Attribute types

Every value you write is text until the attribute it lands in parses it. Each type below is one way of reading that text — what it accepts, and how it is written. A value its attribute cannot parse is an error at compile time, with the reason named: nothing is silently converted or dropped.

#Text

string
Any text.
Accepts
Any text
hello
Introduction to Graphs
rich-text
Inline Chalk content — formatted text, $maths$, links, and inline elements all render.
Accepts
Any inline Chalk
local maximum
the mean $\mu$
single-char
Exactly one alphabetical character.
Accepts
Single letter
x
t
letter-list
Letters separated by commas: single Latin letters or Greek letters by name (alpha, Omega), either with a subscript after _ (x_1, v_max).
Accepts
Comma-separated letters
x
w, L, v, t
x_1, x_2, alpha

#Numbers

number
A numeric literal. class decides whether a fractional part is allowed AND the compiled shape — integer emits a JSON integer, decimal a float.
Accepts
IntegerDecimal
3
-2.5
0.35
parametised-number
Number value that may reference parameters/expressions.
Accepts
NumberParameter-based expression
2
a
2*a+1
ratio
One share over another, written as a fraction — the first environment's share of a split over the second's.
Accepts
a/b
3/2
1/1

#True or false

boolean
A true/false flag, matched in any case. In an attribute group the name alone means true — curve(dashed) — and ! before it means false: curve(!dashed). The negated form is how you turn off an attribute that defaults to true.
Accepts
truefalseyesno
true
no

#Colour

colour-list
Comma-separated colours, read in written order. Every colour the colour type takes: the nine hues, each optionally prefixed light- or dark-, neutral, and the hex(0064fa) literal. rgb(…) is the one colour a list cannot hold — its own commas would split it — so write a literal as hex() here.
Accepts
Comma-separated colours
blue, teal, orange, grey
light-blue, dark-blue
teal, hex(0064fa), neutral

#Lists

string-list
Comma-separated list of strings.
Accepts
Comma-separated text values
Chrome, Safari, Firefox
number-list
Comma-separated list of numbers.
Accepts
Comma-separated integers or decimals
65, 19, 4, 12
1.5, 2.0, 3.7
parametised-number-list
Comma-separated numbers, each of which may be a parameter expression.
Accepts
Comma-separated numbers or expressions
1, 2, 4
a, 2*a
histogram-bins
A histogram's bins: how many, or where their edges fall. One number is a count — 12, or parametised, k, so a slider re-bins the sample — and it needs readings to bin. Two or more are the edges themselves, in order, one more than there are bars, and may be unequal. A single edge is not a grid, so a lone number is never read as one.
Accepts
A count: a number or parameter expressionComma-separated bin edges
12
k
0, 10, 20, 30
series
One axis of a multipoint mark (x:/y: on scatter, line, polygon, bar): comma-separated entries, each a number, a parameter expression, or a name — or a dataset column bound whole, #islands.area. The axis decides how an entry reads: numbers and expressions on a numeric axis, names on a categorical one. The two axes pair by position.
Accepts
Comma-separated numbers, expressions or namesA dataset column: #id.column
1, 2, 4
k, 2*k, 4*k
North, South, East
#islands.area
index-list
Comma-separated indices and ranges. Letters map to positions (A=1).
Accepts
Single indexComma-separated listRange
1,3,5
1-4
A,C-E
cell-list
Spreadsheet-like cell references and ranges.
Accepts
A1A1,B2A1-C3
A1,B2
C3-C5
complex-series
A series of complex numbers: complex expressions written out, comma-separated (a bare number a real), or a column of complex literals bound whole.
Accepts
Comma-separated complex expressionsA dataset column: #id.column
1 + i, 2 - i, -3i, 4
#roots.z

#Points and paths

