apache / apache/echarts

[Bug] Changing series type through setOption does not take effect

Open
#19,349 10 comments 0 reactions 0 assignees View on GitHub
bug en pending
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

5.4.3

### Link to Minimal Reproduction

https://codesandbox.io/s/stacked-horizontal-bar-forked-f7dss4?file=/index.js

### Steps to Reproduce

1. Create a chart
2. Add another call to setOption after the chart is initialized to change some of the settings
3. Change something like the series colour - that works
4. Try changing the series type (e.g., from `bar` to `line`)

### Current Behavior

When you change attributes of the series, the chart works as expected (e..g, change colour from green to purple).

When you change the series type, the series disappears from the chart. The legend is updated with the correct series type, but the actual chart data is not visible.

### Expected Behavior

Should be able to change the series type in the same way you can change the other attributes. Experience should be the same as changing the series type in any of the echarts example pages. E.g., if you go here and change one of these bar series to `line` it will still work: https://echarts.apache.org/examples/en/editor.html?c=bar-y-category-stack

But if you do the same through a second call to `setOption`, it will not work

### Environment

```markdown
- OS: Mac
- Browser: N/A
- Framework: N/A
```

### Any additional comments?

I am giving our users a way to override the settings of our chart components by accessing the raw ECharts configuration. I think changing the series type will be a common request. Originally, I was planning to manually merge the settings objects, but was very happy to get it working by letting the user pass their incremental settings to `setOption`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.