mirror of
https://github.com/navidys/tvxwidgets.git
synced 2025-04-28 13:48:52 +08:00
refactor
Signed-off-by: Markus Ressel <mail@markusressel.de>
This commit is contained in:
parent
2036aacbcb
commit
ca09c00451
8
plot.go
8
plot.go
@ -347,16 +347,20 @@ func (plot *Plot) drawXAxisLabelToScreen(
|
||||
// if we omit the last gap, it fits, so we draw that before stopping
|
||||
expectedLabelWidth--
|
||||
labelWithoutGap := labelWithGap[:len(labelWithGap)-1]
|
||||
tview.Print(screen, labelWithoutGap, initialOffset+labelStart, y+height-plotXAxisLabelsHeight, expectedLabelWidth, tview.AlignLeft, plot.axesLabelColor)
|
||||
plot.printXAxisLabel(screen, labelWithoutGap, initialOffset+labelStart, y+height-plotXAxisLabelsHeight)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
lastUsedLabelEnd = labelStart + expectedLabelWidth
|
||||
tview.Print(screen, labelWithGap, initialOffset+labelStart, y+height-plotXAxisLabelsHeight, expectedLabelWidth, tview.AlignLeft, plot.axesLabelColor)
|
||||
plot.printXAxisLabel(screen, labelWithGap, initialOffset+labelStart, y+height-plotXAxisLabelsHeight)
|
||||
}
|
||||
}
|
||||
|
||||
func (plot *Plot) printXAxisLabel(screen tcell.Screen, label string, x, y int) {
|
||||
tview.Print(screen, label, x, y, len(label), tview.AlignLeft, plot.axesLabelColor)
|
||||
}
|
||||
|
||||
func (plot *Plot) drawYAxisLabelToScreen(screen tcell.Screen, plotYAxisLabelsWidth int, x int, y int, height int) {
|
||||
verticalOffset := plot.minVal
|
||||
verticalScale := (plot.maxVal - plot.minVal) / float64(height-plotXAxisLabelsHeight-1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user