我正在尝试将一个点的值打印到绘图上,但提供的文档不完整或令人困惑。我知道 TrackerFormatString 值可以做类似的事情,但我希望文本始终位于随不同值动态变化的图上。有什么我可能忽略了或者我可以研究的吗?
var series1 = new LineSeries { Title = "Stage I", MarkerType = MarkerType.Circle, Smooth = true, TrackerFormatString = "Stage I\nYear: {2:0.0}\n{4:0.0} %" };
//let's say I have a line series like this
//I need to enter some sort of text on the plot that has the values of the below points:
series1.Points.Add(new DataPoint(0.0, 100.0));
series1.Points.Add(new DataPoint(1, 82.3));
series1.Points.Add(new DataPoint(3, 59.2));
series1.Points.Add(new DataPoint(5, 47.7));
如能提供任何形式的帮助,我们将不胜感激!
最佳答案
您可以为绘图添加注释。要显示文本,请使用 TextAnnotation
。
将注释添加到您的模型,为位置提供 DataPoint
并为要显示的文本提供 Text
。例如
yourModel.Annotations.Add(new TextAnnotation { TextPosition = new DataPoint(DateTimeAxis.ToDouble(now), wert), Text = "82.3%" });
关于c# - 如何在 LineSeries 图上显示文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44419265/