Compare commits
3 Commits
efedd6522d
...
2a0485b0e9
Author | SHA1 | Date |
---|---|---|
Ray Elliott | 2a0485b0e9 | |
Ray Elliott | 4a4d9b58da | |
Ray Elliott | ec0ef9f907 |
|
@ -4,5 +4,5 @@
|
||||||
|
|
||||||
This fork provides
|
This fork provides
|
||||||
* the option of removing borders around gauges (as with the Textbox and Asciibox components),
|
* the option of removing borders around gauges (as with the Textbox and Asciibox components),
|
||||||
* the placement of a gauge's title within its label.
|
* the placement of a gauge's title within its label,
|
||||||
|
* removal of the status bar.
|
||||||
|
|
|
@ -88,9 +88,9 @@ func (g *Gauge) Draw(buffer *ui.Buffer) {
|
||||||
|
|
||||||
var label string
|
var label string
|
||||||
if g.percentOnly {
|
if g.percentOnly {
|
||||||
label = fmt.Sprintf("%s: %v%% ", g.title, util.FormatValue(percent, g.scale))
|
label = fmt.Sprintf(" %s: %v%% ", g.title, util.FormatValue(percent, g.scale))
|
||||||
} else {
|
} else {
|
||||||
label = fmt.Sprintf("%s: %v%% (%v) ", g.title, util.FormatValue(percent, g.scale), util.FormatValue(g.curValue, g.scale))
|
label = fmt.Sprintf(" %s: %v%% (%v) ", g.title, util.FormatValue(percent, g.scale), util.FormatValue(g.curValue, g.scale))
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw bar
|
// draw bar
|
||||||
|
@ -106,7 +106,7 @@ func (g *Gauge) Draw(buffer *ui.Buffer) {
|
||||||
)
|
)
|
||||||
|
|
||||||
// draw label
|
// draw label
|
||||||
labelXCoordinate := g.Inner.Min.X + (g.Inner.Dx() / 2) - int(float64(len(label))/2)
|
labelXCoordinate := g.Inner.Min.X
|
||||||
labelYCoordinate := g.Inner.Min.Y + ((g.Inner.Dy() - 1) / 2)
|
labelYCoordinate := g.Inner.Min.Y + ((g.Inner.Dy() - 1) / 2)
|
||||||
if labelYCoordinate < g.Inner.Max.Y {
|
if labelYCoordinate < g.Inner.Max.Y {
|
||||||
for i, char := range label {
|
for i, char := range label {
|
||||||
|
|
|
@ -27,7 +27,7 @@ const (
|
||||||
ColorDarkGrey ui.Color = 238
|
ColorDarkGrey ui.Color = 238
|
||||||
ColorLightGrey ui.Color = 254
|
ColorLightGrey ui.Color = 254
|
||||||
ColorGrey ui.Color = 242
|
ColorGrey ui.Color = 242
|
||||||
ColorWhite ui.Color = 15
|
ColorWhite ui.Color = 244
|
||||||
ColorBlack ui.Color = 0
|
ColorBlack ui.Color = 0
|
||||||
ColorClear ui.Color = -1
|
ColorClear ui.Color = -1
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue