-
Notifications
You must be signed in to change notification settings - Fork 716
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
Support geoPath.digits(n)
in geo projection components
#1761
Comments
geoPath
digts in <Projection />
componentgeoPath.digits(N)
in <Projection />
component
geoPath.digits(N)
in <Projection />
componentgeoPath.digits(n)
in <Projection />
component
geoPath.digits(n)
in <Projection />
componentgeoPath.digits(n)
in Projection components
geoPath.digits(n)
in Projection componentsgeoPath.digits(n)
in visx-geo
projection components
geoPath.digits(n)
in visx-geo
projection componentsgeoPath.digits(n)
in geo projection components
@williaster would you be willing to review a PR if I manage to get this task done in a few days? I guess I’ll need to add |
@kachkaev thanks for opening the issue with such great details. I'd be happy to review the change 👀 and get it in if you'd like to take it on 🙏 You are 100% correct about adding
lmk if you have any questions along the way – here or on a new PR |
Great, thanks for your reply and for the hints! I’ll try to produce something by the end of this week if things go as planned 🤞 |
👋 @williaster! I have started a PR in #1767. The description is missing – feel free to help me with it if it’s quick for you. Apart from that, I seem to have produced the diff that works as expected. Happy to do more iterations on this PR, it’d be just great to get some initial feedback from you or your colleagues. The DX was neat, nice setup! |
Amazing! I'll take a look asap today/tomorrow |
When
@visx/geo
generates an SVG, paths end up containing more than 10 fractional digits. This increases page download size but is not practically useful. Fractional digits are often ‘random’, which means that transport-level compression cannot be very efficient for them.Here is an example: https://airbnb.io/visx/geo-custom
It turns out that
d3-geo
supportspath.digits(n)
since version3.1.0
(see d3/d3-geo#272 for context). It’d be nice to add support fordigits
in@visx/geo
, similar to how it’s already done forpointRadius
:<CustomProjection<FeatureShape> {...miscProps} pointRadius={2} + digits={3} >
The result would be a much smaller SVG:
Here is the file we’ll need to change:
visx/packages/visx-geo/src/projections/Projection.tsx
Lines 150 to 152 in ca38100
const path = geoPath().projection(currProjection); + if (digits) path.pointRadius(digits); if (pointRadius) path.pointRadius(pointRadius);
We’ll also need to bump
d3-geo
from^1.11.3
to^3.1.0
for the new prop to work. Althoughd3-geo@3
depends ond3-array@2.5.0 - 3
, this change may be blocked by #1267.WDYT folks?
The text was updated successfully, but these errors were encountered: