charts

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeValue   = "value"
	TypeLine    = "line"
	TypePie     = "pie"
	TypeBar     = "bar"
	TypeFunnel  = "funnel"
	TypeRadar   = "radar"
	TypeScatter = "scatter"
	TypeGauge   = "gauge"
	TypeEchart  = "echart"
	TypeTable   = "table"
	TypeClock   = "clock"
	TypeURL     = "url"
	TypeHTML    = "html"
)

Variables

This section is empty.

Functions

func NewFuncString added in v0.0.2

func NewFuncString(jsFunc string) string

Types

type Axis added in v0.0.2

type Axis struct {
	Reverse bool   `yaml:"reverse" json:"reverse"`
	X       *XAxis `yaml:"x" json:"x"`
	Y       *YAxis `yaml:"y" json:"y"`
}

func NewAxis added in v0.0.2

func NewAxis() *Axis

type AxisChart added in v0.0.2

type AxisChart struct {
	BasicChart `yaml:",inline" json:",inline"`

	Axis *Axis `yaml:"axis" json:"axis"`
}

type AxisLine added in v0.0.2

type AxisLine struct {
	Width interface{} `yaml:"width" json:"width"`
}

func NewAxisLine added in v0.0.2

func NewAxisLine() *AxisLine

type AxisTick added in v0.0.2

type AxisTick struct {
	Length interface{} `yaml:"length" json:"length"`
	Width  interface{} `yaml:"width" json:"width"`
	Color  interface{} `yaml:"color" json:"color"`
}

func NewAxisTick added in v0.0.2

func NewAxisTick() *AxisTick

type BarChart

type BarChart struct {
	AxisChart `yaml:",inline" json:",inline"`

	Labels []string     `yaml:"labels" json:"labels"`
	Series []*BarSeries `yaml:"series" json:"series"`
}

func NewBarChart added in v0.0.2

func NewBarChart() *BarChart

func (*BarChart) AddSeries added in v0.0.2

func (this *BarChart) AddSeries(series *BarSeries)

func (*BarChart) Type

func (this *BarChart) Type() string

type BarSeries added in v0.0.2

type BarSeries struct {
	Series

	Width string `yaml:"width" json:"width"` // bar width
	Stack string `yaml:"stack" json:"stack"`
}

func NewBarSeries added in v0.0.2

func NewBarSeries() *BarSeries

type BasicChart

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

func (*BasicChart) Fetch

func (this *BasicChart) Fetch(db *dbs.DB) error

func (*BasicChart) Param added in v0.0.2

func (this *BasicChart) Param() *Param

func (*BasicChart) SetParam added in v0.0.2

func (this *BasicChart) SetParam(param *Param)

type ChartInterface

type ChartInterface interface {
	Type() string
	Fetch(db *dbs.DB) error
	SetParam(param *Param)
}

func Decode

func Decode(chartType Type, options string) (ChartInterface, error)

type ClockChart

type ClockChart struct {
	BasicChart

	Timestamp int64 `yaml:"timestamp" json:"timestamp"`
}

func NewClockChart added in v0.0.2

func NewClockChart() *ClockChart

func (*ClockChart) Type

func (this *ClockChart) Type() string

type Echart

type Echart struct {
	BasicChart

	Code string `yaml:"code" json:"code"`
}

func NewEchart added in v0.0.2

func NewEchart() *Echart

func (*Echart) Type

func (this *Echart) Type() string

type FunnelChart

type FunnelChart struct {
	BasicChart

	Series []*FunnelSeries `yaml:"series" json:"series"`
}

func NewFunnelChart added in v0.0.2

func NewFunnelChart() *FunnelChart

func (*FunnelChart) AddSeries added in v0.0.2

func (this *FunnelChart) AddSeries(series *FunnelSeries)

func (*FunnelChart) Type

func (this *FunnelChart) Type() string

type FunnelSeries added in v0.0.2

type FunnelSeries struct {
	Series
}

func NewFunnelSeries added in v0.0.2

func NewFunnelSeries() *FunnelSeries

type GaugeChart

type GaugeChart struct {
	BasicChart

	Series []*GaugeSeries `yaml:"series" json:"series"`
}

func NewGaugeChart added in v0.0.2

func NewGaugeChart() *GaugeChart

func (*GaugeChart) AddSeries added in v0.0.2

func (this *GaugeChart) AddSeries(series *GaugeSeries)

func (*GaugeChart) Type

func (this *GaugeChart) Type() string

type GaugeSeries added in v0.0.2

type GaugeSeries struct {
	Series `yaml:",inline" json:",inline"`

	Min         interface{} `yaml:"min" json:"min"`
	Max         interface{} `yaml:"max" json:"max"`
	Radius      interface{} `yaml:"radius" json:"radius"`
	Center      *Position   `yaml:"center" json:"center"`
	AxisLine    *AxisLine   `yaml:"axisLine" json:"axisLine"`
	AxisTick    *AxisTick   `yaml:"axisTick" json:"axisTick"`
	Pointer     *Pointer    `yaml:"pointer" json:"pointer"`
	SplitLine   *SplitLine  `yaml:"splitLine" json:"splitLine"`
	SplitNumber interface{} `yaml:"splitNumber" json:"splitNumber"`
	Detail      interface{} `yaml:"detail" json:"detail"`
	DetailStyle *TextStyle  `yaml:"detailStyle" json:"detailStyle"`
}

func NewGaugeSeries added in v0.0.2

func NewGaugeSeries() *GaugeSeries

type HTMLChart

type HTMLChart struct {
	BasicChart

	HTML string `yaml:"html" json:"html"`
}

func NewHTMLChart added in v0.0.2

func NewHTMLChart() *HTMLChart

func (*HTMLChart) Type

func (this *HTMLChart) Type() string

type LineChart

type LineChart struct {
	AxisChart `yaml:",inline" json:",inline"`

	Series []*LineSeries `yaml:"series" json:"series"`
	Labels []string      `yaml:"labels" json:"labels"`
}

func NewLineChart

func NewLineChart() *LineChart

func (*LineChart) AddSeries added in v0.0.2

func (this *LineChart) AddSeries(series ...*LineSeries)

func (*LineChart) Fetch

func (this *LineChart) Fetch(db *dbs.DB) error

func (*LineChart) Type

func (this *LineChart) Type() string

type LineSeries added in v0.0.2

type LineSeries struct {
	Series

	IsFilled bool `yaml:"isFilled" json:"isFilled"`
	IsSmooth bool `yaml:"isSmooth" json:"isSmooth"`
}

func NewLineSeries added in v0.0.2

func NewLineSeries() *LineSeries
type Menu struct {
	Items []*MenuItem `yaml:"items" json:"items"`
}

func NewMenu added in v0.0.2

func NewMenu() *Menu
func (this *Menu) AddItem(item *MenuItem)
func (this *Menu) SelectItem(itemId ...string)
type MenuItem struct {
	Id       string `yaml:"id" json:"id"`
	Name     string `yaml:"name" json:"name"`
	IsActive bool   `yaml:"isActive" json:"isActive"`
}

func NewMenuItem added in v0.0.2

func NewMenuItem(id, name string) *MenuItem
type MenuParam struct {
	ItemIds []string `yaml:"itemIds" json:"itemIds"`
}
func (this *MenuParam) HasItems() bool
func (this *MenuParam) IsActive(itemId string) bool

type Param added in v0.0.2

type Param struct {
	MenuParam *MenuParam `yaml:"menuParam" json:"menuParam"`
	TimeParam *TimeParam `yaml:"timeParam" json:"timeParam"`
}

func NewParam added in v0.0.2

func NewParam() *Param

type PieChart

type PieChart struct {
	BasicChart

	Series []*PieSeries `yaml:"series" json:"series"`
}

func NewPieChart added in v0.0.2

func NewPieChart() *PieChart

func (*PieChart) AddSeries added in v0.0.2

