Categorygithub.com/dolfly/go-chart/v2
modulepackage
2.2.0
Repository: https://github.com/dolfly/go-chart.git
Documentation: pkg.go.dev

# README

go-chart

This project is archived!

I originally released this as a way to publish stock charts in slack bots. It was kind of fun at the time! I never anticipated that it would become heavily used, and as often happens with open source, I have a ton of time commitments elsewhere, and can't reasonbly devote enough time to this project to match the usage.

There have been a number of forks over time, I'd encourage you all to seek those out, or new charting libraries.

Best,

  • Will

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

AbsInt returns the absolute value of an int.
BoundedLastValuesAnnotationSeries returns a last value annotation series for a bounded values provider.
CirclePoint returns the absolute position of a circle diameter point given by the radius and the theta.
Days generates a seq of timestamps by day, from -days to today.
Debug logs an debug message if the logger is set.
Debugf logs an debug message if the logger is set.
DegreesAdd adds a delta to a base in radians.
DegreesToCompass returns the degree value in compass / clock orientation.
DegreesToRadians returns degrees as radians.
DiffHours returns the difference in hours between two times.
FloatValueFormatter is a ValueFormatter for float64, exponential notation, e.g.
FirstValueAnnotation returns an annotation series of just the first value of a value provider as an annotation.
FloatValueFormatter is a ValueFormatter for float64.
FloatValueFormatterWithFormat is a ValueFormatter for float64 with a given format.
GenerateContinuousTicks generates a set of ticks.
GenerateGridLines generates grid lines.
GetAlternateColor returns a color from the default list by index.
GetDefaultColor returns a color from the default list by index.
GetDefaultFont returns the default font (Roboto-Medium).
GetRoundToForDelta returns a `roundTo` value for a given delta.
Hidden is a prebuilt style with the `Hidden` property set to true.
HideXAxis hides the x-axis.
HideYAxis hides a y-axis.
Hours returns a sequence of times by the hour for a given number of hours after a given start.
HoursFilled adds zero values for the data bounded by the start and end of the xdata array.
Info logs an info message if the logger is set.
Infof logs an info message if the logger is set.
IntValueFormatter is a ValueFormatter for float64.
Jet is a color map provider based on matlab's jet color map.
KValueFormatter is a formatter for K values.
LastValueAnnotationSeries returns an annotation series of just the last value of a value provider.
Legend returns a legend renderable function.
LegendLeft is a legend that is designed for longer series lists.
LegendThin is a legend that doesn't obscure the chart area.
LinearCoefficients returns a fixed linear coefficient pair.
LinearRange returns an array of values representing the range from start to end, incremented by 1.0.
LinearRangeWithStep returns the array values of a linear seq with a given start, end and optional step.
MaxInt returns the maximum int.
Mean returns the mean of a set of values.
MeanInt returns the mean of a set of integer values.
MinInt returns the minimum int.
MinMax returns the minimum and maximum of a given set of values.
NewArray returns a new array from a given set of values.
NewBox returns a new (set) box.
NewLinearSequence returns a new linear generator.
NewLogger returns a new logger.
NewRandomSequence creates a new random seq.
NewValueBuffer creates a new value buffer with an optional set of values.
NewValueBufferWithCapacity creates a new ValueBuffer pre-allocated with the given capacity.
Normalize returns a set of numbers on the interval [0,1] for a given set of inputs.
NormalizedLinearCoefficients returns a fixed linear coefficient pair.
OptLoggerStderr sets the Stdout writer.
OptLoggerStdout sets the Stdout writer.
ParseFloats parses a list of floats.
ParseTimes parses a list of times with a given format.
PercentDifference computes the percentage difference between two values.
PercentToRadians converts a normalized value (0,1) to radians.
PercentValueFormatter is a formatter for percent values.
PNG returns a new png/raster renderer.
RadianAdd adds a delta to a base in radians.
RadiansToDegrees translates a radian value to a degree value.
RandomValues returns an array of random values.
RandomValuesWithMax returns an array of random values with a given average.
ReadChunks reads a file in `chunkSize` pieces, dispatched to the handler.
ReadLines reads a file and calls the handler for each line.
RotateCoordinate rotates a coordinate around a given center by a theta in radians.
RoundDown rounds down to a given roundTo value.
RoundPlaces rounds an input to a given places.
RoundUp rounds up to a given roundTo value.
Shown is a prebuilt style with the `Hidden` property set to false.
SplitCSV splits a corpus by the `,`, dropping leading or trailing whitespace unless quoted.
StyleTextDefaults returns a style for drawing outside a chart context.
Sum sums a set of values.
SumInt sums a set of values.
SVG returns a new png/raster renderer.
SVGWithCSS returns a new png/raster renderer with attached custom CSS The optional nonce argument sets a CSP nonce.
TimeDateValueFormatter is a ValueFormatter for timestamps.
TimeFromFloat64 returns a time from a float64.
TimeHourValueFormatter is a ValueFormatter for timestamps.
TimeMax returns the minimum and maximum times in a given range.
TimeMillis returns a duration as a float millis.
TimeMin returns the minimum and maximum times in a given range.
TimeMinMax returns the minimum and maximum times in a given range.
TimeMinuteValueFormatter is a ValueFormatter for timestamps.
TimeToFloat64 returns a float64 representation of a time.
TimeValueFormatter is a ValueFormatter for timestamps.
TimeValueFormatterWithFormat returns a time formatter with a given format.
ToFloat64 returns a float64 representation of a time.
ValueSequence returns a sequence for a given values set.
Viridis creates a color map provider.

