Documentation
¶
Index ¶
- type BarChart
- type DrawDirection
- type Gauge
- type Image
- type List
- func (self *List) Draw(buf *Buffer)
- func (self *List) ScrollAmount(amount int)
- func (self *List) ScrollBottom()
- func (self *List) ScrollDown()
- func (self *List) ScrollHalfPageDown()
- func (self *List) ScrollHalfPageUp()
- func (self *List) ScrollPageDown()
- func (self *List) ScrollPageUp()
- func (self *List) ScrollTop()
- func (self *List) ScrollUp()
- type Paragraph
- type PieChart
- type PieChartLabel
- type Plot
- type PlotMarker
- type PlotType
- type Sparkline
- type SparklineGroup
- type StackedBarChart
- type TabPane
- type Table
- type Tree
- func (self *Tree) Collapse()
- func (self *Tree) CollapseAll()
- func (self *Tree) Draw(buf *Buffer)
- func (self *Tree) Expand()
- func (self *Tree) ExpandAll()
- func (self *Tree) ScrollAmount(amount int)
- func (self *Tree) ScrollBottom()
- func (self *Tree) ScrollDown()
- func (self *Tree) ScrollHalfPageDown()
- func (self *Tree) ScrollHalfPageUp()
- func (self *Tree) ScrollPageDown()
- func (self *Tree) ScrollPageUp()
- func (self *Tree) ScrollTop()
- func (self *Tree) ScrollUp()
- func (self *Tree) SelectedNode() *TreeNode
- func (self *Tree) SetNodes(nodes []*TreeNode)
- func (self *Tree) ToggleExpand()
- func (self *Tree) Walk(fn TreeWalkFn)
- 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 {
Block
BarColors []Color
LabelStyles []Style
NumStyles []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 Image ¶
type List ¶
type List struct {
Block
Rows []string
WrapText bool
TextStyle Style
SelectedRow int
SelectedRowStyle Style
// 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 self.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 (self *List) ScrollBottom()
func (*List) ScrollDown ¶
func (self *List) ScrollDown()
func (*List) ScrollHalfPageDown ¶
func (self *List) ScrollHalfPageDown()
func (*List) ScrollHalfPageUp ¶
func (self *List) ScrollHalfPageUp()
func (*List) ScrollPageDown ¶
func (self *List) ScrollPageDown()
func (*List) ScrollPageUp ¶
func (self *List) ScrollPageUp()
type Paragraph ¶
func NewParagraph ¶
func NewParagraph() *Paragraph
type PieChart ¶
type PieChart struct {
Block
Data []float64 // list of data items
Colors []Color // colors to by cycled through
LabelFormatter PieChartLabel // callback function for labels
AngleOffset float64 // which angle to start drawing at? (see piechartOffsetUp)
}
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 {
Block
Data [][]float64
DataLabels []string
MaxVal float64
LineColors []Color
AxesColor Color // TODO
ShowAxes bool
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 Sparkline ¶
type Sparkline struct {
Data []float64
Title string
TitleStyle Style
LineColor Color
MaxVal float64
MaxHeight int // TODO
}
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 ¶
type SparklineGroup struct {
Block
Sparklines []*Sparkline
}
SparklineGroup is a renderable widget which groups together the given sparklines.
func NewSparklineGroup ¶
func NewSparklineGroup(sls ...*Sparkline) *SparklineGroup
func (*SparklineGroup) Draw ¶
func (self *SparklineGroup) Draw(buf *Buffer)
type StackedBarChart ¶
type StackedBarChart struct {
Block
BarColors []Color
LabelStyles []Style
NumStyles []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 (self *StackedBarChart) Draw(buf *Buffer)
type TabPane ¶
type TabPane struct {
Block
TabNames []string
ActiveTabIndex int
ActiveTabStyle Style
InactiveTabStyle 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 (self *TabPane) FocusRight()
type Table ¶
type Table struct {
Block
Rows [][]string
ColumnWidths []int
TextStyle Style
RowSeparator bool
TextAlignment Alignment
RowStyles map[int]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 Tree ¶
type Tree struct {
Block
TextStyle Style
SelectedRowStyle Style
WrapText bool
SelectedRow int
// contains filtered or unexported fields
}
Tree is a tree widget.
func (*Tree) CollapseAll ¶
func (self *Tree) CollapseAll()
func (*Tree) ScrollAmount ¶
ScrollAmount scrolls by amount given. If amount is < 0, then scroll up. There is no need to set self.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 (self *Tree) ScrollBottom()
func (*Tree) ScrollDown ¶
func (self *Tree) ScrollDown()
func (*Tree) ScrollHalfPageDown ¶
func (self *Tree) ScrollHalfPageDown()
func (*Tree) ScrollHalfPageUp ¶
func (self *Tree) ScrollHalfPageUp()
func (*Tree) ScrollPageDown ¶
func (self *Tree) ScrollPageDown()
func (*Tree) ScrollPageUp ¶
func (self *Tree) ScrollPageUp()
func (*Tree) SelectedNode ¶
func (*Tree) ToggleExpand ¶
func (self *Tree) ToggleExpand()
func (*Tree) Walk ¶
func (self *Tree) Walk(fn TreeWalkFn)
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.