quinnsu opened a new pull request, #21094: URL: https://github.com/apache/echarts/pull/21094
<!-- 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 - [x] others ### What does this PR do? <!-- USE ONE SENTENCE TO DESCRIBE WHAT THIS PR DOES. --> ### Fixed issues [Question] When the legend may have multiple lines, how do I avoid overlapping graphics with the legend? https://github.com/apache/echarts/issues/16912 ## Details ### Before: What was the problem? When legends contain many items, they can grow beyond the available container space and overlap with the main chart area (grid, radar, etc.). The current behavior calculates `maxHeight` as `containerHeight - bottom - verticalMargin - top`, but doesn't enforce any upper limit when users specify a height constraint. <img width="538" alt="image" src="https://github.com/user-attachments/assets/6f2cb8b3-fd52-4a8a-b70d-5cd1c3f881cc" /> ### After: How does it behave after the fixing? When `legend.height` is specified, the legend will automatically scale down if its natural height exceeds the specified threshold. <img width="539" alt="auto scale" src="https://github.com/user-attachments/assets/b2373741-1cf2-46d3-afd2-2552b9796ccd" /> <img width="535" alt="image" src="https://github.com/user-attachments/assets/ea90c08c-782f-4ead-a15a-4aea82b85f22" /> ## Document Info One of the following should be checked. - [ ] This PR doesn't relate to document changes - [x] The document should be updated later - [ ] The document changes have been made in apache/echarts-doc#xxx ## Misc ### ZRender Changes - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx). ### Related test cases or examples to use the new APIs Test file created: test/legend-height-formats.html ## Others ### Merging options - [ ] Please squash the commits into a single one when merging. ### Other information I'm not sure if this is the best approach to solve this problem, and I'm happy to iterate and improve based on your feedback and suggestions. Open to alternative solutions! -- 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]
