You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "plainheart (via GitHub)" <gi...@apache.org> on 2025/12/18 19:36:02 UTC
[PR] fix(scatter): fix jitter layout does not support progressive rendering and cause chart to freeze and potential NPE [echarts]
plainheart opened a new pull request, #21436:
URL: https://github.com/apache/echarts/pull/21436
<!-- 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?
Current implementation of `scatterJitterLayout` does not support progressive rendering like [`scatterPointsLayout`](https://github.com/apache/echarts/blob/bbe3591a8a946b62a16e2ee6e254d8d1ed0c2741/src/layout/points.ts#L85-L88), which causes two issues:
1. Chart freezes with large datasets
2. Chart throws NPE with progressive rendering as the layout points use typed array and can not be retrieved by `seriesData.getItemLayout(idx)`
Please take a look at [this online example](https://echarts.apache.org/examples/editor.html?c=scatter-large) for a quick view.
### Fixed issues
- Resolves #21434
## Comparison
<img width="2795" height="1625" alt="image" src="https://github.com/user-attachments/assets/fbb8ee0c-cfba-4966-982a-3e4ad7787a9b" />
## 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
See the 4th/5th test cases in `test/scatter-jitter.html`.
### Merging options
- [ ] Please squash the commits into a single one when merging.
### Other information
--
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(scatter): fix jitter layout does not support progressive rendering and cause chart to freeze and potential NPE [echarts]
Posted by "100pah (via GitHub)" <gi...@apache.org>.
100pah merged PR #21436:
URL: https://github.com/apache/echarts/pull/21436
--
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(scatter): fix jitter layout does not support progressive rendering and cause chart to freeze and potential NPE [echarts]
Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on PR #21436:
URL: https://github.com/apache/echarts/pull/21436#issuecomment-3677785265
Congratulations! Your PR has been merged. Thanks for your contribution! 👍
--
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(scatter): fix jitter layout does not support progressive rendering and cause chart to freeze and potential NPE [echarts]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #21436:
URL: https://github.com/apache/echarts/pull/21436#issuecomment-3671953780
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21436@bbe3591
<!-- ECHARTS_PR_PREVIEW -->
--
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(scatter): fix jitter layout does not support progressive rendering and cause chart to freeze and potential NPE [echarts]
Posted by "plainheart (via GitHub)" <gi...@apache.org>.
plainheart commented on code in PR #21436:
URL: https://github.com/apache/echarts/pull/21436#discussion_r2632405800
##########
src/util/jitter.ts:
##########
@@ -67,21 +67,19 @@ export function fixJitter(
}
const axisModel = fixedAxis.model as AxisBaseModel;
const jitter = axisModel.get('jitter');
+ if (!(jitter > 0)) {
+ return floatCoord;
+ }
const jitterOverlap = axisModel.get('jitterOverlap');
const jitterMargin = axisModel.get('jitterMargin') || 0;
// Get band width to limit jitter range
const bandWidth = fixedAxis.scale.type === 'ordinal'
? fixedAxis.getBandWidth()
: null;
- if (jitter > 0) {
- if (jitterOverlap) {
- return fixJitterIgnoreOverlaps(floatCoord, jitter, bandWidth, radius);
- }
- else {
- return fixJitterAvoidOverlaps(fixedAxis, fixedCoord, floatCoord, radius, jitter, jitterMargin);
- }
+ if (jitterOverlap) {
+ return fixJitterIgnoreOverlaps(floatCoord, jitter, bandWidth, radius);
}
- return floatCoord;
+ return fixJitterAvoidOverlaps(fixedAxis, fixedCoord, floatCoord, radius, jitter, jitterMargin);
Review Comment:
No logical bug here. Just tweaked the code style.
--
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(scatter): fix jitter layout does not support progressive rendering and cause chart to freeze and potential NPE [echarts]
Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on PR #21436:
URL: https://github.com/apache/echarts/pull/21436#issuecomment-3671930881
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).
The pull request is marked to be `PR: author is committer` because you are a committer of this project.
--
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