Documentation
¶
Overview ¶
Package charts provides Go bindings for Apple's Charts framework.
The package integrates with swiftui.View and focuses on the practical Swift Charts surface needed for real dashboards, SRE charts, and ML plots: line, area, bar, point, rule, rectangle, and sector marks; domains and scale types; axes and legends; foreground style scales; annotations; and scrollable time-series presentation.
Bridge sources under internal/swift/ are generated by go generate.
Quick start ¶
import (
"time"
"github.com/tmc/swiftui"
"github.com/tmc/swiftui/charts"
)
view := charts.Chart(
charts.LineMark(
charts.X(charts.TimeValue("Time", time.Now(), charts.TimeUnitMinute)),
charts.Y(charts.NumberValue("Latency", 182.4)),
).ForegroundStyle(swiftui.RGB(0.18, 0.36, 0.79)),
).ChartYScaleType(charts.ScaleTypeLog).View()
_ = view
Example (BarChart) ¶
package main
import (
"github.com/tmc/swiftui"
"github.com/tmc/swiftui/charts"
)
func main() {
view := charts.Chart(
charts.BarMark(
charts.X(charts.CategoryValue("Service", "api")),
charts.Y(charts.NumberValue("Errors", 12)),
).ForegroundStyle(swiftui.RGB(0.78, 0.22, 0.22)),
charts.BarMark(
charts.X(charts.CategoryValue("Service", "worker")),
charts.Y(charts.NumberValue("Errors", 4)),
).ForegroundStyle(swiftui.RGB(0.28, 0.48, 0.84)),
).ChartLegend(charts.LegendHidden)
_ = view.View()
}
Output:
Example (ConfidenceIntervalChart) ¶
package main
import (
"github.com/tmc/swiftui"
"github.com/tmc/swiftui/charts"
)
func main() {
view := charts.Chart(
charts.ErrorBarMark(
charts.XFloatRange("95% CI", 71, 86),
charts.YString("Experiment", "baseline"),
charts.HeightFixed(10),
).ForegroundStyle(swiftui.RGB(0.57, 0.59, 0.63)),
charts.PointMark(
charts.XFloat("Mean", 78),
charts.YString("Experiment", "baseline"),
).ForegroundStyle(swiftui.RGB(0.15, 0.45, 0.27)).Symbol(charts.SymbolCircle).SymbolSize(40),
charts.ErrorBarMark(
charts.XFloatRange("95% CI", 83, 97),
charts.YString("Experiment", "candidate"),
charts.HeightFixed(10),
).ForegroundStyle(swiftui.RGB(0.57, 0.59, 0.63)),
charts.PointMark(
charts.XFloat("Mean", 90),
charts.YString("Experiment", "candidate"),
).ForegroundStyle(swiftui.RGB(0.15, 0.45, 0.27)).Symbol(charts.SymbolDiamond).SymbolSize(40),
).ChartXAxis(charts.AxisMarks(
charts.AxisGridLines(),
charts.AxisValueLabels(charts.FixedFormat(0)),
))
_ = view.View()
}
Output:
Example (DeltaChart) ¶
package main
import (
"github.com/tmc/swiftui"
"github.com/tmc/swiftui/charts"
)
func main() {
view := charts.Chart(
charts.RangeBarMark(
charts.XFloatRange("Delta", -0.12, 0.08),
charts.YString("Benchmark", "Decode/large"),
).ForegroundStyle(swiftui.RGBA(0.86, 0.38, 0.26, 0.8)).TextAnnotation("-12%", charts.AnnotationLeading),
charts.RangeBarMark(
charts.XFloatRange("Delta", 0.0, 0.17),
charts.YString("Benchmark", "Encode/small"),
).ForegroundStyle(swiftui.RGBA(0.21, 0.58, 0.28, 0.82)).TextAnnotation("+17%", charts.AnnotationTrailing),
charts.ReferenceLineX(charts.NumberValue("Baseline", 0), "baseline").
LineStyle(charts.Stroke(1, 3, 2)),
).ChartXScaleDomain(charts.NumberDomain(-0.2, 0.2)).
ChartXAxis(charts.AxisMarks(
charts.AxisGridLinesStyled(charts.Stroke(0.75, 2, 2), false),
charts.AxisValueLabels(charts.PercentFormat(0)),
)).
ChartLegend(charts.LegendHidden)
_ = view.View()
}
Output:
Example (GroupedBenchmarkBars) ¶
package main
import (
"github.com/tmc/swiftui/charts"
)
func main() {
view := charts.Chart(
charts.BarMark(
charts.XFloat("ns/op", 1823),
charts.YString("Benchmark", "Encode/small"),
charts.HeightFixed(14),
).PositionBy("Run", "old").ForegroundStyleBy("Run", "old").TextAnnotation("1823", charts.AnnotationTrailing),
charts.BarMark(
charts.XFloat("ns/op", 1312),
charts.YString("Benchmark", "Encode/small"),
charts.HeightFixed(14),
).PositionBy("Run", "new").ForegroundStyleBy("Run", "new").TextAnnotation("1312", charts.AnnotationTrailing),
charts.BarMark(
charts.XFloat("ns/op", 4180),
charts.YString("Benchmark", "Decode/large"),
charts.HeightFixed(14),
).PositionBy("Run", "old").ForegroundStyleBy("Run", "old"),
charts.BarMark(
charts.XFloat("ns/op", 3540),
charts.YString("Benchmark", "Decode/large"),
charts.HeightFixed(14),
).PositionBy("Run", "new").ForegroundStyleBy("Run", "new"),
).ChartLegend(charts.LegendCompact(charts.LegendPositionTop, charts.LegendAlignmentLeading)).
ChartXAxis(charts.AxisMarks(
charts.AxisGridLines(),
charts.AxisValueLabels(charts.CompactFormat(1)),
))
_ = view.View()
}
Output:
Example (LineChart) ¶
package main
import (
"time"
"github.com/tmc/swiftui/charts"
)
func main() {
now := time.Now()
view := charts.Chart(
charts.LineMark(
charts.X(charts.TimeValue("Time", now.Add(-2*time.Minute), charts.TimeUnitMinute)),
charts.Y(charts.NumberValue("Latency", 145)),
).ForegroundStyleBy("Series", "p95").Symbol(charts.SymbolCircle),
charts.LineMark(
charts.X(charts.TimeValue("Time", now.Add(-1*time.Minute), charts.TimeUnitMinute)),
charts.Y(charts.NumberValue("Latency", 162)),
).ForegroundStyleBy("Series", "p95").Symbol(charts.SymbolCircle),
charts.LineMark(
charts.X(charts.TimeValue("Time", now, charts.TimeUnitMinute)),
charts.Y(charts.NumberValue("Latency", 180)),
).ForegroundStyleBy("Series", "p95").Symbol(charts.SymbolCircle),
).ChartXVisibleDomainLength(180).ChartScrollableAxes(charts.ScrollAxisHorizontal)
_ = view.View()
}
Output:
Example (MixedChart) ¶
package main
import (
"time"
"github.com/tmc/swiftui"
"github.com/tmc/swiftui/charts"
)
func main() {
now := time.Now()
view := charts.Chart(
charts.RectangleMark(
charts.XDateRange("Window", now.Add(-time.Minute), now, charts.TimeUnitMinute),
charts.YFloatRange("Band", 110, 190),
).ForegroundStyle(swiftui.RGBA(0.18, 0.36, 0.79, 0.16)),
charts.LineMark(
charts.X(charts.TimeValue("Time", now, charts.TimeUnitMinute)),
charts.Y(charts.NumberValue("Mean", 150)),
).ForegroundStyle(swiftui.RGB(0.18, 0.36, 0.79)),
charts.RuleMark(
charts.Y(charts.NumberValue("SLO", 175)),
).LineStyle(charts.Stroke(1.5, 4, 2)),
).ChartYScaleDomain(charts.NumberDomain(100, 220))
_ = view.View()
}
Output:
Index ¶
- Variables
- func VisibleDomainNumeric(length float64) visibleDomainLength
- func VisibleDomainTime(length time.Duration) visibleDomainLength
- type AnnotationAlignment
- type AnnotationCollisionMode
- type AnnotationOverflowStrategy
- type AnnotationPosition
- type AxisConfig
- type AxisLabelOption
- type AxisOption
- func AxisDateLabels(pattern string, centered bool) AxisOption
- func AxisGridLines() AxisOption
- func AxisGridLinesStyled(style LineStyle, centered bool) AxisOption
- func AxisLabels() AxisOption
- func AxisPositionOption(position AxisPosition) AxisOption
- func AxisPresetOption(preset AxisPreset) AxisOption
- func AxisTickCount(desiredCount int) AxisOption
- func AxisTickMinimumStride(minimumStride float64, desiredCount int) AxisOption
- func AxisTickStride(step float64) AxisOption
- func AxisTickStrideRounded(step float64, roundLowerBound, roundUpperBound bool) AxisOption
- func AxisTickValues(values ...Value) AxisOption
- func AxisTicks() AxisOption
- func AxisTicksStyled(length AxisTickLength, style LineStyle, centered bool) AxisOption
- func AxisValueLabels(format ValueFormat) AxisOption
- func AxisValuesOption(values AxisValues) AxisOption
- type AxisPosition
- type AxisPreset
- type AxisStyleOption
- func AxisStyleBackgroundColor(color swiftui.Color) AxisStyleOption
- func AxisStyleBackgroundView(view swiftui.View) AxisStyleOption
- func AxisStyleForeground(color swiftui.Color) AxisStyleOption
- func AxisStyleOpacity(opacity float64) AxisStyleOption
- func AxisStyleOverlayView(view swiftui.View) AxisStyleOption
- type AxisTickLength
- type AxisValues
- func AutomaticAxisValues() AxisValues
- func AutomaticAxisValuesCount(desiredCount int) AxisValues
- func AutomaticAxisValuesMinimumStride(minimumStride float64, desiredCount int) AxisValues
- func AxisValueList(values ...Value) AxisValues
- func NumericStride(step float64) AxisValues
- func NumericStrideRounded(step float64, roundLowerBound, roundUpperBound bool) AxisValues
- func TimeStride(unit TimeUnit) AxisValues
- func TimeStrideCount(unit TimeUnit, count int) AxisValues
- func TimeStrideRounded(unit TimeUnit, count int, roundLowerBound, roundUpperBound bool) AxisValues
- type ChartView
- func (c ChartView) AsView() swiftui.View
- func (c ChartView) ChartAngleSelection(binding SelectionValueBinding) ChartView
- func (c ChartView) ChartBackground(background ProxyBackground) ChartView
- func (c ChartView) ChartForegroundStyleScale(entries ...StyleScaleEntry) ChartView
- func (c ChartView) ChartForegroundStyleScaleType(scaleType ScaleType) ChartView
- func (c ChartView) ChartGesture(gesture ProxyGesture) ChartView
- func (c ChartView) ChartLegend(config LegendConfig) ChartView
- func (c ChartView) ChartLineStyleScale(entries ...LineStyleScaleEntry) ChartView
- func (c ChartView) ChartOverlay(overlay ProxyOverlay) ChartView
- func (c ChartView) ChartPlotStyle(opts ...PlotStyleOption) ChartView
- func (c ChartView) ChartScrollPositionInitialXDate(value time.Time) ChartView
- func (c ChartView) ChartScrollPositionInitialXNumber(value float64) ChartView
- func (c ChartView) ChartScrollPositionInitialYDate(value time.Time) ChartView
- func (c ChartView) ChartScrollPositionInitialYNumber(value float64) ChartView
- func (c ChartView) ChartScrollPositionX(binding ScrollPositionBinding) ChartView
- func (c ChartView) ChartScrollPositionY(binding ScrollPositionBinding) ChartView
- func (c ChartView) ChartScrollTargetBehavior(behavior ScrollTargetBehavior) ChartView
- func (c ChartView) ChartScrollableAxes(axis ScrollAxis) ChartView
- func (c ChartView) ChartSymbolScale(entries ...SymbolScaleEntry) ChartView
- func (c ChartView) ChartSymbolSizeScale(entries ...SymbolSizeScaleEntry) ChartView
- func (c ChartView) ChartSymbolSizeScaleType(scaleType ScaleType) ChartView
- func (c ChartView) ChartXAxis(config AxisConfig) ChartView
- func (c ChartView) ChartXAxisLabel(text string, opts ...AxisLabelOption) ChartView
- func (c ChartView) ChartXAxisStyle(opts ...AxisStyleOption) ChartView
- func (c ChartView) ChartXScaleDomain(domain Domain) ChartView
- func (c ChartView) ChartXScaleRange(rng PositionScaleRange) ChartView
- func (c ChartView) ChartXScaleType(scaleType ScaleType) ChartView
- func (c ChartView) ChartXSelection(binding SelectionValueBinding) ChartView
- func (c ChartView) ChartXSelectionRange(binding SelectionRangeBinding) ChartView
- func (c ChartView) ChartXVisibleDomain(length visibleDomainLength) ChartView
- func (c ChartView) ChartXVisibleDomainLength(length float64) ChartView
- func (c ChartView) ChartYAxis(config AxisConfig) ChartView
- func (c ChartView) ChartYAxisLabel(text string, opts ...AxisLabelOption) ChartView
- func (c ChartView) ChartYAxisStyle(opts ...AxisStyleOption) ChartView
- func (c ChartView) ChartYScaleDomain(domain Domain) ChartView
- func (c ChartView) ChartYScaleRange(rng PositionScaleRange) ChartView
- func (c ChartView) ChartYScaleType(scaleType ScaleType) ChartView
- func (c ChartView) ChartYSelection(binding SelectionValueBinding) ChartView
- func (c ChartView) ChartYSelectionRange(binding SelectionRangeBinding) ChartView
- func (c ChartView) ChartYVisibleDomain(length visibleDomainLength) ChartView
- func (c ChartView) ChartYVisibleDomainLength(length float64) ChartView
- func (c ChartView) Frame(width, height float64) swiftui.View
- func (c ChartView) Pointer() uintptr
- func (c ChartView) View() swiftui.View
- type DateComponents
- type DateRangeState
- type DateState
- type Dim
- func Angle(v Value) Dim
- func AngularInset(points float64) Dim
- func HeightFixed(points float64) Dim
- func InnerRadiusRatio(ratio float64) Dim
- func LowerQuartile(v Value) Dim
- func Maximum(v Value) Dim
- func Median(v Value) Dim
- func Minimum(v Value) Dim
- func Q1(v Value) Dim
- func Q3(v Value) Dim
- func UpperQuartile(v Value) Dim
- func WidthRatio(ratio float64) Dim
- func X(v Value) Dim
- func XDate(label string, value time.Time, unit TimeUnit) Dim
- func XDateRange(label string, start, end time.Time, unit TimeUnit) Dim
- func XFloat(label string, value float64) Dim
- func XFloatRange(label string, start, end float64) Dim
- func XInt(label string, value int) Dim
- func XRange(start, end Value) Dim
- func XString(label, value string) Dim
- func Y(v Value) Dim
- func YDate(label string, value time.Time, unit TimeUnit) Dim
- func YFloat(label string, value float64) Dim
- func YFloatRange(label string, start, end float64) Dim
- func YInt(label string, value int) Dim
- func YIntRange(label string, start, end int) Dim
- func YRange(start, end Value) Dim
- func YString(label, value string) Dim
- type Domain
- type DurationUnit
- type InterpolationMethod
- type LabelAlignment
- type LegendAlignment
- type LegendConfig
- type LegendPosition
- type LegendVisibility
- type LineStyle
- type LineStyleScaleEntry
- type MajorValueAlignment
- type Mark
- func AreaMark(dims ...Dim) Mark
- func BarMark(dims ...Dim) Mark
- func BoxPlotMark(dims ...Dim) Mark
- func ErrorBarMark(dims ...Dim) Mark
- func LineMark(dims ...Dim) Mark
- func MapPointPlot[T any](data []T, x func(T) Value, y func(T) Value) Mark
- func MapRectanglePlot[T any](data []T, x func(T) Value, y func(T) Value, width, height MarkDimension) Mark
- func MapRulePlot[T any](data []T, xStart func(T) Value, xEnd func(T) Value, y func(T) Value) Mark
- func MarkGroup(marks ...Mark) Mark
- func PointMark(dims ...Dim) Mark
- func PointPlot(data ...PointPlotDatum) Mark
- func RangeBarMark(dims ...Dim) Mark
- func RectangleMark(dims ...Dim) Mark
- func RectanglePlot(data ...RectanglePlotDatum) Mark
- func ReferenceLineX(value Value, label string) Mark
- func ReferenceLineY(value Value, label string) Mark
- func RuleMark(dims ...Dim) Mark
- func RulePlot(data ...RulePlotDatum) Mark
- func SectorMark(dims ...Dim) Mark
- func Series(marks ...Mark) Mark
- func (m Mark) AccessibilityHidden(hidden bool) Mark
- func (m Mark) AccessibilityLabel(text string) Mark
- func (m Mark) AccessibilityValue(text string) Mark
- func (m Mark) AlignsMarkStylesWithPlotArea(aligns bool) Mark
- func (m Mark) Annotation(position AnnotationPosition, alignment AnnotationAlignment, ...) Mark
- func (m Mark) AnnotationCollision(mode AnnotationCollisionMode) Mark
- func (m Mark) AnnotationDeclutterByDistance(minX, minY float64) Mark
- func (m Mark) AnnotationDeclutterLatest(maxCount int) Mark
- func (m Mark) AnnotationOffset(x, y float64) Mark
- func (m Mark) AnnotationOffsetChart(dx, dy float64) Mark
- func (m Mark) AnnotationOverflow(x, y AnnotationOverflowStrategy) Mark
- func (m Mark) AnnotationPriority(priority int) Mark
- func (m Mark) Blur(radius float64) Mark
- func (m Mark) CornerRadius(radius float64) Mark
- func (m Mark) ExcludeFromLegend() Mark
- func (m Mark) ForegroundStyle(color swiftui.Color) Mark
- func (m Mark) ForegroundStyleBy(label, value string) Mark
- func (m Mark) Interpolation(method InterpolationMethod) Mark
- func (m Mark) LineStyle(style LineStyle) Mark
- func (m Mark) LineStyleBy(label, value string) Mark
- func (m Mark) Offset(x, y float64) Mark
- func (m Mark) Opacity(opacity float64) Mark
- func (m Mark) PositionBy(label, value string) Mark
- func (m Mark) Shadow(color swiftui.Color, radius, x, y float64) Mark
- func (m Mark) Stacking(stacking MarkStacking) Mark
- func (m Mark) Symbol(symbol SymbolKind) Mark
- func (m Mark) SymbolBy(label, value string) Mark
- func (m Mark) SymbolDiameter(points float64) Mark
- func (m Mark) SymbolRadius(points float64) Mark
- func (m Mark) SymbolSize(area float64) Mark
- func (m Mark) SymbolSizeBy(label, value string) Mark
- func (m Mark) SymbolStroke(color swiftui.Color, width float64) Mark
- func (m Mark) TextAnnotation(text string, position AnnotationPosition) Mark
- func (m Mark) TextAnnotationAligned(text string, position AnnotationPosition, alignment AnnotationAlignment) Mark
- func (m Mark) ZIndex(value float64) Mark
- type MarkDimension
- type MarkStacking
- type NumberRangeState
- type NumberState
- type OptionalDateState
- type OptionalNumberState
- type PlotStyleOption
- func PlotBackgroundColor(color swiftui.Color) PlotStyleOption
- func PlotBackgroundView(view swiftui.View) PlotStyleOption
- func PlotBorder(color swiftui.Color, width float64) PlotStyleOption
- func PlotInset(top, right, bottom, left float64) PlotStyleOption
- func PlotInsetAll(padding float64) PlotStyleOption
- func PlotOverlayView(view swiftui.View) PlotStyleOption
- type PointPlotDatum
- type PositionScaleRange
- type ProxyBackground
- type ProxyGesture
- func DragAngleSelectionGesture(state SelectionValueBinding, minDistance float64) ProxyGesture
- func DragXRangeSelectionGesture(state SelectionRangeBinding, minDistance float64) ProxyGesture
- func DragXSelectionGesture(state SelectionValueBinding, minDistance float64) ProxyGesture
- func DragYRangeSelectionGesture(state SelectionRangeBinding, minDistance float64) ProxyGesture
- func DragYSelectionGesture(state SelectionValueBinding, minDistance float64) ProxyGesture
- type ProxyOverlay
- type RectanglePlotDatum
- func PlotRectangleRange(xStart, xEnd, yStart, yEnd Value) RectanglePlotDatum
- func PlotRectangleXRange(xStart, xEnd, y Value, height MarkDimension) RectanglePlotDatum
- func PlotRectangleXY(x, y Value, width, height MarkDimension) RectanglePlotDatum
- func PlotRectangleYRange(x, yStart, yEnd Value, width MarkDimension) RectanglePlotDatum
- type RulePlotDatum
- type ScaleType
- type ScrollAxis
- type ScrollPositionBinding
- type ScrollTargetBehavior
- func DateAlignedScrollTarget(components DateComponents, major *MajorValueAlignment, ...) ScrollTargetBehavior
- func DateAlignedXYScrollTarget(xDate, yDate DateComponents, xMajor, yMajor *MajorValueAlignment, ...) ScrollTargetBehavior
- func ValueAlignedScrollTarget(unit float64, major *MajorValueAlignment, limit ValueAlignedLimitBehavior) ScrollTargetBehavior
- func ValueAlignedXYScrollTarget(xUnit, yUnit float64, xMajor, yMajor *MajorValueAlignment, ...) ScrollTargetBehavior
- type SelectionRangeBinding
- type SelectionValueBinding
- type StyleScaleEntry
- type SymbolKind
- type SymbolScaleEntry
- type SymbolSizeScaleEntry
- type TimeUnit
- type Value
- type ValueAlignedLimitBehavior
- type ValueFormat
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( InterpolationLinear = InterpolationMethod{/* contains filtered or unexported fields */} InterpolationCatmullRom = InterpolationMethod{/* contains filtered or unexported fields */} InterpolationCardinal = InterpolationMethod{/* contains filtered or unexported fields */} InterpolationMonotone = InterpolationMethod{/* contains filtered or unexported fields */} InterpolationStepStart = InterpolationMethod{/* contains filtered or unexported fields */} InterpolationStepCenter = InterpolationMethod{/* contains filtered or unexported fields */} InterpolationStepEnd = InterpolationMethod{/* contains filtered or unexported fields */} )
var ( ScaleTypeAutomatic = ScaleType{/* contains filtered or unexported fields */} ScaleTypeLinear = ScaleType{/* contains filtered or unexported fields */} ScaleTypeLog = ScaleType{/* contains filtered or unexported fields */} ScaleTypeDate = ScaleType{/* contains filtered or unexported fields */} ScaleTypeCategory = ScaleType{/* contains filtered or unexported fields */} ScaleTypeSquareRoot = ScaleType{/* contains filtered or unexported fields */} )
var AxisHidden = AxisConfig{/* contains filtered or unexported fields */}
AxisHidden hides an axis.
var AxisTickLengthAutomatic = AxisTickLength{/* contains filtered or unexported fields */}
var LegendHidden = LegendConfig{Visibility: LegendVisibilityHidden}
LegendHidden hides the legend.
var MajorValueAlignmentPage = MajorValueAlignment{/* contains filtered or unexported fields */}
var MarkDimensionAutomatic = MarkDimension{/* contains filtered or unexported fields */}
MarkDimensionAutomatic uses the framework default sizing.
var PagingScrollTarget = ScrollTargetBehavior{/* contains filtered or unexported fields */}
PagingScrollTarget snaps by pages.
var ValueFormatAutomatic = ValueFormat{/* contains filtered or unexported fields */}
ValueFormatAutomatic uses the framework default label formatting.
Functions ¶
func VisibleDomainNumeric ¶
func VisibleDomainNumeric(length float64) visibleDomainLength
VisibleDomainNumeric uses a numeric visible-domain length.
func VisibleDomainTime ¶
VisibleDomainTime uses a time-domain visible length.
Types ¶
type AnnotationAlignment ¶
type AnnotationAlignment int32
AnnotationAlignment controls annotation alignment.
const ( AnnotationAlignmentCenter AnnotationAlignment = iota AnnotationAlignmentLeading AnnotationAlignmentTrailing AnnotationAlignmentTop AnnotationAlignmentBottom )
type AnnotationCollisionMode ¶
type AnnotationCollisionMode int32
AnnotationCollisionMode controls built-in annotation collision resolution.
const ( AnnotationCollisionAutomatic AnnotationCollisionMode = iota AnnotationCollisionHideOverlapping AnnotationCollisionKeepLatest AnnotationCollisionKeepPriority )
type AnnotationOverflowStrategy ¶
type AnnotationOverflowStrategy int32
AnnotationOverflowStrategy controls how annotations resolve overflow.
const ( AnnotationOverflowAutomatic AnnotationOverflowStrategy = iota AnnotationOverflowFit AnnotationOverflowFitChart AnnotationOverflowFitPlot AnnotationOverflowPadScale AnnotationOverflowDisabled )
type AnnotationPosition ¶
type AnnotationPosition int32
AnnotationPosition controls where an annotation is attached.
const ( AnnotationTop AnnotationPosition = iota AnnotationBottom AnnotationLeading AnnotationTrailing AnnotationOverlay AnnotationTopLeading AnnotationTopTrailing AnnotationBottomLeading AnnotationBottomTrailing AnnotationAutomatic )
type AxisConfig ¶
type AxisConfig struct {
// contains filtered or unexported fields
}
AxisConfig configures chart axes.
type AxisLabelOption ¶
type AxisLabelOption struct {
// contains filtered or unexported fields
}
AxisLabelOption configures chart axis labels.
func AxisLabelAlignmentOption ¶
func AxisLabelAlignmentOption(alignment LabelAlignment) AxisLabelOption
AxisLabelAlignmentOption sets the axis label alignment.
func AxisLabelPosition ¶
func AxisLabelPosition(position AnnotationPosition) AxisLabelOption
AxisLabelPosition sets the axis label position.
func AxisLabelSpacing ¶
func AxisLabelSpacing(spacing float64) AxisLabelOption
AxisLabelSpacing sets the axis label spacing.
type AxisOption ¶
type AxisOption struct {
// contains filtered or unexported fields
}
AxisOption configures an axis.
func AxisDateLabels ¶
func AxisDateLabels(pattern string, centered bool) AxisOption
AxisDateLabels enables date labels using a limited format pattern such as "MMM", "MM/dd", or "HH:mm".
func AxisGridLinesStyled ¶
func AxisGridLinesStyled(style LineStyle, centered bool) AxisOption
AxisGridLinesStyled enables grid lines with styling.
func AxisPositionOption ¶
func AxisPositionOption(position AxisPosition) AxisOption
AxisPositionOption sets the axis position.
func AxisPresetOption ¶
func AxisPresetOption(preset AxisPreset) AxisOption
AxisPresetOption sets the axis preset.
func AxisTickCount ¶
func AxisTickCount(desiredCount int) AxisOption
AxisTickCount targets an approximate tick count using the framework's automatic placement.
func AxisTickMinimumStride ¶
func AxisTickMinimumStride(minimumStride float64, desiredCount int) AxisOption
AxisTickMinimumStride targets automatic placement with a minimum stride.
func AxisTickStride ¶
func AxisTickStride(step float64) AxisOption
AxisTickStride uses a fixed numeric stride.
func AxisTickStrideRounded ¶
func AxisTickStrideRounded(step float64, roundLowerBound, roundUpperBound bool) AxisOption
AxisTickStrideRounded uses a fixed numeric stride with explicit bound rounding.
func AxisTickValues ¶
func AxisTickValues(values ...Value) AxisOption
AxisTickValues uses an explicit ordered list of tick values.
func AxisTicksStyled ¶
func AxisTicksStyled(length AxisTickLength, style LineStyle, centered bool) AxisOption
AxisTicksStyled enables ticks with styling.
func AxisValueLabels ¶
func AxisValueLabels(format ValueFormat) AxisOption
AxisValueLabels enables numeric labels with an explicit formatter.
func AxisValuesOption ¶
func AxisValuesOption(values AxisValues) AxisOption
AxisValuesOption sets the axis values configuration.
type AxisPosition ¶
type AxisPosition int32
AxisPosition controls where an axis is drawn.
const ( AxisPositionAutomatic AxisPosition = iota AxisPositionBottom AxisPositionTop AxisPositionLeading AxisPositionTrailing )
type AxisPreset ¶
type AxisPreset int32
AxisPreset controls the preset used for axis marks.
const ( AxisPresetAutomatic AxisPreset = iota AxisPresetAligned AxisPresetExtended AxisPresetInset )
type AxisStyleOption ¶
type AxisStyleOption struct {
// contains filtered or unexported fields
}
AxisStyleOption configures axis-content styling for chartXAxisStyle/chartYAxisStyle.
func AxisStyleBackgroundColor ¶
func AxisStyleBackgroundColor(color swiftui.Color) AxisStyleOption
AxisStyleBackgroundColor applies a background color behind axis content.
func AxisStyleBackgroundView ¶
func AxisStyleBackgroundView(view swiftui.View) AxisStyleOption
AxisStyleBackgroundView places a SwiftUI view behind axis content.
func AxisStyleForeground ¶
func AxisStyleForeground(color swiftui.Color) AxisStyleOption
AxisStyleForeground applies a foreground style to axis content.
func AxisStyleOpacity ¶
func AxisStyleOpacity(opacity float64) AxisStyleOption
AxisStyleOpacity applies opacity to axis content.
func AxisStyleOverlayView ¶
func AxisStyleOverlayView(view swiftui.View) AxisStyleOption
AxisStyleOverlayView places a SwiftUI view over axis content.
type AxisTickLength ¶
type AxisTickLength struct {
// contains filtered or unexported fields
}
AxisTickLength controls native tick length behavior.
func AxisTickLengthLabel ¶
func AxisTickLengthLabel(extendPastBy float64) AxisTickLength
AxisTickLengthLabel matches the current label length.
func AxisTickLengthLongestLabel ¶
func AxisTickLengthLongestLabel(extendPastBy float64) AxisTickLength
AxisTickLengthLongestLabel matches the longest visible label length.
type AxisValues ¶
type AxisValues struct {
// contains filtered or unexported fields
}
AxisValues controls which ticks are emitted.
func AutomaticAxisValues ¶
func AutomaticAxisValues() AxisValues
AutomaticAxisValues uses the framework default tick placement.
func AutomaticAxisValuesCount ¶
func AutomaticAxisValuesCount(desiredCount int) AxisValues
AutomaticAxisValuesCount uses automatic placement with a desired tick count.
func AutomaticAxisValuesMinimumStride ¶
func AutomaticAxisValuesMinimumStride(minimumStride float64, desiredCount int) AxisValues
AutomaticAxisValuesMinimumStride uses automatic placement with a minimum stride.
func AxisValueList ¶
func AxisValueList(values ...Value) AxisValues
AxisValueList uses an explicit ordered list of tick values.
func NumericStride ¶
func NumericStride(step float64) AxisValues
NumericStride uses a numeric stride.
func NumericStrideRounded ¶
func NumericStrideRounded(step float64, roundLowerBound, roundUpperBound bool) AxisValues
NumericStrideRounded uses a numeric stride with explicit rounding.
func TimeStride ¶
func TimeStride(unit TimeUnit) AxisValues
TimeStride uses a calendar-based stride.
func TimeStrideCount ¶
func TimeStrideCount(unit TimeUnit, count int) AxisValues
TimeStrideCount uses a calendar-based stride with an explicit count.
func TimeStrideRounded ¶
func TimeStrideRounded(unit TimeUnit, count int, roundLowerBound, roundUpperBound bool) AxisValues
TimeStrideRounded uses a calendar-based stride with an explicit count and rounding.
type ChartView ¶
type ChartView struct {
// contains filtered or unexported fields
}
ChartView is a lazily-built Charts view.
func (ChartView) ChartAngleSelection ¶
func (c ChartView) ChartAngleSelection(binding SelectionValueBinding) ChartView
func (ChartView) ChartBackground ¶
func (c ChartView) ChartBackground(background ProxyBackground) ChartView
func (ChartView) ChartForegroundStyleScale ¶
func (c ChartView) ChartForegroundStyleScale(entries ...StyleScaleEntry) ChartView
ChartForegroundStyleScale configures a categorical foreground-style scale.
func (ChartView) ChartForegroundStyleScaleType ¶
ChartForegroundStyleScaleType sets the foreground-style scale type.
func (ChartView) ChartGesture ¶
func (c ChartView) ChartGesture(gesture ProxyGesture) ChartView
func (ChartView) ChartLegend ¶
func (c ChartView) ChartLegend(config LegendConfig) ChartView
ChartLegend configures legend visibility and placement.
func (ChartView) ChartLineStyleScale ¶
func (c ChartView) ChartLineStyleScale(entries ...LineStyleScaleEntry) ChartView
ChartLineStyleScale configures a categorical line-style scale.
func (ChartView) ChartOverlay ¶
func (c ChartView) ChartOverlay(overlay ProxyOverlay) ChartView
func (ChartView) ChartPlotStyle ¶
func (c ChartView) ChartPlotStyle(opts ...PlotStyleOption) ChartView
ChartPlotStyle configures the plot area.
func (ChartView) ChartScrollPositionInitialXDate ¶
ChartScrollPositionInitialXDate sets the initial time-based scroll position.
func (ChartView) ChartScrollPositionInitialXNumber ¶
ChartScrollPositionInitialXNumber sets the initial numeric scroll position.
func (ChartView) ChartScrollPositionInitialYDate ¶
ChartScrollPositionInitialYDate sets the initial time-based y scroll position.
func (ChartView) ChartScrollPositionInitialYNumber ¶
ChartScrollPositionInitialYNumber sets the initial numeric y scroll position.
func (ChartView) ChartScrollPositionX ¶
func (c ChartView) ChartScrollPositionX(binding ScrollPositionBinding) ChartView
func (ChartView) ChartScrollPositionY ¶
func (c ChartView) ChartScrollPositionY(binding ScrollPositionBinding) ChartView
func (ChartView) ChartScrollTargetBehavior ¶
func (c ChartView) ChartScrollTargetBehavior(behavior ScrollTargetBehavior) ChartView
func (ChartView) ChartScrollableAxes ¶
func (c ChartView) ChartScrollableAxes(axis ScrollAxis) ChartView
ChartScrollableAxes enables scrolling along the selected axes.
func (ChartView) ChartSymbolScale ¶
func (c ChartView) ChartSymbolScale(entries ...SymbolScaleEntry) ChartView
ChartSymbolScale configures a categorical symbol scale.
func (ChartView) ChartSymbolSizeScale ¶
func (c ChartView) ChartSymbolSizeScale(entries ...SymbolSizeScaleEntry) ChartView
ChartSymbolSizeScale configures a categorical symbol-size scale.
func (ChartView) ChartSymbolSizeScaleType ¶
ChartSymbolSizeScaleType sets the symbol-size scale type.
func (ChartView) ChartXAxis ¶
func (c ChartView) ChartXAxis(config AxisConfig) ChartView
ChartXAxis configures the x axis.
func (ChartView) ChartXAxisLabel ¶
func (c ChartView) ChartXAxisLabel(text string, opts ...AxisLabelOption) ChartView
ChartXAxisLabel sets the x-axis label.
func (ChartView) ChartXAxisStyle ¶
func (c ChartView) ChartXAxisStyle(opts ...AxisStyleOption) ChartView
ChartXAxisStyle styles x-axis content using a practical subset of chartXAxisStyle.
func (ChartView) ChartXScaleDomain ¶
ChartXScaleDomain sets the x-axis scale domain.
func (ChartView) ChartXScaleRange ¶
func (c ChartView) ChartXScaleRange(rng PositionScaleRange) ChartView
ChartXScaleRange sets the x-axis scale range.
func (ChartView) ChartXScaleType ¶
ChartXScaleType sets the x-axis scale type.
func (ChartView) ChartXSelection ¶
func (c ChartView) ChartXSelection(binding SelectionValueBinding) ChartView
func (ChartView) ChartXSelectionRange ¶
func (c ChartView) ChartXSelectionRange(binding SelectionRangeBinding) ChartView
func (ChartView) ChartXVisibleDomain ¶
func (ChartView) ChartXVisibleDomainLength ¶
ChartXVisibleDomainLength sets the visible x-domain length for scrollable charts.
For time-based charts, length is interpreted as seconds.
func (ChartView) ChartYAxis ¶
func (c ChartView) ChartYAxis(config AxisConfig) ChartView
ChartYAxis configures the y axis.
func (ChartView) ChartYAxisLabel ¶
func (c ChartView) ChartYAxisLabel(text string, opts ...AxisLabelOption) ChartView
ChartYAxisLabel sets the y-axis label.
func (ChartView) ChartYAxisStyle ¶
func (c ChartView) ChartYAxisStyle(opts ...AxisStyleOption) ChartView
ChartYAxisStyle styles y-axis content using a practical subset of chartYAxisStyle.
func (ChartView) ChartYScaleDomain ¶
ChartYScaleDomain sets the y-axis scale domain.
func (ChartView) ChartYScaleRange ¶
func (c ChartView) ChartYScaleRange(rng PositionScaleRange) ChartView
ChartYScaleRange sets the y-axis scale range.
func (ChartView) ChartYScaleType ¶
ChartYScaleType sets the y-axis scale type.
func (ChartView) ChartYSelection ¶
func (c ChartView) ChartYSelection(binding SelectionValueBinding) ChartView
func (ChartView) ChartYSelectionRange ¶
func (c ChartView) ChartYSelectionRange(binding SelectionRangeBinding) ChartView
func (ChartView) ChartYVisibleDomain ¶
func (ChartView) ChartYVisibleDomainLength ¶
ChartYVisibleDomainLength sets the visible y-domain length for scrollable charts.
For time-based charts, length is interpreted as seconds.
type DateComponents ¶
DateComponents is a narrow bridge for date-aligned scrolling.
func MatchTimeUnit ¶
func MatchTimeUnit(unit TimeUnit, count int) DateComponents
MatchTimeUnit returns date components for common chart time strides.
type DateRangeState ¶
type DateRangeState struct {
// contains filtered or unexported fields
}
DateRangeState is a bindable time-based range selection state.
func NewDateRangeState ¶
func NewDateRangeState(start, end time.Time, ok bool) *DateRangeState
func (*DateRangeState) Clear ¶
func (s *DateRangeState) Clear()
func (*DateRangeState) Release ¶
func (s *DateRangeState) Release()
func (*DateRangeState) Set ¶
func (s *DateRangeState) Set(start, end time.Time)
type DateState ¶
type DateState struct {
// contains filtered or unexported fields
}
DateState is a bindable time-based chart state.
func NewDateState ¶
type Dim ¶
type Dim struct {
// contains filtered or unexported fields
}
Dim is a mark dimension or dimension-like argument.
func AngularInset ¶
AngularInset sets a sector mark angular inset in points.
func HeightFixed ¶
HeightFixed sets a rectangle mark's height in points.
func InnerRadiusRatio ¶
InnerRadiusRatio sets a sector mark inner radius ratio.
func LowerQuartile ¶
LowerQuartile sets the first quartile value used by helpers such as BoxPlotMark.
func UpperQuartile ¶
UpperQuartile sets the third quartile value used by helpers such as BoxPlotMark.
func WidthRatio ¶
WidthRatio sets a rectangle or ranged bar width as a ratio of the slot width.
func XFloatRange ¶
func YFloatRange ¶
type Domain ¶
type Domain struct {
// contains filtered or unexported fields
}
Domain is a chart scale domain.
func CategoryDomain ¶
CategoryDomain creates an ordered categorical domain.
func IntegerDomain ¶
IntegerDomain creates an integer domain.
func NumberDomain ¶
NumberDomain creates a floating-point domain.
type DurationUnit ¶
type DurationUnit int32
DurationUnit controls duration-oriented numeric formatting.
const ( DurationUnitSecond DurationUnit = iota DurationUnitMillisecond DurationUnitMicrosecond DurationUnitNanosecond DurationUnitMinute )
type InterpolationMethod ¶
type InterpolationMethod struct {
// contains filtered or unexported fields
}
InterpolationMethod controls line and area interpolation.
func InterpolationCardinalTension ¶
func InterpolationCardinalTension(tension float64) InterpolationMethod
InterpolationCardinalTension returns a cardinal interpolation with an explicit tension.
func InterpolationCatmullRomAlpha ¶
func InterpolationCatmullRomAlpha(alpha float64) InterpolationMethod
InterpolationCatmullRomAlpha returns a Catmull-Rom interpolation with an explicit alpha.
type LabelAlignment ¶
type LabelAlignment int32
LabelAlignment controls label alignment for axis labels.
const ( LabelAlignmentCenter LabelAlignment = iota LabelAlignmentLeading LabelAlignmentTrailing LabelAlignmentTop LabelAlignmentBottom LabelAlignmentTopLeading LabelAlignmentTopTrailing LabelAlignmentBottomLeading LabelAlignmentBottomTrailing )
type LegendAlignment ¶
type LegendAlignment int32
LegendAlignment controls legend alignment.
const ( LegendAlignmentCenter LegendAlignment = iota LegendAlignmentLeading LegendAlignmentTrailing LegendAlignmentTop LegendAlignmentBottom )
type LegendConfig ¶
type LegendConfig struct {
Visibility LegendVisibility
Position LegendPosition
Alignment LegendAlignment
Spacing float64
}
LegendConfig configures the chart legend.
func LegendCompact ¶
func LegendCompact(position LegendPosition, alignment LegendAlignment) LegendConfig
LegendCompact returns a visible legend tuned for dense short series labels.
func LegendVisible ¶
func LegendVisible(position LegendPosition, alignment LegendAlignment, spacing float64) LegendConfig
LegendVisible returns a visible legend configuration.
type LegendPosition ¶
type LegendPosition int32
LegendPosition controls legend placement.
const ( LegendPositionAutomatic LegendPosition = iota LegendPositionTop LegendPositionBottom LegendPositionLeading LegendPositionTrailing LegendPositionOverlay )
type LegendVisibility ¶
type LegendVisibility int32
LegendVisibility controls legend visibility.
const ( LegendVisibilityAutomatic LegendVisibility = iota LegendVisibilityVisible LegendVisibilityHidden )
type LineStyleScaleEntry ¶
LineStyleScaleEntry maps a series key to a line style.
func LineStyleScale ¶
func LineStyleScale(key string, style LineStyle) LineStyleScaleEntry
LineStyleScale creates a categorical line-style scale entry.
type MajorValueAlignment ¶
type MajorValueAlignment struct {
// contains filtered or unexported fields
}
MajorValueAlignment controls how value-aligned scrolling snaps to larger boundaries.
func MajorValueAlignmentMatching ¶
func MajorValueAlignmentMatching(components DateComponents) MajorValueAlignment
func MajorValueAlignmentUnit ¶
func MajorValueAlignmentUnit(unit float64) MajorValueAlignment
type Mark ¶
type Mark struct {
// contains filtered or unexported fields
}
Mark is a chart mark or a mark group.
func BoxPlotMark ¶
BoxPlotMark creates a box plot from min/q1/median/q3/max values.
func ErrorBarMark ¶
ErrorBarMark creates a whisker-style interval mark.
func MapPointPlot ¶
MapPointPlot maps a Go slice into a vectorized point plot.
func MapRectanglePlot ¶
func MapRectanglePlot[T any](data []T, x func(T) Value, y func(T) Value, width, height MarkDimension) Mark
MapRectanglePlot maps a Go slice into a vectorized centered rectangle plot.
func MapRulePlot ¶
MapRulePlot maps a Go slice into a vectorized ranged rule plot.
func PointPlot ¶
func PointPlot(data ...PointPlotDatum) Mark
PointPlot creates a vectorized point plot.
func RangeBarMark ¶
RangeBarMark creates a horizontal or vertical interval bar.
func RectanglePlot ¶
func RectanglePlot(data ...RectanglePlotDatum) Mark
RectanglePlot creates a vectorized rectangle plot.
func ReferenceLineX ¶
ReferenceLineX creates a labeled x-axis reference line.
func ReferenceLineY ¶
ReferenceLineY creates a labeled y-axis reference line.
func (Mark) AccessibilityHidden ¶
AccessibilityHidden hides a mark from accessibility.
func (Mark) AccessibilityLabel ¶
AccessibilityLabel sets a mark accessibility label.
func (Mark) AccessibilityValue ¶
AccessibilityValue sets a mark accessibility value description.
func (Mark) AlignsMarkStylesWithPlotArea ¶
AlignsMarkStylesWithPlotArea aligns mark styles with the plot area.
func (Mark) Annotation ¶
func (m Mark) Annotation(position AnnotationPosition, alignment AnnotationAlignment, content swiftui.View) Mark
Annotation attaches a SwiftUI view annotation to the mark.
func (Mark) AnnotationCollision ¶
func (m Mark) AnnotationCollision(mode AnnotationCollisionMode) Mark
AnnotationCollision applies a built-in collision policy for nearby annotations.
func (Mark) AnnotationDeclutterByDistance ¶
AnnotationDeclutterByDistance suppresses annotations on nearby sibling marks.
The heuristic runs in chart data space, with latest marks winning ties. Numeric and time axes use their underlying values. Categorical axes use stable ordinal positions within the sibling sequence.
func (Mark) AnnotationDeclutterLatest ¶
AnnotationDeclutterLatest keeps annotations on only the most recent marks in a sibling sequence.
func (Mark) AnnotationOffset ¶
AnnotationOffset offsets an annotation view in points after attachment.
func (Mark) AnnotationOffsetChart ¶
AnnotationOffsetChart offsets an annotation anchor in chart data space.
This is intended for numeric and time axes. Unsupported axes leave the mark unchanged.
func (Mark) AnnotationOverflow ¶
func (m Mark) AnnotationOverflow(x, y AnnotationOverflowStrategy) Mark
AnnotationOverflow sets overflow handling for mark annotations.
func (Mark) AnnotationPriority ¶
AnnotationPriority prefers this annotation when using AnnotationCollisionKeepPriority.
func (Mark) CornerRadius ¶
CornerRadius sets a corner radius for supported marks.
func (Mark) ExcludeFromLegend ¶
ExcludeFromLegend resolves style-scale-backed mark styling to fixed values when possible.
func (Mark) ForegroundStyle ¶
ForegroundStyle sets a fixed mark color.
func (Mark) ForegroundStyleBy ¶
ForegroundStyleBy assigns a categorical style key, typically producing a legend.
func (Mark) Interpolation ¶
func (m Mark) Interpolation(method InterpolationMethod) Mark
Interpolation sets the interpolation method for line and area marks.
func (Mark) LineStyleBy ¶
LineStyleBy assigns line styles by category.
func (Mark) PositionBy ¶
PositionBy groups marks by category for side-by-side placement.
func (Mark) Stacking ¶
func (m Mark) Stacking(stacking MarkStacking) Mark
Stacking sets bar or area stacking behavior.
func (Mark) SymbolDiameter ¶
SymbolDiameter sets the symbol size using a visual diameter in points.
func (Mark) SymbolRadius ¶
SymbolRadius sets the symbol size using a visual radius in points.
func (Mark) SymbolSize ¶
SymbolSize sets the symbol area in square points.
func (Mark) SymbolSizeBy ¶
SymbolSizeBy assigns symbol sizes by category.
func (Mark) SymbolStroke ¶
SymbolStroke draws a contrasting outline around a fixed symbol.
func (Mark) TextAnnotation ¶
func (m Mark) TextAnnotation(text string, position AnnotationPosition) Mark
TextAnnotation attaches a lightweight text label to the mark.
func (Mark) TextAnnotationAligned ¶
func (m Mark) TextAnnotationAligned(text string, position AnnotationPosition, alignment AnnotationAlignment) Mark
TextAnnotationAligned attaches a lightweight text label with explicit alignment.
type MarkDimension ¶
type MarkDimension struct {
// contains filtered or unexported fields
}
MarkDimension configures vectorized rectangle sizing.
func MarkDimensionFixed ¶
func MarkDimensionFixed(points float64) MarkDimension
MarkDimensionFixed uses a fixed size in points.
func MarkDimensionInset ¶
func MarkDimensionInset(inset float64) MarkDimension
MarkDimensionInset uses an inset relative to the slot.
func MarkDimensionRatio ¶
func MarkDimensionRatio(ratio float64) MarkDimension
MarkDimensionRatio uses a slot-relative size ratio.
type MarkStacking ¶
type MarkStacking int32
MarkStacking controls bar and area stacking behavior.
const ( MarkStackingAutomatic MarkStacking = iota MarkStackingStandard MarkStackingCentered MarkStackingNormalized MarkStackingUnstacked )
type NumberRangeState ¶
type NumberRangeState struct {
// contains filtered or unexported fields
}
NumberRangeState is a bindable numeric range selection state.
func NewNumberRangeState ¶
func NewNumberRangeState(start, end float64, ok bool) *NumberRangeState
func (*NumberRangeState) Clear ¶
func (s *NumberRangeState) Clear()
func (*NumberRangeState) Release ¶
func (s *NumberRangeState) Release()
func (*NumberRangeState) Set ¶
func (s *NumberRangeState) Set(start, end float64)
type NumberState ¶
type NumberState struct {
// contains filtered or unexported fields
}
NumberState is a bindable numeric chart state.
func NewNumberState ¶
func NewNumberState(initial float64) *NumberState
func (*NumberState) Get ¶
func (s *NumberState) Get() float64
func (*NumberState) Release ¶
func (s *NumberState) Release()
func (*NumberState) Set ¶
func (s *NumberState) Set(v float64)
type OptionalDateState ¶
type OptionalDateState struct {
// contains filtered or unexported fields
}
OptionalDateState is a bindable optional time-based selection state.
func NewOptionalDateState ¶
func NewOptionalDateState(initial time.Time, ok bool) *OptionalDateState
func (*OptionalDateState) Clear ¶
func (s *OptionalDateState) Clear()
func (*OptionalDateState) Release ¶
func (s *OptionalDateState) Release()
func (*OptionalDateState) Set ¶
func (s *OptionalDateState) Set(v time.Time)
type OptionalNumberState ¶
type OptionalNumberState struct {
// contains filtered or unexported fields
}
OptionalNumberState is a bindable optional numeric selection state.
func NewOptionalNumberState ¶
func NewOptionalNumberState(initial float64, ok bool) *OptionalNumberState
func (*OptionalNumberState) Clear ¶
func (s *OptionalNumberState) Clear()
func (*OptionalNumberState) Get ¶
func (s *OptionalNumberState) Get() (float64, bool)
func (*OptionalNumberState) Release ¶
func (s *OptionalNumberState) Release()
func (*OptionalNumberState) Set ¶
func (s *OptionalNumberState) Set(v float64)
type PlotStyleOption ¶
type PlotStyleOption struct {
// contains filtered or unexported fields
}
PlotStyleOption configures the chart plot area.
func PlotBackgroundColor ¶
func PlotBackgroundColor(color swiftui.Color) PlotStyleOption
PlotBackgroundColor sets a solid plot-area background color.
func PlotBackgroundView ¶
func PlotBackgroundView(view swiftui.View) PlotStyleOption
PlotBackgroundView places a SwiftUI view behind the plot area.
func PlotBorder ¶
func PlotBorder(color swiftui.Color, width float64) PlotStyleOption
PlotBorder draws a border around the plot area.
func PlotInset ¶
func PlotInset(top, right, bottom, left float64) PlotStyleOption
PlotInset adds plot-area padding in points.
func PlotInsetAll ¶
func PlotInsetAll(padding float64) PlotStyleOption
PlotInsetAll adds equal plot-area padding on every edge in points.
func PlotOverlayView ¶
func PlotOverlayView(view swiftui.View) PlotStyleOption
PlotOverlayView places a SwiftUI view over the plot area.
type PointPlotDatum ¶
PointPlotDatum is one point in a vectorized point plot.
func PlotPoint ¶
func PlotPoint(x, y Value) PointPlotDatum
PlotPoint creates a vectorized point plot datum.
type PositionScaleRange ¶
type PositionScaleRange struct {
// contains filtered or unexported fields
}
PositionScaleRange controls a native positional scale range.
func PlotDimensionRange ¶
func PlotDimensionRange(startPadding, endPadding float64) PositionScaleRange
PlotDimensionRange uses the plot dimension with optional start and end padding.
type ProxyBackground ¶
type ProxyBackground struct {
// contains filtered or unexported fields
}
ProxyBackground is a practical chart background driven by ChartProxy data.
func SelectionBandBackgroundX ¶
func SelectionBandBackgroundX(r SelectionRangeBinding, color swiftui.Color) ProxyBackground
SelectionBandBackgroundX shows the selected x-range behind the plot.
func SelectionBandBackgroundY ¶
func SelectionBandBackgroundY(r SelectionRangeBinding, color swiftui.Color) ProxyBackground
SelectionBandBackgroundY shows the selected y-range behind the plot.
type ProxyGesture ¶
type ProxyGesture struct {
// contains filtered or unexported fields
}
ProxyGesture is a practical drag-selection gesture driven by ChartProxy.
func DragAngleSelectionGesture ¶
func DragAngleSelectionGesture(state SelectionValueBinding, minDistance float64) ProxyGesture
func DragXRangeSelectionGesture ¶
func DragXRangeSelectionGesture(state SelectionRangeBinding, minDistance float64) ProxyGesture
func DragXSelectionGesture ¶
func DragXSelectionGesture(state SelectionValueBinding, minDistance float64) ProxyGesture
func DragYRangeSelectionGesture ¶
func DragYRangeSelectionGesture(state SelectionRangeBinding, minDistance float64) ProxyGesture
func DragYSelectionGesture ¶
func DragYSelectionGesture(state SelectionValueBinding, minDistance float64) ProxyGesture
type ProxyOverlay ¶
type ProxyOverlay struct {
// contains filtered or unexported fields
}
ProxyOverlay is a practical chart overlay driven by ChartProxy data.
func CrosshairOverlay ¶
func CrosshairOverlay(x SelectionValueBinding, y SelectionValueBinding, color swiftui.Color, width float64) ProxyOverlay
CrosshairOverlay draws x/y crosshair guides from selection state.
func ReadoutOverlay ¶
func ReadoutOverlay(x SelectionValueBinding, y SelectionValueBinding, alignment LabelAlignment, xFormat, yFormat ValueFormat) ProxyOverlay
ReadoutOverlay shows a compact hover/readout box from selection state.
type RectanglePlotDatum ¶
type RectanglePlotDatum struct {
X *Value
Y *Value
XStart *Value
XEnd *Value
YStart *Value
YEnd *Value
Width MarkDimension
Height MarkDimension
}
RectanglePlotDatum is one rectangle in a vectorized rectangle plot.
func PlotRectangleRange ¶
func PlotRectangleRange(xStart, xEnd, yStart, yEnd Value) RectanglePlotDatum
PlotRectangleRange creates a fully-ranged rectangle datum.
func PlotRectangleXRange ¶
func PlotRectangleXRange(xStart, xEnd, y Value, height MarkDimension) RectanglePlotDatum
PlotRectangleXRange creates a ranged-x rectangle datum.
func PlotRectangleXY ¶
func PlotRectangleXY(x, y Value, width, height MarkDimension) RectanglePlotDatum
PlotRectangleXY creates a centered rectangle datum.
func PlotRectangleYRange ¶
func PlotRectangleYRange(x, yStart, yEnd Value, width MarkDimension) RectanglePlotDatum
PlotRectangleYRange creates a ranged-y rectangle datum.
type RulePlotDatum ¶
RulePlotDatum is one rule in a vectorized rule plot.
func PlotRuleXRange ¶
func PlotRuleXRange(xStart, xEnd, y Value) RulePlotDatum
PlotRuleXRange creates an x-ranged rule datum.
func PlotRuleYRange ¶
func PlotRuleYRange(x, yStart, yEnd Value) RulePlotDatum
PlotRuleYRange creates a y-ranged rule datum.
type ScaleType ¶
type ScaleType struct {
// contains filtered or unexported fields
}
ScaleType controls a chart axis scale type.
func ScaleTypePower ¶
ScaleTypePower returns a power scale with the provided exponent.
func ScaleTypeSymmetricLog ¶
ScaleTypeSymmetricLog returns a symmetric-log scale with the provided slope near zero.
type ScrollAxis ¶
type ScrollAxis int32
ScrollAxis controls chart scrolling.
const ( ScrollAxisNone ScrollAxis = iota ScrollAxisHorizontal ScrollAxisVertical ScrollAxisBoth )
type ScrollPositionBinding ¶
type ScrollPositionBinding interface {
// contains filtered or unexported methods
}
type ScrollTargetBehavior ¶
type ScrollTargetBehavior struct {
// contains filtered or unexported fields
}
ScrollTargetBehavior configures snapping for scrollable charts.
func DateAlignedScrollTarget ¶
func DateAlignedScrollTarget(components DateComponents, major *MajorValueAlignment, limit ValueAlignedLimitBehavior) ScrollTargetBehavior
DateAlignedScrollTarget aligns scrolling to matching date components.
func DateAlignedXYScrollTarget ¶
func DateAlignedXYScrollTarget(xDate, yDate DateComponents, xMajor, yMajor *MajorValueAlignment, limit ValueAlignedLimitBehavior) ScrollTargetBehavior
DateAlignedXYScrollTarget aligns both axes to date components.
func ValueAlignedScrollTarget ¶
func ValueAlignedScrollTarget(unit float64, major *MajorValueAlignment, limit ValueAlignedLimitBehavior) ScrollTargetBehavior
ValueAlignedScrollTarget aligns scrolling to a numeric unit.
func ValueAlignedXYScrollTarget ¶
func ValueAlignedXYScrollTarget(xUnit, yUnit float64, xMajor, yMajor *MajorValueAlignment, limit ValueAlignedLimitBehavior) ScrollTargetBehavior
ValueAlignedXYScrollTarget aligns both axes to numeric units.
type SelectionRangeBinding ¶
type SelectionRangeBinding interface {
// contains filtered or unexported methods
}
type SelectionValueBinding ¶
type SelectionValueBinding interface {
// contains filtered or unexported methods
}
type StyleScaleEntry ¶
StyleScaleEntry maps a series key to a color.
func StyleScale ¶
func StyleScale(key string, color swiftui.Color) StyleScaleEntry
StyleScale creates a categorical foreground-style scale entry.
type SymbolKind ¶
type SymbolKind int32
SymbolKind controls a fixed symbol shape.
const ( SymbolCircle SymbolKind = iota SymbolSquare SymbolDiamond SymbolTriangle SymbolPentagon SymbolPlus SymbolCross SymbolAsterisk )
type SymbolScaleEntry ¶
type SymbolScaleEntry struct {
Key string
Symbol SymbolKind
}
SymbolScaleEntry maps a series key to a symbol shape.
func SymbolScale ¶
func SymbolScale(key string, symbol SymbolKind) SymbolScaleEntry
SymbolScale creates a categorical symbol-scale entry.
type SymbolSizeScaleEntry ¶
SymbolSizeScaleEntry maps a series key to a symbol size.
func SymbolSizeScale ¶
func SymbolSizeScale(key string, size float64) SymbolSizeScaleEntry
SymbolSizeScale creates a categorical symbol-size scale entry.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is a labeled plottable value used by mark dimensions.
func CategoryValue ¶
CategoryValue creates a categorical plottable value.
func IntegerValue ¶
IntegerValue creates an integer plottable value.
func NumberValue ¶
NumberValue creates a floating-point plottable value.
type ValueAlignedLimitBehavior ¶
type ValueAlignedLimitBehavior int32
const ( ValueAlignedLimitAutomatic ValueAlignedLimitBehavior = iota ValueAlignedLimitAlways ValueAlignedLimitNever )
type ValueFormat ¶
type ValueFormat struct {
// contains filtered or unexported fields
}
ValueFormat controls numeric formatting for axis labels and exact-value annotations.
func CompactFormat ¶
func CompactFormat(precision int) ValueFormat
CompactFormat formats a value using compact notation such as 1.2K or 4.6M.
func DurationFormat ¶
func DurationFormat(unit DurationUnit, precision int) ValueFormat
DurationFormat formats a numeric value as a duration-like label in a fixed unit.
func FixedFormat ¶
func FixedFormat(precision int) ValueFormat
FixedFormat formats a value with fixed fractional precision.
func PercentFormat ¶
func PercentFormat(precision int) ValueFormat
PercentFormat formats a fractional value as a percentage.
func SuffixFormat ¶
func SuffixFormat(suffix string, precision int) ValueFormat
SuffixFormat formats a value with fixed precision and a literal suffix.
func (ValueFormat) Format ¶
func (f ValueFormat) Format(value float64) string
Format formats a numeric value using the configured rules.