Page 1 of 1

TContourSeries: slowing down problem

Posted: Wed Feb 12, 2020 1:06 am
by 16587594
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;

Re: TContourSeries: slowing down problem

Posted: Fri Feb 14, 2020 10:23 am
by Marc
Hello,

You can set:

Code: Select all

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

Re: TContourSeries: slowing down problem

Posted: Fri Feb 14, 2020 5:51 pm
by 16587594
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;

Re: TContourSeries: slowing down problem

Posted: Mon Feb 17, 2020 3:52 pm
by Marc
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

Re: TContourSeries: slowing down problem

Posted: Tue Feb 18, 2020 12:18 am
by 16587594
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

Re: TContourSeries: slowing down problem

Posted: Fri Feb 21, 2020 5:18 pm
by Marc
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