Select trigger charts

I want to trigger the chart when the select is made in the Select component. The database I use is mongodb.

Hi @kackisiyiz

Thanks for reaching out!

Chart components don't have their own trigger property, but we can control when the query that populates the chart triggers.

For your use case, you will most likely want to have a Mongo query that is set to be manually triggered. Then, in your select component configuration, you can create an event handler that triggers the Mongo query. As long as the chart is then populated by the Mongo query, it will populate the chart with data.

Since the chart will initially load without data, I would recommend making the chart's data input conditional so that it doesn't throw an error on page load.

{{chartQuery.data ? chartQuery.data : [ ] }}