Chess evaluation
Who is better move after move, white under the curve and black above, with the mistakes and blunders. Good for reviewing a game of chess.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'chesseval',
white: 'Amira Ben Ali',
black: 'Louise Fontaine',
evals: [
0.3, 0.2, 0, 0, -0.2, -0.4, -0.4, -0.3, -0.5, -0.7, -0.8, -1, -0.8, -1, -1, -1.3, -1.3,
-1.5, -1.6, -1.5, -1.8, -1.8, -1.8, 0.8, 1, 0.8, 0.7, 0.8, 1, 0.8, 0.8, 0.8, 0.5, 0.6, 0.5,
0.5, 0.7, 1, -0.8, -1, -0.9, -1, -1, -1, -1.1, -0.5, -0.4, -0.3, -0.2, -0.2, -0.1, -0.2, 0,
0.4, 0.7, 0.9, 1.3, 1.3, 1.4, 1.7, 2.1, 2.4, 2.9, 3,
],
moves: [
'e4', 'e5', 'Nf3', 'Nc6', 'Bb5', 'a6', 'Ba4', 'Nf6', 'O-O', 'Be7', 'Re1', 'b5', 'Bb3',
'd6', 'c3', 'O-O', 'Qe2', 'Bg7', 'Rad1', 'Rad8', 'h3', 'Na5', 'Bc2', 'c5', 'd4', 'Qc7',
'Nbd2', 'Bd7', 'Nf1', 'Rfe8', 'Ng3', 'g6', 'Bg5', 'Bf8', 'Qd2', 'Nc4', 'Qe2', 'Bg7',
'Rad1', 'Rad8', 'h3', 'Na5', 'Bc2', 'c5', 'd4', 'Qc7', 'Nbd2', 'Bd7', 'Nf1', 'Rfe8', 'Ng3',
'g6', 'Bg5', 'Bf8', 'Qd2', 'Nc4', 'Qe2', 'Bg7', 'Rad1', 'Rad8', 'h3', 'Na5', 'Bc2', 'c5',
],
};
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 chesseval takes:
/** The evaluation of a chess game, move by move: above the middle White is better. */
interface ChessEvalSpec extends Base {
type: 'chesseval';
/** Pawns after each half-move, seen by White; 100 or more is a mate. */
evals: number[];
/** The moves, as written on the score sheet. */
moves?: string[];
white?: string;
black?: string;
onItemClick?: (ply: string) => void;
}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