looking spiffy.
This commit is contained in:
parent
1269397821
commit
e5cc7f9e9c
1 changed files with 3 additions and 2 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/golang/freetype/truetype"
|
||||
)
|
||||
|
@ -138,8 +139,8 @@ func (sbc StackedBarChart) drawBar(r Renderer, canvasBox Box, xoffset int, bar S
|
|||
normalizedBarComponents := Values(bar.Values).Normalize()
|
||||
yoffset := canvasBox.Top
|
||||
for index, bv := range normalizedBarComponents {
|
||||
barHeight := int(bv.Value * float64(canvasBox.Height()))
|
||||
barBox := Box{Top: yoffset, Left: bxl, Right: bxr, Bottom: yoffset + barHeight}
|
||||
barHeight := int(math.Ceil(bv.Value * float64(canvasBox.Height())))
|
||||
barBox := Box{Top: yoffset, Left: bxl, Right: bxr, Bottom: Math.MinInt(yoffset+barHeight, canvasBox.Bottom-DefaultStrokeWidth)}
|
||||
Draw.Box(r, barBox, bv.Style.InheritFrom(sbc.styleDefaultsStackedBarValue(index)))
|
||||
yoffset += barHeight
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue