From f77d6c590bf683377986064113ddddae9ed443c2 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 20 Mar 2016 15:45:02 -0400 Subject: Added Markdown editor and Javascript code refactoring --- assets/js/src/CumulativeFlowDiagram.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'assets/js/src/CumulativeFlowDiagram.js') diff --git a/assets/js/src/CumulativeFlowDiagram.js b/assets/js/src/CumulativeFlowDiagram.js index 61a0847b..b22fd2e9 100644 --- a/assets/js/src/CumulativeFlowDiagram.js +++ b/assets/js/src/CumulativeFlowDiagram.js @@ -1,14 +1,21 @@ -function CumulativeFlowDiagram() { -} +Kanboard.CumulativeFlowDiagram = function(app) { + this.app = app; +}; -CumulativeFlowDiagram.prototype.execute = function() { +Kanboard.CumulativeFlowDiagram.prototype.execute = function() { + if (this.app.hasId("analytic-cfd")) { + this.show(); + } +}; - var metrics = $("#chart").data("metrics"); +Kanboard.CumulativeFlowDiagram.prototype.show = function() { + var chart = $("#chart"); + var metrics = chart.data("metrics"); var columns = []; var groups = []; var categories = []; var inputFormat = d3.time.format("%Y-%m-%d"); - var outputFormat = d3.time.format($("#chart").data("date-format")); + var outputFormat = d3.time.format(chart.data("date-format")); for (var i = 0; i < metrics.length; i++) { -- cgit v1.2.3