Page 1 of 1

TScrollpagerTool - Can I delay repainting of the main chart?

Posted: Mon Nov 17, 2014 11:02 am
by 16567885
I have a fancy looking long-term trend with a TScrollpagerTool. On slower machines, scrolling around is not quite smooth. Because of that, I'd like to block auto-repainting the main chart until the mousebutton is released.

Is that possible?

Re: TScrollpagerTool - Can I delay repainting of the main chart?

Posted: Mon Nov 17, 2014 11:35 am
by yeray
Hi Jens,

The problem is you can't repaint the chart below, the subchart, without repainting the main chart.
So you can do this, but this way you don't see where are you dragging the ColorBand below until you release the mouse:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  ChartTool1.SubChartTChart.OnMouseDown:=ScrollChartMouseDown;
  ChartTool1.SubChartTChart.OnMouseUp:=ScrollChartMouseUp;
end;

procedure TForm1.ScrollChartMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X: Integer; Y: Integer);
begin
  Chart1.AutoRepaint:=false;
end;

procedure TForm1.ScrollChartMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X: Integer; Y: Integer);
begin
  Chart1.AutoRepaint:=false;
  Chart1.Draw;
end;

Re: TScrollpagerTool - Can I delay repainting of the main chart?

Posted: Mon Nov 17, 2014 7:40 pm
by 16567885
Understood, thanks.

Re: TScrollpagerTool - Can I delay repainting of the main chart?

Posted: Tue Nov 18, 2014 8:59 am
by yeray
Hi Jens,

Another alternative would be using two independent TChart, place one above the other, add a series on one of them, clone it on the other, add a colorband tool at the chart on the bottom and use the events to synchronize both charts as you wish.

Re: TScrollpagerTool - Can I delay repainting of the main chart?

Posted: Tue Nov 18, 2014 10:22 am
by 16567885
Yes, I also thought of that. But I'm lazy. Why would I do that if I can also lean back, just use a TScrollpagerTool and let TeeChart do the work? :D

I probably should rather investigate the performance issue for this chart than trying to make it less obvious. Thanks for your help, as always.