dataRowsDefaultColors function
Sets up colors for legends, first several explicitly, rest randomly.
This is used if user does not set colors.
Implementation
List<ui.Color> dataRowsDefaultColors(int dataRowsCount) {
List<ui.Color> _rowsColors = List.empty(growable: true);
if (dataRowsCount >= 1) {
_rowsColors.add(material.Colors.yellow);
}
if (dataRowsCount >= 2) {
_rowsColors.add(material.Colors.green);
}
if (dataRowsCount >= 3) {
_rowsColors.add(material.Colors.blue);
}
if (dataRowsCount >= 4) {
_rowsColors.add(material.Colors.black);
}
if (dataRowsCount >= 5) {
_rowsColors.add(material.Colors.grey);
}
if (dataRowsCount >= 6) {
_rowsColors.add(material.Colors.orange);
}
if (dataRowsCount > 6) {
for (int i = 3; i < dataRowsCount; i++) {
int colorHex = math.Random().nextInt(0xFFFFFF);
int opacityHex = 0xFF;
_rowsColors.add(ui.Color(colorHex + (opacityHex * math.pow(16, 6)).toInt()));
}
}
return _rowsColors;
}