Skip to content

Commit c6248b5

Browse files
committed
fix score graph x-offset
1 parent 74866e5 commit c6248b5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ui/scoreGraph.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ func (g *scoreGraph) drawDataPointsRectangular(cr *cairo.Context, layout graphLa
348348
valueScaling = 0
349349
}
350350
for i := range valueCount {
351-
startX := float64(i) * layout.binWidth
352-
endX := float64(i+1) * layout.binWidth
351+
startX := float64(i)*layout.binWidth + layout.leftLegendWidth
352+
endX := float64(i+1)*layout.binWidth + layout.leftLegendWidth
353353
value := float64(datapoints[i].Points)
354354
y := layout.zeroY - math.Min(value*valueScaling, layout.maxHeight)
355355
cr.LineTo(startX, y)
@@ -365,8 +365,8 @@ func (g *scoreGraph) drawDataPointsRectangular(cr *cairo.Context, layout graphLa
365365
valueScaling = 0
366366
}
367367
for i := valueCount - 1; i >= 0; i-- {
368-
startX := float64(i+1) * layout.binWidth
369-
endX := float64(i) * layout.binWidth
368+
startX := float64(i+1)*layout.binWidth + layout.leftLegendWidth
369+
endX := float64(i)*layout.binWidth + layout.leftLegendWidth
370370
value := float64(datapoints[i].Multis)
371371
y := layout.zeroY + math.Min(value*valueScaling, layout.maxHeight)
372372
cr.LineTo(startX, y)
@@ -395,9 +395,9 @@ func (g *scoreGraph) drawDataPointsCurved(cr *cairo.Context, layout graphLayout,
395395
}
396396
lastY := layout.zeroY
397397
for i := range valueCount {
398-
startX := float64(i) * layout.binWidth
398+
startX := float64(i)*layout.binWidth + layout.leftLegendWidth
399399
centerX := startX + layout.binWidth/2.0
400-
endX := float64(i+1) * layout.binWidth
400+
endX := float64(i+1)*layout.binWidth + layout.leftLegendWidth
401401
value := float64(datapoints[i].Points)
402402
y := layout.zeroY - math.Min(value*valueScaling, layout.maxHeight)
403403
if i == 0 {
@@ -422,9 +422,9 @@ func (g *scoreGraph) drawDataPointsCurved(cr *cairo.Context, layout graphLayout,
422422
valueScaling = layout.multisLowZoneHeight / g.multisBinGoal
423423
lastY = layout.zeroY
424424
for i := valueCount - 1; i >= 0; i-- {
425-
startX := float64(i+1) * layout.binWidth
425+
startX := float64(i+1)*layout.binWidth + layout.leftLegendWidth
426426
centerX := startX - layout.binWidth/2.0
427-
endX := float64(i) * layout.binWidth
427+
endX := float64(i)*layout.binWidth + layout.leftLegendWidth
428428
value := float64(datapoints[i].Multis)
429429
y := layout.zeroY + math.Min(value*valueScaling, layout.maxHeight)
430430
if i == valueCount-1 {

0 commit comments

Comments
 (0)