Hi ,

I have a requirement to grey out the legends and hide the lines once user 
clicks on the legend. However, the lines are getting hidden but the legend 
is not getting greyed out. The same piece of code works with  all other 
visualization charts. The code is as below. 

google.visualization.events.addListener(chart, 'select', function () {
    
      var sel = chart.getSelection();
          // if selection length is 0, we deselected an element
          if (sel.length > 0) {
              // if row is undefined, we clicked on the legend
              if (sel[0].row === null) {
                  var col = sel[0].column;
                  if (columns[col] == col) {
                      // hide the data series
                      columns[col] = {
                          label: data.getColumnLabel(col),
                          type: data.getColumnType(col),
                          calc: function () {
                              return null;
                          }
                         
                      };
                      // grey out the legend entry
                      series[col - 1].color = '#CCCCCC';
                  }
                  else {
                      // show the data series
                      columns[col] = col;
                      series[col - 1].color = null;
                  }
                 /* var view = new google.visualization.DataView(data);
                  view.setColumns(columns);
                  chart.draw(view, options);*/
                  var view = new google.visualization.DataView(data);
                  view.setColumns(columns);
                  chart.draw(view, options);

              }
          }
      });

anybody has an idea, why isnt working? 

-- 
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/d/optout.

Reply via email to