Chartjs-How to reduce the distance between yAxes in Chart.js?

0👍

What happens if you set suggestedMin of the position: 'right' of your yAxes object to be

suggestedMin: Math.min.apply(null, this.chartData.datasets[0].data)

This should set the minimum of the right axis to be on the minimal value of your dataset rather than starting from 0.

Not sure if it should auto-find it by itself because it is "suggested". There is maybe a better way but this one should at least work.


Reference for the minimum code was found here: https://medium.com/coding-at-dawn/the-fastest-way-to-find-minimum-and-maximum-values-in-an-array-in-javascript-2511115f8621

Leave a comment