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 install --save parliament-svg
const parliamentSVG =const svg =
partiesis an object containing seat count and colour for each party
Each seat contains the party name in its
seatCountis a boolean, if
truethe total seat count will be displayed in the chart
For the given
parties object and
seatCount enabled, the rendered result should look like this:
If you want to convert the virtual DOM tree to HTML/SVG string, use
const toStr =const svg =
- westminster-svg - "westminster-style parliament charts"
- d3-parliament - "parliament charts for D3"
- wikidata-parliament-svg - "draws parliament graphs based on data from wikidata"
If you found a bug or want to propose a feature, feel free to visit the issues page.