0
I need to put a caption on a Chart.js chart, but I’m not able to do that.
Does anyone know how I do?
<div class="flex-conteiner2">
<canvas id="myChart3" width="900" ; height="400"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js" integrity="sha512-d9xgZrVZpmmQlfonhQUvTR7lMPtO7NkZMkA0ABN3PHCbKA5nqylQ/yWlFAyY6hYgdF1Qh6nYiuADWwKB4C2WSw==" crossorigin="anonymous"></script>
<script>
var ctx = document.getElementById('myChart3').getContext('2d');
var chart = new Chart(ctx, {
type: 'line',
data: {
labels: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
datasets: [{
lineTension: 0,
label: '2020',
backgroundColor: 'transparent',
borderColor: '#69b360',
data: [4, 5, 1, 2, 3, 4, 1, 4, 3, 5, 2, 4]
},
{
lineTension: 0,
label: '2019',
backgroundColor: 'transparent',
borderColor: ' #b25252',
data: [4, 2, 5, 3, 3, 1, 4, 3, 2, 4, 2, 3]
}]
},
options: {
legend: {
display: true,
position: "bottom",
labels: {
generateLabels: function (chart) {
['Muito Insatisfeito', 'Pouco Insatisfeito', 'neutro', 'Pouco Satisfeito', 'Muito Satisfeito']
},
},
},
},
});
</script>