File size: 1,076 Bytes
e4f4821 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
KB.component('chart-project-time-comparison', function (containerElement, options) {
this.render = function () {
var spent = [options.labelSpent];
var estimated = [options.labelEstimated];
var categories = [];
for (var status in options.metrics) {
spent.push(options.metrics[status].time_spent);
estimated.push(options.metrics[status].time_estimated);
categories.push(status === 'open' ? options.labelOpen : options.labelClosed);
}
KB.dom(containerElement).add(KB.dom('div').attr('id', 'chart').build());
c3.generate({
data: {
columns: [spent, estimated],
type: 'bar'
},
bar: {
width: {
ratio: 0.2
}
},
axis: {
x: {
type: 'category',
categories: categories
}
},
legend: {
show: true
}
});
};
});
|