The diagram canvas element and all drawing primitives — curves, shapes, data plots, and labels
diagramalias: graphA coordinate canvas for mathematical drawings. Place drawing primitives inside the body {}. Diagrams go in the detail panel [] of a scene, displayed alongside the narrative body.
x domain (interval; default: [-10, 10]). Horizontal range of the canvasy domain (interval; default: [-10, 10]). Vertical range of the canvasx-axis-label (string; default: —). Label for the x-axisy-axis-label (string; default: —). Label for the y-axistitle (string; default: —). Title displayed above the diagramshow axes (boolean; default: true). Show x and y axesshow grid (boolean; default: true). Show the background gridshow ticks (boolean; default: true). Show axis tick marksshow background (boolean; default: true). Show the diagram backgroundx grid spacing (grid-step; default: auto). Grid line spacing on x-axisy grid spacing (grid-step; default: auto). Grid line spacing on y-axisparameteralias: paramAn interactive slider that defines a variable students can manipulate. Place in the same detail [] block as the diagram. Any expression in the scene that references the variable letter updates in real time.
var (required; single-char). Variable letter (a–z)range (parametised-interval; default: [-10, 10]). Slider range [min, max]step (number; default: 1). Slider step sizedefault (number; default: 0). Initial slider valuecurvePlots a mathematical function y = f(x) as a smooth curve. Expressions use standard math notation and can reference parameter variables.
expression (required; parametised-expression). Math expression for y as a function of xcolour (colour; default: blue). Curve colourwidth (number; default: 2). Stroke width in pixelsdashed (boolean; default: false). Dashed strokedomain (parametised-interval; default: —). Restrict the x range of the curverange (parametised-interval; default: —). Clip the y range of the curvearrowheads (boolean; default: true). Show arrowheads at curve endpointslineA polyline connecting a sequence of coordinate points. Use for data series, piecewise functions, or step functions.
data (required; parametised-coordinate-list). Coordinates, e.g. (0,0),(1,2),(2,3)colour (colour; default: pink). Line colourwidth (number; default: 2). Stroke widthinterpolate (linear / step; default: linear). linear connects points directly; step draws horizontal then verticalpolygonA filled or unfilled polygon connecting a sequence of coordinate points.
data (required; parametised-coordinate-list). Vertex coordinatesfill (boolean; default: true). Fill the interiorcolour (colour; default: teal). Fill and stroke colouropacity (number; default: 1). Opacity (0–1)circle, square, rectangle, triangle, diamond, hexagon, starFixed geometric shapes positioned at (x, y) with a given size. All share the same attribute set. Available shapes: circle, square, rectangle, triangle, diamond, hexagon, star.
x (parametised-number; default: 0). Centre x coordinatey (parametised-number; default: 0). Centre y coordinatesize (parametised-number; default: 1). Radius or side lengthcolour (colour; default: purple). Shape colourfill (boolean; default: true). Fill the interioropacity (number; default: 1). Opacity (0–1)vectorA directed arrow from origin (x, y) in direction (dx, dy). Use for showing forces, velocity, gradients, or any directed quantity.
x (parametised-number; default: 0). Origin xy (parametised-number; default: 0). Origin ydx (required; parametised-number). x component (horizontal displacement)dy (required; parametised-number). y component (vertical displacement)colour (colour; default: green). Arrow colourwidth (number; default: 2). Stroke widthdashed (boolean; default: false). Dashed strokeopacity (number; default: 1). Opacity (0–1)segmentA line segment between two explicit endpoints (x1, y1) and (x2, y2).
x1 (required; parametised-number). First point xy1 (required; parametised-number). First point yx2 (required; parametised-number). Second point xy2 (required; parametised-number). Second point ycolour (colour; default: grey). Segment colourwidth (number; default: 2). Stroke widthdashed (boolean; default: false). Dashed strokeopacity (number; default: 1). Opacity (0–1)pointA single point marker at (x, y). Use to highlight specific coordinates, solutions, or data points.
x (required; parametised-number). x coordinatey (required; parametised-number). y coordinatesize (parametised-number; default: 6). Point radius in pixelscolour (colour; default: orange). Point colouropacity (number; default: 1). Opacity (0–1)textA text label positioned at (x, y) on the diagram canvas. Use for annotations, axis labels, or coordinate labels.
x (number; default: 0). x coordinatey (number; default: 0). y coordinatesize (number; default: 20). Font size in pixelscolour (colour; default: neutral). Text colouranchor (start / middle / end; default: middle). Horizontal text alignmentscatterA scatter plot of discrete data points, each rendered as a marker shape.
data (required; parametised-coordinate-list). Coordinate listshape (shape-type; default: circle). Marker shape (circle, square, triangle, diamond, star, hexagon)size (parametised-number; default: 6). Marker size in pixelscolour (colour; default: red). Marker colouropacity (number; default: 1). Opacity (0–1)histogramA bar chart rendered on the diagram canvas using pre-binned data. bins defines the edges between bars — it must have exactly one more value than values.
bins (required; number-list). Comma-separated bin edges (N+1 values for N bars)values (required; number-list). Comma-separated bar heights, one per bincolours (colour-list; default: —). Per-bar colours; first colour is the fallbackorientation (vertical / horizontal; default: vertical). Bar directionshow-labels (boolean; default: false). Show numeric values above each bar