This looks like a bug on our side. Thanks for reporting! - VizBoy.
On Sun, May 17, 2009 at 7:08 AM, 秦锋 <[email protected]> wrote: > > Hi: > It's glad to see visualization supports onmouseover event now, and > following is my example inherited from google ajax playground, the > important thing following is that the cell[0,2] is empty: > > <!-- > copyright (c) 2009 Google inc. > > You are free to copy and use this sample. > License can be found here: > http://code.google.com/apis/ajaxsearch/faq/#license > --> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:// > www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <meta http-equiv="content-type" content="text/html; charset=utf-8"/ > > > <title> > Google Visualization API Sample > </title> > <script language="javascript" type="text/javascript"> > <!-- > function myonmousemove() > { > value.innerHTML = "X:" + window.event.x + " Y:" + window.event.y + " " > + "X:" + window.event.screenX + " Y:" + window.event.screenY; > } > //--> > </script> > <script type="text/javascript" src="http://www.google.com/jsapi"></ > script> > <script type="text/javascript"> > google.load('visualization', '1', {packages: > ['linechart','table']}); > </script> > <script type="text/javascript"> > var visualization; > > var data = new google.visualization.DataTable(); > data.addColumn('string', 'Name'); > data.addColumn('number', 'Height'); > data.addColumn('number', 'Age'); > data.addRows(3); > data.setCell(0, 0, 'Tong Ning mu'); > data.setCell(1, 0, 'Huang Ang fa'); > data.setCell(2, 0, 'Teng nu'); > data.setCell(0, 1, 174); > data.setCell(1, 1, 523); > data.setCell(2, 1, 86); > // data.setCell(0, 2, 20); > data.setCell(1, 2, 30); > data.setCell(2, 2, 40); > > function drawVisualization() { > visualization = new google.visualization.LineChart > (document.getElementById('chart')); > visualization.draw(data, {enableTooltip:true}); > > // Add our selection handler. > google.visualization.events.addListener(visualization, 'select', > selectHandler); > google.visualization.events.addListener(visualization, > 'onmouseover', onmouseoverHandler); > > table = new google.visualization.Table(document.getElementById > ('table')); > table.draw(data, null); > } > > // The selection handler. > // Loop through all items in the selection and concatenate > // a single message from all of them. > function selectHandler() { > var selection = visualization.getSelection(); > var message = ''; > for (var i = 0; i < selection.length; i++) { > var item = selection[i]; > if (item.row != null && item.column != null) { > message += '{row:' + item.row + ',column:' + item.column + > '}'; > window.alert(data.getValue(item.row, item.column)); > } else if (item.row != null) { > message += '{row:' + item.row + '}'; > } else if (item.column != null) { > message += '{column:' + item.column + '}'; > } > } > if (message == '') { > message = 'nothing'; > } > //alert('You selected ' + message); > } > function onmouseoverHandler(e) { > value.innerHTML = e.row + " " + e.column + " " + data.getValue(e.row, > e.column); > } > > google.setOnLoadCallback(drawVisualization); > > > </script> > > </head> > <body style="font-family: Arial;border: 0 none;" > onmousemove=myonmousemove()> > <div id="value"></div> > <div id="table" ></div> > <div id="chart" style="height:500px;width:500px;"></div> > </body> > </html> > > Actually I found onmouseover and select all return wrong row number > when I move mouse to "Huang Ang fa"'s "Age", it shows the cell[0,2], > but [1,2] expected. > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
