Free Support Forum - aspose.com

Unable to refresh chart with new data using Aspose.Slides for .NET

Hi, I came across a problem when updating the data for an existing chart in a PPT. After I updated the values in a ChartDataWorkbook, the chart did not refresh with the updated value in the slide. I had to open it in Office PowerPoint, selected the specified chart, clicked “Edit Data”, and then the chart refreshed.

I was wondering if there is a method like Chart.Refresh() or something that can refresh the chart immediately.

But the weird thing is that, this problem occurred in the latest Aspose.Slides.dll v17.12.1.0, while in older version v15.1.0.0, the problem did not exist, the chart can be auto refreshed after I updated the values in chart data workbook.

Does anyone know what happened?

@14azheng,

I have observed the information shared and have not been able to completely understand the issue incurring on your end. Can you please share the sample project along with source and desired output presentation. We will investigate the issue further on our end to help you on provision of requested information.

AsposeChartUpdate.zip (1.1 MB)

Hi, here attached the sample codes for your reference. What I mean was that, after I run this sample codes which is to update the chart data, the chart’s appearance is not updated, until I “Edit Data” in PowerPoint to open the data sheet, the chart’s appearance refresh.

But what I want is that, the chart’s appearance should be auto refreshed once the chart data is updated.Or is there any method that can manually refresh the chart’s appearance based on the chart data?

Thanks

@14azheng,

I have worked with the presentation file shared by you and have been able to observe the issue specified. An issue with ID SLIDESNET-39807 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.

This is affecting me also. Is there an update on this issue? Is there a workaround in the meantime?

Thanks.

@cpoxon,

Once you set the value directly in chart worksheet, you can use SetRange() method to recalculate the chart data before saving. The Argument inside SetRange() include the sheet information and Cells indices used in chart for holding chart series data points values.

chart.ChartData.SetRange("Sheet1!$A$1:$B$18");

@mudassir.fayyaz

Your suggestion is right, it can force to refresh the chart appearance. But after it refreshes, the pre-set style of chart data points is missing, change to a default style (in my sample, the color of lines and markers will be changed).

I’m not sure if this is a bug, but I think the style of chart should be retained after I use SetRange() method to refresh the chart.

Please take a look at this.

Thanks

@14azheng,

I have observed your comments. Please share source files along with generated result and sample code for further investigation.

@Adnan.Ahmad,

Thanks for your quick revert, Here attached my sample codes v2 AsposeChartUpdate_v2.zip (1.2 MB).

I just added one more statement “chart.ChartData.SetRange(“Sheet1!$A$1:$B$18”);” to force the chart refresh as mudassir suggested.

You can find my comparison from “Before.png” and “After.png”, the format of chart totally changed after I used SetRange method.

Hope this can help your team to figure out the problem.

Thanks

@14azheng,

I have worked with the sample code and source file shared by you and i have been able to reproduce the specified issue. A ticket with ID SLIDESNET-39896 has been logged in our issue tracking system to further investigate and resolve the issue.This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

Dears, may I have any updates on the reported issue? It has been 2 months since the issue was raised.

Thanks

@14azheng,

I regret to share that at present the issues are still unresolved. We request for your patience till the time the issues get resolved. We will update you as soon as the issues will be fixed.

Ok, but why the status shows resolved for both issues?

@14azheng,

The concerned issues have been marked as resolved in Aspose.Slides for .NET 18.6 product release. We will share the good news with you as soon as the product will be shared online.

The issues you have found earlier (filed as SLIDESNET-39807,SLIDESNET-39896) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by mudassir.fayyaz

Hi there,
I am also getting this issue and I am using the latest version of Slides. When I right click on data that in imported from behind excel spreadsheet formatting is lost and the graph changes even though the data does not change. Please advise. Let me know if there is any further information that I can send onto you, code or the output files.
Thanks in advance.

@padair,

I have observed your comments. Can you please share source files along with generated result and sample code so that we may further investigate to help you out.

Hi,
Attached is zip containing sample project. Please reach out if you have any queries.
Thanks in advance.AsposeSampleProject.zip (928.0 KB)

@padair,

I have worked with sample project shared by you. Can you please share source presentation, generated result along with source excel data file so that we may further investigate to help you out.

Apologies, I have re-zipped along with source presentation, generated result along with source excel data file.
SampleAsposeProject.zip (1.0 MB)