Page 1 of 1

Horizontal Line - Large Number of data points

Posted: Tue Nov 24, 2009 7:05 am
by 13050267
Hi,

We are using TeeChart for .NET Ver 3.5 in our application. We have the feature requirement which requires plotting of about 500000 data points in horizontal line. I have successfully tried this with FastLine series and it works. But it takes very long time plotting this much data points in horizontal line series.

My question is, can TeeChart horizontal line series handle half a million (or maybe more) data points effectively? Please guide me whether its possible with TeeChart or not.

Nitin

Re: Horizontal Line - Large Number of data points

Posted: Wed Nov 25, 2009 3:27 pm
by yeray
Hi Nitin,

Please take a look at the Real-time Charting article here where some tips for improving the performance are explained.

Re: Horizontal Line - Large Number of data points

Posted: Thu Nov 26, 2009 4:57 am
by 13050267
Hi Yeray,

Thanks for the reply. I have already gone through the article and as I said, it works with FastLine series. But fast line series is vertical line series, where my requirement is to plot data in Horizontal Line Series. How can I speed up horizontal line series.

Re: Horizontal Line - Large Number of data points

Posted: Fri Nov 27, 2009 4:39 pm
by yeray
Hi Nitin,

Have you tried using a FastLine series to draw the Horizontal line? If yes, what problems did you found?
Please, take a look at the following example where the same line is drawn using an HorizLine and a FasLine:

Code: Select all

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }

        int nSamples;
        int[] XVal;
        int[] YVal;

        private void InitializeChart()
        {
            nSamples = 500000;
            XVal = new int[nSamples];
            YVal = new int[nSamples];
            Random rnd = new Random();

            XVal[0] = 0;
            YVal[0] = rnd.Next(100);            
            for (int i = 1; i < nSamples; i++)
			{
                XVal[i] = i;
                YVal[i] = YVal[i - 1] + rnd.Next(10) - 5;
			}

            CreateAndFillSeries();
        }

        private void CreateAndFillSeries()
        {            
            if (tChart1.Series.Count > 0)            
                if (tChart1[0] is Steema.TeeChart.Styles.FastLine) HorizLine();
                else FastLine();            
            else FastLine();            
        }

        private void FastLine()
        {
            tChart1.Clear();
            tChart1.Aspect.View3D = false;
            tChart1.Legend.Visible = false;
            tChart1.Header.Text = "FastLine";
            Steema.TeeChart.Styles.FastLine fastLine1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
            fastLine1.Add(YVal, XVal);
        }

        private void HorizLine()
        {
            tChart1.Clear();
            tChart1.Aspect.View3D = false;
            tChart1.Legend.Visible = false;
            tChart1.Header.Text = "HorizLine";
            Steema.TeeChart.Styles.HorizLine horizLine1 = new Steema.TeeChart.Styles.HorizLine(tChart1.Chart);
            horizLine1.Add(YVal, XVal);            
        }        

        private void button1_Click(object sender, EventArgs e)
        {
            CreateAndFillSeries();
        }
    }

Re: Horizontal Line - Large Number of data points

Posted: Sat Nov 28, 2009 5:05 am
by 13050267
Hi Yeray,

Thanks for the code. I didn't know this thing. It works and takes only a second to plot the data.

Thank you very much.

Nitin

Re: Horizontal Line - Large Number of data points

Posted: Mon Nov 30, 2009 11:23 am
by yeray
Hi Nitin,

I'm pleased to have been helpful!