How to create a Google chart with a width and height of 100%?

How to create a Google chart with a width and height of 100%?

I tried using the obvious width: 100%, but this does not work.

+4
source share
1 answer

From a google doc:

One very common installation option is the height and width of the chart. You can specify the size of the chart in two places: in the HTML container or in the chart options. If you specify a size in both locations, the chart is usually delayed to the specified size in HTML. If you don’t specify the size of the chart in HTML or as an option, the chart may not display properly.

The solution is to specify the width using HTML, not using Javascript. So:

var options = {
  'legend':'left',
  'title':'My Big Pie Chart',
  'is3D':true,
  'width':100%,
  'height':500
}

DOES NOT WORK.

. CSS, . , , . , : 100%; . . ? , HTML 4 body , . 100% . HTML5 body , . , 100% HTML5, , , , .

DOCTYPE xlmns , HTML 4 , HTML5 . html/body 100% CSS, , :

html, body {
      width: 100%;
      height: 100%;
    }
+4

Source: https://habr.com/ru/post/1540292/


All Articles