【问题标题】:wpf oxyplot -- change popup when datapoint is clickedwpf oxyplot - 单击数据点时更改弹出窗口
【发布时间】:2016-02-22 16:47:20
【问题描述】:

我正在使用带有 wpf 的 oxyplot,如果单击数据点,我想更改弹出窗口。

可以改变吗?我看到了一些例子,展示了如何获得点击点,但没有改变样式。

谢谢

【问题讨论】:

    标签: c# wpf oxyplot


    【解决方案1】:

    在 OxyPlot 的源代码中,弹出窗口称为 Tracker。 您可以通过OxyPlot.Wpf.PlotView.DefaultTrackerTemplate 在 XAML 中将其 ControlTemplate 定义为:

    <oxy:PlotView Model="{Binding SomePlotModel}">
      <oxy:PlotView.DefaultTrackerTemplate>
        <ControlTemplate>
           <!-- Put your content here-->
        </ControlTemplate>
       </oxy:PlotView.DefaultTrackerTemplate>
    </oxy:PlotView>
    

    如果每个系列数据需要不同的tracker,则使用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>
    

    ControlTemplateDataContextTrackerHitResult,您可以在此处查看可用的属性: https://github.com/oxyplot/oxyplot/blob/master/Source/OxyPlot/PlotController/Manipulators/TrackerHitResult.cs

    一些例子: How can I show the plot points in Oxyplot for a line Graph? http://discussion.oxyplot.org/topics/592-wpf-tracker-multiple-value/

    【讨论】:

    • 你是今天最棒的人 :-) - 谢谢!
    猜你喜欢
    • 2018-12-18
    • 1970-01-01
    • 1970-01-01
    • 2022-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-27
    • 1970-01-01
    相关资源
    最近更新 更多