PhiaUi.Components.BoxPlot (phia_ui v0.1.17)

Copy Markdown View Source

Box-and-whisker plot — pure SVG, zero JS.

Renders statistical distributions as boxes (Q1-Q3), median lines, whiskers (to the most extreme non-outlier data points), and optional outlier dots. Supports both raw value lists and pre-computed quartile statistics.

Examples

<.box_plot data={[
  %{label: "Group A", values: [12, 15, 18, 22, 25, 28, 30, 35, 45]},
  %{label: "Group B", values: [5, 10, 15, 20, 25, 30, 35, 40]}
]} />

<.box_plot data={[
  %{label: "Precomputed", q1: 15.0, median: 22.0, q3: 30.0,
    whisker_low: 12.0, whisker_high: 35.0, outliers: [5.0, 45.0]}
]} />

Summary

Functions

box_plot(assigns)

Attributes

  • data (:list) - Raw values: [%{label, values: [numbers]}] or pre-computed: [%{label, q1, median, q3, whisker_low, whisker_high, outliers}]. Defaults to [].
  • colors (:list) - Override default palette. CSS color strings. Defaults to [].
  • show_outliers (:boolean) - Show outlier dots beyond whiskers. Defaults to true.
  • show_grid (:boolean) - Show Y-axis grid lines. Defaults to true.
  • show_labels (:boolean) - Show axis tick labels. Defaults to true.
  • 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.