[BUG]: geo projections lose their D3 default rotation
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Bắt đầu tại Geo.updateProjection và so sánh cách xử lý phép xoay với các hàm khởi tạo phép chiếu của D3, đặc biệt là các giá trị mặc định quincuncial và wiechel được mô tả trong issue. Tái hiện ví dụ peirce quincuncial trong trình duyệt, sau đó xác minh rằng hướng được render vẫn giữ giá trị mặc định chuẩn của phép chiếu đồng thời áp dụng phép xoay được yêu cầu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- JavaScript
- Star
- 18.3k
- Fork
- 2k
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 28
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của plotly/plotly.js
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
chore P1 plotly-internal size: 1 task
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
-
chore P3 plotly-internal size: 1 task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
bug infrastructure P2
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
Tất cả issue của plotly/plotly.js
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
avniproject/avni-client#2135 ·
-
automated broken-link
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
agent/security hive/hosted-available-lke648397-260827-5n31 security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
babalae/bettergi-scripts-list#3674 ·
-
A-Release-Notes C-Editing D-Modest S-Ready-For-Implementation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
bevyengine/bevy-website#2595 ·