1👍
✅
This will be fixed with the upcomming release of chart.js V4, the tick calculation has undergone some refinement in this pr: https://github.com/chartjs/Chart.js/pull/9166
Result:
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3]
}]
},
options: {
scales: {
x: {
},
y: {
type: 'logarithmic',
min: 2,
max: 19
}
}
}
});
<script src="https://www.chartjs.org/dist/master/chart.umd.js"></script>
<div class="myChartDiv">
<canvas id="myChart" width="600" height="400"></canvas>
</div>
Source:stackexchange.com