apache / apache/echarts

[Bug] Toolbox magic type feature doesn't indicate default chart state

Open
#16,473 2 comments 0 reactions 0 assignees View on GitHub
en enhancement topic: toolbox
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
15h 17m
Merged PRs (30d)
5

Description

### Version

5.3.0

### Link to Minimal Reproduction

https://nccrd.saeon.ac.za/reports

### Steps to Reproduce

1. Go to the link
2. Look at the toolbox - the 'magic type' feature indicates no current state despite that the chart state does reflect one of the possible options (in this case stacked bar)

### Current Behavior

The magic type feature allows for toggling between line/bar, and stacked/not stacked. In my case I have a bar chart that is stacked. When I include the magic type in the toolbox, none of the icons are selected. Because of this:

- If a user clicks the 'line' option, then the chart changes to a line. This looks good. But
- If a user clicks the 'bar' option, then nothing happens (except that the 'bar' option becomes emphasized'). The **next** click on the bar option changes the chart. This feels like a bug
- Same with the stacked icon

### Expected Behavior

The magic type icons represent all possible 'states' of the chart. By default the charts render in one of these 'states'. The correct icons should show as 'on' on initial chart render

### Environment

```markdown
- OS: ALL
- Browser: ALL
- Framework: ALL
```

### Any additional comments?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the linked minimal reproduction and inspect the toolbox magic type feature, focusing on how its icons determine the chart's initial state. Reproduce the stacked bar case and verify that the matching bar and stacked controls are selected on first render and that subsequent clicks change the chart correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.