wchart

package
v1.18.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2022 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ColorOrange is orange.
	ColorOrange = drawing.Color{R: 255, G: 165, B: 0, A: 255}

	// ColorGreen is green.
	ColorGreen = drawing.Color{R: 0, G: 255, B: 0, A: 255}
)

Functions

func ColorImageToDrawing

func ColorImageToDrawing(col color.RGBA) drawing.Color

ColorImageToDrawing converts a `color.RGBA` value to a `drawing.Color` value.

func GridLines

func GridLines(values []float64, style chart.Style) []chart.GridLine

GridLines creates a `[]chart.GridLine` from a slice of `int64` and a style.

func MustParseColor

func MustParseColor(colorName string) drawing.Color

MustParseColor returns a `drawing.Color` for the SVG color name. If the color name is not found, black is returned.

func ParseColor

func ParseColor(colorName string) (drawing.Color, error)

ParseColor returns a `drawing.Color` for the SVG color name. If the color name is not found, an error is returned.

func TSSToChart added in v1.7.0

func TSSToChart(data timeseries.TimeSeriesSet, opts ChartOptions) chart.Chart

TSSToChart converts a `TimeSeriesSet` to a `wcharczuk.Chart`.

func Ticks

func Ticks(tickValues []float64, fn strconvutil.Float64ToString) []chart.Tick

Ticks converts a slice of `float64` to a slice of `chart.Tick`. Common formatting functions include `strconvutil.Commify` and `strconvutil.Int64Abbreviation`.

func TicksAndGridlinesTime

func TicksAndGridlinesTime(interval timeutil.Interval, timeBegin, timeEnd time.Time, styleMajor, styleMinor chart.Style, timeFormat func(time.Time) string, tickInterval, gridInterval timeutil.Interval) ([]chart.Tick, []chart.GridLine)

TicksAndGridlinesTime takes a begin and end time and converts it to `[]chart.Tick` and `[]chart.GridLine.`.

func TicksInt64

func TicksInt64(tickValues []int64, fn strconvutil.Int64ToString) []chart.Tick

TicksInt64 converts a slice of `int64` to a slice of `chart.Tick`. Common formatting functions include `strconvutil.Commify` and `strconvutil.Int64Abbreviation`.

func TimeSeriesMapToContinuousSeriesMonths added in v1.7.0

func TimeSeriesMapToContinuousSeriesMonths(dsm map[string]timeseries.TimeSeries, order []string) []chart.ContinuousSeries

func TimeSeriesMapToContinuousSeriesQuarters added in v1.7.0

func TimeSeriesMapToContinuousSeriesQuarters(dsm map[string]timeseries.TimeSeries, order []string) []chart.ContinuousSeries

func TimeSeriesToContinuousSeries added in v1.7.0

func TimeSeriesToContinuousSeries(ds timeseries.TimeSeries) chart.ContinuousSeries

func TimeSeriesToContinuousSeriesQuarter added in v1.7.0

func TimeSeriesToContinuousSeriesQuarter(ds timeseries.TimeSeries) chart.ContinuousSeries

func WritePNG

func WritePNG(filename string, thisChart ChartType) error

Types

type ChartOptions

type ChartOptions struct {
	LegendEnable    bool
	YAxisLeft       bool
	XAxisTimeLayout string
}

type ChartType

type ChartType interface {
	Render(rp chart.RendererProvider, w io.Writer) error
}

type Colors

type Colors struct {
	BackgroundColorVal       drawing.Color
	BackgroundStrokeColorVal drawing.Color
	CanvasColorVal           drawing.Color
	CanvasStrokeColorVal     drawing.Color
	AxisStrokeColorVal       drawing.Color
	TextColorVal             drawing.Color
	SeriesColorVal           drawing.Color
}

func ColorsDefault

func ColorsDefault() Colors

func (Colors) AxisStrokeColor

func (c Colors) AxisStrokeColor() drawing.Color

func (Colors) BackgroundColor

func (c Colors) BackgroundColor() drawing.Color

func (Colors) BackgroundStrokeColor

func (c Colors) BackgroundStrokeColor() drawing.Color

func (Colors) CanvasColor

func (c Colors) CanvasColor() drawing.Color

func (Colors) CanvasStrokeColor

func (c Colors) CanvasStrokeColor() drawing.Color

func (Colors) GetSeriesColor

func (c Colors) GetSeriesColor(index int) drawing.Color

func (Colors) TextColor

func (c Colors) TextColor() drawing.Color

type TimeFormatter

type TimeFormatter struct {
	Layout string // time format string
}

TimeFormatter provides a struct that satisifies the `github.com/wcharczuk/go-chart.ValueFormatter` interface using a given time layout string.

func (*TimeFormatter) FormatTime

func (tvf *TimeFormatter) FormatTime(v interface{}) string

Directories

Path Synopsis
examples
bar

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL