Severe performance hit when drawing 100 series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
ltang
Newbie
Newbie
Posts: 8
Joined: Mon Sep 15, 2008 12:00 am
Contact:

Severe performance hit when drawing 100 series

Post by ltang » Fri Jul 17, 2009 11:07 pm

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?

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Severe performance hit when drawing 100 series

Post by Sandra » Mon Jul 20, 2009 12:37 pm

Hello Itang,

I recomend that see Steema Software articles, concretly see Real-time Charting.

I hope that will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Severe performance hit when drawing 100 series

Post by Sandra » Tue Jul 21, 2009 9:16 am

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,
Best Regards,
Sandra Pazos / 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