Your mistake is setting the first column to be of type 'date' and not 'datetime'. This is described at http://code.google.com/apis/visualization/documentation/gallery/annotatedtimeline.html#Data_Format ("If the first column is of type date (and not datetime) then the time resolution on the X axis will not get below days.")
Regards, VizGuy On Thu, Feb 19, 2009 at 12:23 AM, desvin <[email protected]>wrote: > > Thanks for your help. > > I've tried to modify my code using your advice but I can't get it > working. > > From what I understand, you added a new column (data.addColumn > ('number', 'Hours');) but you do not pass it any data, am I right ? > > Thnaks for your help. > > On 18 fév, 23:01, Diter <[email protected]> wrote: > > Try this way: > > > > function drawChart() { > > var data = new google.visualization.DataTable(); > > data.addColumn('date', 'Date'); > > data.addColumn('number', 'Hours'); > > data.addColumn('number', 'Visits'); > > > > data.addRow(); > > data.setValue(0, 0, new Date(2008, 1 ,1, 1, 1, 1)); > > data.setValue(0, 1, 30000); > > data.setValue(1, 0, new Date(2008, 1 ,2, 1, 1, 1)); > > data.setValue(1, 1, 14045); > > var chart = new google.visualization.AnnotatedTimeLine > > (document.getElementById('chart_div')); > > chart.draw(data, {displayAnnotations: true}); > > } > > > > On Feb 18, 4:42 pm, desvin wrote: > > > > > Hello all, > > > > > I've struggling all day with Google's Annotated Timeline chart. > > > I'm using this chart to display an analysis of an internet site > > > visits. > > > > > To do so, I've got the data of how many users connected to this site > > > every hour for the last fifteen days. > > > > > I am able to display these data well but would like to show the hours > > > in the x scale. > > > > > Have you got an idae on how to do so ? > > > > > Thanks a lot for your help. > > > > > PS : a sample of the code I use : > > > ... > > > function drawChart() { > > > var data = new google.visualization.DataTable(); > > > data.addColumn('date', 'Date'); > > > data.addColumn('number', 'Visits'); > > > data.addRows(2); > > > data.setValue(0, 0, new Date(2008, 1 ,1, 1, 1, 1)); > > > data.setValue(0, 1, 30000); > > > data.setValue(1, 0, new Date(2008, 1 ,2, 1, 1, 1)); > > > data.setValue(1, 1, 14045); > > > var chart = new google.visualization.AnnotatedTimeLine > > > (document.getElementById('chart_div')); > > > chart.draw(data, {displayAnnotations: true}); > > > } > > > > > ... > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
