I've been using Plotly extensively in a SPA and one of my biggest annoyances is that Plotly adds so many inline styles!
I think Plotly could learn a bit from other svg charting libraries like Chartist in this case.
I would like to contribute a PR that attempts to move all the default values of styles for elements out from D3 and into the provided CSS. Inline styles will still be applied as they are now with the existing API so there won't be any breaking changes.
This will make Plotly MUCH more friendly to theming and applying different looks and feels with CSS instead of having to re-draw the whole chart with js.
Thoughts?
Thanks very much for writing for in.
I have some bad news for you though. Your suggestion won't happen anytime soon.
plotly.js is designed to have only one source of truth, that being our JSON-serializable "data" and "layout" API - which, as you said, can only be modified in JS.
This paradigm allows us:
We understand the power of CSS for _theming_ charts, but for plotly.js that has only the potential to work for SVG charts generated by JS users - which at the moment is only a fraction of all plotly users.
I think I wasn't clear. My suggestion is to have zero change on the API. The json API would work exactly as it does now. However, specifically in the plotly.js side of things, the default values would be provided via CSS and overridden by explicitly provided values from the "data" and "layout" objects. Does that make sense?
Most helpful comment
I think I wasn't clear. My suggestion is to have zero change on the API. The json API would work exactly as it does now. However, specifically in the plotly.js side of things, the default values would be provided via CSS and overridden by explicitly provided values from the "data" and "layout" objects. Does that make sense?