Hi Support,
I’m getting this error while creating chart.
sld = presentation.getSlides().get_Item(4);
for (let i = 0; i < sld.getShapes().size(); i++) {
const shape = sld.getShapes().get_Item(i);
console.log('shape.getName()', shape.getName());
if (shape.getName() == 'Chart 0') {
const chart = shape;
// Sets the index for the chart data sheet
defaultWorksheetIndex = 0;
// Gets the chart data worksheet
fact = chart.getChartData().getChartDataWorkbook();
chart.getChartData().getSeries().clear();
chart.getChartData().getCategories().clear();
fact = chart.getChartData().getChartDataWorkbook();
chart.getChartData().getSeries().add(fact.getCell(0, 0, 1, 'Series 1'), chart.getType());
series = chart.getChartData().getSeries().get_Item(0);
chart.getChartData().getCategories().add(fact.getCell(0, 1, 0, 'C1'));
series.getDataPoints().addDataPointForLineSeries(fact.getCell(0, 1, 1, 24));
chart.getChartData().getCategories().add(fact.getCell(0, 2, 0, 'C2'));
series.getDataPoints().addDataPointForLineSeries(fact.getCell(0, 2, 1, 23));
chart.getChartData().getCategories().add(fact.getCell(0, 3, 0, 'C3'));
series.getDataPoints().addDataPointForLineSeries(fact.getCell(0, 3, 1, -10));
chart.getChartData().getCategories().add(fact.getCell(0, 4, 0, 'C4'));
series.getDataPoints().addDataPointForLineSeries(fact.getCell(0, 4, 1, null));
}
}
Error:
image.png (28.1 KB)
type or paste code here
type or paste code here