I have a teeChart .NET Professional 2018.12.17 and my goal is to show a tooltip with point index when cursor hovers above bar point (and to hide it when cursor is not above any bar point, i.e. cursor is above any empty space on chart).
I've tried the following code:
Code: Select all
private void bar1_MouseEnter(object sender, System.EventArgs e)
{
var client = tChart1.PointToClient(MousePosition);
toolTip1.SetToolTip(tChart1, bar1.Clicked(client.X, client.Y).ToString());
toolTip1.Active = true;
}
private void bar1_MouseLeave(object sender, System.EventArgs e)
{
toolTip1.Active = false;
}
Code: Select all
private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
var clickedPointIndex = bar1.Clicked(e.X, e.Y);
if (clickedPointIndex != -1)
{
if (!toolTip1.Active)
{
toolTip1.SetToolTip(tChart1, clickedPointIndex.ToString());
toolTip1.Active = true;
}
}
else
toolTip1.Active = false;
}
1) Chart thinks that bar point is clicked (MouseEnter fires) when cursor is in space between two points:
When cursor is above or below bar point - chart correctly thinks that that point is not clicked (MouseLeave fires).
2) If cursor touches for example point #2 and than is moved to point #1 - chart thinks that point #2 is clicked:
Looks like this behavoir is beacuse of 1) - clicked point no is not dropped when cursor is in space between points
So why is it working that way (from my point of view it looks like a bug)?
How can I make it work like I want?
I've uploaded sample application here