go-chart/axis.go
2016-07-30 09:12:03 -07:00

42 lines
1.2 KiB
Go

package chart
type tickPosition int
const (
// TickPositionUnset means to use the default tick position.
TickPositionUnset tickPosition = 0
// TickPositionBetweenTicks draws the labels for a tick between the previous and current tick.
TickPositionBetweenTicks tickPosition = 1
// TickPositionUnderTick draws the tick below the tick.
TickPositionUnderTick tickPosition = 2
)
// YAxisType is a type of y-axis; it can either be primary or secondary.
type yAxisType int
const (
// YAxisPrimary is the primary axis.
YAxisPrimary yAxisType = 0
// YAxisSecondary is the secondary axis.
YAxisSecondary yAxisType = 1
)
// Axis is a chart feature detailing what values happen where.
type Axis interface {
GetName() string
GetStyle() Style
GetTicks() []Tick
GenerateTicks(r Renderer, ra Range, vf ValueFormatter) []Tick
// GetGridLines returns the gridlines for the axis.
GetGridLines(ticks []Tick) []GridLine
// Measure should return an absolute box for the axis.
// This is used when auto-fitting the canvas to the background.
Measure(r Renderer, canvasBox Box, ra Range, style Style, ticks []Tick) Box
// Render renders the axis.
Render(r Renderer, canvasBox Box, ra Range, style Style, ticks []Tick)
}