Hi,
In the ActiveX version we used XScreenToValue to determine the nearest point in a series to the mouse pointer. In the .NET version the OnMouseMove event has gone so we are using the standard MouseMove event. However, XScreenToValue returns a very large number when it's given e.X. Does e.X have to be converted first? The code is below:
private void tcSwap_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
int xIndex;
if (tcSwap.SeriesCount > 0)
{
xIndex = (int)tcSwap.Series[0].XScreenToValue(e.X);
if (xIndex > 0 && xIndex < tcSwap.Series[0].Count)
{
// Do something
}
}
}
Thanks for your help.
XScreenToValue
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi CAfIT,
Why don't you try doing something like this:
Why don't you try doing something like this:
Code: Select all
private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
int xIndex;
double xVal;
if (tChart1.Series.Count > 0)
{
xVal = tChart1.Axes.Bottom.CalcPosPoint(e.X);
xIndex = tChart1[0].XValues.IndexOf(xVal);
if (xIndex > 0 && xIndex < tChart1[0].Count)
{
tChart1.Header.Text = xIndex.ToString();
}
}
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |