Exception When Creating Waterfall Chart with No Data Points in Java

Aspose.Slides for Java (version 25.11, jdk16)
Environment:
Java version: 21
Aspose.Slides Gradle dependency: com.aspose:aspose-slides:25.11:jdk16
Description:
We are trying to generate a PowerPoint slide with a Waterfall chart using Aspose.Slides for Java. The requirement is to create the chart with no data points (i.e., both categories and series are cleared after chart creation). When running the following code, we encounter an exception (please see stack trace below).
Sample code -

import com.aspose.slides.ChartType;
import com.aspose.slides.IChart;
import com.aspose.slides.ISlide;
import com.aspose.slides.Presentation;
import com.aspose.slides.SaveFormat;

import java.nio.file.Files;
import java.nio.file.Path;

public class EmptyWaterfallChartSample {

    public static void main(String[] args) throws Exception {
        Path outDir = Path.of("out");
        Files.createDirectories(outDir);
        String outputFile = outDir.resolve("waterfall-no-datapoints.pptx").toString();

        Presentation pres = new Presentation();
        try {
            ISlide slide = pres.getSlides().get_Item(0);

            // Add a waterfall chart shape
            IChart chart = slide.getShapes().addChart(ChartType.Waterfall, 80, 80, 800, 420);

            // Remove all default categories/series so no data points are plotted
            chart.getChartData().getSeries().clear();
            chart.getChartData().getCategories().clear();

            // Optional: hide legend for cleaner empty chart
            chart.setLegend(false);

            pres.save(outputFile, SaveFormat.Pptx);
            System.out.println("Generated: " + outputFile);
        } finally {
            pres.dispose();
        }
    }
}

Please clarify if Waterfall charts require at least one data point, or if this is a bug.

@VaradS,
Thank you for reporting the issue. I have reproduced the problem where an exception is thrown when creating a Waterfall chart with no data points. We apologize for any inconvenience caused.

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

Issue ID(s): SLIDESJAVA-39823

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.

@VaradS,
Our developers have investigated the case.

Using these lines of code completely clears all underlying chart data. This means that when you save the presentation, the chart contains no data.

chart.getChartData().getSeries().clear();
chart.getChartData().getCategories().clear();

Since the presentation with the expected result was not provided, we can assume that you deleted the series and categories and then saved the presentation. However, to preserve the required structure so the chart remains usable in PowerPoint, you should use a different approach—clear the workbook instead.

Presentation presentation = new Presentation();
try {
    ISlide slide = presentation.getSlides().get_Item(0);

    IChart chart = slide.getShapes().addChart(ChartType.Waterfall, 80, 80, 800, 420);

    chart.getChartData().getChartDataWorkbook().clear(0);
    chart.setLegend(false);

    presentation.save("output.pptx", SaveFormat.Pptx);
} finally {
    presentation.dispose();
}

More examples:
Manage Chart Workbooks in Presentations Using Java|Aspose.Slides Documentation