Help us shape the future of Go! Take the 2026 Go Developer Survey

chart

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InfoDialog = 0 + iota
	ErrorDailog
)

represents dialog type.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityModeGauge

type ActivityModeGauge struct {
	*view.Box
	// contains filtered or unexported fields
}

ActivityModeGauge represents activity mode gauge permitive.

func NewActivityModeGauge

func NewActivityModeGauge() *ActivityModeGauge

NewActivityModeGauge returns new activity mode gauge permitive.

func (*ActivityModeGauge) Draw

func (g *ActivityModeGauge) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*ActivityModeGauge) Focus

func (g *ActivityModeGauge) Focus(delegate func(p view.Primitive))

Focus is called when this primitive receives focus.

func (*ActivityModeGauge) GetRect

func (g *ActivityModeGauge) GetRect() (int, int, int, int)

GetRect return primitive current rect.

func (*ActivityModeGauge) HasFocus

func (g *ActivityModeGauge) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (*ActivityModeGauge) Pulse

func (g *ActivityModeGauge) Pulse()

Pulse pulse update the gauge progress bar.

func (*ActivityModeGauge) Reset

func (g *ActivityModeGauge) Reset()

Reset resets the gauge counter (set to 0).

func (*ActivityModeGauge) SetPgBgColor

func (g *ActivityModeGauge) SetPgBgColor(color tcell.Color)

SetPgBgColor sets progress block background color.

func (*ActivityModeGauge) SetRect

func (g *ActivityModeGauge) SetRect(x, y, width, height int)

SetRect sets rect for this primitive.

type BarChart

type BarChart struct {
	*view.Box
	// contains filtered or unexported fields
}

BarChart represents bar chart primitive.

func NewBarChart

func NewBarChart() *BarChart

NewBarChart returns a new bar chart primitive.

func (*BarChart) AddBar

func (c *BarChart) AddBar(label string, value int, color tcell.Color)

AddBar adds new bar item to the bar chart primitive.

func (*BarChart) Draw

func (c *BarChart) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*BarChart) Focus

func (c *BarChart) Focus(delegate func(p view.Primitive))

Focus is called when this primitive receives focus.

func (*BarChart) GetRect

func (c *BarChart) GetRect() (int, int, int, int)

GetRect return primitive current rect.

func (*BarChart) HasFocus

func (c *BarChart) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (*BarChart) SetAxesColor

func (c *BarChart) SetAxesColor(color tcell.Color)

SetAxesColor sets axes x and y lines color.

func (*BarChart) SetAxesLabelColor

func (c *BarChart) SetAxesLabelColor(color tcell.Color)

SetAxesLabelColor sets axes x and y label color.

func (*BarChart) SetBarValue

func (c *BarChart) SetBarValue(name string, value int)

SetBarValue sets bar values.

func (*BarChart) SetBorder

func (c *BarChart) SetBorder(status bool)

SetBorder sets border for this primitive.

func (*BarChart) SetMaxValue

func (c *BarChart) SetMaxValue(max int)

SetMaxValue sets maximum value of bars.

func (*BarChart) SetRect

func (c *BarChart) SetRect(x, y, width, height int)

SetRect sets rect for this primitive.

type BarChartItem

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

BarChartItem represents a single bar in bar chart.

type Marker

type Marker uint

Marker represents plot drawing marker (braille or dot).

const (
	// plot marker.
	PlotMarkerBraille Marker = iota
	PlotMarkerDot
)

type MessageDialog

type MessageDialog struct {
	*view.Box
	// contains filtered or unexported fields
}

MessageDialog represents message dialog primitive.

func NewMessageDialog

func NewMessageDialog(dtype int) *MessageDialog

NewMessageDialog returns a new message dialog primitive.

func (*MessageDialog) Draw

func (d *MessageDialog) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*MessageDialog) Focus

func (d *MessageDialog) Focus(delegate func(p view.Primitive))

Focus is called when this primitive receives focus.

func (*MessageDialog) GetBackgroundColor

func (d *MessageDialog) GetBackgroundColor() tcell.Color

GetBackgroundColor returns dialog background color.

func (*MessageDialog) HasFocus

func (d *MessageDialog) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (*MessageDialog) InputHandler

func (d *MessageDialog) InputHandler() func(event *tcell.EventKey, setFocus func(p view.Primitive))

InputHandler returns input handler function for this primitive.

func (*MessageDialog) MouseHandler

func (d *MessageDialog) MouseHandler() func(action view.MouseAction, event *tcell.EventMouse, setFocus func(p view.Primitive)) (consumed bool, capture view.Primitive)

MouseHandler returns the mouse handler for this primitive.

func (*MessageDialog) SetBackgroundColor

func (d *MessageDialog) SetBackgroundColor(color tcell.Color)

