2017-06-07 53 views
2

我試圖將一個點的值打印到圖上,但提供的文檔不完整或令人困惑。我知道TrackerFormatString值可以做類似的事情,但我希望文本始終處於隨不同值而動態變化的情節中。有沒有我可能忽略的東西,或者我可以看看?如何在LineSeries圖上顯示文本?

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)); 

This is what I have:

This is what I need:

任何形式的與此幫助將不勝感激!

+0

那麼,你想添加註釋嗎? –

回答

0

你可以添加註釋到你的情節。用於顯示文本使用TextAnnotation

將註釋添加到您的模型中,爲位置提供DataPoint併爲要顯示的文本提供Text。例如

yourModel.Annotations.Add(new TextAnnotation { TextPosition = new DataPoint(DateTimeAxis.ToDouble(now), wert), Text = "82.3%" });