Page 1 of 1
ColorGrid and CursorTool
Posted: Tue Jan 19, 2010 4:01 am
by 13045490
Hi,
I have a ColorGrid that I added a CursorTool to. I would like to display the x,y,z value of the cursor location. I implemented the cursorTool_Changed method and get the correct (x,y) values using e.XValue and e.YValue. However I do not know how to get the z value. I also noticed that Steema.TeeChart.Tools.CursorChangeEventArgs passes in an e.ValueIndex but it is always zero. How come the ValueIndex is not the same as in the cusor click method or why doesn't the following work:
double x = colorGrid1.XValues.Value[e.ValueIndex];
double y = colorGrid1.YValues.Value[e.ValueIndex];
double z = colorGrid1.ZValues.Value[e.ValueIndex];
Thanks
John Fraschilla
Re: ColorGrid and CursorTool
Posted: Tue Jan 19, 2010 3:35 pm
by narcis
Hi John,
I'm afraid this is a bug (TF02014645) which I have added to the defect list to be investigated. In the meantime, a workaround is doing this:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Styles.ColorGrid colorGrid1;
private Steema.TeeChart.Tools.CursorTool cursor1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
colorGrid1 = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);
colorGrid1.FillSampleValues();
cursor1 = new Steema.TeeChart.Tools.CursorTool(tChart1.Chart);
cursor1.FollowMouse = true;
cursor1.Series = colorGrid1;
cursor1.Change += new Steema.TeeChart.Tools.CursorChangeEventHandler(cursor1_Change);
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
}
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
ShowSeriesValues(colorGrid1.Clicked(e.X, e.Y));
}
void cursor1_Change(object sender, Steema.TeeChart.Tools.CursorChangeEventArgs e)
{
//ShowSeriesValues(e.ValueIndex);
}
private void ShowSeriesValues(int i)
{
if (i != -1)
{
double x = colorGrid1.XValues.Value[i];
double y = colorGrid1.YValues.Value[i];
double z = colorGrid1.ZValues.Value[i];
tChart1.Header.Text = x.ToString() + "; " +
y.ToString() + "; " +
z.ToString();
}
}
Hope this helps!
Re: ColorGrid and CursorTool
Posted: Wed Jan 20, 2010 5:39 pm
by 13045490
Narcis,
I am getting an IndexOutOfRangeException in the colorGrid1.Clicked(e.X, e.Y)) member function
John
Re: ColorGrid and CursorTool
Posted: Wed Jan 20, 2010 7:57 pm
by narcis
Hi John,
Which is the exact TeeChart for .NET build you are using? It worked fine for me here using latest v2009 release available at the client area.
Thanks in advance.
Re: ColorGrid and CursorTool
Posted: Thu Jan 28, 2010 10:58 am
by narcis
Hi John,
Please notice that TF02014645 has been fixed for the next TeeChart for .NET 2009 maintenance release.
An alternative workaround can also be this:
Code: Select all
void cursor1_Change(object sender, Steema.TeeChart.Tools.CursorChangeEventArgs e)
{
ShowSeriesValues(colorGrid1.Clicked(e.x, e.y));
}