Skip to content
OpenChart

Parliament

Draw legislative seats as dots in a hemicycle grouped by party, then add a multi-party chamber, hide the majority line or move it to a custom threshold.

A parliament chart draws a legislature as a hemicycle: dots packed into concentric arcs and grouped by party from left to right. It is the standard form for legislative composition, where who holds a majority is the question.

Use a pie or donut for shares of a whole that is not a set of seats, or a waffle chart when the units are not seats. A bar chart ranks groups by size more precisely than a hemicycle does.

The demos on this page draw one dot per five seats, computed from the seat counts, to keep the page light. The mark draws one dot per unit of the theta value, so a spec with one dot per seat just uses the seat counts.

A basic parliament

Set mark to "parliament", put the count on theta and the party on color. Order the data left to right by political group, because the layout keeps that order across the arc. Party colors usually come from an explicit scale.range. A majority line and an “N to win” label are drawn by default, and majorityLine on the mark can replace the label text. Here it names the real threshold of 218 seats, because the dot count is a fifth of the seat count.

DemocraticRepublicanRepublicans hold a narrow House majorityUS House of Representatives, 435 seats. Each dot is five seats.DemocraticRepublicanRepublicans hold a narrow House majorityUS House of Representatives, 435 seats. Each dot is five seats.
US House seats by party. Source: Illustrative data.
{
  "mark": {
    "type": "parliament",
    "majorityLine": {
      "seats": 44,
      "label": "218 seats to win"
    }
  },
  "data": [
    {
      "party": "Democratic",
      "dots": 43
    },
    {
      "party": "Republican",
      "dots": 44
    }
  ],
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "party",
      "type": "nominal",
      "scale": {
        "domain": [
          "Democratic",
          "Republican"
        ],
        "range": [
          "#1b7fa3",
          "#c44e52"
        ]
      }
    }
  },
  "chrome": {
    "title": "Republicans hold a narrow House majority",
    "subtitle": "US House of Representatives, 435 seats. Each dot is five seats."
  }
}
import { Chart } from "@opendata-ai/openchart-react";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const spec: ChartSpec = {
  "mark": {
    "type": "parliament",
    "majorityLine": {
      "seats": 44,
      "label": "218 seats to win"
    }
  },
  "data": [/* 2 rows, as in the Spec tab; Copy includes them */],
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "party",
      "type": "nominal",
      "scale": {
        "domain": [
          "Democratic",
          "Republican"
        ],
        "range": [
          "#1b7fa3",
          "#c44e52"
        ]
      }
    }
  },
  "chrome": {
    "title": "Republicans hold a narrow House majority",
    "subtitle": "US House of Representatives, 435 seats. Each dot is five seats."
  }
};

export function Example() {
  return <Chart spec={spec} />;
}
<script setup lang="ts">
import { Chart } from "@opendata-ai/openchart-vue";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const spec: ChartSpec = {
  "mark": {
    "type": "parliament",
    "majorityLine": {
      "seats": 44,
      "label": "218 seats to win"
    }
  },
  "data": [/* 2 rows, as in the Spec tab; Copy includes them */],
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "party",
      "type": "nominal",
      "scale": {
        "domain": [
          "Democratic",
          "Republican"
        ],
        "range": [
          "#1b7fa3",
          "#c44e52"
        ]
      }
    }
  },
  "chrome": {
    "title": "Republicans hold a narrow House majority",
    "subtitle": "US House of Representatives, 435 seats. Each dot is five seats."
  }
};
</script>

<template>
  <Chart :spec="spec" />
</template>
<script lang="ts">
import { Chart } from "@opendata-ai/openchart-svelte";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const spec: ChartSpec = {
  "mark": {
    "type": "parliament",
    "majorityLine": {
      "seats": 44,
      "label": "218 seats to win"
    }
  },
  "data": [/* 2 rows, as in the Spec tab; Copy includes them */],
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "party",
      "type": "nominal",
      "scale": {
        "domain": [
          "Democratic",
          "Republican"
        ],
        "range": [
          "#1b7fa3",
          "#c44e52"
        ]
      }
    }
  },
  "chrome": {
    "title": "Republicans hold a narrow House majority",
    "subtitle": "US House of Representatives, 435 seats. Each dot is five seats."
  }
};
</script>

