I have been trying to use the chartRangeFilter for the new google.visualization.Timeline but was not successful. Here is the code I have written, could you please let me know if this is possible. If possible also please let me know what am i doing wrong here.
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1.1', {packages: ['controls']});
google.setOnLoadCallback(drawVisualization);
function drawVisualization() {
var dashboard = new google.visualization.Dashboard(
document.getElementById('dashboard'));
var control = new google.visualization.ControlWrapper({
'controlType': 'ChartRangeFilter',
'containerId': 'control',
'options': {
// Filter by the date axis.
'filterColumnIndex': 0,
'ui': {
'chartType': 'LineChart',
'chartOptions': {
'chartArea': {'width': '90%'},
'hAxis': {'baselineColor': 'none'}
},
// Display a single series that shows the closing value of the stock.
// Thus, this view has two columns: the date (axis) and the stock value (line series).
'chartView': {
'columns': [0, 3]
},
// 1 day in milliseconds = 24 * 60 * 60 * 1000 = 86,400,000
'minRangeSize': 86400000
}
},
// Initial range: 2012-02-09 to 2012-03-20.
'state': {'range': {'start': new Date(2012, 1, 9), 'end': new Date(2012, 2, 20)}}
});
var chart = new google.visualization.ChartWrapper({
'chartType': 'Timeline',
'containerId': 'chart',
'options': {
'width': 900,
'height': 500,
}
});
var data = new google.visualization.DataTable();
data.addColumn({ type: 'String', id: 'TestAction' });
data.addColumn({ type: 'date', id: 'Start' });
data.addColumn({ type: 'date', id: 'End' });
data.addRows([
[ 'MO Call', new Date(2013,10,2,12,0,0,0), new Date(2013,10,2,12,0,10,0)],
[ 'MO Call', new Date(2013,10,2,12,0,25,0), new Date(2013,10,2,12,1,0,0)],
[ 'MO Call', new Date(2013,10,2,12,1,20,0), new Date(2013,10,2,12,1,40,0)],
[ 'Browser', new Date(2013,10,2,12,0,10,0), new Date(2013,10,2,12,0,30,0)],
[ 'Browser', new Date(2013,10,2,12,0,45,0), new Date(2013,10,2,12,1,0,0)],
[ 'Browser', new Date(2013,10,2,12,1,20,0), new Date(2013,10,2,12,1,40,0)],
[ 'Browser', new Date(2013,10,2,12,2,10,0), new Date(2013,10,2,12,2,25,0)],
[ 'WIFI', new Date(2013,10,2,12,0,10,0), new Date(2013,10,2,12,0,30,0)],
[ 'WIFI', new Date(2013,10,2,12,0,45,0), new Date(2013,10,2,12,1,0,0)],
[ 'WIFI', new Date(2013,10,2,12,1,20,0), new Date(2013,10,2,12,1,40,0)]]);
dashboard.bind(control, chart);
dashboard.draw(data);
}
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="dashboard">
<div id="chart"></div>
<div id="control"></div>
</div>
</body>
</html>