GanttEx.Marker (GanttEx v0.1.0)

Copy Markdown View Source

A vertical line on the timeline marking a date (a release, a freeze, today...).

Markers are given to GanttEx.Live.Gantt with the markers attribute; today_marker adds one for the current date.

iex> {:ok, marker} = GanttEx.Marker.new(%{date: "2025-03-01", text: "Release", color: "#e11d48"})
iex> {marker.date, marker.text, marker.color}
{~N[2025-03-01 00:00:00], "Release", "#e11d48"}

iex> GanttEx.Marker.new(text: "No date")
{:error, {:invalid, :date}}

Summary

Functions

Builds a marker from a map or keyword list.

Like new/1 but raises ArgumentError.

Types

t()

@type t() :: %GanttEx.Marker{
  class: String.t() | nil,
  color: String.t() | nil,
  date: NaiveDateTime.t(),
  id: term(),
  text: String.t()
}

Functions

new(marker)

@spec new(map() | keyword() | t()) :: {:ok, t()} | {:error, {:invalid, atom()}}

Builds a marker from a map or keyword list.

new!(attrs)

@spec new!(map() | keyword() | t()) :: t()

Like new/1 but raises ArgumentError.