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

194
Vistas
ChartJS pie chart with simple parsing options doesn't render, only works when set as bar/line chart

I have this chart that works normally

    var ctx = document.getElementById("myChart").getContext("2d");

const cfg = {
    type: 'bar',
    data: {
        datasets: [{
            data: receivedData,
            label:"testSet"
        }]
    },
    options: {
        parsing: {
            yAxisKey: 'COUNT',
            xAxisKey: 'MODEL'
        }
    }
    };

var myChart = new Chart(ctx, cfg);

receivedData contains objects with the following properties

    {MODEL:"model name", COUNT:10}

the problem is if i try to change the chart's type to pie or doughnut, then the chart won't render, bar and line works normally though.

is this some sort of bug or am i doing something wrong?

i'm using chart.js's latest version

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

At the moment you cant use object notation for doughnut/pie charts, there is an enchancement issue open currently in their repo for this: https://github.com/chartjs/Chart.js/issues/9440

So you will need to transform your object to the normal labels and data array first if you want to show your data as a pie/doughnut chart

about 4 years ago · Juan Pablo Isaza Denunciar
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