mirror of
https://github.com/navidys/tvxwidgets.git
synced 2025-05-09 19:29:29 +08:00
simplify code
Signed-off-by: Markus Ressel <mail@markusressel.de>
This commit is contained in:
parent
253e22ef1a
commit
2036aacbcb
4
plot.go
4
plot.go
@ -323,11 +323,10 @@ func (plot *Plot) drawXAxisLabelToScreen(
|
||||
// print the labels, skipping those that would overlap,
|
||||
// stopping when there is no more space
|
||||
lastUsedLabelEnd := math.MinInt
|
||||
isFirstLabel := true
|
||||
initialOffset := xAxisAreaStartX
|
||||
for i := 0; i < maxDataPoints; i++ {
|
||||
labelStart := labelStartMap[i]
|
||||
if !isFirstLabel && labelStart < lastUsedLabelEnd {
|
||||
if labelStart < lastUsedLabelEnd {
|
||||
// the label would overlap with the previous label
|
||||
continue
|
||||
}
|
||||
@ -355,7 +354,6 @@ func (plot *Plot) drawXAxisLabelToScreen(
|
||||
|
||||
lastUsedLabelEnd = labelStart + expectedLabelWidth
|
||||
tview.Print(screen, labelWithGap, initialOffset+labelStart, y+height-plotXAxisLabelsHeight, expectedLabelWidth, tview.AlignLeft, plot.axesLabelColor)
|
||||
isFirstLabel = false
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user