I've already read some threads on the subject but haven't quite found what I'm looking for.
Here's what I have written so far:
Point? prevPosition = null;
ToolTip tooltip = new ToolTip();
void lineGraph_MouseMove(object sender, MouseEventArgs e){
var pos = e.Location;
if (prevPosition.HasValue && pos == prevPosition.Value)
return;
tooltip.RemoveAll();
prevPosition = pos;
var results = lineGraph.HitTest(pos.X, pos.Y, false,ChartElementType.PlottingArea);
foreach (var result in results){
if (result.ChartElementType == ChartElementType.PlottingArea){
var xVal = result.ChartArea.AxisX.PixelPositionToValue(pos.X);
var yVal = result.ChartArea.AxisY.PixelPositionToValue(pos.Y);
tooltip.Show("X=" + xVal + ", Y=" + yVal, this.lineGraph,pos.X, pos.Y - 15);
}
}
}
But the toolTip doesn't show.