fyneline

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 8 Imported by: 0

README

Fyneline

Typed, responsive charts for Fyne, with a chainable API inspired by LayerChart.

go get github.com/nathabonfim59/fyneline

Fyneline currently provides BarChart, AreaChart, ArcChart, and Spline. Each is a regular fyne.Widget that can be passed directly to Window.SetContent or any Fyne container.

The examples directory contains runnable projects and a Makefile that regenerates these captures with Fyne's software renderer.

BarChart AreaChart
BarChart examples AreaChart examples
ArcChart Spline
ArcChart examples Spline examples

From the examples folder, run make render for every screenshot or make render EXAMPLE=arc-chart for one. See the examples README for all targets.

BarChart

type Sale struct {
    Month   string
    Online  float64
    InStore float64
}

chart := fyneline.NewBarChart(
    sales,
    func(s Sale) string { return s.Month },
    fyneline.NewBarSeries("Online", func(s Sale) float64 { return s.Online }),
    fyneline.NewBarSeries("In store", func(s Sale) float64 { return s.InStore }),
).
    SetSeriesLayout(fyneline.SeriesGroup).
    SetBandPadding(0.4).
    SetValueAxis(fyneline.NewNumericAxis().WithDomain(0, 100))

Bar series support SeriesOverlap, SeriesGroup, SeriesStack, SeriesStackExpand, and SeriesStackDiverging, plus vertical and horizontal orientations.

AreaChart

chart := fyneline.NewAreaChart(
    readings,
    fyneline.TimeAccessor(func(r Reading) time.Time { return r.Time }),
    fyneline.NewAreaSeries("Temperature", func(r Reading) float64 { return r.Value }),
).
    SetCurve(fyneline.CurveMonotoneX).
    SetXAxis(fyneline.NewTimeAxis("15:04", time.Local))

Area charts share the spline curve and gap policies and support overlapping, stacked, normalized, and diverging series.

ArcChart

chart := fyneline.NewArcChart(
    segments,
    func(s Segment) float64 { return s.Value },
    func(s Segment) string { return s.Name },
).
    SetInnerRadius(0.58).
    SetRange(-120, 120).
    SetPadAngle(2).
    SetLabels(true)

Angles are degrees with zero at the top and positive values moving clockwise. Use SetMaxValue for partially filled gauges.

Spline

chart := fyneline.NewSpline(
    points,
    func(p Point) float64 { return p.X },
    fyneline.NewSplineSeries("Value", func(p Point) float64 { return p.Y }),
).SetCurve(fyneline.CurveMonotoneX)

Available curves are linear, monotone-x, step, step-before, and step-after. Optional series accessors can break, connect, or replace missing values with zero.

Live updates

Chart setters refresh immediately and return the receiver for chaining. Input slices are copied. As with other Fyne widgets, schedule updates originating in background goroutines on Fyne's UI goroutine:

fyne.Do(func() {
    chart.SetData(updated)
})

Documentation

Every exported API is documented for go doc:

go doc github.com/nathabonfim59/fyneline
go doc github.com/nathabonfim59/fyneline.BarChart
go doc github.com/nathabonfim59/fyneline.NewArcChart

Requirements

  • Go 1.22 or later
  • Fyne 2.8 or later

Fyneline is available under the MIT License.

Documentation

Overview

Package fyneline provides typed, responsive charts for Fyne applications.

Charts accept application-defined data through accessor functions. This keeps data preparation type-safe while offering the property-oriented, chainable configuration style familiar from LayerChart.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Palette

func Palette(colors ...color.Color) func(index int) color.Color

Palette returns an index-based color accessor that cycles through colors. A palette with no colors always returns nil.

func TimeAccessor

func TimeAccessor[T any](accessor func(T) time.Time) func(T) float64

TimeAccessor converts time values to Unix seconds for a continuous axis.

Types

type ArcChart

type ArcChart[T any] struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

ArcChart displays values as portions of a circle. It supports pie, doughnut, gauge, and partial-circle layouts through its radius and range setters.

func NewArcChart

func NewArcChart[T any, N Number](data []T, value func(T) N, label func(T) string) *ArcChart[T]

NewArcChart constructs an arc chart. Angles use degrees, with zero at the top and positive values moving clockwise, matching LayerChart and canvas.Arc.

Example
package main

import (
	"image/color"

	"github.com/nathabonfim59/fyneline"
)

