Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw border around the chart area in Google Charts?

I need a border around just the chart area and not the whole chart. I can't find what property to set. This is in the Google Visualization API.

like image 967
necromancer Avatar asked Oct 10 '13 22:10

necromancer


People also ask

How do you add a border to a pie chart?

Click the chart to select it. In the Format sidebar, click the Chart tab. In the Chart Options section of the sidebar, select the Border checkbox.


1 Answers

The appropriate option is undocumented. You need to set the chartArea.backgroundColor.stroke and chartArea.backgroundColor.strokeWidth options. The stroke option controls the color of the border, and takes any valid HTML color string. The strokeWidth option controls the width of the border, and takes an integer for the width in pixels:

chartArea: {
    backgroundColor: {
        stroke: '#4322c0',
        strokeWidth: 3
    }
}
like image 133
asgallant Avatar answered Sep 28 '22 10:09

asgallant