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

Make log ticks formatter selection logic more robust #1731

Merged
merged 1 commit into from
Jan 15, 2025
Merged

Conversation

axelboc
Copy link
Contributor

@axelboc axelboc commented Jan 15, 2025

As explained in #1726 (comment), the log ticks formatter selection logic doesn't work when the domain array is in the wrong order ([max, min] instead of [min, max]). Ideally this shouldn't happen, and I'll investigate the idea of asserting min < max in VisCanvas.

Regardless, I'm not happy with the domain-flipping logic const [min, max] = domain[0] > 0 ? domain : [-domain[1], -domain[0]];. In this PR, I refactor it so it's more robust and explain why we need it at all in a comment. The new logic works with [max, min], because why not:

BEFORE AFTER
image image

@axelboc axelboc requested a review from loichuder January 15, 2025 10:09
@axelboc axelboc merged commit 3c8ea6d into main Jan 15, 2025
8 checks passed
@axelboc axelboc deleted the fix-log-ticks branch January 15, 2025 10:32
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

Successfully merging this pull request may close these issues.

2 participants