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

124
Views
Data in Chart JS - X and Y

I have a chart in which I am receiving several JSON and I would need to show that data in the chart, but when I try to show it, it does not do it and fails.

Example code:

{
  "product": "Flour125",
  "99": "2567",
  "101": "123",
  "102": "201"
}

The problem I am having is that I cannot display this data correctly, because when I try to display it, what it does is to take for example 99, 102, etc. and what I am trying to do is to show them by product.

Code:

setInterval(function() {
    $.ajax({
        url: 'product.php',
        type: 'GET',
        dataType: 'json',
        success: function(data) {
            for (var i = 0; i < data.length; i++) {
                chartproduct.data.datasets[i].label = data[i]['product'];
                chartproduct.data.datasets[i].data = data[i];
            }
            chartproduct.update();
        }
    });
}, 5000);

the graph I am trying to generate is of stacked type

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!