Page 1 of 1

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

Posted: Fri Jan 04, 2013 8:17 pm
by 15663355
Hello,
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/artic ... altime.htm
http://www.steema.net/publicnews/steema ... 000000.htm
http://www.teechart.net/support/viewtopic.php?p=47388
http://www.teechart.net/support/viewtopic.php?t=5127
http://www.teechart.net/support/viewtop ... =4&t=10681
http://www.steema.net/publicnews/steema ... 000000.htm
http://stackoverflow.com/questions/1197 ... ith-tchart

All the links shows that this problem was faced by other users too.
I tried injecting data arrays directly into the series . I also tried doing series4.refreshseries() and series4.repaint() instead of chart.refresh() but the chart does not show live changes in the values of series4. I can only see it if I refresh the chart.So, only repainting and refreshing the series does not reflect changes in the graph.
Is there anyway I can just paint,update and refresh one series without refreshing the whole chart to view the changes in the series values? I want to see the changes of the values of only one series, but when I do chart.refresh() , it will redraw other 3 series as well which is creating a big delay and the delay goes high relatively with increase in number of data points.
Lastly, I tried doing series1,series2, series3.active = false and then chart.refresh() to see the series4 changes and It works so fine. but certainly I do not want to hide the other 3 series from the graph.

I have attached the demo project with instructions in it, in which you can change the number of datapoints to include in the graph and the performance delay will vary.
Is there any solution for this?
Project.zip

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

Posted: Mon Jan 07, 2013 12:22 pm
by 10050769
Hello Saumil,

Thanks for your explanation and your project. But we can not execute it to see your problem, because the project is very complex and I have found some problems with NullExeceptions. Would be very helpful for us if you can arrange a simple project for us where we can reproduce your problem with real-time plotting and try to suggest a solution for this.

Thanks,