場景
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(); }
效果

轉載請註明出處,本文鏈接:https://www.uj5u.com/net/4909.html
標籤:WinForm
