Closed tomcanac closed 2 years ago
Hi @tomcanac, great suggestion. We'll try to get to this soon.
Actually we already do have an example of the Charts Embedding SDK in a React app - see the Timeline example. This does show a bunch of other stuff on top of the minimalist React integration, so I still think a simpler sample is a good idea, but this should help you in the meantime.
Great thanks for pointing this out! It will definitely do the job for my need, feel free to close this issue if you want or keep it open for a simpler integration example.
Thanks!
For anyone coming to this thread this is an updated blog of an example using React (2022-03).
Also, if you are using Authenticated Embedding remember to use the getUserToken
in the EmbedChartOptions
to define a function that returns a valid authorization token or you will receive a Error 3: Embedding not enabled on this chart
.
Thanks for sharing @cpotdevin! Any feedback in terms of documentation is always helpful to the team!
I recently updated the main README.md
file so that users can easily find a React usage example which links to the existing timeline example. This change can be found in https://github.com/mongodb-js/charts-embed-sdk/pull/61.
Thank you all for participating in this discussion. I'm closing the issue as there are a few React examples mentioned above.
Integrating the SDK in a react app is undocumented and a bit obscure right now.
It would be nice to have an example of integration of a chart with the SDK in a react component.
I tried myself but didn't manage to get something really functionnal and I don't have much time in my project to do a lot of R&D. An official documentation example would be amazing.