I have this google chart on my site . This is a scatter chart at the moment, but I would like to find a solution for all types of charts. For example, if you load a site with a window width of 700 pixels, the size of the chart does not respond: the chart is too wide. Below is the code I'm using.
HTML:
<div id="chart_div"></div>
CSS:
#chart_div { width:100%; height:20%; }
JS:
var options = { title: 'Weight of pro surfer vs. Volume of his pro model', hAxis: {title: 'Weight (kg)', minValue: 53, maxValue: 100}, //55 vAxis: {title: 'Volume (l)'}, //, minValue: 20, maxValue: 40}, //20 legend: 'none', width: '100%', height: '100%', colors: ['#000000'], series: { 1: { color: '#06b4c8' }, }, legend: {position: 'top right', textStyle: {fontSize: 8}}, chartArea: {width: '60%'}, trendlines: { 0: {//type: 'exponential', visibleInLegend: true, color: 'grey', lineWidth: 2, opacity: 0.2, labelInLegend: 'Linear trendline\n(Performance)' } } // Draw a trendline for data series 0. }; var chart = new google.visualization.ScatterChart(document.getElementById('chart_div')); chart.draw(data, options); google.visualization.events.addListener(chart, 'ready', myReadyHandler()); function myReadyHandler() { chartDrawn.resolve(); }
Edit: It seems that the div #chart_div is the correct size (the one I set using css), but the diagram inside this div does not adapt to its size ... it remains locked with See Image: 
jquery google-visualization responsive-design charts
Louis
source share