<Chart {spec} />
import { createChart } from "@opendata-ai/openchart-vanilla";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const spec: ChartSpec = {
  "mark": {
    "type": "parliament",
    "majorityLine": {
      "seats": 44,
      "label": "218 seats to win"
    }
  },
  "data": [/* 2 rows, as in the Spec tab; Copy includes them */],
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "party",
      "type": "nominal",
      "scale": {
        "domain": [
          "Democratic",
          "Republican"
        ],
        "range": [
          "#1b7fa3",
          "#c44e52"
        ]
      }
    }
  },
  "chrome": {
    "title": "Republicans hold a narrow House majority",
    "subtitle": "US House of Representatives, 435 seats. Each dot is five seats."
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);

Many groups

The same spec works with more than two groups. Here eight groups share 705 seats, ordered along the political spectrum so neighboring blocks read as a gradient. The category field can have any name; this data calls it group. No group would pass a simple majority alone, so majorityLine: false hides the line and its label. Use it when a chamber has no single voting threshold to show.

LeftGreensS&DRenewEPPECRIDNon-attachedNo group holds a majority alone705 seats ordered left to right by political group. Each dot is five seats.LeftGreensS&DRenewEPPECRIDNon-attachedNo group holds a majority alone705 seats ordered left to right by political group. Each dot is five seats.
A chamber with eight groups. Source: Illustrative data.
{
  "mark": {
    "type": "parliament",
    "majorityLine": false
  },
  "data": [
    {
      "group": "Left",
      "dots": 8
    },
    {
      "group": "Greens",
      "dots": 14
    },
    {
      "group": "S&D",
      "dots": 28
    },
    {
      "group": "Renew",
      "dots": 20
    },
    {
      "group": "EPP",
      "dots": 36
    },
    {
      "group": "ECR",
      "dots": 14
    },
    {
      "group": "ID",
      "dots": 10
    },
    {
      "group": "Non-attached",
      "dots": 12
    }
  ],
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "group",
      "type": "nominal",
      "scale": {
        "domain": [
          "Left",
          "Greens",
          "S&D",
          "Renew",
          "EPP",
          "ECR",
          "ID",
          "Non-attached"
        ],
        "range": [
          "#8b1a1a",
          "#3d9970",
          "#c44e52",
          "#f0a202",
          "#1b7fa3",
          "#2c3e88",
          "#5b6ee1",
          "#8a8f98"
        ]
      }
    }
  },
  "chrome": {
    "title": "No group holds a majority alone",
    "subtitle": "705 seats ordered left to right by political group. Each dot is five seats."
  }
}
import { Chart } from "@opendata-ai/openchart-react";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "parliament",
    "majorityLine": false
  },
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "group",
      "type": "nominal",
      "scale": {
        "domain": [
          "Left",
          "Greens",
          "S&D",
          "Renew",
          "EPP",
          "ECR",
          "ID",
          "Non-attached"
        ],
        "range": [
          "#8b1a1a",
          "#3d9970",
          "#c44e52",
          "#f0a202",
          "#1b7fa3",
          "#2c3e88",
          "#5b6ee1",
          "#8a8f98"
        ]
      }
    }
  },
  "chrome": {
    "title": "No group holds a majority alone",
    "subtitle": "705 seats ordered left to right by political group. Each dot is five seats."
  }
};

