Expand description
Plotting for GPUI Component’s charts.
The unstyled primitives — scales, shapes, axes, grids, labels, Plot and
PlotElement — live in gpui_base::plot and are re-exported here.
This module adds the styled tooltip overlay and the IntoPlot derive.
Modules§
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
Axis - Axis lines and their tick labels.
- Plot
Element - Paints a
Plotfilling its container, with hover tracking and the plot’s tooltip overlay when the plot has anPlot::id. - 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 hover: how its 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