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

[FEATURE] Automatic adjustment of yAxes range based on displayed data #4131

Closed
IvanRF opened this issue Apr 9, 2017 · 1 comment · Fixed by #6695
Closed

[FEATURE] Automatic adjustment of yAxes range based on displayed data #4131

IvanRF opened this issue Apr 9, 2017 · 1 comment · Fixed by #6695

Comments

@IvanRF
Copy link

IvanRF commented Apr 9, 2017

Demonstration: http://codepen.io/anon/pen/jBgrGR

The dataset includes a high value for a past date: ('2017-01-01', 1200) and lower values for the Last 7 days.

When the view only shows the last 7 days by changing time.min and time.max on the x axis, the high value (1200) corresponding to a date outside the view makes the entire chart unreadable. That is, the max value of the y axis should be automatically updated based on the data being displayed. In this example, 1200 should be updated to 7, which is the highest value for the last 7 days.

Could this behaviour be added as an option for the chart? or did miss something already available?

@etimberg
Copy link
Member

etimberg commented Apr 9, 2017

@IvanRF supporting this will take some work inside the chart. I'm happy to look at some kind of PR / proposal for this feature. The data limits for a linear axis are determined here: https://github.com/chartjs/Chart.js/blob/master/src/scales/scale.linear.js#L16-L132 and for a logarithmic axis here: https://github.com/chartjs/Chart.js/blob/master/src/scales/scale.logarithmic.js#L17-L135

Maybe some common logic could be factored out at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants