c1chart的toolTipText没有办法显示X对应的文本,
刚才的代码可以改成这样子,对折线图使用
- void c1Chart1_MouseMove(object sender, MouseEventArgs e)
- {
- Point mp = e.Location;
-
- int s=0, p=0, d=0,x=0,y=0;
-
- c1Chart1.ChartGroups[0].CoordToDataIndex(mp.X, mp.Y, CoordinateFocusEnum.XandYCoord, ref s, ref p, ref d);
- c1Chart1.ChartGroups[0].DataIndexToCoord(s, p,ref x,ref y);
- if (d < 20&& p >= 0)
- {
- c1SuperTooltip1.Show("X轴坐标:" + dt.Rows[p].ItemArray[1].ToString(), c1Chart1, new Point(x,y));
- }
- else
- {
- c1SuperTooltip1.Hide();
- }
- }
复制代码 |