[英]How Do I Display Text on a LineSeries Plot?
我正在尝试将一个点的值打印到绘图上,但提供的文档不完整或令人困惑。 我知道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
提供Text
。 例如
yourModel.Annotations.Add(new TextAnnotation { TextPosition = new DataPoint(DateTimeAxis.ToDouble(now), wert), Text = "82.3%" });
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.