render method
dynamic
render()
override
Implementation
render() {
var ctx = this.startRender();
double start = 0;
double total = 0;
var c = 0;
for (var i = 0; i < items.length; i++) {
total += items[i].weight;
}
for (var i = 0; i < items.length; i++) {
if (i == items.length - 1 && c == 0) {
//make sure last color is different than first
c = 1;
}
if (items[i].color == null) {
items[i].color = _colors[c];
}
drawSegment(ctx, items[i], start, total);
c++;
if (c >= _colors.length) {
c = 0;
}
start += items[i].weight;
}
}