📣 Plotly.js 2.0 is coming soon!

Update Jun 8, 2021: Plotly.js 2.0 is now released!

After 5 years and 177 releases of Plotly.js between 1.0.0 and the current 1.58.4, it’s finally time for us to release Plotly.js 2.0! :tada:

Our commitment to semantic versioning requires us to make this next release a major version bump because we are making some backwards-incompatible changes to older and deprecated features (see below), but we see this as a low-risk maintenance release and we expect that the vast majority of users should plan to upgrade without fearing significant issues, including Javascript developers who embed Plotly.js directly in their apps or websites, as well as data scientists using Plotly.js via Plotly.py in a notebook environment, and of course Dash app developers!

We encourage all interested developers to read the changelog carefully, but here is a summary of the important changes and some commentary.

:warning: What is getting changed or removed?

We take stability and backwards-compatibility very seriously, so although in principle a new major version could introduce numerous breaking changes, we are bumping the major version number in Plotly.js only because we are removing the following functionality, which we feel is very seldom-used, has long been deprecated and/or has long been un/undocumented. We are making these changes today so as to be able to continue maintaining the library without needing to invest in upkeep of legacy/unused functionality.

We are dropping:

  • Support for Internet Explorer 9 and 10: our support for these browsers has been poor and degrading for months, and we’re officially ruling out supporting them at all starting now. For reference, Microsoft stopped supporting IE 10 more than 5 years ago.
  • The contourgl trace type: this trace type is not currently in the main bundle, and this removal will only impact users of the gl2d custom bundle. This trace has many problems and is easily replaced by using the non-WebGL-powered contour trace.
  • The area trace type: this trace type has been marked as deprecated and un/under-documented for years; the barpolar trace types should be used instead.
  • The legacy polar r and t attributes of the otherwise-cartesian scatter and bar traces: these attributes have been marked as deprecated and un/under-documented for years; the scatterpolar and barpolar trace types should be used instead.
  • The Plotly.plot() function: this function has been deprecated/under-documented for years, in favour of Plotly.react() or a combination of Plotly.newPlot()/Plotly.restyle()/Plotly.relayout()
  • The Plotly.d3 object: this object currently mirrors all of version 3 of the D3 library. Version 4 of D3 came out over 4 years ago (the current latest version is 6.5!) and the state of Javascript packaging has evolved such that it’s now much easier for Javascript developers to “bring their own” version of d3 to their app rather than rely on the one provided by Plotly.js.
  • We are marking the heatmapgl and pointcloud trace types as “deprecated”, and recommending that folks use the heatmap/image or scattergl trace types instead. These will be removed in a future major version, such as Plotly.js 3.0. If you are using these, please reach out and tell us why and how, so we can take your needs into consideration as we move forward!

:hammer_and_wrench: What is getting upgraded or added?

Since this is mostly a maintenance/cleanup release for us, intended to allow us to move faster in the future, this particular version intentionally does not include many new features.

The one major improvement to the library we have made is that a number of our partial bundles now no longer use function constructors, and therefore do not trigger the corresponding Content Security Policy error. The bundles that are now function-constructor safe are: basic , cartesian , finance , geo , and mapbox. We are committing to making this a permanent change. We have also added a new partial bundle called strict, which contains the maximal subset of the library that works without using function constructors, and as we are able to refactor the rest of the functionality of Plotly.js to avoid using function constructors we will expand this partial bundle. This security-related work was generously sponsored by Equinor, and we sincerely thank them for their vision and support. :heart:

Note: we also still need more sponsorship in order to finish this work and extend this CSP-safety to all of our 3d trace types!

:snake: What about Plotly.py?

Since the plotly.graph_objects module in Plotly.py is automatically generated from Plotly.js, the removals of trace types and attributes listed above force us to change the major version number in Plotly.py as well, to 5.0. Update: Plotly.py 5.0 is now out!

:dancer: What about Dash?

