chart

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BarChart added in v2.1.0

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

BarChart wraps dataviz terminal bar chart rendering.

func NewBarChart added in v2.1.0

func NewBarChart(title string, labels []string, values []float64, opts ...BarChartOption) *BarChart

NewBarChart creates a new BarChart.

func (*BarChart) Blur added in v2.1.0

func (c *BarChart) Blur()

Blur marks the component unfocused.

func (*BarChart) Focus added in v2.1.0

func (c *BarChart) Focus()

Focus marks the component focused.

func (*BarChart) Focused added in v2.1.0

func (c *BarChart) Focused() bool

Focused reports focus state.

func (*BarChart) Init added in v2.1.0

func (c *BarChart) Init() tea.Cmd

Init initializes the component.

func (*BarChart) SetData added in v2.1.0

func (c *BarChart) SetData(labels []string, values []float64)

SetData replaces labels and values.

func (*BarChart) Update added in v2.1.0

func (c *BarChart) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles messages.

func (*BarChart) View added in v2.1.0

func (c *BarChart) View() string

View renders the bar chart.

type BarChartOption added in v2.1.0

type BarChartOption func(*BarChart)

BarChartOption configures a BarChart.

func WithBarChartDesignTokens added in v2.1.0

func WithBarChartDesignTokens(tokens *design.DesignTokens) BarChartOption

WithBarChartDesignTokens applies design-system tokens.

func WithBarChartHeight added in v2.1.0

func WithBarChartHeight(height int) BarChartOption

WithBarChartHeight sets chart height.

func WithBarChartTheme added in v2.1.0

func WithBarChartTheme(theme string) BarChartOption

WithBarChartTheme applies a named theme.

func WithBarChartWidth added in v2.1.0

func WithBarChartWidth(width int) BarChartOption

WithBarChartWidth sets chart width.

type HeatMap added in v2.1.0

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

HeatMap renders a matrix as colored terminal blocks.

func NewHeatMap added in v2.1.0

func NewHeatMap(title string, data [][]float64, opts ...HeatMapOption) *HeatMap

NewHeatMap creates a new HeatMap.

func (*HeatMap) Blur added in v2.1.0

func (c *HeatMap) Blur()

Blur marks the component unfocused.

func (*HeatMap) Focus added in v2.1.0

func (c *HeatMap) Focus()

Focus marks the component focused.

func (*HeatMap) Focused added in v2.1.0

func (c *HeatMap) Focused() bool

Focused reports focus state.

func (*HeatMap) Init added in v2.1.0

func (c *HeatMap) Init() tea.Cmd

Init initializes the component.

func (*HeatMap) Update added in v2.1.0

func (c *HeatMap) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles messages.

func (*HeatMap) View added in v2.1.0

func (c *HeatMap) View() string

View renders the heatmap using ANSI-colored blocks.

type HeatMapOption added in v2.1.0

type HeatMapOption func(*HeatMap)

HeatMapOption configures a HeatMap.

func WithHeatMapDesignTokens added in v2.1.0

func WithHeatMapDesignTokens(tokens *design.DesignTokens) HeatMapOption

WithHeatMapDesignTokens applies design-system tokens.

func WithHeatMapHeight added in v2.1.0

func WithHeatMapHeight(height int) HeatMapOption

WithHeatMapHeight sets chart height.

func WithHeatMapTheme added in v2.1.0

func WithHeatMapTheme(theme string) HeatMapOption

WithHeatMapTheme applies a named theme.

func WithHeatMapWidth added in v2.1.0

func WithHeatMapWidth(width int) HeatMapOption

WithHeatMapWidth sets chart width.

type LineChart added in v2.1.0

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

LineChart wraps terminal line chart rendering using a braille canvas.

func NewLineChart added in v2.1.0

func NewLineChart(title string, opts ...LineChartOption) *LineChart

NewLineChart creates a new LineChart.

func (*LineChart) AddSeries added in v2.1.0

func (c *LineChart) AddSeries(label string, data []float64)

AddSeries appends a named data series.

func (*LineChart) Blur added in v2.1.0

func (c *LineChart) Blur()

Blur marks the component unfocused.

func (*LineChart) Focus added in v2.1.0

func (c *LineChart) Focus()

Focus marks the component focused.

func (*LineChart) Focused added in v2.1.0

func (c *LineChart) Focused() bool

Focused reports focus state.

func (*LineChart) Init added in v2.1.0

func (c *LineChart) Init() tea.Cmd

Init initializes the component.

func (*LineChart) Update added in v2.1.0

func (c *LineChart) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles messages.

func (*LineChart) View added in v2.1.0

func (c *LineChart) View() string

View renders the line chart using braille cells.

type LineChartOption added in v2.1.0

type LineChartOption func(*LineChart)

LineChartOption configures a LineChart.

func WithLineChartDesignTokens added in v2.1.0

func WithLineChartDesignTokens(tokens *design.DesignTokens) LineChartOption

WithLineChartDesignTokens applies design-system tokens.

func WithLineChartHeight added in v2.1.0

func WithLineChartHeight(height int) LineChartOption

WithLineChartHeight sets chart height.

func WithLineChartTheme added in v2.1.0

func WithLineChartTheme(theme string) LineChartOption

WithLineChartTheme applies a named theme.

func WithLineChartWidth added in v2.1.0

func WithLineChartWidth(width int) LineChartOption

WithLineChartWidth sets chart width.

type ProgressBar

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

ProgressBar renders a horizontal progress bar with optional gradient coloring.

func NewProgressBar

func NewProgressBar(progress float64, opts ...ProgressBarOption) *ProgressBar

NewProgressBar creates a new progress bar.

func (*ProgressBar) Blur

func (pb *ProgressBar) Blur()

Blur marks the component as unfocused.

func (*ProgressBar) Focus

func (pb *ProgressBar) Focus()

Focus marks the component as focused.

func (*ProgressBar) Focused

func (pb *ProgressBar) Focused() bool

Focused returns whether the component is focused.

func (*ProgressBar) GetProgress

func (pb *ProgressBar) GetProgress() float64

GetProgress returns current progress.

func (*ProgressBar) Increment

func (pb *ProgressBar) Increment(delta float64)

Increment changes progress by delta and clamps to [0, 1].

func (*ProgressBar) Init

func (pb *ProgressBar) Init() tea.Cmd

Init initializes the progress bar.

func (*ProgressBar) SetLabel

func (pb *ProgressBar) SetLabel(s string)

SetLabel sets the right-side label.

func (*ProgressBar) SetProgress

func (pb *ProgressBar) SetProgress(p float64)

SetProgress sets and clamps progress to [0, 1].

func (*ProgressBar) Update

func (pb *ProgressBar) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles messages.

func (*ProgressBar) View

func (pb *ProgressBar) View() string

View renders the progress bar.

type ProgressBarOption

type ProgressBarOption func(*ProgressBar)

ProgressBarOption configures a ProgressBar.

func WithProgressBarDesignTokens

func WithProgressBarDesignTokens(tokens *design.DesignTokens) ProgressBarOption

WithProgressBarDesignTokens applies design-system tokens.

func WithProgressBarEmptyChar

func WithProgressBarEmptyChar(r rune) ProgressBarOption

WithProgressBarEmptyChar sets a custom empty segment character.

func WithProgressBarFilledChar

func WithProgressBarFilledChar(r rune) ProgressBarOption

WithProgressBarFilledChar sets a custom filled segment character.

func WithProgressBarGradient

func WithProgressBarGradient(start, end colorpkg.Color) ProgressBarOption

WithProgressBarGradient configures a two-stop gradient.

func WithProgressBarLabel

func WithProgressBarLabel(label string) ProgressBarOption

WithProgressBarLabel sets the right-side label.

func WithProgressBarMultiStopGradient

func WithProgressBarMultiStopGradient(stops []colorpkg.GradientStop) ProgressBarOption

WithProgressBarMultiStopGradient configures a multi-stop gradient.

func WithProgressBarShowPercent

func WithProgressBarShowPercent(show bool) ProgressBarOption

WithProgressBarShowPercent toggles percent rendering.

func WithProgressBarStyle

func WithProgressBarStyle(style ProgressBarStyle) ProgressBarOption

WithProgressBarStyle sets the bar style.

func WithProgressBarTheme

func WithProgressBarTheme(theme string) ProgressBarOption

WithProgressBarTheme applies a named design-system theme.

func WithProgressBarWidth

func WithProgressBarWidth(width int) ProgressBarOption

WithProgressBarWidth sets the bar width in characters.

type ProgressBarStyle

type ProgressBarStyle int

