Reputation: 808
I want to use a slice other than the Filter Box to apply a filter to my dashboard.
For my dataset, which is structured like a tree, I have adapted the indented tree from the d3 visualizations gallery into a slice that looks something like this:
My tree slice has branches and levels which represent different paths, and end nodes which contain my values.
Now, I would like to use this slice to filter my dashboard. Particularly, when the user clicks one of my end nodes, I would like to remove any previous values and to apply the value of that node instead.
I have tried representing the path and value of the node as a string and using it like that in the regular Filter Box. However, there are often cases where I end up with really long strings that make for a poor user experience.
I have looked at the Filter Box implementation to see if I could find the method used to change the filter settings. However, this seems to be quite an involved process and re-implementing the Filter Box in my slice seems to me like the wrong approach.
Is there a generic way to change the dashboard filter and apply it?
Upvotes: 1
Views: 2946
Reputation: 1149
The "Table" visualization is currently the only other visualization outside than "Filter Box" that's been set up to (optionally) emit dashboard filter events. Here's how it's implemented:
The interface for the visualization is a function that receives the slice
and payload
params. The slice
object exposes a addFiler
and removeFilter
as shown in the example above.
So it's a matter or setting up your visualization to emit the proper filtering events by using the slice object.
Upvotes: 2