types

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 5 Imported by: 7 modules, 7 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayOKAppend added in v0.7.0

func ArrayOKAppend[T any](array *ArrayOK[*T], values ...T)

Types

type ArrayOK

type ArrayOK[T any] struct {
	Value T
	Array []T
}

ArrayOK is a type that allows you to define a single value or an array of values, But not both. If Array is defined, Value will be ignored.

func ArrayOKArray

func ArrayOKArray[T any](array ...T) *ArrayOK[*T]

func ArrayOKValue

func ArrayOKValue[T any](value T) *ArrayOK[*T]

func (*ArrayOK[T]) MarshalJSON

func (arrayOK *ArrayOK[T]) MarshalJSON() ([]byte, error)

func (*ArrayOK[T]) UnmarshalJSON

func (arrayOK *ArrayOK[T]) UnmarshalJSON(data []byte) error

type BDataArrayType added in v0.7.0

type BDataArrayType struct {
	Dtype DType          `json:"dtype,omitempty"`
	Bdata []byte         `json:"bdata,omitempty"`
	Shape DataArrayShape `json:"shape,omitempty"`
}

type BoolType added in v0.7.0

type BoolType *bool

BoolType represents a *bool value. Needed to tell the different between false and nil.

var (

	// True is a *bool with true value
	True BoolType = &trueValue
	// False is a *bool with false value
	False BoolType = &falseValue
)

func B added in v0.7.0

func B(v bool) BoolType

func BA added in v0.7.0

func BA(v []bool) []BoolType

BA converts a list of bool into BooleanType

type Color

type Color string

