From f3a33bc4fe73db938a69b8148ee9205e1d73c358 Mon Sep 17 00:00:00 2001 From: Gordon Woodhull Date: Thu, 5 Mar 2020 15:47:16 -0500 Subject: [PATCH] compare ring sum within epsilon of 1 fixes #1661 closes #1662 --- Changelog.md | 4 ++++ src/charts/sunburst-chart.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 21f4933f3..e012f7990 100644 --- a/Changelog.md +++ b/Changelog.md @@ -14,6 +14,10 @@ IE is no longer supported. dc.js will not support transpilation. Stick with dc@3 The API is mostly compatible, but there are a few breaking changes - see the [v4 upgrade guide](https://github.com/dc-js/dc.js/blob/develop/docs/dc-v4-upgrade-guide.md) for details. +## 3.2.1 +* Fix rounding issue with equal ring sizes, by hofmeister ([#1662](https://github.com/dc-js/dc.js/pull/1662) / ([#1661](https://github.com/dc-js/dc.js/issues/1661)) + + ## 3.2.0 * Support for general customizable ring sizes on the sunburst chart, by hofmeister ([#1625](https://github.com/dc-js/dc.js/pull/1655) / ([#1511](https://github.com/dc-js/dc.js/issues/1511)) * Sort sunburst wedges according to `baseMixin.ordering()`, by hofmeister ([#1625](https://github.com/dc-js/dc.js/pull/1655) / ([#1511](https://github.com/dc-js/dc.js/issues/1511)) diff --git a/src/charts/sunburst-chart.js b/src/charts/sunburst-chart.js index 1f99d695d..8ecfb9015 100644 --- a/src/charts/sunburst-chart.js +++ b/src/charts/sunburst-chart.js @@ -449,7 +449,7 @@ export class SunburstChart extends ColorMixin(BaseMixin) { } const portionsSum = d3.sum(relativeSizes); - if (portionsSum !== 1) { + if (Math.abs(portionsSum - 1) > dc.constants.NEGLIGIBLE_NUMBER) { throw new BadArgumentException( `relativeRingSizes : portions must add up to 1, but sum was ${portionsSum}`); }