Page 1 of 1

TChartEditor response time

Posted: Wed Apr 22, 2015 6:08 pm
by 16569987
Hi,

When the chart shows e.g. million data points, the chart editor becomes so slow that users think the software has crashed. With the chart editor's AutoRepaint property set to True, then just changing the series title causes many seconds of delay while the whole chart is redrawn. With the AutoRepaint property set to False, the chart closes and the application seems to hang while the chart is updated. In either mode the user has no visible indication that anything is happening, and the TChartEditor offers no events that we can use to show a wait cursor.

Is there anything that can be done to speed up chart regeneration? Are there other chart properties that can be set to improve performance? If we're changing only the series title through the chart editor, then only the legend needs to be redrawn, and that should be really quick.

Alternatively, could the TChartEditor support more events so that we can keep users informed during time-consuming operations?

Thanks for any advice.

Toreba

Re: TChartEditor response time

Posted: Thu Apr 23, 2015 8:44 am
by yeray
Hi Toreba,

First of all, I'd suggest you to carefully read the post here.

Regarding the Editor, we always recommend to not allow the final user to access it. Note the editor is a tool designed to help the developers to build their charts writing less code; with the years, this tool has grown in complexity and it's quite easy to end in inconsistent configurations if manipulated by the wrong hands.

Regarding the legend repaints, I'm afraid chart and the legend are more linked than that and it would be difficult to separate their drawing routines. Ie, note the series title can be shown in the series marks, so changing the title needs to repaint the whole series.

Adding events to all the actions possible in the editor, or to all the actions that force a chart repaint, would be a lot of events.

I'd suggest you implement any tip possible for you from those in the post mentioned above. Also, you could change the cursor at OnBeforeDrawSeries and restore it at OnAfterDraw:

Code: Select all

procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
begin
  Screen.Cursor:=crHourGlass;
end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
  Screen.Cursor:=crDefault;
end;

Re: TChartEditor response time

Posted: Thu Apr 23, 2015 1:18 pm
by 16569987
Yeray,

That's very helpful, thanks for your advice. I will certainly experiment with the options.

The chart editor is too useful to deny to users! Does the TChart version 'with source' include the source for the TChartEditor? Could I add events myself, and customize in other ways?

Regards

Toreba

Re: TChartEditor response time

Posted: Thu Apr 23, 2015 2:14 pm
by yeray
Hello Toreba,
toreba wrote:The chart editor is too useful to deny to users!
It's useful, but too complicate for a regular user expecting things to be intuitive (IMHO).
toreba wrote:Does the TChart version 'with source' include the source for the TChartEditor? Could I add events myself, and customize in other ways?
Indeed!