blob: a110e6b4501aa6595825b71976b114e780f78be2 (
plain)
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
|
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.el(containerElement).add(KB.el('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
}
});
};
});
|