move guage label to left
This commit is contained in:
parent
ec0ef9f907
commit
4a4d9b58da
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue