Performance Issue with TChart

2019-09-16 01:18发布

问题:

I'm using Steema TChart in my application. I use this component to chart a line graph, typically containing 1,000 to 2,000 data points, realtime as the data points become available. A typical line takes about 30 seconds to complete.

After my 2nd or 3rd line is being generated, the TChart component reaches a point where the processor is being pegged. Even though the chart is being updated, other UI updates are being drastically affected by the redraw that the chart must be performing each time a new data point is added. I've experimented and found that if I don't show the chart while a line is being plotted (the chart is on a separate tab on the window; however it is not currently displayed) I have much better performance and the processor usage goes down dramatically.

Has anyone found ways to use this component and have better performance?

回答1:

In that case probably asynchronous painting technique, using AutoRepaint property as suggested in this thread, will help enhancing your system's performance. Basically you need to set Autorepaint to false to prevent the chart repainting after adding a point and set it back to true and call refresh when data addition has finished.

The Real-time Charting article here may also help improving your TeeChart application's performance. This is a Delphi article but most of it can be applied to the .NET version of TeeChart also.

Last but not least, TeeChart for .NET ships with a Direct2D rendering engine. This is ideal for the high speed data throughput required by DSP realtime applications. See the White paper, Boosting graphics-rendering performance in Windows Forms, for a closer look.