Using query to panel plugin

Hey there,

I have a task to make a panel plugin where I can make queries. I use InfluxDB.
I made my own panel plugin where I can listing items with checkboxes.
Let’s say I have 4 columns with some raws:

| field_a | field_b | field_c | checkbox |

I would like to achive that if I clicked the given checkbox to state true, I would like to generate a query just with those properties what have true checkbox state. Everytime when a I make a click to a checkbox the panel should generate a new query as well. Is it possible to embed a query part in a panel plugin if yes how? I tried to understand the datasource docuements. However it is not clear how could be an analogy for a select * from statement like I type in the explore field. Any help appreciate!
Thanks in advance!