JSON Format Explanation

↩ 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

Field Default Description
min_nrows 0 The minimum number of concentric arcs of seats in the diagram. If the total number of seats requires fewer arcs than this value, extra empty arcs will be added.
seat_radius_factor 1 Scales the size of each individual seat dot. Values greater than 1 make seats larger; values less than 1 make them smaller.
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 size of the output SVG canvas in arbitrary units. Larger values produce a higher-resolution SVG.
margins 5.0 The amount of blank space added around the diagram within the canvas, in the same units as canvas_size.
write_number_of_seats false If true, the total number of seats is printed as a label in the centre of the diagram.
font_size_factor 0.2057 Scales the size of the seat count label shown when write_number_of_seats is enabled.

Party fields (attrib)

The attrib array contains one object per party or group. Parties are drawn in the order they appear, filling from the outermost arc inward.

Field Description
data The name of the party or group. Used as a label in the diagram legend.
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.