Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

432
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda