Pie / Hierarchical

Classroom

type: 'classroom'

Hemicycle of round seats — one per unit of each category's value — arranged in concentric arcs. Hovering a seat highlights its category and dims the rest; clicking a seat fires a point event. Use type 'item' with custom angles, or 'classroom' for the bottom-anchored hemicycle defaults.

Edit the JSON on the right and press Run (or ⌘/Ctrl + Enter) — data, titles, categories and colors all update live.

Live
Classroom
Edit · JSON

Data format

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

Data shape

The JSON you pass inside the chart — drop it straight into your series.

data: [
  { name: 'At risk', y: 3 },
  { name: 'Progressing', y: 7 },
  { name: 'Unavailable', y: 6 }
]

Example

import KatuCharts from 'katucharts.js';

KatuCharts.chart('container', {
  chart: { type: 'classroom' },
  series: [{
    cursor: 'pointer',
    point: { events: { click: function () { openDetails(this.name); } } },
    data: [
      { name: 'At risk', y: 3 },
      { name: 'Progressing', y: 7 },
      { name: 'Unavailable', y: 6 }
    ]
  }]
});

Type-specific options

OptionDescription
startAngle / endAngleArc span in degrees (classroom defaults -100 / 100).
center / size / innerSizePosition, overall size and the hollow center (auto-fit when size is omitted).
rows / itemPaddingFixed rows and the gap between seats (auto rows when omitted).
marker.radiusFixed seat radius; omit to auto-size (fewer seats → bigger).
dataLabelsPer-category label, e.g. '{point.label} ({point.y})'.
point.events.clickPer-seat click — open a modal or a detail page.
groupRender each datum as its own seat, colored & legended by group.

Variations

Seat labels

Show a short label and count on each bloc.

KatuCharts.chart('container', {
  chart: { type: 'classroom' },
  series: [{
    keys: ['name', 'y', 'label'],
    data: [['The Left', 39, 'LEFT'], ['Greens', 60, 'GRN'], ['Far Right', 50, 'AFR']],
    dataLabels: { enabled: true, format: '{point.label} ({point.y})' }
  }]
});

Individual seats

One seat per student, grouped and colored by status; hover a seat for its name and click to open it.

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: 'Progressing' },
      { name: 'Student 2', y: 1, group: 'Unavailable' }
    ]
  }]
});

Rectangular grid

Drop the angles for a row/column grid of items.

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

Common errors

Why does my classroom 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 classroom chart in JavaScript?
Install with `npm install katucharts.js`, then call KatuCharts.chart(container, { chart: { type: 'classroom' }, series: [...] }).
Why does my classroom 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.
Common options (color, visible, marker, dataLabels, animation, events, zones…) apply to every type — see Configuration → series. See it rendered in the gallery.