Mostrar valor em cima da barra de um gráfico.

17 views
Skip to first unread message

Valdecir Renkaveski

unread,
Apr 30, 2018, 4:20:48 PM4/30/18
to Google Visualization API
Estou com dificuldades para colocar as informações do valor sobre a barra de um gráfico de barra.
Alguém pode me auxiliar?
Segue o código.

function Mychart(){

    Padrao_de_Cores();

    var cht = document.getElementById("myChart");
   var ctx1 = cht.getContext("2d");

    window.myChart = new Chart(ctx1 , {
   type: 'bar',
   data: {
       labels:MatrizSArea,    
        datasets: [{label:"AA - 50%",
       data: MatriszCor1,
       backgroundColor:'rgb(255, 0, 0)',},    
        {   label:"A - 75%",
           data: MatriszCor2,
           backgroundColor:'rgb(191, 143, 0)',
       },
       {   label:"B - 90%",
           data: MatriszCor3,
           backgroundColor:'rgb(255, 255, 0)',
       },      
       {   label:"C - 100%",
           data: MatriszCor4,
           backgroundColor:'rgb(0, 176, 80)',
       }],
    },
       options: {          
           title:{
               display:true,
               text:$('#Depto').val(),
           },

            tooltips: {
               mode: 'index',
               intersect: true,
           },
           
           responsive: true,
           
           scales: {
               xAxes: [{
                   stacked: true,
               }],
               yAxes: [{
                   stacked: true,
                   ticks: {
                   beginAtZero:true,
                   bounds:false,
                   }
               }]
           },
       }
   });
}



Reply all
Reply to author
Forward
0 new messages