var fireCtx = document.getElementById('fireNumberChart').getContext('2d');
var fireChart = new Chart(fireCtx, {
type: 'line',
data: {
labels: [], // Add your labels here
datasets: [{
label: 'Sensor Value',
data: [], // Add your sensor data here
backgroundColor: 'rgba(54, 162, 235, 0.2)',
borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
suggestedMin: 0, // Ensure the y-axis starts at 0
beginAtZero: true,
precision: 0 // Display whole numbers only
}
}]
}
}
});
I want to ensure that the lowest number on the y-axis is always fixed to 0. this is the JavaScript code I’m using for the chart
2
Answers
Or filter data
Also you can hide the negative data