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

Consistent .u-axis layout #971

Closed
Qanpi opened this issue Jul 9, 2024 · 1 comment
Closed

Consistent .u-axis layout #971

Qanpi opened this issue Jul 9, 2024 · 1 comment
Labels
question Further information is requested

Comments

@Qanpi
Copy link

Qanpi commented Jul 9, 2024

Hey!

Wondering if there is any way to consistently retrieve a specific (e.g. right) axis DOM element, irrespective of how many axes there are.

One option is to use querySelectorAll with .u-axis but that's subject to changes based on the number of added axes. Perhaps the divs could have a data-tag to mark their position? Alternatively, the divs for all four axes could be mounted even if not toggled (using .u-off).

Use case: add custom element (unit label) to the axis.

@Qanpi Qanpi changed the title Consistent u.axis layout Consistent .u-axis layout Jul 9, 2024
@leeoniya
Copy link
Owner

One option is to use querySelectorAll with .u-axis but that's subject to changes based on the number of added axes.

you can always get the position using .getBoundingClientRect()

there's also a couple internal properties u.axes[i]._pos and u.axes[i]._el

Use case: add custom element (unit label) to the axis.

why would you do this after init and not add it to the axis label during initial axes defs? i guess in case you toggle all series off and the outer axis disappears?

anyways, hope that helps.

@leeoniya leeoniya added the question Further information is requested label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants