Thanks for you timely response
your sample work great for legends but am still facing issue.
this is your code
Binding binding = new Binding();
binding.Source = new ViewModel();
binding.Path = "Data";
doughnutSeries.SetBinding(ChartSeries.ItemsSourceProperty, binding);
by using this code it work in your sample but i want it is not working in my project. am using xaml syntax using xamarin.forms.
i also try same sample code in my project but no result.
1. How i can convert this code to xaml syntax. please provide xaml syntax.
2. below i attached xaml code from my project please look into code thanks.
here is my attached xaml.
i also attached android screen shoot you can see there is no legends.
i think if i set itemsource according your provide binding code may be it will show legends right now its not showing legends.
<chart:SfChart HorizontalOptions="FillAndExpand" x:Name="DoughnutChart" VerticalOptions="FillAndExpand" SelectionChanged="SfChart_OnSelectionChanged">
<chart:SfChart.BindingContext>
<local:DailyMetricsViewModel/>
</chart:SfChart.BindingContext>
<chart:SfChart.Legend>
<chart:ChartLegend DockPosition="Bottom">
<chart:ChartLegend.LabelStyle>
<chart:ChartLegendLabelStyle Font="7"/>
</chart:ChartLegend.LabelStyle>
</chart:ChartLegend>
</chart:SfChart.Legend>
<chart:DoughnutSeries DataMarkerPosition="OutsideExtended" ItemsSource="{Binding GigsData}" IsVisibleOnLegend="True"
ConnectorLineType="Line" EnableDataPointSelection="True">
<chart:DoughnutSeries.ColorModel>
<chart:ChartColorModel Palette="Custom">
<chart:ChartColorModel.CustomBrushes>
<Color>#F7941D</Color>
<Color>#00BBBB</Color>
<Color>#FFCC33</Color>
<Color>#ACD373</Color>
<Color>#D63B2D</Color>
<Color>#f2594b</Color>
</chart:ChartColorModel.CustomBrushes>
</chart:ChartColorModel>
</chart:DoughnutSeries.ColorModel>
<chart:DoughnutSeries.DataMarker>
<chart:ChartDataMarker LabelContent="YValue">
<chart:ChartDataMarker.LabelStyle>
<chart:DataMarkerLabelStyle Font="25" Margin="2">
</chart:DataMarkerLabelStyle>
</chart:ChartDataMarker.LabelStyle>
</chart:ChartDataMarker>
</chart:DoughnutSeries.DataMarker>
</chart:DoughnutSeries>
</chart:SfChart>
Attachment:
android_legends_759f4c4b.zip