0
votes

I'm using ChartJS 2.7.2.

Now Y-axis scale is automatic depending on values. I want it to be still automatic but max should not be too high. I always want to see max scale at for example: (value+20%).

desired look: good looking chart

unwanted look: not so good looking chart

/edited:

example with data

I'm using ajax to get data: my real JS code

I want to see only 3 Y-axis ticks (screen 2) but scale and line should look like here (screen 1).

How it looks without maxTicksLimit: 3,: screen 1

How it looks with maxTicksLimit: 3,: screen 2

1
Do you have a sample with some sample data that reproduces the issue?George Kemp
Please post your code or better create a fiddleKunal Khivensara
When I remove maxTicksLimit: 3, it works fine - so mayby I should find other way of showing only 3 ticks?kruzyk

1 Answers

0
votes

If you're using a backend language to parse the data prior to displaying it, I'd be doing a calculation there to work out what the "max" figure should be, then insert that into the yTicks are as "max: " (as a PHP example), otherwise, use javascript .forEach to cycle through your data array and determine the highest number, then put that in the max field.