plotly / plotly/plotly.js

Feature request / Focus reset on Treemap during live updates

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

还没有人认领这个 Issue。

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

描述

Context

I'm using Plotly's treemap in real-time web application where data is updated frequently.
The visualization represents a hierarchical dataset, and I allow users to interact with it by clicking on a bloc to focus on a specific branch

Problem

Currently, every time I update the data (specifically the ids, parents, and labels arrays), the focus resets back to the root of the treemap. This breaks the user experience since the user is forced back to the top level, even if they were navigating deeper into the tree.

Expected Behavior

Ideally, I want the treemap to preserve the current focus when the tree is updated (as long as the selected node and its children are still present in the data). I haven't found a configuration like rootId / focusId option that persists focus across updates in treemaps.

Current workaround

One potential workaround I'm exploring is to reconstruct a filtered version of the tree manually, by :

  • Extracting the clicked node and all of its descendants
  • Overidding their parents fields so the focused node become the new root
  • Updating the plot with this "subtree" only

That should works, but it adds quite a bit complexity to the data processing. In addition, I don't know how to manage pathbar

Request

Is there currently a configuration way to preserve the focus state across data updates in a treemap plot ?

Environment
  • Library : Plotly.js (with react class)
  • Plot type : treemap
  • Use case : real-time updates + interactive navigation

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先跟踪 Plotly.js treemap 在 ids、parents 和 labels 数组发生变化时的更新,并以所描述的实时更新场景以及当前的 focus/pathbar 行为作为参考。完成的标准是:更新后,如果选中的节点及其子节点仍然存在,该节点仍保持焦点,同时导航和 pathbar 保持一致。

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

评估

技术栈
javascript, react
领域
data-visualization, frontend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

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