Repository navigation
Units: the popup and the timeseries follow a layer's unit switch - #675
Draft
BhattaraiSijan wants to merge 3 commits into
Draft
BhattaraiSijan wants to merge 3 commits into
BhattaraiSijan wants to merge 3 commits into
Conversation
1 of 5 tasks
BhattaraiSijan
force-pushed
the
feat/668-unit-popup-timeseries
branch
from
November 23, 2026 16:02
3f9e1a0 to
6ac8621
Compare
BhattaraiSijan
force-pushed
the
feat/666-unit-switch-legend
branch
from
November 23, 2026 16:02
19893f1 to
b0e6c2f
Compare
BhattaraiSijan
force-pushed
the
feat/668-unit-popup-timeseries
branch
from
November 23, 2026 16:29
6ac8621 to
e551a1b
Compare
BhattaraiSijan
force-pushed
the
feat/666-unit-switch-legend
branch
from
November 23, 2026 16:29
b0e6c2f to
e037e57
Compare
BhattaraiSijan
force-pushed
the
feat/666-unit-switch-legend
branch
from
November 23, 2026 17:11
e037e57 to
d78d174
Compare
BhattaraiSijan
force-pushed
the
feat/668-unit-popup-timeseries
branch
from
November 23, 2026 17:11
e551a1b to
5c883f6
Compare
BhattaraiSijan
force-pushed
the
feat/666-unit-switch-legend
branch
from
November 23, 2026 21:36
d78d174 to
464b9a2
Compare
BhattaraiSijan
force-pushed
the
feat/668-unit-popup-timeseries
branch
from
November 23, 2026 21:36
5c883f6 to
417ac23
Compare
BhattaraiSijan
force-pushed
the
feat/666-unit-switch-legend
branch
from
November 24, 2026 15:39
464b9a2 to
91a815d
Compare
BhattaraiSijan
force-pushed
the
feat/668-unit-popup-timeseries
branch
from
November 24, 2026 15:39
417ac23 to
591ce2d
Compare
This was referenced Nov 24, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #668, #669. Part of #672. Third PR of the units epic, stacked on #674; review that first, this diff is against its branch. Base moves to
feat/unit-conversiononce it merges.Size
What
#674 let a viewer show a layer in another unit, and relabelled the legend. This PR makes the two other surfaces that print a layer's values follow: the feature popup and the timeseries card, both while already open and for anything opened later. One layer now reads in one unit everywhere. Switching back restores the original numbers exactly.
_shared/units/applyUnit.tsapplies the map core hands out with a unit (shown = source × scale + offset) and takes it back, rounding to twelve significant digits. It imports nothing from core; plugins never resolve a unit, they asklayers:getUnitand do the arithmetic. The LayerManager's rescale write-back now uses it too.layer:unitChangefor that layer it updates its cached unit and shows the card again at the same anchor. The popup service replaces an open card in place, and the replaced card's request answers "closed", which presses nothing. Later clicks use the new unit with no re-read of the layer configs. A switch on another layer, or with no card open, does nothing.layer:unitChangeit re-emitsseriesReadyfrom that response with no fetch and no loading state. The kept response is dropped with the selection. The chart stays unit-ignorant: it prints the string it is handed, and the downloaded CSV's value column now names it,PM2.5 (mg/m³).Reading order
src/essence/Tools/_shared/units/applyUnit.ts:applyUnitandunapplyUnit, the only arithmetic a plugin does.src/essence/Tools/LayerManager/adapters/handlers.ts:setRescalenow goes throughunapplyUnit.src/essence/Tools/FeaturePopup/FeaturePopupTool.js:formatValue,_showCardsplit out of the click handler,_onUnitChange, and thelayer:unitChangesubscription.src/essence/Tools/FetchTimeseries/lib/timeseries.ts:buildPayloadtakeslayerUnitand convertspoints[].y;FetchTimeseriesTool.tsx:_lastResponse,_payloadFor,_onUnitChange.src/essence/Tools/SeriesChart/lib/chartData.ts: the CSV header names the unit.Notes
propertyfromlayers:getUnit); a layer with nopropertyprints every row as before, unit switch or not.Testing
npx vitest run: 226 files, 3874 tests pass;npx tsc --noEmitclean🤖 Generated with Claude Code