Chart1控件不太用,你可以看看Chart1控件有没有工作区矩形的属性,或者ChartArea的工作区矩形属性,如果有的话,那毫无压力。
private void chart1_GetToolTipText(object sender, System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs e)
{
if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint)
{
this.Cursor = Cursors.Cross;
int i = e.HitTestResult.PointIndex;
StringBuilder dpStr =new StringBuilder();
foreach (var item in chart1.Series)
{
DataPoint dp = item.Points[i];
dpStr.Append(item.Name + " X:" + dp.XValue + " Y:" + dp.YValues[0]+"\r\n");
}
e.Text = dpStr.ToString();
}
else
{
this.Cursor = Cursors.Default;
}
}
参考
http://blog.csdn.net/chenep/article/details/10052345