[Bug] Graph on cartesian2d is misplaced after setOption from a graph on the default (view) coordinate system
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 66/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, typescript
调研方向
原因在 GraphView.render 中已指明:只有当系列拥有自己的 View 坐标系时,视图坐标系的变换才会应用到 mainGroup,因此被复用的视图会保留旧的变换。请先阅读该分支,以及每次渲染之间该分组如何被重置。完成标准是:使用 notMerge: true 调用 setOption 之后,cartesian2d 图表与坐标轴的对齐方式,和直接用 cartesian 配置创建的图表一致。
由索引模型根据 Issue 内容生成。
描述
Version
6.1.0 (also current master 34f4d927e)
Link to Minimal Reproduction
const viewGraph = {
series: [{
type: 'graph', layout: 'none', symbolSize: 20,
data: [{ name: 'p', x: 0, y: 0 }, { name: 'q', x: 1000, y: 10 }],
links: [{ source: 'p', target: 'q' }]
}]
};
const cartesianGraph = {
xAxis: { type: 'category', boundaryGap: false, data: ['a', 'b', 'c'] },
yAxis: { type: 'value' },
series: [{
type: 'graph', layout: 'none', coordinateSystem: 'cartesian2d', symbolSize: 20,
data: [10, 30, 20],
links: [{ source: 0, target: 1 }, { source: 1, target: 2 }]
}]
};
option = viewGraph;
// After 1 s, switch to the cartesian graph. Its nodes don't line up with the axes:
setTimeout(() => myChart.setOption(cartesianGraph, { notMerge: true }), 1000);
Steps to Reproduce
- Render a graph series on its default
viewcoordinate system (layout: 'none'with x/y). setOptionan option whose graph series is oncartesian2d(withnotMerge: truehere; withroam: trueorfalsealike).
Current Behavior
The nodes and edges of the cartesian graph are scaled and translated by the transform of the previous view graph, so they do not
line up with the axes.
Expected Behavior
The graph is placed on the grid exactly as in a chart created directly with the cartesian option.
Environment
- OS: any (also reproduced with the SVG renderer in Node.js SSR)
- Browser: any
- Framework: none
Any additional comments?
Cause: GraphView.render applies the view coordinate system's transform to its main group only when the series has its own View
coordinate system (if (ownCoordSys) applyViewCoordSysTransToElement(mainGroup, ...)). When the reused view later renders a graph on
an external coordinate system, the old transform is never reset. 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 小时 新手友好度 72/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 天内回复
-
A model answer with prose after its fenced JSON is rejected as NOT_JSON可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭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 天内回复