We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Chart to Image conversion - Y-axis values are different in chart image in .NET

Hi, please find the attached image and excel file (files.zip (44.3 KB)).
In excel file go to sheet “Sheet_ColumnClustered3DChart” and check the chart image named “Chart 2”

If you compare this chart which is present in excel sheet with the one attached (“axisImage.png”), Y-axis values are different from excel chart image.

Can you please let us know is this a bug or we are missing something in our implementation.

Below is the code i am using to conver chart object to image.

 Workbook workbook = new Workbook("FilePath of Excel attached");
Worksheet sourceWorksheet = workbook.Worksheets["Sheet_ColumnClustered3DChart"];
ImageOrPrintOptions imageOrPrintOptions = new ImageOrPrintOptions();
            imageOrPrintOptions.OnePagePerSheet = true;
            // Always use Png as its file size is 8 times lesser than of Jpeg.
            imageOrPrintOptions.ImageType = ImageType.Png;
            imageOrPrintOptions.HorizontalResolution = 200;
            imageOrPrintOptions.VerticalResolution = 200;
            imageOrPrintOptions.IsCellAutoFit = true;
    Aspose.Cells.Charts.Chart sourceChart = sourceWorksheet.Charts["Chart 2"];
                                    imageToReturn = sourceChart.ToImage(imageOrPrintOptions);

Please provide a fix as soon as you can.



Thanks for the template file and sample code segment.

After an initial test, I am able to observe the issue as you mentioned by using your sample code with your template file. I found that y-axis values are different in the chart image. The issue might be due to small size of the chart’s plot area, so you may extent it a bit. Anyways, we need to look into it if we can improve on it.

I have logged a ticket with an id “CELLSNET-46721” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.