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

27
xaxis.go Normal file
View file

@ -0,0 +1,27 @@
package chart
import "github.com/wcharczuk/go-chart/drawing"
// XAxis represents the horizontal axis.
type XAxis struct {
axis
}
// Render renders the axis
func (xa XAxis) Render(r Renderer, canvasBox Box, ra Range) {
tickFontSize := xa.Style.GetFontSize(DefaultFontSize)
tickHeight := drawing.PointsToPixels(r.GetDPI(), tickFontSize)
ty := canvasBox.Bottom + DefaultXAxisMargin + int(tickHeight)
r.SetFontColor(xa.Style.GetFontColor(DefaultAxisColor))
r.SetFontSize(tickFontSize)
ticks := xa.getTicks(ra)
for _, t := range ticks {
v := t.Value
x := ra.Translate(v)
tx := canvasBox.Left + int(x)
r.Text(t.Label, tx, ty)
}
}