plot more data points.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
cs_ech
Newbie
Newbie
Posts: 14
Joined: Mon Oct 02, 2006 12:00 am

plot more data points.

Post by cs_ech » Tue Sep 01, 2009 9:29 pm

I am querying from a database and plotting the retrieved data.
The query on an average returns around 10 million data points.
I am currently not able to plot them all.
Please advice.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: plot more data points.

Post by Yeray » Wed Sep 02, 2009 12:00 pm

Hi cs_ech,

A first possibility, if you are using a FastLine series, would be setting DrawAllPoints property to false to reduce the number of points to draw.

Another possibility would be using the provided DownSampling function. Please, see the All Features\Welcome !\Functions\Extended\Reducing number of points example demo from New Features Demo (you should find it at TeeChart program's group).

And, of course, it would be also good if you could manually reduce the number of points applying your own filter before adding the points to the series.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

cs_ech
Newbie
Newbie
Posts: 14
Joined: Mon Oct 02, 2006 12:00 am

Re: plot more data points.

Post by cs_ech » Wed Sep 02, 2009 9:14 pm

hi,
I am not using FastLine series but a point graph.
I was unable to activate the paging property.
Out of the 10 million data points, I am only able to plot 1000 points in one page.

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

Re: plot more data points.

Post by Narcís » Thu Sep 03, 2009 8:28 am

Hi cs_ech,

FastLine series are the fastest in TeeChart. I strongly suggest you to do something as in the example below. If you can't use FastLine then remove all properties that are exclusive to that series. Anyway, and as Yeray suggested, DownSampling function can also be applied to Points series.

Code: Select all

  public Form1()
  {
   InitializeComponent();
   InitializeChart();
  }

  int nrOfSamples = 25000000;
  private Steema.TeeChart.Styles.FastLine fastline1;
  private System.Diagnostics.Stopwatch stopWatch;

  private void InitializeChart()
  {
   stopWatch = new System.Diagnostics.Stopwatch();

   tChart1.Aspect.View3D = false;
   tChart1.Aspect.SmoothingMode = 
System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
   tChart1.Legend.Visible = false;
   tChart1.Axes.Bottom.SetMinMax(0, nrOfSamples);

   fastline1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);

   //pre-assign ChartPens
   Pen rPen = new Pen(Color.Red);
   Steema.TeeChart.Drawing.ChartPen redPen = new 
Steema.TeeChart.Drawing.ChartPen(tChart1.Chart, rPen);
   fastline1.LinePen = redPen;
   fastline1.DrawAllPoints = false;
   fastline1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.None;

   tChart1.AfterDraw += new 
Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
  }

  void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D 
g)
  {
   //calculate elapsed time
   //stopWatch.Stop();
   TimeSpan elapsedTime = stopWatch.Elapsed;
   string total = elapsedTime.TotalSeconds.ToString();
   label1.Text = "Elapsed time: " + total + " s";
  }

  private void button1_Click(object sender, EventArgs e)
  {
   button1.Enabled = false;

   stopWatch.Reset();
   stopWatch.Start();

   tChart1.AutoRepaint = false;

   double[] x1 = new double[nrOfSamples];
   for (int i = 0; i < x1.Length; i++)
   {
    x1[i] = i;
   }

   double[] random1 = new double[nrOfSamples];

   FillArray(random1);
   //fastline1.Add(x1, random1);

   fastline1.XValues.Value = x1;
   fastline1.XValues.Count = nrOfSamples;

   fastline1.YValues.Value = random1;
   fastline1.YValues.Count = nrOfSamples;

   tChart1.AutoRepaint = true;
   tChart1.Refresh();
   Application.DoEvents();

   stopWatch.Stop();

   button1.Enabled = true;
  }

  private static void FillArray(double[] myArray)
  {
   Random y = new Random();
   for (int i = 0; i < myArray.Length; i++)
   {
    myArray[i] = y.Next();
   }
  }
Hope this helps!
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

cs_ech
Newbie
Newbie
Posts: 14
Joined: Mon Oct 02, 2006 12:00 am

Re: plot more data points.

Post by cs_ech » Mon Sep 14, 2009 10:15 pm

This code gives me following errors:

Steema.TeeChart.Drawing.ChartPen redPen = new Steema.TeeChart.Drawing.ChartPen(tChart1.Chart, rPen);
The best overloaded method match for 'Steema.TeeChart.Drawing.ChartPen.ChartPen(Steema.TeeChart.Chart, bool)' has some invalid arguments

Steema.TeeChart.Drawing.ChartPen redPen = new Steema.TeeChart.Drawing.ChartPen(tChart1.Chart, rPen);
Argument '2': cannot convert from 'System.Drawing.Pen' to 'bool'

fastline1.LinePen = redPen;
Property or indexer 'Steema.TeeChart.Styles.BaseLine.LinePen' cannot be assigned to -- it is read only

label1.Text = "Elapsed time: " + total + " s";
The name 'label1' does not exist in the current context

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

Re: plot more data points.

Post by Narcís » Tue Sep 15, 2009 7:57 am

Hi cs_ech,
Steema.TeeChart.Drawing.ChartPen redPen = new Steema.TeeChart.Drawing.ChartPen(tChart1.Chart, rPen);
The best overloaded method match for 'Steema.TeeChart.Drawing.ChartPen.ChartPen(Steema.TeeChart.Chart, bool)' has some invalid arguments

Steema.TeeChart.Drawing.ChartPen redPen = new Steema.TeeChart.Drawing.ChartPen(tChart1.Chart, rPen);
Argument '2': cannot convert from 'System.Drawing.Pen' to 'bool'

fastline1.LinePen = redPen;
Property or indexer 'Steema.TeeChart.Styles.BaseLine.LinePen' cannot be assigned to -- it is read only
As I told you in my previous reply, some of those properties are exclusive to FastLine series. If you are using Points series you'll have to remove them.
label1.Text = "Elapsed time: " + total + " s";
The name 'label1' does not exist in the current context
You just need to drop a Label at your form and call it label1 to get this working.
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