Generate parliament charts as virtual-dom SVG
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs fix backspace issue Oct 18, 2017
lib soothe the linter Nov 1, 2018
.editorconfig update dotfiles Sep 3, 2018
.eslintrc.json add node 10, add linter, index -> lib/index, code style Nov 1, 2018
.gitignore update dotfiles Sep 3, 2018
package.json 2.1.3 Nov 1, 2018 add live demo link Sep 3, 2018


Generate parliament charts as virtual-dom SVG. Design inspired by the Wikipedia parliament charts. Play around with the live demo! For westminster-style parliament charts, see westminster-svg. If you are using D3, you might prefer working with the d3-parliament module.

npm version Build Status Greenkeeper badge dependency status license chat on gitter


npm install --save parliament-svg


const parliamentSVG = require('parliament-svg')

const svg = parliamentSVG(parties, seatCount)
  • parties is an object containing seat count and colour for each party
	"linke": {
		"seats": 64,
		"colour": "#a08"
	"spd": {
		"seats": 193,
		"colour": "#e02"
	"gruene": {
		"seats": 63,
		"colour": "#0b2"
	"union": {
		"seats": 311,
		"colour": "#333"

Each seat contains the party name in its class attribute.

  • seatCount is a boolean, if true the total seat count will be displayed in the chart

For the given parties object and seatCount enabled, the rendered result should look like this:

Example: German Bundestag with seat count enabled

If you want to convert the virtual DOM tree to HTML/SVG string, use virtual-dom-stringify:

const toStr = require('virtual-dom-stringify')
const svg = toStr(svg)

See also


If you found a bug or want to propose a feature, feel free to visit the issues page.