Page 1 of 1

Scrolling ColorGrid

Posted: Thu Feb 08, 2007 12:57 pm
by 8120359
Hi,

I've been trying to implement a 'scrolling' ColorGrid with teeChart v2, that is when new values are added to the colorgrid, the old values from the top should be deleted, so fixed number of rows would always be visible.
What is the recommended way to remove data from colorgrid? I've tried the ColorGrid.Delete method, but it seems to fail with index out of range when e.g. colorGrid1.Delete(0,100,true) is used. When the boolean parameter omitted, that deletes items from two separate locations on the colorgrid (on top and bottom row).

Posted: Fri Feb 09, 2007 9:39 am
by narcis
Hi HQO,

I could reproduce the issue here and this seems to be a bug. I've added it (TF02012067) to our defect list to be fixed for future releases.

In the meantime, a workaround can be not removing series rows but modifying left axis scales, for example:

Code: Select all

		private Steema.TeeChart.Styles.ColorGrid colorGrid1;
		private int count = 0;
		private int NumColumns = 10;
		private int NumRows = 10;

		private void Form1_Load(object sender, EventArgs e)
		{
			colorGrid1 = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);

			tChart1.Axes.Left.Inverted = true;
			timer1.Enabled = true;
		}

		private void timer1_Tick(object sender, EventArgs e)
		{
			Random Y = new Random();

			for (int x = 0; x < NumColumns; x++)
			{
				colorGrid1.Add(x, Y.Next(1000), count);
			}

			count++;

			if (count > NumRows)
			{
				//colorGrid1.Delete(0, NumColumns);
				tChart1.Axes.Left.SetMinMax(count - NumRows, count);
			}
		}