echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Bug] treemapRootToNode doesn't properly work with leafDepth 1

Open HJK181 opened this issue 6 months ago • 4 comments

Version

5.4.3

Link to Minimal Reproduction

https://codesandbox.io/p/devbox/beautiful-chebyshev-3lgfcx?workspaceId=ws_P5axcbk322QJHWwfpQvWGp

Steps to Reproduce

  1. create a treemap chart with a series option leafDepth: 1
  2. dispatch a treemapRootToNode action with a targetNodeId for a node with leaf depth > 1

Please see the setTimeout in the codesandbox index.js. If you remove "/child1" from the targetNodeId the action works. It also behaves correctly if you remove leafDepth: 1 from the series option.

Current Behavior

The svg renders nothing

Expected Behavior

The correct node is rendered, the same way as when you click on the nodes individually.

Environment

Any additional comments?

No response

HJK181 avatar Jun 02 '25 09:06 HJK181

2. dispatch a treemapRootToNode action with a leafDepth > 1

treemapRootToNode action does not have a parameter for leafDepth. Also I cannot access your Link to Minimal Reproduction.

helgasoft avatar Jun 02 '25 18:06 helgasoft

  1. dispatch a treemapRootToNode action with a leafDepth > 1

treemapRootToNode action does not have a parameter for leafDepth. Also I cannot access your Link to Minimal Reproduction.

Sry, the codesandbox link wasn't public, could you please try again, it should be accessible now? I don't pass leafDepth on the action itself, it is set on the options series. The action just contains a targetNodeId with a leaf depth > 1. Please see options.js and index.js in the codesandbox.

HJK181 avatar Jun 03 '25 04:06 HJK181

"leafDepth represents how many levels are shown at most" - and the counting starts from the top level. Your levels are 'article', 'Information and Computing Sciences' and 'child1'. So to be able to see 'child1' thru treemapRootToNode you'll need to set leafDepth >= 3. That's my understanding, anyway.

helgasoft avatar Jun 04 '25 04:06 helgasoft

My use case is to display one level at a time, which is why I've set leafDepth to 1 in the options series. The issue is that once you click your way to level 3, the chart has loaded all groups internally, which enables treemapRootToNode for child1 to work. But, when you dispatch the action right after the chart loads and the user never clicked to that level, it's broken. This is an inconsistent behavior and from my POV a bug.

HJK181 avatar Jun 04 '25 04:06 HJK181