Closed cdmvfx closed 2 months ago
@cdmvfx Thanks for suggesting this. We are actually working on a solution to fix this issue as we have got feedback on giving developers flexibility on changing the stage when the embedded chart and dashboard filters execute.
We are looking at supporting something along the lines of
For Dashboard - dashboard.setFilter({ bathrooms:{ $gt: 4 }}, execute_earlier)
For a chart inside a dashboard - dashboard.chart.setFilter({ bathrooms:{ $gt: 4 }}, execute_earlier)
where execute_earlier is optional and is boolean (true or false)
and the embedded filter will be executed at stage number 2. (See pic). Let us know if this solution is ideally suited for your needs.
@kirangp That looks perfect! It would absolutely fix our use case.
Other than that small thing, Charts + the embed SDK is a godsend for our business. 🙂
Thanks for the update!
Great to know that the solution works for you. Love your feedback on how Charts is impacting your business.
We are looking at releasing the feature in March/April.
@kirangp Any update on the release of this feature?
Hi @shriya-shah-ext-volansys the pre-filter feature is completed, and is planned to come in the next SDK release 3.3.0 that will be done after Atlas Charts 1.45 release. We can't give exact timing but it might be at the beginning/mid June.
Hi @cdmvfx, the preliminary embedding filter has been released last week. Please have a look at package version 3.3.1
.
The problem: At the moment, the "filter" option on the dashboard constructor will apply the inputted filters to each individual chart on the dashboard. This is problematic in our use case, as we have some charts that contain aggregations which completely modify the resulting document data schema.
When passing in filters, they are applied AFTER the aggregations which results in a blank chart, due to missing fields for the filter.
The solution: On the MongoDB Charts dashboard editor (via charts.mongodb.com), there is a button for "Dashboard Filters". These dashboard filters work completely differently. Here they are applied to the data BEFORE it is given to each chart in the dashboard. The result is that all of our charts function as expected, due to not being applied on a per-chart level. To my knowledge, this is not a part of the Embedding SDK.
It would be awesome if this same functionality could be applied to the Embedding SDK, where we could have a "global filter" that is applied to the data before it hits the charts, the same way it does on the charts.mongodb.com dashboard editor. That way aggregations would function as expected, and per-chart filters wouldn't be needed.
At the present moment, this issue is forcing us to simply duplicate the dashboard for each use case and not use the Embedding SDK.