Skip to content
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

Switch to use anywidget #4663

Closed
wants to merge 43 commits into from
Closed

Conversation

marthacryan
Copy link
Collaborator

@marthacryan marthacryan commented Jul 14, 2024

Co-authored by @manzt! This updates the logic for the FigureWidget to rely on anywidget.
A quote about anywidget from the documentation for context:

anywidget is both a specification and toolset for authoring reusable web-based widgets for interactive computing environments. As a specification, it defines a standard for widget front-end code. As a toolkit, it provides tools for authoring widget front-end code according to the specification, as well as a Python library that simplifies creating and publishing custom Jupyter Widgets.

This will not affect the go.Figure class. High level explanation of the difference between using go.Figure and go.FigureWidget:

  • go.Figure: The chart generated by this object will be interactive on the client side. For many purposes, this is all a user needs to do with a chart. The interactions are things like zooming in, or any of the various operations in the toolbar.
  • go.FigureWidget: The difference here is that the figure is interactive on the server side as well.
    • Interactions with the plotly chart can be sent to the python kernel and used in other widgets.
    • Interactions with other widgets can be used to control the chart

@marthacryan marthacryan marked this pull request as draft July 14, 2024 17:57
@gvwilson gvwilson requested a review from emilykl July 17, 2024 18:28
@gvwilson gvwilson added feature something new P2 considered for next cycle community community contribution labels Aug 13, 2024
.circleci/config.yml Outdated Show resolved Hide resolved
{
"scripts": {
"build": "esbuild --bundle --alias:plotly.js=plotly.js/dist/plotly --format=esm --minify --outfile=../plotly/bundle.js widget.ts",
"watch": "npm run build -- --watch --sourcemap=inline",
Copy link

@manzt manzt Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sourcemaps will make it easier to debug when developing the widget using the browser developer tools.

@@ -0,0 +1,17 @@
{
"scripts": {
"build": "esbuild --bundle --alias:plotly.js=plotly.js/dist/plotly --format=esm --minify --outfile=../plotly/bundle.js widget.ts",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the --minify and --alias flags. minify makes the final bundle smaller.

The alias here is to make the import nicer for typescript type checking types (tsc), while esbuild needs to point to the actual files (./dist).

@marthacryan marthacryan mentioned this pull request Oct 18, 2024
@marthacryan marthacryan mentioned this pull request Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community community contribution feature something new P2 considered for next cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants