TrackerFormatString question

Jun 4, 2012 at 6:11 PM

In the documentation page

http://oxyplot.codeplex.com/wikipage?title=Custom%20trackers&referringTitle=Documentation

it states that you can define what the tracker displays by modifying the TrackerFormatString property of the series. What format is this property expecting? In particular, if I want my tracker to show the following:

 

X Axis Title: 0.###

Y Axis Title: 0.###

 

(where 0.### is meant to be the appropriate value to 3 decimal places), what do I have to set TrackerFormatString to? I'm using LineSeries and ScatterSeries, if that makes a difference.

 

Thanks,

 

Steve

Jun 4, 2012 at 9:09 PM
Edited Jun 4, 2012 at 9:12 PM

Sorry the wiki documentation is not finished. 

The tracker format string has some variations for different series (should be documented... and maybe improved?), but it should at least support the following arguments

{0} the title of the series
{1} the title of the x-axis
{2} the x-value
{3} the title of the y-axis
{4} the y-value

For ScatterSeries you also have

{5} the title of the value-axis
{6} the value of the scatter point

This means that in your case you should be able to use

X Axis Title: {2:0.###}
Y Axis Title: {4:0.###}

The format string can also contain names of properties of the items (requires use of the ItemsSource property):

{X:0.###}, {Y:0.###}, {Value:0.###}

where X, Y and Value are properties of your items.

Oct 21, 2013 at 9:20 AM
Just in case it helps anyone, and expanding on the above:

If you have a class like this:
class ExercisePoint : IDataPoint
    {
        public double X { get; set; }
        public double Y { get; set; }
        public int Lvl { get; set; }
        public DateTime DateTime { get; set; }
        public string Exercise { get; set; }
    }
You could then create a line series with a custom Tracker that look like this:
var line_series_array = new LineSeries()
                {
                    ... other propreties initialization here ...

                    TrackerFormatString = "{DateTime:dd.MM.yy}"+ Environment.NewLine +"{Exercise}, lvl {Lvl}:{Y}"
                };
This will give you in this case, the date in the given format on one line, and on the second, the exercise, level, and Y value.

Easy peasy once you figure it out ... :)


(Just wondering, any chance of being able to format the text in there? )
Apr 11, 2014 at 10:19 AM
Thanks for the post.

An additional tip here. The default setting is like below,
var lineSeries = new LineSeries
{
    TrackerFormatString = "{0} " + Environment.NewLine + "{1}: {2} " + Environment.NewLine + "{3}: {4} ",
}
You can modify it based on that. Also note that the {0} would be used in Legend Title.
Apr 30, 2014 at 6:55 AM
Edited Apr 30, 2014 at 9:40 AM
Hello i need help
Ihave a scatterSeries. And i need to for every point's have unique string lines, and this lines must show at the tracker.
How i can do that???
Image