farisbasha opened a new pull request, #21898: URL: https://github.com/apache/echarts/pull/21898
<!-- Please fill in the following information to help us review your PR more efficiently. --> ## Brief Information This pull request is in the type of: - [ ] bug fixing - [ ] new feature - [ ] others ### What does this PR do? Chord series: a negative link value now counts as 0 instead of crashing the whole chart. ### Fixed issues - #21896: chord series throws TypeError when a link value is negative ## Details ### Before: What was the problem? With a negative link value, the layout could exit early (no positive value left), so edges had no layout and `ChordEdge` threw `Cannot read properties of undefined (reading 'r')`. The chart stayed blank. With a mix of positive and negative links, the negative values were subtracted from the node arcs. ### After: How does it behave after the fixing? In `chordLayout.ts`, link values are clamped to 0, and the "all zero" check sums only positive values. So a negative link is drawn like a zero link, and the rest of the chart renders. If every value is 0 or negative, the existing all-zero fallback (equal links) is used. ## Document Info One of the following should be checked. - [ ] 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 Added `test/ut/spec/series/chord.test.ts` (2 cases: the issue's single negative link, and a mixed positive/negative case). Both fail on master and pass with this change. Full `npm test` (jest), `eslint` and `tsc --noEmit` pass. ### Merging options - [ ] Please squash the commits into a single one when merging. ### Other information This change was written with help from an AI coding assistant (Claude). -- 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]
