3

I've got a google visualization graph and a legenda for that graph on top of the graph.

These are my graph options:

var chartOptions ={
    width: 700, height: 500,
    chartArea: {width: '80%', height: '80%', top:20},
    legend: {position: 'top'},
    titlePosition: 'in', 
    axisTitlesPosition: 'in',
    hAxis: {showTextEvery: '1', textPosition: 'out'}, 
    vAxis: {textPosition: 'out'}    
}     

I was wondering if there is a way to set the margin between the legenda and the graph or maybe I've messed something up by setting these options.

Thanks in advance.

MmynameStackflow
  • 1,251
  • 3
  • 19
  • 39

1 Answers1

6

I found the problem myself.

I'd set the property top to 20 of the chartArea in the strugling to get the chart maximized. When I removed this property the problem was solved.

The solution to maximize the chart is to set the theme to 'maximized' as described in the google api or to set the width and height of the chart area to 100% percent if you don't have any outside labels or a legend.

The final code of the option var is:

var options ={
        width: 700, height: 500,
        chartArea: {width: '80%', height: '75%'},
        legend: {position: 'top'},
        titlePosition: 'in', axisTitlesPosition: 'in',
        hAxis: {showTextEvery: '1', textPosition: 'out'}, 
        vAxis: {textPosition: 'out'}
}   
MmynameStackflow
  • 1,251
  • 3
  • 19
  • 39