plot

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

README

bubble-plot

very experimental Bubbletea custom bubble for displaying plots using braille characters and my own fork of exrook/drawille-go which takes a lot of inspiration from termui's implementation

i built this to use in my kubectl plugin topui

notes

  • the font this is displayed on needs to be able to render unicode braille characters (\u28**) and line characters (\u25**) for the x and y axis
  • displaying horizontal labels is hard, right now this just tries to display a label at the beginning and end of the graphed lines using a slice of strings provided by the user that must be the same length as the data provided
  • this and my fork of drawille are very much a work in progress

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GraphUpdateCmd

func GraphUpdateCmd(data [][]float64, labels []string) tea.Cmd

Types

type GraphUpdateMsg

type GraphUpdateMsg struct {
	Data   [][]float64
	Labels []string
}

type Model

type Model struct {
	Width  int
	Height int
	Title  string
	Styles Styles

	MaxDataPoints int
	// contains filtered or unexported fields
}

func New

func New(options ...Option) *Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (*Model) SetSize

func (m *Model) SetSize(msg tea.WindowSizeMsg)

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type Option

type Option func(*Model)

func WithAxisColor added in v0.0.4

func WithAxisColor(color int) Option

func WithContainerStyle

func WithContainerStyle(style lipgloss.Style) Option

func WithData added in v0.0.4

func WithData(data [][]float64) Option

func WithDimensions added in v0.0.4

func WithDimensions(width, height int) Option

func WithHorizontalLabels added in v0.0.4

func WithHorizontalLabels(labels []string) Option

func WithLabelColor added in v0.0.4

func WithLabelColor(color int) Option

func WithLineColors added in v0.0.4

func WithLineColors(colors []int) Option

func WithMaxDataPoints added in v0.0.3

func WithMaxDataPoints(amount int) Option

func WithShowTitle

func WithShowTitle(show bool) Option

func WithTitleStyle

func WithTitleStyle(style lipgloss.Style) Option

type Styles

type Styles struct {
	Container  lipgloss.Style
	Title      lipgloss.Style
	AxisColor  int
	LabelColor int
	LineColors []int
}

func NewDefaultStyles

func NewDefaultStyles() Styles

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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