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

Styling / Attributing #1338

Open
mcnuttandrew opened this issue May 28, 2020 · 2 comments
Open

Styling / Attributing #1338

mcnuttandrew opened this issue May 28, 2020 · 2 comments

Comments

@mcnuttandrew
Copy link
Collaborator

@mcnuttandrew mcnuttandrew commented May 28, 2020

A number of the series have a somewhat inconsistent notion of style. In particular some series use style as a way to apply attributes to rows of series (such as the LabelSeries), while others apply them as inline styles. If there is a major versioning happening soon it might be a good opportunity to clear up that part of the api.

In particular I suggest that all (SVG) series should feature both a style param as well as an attributes param. This will hopefully resolve some ambiguity found across these two (equal valid!) usages.

@Xiot
Copy link
Contributor

@Xiot Xiot commented Jun 4, 2020

Wouldn't the inclusion, and wide usage, of both style and attribute params actually increase the ambiguity instead of resolving it. If we have two ways of accomplishing the same thing, then we would need to come up with a priority order, which may not be immediately obvious to the caller.

I guess it just falls back to the inherit precedence in the svg elements themselves.
Looking at this StackOverflow post the order seems to be:

Thus the precedence, from lowest to highest, is

  1. attributes
  2. CSS style sheets
  3. inline styles

The reasoning that the post arrives at is that the choice to use attributes or styles comes down to whether it represents 'content' or 'style'

Looking at the LabelSeries it looks as though marginLeft and marginTop were only included at attributes because they are being used to set the translate

margin(Left|Right|Top|Bottom) are being passed by the XYPlot to all of the series so that they can properly offset themselves to account for the margins that are passed to the chart itself.

@Xiot
Copy link
Contributor

@Xiot Xiot commented Jun 4, 2020

I think the other thing that we may want to consider, is how similar we want our svg and canvas apis?

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.