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

195
Views
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 answers
Answer question

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 Report
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!