Circular / Jerárquico

Aula

type: 'classroom'

Hemiciclo de asientos redondos — uno por unidad del valor de cada categoría — dispuestos en arcos concéntricos. Al pasar el cursor sobre un asiento se resalta su categoría y se atenúan las demás; al hacer clic en un asiento se dispara un evento de punto. Usa el tipo 'item' con ángulos personalizados, o 'classroom' para el hemiciclo anclado en la base.

Edita el JSON a la derecha y presiona Ejecutar (o ⌘/Ctrl + Intro) — los datos, títulos, categorías y colores se actualizan en vivo.

En Vivo
Aula
Editar · JSON

Formato de datos

[{ name, y, color? }] · keys: ['name','y','label']

Estructura de datos

El JSON que pasas dentro del gráfico — colócalo directamente en tu series.

data: [
  { name: 'En riesgo', y: 3 },
  { name: 'Progresando', y: 7 },
  { name: 'No disponible', y: 6 }
]

Ejemplo

import KatuCharts from 'katucharts.js';

KatuCharts.chart('container', {
  chart: { type: 'classroom' },
  series: [{
    cursor: 'pointer',
    point: { events: { click: function () { openDetails(this.name); } } },
    data: [
      { name: 'En riesgo', y: 3 },
      { name: 'Progresando', y: 7 },
      { name: 'No disponible', y: 6 }
    ]
  }]
});

Opciones específicas del tipo

OpciónDescripción
startAngle / endAngleAmplitud del arco en grados (predeterminados del aula -100 / 100).
center / size / innerSizePosición, tamaño general y el centro hueco (autoajuste cuando se omite size).
rows / itemPaddingFilas fijas y el espacio entre asientos (filas automáticas si se omite).
marker.radiusRadio fijo del asiento; omítelo para autoajustar (menos asientos → más grandes).
dataLabelsEtiqueta por categoría, p. ej. '{point.label} ({point.y})'.
point.events.clickClic por asiento — abrir un modal o una página de detalle.
groupRenderiza cada dato como su propio asiento, coloreado y en la leyenda por grupo.

Variaciones

Etiquetas en asientos

Muestra una etiqueta corta y el recuento en cada bloque.

KatuCharts.chart('container', {
  chart: { type: 'classroom' },
  series: [{
    keys: ['name', 'y', 'label'],
    data: [['La Izquierda', 39, 'LEFT'], ['Verdes', 60, 'GRN'], ['Extrema Derecha', 50, 'AFR']],
    dataLabels: { enabled: true, format: '{point.label} ({point.y})' }
  }]
});

Asientos individuales

Un asiento por estudiante, agrupado y coloreado por estado; pasa el cursor para ver el nombre y haz clic para abrir.

KatuCharts.chart('container', {
  chart: { type: 'classroom' },
  series: [{
    cursor: 'pointer',
    tooltip: { pointFormat: '{point.name}' },
    point: { events: { click: function () { openStudent(this.name); } } },
    data: [
      { name: 'Student 1', y: 1, group: 'Progresando' },
      { name: 'Student 2', y: 1, group: 'No disponible' }
    ]
  }]
});

Cuadrícula rectangular

Quita los ángulos para una cuadrícula de elementos en filas/columnas.

KatuCharts.chart('container', {
  chart: { type: 'item' },
  series: [{
    layout: 'horizontal', rows: 5,
    data: [
      { name: 'Satisfecho', y: 34 },
      { name: 'Neutral', y: 18 },
      { name: 'Insatisfecho', y: 10 }
    ]
  }]
});

Common errors

Why does my aula chart render as a line chart?
The chart type was not registered. KatuCharts logs "KatuCharts: unknown series type "<type>", falling back to line" and draws a line chart rather than throwing. Import the module the type belongs to — for example `import 'katucharts.js/bio';` — before creating the chart.
Why do I get "Cannot read properties of null (reading 'appendChild')"?
The container element does not exist when the chart is created. Create the chart after the element is in the DOM: in React that means inside useEffect, not during render.
Why is the chart rendering with zero height?
The container has no height. A div with no content collapses to zero. Give it a height in CSS, or pass `chart: { height: 400 }` in the options.

FAQ

How do I create a aula chart in JavaScript?
Install with `npm install katucharts.js`, then call KatuCharts.chart(container, { chart: { type: 'classroom' }, series: [...] }).
Why does my aula chart render as a line chart?
The chart type was not registered. KatuCharts logs "KatuCharts: unknown series type "<type>", falling back to line" and draws a line chart rather than throwing. Import the module the type belongs to — for example `import 'katucharts.js/bio';` — before creating the chart.
Why do I get "Cannot read properties of null (reading 'appendChild')"?
The container element does not exist when the chart is created. Create the chart after the element is in the DOM: in React that means inside useEffect, not during render.
Why is the chart rendering with zero height?
The container has no height. A div with no content collapses to zero. Give it a height in CSS, or pass `chart: { height: 400 }` in the options.
Las opciones comunes (color, visible, marker, dataLabels, animation, events, zones…) se aplican a todos los tipos — véase Configuración → series. Míralo renderizado en la galería.