<chart:SfCartesianChart.Resources> <ResourceDictionary> <converter:BrushToColorConverter x:Key="brushToColor" /> <DataTemplate x:Key="legendTemplate"> <Grid ColumnDefinitions="Auto,Auto" ColumnSpacing="5" Margin="5"> <BoxView Grid.Column="0" Color="{Binding IconBrush,Converter={StaticResource brushToColor}}"/> <Label Grid.Column="1" Text="{Binding Item.Label}" TextColor="{Binding IconBrush,Converter={StaticResource brushToColor}}"/> </Grid> </DataTemplate> </ResourceDictionary> </chart:SfCartesianChart.Resources> <chart:SfCartesianChart.Legend> <chart:ChartLegend ItemTemplate="{StaticResource legendTemplate}"/> </chart:SfCartesianChart.Legend> <chart:SplineSeries Label="Mobile" ItemsSource="{Binding Data}" XBindingPath="Year" YBindingPath="Mobile"> </chart:SplineSeries> <chart:SplineSeries Label="Labtop" ItemsSource="{Binding Data}" XBindingPath="Year" YBindingPath="LapTop"> </chart:SplineSeries> |