WPF OxyPlot——当数据点被点击时更改弹出窗口

4
我正在使用oxyplot和wpf,希望在单击数据点时更改弹出窗口。OxyplotDataPointClick 是否可以更改?我看到了一些示例,展示了如何获取点击的点,但没有关于更改样式的内容。
谢谢。
1个回答

6
弹出窗口在OxyPlot的源代码中被称为Tracker。您可以通过XAML定义它的ControlTemplate,方法是使用OxyPlot.Wpf.PlotView.DefaultTrackerTemplate
<oxy:PlotView Model="{Binding SomePlotModel}">
  <oxy:PlotView.DefaultTrackerTemplate>
    <ControlTemplate>
       <!-- Put your content here-->
    </ControlTemplate>
   </oxy:PlotView.DefaultTrackerTemplate>
</oxy:PlotView>

如果每个系列数据需要不同的跟踪器,则使用OxyPlot.Wpf.PlotView.TrackerDefinitions。例如,如果您有一个具有TrackerKey="LineSeriesXyzTrackerKey"的LineSeries,则定义其跟踪器为:
<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>
ControlTemplateDataContext是一个TrackerHitResult,你可以在这里查看可用的属性: https://github.com/oxyplot/oxyplot/blob/master/Source/OxyPlot/PlotController/Manipulators/TrackerHitResult.cs 一些示例: 如何在Oxyplot中显示线图中的绘图点? http://discussion.oxyplot.org/topics/592-wpf-tracker-multiple-value/

1
你今天是最棒的人 :-) - 谢谢! - thardes2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接