Skip to content

Tennis serve map ​

Where the serves landed in the service boxes: aces, points won and lost, faults, wide, body or T. Good for how a player serves and where to stand to return.

The smallest code that works. change the code, then press Run

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'serve',
  player: 'Yasmine Haddad',
  serves: [
    { x: 21, y: 41, result: 'won', speed: 163 },
    { x: 76, y: 57, result: 'fault', speed: 169 },
    { x: 7.84, y: 55, result: 'fault', speed: 187 },
    { x: 84, y: 35, result: 'fault', speed: 191 },
    { x: 19, y: 40, result: 'fault', speed: 196 },
    { x: 76, y: 63, result: 'fault', speed: 168 },
    { x: 20, y: 46, result: 'won', speed: 171 },
    { x: 93.16, y: 38, result: 'won', speed: 164 },
    { x: 24, y: 41, result: 'lost', speed: 173 },
    { x: 78, y: 35, result: 'ace', speed: 159 },
    { x: 2.84, y: 61, result: 'fault', speed: 184 },
    { x: 99, y: 34, result: 'won', speed: 184 },
    { x: 47.160000000000004, y: 38, result: 'lost', speed: 197 },
    { x: 73, y: 37, result: 'won', speed: 173 },
    { x: 5.84, y: 44, result: 'ace', speed: 198 },
    { x: 52.839999999999996, y: 60, result: 'fault', speed: 202 },
    { x: 5.84, y: 41, result: 'lost', speed: 170 },
    { x: 78, y: 51, result: 'lost', speed: 176 },
    { x: 0.8399999999999999, y: 47, result: 'fault', speed: 177 },
    { x: 79, y: 32, result: 'lost', speed: 187 },
    { x: 25, y: 37, result: 'won', speed: 183 },
    { x: 93.16, y: 37, result: 'won', speed: 183 },
    { x: 5.84, y: 61, result: 'fault', speed: 171 },
    { x: 81, y: 44, result: 'fault', speed: 191 },
    { x: 6.84, y: 42, result: 'lost', speed: 168 },
    { x: 93.16, y: 61, result: 'fault', speed: 165 },
    { x: 41.160000000000004, y: 44, result: 'won', speed: 191 },
    { x: 98.16, y: 38, result: 'won', speed: 202 },
    { x: 5.84, y: 38, result: 'ace', speed: 204 },
    { x: 59.839999999999996, y: 62, result: 'fault', speed: 186 },
    { x: 27, y: 50, result: 'ace', speed: 167 },
    { x: 98.16, y: 37, result: 'won', speed: 203 },
    { x: 46.160000000000004, y: 44, result: 'lost', speed: 161 },
    { x: 95.16, y: 57, result: 'fault', speed: 182 },
    { x: 41.160000000000004, y: 30, result: 'ace', speed: 181 },
    { x: 99, y: 48, result: 'won', speed: 195 },
    { x: 26, y: 44, result: 'ace', speed: 197 },
    { x: 55.839999999999996, y: 51, result: 'lost', speed: 159 },
    { x: 44.160000000000004, y: 64, result: 'fault', speed: 168 },
    { x: 61.839999999999996, y: 35, result: 'fault', speed: 174 },
    { x: 24, y: 60, result: 'fault', speed: 193 },
    { x: 94.16, y: 52, result: 'ace', speed: 203 },
    { x: 41.160000000000004, y: 31, result: 'won', speed: 192 },
    { x: 77, y: 34, result: 'won', speed: 176 },
    { x: 22, y: 59, result: 'fault', speed: 159 },
    { x: 74, y: 39, result: 'lost', speed: 192 },
    { x: 47.160000000000004, y: 35, result: 'ace', speed: 174 },
    { x: 57.839999999999996, y: 39, result: 'won', speed: 195 },
    { x: -4.16, y: 43, result: 'fault', speed: 200 },
    { x: 54.839999999999996, y: 31, result: 'lost', speed: 166 },
    { x: 23, y: 42, result: 'won', speed: 196 },
    { x: 79, y: 58, result: 'fault', speed: 196 },
    { x: 46.160000000000004, y: 45, result: 'lost', speed: 199 },
    { x: 56.839999999999996, y: 31, result: 'lost', speed: 172 },
    { x: 21, y: 45, result: 'ace', speed: 195 },
    { x: 53.839999999999996, y: 46, result: 'won', speed: 167 },
    { x: 1, y: 47, result: 'won', speed: 173 },
    { x: 52.839999999999996, y: 57, result: 'fault', speed: 166 },
    { x: 25, y: 33, result: 'won', speed: 179 },
    { x: 51.839999999999996, y: 35, result: 'won', speed: 158 },
    { x: 4.84, y: 42, result: 'won', speed: 189 },
    { x: 59.839999999999996, y: 50, result: 'won', speed: 187 },
    { x: 1, y: 61, result: 'fault', speed: 174 },
    { x: 80, y: 40, result: 'fault', speed: 175 },
    { x: 17, y: 32, result: 'fault', speed: 183 },
    { x: 99, y: 58, result: 'fault', speed: 198 },
    { x: 21, y: 35, result: 'ace', speed: 165 },
    { x: 57.839999999999996, y: 36, result: 'won', speed: 175 },
    { x: 1.8399999999999999, y: 38, result: 'lost', speed: 159 },
    { x: 80, y: 42, result: 'won', speed: 169 },
    { x: 1, y: 37, result: 'lost', speed: 197 },
    { x: 80, y: 48, result: 'lost', speed: 197 },
  ],
};

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 serve takes:

/** Where the serves of a player landed in the service boxes. */
interface ServeSpec extends Base {
  type: 'serve';
  /** `x` across the singles court seen by the server, from 0 to 100; `y` from the net (0) to the baseline (100). */
  serves: {
    x: number;
    y: number;
    result: 'ace' | 'won' | 'lost' | 'fault';
    /** Serving to the right (deuce) or the left (advantage) box. Read from `x` when missing. */
    side?: 'deuce' | 'ad';
    speed?: number;
  }[];
  player?: string;
  /** km/h by default. */
  unit?: string;
}

Style it

  • Colours: theme.palette, chart.setColor(name, colour), or --nervure-palette in your CSS. More
  • Marks: [data-series="name"], parts: [data-part="axes"], legend, series. What you change is kept in exports.
  • Movement: animation: false draws at once. More
  • Files: chart.download('png'), svg, csv. More

Close to it