parametised-coordinate-list
Coordinate pairs with optional parameterized values.
Accepts
(x,y) pairs
(0,0),(1,1)
(a,2),(b,3)
angle-arm
One arm of an angle, in either of the two ways an arm is named: a point it runs through, or a bearing in degrees anticlockwise from the positive x axis. A point announces itself with its parentheses and its comma, so a bearing that happens to open with a bracket — (a + b) * 2 — is still read as the expression it is. Either form may be parametised, so an arm can follow a reader's slider.
Accepts
(x, y)Degrees
(4, 1)
30
(cos(t), sin(t))
graph-transform
A map of a graph's plane, written in the notation that plane is mapped in. The ordinary plane takes a 2×2 matrix as its two ROWS, the way one is written on paper: (1, 1), (0, 1) is (x, y) ↦ (x + y, y), and its columns are where the basis vectors land. Entries may be parametised. The argand plane takes a function of z instead, read as any other complex expression. A matrix announces itself with its rows, so a complex map that opens with a bracket — (1 + i) * z — is still read as the expression it is.
Accepts
Matrix rows: (a, b), (c, d)A function of z
(0, -1), (1, 0)
(1, k), (0, 1)
z^2
(z + 1/z) / 2
curve-path
The curve to follow: a #id reference to a curve or fit, or an expression in x given directly.
Accepts
#idExpression in x
#flight
x^2 - 1
geo-coordinate
A place on the earth, written LATITUDE FIRST: 48.85, 2.35 is Paris. Either half may be a parametised expression, so a place can ride a slider or a keyframe.
Accepts
lat, lon
48.85, 2.35
35.68, 139.69
0, lon
geo-anchor
A place, in either of the two ways a geographic environment names one: a geo-coordinate, or #id naming a marker the same environment already draws. The reference form is what lets a map that pins Tokyo also be framed on Tokyo without writing the coordinate twice.
Accepts
lat, lon#id of a marker in the same environment
48.85, 2.35
#tokyo
diagram-point
A place on a diagram environment's content frame, as fractions: 0.62, 0.31 is 62% across and 31% from the top. The origin is the TOP LEFT and y runs DOWN — the way a position is read off an image — unlike the graph's y-up coordinates. Both halves are plain numbers between 0 and 1.
Accepts
u, v — fractions of the frame, 0 to 1
0.62, 0.31
0.5, 0.5
diagram-anchor
A place on the frame, in either of the two ways a diagram environment names one: a diagram-point, or #id naming a box or pin the same environment already draws. The reference form is what lets a frame that labels the nucleus also be focused on the nucleus without writing the fraction twice.
Accepts
u, v#id of a box or pin in the same environment
0.62, 0.31
#nucleus
diagram-ref
#id naming a box or pin in the same diagram environment — an arrow's endpoints. Nothing else is accepted, and an id no box or pin declares is a compile error.
Accepts
#id of a box or pin in the same environment
#pcr
#nucleus

#Ranges and spacing

interval
An ascending inclusive range. A descending range is a compile error. This is a VALUE FORM, not @for syntax — any attribute whose type admits an interval accepts one, and an interval may be a list item, which is how an attribute comes to accept 1, 2, 3, 7..11.
Accepts
from..to
0..6
1, 2, 3, 7..11
parametised-interval
Interval that can include parameter expressions in bounds.
Accepts
Interval-like syntax with expressions
[-10, 10]
[a, b]
axis-value
A place on a graph axis: a number or parameter expression on a numeric axis, a date literal on a dates axis, or a name on a categorical one. On the polar plane an angle takes 60deg.
Accepts
A number or expressionA name on a categorical axis
0
2 * k
2024-03
Wed
90deg
axis-interval
An interval on a graph axis — a domain, a band, a brace, a !cue.zoom window. Each end is a number or expression on a numeric axis, a date on a dates axis, or a name on a categorical one; an end left empty is unbounded.
Accepts
[start, end] with numbers or expressions[start, end] with names on a categorical axis
[0, 10]
[a, b]
[Tue, Thu]
[0, ]
axis-scale
How a graph axis places a value: linear, log (v at log₁₀ v) or log2. A transform of numbers, refused beside names, dates or angles.
Accepts
linearloglog2
linear
log
axis-format
What a graph axis holds: auto (decided from the marks), numbers, discrete, radians, degrees, dates, a preset series (months, weekdays), a written series of names, or a dataset column whose distinct cells are the names. A series makes the axis categorical. So does discrete, which rules the axis at the NUMBERS its marks give — sorted, one stop each, evenly spaced however far apart the numbers are, ticked at those values and nowhere between them.
Accepts
autonumbers, discrete, radians, degrees, datesmonths, weekdaysComma-separated namesA dataset column: #id.column
auto
radians
discrete
months
Red, Blue, Yellow
#sales.region
grid-step
Grid spacing mode.
Accepts
autoPositive integer
auto
2
5

