Skip to content

Commit

Permalink
fix: min height for rows in sales funnel
Browse files Browse the repository at this point in the history
(cherry picked from commit fd71d8a)
  • Loading branch information
ljain112 authored and mergify[bot] committed Aug 6, 2024
1 parent e679b33 commit 2f81c99
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion erpnext/selling/page/sales_funnel/sales_funnel.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,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
Expand All @@ -202,7 +205,7 @@ erpnext.SalesFunnel = class SalesFunnel {

// 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;
d.height = (height * d.value * Math.pow(i + 1, 2)) / me.options.total_weightage + min_height;
});

this.elements.canvas = $("<canvas></canvas>")
Expand Down

0 comments on commit 2f81c99

Please sign in to comment.