dataRange property

Range? get dataRange

Gets the data range for the chart series.

Implementation

Range? get dataRange {
  return _dataRange;
}
set dataRange (Range? value)

sets the data range for the chart series.

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 = ChartCollection(sheet);
Chart chart = charts.add();
chart.chartType = ExcelChartType.bar;
chart.dataRange = sheet.getRangeByName('A1:B4');
sheet.charts = charts;
List<int> bytes = workbook.saveAsStream();
File('Chart.xlsx').writeAsBytes(bytes);
workbook.dispose();

Implementation

set dataRange(Range? value) {
  if (_dataRange != value) {
    _dataRange = value;
    if (value == null) {
      return;
    }
    final ExcelChartType type = chartType;
    _onDataRangeChanged(type);

    //ChartSerie serie = m_series[0];
  }
}