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!
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.
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 thegl2d
custom bundle. This trace has many problems and is easily replaced by using the non-WebGL-poweredcontour
trace. - The
area
trace type: this trace type has been marked as deprecated and un/under-documented for years; thebarpolar
trace types should be used instead. - The legacy polar
r
andt
attributes of the otherwise-cartesianscatter
andbar
traces: these attributes have been marked as deprecated and un/under-documented for years; thescatterpolar
andbarpolar
trace types should be used instead. - The
Plotly.plot()
function: this function has been deprecated/under-documented for years, in favour ofPlotly.react()
or a combination ofPlotly.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
andpointcloud
trace types as “deprecated”, and recommending that folks use theheatmap
/image
orscattergl
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!
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.
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?
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!
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.
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 (we have decided to stop maintaining a “latest” bundle). The same pattern will hold true for all the official partial bundles.https://cdn.plot.ly/plotly-latest-v2.js
(once 2.0.0 comes out)
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!