Stadium seating
The sections of a stadium around its field, coloured by the share of seats sold. Good for ticket sales for matches, concerts and shows.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'arena',
field: 'pitch',
sections: [
{ name: '101', capacity: 1200, sold: 768, price: 30 },
{ name: '102', capacity: 1100, sold: 484, price: 20 },
{ name: '103', capacity: 1200, sold: 900, price: 30 },
{ name: '104', capacity: 1000, sold: 500, price: 30 },
{ name: '105', capacity: 1500, sold: 555, price: 40 },
{ name: '106', capacity: 800, sold: 528, price: 30 },
{ name: '107', capacity: 1000, sold: 900, price: 20 },
{ name: '108', capacity: 1100, sold: 869, price: 40 },
{ name: '109', capacity: 1400, sold: 686, price: 40 },
{ name: '110', capacity: 1200, sold: 1200, price: 30 },
{ name: '111', capacity: 1200, sold: 732, price: 20 },
{ name: '112', capacity: 1300, sold: 728, price: 40 },
{ name: '113', capacity: 1500, sold: 1500, price: 30 },
{ name: '114', capacity: 900, sold: 810, price: 40 },
{ name: '115', capacity: 1100, sold: 814, price: 30 },
{ name: '116', capacity: 1500, sold: 915, price: 30 },
{ name: '201', tier: 1, capacity: 1400, sold: 168, price: 20 },
{ name: '202', tier: 1, capacity: 1200, sold: 480, price: 20 },
{ name: '203', tier: 1, capacity: 1700, sold: 867, price: 20 },
{ name: '204', tier: 1, capacity: 1300, sold: 351, price: 20 },
{ name: '205', tier: 1, capacity: 1800, sold: 1206, price: 30 },
{ name: '206', tier: 1, capacity: 1500, sold: 1230, price: 20 },
{ name: '207', tier: 1, capacity: 1700, sold: 1360, price: 20 },
{ name: '208', tier: 1, capacity: 1500, sold: 1380, price: 20 },
{ name: '209', tier: 1, capacity: 1800, sold: 1188, price: 30 },
{ name: '210', tier: 1, capacity: 1300, sold: 247, price: 30 },
{ name: '211', tier: 1, capacity: 1700, sold: 1564, price: 30 },
{ name: '212', tier: 1, capacity: 1300, sold: 1001, price: 20 },
],
};
export default function Example() {
return <Chart spec={spec} style={{ height: 340 }} />;
}Or import this chart alone: what each import weighs.
Options
Beside the fields shared by every chart (title, format, heading, export…), type arena takes:
/** Stadium or arena from above: its sections around the field, by share of seats sold. */
interface ArenaSpec extends Base {
type: 'arena';
/** In order around the field, from the top, clockwise. */
sections: ArenaSection[];
field?: 'pitch' | 'court' | 'stage';
onItemClick?: (name: string) => void;
}
interface ArenaSection {
name: string;Style it
- Colours:
theme.palette,chart.setColor(name, colour), or--nervure-palettein your CSS. More - Marks:
[data-series="name"], parts:[data-part="axes"],legend,series. What you change is kept in exports. - Movement:
animation: falsedraws at once. More - Files:
chart.download('png'),svg,csv. More