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

Labels can overlap #8

Open
johnwalley opened this issue Jul 2, 2018 · 2 comments
Open

Labels can overlap #8

johnwalley opened this issue Jul 2, 2018 · 2 comments
Labels

Comments

@johnwalley
Copy link
Owner

screen shot 2018-07-02 at 11 58 39

@johnwalley
Copy link
Owner Author

johnwalley commented Jul 2, 2018

Possible solutions include providing a cut-down array of tickValues and rotating the labels after the fact, e.g. https://bl.ocks.org/mbostock/4403522

However, this module is named d3 simple slider so we should consider solutions which put less burden on the user. For example, provide an interface to let the user simply specify a rotation angle. Even better, but much larger in scope, would be to detect the size of the labels and adjust the tick values accordingly.

@rusackas
Copy link

rusackas commented Nov 7, 2018

You can use element.getComputedTextLength() to calculate the text width of the label, but the question is then what? One could:
• truncate the text and add an ellipsis, and keep knocking off characters until it fits in the designated width (slider width / # of ticks), but the label may be unusable (e.g. a bunch of "20..." in your example)
• figure out the widest label text, and skip every nth label to make sure they all fit... but if there wind up not being enough tick labels to infer what the other ticks represent, then that's a bad solution too.

@johnwalley johnwalley added the bug label Nov 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants