I have next TimeLine Chart
google.setOnLoadCallback(drawChart);
function drawChart() {
var container = document.getElementById('timechart');
var chart = new google.visualization.Timeline(container);
var dataTable = new google.visualization.DataTable();
dataTable.addColumn({ type: 'string', id: 'Room' });
dataTable.addColumn({ type: 'string', id: 'Name' });
dataTable.addColumn({ type: 'date', id: 'Start' });
dataTable.addColumn({ type: 'date', id: 'End' });
dataTable.addRows([
[ 'Magnolia Room', 'row 1', new Date(0,0,0,9,0,0), new Date(0,0,0,
14,0,0) ],
[ 'Magnolia Room', 'row 2', new Date(0,0,0,14,30,0), new Date(0,0,0,
16,0,0) ],
[ 'Magnolia Room', 'row 3', new Date(0,0,0,16,30,0), new Date(0,0,0,
18,0,0) ],
[ 'Gladiolus Room', 'row 4', new Date(0,0,0,12,30,0), new Date(0,0,0,
14,0,0) ],
[ 'Gladiolus Room', 'row 5', new Date(0,0,0,14,30,0), new Date(0,0,0,
16,0,0) ],
[ 'Gladiolus Room', 'row 6', new Date(0,0,0,16,30,0), new Date(0,0,0,
18,0,0) ],
[ 'Petunia Room', 'row 7', new Date(0,0,0,12,30,0), new Date(0,0,0,
14,0,0) ],
[ 'Petunia Room', 'row 8', new Date(0,0,0,14,30,0), new Date(0,0,0,
16,0,0) ],
[ 'Petunia Room', 'row 9', new Date(0,0,0,16,30,0), new Date(0,0,0,
18,00,0) ]]);
var options = {
colors: ['#cbb69d', '#603913', '#c69c6e','#cbb69d', '#603913', '#c69c6e'
,'#cbb69d', '#603913', '#c69c6e'],
backgroundColor: '#fff',
enableInteractivity: false,
};
chart.draw(dataTable, options);
google.visualization.events.addListener(chart, 'select', selectHandler);
function selectHandler(){
var selectedItem = chart.getSelection();
if (selectedItem) {
var value = dataTable.getValue(getSelection.row,1); //row is
undefined
alert('The user selected ' + value);
}
}
}
I need to see "The user selected row 1", when first row was clicked.
Where did I go wrong?
PS. Sorry for my bad English.
--
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/d/optout.