chartjs / Chart.js

Simple HTML5 Charts using the <canvas> tag
https://www.chartjs.org/
MIT License
64.23k stars 11.89k forks source link

Make autoSkip scriptable #9973

Open xr0master opened 2 years ago

xr0master commented 2 years ago

Hi. Quite a simple function that is often needed by developers (more precisely, product managers), and no one knows a good solution.

https://jsfiddle.net/oeqvuz75/2/

Feature Proposal

Make autoSkip scriptable or somehow be able to specify not to skip the zero tick.

Feature Use Case

The problem can be seen in the example. Without a zero axis, bars are going out of "air".

Thanks for your great work.

P.S. Maybe a solution actually already exists?

kurkle commented 2 years ago

You can enable major ticks and mark the important ones major (major ticks are preferred by autoSkip): https://jsfiddle.net/hn6f7ce9/

xr0master commented 2 years ago

@kurkle Interesting! However, for some reason this changes stepSize (was 30, now 40) and does not look so "nice". Ideally, it would be nice to display the scale as it is, and "add" the required value. Right now I think this is probably the easiest way to do it through a plugin... Thank you!