diff options
Diffstat (limited to 'assets/js/src/LeadCycleTimeChart.js')
-rw-r--r-- | assets/js/src/LeadCycleTimeChart.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/assets/js/src/LeadCycleTimeChart.js b/assets/js/src/LeadCycleTimeChart.js new file mode 100644 index 00000000..501ed892 --- /dev/null +++ b/assets/js/src/LeadCycleTimeChart.js @@ -0,0 +1,45 @@ +function LeadCycleTimeChart() { +} + +LeadCycleTimeChart.prototype.execute = function(app) { + var metrics = $("#chart").data("metrics"); + var cycle = [$("#chart").data("label-cycle")]; + var lead = [$("#chart").data("label-lead")]; + var categories = []; + + var types = {}; + types[$("#chart").data("label-cycle")] = 'area'; + types[$("#chart").data("label-lead")] = 'area-spline'; + + var colors = {}; + colors[$("#chart").data("label-lead")] = '#afb42b'; + colors[$("#chart").data("label-cycle")] = '#4e342e'; + + for (var i = 0; i < metrics.length; i++) { + cycle.push(parseInt(metrics[i].avg_cycle_time)); + lead.push(parseInt(metrics[i].avg_lead_time)); + categories.push(metrics[i].day); + } + + c3.generate({ + data: { + columns: [ + lead, + cycle + ], + types: types, + colors: colors + }, + axis: { + x: { + type: 'category', + categories: categories + }, + y: { + tick: { + format: app.formatDuration + } + } + } + }); +}; |