flutter-examples icon indicating copy to clipboard operation
flutter-examples copied to clipboard

Pie chart legend icon not able to change

Open gopibathini opened this issue 2 years ago • 1 comments

not able to change icon for defualt legends and also need to display y axis data in legend , in legend builder when i increase container height pie chart size getting reduced. Please help

gopibathini avatar Aug 17 '22 07:08 gopibathini

Hi Team,

Greetings from Syncfusion.

Query 1: Not able to change icon for default legends.

You can customize the legend icon shape using legendIconType property of PieSeries as per the following code snippet.

series: <PieSeries<ChartSampleData, String>>[
              PieSeries<ChartSampleData, String>(
                  dataSource: dataPoints,
                  xValueMapper: (ChartSampleData data, _) => data.x,
                  yValueMapper: (ChartSampleData data, _) => data.y,
                  legendIconType: LegendIconType.diamond),
 ],

Query 2: Need to display y axis data in legend.

You can display the y values in legend items with the help of onLegendItemRender as per the following code snippet.

onLegendItemRender: (LegendRenderArgs args) {
              // You can customize the y axis data by using this text arguments
              args.text = dataPoints[args.pointIndex!].y.toString();
            },

image

Query 3: In legend builder when I increase container height pie chart size getting reduced.

According to the behavior, the pie series size will be calculated using the available size from the legend and title size. So, the pie series size will be reduced while we increase the legend item size in the builder. However, you can render the legend item without affecting the series size by using the offset property of the Legend. Please refer to the following ug to float the legend.

https://help.syncfusion.com/flutter/circular-charts/legend#floating-legend

Thanks, Lokesh.

SriramKiranSenthilkumar avatar Aug 19 '22 05:08 SriramKiranSenthilkumar