func main() {
	type Segment struct {
		Name  string
		Value float64
	}
	segments := []Segment{{Name: "Used", Value: 72}, {Name: "Free", Value: 28}}
	colors := fyneline.Palette(
		color.NRGBA{R: 62, G: 126, B: 247, A: 255},
		color.NRGBA{R: 215, G: 220, B: 230, A: 255},
	)

	chart := fyneline.NewArcChart(segments,
		func(s Segment) float64 { return s.Value },
		func(s Segment) string { return s.Name },
	).
		SetInnerRadius(0.58).
		SetPadAngle(2).
		SetStyle(func(_ Segment, index int) fyneline.ArcStyle {
			return fyneline.ArcStyle{Fill: fyneline.FillStyle{Color: colors(index), Opacity: 1}}
		})

	_ = chart
}

func (*ArcChart[T]) CreateRenderer

func (c *ArcChart[T]) CreateRenderer() fyne.WidgetRenderer

CreateRenderer implements fyne.Widget.

func (*ArcChart[T]) SetCornerRadius

func (c *ArcChart[T]) SetCornerRadius(radius float32) *ArcChart[T]

SetCornerRadius sets arc corner rounding in logical pixels.

func (*ArcChart[T]) SetData

func (c *ArcChart[T]) SetData(data []T) *ArcChart[T]

SetData replaces the chart data and refreshes the widget.

func (*ArcChart[T]) SetInnerRadius

func (c *ArcChart[T]) SetInnerRadius(fraction float32) *ArcChart[T]

SetInnerRadius sets the cutout as a fraction of the outer radius.

func (*ArcChart[T]) SetLabels

func (c *ArcChart[T]) SetLabels(visible bool) *ArcChart[T]

SetLabels shows or hides labels at arc centroids.

func (*ArcChart[T]) SetMaxValue

func (c *ArcChart[T]) SetMaxValue(value float64) *ArcChart[T]

SetMaxValue fixes the value represented by the complete angular range. It is useful for gauges whose data does not fill the range.

func (*ArcChart[T]) SetOuterRadius

func (c *ArcChart[T]) SetOuterRadius(fraction float32) *ArcChart[T]

SetOuterRadius sets the outer radius as a fraction of available space.

func (*ArcChart[T]) SetPadAngle

func (c *ArcChart[T]) SetPadAngle(degrees float64) *ArcChart[T]

SetPadAngle sets the angular space between adjacent arcs in degrees.

func (*ArcChart[T]) SetPadding

func (c *ArcChart[T]) SetPadding(padding Insets) *ArcChart[T]

SetPadding sets logical-pixel insets around the chart.

func (*ArcChart[T]) SetRange

func (c *ArcChart[T]) SetRange(start, end float64) *ArcChart[T]

SetRange sets the chart's angular range in degrees.

func (*ArcChart[T]) SetStyle

func (c *ArcChart[T]) SetStyle(style func(T, int) ArcStyle) *ArcChart[T]

SetStyle assigns per-datum styling. The index is the datum's display index.

type ArcStyle

type ArcStyle struct {
	Fill   FillStyle
	Stroke StrokeStyle
}

ArcStyle controls an arc's fill and outline.

type AreaChart

type AreaChart[T any] struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

AreaChart displays quantitative series as filled areas over a continuous x axis. It defaults to overlapping series with a zero baseline.

func NewAreaChart

func NewAreaChart[T any, X Number](data []T, x func(T) X, series ...AreaSeries[T]) *AreaChart[T]

NewAreaChart constructs an area chart from data, an x accessor, and one or more numerical series.

Example
package main

import (
	"time"

	"github.com/nathabonfim59/fyneline"
)

func main() {
	type Reading struct {
		Time  time.Time
		Value float64
		Valid bool
	}
	readings := []Reading{
		{Time: time.Unix(0, 0), Value: 12, Valid: true},
		{Time: time.Unix(60, 0), Valid: false},
		{Time: time.Unix(120, 0), Value: 15, Valid: true},
	}

	chart := fyneline.NewAreaChart(readings,
		fyneline.TimeAccessor(func(r Reading) time.Time { return r.Time }),
		fyneline.NewOptionalAreaSeries("Temperature", func(r Reading) (float64, bool) {
			return r.Value, r.Valid
		}),
	).
		SetCurve(fyneline.CurveMonotoneX).
		SetXAxis(fyneline.NewTimeAxis("15:04", time.UTC))

	_ = chart
}

func (*AreaChart[T]) CreateRenderer

func (c *AreaChart[T]) CreateRenderer() fyne.WidgetRenderer

CreateRenderer implements fyne.Widget.

