Manual
Overview
Language
IntroductionScenes & structureText & inlineGraphsCode panesAnimationDataReuse & logicExpressions & parameters
Elements
Text
ParagraphHeading 1Heading 2Heading 3Heading 4Unordered ListDivider
Media
ImageTableEquation
Callouts
NoteDefinitionExampleTask
Graph
GraphLinePolygonCurveIntegralScatterHistogramPointSegmentVectorCircleSquareRectangleTriangleStarDiamondHexagonTextAxis labelAxis BraceFitResidualsContourHeatmapParameter
Code
Code canvasLines
Animation
CueDraw cueTrace cueHighlight cueSpotlight cueType cue
Structure
SceneStep
Reference
Internote Reference
Inline
Formatting
BoldItalicsInline CodeHighlightLink
Text colour
Red textOrange textYellow textGreen textTeal textBlue textPurple textPink textGrey text
Maths
Maths
Reference
Internote ReferenceValueConstant
Other
FootnoteIcon
Directives
DatasetIncludeConstantsTemplatePresetConditionalForIgnore
Keyframes
KeyframeZoom keyframe
Attribute types
?
  1. Elements
  2. Graph
  3. Segment

Segment

segmentBlock elementGraph

A line segment between two points (x1, y1) and (x2, y2). Use for distances, measurements, or line construction.

Attributes

startRequiredImplicit
coordinate
Also written: fromOne endpoint, as a coordinate: `start: (2, 1)`. Animatable as a whole, so `!cue.to{(4, 3)}` moves the end in a straight line.The head shorthand supplies it: segment:value
endRequired
coordinate
Also written: toThe other endpoint, e.g. `end: (6, 9)`.
colour
colour
Also written: colorColour.
Defaultgrey
width
number
Stroke width.
Default2
opacity
number
Opacity.
Default1
dashed
boolean
Dashed stroke.
Defaultfalse
label
rich-text
Text drawn beside the element — rich text, so `$maths$` and inline formatting render. Fades and draws with the element.
hidden
boolean
Declared but not drawn. Animatable — `hidden: true !cue.to{false}(at: 2)` reveals it — and unlike a `cue`, a hidden element still frames the plot, so the axes do not jump when it appears.
Defaultfalse
lock
boolean
Also written: lockedKeeps the reader from editing this element on an `editable:` graph. Nothing at all on a graph that is not editable.
Defaultfalse
text-size
number
Text size.
Default20
z
parametised-number
Stacking order. Higher z renders on top; when omitted or equal, elements stack in document order (later on top).

Allowed content

Body { }Inline Chalk content (formatted text, inline math, links, and inline elements)

Allowed in

canvas.graph { }cue { }cue.draw { }cue.trace { }cue.highlight { }cue.spotlight { }

Examples

segment(start: (0, 0); end: (2, 1))
segment(start: (-2, 1); end: (1, -1); colour: grey)
On this page
AttributesAllowed inExamples
Segment · Internote