mirror of
https://github.com/navidys/tvxwidgets.git
synced 2025-05-01 22:18:14 +08:00
lint fixes
Signed-off-by: Markus Ressel <mail@markusressel.de>
This commit is contained in:
parent
fb7e4a8141
commit
12e9f953a3
4
plot.go
4
plot.go
@ -298,6 +298,7 @@ func (plot *Plot) drawXAxisLabelsToScreen(
|
||||
// determine the width needed for the largest label
|
||||
maxXAxisLabelWidth := 0
|
||||
for _, d := range plot.data {
|
||||
|
||||
for i := range d {
|
||||
label := plot.xAxisLabelFunc(i)
|
||||
labelMap[i] = label
|
||||
@ -324,6 +325,7 @@ func (plot *Plot) drawXAxisLabelsToScreen(
|
||||
// stopping when there is no more space
|
||||
lastUsedLabelEnd := math.MinInt
|
||||
initialOffset := xAxisAreaStartX
|
||||
|
||||
for i := 0; i < maxDataPoints; i++ {
|
||||
labelStart := labelStartMap[i]
|
||||
if labelStart < lastUsedLabelEnd {
|
||||
@ -333,6 +335,7 @@ func (plot *Plot) drawXAxisLabelsToScreen(
|
||||
|
||||
rawLabel := labelMap[i]
|
||||
labelWithGap := rawLabel
|
||||
|
||||
if i == 0 {
|
||||
labelWithGap += strings.Repeat(gapRune, plotXAxisLabelsGap/2)
|
||||
} else {
|
||||
@ -341,6 +344,7 @@ func (plot *Plot) drawXAxisLabelsToScreen(
|
||||
|
||||
expectedLabelWidth := len(labelWithGap)
|
||||
remainingWidth := xAxisAvailableWidth - labelStart
|
||||
|
||||
if expectedLabelWidth > remainingWidth {
|
||||
// the label would be too long to fit in the remaining space
|
||||
if expectedLabelWidth-1 <= remainingWidth {
|
||||
|
Loading…
x
Reference in New Issue
Block a user