func (*AreaChart[T]) SetCurve

func (c *AreaChart[T]) SetCurve(curve Curve) *AreaChart[T]

SetCurve selects linear, monotone, or stepped interpolation.

func (*AreaChart[T]) SetData

func (c *AreaChart[T]) SetData(data []T) *AreaChart[T]

SetData replaces the chart data and refreshes the widget.

func (*AreaChart[T]) SetGapPolicy

func (c *AreaChart[T]) SetGapPolicy(policy GapPolicy) *AreaChart[T]

SetGapPolicy controls how optional series values are connected.

func (*AreaChart[T]) SetPadding

func (c *AreaChart[T]) SetPadding(padding Insets) *AreaChart[T]

SetPadding sets logical-pixel insets around the chart.

func (*AreaChart[T]) SetSeries

func (c *AreaChart[T]) SetSeries(series ...AreaSeries[T]) *AreaChart[T]

SetSeries replaces the displayed series and refreshes the widget.

func (*AreaChart[T]) SetSeriesLayout

func (c *AreaChart[T]) SetSeriesLayout(layout SeriesLayout) *AreaChart[T]

SetSeriesLayout selects overlap, stack, normalized stack, or diverging stack. SeriesGroup is treated as SeriesOverlap for area charts.

func (*AreaChart[T]) SetXAxis

func (c *AreaChart[T]) SetXAxis(axis NumericAxis) *AreaChart[T]

SetXAxis replaces the x-axis configuration.

func (*AreaChart[T]) SetYAxis

func (c *AreaChart[T]) SetYAxis(axis NumericAxis) *AreaChart[T]

SetYAxis replaces the y-axis configuration.

type AreaSeries

type AreaSeries[T any] struct {
	// contains filtered or unexported fields
}

AreaSeries describes one named set of values in an AreaChart.

func NewAreaSeries

func NewAreaSeries[T any, N Number](name string, value func(T) N) AreaSeries[T]

NewAreaSeries creates an area series from a required numeric accessor.

func NewOptionalAreaSeries

func NewOptionalAreaSeries[T any, N Number](name string, value func(T) (N, bool)) AreaSeries[T]

NewOptionalAreaSeries creates an area series whose accessor can report gaps.

func (AreaSeries[T]) WithFill

func (s AreaSeries[T]) WithFill(c color.Color) AreaSeries[T]

WithFill returns a copy of the series filled with c.

func (AreaSeries[T]) WithStroke

func (s AreaSeries[T]) WithStroke(stroke StrokeStyle) AreaSeries[T]

WithStroke returns a copy of the series using stroke.

func (AreaSeries[T]) WithStyle

func (s AreaSeries[T]) WithStyle(style AreaStyle) AreaSeries[T]

WithStyle returns a copy of the series using style.

type AreaStyle

type AreaStyle struct {
	Fill   FillStyle
	Stroke StrokeStyle
}

AreaStyle controls an area's fill and boundary line.

type AxisStyle

type AxisStyle struct {
	LineColor  color.Color
	LabelColor color.Color
	GridColor  color.Color
	LineWidth  float32
	TextSize   float32
}

AxisStyle controls axis, grid, and label appearance. Nil colors use the active Fyne theme.

type BarChart

type BarChart[T any] struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

BarChart displays categorical data using rectangular bars. It defaults to vertical, overlapping series with LayerChart-compatible band padding.

func NewBarChart

func NewBarChart[T any](data []T, category func(T) string, series ...BarSeries[T]) *BarChart[T]

NewBarChart constructs a category-based bar chart. Categories appear in first-seen order unless CategoryAxis.WithCategories supplies an order.

Example
package main

import (
	"github.com/nathabonfim59/fyneline"
)

func main() {
	type Sale struct {
		Month   string
		Online  float64
		InStore float64
	}
	sales := []Sale{
		{Month: "Jan", Online: 42, InStore: 31},
		{Month: "Feb", Online: 55, InStore: 38},
		{Month: "Mar", Online: 49, InStore: 44},
	}

	chart := fyneline.NewBarChart(sales,
		func(s Sale) string { return s.Month },
		fyneline.NewBarSeries("Online", func(s Sale) float64 { return s.Online }),
		fyneline.NewBarSeries("In store", func(s Sale) float64 { return s.InStore }),
	).
		SetSeriesLayout(fyneline.SeriesGroup).
		SetValueAxis(fyneline.NewNumericAxis().WithDomain(0, 60))

	_ = chart // Pass chart directly to Window.SetContent.
}

