how to improve performance of Tchart in real-time plotting?

送分小仙女□ 提交于 2019-12-12 05:15:37

问题


I am developing an application which has minimum one tchart with 4 fastlines in it . maximum number of tcharts are 16 depending on few criteria.each fastline contains different sample numbers in different cases. here is the problem now. If I have sample number less than 200-250. then I can see the graph is being plotted real-time. now as the sample number increases the delay goes so long in plotting the graph. so let's say if we have 1000 samples for each fasline then total of 4000 samples in chart. and there can be maximum 16 charts like this. I noticed that delay is highly dependent on number of samples fastline contains and number of fastlines in the chart. I already made changes regarding autorepaint = false. I have chart1.autorepaint = false series1.autorepaint = false and also series 2 , 3, 4. each time I add a value in fastline , I have to manually do chart1.refresh() which takes so much time again as it refreshes all the 4 fastlines in it. Delay can also be related to series1.add(), but I am not sure. Is there anything I can do to avoid the delays ?

Here is the code I am using .

    public void PlotActualValuesUpToSampleNumber(int SampleNumber)
     {      
            int DataPoint;
            Chart1.AutoRepaint = false;
            for (DataPoint = LastActualSamplePlotted + 1; DataPoint <= SampleNumber; DataPoint ++ )
            {

                    if (Imp.ThisSampleContainsFault[ChannelNumber, DataPoint])
                    {

                        Chart1.Panel.Gradient.Visible = false;
                        Chart1.Panel.Color = Imp.ChartBackgroundColorIfFault;

                    }

                    Series4.Add(Imp.ActualValue[ChannelNumber, DataPoint], "", Color.Yellow);

                   LastActualSamplePlotted ++;

            }
            Chart1.Refresh();
            Chart1.AutoRepaint = true;               
     }

Is there anything I can do to avoid the delays? I already referred to these links. http://www.teechart.net/reference/articles/VCLRealtime.htm http://www.teechart.net/support/viewtopic.php?p=47388 http://www.teechart.net/support/viewtopic.php?t=5127 http://stackoverflow.com/questions/11977423/performance-issue-with-tchart

but no success.


回答1:


Performance is mainly affected by the amount of data the chart has to handle. Different code solutions and environments may also be pretty influential here. So my suggestions are:

  1. Have you tried injecting data arrays directly into the series as the second example Sandra posted here? This is the same principle as in the VCL Real-time Charting article.

  2. have you tried the Direct 2D version of TeeChart? You can find a white paper regarding its performance here.

  3. I'd strongly recommend you to check the examples at the sections below in the features demo available at TeeChart's program group.

*All Features\Welcome !\Chart styles\Standard\Fast Line*

All Features\Welcome !\Speed

If you still don't get the results you expected please send us a simple example project we can run "as-is" to reproduce the problem here.



来源:https://stackoverflow.com/questions/14124751/how-to-improve-performance-of-tchart-in-real-time-plotting

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!