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

233
Views
Chartjs: Remove labels on the x-axis when all the values in dataset are zero in stacked bar chart

I am trying to remove the label entirely from the chart when all the values in the dataset are zero and it appears blank with labels as there is no point of showing it. Tried different ways but wasn't able to achieve it.

From the below screenshot I want just display "Wed, Fri and Mon" which have data and remove the rest.

enter image description here

For example: In the below data we have all zero's for Saturday and I do not want to show Sat on the chart with just empty/no stacked bar.

    const labels = [Mon, Tue, Wed, Thu, Fri, Sat, Sun] // Can be 7 days or 14 days
const data = {
  labels: labels,
  datasets: [
    {
      label: 'Dataset 1',
      data: [25,40,4,60,0,43],
      backgroundColor: red
    },
    {
      label: 'Dataset 2',
      data: [20,4,30,40,0,43],
      backgroundColor: blue
    },
    {
      label: 'Dataset 3',
      data: [2,4,4,100,0,43],
      backgroundColor: green
    },
  ]
};
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!