You might need some dynamic behavior to make this work, such as catching the 'ready' and getting the size of the rendered table to then set the size of the wrapper.
To hopefully help you find a solution, here is a partial copy of a test utility I have used to generate the many variations in tables. Use initAndDraw as the onload callback.
var dataTable;
/**
* Set up data table for all table charts.
*/
function setDataTable1() {
dataTable = createSomeTable();
}
var idNum = 0;
/**
* Create a table chart with the parameters.
* @param {?(number|string)} wWidth wrapper width.
* @param {?(number|string)} wHeight wrapper height.
* @param {?(number|string)} width
* @param {?(number|string)} height
* @param {!Object} options
*/
function createTableChart(wWidth, wHeight, width, height, options) {
var id = 'table' + (idNum++);
var section = document.createElement('div');
section.innerHTML = '</br><hr><h3>' + id + '</h3>' +
'<p>container' +
' width: ' + width + ' height: ' + height + '</br>' +
' table options: ' + JSON.stringify(options) +
'</p>';
document.getElementById('tables').appendChild(section);
var wrapper = document.createElement('div');
wrapper.cssText = '';
if (wWidth != null) {
wrapper.style.width =
(typeof wWidth === 'number' ? wWidth + 'px' : wWidth);
}
if (wHeight != null) {
wrapper.style.height =
(typeof wHeight === 'number' ? wHeight + 'px' : wHeight);
}
try {
wrapper.style.outline = '10px solid rgba(200, 200, 200, 0.5)';
} catch (e) {}
section.appendChild(wrapper);
var container = document.createElement('div');
container.cssText = '';
if (width != null) {
container.style.width =
(typeof width === 'number') ? width + 'px' : width;
}
if (height != null) {
container.style.height =
(typeof height === 'number') ? height + 'px' : height;
}
try {
container.style.outline = '5px solid rgba(128, 128, 128, 0.5)';
} catch (e) {}
// Test with table-cell container.
//container.style.display = 'table-cell';
// Test if drawn with invisible container.
//container.style.display = 'none';
wrapper.appendChild(container);
var chart = new google.visualization.Table(container);
chart.draw(dataTable, options);
//container.style.display = null;
}
/**
* Initialize everything and draw the charts.
*/
function initAndDraw() {
setDataTable1();
var wrapperWidth = '100%';
var wrapperHeight = '100%';
// not specified, too small, too large, 100%
/*
var containerWidths = [null, 200, 600, '100%'];
var containerHeights = [null, 150, 250];
var chartWidths = [null, 180, 400, '50%', '100%'];
var chartHeights = [null, 150, '50%', '100%'];
*/
var containerWidths = [null, 600, '100%'];
var containerHeights = [null, 250];
var chartWidths = [null, 180, '100%'];
var chartHeights = [null, 150, '100%'];
var pagingOptions = [0, 5];
// var frozenColumns = [-1, 2];
var frozenColumns = [-1];
for (var contWidth in containerWidths) {
var containerWidth = containerWidths[contWidth];
for (var contHeight in containerHeights) {
var containerHeight = containerHeights[contHeight];
for (var cWidth in chartWidths) {
var chartWidth = chartWidths[cWidth];
if (typeof chartWidth === 'number' &&
typeof containerWidth === 'number' &&
chartWidth > containerWidth) { continue; }
for (var cHeight in chartHeights) {
var chartHeight = chartHeights[cHeight];
if (typeof chartHeight === 'number' &&
typeof containerHeight === 'number' &&
chartHeight > containerHeight) { continue; }
for (var fc in frozenColumns) {
for (var po in pagingOptions) {
var pageSize = pagingOptions[po];
var page = pageSize > 0 ? 'enable' : 'disable';
createTableChart(
wrapperWidth, wrapperHeight,
containerWidth,
containerHeight, {
width: chartWidth,
height: chartHeight,
page: page,
pageSize: pageSize,
frozenColumns: frozenColumns[fc]
});
}
}
}
}
}
}
}