wchart

package
v2.18.6 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 19 Imported by: 3

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

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, timeStart, timeEnd time.Time, styleMajor, styleMinor chart.Style, timeFormat func(time.Time) string, tickInterval, gridInterval timeutil.Interval) ([]chart.Tick, []chart.GridLine)

TicksAndGridlinesTime takes a start 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

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

func TimeSeriesMapToContinuousSeriesQuarters

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

func TimeSeriesToContinuousSeries

func TimeSeriesToContinuousSeries(ds timeseries.TimeSeries) chart.ContinuousSeries

func TimeSeriesToContinuousSeriesQuarter

func TimeSeriesToContinuousSeriesQuarter(ds timeseries.TimeSeries) chart.ContinuousSeries

func WritePNG

func WritePNG(w io.Writer, c ChartType) error

func WritePNGFile added in v2.18.1

func WritePNGFile(filename string, c 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 Table added in v2.18.0

type Table struct {
	Table *tablef64.Table
}

func (*Table) BoxPlot added in v2.18.0

func (tbl *Table) BoxPlot(values []float64) (*plotter.BoxPlot, error)

func (*Table) BoxPlotColNameWritePNGFile added in v2.18.0

func (tbl *Table) BoxPlotColNameWritePNGFile(filename, title, colName string) error

func (*Table) ScatterPlot added in v2.18.0

func (tbl *Table) ScatterPlot(title, xColName, yColName string, dotWidth float64) (chart.Chart, error)

func (*Table) ScatterPlotWritePNG added in v2.18.1

func (tbl *Table) ScatterPlotWritePNG(w io.Writer, title, xColName, yColName string, dotWidth float64) error

func (*Table) ScatterPlotWritePNGFile added in v2.18.0

func (tbl *Table) ScatterPlotWritePNGFile(filename, title, xColName, yColName string, dotWidth float64) error

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 any) string

Directories

Path Synopsis
examples
bar

Jump to

Keyboard shortcuts

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