Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

ensure more than 12 bins are present to show ticks #67

Benjamin Kingc7943886315a
diff --git a/web/js/modules/palettes/util.js b/web/js/modules/palettes/util.js
index d6503e66f..944b964bc 100644
--- a/web/js/modules/palettes/util.js
+++ b/web/js/modules/palettes/util.js
@@ -94,7 +94,7 @@ export function drawTicksOnCanvas(ctx, legend, width, height) {
const yValue2 = parseFloat(12 * 0.3);
const drawWidth = Math.ceil(binWidth);
const halfWidth = drawWidth / 2;
- if (ticks && ticks.length > 0) {
+ if (ticks && ticks.length > 0 && bins > 12) {
ticks.forEach(tick => {
const start = binWidth * tick;
const midpoint = Math.floor((start + halfWidth)) + 0.5; // https://stackoverflow.com/a/8696641/4589331