func (this *PieChart) AddSeries(series ...*PieSeries)

func (*PieChart) Fetch added in v0.0.2

func (this *PieChart) Fetch(db *dbs.DB) error

func (*PieChart) Type

func (this *PieChart) Type() string

type PieSeries added in v0.0.2

type PieSeries struct {
	Series

	Radius string    `yaml:"radius" json:"radius"`
	Center *Position `yaml:"center" json:"center"`
}

func NewPieSeries added in v0.0.2

func NewPieSeries() *PieSeries

func (*PieSeries) Fetch added in v0.0.2

func (this *PieSeries) Fetch(db *dbs.DB) error

type Pointer added in v0.0.2

type Pointer struct {
	Length interface{} `yaml:"length" json:"length"`
	Width  interface{} `yaml:"width" json:"width"`
}

gauge pointer

func NewPointer added in v0.0.2

func NewPointer() *Pointer

type Position added in v0.0.2

type Position struct {
	X interface{} `yaml:"x" json:"x"`
	Y interface{} `yaml:"y" json:"y"`
}

func NewPosition added in v0.0.2

func NewPosition(x, y interface{}) *Position

type RadarCategory added in v0.0.2

type RadarCategory struct {
	Name string  `yaml:"name" json:"name"`
	Max  float64 `yaml:"max" json:"max"`
}

func NewRadarCategory added in v0.0.2

func NewRadarCategory(name string, max float64) *RadarCategory

type RadarChart

type RadarChart struct {
	BasicChart

	Radius     string           `yaml:"radius" json:"radius"`
	Center     *Position        `yaml:"center" json:"center"`
	Categories []*RadarCategory `yaml:"categories" json:"categories"`
	Series     []*RadarSeries   `yaml:"series" json:"series"`
}

func NewRadarChart added in v0.0.2

func NewRadarChart() *RadarChart

func (*RadarChart) AddCategory added in v0.0.2

func (this *RadarChart) AddCategory(category *RadarCategory)

func (*RadarChart) AddSeries added in v0.0.2

func (this *RadarChart) AddSeries(series *RadarSeries)

func (*RadarChart) Type

func (this *RadarChart) Type() string

type RadarSeries added in v0.0.2

type RadarSeries struct {
	Series

	SubCategories []*RadarSubCategory `yaml:"subCategories" json:"subCategories"`
}

func NewRadarSeries added in v0.0.2

func NewRadarSeries() *RadarSeries

func (*RadarSeries) AddSubCategory added in v0.0.2

func (this *RadarSeries) AddSubCategory(category *RadarSubCategory)

type RadarSubCategory added in v0.0.2

type RadarSubCategory struct {
	Name   string    `yaml:"name" json:"name"`
	Values []float64 `yaml:"values" json:"values"`
}

func NewRadarSubCategory added in v0.0.2

func NewRadarSubCategory(name string) *RadarSubCategory

type ScatterChart

type ScatterChart struct {
	AxisChart `yaml:",inline" json:",inline"`

	Series []*ScatterSeries `yaml:"series" json:"series"`
}

func NewScatterChart added in v0.0.2

func NewScatterChart() *ScatterChart

func (*ScatterChart) AddSeries added in v0.0.2

func (this *ScatterChart) AddSeries(series *ScatterSeries)

func (*ScatterChart) Type

func (this *ScatterChart) Type() string

type ScatterSeries added in v0.0.2

type ScatterSeries struct {
	Series

	Size string `yaml:"size" json:"size"`
}

func NewScatterSeries added in v0.0.2

func NewScatterSeries() *ScatterSeries

type Series added in v0.0.2

type Series struct {
	Name   string   `yaml:"name" json:"name"`
	Values []*Value `yaml:"values" json:"values"`
	Color  string   `yaml:"color" json:"color"`
	Query  string   `yaml:"query" json:"query"`
}

func (*Series) AddValue added in v0.0.2

func (this *Series) AddValue(value interface{}, label string)

func (*Series) AddValues added in v0.0.2

