We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create Chart on it's own worksheet

How would you go about creating a chart on a different worksheet then the data is on?


You should use the full naming that includes the sheet number.



Here, DataSheet is a name of sheet that contains data and it refers cells from A1 to A12

Thanks. I noticed that using the built in excel classes it’s possible to create a worksheet that is just a chart, no rows or columns. Is there a way to mimic this using Aspose?


Yes, please provide a SheetType.CHART while creating a worksheet.

Please see the code below, it will add a chart sheet and a chart with a data from data sheet. The code is partial but will give you an idea.


Worksheet chartSheet = workbook.getWorksheets().addSheet(SheetType.CHART);

Chart ch = chartSheet.getCharts().addChart(ChartType.COLUMN_STACKED, 10,10, 50, 50);

ch.getNSeries().add("=DataSheet!$A$1:$A$12", true);

Thank you so much. This is exactly what I was looking for.