@flourish/legend
Advanced tools
Comparing version 6.2.0 to 6.2.2
{ | ||
"name": "@flourish/legend", | ||
"version": "6.2.0", | ||
"version": "6.2.2", | ||
"description": "Flourish module for making legend", | ||
@@ -5,0 +5,0 @@ "main": "legend.js", |
# 6.2.0 | ||
* Add extra check to ensure toFixed() in the roundDown function | ||
is getting values it can process (i.e. between 0 and 100) | ||
# 6.2.0 | ||
* Add settings to continuous legend that allow user to add custom labels | ||
@@ -3,0 +8,0 @@ |
@@ -10,2 +10,3 @@ function remToPx(rem) { | ||
function roundDown(val) { | ||
if (val === 0) return 0; | ||
// Round x down to nice value (preserve the first significant digit, the remaining digits -> 0) | ||
@@ -19,3 +20,7 @@ // e.g. 123.456 => 100, 0.123456 -> 0.1 | ||
// Remove floating point garbage from decimal values | ||
if (exp < 0) rounded = parseFloat(rounded.toFixed(-exp)); | ||
if (exp < 0) { | ||
var abs_exp = -exp; | ||
// toFixed() limited to range 0 to 100 | ||
rounded = abs_exp <= 100 ? parseFloat(rounded.toFixed(abs_exp)): 0; | ||
} | ||
@@ -22,0 +27,0 @@ return rounded; |
Sorry, the diff of this file is too big to display
197758
4951