Documentation
¶
Index ¶
- type Model
- func (m *Model) Last(name string) (float64, bool)
- func (m *Model) Legend() string
- func (m *Model) LegendBox() string
- func (m *Model) Len() int
- func (m *Model) LenSeries(name string) int
- func (m *Model) LineWidth() int
- func (m *Model) Mode() RenderMode
- func (m *Model) Push(v float64)
- func (m *Model) PushSeries(name string, v float64)
- func (m *Model) SetAxisStyle(s lipgloss.Style)
- func (m *Model) SetFill(on bool)
- func (m *Model) SetGrid(on bool)
- func (m *Model) SetLabelFormatter(fn func(float64) string)
- func (m *Model) SetLabelWidth(w int)
- func (m *Model) SetLineStyle(s lipgloss.Style)
- func (m *Model) SetLineWidth(w int)
- func (m *Model) SetMode(mode RenderMode)
- func (m *Model) SetSeriesStyle(name string, s lipgloss.Style)
- func (m *Model) SetSmooth(on bool)
- func (m *Model) SetTicks(ticks ...float64)
- func (m *Model) ToggleRenderMode()
- func (m *Model) View() string
- type Option
- func WithAxisStyle(s lipgloss.Style) Option
- func WithBraille() Option
- func WithFill(on bool) Option
- func WithGrid(on bool) Option
- func WithLabelFormatter(fn func(float64) string) Option
- func WithLabelWidth(w int) Option
- func WithLineStyle(s lipgloss.Style) Option
- func WithLineWidth(w int) Option
- func WithLines() Option
- func WithMode(mode RenderMode) Option
- func WithRange(min, max float64) Option
- func WithSeriesStyle(name string, s lipgloss.Style) Option
- func WithSmooth(on bool) Option
- func WithTicks(ticks ...float64) Option
- type RenderMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is a streaming terminal line chart.
func (*Model) Legend ¶
Legend returns a formatted legend for named series, or empty string if none exist.
func (*Model) LegendBox ¶
LegendBox returns a boxed legend with borders, swatches, series names, and recent values.
func (*Model) LenSeries ¶
LenSeries returns the number of points in the named series within the window.
func (*Model) Push ¶
Push adds a data point to the default series. Maintains a sliding window of width w.
func (*Model) PushSeries ¶
PushSeries adds a data point to a named series.
func (*Model) SetAxisStyle ¶
SetAxisStyle dynamically updates the axis style.
func (*Model) SetLabelFormatter ¶ added in v0.2.0
SetLabelFormatter dynamically updates the Y-axis label formatter.
func (*Model) SetLabelWidth ¶ added in v0.2.0
SetLabelWidth dynamically updates the Y-axis label column width.
func (*Model) SetLineStyle ¶
SetLineStyle dynamically updates the line style.
func (*Model) SetLineWidth ¶
SetLineWidth sets the line width: 1 for thin, 2 for bold.
func (*Model) SetMode ¶
func (m *Model) SetMode(mode RenderMode)
SetMode sets the rendering mode (ModeLines or ModeBraille).
func (*Model) SetSeriesStyle ¶
SetSeriesStyle dynamically sets the style for a named series.
func (*Model) ToggleRenderMode ¶
func (m *Model) ToggleRenderMode()
ToggleRenderMode switches between ModeLines and ModeBraille.
type Option ¶
type Option func(*Model)
Option configures a Model.
func WithAxisStyle ¶
WithAxisStyle sets the axes and labels style.
func WithBraille ¶
func WithBraille() Option
WithBraille enables braille dot matrix mode (2x4 dots).
func WithLabelFormatter ¶ added in v0.2.0
WithLabelFormatter sets a custom formatter for Y-axis tick values.
func WithLabelWidth ¶ added in v0.2.0
WithLabelWidth sets an explicit width for Y-axis labels.
func WithLineStyle ¶
WithLineStyle sets the default line style.
func WithLineWidth ¶
WithLineWidth sets line width: 1 thin, 2 bold.
func WithMode ¶
func WithMode(mode RenderMode) Option
WithMode sets rendering mode (ModeLines or ModeBraille).
func WithSeriesStyle ¶
WithSeriesStyle sets the style for a named series.
func WithSmooth ¶
WithSmooth enables or disables line smoothing (rounded corners or spline).
type RenderMode ¶
type RenderMode int
RenderMode defines how line curves are rendered on the chart.
const ( // ModeLines renders smooth continuous lines (box-drawing ╭, ╮, ╯, ╰, ─, │) with Grafana-style area fill ░. ModeLines RenderMode = iota // ModeBraille renders using a 2x4 dot braille matrix (Unicode Braille Patterns). ModeBraille )