Golf scorecard
Strokes on each hole against the par, birdies in circles and bogeys in squares, with the totals. Good for rounds, tournaments and friendly games.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'golf',
par: [4, 4, 3, 5, 4, 4, 3, 4, 5, 4, 3, 5, 4, 4, 3, 4, 5, 4],
players: [
{ name: 'Sami Ayari', strokes: [4, 4, 3, 5, 4, 4, 3, 4, 4, 4, 3, 4, 6, 3, 3, 3, 4, 4] },
{ name: 'Paul Girard', strokes: [4, 5, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 5, 4, 4] },
{ name: 'Hedi Mansour', strokes: [6, 5, 3, 3, 5, 4, 3, 4, 4, 6, 3, 4, 4, 3, 3, 3, 4, 5] },
],
};
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 golf takes:
/** A golf scorecard: strokes on each hole, marked against the par. */
interface GolfSpec extends Base {
type: 'golf';
/** Par of each hole: 9 or 18 holes. */
par: number[];
players: { name: string; strokes: (number | null)[]; color?: 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