WPF performance test

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
MGV
Newbie
Newbie
Posts: 9
Joined: Wed May 23, 2007 12:00 am

WPF performance test

Post by MGV » Fri Feb 20, 2009 2:09 pm

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();



}

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Feb 20, 2009 4:25 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

MGV
Newbie
Newbie
Posts: 9
Joined: Wed May 23, 2007 12:00 am

Post by MGV » Tue Feb 24, 2009 2:17 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Feb 24, 2009 2:26 pm

Hi MGV,

Try calling tChart1.Draw() before retrieving the values.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

MGV
Newbie
Newbie
Posts: 9
Joined: Wed May 23, 2007 12:00 am

Post by MGV » Tue Feb 24, 2009 2:54 pm

this works for winforms version , but does not for WPF

narcis wrote:Hi MGV,

Try calling tChart1.Draw() before retrieving the values.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Feb 24, 2009 3:17 pm

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(); 
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply