diff options
author | Matthew Cillo <matthewacillo@gmail.com> | 2015-12-07 22:40:55 -0500 |
---|---|---|
committer | Matthew Cillo <matthewacillo@gmail.com> | 2015-12-07 22:45:12 -0500 |
commit | 583e6bf064bbbdd0b031ea429fb1de949ddf64a7 (patch) | |
tree | f88aed231d898172fb2c37b87e9c5310d2de1985 /assets/js/src/CompareHoursColumnChart.js | |
parent | 78fd4d3ee9940bde6d0bef8c611c6a19595e81fd (diff) |
added working template of compare hours
Diffstat (limited to 'assets/js/src/CompareHoursColumnChart.js')
-rw-r--r-- | assets/js/src/CompareHoursColumnChart.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/assets/js/src/CompareHoursColumnChart.js b/assets/js/src/CompareHoursColumnChart.js new file mode 100644 index 00000000..fca67689 --- /dev/null +++ b/assets/js/src/CompareHoursColumnChart.js @@ -0,0 +1,43 @@ +function CompareHoursColumnChart(app) { + this.app = app; +} + +CompareHoursColumnChart.prototype.execute = function() { + var metrics = $("#chart").data("metrics"); + var spent = [$("#chart").data("label-spent")]; + var estimated = [$("#chart").data("label-estimated")]; + var categories = []; + + for (var status in metrics) { + spent.push(parseInt(metrics[status].time_spent)); + estimated.push(parseInt(metrics[status].time_estimated)); + categories.push(status); + } + + console.log(spent); + c3.generate({ + data: { + columns: [spent, estimated], + type: 'bar' + }, + bar: { + width: { + ratio: 0.2 + } + }, + axis: { + x: { + type: 'category', + categories: categories + }, + y: { + tick: { + format: this.app.formatDuration + } + } + }, + legend: { + show: true + } + }); +}; |