LabelFormatString to display other values other than x/y coordinates

Oystein Bjorke 6 years ago 0
This discussion was imported from CodePlex

michaeldjackson wrote at 2013-07-22 22:16:

I'm plotting points on WPF OxyPlot based on a defined set of point indexes.
For example, I have a file containing two sections:

Section 1 (x, y, width, temperature)
0.00000 8008.00000 303.89111
2.07055 8007.72754 286.60547
4.00000 8006.92822 274.70264

Section 2 (vertexes)
1, 44, 45, 2
2, 45, 46, 3
3, 46, 47, 4

Section 2 tells me in what order to plot the x/y coordinates from Section 1, so the first line in Section 2 says to plot points in line 1, then points in line 44, then points in line 45, then points in line 2 (of Section 1), etc.

I need to use LabelFormatString to display the vertex values, ie 1, 44, 45, 2, etc rather than the x/y coordinates.

Is this possible and how?


everytimer wrote at 2013-07-22 22:43:

Is it for the tracker? If it's so you can use "Tag" property of LineSeries and bind it in XAML. See Tracker examples.

Good luck

michaeldjackson wrote at 2013-07-22 23:56:

Thanks for the reply.
Actually, it's NOT for the Tracker. I need to show the Index number for each vertex, AND, hopefully bind it's visibility in XAML to allow user to show/hide it.
If that's not possible, I could resort to the Tracker.

everytimer wrote at 2013-07-23 00:30:

Then why you just do something like this:
for(int i=0; i<s2.Points.Count(); i++)
s1.Points.Add(new DataPoint(myList1X[i],myListY[i] );
s1.LabelFormatString = (s2.Points[i].X, s2.Points[i].Y)
Please note that I haven't tested this (you would probable need ToString() that).
For disabling that you could put a condition before LabelFormatString and redraw the LineSeries whenever the user clicks on that particular CheckBox. Good luck