Page 1 of 1
WPF performance test
Posted: Fri Feb 20, 2009 2:09 pm
by 14045274
Hello
we have very small speed of zoom and move operations with WPF Chart:(
version :3.5.3274.30663
can you increase performance ?
private void button2_Click(object sender, RoutedEventArgs e)
{
tChart1.Aspect.View3D = false;
int SerCnt = 20;
int PtCnt = 48 * 30;
for (int i = 1; i <= SerCnt; i++)
{
Line Ser = new Line();
Ser.Pointer.Visible = false;
Ser.Pointer.Style = PointerStyles.Circle;
Ser.Pointer.VertSize = 2;
Ser.Pointer.HorizSize = 2;
tChart1.Series.Add(Ser);
Ser.FillSampleValues(PtCnt);
}
int SeriesCount = 0;
int PointCount = 0;
foreach (Series s in tChart1.Series)
{
SeriesCount++;
PointCount = PointCount + s.Count;
}
tChart1.Chart.Header.Text = "Total series : " + SeriesCount.ToString() + "; Total points : " + PointCount.ToString();
}
Posted: Fri Feb 20, 2009 4:25 pm
by narcis
Hi MGV,
First of all please notice there are much newer versions available:
http://www.teechart.net/support/viewtopic.php?t=9220
Regarding your technical question, we are constantly working in increasing TeeChart.WPF.dll performance.
WPF is slower than GDI+ and WinForms applications. Although WPF is faster in some areas, such as painting, it is slower in other areas as extra objects have to be created to be passed to the painting method. All WPF pen objects expect a brush to define their appearance. This makes pens very flexible, but means that just to set a pen to a red color, for example, a new brush has to be created. On balance, therefore, as for the investigation and tests we have done so far, we do not expect the WPF chart to be as quick as the GDI+ chart for large datasets. We don’t think WPF was designed for intensive drawing, it was designed for aesthetic drawing. Does a similar WinForms application has same performance?
For enhancing your applications performance you could try implementing hints provided in the
Real-time Charting article
here.
You could also filter your data using DownSampling function as shown in the
All Features\Welcome !\Functions\Extended\Reducing number of points examples at the features demo, available at TeeChart's program group.
BTW: Please notice that SeriesCount variable in your foreach loop is unnecessary as TeeChart already has tChart1.Series.Count property.
Posted: Tue Feb 24, 2009 2:17 pm
by 14045274
thank you
one more question :
private void tChart1_Zoomed(object sender, EventArgs e)
{
int f = tChart1.Chart.Series[0].FirstVisibleIndex; // --always returned 0
int l = tChart1.Chart.Series[0].LastVisibleIndex; // --always returned Series[0].Count-1
textBox1.Text = textBox1.Text + "\n" + f.ToString() + " " + l.ToString();
}
f and l values are not correct
Posted: Tue Feb 24, 2009 2:26 pm
by narcis
Hi MGV,
Try calling tChart1.Draw() before retrieving the values.
Posted: Tue Feb 24, 2009 2:54 pm
by 14045274
this works for winforms version , but does not for WPF
narcis wrote:Hi MGV,
Try calling tChart1.Draw() before retrieving the values.
Posted: Tue Feb 24, 2009 3:17 pm
by narcis
Hi MGV,
Sorry, in WPF version you need to do this:
Code: Select all
void tChart1_Zoomed(object sender, EventArgs e)
{
BitmapSource bmp = tChart1.Chart.Bitmap();
int f = tChart1.Chart.Series[0].FirstVisibleIndex;
int l = tChart1.Chart.Series[0].LastVisibleIndex;
textBox1.Text = f.ToString() + " " + l.ToString();
}