Explanation of SVG parameters & the JSON format

↩ To parliament creator

Below is an example of the JSON format accepted by the parliament diagram creator, followed by an explanation of each field.

{
  "min_nrows": 0,
  "seat_radius_factor": 1,
  "span_angle": 180,
  "canvas_size": 200,
  "margins": 5.0,
  "write_number_of_seats": true,
  "font_size_factor": 0.2057,
  "attrib": [
    {
      "data": "Party A",
      "color": "#992A2A",
      "border_size": 0,
      "border_color": "#000000",
      "nseats": 77
    },
    {
      "data": "Party B",
      "color": "#4466FF",
      "border_size": 1,
      "border_color": "#000000",
      "nseats": 43
    }
  ]
}

Global parameters (from documentation)

Field Default Description
min_nrows 0 The minimum number of rows to use. Only taken into account if the required number of rows to hold the given number of seats is less than that. Defaults to 0, which means using the minimum number of rows possible.
seat_radius_factor 1 The ratio of the seats radius over the row thickness. Defaults to 1, which makes seats touch their neighbors.
span_angle 180 The angle in degrees that the diagram spans. 180 produces a standard semicircle. Values less than 180 produce a narrower arc. Values above 180 are not supported.
canvas_size 200 The height of the 2:1 rectangle in which the hemicycle will be drawn.
margins 5.0 The margins around that rectangle. If four values are given, they are the left, top, right, and bottom margins, in that order. If two values are given, they are the horizontal and vertical margins, in that order. If one value is given, it is used for all four margins.
write_number_of_seats false Whether to write the total number of seats at the bottom center of the diagram - in the well of the House.
font_size_factor 0.2057 Scales the size of the seat count label shown when write_number_of_seats is enabled.

Party fields (attrib)

A factor you should tweak to change the font size of the number of seats. The default value is 0.2057. Keeping this constant will keep the font size in scale when changing the canvas size.

Field Description
data Metadata about the group of seats, which will end up in the SVG file. Typically the name of the party or of the member.
color The fill colour of the seat dots for this party, as a hex colour code (e.g. #992A2A).
border_size The thickness of the outline drawn around each seat dot. Defaults to 0 (no outline).
border_color The colour of the outline, as a hex colour code. Only visible when border_size is greater than 0.
nseats The number of seats this party holds.