dataLabels property
ChartDataLabels
get
dataLabels
Gets chart text area object.
Workbook workbook = Workbook();
Worksheet sheet = workbook.worksheets[0];
sheet.getRangeByName('A1').text = 'Items';
sheet.getRangeByName('B1').text = 'Count';
sheet.getRangeByName('A2').text = 'Beverages';
sheet.getRangeByName('A3').text = 'Condiments';
sheet.getRangeByName('A4').text = 'Confections';
sheet.getRangeByName('B2').number = 2776;
sheet.getRangeByName('B3').number = 1077;
sheet.getRangeByName('B4').number = 2287;
ChartCollection charts = new ChartCollection(sheet);
Chart chart = charts.add();
chart.chartType = ExcelChartType.line;
chart.dataRange = sheet.getRangeByName('A1:B4');
ChartSerie serie = chart.series[0];
serie.dataLabels.IsValue = true;
serie.dataLabels.textArea.size = 12;
serie.dataLabels.textArea.bold = true;
serie.dataLabels.textArea.color = '#0000A0';
serie.linePattern = ExcelChartLinePattern.dash;
chart.isSeriesInRows = false;
sheet.charts = charts;
List<int> bytes = workbook.saveAsStream();
File('Chart.xlsx').writeAsBytes(bytes);
workbook.dispose();
Implementation
ChartDataLabels get dataLabels {
return _dataLabels ??= ChartDataLabels(this);
}