#Expressions

parametised-expression
Math expression that may include parameter variables.
Accepts
Expression string
x^2 + 2x + 1
sin(a*x)
parametised-surface-expression
Math expression over the plane — the one place y is legal alongside x — that may also reference parameters.
Accepts
Expression in x and y
x^2 + y^2
sin(x) * cos(y) + a
curve-expression
A curve's function of its plane's independent axis: an expression in x on the ordinary plane, in theta on the polar one. Parameters are the other letters; 60deg writes an angle in degrees. min(a, b), max(a, b) and clamp(x, lo, hi) are how a function defined in pieces is written as one curve.
Accepts
An expression in xAn expression in theta (polar)
x^2
a * sin(b * x)
1 + cos(theta)
min(2x, 10)
parametric-expression
One coordinate of a curve that is a position in t: an expression in t, the other letters parameters.
Accepts
An expression in t
cos(t)
a * sin(2t)
complex-expression
A complex number, as an expression: a real term, an imaginary term with i, or any expression of them — ^ the principal power; abs, arg, conj, re, im and the ordinary functions. Single letters are parameters, read as complex.
Accepts
A complex literal: 3 + 2i, -i, 4An expression in i and the parameters
3 + 2i
(3 + 2i)^2
sqrt(13) * e^(i * a)
conj(z)
complex-parametric-expression
A curve on the argand plane as z(t): a complex expression in t.
Accepts
A complex expression in t
e^(i * t)
sqrt(13) * e^(i * t)
t + i t^2
maths-value
A maths answer: an expression that works out to a number, to a vector — vec(3, -1), 2 vec(1, 2) + vec(0, 1) — or to a matrix, written row by row with semicolons between the rows — mat(1, 2; 3, 4), mat(2, 1; 1, 3) vec(3, -1) — or a bracketed tuple of numbers, (3, -1), which is a different answer from the vector with the same components. Matrices multiply as they do on paper, and a square one can be raised to a whole power. Read by the same parser a reader's typed answer goes through, so an expectation and an answer cannot be read two ways. nrt(x) is the nth root, n! the factorial, choose(n, r) and perm(n, r) count, a Greek letter is written by its name, _ subscripts a letter, and a number may be written in scientific notation (2.81e-5).
Accepts
NumberExpression in the question's variables(a, b, …)vec(a, b, …)mat(a, b; c, d)
8.1
w / (L v t)
(2016, 6.72)
vec(3, -1)
mat(0, -1; 1, 0)
maths-form
The form a maths answer must be written in: exact (no decimals), simplified (nothing left undone or redundant) or rounded(n) (a number to exactly n decimal places, n from 0 to 10).
Accepts
exactsimplifiedrounded(n)
exact
rounded(2)

#Timing and animation

duration
Animation duration value in milliseconds (internally normalized).
Accepts
Integer duration
500
750
1200
duration-auto
Either explicit duration or auto-calculated timing.
Accepts
autoInteger duration
auto
1200
cue-anchor
When something fires, in scene time: a step index, an absolute time, or a step with a time offset.
Accepts
Step indexAbsolute timestep + offset
2
1500ms
2 + 500ms
optional-cue-anchor
Nullable cue anchor — null means the cue never fires on its own.
Accepts
nullStep indexAbsolute timestep + offset
null
2
4 + 1.5s

#References

reference
An #id pointer, compiled to a binding the renderer resolves. The attribute holds a pointer and nothing more. targets names node or micronode types, or @data for a dataset.
Accepts
#id#id.member
#flight
#fit.slope

#Fixed choices

plane
A graph's plane — what a coordinate on its marks is: x a number line, xy the ordinary plane, argand the complex plane, polar (r, theta).
Accepts
xxyargandpolar
xy
argand
polar

Last updated