signac-dashboard
signac-dashboard copied to clipboard
Interactive plots with Plotly
Feature description
I was in the need of showing a couple of quite complex plots and thought that something like Plotly, which I have used in the past, could work.
Proposed solution
I have managed to include a Plot Viewer module to the dashboard. First, the minified Plotly code is added as a module asset. Then, when building the view, a card is added with the data and layout arguments for the plot as HTML attributes (serialized as JSON and escaped). Finally, a script deserializes this data and populates the plot.
Additional context
When I implemented this I had not seen #38. I might have gone that route if I had, but now that it's implemented I thought you might want to at least give it a look.
I initially introduced the Plotly code as a global asset, but given that it's quite large (about 3.5 MB) I moved it to a module asset to avoid loading it if it isn't needed. Even so, this is still a heavy addition to the repo as a whole, so I totally understand if you don't want to go this route. On the flip side, this avoids adding a new package as a dependency.
Plotly can be licensed under an MIT license (the notice is included at the beginning of the file), which I believe is compatible with signac's BSD license.