Expand description
Plotting for macOS charts.
The unstyled primitives — scales, shapes, axes, grids, labels, Plot,
PlotElement and hover tracking — come from gpui_kit::base::plot and are
re-exported here. This module adds the macOS-styled tooltip overlay.
A custom plot implements Plot and becomes an element with
impl_into_plot!.
Modules§
- label
- scale
- shape
- tooltip
- The hover overlay an macOS chart returns from
Plot::tooltip: a crosshair or band, square data markers, and a compact square box in the shell tooltip’s surface.
Structs§
- Axis
Text - A tick label on a
PlotAxis: its text, where along the axis it sits and how it is drawn.font_sizedefaults toTEXT_SIZE. - Grid
- Axis-aligned grid lines across a plot, at the given x and y positions.
- Path
Cache - A tessellated path reused across frames while its shape is unchanged.
- Path
Caches - The
PathCaches of a plot that is rebuilt on every render, kept in the window’s element state so they outlive the plot value. - Plot
Appear - How far a plot’s data marks have appeared this frame, handed to
Plot::appear. - Plot
Appear Scope - Remembers which plots inside it have finished appearing, so a plot that is painted again after a gap — a row a virtual list scrolled out of view and back — shows its data whole instead of drawing in again.
- Plot
Axis - Axis lines and their tick labels.
- Plot
Element - Paints a
Plotfilling its container, with appear tracking when the plot has anPlot::id, and hover tracking and the plot’s tooltip overlay when it is alsoPlot::interactive. - Plot
Hover - The datum a plot has under the pointer this frame, handed to
Plot::hover. - Plot
Label - Plot
Motion - The timing of a plot’s motion: how its data marks appear when it is first painted, how its hover progress fades in and out, and the spring a pointer follows the hovered datum with.
- Shape
Key - A shape key from its projected points (origin-relative) and whatever else shapes the tessellation (stroke width, curve style, dash pattern).
- Tooltip
State - The datum the cursor resolved to, returned from
Plot::tooltip_state.
Enums§
- Axis
Label Placement - Where a chart draws the tick labels of its value axis.
- Axis
Label Side - Which side of an axis line the tick labels render on.
- Curve
- How a
LineorAreaconnects its points, like d3’s curve factories.
Constants§
Traits§
- Plot
- Plot
Value - A number a
ScaleLinearand the charts built on it can place:f32,f64, andrust_decimal::Decimalwith thedecimalfeature.
Functions§
- axis_
gutter - The space below (or above) an x-axis line that tick labels of
font_sizeneed: the gapPlotAxisleaves between the line and the labels, the labels themselves, and a trailing gap. - hover_
progress - How far the enclosing plot’s hover has faded in this frame, from
0to1; seePlotHover::progress. - is_
hover_ entering - Whether this frame is the first the enclosing plot’s cursor is on a datum;
see
PlotHover::is_entering. - origin_
point - pointer_
spring - The spring a hover pointer — the crosshair, highlight band or hover dot —
follows the hovered datum with: the active
PlotMotion’s pointer, which snaps unless a styled layer projects one. - polygon