diff --git a/erpnext/selling/page/sales_funnel/sales_funnel.js b/erpnext/selling/page/sales_funnel/sales_funnel.js index 017f971ae95ac0f615fd02e4c9e78bf855fef7c3..647b2904d17ae8959ca5f22231ec9d164c0535f2 100644 --- a/erpnext/selling/page/sales_funnel/sales_funnel.js +++ b/erpnext/selling/page/sales_funnel/sales_funnel.js @@ -178,6 +178,9 @@ erpnext.SalesFunnel = class SalesFunnel { this.options.width = $(this.elements.funnel_wrapper).width() * 2.0 / 3.0; this.options.height = (Math.sqrt(3) * this.options.width) / 2.0; + const min_height = (this.options.height * 0.1) / this.options.data.length; + const height = this.options.height * 0.9; + // calculate total weightage // as height decreases, area decreases by the square of the reduction // hence, compensating by squaring the index value @@ -185,8 +188,8 @@ erpnext.SalesFunnel = class SalesFunnel { function(prev, curr, i) { return prev + Math.pow(i+1, 2) * curr.value; }, 0.0); // calculate height for each data - $.each(this.options.data, function(i, d) { - d.height = me.options.height * d.value * Math.pow(i+1, 2) / me.options.total_weightage; + $.each(this.options.data, function (i, d) { + d.height = (height * d.value * Math.pow(i + 1, 2)) / me.options.total_weightage + min_height; }); this.elements.canvas = $('')