fixing y-axis label position

This commit is contained in:
Will Charczuk 2016-10-27 10:40:27 -07:00
parent e8de11d590
commit fc2973067c
1 changed files with 6 additions and 1 deletions

View File

@ -195,7 +195,12 @@ func (ya YAxis) Render(r Renderer, canvasBox Box, ra Range, defaults Style, tick
tx = canvasBox.Left - (DefaultYAxisMargin + int(sw) + maxTextWidth + DefaultYAxisMargin)
}
ty := canvasBox.Top + (canvasBox.Height()>>1 + tb.Width()>>1)
var ty int
if nameStyle.TextRotationDegrees == 0 {
ty = canvasBox.Top + (canvasBox.Height()>>1 - tb.Width()>>1)
} else {
ty = canvasBox.Top + (canvasBox.Height()>>1 - tb.Height()>>1)
}
Draw.Text(r, ya.Name, tx, ty, nameStyle)
}