簡體   English   中英

如何在LineSeries圖上顯示文本?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM