Documentation
¶
Index ¶
- Constants
- Variables
- func Days(days int) []time.Time
- func Debug(log Logger, arguments ...any)
- func Debugf(log Logger, format string, arguments ...any)
- func DiffHours(t1, t2 time.Time) (hours int)
- func ExponentialValueFormatter(v any) string
- func FloatValueFormatter(v any) string
- func FloatValueFormatterWithFormat(v any, floatFormat string) string
- func GetAlternateColor(index int) config.Color
- func GetDefaultColor(index int) config.Color
- func GetDefaultFont() (*truetype.Font, error)
- func GetDefaultFontProvider() (config.FontFamily, error)
- func Hours(start time.Time, totalHours int) []time.Time
- func HoursFilled(xdata []time.Time, ydata []float64) ([]time.Time, []float64)
- func Info(log Logger, arguments ...any)
- func Infof(log Logger, format string, arguments ...any)
- func IntValueFormatter(v any) string
- func Jet(v, vmin, vmax float64) config.Color
- func LinearRange(start, end float64) []float64
- func LinearRangeWithStep(start, end, step float64) []float64
- func NewTrueTypeFontAdapter(font *truetype.Font, name, family, weight, style, path string) config.FontFamily
- func ParseFloats(values ...string) ([]float64, error)
- func ParseTimes(layout string, values ...string) ([]time.Time, error)
- func PercentValueFormatter(v any) string
- func RandomValues(count int) []float64
- func RandomValuesWithMax(count int, max float64) []float64
- func ReadChunks(filePath string, chunkSize int, handler func([]byte) error) error
- func ReadLines(filePath string, handler func(string) error) error
- func SVGWithCSS(css string, nonce string) func(width, height int) (Renderer, error)
- func SplitCSV(text string) (output []string)
- func TimeDateValueFormatter(v any) string
- func TimeFromFloat64(tf float64) time.Time
- func TimeHourValueFormatter(v any) string
- 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 TimeMinuteValueFormatter(v any) string
- func TimeToFloat64(t time.Time) float64
- func TimeValueFormatter(v any) string
- func ToFloat64(t time.Time) float64
- func Viridis(v, vmin, vmax float64) config.Color
- type AnnotationSeries
- func BoundedLastValuesAnnotationSeries(innerSeries FullBoundedValuesProvider, vfs ...ValueFormatter) AnnotationSeries
- func FirstValueAnnotation(innerSeries ValuesProvider, vfs ...ValueFormatter) AnnotationSeries
- func LastValueAnnotationSeries(innerSeries ValuesProvider, vfs ...ValueFormatter) AnnotationSeries
- func (as AnnotationSeries) GetName() string
- func (as AnnotationSeries) GetStyle() Style
- func (as AnnotationSeries) GetYAxis() YAxisType
- func (as AnnotationSeries) Measure(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style) canvas.Box
- func (as AnnotationSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (as AnnotationSeries) Validate() error
- type Array
- type Axis
- type BarChart
- func (bc BarChart) GetBarSpacing() int
- func (bc BarChart) GetBarWidth() int
- func (bc BarChart) GetColorPalette() ColorPalette
- func (bc BarChart) GetDPI() float64
- func (bc BarChart) GetFont() *truetype.Font
- func (bc BarChart) GetHeight() int
- func (bc BarChart) GetWidth() int
- func (bc BarChart) Render(rp RendererProvider, w io.Writer) error
- type BollingerBandsSeries
- func (bbs *BollingerBandsSeries) GetBoundedLastValues() (x, y1, y2 float64)
- func (bbs *BollingerBandsSeries) GetBoundedValues(index int) (x, y1, y2 float64)
- func (bbs BollingerBandsSeries) GetK(defaults ...float64) float64
- func (bbs BollingerBandsSeries) GetName() string
- func (bbs BollingerBandsSeries) GetPeriod() int
- func (bbs BollingerBandsSeries) GetStyle() Style
- func (bbs BollingerBandsSeries) GetYAxis() YAxisType
- func (bbs BollingerBandsSeries) Len() int
- func (bbs *BollingerBandsSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (bbs BollingerBandsSeries) Validate() error
- type BoundedLastValuesProvider
- type BoundedValuesProvider
- type Chart
- type ChartEngine
- func (ce *ChartEngine) BarChart(barWidth int) *BarChart
- func (ce *ChartEngine) DonutChart(values []Value) *DonutChart
- func (ce *ChartEngine) GetFont() *truetype.Font
- func (ce *ChartEngine) PieChart(values []Value) *PieChart
- func (ce *ChartEngine) SetDefaultBackgroundStyle(style Style) *ChartEngine
- func (ce *ChartEngine) SetDefaultCanvasStyle(style Style) *ChartEngine
- func (ce *ChartEngine) SetDefaultColorPalette(palette ColorPalette) *ChartEngine
- func (ce *ChartEngine) SetDefaultDPI(dpi float64) *ChartEngine
- func (ce *ChartEngine) SetDefaultDimensions(width, height int) *ChartEngine
- type ColorPalette
- type ColorProvider
- type ConcatSeries
- type ContinuousRange
- func (r ContinuousRange) GetDelta() float64
- func (r ContinuousRange) GetDomain() int
- func (r ContinuousRange) GetMax() float64
- func (r ContinuousRange) GetMin() float64
- func (r ContinuousRange) IsDescending() bool
- func (r ContinuousRange) IsZero() bool
- func (r *ContinuousRange) SetDomain(domain int)
- func (r *ContinuousRange) SetMax(max float64)
- func (r *ContinuousRange) SetMin(min float64)
- func (r ContinuousRange) String() string
- func (r ContinuousRange) Translate(value float64) int
- type ContinuousSeries
- func (cs ContinuousSeries) GetFirstValues() (float64, float64)
- func (cs ContinuousSeries) GetLastValues() (float64, float64)
- func (cs ContinuousSeries) GetName() string
- func (cs ContinuousSeries) GetStyle() Style
- func (cs ContinuousSeries) GetValueFormatters() (x, y ValueFormatter)
- func (cs ContinuousSeries) GetValues(index int) (float64, float64)
- func (cs ContinuousSeries) GetYAxis() YAxisType
- func (cs ContinuousSeries) Len() int
- func (cs ContinuousSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (cs ContinuousSeries) Validate() error
- type DonutChart
- func (pc DonutChart) Box() canvas.Box
- func (pc DonutChart) GetColorPalette() ColorPalette
- func (pc DonutChart) GetDPI(defaults ...float64) float64
- func (pc DonutChart) GetFont() *truetype.Font
- func (pc DonutChart) GetHeight() int
- func (pc DonutChart) GetWidth() int
- func (pc DonutChart) Render(rp RendererProvider, w io.Writer) error
- type DotColorProvider
- type EMASeries
- func (ema *EMASeries) GetFirstValues() (x, y float64)
- func (ema *EMASeries) GetLastValues() (x, y float64)
- func (ema EMASeries) GetName() string
- func (ema EMASeries) GetPeriod() int
- func (ema EMASeries) GetSigma() float64
- func (ema EMASeries) GetStyle() Style
- func (ema *EMASeries) GetValues(index int) (x, y float64)
- func (ema EMASeries) GetYAxis() YAxisType
- func (ema EMASeries) Len() int
- func (ema *EMASeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (ema *EMASeries) Validate() error
- type FirstValuesProvider
- type FullBoundedValuesProvider
- type FullValuesProvider
- type GridLine
- type GridLineProvider
- type HistogramSeries
- func (hs HistogramSeries) GetBoundedValues(index int) (x, y1, y2 float64)
- func (hs HistogramSeries) GetName() string
- func (hs HistogramSeries) GetStyle() Style
- func (hs HistogramSeries) GetValues(index int) (x, y float64)
- func (hs HistogramSeries) GetYAxis() YAxisType
- func (hs HistogramSeries) Len() int
- func (hs HistogramSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (hs HistogramSeries) Validate() error
- type ImageWriter
- type IsZeroable
- type LastValuesProvider
- type LinearCoefficientProvider
- type LinearCoefficientSet
- type LinearRegressionSeries
- func (lrs LinearRegressionSeries) Coefficients() (m, b, stdev, avg float64)
- func (lrs LinearRegressionSeries) GetEndIndex() int
- func (lrs *LinearRegressionSeries) GetFirstValues() (x, y float64)
- func (lrs *LinearRegressionSeries) GetLastValues() (x, y float64)
- func (lrs LinearRegressionSeries) GetLimit() int
- func (lrs LinearRegressionSeries) GetName() string
- func (lrs LinearRegressionSeries) GetOffset() int
- func (lrs LinearRegressionSeries) GetStyle() Style
- func (lrs *LinearRegressionSeries) GetValues(index int) (x, y float64)
- func (lrs LinearRegressionSeries) GetYAxis() YAxisType
- func (lrs *LinearRegressionSeries) IsZero() bool
- func (lrs LinearRegressionSeries) Len() int
- func (lrs *LinearRegressionSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (lrs *LinearRegressionSeries) Validate() error
- type LinearSeq
- func (lg LinearSeq) End() float64
- func (lg LinearSeq) GetValue(index int) float64
- func (lg LinearSeq) Len() int
- func (lg LinearSeq) Start() float64
- func (lg LinearSeq) Step() float64
- func (lg *LinearSeq) WithEnd(end float64) *LinearSeq
- func (lg *LinearSeq) WithStart(start float64) *LinearSeq
- func (lg *LinearSeq) WithStep(step float64) *LinearSeq
- type LinearSeries
- func (ls LinearSeries) GetEndIndex() int
- func (ls *LinearSeries) GetFirstValues() (x, y float64)
- func (ls *LinearSeries) GetLastValues() (x, y float64)
- func (ls LinearSeries) GetName() string
- func (ls LinearSeries) GetStyle() Style
- func (ls *LinearSeries) GetValues(index int) (x, y float64)
- func (ls LinearSeries) GetYAxis() YAxisType
- func (ls LinearSeries) IsZero() bool
- func (ls LinearSeries) Len() int
- func (ls *LinearSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (ls LinearSeries) Validate() error
- type LogarithmicRange
- func (r LogarithmicRange) GetDelta() float64
- func (r LogarithmicRange) GetDomain() int
- func (r LogarithmicRange) GetMax() float64
- func (r LogarithmicRange) GetMin() float64
- func (r LogarithmicRange) GetTicks(render Renderer, defaults Style, vf ValueFormatter) []Tick
- func (r LogarithmicRange) IsDescending() bool
- func (r LogarithmicRange) IsZero() bool
- func (r *LogarithmicRange) SetDomain(domain int)
- func (r *LogarithmicRange) SetMax(max float64)
- func (r *LogarithmicRange) SetMin(min float64)
- func (r LogarithmicRange) String() string
- func (r LogarithmicRange) Translate(value float64) int
- type Logger
- type LoggerOption
- type MACDLineSeries
- func (macdl MACDLineSeries) GetName() string
- func (macdl MACDLineSeries) GetPeriods() (w1, w2 int)
- func (macdl MACDLineSeries) GetStyle() Style
- func (macdl *MACDLineSeries) GetValues(index int) (x float64, y float64)
- func (macdl MACDLineSeries) GetYAxis() YAxisType
- func (macdl *MACDLineSeries) Len() int
- func (macdl *MACDLineSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (macdl MACDLineSeries) Validate() error
- type MACDSeries
- func (macd MACDSeries) GetName() string
- func (macd MACDSeries) GetPeriods() (w1, w2, sig int)
- func (macd MACDSeries) GetStyle() Style
- func (macd *MACDSeries) GetValues(index int) (x float64, y float64)
- func (macd MACDSeries) GetYAxis() YAxisType
- func (macd MACDSeries) Len() int
- func (macd MACDSeries) Validate() error
- type MACDSignalSeries
- func (macds MACDSignalSeries) GetName() string
- func (macds MACDSignalSeries) GetPeriods() (w1, w2, sig int)
- func (macds MACDSignalSeries) GetStyle() Style
- func (macds *MACDSignalSeries) GetValues(index int) (x float64, y float64)
- func (macds MACDSignalSeries) GetYAxis() YAxisType
- func (macds *MACDSignalSeries) Len() int
- func (macds *MACDSignalSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (macds MACDSignalSeries) Validate() error
- type MaxSeries
- func (ms MaxSeries) GetName() string
- func (ms MaxSeries) GetStyle() Style
- func (ms *MaxSeries) GetValues(index int) (x, y float64)
- func (ms MaxSeries) GetYAxis() YAxisType
- func (ms MaxSeries) Len() int
- func (ms *MaxSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (ms *MaxSeries) Validate() error
- type MinSeries
- func (ms MinSeries) GetName() string
- func (ms MinSeries) GetStyle() Style
- func (ms *MinSeries) GetValues(index int) (x, y float64)
- func (ms MinSeries) GetYAxis() YAxisType
- func (ms MinSeries) Len() int
- func (ms *MinSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (ms *MinSeries) Validate() error
- type NameProvider
- type PdfRenderer
- func (r *PdfRenderer) ArcTo(cx, cy int, rx, ry, startAngle, delta float64)
- func (r *PdfRenderer) Circle(radius float64, x, y int)
- func (r *PdfRenderer) ClearTextRotation()
- func (r *PdfRenderer) Close()
- func (r *PdfRenderer) Fill()
- func (r *PdfRenderer) FillStroke()
- func (r *PdfRenderer) GetDPI() float64
- func (r *PdfRenderer) LineTo(x, y int)
- func (r *PdfRenderer) MeasureText(body string) canvas.Box
- func (r *PdfRenderer) MoveTo(x, y int)
- func (r *PdfRenderer) QuadCurveTo(cx, cy, x, y int)
- func (r *PdfRenderer) ResetStyle()
- func (r *PdfRenderer) Save(w io.Writer) error
- func (r *PdfRenderer) SetClassName(className string)
- func (r *PdfRenderer) SetDPI(dpi float64)
- func (r *PdfRenderer) SetFillColor(color config.Color)
- func (r *PdfRenderer) SetFont(font config.FontFamily)
- func (r *PdfRenderer) SetFontColor(color config.Color)
- func (r *PdfRenderer) SetFontSize(size float64)
- func (r *PdfRenderer) SetStrokeColor(color config.Color)
- func (r *PdfRenderer) SetStrokeDashArray(dashArray []float64)
- func (r *PdfRenderer) SetStrokeWidth(width float64)
- func (r *PdfRenderer) SetTextRotation(radians float64)
- func (r *PdfRenderer) Stroke()
- func (r *PdfRenderer) Text(body string, x, y int)
- type PercentChangeSeries
- func (pcs PercentChangeSeries) GetFirstValues() (x, y float64)
- func (pcs PercentChangeSeries) GetLastValues() (x, y float64)
- func (pcs PercentChangeSeries) GetName() string
- func (pcs PercentChangeSeries) GetStyle() Style
- func (pcs PercentChangeSeries) GetValueFormatters() (x, y ValueFormatter)
- func (pcs PercentChangeSeries) GetValues(index int) (x, y float64)
- func (pcs PercentChangeSeries) GetYAxis() YAxisType
- func (pcs PercentChangeSeries) Len() int
- func (pcs PercentChangeSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (pcs PercentChangeSeries) Validate() error
- type PercentChangeSeriesSource
- type PieChart
- func (pc PieChart) Box() canvas.Box
- func (pc PieChart) GetColorPalette() ColorPalette
- func (pc PieChart) GetDPI(defaults ...float64) float64
- func (pc PieChart) GetFont() *truetype.Font
- func (pc PieChart) GetHeight() int
- func (pc PieChart) GetWidth() int
- func (pc PieChart) Render(rp RendererProvider, w io.Writer) error
- type Point
- type PolynomialRegressionSeries
- func (prs PolynomialRegressionSeries) GetEndIndex() int
- func (prs *PolynomialRegressionSeries) GetFirstValues() (x, y float64)
- func (prs *PolynomialRegressionSeries) GetLastValues() (x, y float64)
- func (prs PolynomialRegressionSeries) GetLimit() int
- func (prs PolynomialRegressionSeries) GetName() string
- func (prs PolynomialRegressionSeries) GetOffset() int
- func (prs PolynomialRegressionSeries) GetStyle() Style
- func (prs *PolynomialRegressionSeries) GetValues(index int) (x, y float64)
- func (prs PolynomialRegressionSeries) GetYAxis() YAxisType
- func (prs PolynomialRegressionSeries) Len() int
- func (prs *PolynomialRegressionSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (prs *PolynomialRegressionSeries) Validate() error
- type RGBACollector
- type RandomSeq
- type Range
- type Renderable
- type Renderer
- type RendererProvider
- type SMASeries
- func (sma SMASeries) GetFirstValues() (x, y float64)
- func (sma SMASeries) GetLastValues() (x, y float64)
- func (sma SMASeries) GetName() string
- func (sma SMASeries) GetPeriod(defaults ...int) int
- func (sma SMASeries) GetStyle() Style
- func (sma SMASeries) GetValues(index int) (x, y float64)
- func (sma SMASeries) GetYAxis() YAxisType
- func (sma SMASeries) Len() int
- func (sma SMASeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (sma SMASeries) Validate() error
- 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 Series
- type SizeProvider
- type StackedBar
- type StackedBarChart
- func (sbc StackedBarChart) Box() canvas.Box
- func (sbc StackedBarChart) GetBarSpacing() int
- func (sbc StackedBarChart) GetColorPalette() ColorPalette
- func (sbc StackedBarChart) GetDPI(defaults ...float64) float64
- func (sbc StackedBarChart) GetFont() *truetype.Font
- func (sbc StackedBarChart) GetHeight() int
- func (sbc StackedBarChart) GetWidth() int
- func (sbc StackedBarChart) Render(rp RendererProvider, w io.Writer) error
- type StdoutLogger
- func (l *StdoutLogger) Debug(arguments ...any)
- func (l *StdoutLogger) Debugf(format string, arguments ...any)
- func (l *StdoutLogger) Err(err error)
- func (l *StdoutLogger) Error(arguments ...any)
- func (l *StdoutLogger) Errorf(format string, arguments ...any)
- func (l *StdoutLogger) Errorln(arguments ...any)
- func (l *StdoutLogger) FatalErr(err error)
- func (l *StdoutLogger) Info(arguments ...any)
- func (l *StdoutLogger) Infof(format string, arguments ...any)
- func (l *StdoutLogger) Println(arguments ...any)
- type Stringable
- type Style
- func (s Style) GetClassName(defaults ...string) string
- func (s Style) GetDotColor(defaults ...config.Color) config.Color
- func (s Style) GetDotOptions() Style
- func (s Style) GetDotWidth(defaults ...float64) float64
- func (s Style) GetFillAndStrokeOptions() Style
- func (s Style) GetFillColor(defaults ...config.Color) config.Color
- func (s Style) GetFillOptions() Style
- func (s Style) GetFont(defaults ...*truetype.Font) *truetype.Font
- func (s Style) GetFontColor(defaults ...config.Color) config.Color
- func (s Style) GetFontProvider(defaults ...config.FontFamily) config.FontFamily
- func (s Style) GetFontSize(defaults ...float64) float64
- func (s Style) GetPadding(defaults ...canvas.Box) canvas.Box
- func (s Style) GetStrokeColor(defaults ...config.Color) config.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 TimeSeries
- func (ts TimeSeries) GetFirstValues() (x, y float64)
- func (ts TimeSeries) GetLastValues() (x, y float64)
- func (ts TimeSeries) GetName() string
- func (ts TimeSeries) GetStyle() Style
- func (ts TimeSeries) GetValueFormatters() (x, y ValueFormatter)
- func (ts TimeSeries) GetValues(index int) (x, y float64)
- func (ts TimeSeries) GetYAxis() YAxisType
- func (ts TimeSeries) Len() int
- func (ts TimeSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
- func (ts TimeSeries) Validate() error
- type Times
- type TrueTypeFontAdapter
- type Value
- type Value2
- type ValueBuffer
- func (b *ValueBuffer) Array() Array
- func (b *ValueBuffer) Capacity() int
- func (b *ValueBuffer) Clear()
- func (b *ValueBuffer) Dequeue() float64
- func (b *ValueBuffer) Each(mapfn func(int, float64))
- func (b *ValueBuffer) Enqueue(value float64)
- func (b *ValueBuffer) GetValue(index int) float64
- func (b *ValueBuffer) Len() int
- func (b *ValueBuffer) Peek() float64
- func (b *ValueBuffer) PeekBack() float64
- func (b *ValueBuffer) SetCapacity(capacity int)
- func (b *ValueBuffer) String() string
- func (b *ValueBuffer) TrimExcess()
- type ValueFormatter
- type ValueFormatterProvider
- type Values
- type ValuesProvider
- 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 canvas.Box, ra Range, defaults Style, ticks []Tick) canvas.Box
- func (xa XAxis) Render(r Renderer, canvasBox canvas.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 canvas.Box, ra Range, defaults Style, ticks []Tick) canvas.Box
- func (ya YAxis) Render(r Renderer, canvasBox canvas.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 ( // DefaultMACDPeriodPrimary is the long window. DefaultMACDPeriodPrimary = 26 // DefaultMACDPeriodSecondary is the short window. DefaultMACDPeriodSecondary = 12 // DefaultMACDSignalPeriod is the signal period to compute for the MACD. DefaultMACDSignalPeriod = 9 )
const ( SecondsPerHour = 60 * 60 SecondsPerDay = 60 * 60 * 24 )
SecondsPerXYZ
const (
// DefaultEMAPeriod is the default EMA period used in the sigma calculation.
DefaultEMAPeriod = 12
)
const (
// DefaultSimpleMovingAveragePeriod is the default number of values to average.
DefaultSimpleMovingAveragePeriod = 16
)
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 = config.Color{R: 255, G: 255, B: 255, A: 255} // ColorBlue is the basic theme blue color. ColorBlue = config.Color{R: 0, G: 116, B: 217, A: 255} // ColorCyan is the basic theme cyan color. ColorCyan = config.Color{R: 0, G: 217, B: 210, A: 255} // ColorGreen is the basic theme green color. ColorGreen = config.Color{R: 0, G: 217, B: 101, A: 255} // ColorRed is the basic theme red color. ColorRed = config.Color{R: 217, G: 0, B: 116, A: 255} // ColorOrange is the basic theme orange color. ColorOrange = config.Color{R: 217, G: 101, B: 0, A: 255} // ColorYellow is the basic theme yellow color. ColorYellow = config.Color{R: 217, G: 210, B: 0, A: 255} // ColorBlack is the basic theme black color. ColorBlack = config.Color{R: 51, G: 51, B: 51, A: 255} // ColorLightGray is the basic theme light gray color. ColorLightGray = config.Color{R: 239, G: 239, B: 239, A: 255} // ColorAlternateBlue is a alternate theme color. ColorAlternateBlue = config.Color{R: 106, G: 195, B: 203, A: 255} // ColorAlternateGreen is a alternate theme color. ColorAlternateGreen = config.Color{R: 42, G: 190, B: 137, A: 255} // ColorAlternateGray is a alternate theme color. ColorAlternateGray = config.Color{R: 110, G: 128, B: 139, A: 255} // ColorAlternateYellow is a alternate theme color. ColorAlternateYellow = config.Color{R: 240, G: 174, B: 90, A: 255} // ColorAlternateLightGray is a alternate theme color. ColorAlternateLightGray = config.Color{R: 187, G: 190, B: 191, A: 255} // ColorTransparent is a transparent (alpha zero) color. ColorTransparent = config.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 = []config.Color{ ColorBlue, ColorGreen, ColorRed, ColorCyan, ColorOrange, } // DefaultAlternateColors are a couple alternate colors. DefaultAlternateColors = []config.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 = canvas.Box{Top: 5, Left: 5, Right: 5, Bottom: 5} // DefaultBackgroundPadding is the default canvas padding config. DefaultBackgroundPadding = canvas.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 ExponentialValueFormatter ¶
FloatValueFormatter is a ValueFormatter for float64, exponential notation, e.g. 1.52e+08.
func FloatValueFormatter ¶
FloatValueFormatter is a ValueFormatter for float64.
func FloatValueFormatterWithFormat ¶
FloatValueFormatterWithFormat is a ValueFormatter for float64 with a given format.
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). Esta función ahora inicializa un ChartEngine si no existe uno para mantener compatibilidad con el código existente. NOTA: Para código nuevo, usar GetDefaultFontProvider() en su lugar que es compatible con la nueva abstracción config.FontFamily.
func GetDefaultFontProvider ¶ added in v0.0.70
func GetDefaultFontProvider() (config.FontFamily, error)
GetDefaultFontProvider returns the default font as a config.FontFamily. Esta es la función preferida para el nuevo código que utiliza la abstracción config.FontFamily en lugar de truetype.Font directamente.
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 IntValueFormatter ¶
IntValueFormatter is a ValueFormatter for float64.
func LinearRange ¶
LinearRange returns an array of values representing the range from start to end, incremented by 1.0.
func LinearRangeWithStep ¶
LinearRangeWithStep returns the array values of a linear seq with a given start, end and optional step.
func NewTrueTypeFontAdapter ¶ added in v0.0.70
func NewTrueTypeFontAdapter(font *truetype.Font, name, family, weight, style, path string) config.FontFamily
NewTrueTypeFontAdapter crea un nuevo adaptador para truetype.Font
func ParseFloats ¶
ParseFloats parses a list of floats.
func ParseTimes ¶
ParseTimes parses a list of times with a given format.
func PercentValueFormatter ¶
PercentValueFormatter is a formatter for percent values. NOTE: it normalizes the values, i.e. multiplies by 100.0.
func RandomValues ¶
RandomValues returns an array of random values.
func RandomValuesWithMax ¶
RandomValuesWithMax returns an array of random values with a given average.
func ReadChunks ¶
ReadChunks reads a file in `chunkSize` pieces, dispatched to the handler.
func SVGWithCSS ¶
SVGWithCSS returns a new png/raster renderer with attached custom CSS The optional nonce argument sets a CSP nonce.
func SplitCSV ¶
SplitCSV splits a corpus by the `,`, dropping leading or trailing whitespace unless quoted.
func TimeDateValueFormatter ¶
TimeDateValueFormatter is a ValueFormatter for timestamps.
func TimeFromFloat64 ¶
TimeFromFloat64 returns a time from a float64.
func TimeHourValueFormatter ¶
TimeHourValueFormatter is a ValueFormatter for timestamps.
func TimeMillis ¶
TimeMillis returns a duration as a float millis.
func TimeMinMax ¶
TimeMinMax returns the minimum and maximum times in a given range.
func TimeMinuteValueFormatter ¶
TimeMinuteValueFormatter is a ValueFormatter for timestamps.
func TimeToFloat64 ¶
TimeToFloat64 returns a float64 representation of a time.
func TimeValueFormatter ¶
TimeValueFormatter is a ValueFormatter for timestamps.
Types ¶
type AnnotationSeries ¶
AnnotationSeries is a series of labels on the chart.
func BoundedLastValuesAnnotationSeries ¶
func BoundedLastValuesAnnotationSeries(innerSeries FullBoundedValuesProvider, vfs ...ValueFormatter) AnnotationSeries
BoundedLastValuesAnnotationSeries returns a last value annotation series for a bounded values provider.
func FirstValueAnnotation ¶
func FirstValueAnnotation(innerSeries ValuesProvider, vfs ...ValueFormatter) AnnotationSeries
FirstValueAnnotation returns an annotation series of just the first value of a value provider as an annotation.
func LastValueAnnotationSeries ¶
func LastValueAnnotationSeries(innerSeries ValuesProvider, vfs ...ValueFormatter) AnnotationSeries
LastValueAnnotationSeries returns an annotation series of just the last value of a value provider.
func (AnnotationSeries) GetName ¶
func (as AnnotationSeries) GetName() string
GetName returns the name of the time series.
func (AnnotationSeries) GetStyle ¶
func (as AnnotationSeries) GetStyle() Style
GetStyle returns the line style.
func (AnnotationSeries) GetYAxis ¶
func (as AnnotationSeries) GetYAxis() YAxisType
GetYAxis returns which YAxis the series draws on.
func (AnnotationSeries) Measure ¶
func (as AnnotationSeries) Measure(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style) canvas.Box
Measure returns a bounds box of the series.
func (AnnotationSeries) Render ¶
func (as AnnotationSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
Render draws the series.
func (AnnotationSeries) Validate ¶
func (as AnnotationSeries) Validate() error
Validate validates the series.
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 canvas.Box, ra Range, style Style, ticks []Tick) canvas.Box
// Render renders the axis.
Render(r Renderer, canvasBox canvas.Box, ra Range, style Style, ticks []Tick)
}
Axis is a chart feature detailing what values happen where.
type BarChart ¶
type BarChart struct {
Title string
TitleStyle Style
ColorPalette ColorPalette
Width int
Height int
DPI float64
BarWidth int
Background Style
Canvas Style
XAxis Style
YAxis YAxis
BarSpacing int
UseBaseValue bool
BaseValue float64
Font *truetype.Font
Bars []Value
Elements []Renderable
}
BarChart is a chart that draws bars on a range.
func (BarChart) GetBarSpacing ¶
GetBarSpacing returns the spacing between bars.
func (BarChart) GetBarWidth ¶
GetBarWidth returns the default bar width.
func (BarChart) GetColorPalette ¶
func (bc BarChart) GetColorPalette() ColorPalette
GetColorPalette returns the color palette for the chart.
type BollingerBandsSeries ¶
type BollingerBandsSeries struct {
Name string
Style Style
YAxis YAxisType
Period int
K float64
InnerSeries ValuesProvider
// contains filtered or unexported fields
}
BollingerBandsSeries draws bollinger bands for an inner series. Bollinger bands are defined by two lines, one at SMA+k*stddev, one at SMA-k*stdev.
func (*BollingerBandsSeries) GetBoundedLastValues ¶
func (bbs *BollingerBandsSeries) GetBoundedLastValues() (x, y1, y2 float64)
GetBoundedLastValues returns the last bounded value for the series.
func (*BollingerBandsSeries) GetBoundedValues ¶
func (bbs *BollingerBandsSeries) GetBoundedValues(index int) (x, y1, y2 float64)
GetBoundedValues gets the bounded value for the series.
func (BollingerBandsSeries) GetK ¶
func (bbs BollingerBandsSeries) GetK(defaults ...float64) float64
GetK returns the K value, or the number of standard deviations above and below to band the simple moving average with. Typical K value is 2.0.
func (BollingerBandsSeries) GetName ¶
func (bbs BollingerBandsSeries) GetName() string
GetName returns the name of the time series.
func (BollingerBandsSeries) GetPeriod ¶
func (bbs BollingerBandsSeries) GetPeriod() int
GetPeriod returns the window size.
func (BollingerBandsSeries) GetStyle ¶
func (bbs BollingerBandsSeries) GetStyle() Style
GetStyle returns the line style.
func (BollingerBandsSeries) GetYAxis ¶
func (bbs BollingerBandsSeries) GetYAxis() YAxisType
GetYAxis returns which YAxis the series draws on.
func (BollingerBandsSeries) Len ¶
func (bbs BollingerBandsSeries) Len() int
Len returns the number of elements in the series.
func (*BollingerBandsSeries) Render ¶
func (bbs *BollingerBandsSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
Render renders the series.
func (BollingerBandsSeries) Validate ¶
func (bbs BollingerBandsSeries) Validate() error
Validate validates the series.
type BoundedLastValuesProvider ¶
type BoundedLastValuesProvider interface {
GetBoundedLastValues() (x, y1, y2 float64)
}
BoundedLastValuesProvider is a special type of value provider that can return it's (potentially computed) bounded last value.
type BoundedValuesProvider ¶
BoundedValuesProvider allows series to return a range.
type Chart ¶
type Chart struct {
Title string
TitleStyle Style
ColorPalette ColorPalette
Width int
Height int
DPI float64
Background Style
Canvas Style
XAxis XAxis
YAxis YAxis
YAxisSecondary YAxis
Font *truetype.Font
Series []Series
Elements []Renderable
Log Logger
}
Chart is what we're drawing.
func (Chart) GetColorPalette ¶
func (c Chart) GetColorPalette() ColorPalette
GetColorPalette returns the color palette for the chart.
type ChartEngine ¶ added in v0.0.65
type ChartEngine struct {
// Estilos predeterminados
Background Style
Canvas Style
// Paleta de colores
ColorPalette ColorPalette
// contains filtered or unexported fields
}
ChartEngine centraliza la configuración y recursos para todos los gráficos
func NewEngine ¶ added in v0.0.65
func NewEngine(fontBytes []byte) (*ChartEngine, error)
NewEngine crea una nueva instancia de ChartEngine con la fuente proporcionada. Este método debe ser llamado una sola vez para centralizar la inicialización.
func (*ChartEngine) BarChart ¶ added in v0.0.65
func (ce *ChartEngine) BarChart(barWidth int) *BarChart
BarChart crea un nuevo BarChart usando la configuración del motor
func (*ChartEngine) DonutChart ¶ added in v0.0.65
func (ce *ChartEngine) DonutChart(values []Value) *DonutChart
DonutChart crea un nuevo DonutChart usando la configuración del motor
func (*ChartEngine) GetFont ¶ added in v0.0.65
func (ce *ChartEngine) GetFont() *truetype.Font
GetFont devuelve la fuente configurada en el ChartEngine
func (*ChartEngine) PieChart ¶ added in v0.0.65
func (ce *ChartEngine) PieChart(values []Value) *PieChart
PieChart crea un nuevo PieChart usando la configuración del motor
func (*ChartEngine) SetDefaultBackgroundStyle ¶ added in v0.0.65
func (ce *ChartEngine) SetDefaultBackgroundStyle(style Style) *ChartEngine
WithBackgroundStyle configura el estilo de fondo
func (*ChartEngine) SetDefaultCanvasStyle ¶ added in v0.0.65
func (ce *ChartEngine) SetDefaultCanvasStyle(style Style) *ChartEngine
WithCanvasStyle configura el estilo del canvas
func (*ChartEngine) SetDefaultColorPalette ¶ added in v0.0.65
func (ce *ChartEngine) SetDefaultColorPalette(palette ColorPalette) *ChartEngine
WithColorPalette configura la paleta de colores para los gráficos
func (*ChartEngine) SetDefaultDPI ¶ added in v0.0.65
func (ce *ChartEngine) SetDefaultDPI(dpi float64) *ChartEngine
WithDPI configura el DPI para los gráficos generados por este motor
func (*ChartEngine) SetDefaultDimensions ¶ added in v0.0.65
func (ce *ChartEngine) SetDefaultDimensions(width, height int) *ChartEngine
SetDefaultDimensions configura el tamaño de los gráficos por defecto generados por este motor
type ColorPalette ¶
type ColorPalette interface {
BackgroundColor() config.Color
BackgroundStrokeColor() config.Color
CanvasColor() config.Color
CanvasStrokeColor() config.Color
AxisStrokeColor() config.Color
TextColor() config.Color
GetSeriesColor(index int) config.Color
}
ColorPalette is a set of colors that.
type ColorProvider ¶
ColorProvider is a general provider for color ranges based on values.
type ConcatSeries ¶
type ConcatSeries []Series
ConcatSeries is a special type of series that concatenates its `InnerSeries`.
func (ConcatSeries) GetValue ¶
func (cs ConcatSeries) GetValue(index int) (x, y float64)
GetValue returns the value at the (meta) index (i.e 0 => totalLen-1)
func (ConcatSeries) Len ¶
func (cs ConcatSeries) Len() int
Len returns the length of the concatenated set of series.
func (ConcatSeries) Validate ¶
func (cs ConcatSeries) Validate() error
Validate validates the series.
type ContinuousRange ¶
ContinuousRange represents a boundary for a set of numbers.
func (ContinuousRange) GetDelta ¶
func (r ContinuousRange) GetDelta() float64
GetDelta returns the difference between the min and max value.
func (ContinuousRange) GetDomain ¶
func (r ContinuousRange) GetDomain() int
GetDomain returns the range domain.
func (ContinuousRange) GetMax ¶
func (r ContinuousRange) GetMax() float64
GetMax returns the max value for the continuous range.
func (ContinuousRange) GetMin ¶
func (r ContinuousRange) GetMin() float64
GetMin gets the min value for the continuous range.
func (ContinuousRange) IsDescending ¶
func (r ContinuousRange) IsDescending() bool
IsDescending returns if the range is descending.
func (ContinuousRange) IsZero ¶
func (r ContinuousRange) IsZero() bool
IsZero returns if the ContinuousRange has been set or not.
func (*ContinuousRange) SetDomain ¶
func (r *ContinuousRange) SetDomain(domain int)
SetDomain sets the range domain.
func (*ContinuousRange) SetMax ¶
func (r *ContinuousRange) SetMax(max float64)
SetMax sets the max value for the continuous range.
func (*ContinuousRange) SetMin ¶
func (r *ContinuousRange) SetMin(min float64)
SetMin sets the min value for the continuous range.
func (ContinuousRange) String ¶
func (r ContinuousRange) String() string
String returns a simple string for the ContinuousRange.
func (ContinuousRange) Translate ¶
func (r ContinuousRange) Translate(value float64) int
Translate maps a given value into the ContinuousRange space.
type ContinuousSeries ¶
type ContinuousSeries struct {
Name string
Style Style
YAxis YAxisType
XValueFormatter ValueFormatter
YValueFormatter ValueFormatter
XValues []float64
YValues []float64
}
ContinuousSeries represents a line on a chart.
func (ContinuousSeries) GetFirstValues ¶
func (cs ContinuousSeries) GetFirstValues() (float64, float64)
GetFirstValues gets the first x,y values.
func (ContinuousSeries) GetLastValues ¶
func (cs ContinuousSeries) GetLastValues() (float64, float64)
GetLastValues gets the last x,y values.
func (ContinuousSeries) GetName ¶
func (cs ContinuousSeries) GetName() string
GetName returns the name of the time series.
func (ContinuousSeries) GetStyle ¶
func (cs ContinuousSeries) GetStyle() Style
GetStyle returns the line style.
func (ContinuousSeries) GetValueFormatters ¶
func (cs ContinuousSeries) GetValueFormatters() (x, y ValueFormatter)
GetValueFormatters returns value formatter defaults for the series.
func (ContinuousSeries) GetValues ¶
func (cs ContinuousSeries) GetValues(index int) (float64, float64)
GetValues gets the x,y values at a given index.
func (ContinuousSeries) GetYAxis ¶
func (cs ContinuousSeries) GetYAxis() YAxisType
GetYAxis returns which YAxis the series draws on.
func (ContinuousSeries) Len ¶
func (cs ContinuousSeries) Len() int
Len returns the number of elements in the series.
func (ContinuousSeries) Render ¶
func (cs ContinuousSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
Render renders the series.
func (ContinuousSeries) Validate ¶
func (cs ContinuousSeries) Validate() error
Validate validates the series.
type DonutChart ¶
type DonutChart struct {
Title string
TitleStyle Style
ColorPalette ColorPalette
Width int
Height int
DPI float64
Background Style
Canvas Style
SliceStyle Style
Font *truetype.Font
Values []Value
Elements []Renderable
}
DonutChart is a chart that draws sections of a circle based on percentages with an hole.
func (DonutChart) Box ¶
func (pc DonutChart) Box() canvas.Box
canvas.Box returns the chart bounds as a box.
func (DonutChart) GetColorPalette ¶
func (pc DonutChart) GetColorPalette() ColorPalette
GetColorPalette returns the color palette for the chart.
func (DonutChart) GetDPI ¶
func (pc DonutChart) GetDPI(defaults ...float64) float64
GetDPI returns the dpi for the chart.
func (DonutChart) GetFont ¶
func (pc DonutChart) GetFont() *truetype.Font
GetFont returns the text font.
func (DonutChart) GetHeight ¶
func (pc DonutChart) GetHeight() int
GetHeight returns the chart height or the default value.
func (DonutChart) GetWidth ¶
func (pc DonutChart) GetWidth() int
GetWidth returns the chart width or the default value.
func (DonutChart) Render ¶
func (pc DonutChart) Render(rp RendererProvider, w io.Writer) error
Render renders the chart with the given renderer to the given io.Writer.
type DotColorProvider ¶
DotColorProvider is a provider for dot color.
type EMASeries ¶
type EMASeries struct {
Name string
Style Style
YAxis YAxisType
Period int
InnerSeries ValuesProvider
// contains filtered or unexported fields
}
EMASeries is a computed series.
func (*EMASeries) GetFirstValues ¶
GetFirstValues computes the first moving average value.
func (*EMASeries) GetLastValues ¶
GetLastValues computes the last moving average value but walking back window size samples, and recomputing the last moving average chunk.
type FirstValuesProvider ¶
type FirstValuesProvider interface {
GetFirstValues() (x, y float64)
}
FirstValuesProvider is a special type of value provider that can return it's (potentially computed) first value.
type FullBoundedValuesProvider ¶
type FullBoundedValuesProvider interface {
BoundedValuesProvider
BoundedLastValuesProvider
}
FullBoundedValuesProvider is an interface that combines `BoundedValuesProvider` and `BoundedLastValuesProvider`
type FullValuesProvider ¶
type FullValuesProvider interface {
ValuesProvider
LastValuesProvider
}
FullValuesProvider is an interface that combines `ValuesProvider` and `LastValuesProvider`
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 HistogramSeries ¶
type HistogramSeries struct {
Name string
Style Style
YAxis YAxisType
InnerSeries ValuesProvider
}
HistogramSeries is a special type of series that draws as a histogram. Some peculiarities; it will always be lower bounded at 0 (at the very least). This may alter ranges a bit and generally you want to put a histogram series on it's own y-axis.
func (HistogramSeries) GetBoundedValues ¶
func (hs HistogramSeries) GetBoundedValues(index int) (x, y1, y2 float64)
GetBoundedValues implements BoundedValuesProvider.GetBoundedValue
func (HistogramSeries) GetName ¶
func (hs HistogramSeries) GetName() string
GetName implements Series.GetName.
func (HistogramSeries) GetStyle ¶
func (hs HistogramSeries) GetStyle() Style
GetStyle implements Series.GetStyle.
func (HistogramSeries) GetValues ¶
func (hs HistogramSeries) GetValues(index int) (x, y float64)
GetValues implements ValuesProvider.GetValues.
func (HistogramSeries) GetYAxis ¶
func (hs HistogramSeries) GetYAxis() YAxisType
GetYAxis returns which yaxis the series is mapped to.
func (HistogramSeries) Len ¶
func (hs HistogramSeries) Len() int
Len implements BoundedValuesProvider.Len.
func (HistogramSeries) Render ¶
func (hs HistogramSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
Render implements Series.Render.
func (HistogramSeries) Validate ¶
func (hs HistogramSeries) Validate() error
Validate validates the series.
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 LastValuesProvider ¶
type LastValuesProvider interface {
GetLastValues() (x, y float64)
}
LastValuesProvider is a special type of value provider that can return it's (potentially computed) last value.
type LinearCoefficientProvider ¶
type LinearCoefficientProvider interface {
Coefficients() (m, b, stdev, avg float64)
}
LinearCoefficientProvider is a type that returns linear cofficients.
type LinearCoefficientSet ¶
LinearCoefficientSet is the m and b values for the linear equation in the form: y = (m*x) + b
func LinearCoefficients ¶
func LinearCoefficients(m, b float64) LinearCoefficientSet
LinearCoefficients returns a fixed linear coefficient pair.
func NormalizedLinearCoefficients ¶
func NormalizedLinearCoefficients(m, b, stdev, avg float64) LinearCoefficientSet
NormalizedLinearCoefficients returns a fixed linear coefficient pair.
func (LinearCoefficientSet) Coefficients ¶
func (lcs LinearCoefficientSet) Coefficients() (m, b, stdev, avg float64)
Coefficients returns the coefficients.
type LinearRegressionSeries ¶
type LinearRegressionSeries struct {
Name string
Style Style
YAxis YAxisType
Limit int
Offset int
InnerSeries ValuesProvider
// contains filtered or unexported fields
}
LinearRegressionSeries is a series that plots the n-nearest neighbors linear regression for the values.
func (LinearRegressionSeries) Coefficients ¶
func (lrs LinearRegressionSeries) Coefficients() (m, b, stdev, avg float64)
Coefficients returns the linear coefficients for the series.
func (LinearRegressionSeries) GetEndIndex ¶
func (lrs LinearRegressionSeries) GetEndIndex() int
GetEndIndex returns the effective limit end.
func (*LinearRegressionSeries) GetFirstValues ¶
func (lrs *LinearRegressionSeries) GetFirstValues() (x, y float64)
GetFirstValues computes the first linear regression value.
func (*LinearRegressionSeries) GetLastValues ¶
func (lrs *LinearRegressionSeries) GetLastValues() (x, y float64)
GetLastValues computes the last linear regression value.
func (LinearRegressionSeries) GetLimit ¶
func (lrs LinearRegressionSeries) GetLimit() int
GetLimit returns the window size.
func (LinearRegressionSeries) GetName ¶
func (lrs LinearRegressionSeries) GetName() string
GetName returns the name of the time series.
func (LinearRegressionSeries) GetOffset ¶
func (lrs LinearRegressionSeries) GetOffset() int
GetOffset returns the data offset.
func (LinearRegressionSeries) GetStyle ¶
func (lrs LinearRegressionSeries) GetStyle() Style
GetStyle returns the line style.
func (*LinearRegressionSeries) GetValues ¶
func (lrs *LinearRegressionSeries) GetValues(index int) (x, y float64)
GetValues gets a value at a given index.
func (LinearRegressionSeries) GetYAxis ¶
func (lrs LinearRegressionSeries) GetYAxis() YAxisType
GetYAxis returns which YAxis the series draws on.
func (*LinearRegressionSeries) IsZero ¶
func (lrs *LinearRegressionSeries) IsZero() bool
IsZero returns if we've computed the coefficients or not.
func (LinearRegressionSeries) Len ¶
func (lrs LinearRegressionSeries) Len() int
Len returns the number of elements in the series.
func (*LinearRegressionSeries) Render ¶
func (lrs *LinearRegressionSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
Render renders the series.
func (*LinearRegressionSeries) Validate ¶
func (lrs *LinearRegressionSeries) Validate() error
Validate validates the series.
type LinearSeq ¶
type LinearSeq struct {
// contains filtered or unexported fields
}
LinearSeq is a stepwise generator.
func NewLinearSequence ¶
func NewLinearSequence() *LinearSeq
NewLinearSequence returns a new linear generator.
type LinearSeries ¶
type LinearSeries struct {
Name string
Style Style
YAxis YAxisType
XValues []float64
InnerSeries LinearCoefficientProvider
// contains filtered or unexported fields
}
LinearSeries is a series that plots a line in a given domain.
func (LinearSeries) GetEndIndex ¶
func (ls LinearSeries) GetEndIndex() int
GetEndIndex returns the effective limit end.
func (*LinearSeries) GetFirstValues ¶
func (ls *LinearSeries) GetFirstValues() (x, y float64)
GetFirstValues computes the first linear regression value.
func (*LinearSeries) GetLastValues ¶
func (ls *LinearSeries) GetLastValues() (x, y float64)
GetLastValues computes the last linear regression value.
func (LinearSeries) GetName ¶
func (ls LinearSeries) GetName() string
GetName returns the name of the time series.
func (LinearSeries) GetStyle ¶
func (ls LinearSeries) GetStyle() Style
GetStyle returns the line style.
func (*LinearSeries) GetValues ¶
func (ls *LinearSeries) GetValues(index int) (x, y float64)
GetValues gets a value at a given index.
func (LinearSeries) GetYAxis ¶
func (ls LinearSeries) GetYAxis() YAxisType
GetYAxis returns which YAxis the series draws on.
func (LinearSeries) IsZero ¶
func (ls LinearSeries) IsZero() bool
IsZero returns if the linear series has computed coefficients or not.
func (LinearSeries) Len ¶
func (ls LinearSeries) Len() int
Len returns the number of elements in the series.
func (*LinearSeries) Render ¶
func (ls *LinearSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
Render renders the series.
func (LinearSeries) Validate ¶
func (ls LinearSeries) Validate() error
Validate validates the series.
type LogarithmicRange ¶
LogarithmicRange represents a boundary for a set of numbers.
func (LogarithmicRange) GetDelta ¶
func (r LogarithmicRange) GetDelta() float64
GetDelta returns the difference between the min and max value.
func (LogarithmicRange) GetDomain ¶
func (r LogarithmicRange) GetDomain() int
GetDomain returns the range domain.
func (LogarithmicRange) GetMax ¶
func (r LogarithmicRange) GetMax() float64
GetMax returns the max value for the continuous range.
func (LogarithmicRange) GetMin ¶
func (r LogarithmicRange) GetMin() float64
GetMin gets the min value for the continuous range.
func (LogarithmicRange) GetTicks ¶
func (r LogarithmicRange) GetTicks(render Renderer, defaults Style, vf ValueFormatter) []Tick
GetTicks calculates the needed ticks for the axis, in log scale. Only supports Y values > 0.
func (LogarithmicRange) IsDescending ¶
func (r LogarithmicRange) IsDescending() bool
IsDescending returns if the range is descending.
func (LogarithmicRange) IsZero ¶
func (r LogarithmicRange) IsZero() bool
IsZero returns if the LogarithmicRange has been set or not.
func (*LogarithmicRange) SetDomain ¶
func (r *LogarithmicRange) SetDomain(domain int)
SetDomain sets the range domain.
func (*LogarithmicRange) SetMax ¶
func (r *LogarithmicRange) SetMax(max float64)
SetMax sets the max value for the continuous range.
func (*LogarithmicRange) SetMin ¶
func (r *LogarithmicRange) SetMin(min float64)
SetMin sets the min value for the continuous range.
func (LogarithmicRange) String ¶
func (r LogarithmicRange) String() string
String returns a simple string for the LogarithmicRange.
func (LogarithmicRange) Translate ¶
func (r LogarithmicRange) Translate(value float64) int
Translate maps a given value into the LogarithmicRange space. Modified version from ContinuousRange.
type Logger ¶
type Logger interface {
Info(...any)
Infof(string, ...any)
Debug(...any)
Debugf(string, ...any)
Err(error)
FatalErr(error)
Error(...any)
Errorf(string, ...any)
}
Logger is a type that implements the logging interface.
type LoggerOption ¶
type LoggerOption = func(*StdoutLogger)
LoggerOption mutates a stdout logger.
func OptLoggerStderr ¶
func OptLoggerStderr(wr io.Writer) LoggerOption
OptLoggerStderr sets the Stdout writer.
func OptLoggerStdout ¶
func OptLoggerStdout(wr io.Writer) LoggerOption
OptLoggerStdout sets the Stdout writer.
type MACDLineSeries ¶
type MACDLineSeries struct {
Name string
Style Style
YAxis YAxisType
InnerSeries ValuesProvider
PrimaryPeriod int
SecondaryPeriod int
Sigma float64
// contains filtered or unexported fields
}
MACDLineSeries is a series that computes the inner ema1-ema2 value as a series.
func (MACDLineSeries) GetName ¶
func (macdl MACDLineSeries) GetName() string
GetName returns the name of the time series.
func (MACDLineSeries) GetPeriods ¶
func (macdl MACDLineSeries) GetPeriods() (w1, w2 int)
GetPeriods returns the primary and secondary periods.
func (MACDLineSeries) GetStyle ¶
func (macdl MACDLineSeries) GetStyle() Style
GetStyle returns the line style.
func (*MACDLineSeries) GetValues ¶
func (macdl *MACDLineSeries) GetValues(index int) (x float64, y float64)
GetValues gets a value at a given index. For MACD it is the signal value.
func (MACDLineSeries) GetYAxis ¶
func (macdl MACDLineSeries) GetYAxis() YAxisType
GetYAxis returns which YAxis the series draws on.
func (*MACDLineSeries) Len ¶
func (macdl *MACDLineSeries) Len() int
Len returns the number of elements in the series.
func (*MACDLineSeries) Render ¶
func (macdl *MACDLineSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
Render renders the series.
func (MACDLineSeries) Validate ¶
func (macdl MACDLineSeries) Validate() error
Validate validates the series.
type MACDSeries ¶
type MACDSeries struct {
Name string
Style Style
YAxis YAxisType
InnerSeries ValuesProvider
PrimaryPeriod int
SecondaryPeriod int
SignalPeriod int
// contains filtered or unexported fields
}
MACDSeries computes the difference between the MACD line and the MACD Signal line. It is used in technical analysis and gives a lagging indicator of momentum.
func (MACDSeries) GetName ¶
func (macd MACDSeries) GetName() string
GetName returns the name of the time series.
func (MACDSeries) GetPeriods ¶
func (macd MACDSeries) GetPeriods() (w1, w2, sig int)
GetPeriods returns the primary and secondary periods.
func (MACDSeries) GetStyle ¶
func (macd MACDSeries) GetStyle() Style
GetStyle returns the line style.
func (*MACDSeries) GetValues ¶
func (macd *MACDSeries) GetValues(index int) (x float64, y float64)
GetValues gets a value at a given index. For MACD it is the signal value.
func (MACDSeries) GetYAxis ¶
func (macd MACDSeries) GetYAxis() YAxisType
GetYAxis returns which YAxis the series draws on.
func (MACDSeries) Len ¶
func (macd MACDSeries) Len() int
Len returns the number of elements in the series.
type MACDSignalSeries ¶
type MACDSignalSeries struct {
Name string
Style Style
YAxis YAxisType
InnerSeries ValuesProvider
PrimaryPeriod int
SecondaryPeriod int
SignalPeriod int
// contains filtered or unexported fields
}
MACDSignalSeries computes the EMA of the MACDLineSeries.
func (MACDSignalSeries) GetName ¶
func (macds MACDSignalSeries) GetName() string
GetName returns the name of the time series.
func (MACDSignalSeries) GetPeriods ¶
func (macds MACDSignalSeries) GetPeriods() (w1, w2, sig int)
GetPeriods returns the primary and secondary periods.
func (MACDSignalSeries) GetStyle ¶
func (macds MACDSignalSeries) GetStyle() Style
GetStyle returns the line style.
func (*MACDSignalSeries) GetValues ¶
func (macds *MACDSignalSeries) GetValues(index int) (x float64, y float64)
GetValues gets a value at a given index. For MACD it is the signal value.
func (MACDSignalSeries) GetYAxis ¶
func (macds MACDSignalSeries) GetYAxis() YAxisType
GetYAxis returns which YAxis the series draws on.
func (*MACDSignalSeries) Len ¶
func (macds *MACDSignalSeries) Len() int
Len returns the number of elements in the series.
func (*MACDSignalSeries) Render ¶
func (macds *MACDSignalSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
Render renders the series.
func (MACDSignalSeries) Validate ¶
func (macds MACDSignalSeries) Validate() error
Validate validates the series.
type MaxSeries ¶
type MaxSeries struct {
Name string
Style Style
YAxis YAxisType
InnerSeries ValuesProvider
// contains filtered or unexported fields
}
MaxSeries draws a horizontal line at the maximum value of the inner series.
type MinSeries ¶
type MinSeries struct {
Name string
Style Style
YAxis YAxisType
InnerSeries ValuesProvider
// contains filtered or unexported fields
}
MinSeries draws a horizontal line at the minimum value of the inner series.
type NameProvider ¶
type NameProvider interface {
GetName() string
}
NameProvider is a type that returns a name.
type PdfRenderer ¶ added in v0.0.73
type PdfRenderer struct {
// contains filtered or unexported fields
}
PdfRenderer implementa la interfaz Renderer para dibujar directamente en un PDF usando el motor PdfEngine en lugar de generar imágenes rasterizadas.
func NewPdfRenderer ¶ added in v0.0.73
func NewPdfRenderer(engine *pdfengine.PdfEngine) *PdfRenderer
NewPdfRenderer crea un nuevo renderizador PDF usando el motor PdfEngine existente
func (*PdfRenderer) ArcTo ¶ added in v0.0.73
func (r *PdfRenderer) ArcTo(cx, cy int, rx, ry, startAngle, delta float64)
ArcTo dibuja un arco con un centro dado (cx,cy) un conjunto de radios dado (rx,ry), un ángulo inicial y delta (en radianes)
func (*PdfRenderer) Circle ¶ added in v0.0.73
func (r *PdfRenderer) Circle(radius float64, x, y int)
Circle dibuja un círculo en las coordenadas dadas con un radio dado
func (*PdfRenderer) ClearTextRotation ¶ added in v0.0.73
func (r *PdfRenderer) ClearTextRotation()
ClearTextRotation limpia la rotación
func (*PdfRenderer) Close ¶ added in v0.0.73
func (r *PdfRenderer) Close()
Close finaliza una forma dibujada por LineTo
func (*PdfRenderer) Fill ¶ added in v0.0.73
func (r *PdfRenderer) Fill()
Fill rellena el camino, pero no lo traza
func (*PdfRenderer) FillStroke ¶ added in v0.0.73
func (r *PdfRenderer) FillStroke()
FillStroke rellena y traza un camino
func (*PdfRenderer) GetDPI ¶ added in v0.0.73
func (r *PdfRenderer) GetDPI() float64
GetDPI obtiene el DPI del renderizador
func (*PdfRenderer) LineTo ¶ added in v0.0.73
func (r *PdfRenderer) LineTo(x, y int)
LineTo comienza una forma y dibuja una línea hasta un punto dado desde el punto anterior
func (*PdfRenderer) MeasureText ¶ added in v0.0.73
func (r *PdfRenderer) MeasureText(body string) canvas.Box
MeasureText mide el texto
func (*PdfRenderer) MoveTo ¶ added in v0.0.73
func (r *PdfRenderer) MoveTo(x, y int)
MoveTo mueve el cursor a un punto dado
func (*PdfRenderer) QuadCurveTo ¶ added in v0.0.73
func (r *PdfRenderer) QuadCurveTo(cx, cy, x, y int)
QuadCurveTo dibuja una curva cuadrática cx y cy representan los "puntos de control" de Bezier
func (*PdfRenderer) ResetStyle ¶ added in v0.0.73
func (r *PdfRenderer) ResetStyle()
ResetStyle restablece los estilos del renderizador a sus valores predeterminados
func (*PdfRenderer) Save ¶ added in v0.0.73
func (r *PdfRenderer) Save(w io.Writer) error
Save escribe la imagen en el escritor dado En el caso de PdfRenderer, este método no hace nada directamente ya que el renderizado se hace directamente en el PDF proporcionado en la creación
func (*PdfRenderer) SetClassName ¶ added in v0.0.73
func (r *PdfRenderer) SetClassName(className string)
SetClassName establece el nombre de clase actual
func (*PdfRenderer) SetDPI ¶ added in v0.0.73
func (r *PdfRenderer) SetDPI(dpi float64)
SetDPI establece el DPI para el renderizador
func (*PdfRenderer) SetFillColor ¶ added in v0.0.73
func (r *PdfRenderer) SetFillColor(color config.Color)
SetFillColor establece el color de relleno actual
func (*PdfRenderer) SetFont ¶ added in v0.0.73
func (r *PdfRenderer) SetFont(font config.FontFamily)
SetFont establece una fuente para un campo de texto
func (*PdfRenderer) SetFontColor ¶ added in v0.0.73
func (r *PdfRenderer) SetFontColor(color config.Color)
SetFontColor establece el color de una fuente
func (*PdfRenderer) SetFontSize ¶ added in v0.0.73
func (r *PdfRenderer) SetFontSize(size float64)
SetFontSize establece el tamaño de fuente para un campo de texto
func (*PdfRenderer) SetStrokeColor ¶ added in v0.0.73
func (r *PdfRenderer) SetStrokeColor(color config.Color)
SetStrokeColor establece el color de trazo actual
func (*PdfRenderer) SetStrokeDashArray ¶ added in v0.0.73
func (r *PdfRenderer) SetStrokeDashArray(dashArray []float64)
SetStrokeDashArray establece el array de guiones del trazo
func (*PdfRenderer) SetStrokeWidth ¶ added in v0.0.73
func (r *PdfRenderer) SetStrokeWidth(width float64)
SetStrokeWidth establece el ancho del trazo
func (*PdfRenderer) SetTextRotation ¶ added in v0.0.73
func (r *PdfRenderer) SetTextRotation(radians float64)
SetTextRotation establece una rotación para dibujar elementos
func (*PdfRenderer) Text ¶ added in v0.0.73
func (r *PdfRenderer) Text(body string, x, y int)
Text dibuja un blob de texto
type PercentChangeSeries ¶
type PercentChangeSeries struct {
Name string
Style Style
YAxis YAxisType
InnerSeries PercentChangeSeriesSource
}
PercentChangeSeries applies a percentage difference function to a given continuous series.
func (PercentChangeSeries) GetFirstValues ¶
func (pcs PercentChangeSeries) GetFirstValues() (x, y float64)
GetFirstValues implements FirstValuesProvider.
func (PercentChangeSeries) GetLastValues ¶
func (pcs PercentChangeSeries) GetLastValues() (x, y float64)
GetLastValues gets the last values.
func (PercentChangeSeries) GetName ¶
func (pcs PercentChangeSeries) GetName() string
GetName returns the name of the time series.
func (PercentChangeSeries) GetStyle ¶
func (pcs PercentChangeSeries) GetStyle() Style
GetStyle returns the line style.
func (PercentChangeSeries) GetValueFormatters ¶
func (pcs PercentChangeSeries) GetValueFormatters() (x, y ValueFormatter)
GetValueFormatters returns value formatter defaults for the series.
func (PercentChangeSeries) GetValues ¶
func (pcs PercentChangeSeries) GetValues(index int) (x, y float64)
GetValues gets x, y values at a given index.
func (PercentChangeSeries) GetYAxis ¶
func (pcs PercentChangeSeries) GetYAxis() YAxisType
GetYAxis returns which YAxis the series draws on.
func (PercentChangeSeries) Len ¶
func (pcs PercentChangeSeries) Len() int
Len implements part of Series.
func (PercentChangeSeries) Render ¶
func (pcs PercentChangeSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
Render renders the series.
func (PercentChangeSeries) Validate ¶
func (pcs PercentChangeSeries) Validate() error
Validate validates the series.
type PercentChangeSeriesSource ¶
type PercentChangeSeriesSource interface {
Series
FirstValuesProvider
LastValuesProvider
ValuesProvider
ValueFormatterProvider
}
PercentChangeSeriesSource is a series that can be used with a PercentChangeSeries
type PieChart ¶
type PieChart struct {
Title string
TitleStyle Style
ColorPalette ColorPalette
Width int
Height int
DPI float64
Background Style
Canvas Style
SliceStyle Style
Font *truetype.Font
Values []Value
Elements []Renderable
}
PieChart is a chart that draws sections of a circle based on percentages.
func (PieChart) GetColorPalette ¶
func (pc PieChart) GetColorPalette() ColorPalette
GetColorPalette returns the color palette for the chart.
type Point ¶
type Point struct {
X, Y float64
}
Point representa un punto en un camino (path) para el renderizado
type PolynomialRegressionSeries ¶
type PolynomialRegressionSeries struct {
Name string
Style Style
YAxis YAxisType
Limit int
Offset int
Degree int
InnerSeries ValuesProvider
// contains filtered or unexported fields
}
PolynomialRegressionSeries implements a polynomial regression over a given inner series.
func (PolynomialRegressionSeries) GetEndIndex ¶
func (prs PolynomialRegressionSeries) GetEndIndex() int
GetEndIndex returns the effective limit end.
func (*PolynomialRegressionSeries) GetFirstValues ¶
func (prs *PolynomialRegressionSeries) GetFirstValues() (x, y float64)
GetFirstValues computes the first poly regression value.
func (*PolynomialRegressionSeries) GetLastValues ¶
func (prs *PolynomialRegressionSeries) GetLastValues() (x, y float64)
GetLastValues computes the last poly regression value.
func (PolynomialRegressionSeries) GetLimit ¶
func (prs PolynomialRegressionSeries) GetLimit() int
GetLimit returns the window size.
func (PolynomialRegressionSeries) GetName ¶
func (prs PolynomialRegressionSeries) GetName() string
GetName returns the name of the time series.
func (PolynomialRegressionSeries) GetOffset ¶
func (prs PolynomialRegressionSeries) GetOffset() int
GetOffset returns the data offset.
func (PolynomialRegressionSeries) GetStyle ¶
func (prs PolynomialRegressionSeries) GetStyle() Style
GetStyle returns the line style.
func (*PolynomialRegressionSeries) GetValues ¶
func (prs *PolynomialRegressionSeries) GetValues(index int) (x, y float64)
GetValues returns the series value for a given index.
func (PolynomialRegressionSeries) GetYAxis ¶
func (prs PolynomialRegressionSeries) GetYAxis() YAxisType
GetYAxis returns which YAxis the series draws on.
func (PolynomialRegressionSeries) Len ¶
func (prs PolynomialRegressionSeries) Len() int
Len returns the number of elements in the series.
func (*PolynomialRegressionSeries) Render ¶
func (prs *PolynomialRegressionSeries) Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, defaults Style)
Render renders the series.
func (*PolynomialRegressionSeries) Validate ¶
func (prs *PolynomialRegressionSeries) Validate() error
Validate validates the series.
type RGBACollector ¶
RGBACollector is a render target for a chart.
type RandomSeq ¶
type RandomSeq struct {
// contains filtered or unexported fields
}
RandomSeq is a random number seq generator.
func NewRandomSequence ¶
func NewRandomSequence() *RandomSeq
NewRandomSequence creates a new random seq.
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(config.Color)
// SetFillColor sets the current fill color.
SetFillColor(config.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.
// Old signature: SetFont(*truetype.Font)
SetFont(config.FontFamily)
// SetFontColor sets a font's color
SetFontColor(config.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) canvas.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.
func NewPdfRendererProvider ¶ added in v0.0.73
func NewPdfRendererProvider(engine *pdfengine.PdfEngine) RendererProvider
NewPdfRendererProvider crea un proveedor de renderizado PDF
type SMASeries ¶
type SMASeries struct {
Name string
Style Style
YAxis YAxisType
Period int
InnerSeries ValuesProvider
}
SMASeries is a computed series.
func (SMASeries) GetFirstValues ¶
GetFirstValues computes the first moving average value.
func (SMASeries) GetLastValues ¶
GetLastValues computes the last moving average value but walking back window size samples, and recomputing the last moving average chunk.
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 Series ¶
type Series interface {
GetName() string
GetYAxis() YAxisType
GetStyle() Style
Validate() error
Render(r Renderer, canvasBox canvas.Box, xrange, yrange Range, s Style)
}
Series is an alias to Renderable.
type SizeProvider ¶
SizeProvider is a provider for integer size.
type StackedBar ¶
StackedBar is a bar within a StackedBarChart.
func (StackedBar) GetWidth ¶
func (sb StackedBar) GetWidth() int
GetWidth returns the width of the bar.
type StackedBarChart ¶
type StackedBarChart struct {
Title string
TitleStyle Style
ColorPalette ColorPalette
Width int
Height int
DPI float64
Background Style
Canvas Style
XAxis Style
YAxis Style
BarSpacing int
Font *truetype.Font
IsHorizontal bool
Bars []StackedBar
Elements []Renderable
}
StackedBarChart is a chart that draws sections of a bar based on percentages.
func (StackedBarChart) Box ¶
func (sbc StackedBarChart) Box() canvas.Box
canvas.Box returns the chart bounds as a box.
func (StackedBarChart) GetBarSpacing ¶
func (sbc StackedBarChart) GetBarSpacing() int
GetBarSpacing returns the spacing between bars.
func (StackedBarChart) GetColorPalette ¶
func (sbc StackedBarChart) GetColorPalette() ColorPalette
GetColorPalette returns the color palette for the chart.
func (StackedBarChart) GetDPI ¶
func (sbc StackedBarChart) GetDPI(defaults ...float64) float64
GetDPI returns the dpi for the chart.
func (StackedBarChart) GetFont ¶
func (sbc StackedBarChart) GetFont() *truetype.Font
GetFont returns the text font.
func (StackedBarChart) GetHeight ¶
func (sbc StackedBarChart) GetHeight() int
GetHeight returns the chart height or the default value.
func (StackedBarChart) GetWidth ¶
func (sbc StackedBarChart) GetWidth() int
GetWidth returns the chart width or the default value.
func (StackedBarChart) Render ¶
func (sbc StackedBarChart) Render(rp RendererProvider, w io.Writer) error
Render renders the chart with the given renderer to the given io.Writer.
type StdoutLogger ¶
StdoutLogger is a basic logger.
func (*StdoutLogger) Debug ¶
func (l *StdoutLogger) Debug(arguments ...any)
Debug writes an debug message.
func (*StdoutLogger) Debugf ¶
func (l *StdoutLogger) Debugf(format string, arguments ...any)
Debugf writes an debug message.
func (*StdoutLogger) Error ¶
func (l *StdoutLogger) Error(arguments ...any)
Error writes an error message.
func (*StdoutLogger) Errorf ¶
func (l *StdoutLogger) Errorf(format string, arguments ...any)
Errorf writes an error message.
func (*StdoutLogger) Errorln ¶
func (l *StdoutLogger) Errorln(arguments ...any)
Errorln prints a new message.
func (*StdoutLogger) FatalErr ¶
func (l *StdoutLogger) FatalErr(err error)
FatalErr writes an error message and exits.
func (*StdoutLogger) Info ¶
func (l *StdoutLogger) Info(arguments ...any)
Info writes an info message.
func (*StdoutLogger) Infof ¶
func (l *StdoutLogger) Infof(format string, arguments ...any)
Infof writes an info message.
func (*StdoutLogger) Println ¶
func (l *StdoutLogger) Println(arguments ...any)
Println prints a new message.
type Stringable ¶
type Stringable interface {
String() string
}
Stringable is a type that has a string representation.
type Style ¶
type Style struct {
Hidden bool
Padding canvas.Box
ClassName string
StrokeWidth float64
StrokeColor config.Color
StrokeDashArray []float64
DotColor config.Color
DotWidth float64
DotWidthProvider SizeProvider
DotColorProvider DotColorProvider
FillColor config.Color
FontSize float64
FontColor config.Color
Font *truetype.Font
FontProvider config.FontFamily
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) GetFontProvider ¶ added in v0.0.70
func (s Style) GetFontProvider(defaults ...config.FontFamily) config.FontFamily
GetFontProvider returns the font provider.
func (Style) GetFontSize ¶
GetFontSize gets the font size.
func (Style) GetPadding ¶
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 config.
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 config.
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 config. 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 Tick ¶
Tick represents a label on an axis.
func GenerateContinuousTicks ¶
func GenerateContinuousTicks(r Renderer, ra Range, isVertical bool, style Style, vf ValueFormatter) []Tick
GenerateContinuousTicks generates a set of ticks.
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 ¶
type TicksProvider interface {
GetTicks(r Renderer, defaults Style, vf ValueFormatter) []Tick
}
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 TimeSeries ¶
type TimeSeries struct {
Name string
Style Style
YAxis YAxisType
XValues []time.Time
YValues []float64
}
TimeSeries is a line on a chart.
func (TimeSeries) GetFirstValues ¶
func (ts TimeSeries) GetFirstValues() (x, y float64)
GetFirstValues gets the first values.
func (TimeSeries) GetLastValues ¶
func (ts TimeSeries) GetLastValues() (x, y float64)
GetLastValues gets the last values.
func (TimeSeries) GetName ¶
func (ts TimeSeries) GetName() string
GetName returns the name of the time series.
func (TimeSeries) GetValueFormatters ¶
func (ts TimeSeries) GetValueFormatters() (x, y ValueFormatter)
GetValueFormatters returns value formatter defaults for the series.
func (TimeSeries) GetValues ¶
func (ts TimeSeries) GetValues(index int) (x, y float64)
GetValues gets x, y values at a given index.
func (TimeSeries) GetYAxis ¶
func (ts TimeSeries) GetYAxis() YAxisType
GetYAxis returns which YAxis the series draws on.
func (TimeSeries) Len ¶
func (ts TimeSeries) Len() int
Len returns the number of elements in the series.
type Times ¶
Times are an array of times. It wraps the array with methods that implement `seq.Provider`.
type TrueTypeFontAdapter ¶ added in v0.0.70
type TrueTypeFontAdapter struct {
Font *truetype.Font
FontName string
FontFamily string
FontWeight string
FontStyle string
FontPath string
}
TrueTypeFontAdapter adapta un *truetype.Font a la interfaz config.FontFamily Esto se usará durante la transición mientras se refactoriza el código que usa freetype
func (*TrueTypeFontAdapter) Family ¶ added in v0.0.70
func (a *TrueTypeFontAdapter) Family() string
func (*TrueTypeFontAdapter) Name ¶ added in v0.0.70
func (a *TrueTypeFontAdapter) Name() string
Implementación de la interfaz config.FontFamily
func (*TrueTypeFontAdapter) Path ¶ added in v0.0.70
func (a *TrueTypeFontAdapter) Path() string
func (*TrueTypeFontAdapter) SVGFontID ¶ added in v0.0.70
func (a *TrueTypeFontAdapter) SVGFontID() string
func (*TrueTypeFontAdapter) Style ¶ added in v0.0.70
func (a *TrueTypeFontAdapter) Style() string
func (*TrueTypeFontAdapter) Weight ¶ added in v0.0.70
func (a *TrueTypeFontAdapter) Weight() string
type ValueBuffer ¶
type ValueBuffer struct {
// contains filtered or unexported fields
}
ValueBuffer is a fifo datastructure that is backed by a pre-allocated array. Instead of allocating a whole new node object for each element, array elements are re-used (which saves GC churn). Enqueue can be O(n), Dequeue is generally O(1). Buffer implements `seq.Provider`
func NewValueBuffer ¶
func NewValueBuffer(values ...float64) *ValueBuffer
NewValueBuffer creates a new value buffer with an optional set of values.
func NewValueBufferWithCapacity ¶
func NewValueBufferWithCapacity(capacity int) *ValueBuffer
NewValueBufferWithCapacity creates a new ValueBuffer pre-allocated with the given capacity.
func (*ValueBuffer) Array ¶
func (b *ValueBuffer) Array() Array
Array returns the ring buffer, in order, as an array.
func (*ValueBuffer) Capacity ¶
func (b *ValueBuffer) Capacity() int
Capacity returns the total size of the Buffer, including empty elements.
func (*ValueBuffer) Clear ¶
func (b *ValueBuffer) Clear()
Clear removes all objects from the Buffer.
func (*ValueBuffer) Dequeue ¶
func (b *ValueBuffer) Dequeue() float64
Dequeue removes the first element from the RingBuffer.
func (*ValueBuffer) Each ¶
func (b *ValueBuffer) Each(mapfn func(int, float64))
Each calls the consumer for each element in the buffer.
func (*ValueBuffer) Enqueue ¶
func (b *ValueBuffer) Enqueue(value float64)
Enqueue adds an element to the "back" of the Buffer.
func (*ValueBuffer) GetValue ¶
func (b *ValueBuffer) GetValue(index int) float64
GetValue implements seq provider.
func (*ValueBuffer) Len ¶
func (b *ValueBuffer) Len() int
Len returns the length of the Buffer (as it is currently populated). Actual memory footprint may be different.
func (*ValueBuffer) Peek ¶
func (b *ValueBuffer) Peek() float64
Peek returns but does not remove the first element.
func (*ValueBuffer) PeekBack ¶
func (b *ValueBuffer) PeekBack() float64
PeekBack returns but does not remove the last element.
func (*ValueBuffer) SetCapacity ¶
func (b *ValueBuffer) SetCapacity(capacity int)
SetCapacity sets the capacity of the Buffer.
func (*ValueBuffer) String ¶
func (b *ValueBuffer) String() string
String returns a string representation for value buffers.
func (*ValueBuffer) TrimExcess ¶
func (b *ValueBuffer) TrimExcess()
TrimExcess resizes the capacity of the buffer to better fit the contents.
type ValueFormatter ¶
ValueFormatter is a function that takes a value and produces a string.
func KValueFormatter ¶
func KValueFormatter(k float64, vf ValueFormatter) ValueFormatter
KValueFormatter is a formatter for K values.
func TimeValueFormatterWithFormat ¶
func TimeValueFormatterWithFormat(format string) ValueFormatter
TimeValueFormatterWithFormat returns a time formatter with a given format.
type ValueFormatterProvider ¶
type ValueFormatterProvider interface {
GetValueFormatters() (x, y ValueFormatter)
}
ValueFormatterProvider is a series that has custom formatters.
type Values ¶
type Values []Value
Values is an array of Value.
func (Values) ValuesNormalized ¶
ValuesNormalized returns normalized values.
type ValuesProvider ¶
ValuesProvider is a type that produces values.
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.
Source Files
¶
- annotation_series.go
- array.go
- axis.go
- bar_chart.go
- bollinger_band_series.go
- bounded_last_values_annotation_series.go
- chart.go
- chartengine.go
- colors.go
- concat_series.go
- continuous_range.go
- continuous_series.go
- defaults.go
- donut_chart.go
- draw.go
- ema_series.go
- fileutil.go
- first_value_annotation.go
- font.go
- font_provider.go
- grid_line.go
- histogram_series.go
- image_writer.go
- jet.go
- last_value_annotation_series.go
- legend.go
- linear_coefficient_provider.go
- linear_regression_series.go
- linear_sequence.go
- linear_series.go
- logarithmic_range.go
- logger.go
- macd_series.go
- min_max_series.go
- parse.go
- pdf_renderer.go
- percent_change_series.go
- pie_chart.go
- polynomial_regression_series.go
- random_sequence.go
- range.go
- raster_renderer.go
- renderable.go
- renderer.go
- seq.go
- series.go
- sma_series.go
- stacked_bar_chart.go
- stringutil.go
- style.go
- text.go
- tick.go
- time_series.go
- times.go
- timeutil.go
- value.go
- value_buffer.go
- value_formatter.go
- value_formatter_provider.go
- value_provider.go
- vector_renderer.go
- viridis.go
- xaxis.go
- yaxis.go
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
chart
command
|
|
|
examples
|
|
|
annotations
command
|
|
|
axes
command
|
|
|
axes_labels
command
|
|
|
bar_chart
command
|
|
|
bar_chart_base_value
command
|
|
|
basic
command
|
|
|
benchmark_line_charts
command
|
|
|
css_classes
command
|
|
|
custom_formatters
command
|
|
|
custom_padding
command
|
|
|
custom_ranges
command
|
|
|
custom_styles
command
|
|
|
custom_stylesheets
command
|
|
|
custom_ticks
command
|
|
|
descending
command
|
|
|
donut_chart
command
|
|
|
horizontal_stacked_bar
command
|
|
|
image_writer
command
|
|
|
legend
command
|
|
|
legend_left
command
|
|
|
linear_regression
command
|
|
|
logarithmic_axes
command
|
|
|
min_max
command
|
|
|
pie_chart
command
|
|
|
poly_regression
command
|
|
|
request_timings
command
|
|
|
rerender
command
|
|
|
scatter
command
|
|
|
simple_moving_average
command
|
|
|
stacked_bar
command
|
|
|
stacked_bar_labels
command
|
|
|
stock_analysis
command
|
|
|
text_rotation
command
|
|
|
timeseries
command
|
|
|
twoaxis
command
|
|
|
twopoint
command
|
|