Sci notation on continuous legend (#1450)

* sci notation on continuous legend

* significant digits
This commit is contained in:
Colin Megill
2020-05-07 12:59:10 -04:00
committed by GitHub
parent 7ec9bb92f7
commit 9026e0ce41
3 changed files with 37 additions and 6 deletions
@@ -61,7 +61,14 @@ const continuous = (selectorId, colorscale, colorAccessor) => {
});
*/
const legendaxis = d3.axisRight().scale(legendscale).tickSize(6).ticks(8);
const legendaxis = d3
.axisRight(legendscale)
.ticks(6)
.tickFormat(
d3.format(
legendscale.domain().some((n) => Math.abs(n) >= 10000) ? ".0e" : ","
)
);
const svg = d3
.select(selectorId)