qiran97 opened a new issue, #21896:
URL: https://github.com/apache/echarts/issues/21896

   ### Version
   
   6.1.0
   
   ### Link to Minimal Reproduction
   
   
https://echarts.apache.org/examples/en/editor.html?code=PYw7DoMwEER7TjGdm02ZxlGK5BpRihVYYAE2shckhHx3jEF083kzfhLrHd7YKiCaYE3URQOyTkZD1Z0PjaISNSys8dvgeDy6j0Ii3Pab7f8kB-v6_JTR6OdQnzBBOLRGCkpYeJhz8Xheq0RVeu0&enc=deflate
   
   ### Steps to Reproduce
   
   1. Open the reproduction link above.
   2. The chart area stays blank.
   3. The console reports `Uncaught TypeError: Cannot read property 'r' of 
undefined`, with a stack going through `getSectorCornerRadius` → 
`ChordEdge.updateData` → `ChordView.renderEdges`.
   4. Change only `value: -5` to `value: 5` and run again. The chord renders 
normally, so the rest of the option is valid.
   
   ### Current Behavior
   
   The chart renders nothing and an internal `TypeError` is thrown from the 
chord layout/render path. 
   
   ### Expected Behavior
   
   A negative value is not meaningful for a chord link (a ribbon width cannot 
be negative), so I don't expect it to be drawn. But negative values do occur in 
practice: link values are often computed rather than typed by hand — net inflow 
(`inflow - outflow`), profit/loss, temperature difference, weekly change — and 
a negative number can reach the chart without the author realizing it is 
meaningless here. At the moment the option is accepted silently by the schema 
and then crashes deep in the render path, which gives the user no clue about 
what is wrong.
   
   So I expect the library to handle this case in a defined way:
   
   - treat the negative value as `0` (optionally with a warning), or reject it 
with a clear error that points at `links.value`;
   - in either case, the rest of the chart should not be taken down: no `Cannot 
read property 'r' of undefined` from an internal helper such as 
`sectorHelper.js`, and other links/nodes should still be rendered if they are 
valid.
   
   ### Environment
   
   ```markdown
   - OS:Windows 11
   - Browser:Chrome 158
   - Framework:none (plain JavaScript)
   ```
   
   ### Any additional comments?
   
   Boundary results on 6.1.0 (only `links[0].value` changes): `-5` → TypeError 
(this issue); `0` → renders; `5` → renders; nodes with `value: 10` plus a `-5` 
link → renders fine; `NaN` / `'abc'` / missing → no crash. So it only breaks 
when no node has a positive value and the link is negative.
   
   Why it looks like an oversight: `chordLayout` returns early when 
`renderedNodeCount === 0 || nodeValueSum === 0` and leaves no layout for nodes 
or edges. `ChordView` guards the node path (`if (layout) { ... }`) but 
`renderEdges()` creates a `ChordEdge` unconditionally, and 
`ChordEdge.updateData` passes the undefined layout into `getSectorCornerRadius` 
before its own `isNaN` guard. I checked master (`src/chart/chord/`, 
2026-12-03); the edge side still has no guard.


-- 
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]

Reply via email to