Hi Leo,
I believe you can do what you want if you transform the data coming from
the spreadsheet by using a DataView. See the setColumns() method
documentation:
https://developers.google.com/chart/interactive/docs/reference#DataView_setColumnsand
note that you can add a calculated column that species a role. So
the
end of your script would look more like this:
var data = response.getDataTable();
var view = new google.visualization.DataView(data);
// Insert a tooltip column after column 1, using the values in column 1
view.setColumns([0, 1, {sourceColumn: 2, role: 'tooltip'}, 3, 4]);
var chart = new
google.visualization.ColumnChart(document.getElementById('columnchart'));
chart.draw(view, { legend: { position: 'none' } });
I hope that will be enough of a clue, but let me know if it doesn't work
out.
On Sat, Feb 15, 2014 at 9:34 AM, Leo Solano <[email protected]> wrote:
> How can I add a customized tooltip from a column in my spreadsheet - or
> html tooltips?
> This is what I have so far on my test page:
>
>
> <html>
> <head>
> <script type="text/javascript" src="https://www.google.com/jsapi
> "></script>
> <script type="text/javascript">
> google.load("visualization", '1', {packages:['corechart']});
> google.setOnLoadCallback(drawChart);
> function drawChart() {
> var query = new google.visualization.Query(
> '
> https://docs.google.com/spreadsheet/ccc?key=0AtzRlJ-t2eDKdE1ZcVo0eFZ1N1NpUTBPSElJUDRaT1E&usp=drive_web#gid=0'
> );
>
> query.send(handleQueryResponse);
> }
>
> function handleQueryResponse(response) {
> if (response.isError()) {
> alert('Error in query: ' + response.getMessage() + ' ' +
> response.getDetailedMessage());
> return;
> }
>
> var data = response.getDataTable();
> var chart = new
> google.visualization.ColumnChart(document.getElementById('columnchart'));
> chart.draw(data, { legend: { position: 'none' } });
> }
> </script>
>
> <title>Data from a Spreadsheet</title>
> </head>
>
> <body>
> <span id='columnchart'></span>
> </body>
> </html>
>
> --
> 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.
>
--
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> -
978-394-1058
[email protected] <[email protected]> 5CC, Cambridge MA
[email protected] <[email protected]> 9 Juniper Ridge
Road, Acton MA
--
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.