<chart:LineSeries ItemsSource="{Binding Collection}"
XBindingPath="XValue" YBindingPath="YValue"
>
<chart:LineSeries.AdornmentsInfo>
<chart:ChartAdornmentInfo ShowMarker="True" ShowLabel="True" >
<chart:ChartAdornmentInfo.SymbolTemplate>
<DataTemplate>
<Ellipse Height="20" Width="20" Fill="{Binding Converter={StaticResource symbolColor}}"/>
</DataTemplate>
</chart:ChartAdornmentInfo.SymbolTemplate>
</chart:ChartAdornmentInfo>
</chart:LineSeries.AdornmentsInfo>
</chart:LineSeries>
|
public class SymbolColor : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var adornment = value as ChartAdornment;
var item = adornment.Item as Model;
if (item.ColorFlag)
return new SolidColorBrush(Colors.Yellow);
else
return new SolidColorBrush(Colors.Red);
}
} |
Hi Durgadevi,
I tried to run the sample app and it was failing to run.
The value cannot be converted into ChartAdornment type.
<chart:LineSeries.AdornmentsInfo>
<chart:ChartAdornmentInfo ShowLabel="True" SegmentLabelContent="LabelContentPath">
<chart:ChartAdornmentInfo.LabelTemplate>
<DataTemplate>
<Grid>
<Ellipse Height="20" Width="20" Fill="{Binding Converter={StaticResource symbolColor}}"/>
<TextBlock Text="{Binding YData}" HorizontalAlignment="Center"/>
</Grid>
</DataTemplate>
</chart:ChartAdornmentInfo.LabelTemplate>
</chart:ChartAdornmentInfo>
</chart:LineSeries.AdornmentsInfo> |
public class SymbolColor : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var adornment = value as ChartAdornment;
var item = adornment.Item as Model;
if (item.ColorFlag)
return new SolidColorBrush(Colors.Yellow);
else
return new SolidColorBrush(Colors.Red);
}
} |