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

Alignment of axis values for inset/overlay axes #345

Closed
ghost opened this issue Oct 27, 2020 · 2 comments · Fixed by #347
Closed

Alignment of axis values for inset/overlay axes #345

ghost opened this issue Oct 27, 2020 · 2 comments · Fixed by #347

Comments

@ghost
Copy link

ghost commented Oct 27, 2020

Hey @leeoniya, after reading your issue for strategies for auto axis.size I thought about one possible strategy which I think would be cheap to implement.

Current visual

The problem: when the axis size is not enough for the axis value length, the value gets clipped:

ss1

Desired

I managed to achieve the following visual using a negative gap along with size: 0:

ss2

axes: [
    {
        size: 0,
        gap: -32
    },
    {
        size: 0,
        gap: -50
    }
]

Even tough the values are still getting clipped, we could fix it by rendering the text aligned to the left instead of right:

20201027160038

Notice how the CPU Usage axis values are aligned to the left, which makes longer values like 100% still fully visible.

Also, and when using side: 1 // right side:

ss3

Then the text should be aligned to the right instead of left.

Suggested solution

Maybe introduce a property named align for the Axis type, which would allow us to achieve this desired visual. Since this should not require doing any additional renders, it would serve as one decent solution to the axis size problem.

@leeoniya
Copy link
Owner

leeoniya commented Oct 28, 2020

hey @joaopaulobdac

that's a good hack, and i've recommended it before in #235 :)

however, i don't think this is a realistic general recommendation for the axis sizing problem; this overlaid style is visually nice, but ultimately feels rather niche, IMO.

Maybe introduce a property named align for the Axis type, which would allow us to achieve this desired visual.

that's probably a good idea independently of #333.

@ghost
Copy link
Author

ghost commented Oct 28, 2020

however, i don't think this is a realistic general recommendation for the axis sizing problem;

I only suggested this as one possible cheap way of dealing with the axis sizing problem, I agree with you that it's not the ultimate solution 👍

this overlaid style is visually nice, but ultimately feels rather niche, IMO.

In my opinion, the overlaid style is great for when you can't afford to lose graph space displaying the axis values in the sides due to having a small width amount.

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

Successfully merging a pull request may close this issue.

1 participant