SetBackgroundColor sets dialog background color.

func (*MessageDialog) SetDoneFunc

func (d *MessageDialog) SetDoneFunc(handler func()) *MessageDialog

SetDoneFunc sets callback function for when user clicked on the button or presses "enter" or "esc".

func (*MessageDialog) SetMessage

func (d *MessageDialog) SetMessage(message string)

SetMessage sets the dialog message to display.

func (*MessageDialog) SetRect

func (d *MessageDialog) SetRect(x, y, width, height int)

SetRect sets rect for this primitive.

func (*MessageDialog) SetTextColor

func (d *MessageDialog) SetTextColor(color tcell.Color)

SetTextColor sets dialog's message text color.

func (*MessageDialog) SetType

func (d *MessageDialog) SetType(dtype int)

SetType sets dialog type to info or error.

type PercentageModeGauge

type PercentageModeGauge struct {
	*view.Box
	// contains filtered or unexported fields
}

PercentageModeGauge represents percentage mode gauge permitive.

func NewPercentageModeGauge

func NewPercentageModeGauge() *PercentageModeGauge

NewPercentageModeGauge returns new percentage mode gauge permitive.

func (*PercentageModeGauge) Draw

func (g *PercentageModeGauge) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*PercentageModeGauge) Focus

func (g *PercentageModeGauge) Focus(delegate func(p view.Primitive))

Focus is called when this primitive receives focus.

func (*PercentageModeGauge) GetMaxValue

func (g *PercentageModeGauge) GetMaxValue() int

GetMaxValue returns maximum allows value for the gauge.

func (*PercentageModeGauge) GetRect

func (g *PercentageModeGauge) GetRect() (int, int, int, int)

GetRect return primitive current rect.

func (*PercentageModeGauge) GetValue

func (g *PercentageModeGauge) GetValue() int

GetValue returns current gauge value.

func (*PercentageModeGauge) HasFocus

func (g *PercentageModeGauge) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (*PercentageModeGauge) Reset

func (g *PercentageModeGauge) Reset()

Reset resets the gauge counter (set to 0).

func (*PercentageModeGauge) SetMaxValue

func (g *PercentageModeGauge) SetMaxValue(value int)

SetMaxValue set maximum allows value for the gauge.

func (*PercentageModeGauge) SetPgBgColor

func (g *PercentageModeGauge) SetPgBgColor(color tcell.Color)

SetPgBgColor sets progress block background color.

func (*PercentageModeGauge) SetRect

func (g *PercentageModeGauge) SetRect(x, y, width, height int)

SetRect sets rect for this primitive.

func (*PercentageModeGauge) SetValue

func (g *PercentageModeGauge) SetValue(value int)

SetValue update the gauge progress.

type Plot

type Plot struct {
	*view.Box
	// contains filtered or unexported fields
}

Plot represents a plot primitive used for different charts.

func NewPlot

func NewPlot() *Plot

NewPlot returns a plot widget.

func (*Plot) Draw

func (plot *Plot) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*Plot) SetAxesColor

func (plot *Plot) SetAxesColor(color tcell.Color)

SetAxesColor sets axes x and y lines color.

func (*Plot) SetAxesLabelColor

func (plot *Plot) SetAxesLabelColor(color tcell.Color)

SetAxesLabelColor sets axes x and y label color.

func (*Plot) SetData

func (plot *Plot) SetData(data [][]float64)

SetData sets plot data.

func (*Plot) SetDotMarkerRune

func (plot *Plot) SetDotMarkerRune(r rune)

SetDotMarkerRune sets dot marker rune.

func (*Plot) SetDrawAxes

func (plot *Plot) SetDrawAxes(draw bool)

SetDrawAxes set true in order to draw axes to screen.

func (*Plot) SetDrawXAxisLabel

func (plot *Plot) SetDrawXAxisLabel(draw bool)

SetDrawXAxisLabel set true in order to draw x axis label to screen.

func (*Plot) SetDrawYAxisLabel

func (plot *Plot) SetDrawYAxisLabel(draw bool)

SetDrawYAxisLabel set true in order to draw y axis label to screen.

func (*Plot) SetLineColor

func (plot *Plot) SetLineColor(color []tcell.Color)

SetLineColor sets chart line color.

func (*Plot) SetMarker

func (plot *Plot) SetMarker(marker Marker)

SetMarker sets marker type braille or dot mode.

func (*Plot) SetPlotType

func (plot *Plot) SetPlotType(ptype PlotType)

SetPlotType sets plot type (linechart or scatter).

func (*Plot) SetRect

func (plot *Plot) SetRect(x, y, width, height int)

SetRect sets rect for this primitive.

type PlotType

type PlotType uint

