Documentation ¶
Index ¶
- Constants
- Variables
- func AbsInt(value int) int
- func CirclePoint(cx, cy int, radius, thetaRadians float64) (x, y int)
- func Days(days int) []time.Time
- func DegreesAdd(baseDegrees, deltaDegrees float64) float64
- func DegreesToCompass(deg float64) float64
- func DegreesToRadians(degrees float64) float64
- func DiffHours(t1, t2 time.Time) (hours int)
- func GetAlternateColor(index int) drawing.Color
- func GetDefaultColor(index int) drawing.Color
- func GetDefaultFont() (*truetype.Font, error)
- func GetRoundToForDelta(delta float64) float64
- func Hours(start time.Time, totalHours int) []time.Time
- func HoursFilled(xdata []time.Time, ydata []float64) ([]time.Time, []float64)
- func MaxInt(values ...int) (max int)
- func Mean(values ...float64) float64
- func MeanInt(values ...int) int
- func MinInt(values ...int) (min int)
- func MinMax(values ...float64) (min, max float64)
- func Normalize(values ...float64) []float64
- func ParseFloats(values ...string) ([]float64, error)
- func ParseTimes(layout string, values ...string) ([]time.Time, error)
- func PercentDifference(v1, v2 float64) float64
- func PercentToRadians(pct float64) float64
- func RadianAdd(base, delta float64) float64
- func RadiansToDegrees(value float64) float64
- func ReadChunks(filePath string, chunkSize int, handler func([]byte) error) error
- func ReadLines(filePath string, handler func(string) error) error
- func RotateCoordinate(cx, cy, x, y int, thetaRadians float64) (rx, ry int)
- func RoundDown(value, roundTo float64) float64
- func RoundPlaces(input float64, places int) (rounded float64)
- func RoundUp(value, roundTo float64) float64
- func SplitCSV(text string) (output []string)
- func Sum(values ...float64) float64
- func SumInt(values ...int) int
- func TimeFromFloat64(tf float64) time.Time
- func TimeMax(times ...time.Time) (max time.Time)
- func TimeMillis(d time.Duration) float64
- func TimeMin(times ...time.Time) (min time.Time)
- func TimeMinMax(times ...time.Time) (min, max time.Time)
- func TimeToFloat64(t time.Time) float64
- func ToFloat64(t time.Time) float64
- type Array
- type Axis
- type ColorPalette
- type GridLine
- type GridLineProvider
- type ImageWriter
- type IsZeroable
- type NameProvider
- type RGBACollector
- type Range
- type Renderable
- type Renderer
- type RendererProvider
- type Seq
- func (s Seq) Average() float64
- func (s Seq) Each(mapfn func(int, float64))
- func (s Seq) FoldLeft(mapfn func(i int, v0, v float64) float64) (v0 float64)
- func (s Seq) FoldRight(mapfn func(i int, v0, v float64) float64) (v0 float64)
- func (s Seq) Map(mapfn func(i int, v float64) float64) Seq
- func (s Seq) Max() float64
- func (s Seq) Median() (median float64)
- func (s Seq) Min() float64
- func (s Seq) MinMax() (min, max float64)
- func (s Seq) Normalize() Seq
- func (s Seq) Percentile(percent float64) (percentile float64)
- func (s Seq) Reverse() Seq
- func (s Seq) Sort() Seq
- func (s Seq) StdDev() float64
- func (s Seq) Sum() (accum float64)
- func (s Seq) Values() (output []float64)
- func (s Seq) Variance() float64
- type Sequence
- type Stringable
- type Style
- func (s Style) GetClassName(defaults ...string) string
- func (s Style) GetDotColor(defaults ...drawing.Color) drawing.Color
- func (s Style) GetDotOptions() Style
- func (s Style) GetDotWidth(defaults ...float64) float64
- func (s Style) GetFillAndStrokeOptions() Style
- func (s Style) GetFillColor(defaults ...drawing.Color) drawing.Color
- func (s Style) GetFillOptions() Style
- func (s Style) GetFont(defaults ...*truetype.Font) *truetype.Font
- func (s Style) GetFontColor(defaults ...drawing.Color) drawing.Color
- func (s Style) GetFontSize(defaults ...float64) float64
- func (s Style) GetPadding(defaults ...Box) Box
- func (s Style) GetStrokeColor(defaults ...drawing.Color) drawing.Color
- func (s Style) GetStrokeDashArray(defaults ...[]float64) []float64
- func (s Style) GetStrokeOptions() Style
- func (s Style) GetStrokeWidth(defaults ...float64) float64
- func (s Style) GetTextHorizontalAlign(defaults ...TextHorizontalAlign) TextHorizontalAlign
- func (s Style) GetTextLineSpacing(defaults ...int) int
- func (s Style) GetTextOptions() Style
- func (s Style) GetTextRotationDegrees(defaults ...float64) float64
- func (s Style) GetTextVerticalAlign(defaults ...TextVerticalAlign) TextVerticalAlign
- func (s Style) GetTextWrap(defaults ...TextWrap) TextWrap
- func (s Style) InheritFrom(defaults Style) (final Style)
- func (s Style) IsZero() bool
- func (s Style) ShouldDrawDot() bool
- func (s Style) ShouldDrawFill() bool
- func (s Style) ShouldDrawStroke() bool
- func (s Style) String() string
- func (s Style) WriteDrawingOptionsToRenderer(r Renderer)
- func (s Style) WriteTextOptionsToRenderer(r Renderer)
- func (s Style) WriteToRenderer(r Renderer)
- type StyleProvider
- type TextHorizontalAlign
- type TextStyle
- type TextVerticalAlign
- type TextWrap
- type Tick
- type TickPosition
- type Ticks
- type TicksProvider
- type TimeAscending
- type TimeDescending
- type Times
- type XAxis
- func (xa XAxis) GetGridLines(ticks []Tick) []GridLine
- func (xa XAxis) GetName() string
- func (xa XAxis) GetStyle() Style
- func (xa XAxis) GetTickPosition(defaults ...TickPosition) TickPosition
- func (xa XAxis) GetTicks(r Renderer, ra Range, defaults Style, vf ValueFormatter) []Tick
- func (xa XAxis) GetValueFormatter() ValueFormatter
- func (xa XAxis) Measure(r Renderer, canvasBox Box, ra Range, defaults Style, ticks []Tick) Box
- func (xa XAxis) Render(r Renderer, canvasBox Box, ra Range, defaults Style, ticks []Tick)
- type YAxis
- func (ya YAxis) GetGridLines(ticks []Tick) []GridLine
- func (ya YAxis) GetName() string
- func (ya YAxis) GetNameStyle() Style
- func (ya YAxis) GetStyle() Style
- func (ya YAxis) GetTickStyle() Style
- func (ya YAxis) GetTicks(r Renderer, ra Range, defaults Style, vf ValueFormatter) []Tick
- func (ya YAxis) GetValueFormatter() ValueFormatter
- func (ya YAxis) Measure(r Renderer, canvasBox Box, ra Range, defaults Style, ticks []Tick) Box
- func (ya YAxis) Render(r Renderer, canvasBox Box, ra Range, defaults Style, ticks []Tick)
- type YAxisType
Constants ¶
const ( // DefaultChartHeight is the default chart height. DefaultChartHeight = 400 // DefaultChartWidth is the default chart width. DefaultChartWidth = 1024 // DefaultStrokeWidth is the default chart stroke width. DefaultStrokeWidth = 0.0 // DefaultDotWidth is the default chart dot width. DefaultDotWidth = 0.0 // DefaultSeriesLineWidth is the default line width. DefaultSeriesLineWidth = 1.0 // DefaultAxisLineWidth is the line width of the axis lines. DefaultAxisLineWidth = 1.0 //DefaultDPI is the default dots per inch for the chart. DefaultDPI = 92.0 // DefaultMinimumFontSize is the default minimum font size. DefaultMinimumFontSize = 8.0 // DefaultFontSize is the default font size. DefaultFontSize = 10.0 // DefaultTitleFontSize is the default title font size. DefaultTitleFontSize = 18.0 // DefaultAnnotationDeltaWidth is the width of the left triangle out of annotations. DefaultAnnotationDeltaWidth = 10 // DefaultAnnotationFontSize is the font size of annotations. DefaultAnnotationFontSize = 10.0 // DefaultAxisFontSize is the font size of the axis labels. DefaultAxisFontSize = 10.0 // DefaultTitleTop is the default distance from the top of the chart to put the title. DefaultTitleTop = 10 // DefaultBackgroundStrokeWidth is the default stroke on the chart background. DefaultBackgroundStrokeWidth = 0.0 // DefaultCanvasStrokeWidth is the default stroke on the chart canvas. DefaultCanvasStrokeWidth = 0.0 // DefaultLineSpacing is the default vertical distance between lines of text. DefaultLineSpacing = 5 // DefaultYAxisMargin is the default distance from the right of the canvas to the y axis labels. DefaultYAxisMargin = 10 // DefaultXAxisMargin is the default distance from bottom of the canvas to the x axis labels. DefaultXAxisMargin = 10 //DefaultVerticalTickHeight is half the margin. DefaultVerticalTickHeight = DefaultXAxisMargin >> 1 //DefaultHorizontalTickWidth is half the margin. DefaultHorizontalTickWidth = DefaultYAxisMargin >> 1 // DefaultTickCount is the default number of ticks to show DefaultTickCount = 10 // DefaultTickCountSanityCheck is a hard limit on number of ticks to prevent infinite loops. DefaultTickCountSanityCheck = 1 << 10 //1024 // DefaultMinimumTickHorizontalSpacing is the minimum distance between horizontal ticks. DefaultMinimumTickHorizontalSpacing = 20 // DefaultMinimumTickVerticalSpacing is the minimum distance between vertical ticks. DefaultMinimumTickVerticalSpacing = 20 // DefaultDateFormat is the default date format. DefaultDateFormat = "2006-01-02" // DefaultDateHourFormat is the date format for hour timestamp formats. DefaultDateHourFormat = "01-02 3PM" // DefaultDateMinuteFormat is the date format for minute range timestamp formats. DefaultDateMinuteFormat = "01-02 3:04PM" // DefaultFloatFormat is the default float format. DefaultFloatFormat = "%.2f" // DefaultPercentValueFormat is the default percent format. DefaultPercentValueFormat = "%0.2f%%" // DefaultBarSpacing is the default pixel spacing between bars. DefaultBarSpacing = 100 // DefaultBarWidth is the default pixel width of bars in a bar chart. DefaultBarWidth = 50 )
const ( // ContentTypePNG is the png mime type. ContentTypePNG = "image/png" // ContentTypeSVG is the svg mime type. ContentTypeSVG = "image/svg+xml" )
const ( SecondsPerHour = 60 * 60 SecondsPerDay = 60 * 60 * 24 )
SecondsPerXYZ
const ( // Disabled indicates if the value should be interpreted as set intentionally to zero. // this is because golang optionals aren't here yet. Disabled = -1 )
Variables ¶
var ( // ColorWhite is white. ColorWhite = drawing.Color{R: 255, G: 255, B: 255, A: 255} // ColorBlue is the basic theme blue color. ColorBlue = drawing.Color{R: 0, G: 116, B: 217, A: 255} // ColorCyan is the basic theme cyan color. ColorCyan = drawing.Color{R: 0, G: 217, B: 210, A: 255} // ColorGreen is the basic theme green color. ColorGreen = drawing.Color{R: 0, G: 217, B: 101, A: 255} // ColorRed is the basic theme red color. ColorRed = drawing.Color{R: 217, G: 0, B: 116, A: 255} // ColorOrange is the basic theme orange color. ColorOrange = drawing.Color{R: 217, G: 101, B: 0, A: 255} // ColorYellow is the basic theme yellow color. ColorYellow = drawing.Color{R: 217, G: 210, B: 0, A: 255} // ColorBlack is the basic theme black color. ColorBlack = drawing.Color{R: 51, G: 51, B: 51, A: 255} // ColorLightGray is the basic theme light gray color. ColorLightGray = drawing.Color{R: 239, G: 239, B: 239, A: 255} // ColorAlternateBlue is a alternate theme color. ColorAlternateBlue = drawing.Color{R: 106, G: 195, B: 203, A: 255} // ColorAlternateGreen is a alternate theme color. ColorAlternateGreen = drawing.Color{R: 42, G: 190, B: 137, A: 255} // ColorAlternateGray is a alternate theme color. ColorAlternateGray = drawing.Color{R: 110, G: 128, B: 139, A: 255} // ColorAlternateYellow is a alternate theme color. ColorAlternateYellow = drawing.Color{R: 240, G: 174, B: 90, A: 255} // ColorAlternateLightGray is a alternate theme color. ColorAlternateLightGray = drawing.Color{R: 187, G: 190, B: 191, A: 255} // ColorTransparent is a transparent (alpha zero) color. ColorTransparent = drawing.Color{R: 1, G: 1, B: 1, A: 0} )
var ( // DefaultBackgroundColor is the default chart background color. // It is equivalent to css color:white. DefaultBackgroundColor = ColorWhite // DefaultBackgroundStrokeColor is the default chart border color. // It is equivalent to color:white. DefaultBackgroundStrokeColor = ColorWhite // DefaultCanvasColor is the default chart canvas color. // It is equivalent to css color:white. DefaultCanvasColor = ColorWhite // DefaultCanvasStrokeColor is the default chart canvas stroke color. // It is equivalent to css color:white. DefaultCanvasStrokeColor = ColorWhite // DefaultTextColor is the default chart text color. // It is equivalent to #333333. DefaultTextColor = ColorBlack // DefaultAxisColor is the default chart axis line color. // It is equivalent to #333333. DefaultAxisColor = ColorBlack // DefaultStrokeColor is the default chart border color. // It is equivalent to #efefef. DefaultStrokeColor = ColorLightGray // DefaultFillColor is the default fill color. // It is equivalent to #0074d9. DefaultFillColor = ColorBlue // DefaultAnnotationFillColor is the default annotation background color. DefaultAnnotationFillColor = ColorWhite // DefaultGridLineColor is the default grid line color. DefaultGridLineColor = ColorLightGray )
var ( // DefaultColors are a couple default series colors. DefaultColors = []drawing.Color{ ColorBlue, ColorGreen, ColorRed, ColorCyan, ColorOrange, } // DefaultAlternateColors are a couple alternate colors. DefaultAlternateColors = []drawing.Color{ ColorAlternateBlue, ColorAlternateGreen, ColorAlternateGray, ColorAlternateYellow, ColorBlue, ColorGreen, ColorRed, ColorCyan, ColorOrange, } )
var ( // DashArrayDots is a dash array that represents '....' style stroke dashes. DashArrayDots = []int{1, 1} // DashArrayDashesSmall is a dash array that represents '- - -' style stroke dashes. DashArrayDashesSmall = []int{3, 3} // DashArrayDashesMedium is a dash array that represents '-- -- --' style stroke dashes. DashArrayDashesMedium = []int{5, 5} // DashArrayDashesLarge is a dash array that represents '----- ----- -----' style stroke dashes. DashArrayDashesLarge = []int{10, 10} )
var ( // DefaultAnnotationPadding is the padding around an annotation. DefaultAnnotationPadding = Box{Top: 5, Left: 5, Right: 5, Bottom: 5} // DefaultBackgroundPadding is the default canvas padding config. DefaultBackgroundPadding = Box{Top: 5, Left: 5, Right: 5, Bottom: 5} )
var AlternateColorPalette alternateColorPalette
AlternateColorPalette represents the default palatte.
var DefaultColorPalette defaultColorPalette
DefaultColorPalette represents the default palatte.
var (
// Draw contains helpers for drawing common objects.
Draw = &draw{}
)
var (
// Text contains utilities for text.
Text = &text{}
)
Functions ¶
func CirclePoint ¶
CirclePoint returns the absolute position of a circle diameter point given by the radius and the theta.
func DegreesAdd ¶
DegreesAdd adds a delta to a base in radians.
func DegreesToCompass ¶
DegreesToCompass returns the degree value in compass / clock orientation.
func DegreesToRadians ¶
DegreesToRadians returns degrees as radians.
func GetAlternateColor ¶
GetAlternateColor returns a color from the default list by index. NOTE: the index will wrap around (using a modulo).
func GetDefaultColor ¶
GetDefaultColor returns a color from the default list by index. NOTE: the index will wrap around (using a modulo).
func GetDefaultFont ¶
GetDefaultFont returns the default font (Roboto-Medium).
func GetRoundToForDelta ¶
GetRoundToForDelta returns a `roundTo` value for a given delta.
func Hours ¶
Hours returns a sequence of times by the hour for a given number of hours after a given start.
func HoursFilled ¶
HoursFilled adds zero values for the data bounded by the start and end of the xdata array.
func Normalize ¶
Normalize returns a set of numbers on the interval [0,1] for a given set of inputs. An example: 4,3,2,1 => 0.4, 0.3, 0.2, 0.1 Caveat; the total may be < 1.0; there are going to be issues with irrational numbers etc.
func ParseFloats ¶
ParseFloats parses a list of floats.
func ParseTimes ¶
ParseTimes parses a list of times with a given format.
func PercentDifference ¶
PercentDifference computes the percentage difference between two values. The formula is (v2-v1)/v1.
func PercentToRadians ¶
PercentToRadians converts a normalized value (0,1) to radians.
func RadiansToDegrees ¶
RadiansToDegrees translates a radian value to a degree value.
func ReadChunks ¶
ReadChunks reads a file in `chunkSize` pieces, dispatched to the handler.
func RotateCoordinate ¶
RotateCoordinate rotates a coordinate around a given center by a theta in radians.
func RoundPlaces ¶
RoundPlaces rounds an input to a given places.
func SplitCSV ¶
SplitCSV splits a corpus by the `,`, dropping leading or trailing whitespace unless quoted.
func TimeFromFloat64 ¶
TimeFromFloat64 returns a time from a float64.
func TimeMillis ¶
TimeMillis returns a duration as a float millis.
func TimeMinMax ¶
TimeMinMax returns the minimum and maximum times in a given range.
func TimeToFloat64 ¶
TimeToFloat64 returns a float64 representation of a time.
Types ¶
type Array ¶
type Array []float64
Array is a wrapper for an array of floats that implements `ValuesProvider`.
func NewArray ¶
NewArray returns a new array from a given set of values. Array implements Sequence, which allows it to be used with the sequence helpers.
type Axis ¶
type Axis interface { GetName() string SetName(name string) GetStyle() Style SetStyle(style Style) GetTicks() []Tick GenerateTicks(r Renderer, ra Range, vf ValueFormatter) []Tick // GenerateGridLines 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) }
Axis is a chart feature detailing what values happen where.
type ColorPalette ¶
type ColorPalette interface { BackgroundColor() drawing.Color BackgroundStrokeColor() drawing.Color CanvasColor() drawing.Color CanvasStrokeColor() drawing.Color AxisStrokeColor() drawing.Color TextColor() drawing.Color GetSeriesColor(index int) drawing.Color }
ColorPalette is a set of colors that.
type GridLine ¶
GridLine is a line on a graph canvas.
func GenerateGridLines ¶
GenerateGridLines generates grid lines.
type GridLineProvider ¶
type GridLineProvider interface {
GetGridLines(ticks []Tick, isVertical bool, majorStyle, minorStyle Style) []GridLine
}
GridLineProvider is a type that provides grid lines.
type ImageWriter ¶
type ImageWriter struct {
// contains filtered or unexported fields
}
ImageWriter is a special type of io.Writer that produces a final image.
func (*ImageWriter) Image ¶
func (ir *ImageWriter) Image() (image.Image, error)
Image returns an *image.Image for the result.
func (*ImageWriter) SetRGBA ¶
func (ir *ImageWriter) SetRGBA(i *image.RGBA)
SetRGBA sets a raw version of the image.
type IsZeroable ¶
type IsZeroable interface {
IsZero() bool
}
IsZeroable is a type that returns if it's been set or not.
type NameProvider ¶
type NameProvider interface {
GetName() string
}
NameProvider is a type that returns a name.
type RGBACollector ¶
RGBACollector is a render target for a chart.
type Range ¶
type Range interface { Stringable IsZeroable GetMin() float64 SetMin(min float64) GetMax() float64 SetMax(max float64) GetDelta() float64 GetDomain() int SetDomain(domain int) IsDescending() bool // Translate the range to the domain. Translate(value float64) int }
Range is a common interface for a range of values.
type Renderable ¶
Renderable is a function that can be called to render custom elements on the chart.
func Legend ¶
func Legend(c *Chart, userDefaults ...Style) Renderable
Legend returns a legend renderable function.
func LegendLeft ¶
func LegendLeft(c *Chart, userDefaults ...Style) Renderable
LegendLeft is a legend that is designed for longer series lists.
func LegendThin ¶
func LegendThin(c *Chart, userDefaults ...Style) Renderable
LegendThin is a legend that doesn't obscure the chart area.
type Renderer ¶
type Renderer interface { // ResetStyle should reset any style related settings on the renderer. ResetStyle() // GetDPI gets the DPI for the renderer. GetDPI() float64 // SetDPI sets the DPI for the renderer. SetDPI(dpi float64) // SetClassName sets the current class name. SetClassName(string) // SetStrokeColor sets the current stroke color. SetStrokeColor(drawing.Color) // SetFillColor sets the current fill color. SetFillColor(drawing.Color) // SetStrokeWidth sets the stroke width. SetStrokeWidth(width float64) // SetStrokeDashArray sets the stroke dash array. SetStrokeDashArray(dashArray []float64) // MoveTo moves the cursor to a given point. MoveTo(x, y int) // LineTo both starts a shape and draws a line to a given point // from the previous point. LineTo(x, y int) // QuadCurveTo draws a quad curve. // cx and cy represent the bezier "control points". QuadCurveTo(cx, cy, x, y int) // ArcTo draws an arc with a given center (cx,cy) // a given set of radii (rx,ry), a startAngle and delta (in radians). ArcTo(cx, cy int, rx, ry, startAngle, delta float64) // Close finalizes a shape as drawn by LineTo. Close() // Stroke strokes the path. Stroke() // Fill fills the path, but does not stroke. Fill() // FillStroke fills and strokes a path. FillStroke() // Circle draws a circle at the given coords with a given radius. Circle(radius float64, x, y int) // SetFont sets a font for a text field. SetFont(*truetype.Font) // SetFontColor sets a font's color SetFontColor(drawing.Color) // SetFontSize sets the font size for a text field. SetFontSize(size float64) // Text draws a text blob. Text(body string, x, y int) // MeasureText measures text. MeasureText(body string) Box // SetTextRotatation sets a rotation for drawing elements. SetTextRotation(radians float64) // ClearTextRotation clears rotation. ClearTextRotation() // Save writes the image to the given writer. Save(w io.Writer) error }
Renderer represents the basic methods required to draw a chart.
type RendererProvider ¶
RendererProvider is a function that returns a renderer.
type Seq ¶
type Seq struct {
Sequence
}
Seq is a utility wrapper for seq providers.
func ValueSequence ¶
ValueSequence returns a sequence for a given values set.
func (Seq) Percentile ¶
Percentile finds the relative standing in a slice of floats. `percent` should be given on the interval [0,1.0).
type Stringable ¶
type Stringable interface {
String() string
}
Stringable is a type that has a string representation.
type Style ¶
type Style struct { Hidden bool Padding Box ClassName string StrokeWidth float64 StrokeColor drawing.Color StrokeDashArray []float64 DotColor drawing.Color DotWidth float64 DotWidthProvider SizeProvider DotColorProvider DotColorProvider FillColor drawing.Color FontSize float64 FontColor drawing.Color Font *truetype.Font TextHorizontalAlign TextHorizontalAlign TextVerticalAlign TextVerticalAlign TextWrap TextWrap TextLineSpacing int TextRotationDegrees float64 //0 is unset or normal }
Style is a simple style set.
func Hidden ¶
func Hidden() Style
Hidden is a prebuilt style with the `Hidden` property set to true.
func Shown ¶
func Shown() Style
Shown is a prebuilt style with the `Hidden` property set to false. You can also think of this as the default.
func StyleTextDefaults ¶
func StyleTextDefaults() Style
StyleTextDefaults returns a style for drawing outside a chart context.
func (Style) GetClassName ¶
GetClassName returns the class name or a default.
func (Style) GetDotColor ¶
GetDotColor returns the stroke color.
func (Style) GetDotOptions ¶
GetDotOptions returns the dot components.
func (Style) GetDotWidth ¶
GetDotWidth returns the dot width for scatter plots.
func (Style) GetFillAndStrokeOptions ¶
GetFillAndStrokeOptions returns the fill and stroke components.
func (Style) GetFillColor ¶
GetFillColor returns the fill color.
func (Style) GetFillOptions ¶
GetFillOptions returns the fill components.
func (Style) GetFontColor ¶
GetFontColor gets the font size.
func (Style) GetFontSize ¶
GetFontSize gets the font size.
func (Style) GetPadding ¶
func (s Style) GetPadding(defaults ...Box) Box
GetPadding returns the padding.
func (Style) GetStrokeColor ¶
GetStrokeColor returns the stroke color.
func (Style) GetStrokeDashArray ¶
GetStrokeDashArray returns the stroke dash array.
func (Style) GetStrokeOptions ¶
GetStrokeOptions returns the stroke components.
func (Style) GetStrokeWidth ¶
GetStrokeWidth returns the stroke width.
func (Style) GetTextHorizontalAlign ¶
func (s Style) GetTextHorizontalAlign(defaults ...TextHorizontalAlign) TextHorizontalAlign
GetTextHorizontalAlign returns the horizontal alignment.
func (Style) GetTextLineSpacing ¶
GetTextLineSpacing returns the spacing in pixels between lines of text (vertically).
func (Style) GetTextOptions ¶
GetTextOptions returns just the text components of the style.
func (Style) GetTextRotationDegrees ¶
GetTextRotationDegrees returns the text rotation in degrees.
func (Style) GetTextVerticalAlign ¶
func (s Style) GetTextVerticalAlign(defaults ...TextVerticalAlign) TextVerticalAlign
GetTextVerticalAlign returns the vertical alignment.
func (Style) GetTextWrap ¶
GetTextWrap returns the word wrap.
func (Style) InheritFrom ¶
InheritFrom coalesces two styles into a new style.
func (Style) ShouldDrawDot ¶
ShouldDrawDot tells drawing functions if they should draw the dot.
func (Style) ShouldDrawFill ¶
ShouldDrawFill tells drawing functions if they should draw the stroke.
func (Style) ShouldDrawStroke ¶
ShouldDrawStroke tells drawing functions if they should draw the stroke.
func (Style) WriteDrawingOptionsToRenderer ¶
WriteDrawingOptionsToRenderer passes just the drawing style options to a renderer.
func (Style) WriteTextOptionsToRenderer ¶
WriteTextOptionsToRenderer passes just the text style options to a renderer.
func (Style) WriteToRenderer ¶
WriteToRenderer passes the style's options to a renderer.
type StyleProvider ¶
type StyleProvider interface {
GetStyle() Style
}
StyleProvider is a type that returns a style.
type TextHorizontalAlign ¶
type TextHorizontalAlign int
TextHorizontalAlign is an enum for the horizontal alignment options.
const ( // TextHorizontalAlignUnset is the unset state for text horizontal alignment. TextHorizontalAlignUnset TextHorizontalAlign = 0 // TextHorizontalAlignLeft aligns a string horizontally so that it's left ligature starts at horizontal pixel 0. TextHorizontalAlignLeft TextHorizontalAlign = 1 // TextHorizontalAlignCenter left aligns a string horizontally so that there are equal pixels // to the left and to the right of a string within a box. TextHorizontalAlignCenter TextHorizontalAlign = 2 // TextHorizontalAlignRight right aligns a string horizontally so that the right ligature ends at the right-most pixel // of a box. TextHorizontalAlignRight TextHorizontalAlign = 3 )
type TextStyle ¶
type TextStyle struct { HorizontalAlign TextHorizontalAlign VerticalAlign TextVerticalAlign Wrap TextWrap }
TextStyle encapsulates text style options.
type TextVerticalAlign ¶
type TextVerticalAlign int
TextVerticalAlign is an enum for the vertical alignment options.
const ( // TextVerticalAlignUnset is the unset state for vertical alignment options. TextVerticalAlignUnset TextVerticalAlign = 0 // TextVerticalAlignBaseline aligns text according to the "baseline" of the string, or where a normal ascender begins. TextVerticalAlignBaseline TextVerticalAlign = 1 // TextVerticalAlignBottom aligns the text according to the lowers pixel of any of the ligatures (ex. g or q both extend below the baseline). TextVerticalAlignBottom TextVerticalAlign = 2 // TextVerticalAlignMiddle aligns the text so that there is an equal amount of space above and below the top and bottom of the ligatures. TextVerticalAlignMiddle TextVerticalAlign = 3 // TextVerticalAlignMiddleBaseline aligns the text vertically so that there is an equal number of pixels above and below the baseline of the string. TextVerticalAlignMiddleBaseline TextVerticalAlign = 4 // TextVerticalAlignTop alignts the text so that the top of the ligatures are at y-pixel 0 in the container. TextVerticalAlignTop TextVerticalAlign = 5 )
type TextWrap ¶
type TextWrap int
TextWrap is an enum for the word wrap options.
const ( // TextWrapUnset is the unset state for text wrap options. TextWrapUnset TextWrap = 0 // TextWrapNone will spill text past horizontal boundaries. TextWrapNone TextWrap = 1 // TextWrapWord will split a string on words (i.e. spaces) to fit within a horizontal boundary. TextWrapWord TextWrap = 2 // TextWrapRune will split a string on a rune (i.e. utf-8 codepage) to fit within a horizontal boundary. TextWrapRune TextWrap = 3 )
type TickPosition ¶
type TickPosition int
TickPosition is an enumeration of possible tick drawing positions.
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 )
type Ticks ¶
type Ticks []Tick
Ticks is an array of ticks.
type TicksProvider ¶
TicksProvider is a type that provides ticks.
type TimeAscending ¶
TimeAscending sorts a given list of times ascending, or min to max.
type TimeDescending ¶
TimeDescending sorts a given list of times ascending, or min to max.
func (TimeDescending) Less ¶
func (d TimeDescending) Less(i, j int) bool
Less implements sort.Sorter
type Times ¶
Times are an array of times. It wraps the array with methods that implement `seq.Provider`.
type XAxis ¶
type XAxis struct { Name string NameStyle Style Style Style ValueFormatter ValueFormatter Range Range TickStyle Style Ticks []Tick TickPosition TickPosition GridLines []GridLine GridMajorStyle Style GridMinorStyle Style }
XAxis represents the horizontal axis.
func (XAxis) GetGridLines ¶
GetGridLines returns the gridlines for the axis.
func (XAxis) GetTickPosition ¶
func (xa XAxis) GetTickPosition(defaults ...TickPosition) TickPosition
GetTickPosition returns the tick position option for the axis.
func (XAxis) GetTicks ¶
GetTicks returns the ticks for a series. The coalesce priority is:
- User Supplied Ticks (i.e. Ticks array on the axis itself).
- Range ticks (i.e. if the range provides ticks).
- Generating continuous ticks based on minimum spacing and canvas width.
func (XAxis) GetValueFormatter ¶
func (xa XAxis) GetValueFormatter() ValueFormatter
GetValueFormatter returns the value formatter for the axis.
type YAxis ¶
type YAxis struct { Name string NameStyle Style Style Style Zero GridLine AxisType YAxisType Ascending bool ValueFormatter ValueFormatter Range Range TickStyle Style Ticks []Tick GridLines []GridLine GridMajorStyle Style GridMinorStyle Style }
YAxis is a veritcal rule of the range. There can be (2) y-axes; a primary and secondary.
func (YAxis) GetGridLines ¶
GetGridLines returns the gridlines for the axis.
func (YAxis) GetNameStyle ¶
GetNameStyle returns the name style.
func (YAxis) GetTickStyle ¶
GetTickStyle returns the tick style.
func (YAxis) GetTicks ¶
GetTicks returns the ticks for a series. The coalesce priority is:
- User Supplied Ticks (i.e. Ticks array on the axis itself).
- Range ticks (i.e. if the range provides ticks).
- Generating continuous ticks based on minimum spacing and canvas width.
func (YAxis) GetValueFormatter ¶
func (ya YAxis) GetValueFormatter() ValueFormatter
GetValueFormatter returns the value formatter for the axis.