Documentation ¶
Overview ¶
Package streamlinechart implements a linechart that draws lines going from the right of the chart to the left of the chart
Index ¶
- Constants
- type Model
- func (m *Model) ClearAllData()
- func (m *Model) ClearDataSet(n string)
- func (m *Model) Draw()
- func (m *Model) DrawAll()
- func (m *Model) DrawDataSets(names []string)
- func (m *Model) Push(f float64)
- func (m *Model) PushDataSet(n string, f float64)
- func (m *Model) Resize(w, h int)
- func (m *Model) SetDataSetStyles(n string, ls runes.LineStyle, s lipgloss.Style)
- func (m *Model) SetStyles(ls runes.LineStyle, s lipgloss.Style)
- func (m *Model) SetViewXRange(min, max float64)
- func (m *Model) SetViewXYRange(minX, maxX, minY, maxY float64)
- func (m *Model) SetViewYRange(min, max float64)
- func (m *Model) SetXRange(min, max float64)
- func (m *Model) SetYRange(min, max float64)
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- type Option
- func WithAxesStyles(as lipgloss.Style, ls lipgloss.Style) Option
- func WithDataSetStream(n string, f []float64) Option
- func WithDataSetStyles(n string, ls runes.LineStyle, s lipgloss.Style) Option
- func WithLineChart(lc *linechart.Model) Option
- func WithStream(f []float64) Option
- func WithStyles(ls runes.LineStyle, s lipgloss.Style) Option
- func WithUpdateHandler(h linechart.UpdateHandler) Option
- func WithXRange(min, max float64) Option
- func WithXYRange(minX, maxX, minY, maxY float64) Option
- func WithXYSteps(x, y int) Option
- func WithYRange(min, max float64) Option
- func WithZoneManager(zm *zone.Manager) Option
Constants ¶
const DefaultDataSetName = "default"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Model ¶
Model contains state of a streamlinechart with an embedded linechart.Model A data set consists of a sequence of Y data values. For each data set, streamlinecharts can only plot a single rune in each column of the graph canvas from right to left. Uses linechart Model UpdateHandler() for processing keyboard and mouse messages.
func New ¶
New returns a streamlinechart Model initialized from width, height and various options. By default, the chart will hide the X axis, auto set Y value ranges, and only enable moving viewport on Y axis.
func (*Model) ClearAllData ¶
func (m *Model) ClearAllData()
ClearAllData will reset stored data values in all data sets.
func (*Model) ClearDataSet ¶
ClearDataSet will erase stored data set given by name string.
func (*Model) Draw ¶
func (m *Model) Draw()
Draw will draw lines runes displayed from right to left of the graphing area of the canvas. Uses default data set.
func (*Model) DrawAll ¶
func (m *Model) DrawAll()
DrawAll will draw lines runes for all data sets from right to left of the graphing area of the canvas.
func (*Model) DrawDataSets ¶
DrawDataSets will draw lines runes from right to left of the graphing area of the canvas for each data set given by name strings.
func (*Model) Push ¶
Push will push a float64 Y data value to the default data set to be displayed with Draw.
func (*Model) PushDataSet ¶
Push will push a float64 Y data value to a data set to be displayed with Draw. Using given data set by name string.
func (*Model) Resize ¶
Resize will change streamlinechart display width and height. Existing data will be rescaled.
func (*Model) SetDataSetStyles ¶
SetDataSetStyles will set the styles of the given data set by name string.
func (*Model) SetViewXRange ¶
SetViewXRange updates the displayed minimum and maximum X values. Existing data will be rescaled.
func (*Model) SetViewXYRange ¶
SetViewXYRange updates the displayed minimum and maximum X and Y values. Existing data will be rescaled.
func (*Model) SetViewYRange ¶
SetViewYRange updates the displayed minimum and maximum Y values. Existing data will be rescaled.
func (*Model) SetXRange ¶
SetXRange updates the minimum and maximum expected X values. Existing data will be rescaled.
type Option ¶
type Option func(*Model)
Option is used to set options when initializing a streamlinechart. Example:
slc := New(width, height, WithStyles(someLineStyle, someLipglossStyle))
func WithAxesStyles ¶
WithAxesStyles sets the axes line and line label styles.
func WithDataSetStream ¶
WithDataSetStream adds []float64 data points to the data set given by name.
func WithDataSetStyles ¶
WithDataSetStyles sets the line style and lipgloss style of the data set given by name.
func WithLineChart ¶
WithLineChart sets internal linechart to given linechart.
func WithStream ¶
WithStream adds []float64 data points to the default data set.
func WithStyles ¶
WithStyles sets the default line style and lipgloss style of data sets.
func WithUpdateHandler ¶
func WithUpdateHandler(h linechart.UpdateHandler) Option
WithUpdateHandler sets the UpdateHandler used when processing bubbletea Msg events in Update().
func WithXRange ¶
WithXRange sets expected and displayed minimum and maximum Y value range.
func WithXYRange ¶
WithXYRange sets expected and displayed minimum and maximum Y value range.
func WithXYSteps ¶
WithXYSteps sets the number of steps when drawing X and Y axes values. If X steps 0, then X axis will be hidden. If Y steps 0, then Y axis will be hidden.
func WithYRange ¶
WithYRange sets expected and displayed minimum and maximum Y value range.
func WithZoneManager ¶
WithZoneManager sets the bubblezone Manager used when processing bubbletea Msg mouse events in Update().