Can AccumulationChart to display labels in percentage?

Hi,

How to tell AccumulationChart to display labels in percentage? or percentage need to be computed at the data level?


 <SfAccumulationChart ID="Sources" EnableBorderOnMouseMove="false" Title="Incident by Sources">

                            <AccumulationChartTooltipSettings Header="" Format="<b>${point.x}</b><br>Source : <b>${point.y} incidents</b>" Enable="true"></AccumulationChartTooltipSettings>

                            <AccumulationChartLegendSettings Visible="false"></AccumulationChartLegendSettings>

                            <AccumulationChartSeriesCollection>

                                <AccumulationChartSeries DataSource="@PieDataIncidentBySource" XName="Labels" YName="Val" Name="Sources" Explode="true" ExplodeOffset="0%" ExplodeIndex="0">

                                    <AccumulationDataLabelSettings Visible="true" Name="DataLabelMappingName" Position="AccumulationLabelPosition.Inside">

                                        <AccumulationChartConnector Length="20px" Type="ConnectorType.Curve"></AccumulationChartConnector>

                                        <AccumulationChartDataLabelFont FontWeight="600"></AccumulationChartDataLabelFont>


                                    </AccumulationDataLabelSettings>

                                    <AccumulationChartAnimation Enable="true"></AccumulationChartAnimation>

                                </AccumulationChartSeries>

                            </AccumulationChartSeriesCollection>

                        </SfAccumulationChart>



Regards

Sao




1 Reply 1 reply marked as answer

DG Durga Gopalakrishnan Syncfusion Team February 27, 2023 12:38 PM UTC

Hi Sao,


Greetings from Syncfusion.


We recommend you to use OnDataLabelRender event to customize the data labels based on your requirement. Please check with the below snippet and sample.


<SfAccumulationChart>

    <AccumulationChartEvents OnDataLabelRender="DataLabelRenderEvent">

    </AccumulationChartEvents>

</SfAccumulationChart>

 

@code {

    public void DataLabelRenderEvent(AccumulationTextRenderEventArgs args)

    {

        args.Text = args.Point.Percentage + "%";

    }

}



Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/PiePercent-408559498.zip


Kindly revert us if you have any concerns.


Regards,

Durga Gopalakrishnan.


Marked as answer
Loader.
Up arrow icon