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

Add maxLines option for gridLines [v2 enhancement] #1859

Closed
morleyzhi opened this issue Jan 6, 2016 · 5 comments
Closed

Add maxLines option for gridLines [v2 enhancement] #1859

morleyzhi opened this issue Jan 6, 2016 · 5 comments

Comments

@morleyzhi
Copy link

One of the projects I'm working on doesn't have any axis labels, so I wound up in a situation where there were a lot of gridLines, to the point where it made the chart illegible. I think being able to add a max number to the gridLines config could be useful:

                xAxes: [{
                    gridLines: {
                        display: true
                        drawTicks: false
                        maxLines: 100
                    }
                    ticks: {
                        display: false
                    }
                }]

In fact, I've already done this on an illegitimate fork:

https://github.com/morleyzhi/OkChart.js/commit/5d42d12ffe3168ba28def36135fcc3dfa6725061

If you think this is worth folding into Chart.js proper, I can make a pull request for it.

@etimberg
Copy link
Member

etimberg commented Jan 7, 2016

@morleyzhi there's a similar option here https://github.com/nnnick/Chart.js/blob/v2.0-dev/src/scales/scale.linear.js#L162

If yours produces different results, I'd be more than happy to look over a PR.

@morleyzhi
Copy link
Author

I don't think the maxTicksLimit does what I'm intending. It limits ticks but not gridlines.

This is with maxTicksLimit set to 100. There's definitely more than 100 gridLines:

image

In contrast, this is with my maxLines prop:

image

I'll make a PR that uses maxTicksLimit to also limit the number of gridlines.

@morleyzhi
Copy link
Author

...Actually, I just imported the latest version of Chart.js, and it looks like it works. So we're good. Thanks!

@morleyzhi
Copy link
Author

Sorry about this -- I was mistaken. I had added back in the ticks display for testing, and I mistook the label-spacing for maxTicksLimit usage.

@etimberg
Copy link
Member

etimberg commented Jan 7, 2016

Merged #1863

@etimberg etimberg closed this as completed Jan 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants