I am trying to place textual information above particular points in the series, and have them be linked, meaning that if I scroll around the plot, the text is always in the same position relative to a particular point in the series. like so:
my lets say length of my int[] data is 15 and it contains values {22, 44, 55, 87, 33, 21, 23, 44, 33, 42, 54, 56, 66, 77, 99}
I need to place letter "H" over position 3, "Z" over position 8, and "T" over position 12. All annotations are near the top of the plot area. My code works fine displaying regular LineSeries but I cant figure out how to add the annotations.
public void SetWaveformData(int[] data)
{
PlotModel plotModel = new PlotModel();
List<DataPoint> dataSeries = new List<DataPoint>();
int i = 0;
foreach (int yValue in data)
{
dataSeries.Add(new DataPoint { X = i++, Y = yValue });
}
LineSeries ser = new LineSeries();
ser.Points.AddRange(dataSeries);
plotModel.Series.Add(ser);
}
You can create Text Annotations
var myTextAnnotation = new TextAnnotation();
myTextAnnotation.TextPosition = new DataPoint(3, 55);
myTextAnnotation.Text = "H";
and then add them to the plots models annotations.
OR
You can do some digging around and try to use the series labels, there's an example of how it's used here, called "Labels" under the "LineSeries" category:
http://resources.oxyplot.org/examplebrowser/
but on this example the labels are the Y value so you'll have to find a way to manipulate that.
Hope this helps!