diff --git a/Barchart-API.md b/Barchart-API.md index 528ec14..25d14a1 100644 --- a/Barchart-API.md +++ b/Barchart-API.md @@ -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.