Directives and plot options#
A directive is a comment attached to a math cell. Write it in the same cell as the expression it configures, either on its own line or after the expression. A directive sets up a control or a plot; it is not a REPL command.
Directive syntax#
@config#
@config(path = value, ...)
Set plot-wide configuration for this cell.
@animate#
@animate(parameter, min, max, duration [, mode])
Animate a plot parameter over a range.
| Argument | Value | Required | Default |
|---|---|---|---|
parameter |
string | Yes | None |
min |
expression | No | 0 |
max |
expression | No | 10 |
dur |
duration | No | 4s |
mode |
loop, bounce, once |
No | loop |
speed |
number | No | 1 |
@slider#
@slider(min = value, max = value [, step = value])
Render a continuous numeric slider for a binding.
| Argument | Value | Required | Default |
|---|---|---|---|
min |
number | Yes | None |
max |
number | Yes | None |
step |
number | No | adaptive |
tick |
boolean | No | false |
@range#
@range(min = value, max = value [, step = value])
Render a two-handle numeric range control.
| Argument | Value | Required | Default |
|---|---|---|---|
min |
number | Yes | None |
max |
number | Yes | None |
step |
number | No | adaptive |
tick |
boolean | No | false |
@stepper#
@stepper(min = integer, max = integer)
Render an integer stepper for a binding.
| Argument | Value | Required | Default |
|---|---|---|---|
min |
integer | Yes | None |
max |
integer | Yes | None |
@switch#
@switch
Render a boolean toggle for a binding.
@select#
@select(options = [value, ...] [, style = dropdown])
Render a categorical picker for a binding.
| Argument | Value | Required | Default |
|---|---|---|---|
options |
scalarList | Yes | None |
style |
dropdown, segmented |
No | dropdown |
Plot configuration#
Write // @config(path=value, ...) in the plot cell.
Any field you leave out inherits the note or plot default.
A field you do set stays locked in the settings panel until you remove the source value or unlock it there.
A path accepts a numeric expression only where the table says so.
Grid#
| Path | Value | Dynamic expression |
|---|---|---|
grid.type |
cartesian, polar, dots, isometric |
No |
grid.show |
boolean | No |
grid.showMinor |
boolean | No |
grid.polar.radialCount |
integer | No |
Axes#
| Path | Value | Dynamic expression |
|---|---|---|
axis.x.show |
boolean | No |
axis.x.tickLabels |
boolean | No |
axis.x.label |
string | No |
axis.x.step |
number | No |
axis.x.usePiLabels |
boolean | No |
axis.x.arrow |
none, positive, both, end |
No |
axis.y.show |
boolean | No |
axis.y.tickLabels |
boolean | No |
axis.y.label |
string | No |
axis.y.step |
number | No |
axis.y.usePiLabels |
boolean | No |
axis.y.arrow |
none, positive, both, end |
No |
Scales#
| Path | Value | Dynamic expression |
|---|---|---|
scale.x |
linear, logarithmic, log |
No |
scale.y |
linear, logarithmic, log |
No |
scale.angle |
radians, degrees, radian, degree |
No |
Viewport#
| Path | Value | Dynamic expression |
|---|---|---|
viewport.autoFit |
boolean | No |
viewport.lockAspect |
boolean | No |
viewport.x.min |
number | Yes |
viewport.x.max |
number | Yes |
viewport.y.min |
number | Yes |
viewport.y.max |
number | Yes |
viewport.width |
number | No |
viewport.height |
number | No |
Right Y axis#
| Path | Value | Dynamic expression |
|---|---|---|
rightYAxis.min |
number | No |
rightYAxis.max |
number | No |
Legend#
| Path | Value | Dynamic expression |
|---|---|---|
legend.show |
boolean | No |
Trace#
| Path | Value | Dynamic expression |
|---|---|---|
trace.show |
boolean | No |
Title#
| Path | Value | Dynamic expression |
|---|---|---|
title |
string | No |
Interaction#
| Path | Value | Dynamic expression |
|---|---|---|
interaction.showZoomControls |
boolean | No |
interaction.snapToCurve |
boolean | No |
interaction.snapToGrid |
boolean | No |
interaction.crosshair |
boolean | No |
interaction.tangentOnSnap |
boolean | No |
interaction.poi |
none, always, onSelected, on-selected |
No |
interaction.autofocus |
boolean | No |
Render mode#
| Path | Value | Dynamic expression |
|---|---|---|
plotType |
interactive, static |
No |
Evaluator#
| Path | Value | Dynamic expression |
|---|---|---|
plot.engine |
auto, fjs, math_expressions, mathExpressions, math-expressions |
No |
Animation#
| Path | Value | Dynamic expression |
|---|---|---|
animate.parameter |
string | No |
animate.min |
expression | Yes |
animate.max |
expression | Yes |
animate.dur |
duration | No |
animate.mode |
loop, bounce, once |
No |
animate.speed |
number | No |
Series#
| Path | Value | Dynamic expression |
|---|---|---|
series[0].yAxis |
left, right |
No |
series[0].yAxis is an example of the notation: any nonnegative series index is accepted.
Series indices start at 0 here, while matrix indices inside an expression start at 1.
Set the right axis range with rightYAxis.min and rightYAxis.max.
plot.engine picks the evaluator that samples a plot, and it is debug-only.
A release build drops it from the language, rejects the directive, and gives every plot auto.
plotEngine, engine, and plot.backend are older aliases of the same setting.
interaction.showZoomControls is preferred over interaction.zoomControls and zoomControls.
How a style object differs from a config path#
A style object written directly after a series describes that series, and it travels with the expression.
A @config path describes the plot as a whole.
Color, line width, dash pattern, opacity, label, and the point and fill fields belong in the series style object.
Grid, axis, scale, viewport, legend, trace, title, render mode, and animation belong on @config.
A style object that carries a config path is warned about, and the key is dropped rather than applied.
Choosing an evaluator#
Most plots need no evaluator setting at all: auto picks the right sampler for the expression and the platform.
fjs uses the app's math runtime, and math_expressions supports a smaller numeric expression vocabulary on supported native builds.
The web uses the browser math runtime.
An expression the chosen evaluator does not support can fall back or report an error, so stay on auto unless you need a specific choice.