snapshot.
This commit is contained in:
parent
cd4bbc6503
commit
8595962d99
3 changed files with 10 additions and 37 deletions
12
yaxis.go
12
yaxis.go
|
|
@ -84,23 +84,20 @@ func (ya YAxis) Measure(r Renderer, canvasBox Box, ra Range, defaults Style, tic
|
|||
}
|
||||
|
||||
ya.TickStyle.InheritFrom(ya.Style.InheritFrom(defaults)).WriteToRenderer(r)
|
||||
|
||||
var minx, maxx, miny, maxy = math.MaxInt32, 0, math.MaxInt32, 0
|
||||
var maxTextHeight int
|
||||
for _, t := range ticks {
|
||||
|
||||
v := t.Value
|
||||
ly := canvasBox.Bottom - ra.Translate(v)
|
||||
|
||||
tb := r.MeasureText(t.Label)
|
||||
tbh2 := tb.Height() >> 1
|
||||
finalTextX := tx
|
||||
if ya.AxisType == YAxisSecondary {
|
||||
finalTextX = tx - tb.Width()
|
||||
}
|
||||
|
||||
if tb.Height() > maxTextHeight {
|
||||
maxTextHeight = tb.Height()
|
||||
}
|
||||
maxTextHeight = Math.MaxInt(tb.Height(), maxTextHeight)
|
||||
|
||||
if ya.AxisType == YAxisPrimary {
|
||||
minx = canvasBox.Right
|
||||
|
|
@ -109,8 +106,9 @@ func (ya YAxis) Measure(r Renderer, canvasBox Box, ra Range, defaults Style, tic
|
|||
minx = Math.MinInt(minx, finalTextX)
|
||||
maxx = Math.MaxInt(maxx, tx)
|
||||
}
|
||||
miny = Math.MinInt(miny, ly-tb.Height()>>1)
|
||||
maxy = Math.MaxInt(maxy, ly+tb.Height()>>1)
|
||||
|
||||
miny = Math.MinInt(miny, ly-tbh2)
|
||||
maxy = Math.MaxInt(maxy, ly+tbh2)
|
||||
}
|
||||
|
||||
if ya.NameStyle.Show && len(ya.Name) > 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue