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

cannot set CSS classes for labels, titles #23

Closed
cloudonshore opened this issue Nov 16, 2016 · 1 comment
Closed

cannot set CSS classes for labels, titles #23

cloudonshore opened this issue Nov 16, 2016 · 1 comment

Comments

@cloudonshore
Copy link
Contributor

Label and title styles must be set through the labelStyle and titleStyle props respectively.

Labels have inline styles by default, that must be overridden by a labelStyle prop to be changed (because inline styles override CSS stylesheet styles, a stylesheet selector cannot be used without the !important flag, which is hacky),
Titles have this issue as well, as well as having no class associated with them, so it isn't possible to select them with a CSS child selector.

This makes it very difficult to have a centralized style sheet that manages styles for all charts.

I'm adding this issue so it can be addressed in the refactor.

@krissalvador27
Copy link
Contributor

krissalvador27 commented Apr 26, 2018

It's unfortunate but because label and title use measureText to calculate the smallest amount of possible collisions along the axis, it's dependent on a default fontFamily, size and fontStyle to be sent in. It's definitely hacky for your centralized stylesheet to use !important to override said styles but the best work around off the top of my head without sacrificing measureText's collision detection would be to create a styled label/title component (essentially wrapping label/title and always sending in your preferred styles).

EDIT: Will be sure to add this as disclaimer in the docs!

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

No branches or pull requests

2 participants