func (*BarChart[T]) CreateRenderer

func (c *BarChart[T]) CreateRenderer() fyne.WidgetRenderer

CreateRenderer implements fyne.Widget.

func (*BarChart[T]) SetBandPadding

func (c *BarChart[T]) SetBandPadding(padding float32) *BarChart[T]

SetBandPadding sets the empty fraction of each category band. Values outside [0, 1) are replaced by the default 0.4.

func (*BarChart[T]) SetCategoryAxis

func (c *BarChart[T]) SetCategoryAxis(axis CategoryAxis) *BarChart[T]

SetCategoryAxis replaces the category-axis configuration.

func (*BarChart[T]) SetData

func (c *BarChart[T]) SetData(data []T) *BarChart[T]

SetData replaces the chart data and refreshes the widget.

func (*BarChart[T]) SetGroupPadding

func (c *BarChart[T]) SetGroupPadding(padding float32) *BarChart[T]

SetGroupPadding sets the empty fraction between bars in a grouped band.

func (*BarChart[T]) SetOrientation

func (c *BarChart[T]) SetOrientation(orientation BarOrientation) *BarChart[T]

SetOrientation selects vertical or horizontal bars.

func (*BarChart[T]) SetPadding

func (c *BarChart[T]) SetPadding(padding Insets) *BarChart[T]

SetPadding sets logical-pixel insets around the chart.

func (*BarChart[T]) SetSeries

func (c *BarChart[T]) SetSeries(series ...BarSeries[T]) *BarChart[T]

SetSeries replaces the displayed series and refreshes the widget.

func (*BarChart[T]) SetSeriesLayout

func (c *BarChart[T]) SetSeriesLayout(layout SeriesLayout) *BarChart[T]

SetSeriesLayout selects overlap, stack, normalized stack, diverging stack, or grouped rendering.

func (*BarChart[T]) SetStackPadding

func (c *BarChart[T]) SetStackPadding(padding float32) *BarChart[T]

SetStackPadding sets the empty fraction removed from stacked bar edges.

func (*BarChart[T]) SetValueAxis

func (c *BarChart[T]) SetValueAxis(axis NumericAxis) *BarChart[T]

SetValueAxis replaces the value-axis configuration.

type BarOrientation

type BarOrientation uint8

BarOrientation controls the direction in which bars grow.

const (
	// BarVertical displays categories horizontally and values vertically.
	BarVertical BarOrientation = iota
	// BarHorizontal displays categories vertically and values horizontally.
	BarHorizontal
)

type BarSeries

type BarSeries[T any] struct {
	// contains filtered or unexported fields
}

BarSeries describes one named set of values in a BarChart.

func NewBarSeries

func NewBarSeries[T any, N Number](name string, value func(T) N) BarSeries[T]

NewBarSeries creates a bar series from a required numeric accessor.

func NewOptionalBarSeries

func NewOptionalBarSeries[T any, N Number](name string, value func(T) (N, bool)) BarSeries[T]

NewOptionalBarSeries creates a bar series whose accessor can report gaps.

func (BarSeries[T]) WithFill

func (s BarSeries[T]) WithFill(c color.Color) BarSeries[T]

WithFill returns a copy of the series filled with c.

func (BarSeries[T]) WithStroke

func (s BarSeries[T]) WithStroke(stroke StrokeStyle) BarSeries[T]

WithStroke returns a copy of the series using stroke.

func (BarSeries[T]) WithStyle

func (s BarSeries[T]) WithStyle(style BarStyle) BarSeries[T]

WithStyle returns a copy of the series using style.

type BarStyle

type BarStyle struct {
	Fill         FillStyle
	Stroke       StrokeStyle
	CornerRadius float32
}

BarStyle controls a bar's fill, outline, and corner radius.

type CategoryAxis

type CategoryAxis struct {
	// contains filtered or unexported fields
}

CategoryAxis configures a discrete category axis. Build one with NewCategoryAxis and customize it using its With methods.

func NewCategoryAxis

func NewCategoryAxis() CategoryAxis

NewCategoryAxis returns a visible category axis using data order.

func (CategoryAxis) WithCategories

func (a CategoryAxis) WithCategories(categories ...string) CategoryAxis

WithCategories returns an axis with an explicit category order.

func (CategoryAxis) WithFormatter

func (a CategoryAxis) WithFormatter(format func(string) string) CategoryAxis

WithFormatter returns an axis that formats category labels with format.

func (CategoryAxis) WithGrid

