Repository navigation
test(scale): add regression test for empty bar series changing time axis bounds - #21817
Raman-Katiyar wants to merge 1 commit into
Conversation
|
Thanks for your contribution! Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only. |
f777329 to
a4adf2a
Compare
|
I have pushed a small correction to the tests in this PR. The time-axis cases originally used string min/max values ('2025-01-01'), which ECharts parses as local time, so the assertions only held in UTC environments. The tests now use numeric timestamps instead, which makes them deterministic in any timezone — I verified they pass under IST, America/New_York, Asia/Tokyo and UTC, and the full scale spec folder passes (7/7). The behaviour being locked in is unchanged: an empty bar series does not change the explicitly set axis bounds. |
Brief Information
This pull request is in the type of:
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
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 explicitmin/maxcaused 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:adjustScaleForOverflowinsrc/coord/axisHelper.tsadjusted 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
adjustScaleForOverflowpath 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 intest/ut/spec/scale/emptyBarAxisExtent.test.ts:min/max, line series + empty bar series → extent stays exactly[min, max]min/max, empty bar series only → extent stays exactly[min, max]min/max, line series + empty bar series → extent stays exactly[min, max]The first two tests fail on tag
6.0.0with the reported wrong extent and pass on master.Document Info
Misc
Security Checking
ZRender Changes
Related test cases or examples to use the new APIs
test/ut/spec/scale/emptyBarAxisExtent.test.ts(new). Existingtest/ut/spec/scale/interval.test.tsstill passes.Merging options
Other information
No source files and no
dist/files are changed in this PR.PR checklist (from the repo PR guidance):
src/on master — verified the faulty code path no longer existsinterval.test.ts) — passdist/,i18n/orssr/client/dist/files included<type>(<scope>): <subject>convention