And here is a simple working example:
<html>
<head>
<script type='text/javascript' src='http://www.google.com/jsapi
'></script>
<script type='text/javascript'>
google.load('visualization', '1', {'packages':['annotatedtimeline']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('datetime', 'Date');
data.addColumn('number', 'Sold Pencils');
data.addRows(6);
data.setValue(0, 0, new Date(2008, 1 ,1, 13, 45, 00));
data.setValue(0, 1, 30000);
data.setValue(1, 0, new Date(2008, 1 ,1, 15, 55, 00));
data.setValue(1, 1, 14045);
data.setValue(2, 0, new Date(2008, 1 ,1, 22, 10, 00));
data.setValue(2, 1, 55022);
data.setValue(3, 0, new Date(2008, 1 ,2, 02, 20, 00));
data.setValue(3, 1, 75284);
data.setValue(4, 0, new Date(2008, 1 ,2, 10, 45, 00));
data.setValue(4, 1, 41476);
data.setValue(5, 0, new Date(2008, 1 ,2, 12, 00, 00));
data.setValue(5, 1, 33322);
var chart = new
google.visualization.AnnotatedTimeLine(document.getElementById('chart_div'));
chart.draw(data, {});
}
</script>
</head>
<body>
<div id='chart_div' style='width: 700px; height: 240px;'></div>
</body>
</html>
On Tue, Jan 27, 2009 at 12:10 PM, VizGuy <[email protected]> wrote:
> Zooming to sub day should work automatically now, if you are using datetime
> type for the first column, and not date.note that for both the actual
> value is a javascript Date object, but in 'date' column type the time-of-day
> part of the date is ignored, and so the times assumed to be dates. This is
> why you can't zoom in to less than one day in that case.
>
> Regards,
> VizGuy
>
>
> On Tue, Jan 27, 2009 at 12:41 AM, hokagenz <[email protected]> wrote:
>
>>
>> Can someone tell me how to zoom to sub-day intervals. Example code
>> would be good. I'm new to javascript.
>>
>> Thanks
>> >>
>>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en
-~----------~----~----~----~------~----~------~--~---