Ir para conteúdo
Fórum CódigoFonte.net
ValdecirRK

Mostrar valores acima das barras em gráfico de barras

Recommended Posts

Boa tarde

Estou desenvolvendo um indicador mas estou com dificuldade de inserir os valores acima das barras depois que é gerado.

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,
                    }
                }]
            },
        }
    });
}

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Visitante
Responder

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Processando...

×
×
  • Criar Novo...