mongodb-js / charts-embed-sdk

The easiest way to embed MongoDB Charts visualisations into your web app
https://docs.mongodb.com/charts/master/embedding-charts-sdk/
Apache License 2.0
43 stars 31 forks source link

Define a timezone to use when displaying a chart. #73

Closed imaireaux closed 1 year ago

imaireaux commented 1 year ago

Problem I need to display graphs per hour and data are filtered by user project. Each project has its own timezone. I can set a timezone to use on a mongodb chart, but can't define it with this sdk for a graph when I am displaying it.

Solution Be able to choose the timezone to use when displaying a chart.

Current alternative Create a chart for each timezone and call the right one using its chart id for each project depending on the project timezone, but I will have to create so many identical charts to display the same data.

I also tried to add custom aggregation directly on the chart to create a computed field returning my field on the project timezone, but it seems that this stage is performed before any match (on the project_id) and so on the whole collection so I have a timeout on the project lookup. I don't even know if it could work if this first step is ok and use the lookup result to create my computed field.

khanguslee commented 1 year ago

Hi @imaireaux! Thank you for writing up a detailed suggestion! It would be great if you could add your idea to the MongoDB Feedback Engine if it does not exist.

imaireaux commented 1 year ago

Ok it's done. Thanks for your answer.