Skip to content

Commit

Permalink
Fix: tick format function for thresholds
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchthorson committed Jul 18, 2024
1 parent 3496dba commit 3b85dea
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/lib/maps/ColorLegend/ColorLegend.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,7 @@
function getTickFormatFn(tickFormat, thresholds) {
// respect any user provided options first
if (typeof tickFormat === "string") {
return format(tickFormat);
} else if (tickFormat) {
return tickFormat;
} else if (thresholds) {
if (thresholds) {
// if we have a threshold scale without any use-provided formatting, generate threshold ticks
const thresholdFormat =
tickFormat === undefined
Expand All @@ -186,6 +182,12 @@
return (i) => thresholdFormat(thresholds[i], i);
}
if (typeof tickFormat === "string") {
return format(tickFormat);
}
if (tickFormat) {
return tickFormat;
}
return (d) => d;
}
Expand Down

0 comments on commit 3b85dea

Please sign in to comment.