move guage label to left

This commit is contained in:
Ray Elliott 2021-05-31 19:45:18 +01:00
parent ec0ef9f907
commit 4a4d9b58da
1 changed files with 3 additions and 3 deletions

View File

@ -88,9 +88,9 @@ func (g *Gauge) Draw(buffer *ui.Buffer) {
var label string
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 {
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
@ -106,7 +106,7 @@ func (g *Gauge) Draw(buffer *ui.Buffer) {
)
// 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)
if labelYCoordinate < g.Inner.Max.Y {
for i, char := range label {