Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Changed map radiusScale for increased size for small values #1945

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ You can also check the
- Fixed preview via API (iframe)
- Fixed cut table scroll-bars and unnecessary scroll of bar charts when
switching between chart types
- Fixed map dimension symbols to increase the elements size for small values, whilst preventing any 0 and undefined values from displaying
- Added Footer to the Profile Page

# [5.0.2] - 2024-11-28
Expand Down
19 changes: 15 additions & 4 deletions app/charts/map/map-state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,22 @@ const useMapState = (
// encode only the color of symbols, and the size is irrelevant.
if (symbolLayerState.dataDomain[1] === undefined) {
return scaleSqrt().range([0, 12]).unknown(12);
} else {
return scaleSqrt()
.domain([0, symbolLayerState.dataDomain[1]])
.range([0, 24]);
}

const baseScale = scaleSqrt()
.domain([0, symbolLayerState.dataDomain[1]])
.range([0, 24]);

const wrappedScale = (x: number | null) => {
if (x === null || x === undefined) return 0;
if (x === 0) return 0;
const scaled = baseScale(x);
return Math.max(2, scaled);
};

Object.assign(wrappedScale, baseScale);

return wrappedScale;
}, [symbolLayerState.dataDomain]) as ScalePower<number, number>;

const preparedSymbolLayerState: MapState["symbolLayer"] = useMemo(() => {
Expand Down
Loading