plotly / plotly/plotly.js

Feature request / Focus reset on Treemap during live updates

Open
#7,464 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature P3
Dominant language
JavaScript
Stars
18.3k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
28

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing Plotly.js treemap updates when the ids, parents, and labels arrays change, using the described live-update scenario and current focus/pathbar behavior as the reference. Done means the selected node remains focused after updates when it and its children still exist, while navigation and the pathbar remain coherent.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
data-visualization, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.