1

I am using aspose-slides-17.3-jdk16.jar for java. I have created the Area Chart using IChartDataWorkbook. I have used multiple series to plot area chart and following image is the chart output, where the data labels are overlapped. enter image description here

Is there any way to organize or fit the data labels properly?

Chandra shekar
  • 240
  • 1
  • 12

1 Answers1

2

@Chandra Shekar,

I have observed your requirements and like to mention that you can try using different options label.getDataLabelFormat().setLabelPosition() and label.getDataLabelFormat().setShowLabelAsDataCallout(true) methods on your end to set the individual label positions for chart data points. You can please try using following sample code on your end and may alter this as per your requirements on your end.

public static void TestAreaChart()
{
    Presentation pres = new Presentation();

    IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(ChartType.Area, 50, 50, 500, 400);
    chart.getChartData().getSeries().get_Item(0).getLabels().getDefaultDataLabelFormat().setShowValue(true);
    chart.getChartData().getSeries().get_Item(0).getLabels().getDefaultDataLabelFormat()
                    .setShowLabelAsDataCallout(true);
    chart.getChartData().getSeries().get_Item(0).getLabels().get_Item(2).getDataLabelFormat()
                    .setShowLabelAsDataCallout(true);
    chart.getChartData().getSeries().get_Item(0).getLabels().get_Item(2).getDataLabelFormat()
            .setPosition(LegendDataLabelPosition.OutsideEnd);

    pres.save("C:\\Aspose Data\\AreaChart.pptx", SaveFormat.Pptx);

}

I am working as Support developer/ Evangelist at Aspose.

Mudassir
  • 433
  • 2
  • 7