func (a CategoryAxis) WithGrid(visible bool) CategoryAxis

WithGrid returns an axis with grid lines enabled or disabled.

func (CategoryAxis) WithLabel

func (a CategoryAxis) WithLabel(label string) CategoryAxis

WithLabel returns an axis with the supplied title.

func (CategoryAxis) WithStyle

func (a CategoryAxis) WithStyle(style AxisStyle) CategoryAxis

WithStyle returns an axis using style.

func (CategoryAxis) WithVisible

func (a CategoryAxis) WithVisible(visible bool) CategoryAxis

WithVisible returns an axis with its line, ticks, and labels shown or hidden.

type Curve

type Curve uint8

Curve controls how points are connected.

const (
	// CurveLinear connects points with straight lines.
	CurveLinear Curve = iota
	// CurveMonotoneX connects points smoothly without introducing local extrema.
	CurveMonotoneX
	// CurveStep changes value halfway between adjacent points.
	CurveStep
	// CurveStepBefore changes value before moving to the next x position.
	CurveStepBefore
	// CurveStepAfter changes value after moving from the current x position.
	CurveStepAfter
)

type Domain

type Domain struct {
	Min, Max float64
}

Domain specifies the inclusive minimum and maximum values of an axis.

type FillStyle

type FillStyle struct {
	Color   color.Color
	Opacity float32
}

FillStyle describes the interior of a rendered mark. An opacity greater than zero is clamped to one; zero uses the mark's default opacity.

type GapPolicy

type GapPolicy uint8

GapPolicy controls how a series handles values reported as missing.

const (
	// GapBreak creates separate paths around missing values.
	GapBreak GapPolicy = iota
	// GapConnect connects the nearest defined values.
	GapConnect
	// GapZero treats missing values as zero.
	GapZero
)

type Insets

type Insets struct {
	Top, Right, Bottom, Left float32
}

Insets specifies logical-pixel padding around a chart's plot area.

type Number

type Number interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 |
		~float32 | ~float64
}

Number is a numeric value accepted by chart accessors.

type NumericAxis

type NumericAxis struct {
	// contains filtered or unexported fields
}

NumericAxis configures a continuous numeric axis. Build one with NewNumericAxis and customize it using its With methods.

func NewNumericAxis

func NewNumericAxis() NumericAxis

NewNumericAxis returns a visible, automatically ranged numeric axis.

func NewTimeAxis

func NewTimeAxis(layout string, location *time.Location) NumericAxis

NewTimeAxis returns a numeric axis formatted using layout and location. A nil location formats values in time.Local.

func (NumericAxis) WithAutoDomain

func (a NumericAxis) WithAutoDomain() NumericAxis

WithAutoDomain returns an axis whose domain is inferred from its data.

func (NumericAxis) WithDomain

func (a NumericAxis) WithDomain(minimum, maximum float64) NumericAxis

WithDomain returns an axis fixed to the supplied domain.

func (NumericAxis) WithFormatter

func (a NumericAxis) WithFormatter(format func(float64) string) NumericAxis

WithFormatter returns an axis that formats tick values with format.

func (NumericAxis) WithGrid

func (a NumericAxis) WithGrid(visible bool) NumericAxis

WithGrid returns an axis with grid lines enabled or disabled.

func (NumericAxis) WithLabel

func (a NumericAxis) WithLabel(label string) NumericAxis

WithLabel returns an axis with the supplied title.

func (NumericAxis) WithStyle

func (a NumericAxis) WithStyle(style AxisStyle) NumericAxis

WithStyle returns an axis using style.

func (NumericAxis) WithTickCount

func (a NumericAxis) WithTickCount(count int) NumericAxis

WithTickCount returns an axis targeting count labeled ticks.

func (NumericAxis) WithVisible

func (a NumericAxis) WithVisible(visible bool) NumericAxis

WithVisible returns an axis with its line, ticks, and labels shown or hidden.

type SeriesLayout

type SeriesLayout uint8

SeriesLayout controls how multiple series share the same chart space.

const (
	// SeriesOverlap draws each series independently in the same plot area.
	SeriesOverlap SeriesLayout = iota
	// SeriesStack places each series on top of the preceding series.
	SeriesStack
	// SeriesStackExpand normalizes each stack to a total of one.
	SeriesStackExpand
	// SeriesStackDiverging stacks positive and negative values away from zero.
	SeriesStackDiverging
	// SeriesGroup places series beside each other. It is supported by BarChart.
	SeriesGroup
)

type Spline

type Spline[T any] struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

