WPF工具箱图表:自定义数据点标签 [英] WPF toolkit charting : Customize datapoint label

查看:115
本文介绍了WPF工具箱图表:自定义数据点标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用WPF工具包创建了一个简单的LineSeries图表。默认情况下,将鼠标悬停在数据点上时,它将显示带有YAxis值的标签。 (如果将鼠标放在X = 3,Y = 45数据点上,它将显示一个带有 45的标签)

I have create a simple LineSeries chart using WPF toolkit. By default, on mouse over a datapoint, it display a label with YAxis value. (if I put my mouse on the X=3,Y=45 datapoint, it will display a label with "45" inside)

我想更改此默认行为显示X和Y轴值。 (如果将鼠标放在X = 3,Y = 45数据点上,它将显示一个带有 3,45的标签)

I want to change this default behavior to display both X and Y axis value. (if I put my mouse on the X=3,Y=45 datapoint, it will display a label with "3, 45" inside)

如果有人有建议,可能很棒!
谢谢您,最好的问候,

If somebody have a suggestion, it could be great ! Thank you and best regards,

PY

推荐答案

在这里您可以找到 LineSeries DataPoint 的XAML样式,默认情况下,工具提示定义为

Here you can find the XAML style of a LineSeries DataPoint and by default the tooltip is defined as

<ToolTipService.ToolTip>
   <ContentControl Content="{TemplateBinding FormattedDependentValue}"/>
</ToolTipService.ToolTip>

因此,您可以将整个样式应用于应用程序并覆盖工具提示定义,例如:

so, you can take the whole style to your application and override the tooltip definition for example:

<ToolTipService.ToolTip>
   <StackPanel Margin="2,2,2,2">
      <ContentControl Content="{TemplateBinding IndependentValue}" FontSize="12"/>
      <ContentControl Content="{TemplateBinding DependentValue}"   FontSize="12"/>
   </StackPanel>
</ToolTipService.ToolTip>

,您将显示所需的 X,Y工具提示。

and you willget displayed the "X, Y" tooltip you need.

这篇关于WPF工具箱图表:自定义数据点标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