我有以下图表:
<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的集合&gt;其中doubleA是提取的数据,doubleB是doubleA的标准化值,基于范围。所以我需要将LineSeries更改为:
<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。无论如何要做到这一点?