Show series value over any point on chart using tooltip c#

我的梦境 提交于 2019-12-06 09:31:54

So the solution was to not use a HitTest. Instead if you use PixelPositionToValue it works much better. I'll include the code below.

private void chData_MouseMove(object sender, MouseEventArgs e)
    {
        try
        {   
            int cursorX = Convert.ToInt32(chData.ChartAreas[0].AxisX.PixelPositionToValue(e.Location.X));

            tipInfo = "Bat 1: " + ch1Array[cursorX].ToString("0.00") + Environment.NewLine + "Bat 2: " + ch2Array[cursorX].ToString("0.00") + Environment.NewLine;

            tooltip.SetToolTip(chData, tipInfo);

        }
        catch { }
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!