場景 Winforn中設置ZedGraph曲線圖的屬性、坐標軸屬性、刻度屬性: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/100112573 Winform中實現ZedGraph的多條Y軸(附源碼下載): https://bl ...
場景
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(); }
效果