Realtime curve with windows mobile 5

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
hchiker
Newbie
Newbie
Posts: 5
Joined: Mon Mar 23, 2009 12:00 am

Realtime curve with windows mobile 5

Post by hchiker » Tue Aug 25, 2009 1:01 pm

Hi,
I use TeeChart .net 3 with VS2005 on a Pocket PC with windows mobile 5. I try to display a curve every 500 ms using FasLine type but the dynamic performance are so Bad (1.5 s or 1s in the best case) ! Is there a way to Have a "realtime" display?

thanks

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

Re: Realtime curve with windows mobile 5

Post by Narcís » Tue Aug 25, 2009 2:08 pm

Hi hchiker,

You could do something as in the example below. You could implement the button code in timer's event and modify it to fit your needs.

Code: Select all

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

  int nrOfSamples = 1000000;
  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

hchiker
Newbie
Newbie
Posts: 5
Joined: Mon Mar 23, 2009 12:00 am

Re: Realtime curve with windows mobile 5

Post by hchiker » Tue Aug 25, 2009 2:32 pm

Hi,
thanks for your answer.
I have a similar code for update the chart and it works fine on PC but the pocket version is too slow. Can I add some improvment for the TeeChart.Pocket version ?
Thanks

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

Re: Realtime curve with windows mobile 5

Post by Narcís » Wed Aug 26, 2009 8:15 am

Hi hchiker,

Can you please send us a simple example project we can run "as-is" so that we can try to optimize it?

Thanks in advance.
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