Google Chart inside and Overlow
by achudars
HTML
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {
packages: ["corechart"]
});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540]
]);
var options = {
title: 'Company Performance',
hAxis: {
title: 'Year',
titleTextStyle: {
color: 'red'
}
},
width: data.getNumberOfRows() * 65,
bar: {
groupWidth: 20
}
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
...
CSS
#chart_div {
overflow-x: scroll;
overflow-y: hidden;
width: 500px;
height: 550px;
}