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 chart method for getting initial scale bounds #585
Conversation
Guess to keep it in line with the main chartjs docs it's best to create a sub cat under the developer section call it API and put it in there |
Added a suggestion, but I did not try this - so it might not make sense. |
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
👍 Can do
I can imagine getting the original bounds will still be useful, but you're right, having the higher level API there as well would also be useful. I'll have a go at adding that as well, although I might only get round to that on Monday or something. |
A isZoomedOrPanned() might be helpful, it may also address my problem where trying to reset all of the charts on a page at once breaks (see my Discussion #583) |
I've added documentation for all methods added on the Chart.js instance. I also noticed while doing that, that the @kurkle, does that work for you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, thank you!
I've requested a review from @etimberg too, lets see if he has any notes
Looks like there are some linting errors (due to the fixed types and incorrect usage in the exports.ts)
|
I think I've fixed that issue, there was also a linting error in the documentation somewhere that I believe I've fixed now as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coveralls.io is in maintenance currently, that's why the CI fails. I'd expect it to become available later today.
@kurkle, looks like it's back up and running again. Is there an easy way to rerun the failed jobs, or do I need to push a new commit or something? |
Based on the discussion in #584, this adds a new method,
getInitialScaleBounds
that returns an object mapping scale IDs to {min, max} values.I've added tests and type definitions. I couldn't see anywhere obvious to document this in the guide, but I think exporting it from
index.d.ts
at least adds some basic type doc stuff, right?