[FEATURE]: line graphs with line color based on value
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 45/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- javascript
研究方向
Start with the scatter attributes in src/traces/scatter/attributes.js, the defaults in line_defaults.js, and gradientWithBounds in src/components/drawing/index.js. Review how fill gradients, legend icons, and image tests are handled, then resolve the proposed line.gradient API with maintainers. Done includes line rendering, reference images, a draftlogs/ changelog, and a rebuilt generated schema; scattergl is out of scope.
由索引模型根據 Issue 內容生成。
描述
Description
Line graphs can have only one colour per series.
Sometime it is very useful to have the line colour variable based on value, to show visually ranges.
For example, I am using right now Apexcharts for energy prices and I obtain:
Why should this feature be added?
Provide information visually, without the need of reading values, which is useful when preparing graph which must be understood easily and also by less technical people.
I can open a PR if the feature is approved. It would be generated by LLM and tested myself.
Mocks/Designs
See screenshot above.
Notes
Related: https://github.com/plotly/plotly.js/issues/5259
This is Claude asked about the complexity of the implementation:
Area graphs: works today
Scatter traces have a fillgradient attribute (src/traces/scatter/attributes.js:387). Set it to type: 'vertical' and give start/stop in y-axis units. Colour scales accept the same position twice, so a scale can switch colour sharply instead of blending. That makes thresholds possible:
// thresholds 2 and 4, gradient spans y = 0..6
fillgradient: {
type: 'vertical', start: 0, stop: 6,
colorscale: [[0, base], [2/6, base], [2/6, 'orange'],
[4/6, 'orange'], [4/6, 'red'], [1, 'red']]
}
Lines and stepped lines: needs a new attribute
line.color takes one colour only. The drawing helper behind fillgradient (gradientWithBounds in src/components/drawing/index.js:462) can already colour a line instead of a fill. So the feature would mostly reuse existing code:
- New attributes: add them to the scatter line settings, plus their defaults in
line_defaults.js. - Drawing: call the existing helper on the line, in the same way the fill code does.
- Other pieces:
- the legend icon;
- image tests (a human must generate the reference images);
- a changelog file in
draftlogs/; - a rebuild of the generated schema.
It would work for all line shapes, including hv, vh, hvh, vhv and spline. It would not cover the WebGL version (scattergl), and stacked areas would be coloured by their stacked height.
For the settings, I suggest a line.gradient that copies fillgradient (type, start, stop, colorscale). That keeps the API consistent, and plotly.js puts consistency first. Your threshold list could be added on top of that as an easier way to write the stepped colour scale. The maintainers should decide on that part.
- 主要語言
- JavaScript
- 星號
- 18.4k
- 分支
- 2.1k
- 平均合併
- 2 天 16 小時
- 30 天內合併 PR
- 11
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
plotly/plotly.js 的其他 Issue
-
[BUG]: `events` is required but not declared in dependencies可能已有人在做 @KoolADE85 於 6 天前認領。 未關閉bug P3 size: 1
難度 2/5 1-3 小時 新手友好度 83/100
plotly/plotly.js#8163 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
[BUG]: `sankey`: `node.x` / `node.y` of `0` is ignored可能已有人在做 @adimalkar 於 11 天前認領。 未關閉bug P3 size: 1
難度 2/5 1-3 小時 新手友好度 75/100
plotly/plotly.js#8150 · 1 則留言 ·
維護者通常 1 天內回覆
-
[BUG]: `scatterpolargl` drops points between 10000 and 100000 points可能已有人在做 @Tanishdete333 於 11 天前認領。 未關閉bug P3 size: 1
難度 2/5 1-3 小時 新手友好度 82/100
plotly/plotly.js#8148 · 1 則留言 ·
維護者通常 1 天內回覆
-
[BUG]: findEmpties throws "iterated with no new neighbors" for large NaN regions in contour (double-precision underflow)可能已有人在做 @davrens101 於 10 天前認領。 未關閉bug P3 size: 3
難度 2/5 1-3 小時 新手友好度 86/100
plotly/plotly.js#8108 · 4 則留言 ·
維護者通常 1 天內回覆
-
chore P3 plotly-internal size: 3 task
難度 2/5 1-3 小時 新手友好度 77/100
plotly/plotly.js#8064 · 1 則留言 ·
維護者通常 1 天內回覆
相似的 Issue
-
channels:add check:passed
難度 1/5 1 小時以內 新手友好度 82/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 83/100
-
難度 2/5 1-3 小時 新手友好度 66/100
SasanLabs/VulnerableApp#912 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
[chore]: Force minimatch 11.0.1 in the CI scripts' jest tooling (Dependabot #140)可能已有人在做 @alishair7071 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
jaegertracing/jaeger#10133 · 2 則留言 ·
維護者通常 1 天內回覆