0👍
Make sure the data
element includes the labels
definition.
var batlevels = {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
datasets: [{
label: 'My Dataset',
data: [20, 40, 10, 30, 50],
backgroundColor: ['#FF6384', '#63FF84', '#84FF63', '#8463FF', '#6384FF']
}]
};
new Chart(document.getElementById("myChart1"), {
type: 'bar',
data: batlevels,
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js"></script>
<canvas id="myChart1" height="80"></canvas>
- Chartjs-Chat js with respose ajax
- Chartjs-Chart.JS Get Json data for chart and return dataset where a type equals a certain type
Source:stackexchange.com