Slow TChart with several lines...

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Whookie
Newbie
Newbie
Posts: 25
Joined: Fri Jan 07, 2011 12:00 am

Slow TChart with several lines...

Post by Whookie » Tue Apr 01, 2014 5:50 pm

I have enclosed a demo project (using XE5 and latest release but checked with older (2013) versions of TChart too) which adds a punch of lines and then gives feedback by moving over an image. The problem is, that the response of that feedback gets slow with additional lines added.

Instructions:
1. Please compile and run the appliction (maximize it!!! -> the bigger the screen the greater the effect is)
2. Move over the image in the bottom/left corner. A "cursor"-series will appear, which moves pretty fast (as expected). Trying to move in horizontal lines will give the impression of a moving sinus to some extent. Please use only the upper half of the image and try to move quickly ...
3. Press "Add Dataset.." button (top/left) and try to move around over the image (see pt. 2)
4. Repeat pt 3 until the "Add DataSet.." button gets grayed out. This adds 10 sets of lines but TChart shows only the average value of the sets and for the current set an aura is shown with all the minima and maximas of that set.
At this stage the "cursor"-series has a little bit of a lag already - but that would be acceptable.
5. Try to use the "Select set" dropdown box and select set #1 to see the aura is very small with this set. Try all the other sets to get an impression and then return to set #1.
6. Press the "Edit" button beside the "Select set" box and all the lines the current set consists off, will be displayed. In addition the "Select line" dropdown box is filled with numbers corresponding to those lines and the first one is selected (and high-lightened in the chart). Selecting other lines (drop down the list and select line number 5 for example, will change the line in the chart too).
7. Moving over the image (like in pt. 2) will show the "cursor"-series again and gives you an impression of responseness of that series.
8. Select the next set (eg. "Set #2") and press the "Edit"-button again and repeat pt. 7
At "set #5" things start to get really slower and at set #8 (240 lines) movement of the cursor-series and the mouse on the image have great lag. At set #9 it gets unbearable and at set #10 its so slow that the "curser"-series just jumps to a few lines when moving over the image.

That behavior might come from inefficient usage of the component and so I'm asking,
if you can help me to have better response (preferable speeds like with set #3) for sets with up to 500 lines?

Please note, that there are some parts left out in the demo. In the real application moving over the TChart series in "edit"-mode a cursor is shown on the image whenever a line of data is found beneath the mouse (as data isnt random then and each line in the chart corresponds to a destinct location in the image)...

TIA
Whookie
Attachments
SlowTChart.7z
(5.61 KiB) Downloaded 648 times

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Slow TChart with several lines...

Post by Yeray » Wed Apr 02, 2014 2:00 pm

Hello,

Some things you could try:

- Move from GDI+ to GDI. Add this at FormCreate:

Code: Select all

  Chart1.Canvas:=TTeeCanvas3D.Create;
- Use TFastLineSeries instead of TLineSeries.
This really gives a faster result for me here changing all the Lines to FastLines and setting these properties for all the FastLines:

Code: Select all

    DrawAllPoints:=false;
    FastPen:=true;
    DrawStyle:=flAll;
Also see this:
http://www.teechart.net/support/viewtop ... 066#p65066
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Whookie
Newbie
Newbie
Posts: 28
Joined: Fri Sep 24, 2004 4:00 am

Re: Slow TChart with several lines...

Post by Whookie » Wed Apr 02, 2014 2:52 pm

Hi Yeray,
I'm sorry to bother you again but:

I tried to use GDI instead of GDI+ earlier but it didn't work because there is no transparency with GDI so the hole point with the aura isnt working (if you are not aware of that, please just try it with my example)...

I also tried to use TFastLineSeries but as I mentionted in my notes, there is more to my application and all the Series need to be clickable and TFastLineSeries is missing that properties...

It also seems that all the properties you mention are not part of TLineSeries (DrawAllPoints, FastPen, DrawStyle)...

In the link you provided they are talking of a million of points but in contrast I just have 400 lines of 320 points which gives just 128000 data points so I'm stuck with my problem again...

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Slow TChart with several lines...

Post by Yeray » Thu Apr 03, 2014 12:17 pm

Hi,
Whookie wrote:I tried to use GDI instead of GDI+ earlier but it didn't work because there is no transparency with GDI so the hole point with the aura isnt working (if you are not aware of that, please just try it with my example)...
I've added it to the tracker:
http://bugs.teechart.net/show_bug.cgi?id=696
Feel free to add your mail to the CC list to be automatically notified when an update arrives.
Whookie wrote:I also tried to use TFastLineSeries but as I mentionted in my notes, there is more to my application and all the Series need to be clickable and TFastLineSeries is missing that properties...
You could try to implement this yourself for the TFastLineSeries. You could use the Chart OnMouseMove event to loop all the series and interrogate the series Clicked function to see if anyone is under the mouse.
However, I'm not sure if this will work fine once DrawAllPoints will be set to false.
Whookie wrote:It also seems that all the properties you mention are not part of TLineSeries (DrawAllPoints, FastPen, DrawStyle)...
Exactly. I suggested you to move to TFastLineSeries to get access to these properties.
Whookie wrote:In the link you provided they are talking of a million of points but in contrast I just have 400 lines of 320 points which gives just 128000 data points so I'm stuck with my problem again...
GDI+ is slower than GDI in some circumstances. Transparencies is one of the features afecting the performance.
As an alternative to TFastLineSeries and its DrawAllPoints property, I'd suggest you to give a try to the TDownSampling function that works without problems with TLineSeries. See the example at "All features\Welcome !\Functions\Extended\Reducing number of points" in the features demo to understand how this function works.

I'd also suggest you to take a look at the examples under "All features\Welcome !\Speed".
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply