简体   繁体   English

wpf oxyplot - 单击datapoint时更改弹出窗口

[英]wpf oxyplot — change popup when datapoint is clicked

I am using oxyplot with wpf and I want to change the popup if a datapoint gets clicked. 我正在使用带有wpf的oxyplot,如果点击一个数据点,我想更改弹出窗口。 OxyplotDataPointClick

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. 该弹出窗口在OxyPlot的源代码中称为Tracker You can define its ControlTemplate in XAML via OxyPlot.Wpf.PlotView.DefaultTrackerTemplate as: 您可以通过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>

If each series data need different tracker, then use OxyPlot.Wpf.PlotView.TrackerDefinitions . 如果每个系列数据需要不同的跟踪器,则使用OxyPlot.Wpf.PlotView.TrackerDefinitions For example, if your have a LineSeries with TrackerKey="LineSeriesXyzTrackerKey" , then defines its tracker as: 例如,如果您的LineSeries具有TrackerKey="LineSeriesXyzTrackerKey" ,则将其跟踪器定义为:

<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 ControlTemplateDataContext是一个TrackerHitResult ,您可以在这里查看可用的属性: 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? 一些例子: 如何在线图中显示Oxyplot中的绘图点? http://discussion.oxyplot.org/topics/592-wpf-tracker-multiple-value/ http://discussion.oxyplot.org/topics/592-wpf-tracker-multiple-value/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM