Fastline issues

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Andy
Newbie
Newbie
Posts: 1
Joined: Mon Feb 21, 2005 5:00 am

Fastline issues

Post by Andy » Tue Apr 05, 2005 2:31 pm

The simple example posted attempts to use the Fastline series

1. A timer is called every seconds and adds a point to a fastline series
2. When the user presses a button 10000 points are added


This is just a sample application to test out a problem.

My problem is that after a large number of points have been added the CPU is using a large amount of time and the windows are hard to drag.

If I manualy scroll the canvas so it does not scroll when adding the 1Hz data then a large CPU time is still used. If I however drag the canvas such that the previoudly generated high frequency data is not displayed then the cpu time reduces.

I have concluded that the add method is not inefficient but the chart is unessarily refreshing previously plotted data even when there is no axis scaling change. This was not the behavoir in the OCX version.

Is there any prospect of your guys looking into this and fixing it? I think it is a simple bug and cant see what you cant provide a method to prevent the chart from repainting when it is not necessary?

Help please

Andy



using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Steema.TeeChart;


namespace TrendTest
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private Steema.TeeChart.TChart tChart1;
private System.Windows.Forms.Timer timer1;
private System.ComponentModel.IContainer components;

private Steema.TeeChart.Styles.FastLine fl;
private Random rnd = new Random();
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
private double x;
private int index = 0;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

tChart1.Legend.Visible = false;
fl = new Steema.TeeChart.Styles.FastLine();
tChart1.Series.Add(fl);
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.tChart1 = new Steema.TeeChart.TChart();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// tChart1
//
//
// tChart1.Header
//
this.tChart1.Header.Lines = new string[] {
"TeeChart"};
this.tChart1.Location = new System.Drawing.Point(16, 16);
this.tChart1.Name = "tChart1";
this.tChart1.Size = new System.Drawing.Size(712, 416);
this.tChart1.TabIndex = 0;
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// button1
//
this.button1.Location = new System.Drawing.Point(232, 448);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(104, 24);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(392, 448);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 24);
this.label1.TabIndex = 2;
this.label1.Text = "label1";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(784, 486);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.Controls.Add(this.tChart1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}


private void timer1_Tick(object sender, System.EventArgs e)
{
double y = rnd.NextDouble();
fl.Add(x, y);
x += 1;
}

private void button1_Click(object sender, System.EventArgs e)
{
double y;
for(int i = 0; i < 10000; i++)
{
y = rnd.NextDouble();
fl.Add(x, y);
x += 0.00005;
}
}

}
}

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Apr 07, 2005 9:54 am

Hi,

how about using the AutoRepaint method ?
You could see some speed tricks in this article about RealTime charting (it's for VCL but the majority of the things can be done in NET) :


RealTime Charting

Post Reply