TContourSeries: slowing down problem

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
FMenges
Newbie
Newbie
Posts: 6
Joined: Thu Dec 12, 2019 12:00 am
Contact:

TContourSeries: slowing down problem

Post by FMenges » Wed Feb 12, 2020 1:06 am

Hi there,

I use a TContourseries to plot 2D spectral data. While hovering with the mouse, it always paints a red higlighted trace for all contours that have the same z value as the current mouse position. With contours of complex shape, this slows down the program extremely. I also use a cursor tool, to let the user extract cross sections, and this gets unusable in this mode. I then have to switch to TColorGridSeries, which doesn't have the problem, obviously.
I really don't need that contours highlighted, but couldn't find a property or method to turn this behaviour off. Any advise?

Here is how I initialize the TContourSeries:
ContourSeries.YPositionLevel:=false;
ContourSeries.NumLevels:=ColorSteps;
ContourSeries.CreateAutoLevels;
ContourSeries.AutomaticLevels:=true;
ContourSeries.Pen.Visible := Grid_Lines;
ContourSeries.Pen.Width := 0;
ContourSeries.Pen.Color:=clSilver;
ContourSeries.Smoothing.Active:=true;
ContourSeries.Smoothing.Factor:=4;
ContourSeries.Filled:=true;
ContourSeries.Brush.Style := bsSolid;
ContourSeries.IrregularGrid:=true;
Attachments
screenshot_highlighted_contourlines.png
screenshot_highlighted_contourlines.png (88.19 KiB) Viewed 16686 times

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: TContourSeries: slowing down problem

Post by Marc » Fri Feb 14, 2020 10:23 am

Hello,

You can set:

Code: Select all

Chart1.Hover.Visible := False;
Regards,
Marc Meumann
Steema Support

FMenges
Newbie
Newbie
Posts: 6
Joined: Thu Dec 12, 2019 12:00 am
Contact:

Re: TContourSeries: slowing down problem

Post by FMenges » Fri Feb 14, 2020 5:51 pm

O.M.G. This is awesome, the speed increase is tremendous. It now reacts nearly realtime even for large data sets (like 1700 x 6500 data points).
Thank you very much!

Are there any other optimizations possible, like those we have for lines series:
Series1 := TFastLineSeries.Create(Self);
Series1.XValues.Order := loNone;
Series1.DrawAllPoints:=false;
Series1.DrawAllPointsStyle:=daMinMax;

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: TContourSeries: slowing down problem

Post by Marc » Mon Feb 17, 2020 3:52 pm

Hello,

Thanks for the feedback, that's useful to know. There are no specific properties that can be used to speed up ContourSeries,

There are a few generic steps/suggestions that can help according to certain circumstance.

- Chart AutoRepaint property. If false the chart will only repaint when you demand it to via a Chart.Repaint. Fr some data operations that may be desirable
- Axis Labels. In some circumstances a fixed Axis increment can speed up the paint cycle.
- Other variables depend on chart setup, to use Pen solid, not dashed lines, to not use Pen at all, to reduce the use of mouse-move events (to reduce any repaint cycles when interacting with the chart)

Regards,
Marc
Steema Support

FMenges
Newbie
Newbie
Posts: 6
Joined: Thu Dec 12, 2019 12:00 am
Contact:

Re: TContourSeries: slowing down problem

Post by FMenges » Tue Feb 18, 2020 12:18 am

Hmm, something like Series1.DrawAllPoints:=false; Series1.DrawAllPointsStyle:=daMinMax; but for 2D display would be so helpful. Obviously, the same principle would apply here, as only as many data points can be visualized as screen pixels are available...
As described, with Hover.Visible:=false, things like moving the CursorTool or moving the Zoom rectangle with the mouse now work instantaneously. Also, using the CursorTool.Onchange event for creating the cross sections works lightning fast for any size of the 2D plot. This is true for both ContourSeries and ColorGridSeries. I found that assigning the data on creation is also reasonably fast, and setting irregular:=false makes no difference for me, as the data has regular spacing (while not using Integer values for XValues and ZValues). I don'T use grid lines, and only solid lines otherwise.

However, every action that involves (re-)painting of the plot becomes tediously slow for my larger arrays. This includes, zooming in or out, panning, using TAxisScrollTool, TAxisScrollbar and the like. A simple refresh for a TColorGridseries takes 19 seconds for the big 1700 x 6500... Quite a lot for a 500x1200 pixel image...
While I don't understand enough, this thread seems very interesting to me: viewtopic.php?f=4&t=3316 It is from 2006 and from the .NET section... Could you confirm, that these improvements in speed and efficiency were als implemented for the VCL version?

I think I have to look into reducing the number of data points towards the chart size in pixels before adding the array, and the re-add an updated section every time when a pan or zoom happens. Quite sure this will be faster than waiting for chart refreshing with the whole data set inside. It is just that I might loose something in the display, which si why I was asking for a daMinMax option...

Best,
Friedrich

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: TContourSeries: slowing down problem

Post by Marc » Fri Feb 21, 2020 5:18 pm

Hello Friedrich,

Yes, the viewtopic.php?f=4&t=3316 was an interesting discussion. Though many of the issues are somewhat different for Delphi, which is unmanaged and much faster by nature, it merits a deeper look. Your point about DrawAll could be worth investigation time; not sure yet how feasible it might be. Adding data by array will also be quicker but won't speed up the repaints.

We'll take a closer look.
Regards,
Marc
Steema Support

Post Reply