export function Example() {
  return <Chart spec={spec} />;
}
<script setup lang="ts">
import { Chart } from "@opendata-ai/openchart-vue";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "parliament",
    "majorityLine": false
  },
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "group",
      "type": "nominal",
      "scale": {
        "domain": [
          "Left",
          "Greens",
          "S&D",
          "Renew",
          "EPP",
          "ECR",
          "ID",
          "Non-attached"
        ],
        "range": [
          "#8b1a1a",
          "#3d9970",
          "#c44e52",
          "#f0a202",
          "#1b7fa3",
          "#2c3e88",
          "#5b6ee1",
          "#8a8f98"
        ]
      }
    }
  },
  "chrome": {
    "title": "No group holds a majority alone",
    "subtitle": "705 seats ordered left to right by political group. Each dot is five seats."
  }
};
</script>

<template>
  <Chart :spec="spec" />
</template>
<script lang="ts">
import { Chart } from "@opendata-ai/openchart-svelte";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "parliament",
    "majorityLine": false
  },
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "group",
      "type": "nominal",
      "scale": {
        "domain": [
          "Left",
          "Greens",
          "S&D",
          "Renew",
          "EPP",
          "ECR",
          "ID",
          "Non-attached"
        ],
        "range": [
          "#8b1a1a",
          "#3d9970",
          "#c44e52",
          "#f0a202",
          "#1b7fa3",
          "#2c3e88",
          "#5b6ee1",
          "#8a8f98"
        ]
      }
    }
  },
  "chrome": {
    "title": "No group holds a majority alone",
    "subtitle": "705 seats ordered left to right by political group. Each dot is five seats."
  }
};
</script>

<Chart {spec} />
import { createChart } from "@opendata-ai/openchart-vanilla";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "parliament",
    "majorityLine": false
  },
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "group",
      "type": "nominal",
      "scale": {
        "domain": [
          "Left",
          "Greens",
          "S&D",
          "Renew",
          "EPP",
          "ECR",
          "ID",
          "Non-attached"
        ],
        "range": [
          "#8b1a1a",
          "#3d9970",
          "#c44e52",
          "#f0a202",
          "#1b7fa3",
          "#2c3e88",
          "#5b6ee1",
          "#8a8f98"
        ]
      }
    }
  },
  "chrome": {
    "title": "No group holds a majority alone",
    "subtitle": "705 seats ordered left to right by political group. Each dot is five seats."
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);

A custom threshold

majorityLine takes an object to move the line. seats sets the threshold, here 470 seats scaled to dots, which is two thirds of 705, and label replaces the default “N to win” text. A seats value outside the range from 1 to the total warns and falls back to a simple majority.

LeftGreensS&DRenewEPPECRIDNon-attachedThe line can mark a supermajority instead705 seats with the threshold set to 470. Each dot is five seats.LeftGreensS&DRenewEPPECRIDNon-attachedThe line can mark a supermajority instead705 seats with the threshold set to 470. Each dot is five seats.
A two-thirds threshold. Source: Illustrative data.
{
  "mark": {
    "type": "parliament",
    "majorityLine": {
      "seats": 94,
      "label": "470 seats for two-thirds"
    }
  },
  "data": [
    {
      "group": "Left",
      "dots": 8
    },
    {
      "group": "Greens",
      "dots": 14
    },
    {
      "group": "S&D",
      "dots": 28
    },
    {
      "group": "Renew",
      "dots": 20
    },
    {
      "group": "EPP",
      "dots": 36
    },
    {
      "group": "ECR",
      "dots": 14
    },
    {
      "group": "ID",
      "dots": 10
    },
    {
      "group": "Non-attached",
      "dots": 12
    }
  ],
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "group",
      "type": "nominal",
      "scale": {
        "domain": [
          "Left",
          "Greens",
          "S&D",
          "Renew",
          "EPP",
          "ECR",
          "ID",
          "Non-attached"
        ],
        "range": [
          "#8b1a1a",
          "#3d9970",
          "#c44e52",
          "#f0a202",
          "#1b7fa3",
          "#2c3e88",
          "#5b6ee1",
          "#8a8f98"
        ]
      }
    }
  },
  "chrome": {
    "title": "The line can mark a supermajority instead",
    "subtitle": "705 seats with the threshold set to 470. Each dot is five seats."
  }
}
import { Chart } from "@opendata-ai/openchart-react";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "parliament",
    "majorityLine": {
      "seats": 94,
      "label": "470 seats for two-thirds"
    }
  },
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "group",
      "type": "nominal",
      "scale": {
        "domain": [
          "Left",
          "Greens",
          "S&D",
          "Renew",
          "EPP",
          "ECR",
          "ID",
          "Non-attached"
        ],
        "range": [
          "#8b1a1a",
          "#3d9970",
          "#c44e52",
          "#f0a202",
          "#1b7fa3",
          "#2c3e88",
          "#5b6ee1",
          "#8a8f98"
        ]
      }
    }
  },
  "chrome": {
    "title": "The line can mark a supermajority instead",
    "subtitle": "705 seats with the threshold set to 470. Each dot is five seats."
  }
};