Spline displays one or more numerical series as connected lines. Although LayerChart exposes Spline as a composable mark, Fyneline makes it a complete, responsive Fyne widget with axes and grid configuration.

func NewSpline

func NewSpline[T any, X Number](data []T, x func(T) X, series ...SplineSeries[T]) *Spline[T]

NewSpline constructs a spline from data, an x accessor, and one or more numerical series. The default curve is CurveLinear, matching LayerChart.

Example
package main

import (
	"github.com/nathabonfim59/fyneline"
)

func main() {
	type Point struct{ X, Y float64 }
	points := []Point{{X: 0, Y: 2}, {X: 1, Y: 5}, {X: 2, Y: 3}}

	chart := fyneline.NewSpline(points,
		func(p Point) float64 { return p.X },
		fyneline.NewSplineSeries("Value", func(p Point) float64 { return p.Y }),
	).SetCurve(fyneline.CurveMonotoneX)

	_ = chart
}

func (*Spline[T]) CreateRenderer

func (c *Spline[T]) CreateRenderer() fyne.WidgetRenderer

CreateRenderer implements fyne.Widget.

func (*Spline[T]) SetCurve

func (c *Spline[T]) SetCurve(curve Curve) *Spline[T]

SetCurve selects linear, monotone, or stepped interpolation.

func (*Spline[T]) SetData

func (c *Spline[T]) SetData(data []T) *Spline[T]

SetData replaces the chart data and refreshes the widget.

func (*Spline[T]) SetGapPolicy

func (c *Spline[T]) SetGapPolicy(policy GapPolicy) *Spline[T]

SetGapPolicy controls how optional series values are connected.

func (*Spline[T]) SetPadding

func (c *Spline[T]) SetPadding(padding Insets) *Spline[T]

SetPadding sets logical-pixel insets around the chart.

func (*Spline[T]) SetSeries

func (c *Spline[T]) SetSeries(series ...SplineSeries[T]) *Spline[T]

SetSeries replaces the displayed series and refreshes the widget.

func (*Spline[T]) SetXAxis

func (c *Spline[T]) SetXAxis(axis NumericAxis) *Spline[T]

SetXAxis replaces the x-axis configuration.

func (*Spline[T]) SetYAxis

func (c *Spline[T]) SetYAxis(axis NumericAxis) *Spline[T]

SetYAxis replaces the y-axis configuration.

type SplineSeries

type SplineSeries[T any] struct {
	// contains filtered or unexported fields
}

SplineSeries describes one named set of values in a Spline.

func NewOptionalSplineSeries

func NewOptionalSplineSeries[T any, N Number](name string, value func(T) (N, bool)) SplineSeries[T]

NewOptionalSplineSeries creates a spline series whose accessor can report gaps.

func NewSplineSeries

func NewSplineSeries[T any, N Number](name string, value func(T) N) SplineSeries[T]

NewSplineSeries creates a spline series from a required numeric accessor.

func (SplineSeries[T]) WithColor

func (s SplineSeries[T]) WithColor(c color.Color) SplineSeries[T]

WithColor returns a copy of the series using c.

func (SplineSeries[T]) WithStyle

func (s SplineSeries[T]) WithStyle(style SplineStyle) SplineSeries[T]

WithStyle returns a copy of the series using style.

func (SplineSeries[T]) WithWidth

func (s SplineSeries[T]) WithWidth(width float32) SplineSeries[T]

WithWidth returns a copy of the series using width.

type SplineStyle

type SplineStyle struct {
	Stroke StrokeStyle
}

SplineStyle controls a spline's line.

type StrokeStyle

type StrokeStyle struct {
	Color color.Color
	Width float32
}

StrokeStyle describes the outline of a rendered mark.

Directories

Path Synopsis
examples
arc-chart
Package arcchart contains the ArcChart example gallery.
Package arcchart contains the ArcChart example gallery.
arc-chart/cmd command
area-chart
Package areachart contains the AreaChart example gallery.
Package areachart contains the AreaChart example gallery.
area-chart/cmd command
bar-chart
Package barchart contains the BarChart example gallery.
Package barchart contains the BarChart example gallery.
bar-chart/cmd command
internal/gallery
Package gallery contains presentation helpers shared by the example apps.
Package gallery contains presentation helpers shared by the example apps.
render command
Command render regenerates the screenshots used by the example READMEs.
Command render regenerates the screenshots used by the example READMEs.
spline
Package spline contains the Spline example gallery.
Package spline contains the Spline example gallery.
spline/cmd command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL