pissang opened a new pull request #16272: URL: https://github.com/apache/echarts/pull/16272
<!-- 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 - [x] new feature - [ ] others ### What does this PR do? Add `useViewBox` opt in `renderToSVGString` method to make the generated SVG responsive. ### Fixed issues https://github.com/apache/echarts/issues/16127#issuecomment-983514232 ## Details ### Before: What was the problem? The generated SVG has no [viewBox](https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/viewBox) attribute and is not responsive. ### After: How is it fixed in this PR? Use a `useViewBox` opt (default to be true) to add [viewBox](https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/viewBox) attribute. It's responsive now when `width` and `height` are changed. This allows use to configure `width` and `height` in the CSS. ```css .chart svg { width: 100%; height: 100%; } ``` ## Misc <!-- ADD RELATED ISSUE ID WHEN APPLICABLE --> - [x] The API has been changed (apache/echarts-doc#xxx). - [x] This PR depends on ZRender changes (ecomfe/zrender#861). -- 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]
