We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to increase Data label width in pie chart

hey @mudassir.fayyaz,

please help me to find out actual height & width of pie chart data-label, and also share source to set manually width of data label, kindly refer snapshot of PPTx (format data label > label option > text option > Size > width ) property. required label position always center only .

Thanks!pieLabelIssue.jpg (79.4 KB)

@prashant.barwe,

I have observed your requirements and suggest you to please try using following sample code.

public static void PieChartLabel()
{
  
    using (Presentation presentation = new Presentation())
    {
        IChart chart = presentation.Slides[0].Shapes.AddChart(ChartType.Pie, 50, 50, 500, 400);
        chart.ChartData.Series[0].Labels.DefaultDataLabelFormat.ShowValue = true;
        chart.ChartData.Series[0].Labels.DefaultDataLabelFormat.ShowLabelAsDataCallout = true;
        chart.ChartData.Series[0].Labels[2].DataLabelFormat.ShowLabelAsDataCallout = false;
        chart.ChartData.Series[0].Labels[2].AddTextFrameForOverriding("This is long long long text string with chart label");
        chart.ChartData.Series[0].Labels[2].Width = 100;
        presentation.Save( "c:\\Aspose Data\\DisplayChartLabels_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
    }
}

@mudassir.fayyaz,
I worked with below code but its not worked .Please give alternative solution and for this chart area is very less(5 cm^2)

IDataLabelCollection lblCol= iChart.getChartData().getSeries().get_Item(0).getLabels();
lblCol.getDefaultDataLabelFormat().setShowValue(true);
lblCol.getDefaultDataLabelFormat().setShowLabelAsDataCallout(true);

for(IDataLabel label :lblCol){
label.getDataLabelFormat().setShowLabelAsDataCallout(false);
label.setWidth(100f);
}

@Pravin_Pansare,

I request you to please provide working sample code along with generated presentation and desired output presentation. I will work with your sample code to investigate the issue further and help you out.