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
Repeating same tick values #4748
Comments
@ostrolucky do you have a fiddle that reproduces this? |
I'm not entirely convinced this is a bug. The callback is explicitly formatting the string values for ticks like Using a callback to only display certain ticks is recommended. Here I've written a simple one that only returns ticks that are integers and removes the others. If you want grid lines to show up for the hidden ticks, return |
I don't care about classification of this, I never mentioned it's a bug. I don't see current behaviour as sensible though. I don't see any use case where it's useful when values shown there are duplicated, do you? I also don't see why is developer forced to work around this. Developer never provided non-integer value, but Chart.js tries to display them. I've never see this in other charting solutions. |
Closing as this is unlikely to be fixed. |
Worked out a temporary solution:
ref: https://stackoverflow.com/questions/37699485/skip-decimal-points-on-y-axis-in-chartjs Another Solution Now:
|
Since I see other people have same problem, reopening |
It'd be great if this would be fixed soon |
There is a proposal to add a way of forcing integer steps in #4841 |
Closing as this was solved in #4841 and is already available in version 2.7.3 (setting |
Using version 2.7.3 |
I got it working now. What helped was converting the (y) values first, before constructing a label in |
I got the solution by using https://www.chartjs.org/docs/latest/axes/cartesian/linear.html#axis-range-settings |
Repeating values are not seen in graph any one who has resolved it please send the 'options' of chart |
I was struggling with this problem for hours at last "precision: 0" solved this for me. |
@pimvanderheijden I am facing the same problem and my current code converts the y-value inside callback function and then constructs the label inside. Could you please give more context about how did you manage to filter the identical values before the callback?? |
I think I meant I mapped the set of x and y values
Not really sure if this answer the question honestly |
|
See Y axis? This is caused because we are returning rounded value in
options.yAxes.ticks.callback
. So chart.js calls callback with 0, 0.1 ... 0.9, 1.0, 1.1 values, but callback returns 0, 1 only. Repeating same values in a chart is undesirable for end user.In userspace, I've applied following fix to solve this issue:
The text was updated successfully, but these errors were encountered: