Filtering a chart via dropdown/combobox

Hello everyone, 

I have a couple of charts in my page that i would like to allow the user to filter using a dropdown or a combobox but I'm not sure how to go about it.

lets say  I have a bar chart that shows total sales for a the past months and I have a drop down list that has product categories so once the category is chosen the chart should reflect the sales of oonly that category of products.

If anyone could help or point me to the right direction that'd be highly appreciated 

Hi Joharah, 

Your charts are fed somehow by a query, right? It might have a few different solutions, but here it goes one suggestion: 

Your query(ies) (which feds your graphs) should consider product category as a parameter (if not informed, bring all the data, else, bring filtered data). In the "On Change" action, "Ajax Refresh" your graphs should be enough. 


Regards,

Otavio.

Otavio Souza wrote:

Hi Joharah, 

Your charts are fed somehow by a query, right? It might have a few different solutions, but here it goes one suggestion: 

Your query(ies) (which feds your graphs) should consider product category as a parameter (if not informed, bring all the data, else, bring filtered data). In the "On Change" action, "Ajax Refresh" your graphs should be enough. 


Regards,

Otavio.

So The second part is what I have done but it did not work for me. I have aggregates in my preparations and thats whats feeding my charts, I've tried to filter that tables with the value from the combo box but it did not seem to work  


In the DropDown's OnChange Event you can filter the Query result and after that you have to guarantee that the chart is refreshed.

This is a very simple demo of what it looks like:


Joharah Khalid wrote:

Otavio Souza wrote:

Hi Joharah, 

Your charts are fed somehow by a query, right? It might have a few different solutions, but here it goes one suggestion: 

Your query(ies) (which feds your graphs) should consider product category as a parameter (if not informed, bring all the data, else, bring filtered data). In the "On Change" action, "Ajax Refresh" your graphs should be enough. 


Regards,

Otavio.

So The second part is what I have done but it did not work for me. I have aggregates in my preparations and thats whats feeding my charts, I've tried to filter that tables with the value from the combo box but it did not seem to work  


So your Combo has a variable that filters the Aggregates result, once that filter variable is altered, in the OnChange property of the Combo Box Refresh the query using this: