Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Commit

Permalink
fixing y-axis label position
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Charczuk committed Oct 27, 2016
1 parent e8de11d commit fc29730
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion yaxis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit fc29730

Please sign in to comment.