[Bug] themeRiver layout is wrong after `resize()`: `boundaryGap` keeps the pixel values of the first layout
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, typescript
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Người báo lỗi chỉ ra themeRiverLayout là nơi seriesModel.get('boundaryGap') được xử lý ngay tại chỗ, vì vậy hãy bắt đầu từ đó và kiểm tra xem mảng option có bị thay đổi hay không. Tái hiện bằng đoạn mã mẫu: thực hiện resize, sau đó so sánh với một biểu đồ mới ở kích thước cuối cùng, và kiểm tra getOption().series[0].boundaryGap trước và sau khi thực hiện. Hoàn thành khi các lần layout lặp lại cho kết quả giống biểu đồ mới và mảng option vẫn giữ nguyên các chuỗi phần trăm.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
6.1.0 (also current master 34f4d927e)
Link to Minimal Reproduction
option = {
animation: false,
singleAxis: { type: 'time', top: 20, bottom: 30 },
series: [{
type: 'themeRiver',
data: [
['2015/11/08', 10, 'a'], ['2015/11/09', 15, 'a'], ['2015/11/10', 35, 'a'],
['2015/11/08', 35, 'b'], ['2015/11/09', 36, 'b'], ['2015/11/10', 20, 'b']
]
}]
};
// 1 s: make the chart shorter. The streams keep the top/bottom gaps of the original height:
setTimeout(() => myChart.resize({ height: 200 }), 1000);
// 3 s: set the same option again (notMerge). Nothing changes, yet the streams jump to the correct layout:
setTimeout(() => myChart.setOption(option, true), 3000);
Steps to Reproduce
- Create the chart with the option above in a 240x390 container.
- Call
myChart.resize({ width: 400, height: 300 })(or resize the browser window when the container height is responsive). - Compare with a chart created directly at 400x300. Setting the same option again with
notMerge: truealso fixes the layout.
Current Behavior
After the resize, the streams are laid out with the top and bottom gaps of the initial size. For example, when a 240x390 chart
is resized to 400x300, the streams are squeezed or shifted instead of filling the area like a fresh 400x300 chart.
myChart.getOption().series[0].boundaryGap also returns pixel numbers instead of the default ['10%', '10%'] ([34, 34] for the
240x390 chart, before and after the resize).
A setOption that only changes the size of the singleAxis (top, bottom, left or right) shows the same problem.
Expected Behavior
The layout after resize() is the same as a fresh chart at the final size, and boundaryGap in the option is left unchanged.
Environment
- OS: any (also reproduced with the SVG renderer in Node.js SSR)
- Browser: any
- Framework: none
Any additional comments?
Cause: themeRiverLayout gets the array with seriesModel.get('boundaryGap') and then resolves the percentages in place
(boundaryGap[0] = parsePercent(boundaryGap[0], rect.height)). This overwrites the option array, so every later layout reuses
the pixel values from the first one. Copying the array before resolving fixes it; I can send a PR.
- Ngôn ngữ chính
- TypeScript
- Star
- 67.8k
- Fork
- 19.9k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc 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 apache/echarts
-
en pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] chord `lineStyle.color: 'gradient'` uses the previous layout after resize or setOptionCó thể đã có người làm @yqtian-se đã nhận hôm nay. Đang mởen pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
apache/echarts#21854 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] String formatter templates only replace the first occurrence of `{a}`/`{b}`/`{c}`Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởen pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
apache/echarts#21843 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] Inverse axis collapses the grid with outerBoundsContain when a tick is near the axis edgeCó thể đã có người làm @schizophrenicmaniac đã nhận 3 ngày trước. Đang mởen pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
apache/echarts#21839 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
en pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/echarts#21813 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/echarts
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
cursor/community-plugins#583 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
afk-ok importer size:S
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
enorm-labs/event-junkie#5404 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Wavvon/Wavvon-clients#493 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
answerLoops/answerLoops#679 ·
Maintainer thường phản hồi trong vòng 1 ngày