Documentation
¶
Index ¶
- func ArrayOKAppend[T any](array *ArrayOK[*T], values ...T)
- type ArrayOK
- type BDataArrayType
- type BoolType
- type Color
- type ColorList
- type ColorScale
- type ColorScaleReference
- type ColorWithColorScale
- type DType
- type DataArrayShape
- type DataArrayType
- type Fig
- type IntegerType
- type NumberType
- type StringType
- type Trace
- type TraceType
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayOKAppend ¶ added in v0.7.0
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 ArrayOKValue ¶
func (*ArrayOK[T]) MarshalJSON ¶
func (*ArrayOK[T]) UnmarshalJSON ¶
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.
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)",
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 ¶
func (*ColorScaleReference) MarshalJSON ¶
func (cs *ColorScaleReference) MarshalJSON() ([]byte, error)
type ColorWithColorScale ¶
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 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 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 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 }