The timeline chart looks at the types of your columns to determine how they should be used. As you can see in our documentation<https://developers.google.com/chart/interactive/docs/gallery/timeline>, The first example has a string column followed by two date columns. As you can see, in that case, the chart will use the string column for row labels. If you specify two string columns before your date columns, then the first column will be used for row labels and the second column will be used for bar labels. Here is a jsfiddle showing what your charts would look like for both removing your 'id' column and making it a string column, as well as a checkbox to control whether labels are drawn: http://jsfiddle.net/MJwK2/
- Sergey On Wed, Mar 5, 2014 at 10:25 PM, Reddy <[email protected]> wrote: > 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]> 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]. >>> 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. >>> >> >> -- > 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. > -- 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.
