A layer's datum attributes, declared events and hover text (spec/04 §1.9), copied from
visualize's Visualize.Chart.Mark tooltip part and the server half of
Visualize.Hooks.Tooltip.
A layer's tooltip node (fields, template, event, context_event, show) asks
it to carry each row's fields on its elements for the tooltip hook to show with no round
trip:
- each named field is written as a datum attribute (
Macaw.Draw.IR.Element.datum/3,_as-),to_string/1of its value, with its declared name beside it where the slot's schema names the value;[]writes every column in sorted order (element/4); - the group carries
data-tooltip-templateand, when given,data-tooltip-eventanddata-tooltip-context-event(group/1); show: falsekeeps the keys and events and shows nothing on hover; with it, only the namedfieldsare written.
event and context_event are names the Frame declares as its events: a click on
an element emits an event of that name (event/4), its identity the row's declared
identity (or nil), its value the row's declared fields as [field, value] pairs,
never a row ordinal. The two names may not be equal ({:same_name, :event} at
context_event), and a name the runtime reserves is {:reserved, :event, name}
(check/2).
Summary
Functions
The faults of a tooltip node's event names at path (§1.9): a reserved name at its key,
and a context_event equal to event.
An element with its row's datum attributes (§1.9): the tooltip's named fields read
from row, or every column with a text form in sorted order where it names none and
shows them; under show: false with no fields, none. schema names declared values.
The event a click on an element of a layer emits (§1.9): %{name, identity, value},
name the tooltip's event (or context_event with context: true), identity the
row's declared identity by schema (or nil), value the row's declared fields as
[field, value] pairs in the schema's field order. :none without such an event.
Whether the tooltip declares a click or a context event.
Whether a tooltip node writes every column of an element's row (§1.9): it names no
fields and shows them. A declared event alone reads no row where the layer draws: the
item's identity and value are written by column (Macaw.Frame.Events.write/3).
The group's tooltip attributes (§1.9): data-tooltip-template, data-tooltip-event,
data-tooltip-context-event where given, and data-tooltip-show="false".
The event names the runtime reserves.
Whether a tooltip node needs each element's whole row: it names no fields and shows them, or it has an event (whose value is the row's declared fields).
An element with its row's datum attributes, as writer/2 settled them (§1.9).
A tooltip node's datum attributes settled for a whole layer (§1.9): the attribute
names, the listing and each field's declared names, read once, so write/3 writes a
row's attributes from its values alone. nil for no tooltip or none to write, :every
for a node that writes every column. write(element, row, writer(tooltip, schema))
is element(element, row, tooltip, schema).
Types
Functions
@spec check(term(), list()) :: [Macaw.Base.Fault.t()]
The faults of a tooltip node's event names at path (§1.9): a reserved name at its key,
and a context_event equal to event.
iex> Macaw.Frame.Layer.Tooltip.check(%{"event" => "zoom", "context_event" => "zoom"}, [:tooltip])
[{[:tooltip, :event], {:reserved, :event, "zoom"}},
{[:tooltip, :context_event], {:reserved, :event, "zoom"}},
{[:tooltip, :context_event], {:same_name, :event}}]
@spec element( Macaw.Draw.IR.Element.t(), map(), map() | nil, Macaw.Data.Schema.t() | nil ) :: Macaw.Draw.IR.Element.t()
An element with its row's datum attributes (§1.9): the tooltip's named fields read
from row, or every column with a text form in sorted order where it names none and
shows them; under show: false with no fields, none. schema names declared values.
@spec event(map() | nil, map(), Macaw.Data.Schema.t() | nil, keyword()) :: map() | :none
The event a click on an element of a layer emits (§1.9): %{name, identity, value},
name the tooltip's event (or context_event with context: true), identity the
row's declared identity by schema (or nil), value the row's declared fields as
[field, value] pairs in the schema's field order. :none without such an event.
Whether the tooltip declares a click or a context event.
Whether a tooltip node writes every column of an element's row (§1.9): it names no
fields and shows them. A declared event alone reads no row where the layer draws: the
item's identity and value are written by column (Macaw.Frame.Events.write/3).
The group's tooltip attributes (§1.9): data-tooltip-template, data-tooltip-event,
data-tooltip-context-event where given, and data-tooltip-show="false".
@spec reserved() :: [String.t(), ...]
The event names the runtime reserves.
Whether a tooltip node needs each element's whole row: it names no fields and shows them, or it has an event (whose value is the row's declared fields).
@spec write(Macaw.Draw.IR.Element.t(), map(), writer() | tuple()) :: Macaw.Draw.IR.Element.t()
An element with its row's datum attributes, as writer/2 settled them (§1.9).
@spec writer(map() | nil, Macaw.Data.Schema.t() | nil) :: writer()
A tooltip node's datum attributes settled for a whole layer (§1.9): the attribute
names, the listing and each field's declared names, read once, so write/3 writes a
row's attributes from its values alone. nil for no tooltip or none to write, :every
for a node that writes every column. write(element, row, writer(tooltip, schema))
is element(element, row, tooltip, schema).