Documentation
¶
Index ¶
- Constants
- Variables
- func AsAny[T SupportedType](data []T) []any
- func Avg[T float64 | int](data []T) float64
- func EChartRenderMode(mode RenderMode)
- func Map[T, U any](s []T, f func(T) U) []U
- type ChartOption
- func LineFn(name string, fn func(float64) float64) ChartOption
- func LineXY(name string, x, y []float64) ChartOption
- func Name(name string) ChartOption
- func PlotX(x iter.Seq[float64]) ChartOption
- func Ratio(ratio float64) ChartOption
- func Size(width, height int) ChartOption
- func XName(name string) ChartOption
- func YName(name string) ChartOption
- type DataFrame
- type EChart
- type LineData
- type RenderMode
- type Series
- func NewRandomFloat64Series(name string, len int, min float64, max float64) Series
- func NewRandomIntSeries(name string, len, max int) Series
- func NewSeries[T SupportedType](name string, data []T) Series
- func NewSeriesAny(name string, data []any) Series
- func NewStringSeries(name string, len int) Series
- type SupportedType
- type XYChart
Constants ¶
View Source
const DefaultPlotHeight = 480
View Source
const DefaultPlotRatio = 16.0 / 9.0
View Source
const DefaultPlotWidth = 0
Default height for gonum plot, in pixels
View Source
const Inch480px = 480 / 96
View Source
const Inch640px = 640 / 96
assuming 96 DPI
Variables ¶
View Source
var ( ExampleSVG = &svg{} ExamplePNG = &pngExample{} ExampleGonumPlot = &gonumPlot{} ExampleEChartsPlot = &echartsPlot{} )
Functions ¶
func AsAny ¶
func AsAny[T SupportedType](data []T) []any
func EChartRenderMode ¶
func EChartRenderMode(mode RenderMode)
Types ¶
type ChartOption ¶
type ChartOption func(*chartConfig)
func LineXY ¶
func LineXY(name string, x, y []float64) ChartOption
func Name ¶
func Name(name string) ChartOption
func Ratio ¶
func Ratio(ratio float64) ChartOption
func Size ¶
func Size(width, height int) ChartOption
func XName ¶
func XName(name string) ChartOption
func YName ¶
func YName(name string) ChartOption
type DataFrame ¶
type DataFrame interface {
fmt.Stringer
Columns() []string
Rows() int
GetColumn(name string) Series
GetColumnAt(index int) Series
SetColumn(data Series) error
SetColumnAt(index int, data Series) error
RemoveColumn(name string) error
RemoveColumnAt(index int) error
Head(n int) DataFrame
Tail(n int) DataFrame
Avg() DataFrame
// Plot(options ...ChartOption)
Bar(options ...ChartOption)
Line(options ...ChartOption)
Pie(options ...ChartOption)
XY(options ...ChartOption)
}
DataFrame interface to define the operations on a DataFrame
func FromRandomValue ¶
FromRandomValue generates a DataFrame with random float64 values.
func FromRecords ¶
FromRecords creates a DataFrame from a slice of slices where each inner slice represents a row
func NewDataFrame ¶
NewDataFrame creates a new DataFrame with the given columns in the given order
type EChart ¶
type EChart struct {
// contains filtered or unexported fields
}
func (*EChart) Options ¶
func (c *EChart) Options() []term.BlockOption
type RenderMode ¶
type RenderMode string
const ( IFrameMode RenderMode = "iframe" DivMode RenderMode = "div" )
Default height for the echart iframe, in pixels. The chart only needs 530px, but the body has a padding of 8px.
type Series ¶
type Series interface {
fmt.Stringer
Len() int
Name() string
Data() []any
ToFloat64() []float64
AsFloat64() []float64
AsInt() []int
AsString() []string
Avg() Series
}
func NewRandomFloat64Series ¶
func NewRandomIntSeries ¶
func NewSeries ¶
func NewSeries[T SupportedType](name string, data []T) Series
func NewSeriesAny ¶
func NewStringSeries ¶
type SupportedType ¶
SupportedType constrains the types that can be used in a Series
type XYChart ¶
type XYChart struct {
// contains filtered or unexported fields
}
func NewGonumPlot ¶
func NewXYChart ¶
func NewXYChart(options ...ChartOption) (*XYChart, error)
Click to show internal directories.
Click to hide internal directories.