[BUG]: geo projections lose their D3 default rotation
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 72/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- javascript
- Domaine
- data-visualization
Piste de recherche
Commencez par Geo.updateProjection et comparez la gestion de la rotation avec les constructeurs de projections de D3, en particulier les valeurs par défaut de quincuncial et wiechel décrites dans l’issue. Reproduisez l’exemple peirce quincuncial dans le navigateur, puis vérifiez que l’orientation rendue conserve la valeur par défaut canonique de la projection tout en appliquant une rotation demandée.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Description
Geo.updateProjection calls projection.rotate([-rotation.lon, -rotation.lat, rotation.roll]) unconditionally. For a world-scope map projection.rotation defaults to [0, 0, 0], so any rotation the D3 projection ships with is discarded.
Six of the projections in plotly.js carry a non-identity default rotation:
| projection | D3 default rotation |
|---|---|
albers |
[96, 0, 0] |
bertin1953 |
[-16.5, -42, 0] |
gringorten quincuncial |
[-90, -90, 45] |
peirce quincuncial |
[-90, -90, 45] |
sinu mollweide |
[-20, -55, 0] |
wiechel |
[0, -90, 45] |
For the quincuncials and wiechel that rotation is geometric: it places the sphere in the polar aspect and tilts the square 45°, and is applied inside the projection's own constructor:
// d3-geo-projection/src/quincuncial/index.js
return projection(projectQuincuncial)
.rotate([-90, -90, 45])
.clipAngle(180 - 1e-3);
Replacing it renders a different orientation from the one D3 defines. (For albers, D3's [96, 0, 0] preconfigures it for the USA, so discarding it is probably intended.)
Screenshots/Video
For 'peirce quincuncial':
| D3 projection | Plotly projection |
|---|---|
Steps to reproduce
- Be on master
- Open Plotly devtools
- Enter the following snippet into the browser console:
Plotly.newPlot(gd, [{
type: 'choropleth',
locations: ['GHA', 'ARG', 'AUS', 'CAN'],
z: [1, 2, 3, 4],
showscale: false
}], {
geo: { projection: { type: 'peirce quincuncial' }, fitbounds: false },
height: 800
});
- Note that
- Expected: the canonical peirce quincuncial orientation.
- Actual: rendered with rotation
[0, 0, 0].
Screenshots
Notes
- A fix needs to compose the requested rotation onto each projection's default rather than replace it, since
d3.geoProjection.rotate()replaces - This was discovered in #7948. It's possible that this is intentional for a good reason, but it would be worth looking at changing it regardless.
- Langage dominant
- JavaScript
- Étoiles
- 18.3k
- Forks
- 2k
- Merge moyen
- 2 j 10 h
- PR mergées (30 j)
- 30
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de plotly/plotly.js
-
chore P3 plotly-internal size: 3 task
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
-
chore P1 plotly-internal size: 1 task
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
-
chore P3 plotly-internal size: 1 task
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
bug infrastructure P2
Difficulté 1/5 Moins d'une heure Accessibilité débutants 65/100
Toutes les issues de plotly/plotly.js
Issues similaires
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
Improve Title Support Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
georgestephanis/p2026#40 ·
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Margaret-Petersen/food-delivery-app-clone-react-native#1981 ·