14,16d13 < < var ready=false; < 18d14 < //echo "var data, chart; \n"; 31d26 < echo " var colnames= '" . $GETlabel . "," . str_replace("'", "", $GETvalue) . "'; \n"; 48,105c43 < $GETonclick = ""; < if (isset($_GET['onclick'])) $GETonclick = urldecode($_GET['onclick']); < if (isset($_POST['onclick'])) $GETonclick = urldecode($_POST['onclick']); < if ($GETonclick != "") { < echo "google.visualization.events.addListener(chart, 'ready', function() { ready=true; }); \n"; < echo "google.visualization.events.addListener(chart, 'select', function() { < if (ready) { < var message = '', dparts, colparts=colnames.split(','), predparts, postdparts, diffcolnames=colnames,diffvalues; < var selection = chart.getSelection(); < for (var i = 0; i < selection.length; i++) { < var item = selection[i]; < if (item.row != null && item.column != null) { < var str = data.getFormattedValue(item.row, item.column); < //document.title=str; < message=document.head.innerHTML; < for (var iij=0; iij<=eval(item.row); iij++) { < message=message.replace(', [',',['); < } < dparts=message.split(',['); < message += '{row:' + item.row + ',column:' + item.column + '} = ' + str; < if (eval(dparts.length) >= eval(1 + item.row)) { < postdparts=dparts[eval(1 + item.row)].split(','); < if (eval(postdparts.length) >= eval(1 + item.column)) { < if (eval(colparts.length) == 3) { < alert('In ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while ' + colparts[eval(3 - item.column)] + ' were ' + postdparts[eval(3 - item.column)].replace(']','') + ' the difference being ' + eval(eval(postdparts[1].replace(']','')) - eval(postdparts[2].replace(']','')))); < } else { < predparts=dparts[eval(1 + item.row)].split(']'); < diffvalues=('~' + predparts[0] + '~').replace('~' + postdparts[0].replace(']','') + ',','~'); < if (eval(0 + item.column) == 1) { < diffvalues=diffvalues.replace('~' + str + ',','').replace(/~/g,''); < } else if (eval(colparts.length) == eval(1 + item.column)) { < diffvalues=diffvalues.replace(',' + str + '~','').replace(/~/g,''); < } else { < diffvalues=diffvalues.replace(',' + str + ',',',').replace(/~/g,''); < } < diffcolnames=('~' + colnames + '~').replace('~' + colparts[0] + ',','~').replace('~' + colparts[eval(0 + item.column)] + ',','').replace(',' + colparts[eval(0 + item.column)] + '~','').replace(',' + colparts[eval(0 + item.column)] + ',',',').replace(/~/g,''); < alert('In ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while (' + diffcolnames + ') were (' + diffvalues + ').'); < } < } < } < } else if (item.row != null) { < var str = data.getFormattedValue(item.row, 0); < message += '{row:' + item.row + ', column:none}; value (col 0) = ' + str; < } else if (item.column != null) { < var str = data.getFormattedValue(0, item.column); < message += '{row:none, column:' + item.column + '}; value (row 0) = ' + str; < } < } < if (message == '') { < message = 'nothing'; < } < if (1 == 2) console.log('You selected ' + message); < } < } < ); < "; < } < echo " chart.draw(data, options); } \n"; --- > echo " chart.draw(data, options); \n } \n"; 107c45 < echo " \n"; --- > echo " \n"; 112c50 < echo '
' . " \n"; --- > echo '' . " \n"; 123c61 < echo ' var title = prompt("Enter Line Chart Title (suffix by &onclick=y for added onclick functionality)", "' . $GETtitle . '"); ' . "\n"; --- > echo ' var title = prompt("Enter Line Chart Title", "' . $GETtitle . '"); ' . "\n"; 163,164d100 < } else { < echo '<' . 'script' . '>' . "\n " . " function later() { } " . "script>\n";