WPF工具包图表-自定义工具提示-显示复杂的依赖值
我有以下图表:WPF工具包图表-自定义工具提示-显示复杂的依赖值,wpf,templates,charts,tooltip,toolkit,Wpf,Templates,Charts,Tooltip,Toolkit,我有以下图表: <cht:Chart ...> <cht:Chart.Series> <cht:LineSeries Name="LineSeries" Title="a" DependentValueBinding="{Binding Path=Value}" IndependentValueBinding="{Binding Path=Key}" ItemsSourc
<cht:Chart ...>
<cht:Chart.Series>
<cht:LineSeries Name="LineSeries" Title="a"
DependentValueBinding="{Binding Path=Value}"
IndependentValueBinding="{Binding Path=Key}"
ItemsSource="{Binding Path=SourceCollection}"
IsSelectionEnabled="True"
DataPointStyle="{DynamicResource SmallPointStyle}">
</cht:LineSeries>
</cht:Chart.Series>
</cht:Chart>
以及DataPointStyle:
<Style TargetType="cht:LineDataPoint">
<Setter Property="Width" Value="2" />
<Setter Property="Height" Value="2" />
<Setter Property="DependentValueStringFormat" Value="{}{0:0.00}"/>
</Style>
<Style x:Key="SmallPointStyle" TargetType="cht:LineDataPoint" BasedOn="{StaticResource {x:Type cht:LineDataPoint}}">
<Setter Property="BorderBrush" Value="Orange"/>
<Setter Property="Background" Value="Orange"/>
</Style>
源集合是KeyValuePair的列表。
该应用程序运行良好
我遇到了一个问题,因为我想使用KeyValuePair>的集合,其中doubleA是提取的数据,doubleB是基于范围的doubleA的归一化值。因此,我需要将线条系列更改为:
<cht:Chart ...>
<cht:Chart.Series>
<cht:LineSeries Name="LineSeries" Title="a"
DependentValueBinding="{Binding Path=Value.Value}"
IndependentValueBinding="{Binding Path=Key}"
ItemsSource="{Binding Path=SourceCollection}"
IsSelectionEnabled="True"
DataPointStyle="{DynamicResource SmallPointStyle}">
</cht:LineSeries>
</cht:Chart.Series>
</cht:Chart>
它按照我的预期工作,但我需要在工具提示中显示真实值(value.Key),而不是DependentValue。有没有办法做到这一点 有关一种可能的解决方案,请参见此
可以找到必须替代的线系列数据点样式。
但是,请记住,当您覆盖模板时,将不再获得任何随机颜色
祝你好运