Greying out legends not working for new google.charts.Line charts

72 views
Skip to first unread message

Pavankumar C

unread,
Jul 6, 2015, 11:09:09 AM7/6/15
to google-visua...@googlegroups.com
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? 

Sergey Grabkovsky

unread,
Jul 7, 2015, 10:30:45 AM7/7/15
to google-visua...@googlegroups.com
Hi,

The Material charts don't yet support the option to change a particular series color.

--
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 google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

pavankumar c

unread,
Jul 7, 2015, 3:28:51 PM7/7/15
to google-visua...@googlegroups.com
ok thanks. Any idea when can it be released? any other alternatives?

--
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/cuXjdBG6Ne0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.



--
Regards,
Pavan Kumar
Reply all
Reply to author
Forward
0 new messages