Plotly.js: Move property literals out of Plotly.restyle

Created on 15 Jun 2016  路  5Comments  路  Source: plotly/plotly.js

Most helpful comment

All 5 comments

I think (at least I like to think) that there's a way to achieve this using our attribute declaration.

Some questions that we need to answer:

  • Do we need all restyle docalc, doplot, ... distinctions ? Can you merge some of them?
  • Most docalc updates relate to our data_array and our arrayOk attributes. Meaning that we could simply use the attribute declaration to figure our what update path to take. Are there any exceptions to that rule?
  • _anything else ?_

And most importantly, much of restyle (and relayout) is un-tested. We should be very careful when making this change.

From @rreusser 's https://github.com/plotly/plotly.js/issues/1578

Carpet is going to add a huge number of attrs to recalcAttrs. (up to 287 total or so!?) The array of attributes is recalculated on every plot and it looks them up with indexOf. It should place them in a hash (e.g. {mode: true, visible: true, ...}) and should be defined in a plot-api-global context since it never changes.

@alexcjohnson notes that a larger refactoring is desired, but this might be a start since, at least once carpet is merged, it shouldn't take more than five minutes and may very well be at the point of having a non-negligible impact on performance.

A pretty valuable first step was made in https://github.com/plotly/plotly.js/pull/1653/files/413e5459960c4b4c2c4c6212919e3a5c3183f981#diff-2941ab69a12080c0633ff4ac8ea3aa83

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonmmease picture jonmmease  路  3Comments

maxwell8888 picture maxwell8888  路  3Comments

HunterMcGushion picture HunterMcGushion  路  3Comments

chriddyp picture chriddyp  路  3Comments

boleslawmaliszewski picture boleslawmaliszewski  路  3Comments