plotly / plotly/plotly.js

[BUG]: The `quiver` trace ignores a discrete `marker.color` array and results in every arrow being black

未关闭
#8,026 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug P2 size: 3
主要语言
JavaScript
星标
18.3k
派生
2k
平均合并
2 天 12 小时
30 天内合并 PR
28

描述

Description

The quiver trace ignores a discrete marker.color array. Every arrow ends up black instead of taking its per-point color. A numeric array with a colorscale works, and a single color string works.

Screenshots/Video
No colorscale (the bug) With colorscale (for comparison)
Image Image
Steps to reproduce
  • Open plotly devtools
  • Run the following snippet in the browser devtools console
     Plotly.newPlot(gd, [{
       type: 'quiver',
       x: [1, 2, 3], y: [1, 2, 3],
       u: [1, 1, 1], v: [0, 1, 0],
       marker: { color: ['rgb(23, 103, 194)', '#FF4136', '#2ECC40'], line: { width: 3 } }
     }]);
    
  • Note that all three arrows are rgb(0, 0, 0) (by inspection of using your eyes)
  • Run the following modified snippet:
     Plotly.newPlot(gd, [{
       type: 'quiver',
       x: [1, 2, 3], y: [1, 2, 3],
       u: [1, 1, 1], v: [0, 1, 0],
       marker: { color: [0, 5, 10], line: { width: 3 } },
       colorscale: 'Viridis'
     }]);
    
  • Note that the arrows have the correct color
Notes
  • marker.color is documented as arrayOk, so the black arrows seem to be a rendering bug (rather than an unsupported input)
  • Per the schema, each arrow should be drawn as its own color from the array. If this behavior is intentional, we should update the description.
  • This was found while working on #8025

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

通过浏览器开发者工具中的 Plotly.newPlot 调用重现该问题,从 quiver trace 的实现开始。比较离散 marker.color 数组与数值 colorscale 情况下的处理方式,然后验证每个箭头都使用其对应的颜色,同时单色和 colorscales 仍能正常工作。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
描述清楚
新手友好度
72/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。