htr3n edited a comment on issue #16127: URL: https://github.com/apache/echarts/issues/16127#issuecomment-995304513
@pissang @plainheart Regarding the nightly build that you recommended, I've noticed a strange issue. I tried to load the legend icons as dataURI per documentation here: https://echarts.apache.org/en/option.html#legend.data.icon. The `dataURI` is a wrapper for an SVG icon. ```javascript legend: { show: true, data: [ { name: 'LegendIcon', icon: 'image://data:image/svg+xml;base64,PHN2ZyB4bWxuc....' } ] } ``` I use the same code on my React UI and it can be rendered successfully. But the new nightly build server-side rendering implementation `renderToSVGString()` raised an error: `ReferenceError: HTMLImageElement is not defined`. It seems it could not load the `dataURI`? ``` "echarts-nightly": "^5.3.0-dev.20211212", ``` __Updated__: If I replace the `dataURI` `'image://data:image/svg...'` with SVG path, for instance, taken from ECharts web site ```javascript icon: 'path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z' ``` then it works. My wild guess is that, the `dataURI` needs a Canvas to render properly? In case of using SVG path data, `path://M...` is not sufficient to set SVG styles such as `stroke` (colour) and `stroke-width`. -- 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-unsubscr...@echarts.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org