You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/06/14 11:28:46 UTC

[GitHub] [echarts] hornta opened a new issue, #17215: [Feature] Adaptive width/height of legend container

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

   ### What problem does this feature solve?
   
   Based on this issue: https://github.com/apache/echarts/issues/7887
   
   We need our chart to adapt the height/width of the legends both vertical and horizontal type so that items doesn't overflow onto the graph area. Currently they only way is to hardcode a pixel/percentage value but it's not responsive.
   
   ### What does the proposed API look like?
   
   -


-- 
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-unsubscribe@echarts.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] zxrrg commented on issue #17215: [Feature] Adaptive width/height of legend container

Posted by "zxrrg (via GitHub)" <gi...@apache.org>.
zxrrg commented on issue #17215:
URL: https://github.com/apache/echarts/issues/17215#issuecomment-1587116609

   There is a way in which you can make it dynamic.
   The idea is to retrieve the maximum length (in characters) and give that spacing to the grid (by multiplying it by X, depending on the font size).
   
   MaxLength:
   
   `let maxLength = 0;`
   `const series = option.series.map((key) => {`
     `if (key.name.length > maxLength) {`
       `maxLength = key.name.length;`
     `}`
     `....`
   
   GRid like this:
   
   `grid: {`
     `containLabel: true,`
     `right: showLegend ? maxLength * 9 : 40,`
     `bottom: 80,`
   `},`
   
   and thats it :)


-- 
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-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org