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
|
// determine the width needed for the largest label
|
||||||
maxXAxisLabelWidth := 0
|
maxXAxisLabelWidth := 0
|
||||||
for _, d := range plot.data {
|
for _, d := range plot.data {
|
||||||
|
|
||||||
for i := range d {
|
for i := range d {
|
||||||
label := plot.xAxisLabelFunc(i)
|
label := plot.xAxisLabelFunc(i)
|
||||||
labelMap[i] = label
|
labelMap[i] = label
|
||||||
@ -324,6 +325,7 @@ func (plot *Plot) drawXAxisLabelsToScreen(
|
|||||||
// stopping when there is no more space
|
// stopping when there is no more space
|
||||||
lastUsedLabelEnd := math.MinInt
|
lastUsedLabelEnd := math.MinInt
|
||||||
initialOffset := xAxisAreaStartX
|
initialOffset := xAxisAreaStartX
|
||||||
|
|
||||||
for i := 0; i < maxDataPoints; i++ {
|
for i := 0; i < maxDataPoints; i++ {
|
||||||
labelStart := labelStartMap[i]
|
labelStart := labelStartMap[i]
|
||||||
if labelStart < lastUsedLabelEnd {
|
if labelStart < lastUsedLabelEnd {
|
||||||
@ -333,6 +335,7 @@ func (plot *Plot) drawXAxisLabelsToScreen(
|
|||||||
|
|
||||||
rawLabel := labelMap[i]
|
rawLabel := labelMap[i]
|
||||||
labelWithGap := rawLabel
|
labelWithGap := rawLabel
|
||||||
|
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
labelWithGap += strings.Repeat(gapRune, plotXAxisLabelsGap/2)
|
labelWithGap += strings.Repeat(gapRune, plotXAxisLabelsGap/2)
|
||||||
} else {
|
} else {
|
||||||
@ -341,6 +344,7 @@ func (plot *Plot) drawXAxisLabelsToScreen(
|
|||||||
|
|
||||||
expectedLabelWidth := len(labelWithGap)
|
expectedLabelWidth := len(labelWithGap)
|
||||||
remainingWidth := xAxisAvailableWidth - labelStart
|
remainingWidth := xAxisAvailableWidth - labelStart
|
||||||
|
|
||||||
if expectedLabelWidth > remainingWidth {
|
if expectedLabelWidth > remainingWidth {
|
||||||
// the label would be too long to fit in the remaining space
|
// the label would be too long to fit in the remaining space
|
||||||
if expectedLabelWidth-1 <= remainingWidth {
|
if expectedLabelWidth-1 <= remainingWidth {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user