func (this *Series) AddValues(values []*Value)

type SplitLine added in v0.0.2

type SplitLine struct {
	Length interface{} `yaml:"length" json:"length"`
	Width  interface{} `yaml:"width" json:"width"`
	Color  interface{} `yaml:"color" json:"color"`
}

gauge split line

func NewSplitLine added in v0.0.2

func NewSplitLine() *SplitLine

type TableChart

type TableChart struct {
	BasicChart `yaml:",inline" json:",inline"`

	Rows []*TableRow `yaml:"rows" json:"rows"`
	Cols []*TableCol `yaml:"cols" json:"cols"`
}

func NewTableChart added in v0.0.2

func NewTableChart() *TableChart

func (*TableChart) AddCol added in v0.0.2

func (this *TableChart) AddCol(col *TableCol)

func (*TableChart) AddDefaultCol added in v0.0.2

func (this *TableChart) AddDefaultCol()

func (*TableChart) AddRow added in v0.0.2

func (this *TableChart) AddRow(row *TableRow)

func (*TableChart) AddRowValues added in v0.0.2

func (this *TableChart) AddRowValues(value ...string)

func (*TableChart) Type

func (this *TableChart) Type() string

type TableCol added in v0.0.2

type TableCol struct {
	Width  string `yaml:"width" json:"width"`
	Header string `yaml:"header" json:"header"`
}

func NewDefaultTableCol added in v0.0.2

func NewDefaultTableCol() *TableCol

func NewTableCol added in v0.0.2

func NewTableCol() *TableCol

type TableRow added in v0.0.2

type TableRow struct {
	Values []string `yaml:"values" json:"values"`
}

func NewTableRow added in v0.0.2

func NewTableRow(value ...string) *TableRow

type TextStyle added in v0.0.2

type TextStyle struct {
	Color      interface{} `yaml:"color" json:"color"`
	FontSize   interface{} `yaml:"fontSize" json:"fontSize"`
	FontFamily interface{} `yaml:"fontFamily" json:"fontFamily"`
	FontWeight interface{} `yaml:"fontWeight" json:"fontWeight"`
}

func NewTextStyle added in v0.0.2

func NewTextStyle() *TextStyle

type TimeParam added in v0.0.2

type TimeParam struct {
}

type Type

type Type = string

type URLChart

type URLChart struct {
	BasicChart `yaml:",inline" json:",inline"`

	URL string `yaml:"url" json:"url"`
}

func NewURLChart added in v0.0.2

func NewURLChart() *URLChart

func (*URLChart) Type

func (this *URLChart) Type() string

type Value

type Value struct {
	Value interface{} `yaml:"value" json:"value"` // raw value
	Label string      `yaml:"label" json:"label"`
}

func NewValue

func NewValue(value interface{}, label string) *Value

type ValueChart

type ValueChart struct {
	BasicChart `yaml:",inline" json:",inline"`

	Value      *Value `yaml:"value" json:"value"`
	ValueColor string `yaml:"valueColor" json:"valueColor"` // value color
	LabelColor string `yaml:"labelColor" json:"labelColor"` // label color
	Query      string `yaml:"query" json:"query"`
}

func NewValueChart added in v0.0.2

func NewValueChart() *ValueChart

func (*ValueChart) Fetch added in v0.0.2

func (this *ValueChart) Fetch(db *dbs.DB) error

func (*ValueChart) Type

func (this *ValueChart) Type() string

type XAxis added in v0.0.2

type XAxis struct {
	Name   string      `yaml:"name" json:"name"`
	Type   string      `yaml:"type" json:"type"`
	Max    interface{} `yaml:"max" json:"max"`
	Labels []string    `yaml:"labels" json:"labels"`
}

func NewXAxis added in v0.0.2

func NewXAxis() *XAxis

type YAxis added in v0.0.2

type YAxis struct {
	XAxis `yaml:",inline" json:",inline"`
}

func NewYAxis added in v0.0.2

func NewYAxis() *YAxis

Jump to

Keyboard shortcuts

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