How to implement "variables filter function" to control a "influxdb datasource panel" in my custom plugin panel?

I wonder that how to do something like the Variables filter function to control a panel’s data in my custom plugin panel. anyone could give some advices?

example: when i click a button in my custom plugin, it can change other panels’ data like how “Variables” do.

thanks a lot !