Merge branch 'barchart-cell-char' of git://github.com/leighmcculloch/termui into leighmcculloch-barchart-cell-char

This commit is contained in:
Zack Guo 2016-08-13 21:36:51 -04:00
commit 4e0083d6b1

View File

@ -29,6 +29,7 @@ type BarChart struct {
DataLabels []string DataLabels []string
BarWidth int BarWidth int
BarGap int BarGap int
CellChar rune
labels [][]rune labels [][]rune
dataNum [][]rune dataNum [][]rune
numBar int numBar int
@ -44,6 +45,7 @@ func NewBarChart() *BarChart {
bc.TextColor = ThemeAttr("barchart.text.fg") bc.TextColor = ThemeAttr("barchart.text.fg")
bc.BarGap = 1 bc.BarGap = 1
bc.BarWidth = 3 bc.BarWidth = 3
bc.CellChar = ' '
return bc return bc
} }
@ -91,7 +93,7 @@ func (bc *BarChart) Buffer() Buffer {
for j := 0; j < bc.BarWidth; j++ { for j := 0; j < bc.BarWidth; j++ {
for k := 0; k < h; k++ { for k := 0; k < h; k++ {
c := Cell{ c := Cell{
Ch: ' ', Ch: bc.CellChar,
Bg: bc.BarColor, Bg: bc.BarColor,
} }
if bc.BarColor == ColorDefault { // when color is default, space char treated as transparent! if bc.BarColor == ColorDefault { // when color is default, space char treated as transparent!