WInforn中设置ZedGraph的焦点显示坐标格式化以及显示三个坐标数的解决办法
生活随笔
收集整理的這篇文章主要介紹了
WInforn中设置ZedGraph的焦点显示坐标格式化以及显示三个坐标数的解决办法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
場景
Winforn中設置ZedGraph曲線圖的屬性、坐標軸屬性、刻度屬性:
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/100112573
Winform中實現ZedGraph的多條Y軸(附源碼下載):
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/100132245
ZedGraph設置顯示坐標值
zgc.IsShowCursorValues = true;
但是在刷新曲線圖之后出現了鼠標焦點出現三個坐標值
?
解決方法是在其鼠標焦點懸浮事件中格式化其要顯示的值,修改為舉例最近的去曲線上的點。
注:
博客主頁:
https://blog.csdn.net/badao_liumang_qizhi
關注公眾號
霸道的程序猿
獲取編程相關電子書、教程推送與免費下載。
實現
//顯示焦點值事件 zgc.CursorValueEvent += zgc_CursorValueEvent;然后在方法中
?private static string zgc_CursorValueEvent(ZedGraphControl sender, GraphPane pane, Point mousePt){CurveItem nearstCurve;int i;Double x = 0.0;Double y = 0.0;Global.zedGraphControl1.GraphPane.FindNearestPoint(mousePt, out nearstCurve, out i);if (nearstCurve!= null && nearstCurve.Points[i] != null && nearstCurve.Points[i].X != null){x = nearstCurve.Points[i].X;}if (nearstCurve!= null && nearstCurve.Points[i] != null && nearstCurve.Points[i].Y != null){y = nearstCurve.Points[i].Y;}return "X:" + x.ToString() + "? Y:" + y.ToString();}效果
?
總結
以上是生活随笔為你收集整理的WInforn中设置ZedGraph的焦点显示坐标格式化以及显示三个坐标数的解决办法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Winform中设置ZedGraph的曲
- 下一篇: Winform中设置ZedGraph鼠标