apache / apache/echarts

[Bug] Empty Bar series causes x axis bounds to change

Open
#21,148 0 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

5.6.0, 6.0.0

### Link to Minimal Reproduction

https://codesandbox.io/p/sandbox/strange-worker-l9wcxq?file=%2Fsrc%2Findex.js

### Steps to Reproduce

Toggle bar series on/off, observe the x-axis bounds. Or, comment out/in the bar series.

### Current Behavior

Here is the real chart that I'm seeing the problem with:

![Image](https://github.com/user-attachments/assets/dacfe20e-6120-4a6c-96af-6699c8e705fd)

I believe I've been able to narrow down the source of the problem to the behavior shown in the minimal reproduction. xAxis bounds are explicitly set. As soon as I add an empty bar series, the chart no longer respects the xAxis bounds.

## Without Bar Series
Image

## With Empty Bar Series
Image

### Expected Behavior

I would expect the xAxis to stay at the set min/max bounds when the empty bar series gets added.

### Environment

```markdown
- OS: EndeavourOS Linux x86_64
- Browser: Chromium Version 140.0.7264.0 (Developer Build) (64-bit), also tried on Mozilla Firefox 141.0 (64-bit)
```

### Any additional comments?

_No response_

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.