export function Example() {
  return <Chart spec={spec} />;
}
<script setup lang="ts">
import { Chart } from "@opendata-ai/openchart-vue";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "parliament",
    "majorityLine": {
      "seats": 94,
      "label": "470 seats for two-thirds"
    }
  },
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "group",
      "type": "nominal",
      "scale": {
        "domain": [
          "Left",
          "Greens",
          "S&D",
          "Renew",
          "EPP",
          "ECR",
          "ID",
          "Non-attached"
        ],
        "range": [
          "#8b1a1a",
          "#3d9970",
          "#c44e52",
          "#f0a202",
          "#1b7fa3",
          "#2c3e88",
          "#5b6ee1",
          "#8a8f98"
        ]
      }
    }
  },
  "chrome": {
    "title": "The line can mark a supermajority instead",
    "subtitle": "705 seats with the threshold set to 470. Each dot is five seats."
  }
};
</script>

<template>
  <Chart :spec="spec" />
</template>
<script lang="ts">
import { Chart } from "@opendata-ai/openchart-svelte";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "parliament",
    "majorityLine": {
      "seats": 94,
      "label": "470 seats for two-thirds"
    }
  },
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "group",
      "type": "nominal",
      "scale": {
        "domain": [
          "Left",
          "Greens",
          "S&D",
          "Renew",
          "EPP",
          "ECR",
          "ID",
          "Non-attached"
        ],
        "range": [
          "#8b1a1a",
          "#3d9970",
          "#c44e52",
          "#f0a202",
          "#1b7fa3",
          "#2c3e88",
          "#5b6ee1",
          "#8a8f98"
        ]
      }
    }
  },
  "chrome": {
    "title": "The line can mark a supermajority instead",
    "subtitle": "705 seats with the threshold set to 470. Each dot is five seats."
  }
};
</script>

<Chart {spec} />
import { createChart } from "@opendata-ai/openchart-vanilla";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "parliament",
    "majorityLine": {
      "seats": 94,
      "label": "470 seats for two-thirds"
    }
  },
  "encoding": {
    "theta": {
      "field": "dots",
      "type": "quantitative"
    },
    "color": {
      "field": "group",
      "type": "nominal",
      "scale": {
        "domain": [
          "Left",
          "Greens",
          "S&D",
          "Renew",
          "EPP",
          "ECR",
          "ID",
          "Non-attached"
        ],
        "range": [
          "#8b1a1a",
          "#3d9970",
          "#c44e52",
          "#f0a202",
          "#1b7fa3",
          "#2c3e88",
          "#5b6ee1",
          "#8a8f98"
        ]
      }
    }
  },
  "chrome": {
    "title": "The line can mark a supermajority instead",
    "subtitle": "705 seats with the threshold set to 470. Each dot is five seats."
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);

Fields that matter

Field What it does
mark "parliament", or an object that sets majorityLine, seatRadius and shape.
mark.majorityLine true by default. false hides it; { seats, label } sets a custom threshold and text.
mark.seatRadius Dot radius in pixels. "auto" sizes dots to fill the rings.
encoding.theta The count of each party, one dot per unit.
encoding.color The party. scale.domain and scale.range pin parties to colors.