Chart Legend Cropped

I'm having difficulty working around legend cropping issues on the circular chart. I keep trying different permutations of size settings but can't come up with anything to make it work reliably. Even if I adjust the PieSeries radius down to 0.5, I still get cropping.

2023-12-14 15_10_57-.png

It seems like the cropping is the same regardless of the PieSeries size. Here the chart is displayed without a custom radius.

b2023-12-14 15_19_15-.png

How can I make the legend take the space it needs and then allow the PieSeries to use the remaining space?

Thanks so much for your great support!


                <Border Style="{DynamicResource DashboardCardStyle}" HorizontalOptions="FillAndExpand">

                    <chart:SfCircularChart MaximumHeightRequest="250">
                        <chart:PieSeries ItemsSource="{Binding PieChartDataPoints}"
                                         XBindingPath="Level"
                                         YBindingPath="Percentage"
                                         ShowDataLabels="True"
                                         PaletteBrushes="{Binding SfPieChartBrushes}"
                                         EnableAnimation="True"
                                         Stroke="White"
                                         StrokeWidth="2"
                                         >
                            <chart:PieSeries.DataLabelSettings>
                                <chart:CircularDataLabelSettings>
                                    <chart:CircularDataLabelSettings.LabelStyle>
                                        <chart:ChartDataLabelStyle LabelFormat="#.##'%"/>
                                    </chart:CircularDataLabelSettings.LabelStyle>
                                </chart:CircularDataLabelSettings>
                            </chart:PieSeries.DataLabelSettings>
                        </chart:PieSeries>
                        <chart:SfCircularChart.Legend>
                            <chart:ChartLegend Placement="Right">
                                <chart:ChartLegend.ItemTemplate>
                                    <DataTemplate>
                                        <StackLayout Orientation="Horizontal" BackgroundColor="LightGoldenrodYellow" Margin="0,0,10,0">
                                            <Ellipse WidthRequest="14" HeightRequest="14" Margin="3" Fill="{Binding IconBrush}"/>
                                            <Label Text="{Binding Text}" />
                                        </StackLayout>
                                    </DataTemplate>
                                </chart:ChartLegend.ItemTemplate>
                            </chart:ChartLegend>
                        </chart:SfCircularChart.Legend>
                    </chart:SfCircularChart>
                </Border>

4 Replies

SA Saiyath Ali Fathima Bee Moidhin Abdhul Kathar Syncfusion Team December 15, 2023 12:09 PM UTC

Hi Ben,

 

We would like to inform you that the mentioned issue, "Legend Crop," was reproduced with.NET 8.0. Our development team is actively working on your query and will update our response within two business days on December 19, 2023.

 

Regards,

Saiyath Ali Fathima M



NM Nanthini Mahalingam Syncfusion Team December 20, 2023 01:30 PM UTC

Hi Ben,


We would like to let you know that we suggest using the LineBreakMode as WordWrap in the legend template. By using this, we are able to view the entire legend template in the view. For reference, we have provided the code snippet and demo.


<chart:ChartLegend.ItemTemplate>

   <DataTemplate>

       <StackLayout Orientation="Horizontal" BackgroundColor="LightGoldenrodYellow" Margin="0,0,10,0">

           <Ellipse WidthRequest="12" HeightRequest="12" Margin="3" Fill="{Binding IconBrush}"/>

           <Label Text="{Binding Text}" LineBreakMode="WordWrap" WidthRequest="40" />

       </StackLayout>

   </DataTemplate>

</chart:ChartLegend.ItemTemplate>


Output:

A screenshot of a pie chart

Description automatically generated

We hope it will help you achieve your requirement.


Regards,

Nanthini M



BH Ben Holtsclaw December 21, 2023 07:46 PM UTC

Thank you for the suggestion, but I'm afraid that doesn't look visually appealing at all. Is further work being done on this, or is this the final solution?



NM Nanthini Mahalingam Syncfusion Team December 25, 2023 03:37 PM UTC

We need to inform you that we currently do not have direct support for "Custom Layout Support for Chart Legend in .NET MAUI" which is used to align the legend items in the desired view. We have already created a feature request

For this support.You can find the feedback portal at the following link: https://www.syncfusion.com/feedback/43478/custom-layout-support-for-chart-legend-in-net-maui


We will prioritize the features for each release based on demand and priority. Therefore, this feature will be available in one of our upcoming releases. You can also track the status of the feature using the feedback provided.


If you have any additional specifications or suggestions for the bug report, please add them as a comment in the feedback portal.


Loader.
Up arrow icon