Skip to main content

Module chart

Module chart 

Source
Expand description

A run of magnitudes against one axis, rendered as bars.

meter’s neighbour and its opposite in one respect: a meter draws one proportion and computes the width from the pair it is handed, and this draws a series and computes nothing. Both numbers reach the markup as they were given, and the division happens in CSS.

§Why the arithmetic is in the stylesheet

Not taste, and not an optimisation. quasi-declare derives a compiled template by rendering a screen with stand-in values and keeping the bytes that no request reaches; a number the description HANDS a renderer is found in that render and becomes a hole, and a number the renderer WORKS OUT from two of them is printed as its arithmetic, leaves no stand-in to find, and is baked into the template as a constant. quasi_router::stage::number_at says so in as many words.

So a chart drawn from a width this crate computed could be described and could not be compiled, which for MNW’s revenue chart is the difference between a screen on the seam and the one screen left off it. --value and --most are printed with {} and reach the markup as themselves, and chart_rules divides them where a browser can.

It costs nothing and reads better: the DOM carries the two real numbers rather than a percentage with nothing behind it, which is makeover_layout::Chart’s own argument for carrying the pair.

Both ride in VARS_ATTR rather than in style, so a page whose policy refuses style attributes still draws its bars.

Constants§

CHART_CLASSES
Every class this module can put in markup.

Functions§

bar_text
What a bar says when a pointer rests on it, or nothing.
chart_html
A chart as a returned string.
chart_html_into
A chart as a run of bars, written into a buffer the caller already has.
chart_html_placed
A chart, saying where each bar landed.
rules
The rules, for the stylesheet builder.