randomDataRowsLegends function
Sets up legends names, first several explicitly, rest randomly.
This is used if user does not set legends. This should be kept in sync with colors below.
Implementation
List<String> randomDataRowsLegends(int dataRowsCount) {
List<String> _defaultLegends = List.empty(growable: true);
if (dataRowsCount >= 1) {
_defaultLegends.add('YELLOW');
}
if (dataRowsCount >= 2) {
_defaultLegends.add('GREEN');
}
if (dataRowsCount >= 3) {
_defaultLegends.add('BLUE');
}
if (dataRowsCount >= 4) {
_defaultLegends.add('BLACK');
}
if (dataRowsCount >= 5) {
_defaultLegends.add('GREY');
}
if (dataRowsCount >= 6) {
_defaultLegends.add('ORANGE');
}
if (dataRowsCount > 6) {
for (int i = 3; i < dataRowsCount; i++) {
// todo-1 when large value is generated, it paints outside canvas, fix.
int number = math.Random().nextInt(10000);
_defaultLegends.add('OTHER ' + number.toString());
}
}
return _defaultLegends;
}