void chart1_GetToolTipText(object sender, ToolTipEventArgs e)
{ HitTestResult hitTestResult = chart1.HitTest(e.X, e.Y);
if (hitTestResult.PointIndex >= 0 )
if( hitTestResult.ChartElementType == ChartElementType.DataPoint)
{ tooltip.RemoveAll();
var results = chart1.HitTest(e.X, e.Y, false,
ChartElementType.DataPoint);
foreach (var result in results)
{
if (result.ChartElementType == ChartElementType.DataPoint)
{
var prop = result.Object as DataPoint;
if (prop != null)
{
var pointXPixel = result.ChartArea.AxisX.ValueToPixelPosition(prop.XValue);
var pointYPixel = result.ChartArea.AxisY.ValueToPixelPosition(prop.YValues[0]);
if (Math.Abs(e.X - pointXPixel) < 2 &&
Math.Abs(e.Y - pointYPixel) < 2)
{
tooltip.Show(prop.XValue +
"," + prop.YValues[0], chart1,
e.X, e.Y - 15);
}
}
}
}
}
}