plotPoints method
void
plotPoints(
- dynamic dataList,
- List uniqueValues
)
Implementation
void plotPoints(dynamic dataList, List uniqueValues) {
xValues.clear();
barDataPoint.clear();
var type = this.type?.toLowerCase().trim();
switch (type) {
case 'stacked':
stackDataPoint.clear();
plotFunction = pointFromStackedBarData;
break;
case 'grouped':
rodDataPoint.clear();
plotFunction = pointFromGroupedBarData;
barDataPoint.add(BarChartGroupDataExtended(this, data,
x: uniqueValues.length, barRods: rodDataPoint));
break;
case 'waterfall':
plotFunction = pointFromWaterfallBarData;
break;
case 'bar':
default:
plotFunction = pointFromBarData;
break;
}
int len = uniqueValues.length;
for (var i = 0; i < dataList.length; i++) {
//set the data of the series for databinding
data = dataList[i];
if (type == 'bar' || type == 'waterfall' || type == null) {
xValues.add(x);
x = len;
len += 1;
} else {
x = len;
}
plotFunction!();
}
if (type == 'stacked') {
stackDataPoint.sort((b, a) => a.toY.compareTo(b.toY));
barDataPoint.add(BarChartGroupDataExtended(this, data,
x: uniqueValues.length,
barRods: [
BarChartRodDataExtended(this, data,
toY: stackDataPoint[0].toY,
color: Colors.transparent,
rodStackItems: stackDataPoint)
]));
}
dataList = null;
}