Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google charts: Move legend position

I am using Google Charts to visualize data on my website. I have a problem with the 'visualization' 1.1 and the 'pakcages' line:

google.load('visualization', '1.1', {packages: ['line']});

I try to put the legend column in the bottom position, with others Google Charts types I use the next line and it works:

var options = {
legend: { position: 'bottom'}
};

But with this type of charts no works, it put the legend column in the right, like you can see in this image of my web: chart example

Thanks!

like image 524
Javier García Avatar asked Dec 20 '15 14:12

Javier García


People also ask

How do I change the position of my legend in a graph?

Click the chart, and then click the Chart Design tab. Click Add Chart Element > Legend. To change the position of the legend, choose Right, Top, Left, or Bottom. To change the format of the legend, click More Legend Options, and then make the format changes that you want.

How do I move my legend?

You can move the legend to any position within your chart. To move a chart's legend, simply click on it once to select it. (You will know it is selected when handles appear around the perimeter of the legend.) Then use the mouse to click within the legend and drag the legend to the desired position on the chart.

How do I customize my Google bar graph?

Customize a bar chartChoose an option: Chart style: Change how the chart looks. Chart & axis titles: Edit or format title text. Series: Change bar colors, axis location, or add error bars, data labels, or trendline.


2 Answers

I believe the syntax is like this:

var options = {
legend: 'bottom'
};

Source

EDIT: Actually, it seems to not yet be supported. Only right or none. Source

like image 98
itamar Avatar answered Sep 18 '22 04:09

itamar


Syntax would be -

  legend: { 
          position: 'bottom', 
        alignment: 'center' ,
        orientation: 'vertical',
    }
like image 32
patidarsnju Avatar answered Sep 19 '22 04:09

patidarsnju