Dash depends on Plotly.js via the dcc.Graph component from dash_core_components, although we don’t consider the portions of the Plotly.js schema that were deprecated before Dash was released to be part of the public Dash API. An upcoming minor version of dash_core_components will be upgraded to use Plotly.js 2.0, meaning Dash users will get the new version of Plotly.js via a routine upgrade of the dash package, which depends on dash_core_components.

You can control the exact version of Plotly.js which dcc.Graph loads by placing a specific Plotly.js/ version bundle into your Dash app assets directory. The same approach allows you to choose a specific partial bundle to use, for example if your app uses only a subset of Plotly.js features, or if your organization policies require to use the new strict bundle to avoid Content Security Policy warnings. We are also working on a new mechanism for developers to easily build their own custom partial bundles, for cases where the officially-supported partial bundles are either too big or too small.

:spider_web: What about the CDN?

We host Plotly.js bundles on a Content Delivery Network for folks to use, and we will continue to do so with v2, but in order to not break anything for folks using the “latest” bundle URL at https://cdn.plot.ly/plotly-latest.min.js, we will stop updating that bundle (it will stay pinned to 1.58.4) and the new “latest” CDN URL will be https://cdn.plot.ly/plotly-latest-v2.js (once 2.0.0 comes out) (we have decided to stop maintaining a “latest” bundle). The same pattern will hold true for all the official partial bundles.

:rocket: Try the Release Candidate and give us feedback!

We’ve released Plotly.js 2.0.0-rc.2 to NPM and to the CDN under https://cdn.plot.ly/plotly-2.0.0-rc.2.min.js for folks to try out and give us feedback. You can try these bundles right now in your Dash app using the assets directory approach outlined above.

Please let us know if there’s anything in these bundles that would prevent you from upgrading or otherwise break your app and we’ll try to either undo the change if it’s not listed above or provide an easy glide path!

10 Likes

What about react-plotly?

Good question! react-plotly.js should be unaffected by this change: you should be able to upgrade your version of Plotly.js to 2.0 and continue using react-plotly.js just like previous minor version bumps :slight_smile: If you want to try the RC in your app you can confirm this and let us know if you run into any problems!

Thanks Nicolas

I sure will try version 2 with react-plotly and get back to you in case I run into any problems.

An update on this: we’ve just published the second release candidate (RC.1) and are looking forward to a release in a couple of weeks :slight_smile:

RC1 seems to work with react-plotly, at least on simple examples.

However more complex setups break after the upgrade from 1.58.4 to 2.0.0.rc1

I get a lot of

Unrecognized subplot: xy

and some

Uncaught TypeError: Cannot read property 'length' of undefined
    at calcLinks (plotly.js:175235)
    at recomputeAxisLists (plotly.js:174148)
    at Object.dragOptions.prepFn (plotly.js:174187)
    at SVGRectElement.onStart [as _ontouchstart] (plotly.js:135993)

for the exact same data and layout setup as when testing with 1.58.4

Mouse actions are not working at all (selection, scroll to zoom, drag to zoom)

Hunting down the reason for that will take some time

@secretwpn thanks for letting us know! A reproducible example would go a long way to figuring out what’s broken here.

Another update: we’ve just published the third and final release candidate (RC.2) and are looking forward to a release next week for real this time!

Small update as we quickly approach release day: we have decided to stop maintaining a “latest” bundle on the CDN, and instead folks will need to pick a version of the library they want to depend on.

Final update on this thread: we’ve now released Plotly.js 2.0! :tada:

Is this available? I am trying to mollify the InfoSec gods now and CSP is front and center and I need the ‘strict’ Plotly 2.0 package.

I’m on Dash 1.20 with dash_core_components 1.16.0

Thanks!
DDR

Plotly.js 2.0 is available now, yes, and you can drop the 2.0-strict bundle into your Dash app’s assets directory (see "Controlling the Plotly.js Version Used by `dcc.Graph " in dcc.Graph | Dash for Python Documentation | Plotly) to override the built-in version that comes with Dash 1.20 :slight_smile:

Final update: Plotly.py 5.0 is now out and includes all of the above changes and more: 📣 Introducing Plotly.py 5.0.0 - a new federated Jupyter extension, Icicle charts, and Bar chart patterns

1 Like