Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How the legends on Google charts can be wrapped

Tags:

charts

I need the legends of Google chart to get wrapped (comes in new line) automatically if it exceeds container area. I don't want scroll button as it is not enough convenient. With available customization options, seems it cannot be done. Any other way?

like image 622
Abhay Avatar asked Oct 05 '12 11:10

Abhay


People also ask

How do I get rid of the legend in my Google chart?

The Legend is hidden by setting the legend property to none in the Google Chart Options. title: 'USA City Distribution', legend: 'none' // Hides the Legend.

Are Google Charts Interactive?

These charts are based on pure HTML5/SVG technology (adopting VML for old IE versions), so no plugins are required. All of them are interactive, and many are pannable and zoomable.


1 Answers

Use the maxLines property for the legend. i.e.:

options.legend = {position: 'top', maxLines: 5};

Note that this undocumented property only works if the legend is positioned at the top and there is enough vertical space to render both the chart and multi-line legend.

like image 67
Akin Williams Avatar answered Oct 31 '22 12:10

Akin Williams