mckinsey / vizro

Vizro is a toolkit for creating modular data visualization applications.
https://vizro.readthedocs.io/en/stable/
Apache License 2.0
2.49k stars 112 forks source link

Is There a Way to Get the JavaScript Code for a Given Vizro app.py? #575

Open Layman-Bebop opened 3 weeks ago

Layman-Bebop commented 3 weeks ago

Question

Is There a Way to Get the JavaScript Code for a Given Vizro app.py? I would like to integrate a Vizro-Dash dashboard page into a React-based multi-page dashboard. Wondering if it's possible to implement this?

Code/Examples

No response

Other information

No response

Which package?

vizro

Package version

No response

Python version

3.12

OS

Windows

Code of Conduct

antonymilne commented 3 weeks ago

Hello @Layman-Bebop and thank you for your question! Vizro is built on top of Dash, and the answer here is the same as it would be for Dash: depending on exactly what you want to achieve this may or may not be possible. The answer is pretty well covered in the Dash documentation.

It's unfortunately not possible to directly convert a Dash dashboard into pure JS code. The options are:

  1. Embed as a React component - this is the best solution and probably what you want to do but requires Dash enterprise, which costs 💰
  2. Embed as an iframe - feels a bit hacky but in practice can actually work very well. I've seen people do this before successfully and you wouldn't even guess it was an iframe just from using the website. This is quite a new feature, not documented or fully worked out yet but It's also possible to pass information into Vizro using query parameters sent through the iframe src, a bit like this