Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

72
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!