[英]Show offset of StripLine as a label on the Y-Axis
我的WinForms應用程序中有以下圖表:
我需要顯示紅線的參考編號(在這種情況下為“ 37”)
當我嘗試將CustomLabel添加到Y軸時,所有其他數字都消失了。
我嘗試將標簽的RowIndex更改為2,但這是結果:
它只顯示一個倒置的“ 3”,而不是一個直的“ 37”
這是我需要的:
我怎樣才能做到這一點?
您可以使用TextAnnotation
顯示數據值:
ChartArea ca = chart1.ChartAreas[0];
TextAnnotation ta = new TextAnnotation();
DataPoint dp0 = Series2.Points[0]; // pick a datapoint!
ta.Text = dp0.YValues[0] + "";
ta.ForeColor = dp0.Color;
ta.AxisY = ca.AxisY;
ta.Y = dp0.YValues[0];
ta.X = 5; // pick a value that fits with your y-axis!
ta.Alignment = ContentAlignment.MiddleLeft;
chart1.Annotations.Add(ta);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.