I tried with string id before I posted this question here, but it didn't work.
Other solution you gave was to remove the column altogether, but, if I remove id column, how will chart know that the first column is not an id column, but one of the variables to draw the chart? Thanks for your help. On Monday, March 3, 2014 8:45:04 AM UTC-6, Sergey wrote: > The issue here is that the Timeline expects a string as the first column, > not a number. It doesn't seem like there is much of a point to numbering > the rows, so you can either get rid of that column altogether or simply > change it to a string, and everything should work. > > - Sergey > > > On Sat, Mar 1, 2014 at 7:51 PM, Reddy <[email protected] <javascript:>>wrote: > >> Hi I have the following code to draw timeline chart. It is giving me >> Invalid >> column index undefined. Should be an integer in the range [0-3] error. Can >> anyone help? >> >> <script type="text/javascript" src=" >> https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization >> ', >> 'version':'1','packages':['timeline']}]}"></script> >> >> <script type="text/javascript"> >> google.setOnLoadCallback(drawChart); >> function drawChart() { >> >> var dataTable = new google.visualization.DataTable(); >> dataTable.addColumn({ type: 'number', id: 'no' }); >> dataTable.addColumn({ type: 'string', id: 'Project' }); >> dataTable.addColumn({ type: 'date', id: 'Start Dt' }); >> dataTable.addColumn({ type: 'date', id: 'End Dt' }); >> dataTable.addRows([ >> [ 0, 'proj1', new Date(2013, 10, 29), new Date(2014, 5, 3) ], >> [ 1, 'proj2', new Date(2014, 2, 3), new Date(2014, 6, 3) ], >> [ 2, 'proj3', new Date(2014, 1, 1), new Date(2014, 12, 31) ], >> [ 3, 'proj4', new Date(2013, 10, 1), new Date(2014, 4, 1) ], >> [ 5, 'Mt5', new Date(2013, 9, 3), new Date(2014, 5, 3) ]]); >> var chart = new >> google.visualization.Timeline(document.getElementById('projects')); >> >> var options = { >> timeline: { showRowLabels: false } >> }; >> >> chart.draw(dataTable, options); >> } >> </script> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Visualization API" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]<javascript:> >> . >> To post to this group, send email to >> [email protected]<javascript:> >> . >> Visit this group at >> http://groups.google.com/group/google-visualization-api. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-visualization-api. For more options, visit https://groups.google.com/groups/opt_out.
