I've seen in other posts that googlecharts can be easily zoomed using the option explore
.
I've been unsuccessfully trying to zoom this chart with the following characteristics:
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'time');
data.addColumn('number', 'value');
data.addRows([['2001', 12],['2002', 15],['2003', 16],
['2004', 12],['2005', 15],['2006', 19],
['2007', 12],['2008', 25],['2009', 16],
['2010', 22],['2011', 12],['2012', 13]]);
var options = {
title: 'Price Chart',
explorer: {actions: ['dragToZoom', 'rightClickToReset'],axis: 'horizontal',keepInBounds: true,maxZoomIn: 4.0},
legend: { position: 'bottom' }
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<div id="curve_chart" style="width: 100%; height: 100%"></div>
As shown in the comment of this question, i'm not using the parameter date
to pass the data, so the bug doesn't come from here.
I'm guessing that the problem comes ethier from addRows
or div
.
See fiddle here
Any suggestions?