Color A string describing color. Supported formats: - hex (e.g. '#d3d3d3') - rgb (e.g. 'rgb(255, 0, 0)') - rgba (e.g. 'rgb(255, 0, 0, 0.5)') - hsl (e.g. 'hsl(0, 100%, 50%)') - hsv (e.g. 'hsv(0, 100%, 100%)') - named colors (full list: http://www.w3.org/TR/css3-color/#svg-color)",

func C added in v0.7.0

func C(v string) Color

func CN added in v0.7.0

func CN(v []string) []Color

type ColorList

type ColorList []Color

ColorList A list of colors. Must be an {array} containing valid colors.

type ColorScale

type ColorScale struct {
	Name   string
	Values []ColorScaleReference
}

ColorScale A Plotly colorscale either picked by a name: (any of Greys, YlGnBu, Greens, YlOrRd, Bluered, RdBu, Reds, Blues, Picnic, Rainbow, Portland, Jet, Hot, Blackbody, Earth, Electric, Viridis, Cividis ) customized as an {array} of 2-element {arrays} where the first element is the normalized color level value (starting at *0* and ending at *1*), and the second item is a valid color string.

func (*ColorScale) MarshalJSON

func (cs *ColorScale) MarshalJSON() ([]byte, error)

func (*ColorScale) UnmarshalJSON

func (cs *ColorScale) UnmarshalJSON(data []byte) error

type ColorScaleReference

type ColorScaleReference struct {
	NormalizedValue float64
	Color           Color
}

func (*ColorScaleReference) MarshalJSON

func (cs *ColorScaleReference) MarshalJSON() ([]byte, error)

type ColorWithColorScale

type ColorWithColorScale struct {
	Color *Color
	Value float64
}

func UseColor

func UseColor(in Color) ColorWithColorScale

func UseColorScaleValues

func UseColorScaleValues(in []float64) []ColorWithColorScale

func UseColors

func UseColors(in []Color) []ColorWithColorScale

func (*ColorWithColorScale) MarshalJSON

func (c *ColorWithColorScale) MarshalJSON() ([]byte, error)

func (*ColorWithColorScale) UnmarshalJSON

func (c *ColorWithColorScale) UnmarshalJSON(data []byte) error

type DType added in v0.7.0

type DType string
const (
	DTypeFloat64 DType = "float64"
	DTypeFloat32 DType = "float32"
	DTypeInt32   DType = "int32"
	DTypeUInt32  DType = "uint32"
	DTypeInt16   DType = "int16"
	DTypeUInt16  DType = "uint16"
	DTypeInt8    DType = "int8"
	DTypeUInt8   DType = "uint8"
	DTypeUInt8c  DType = "uint8c"
)

type DataArrayShape added in v0.7.0

type DataArrayShape []int

func (DataArrayShape) MarshalJSON added in v0.7.0

func (d DataArrayShape) MarshalJSON() ([]byte, error)

func (*DataArrayShape) UnmarshalJSON added in v0.7.0

func (d *DataArrayShape) UnmarshalJSON(data []byte) error

type DataArrayType added in v0.7.0

type DataArrayType struct {
	// contains filtered or unexported fields
}

DataArrayType An {array} of data. The value must represent an {array} or it will be ignored, but this array can be provided in several forms: (1) a regular {array} object (2) a typed array (e.g. Float32Array) (3) an object with keys dtype, bdata, and optionally shape. In this 3rd form, dtype is one of *f8*, *f4*. *i4*, *u4*, *i2*, *u2*, *i1*, *u1* or *u1c* for Uint8ClampedArray. In addition to shorthand `dtype` above one could also use the following forms: *float64*, *float32*, *int32*, *uint32*, *int16*, *uint16*, *int8*, *uint8* or *uint8c* for Uint8ClampedArray. `bdata` is either a base64-encoded string or the ArrayBuffer of an integer or float typed array. For either multi-dimensional arrays you must also provide its dimensions separated by comma via `shape`. For example using `dtype`: *f4* and `shape`: *5,100* you can declare a 2-D array that has 5 rows and 100 columns containing float32 values i.e. 4 bits per value. `shape` is optional for one dimensional arrays.",

func BDataArray added in v0.7.0

func BDataArray(dtype DType, bdata []byte, shape []int) *DataArrayType

func DataArray added in v0.7.0

func DataArray[T any](data []T) *DataArrayType

func (*DataArrayType) MarshalJSON added in v0.7.0

func (d *DataArrayType) MarshalJSON() ([]byte, error)

func (*DataArrayType) UnmarshalJSON added in v0.7.0

func (d *DataArrayType) UnmarshalJSON(data []byte) error

func (*DataArrayType) Value added in v0.7.0

func (da *DataArrayType) Value() interface{}

Value returns either the underlying interface values OR the BDataArrayType, depending on how the DataArray was created.

type Fig

type Fig interface {
	Info() Version
}

Fig Represents a plotly figure use the Info method to get details about the plotly version

type IntegerType added in v0.7.0

type IntegerType *int

IntegerType as defined by plotly schema

func I added in v0.7.0

func I(n int) IntegerType

func IA added in v0.7.0

func IA(n []int) []IntegerType

IA converts a list of int to IntegerType

func IS added in v0.7.0

func IS(n string) IntegerType

IS Given a string, parses it as an integer number Panics if the string is not an integer number

type NumberType added in v0.7.0

type NumberType *float64

NumberType as defined by plotly schema

func N added in v0.7.0

func N(n float64) NumberType

func NA added in v0.7.0

func NA(n []float64) []NumberType

NA converts a list of float64 to NumberType

func NS added in v0.7.0

func NS(n string) NumberType

NS Given a string, parses it as a float64 number Panics if the string is not a float number

type StringType added in v0.7.0

type StringType string

StringType as defined by plotly schema This is not *string because I do not see any case where an empty string is a desired input for plotly and having this as string makes it much easier to work with the package.

func S added in v0.7.0

func S(v string) StringType

S converts a string to a StringType It is not needed, but if you use this method, it will make it easier to migrate to different implementations of String type in case we actually need *string instead of string

type Trace

type Trace interface {
	GetType() TraceType
}

Trace Every trace implements this interface It is useful for autocompletion, it is a better idea to use type assertions/switches to identify trace types

type TraceType

type TraceType string

TraceType is the type for the TraceType field on every trace

type Version

type Version struct {
	Name      string `yaml:"Name"`      // name of the version
	Tag       string `yaml:"Tag"`       // git tag of the plotly version
	URL       string `yaml:"URL"`       // url under which the plotly schema json file can be downloaded directly
	Path      string `yaml:"Path"`      // path under which the schema file will be saved locally for future use
	Generated string `yaml:"Generated"` // path for the generated package
	Cdn       string `yaml:"CDN"`       // url for the cdn which should be included in the head of the generated html
}

Jump to

Keyboard shortcuts

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