Skip to content

Pass network ​

Players at their average place on the pitch, joined by lines as thick as the passes between them. Good for how a team builds its play, and who links it.

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

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'passmap',
  team: 'Sfax Lions',
  color: '#c8384f',
  players: [
    { id: 'p1', name: 'Amine Gharbi', number: 1, x: 8, y: 49, touches: 41 },
    { id: 'p2', name: 'Rami Jaziri', number: 2, x: 30, y: 84, touches: 37 },
    { id: 'p3', name: 'Salim Ayari', number: 3, x: 25, y: 62, touches: 44 },
    { id: 'p4', name: 'Hedi Mansour', number: 4, x: 22, y: 36, touches: 43 },
    { id: 'p5', name: 'Nader Ferchichi', number: 5, x: 33, y: 11, touches: 70 },
    { id: 'p6', name: 'Karim Ben Ali', number: 6, x: 39, y: 49, touches: 45 },
    { id: 'p7', name: 'Yassin Khelifi', number: 7, x: 52, y: 71, touches: 31 },
    { id: 'p8', name: 'Omar Saidi', number: 8, x: 54, y: 31, touches: 59 },
    { id: 'p9', name: 'Bilel Trabelsi', number: 9, x: 74, y: 82, touches: 55 },
    { id: 'p10', name: 'Adel Haddad', number: 10, x: 78, y: 52, touches: 44 },
    { id: 'p11', name: 'Sami Mejri', number: 11, x: 72, y: 15, touches: 34 },
  ],
  passes: [
    { from: 'p1', to: 'p2', count: 2 },
    { from: 'p1', to: 'p3', count: 2 },
    { from: 'p1', to: 'p4', count: 4 },
    { from: 'p1', to: 'p6', count: 5 },
    { from: 'p2', to: 'p1', count: 2 },
    { from: 'p2', to: 'p3', count: 3 },
    { from: 'p2', to: 'p6', count: 1 },
    { from: 'p2', to: 'p7', count: 5 },
    { from: 'p3', to: 'p1', count: 3 },
    { from: 'p3', to: 'p2', count: 4 },
    { from: 'p3', to: 'p4', count: 3 },
    { from: 'p3', to: 'p6', count: 3 },
    { from: 'p3', to: 'p7', count: 6 },
    { from: 'p4', to: 'p1', count: 3 },
    { from: 'p4', to: 'p3', count: 1 },
    { from: 'p4', to: 'p5', count: 1 },
    { from: 'p4', to: 'p6', count: 0 },
    { from: 'p4', to: 'p8', count: 1 },
    { from: 'p5', to: 'p4', count: 0 },
    { from: 'p5', to: 'p6', count: 1 },
    { from: 'p5', to: 'p8', count: 4 },
    { from: 'p5', to: 'p11', count: 2 },
    { from: 'p6', to: 'p1', count: 3 },
    { from: 'p6', to: 'p2', count: 3 },
    { from: 'p6', to: 'p3', count: 1 },
    { from: 'p6', to: 'p4', count: 2 },
    { from: 'p6', to: 'p5', count: 2 },
    { from: 'p6', to: 'p7', count: 5 },
    { from: 'p6', to: 'p8', count: 5 },
    { from: 'p6', to: 'p10', count: 3 },
    { from: 'p7', to: 'p2', count: 2 },
    { from: 'p7', to: 'p3', count: 5 },
    { from: 'p7', to: 'p6', count: 4 },
    { from: 'p7', to: 'p8', count: 2 },
    { from: 'p7', to: 'p9', count: 6 },
    { from: 'p7', to: 'p10', count: 2 },
    { from: 'p8', to: 'p4', count: 1 },
    { from: 'p8', to: 'p5', count: 5 },
    { from: 'p8', to: 'p6', count: 2 },
    { from: 'p8', to: 'p7', count: 2 },
    { from: 'p8', to: 'p10', count: 3 },
    { from: 'p8', to: 'p11', count: 6 },
    { from: 'p9', to: 'p7', count: 1 },
    { from: 'p9', to: 'p10', count: 1 },
    { from: 'p10', to: 'p6', count: 3 },
    { from: 'p10', to: 'p7', count: 3 },
    { from: 'p10', to: 'p8', count: 5 },
    { from: 'p10', to: 'p9', count: 4 },
    { from: 'p10', to: 'p11', count: 1 },
    { from: 'p11', to: 'p5', count: 2 },
    { from: 'p11', to: 'p8', count: 4 },
    { from: 'p11', to: 'p10', count: 1 },
  ],
};

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

/** Passes between the players of a team, each one at the average place where he touched the ball. */
interface PassMapSpec extends Base {
  type: 'passmap';
  /** `x` from the own goal (0) to the goal attacked (100), `y` across, both from 0 to 100. */
  players: { id: string; name: string; number?: number; x: number; y: number; touches?: number }[];
  /** Passes from one player to another; both ways are added on one link. */
  passes: { from: string; to: string; count: number }[];
  /** Links with fewer passes are not drawn: 3 by default. */
  min?: number;
  team?: string;
  color?: string;
  onItemClick?: (id: string) => void;
}

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