slider

A parameter the reader drags along a track, surfaced as a row in the scene's footer. It declares the parameter as well as offering it: slider:a(range: [0, 5]) is the letter a between 0 and 5, and every expression in the SCENE that mentions a re-evaluates as it moves — a control written inside one graph drives a curve in another beside it. name: is what it is called in front of the reader — rich text, so Frequency $b$ sets its own maths — and without one the row is labelled with the parameter itself. The current value is derived: prose cites it with {{#a.value}}, which reaches the control by its node id, so a control the prose cites is written with one (slider#spread:s(…)). The plain case, and the one to reach for: a quantity that moves continuously, so every value between the ends is one the reader can stop at. over: binds it to a dataset column instead, so its range, its stops and its format come from the cells rather than being written out — a slider over a column of years is a year scrubber with nothing else said, and every mark carrying a slice: over that column reads itself against it. To have the scene drive it rather than the reader, write cue.slider; to offer a handful of choices rather than a track, selector.

sliderNode
A sine wave with two sliders beneath the plot, amplitude at 2 and frequency at 1.A sine wave with two sliders beneath the plot, amplitude at 2 and frequency at 1.
Writing with it:

#Attributes

parameterRequiredImplicit
The parameter this control declares and drives — slider:a, and the whole scene's a from then on. One letter is the ordinary case, and the only one an expression can read: curve: a*x^2 reaches it by that letter. A word (selector:country) is for a parameter that never appears in a formula, and cannot be read in maths — to the expression parser country is a product of seven letters.
parameter-name
Also written: varCan be written as shorthand: slider:value
name
What the parameter is called in front of a reader. Rich text, so Frequency bb sets its own maths.
Also written: label
over
A dataset column the parameter runs over: over: #pop.year. Its cells are the stops, their span is the range, and what they are decides the format — so range: is not consulted where this is given. A column of NAMES gives a parameter whose values are those names. This is the shape long-format data arrives in, and the shape a mark's slice: reads: the mark names the column, not the parameter, and the two meet at the column.
Also written: column
format
What the values are, for the readout: numbers, dates, months, weekdays, hours, weeks or names. Every one but the last places a value on its own number line — position 1…12 for a month, a fractional year for a date — so the range stays a pair of numbers and only the reading changes. names has no number line: the values are the data's own words. auto takes the kind from the column over: names, and is numeric where no column was named.
autonumbersdatesmonthsweekdayshoursweeksnames
Also written: values
Defaultauto
range
Range interval [start, end]. Ignored where over: or options: gives the stops: those decide.
Default[-10, 10]
step
Distance between stops. Absent, 1 — or, under over:, the closest the data's own values come to each other, which is the spacing that can reach every row.
default
Where it starts. Absent, 0 — or, under over:, the first value in the column. Where the stops are names this is an INDEX among them, since a name has no number line to sit on; writing the wanted one first in options: is the usual way to say which opens.
Also written: start
hiddenAnimatable
Keeps the control out of the footer: the expressions still read the parameter, the reader cannot move it.
Defaultfalse
lock
Keeps the reader from editing it on an editable: graph.
Also written: locked
Defaultfalse
discrete
Stand on one stop at a time. Continuous (the default), the parameter moves through the gaps between stops and the marks glide with it; discrete, it snaps to the nearest — the data's own values, or the step ladder — and the marks jump from one slice to the next, for a quantity that is not a continuous function of the axis.
Also written: stepped
Defaultfalse

#Derived attributes

Computed while the element renders — read one with #id.name in attribute position or {{#id.name}} in prose, never set.

valueDerived
Where the parameter currently stands: the reader's setting, or the author's starting point where they have not moved it.

#Allowed in

#Examples

slider:a(name: steepness; range: [0, 4]; step: 0.25; default: 2)
curve(f: a * x^2; domain: [-3, 3])
slider#years:t(over: #pop.year; name: Year)
slider:m(format: months; range: [1, 12]; step: 1; name: Month)

Last updated