Objective:
We have designed a column chart by hand in PowerPoint, see "chart template" image below.
We want to replace the data behind the chart using spire.presentation.
We want the chart not to lose any of its visual formatting which we set by hand.
We want to simply connect to the chart shape, access the data behind it and replace it with new data.
We do not want to control the chart's visual formatting through code.
We do not want to copy the formatting of one series and apply it to another through code.
Problem:
If the data we want to add has more data values than what was originally in the chart then those data values are not automatically shown in the chart.
This is the data I want to add:
chart.ChartData[1, 0].Value = "Samsung";
chart.ChartData[2, 0].Value = "Apple";
chart.ChartData[3, 0].Value = "Google";
chart.ChartData[4, 0].Value = "Xiaomi";
chart.ChartData[5, 0].Value = "Huawei";
chart.ChartData[6, 0].Value = "Oppo";
chart.ChartData[7, 0].Value = "Alcatel";
chart.ChartData[1, 1].Value = 0.1;
chart.ChartData[2, 1].Value = 0.25;
chart.ChartData[3, 1].Value = 0.6;
chart.ChartData[4, 1].Value = 0.2;
chart.ChartData[5, 1].Value = 0.3;
chart.ChartData[6, 1].Value = 0.1;
chart.ChartData[7, 1].Value = 0.4;
The data range behind the chart is not automatically expanded to include the new data value. See "missing data values" image.
Question:
how do we expand the data range behind the chart to include the new data values so that we don't have to control the visual format of the data value through code.