Hi Support,
I’m getting this error while setting position of chart legend.
var java = require('java');
var aspose = aspose || {};
asposeSlides = require("aspose.slides.via.java");
// var license = new asposeSlides.License();
// license.setLicense("Aspose.SlidesforNode.jsviaJava.lic");
var pres = new asposeSlides.Presentation("Plane Type Model Template v3.pptx");
sld = pres.getSlides().get_Item(3);
// Creates the default chart
chart = sld.getShapes().addChart(asposeSlides.ChartType.Line, 0, 0, 400, 400);
// Gets the default chart data worksheet index
defaultWorksheetIndex = 0;
// Gets the chart data worksheet
fact = chart.getChartData().getChartDataWorkbook();
chart.getChartData().getSeries().clear();
chart.getChartData().getCategories().clear();
chart.getLegend().setX(50 / chart.getWidth());
chart.getLegend().setY(50 / chart.getHeight());
chart.getLegend().setWidth(100 / chart.getWidth());
chart.getLegend().setHeight(100 / chart.getHeight());
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));
chart
.getChartData()
.getSeries()
.add(fact.getCell(0, 0, 2, "Series 2"), chart.getType());
//Take second chart series
series2 = chart.getChartData().getSeries().get_Item(1);
//Now populating series data
series2.getDataPoints().addDataPointForLineSeries(fact.getCell(0, 1, 2, 30));
series2.getDataPoints().addDataPointForLineSeries(fact.getCell(0, 2, 2, 10));
series2.getDataPoints().addDataPointForLineSeries(fact.getCell(0, 3, 2, 60));
series2.getDataPoints().addDataPointForLineSeries(fact.getCell(0, 4, 2, 40));
// chart.setLegend(true);
// chart.getLegend().setOverlay(false);
pres.save("out9.pptx", asposeSlides.SaveFormat.Pptx);
console.log("Done");
image.png (35.2 KB)