Page 1 of 1

how can I improve the performance of the chart with fastline

Posted: Sat Mar 23, 2013 9:57 am
by 15663355
Hello,

I have already asked the question on stack overflow. but comments were getting long , so I am posting the question here.
http://stackoverflow.com/questions/1551 ... rt-refresh
I have 16 graphs[maximum ] with 4 fastlines in each graph. In each graph 3 fastlines represent min , max and ideal value. 4th fastline is actual values from the hardware. I have to run the test for 18,000 samples. So , first 3 fastlines are already drawn and when the switch is on and data comes in , 4th fastline is drawn. In order to draw the 4th line, I use the method Series4.Add(actualvalue, "" , color.red) . here is the problem. each time the sample is drawn on 4th line. chart has to be refreshed in order to view the plotting of that sample. that also redraws the other 3 fastlines with 18,000 samples in each . so it redraws that many samples without use again and again. I need to draw only 4th fastline. I can not use an array to fill the values up and then assign it as a source of fastline because I dont have any values beforehand. I tried series4.repaint() method and series4.refreshseries() method, but that doesnt repaint 4th series actually. we have to refresh the whole chart. and therefore, it slows down the performance because of high number of samples in each fastline [18,000] and one graph with 4 fastlines and total 16 graphs like this.

I ve already done Series4.AutoRepaint = false, Series4.DrawAllPoints = false; Series4.XValues.Order = ValueListOrder.None , Series4.YValues.Order = ValueListOrder.None

Is there any way I can increase the performance ?I can not make other 3 lines invisible. I would want to see position of the 4th line in real time with min max and ideal limits. so after making them invisible, it draws at an excellent speed. but i can not hide other 3 lines. so, I can not do fastline.visible= false and fastline.active= false. seems like active and visible serve the same purpose. is there a way i can use fastline.draw() , fastline.repaint(), fastline.refreshseries() to update only 4th line [ without doing chart.refresh] ?
i did this in order to implement direct2d. no improvements.am I missing anything?
Chart1.Graphics3D = new Graphics3DDirect2D(Chart1.Chart);
Chart1.Aspect.TextRenderingHint =TextRenderingHint.SingleBitPerPixel;
Chart1.Aspect.SmoothingMode = SmoothingMode.HighSpeed;
Chart1.Graphics3D.BufferStyle = BufferStyle.None;
Chart1.Graphics3D.SupportsID=false;
Chart1.Graphics3D.Supports3DText=false;
Chart1.Graphics3D.TextRenderingHint= TextRenderingHint.SingleBitPerPixel;
Chart1.Graphics3D.SmoothingMode = SmoothingMode.HighSpeed;
here is the link to my project .
https://www.dropbox.com/s/k8mbd4hcqd2vp6u/Pro.zip
Please go through the read me file first.you will have to add teechart and slimdx references in the project.
I have made a project in the way that chart is a child window. so you can do all the modifications in childwin.cs and its designer. main file gets the data from demo file and save it into array and includes timer.
for the large number of samples, if you make other 3 series visible= false, active = false, then performance will improve and transition will be smooth. but certainly I want smooth transition without hiding other series.
Thanks !

Re: how can I improve the performance of the chart with fastline

Posted: Mon Mar 25, 2013 4:20 pm
by 10050769
Hello Saumil,


I have work wit your project and I try to give you an answer asap.

Thanks,

Re: how can I improve the performance of the chart with fastline

Posted: Tue Mar 26, 2013 9:22 am
by 15663355
Sure ,
Thanks !

Re: how can I improve the performance of the chart with fastline

Posted: Thu Mar 28, 2013 4:20 am
by 15663355
Sandra,

Any solution?

Re: how can I improve the performance of the chart with fastline

Posted: Thu Mar 28, 2013 4:14 pm
by 10050769
Hello Saumil,

Sorry for the delay. After doing many test with your code I have realized that you doesn't add the number of points that indicate to variable NumberOfMinExpectedMaxSamples, for example, if you work with 150 you access many times in the method PlotActualValuesUpToSampleNumber(int SampleNumber) that causes 74000 iterations and produced a considerable decrease of your application performance. My first suggestion is that you redesign your code because only draw the number of values indicates NumberOfMinExpectedMaxSample, one value to iteration. To achieve it I recommend taking a look in TeeChart DemoProjectDirect2D first sample and try to apply the same in your appalication. You can find the demo in similar path as next C:\Program Files\Steema Software\Steema TeeChart for .NET 2012 4.1.2012.01310\Examples\DemoProjectDirect2D.

Thanks,

Re: how can I improve the performance of the chart with fastline

Posted: Fri Mar 29, 2013 5:12 am
by 15663355
Sandra,

I tried to compile it step by step and with number 150.so numberofminexpectedmaxsamples = 150 .SampleNumber comes from real time timer which calculates no of samples collected on the basis of time elapsed. So first time Samplenumber becomes 120 which is less then 150. So, PlotActualValuesUpToSampleNumber(120) is executed and next time in the loop remaining 30 is plotted . when samplenumber = numberofminexpectedmax samples , compiler exists the loop.

I could not find 74000 iterations anywhere. :/

Re: how can I improve the performance of the chart with fastline

Posted: Tue Apr 02, 2013 8:29 am
by narcis
Hi Saumil,

Have you looked at the DemoProjectDirect2D project? Is it performing well at your end? My recommendation would be to use it as the basis for a Direct 2D real-time charting application. Look at it carefully and compare how it differs with your project and remove all parts that could be a bottle neck performance-wise.

Re: how can I improve the performance of the chart with fastline

Posted: Tue Apr 02, 2013 10:50 am
by 15663355
Narcis,

I made few modifications and found an alternate solution. I use minmax function for axes , I set the window of 150 points , and delete every single point outside of window. I use 3 extra series to hold the data.
series1,2,3 actual series [ added in the chart] . tempseries1,2,3 [ to hold the full data of series1,2,3 in the beginning , not in the chart]

I copy 3 series in the beginning of the code[ executed one time only]
Series1.Assign(Series1, tempseries1);
Series2.Assign(Series2, tempseries2);
Series3.Assign(Series3, tempseries3);


Code in the loop.
tempseries1.Assign(tempseries1, Series1);
tempseries2.Assign(tempseries2, Series2);
tempseries3.Assign(tempseries3, Series3);
Chart.Axes.Bottom.SetMinMax(150 * (i), 150 * (i + 1) + 1);
Series1.Delete(150 * (i + 1) + 1, tempseries1.Count - 150 * (i + 1) + 1); // to remove points from max limit to the end
Series2.Delete(150 * (i + 1) + 1, tempseries1.Count - 150 * (i + 1) + 1);
Series3.Delete(150 * (i + 1) + 1, tempseries1.Count - 150 * (i + 1) + 1);
Series1.Delete(0, 150 * (i)); // to remove points from start to min limit
Series2.Delete(0, 150 * (i));
Series3.Delete(0, 150 * (i));

then I do Chart.refresh() later on.
This solves the problem as I have maximum of 150 points in each line at any moment in the chart. and maximum of 4 fastlines. So total number of points in the chart can never go more than 600. this increases the speed rather than keeping 18,000 total points in each line all the time and maximum number of points in the graph 72,000 .

I am already using teechart direct2d and it's canvas in my code.
Thanks for all the help ! :D

Re: how can I improve the performance of the chart with fastline

Posted: Wed Apr 03, 2013 8:44 am
by 10050769
Hello Saumil,

Good news, I am glad that you found alternative solution :D.

Thanks,