Skip to content

Commit 8a2a1ff

Browse files
ryan-williamsclaude
andcommitted
Clamp elevation to maxHeight and tune ward:per_capita gradient
Bars could exceed the stated max height when data values exceeded `modeConf.max` (e.g. wards at $21/sqft with max=10 → 10km+ bars despite "5km" in UI). Now `getElevation` and ward label heights are clamped. Also update `ward:per_capita` default color stops to `0→1273.7→6834.5`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 183e5e8 commit 8a2a1ff

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

www/src/App.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ const MODE_DEFAULTS: Record<string, ModeConfig> = {
125125
light: [{ value: 0, color: [255, 255, 255] }, { value: 4.9, color: [255, 71, 71] }, { value: 8.6, color: [0, 214, 0] }],
126126
}},
127127
'ward:per_capita': { max: 9000, maxHeight: 5400, scale: 'sqrt', stops: {
128-
dark: [{ value: 0, color: [96, 96, 96] }, { value: 2500, color: [255, 0, 0] }, { value: 7000, color: [0, 255, 0] }],
129-
light: [{ value: 0, color: [255, 255, 255] }, { value: 2500, color: [255, 71, 71] }, { value: 7000, color: [0, 214, 0] }],
128+
dark: [{ value: 0, color: [96, 96, 96] }, { value: 1273.7, color: [255, 0, 0] }, { value: 6834.5, color: [0, 255, 0] }],
129+
light: [{ value: 0, color: [255, 255, 255] }, { value: 1273.7, color: [255, 71, 71] }, { value: 6834.5, color: [0, 214, 0] }],
130130
}},
131131
}
132132
const SS_PREFIX = 'jc-taxes:'
@@ -372,7 +372,7 @@ export default function App() {
372372

373373
for (let wi = 0; wi < wardLabelInfo.length; wi++) {
374374
const { metricVal, rings } = wardLabelInfo[wi]
375-
const elev = metricVal * heightScale
375+
const elev = Math.min(metricVal * heightScale, maxHeight)
376376

377377
for (const ring of rings) {
378378
const n = ring.length
@@ -590,7 +590,7 @@ export default function App() {
590590
extruded: true,
591591
wireframe: true,
592592
getFillColor,
593-
getElevation: (f) => getMetricValue(f) * stableHeightScaleRef.current,
593+
getElevation: (f) => Math.min(getMetricValue(f) * stableHeightScaleRef.current, maxHeight),
594594
getLineColor: lineColor,
595595
lineWidthMinPixels: 1,
596596
pickable: true,
@@ -617,7 +617,7 @@ export default function App() {
617617
},
618618
updateTriggers: {
619619
getFillColor: [year, maxVal, colorStops, colorScale, hoveredId, selectedId, aggregateMode, actualTheme, metricMode, staleData],
620-
getElevation: [year, stableHeightScaleRef.current, aggregateMode, metricMode],
620+
getElevation: [year, stableHeightScaleRef.current, aggregateMode, metricMode, maxHeight],
621621
getLineColor: [actualTheme],
622622
},
623623
}),

0 commit comments

Comments
 (0)