AletheiaAsriel

Documentation for the parliament diagram creator

Back

Existing documentation for Gouvernathor's parliament diagram creator covers the function of the Python code which generates the SVG image from the JSON input. Unfortunately, any description of the JSON format used by the Python code is lacking, and so this page provides information on the expected JSON input format.

The JSON input is as follows:

    {
    "attrib": [
        {
            "data": "Party 1",
            "color": "#992A2A",
            "border_size": 0,
            "border_color": "#000000",
            "nseats": 77
        },
        {
            "data": "Party 2",
            "color": "#CEAC00",
            "border_size": 0,
            "border_color": "#000000",
            "nseats": 91
        }
        ...
    ],
    "min_nrows": 0,
    "seat_radius_factor": 1,
    "span_angle": 180,
    "canvas_size": 175,
    "margins": 5.0,
    "write_number_of_seats": true,
    "font_size_factor": 0.2
    }

Party Information (attrib)

An array of objects, where each object represents a party with the following fields:

  • data (string): The name of the party
  • color (string): The fill color of the party's seats in hex format (e.g., "#992A2A")
  • border_size (number): Width of the border around each seat. Must be ≥ 0
  • border_color (string): The color of the seat border in hex format (e.g., "#000000")
  • nseats (integer): Number of seats for this party. Must be > 0

Note: The total number of seats across all parties must not exceed 5000.

Diagram Settings

  • min_nrows (integer): Minimum number of rows in the diagram. Must be ≥ 0. The actual number of rows may be higher depending on the number of seats
  • seat_radius_factor (number): Controls the size of individual seats. Must be > 0. Default is 1.0, larger values make seats bigger
  • span_angle (integer): The angle in degrees that the diagram spans. Must be between 0 and 360. Default is 180 for a semicircle
  • canvas_size (integer): The size of the output SVG in arbitrary units. Must be ≥ 50
  • margins (number): The size of the margins around the diagram in the same units as canvas_size. Must be ≥ 0
  • write_number_of_seats (boolean): Whether to display the number of seats for each party
  • font_size_factor (number): Controls the size of the text showing seat numbers. Must be > 0. Default is 0.2, larger values make text bigger