I am using oxyplot with wpf and I want to change the popup if a datapoint gets clicked.
Is it possible to change? I saw a few examples that show how to get the clicked point but nothing about changeing the style.
Thank You
The popup is called Tracker
in OxyPlot's source code.
You can define its ControlTemplate in XAML via OxyPlot.Wpf.PlotView.DefaultTrackerTemplate
as:
<oxy:PlotView Model="{Binding SomePlotModel}">
<oxy:PlotView.DefaultTrackerTemplate>
<ControlTemplate>
<!-- Put your content here-->
</ControlTemplate>
</oxy:PlotView.DefaultTrackerTemplate>
</oxy:PlotView>
If each series data need different tracker, then use OxyPlot.Wpf.PlotView.TrackerDefinitions
. For example, if your have a LineSeries with TrackerKey="LineSeriesXyzTrackerKey"
, then defines its tracker as:
<oxy:PlotView Model="{Binding SomePlotModel}">
<oxy:PlotView.TrackerDefinitions>
<oxy:TrackerDefinition TrackerKey="LineSeriesXyzTrackerKey">
<oxy:TrackerDefinition.TrackerTemplate>
<ControlTemplate>
<!-- Put your content here-->
</ControlTemplate>
</oxy:TrackerDefinition.TrackerTemplate>
<oxy:TrackerDefinition TrackerKey="SomeOtherTrackerKey">
<oxy:TrackerDefinition.TrackerTemplate>
<ControlTemplate>
<!-- Put your content here-->
</ControlTemplate>
</oxy:TrackerDefinition.TrackerTemplate>
</oxy:TrackerDefinition>
</oxy:PlotView.TrackerDefinitions>
The DataContext
for the ControlTemplate
is a TrackerHitResult
, you can view what properties are available here:
https://github.com/oxyplot/oxyplot/blob/master/Source/OxyPlot/PlotController/Manipulators/TrackerHitResult.cs
Some examples: How can I show the plot points in Oxyplot for a line Graph? http://discussion.oxyplot.org/topics/592-wpf-tracker-multiple-value/