add method
Add chart to the chart collection.
Workbook workbook = Workbook();
Worksheet sheet = workbook.worksheets[0];
ChartCollection chart = ChartCollection(sheet);
chart.add();
sheet.charts = chart;
List<int> bytes = workbook.saveAsStream();
File('EmptyChart.xlsx').writeAsBytes(bytes);
workbook.dispose();
Implementation
Chart add() {
final Chart chart = Chart(_worksheet);
chart._series = ChartSeriesCollection(_worksheet, chart);
chart._primaryCategoryAxis = ChartCategoryAxis(_worksheet, chart);
chart._primaryValueAxis = ChartValueAxis(_worksheet, chart);
chart._primaryValueAxis.hasMajorGridLines = true;
chart._plotArea = ChartPlotArea(_worksheet, chart);
innerList.add(chart);
chart.name = 'Chart${innerList.length}';
chart.index = innerList.length;
chart.topRow = 0;
chart.bottomRow = 19;
chart.leftColumn = 0;
chart.rightColumn = 9;
chart.primaryCategoryAxis.numberFormat = 'General';
chart.primaryValueAxis.numberFormat = 'General';
_worksheet.chartCount++;
return chart;
}