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

427
Views
C3 Bar Chart from JSON - possible to show json attributes beyond x and value keys?

I would like to create a C3 bar chart, but somehow be able to see the attributes associated the data.

So, let's say my chart is defined as below (I'll just say it's survey data):

var chart = c3.generate({
    data: {
        type: 'bar',
        json: [
            { 'response': 'Yes', 'type': 'A', 'total': 1 },
            { 'response': 'No', 'type': 'B', 'total': 2 },
            { 'response': 'Maybe', 'type': 'C', 'total': 3 }
        ],
        keys: {
            x: 'response',
            value: ['total']
        }
    },
    axis: {
            x: {
                type: 'category'
            }
    },
    bar: {
        width: {
            ratio: 0.5
        }
    }
});

How can I hover over a bar and be able to see the "type" attribute? So, I would know that

  • for "Yes" the response was type "B"
  • for "No" the types were "A" and "B"

And so on. Here is a fiddle with the code I'm starting with: https://jsfiddle.net/oc34gd2n/9/

I'm getting familiar with C3 so I'm not sure if this functionality is easy to implement or what API offers it.

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!