Published release 0.2.1. Unreleased PR #2 reference.
LOOM 0.2.1 / PLOTTING AND CALENDARS
Sparkline
One terminal column per sample, with multirow eighth-cell precision and optional missing markers.
Autoscaling considers all finite positive samples, including samples outside the viewport. An explicit nonpositive or non-finite maximum draws no filled cells. Missing markers appear only on the bottom row; invalid missing symbols fall back to a space. Rendering owns no I/O.
Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.
Example
_ = Sparkline(samples: [2, 4, nil, 8, 3], maximum: 8)Members on this page
Feature guides and release status
Sparkline
struct SparklineConforms to: Widget.
One terminal column per sample, with multirow eighth-cell precision and optional missing markers.
Autoscaling considers all finite positive samples, including samples outside the viewport. An explicit nonpositive or non-finite maximum draws no filled cells. Missing markers appear only on the bottom row; invalid missing symbols fall back to a space. Rendering owns no I/O.
Source · Sparkline.swift:45bars
var bars: [SparklineBar]A public field of this type. Its value type and mutability are shown in the declaration.
Source · Sparkline.swift:46maximum
var maximum: Double?A public field of this type. Its value type and mutability are shown in the declaration.
Source · Sparkline.swift:47style
var style: StyleVisual attributes used when painting this value.
Source · Sparkline.swift:48direction
var direction: SparklineDirectionThe horizontal or vertical allocation axis.
Source · Sparkline.swift:49symbols
var symbols: SparklineSymbolsA public field of this type. Its value type and mutability are shown in the declaration.
Source · Sparkline.swift:50missingSymbol
var missingSymbol: StringA public field of this type. Its value type and mutability are shown in the declaration.
Source · Sparkline.swift:51missingStyle
var missingStyle: StylePatchA public field of this type. Its value type and mutability are shown in the declaration.
Source · Sparkline.swift:52init(_:maximum:style:)
init(_ values: [Double], maximum: Double? = nil, style: Style = Style())Creates a value with the supplied arguments. Default arguments are shown in the declaration.
Parameters (3)
values- Argument type and any default are shown in the declaration; see the behavior notes above.
maximum- Argument type and any default are shown in the declaration; see the behavior notes above.
style- Text/cell appearance.
init(samples:maximum:style:)
init(samples: [Double?], maximum: Double? = nil, style: Style = Style())Optional samples use a label so Sparkline([]) remains unambiguous.
Parameters (3)
samples- Argument type and any default are shown in the declaration; see the behavior notes above.
maximum- Argument type and any default are shown in the declaration; see the behavior notes above.
style- Text/cell appearance.
init(bars:maximum:style:)
init(bars: [SparklineBar], maximum: Double? = nil, style: Style = Style())Creates a value with the supplied arguments. Default arguments are shown in the declaration.
Parameters (3)
bars- Argument type and any default are shown in the declaration; see the behavior notes above.
maximum- Argument type and any default are shown in the declaration; see the behavior notes above.
style- Text/cell appearance.
render(in:buffer:)
func render(in area: Rect, buffer: inout Buffer)Paints this widget into the assigned terminal-cell rectangle. Application code owns state, input routing, and terminal lifetime.
Parameters (2)
in- Argument type and any default are shown in the declaration; see the behavior notes above.
buffer- Mutable destination cell grid.