Skip to content

smarter tick count limit for cartesian axes #1898

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

Merged
merged 1 commit into from
Jul 19, 2017
Merged

Conversation

alexcjohnson
Copy link
Collaborator

fixes #484

@etpinard what do you think about this solution: Stopping if two consecutive ticks are truly identical (infinite loop) or if we make more ticks than there are pixels on the axis. I included the same 1000 for short axes and as a fallback in case there are callers with dummy axes that don't have a _length. But it seems to me that any case where you'd really want a large number of ticks, there will still be less than one per pixel.

@etpinard etpinard added status: reviewable bug something broken labels Jul 19, 2017
// This actually gives text '-Infinity' because it can't
// calculate the first tick properly, but since it's not going to
// be able to do any better with the rest, we don't much care.
expect(textOut.length).toBe(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice test!

@etpinard
Copy link
Contributor

what do you think about this solution:

Great solution. Nicely done!

Now, https://codepen.io/etpinard/pen/WwajEX?editors=0010 is showing all its tick labels:

image

🎉

@etpinard etpinard added this to the 1.29.0 milestone Jul 19, 2017
@etpinard
Copy link
Contributor

💃

@alexcjohnson alexcjohnson merged commit 9ab907f into master Jul 19, 2017
@alexcjohnson alexcjohnson deleted the many-ticks branch July 19, 2017 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Axis labels on very tall graph don't reach end of axis
2 participants