Raman-Katiyar opened a new pull request, #21817:
URL: https://github.com/apache/echarts/pull/21817
## Brief Information
This pull request is in the type of:
- [ ] bug fixing
- [ ] new feature
- [x] others (regression test)
### What does this PR do?
Adds Jest regression tests locking in that an empty bar series does not
change explicitly set axis bounds, covering the scenario reported in #21148.
### Fixed issues
- #21148: [Bug] Empty Bar series causes x axis bounds to change (verified
fixed on master — see Details)
## Details
### Before: What was the problem?
On 5.6.0 / 6.0.0, adding an empty bar series (`{type: 'bar', data: []}`) to
a chart whose **time** xAxis has explicit `min`/`max` caused the axis bounds to
be expanded (e.g. a configured 2025-01-01 → 2025-01-10 range rendered as
roughly 2024-12-22 → 2025-01-20). Root cause on those versions:
`adjustScaleForOverflow` in `src/coord/axisHelper.ts` adjusted the extent for
any bar series on a time base axis, ignoring the fixed min/max and the fact
that the bar series had no data.
### After: How does it behave after the fixing?
The behaviour is already correct on master (the `adjustScaleForOverflow`
path was removed by the axis extent rework; contain-shape expansion now only
affects the mapping extent, and empty series produce no supplement). This PR
only adds tests in `test/ut/spec/scale/emptyBarAxisExtent.test.ts`:
- time axis with fixed `min`/`max`, line series + empty bar series → extent
stays exactly `[min, max]`
- time axis with fixed `min`/`max`, empty bar series only → extent stays
exactly `[min, max]`
- value axis with fixed `min`/`max`, line series + empty bar series → extent
stays exactly `[min, max]`
The first two tests fail on tag `6.0.0` with the reported wrong extent and
pass on master.
## Document Info
- [x] This PR doesn't relate to document changes
- [ ] The document should be updated later
- [ ] The document changes have been made in apache/echarts-doc#xxx
## Misc
### Security Checking
- [ ] This PR uses security-sensitive Web APIs. *(not applicable — test
only)*
### ZRender Changes
- [ ] This PR depends on ZRender changes. *(no)*
### Related test cases or examples to use the new APIs
`test/ut/spec/scale/emptyBarAxisExtent.test.ts` (new). Existing
`test/ut/spec/scale/interval.test.ts` still passes.
### Merging options
- [x] Please squash the commits into a single one when merging.
### Other information
No source files and no `dist/` files are changed in this PR.
**PR checklist (from the repo PR guidance):**
- [x] Issue reproduced and root cause identified (on the reported versions)
- [x] No fix needed in `src/` on master — verified the faulty code path no
longer exists
- [x] Regression test added; fails before (6.0.0) / passes after (master)
- [x] Relevant existing tests run (`interval.test.ts`) — pass
- [x] No `dist/`, `i18n/` or `ssr/client/dist/` files included
- [x] Commit message follows `<type>(<scope>): <subject>` convention
- [x] No document changes required
- [x] No ZRender changes required
- [x] No security-sensitive APIs used
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]