Enable user copy rendering code from `mo.ui.data_explorer`
Description
mo.ui.data_explorer provides awesome visualization about dataframe. I hope that i can copy the rendering code to another cell, so I can tweak, modify, or understand how it is implemented.
I guess the encoding and marks option on the left is a hint, but it is hard to understand for an altair-newbee like me.
Suggested solution
I suggest that a tab appears above the visualization, just like what mo.ui.dataframe does.
More specifically, when user click code tab, the render code for main plot will be shown.
Alternative
No response
Additional context
No response
This is doable and seems like a nice addition (thanks for the suggestion!)
We store the sidebar state (x, y, row, etc) in the value of the UI element. It should be fairly easy (frontend or backend) to auto-generated the altair snippet from those values.
We may not get to this at the moment, but open to contribution
Picking this up next!
@wasimsandhu - some design thoughts, feel free to take it or leave it: rather than a tab like we do with data-explorer, I think we can just add a Copy/Clipboard button with a tooltip "Copy as Altiar chart".
we would need to write some fairly simple string formatting to go from encodings -> altair chart. this could live in the frontend, but we should have really good unit tests for this