Filter Bar filter options

Recently I have created a Kibana Custom plugin. It is a funnel plugin. I am trying to add more functionality to the funnel plugin where if I click on any tear of the funnel I would like to add a filter of that tear to the filter bar(Global filter to the dashboard). I would like assistance in how I could code a click event to create a filter bar filter. If you can point me to sample code or code or example how to create a filter bar filter that would be helpful.

When I am referring to filter bar filter I mean the circled thing from the below image.

Thank you

I would check out @timroes excellent blog post on Visualization plugins:

There's a section in there on adding filters: