Closed
Description
initial requirements
- Generic style only. Items that apply to any data setup such as trace color, size, background, and fonts are applied.
- The template data shall be stored without any design point data. For example, the x and y source data shall not be included. If an attribute such as color, size, or opacity is bound to a variable (has individual values), then the individual values will not be stored.
- The template shall be applied to an existing graph (a new graph is not generated).
- A mechanism shall be enabled through the API to report items from the template that do not apply. Example 1) The template has a different number of traces than the plot to which it is being applied. Example 2) The template is from a line plot and being applied to a heat map, therefore the point glyph cannot be applied.
cc @alexcjohnson @etpinard for implementation discussions
cc @chriddyp @sglyon for possible applications to and requirements of plotly.[py|jl]
and Dash
cc @nicolaskruchten @VeraZab for general input.
To get the conversation rolling how about I take a stab at an API:
const figureStyle = plotly.extractStyle(gd || {data, layout}, config)
const info = plotly.applyStyle(gd || {data, layout}, {figureStyle [, config]} [, config])
where info
is an object containing a subset of the structure in figureTheme
documenting each item that was not applied and possibly an optional reason
why it was not applied.
note: It would be great if this operation was immutable however point 3. requires mutation. Perhaps someone has suggestions for an API that allows both immutable application and mutation.