Fude.Annotation (Fude v0.1.0)

Copy Markdown View Source

A note on a chart, at a place of its data: what a graphics desk writes on a chart to tell its story.

chart
|> Fude.annotate(:label, x: "North", y: 136_000, text: "Best quarter on record")
|> Fude.annotate(:band, x: {~D[2026-03-01], ~D[2026-05-01]}, text: "Launch")
|> Fude.annotate(:line, y: 4000, text: "Goal")

The places are values of the data, on the chart's own scales: a category's name, a date, a number.

  • :label - words with a line to a point (x and y; with x alone, the top of the chart at that x).
  • :band - a shaded range of x or of y ({from, to}), with words at its top.
  • :line - a line across the chart at an x or a y, with words.

Summary

Functions

An annotation of a type; raises an ArgumentError that says what is wrong.

Types

place()

@type place() :: term() | {term(), term()}

t()

@type t() :: %Fude.Annotation{
  id: String.t() | nil,
  text: String.t() | nil,
  type: type(),
  x: place(),
  y: place()
}

type()

@type type() :: :label | :band | :line

Functions

new(type, opts)

@spec new(type(), keyword()) :: t()

An annotation of a type; raises an ArgumentError that says what is wrong.