Free Support Forum - aspose.com

Pie Chart Leader Lines in Aspose . Slides Java

I have the following code to generate a pie chart.
Everything works fine but i’m not able to get leader lines although it’s value has been set to true.

   Presentation presentation = new Presentation();

    // Access first slide
    ISlide slides = presentation.getSlides().get_Item(0);

    // Add chart with default data
    IChart chart = slides.getShapes().addChart(ChartType.Pie, 100, 100, 400, 400);

    // Setting chart Title
    chart.getChartTitle().addTextFrameForOverriding("Sample Title");
    chart.getChartTitle().getTextFrameForOverriding().getTextFrameFormat().setCenterText (NullableBool.True);
    chart.getChartTitle().setHeight(20);
    chart.hasTitle();

    // Set first series to Show Values
    chart.getChartData().getSeries().get_Item(0).getLabels().getDefaultDataLabelFormat().setShowValue(true);

    // Setting the index of chart data sheet
    int defaultWorksheetIndex = 0;


    // Getting the chart data worksheet
    IChartDataWorkbook fact = chart.getChartData().getChartDataWorkbook();

    // Delete default generated series and categories
    chart.getChartData().getSeries().clear();
    chart.getChartData().getCategories().clear();

    // Adding new categories
    chart.getChartData().getCategories().add(fact.getCell(0, 1, 0, "First Qtr"));
    chart.getChartData().getCategories().add(fact.getCell(0, 2, 0, "2nd Qtr"));
    chart.getChartData().getCategories().add(fact.getCell(0, 3, 0, "3rd Qtr"));

    // Adding new series
    IChartSeries series = chart.getChartData().getSeries().add(fact.getCell(0, 0, 1, "Series 1"), chart.getType());

    // Now populating series data
    series.getDataPoints().addDataPointForPieSeries(fact.getCell(defaultWorksheetIndex, 1, 1, 20));
    series.getDataPoints().addDataPointForPieSeries(fact.getCell(defaultWorksheetIndex, 2, 1, 50));
    series.getDataPoints().addDataPointForPieSeries(fact.getCell(defaultWorksheetIndex, 3, 1, 30));

	series.getLabels().getDefaultDataLabelFormat().setShowValue(true);
	series.getLabels().getDefaultDataLabelFormat().setShowCategoryName(true);
	series.getLabels().getDefaultDataLabelFormat().setPosition(LegendDataLabelPosition.OutsideEnd);
	
	series.getLabels().getDefaultDataLabelFormat().setShowLeaderLines(true);
    series.getParentSeriesGroup().setColorVaried(true);
    chart.setLegend(false);

    presentation.save(dataDir + "Sample2.pptx", com.aspose.slides.SaveFormat.Pptx);

@agarwalsarthak121

Can you please try using latest Aspose.Email for Java 20.9 on your end first. In case the issue persist then please share the generated output presentation with issue on your end for further investigation.