Tooltip Chart JS Line Chart

0

In the image follows Graphic in Line that I have.

Iwouldlikethetooltiptoworkoutasfollows:

80%

Insteadofthewayitis:

03
:80

GraphicCode:

$(function(){newChart(document.getElementById("graficoOcupacao").getContext("2d"), getChartJs('line'));
});

function getChartJs(type) {

    var config = null;

    if (type === 'line') {
        config = {
            type: 'line',
            data: {
                labels: ["01", "02", "03", "04", "05", "06", "07","08","09","10","11", "12", "13", "14", "15", "16", "17","18","19","20","21", "22", "23", "24", "25", "26", "27","28","29","30"],
                datasets: [{
                    data: dadosGraficoValores,
                    borderColor: 'rgba(0, 188, 212, 0.75)',
                    backgroundColor: 'rgba(0, 188, 212, 0.3)',
                    pointBorderColor: 'rgba(0, 188, 212, 0)',
                    pointBackgroundColor: 'rgba(0, 188, 212, 0.9)',
                    pointBorderWidth: 1
                }]
            },
            options: {
                responsive: true,
                legend: false,
                scales: {
                    xAxes: [{
                        display: true,
                        scaleLabel: {
                            display: true,
                            labelString: 'Dia'
                        }
                    }],
                    yAxes: [{
                        display: true,
                        scaleLabel: {
                            display: true,
                            labelString: 'Ocupação (%)'
                        }
                    }]
                },
                title:{
                    display: true,
                    text:'NOVEMBRO/2017'
                }
            }
        }
    }
    return config;
}
    
asked by anonymous 30.11.2017 / 19:20

1 answer

0

Put this code into "options" and it will work.

           tooltips: {
                callbacks: {
                    title: function() {
                        return '';
                    },
                    label: function(tooltipItem, data) {
                        return tooltipItem.yLabel + " %";
                    }
                }
            }
    
04.12.2017 / 13:35