diff options
Diffstat (limited to 'assets')
-rw-r--r-- | assets/js/src/CompareHoursColumnChart.js | 43 | ||||
-rw-r--r-- | assets/js/src/Router.js | 1 |
2 files changed, 44 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 + } + }); +}; diff --git a/assets/js/src/Router.js b/assets/js/src/Router.js index 0c96262c..ab23c0fd 100644 --- a/assets/js/src/Router.js +++ b/assets/js/src/Router.js @@ -30,6 +30,7 @@ jQuery(document).ready(function() { router.addRoute('analytic-avg-time-column', AvgTimeColumnChart); router.addRoute('analytic-task-time-column', TaskTimeColumnChart); router.addRoute('analytic-lead-cycle-time', LeadCycleTimeChart); + router.addRoute('analytic-compare-hours', CompareHoursColumnChart); router.addRoute('gantt-chart', Gantt); router.dispatch(app); app.listen(); |