Hmmm...you could use a DataView to double-up on your data columns, making a duplicate of each one. The duplicates would have null values, but be included in the legend, while the ones containing data would be excluded from the legend. Use a select event handler to grab clicks on the chart elements (check for null rows to detect legend clicks vis-a-vis other elements), and then hide or add the associated columns and redraw. I think I wrote up an example of this some time back...let me dig through the archives for a minute here...ah yes, here you go: http://jsfiddle.net/MuC37/
There is a lot of stuff to keep track of to make it work right, so read the code carefully. On Tuesday, June 19, 2012 5:56:16 PM UTC-4, Benjamin Press wrote: > > So, I'm working on a few things, and one thing I want to do is to have the > legend's elements sort of act like check boxes. I want to be able to turn > off elements/data by clicking their entry in the legend. However, from what > I've been reading, that would remove the legend element as well as the > element on the chart, thus making it impossible to bring the data back. > Does anyone know of a workaround for this? -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/HAMbDVxiPzgJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
