//设置此属性为true
chartControl1.RuntimeHitTesting = true;
private void ChartControl1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
try
{
ChartHitInfo hitInfo = chartControl1.CalcHitInfo(e.Location);
if (hitInfo.SeriesPoint == null)
{
toolTip.HideHint();
return;
}
//图例名
string lengthName = ((DevExpress.XtraCharts.Native.IOwnedElement)hitInfo.SeriesPoint).Owner.ToString();
//点的Y轴数值
string yValue = hitInfo.SeriesPoint.Argument;
//点的X轴数值
string xValue = hitInfo.SeriesPoint.Values[0].ToString();
toolTip.ShowHint(lengthName + " " + xValue + " " + yValue);
}
catch (Exception ex)
{
FileLogUtility.Error(ex);
}
}