I came up with a solution for this a while back: 
http://jsfiddle.net/asgallant/6gz2Q/

On Friday, March 22, 2013 11:40:36 AM UTC-4, Andreas wrote:
>
> I would like to be able to hide/show each line in a diagram by clicking on 
> the name for that line in the legend. I am familiar with the solution 
> provided here:
> http://jsfiddle.net/asgallant/WaUu2/ 
> but is there any way to do what I am trying to achieve (ie. using the 
> legend options to turn on/off the different lines in the diagram)?
>
> google.load('visualization', '1', {packages:['corechart']});
> google.setOnLoadCallback(drawTable);
> function drawTable() {
>     var data = new google.visualization.DataTable();
>
>     data.addColumn('string', 'Organisation');        
>     data.addColumn('number', 'Finland');                    
>     data.addColumn('number', 'Germany');                    
>     data.addColumn('number', 'Sweden');    
>                    
>     data.addRows([
>     
> ['2010',655.68,650.48,4290.84],['2011',680.57,606.07,3743.17],['2012',931.97,402,402.99]]);
>
>     var options = {
>     chartArea:{left:80,top:50}
>     };
>
>     var table = new 
> google.visualization.LineChart(document.getElementById('column'));
>     table.draw(data, options);
> }
>
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to