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!
We encourage all interested developers to read the changelog carefully, but here is a summary of the important changes and some commentary.
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.
contourgltrace type: this trace type is not currently in the main bundle, and this removal will only impact users of the
gl2dcustom bundle. This trace has many problems and is easily replaced by using the non-WebGL-powered
areatrace type: this trace type has been marked as deprecated and un/under-documented for years; the
barpolartrace types should be used instead.
The legacy polar
tattributes of the otherwise-cartesian
bartraces: these attributes have been marked as deprecated and un/under-documented for years; the
barpolartrace types should be used instead.
Plotly.plot()function: this function has been deprecated/under-documented for years, in favour of
Plotly.react()or a combination of
We are marking the
pointcloudtrace types as “deprecated”, and recommending that folks use the
scattergltrace 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!
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:
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.
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!
What about Plotly.py?
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. No other backwards-incompatible changes are planned in Plotly.py, although we will be announcing some new features shortly. We will, however, be marking a number of under-documented/under-used portions of the library as deprecated, so as to permit future removals, and we will be declaring Python 2.7 and 3.5 and below to be discouraged/deprecated as well. Version 6.0 of Plotly.py will no longer work with these older versions of Python.
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
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.
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). The same pattern will hold true for all the official partial bundles.
Try the first Release Candidate and give us feedback!
We’ve released Plotly.js 2.0.0-rc.0 to NPM and to the CDN under
https://cdn.plot.ly/plotly-2.0.0-rc.0.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!