how to put "%" in chart pie (chartjs)

I need to put % after the number in the chart:

Like: 100%

enter image description here

This is the code that i'm using to make the chart, using chart js:

new Chart(document.getElementById("pie-chart-one"), {
    type: 'doughnut',
    data: {
        labels: ['Transmitidas', 'Não Transmitidas'],
        datasets: [{
            data: [@Model.PorcentQtdDeclaracoesStatusTransmitida, @Model.PorcentQtdDeclaracoesStatusNaoTransmitida],
            backgroundColor: backgroudColor,
            borderWidth: 1,
        }]
    },
    options: {
        legend: {
            display: true,
            position: 'bottom',
            fontSize: 10

        },
       responsive:false,
       fontsize: 11,
       layout: {
           padding: {
               left: 0,
               right: 0,
               top: 30,
               bottom: 30
           }
        }
    }
});

1 answer

  • answered 2018-12-05 20:53 Sk.

    in options definitions...

    options: {
            tooltips: {
                enabled: true,
                mode: 'single',
                callbacks: {
                    label: function(tooltipItems, data) { 
                        return tooltipItems.yLabel + ' %';
                    }
                }
            },
     }