WPF toolkit charting : Customize datapoint label

旧巷老猫 提交于 2019-12-07 08:59:43

问题


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)

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


回答1:


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>

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



来源:https://stackoverflow.com/questions/16333496/wpf-toolkit-charting-customize-datapoint-label

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!