Chart in Exported PDF Is Lost. Dates Are Displayed Incorrectly on Horizontal Chart Axis

aspose slide chart date horizontal axie problem.7z (292.9 KB)
the zip has all file.
the question decribe like that:
i want to build a line chart with a date type horizontal axie.
i have set the number format in worksheet and set the horizontal axie format.
but all fail. what’s more, the pdf will lost line chart.

the key code:

// Adds new categories
for(int i = 1; i <= 400; i++){
    chart.getChartData().getCategories().add(fact.getCell(defaultWorksheetIndex, i, 0, 44562+i));
    fact.getCell(defaultWorksheetIndex, i, 0).setCustomNumberFormat("m\"月\"d\"日\"");
}

// 设置水平轴为日期坐标轴
chart.getAxes().getHorizontalAxis().setCategoryAxisType(CategoryAxisType.Date);
// 设置水平轴显示的格式
chart.getAxes().getHorizontalAxis().setNumberFormat("m\"月\"");

@BIGSHU can you please attach the source presentation (ppt, pptx, etc.) file?

@BIGSHU,
Thank you for reporting on the issues.

I reproduced the problem with the missing chart in the output PDF document and incorrect dates in the output presentation.

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-39164 (Chart is lost when saving a presentation to PDF file)
  SLIDESJAVA-39165 (Dates are displayed incorrectly on the horizontal chart axis)

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.

Please also share the following additional information if it is possible:

  • OS version on which the code was executed
  • JDK version in your app

Jdk is version 1.8 and my os version is win10.

The zip file i have uploaded contains the source presentation.

@BIGSHU,
Thank you for the additional information. I forwarded it to our developers.

@BIGSHU,
As for the SLIDESJAVA-39165 issue, our developers have investigated the case. Please try to replace the relevant parts in your code with the following parts:

// Adds new categories
for (int i = 1; i <= 10; i++) {
    chart.getChartData().getCategories().add(fact.getCell(defaultWorksheetIndex, i, 0, String.valueOf(i) + (char) 44562));
    fact.getCell(defaultWorksheetIndex, i, 0).setCustomNumberFormat("m\"月\"d\"日\"");
}

and

for (int row = 1; row <= 10; row++) {
    series.getDataPoints().addDataPointForLineSeries(fact.getCell(defaultWorksheetIndex, row, col, 100 * col + row));
}

The issues you found earlier (filed as SLIDESJAVA-39164) have been fixed in Aspose.Slides for Java 23.8 (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.