ywx-sss commented on issue #21856:
URL: https://github.com/apache/echarts/issues/21856#issuecomment-7277663583

   I reproduced this independently on `[email protected]` with Node 24 in SSR/SVG 
mode (no browser, no canvas), so the crash is not renderer-specific:
   
   ``js
   const echarts = require('echarts');
   const chart = echarts.init(null, null, { renderer: 'svg', ssr: true, width: 
400, height: 400 });
   chart.setOption({
     polar: {},
     angleAxis: { max: 10 },
     radiusAxis: { type: 'category', data: Array.from({ length: 500 }, (_, i) 
=> 'c' + i) },
     series: [{
       type: 'bar',
       coordinateSystem: 'polar',
       large: true,
       data: Array.from({ length: 500 }, (_, i) => 2 + (i % 7)),
     }],
   });
   chart.renderToSVGString();
   ``
   
   It throws:
   
   ``text
   TypeError: Cannot read properties of undefined (reading 'length')
       at LargePath.buildPath (.../echarts/dist/echarts.js:46675)
       at brushSVGPath (...)
       at SVGPainter._paintList (...)
   ``
   
   `largeThreshold: 2` with two data points reproduces it as well, so the 
trigger is the large-mode path being selected at all, not the data size.
   
   The root cause looks like the same one described in the report: `LargePath` 
assumes a cartesian2d layout (it reads `shape.points` / the layout result 
shaped for cartesian bars), while the polar bar layout carries a different 
shape. Large mode is only implemented for cartesian2d bars, but `large: true` 
is accepted for a polar bar series and the large path is still chosen.
   
   Workaround: `large: false` (or a `largeThreshold` larger than the data 
length) avoids the crash and falls back to normal rendering.
   
   A minimal fix could disable large mode when the bar series is not on 
`cartesian2d` (in the bar view/series where `large` is selected), or make 
`LargePath.buildPath` fall back to the normal path when the layout shape is not 
the cartesian one. A regression test could render the option above in SSR mode 
and assert that `renderToSVGString()` does not throw and contains one path per 
data item.


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