plotly / plotly/plotly.js

enable tonexty without fallback to tozeroy

未关闭
#5,538 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

feature P3
主要语言
JavaScript
星标
18.3k
派生
2k
平均合并
2 天 12 小时
30 天内合并 PR
28

描述

In our use case, we are plotting quantiles of a data set, with lower and upper bound as well as the median. For convenience, we need to fill in the area between the upper and lower bound shown.

The way we have solved this is by setting fill_type=tonexty on all traces and fill_color=gray on the top four traces, but fill_color=None on the bottom trace.

It looks like this:

scatter all visible

The problem is if a user disables the bottom trace, the tonexty fill of the second-to-last trace falls back to tozeroy:

scatter one hidden

This makes no sense in our case. The expected/intended behavior is:

scatter one hidden expected

We have tried/considered several methods:

  1. Creating a stackgroup; this does allow a fill 'inside' the group only, but requires the trace values to be stacked, which they fundamentally aren't; hiding a trace in that case moves the traces above, which is incorrect.
  2. Disabling the trace toggle; this hides the problem of course, but it also disables a useful feature
  3. Dynamically changing the fill_colors when a trace is hidden; this might work, but I can't find an event to hook into, and since we are using Dash, doing this kind of hacking between Python and clientside callbacks is nontrivial at best.

The best solution would be a fill_type that fills to next but falls back to no fill.

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先复现 issue 中描述的 quantile-trace 示例,并检查前一个 trace 被隐藏时 fill_type=tonexty 的行为。查看现有的 Plotly.js fill 行为,并确定应如何表示无填充 fallback;当隐藏 trace 的情况下保留剩余边界之间的区域,而不回退到 tozeroy 时,即视为完成。

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

评估

技术栈
javascript
领域
data-visualization
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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