+2
Under review

WPF tracker multiple value

pitipilot 4 years ago in API • updated by Oystein Bjorke 2 years ago 6
Hi all,
Currently, I've two line series for one plot model. I want to know if it's possible to have a tracker with multiple value like this example :


Best regards.
Under review
For WPF/SL (and maybe Win8, I don't remember) it should be possible to define a custom trackers that shows a value for each series. The default tracker does not support multiple values - remember the LineSeries does not require monotone increasing x-values and could have many intersections for a given x.

Please add a new feature or example request in the issues at GitHub!
Here there is my XAML code:

<oxy:Plot x:Name="graph" Title="test">
<oxy:PlotView.DefaultTrackerTemplate>
<ControlTemplate>
<oxy:TrackerControl Position="{Binding Position}" LineExtents="{Binding PlotModel.PlotArea}" BorderBrush="{Binding Series.ActualColor, Converter={StaticResource OxyColorConverter}}" BorderThickness="3">
<oxy:TrackerControl.Content>
<TextBlock Text="{Binding}" Margin="7" />
</oxy:TrackerControl.Content>
</oxy:TrackerControl>
</ControlTemplate>
</oxy:PlotView.DefaultTrackerTemplate>
</oxy:Plot>


and my C# code :

private void GeneCourbe(List<PointsMesure> mesureList, String mesureName)
{


var valueAxis = new LinearAxis(AxisPosition.Left, 0) { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, Title = "Mesure " + mesureName };
valueAxis.AxisDistance = 0;
valueAxis.IsZoomEnabled = true;
valueAxis.IsPanEnabled = true;
plotModel.Axes.Add(valueAxis);

var line = new LineSeries
{
StrokeThickness = 2,
MarkerSize = 3,
// MarkerStroke = colors[data.Key],
// MarkerType = markerTypes[data.Key],
CanTrackerInterpolatePoints = false,

Smooth = false,
};

line.TrackerFormatString = " {0} " + Environment.NewLine + "{1}: {2} " + Environment.NewLine + "{3}: {4} ";


foreach (PointsMesure pm in mesureList)
{
line.Points.Add(new DataPoint(DateTimeAxis.ToDouble(pm.horodatage), pm.pointmesure));
}

valueAxis.Key = "Axe " + mesureName;
line.YAxisKey = "Axe " + mesureName;

plotModel.Series.Add(line);



graph.InvalidatePlot(true);
graph.Model = plotModel;

}


At each call of the function "GeneCourbe", I create a new lineseries. It will be powerful if I can have one tracker for all LineSeries.
I think this custom tracker would be a great example! Anyone up for it?
This feature could also be covered by Issue #49