How to Set the Border and Fill of Chart Data Labels to Automatic in Java?

Hi,
I have created a line chart using the following sample code.

Presentation pres = new Presentation();
    ISlide sld = pres.getSlides().get_Item(0);
    IChart chart = sld.getShapes().addChart(com.aspose.slides.ChartType.Line, 20, 85, 600, 400);
    int defaultWorksheetIndex = 0;
    IChartDataWorkbook fact = chart.getChartData().getChartDataWorkbook();
    chart.getChartData().getSeries().clear();

    // Add new series
    chart.getChartData().getSeries().add(fact.getCell(defaultWorksheetIndex, 0, 1, "Series 1"), chart.getType());
    chart.getChartData().getSeries().add(fact.getCell(defaultWorksheetIndex, 0, 2, "Series 2"), chart.getType());
    chart.getChartData().getSeries().add(fact.getCell(defaultWorksheetIndex, 0, 3, "Series 3"), chart.getType());
    chart.getChartData().getSeries().add(fact.getCell(defaultWorksheetIndex, 0, 4, "Series 4"), chart.getType());

    // Adding new categories
    chart.getChartData().getCategories().add(fact.getCell(defaultWorksheetIndex, 1, 0, "Cat 1"));
    chart.getChartData().getCategories().add(fact.getCell(defaultWorksheetIndex, 2, 0, "Cat 2"));
    chart.getChartData().getCategories().add(fact.getCell(defaultWorksheetIndex, 3, 0, "Cat 3"));
    chart.getChartData().getCategories().add(fact.getCell(defaultWorksheetIndex, 4, 0, "Cat 4"));

    // Take first chart series
    IChartSeries series = chart.getChartData().getSeries().get_Item(0);
    // Now populating series data
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 1, 1, 29.3));
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 2, 1, 35.5));
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 3, 1, 48.9));
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 4, 1, 54.5));

    // Take second chart series
    series = chart.getChartData().getSeries().get_Item(1);
    // Now populating series data
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 1, 2, 42.4));
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 2, 2, 28.6));
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 3, 2, 31.8));
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 4, 2, 0));

    // Take third chart series
    series = chart.getChartData().getSeries().get_Item(2);
    // Now populating series data
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 1, 3, 20.3));
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 2, 3, 12.8));
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 3, 3, 40.3));
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 4, 3, 34));

    // Take fourth chart series
    series = chart.getChartData().getSeries().get_Item(3);
    // Now populating series data
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 1, 4, 12.3));
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 2, 4, 23));
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 3, 4, 9.1));
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, 4, 4, 22.5));

    chart.getChartData().getSeries().get_Item(0).getLabels().getDefaultDataLabelFormat().setShowValue(true);
    chart.getChartData().getSeries().get_Item(1).getLabels().getDefaultDataLabelFormat().setShowValue(true);
    chart.getChartData().getSeries().get_Item(2).getLabels().getDefaultDataLabelFormat().setShowValue(true);
    chart.getChartData().getSeries().get_Item(3).getLabels().getDefaultDataLabelFormat().setShowValue(true);
    IChartSeries seies=chart.getChartData().getSeries().get_Item(0);
    chart.getLegend().setPosition(LegendPositionType.Bottom);
    pres.save("AsposeLineChart-01.pptx", SaveFormat.Pptx);

I want to have the “automatic” option selected for fill and border. Can you provide a sample code to do that?
PFA screenshot for the options I want to have in ppt.
Screenshot 2025-08-19 163236.png (152.6 KB)

@manavjaiswal

To set the fill and border of your chart series to “automatic” in Aspose.Slides, you can use the following code snippet. This will ensure that the chart uses the default styles for both the fill and border:

// Assuming you have already created your chart and added series
IChartSeries series = chart.getChartData().getSeries().get_Item(0);

// Set the fill format to automatic
series.getFormat().getFillFormat().setFillType(FillType.Automatic);

// Set the line format to automatic
series.getFormat().getLineFormat().setFillType(FillType.Automatic);

This code sets the fill and line formats of the first series in your chart to automatic, allowing the chart to use the default styles. You can repeat this for other series as needed.

Next Steps: If you need to apply this to multiple series, simply loop through the series collection and apply the same settings.

If you have any further questions or need additional assistance, feel free to ask!

@manavjaiswal,
Thank you for posting the question.

We have opened the following new ticket(s) in our internal issue tracking system and will consider your question according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESJAVA-39708

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you found earlier (filed as SLIDESJAVA-39708) have been resolved in Aspose.Slides for Java 25.10 (Maven, JAR).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.