Scattergl doesn't fill to zero y (`tozeroy`) properly
未关闭
还没有人认领这个 Issue。
bug
P3
- 主要语言
- JavaScript
- 星标
- 18.3k
- 派生
- 2k
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 28
描述
scatter works fine, but scattergl fills in a wrong way.
a simple demo:
<html>
<head>
<meta charset="utf-8"/>
<script src="https://cdn.plot.ly/plotly-2.6.3.min.js"></script>
<title>plotly tozeroy bug</title>
</head>
<body>
<div>
<div id="823f03ed-bb11-463b-94a1-dc14225efe68" class="plotly-graph-div" style="height:100%; width:100%;"></div>
<script type="text/javascript">
// prepare data
const x = [];
const y = [];
for (let i = -20; i < 20; i += 0.01) {
x.push(i);
y.push(Math.sin(i));
}
// plot to div
Plotly.newPlot("823f03ed-bb11-463b-94a1-dc14225efe68",
[
{
"type": "scatter",
"x": x,
"y": y,
"xaxis": "x",
"yaxis": "y",
"fill": "tozeroy"
},
{
"type": "scattergl",
"x": x,
"y": y,
"xaxis": "x2",
"yaxis": "y2",
"fill": "tozeroy"
}
],
{
"xaxis": {"anchor": "y", "domain": [0.0, 1.0]},
"yaxis": {"anchor": "x", "domain": [0.575, 1.0]},
"xaxis2": {"anchor": "y2", "domain": [0.0, 1.0]},
"yaxis2": {"anchor": "x2", "domain": [0.0, 0.425]},
"title": {"text": "Scatter vs. Scattergl, fill tozeroy"}
}
);
</script>
</div>
</body>
</html>
output:

贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 Plotly 2.6.3 CDN 运行嵌入式 HTML 重现,并使用 fill: "tozeroy" 比较 scatter 和 scattergl trace。调查 scattergl 背后的 WebGL 渲染路径;对于提供的正弦波数据,当填充区域延伸到 y=0 并与常规 scatter 的结果一致时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100