-
Notifications
You must be signed in to change notification settings - Fork 795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "jupyter" renderer based on JupyterChart #3283
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This will make it really convenient to use both jupyter charts and to work with large datasets (after #3281). I think especially for working with large data, being able to switch all charts back and fourth between different options is helpful for exploring what works best in a particular scenario. I will try to test this out a bit, maybe over the weekend. For now, just one comment on the function name
Hmm what are the possible things that could be going wrong when I'm getting the text representation instead of the actual chart? I tried installing your branch in a new environment. I was prompted to install anywidget first time I tried creating a jupyterchart, did that and restart jupyterlab after clearing the notebook just in case, but I'm still only seeing the text representation. Is there another optional dependency for jupyter charts that we are do not warn about (maybe vl-convert?)? Or is something going on with my jlab maybe (I'm on 4.0.5). |
What is the result if you test a basic Jupyter Widget? import ipywidgets
ipywidgets.IntSlider() |
In addition to @mattijn's question, do you see the same thing when displaying a |
Thanks both, I did see the text representation for regular jupyter widgets as well and also when using JupyterChart directly. There was an error in the console saying Regarding this PR, my understanding is that the renderer only changes the chart at display time, so using this renderer will not give access to all the JupyterChart functionality for each chart, which is also what I saw when testing: This makes sense, since that it how all the other renderers work, but I wonder if it will be confusing in this case since it means that although someone enables the jupyter renderer, they will not be able to take advantage of anything from the I can see this leading to tickets opened along the lines of "I can't use any JupyterChart functionality even after enabling the jupyter renderer". I wonder if going in one of these two directions would make sense:
It's possible that the best is just to keep what you have hear and expand the documentation to be really clear on what the renderer can and can't do, but I'm curious to hear your thoughts on the two options above as well. |
Thanks for trying this out @joelostblom. Yes, you're right that using the "jupyter" renderer means you don't get access to the JupyerChart object. I think this is reasonable and consistent with the other renderers, but I'll update the docs to make this more explicit. Regarding whether the "jupyter" renderer will have uses beyond the VegaFusion integration. One additional feature I'm going to add after these two PRs merge is offline support for JupyterChart. In this case, the "jupyter" renderer could be the preferred offline rendering approach as, unlike with the mime renderer, we would still control the version of vega-lite being used. One idea would be to enabled it with |
Offline support sounds like a great additional feature for Jupyter renderer! Then I also agree it makes sense to keep it as a renderer only and clearly highlighting the differences to using JupyterChart directly in the docs like you said 👍 |
@joelostblom, I updated the language in the docs. See if this looks good! @mattijn @binste Do you have any objections to adding this renderer, or to the name/API? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jonmmease! I think that section of the docs looks good for what this PR provides. When the other PRs land, we can expand the docs to indicate the functionality this render brings, e.g. the integration with the vegafusion transformer and later offline access.
I tested with a few different charts from the gallery and they seem to render fine, not sure if there is a more systematic way to go about it, otherwise that seems sufficient for me.
One last question, would it make sense to add a test similar to the ones for the other renderer functions to check if the metadata is passed correctly or would that not apply here?
Good call on the testing. It reminded me that we don't support embed options in JupyterChart yet. I opened #3288 to track this, and will add a test case like the above when I implement that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, if that is added in a follow up PR when the functionality is available in JupyterChart, then this PR looks good to me in terms of just adding the renderer engine, but maybe let's leave open a few days to see is someone else wants to chime in before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jonmmease ! Looks good to me :) Agree that this will be a very nice addition together with the VegaFusion integration and potential offline support!
Co-authored-by: Stefan Binder <[email protected]>
Thanks @binste! I'm going to merge this on Monday if there isn't more feedback. |
This PR adds a new "jupyter" renderer that performs rendering using JupyterChart. Enable with:
In combination with #3281, this will make it possible to enable VegaFusion's serverside data transformation on interactive charts without needing to manually wrap charts with JupyterChart.
cc @joelostblom