You could easily do this with a non persistent entity to change your selection criteria and based on the inputs selected it could be passed as a parameter to the Chart datasource microflow where you retrieve data based on the search criteria and it should work.
Hope this helps!
EDIT – If there are many search criteria which you would like to retrieve from the database then a more efficient way would be to use OQL. Its just like writing queries and you can create your WHERE in the way we normally write queries. Do note that it might need a little time if you’re doing it for the first time. Reference documentation is available here: https://docs.mendix.com/refguide/oql
Unfortunately, I don’t have a sample/test project which can be shared. But you should be able to manage it, just take it in small steps :)
There are many selection options in selection criteria.
It requires a lot of “if then else” in MF.
I’m looking for a efficient way.
If possible, would you invite me to a sample project related on it?