[Bug] themeRiver layout is wrong after `resize()`: `boundaryGap` keeps the pixel values of the first layout
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, typescript
调研方向
报告者指出 themeRiverLayout 是 seriesModel.get('boundaryGap') 被就地解析的位置,因此请从那里开始,检查 option 数组是否被修改。用示例代码复现:先 resize,然后与最终尺寸下的新图表进行比较,并在前后检查 getOption().series[0].boundaryGap。当重复布局的结果与新图表一致,且 option 数组保留百分比字符串时,即完成。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- TypeScript
- 星标
- 67.8k
- 派生
- 19.9k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/echarts 的其他 Issue
-
en pending
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
[Bug] chord `lineStyle.color: 'gradient'` uses the previous layout after resize or setOption可能已有人在做 @yqtian-se 今天认领。 未关闭en pending
难度 2/5 1-3 小时 新手友好度 75/100
apache/echarts#21854 · 2 条评论 ·
维护者通常 1 天内回复
-
[Bug] String formatter templates only replace the first occurrence of `{a}`/`{b}`/`{c}`可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭en pending
难度 2/5 1-3 小时 新手友好度 80/100
apache/echarts#21843 · 3 条评论 ·
维护者通常 1 天内回复
-
[Bug] Inverse axis collapses the grid with outerBoundsContain when a tick is near the axis edge可能已有人在做 @schizophrenicmaniac 于 3 天前认领。 未关闭en pending
难度 2/5 1-3 小时 新手友好度 82/100
apache/echarts#21839 · 2 条评论 ·
维护者通常 1 天内回复
-
en pending
难度 2/5 1-3 小时 新手友好度 78/100
apache/echarts#21813 · 2 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 72/100
cursor/community-plugins#583 ·
维护者通常 1 天内回复
-
afk-ok importer size:S
难度 2/5 1-3 小时 新手友好度 72/100
enorm-labs/event-junkie#5404 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
Wavvon/Wavvon-clients#493 ·
维护者通常 1 天内回复
-
documentation
难度 1/5 1-3 小时 新手友好度 72/100
answerLoops/answerLoops#679 ·
维护者通常 1 天内回复