ProgressBarStyle defines visual styles for the progress bar.

const (
	ProgressBarBlock ProgressBarStyle = iota
	ProgressBarTick
	ProgressBarClassic
	ProgressBarThin
)

type ScatterPlot added in v2.1.0

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

ScatterPlot renders a terminal scatter plot using braille dots.

func NewScatterPlot added in v2.1.0

func NewScatterPlot(title string, xData, yData []float64, opts ...ScatterPlotOption) *ScatterPlot

NewScatterPlot creates a new ScatterPlot.

func (*ScatterPlot) Blur added in v2.1.0

func (c *ScatterPlot) Blur()

Blur marks the component unfocused.

func (*ScatterPlot) Focus added in v2.1.0

func (c *ScatterPlot) Focus()

Focus marks the component focused.

func (*ScatterPlot) Focused added in v2.1.0

func (c *ScatterPlot) Focused() bool

Focused reports focus state.

func (*ScatterPlot) Init added in v2.1.0

func (c *ScatterPlot) Init() tea.Cmd

Init initializes the component.

func (*ScatterPlot) Update added in v2.1.0

func (c *ScatterPlot) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles messages.

func (*ScatterPlot) View added in v2.1.0

func (c *ScatterPlot) View() string

View renders the scatter plot using braille dots.

type ScatterPlotOption added in v2.1.0

type ScatterPlotOption func(*ScatterPlot)

ScatterPlotOption configures a ScatterPlot.

func WithScatterPlotDesignTokens added in v2.1.0

func WithScatterPlotDesignTokens(tokens *design.DesignTokens) ScatterPlotOption

WithScatterPlotDesignTokens applies design-system tokens.

func WithScatterPlotHeight added in v2.1.0

func WithScatterPlotHeight(height int) ScatterPlotOption

WithScatterPlotHeight sets chart height.

func WithScatterPlotTheme added in v2.1.0

func WithScatterPlotTheme(theme string) ScatterPlotOption

WithScatterPlotTheme applies a named theme.

func WithScatterPlotWidth added in v2.1.0

func WithScatterPlotWidth(width int) ScatterPlotOption

WithScatterPlotWidth sets chart width.

type Sparkline

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

Sparkline renders a compact trend line using Unicode block characters.

func NewSparkline

func NewSparkline(data []float64, opts ...SparklineOption) *Sparkline

NewSparkline creates a new sparkline component.

func (*Sparkline) Blur

func (s *Sparkline) Blur()

Blur marks the component as unfocused.

func (*Sparkline) Focus

func (s *Sparkline) Focus()

Focus marks the component as focused.

func (*Sparkline) Focused

func (s *Sparkline) Focused() bool

Focused returns whether the component is focused.

func (*Sparkline) Init

func (s *Sparkline) Init() tea.Cmd

Init initializes the sparkline.

func (*Sparkline) SetData

func (s *Sparkline) SetData(data []float64)

SetData replaces the sparkline data series.

func (*Sparkline) SetLabel

func (s *Sparkline) SetLabel(label string)

SetLabel sets the right-side label.

func (*Sparkline) Update

func (s *Sparkline) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles messages.

func (*Sparkline) View

func (s *Sparkline) View() string

View renders the sparkline and optional label.

type SparklineOption

type SparklineOption func(*Sparkline)

SparklineOption configures a Sparkline.

func WithSparklineAutoRange

func WithSparklineAutoRange(auto bool) SparklineOption

WithSparklineAutoRange toggles dynamic min/max range calculation.

func WithSparklineData

func WithSparklineData(data []float64) SparklineOption

WithSparklineData sets the sparkline series values.

func WithSparklineDesignTokens

func WithSparklineDesignTokens(tokens *design.DesignTokens) SparklineOption

WithSparklineDesignTokens applies design-system tokens.

func WithSparklineLabel

func WithSparklineLabel(label string) SparklineOption

WithSparklineLabel sets a right-side label.

func WithSparklineRange

func WithSparklineRange(minVal, maxVal float64) SparklineOption

WithSparklineRange sets a fixed value range and disables auto-range.

func WithSparklineTheme

func WithSparklineTheme(theme string) SparklineOption

WithSparklineTheme applies a named design-system theme.

func WithSparklineWidth

func WithSparklineWidth(width int) SparklineOption

WithSparklineWidth sets the sparkline width in characters.

Jump to

Keyboard shortcuts

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