PhiaUi.Components.Data.BarTotals (phia_ui v0.1.17)

Copy Markdown View Source

Sum labels rendered above stacked bar groups — pure SVG, zero JS.

Inspired by Nivo's BarTotals layer. Renders <text> elements showing the total value at the top of each stacked bar group.

Designed to be composed inside a bar chart or xy_chart SVG.

Examples

<.bar_totals totals={[
  %{x: 72.0, y: 20.0, label: "350"},
  %{x: 152.0, y: 30.0, label: "280"}
]} />

Summary

Functions

bar_totals(assigns)

Attributes

  • totals (:list) (required) - List of %{x, y, label} for each group total.
  • font_size (:string) - Override font size (defaults to theme). Defaults to nil.
  • offset (:integer) - Pixels above bar top. Defaults to 6.
  • theme (:map) - Chart theme overrides. Defaults to %{}.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.