Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

73
Visualizações
Feed Chart JS with constants with links

Got this chart which I'm feeding with two constants. I have a third constant with url for each one of those values, and I would like to assign those url to each bar. There's a way to make that? I've come across and example for bars with links but it needs to use data structures and I haven't find a way to use my constants in the data structure.

const numPostPerCat= <?php echo json_encode($countCateT); ?>;
const catName= <?php echo json_encode($cateTforChart); ?>;
const data2= {
    labels:catName,
        datasets: [{
            label: 'Terri',
            backgroundColor: 'rgb(166,166,166)',
            borderColor: 'rgb(166,166,166)',
            data: numPostPerCat,
            borderWidth: 2,
            barThickness: 3,
            datalabels: {
                color:'gray',
                anchor: 'end',
                align: 'top',
            },
        }]
    };
// Config Block
const config2={
    type: 'bar',

    data: data2,
    plugins: [ChartDataLabels],

    options: {

        scales: {

            
            x:{
                grid:{
                    display: false,
                },
            },
                y:{
                    ticks:{
                        display: false,
                    },
                    grid: {
                        display: false,
                    },
                },
                
            },
            
        
        plugins:{
            
             legend: {
               display: false
                     },
             title:{
                 display: true,
                 text: 'Territorios',
                 align: 'start',
             },
                             },
            
        responsive: true,   
        maintainAspectRatio: false,
        

        }

    };
    
// Render Block
const myChart2 = new Chart(
    document.getElementById('myChart2'),
    config2
);

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda