File size: 1,046 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
KB.component('chart-project-estimated-actual-column', function (containerElement, options) {

    this.render = function () {
        var spent = [options.labelSpent];
        var estimated = [options.labelEstimated];
        var columns = [];

        for (var column in options.metrics) {
            spent.push(options.metrics[column].hours_spent);
            estimated.push(options.metrics[column].hours_estimated);
            columns.push(options.metrics[column].title);
        }

        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: columns
                }
            },
            legend: {
                show: true
            }
        });
    };
});