Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR Support for making Plotly more CSS friendly #1195

Closed
JonDum opened this issue Nov 24, 2016 · 2 comments
Closed

PR Support for making Plotly more CSS friendly #1195

JonDum opened this issue Nov 24, 2016 · 2 comments
Labels

Comments

@JonDum
Copy link

@JonDum JonDum commented Nov 24, 2016

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?

@etpinard

This comment has been minimized.

Copy link
Member

@etpinard etpinard commented Nov 24, 2016

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:

  • to describe both SVG and WebGL graphs using the same set of attributes (CSS styling won't work in WebGL)
  • make our a graph's data / layout portable (via JSON) to other languages such as python and R.

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.

@JonDum

This comment has been minimized.

Copy link
Author

@JonDum JonDum commented Nov 28, 2016

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.