Converting old code to new

Greetings,


Recently I upgraded to AsposeTotal, which includes a much newer version of Slides for .Net. Under the Old code method, the following code worked:

private void changeCellValue(ref ChartEx chart)
{
foreach (Aspose.Slides.Pptx.Charts.ChartSeriesEx series in chart.ChartData.Series)
{
foreach (Aspose.Slides.Pptx.Charts.ChartDataCell cell in series.Values)
{
if (cell.Value != null)
{
cell.Value = 15.5;
}
}
}
}

I am having a bit of difficulty translating this code snippet to the latest version equivalent. Any suggestions?

Much appreciated.

Hi Scott,


Thank you for your interest in Aspose.Slides.

I have observed your comments and the sample code shared by you. I would like to share with you that in latest API you need to write ‘ChartEx’ as ‘IChart’ and “Aspose.Slides.Pptx.Charts.ChartSeriesEx” as “Aspose.Slides.Charts.ChartSeries”. Please share with us if you are trying to access the cells as shown in the attached image (see chart.JPG), or not?
I will be able to proceed further as soon as this information is shared by you.

Best Regards,

Thank you Adnan,


Yes, I am interested in particular with accessing the Cells within the chart. I need to update each cells’ data.

I am aware of the changes you mentioned and have implemented them. This far, my code looks like this:

void processCellsInsideSeries(ref IChart chart)
{
foreach (IChartSeries series in chart.ChartData.Series)
{
foreach (IChartDataPoint cell in series.DataPoints)
{
cell.Value.Data = getValueAsDouble(…);
}
}
}

Seems to be working but I’d like to verify that I am not missing something.

Many thanks again.

Hi Scott,


We are glad to know that your problem is resolved and things have started working on your end. I have observed the sample code shared by you and like to share with you that you are doing it right and not missing anything.

Please feel free to contact us if we could be of any help to you.

Best Regards,