Documentation
¶
Index ¶
- type BarChart
- type Calendar
- type DrawDirection
- type EchoMode
- type FunnelChart
- type Gauge
- type Heatmap
- type Image
- type Input
- type LineGauge
- type List
- func (l *List) Draw(buf *ui.Buffer)
- func (l *List) ScrollAmount(amount int)
- func (l *List) ScrollBottom()
- func (l *List) ScrollDown()
- func (l *List) ScrollHalfPageDown()
- func (l *List) ScrollHalfPageUp()
- func (l *List) ScrollPageDown()
- func (l *List) ScrollPageUp()
- func (l *List) ScrollTop()
- func (l *List) ScrollUp()
- type Logo
- type Paragraph
- type PieChart
- type PieChartLabel
- type Plot
- type PlotMarker
- type PlotType
- type RadarChart
- type Sparkline
- type SparklineGroup
- type StackedBarChart
- type TabPane
- type Table
- type TextArea
- type Tree
- func (t *Tree) Collapse()
- func (t *Tree) CollapseAll()
- func (t *Tree) Draw(buf *ui.Buffer)
- func (t *Tree) Expand()
- func (t *Tree) ExpandAll()
- func (t *Tree) ScrollAmount(amount int)
- func (t *Tree) ScrollBottom()
- func (t *Tree) ScrollDown()
- func (t *Tree) ScrollHalfPageDown()
- func (t *Tree) ScrollHalfPageUp()
- func (t *Tree) ScrollPageDown()
- func (t *Tree) ScrollPageUp()
- func (t *Tree) ScrollTop()
- func (t *Tree) ScrollUp()
- func (t *Tree) SelectedNode() *TreeNode
- func (t *Tree) SetNodes(nodes []*TreeNode)
- func (t *Tree) ToggleExpand()
- func (t *Tree) Walk(fn TreeWalkFn)
- type TreeMap
- type TreeMapNode
- type TreeNode
- type TreeWalkFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BarChart ¶
type BarChart struct {
ui.Block
BarColors []ui.Color
LabelStyles []ui.Style
NumStyles []ui.Style // only Fg and Modifier are used
NumFormatter func(float64) string
Data []float64
Labels []string
BarWidth int
BarGap int
MaxVal float64
}
func NewBarChart ¶
func NewBarChart() *BarChart
type Calendar ¶
type Calendar struct {
ui.Block
Month time.Month
Year int
CurrentDay int
SelectedDay int
HeaderStyle ui.Style
DayStyle ui.Style
}
func NewCalendar ¶
func NewCalendar() *Calendar
type FunnelChart ¶
type FunnelChart struct {
ui.Block
Data []float64
Labels []string
Colors []ui.Color
// If false, all trapezoids have height proportional to value
// If true, uniform height
UniformHeight bool
}
func NewFunnelChart ¶
func NewFunnelChart() *FunnelChart
func (*FunnelChart) Draw ¶
func (fc *FunnelChart) Draw(buf *ui.Buffer)
type Heatmap ¶
type Heatmap struct {
ui.Block
Data [][]float64
CellWidth int
CellGap int
XLabels []string
YLabels []string
Colors []ui.Color // Gradient colors from low to high
TextColor ui.Style
}
func NewHeatmap ¶
func NewHeatmap() *Heatmap
type Image ¶
type Input ¶
type Input struct {
ui.Block
Text string
TextStyle ui.Style
CursorStyle ui.Style
Placeholder string
EchoMode EchoMode
Cursor int // cursor position (index in []rune)
sync.Mutex
// contains filtered or unexported fields
}
func (*Input) InsertRune ¶
func (*Input) MoveCursorLeft ¶
func (i *Input) MoveCursorLeft()
func (*Input) MoveCursorRight ¶
func (i *Input) MoveCursorRight()
type LineGauge ¶
type LineGauge struct {
ui.Block
Percent int
LineColor ui.Color
Label string
LabelStyle ui.Style
LabelAlignment ui.Alignment
}
func NewLineGauge ¶
func NewLineGauge() *LineGauge
type List ¶
type List struct {
ui.Block
Rows []string
WrapText bool
TextStyle ui.Style
SelectedStyle ui.Style
TextAlignment ui.Alignment
SelectedRow int
// contains filtered or unexported fields
}
func (*List) ScrollAmount ¶
ScrollAmount scrolls by amount given. If amount is < 0, then scroll up. There is no need to set l.topRow, as this will be set automatically when drawn, since if the selected item is off screen then the topRow variable will change accordingly.
func (*List) ScrollBottom ¶
func (l *List) ScrollBottom()
func (*List) ScrollDown ¶
func (l *List) ScrollDown()
func (*List) ScrollHalfPageDown ¶
func (l *List) ScrollHalfPageDown()
func (*List) ScrollHalfPageUp ¶
func (l *List) ScrollHalfPageUp()
func (*List) ScrollPageDown ¶
func (l *List) ScrollPageDown()
func (*List) ScrollPageUp ¶
func (l *List) ScrollPageUp()
type Paragraph ¶
type Paragraph struct {
ui.Block
Text string
TextStyle ui.Style
WrapText bool
VerticalAlignment ui.Alignment
TextAlignment ui.Alignment
}
func NewParagraph ¶
func NewParagraph() *Paragraph
type PieChart ¶
type PieChart struct {
ui.Block
Data []float64 // list of data items
Colors []ui.Color // colors to by cycled through
LabelFormatter PieChartLabel // callback function for labels
AngleOffset float64 // which angle to start drawing at? (see piechartOffsetUp)
InnerRadius float64 // 0.0 to 1.0, defines the size of the hole
}
func NewPieChart ¶
func NewPieChart() *PieChart
NewPieChart Creates a new pie chart with reasonable defaults and no labels.
type PieChartLabel ¶
PieChartLabel callback
type Plot ¶
type Plot struct {
ui.Block
Data [][]float64
DataLabels []string
MaxVal float64
LineColors []ui.Color
AxesColor ui.Color // TODO
ShowAxes bool
Fill bool // Fills the area under the line (like nvtop)
Marker PlotMarker
DotMarkerRune rune
PlotType PlotType
HorizontalScale int
DrawDirection DrawDirection // TODO
}
Plot has two modes: line(default) and scatter. Plot also has two marker types: braille(default) and dot. A single braille character is a 2x4 grid of dots, so using braille gives 2x X resolution and 4x Y resolution over dot mode.
type RadarChart ¶
type RadarChart struct {
ui.Block
Data [][]float64
DataLabels []string // Names for each data slice
Labels []string // Names for axes
MaxVal float64
LineColors []ui.Color
LabelStyle ui.Style
DotStyle ui.Style
}
func NewRadarChart ¶
func NewRadarChart() *RadarChart
func (*RadarChart) Draw ¶
func (rc *RadarChart) Draw(buf *ui.Buffer)
type Sparkline ¶
type Sparkline struct {
Data []float64
Title string
TitleStyle ui.Style
LineColor ui.Color
MaxVal float64
MaxHeight int
}
Sparkline is like: ▅▆▂▂▅▇▂▂▃▆▆▆▅▃. The data points should be non-negative integers.
func NewSparkline ¶
func NewSparkline() *Sparkline
NewSparkline returns a unrenderable single sparkline that needs to be added to a SparklineGroup
type SparklineGroup ¶
SparklineGroup is a renderable widget which groups together the given sparklines.
func NewSparklineGroup ¶
func NewSparklineGroup(sls ...*Sparkline) *SparklineGroup
func (*SparklineGroup) Draw ¶
func (sg *SparklineGroup) Draw(buf *ui.Buffer)
type StackedBarChart ¶
type StackedBarChart struct {
ui.Block
BarColors []ui.Color
LabelStyles []ui.Style
NumStyles []ui.Style // only Fg and Modifier are used
NumFormatter func(float64) string
Data [][]float64
Labels []string
BarWidth int
BarGap int
MaxVal float64
}
func NewStackedBarChart ¶
func NewStackedBarChart() *StackedBarChart
func (*StackedBarChart) Draw ¶
func (sbc *StackedBarChart) Draw(buf *ui.Buffer)
type TabPane ¶
type TabPane struct {
ui.Block
TabNames []string
ActiveTabIndex int
ActiveTabStyle ui.Style
InactiveTabStyle ui.Style
}
TabPane is a renderable widget which can be used to conditionally render certain tabs/views. TabPane shows a list of Tab names. The currently selected tab can be found through the `ActiveTabIndex` field.
func NewTabPane ¶
func (*TabPane) FocusRight ¶
func (tp *TabPane) FocusRight()
type Table ¶
type Table struct {
ui.Block
Rows [][]string
ColumnWidths []int
TextStyle ui.Style
RowSeparator bool
TextAlignment ui.Alignment
RowStyles map[int]ui.Style
FillRow bool
// ColumnResizer is called on each Draw. Can be used for custom column sizing.
ColumnResizer func()
}
Table is like: ┌ Awesome Table ───────────────────────────────────────────────┐ │ Col0 | Col1 | Col2 | Col3 | Col4 | Col5 | Col6 | │──────────────────────────────────────────────────────────────│ │ Some Item #1 | AAA | 123 | CCCCC | EEEEE | GGGGG | IIIII | │──────────────────────────────────────────────────────────────│ │ Some Item #2 | BBB | 456 | DDDDD | FFFFF | HHHHH | JJJJJ | └──────────────────────────────────────────────────────────────┘
type TextArea ¶
type TextArea struct {
ui.Block
Text string
TextStyle ui.Style
CursorStyle ui.Style
Cursor image.Point // Cursor position in the text (Column, Line) 0-indexed
ShowCursor bool
sync.Mutex
// contains filtered or unexported fields
}
func NewTextArea ¶
func NewTextArea() *TextArea
func (*TextArea) DeleteRune ¶
func (ta *TextArea) DeleteRune()
DeleteRune deletes the rune before the cursor (backspace)
func (*TextArea) InsertNewline ¶
func (ta *TextArea) InsertNewline()
InsertNewline inserts a newline at the cursor
func (*TextArea) InsertRune ¶
InsertRune inserts a rune at the current cursor position
func (*TextArea) MoveCursor ¶
MoveCursor moves the cursor safely
type Tree ¶
type Tree struct {
ui.Block
TextStyle ui.Style
SelectedRowStyle ui.Style
WrapText bool
SelectedRow int
// contains filtered or unexported fields
}
Tree is a tree widget.
func (*Tree) CollapseAll ¶
func (t *Tree) CollapseAll()
func (*Tree) ScrollAmount ¶
ScrollAmount scrolls by amount given. If amount is < 0, then scroll up. There is no need to set t.topRow, as this will be set automatically when drawn, since if the selected item is off screen then the topRow variable will change accordingly.
func (*Tree) ScrollBottom ¶
func (t *Tree) ScrollBottom()
func (*Tree) ScrollDown ¶
func (t *Tree) ScrollDown()
func (*Tree) ScrollHalfPageDown ¶
func (t *Tree) ScrollHalfPageDown()
func (*Tree) ScrollHalfPageUp ¶
func (t *Tree) ScrollHalfPageUp()
func (*Tree) ScrollPageDown ¶
func (t *Tree) ScrollPageDown()
func (*Tree) ScrollPageUp ¶
func (t *Tree) ScrollPageUp()
func (*Tree) SelectedNode ¶
func (*Tree) ToggleExpand ¶
func (t *Tree) ToggleExpand()
func (*Tree) Walk ¶
func (t *Tree) Walk(fn TreeWalkFn)
type TreeMap ¶
type TreeMap struct {
ui.Block
Root *TreeMapNode
TextColor ui.Color
}
func NewTreeMap ¶
func NewTreeMap() *TreeMap
type TreeMapNode ¶
type TreeNode ¶
type TreeNode struct {
Value fmt.Stringer
Expanded bool
Nodes []*TreeNode
// contains filtered or unexported fields
}
TreeNode is a tree node.
type TreeWalkFn ¶
TreeWalkFn is a function used for walking a Tree. To interrupt the walking process function should return false.