PhiaUi.Components.ParliamentChart (phia_ui v0.1.17)

Copy Markdown View Source

Parliament chart — pure SVG, zero JS.

Semicircle of dots representing parliamentary seats. Seats are distributed in concentric semicircular rows from inner to outer arc. Each party fills seats sequentially so the semicircle is visually grouped by faction.

Examples

<.parliament_chart data={[
  %{label: "Party A", value: 120},
  %{label: "Party B", value: 80},
  %{label: "Party C", value: 30},
  %{label: "Independent", value: 10}
]} />

<.parliament_chart
  data={[%{label: "Yes", value: 60}, %{label: "No", value: 40}]}
  colors={["oklch(0.60 0.20 240)", "oklch(0.60 0.25 0)"]}
  seat_radius={4}
/>

Summary

Functions

parliament_chart(assigns)

Attributes

  • data (:list) - Party data: [%{label, value}] where value = seat count. Defaults to [].
  • colors (:list) - Override default palette. CSS color strings. Defaults to [].
  • seat_radius (:integer) - Radius of each seat dot in pixels. Defaults to 5.
  • animate (:boolean) - Enable entrance animations. Defaults to true.
  • animation_duration (:integer) - Animation duration in ms. Defaults to 600.
  • theme (:map) - Chart theme overrides (see ChartTheme). Defaults to %{}.
  • id (:string) - Unique ID for the chart (auto-generated if not provided). Defaults to nil.
  • title (:string) - Chart title rendered above the visualization. Defaults to nil.
  • description (:string) - Chart description for context (rendered below title). Defaults to nil.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.