Skip to content

Commit

Permalink
Merge pull request #4442 from plotly/almost-equal-branchvalues-total
Browse files Browse the repository at this point in the history
Add ALMOST_EQUAL tolerance in branchvalue:total partial sum check
  • Loading branch information
etpinard authored Dec 27, 2019
2 parents 4137ed2 + 08aa81b commit 26541c3
Show file tree
Hide file tree
Showing 3 changed files with 425 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/traces/sunburst/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ var makePullColorFn = require('../pie/calc').makePullColorFn;
var generateExtendedColors = require('../pie/calc').generateExtendedColors;
var colorscaleCalc = require('../../components/colorscale').calc;

var ALMOST_EQUAL = require('../../constants/numerical').ALMOST_EQUAL;

var sunburstExtendedColorWays = {};
var treemapExtendedColorWays = {};

Expand Down Expand Up @@ -165,7 +167,7 @@ exports.calc = function(gd, trace) {
v = partialSum;
}

if(v < partialSum) {
if(v < partialSum * ALMOST_EQUAL) {
failed = true;
return Lib.warn([
'Total value for node', d.data.data.id,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 26541c3

Please sign in to comment.