pub struct Figure<'a> {
pub value: &'a str,
pub caption: &'a str,
pub tone: Tone,
}Expand description
One figure with a caption: a number and what it counts.
The dashboard shape. A large value over a small caption, several of them in a
strip: a current streak, a completion rate, a total. Added 0.11.0,
93c6a174, after goingson turned out to have five of them across five
screens with five class vocabularies for the one shape — task-overview-stat,
stat-box, month-stat-item, contact-summary-stat, sync-stat. Four put
the value above the caption and one inverts it, which is drift inside the
shape rather than a second shape.
§Why the value is text
“17”, “84%”, “12/30”, “3d”. A figure is whatever the app computed, already
formatted, and the formatting is the app’s because only it knows whether the
number is a percentage, a duration or a ratio. This carries none of the
arithmetic Meter carries, and that is the difference between them: a
meter is a proportion a renderer draws, and a figure is a fact a renderer
sets in type.
§Tone is carried, for Meter’s reason
Three of the five sites tone the figure by their own means — red/blue on
the weekly review, a ${type} class on the monthly one, sync-stat-warn on
sync. So tone is carried at every site that needs it and derived at none, and
no renderer can work out that a streak of zero is worth colouring.
§What is not here
Whether the figure answers a click. One of the five is a control — sync’s “Not Applied: 3” opens the list — and an action is not something this crate can name: nothing here knows what a route is. That belongs beside the figure in whatever layer holds the actions, the same way a row’s activation sits beside its parts rather than inside them.
The arrangement is not here either. Several figures in a strip is a set, and a renderer given them one at a time cannot tell it is looking at one; the layer that holds the tree is where the set gets said.
Fields§
§value: &'a strThe number, formatted the way the app means it to read.
caption: &'a strWhat it counts. The caption under the value.
tone: ToneWhat the figure means right now. Tone::Neutral is an ordinary fact.