ColorGrid and CursorTool

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
johnf
Newbie
Newbie
Posts: 6
Joined: Mon Jun 11, 2007 12:00 am

ColorGrid and CursorTool

Post by johnf » Tue Jan 19, 2010 4:01 am

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

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

Re: ColorGrid and CursorTool

Post by Narcís » Tue Jan 19, 2010 3:35 pm

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!
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

johnf
Newbie
Newbie
Posts: 6
Joined: Mon Jun 11, 2007 12:00 am

Re: ColorGrid and CursorTool

Post by johnf » Wed Jan 20, 2010 5:39 pm

Narcis,

I am getting an IndexOutOfRangeException in the colorGrid1.Clicked(e.X, e.Y)) member function

John

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

Re: ColorGrid and CursorTool

Post by Narcís » Wed Jan 20, 2010 7:57 pm

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.
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

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

Re: ColorGrid and CursorTool

Post by Narcís » Thu Jan 28, 2010 10:58 am

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));
    }
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