Documentation
¶
Overview ¶
Package plot provides scales, data layouts and immediate-mode chart drawing. Shapes use local pixel coordinates; applications own data, interaction and accessible descriptions. kit.Plot and kit.Chart provide complete chart views.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Stack ¶
func Stack(series [][]float64) ([][]StackValue, error)
Stack lays out series-major values. Positive and negative totals accumulate separately from zero. NaN represents a missing sample; infinities and total overflow fail atomically. Input slices are never retained.
Types ¶
type Arc ¶
Arc paints a pie or donut sector. Radii are nonnegative pixels and inner must not exceed outer. The sampled outline includes exact angular endpoints.
type Area ¶
Area fills between matching upper and lower boundaries. Invalid pairs split the polygon. Both slices must have equal length; neither is retained.
type Axis ¶
type Axis struct {
Side AxisSide
At, From, To, TickSize, Width float32
Ticks []AxisText
Stroke, TextColor color.NRGBA
TextSize unit.Sp
}
Axis paints a baseline, ticks and labels in a local canvas. At is Y for horizontal axes and X for vertical axes. Labels are clipped to Canvas bounds; reserve margins there. TextSize is sp; geometry and stroke width are pixels.
type Canvas ¶
Canvas clips every primitive to Bounds and translates local pixels to its origin. Construct it during Layout; do not retain it across frames.
type Line ¶
Line splits at invalid points; dots use the original samples. Smooth uses a per-segment smoothstep interpolation and preserves both sample endpoints.
type PieSlice ¶
PieSlice retains the input index and value. Angles are radians, with zero on positive X; positive sweeps turn clockwise in screen coordinates.
type Rectangle ¶
Bar paints a rectangle, including horizontal or negative bars supplied by the caller. Reversed rectangle corners are normalized. Radius is in pixels.
type ScaleBand ¶
type ScaleBand[T comparable] struct { // contains filtered or unexported fields }
ScaleBand owns a unique, insertion-ordered categorical domain. Map returns the low coordinate of each band even for descending ranges.
func NewBand ¶
func NewBand[T comparable](domain []T, extent [2]float64) ScaleBand[T]
type ScaleLinear ¶
ScaleLinear supports reversed domains/ranges. Equal domains map to the range midpoint. Invalid input or an unrepresentable extrapolation returns false.
func (ScaleLinear) Ticks ¶
func (s ScaleLinear) Ticks(count int) []float64
Ticks returns evenly spaced domain values, including endpoints (2..1000). It preserves descending order and returns one tick for a constant domain.
type ScaleOrdinal ¶
type ScaleOrdinal[K comparable, V any] struct { // contains filtered or unexported fields }
ScaleOrdinal cycles a discrete range across a fixed domain. Missing keys and empty ranges return false; Map never extends the domain.
func NewOrdinal ¶
func NewOrdinal[K comparable, V any](domain []K, values []V) ScaleOrdinal[K, V]
func (ScaleOrdinal[K, V]) Map ¶
func (s ScaleOrdinal[K, V]) Map(x K) (V, bool)
type ScalePoint ¶
type ScalePoint[T comparable] struct { // contains filtered or unexported fields }
ScalePoint places categories on points; a singleton is centered.
func NewPoint ¶
func NewPoint[T comparable](domain []T, extent [2]float64) ScalePoint[T]
func (ScalePoint[T]) Domain ¶
func (s ScalePoint[T]) Domain() []T
func (ScalePoint[T]) Map ¶
func (s ScalePoint[T]) Map(x T) (float64, bool)
func (ScalePoint[T]) Padding ¶
func (s ScalePoint[T]) Padding(p float64) ScalePoint[T]
type StackValue ¶
StackValue retains the source series/sample index. Missing samples are invalid.