summaryrefslogtreecommitdiff
path: root/assets/js
diff options
context:
space:
mode:
authorMatthew Cillo <matthewacillo@gmail.com>2015-12-07 22:40:55 -0500
committerMatthew Cillo <matthewacillo@gmail.com>2015-12-07 22:45:12 -0500
commit583e6bf064bbbdd0b031ea429fb1de949ddf64a7 (patch)
treef88aed231d898172fb2c37b87e9c5310d2de1985 /assets/js
parent78fd4d3ee9940bde6d0bef8c611c6a19595e81fd (diff)
added working template of compare hours
Diffstat (limited to 'assets/js')
-rw-r--r--assets/js/src/CompareHoursColumnChart.js43
-rw-r--r--assets/js/src/Router.js1
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();