Page 1 of 1
Severe performance hit when drawing 100 series
Posted: Fri Jul 17, 2009 11:07 pm
by 14050296
I am using TeeChart WPF version Build 3.5.3470.15475.
My dataset: 32K points * 100 traces
Using FastLine series with DrawAllPoint = True.
Downsampling is set to 4000 points.
Case 1: No performance hit
I can plot these data as a single fastline series with no performance problem. That is I can decimate 3 million points buffer to 4000 for displaying purpose.
Case 2: Severe performance hit
The requirement is that I need to plot up each 32K as an individual series. So I need to create 100 series of 32K each. Applying the same down sampling function as above, the result is that the chart contains 100 series and each is rendered by 4000 points. Here I have huge performance problem.
Question: What do I need to do to achieve good performance in case 2?
Re: Severe performance hit when drawing 100 series
Posted: Mon Jul 20, 2009 12:37 pm
by 10050769
Hello Itang,
I recomend that see Steema Software articles, concretly see
Real-time Charting.
I hope that will helps.
Thanks,
Re: Severe performance hit when drawing 100 series
Posted: Tue Jul 21, 2009 9:16 am
by 10050769
Hello itang,
I have been investigating, and I found a way to improve about 10% speed of WPF chart, using next points:
1.- I put property AutoRepaint= false, initially and after than I added values and created series, I put AutoRepaint= true
2.- I added dates directly using arrays, previously created.
3.- I put DrawAllPoints=false.
Please check that next code works faster than last code if you make.
Code: Select all
public Window1()
{
InitializeComponent();
InitializeForm();
}
Steema.TeeChart.WPF.Styles.FastLine b, b1;
Steema.TeeChart.WPF.Functions.DownSampling down;
private System.Diagnostics.Stopwatch stopWatch;
private double[] yValues, xValues;
private void InitializeForm()
{
stopWatch = new System.Diagnostics.Stopwatch();
stopWatch.Reset();
stopWatch.Start();
tChart1.AutoRepaint = false;
tChart1.Walls.View3D = false;
tChart1.Aspect.View3D = false;
tChart1.Legend.Visible = false;
for (int i = 0; i < 100; i++)
{
CreatArray();
b1 = new Steema.TeeChart.WPF.Styles.FastLine(tChart1.Chart);
b = new Steema.TeeChart.WPF.Styles.FastLine(tChart1.Chart);
down = new Steema.TeeChart.WPF.Functions.DownSampling(tChart1.Chart);
b1.Add(xValues, yValues);
b1.Visible = false;
down.DisplayedPointCount = 4000;
b.DataSource = b1;
b.Function = down;
b.DrawAllPoints = false;
}
tChart1.AfterDraw += new PaintChartEventHandler(tChart1_AfterDraw);
tChart1.AutoRepaint = true;
tChart1.Invalidate();
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.WPF.Drawing.Graphics3D g)
{
TimeSpan elapsedTime = stopWatch.Elapsed;
string total = elapsedTime.TotalSeconds.ToString();
tChart1.Header.Visible = true;
this.Title = "Elapsed time: " + total + " s";
}
private void CreatArray()
{
int length = 32000;
xValues = new double[length];
yValues = new double[length];
Random rnd = new Random();
for (int i = 0; i < length; i++)
{
xValues[i] = i;
yValues[i] = rnd.Next(32000);
}
}
Also, I have added an element for calculate time exaclty, that takes.
I hope will helps.
Thanks,