Skip to main content

Module spec

Module spec 

Source
Expand description

The declarative description of a plot: its marks, axes, and styling.

PlotSpec is to plot what SceneSpec is to chart3d — a fluent builder the app assembles each frame and hands to the widget, which resolves it (in draw_ops) to the reused DrawOp::Scene3D data layer plus themed axis/grid/legend chrome.

Following the house two-tier convention, each mark has a terse default-style adder on the builder (PlotSpec::line, PlotSpec::scatter) and a full-control escape hatch (the standalone [line]/scatter builders + PlotSpec::add_mark) for power users.

Structs§

Axis
One axis’s configuration: its Scale and an optional title.
LineMark
A line mark: a series drawn as a connected polyline (segments + round join/cap discs, per the reuse-the-pipelines decision). color = None auto-assigns from the theme’s series palette at resolve time.
PlotSpec
The full declarative description of a plot: marks, per-axis scales, view behaviour, and styling. Assemble fluently and pass to plot:
PlotStyle
Plot-level styling: background, gridlines, and MSAA. Maps to the reused scene’s SceneStyle at resolve time (the plot draws its own axis/grid chrome, so the scene’s own grid/axes are left off).
ScatterMark
A scatter mark: a series drawn as discrete markers. color = None auto-assigns from the theme’s series palette at resolve time.

Enums§

LegendPosition
Where a plot’s legend sits — a corner of the data rect. Set via PlotSpec::legend; the spec’s legend is None (no legend) by default.
Mark
One mark in a plot. Construct with the [line]/scatter builders or the PlotSpec adders.
PlotControls
Pointer control scheme for a plot, the 2D analogue of CameraControls for chart3d: the app picks one on the spec and there is deliberately no built-in scheme-picker widget. Double-click always resets to the full extent and the wheel always zooms the time (X) axis, regardless of scheme; the scheme selects what the primary (unmodified) left-drag does, with Shift doing the other.

Constants§

DEFAULT_LINE_WIDTH
Default line width, in screen pixels.
DEFAULT_MARKER_SIZE
Default scatter marker size, in screen pixels.

Functions§

line
Build a default-styled LineMark from a series — the standalone escape-hatch form (chain .color(...) / .width(...), then add with PlotSpec::add_mark).
scatter
Build a default-styled ScatterMark from a series — the standalone escape-hatch form.