ChartData constructor

ChartData({
  1. required List<List<double>> dataRows,
  2. required List<String> xUserLabels,
  3. required List<String> dataRowsLegends,
  4. required ChartOptions chartOptions,
  5. List<String>? yUserLabels,
  6. dynamic dataRowsColors,
})

Default constructor only assumes dataRows are set, and assigns default values of dataRowsLegends, dataRowsColors, xUserLabels, yUserLabels.

Implementation

ChartData({
  required this.dataRows,
  required this.xUserLabels,
  required this.dataRowsLegends,
  required this.chartOptions,
  this.yUserLabels,
  dataRowsColors,
}) :
      // Initializing of non-nullable dataRowsColors which is a non-required argument
      // must be in the initializer list by a non-member function (member methods only in constructor)
      dataRowsColors = dataRowsColors ?? dataRowsDefaultColors(dataRows.length) {
  validate();
}