PlotType represents plot type (line chart or scatter).

const (
	PlotTypeLineChart PlotType = iota
	PlotTypeScatter
)

type Sparkline

type Sparkline struct {
	*view.Box
	// contains filtered or unexported fields
}

Spartline represents a sparkline widgets.

func NewSparkline

func NewSparkline() *Sparkline

NewSparkline returns a new sparkline widget.

func (*Sparkline) Draw

func (sl *Sparkline) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*Sparkline) GetRect

func (sl *Sparkline) GetRect() (int, int, int, int)

GetRect return primitive current rect.

func (*Sparkline) HasFocus

func (sl *Sparkline) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (*Sparkline) SetData

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

SetData sets sparkline data.

func (*Sparkline) SetDataTitle

func (sl *Sparkline) SetDataTitle(title string)

SetDataTitle sets sparkline data title.

func (*Sparkline) SetDataTitleColor

func (sl *Sparkline) SetDataTitleColor(color tcell.Color)

SetDataTitleColor sets sparkline data title color.

func (*Sparkline) SetLineColor

func (sl *Sparkline) SetLineColor(color tcell.Color)

SetLineColor sets sparkline line color.

func (*Sparkline) SetRect

func (sl *Sparkline) SetRect(x, y, width, height int)

SetRect sets rect for this primitive.

type Spinner

type Spinner struct {
	*view.Box
	// contains filtered or unexported fields
}

Spinner represents a spinner widget.

func NewSpinner

func NewSpinner() *Spinner

NewSpinner returns a new spinner widget.

func (*Spinner) Draw

func (s *Spinner) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*Spinner) Pulse

func (s *Spinner) Pulse()

Pulse updates the spinner to the next frame.

func (*Spinner) Reset

func (s *Spinner) Reset()

Reset sets the frame counter to 0.

func (*Spinner) SetCustomStyle

func (s *Spinner) SetCustomStyle(frames []rune) *Spinner

SetCustomStyle sets a list of runes as custom frames to show as the spinner.

func (*Spinner) SetStyle

func (s *Spinner) SetStyle(style SpinnerStyle) *Spinner

SetStyle sets the spinner style.

type SpinnerStyle

type SpinnerStyle int
const (
	SpinnerDotsCircling SpinnerStyle = iota
	SpinnerDotsUpDown
	SpinnerBounce
	SpinnerLine
	SpinnerCircleQuarters
	SpinnerSquareCorners
	SpinnerCircleHalves
	SpinnerCorners
	SpinnerArrows
	SpinnerHamburger
	SpinnerStack
	SpinnerGrowHorizontal
	SpinnerGrowVertical
	SpinnerStar
	SpinnerBoxBounce
)

type UtilModeGauge

type UtilModeGauge struct {
	*view.Box
	// contains filtered or unexported fields
}

UtilModeGauge represents utilisation mode gauge permitive.

func NewUtilModeGauge

func NewUtilModeGauge() *UtilModeGauge

NewUtilModeGauge returns new utilisation mode gauge permitive.

func (*UtilModeGauge) Draw

func (g *UtilModeGauge) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*UtilModeGauge) Focus

func (g *UtilModeGauge) Focus(delegate func(p view.Primitive))

Focus is called when this primitive receives focus.

func (*UtilModeGauge) GetRect

func (g *UtilModeGauge) GetRect() (int, int, int, int)

GetRect return primitive current rect.

func (*UtilModeGauge) GetValue

func (g *UtilModeGauge) GetValue() float64

GetValue returns current gauge value.

func (*UtilModeGauge) HasFocus

func (g *UtilModeGauge) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (*UtilModeGauge) SetCritPercentage

func (g *UtilModeGauge) SetCritPercentage(percentage float64)

SetCritPercentage sets critical percentage start range.

func (*UtilModeGauge) SetEmptyColor

func (g *UtilModeGauge) SetEmptyColor(color tcell.Color)

SetEmptyColor sets empty gauge color.

func (*UtilModeGauge) SetLabel

func (g *UtilModeGauge) SetLabel(label string)

SetLabel sets label for this primitive.

func (*UtilModeGauge) SetLabelColor

func (g *UtilModeGauge) SetLabelColor(color tcell.Color)

SetLabelColor sets label text color.

func (*UtilModeGauge) SetRect

func (g *UtilModeGauge) SetRect(x, y, width, height int)

SetRect sets rect for this primitive.

func (*UtilModeGauge) SetValue

func (g *UtilModeGauge) SetValue(value float64)

SetValue update the gauge progress.

func (*UtilModeGauge) SetWarnPercentage

func (g *UtilModeGauge) SetWarnPercentage(percentage float64)

SetWarnPercentage sets warning percentage start range.

Jump to

Keyboard shortcuts

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