Page 1 of 1

Dynamically displaying x,y values

Posted: Wed Apr 28, 2004 2:06 pm
by 9079776
Hi,

How can I dynamically (as the cursor is moved over the chart) display the values of the x and y points values in a text block on the chart. An example would be much appreciated.

Thanks,
Serge

Posted: Thu Apr 29, 2004 7:24 am
by Chris
Hi --
How can I dynamically (as the cursor is moved over the chart) display the values of the x and y points values in a text block on the chart. An example would be much appreciated.
Try something similar to:

Code: Select all

private void Form1_Load(object sender, System.EventArgs e) {
	points1.FillSampleValues();
	annotation1.Active=false;
}

private void tChart1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) {
	int clicked = points1.Clicked(e.X,e.Y);
	if(clicked!=-1){
		annotation1.Active=true;
		annotation1.Text = "XValue: " + points1[clicked].X.ToString() + "  YValue: " + points1[clicked].Y.ToString();
	}
	else {
		annotation1.Active=false;
	}
}

Posted: Wed May 05, 2004 2:16 pm
by 9079776
Thanks, much appreciated