plotly.js: wishlist for potential breaking changes since v1
Leave this text box for planned improvements
- upgrade
d3
to v4.0.0 (now v5) - should be mostly a matter of updating the general update pattern. - remove
es-promise
polyfill from bundle - and thus make IE users add their own Promise polyfill. - drop jQuery event support
- Make components (e.g.
Annotations
,Shapes
,RangeSlider
, …) register-able and remove them from the core bundle. - revamp set of default colorscales
- make config arguments consistent https://github.com/plotly/plotly.js/issues/839
- remove
config.plot3dPixelRatio
map for backward compatibility - Incorporate /remove all unofficial exposed methods (i.e Plotly.Plots, Plotly.Fx, Plotly.Snapshot, Plotly.PlotSchema, Plotly.Queue)
- drop event-based
Plotly.Snapshot.toImage
and mergesrc/snapshot
inplot_api/to_image.js
- remove (some) components for
lib/core.js
- see https://github.com/plotly/plotly.js/pull/845 - drop
Plotly.relayout
handlers for the'remove'
and'add'
special values - see https://github.com/plotly/plotly.js/pull/1086 - for log axes, have
layout
express everything in data units instead of linearized units. This applies torange
,tick0
, and annotation and image positions. - remove support for dates provided as epoch milliseconds
- remove the distinction between axis name and axis id (ie
xaxis2
vsx2
) probably by only using the name. - rename current gl marker symbol
'cross'
->'cross-thin'
(i.e. revert https://github.com/plotly/plotly.js/pull/1482/commits/c0eb06599db481f2137ed97e79bab5cb2bc31351)
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 12
- Comments: 63 (51 by maintainers)
On my list:
Plotly.Plots
,Plotly.Fx
,Plotly.Snapshot
,Plotly.PlotSchema
,Plotly.Queue
)Remove our
es6-promise
polyfill and ask IE9, IE8, IE11 (ref) to use their own Promise polyfills.Ooooooh boy.
myPlot
contains methods, plotstate, and history, but it’s current plotstate is always overwritten, and old state is pushed onto a history list)edit: April 14
edit: April 22
Plotly.plot
, and instance methodsPlot.update
,Plot.export
and maybe a few others that don’t fit as an update.edit: April 26
snake_case
orcamelCase
(depending on what we choose)edit: May 3rd
I would love to see autosizing fixed so that it works in flexbox or any dynamically sized containers. If a container’s width/height is
auto
the plot size always defaults to 700x450px. This then requires the use of resize events andPlots.resize()
to get things to behave. It would be nice to refactor the svg plotting to just be sized to100%
of the container instead of using explicit pixels values.Revamp our set of default colorscales.
Besides agreeing with the above two lists, based on very limited work, take it with huge grain of salt:
auto*
attributes: if a value is needed and not provided, that’s enough to indicate that it should be determined automatically, just like all other defaults. This might be too broad a statement, but I think it’s mostly the right goal. There are a few bits of functionality we will need to find a new home for, likeautorange: 'reversed'
gd.data
orgd.layout
duringPlotly.plot
. This requirement has been hinted at elsewhere in this issue but I don’t think it was explicitly stated.#3044 may serve as a model for this kind of behavior, using
_private
attributes to stash values determined duringcalc
rather thansupplyDefaults
Add TypeScript definitions types with every new Plotly.js release and link to NPM @types repo https://www.npmjs.com/package/@types/plotly.js
restyle
andrelayout
and our other API methods - we used these in our old workspace, but this is really not the right level to be managing this issue, as plots may be coupled to other application state (ie changes in data arrays) and using our queue would muck up that correspondence.Any plans to support react-native? I found a third party dev who build this: https://github.com/rynobax/react-native-plotly any thoughts?
To add to the ancient discussion about axis names. Subplot naming for non-cartesian could be made more consistent. I.e. have
scene
andgeo
renamed tosubplot
like the rest. Perhapsgl3d
toscene
.layout.hovermode
from'x'
(compare) to'closest'
. In #778 we discussed setting restrictions on when cartesian plots could default to compare mode (we already separate out non-cartesian and horizontal traces here) but this is both difficult to do (requires digging into data arrays duringsupplyDefaults
) and potentially error-prone, and can still be a source of confusion (seeclickmode
#1852,spikelines
). Seems better just to default to'closest'
and make compare modes explicitly opt-in.Continuing from @etpinard comment https://github.com/plotly/plotly.js/issues/420#issuecomment-364454752
Instead of deprecating
Plotly.plot
renamePlotly.react
toPlotly.plot
.react
may be a somewhat unfortunate name for a method that has the “whole plot specification” ofPlotly.plot
and the performance ofPlotly.update
. Also it is highly useful for those using JQuery, Angular, Vue etc.tickformat
- see #2468Suggestion: now that
Plotly.react
got implemented in https://github.com/plotly/plotly.js/pull/2341, perhaps we start thinking about removing 🔪Plotly.plot
,Plotly.redraw
,Plotly.restyle
,Plotly.relayout
,Plotly.update
andPlotly.moveTraces
entirely from the library makePlotly.react
the only official way to update an existing plotly graph? Therestyle
call signature has always been hard to grasp for new plotly.js users. AsPlotly.react
has the small call signature asPlotly.newPlot
, this should be an improvement.We could probably remove
Plotly.extendTraces
andPlotly.preprendTraces
at some point too, but it might best to keep them and turn them into fast(er) 🐎 routine optimize for streaming data.Just a thought. Maybe some users really like
Plotly.restyle
andPlotly.relayout
…plotly_selected
event withundefined
data that gets emitted when clicking on the plot area in a select mode - see #2241Plotly.setPlotConfig
) - @etpinard suggests a top-level method for it likePlotly.setLogLevel
relayout(gd, {'xaxis.reverse': true})
and change the handling ofaxis.autorange: 'reversed'
from a weird disappearing setting to regular behavior whereautorange: true
always results in an increasing range andautorange: 'reversed'
is always reversed. Would also require the doubleclick interactions to choose whether to setautorange
totrue
or'reversed'
in order to behave the way they do today, but editing behavior would be more intuitive.The precision we have right now - 100 microseconds, one digit better than native dates support - is the best I found I was able to reliably handle using a single javascript number to specify the coordinate. I could imagine a system supporting arbitrary precision within a restricted range where the zero point of the axis linearization is allowed to float - this would be a fairly big project but could be done if someone was sufficiently interested in sponsoring it 😉
Note that this wouldn’t imply any backward incompatibility, so need not be associated with v2
That could work. It gives us the same simplification, clears up the ambiguity, and is a smaller change for users to adapt to. Means we have to do something more clever to manage backward compatibility but maybe that’s unavoidable.
Like
layout.xaxes=[{...}, {...}, {...}]
? two things bother me with that idea:I’d vote for not having “names” that require parsing at all - put them as indexed elements in a list.
[0.1, 100]
rather than[-1, 2]
. For dates we’re doing this in #1078 but I can’t see a backward-compatible way to do it for logs. This also applies to annotation and image positions (but shapes already get it right!) andtick0
. Perhaps in 2.0 we also remove the compatibility transform that #1078 introduces for dates that supports the old range-as-epoch-milliseconds format.Maybe we should drop
Plotly.redraw
in v2.0.0 ?⬆️ there is palette overlap between
plotly.js
and some of itswebgl
renderers, with a different resolution. Slight restructuring would make room for one shared palette set definition at a finer than current resolution.This seems like a good place to discuss smooth transitions as well (requested in #142, and experimented with in https://github.com/ropensci/plotly/pull/547). It’d be awesome if
plot
worked like a d3 selection wrt transitions:Also, in my mind, transitioning positions (x/y) is the most important use case, so it’d be super useful if
restyle()
(or some other method) could also support this:There are multiple ways to transition a path, but I think I’d almost always want to transition the transform.