Vertical line that follows mouse movement in chart
This example shows how to implement a vertical line that follows the mouse movement across the chart.
HTML
<script src="http://www.google.com/jsapi?.js"></script>
<div id="visualization"></div>
JavaScript
google.load('visualization', '1', {packages: ['corechart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Number');
data.addColumn({type: 'string', role: 'annotation'});
data.addColumn('number', 'Value');
data.addRows([
["1", null, 7],
["2", '', 8], //annotation #1
["3", null, 4],
["4", 'Foo', 2], //annotation #2
["5", null, 5],
["5", null, 4],
["5", null, 6],
["5", null, 5]
]);
new google.visualization.ComboChart(document.getElementById('visualization')).
draw(data, {
width: 500,
height: 400,
annotations: {
style: 'line'
}
});
}