Filtering Tables Using Charts

One of my favorite little Retool hacks is filtering tables using different plotly charts.

Shared with Zight

To do this, you just need to make use of Retool's Query JSON with SQL feature:

select * from {{query1.data}}
where ({{_.isEmpty(chart1.selectedPoints)}} or region = ANY({{chart1.selectedPoints.map(d=>d.label)}}))

Set your table's data input field equal to the query above, and when a user selects a point in the chart it will filter the table according to the selected point in the chart :slight_smile:

6 Likes

Hi @JoeyKarczewski - this is great. Do you know how to do this similarly with bar charts while selecting via the legend? I don't see any changes to the component inspector while changing legend selections.


Nice!