You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "jesco-absolut (via GitHub)" <gi...@apache.org> on 2026/06/22 06:35:21 UTC
[PR] fix(dataZoom): guard data shadow for single-point time axis [echarts]
jesco-absolut opened a new pull request, #21658:
URL: https://github.com/apache/echarts/pull/21658
<!-- Please fill in the following information to help us review your PR more efficiently. -->
## Brief Information
This pull request is in the type of:
- [x] bug fixing
- [ ] new feature
- [ ] others
### What does this PR do?
Guard dataZoom slider data-shadow normalization so a single-point time-axis series does not generate NaN shadow geometry.
### Fixed issues
- close #21649
## Details
### Before: What was the problem?
For slider dataZoom with `showDataShadow: true`, `_renderDataShadow` computes a time-axis shadow coordinate with:
```ts
(+thisValue - thisDataExtent[0]) * normalizationConstant
```
`normalizationConstant` was calculated as:
```ts
size[0] / (thisDataExtent[1] - thisDataExtent[0])
```
When the shadow-source series has only one point on a time axis, `thisDataExtent[0] === thisDataExtent[1]`, so the divisor is `0`. This makes `normalizationConstant` become `Infinity`, and the single point computes `0 * Infinity`, producing `NaN`. The NaN coordinate then reaches the shadow polygon/polyline and the slider shadow renders blank/broken.
### After: How does it behave after the fixing?
The normalization divisor is guarded for zero-width extents. In that degenerate single-point case, `normalizationConstant` becomes `0`, so the time-axis shadow coordinate remains finite and maps to the left edge of the slider, consistent with the existing non-time single-point step path.
A visual test was added to `test/dataZoom-single-datapoint.html` covering:
- single-point series on a time axis with `showDataShadow: true`;
- multi-point series on a time axis with `showDataShadow: true`;
- single-point series on a value axis with `showDataShadow: true`.
## Document Info
One of the following should be checked.
- [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.
<!-- PLEASE CHECK IT AGAINST: <https://github.com/apache/echarts/wiki/Security-Checklist-for-Code-Contributors> -->
### ZRender Changes
- [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
### Related test cases or examples to use the new APIs
`test/dataZoom-single-datapoint.html`
Validation run:
```sh
npm run checktype
npx eslint src/component/dataZoom/SliderZoomView.ts
npm run lint
git diff --check
```
### Merging options
- [ ] Please squash the commits into a single one when merging.
### Other information
N.A.
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [PR] fix(dataZoom): guard data shadow for single-point time axis [echarts]
Posted by "jesco-absolut (via GitHub)" <gi...@apache.org>.
jesco-absolut commented on PR #21658:
URL: https://github.com/apache/echarts/pull/21658#issuecomment-5149565630
Closing this in favor of #21668, which addresses the same regression with the existing step-coordinate fallback and a focused unit test for finite shadow geometry. Keeping one implementation should make review easier. Thanks.
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [PR] fix(dataZoom): guard data shadow for single-point time axis [echarts]
Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on PR #21658:
URL: https://github.com/apache/echarts/pull/21658#issuecomment-4765559545
Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/echarts/wiki/How-to-make-a-pull-request).
Please **DO NOT** commit the files in [dist](https://github.com/apache/echarts/tree/master/dist), [i18n](https://github.com/apache/echarts/tree/master/i18n), and [ssr/client/dist](https://github.com/apache/echarts/tree/master/ssr/client/dist) folders in a non-release pull request. These folders are for release use only.
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [PR] fix(dataZoom): guard data shadow for single-point time axis [echarts]
Posted by "jesco-absolut (via GitHub)" <gi...@apache.org>.
jesco-absolut closed pull request #21658: fix(dataZoom): guard data shadow for single-point time axis
URL: https://github.com/apache/echarts/pull/21658
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [PR] fix(dataZoom): guard data shadow for single-point time axis [echarts]
Posted by "jesco-absolut (via GitHub)" <gi...@apache.org>.
jesco-absolut commented on PR #21658:
URL: https://github.com/apache/echarts/pull/21658#issuecomment-5085460615
Hi maintainers — would this single-point time-axis dataZoom fix be of interest for review? The PR is ready from my side, and I’m happy to address any feedback. Thanks for your time.
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org