Tracker Format for Custom data points

Jun 11, 2014 at 9:27 PM
Edited Jun 11, 2014 at 9:28 PM
I have a quick question about custom tracker formats. I have created a ScatterSeries in my view model like so:
Series = new ScatterSeries());
Series.TrackerFormatString = "match: {Match}";
and I'd like this match data to come from my data point, so I have a custom datapoint class like this:
public class MyDataPoint : ScatterPoint {
  public string Match {get;set;}
  public MyDataPoint(double x, double y, string match):base(x,y) { Match = match; }
and then I add these points to the scatter series like this:
Series.Points.Add(new MyDataPoint(5,10,"Message about this"));
But when I click on these points, I get a Null reference exception from PlotView and the program crashes.

I thought I used the wrong TrackerFormatString so tried this one but it had the same result
Series.TrackerFormatString = "Match {DataPoint.Match}";
How've I gone wrong here?
Jun 13, 2014 at 10:59 AM
I have the same problem using ScatterPoint as base with a similar implementation.

In previous projects I used IDataPoint, but that seems to be removed now..
Jun 16, 2014 at 2:23 PM
Yes, and it seems weird to me that the HitResult that goes into TrackerEventArgs for the TrackerChanged event has a DataPoint when the Series type is ScatterSeries. Shouldn't this be a ScatterPoint? I guess with the IDataPoint interface gone there isn't a good way to do polymorphism between DataPoint's and ScatterPoint's. I suppose this means that before the when the HitResult is constructed the X and Y from the ScatterPoint are copied to the a newly constructed DataPoint? Not sure, maybe I'll look at the code today.
Jul 29, 2014 at 9:15 AM
Look some more on this after my vacation and solved my problem after finding the CustomTrackerDemo..

In my XAML I added:
<oxy:PlotView ... >
                        <oxy:TrackerControl Position="{Binding Position}" LineExtents="{Binding LineExtents}">
                                <TextBlock Text="{Binding}" Margin="8"/>
In my viewmodel I have a ScatterSeries
 var scatterSeries = new ScatterSeries
        TrackerFormatString = "{ToolTip}"
which I add a custom data point to
 public class ScatterPointWithToolTip : ScatterPoint
    public string ToolTip { get; private set; }

    public ScatterPointWithToolTip(double x, double y, ...., object tooltip) 
      : base(x, y...)
      ToolTip = (string) tooltip;