# Constants

ContentTypePNG is the png mime type.
ContentTypeSVG is the svg mime type.
DefaultAnnotationDeltaWidth is the width of the left triangle out of annotations.
DefaultAnnotationFontSize is the font size of annotations.
DefaultAxisFontSize is the font size of the axis labels.
DefaultAxisLineWidth is the line width of the axis lines.
DefaultBackgroundStrokeWidth is the default stroke on the chart background.
DefaultBarSpacing is the default pixel spacing between bars.
DefaultBarWidth is the default pixel width of bars in a bar chart.
DefaultCanvasStrokeWidth is the default stroke on the chart canvas.
DefaultChartHeight is the default chart height.
DefaultChartWidth is the default chart width.
DefaultDateFormat is the default date format.
DefaultDateHourFormat is the date format for hour timestamp formats.
DefaultDateMinuteFormat is the date format for minute range timestamp formats.
DefaultDotWidth is the default chart dot width.
DefaultDPI is the default dots per inch for the chart.
DefaultEMAPeriod is the default EMA period used in the sigma calculation.
DefaultFloatFormat is the default float format.
DefaultFontSize is the default font size.
DefaultHorizontalTickWidth is half the margin.
DefaultLineSpacing is the default vertical distance between lines of text.
DefaultMACDPeriodPrimary is the long window.
DefaultMACDPeriodSecondary is the short window.
DefaultMACDSignalPeriod is the signal period to compute for the MACD.
DefaultMinimumFontSize is the default minimum font size.
DefaultMinimumTickHorizontalSpacing is the minimum distance between horizontal ticks.
DefaultMinimumTickVerticalSpacing is the minimum distance between vertical ticks.
DefaultPercentValueFormat is the default percent format.
DefaultSeriesLineWidth is the default line width.
DefaultSimpleMovingAveragePeriod is the default number of values to average.
DefaultStrokeWidth is the default chart stroke width.
DefaultTickCount is the default number of ticks to show.
1024.
DefaultTitleFontSize is the default title font size.
DefaultTitleTop is the default distance from the top of the chart to put the title.
DefaultVerticalTickHeight is half the margin.
DefaultXAxisMargin is the default distance from bottom of the canvas to the x axis labels.
DefaultYAxisMargin is the default distance from the right of the canvas to the y axis labels.
Disabled indicates if the value should be interpreted as set intentionally to zero.
SecondsPerXYZ.
SecondsPerXYZ.
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.
TextHorizontalAlignLeft aligns a string horizontally so that it's left ligature starts at horizontal pixel 0.
TextHorizontalAlignRight right aligns a string horizontally so that the right ligature ends at the right-most pixel of a box.
TextHorizontalAlignUnset is the unset state for text horizontal alignment.
TextVerticalAlignBaseline aligns text according to the "baseline" of the string, or where a normal ascender begins.
TextVerticalAlignBottom aligns the text according to the lowers pixel of any of the ligatures (ex.
TextVerticalAlignMiddle aligns the text so that there is an equal amount of space above and below the top and bottom of the ligatures.
TextVerticalAlignMiddleBaseline aligns the text vertically so that there is an equal number of pixels above and below the baseline of the string.
TextVerticalAlignTop alignts the text so that the top of the ligatures are at y-pixel 0 in the container.
TextVerticalAlignUnset is the unset state for vertical alignment options.
TextWrapNone will spill text past horizontal boundaries.
TextWrapRune will split a string on a rune (i.e.
TextWrapUnset is the unset state for text wrap options.
TextWrapWord will split a string on words (i.e.
TickPositionBetweenTicks draws the labels for a tick between the previous and current tick.
TickPositionUnderTick draws the tick below the tick.
TickPositionUnset means to use the default tick position.
YAxisPrimary is the primary axis.
YAxisSecondary is the secondary axis.

# Variables

AlternateColorPalette represents the default palatte.
BoxZero is a preset box that represents an intentional zero value.
ColorAlternateBlue is a alternate theme color.
ColorAlternateGray is a alternate theme color.
ColorAlternateGreen is a alternate theme color.
ColorAlternateLightGray is a alternate theme color.
ColorAlternateYellow is a alternate theme color.
ColorBlack is the basic theme black color.
ColorBlue is the basic theme blue color.
ColorCyan is the basic theme cyan color.
ColorGreen is the basic theme green color.
ColorLightGray is the basic theme light gray color.
ColorOrange is the basic theme orange color.
ColorRed is the basic theme red color.
ColorTransparent is a transparent (alpha zero) color.
ColorWhite is white.
ColorYellow is the basic theme yellow color.
DashArrayDashesLarge is a dash array that represents '----- ----- -----' style stroke dashes.
DashArrayDashesMedium is a dash array that represents '-- -- --' style stroke dashes.
DashArrayDashesSmall is a dash array that represents '- - -' style stroke dashes.
DashArrayDots is a dash array that represents '....' style stroke dashes.
DefaultAlternateColors are a couple alternate colors.
DefaultAnnotationFillColor is the default annotation background color.
DefaultAnnotationPadding is the padding around an annotation.
DefaultAxisColor is the default chart axis line color.
DefaultBackgroundColor is the default chart background color.
DefaultBackgroundPadding is the default canvas padding config.
DefaultBackgroundStrokeColor is the default chart border color.
DefaultCanvasColor is the default chart canvas color.
DefaultCanvasStrokeColor is the default chart canvas stroke color.
DefaultColorPalette represents the default palatte.
DefaultColors are a couple default series colors.
DefaultFillColor is the default fill color.
DefaultGridLineColor is the default grid line color.
DefaultStrokeColor is the default chart border color.
DefaultTextColor is the default chart text color.
Draw contains helpers for drawing common objects.
Text contains utilities for text.

# Structs

AnnotationSeries is a series of labels on the chart.
BarChart is a chart that draws bars on a range.
BollingerBandsSeries draws bollinger bands for an inner series.
Box represents the main 4 dimensions of a box.
BoxCorners is a box with independent corners.
Chart is what we're drawing.
ContinuousRange represents a boundary for a set of numbers.
ContinuousSeries represents a line on a chart.
DonutChart is a chart that draws sections of a circle based on percentages with an hole.
EMASeries is a computed series.
GridLine is a line on a graph canvas.
HistogramSeries is a special type of series that draws as a histogram.
ImageWriter is a special type of io.Writer that produces a final image.
LinearCoefficientSet is the m and b values for the linear equation in the form: y = (m*x) + b.
LinearRegressionSeries is a series that plots the n-nearest neighbors linear regression for the values.
LinearSeq is a stepwise generator.
LinearSeries is a series that plots a line in a given domain.
LogarithmicRange represents a boundary for a set of numbers.
MACDLineSeries is a series that computes the inner ema1-ema2 value as a series.
MACDSeries computes the difference between the MACD line and the MACD Signal line.
MACDSignalSeries computes the EMA of the MACDLineSeries.
MaxSeries draws a horizontal line at the maximum value of the inner series.
MinSeries draws a horizontal line at the minimum value of the inner series.
PercentChangeSeries applies a percentage difference function to a given continuous series.
PieChart is a chart that draws sections of a circle based on percentages.
Point is an X,Y pair.
PolynomialRegressionSeries implements a polynomial regression over a given inner series.
RandomSeq is a random number seq generator.
Seq is a utility wrapper for seq providers.
SMASeries is a computed series.
StackedBar is a bar within a StackedBarChart.
StackedBarChart is a chart that draws sections of a bar based on percentages.
StdoutLogger is a basic logger.
Style is a simple style set.
TextStyle encapsulates text style options.
Tick represents a label on an axis.
TimeSeries is a line on a chart.
Value is a chart value.
Value2 is a two axis value.
ValueBuffer is a fifo datastructure that is backed by a pre-allocated array.
XAxis represents the horizontal axis.
YAxis is a veritcal rule of the range.

# Interfaces

Axis is a chart feature detailing what values happen where.
BoundedLastValuesProvider is a special type of value provider that can return it's (potentially computed) bounded last value.
BoundedValuesProvider allows series to return a range.
ColorPalette is a set of colors that.
FirstValuesProvider is a special type of value provider that can return it's (potentially computed) first value.
FullBoundedValuesProvider is an interface that combines `BoundedValuesProvider` and `BoundedLastValuesProvider`.
FullValuesProvider is an interface that combines `ValuesProvider` and `LastValuesProvider`.
GridLineProvider is a type that provides grid lines.
IsZeroable is a type that returns if it's been set or not.
LastValuesProvider is a special type of value provider that can return it's (potentially computed) last value.
LinearCoefficientProvider is a type that returns linear cofficients.
Logger is a type that implements the logging interface.
NameProvider is a type that returns a name.
PercentChangeSeriesSource is a series that can be used with a PercentChangeSeries.
Range is a common interface for a range of values.
Renderer represents the basic methods required to draw a chart.
RGBACollector is a render target for a chart.
Sequence is a provider for values for a seq.
Series is an alias to Renderable.
Stringable is a type that has a string representation.
StyleProvider is a type that returns a style.
TicksProvider is a type that provides ticks.
ValueFormatterProvider is a series that has custom formatters.
ValuesProvider is a type that produces values.

# Type aliases

Array is a wrapper for an array of floats that implements `ValuesProvider`.
ColorProvider is a general provider for color ranges based on values.
ConcatSeries is a special type of series that concatenates its `InnerSeries`.
DotColorProvider is a provider for dot color.
LoggerOption mutates a stdout logger.
Renderable is a function that can be called to render custom elements on the chart.
RendererProvider is a function that returns a renderer.
SizeProvider is a provider for integer size.
TextHorizontalAlign is an enum for the horizontal alignment options.
TextVerticalAlign is an enum for the vertical alignment options.
TextWrap is an enum for the word wrap options.
TickPosition is an enumeration of possible tick drawing positions.
Ticks is an array of ticks.
TimeAscending sorts a given list of times ascending, or min to max.
TimeDescending sorts a given list of times ascending, or min to max.
Times are an array of times.
ValueFormatter is a function that takes a value and produces a string.
Values is an array of Value.
YAxisType is a type of y-axis; it can either be primary or secondary.