2016-07-10 04:11:47 -04:00
|
|
|
package chart
|
|
|
|
|
2016-07-31 19:54:09 -04:00
|
|
|
// TickPosition is an enumeration of possible tick drawing positions.
|
|
|
|
type TickPosition int
|
2016-07-30 12:12:03 -04:00
|
|
|
|
|
|
|
const (
|
|
|
|
// TickPositionUnset means to use the default tick position.
|
2016-07-31 19:54:09 -04:00
|
|
|
TickPositionUnset TickPosition = 0
|
2016-07-30 12:12:03 -04:00
|
|
|
// TickPositionBetweenTicks draws the labels for a tick between the previous and current tick.
|
2016-07-31 19:54:09 -04:00
|
|
|
TickPositionBetweenTicks TickPosition = 1
|
2016-07-30 12:12:03 -04:00
|
|
|
// TickPositionUnderTick draws the tick below the tick.
|
2016-07-31 19:54:09 -04:00
|
|
|
TickPositionUnderTick TickPosition = 2
|
2016-07-30 12:12:03 -04:00
|
|
|
)
|
|
|
|
|
2016-07-10 04:11:47 -04:00
|
|
|
// YAxisType is a type of y-axis; it can either be primary or secondary.
|
2016-07-31 19:54:09 -04:00
|
|
|
type YAxisType int
|
2016-07-10 04:11:47 -04:00
|
|
|
|
|
|
|
const (
|
|
|
|
// YAxisPrimary is the primary axis.
|
2016-07-31 19:54:09 -04:00
|
|
|
YAxisPrimary YAxisType = 0
|
2016-07-10 04:11:47 -04:00
|
|
|
// YAxisSecondary is the secondary axis.
|
2016-07-31 19:54:09 -04:00
|
|
|
YAxisSecondary YAxisType = 1
|
2016-07-10 04:11:47 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// Axis is a chart feature detailing what values happen where.
|
|
|
|
type Axis interface {
|
|
|
|
GetName() string
|
2017-01-09 20:57:45 -05:00
|
|
|
SetName(name string)
|
|
|
|
|
2016-07-10 04:11:47 -04:00
|
|
|
GetStyle() Style
|
2017-01-09 20:57:45 -05:00
|
|
|
SetStyle(style Style)
|
2016-07-21 17:11:27 -04:00
|
|
|
|
|
|
|
GetTicks() []Tick
|
|
|
|
GenerateTicks(r Renderer, ra Range, vf ValueFormatter) []Tick
|
|
|
|
|
2017-01-09 20:57:45 -05:00
|
|
|
// GenerateGridLines returns the gridlines for the axis.
|
2016-07-12 22:14:14 -04:00
|
|
|
GetGridLines(ticks []Tick) []GridLine
|
2016-07-21 17:11:27 -04:00
|
|
|
|
|
|
|
// 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)
|
2016-07-10 04:11:47 -04:00
|
|
|
}
|