问题
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