-
Notifications
You must be signed in to change notification settings - Fork 19.8k
Fix/line chart broken axis #21376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix/line chart broken axis #21376
Conversation
…value scales Fixed an issue where axisLabel.showMinLabel and axisLabel.showMaxLabel options were not respected on time and value (interval) axes when using broken axis (axisPointer.data with breaks). This caused extent boundary labels (e.g., 00:00) to disappear when breaks were positioned close to them. Root Cause: - makeRealNumberLabels() did not check showMinLabel/showMaxLabel options - pruneTicksByBreak() removed ticks within gap distance (interval * 3/4) of break boundaries, which could inadvertently remove extent boundary ticks - Category axes had this logic but real number/time axes did not Example Issue: - Axis extent: 00:00 to 23:59:59 with 2-hour interval - Break: 02:00 to 09:00 - Result: 00:00 label disappeared because it fell within the 1.5-hour pruning gap around the break start (02:00 - 1.5h = 00:30) - Moving break to 03:00 would show 00:00 because it fell outside the gap Solution: 1. Check showMinLabel/showMaxLabel options in makeRealNumberLabels() 2. Pass pruneByBreak: 'preserve_extent_bound' to scale.getTicks() when these options are enabled, preventing removal of extent boundary ticks 3. Defensively add missing min/max labels if first/last tick is a break marker or not at the extent boundary 4. Preserve time metadata for proper formatting on time axes This aligns real number/time axis behavior with category axis implementation and ensures consistent label display regardless of break positioning. Fixes: Issue where axisLabel.showMinLabel: true was not honored on broken axes Related: Time axis, interval axis, broken axis, axis breaks
|
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. This PR depends on ZRender changes. Please update the ZRender dependency to the latest nightly version including this change, which takes place everyday at 8:00 UTC (16:00 Beijing Time). |
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| * Licensed to the Apache Software Foundation (ASF) under one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert the code style changes and turn off auto formatting tools if you are using any.
| "dependencies": { | ||
| "tslib": "2.3.0", | ||
| "zrender": "6.0.0" | ||
| "zrender": "npm:zrender-nightly@^6.0.1-dev.20251114" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this PR depends on a specific PR of zrender, please write thte issue in the description. Otherwise, don't change the version here.
fix(axis): honor showMinLabel/showMaxLabel for broken axis with time/value scales
Brief Information
This pull request is in the type of:
What does this PR do?
Fixes broken axis ignoring showMinLabel/showMaxLabel options on time/value axes, causing extent boundary labels to disappear when breaks are positioned nearby.
Fixed issues
Details
Before: What was the problem?
When using a line chart with a broken axis (time or value scale):
axisLabel: { showMinLabel: true }had no effectRoot Cause:
The makeRealNumberLabels() function in axisTickLabelBuilder.ts lacked the logic to honor showMinLabel/showMaxLabel options, unlike the category axis implementation (makeLabelsByNumericCategoryInterval). When pruneTicksByBreak() executed during scale.getTicks(), it removed ticks within a gap distance (interval * 3/4) of break boundaries to prevent visual overlap with zigzag break indicators. This pruning could inadvertently remove extent boundary ticks when breaks were positioned near the axis start or end.
Example Issue Breakdown:
After: How does it behave after the fixing?
showMinLabelandshowMaxLabeloptions are now properly respected on time and value axes with breakspruneByBreak: 'preserve_extent_bound'mode which protects extent boundary ticks from removalSolution Implementation:
This aligns real number/time axis behavior with the existing category axis implementation and ensures consistent label display regardless of break positioning.
Document Info
One of the following should be checked.
Misc
Security Checking
ZRender Changes
Related test cases or examples to use the new APIs
Test case: Line chart with time axis (00:00 to 23:59:59), break from 02:00 to 09:00, axisLabel.showMinLabel: true should display 00:00 label.
Merging options
Other information
This fix aligns the real number/time axis implementation with the existing category axis behavior, ensuring feature parity across all axis types. The change is backward compatible and only affects behavior when showMinLabel/showMaxLabel is explicitly set with broken axes.
I am attaching a video of the fix
2025-11-15.01-45-08.mp4