Skip to content
This repository was archived by the owner on Jun 6, 2020. It is now read-only.

Conversation

@ImogenF
Copy link
Contributor

@ImogenF ImogenF commented Sep 19, 2019

Improved colours etc.
Truncated axis labels where necessary.
Fixed maxNumberOfTicks behaviour.

image

@ImogenF ImogenF self-assigned this Sep 19, 2019
@stereobooster
Copy link
Contributor

@ImogenF can you please add separate story (to storybook) which will showcase all capabilities of Axis?

@stereobooster
Copy link
Contributor

stereobooster commented Sep 19, 2019

Screenshot 2019-09-19 at 15 25 29

I guess out of scope of this PR:
Screenshot 2019-09-19 at 15 27 46

@ImogenF
Copy link
Contributor Author

ImogenF commented Sep 19, 2019

The previous state was also not great:
image

In this case, the user (or the Explore UI by default) should configure the value of maxNumberOfTicks to an appropriate value, so it would then look like this:

image

@ImogenF
Copy link
Contributor Author

ImogenF commented Sep 20, 2019

I guess out of scope of this PR:
Screenshot 2019-09-19 at 15 27 46

Missed this one yesterday. You're right, out of scope and I'm not sure if there's a nice solution for this one. We could allow the user to change the font size perhaps, but either way, there is bound to be some label overlap sometimes - I think it will have to be up to the user whether they want to display labels at all in that case.

@stereobooster
Copy link
Contributor

@ImogenF this PR needs rebase

@ImogenF ImogenF force-pushed the EX-116-axis-styling branch from 7ba85d3 to b963e6a Compare September 23, 2019 09:53
let text = textEl.text();
let width = (textEl.node() as Element).getBoundingClientRect().width;
while (width > maxWidth && text.length > 0) {
text = text.slice(0, -1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calculate size through getBoundingClientRect is expensive operation. We can use "binary search" here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants