Multiple legends in horizontal mode overlap chart on resize from a narrow viewport to a wide one
Chưa có ai nhận issue này.
- 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
Mô tả
I am having troubles when changing from portrait mode to landscape mode as the legends overlap the x axis ticks or the chart itself.
Here is the reproducible example: https://codepen.io/bleah1/full/ZEMGVpY
Please use Inspect tools and either make the viewport narrow and then pull pretty fast to make it wide again or just go to mobile view and switch from portrait to landscape.
The legends remain in the same place when resizing from a narrow viewport to a wider one.
This behavior is not as bad on PC, because you can resize again and everything falls into place, but on mobile you can't resize the viewport/window, you can only refresh and I can't use it as it is now.
The code is pretty basic:
const plotDiv = document.getElementById('plot');
const traces = [
{x: [1,2,3], y: [2,1,4], stackgroup: 'one'},
{x: [1,2,3], y: [1,1,2], stackgroup: 'one'},
{x: [1,2,3], y: [3,0,2], stackgroup: 'one'},
{x: [1,2,3], y: [4,3,2], stackgroup: 'one'},
{x: [1,2,3], y: [5,5,2], stackgroup: 'one'},
];
const layout = {
showlegend: true,
legend: {
x: 0,
// y: 1,
orientation: "h",
traceorder: "normal",
yanchor: "top",
},
autosize: true,
margin: { pad: 10, b: 10, l: 40, r: 40, t: 80 },
}
const config = {
responsive: true
}
Plotly.newPlot('myDiv', traces, layout, config);
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.
Hướng nghiên cứu
Bắt đầu với bản tái hiện CodePen được liên kết và kiểm tra đường dẫn thay đổi kích thước responsive cho việc đặt chú giải theo chiều ngang trong plotly.js. So sánh việc thay đổi kích thước từ hẹp sang rộng với việc làm mới, sau đó xác minh rằng các chú giải không còn chồng lên các vạch của trục x hoặc biểu đồ sau khi viewport thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript
- Lĩnh vực
- data-visualization
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100