Using aspose-cells-24.5, we are running into a situation where for certain charts the display unit for the y-axis does not process when generating images. This issue is specific to certain charts, and seems to be resolved when we manually move the display unit over by even a few pixels (see video below).
For print options, we are using the following settings:
final ImageOrPrintOptions options = new ImageOrPrintOptions();
options.setOnePagePerSheet(true);
options.setImageType(imageType.toAsposeImageType());
options.setOnePagePerSheet(true);
// enable antialiasing for smooth text
// note that antialiasing is enabled by default locally, but not on dev/canary/prod
options.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
options.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
if (imageType == PresentationImageType.SVG) {
options.setTransparent(true);
options.setOptimized(true);
}
if (imageType == PresentationImageType.PNG) {
// for tables / dashboards
options.setDesiredSize(IMAGE_DEFAULT_MAX_WIDTH, IMAGE_DEFAULT_MAX_HEIGHT, IMAGE_KEEP_ASPECT_RATIO);
// for charts
options.setHorizontalResolution(IMAGE_DEFAULT_QUALITY_DPI);
options.setVerticalResolution(IMAGE_DEFAULT_QUALITY_DPI);
}
@Nirmal1027
It seems you are experiencing an issue with the display units on the y-axis not appearing correctly for certain charts when generating images using Aspose.Cells. This problem may be related to how the chart is rendered, particularly if it resolves when you manually adjust the display unit position.
To troubleshoot this issue, you can try the following steps:
-
Check Chart Type: Ensure that the chart type you are using is compatible with the display units you want to show. Some chart types may have limitations regarding axis formatting.
-
Adjust ImageOrPrintOptions: You are already using ImageOrPrintOptions
to set rendering hints for anti-aliasing, which is good. However, you might want to experiment with other properties, such as the resolution settings, to see if they affect the rendering of the display units.
-
Update Aspose.Cells: If you are using version 24.5, consider checking for any updates or patches that may address this specific issue. Sometimes, bugs are fixed in newer releases.
-
Manual Adjustment: As you mentioned, manually moving the display unit by a few pixels resolves the issue. This suggests that there might be a rendering bug. If possible, you could implement a workaround in your code to programmatically adjust the position of the display unit based on the chart’s dimensions.
Here is a basic example of how you might set up your chart rendering with ImageOrPrintOptions
:
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.setOnePagePerSheet(true);
options.setImageType(imageType.toAsposeImageType());
options.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
options.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
options.setVerticalResolution(300);
options.setHorizontalResolution(300);
// Convert chart to image
chart.toImage("output_chart.png", options);
If the problem persists, consider reaching out to Aspose support with specific details about the charts that are causing issues, including the chart type and any relevant data.
For further assistance, you might want to check the ChartRendering example for additional context on how to set up your charts and rendering options.
If you have any more questions or need further assistance, feel free to ask!
I was unable to upload a video here, so here are the pictures. The first picture shows what was generated by aspose. And the second picture shows the excel chart that we would like to process.
Screenshot 2025-03-19 at 8.00.54 AM.jpg (78.1 KB)
Screenshot 2025-03-19 at 8.01.40 AM.jpg (101.4 KB)
@Nirmal1027
Could you share the template file here? We will check it ASAP.
Hi @simon.zhao , for some reason I am not able to attach the template file to this post. But, I uploaded the excel file to onedrive, here is the public link
@Nirmal1027
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): CELLSNET-58060
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.