mirror of https://github.com/mum4k/termdash.git
Updated Barchart API (markdown)
parent
8f934f797d
commit
1297b10493
|
@ -80,6 +80,41 @@ Refer to the the [barchartdemo](https://github.com/mum4k/termdash/blob/master/wi
|
|||
|
||||
Both the **barchart.New** function and the **BarChart.Values** method accept options that change how the barchart behaves and looks. This section documents the individual options and their behavior.
|
||||
|
||||
### [barchart.BarColors](https://godoc.org/github.com/mum4k/termdash/widgets/barchart#BarColors)
|
||||
|
||||
The **barchart.BarColors** option is used to set colors of the individual bars.
|
||||
|
||||
The following option would configure the first bar to be green and the second to be yellow. This is a partial code snippet, refer to the **barchart.New** section above for the complete code.
|
||||
|
||||
```go
|
||||
// snip.
|
||||
bc.Values(values, max,
|
||||
barchart.BarColors([]cell.Color{
|
||||
cell.ColorGreen,
|
||||
cell.ColorYellow,
|
||||
}),
|
||||
)
|
||||
// snip.
|
||||
```
|
||||
|
||||
Refer to the the [barchartdemo](https://github.com/mum4k/termdash/blob/master/widgets/barchart/barchartdemo/barchartdemo.go) which demonstrates the usage of this option.
|
||||
|
||||
### [barchart.BarGap](https://godoc.org/github.com/mum4k/termdash/widgets/barchart#BarGap)
|
||||
|
||||
The **barchart.BarGap** option sets the widths of spacing between the bars to the provided number of terminal cells.
|
||||
|
||||
The following option would configure the bar gap to two cells. This is a partial code snippet, refer to the **barchart.New** section above for the complete code.
|
||||
|
||||
```go
|
||||
// snip.
|
||||
bc.Values(values, max, barchart.BarGap(2))
|
||||
// snip.
|
||||
```
|
||||
|
||||
Which results in the following barchart:
|
||||
|
||||
[[/images/barchart-api/bar_gap.png|bar_gap]]
|
||||
|
||||
## Keyboard input
|
||||
|
||||
The barchart widget doesn't support keyboard input.
|
||||
|
|
Loading…
Reference in New Issue