【问题标题】:Chart Plot Points - Show tool tip in OxyPlot图表绘图点 - 在 OxyPlot 中显示工具提示
【发布时间】:2016-01-19 02:02:48
【问题描述】:

我正在开发一个需要图表的 WPF 应用程序。我正在使用OxyPlot。我的图表使用以下 XAML 正确呈现。

<oxy:Plot Height="800" HorizontalContentAlignment="Stretch">
  <oxy:Plot.Series>
    <oxy:LineSeries ItemsSource="{Binding Series1Points}" MarkerType="Diamond" Title="Series 1" />
    <oxy:LineSeries ItemsSource="{Binding Series2Points}" MarkerType="Diamond" Title="Series 2" />
  </oxy:Plot.Series>
</oxy:Plot>

我有一个挑战,我没有成功解决。渲染系列时,每个数据点都显示为菱形。当用户将鼠标放在菱形上时,我想显示一个工具提示,其中包含数据点的 X 和 Y 值。你怎么能那样做?似乎应该是可能的。然而,我没有任何成功。

【问题讨论】:

  • 不确定您是否正确理解。重复您的示例 - 工具提示显示为:i.stack.imgur.com/utdOS.png 或者您想更改标准工具提示?
  • 我明白了。我注意到您必须单击才能显示工具提示。有没有办法让工具提示出现在悬停时?
  • 也许这对你有帮助,我正在使用 oxyplot,并决定开始我自己的图书馆,因为我发现我需要更多,github.com/beto-rodriguez/Live-Charts

标签: wpf xaml oxyplot


【解决方案1】:

工具提示仅在左键单击时显示。要在悬停时显示它,您需要修改 oxyplot 控制器:

c#:

public PlotController customController { get; private set; }

...

//Sets the controller to enable show tracker on mouse hover
customController = new PlotController();
customController.UnbindMouseDown(OxyMouseButton.Left);
customController.BindMouseEnter(PlotCommands.HoverSnapTrack);

xaml:

<oxy:Plot Controller="{Binding customController}" Height="800" ... >

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多