Search code examples
wpfoxyplot

Oxyplot: disable tracker


I have several series, and I need to disable tracker for some of them only. How do I do that?

 <oxy:Plot.Series>
      <oxy:AreaSeries ItemsSource="{Binding PowerValues}" Smooth="False" StrokeThickness="1" Foreground="#6B303030" Color="White"  Color2="#00000000"
                                    Fill="{StaticResource FillColor}" BrokenLineColor="Red"></oxy:AreaSeries>
                    <oxy:StairStepSeries ItemsSource="{Binding PowerTemplateMax}" Smooth="False" StrokeThickness="2" Color="Green" IsManipulationEnabled="False">
                    </oxy:StairStepSeries>
                    <oxy:StairStepSeries ItemsSource="{Binding PowerTemplateMin}" Smooth="False" StrokeThickness="2" Color="Yellow"></oxy:StairStepSeries>
                </oxy:Plot.Series>

AreaSeries should have the trakcer, when both StairStepSeries should not.


Solution

  • One way to achieve this using a Custom Tracker, which is invisible. For example, You could define your tracker as.

        <oxy:PlotView.TrackerDefinitions>
            <oxy:TrackerDefinition TrackerKey="InvisibleTracker">
                <oxy:TrackerDefinition.TrackerTemplate>
                    <ControlTemplate>
                        <TextBlock Text="{Binding}" Visibility="Collapsed"/>
                    </ControlTemplate>
                </oxy:TrackerDefinition.TrackerTemplate>
            </oxy:TrackerDefinition>
        </oxy:PlotView.TrackerDefinitions>
    

    Notice you have set the visibility of TextBlock as Collapsed. You can now set the TrackerKey for the series for which you need to hide the Tracker to "InvisibleTracker". This would ensure tracker is not visible for those series.