finos / perspective

A data visualization and analytics component, especially well-suited for large and/or streaming datasets.
https://perspective.finos.org/
Apache License 2.0
7.95k stars 1.06k forks source link

`PerspectiveWidget` HTML export support in Jupyter #2418

Closed tomjakubowski closed 8 months ago

tomjakubowski commented 8 months ago

As it is currently, rendering the HTML output is unconditional and this will add some bloat to all .ipynb using PerspectiveWidget. Every render of a PerspectiveJupyterWidget adds the HTML output to its cell's output in the .ipynb . This includes a base64-serialized arrow of every viewer's data, without deduplication, and a few lines of Javascript and HTML to glue it together.

We can make this configurable and/or optional in Perspective, for users who don't care to support exporting. Would a global setting or per-widget setting make sense?

timkpaine commented 8 months ago

per-widget, what about if I stream data in and call update() a bunch of times, will it reflect the latest?

tomjakubowski commented 8 months ago

I don't have very much experience doing streaming perspectives but I'll check. I think it reflects whatever was in the table at the time the cell first rendered, which is probably undesirable.

tomjakubowski commented 8 months ago

Added a class variable on PerspectiveWidget to gate this new feature behind an undocumented flag while we're tooling on it. Also fixed a bug in the HTML's reference to the datagrid js module

It can be set on the class to make all widgets render HTML output, or on an instance to make only that widget do it

texodus commented 8 months ago

full build