As of now, this is the current appearance of the code which includes a Chart.js first image preview.
I am seeking advice on how to prevent my data chart from starting at the Y axis.
The result of the code can be viewed below. https://i.sstatic.net/sdl3K.png
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: [<?php echo trim($labels);?>],
datasets: [{
label: 'Weekly Revenue',
data: [ 0, 100, 3000, 4000, 5000, 6000, 7000, 8000,9000,10000,],
fill: false,
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 3
},
]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
callback: function(value, index, values) {
return value.toLocaleString("en-PH",{style:"currency", currency:"PHP"});
}
}
}]
}
}
});
<div class="chart-container" style="min-width: 210px; height: 400px; margin: 0 auto">
<canvas id="myChart"></canvas>
</div>
Objective: Ensure that the data does not initiate at the Y-axis.