Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

122
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda