Unable to export chart to image using python asposecells.api

I’m trying to export png image using the pie chart in my excel sheet using python aspisecells.

But the labels of the pie chart are pointing to the values in another sheet. Hence while converting chart to image the reference values are getting exported, not the values I see in the sheet.

How to resolve this issue ?

Code I’m using to write chart to image is below.

sheet = workbook.getWorksheets().get(image_sheet_name)

chart = sheet.getCharts().get(chart_name)

Options = ImageOrPrintOptions()
Options.setHorizontalResolution(500)
Options.setVerticalResolution(500)
chart.toImage(img_path, options)

@shwethanayak,

Probably, the labels in the chart are also referring to the values in the other sheet, so that might be the issue with your Excel file itself. You may check the chart in your Excel file by manually opening the file, fix the labels, and then re-save the file. Now use Aspose.Cells for Python to render the chart to an image using the updated/saved Excel file.
If this is not the case or you still find the labels are not referring to your expected values in the same sheet, kindly provide your Excel file containing the chart (you may zip the file prior attaching here). We will check your issue soon.

Yes, labels are pointing to other sheets. Fixed that.

I’m having another issue now. The entire pie chart is not exported to the image.

The centre text of pie chart which shows the total is not getting exported in the image . How to fix that ?

I’m using same code that I shared earlier .

I’m using chart.toImage()

Does sheetrender help us in render the chart or is it only for sheet ?

@shwethanayak,

Is the center text part of the chart object or is it some extra shape or text that also needs to be exported with the chart? Could you please zip and attach the Excel file containing the chart? We will check it soon.