Dynamic charts without hard coding the filters

I want to create a chart that shows the top 3 appliances which consumes more electricity. I have to achieve this dynamically without hard coding the appliance names, as top 3 may differ based on my time range selection.

It depends on you datasource and it it’s query language supports this type of series sorting and filtering

Thanks for your reply.
My data source is ElasticSearch and I achieved this with group by terms limiting the size and order by Bottom.

Now I am getting the chart with 3 appliances but is there a way to get separate chart for each appliance (total 3 charts) by making use of Template Variables???

No there is no way to do that currently