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

426
Vistas
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 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