Ah, well, similar to how you could use a column of the spreadsheet for tooltips, you could use a column for the role called 'style'.
On Tue, Feb 18, 2014 at 3:09 PM, Leo Solano <[email protected]> wrote: > hmmm, thanks, but really don't know how to add colours if I am using data > from a spreadsheet - sorry, new using charts :( > > > On 18 February 2014 11:57, Daniel LaLiberte <[email protected]> wrote: > >> I'm seeing an error in your page currently (forEach not defined). >> >> The documentation on the ColumnChart talks about how to get different >> colors for each bar: >> https://developers.google.com/chart/interactive/docs/gallery/columnchart#Colors >> >> >> On Tue, Feb 18, 2014 at 11:20 AM, Leo Solano <[email protected]> wrote: >> >>> Hi Daniel, I think that I made it work with your help! >>> leosolano.com/graph/index.html >>> >>> Do you know how I could change the colour of the bars to be different? >>> leo >>> >>> >>> >>> >>> On 18 February 2014 10:22, Daniel LaLiberte <[email protected]>wrote: >>> >>>> 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 a topic in the >>>> Google Groups "Google Visualization API" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/google-visualization-api/MoxlEkXbbaw/unsubscribe >>>> . >>>> To unsubscribe from this group and all its topics, 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. >>>> >>> >>> >>> >>> -- >>> *Leo Solano* >>> 647-609-2727 >>> [email protected] >>> www.leosolano.com >>> >>> -- >>> 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 a topic in the >> Google Groups "Google Visualization API" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/google-visualization-api/MoxlEkXbbaw/unsubscribe >> . >> To unsubscribe from this group and all its topics, 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. >> > > > > -- > *Leo Solano* > 647-609-2727 > [email protected] > www.leosolano.com > > -- > 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.
