Hi,
I am updating a chart by below code.
But the issue I am getting is, if the user wants to update the chart data manually in the updated presentation file, e.g., updating any data, add/remove/edit the series or category, it is not reflecting in the chart.
Kindly help me.
//Instantiate PresentationEx class that represents PPTX file
PresentationEx pres = new PresentationEx(“D:\AsposeChart.pptx”);
//Access first slide
SlideEx sld = pres.Slides[0];
// Add chart with default data
ChartEx chart = (ChartEx)sld.Shapes[0];
//Setting the index of chart data sheet
int defaultWorksheetIndex = 0;
//Getting the chart data worksheet
ChartDataCellFactory fact = chart.ChartData.ChartDataCellFactory;
//DataTable dt = GetDataTable(chart.Type.ToString());
//Take first chart series
ChartSeriesEx series = chart.ChartData.Series[0];
//Now updating series data
fact.GetCell(defaultWorksheetIndex, 0, 1, “New_Series1”);//modifying series name
series.Values[0].Value = 0.90;
series.Values[1].Value = 0.123;
series.Values[2].Value = 0.44;
//Take Second chart series
series = chart.ChartData.Series[1];
//Now updating series data
fact.GetCell(defaultWorksheetIndex, 0, 2, “New_Series2”);//modifying series name
series.Values[0].Value = 0.23;
series.Values[1].Value = 0.67;
series.Values[2].Value = 0.99;
//Now, Adding a new series
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 3, “Series 3”), chart.Type);
//Take 3rd chart series
series = chart.ChartData.Series[2];
//Now populating series data
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 1, 3, 0.20));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 2, 3, 0.50));
series.Values.Add(fact.GetCell(defaultWorksheetIndex, 3, 3, 0.30));
chart.Type = ChartTypeEx.ClusteredCylinder;
// Save presentation with chart
pres.Write(@“D:\AsposeChartMoodified.pptx”);
Thanks,
Laxmikanta
Hi Laxmikanta,
Hi Mudassir,
By using the Aspose.Slides for .NET 6.9.0, the chart is getting updating after the data change. But how to add a new series or category to the chart manually. How to re-size the chart data range? I am not getting the range of the updated chart.
Thanks,
Laxmikanta
Hi Laxmikanta,
Hi Mudassir,
I am elaborating the issue.
Step 1:
By Microsoft Office 2010, if we create a MSO chart and right click and edit data we can see a excel sheet where “To resize chart data range, drag lower right corner of range.” is written below of chart data and a blue line is selecting the chart data range, so we can drag lower right corner of range.
But after modifying the chart by Aspose, that blue line, which should select the chart data range is missing. If so what is the meaning of writing “To resize chart data range, drag lower right corner of range.”
Step 2:
By Microsoft Office 2010, if we create a MSO chart and right click and edit data we can see a excel sheet. In the excel sheet we can add data next to the selected data range(marking by the blue line), the data range automatically added.
This feature I am not getting after updating the chart by Aspose. If so what is the meaning of writing "To resize chart data range, drag lower right corner of range."
For more detail look at the attached image.
Thanks,
Laxmikanta
Hi Laxmikanta,
Hi,
Any updates in SLIDESNET-33853 ???
Hi Laxmikanta,
The issues you have found earlier (filed as SLIDESNET-33853) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.