snapshot.

This commit is contained in:
Will Charczuk 2016-07-10 01:11:47 -07:00
parent 7bb82ae691
commit e9a36274ac
23 changed files with 551 additions and 445 deletions

28
yaxis.go Normal file
View file

@ -0,0 +1,28 @@
package chart
// YAxis is a veritcal rule of the range.
// There can be (2) y-axes; a primary and secondary.
type YAxis struct {
axis
}
// Render renders the axis.
func (ya YAxis) Render(r Renderer, canvasBox Box, ra Range, axisType YAxisType) {
var tx int
if axisType == YAxisPrimary {
tx = canvasBox.Right + DefaultYAxisMargin
} else if axisType == YAxisSecondary {
tx = canvasBox.Left - DefaultYAxisMargin
}
r.SetFontColor(ya.Style.GetFontColor(DefaultAxisColor))
r.SetFontSize(ya.Style.GetFontSize(DefaultFontSize))
ticks := ya.getTicks(ra)
for _, t := range ticks {
v := t.Value
y := ra.Translate(v)
ty := int(y)
r.Text(t.Label, tx, ty)
}
}