pub struct Chart<M = ()>(/* private fields */);Expand description
chart: bars, a sparkline, a heatmap, a line or area chart or a
donut.
Its min/max are a number value domain, not the common size
bounds.
Implementations§
Source§impl<M> Chart<M>
impl<M> Chart<M>
Sourcepub fn key(self, key: impl Into<NodeKey>) -> Self
pub fn key(self, key: impl Into<NodeKey>) -> Self
Identity among siblings: keeps the node’s id (and Tern’s view state) across reorders. A string, or an integer.
Sourcepub fn role(self, role: impl Into<String>) -> Self
pub fn role(self, role: impl Into<String>) -> Self
A name of yours, exposed to CSS as data-role.
Keeps the node mounted but not laid out.
Sourcepub fn mark(self, mark: impl Into<Mark>) -> Self
pub fn mark(self, mark: impl Into<Mark>) -> Self
A transient selection mark drawn over the node.
Sourcepub fn aria(self, aria: impl Into<String>) -> Self
pub fn aria(self, aria: impl Into<String>) -> Self
The accessible name of a node that shows no text.
Sourcepub fn hovercard<N>(self, card: impl Into<Node<N>>) -> Self
pub fn hovercard<N>(self, card: impl Into<Node<N>>) -> Self
A floating card of card’s tree shown while the pointer rests on
the node, in place of title. Sent id-less (ids, keys and handlers
inside are ignored); an older Tern ignores it.
Sourcepub fn href(self, href: impl Into<String>) -> Self
pub fn href(self, href: impl Into<String>) -> Self
A link: ⌘-click opens it; copy and open use it.
Sourcepub fn basis(self, basis: impl Into<Basis>) -> Self
pub fn basis(self, basis: impl Into<Basis>) -> Self
Flex basis: a fraction of the parent, or the content’s size.
Sourcepub fn prop(self, name: &str, value: impl Serialize) -> Self
pub fn prop(self, name: &str, value: impl Serialize) -> Self
Sets any prop untyped; null removes it.
Sourcepub fn on_click(self, msg: M) -> Self
pub fn on_click(self, msg: M) -> Self
Sends msg on a click (sets actions.click to "click" unless
the node names its click action itself).
Sourcepub fn on_dblclick(self, msg: M) -> Self
pub fn on_dblclick(self, msg: M) -> Self
Sends msg on a double click (sets actions.dblclick to
"dblclick" unless the node names it).
Adds act to the context menu and sends msg when it is picked.
Sourcepub fn on_action(self, act: impl Into<String>, msg: M) -> Self
pub fn on_action(self, act: impl Into<String>, msg: M) -> Self
Sends msg on action events whose action is act (name or
name=value).
Sourcepub fn on_action_with(
self,
act: impl Into<String>,
f: impl Fn(&Action) -> M + Send + Sync + 'static,
) -> Self
pub fn on_action_with( self, act: impl Into<String>, f: impl Fn(&Action) -> M + Send + Sync + 'static, ) -> Self
Maps action events whose action is act to a message.
Sourcepub fn on_toggle(self, f: impl Fn(bool) -> M + Send + Sync + 'static) -> Self
pub fn on_toggle(self, f: impl Fn(bool) -> M + Send + Sync + 'static) -> Self
Maps toggle events (the new collapsed; a menu, select or trace
line that opened is not collapsed) to a message.
Sourcepub fn on_select(self, f: impl Fn(&str) -> M + Send + Sync + 'static) -> Self
pub fn on_select(self, f: impl Fn(&str) -> M + Send + Sync + 'static) -> Self
Maps select events (the item) to a message. On a list’s item the
item’s own handler runs first.
Sourcepub fn on_activate(self, f: impl Fn(&str) -> M + Send + Sync + 'static) -> Self
pub fn on_activate(self, f: impl Fn(&str) -> M + Send + Sync + 'static) -> Self
Maps activate events (the item) to a message.
Sourcepub fn on_change(self, f: impl Fn(&Change) -> M + Send + Sync + 'static) -> Self
pub fn on_change(self, f: impl Fn(&Change) -> M + Send + Sync + 'static) -> Self
Maps change events to a message.
Sourcepub fn on_edit(self, f: impl Fn(&Edit) -> M + Send + Sync + 'static) -> Self
pub fn on_edit(self, f: impl Fn(&Edit) -> M + Send + Sync + 'static) -> Self
Maps edit events (native editing) to a message.
Sourcepub fn on_send(self, f: impl Fn(&str) -> M + Send + Sync + 'static) -> Self
pub fn on_send(self, f: impl Fn(&str) -> M + Send + Sync + 'static) -> Self
Maps send events (the text to submit) to a message.
Sourcepub fn token(self, value: impl Into<String>) -> Self
pub fn token(self, value: impl Into<String>) -> Self
The fill color token (the first series’ color).
Sourcepub fn series(self, value: impl Into<Vec<Point>>) -> Self
pub fn series(self, value: impl Into<Vec<Point>>) -> Self
bars/spark: one bar per entry; line/area: one point per
entry; donut: one segment per entry.
Sourcepub fn multi_series(self, value: impl Into<Vec<Series>>) -> Self
pub fn multi_series(self, value: impl Into<Vec<Series>>) -> Self
line/area: several series, one line each.
Sourcepub fn labels(self, value: impl Into<Vec<String>>) -> Self
pub fn labels(self, value: impl Into<Vec<String>>) -> Self
line/area: the x labels by point index.
Sourcepub fn unit(self, value: impl Into<String>) -> Self
pub fn unit(self, value: impl Into<String>) -> Self
line/area/donut: written with every value printed: a currency
symbol ($, €, £, ¥) leads it, %, × and ° attach after it,
words follow a space.
Sourcepub fn last(self, value: impl Into<TextFlag>) -> Self
pub fn last(self, value: impl Into<TextFlag>) -> Self
line/area with one series: the label beside the last point
(true its value, text replaces it, false hides it).
Sourcepub fn total(self, value: impl Into<Text>) -> Self
pub fn total(self, value: impl Into<Text>) -> Self
donut: what the ring’s middle says (default the total).
Sourcepub fn min(self, value: impl Into<f64>) -> Self
pub fn min(self, value: impl Into<f64>) -> Self
bars/spark/line/area: the value domain’s low end (default
0); values are clamped into it.
Sourcepub fn max(self, value: impl Into<f64>) -> Self
pub fn max(self, value: impl Into<f64>) -> Self
bars/spark/line/area: the value domain’s high end
(default the largest series or mark value).
Sourcepub fn marks(self, value: impl Into<Vec<ChartMark>>) -> Self
pub fn marks(self, value: impl Into<Vec<ChartMark>>) -> Self
bars/spark/line/area: dashed reference lines in value
units.
Sourcepub fn cells(self, value: impl Into<Vec<Vec<Option<f64>>>>) -> Self
pub fn cells(self, value: impl Into<Vec<Vec<Option<f64>>>>) -> Self
heatmap: rows of intensities 0–1.