From 71e71d0514bfbbc8823a2b398cf02e7269acc17e Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Thu, 14 Sep 2017 11:21:37 +0530 Subject: [PATCH] [graphs] explicitly call setup() for every graph object (#4120) --- frappe/public/js/frappe/ui/graphs.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/frappe/public/js/frappe/ui/graphs.js b/frappe/public/js/frappe/ui/graphs.js index a4bfd938c4..1fe86e7212 100644 --- a/frappe/public/js/frappe/ui/graphs.js +++ b/frappe/public/js/frappe/ui/graphs.js @@ -28,8 +28,7 @@ frappe.ui.Graph = class Graph { specific_values = [], summary = [], - mode = '', - call_setup = true + mode = '' }) { if(Object.getPrototypeOf(this) === frappe.ui.Graph.prototype) { @@ -65,9 +64,6 @@ frappe.ui.Graph = class Graph { this.$graph = null; // Validate all arguments, check passed data format, set defaults - if (call_setup) { - this.setup(); - } } @@ -479,6 +475,7 @@ frappe.ui.Graph = class Graph { frappe.ui.BarGraph = class BarGraph extends frappe.ui.Graph { constructor(args = {}) { super(args); + this.setup(); } setup_values() { @@ -506,6 +503,7 @@ frappe.ui.BarGraph = class BarGraph extends frappe.ui.Graph { frappe.ui.LineGraph = class LineGraph extends frappe.ui.Graph { constructor(args = {}) { super(args); + this.setup(); } setup_values() { @@ -529,6 +527,7 @@ frappe.ui.LineGraph = class LineGraph extends frappe.ui.Graph { frappe.ui.PercentageGraph = class PercentageGraph extends frappe.ui.Graph { constructor(args = {}) { super(args); + this.setup(); } make_graph_area() { @@ -629,8 +628,7 @@ frappe.ui.HeatMap = class HeatMap extends frappe.ui.Graph { x = [], specific_values = [], summary = [], - mode = 'heatmap', - call_setup = false + mode = 'heatmap' } = {}) { super(arguments[0]); this.start = start; @@ -639,6 +637,7 @@ frappe.ui.HeatMap = class HeatMap extends frappe.ui.Graph { this.count_label = count_label; + this.legend_colors = ['#ebedf0', '#c6e48b', '#7bc96f', '#239a3b', '#196127']; this.setup(); }