This commit is contained in:
21
vendor/github.com/go-echarts/go-echarts/v2/LICENSE
generated
vendored
Normal file
21
vendor/github.com/go-echarts/go-echarts/v2/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019~now chenjiandongx
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
29
vendor/github.com/go-echarts/go-echarts/v2/actions/global.go
generated
vendored
Normal file
29
vendor/github.com/go-echarts/go-echarts/v2/actions/global.go
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
package actions
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
}
|
||||
|
||||
// Type kind of dispatch action
|
||||
type Type string
|
||||
|
||||
// Areas means select-boxes. Multi-boxes can be specified.
|
||||
// If Areas is empty, all of the select-boxes will be deleted.
|
||||
// The first area.
|
||||
type Areas struct {
|
||||
|
||||
//BrushType Optional: 'polygon', 'rect', 'lineX', 'lineY'
|
||||
BrushType string `json:"brushType,omitempty"`
|
||||
|
||||
// CoordRange Only for "coordinate system area", define the area with the
|
||||
// coordinates.
|
||||
CoordRange []string `json:"coordRange,omitempty"`
|
||||
|
||||
// XAxisIndex Assigns which of the xAxisIndex can use Area selecting.
|
||||
XAxisIndex interface{} `json:"xAxisIndex,omitempty"`
|
||||
}
|
||||
63
vendor/github.com/go-echarts/go-echarts/v2/charts/bar.go
generated
vendored
Normal file
63
vendor/github.com/go-echarts/go-echarts/v2/charts/bar.go
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Bar represents a bar chart.
|
||||
type Bar struct {
|
||||
RectChart
|
||||
|
||||
isXYReversal bool
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Bar) Type() string { return types.ChartBar }
|
||||
|
||||
// NewBar creates a new bar chart instance.
|
||||
func NewBar() *Bar {
|
||||
c := &Bar{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.hasXYAxis = true
|
||||
return c
|
||||
}
|
||||
|
||||
// EnablePolarType enables the polar bar.
|
||||
func (c *Bar) EnablePolarType() *Bar {
|
||||
c.hasXYAxis = false
|
||||
c.hasPolar = true
|
||||
return c
|
||||
}
|
||||
|
||||
// SetXAxis sets the X axis.
|
||||
func (c *Bar) SetXAxis(x interface{}) *Bar {
|
||||
c.xAxisData = x
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds the new series.
|
||||
func (c *Bar) AddSeries(name string, data []opts.BarData, options ...SeriesOpts) *Bar {
|
||||
series := SingleSeries{Name: name, Type: types.ChartBar, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// XYReversal checks if X axis and Y axis are reversed.
|
||||
func (c *Bar) XYReversal() *Bar {
|
||||
c.isXYReversal = true
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Bar) Validate() {
|
||||
c.XAxisList[0].Data = c.xAxisData
|
||||
if c.isXYReversal {
|
||||
c.YAxisList[0].Data = c.xAxisData
|
||||
c.XAxisList[0].Data = nil
|
||||
}
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
30
vendor/github.com/go-echarts/go-echarts/v2/charts/bar3d.go
generated
vendored
Normal file
30
vendor/github.com/go-echarts/go-echarts/v2/charts/bar3d.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Bar3D represents a 3D bar chart.
|
||||
type Bar3D struct {
|
||||
Chart3D
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Bar3D) Type() string { return types.ChartBar3D }
|
||||
|
||||
// NewBar3D creates a new 3D bar chart.
|
||||
func NewBar3D() *Bar3D {
|
||||
c := &Bar3D{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.initChart3D()
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds the new series.
|
||||
func (c *Bar3D) AddSeries(name string, data []opts.Chart3DData, options ...SeriesOpts) *Bar3D {
|
||||
c.addSeries(types.ChartBar3D, name, data, options...)
|
||||
return c
|
||||
}
|
||||
430
vendor/github.com/go-echarts/go-echarts/v2/charts/base.go
generated
vendored
Normal file
430
vendor/github.com/go-echarts/go-echarts/v2/charts/base.go
generated
vendored
Normal file
@@ -0,0 +1,430 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"html/template"
|
||||
|
||||
"github.com/go-echarts/go-echarts/v2/actions"
|
||||
"github.com/go-echarts/go-echarts/v2/datasets"
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
)
|
||||
|
||||
// GlobalOpts sets the Global options for charts.
|
||||
type GlobalOpts func(bc *BaseConfiguration)
|
||||
|
||||
// GlobalActions sets the Global actions for charts
|
||||
type GlobalActions func(ba *BaseActions)
|
||||
|
||||
// BaseConfiguration represents an option set needed by all chart types.
|
||||
type BaseConfiguration struct {
|
||||
opts.Legend `json:"legend"`
|
||||
opts.Tooltip `json:"tooltip"`
|
||||
opts.Toolbox `json:"toolbox"`
|
||||
opts.Title `json:"title"`
|
||||
opts.Polar `json:"polar"`
|
||||
opts.AngleAxis `json:"angleAxis"`
|
||||
opts.RadiusAxis `json:"radiusAxis"`
|
||||
opts.Brush `json:"brush"`
|
||||
*opts.AxisPointer `json:"axisPointer"`
|
||||
|
||||
render.Renderer `json:"-"`
|
||||
opts.Initialization `json:"-"`
|
||||
opts.Assets `json:"-"`
|
||||
opts.RadarComponent `json:"-"`
|
||||
opts.GeoComponent `json:"-"`
|
||||
opts.ParallelComponent `json:"-"`
|
||||
opts.JSFunctions `json:"-"`
|
||||
opts.SingleAxis `json:"-"`
|
||||
|
||||
MultiSeries
|
||||
XYAxis
|
||||
|
||||
opts.XAxis3D
|
||||
opts.YAxis3D
|
||||
opts.ZAxis3D
|
||||
opts.Grid3D
|
||||
opts.Grid
|
||||
|
||||
legends []string
|
||||
// Colors is the color list of palette.
|
||||
// If no color is set in series, the colors would be adopted sequentially and circularly
|
||||
// from this list as the colors of series.
|
||||
Colors []string
|
||||
appendColor []string // append customize color to the Colors(reverse order)
|
||||
|
||||
// Animation whether enable the animation, default true
|
||||
Animation bool `json:"animation" default:"true"`
|
||||
|
||||
// Array of datasets, managed by AddDataset()
|
||||
DatasetList []opts.Dataset `json:"dataset,omitempty"`
|
||||
|
||||
DataZoomList []opts.DataZoom `json:"datazoom,omitempty"`
|
||||
VisualMapList []opts.VisualMap `json:"visualmap,omitempty"`
|
||||
|
||||
// ParallelAxisList represents the component list which is the coordinate axis for parallel coordinate.
|
||||
ParallelAxisList []opts.ParallelAxis
|
||||
|
||||
has3DAxis bool
|
||||
hasXYAxis bool
|
||||
hasGeo bool
|
||||
hasRadar bool
|
||||
hasParallel bool
|
||||
hasSingleAxis bool
|
||||
hasPolar bool
|
||||
hasBrush bool
|
||||
|
||||
GridList []opts.Grid `json:"grid,omitempty"`
|
||||
}
|
||||
|
||||
// BaseActions represents a dispatchAction set needed by all chart types.
|
||||
type BaseActions struct {
|
||||
actions.Type `json:"type,omitempty"`
|
||||
actions.Areas `json:"areas,omitempty"`
|
||||
}
|
||||
|
||||
// JSON wraps all the options to a map so that it could be used in the base template
|
||||
//
|
||||
// Get data in bytes
|
||||
// bs, _ : = json.Marshal(bar.JSON())
|
||||
func (bc *BaseConfiguration) JSON() map[string]interface{} {
|
||||
return bc.json()
|
||||
}
|
||||
|
||||
// JSONNotEscaped works like method JSON, but it returns a marshaled object whose characters will not be escaped in the template
|
||||
func (bc *BaseConfiguration) JSONNotEscaped() template.HTML {
|
||||
obj := bc.json()
|
||||
buff := bytes.NewBufferString("")
|
||||
enc := json.NewEncoder(buff)
|
||||
enc.SetEscapeHTML(false)
|
||||
enc.Encode(obj)
|
||||
|
||||
return template.HTML(buff.String())
|
||||
}
|
||||
|
||||
// JSONNotEscapedAction works like method JSON, but it returns a marshaled object whose characters will not be escaped in the template
|
||||
func (ba *BaseActions) JSONNotEscapedAction() template.HTML {
|
||||
obj := ba.json()
|
||||
buff := bytes.NewBufferString("")
|
||||
enc := json.NewEncoder(buff)
|
||||
enc.SetEscapeHTML(false)
|
||||
enc.Encode(obj)
|
||||
|
||||
return template.HTML(buff.String())
|
||||
}
|
||||
|
||||
func (bc *BaseConfiguration) json() map[string]interface{} {
|
||||
obj := map[string]interface{}{
|
||||
"title": bc.Title,
|
||||
"legend": bc.Legend,
|
||||
"animation": bc.Animation,
|
||||
"tooltip": bc.Tooltip,
|
||||
"series": bc.MultiSeries,
|
||||
}
|
||||
// if only one item, use it directly instead of an Array
|
||||
if len(bc.DatasetList) == 1 {
|
||||
obj["dataset"] = bc.DatasetList[0]
|
||||
} else if len(bc.DatasetList) > 1 {
|
||||
obj["dataset"] = bc.DatasetList
|
||||
|
||||
}
|
||||
if bc.AxisPointer != nil {
|
||||
obj["axisPointer"] = bc.AxisPointer
|
||||
}
|
||||
|
||||
if bc.hasPolar {
|
||||
obj["polar"] = bc.Polar
|
||||
obj["angleAxis"] = bc.AngleAxis
|
||||
obj["radiusAxis"] = bc.RadiusAxis
|
||||
}
|
||||
|
||||
if bc.hasGeo {
|
||||
obj["geo"] = bc.GeoComponent
|
||||
}
|
||||
|
||||
if bc.hasRadar {
|
||||
obj["radar"] = bc.RadarComponent
|
||||
}
|
||||
|
||||
if bc.hasParallel {
|
||||
obj["parallel"] = bc.ParallelComponent
|
||||
obj["parallelAxis"] = bc.ParallelAxisList
|
||||
}
|
||||
|
||||
if bc.hasSingleAxis {
|
||||
obj["singleAxis"] = bc.SingleAxis
|
||||
}
|
||||
|
||||
if bc.Toolbox.Show {
|
||||
obj["toolbox"] = bc.Toolbox
|
||||
}
|
||||
|
||||
if len(bc.DataZoomList) > 0 {
|
||||
obj["dataZoom"] = bc.DataZoomList
|
||||
}
|
||||
|
||||
if len(bc.VisualMapList) > 0 {
|
||||
obj["visualMap"] = bc.VisualMapList
|
||||
}
|
||||
|
||||
if bc.hasXYAxis {
|
||||
obj["xAxis"] = bc.XAxisList
|
||||
obj["yAxis"] = bc.YAxisList
|
||||
}
|
||||
|
||||
if bc.has3DAxis {
|
||||
obj["xAxis3D"] = bc.XAxis3D
|
||||
obj["yAxis3D"] = bc.YAxis3D
|
||||
obj["zAxis3D"] = bc.ZAxis3D
|
||||
obj["grid3D"] = bc.Grid3D
|
||||
}
|
||||
|
||||
if bc.Theme == "white" {
|
||||
obj["color"] = bc.Colors
|
||||
}
|
||||
|
||||
if bc.BackgroundColor != "" {
|
||||
obj["backgroundColor"] = bc.BackgroundColor
|
||||
}
|
||||
|
||||
if len(bc.GridList) > 0 {
|
||||
obj["grid"] = bc.GridList
|
||||
}
|
||||
|
||||
if bc.hasBrush {
|
||||
obj["brush"] = bc.Brush
|
||||
}
|
||||
|
||||
return obj
|
||||
}
|
||||
|
||||
// GetAssets returns the Assets options.
|
||||
func (bc *BaseConfiguration) GetAssets() opts.Assets {
|
||||
return bc.Assets
|
||||
}
|
||||
|
||||
// AddDataset adds a Dataset to this chart
|
||||
func (bc *BaseConfiguration) AddDataset(dataset ...opts.Dataset) {
|
||||
bc.DatasetList = append(bc.DatasetList, dataset...)
|
||||
}
|
||||
|
||||
// FillDefaultValues fill default values for chart options.
|
||||
func (bc *BaseConfiguration) FillDefaultValues() {
|
||||
opts.SetDefaultValue(bc)
|
||||
}
|
||||
|
||||
func (bc *BaseConfiguration) initBaseConfiguration() {
|
||||
bc.initSeriesColors()
|
||||
bc.InitAssets()
|
||||
bc.initXYAxis()
|
||||
bc.Initialization.Validate()
|
||||
bc.FillDefaultValues()
|
||||
}
|
||||
|
||||
func (bc *BaseConfiguration) initSeriesColors() {
|
||||
bc.Colors = []string{
|
||||
"#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de",
|
||||
"#3ba272", "#fc8452", "#9a60b4", "#ea7ccc",
|
||||
}
|
||||
}
|
||||
|
||||
func (bc *BaseConfiguration) insertSeriesColors(colors []string) {
|
||||
reversed := reverseSlice(colors)
|
||||
for i := 0; i < len(reversed); i++ {
|
||||
bc.Colors = append(bc.Colors, "")
|
||||
copy(bc.Colors[1:], bc.Colors[0:])
|
||||
bc.Colors[0] = reversed[i]
|
||||
}
|
||||
}
|
||||
|
||||
func (bc *BaseConfiguration) setBaseGlobalOptions(opts ...GlobalOpts) {
|
||||
for _, opt := range opts {
|
||||
opt(bc)
|
||||
}
|
||||
}
|
||||
|
||||
func (ba *BaseActions) setBaseGlobalActions(opts ...GlobalActions) {
|
||||
for _, opt := range opts {
|
||||
opt(ba)
|
||||
}
|
||||
}
|
||||
|
||||
func (ba *BaseActions) json() map[string]interface{} {
|
||||
obj := map[string]interface{}{
|
||||
"type": ba.Type,
|
||||
"areas": ba.Areas,
|
||||
}
|
||||
return obj
|
||||
}
|
||||
|
||||
// WithAreas sets the areas of the action
|
||||
func WithAreas(act actions.Areas) GlobalActions {
|
||||
return func(ba *BaseActions) {
|
||||
ba.Areas = act
|
||||
}
|
||||
}
|
||||
|
||||
// WithType sets the type of the action
|
||||
func WithType(act actions.Type) GlobalActions {
|
||||
return func(ba *BaseActions) {
|
||||
ba.Type = act
|
||||
}
|
||||
}
|
||||
|
||||
// WithAngleAxisOps sets the angle of the axis.
|
||||
func WithAngleAxisOps(opt opts.AngleAxis) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.AngleAxis = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithRadiusAxisOps sets the radius of the axis.
|
||||
func WithRadiusAxisOps(opt opts.RadiusAxis) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.RadiusAxis = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithBrush sets the Brush.
|
||||
func WithBrush(opt opts.Brush) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.hasBrush = true
|
||||
bc.Brush = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithPolarOps sets the polar.
|
||||
func WithPolarOps(opt opts.Polar) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.Polar = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithTitleOpts sets the title.
|
||||
func WithTitleOpts(opt opts.Title) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.Title = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithAnimation enable or disable the animation.
|
||||
func WithAnimation() GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.Animation = false
|
||||
}
|
||||
}
|
||||
|
||||
// WithToolboxOpts sets the toolbox.
|
||||
func WithToolboxOpts(opt opts.Toolbox) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.Toolbox = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithSingleAxisOpts sets the single axis.
|
||||
func WithSingleAxisOpts(opt opts.SingleAxis) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.SingleAxis = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithTooltipOpts sets the tooltip.
|
||||
func WithTooltipOpts(opt opts.Tooltip) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.Tooltip = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithLegendOpts sets the legend.
|
||||
func WithLegendOpts(opt opts.Legend) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.Legend = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithInitializationOpts sets the initialization.
|
||||
func WithInitializationOpts(opt opts.Initialization) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.Initialization = opt
|
||||
if bc.Initialization.Theme != "" &&
|
||||
bc.Initialization.Theme != "white" &&
|
||||
bc.Initialization.Theme != "dark" {
|
||||
bc.JSAssets.Add("themes/" + opt.Theme + ".js")
|
||||
}
|
||||
bc.Initialization.Validate()
|
||||
}
|
||||
}
|
||||
|
||||
// WithDataZoomOpts sets the list of the zoom data.
|
||||
func WithDataZoomOpts(opt ...opts.DataZoom) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.DataZoomList = append(bc.DataZoomList, opt...)
|
||||
}
|
||||
}
|
||||
|
||||
// WithVisualMapOpts sets the List of the visual map.
|
||||
func WithVisualMapOpts(opt ...opts.VisualMap) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.VisualMapList = append(bc.VisualMapList, opt...)
|
||||
}
|
||||
}
|
||||
|
||||
// WithRadarComponentOpts sets the component of the radar.
|
||||
func WithRadarComponentOpts(opt opts.RadarComponent) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.RadarComponent = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithGeoComponentOpts sets the geo component.
|
||||
func WithGeoComponentOpts(opt opts.GeoComponent) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.GeoComponent = opt
|
||||
bc.JSAssets.Add("maps/" + datasets.MapFileNames[opt.Map] + ".js")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// WithParallelComponentOpts sets the parallel component.
|
||||
func WithParallelComponentOpts(opt opts.ParallelComponent) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.ParallelComponent = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithParallelAxisList sets the list of the parallel axis.
|
||||
func WithParallelAxisList(opt []opts.ParallelAxis) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.ParallelAxisList = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithColorsOpts sets the color.
|
||||
func WithColorsOpts(opt opts.Colors) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.insertSeriesColors(opt)
|
||||
}
|
||||
}
|
||||
|
||||
// reverseSlice reverses the string slice.
|
||||
func reverseSlice(s []string) []string {
|
||||
for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
|
||||
s[i], s[j] = s[j], s[i]
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// WithGridOpts sets the List of the grid.
|
||||
func WithGridOpts(opt ...opts.Grid) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.GridList = append(bc.GridList, opt...)
|
||||
}
|
||||
}
|
||||
|
||||
// WithAxisPointerOpts sets the axis pointer.
|
||||
func WithAxisPointerOpts(opt *opts.AxisPointer) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.AxisPointer = opt
|
||||
}
|
||||
}
|
||||
44
vendor/github.com/go-echarts/go-echarts/v2/charts/boxplot.go
generated
vendored
Normal file
44
vendor/github.com/go-echarts/go-echarts/v2/charts/boxplot.go
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// BoxPlot represents a boxplot chart.
|
||||
type BoxPlot struct {
|
||||
RectChart
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*BoxPlot) Type() string { return types.ChartBoxPlot }
|
||||
|
||||
// NewBoxPlot creates a new boxplot chart.
|
||||
func NewBoxPlot() *BoxPlot {
|
||||
c := &BoxPlot{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.hasXYAxis = true
|
||||
return c
|
||||
}
|
||||
|
||||
// SetXAxis adds the X axis.
|
||||
func (c *BoxPlot) SetXAxis(x interface{}) *BoxPlot {
|
||||
c.xAxisData = x
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds the new series.
|
||||
func (c *BoxPlot) AddSeries(name string, data []opts.BoxPlotData, options ...SeriesOpts) *BoxPlot {
|
||||
series := SingleSeries{Name: name, Type: types.ChartBoxPlot, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *BoxPlot) Validate() {
|
||||
c.XAxisList[0].Data = c.xAxisData
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
67
vendor/github.com/go-echarts/go-echarts/v2/charts/chart3d.go
generated
vendored
Normal file
67
vendor/github.com/go-echarts/go-echarts/v2/charts/chart3d.go
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Chart3D is a chart in 3D coordinates.
|
||||
type Chart3D struct {
|
||||
BaseConfiguration
|
||||
}
|
||||
|
||||
// WithXAxis3DOpts sets the X axis of the Chart3D instance.
|
||||
func WithXAxis3DOpts(opt opts.XAxis3D) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.XAxis3D = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithYAxis3DOpts sets the Y axis of the Chart3D instance.
|
||||
func WithYAxis3DOpts(opt opts.YAxis3D) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.YAxis3D = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithZAxis3DOpts sets the Z axis of the Chart3D instance.
|
||||
func WithZAxis3DOpts(opt opts.ZAxis3D) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.ZAxis3D = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithGrid3DOpts sets the grid of the Chart3D instance.
|
||||
func WithGrid3DOpts(opt opts.Grid3D) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
bc.Grid3D = opt
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Chart3D) initChart3D() {
|
||||
c.JSAssets.Add(opts.CompatibleEchartsJS)
|
||||
c.JSAssets.Add("echarts-gl.min.js")
|
||||
c.has3DAxis = true
|
||||
}
|
||||
|
||||
func (c *Chart3D) addSeries(chartType, name string, data []opts.Chart3DData, options ...SeriesOpts) {
|
||||
series := SingleSeries{
|
||||
Name: name,
|
||||
Type: chartType,
|
||||
Data: data,
|
||||
CoordSystem: types.ChartCartesian3D,
|
||||
}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the Chart3D instance.
|
||||
func (c *Chart3D) SetGlobalOptions(options ...GlobalOpts) *Chart3D {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Chart3D) Validate() {
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
44
vendor/github.com/go-echarts/go-echarts/v2/charts/effectscatter.go
generated
vendored
Normal file
44
vendor/github.com/go-echarts/go-echarts/v2/charts/effectscatter.go
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// EffectScatter represents an effect scatter chart.
|
||||
type EffectScatter struct {
|
||||
RectChart
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*EffectScatter) Type() string { return types.ChartEffectScatter }
|
||||
|
||||
// NewEffectScatter creates a new effect scatter chart.
|
||||
func NewEffectScatter() *EffectScatter {
|
||||
c := &EffectScatter{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.hasXYAxis = true
|
||||
return c
|
||||
}
|
||||
|
||||
// SetXAxis adds the X axis.
|
||||
func (c *EffectScatter) SetXAxis(x interface{}) *EffectScatter {
|
||||
c.xAxisData = x
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds the Y axis.
|
||||
func (c *EffectScatter) AddSeries(name string, data []opts.EffectScatterData, options ...SeriesOpts) *EffectScatter {
|
||||
series := SingleSeries{Name: name, Type: types.ChartEffectScatter, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *EffectScatter) Validate() {
|
||||
c.XAxisList[0].Data = c.xAxisData
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
49
vendor/github.com/go-echarts/go-echarts/v2/charts/funnel.go
generated
vendored
Normal file
49
vendor/github.com/go-echarts/go-echarts/v2/charts/funnel.go
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Funnel represents a funnel chart.
|
||||
type Funnel struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Funnel) Type() string { return types.ChartFunnel }
|
||||
|
||||
// NewFunnel creates a new funnel chart.
|
||||
func NewFunnel() *Funnel {
|
||||
c := &Funnel{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds new data sets.
|
||||
func (c *Funnel) AddSeries(name string, data []opts.FunnelData, options ...SeriesOpts) *Funnel {
|
||||
series := SingleSeries{Name: name, Type: types.ChartFunnel, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the Funnel instance.
|
||||
func (c *Funnel) SetGlobalOptions(options ...GlobalOpts) *Funnel {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the Gauge instance.
|
||||
func (c *Funnel) SetDispatchActions(actions ...GlobalActions) *Funnel {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Funnel) Validate() {
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
49
vendor/github.com/go-echarts/go-echarts/v2/charts/gauge.go
generated
vendored
Normal file
49
vendor/github.com/go-echarts/go-echarts/v2/charts/gauge.go
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Gauge represents a gauge chart.
|
||||
type Gauge struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Gauge) Type() string { return types.ChartGauge }
|
||||
|
||||
// NewGauge creates a new gauge chart.
|
||||
func NewGauge() *Gauge {
|
||||
c := &Gauge{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds new data sets.
|
||||
func (c *Gauge) AddSeries(name string, data []opts.GaugeData, options ...SeriesOpts) *Gauge {
|
||||
series := SingleSeries{Name: name, Type: types.ChartGauge, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the Gauge instance.
|
||||
func (c *Gauge) SetGlobalOptions(options ...GlobalOpts) *Gauge {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the Gauge instance.
|
||||
func (c *Gauge) SetDispatchActions(actions ...GlobalActions) *Gauge {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Gauge) Validate() {
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
75
vendor/github.com/go-echarts/go-echarts/v2/charts/geo.go
generated
vendored
Normal file
75
vendor/github.com/go-echarts/go-echarts/v2/charts/geo.go
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/go-echarts/go-echarts/v2/datasets"
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Geo represents a geo chart.
|
||||
type Geo struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Geo) Type() string { return types.ChartGeo }
|
||||
|
||||
var geoFormatter = `function (params) {
|
||||
return params.name + ' : ' + params.value[2];
|
||||
}`
|
||||
|
||||
// NewGeo creates a new geo chart.
|
||||
func NewGeo() *Geo {
|
||||
c := &Geo{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.hasGeo = true
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds new data sets.
|
||||
// geoType options:
|
||||
// * types.ChartScatter
|
||||
// * types.ChartEffectScatter
|
||||
// * types.ChartHeatMap
|
||||
func (c *Geo) AddSeries(name, geoType string, data []opts.GeoData, options ...SeriesOpts) *Geo {
|
||||
series := SingleSeries{Name: name, Type: geoType, Data: data, CoordSystem: types.ChartGeo}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *Geo) extendValue(region string, v float32) []float32 {
|
||||
res := make([]float32, 0)
|
||||
tv := datasets.Coordinates[region]
|
||||
if tv == [2]float32{0, 0} {
|
||||
log.Printf("goecharts: No coordinate is specified for %s\n", region)
|
||||
} else {
|
||||
res = append(tv[:], v)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the Geo instance.
|
||||
func (c *Geo) SetGlobalOptions(options ...GlobalOpts) *Geo {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the Geo instance.
|
||||
func (c *Geo) SetDispatchActions(actions ...GlobalActions) *Geo {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Geo) Validate() {
|
||||
if c.Tooltip.Formatter == "" {
|
||||
c.Tooltip.Formatter = opts.FuncOpts(geoFormatter)
|
||||
}
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
55
vendor/github.com/go-echarts/go-echarts/v2/charts/graph.go
generated
vendored
Normal file
55
vendor/github.com/go-echarts/go-echarts/v2/charts/graph.go
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Graph represents a graph chart.
|
||||
type Graph struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Graph) Type() string { return types.ChartGraph }
|
||||
|
||||
// NewGraph creates a new graph chart.
|
||||
func NewGraph() *Graph {
|
||||
chart := new(Graph)
|
||||
chart.initBaseConfiguration()
|
||||
chart.Renderer = render.NewChartRender(chart, chart.Validate)
|
||||
return chart
|
||||
}
|
||||
|
||||
// AddSeries adds the new series.
|
||||
func (c *Graph) AddSeries(name string, nodes []opts.GraphNode, links []opts.GraphLink, options ...SeriesOpts) *Graph {
|
||||
series := SingleSeries{Name: name, Type: types.ChartGraph, Links: links, Data: nodes}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the Graph instance.
|
||||
func (c *Graph) SetGlobalOptions(options ...GlobalOpts) *Graph {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the Graph instance.
|
||||
func (c *Graph) SetDispatchActions(actions ...GlobalActions) *Graph {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Graph) Validate() {
|
||||
// If there is no layout setting, default layout is set to "force".
|
||||
for i := 0; i < len(c.MultiSeries); i++ {
|
||||
if c.MultiSeries[i].Layout == "" {
|
||||
c.MultiSeries[i].Layout = "force"
|
||||
}
|
||||
}
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
43
vendor/github.com/go-echarts/go-echarts/v2/charts/heatmap.go
generated
vendored
Normal file
43
vendor/github.com/go-echarts/go-echarts/v2/charts/heatmap.go
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// HeatMap represents a heatmap chart.
|
||||
type HeatMap struct {
|
||||
RectChart
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*HeatMap) Type() string { return types.ChartHeatMap }
|
||||
|
||||
// NewHeatMap creates a new heatmap chart.
|
||||
func NewHeatMap() *HeatMap {
|
||||
c := &HeatMap{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.hasXYAxis = true
|
||||
return c
|
||||
}
|
||||
|
||||
// SetXAxis adds the X axis.
|
||||
func (c *HeatMap) SetXAxis(x interface{}) *HeatMap {
|
||||
c.xAxisData = x
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds the new series.
|
||||
func (c *HeatMap) AddSeries(name string, data []opts.HeatMapData, options ...SeriesOpts) *HeatMap {
|
||||
series := SingleSeries{Name: name, Type: types.ChartHeatMap, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *HeatMap) Validate() {
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
44
vendor/github.com/go-echarts/go-echarts/v2/charts/kline.go
generated
vendored
Normal file
44
vendor/github.com/go-echarts/go-echarts/v2/charts/kline.go
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Kline represents a kline chart.
|
||||
type Kline struct {
|
||||
RectChart
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Kline) Type() string { return types.ChartKline }
|
||||
|
||||
// NewKLine creates a new kline chart.
|
||||
func NewKLine() *Kline {
|
||||
c := &Kline{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.hasXYAxis = true
|
||||
return c
|
||||
}
|
||||
|
||||
// SetXAxis adds the X axis.
|
||||
func (c *Kline) SetXAxis(xAxis interface{}) *Kline {
|
||||
c.xAxisData = xAxis
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds the new series.
|
||||
func (c *Kline) AddSeries(name string, data []opts.KlineData, options ...SeriesOpts) *Kline {
|
||||
series := SingleSeries{Name: name, Type: types.ChartKline, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Kline) Validate() {
|
||||
c.XAxisList[0].Data = c.xAxisData
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
45
vendor/github.com/go-echarts/go-echarts/v2/charts/line.go
generated
vendored
Normal file
45
vendor/github.com/go-echarts/go-echarts/v2/charts/line.go
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Line represents a line chart.
|
||||
type Line struct {
|
||||
RectChart
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Line) Type() string { return types.ChartLine }
|
||||
|
||||
// NewLine creates a new line chart.
|
||||
func NewLine() *Line {
|
||||
c := &Line{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.hasXYAxis = true
|
||||
return c
|
||||
}
|
||||
|
||||
// SetXAxis adds the X axis.
|
||||
func (c *Line) SetXAxis(x interface{}) *Line {
|
||||
c.xAxisData = x
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds the new series.
|
||||
func (c *Line) AddSeries(name string, data []opts.LineData, options ...SeriesOpts) *Line {
|
||||
series := SingleSeries{Name: name, Type: types.ChartLine, Data: data}
|
||||
series.InitSeriesDefaultOpts(c.BaseConfiguration)
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Line) Validate() {
|
||||
c.XAxisList[0].Data = c.xAxisData
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
30
vendor/github.com/go-echarts/go-echarts/v2/charts/line3d.go
generated
vendored
Normal file
30
vendor/github.com/go-echarts/go-echarts/v2/charts/line3d.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Line3D represents a 3D line chart.
|
||||
type Line3D struct {
|
||||
Chart3D
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Line3D) Type() string { return types.ChartLine3D }
|
||||
|
||||
// NewLine3D creates a new 3D line chart.
|
||||
func NewLine3D() *Line3D {
|
||||
c := &Line3D{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.initChart3D()
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds the new series.
|
||||
func (c *Line3D) AddSeries(name string, data []opts.Chart3DData, options ...SeriesOpts) *Line3D {
|
||||
c.addSeries(types.ChartLine3D, name, data, options...)
|
||||
return c
|
||||
}
|
||||
51
vendor/github.com/go-echarts/go-echarts/v2/charts/liquid.go
generated
vendored
Normal file
51
vendor/github.com/go-echarts/go-echarts/v2/charts/liquid.go
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Liquid represents a liquid chart.
|
||||
type Liquid struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Liquid) Type() string { return types.ChartLiquid }
|
||||
|
||||
// NewLiquid creates a new liquid chart.
|
||||
func NewLiquid() *Liquid {
|
||||
c := &Liquid{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.JSAssets.Add(opts.CompatibleEchartsJS)
|
||||
c.JSAssets.Add("echarts-liquidfill.min.js")
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds new data sets.
|
||||
func (c *Liquid) AddSeries(name string, data []opts.LiquidData, options ...SeriesOpts) *Liquid {
|
||||
series := SingleSeries{Name: name, Type: types.ChartLiquid, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the Liquid instance.
|
||||
func (c *Liquid) SetGlobalOptions(options ...GlobalOpts) *Liquid {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the Liquid instance.
|
||||
func (c *Liquid) SetDispatchActions(actions ...GlobalActions) *Liquid {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Liquid) Validate() {
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
58
vendor/github.com/go-echarts/go-echarts/v2/charts/map.go
generated
vendored
Normal file
58
vendor/github.com/go-echarts/go-echarts/v2/charts/map.go
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/datasets"
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Map represents a map chart.
|
||||
type Map struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
|
||||
mapType string
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Map) Type() string { return types.ChartMap }
|
||||
|
||||
// NewMap creates a new map chart.
|
||||
func NewMap() *Map {
|
||||
c := &Map{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
return c
|
||||
}
|
||||
|
||||
// RegisterMapType registers the given mapType.
|
||||
func (c *Map) RegisterMapType(mapType string) {
|
||||
c.mapType = mapType
|
||||
c.JSAssets.Add("maps/" + datasets.MapFileNames[mapType] + ".js")
|
||||
}
|
||||
|
||||
// AddSeries adds new data sets.
|
||||
func (c *Map) AddSeries(name string, data []opts.MapData, options ...SeriesOpts) *Map {
|
||||
series := SingleSeries{Name: name, Type: types.ChartMap, MapType: c.mapType, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the Map instance.
|
||||
func (c *Map) SetGlobalOptions(options ...GlobalOpts) *Map {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the Radar instance.
|
||||
func (c *Map) SetDispatchActions(actions ...GlobalActions) *Map {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Map) Validate() {
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
50
vendor/github.com/go-echarts/go-echarts/v2/charts/parallel.go
generated
vendored
Normal file
50
vendor/github.com/go-echarts/go-echarts/v2/charts/parallel.go
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Parallel represents a parallel axis.
|
||||
type Parallel struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Parallel) Type() string { return types.ChartParallel }
|
||||
|
||||
// NewParallel creates a new parallel instance.
|
||||
func NewParallel() *Parallel {
|
||||
c := &Parallel{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.hasParallel = true
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds new data sets.
|
||||
func (c *Parallel) AddSeries(name string, data []opts.ParallelData, options ...SeriesOpts) *Parallel {
|
||||
series := SingleSeries{Name: name, Type: types.ChartParallel, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the Parallel instance.
|
||||
func (c *Parallel) SetGlobalOptions(options ...GlobalOpts) *Parallel {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the Radar instance.
|
||||
func (c *Parallel) SetDispatchActions(actions ...GlobalActions) *Parallel {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Parallel) Validate() {
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
49
vendor/github.com/go-echarts/go-echarts/v2/charts/pie.go
generated
vendored
Normal file
49
vendor/github.com/go-echarts/go-echarts/v2/charts/pie.go
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Pie represents a pie chart.
|
||||
type Pie struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Pie) Type() string { return types.ChartPie }
|
||||
|
||||
// NewPie creates a new pie chart.
|
||||
func NewPie() *Pie {
|
||||
c := &Pie{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds new data sets.
|
||||
func (c *Pie) AddSeries(name string, data []opts.PieData, options ...SeriesOpts) *Pie {
|
||||
series := SingleSeries{Name: name, Type: types.ChartPie, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the Pie instance.
|
||||
func (c *Pie) SetGlobalOptions(options ...GlobalOpts) *Pie {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the Pie instance.
|
||||
func (c *Pie) SetDispatchActions(actions ...GlobalActions) *Pie {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Pie) Validate() {
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
55
vendor/github.com/go-echarts/go-echarts/v2/charts/radar.go
generated
vendored
Normal file
55
vendor/github.com/go-echarts/go-echarts/v2/charts/radar.go
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Radar represents a radar chart.
|
||||
type Radar struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
|
||||
// SymbolKeepAspect is whether to keep aspect for symbols in the form of path://.
|
||||
SymbolKeepAspect bool
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Radar) Type() string { return types.ChartRadar }
|
||||
|
||||
// NewRadar creates a new radar chart.
|
||||
func NewRadar() *Radar {
|
||||
c := &Radar{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.hasRadar = true
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds new data sets.
|
||||
func (c *Radar) AddSeries(name string, data []opts.RadarData, options ...SeriesOpts) *Radar {
|
||||
series := SingleSeries{Name: name, Type: types.ChartRadar, Data: data, SymbolKeepAspect: c.SymbolKeepAspect}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
c.legends = append(c.legends, name)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the Radar instance.
|
||||
func (c *Radar) SetGlobalOptions(options ...GlobalOpts) *Radar {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the Radar instance.
|
||||
func (c *Radar) SetDispatchActions(actions ...GlobalActions) *Radar {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Radar) Validate() {
|
||||
c.Legend.Data = c.legends
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
111
vendor/github.com/go-echarts/go-echarts/v2/charts/rectangle.go
generated
vendored
Normal file
111
vendor/github.com/go-echarts/go-echarts/v2/charts/rectangle.go
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
)
|
||||
|
||||
type Overlaper interface {
|
||||
overlap() MultiSeries
|
||||
}
|
||||
|
||||
// XYAxis represent the X and Y axis in the rectangular coordinates.
|
||||
type XYAxis struct {
|
||||
XAxisList []opts.XAxis `json:"xaxis"`
|
||||
YAxisList []opts.YAxis `json:"yaxis"`
|
||||
}
|
||||
|
||||
func (xy *XYAxis) initXYAxis() {
|
||||
xy.XAxisList = append(xy.XAxisList, opts.XAxis{})
|
||||
xy.YAxisList = append(xy.YAxisList, opts.YAxis{})
|
||||
}
|
||||
|
||||
// ExtendXAxis adds new X axes.
|
||||
func (xy *XYAxis) ExtendXAxis(xAxis ...opts.XAxis) {
|
||||
xy.XAxisList = append(xy.XAxisList, xAxis...)
|
||||
}
|
||||
|
||||
// ExtendYAxis adds new Y axes.
|
||||
func (xy *XYAxis) ExtendYAxis(yAxis ...opts.YAxis) {
|
||||
xy.YAxisList = append(xy.YAxisList, yAxis...)
|
||||
}
|
||||
|
||||
// WithXAxisOpts sets the X axis.
|
||||
func WithXAxisOpts(opt opts.XAxis, index ...int) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
if len(index) == 0 {
|
||||
index = []int{0}
|
||||
}
|
||||
for i := 0; i < len(index); i++ {
|
||||
bc.XYAxis.XAxisList[index[i]] = opt
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WithYAxisOpts sets the Y axis.
|
||||
func WithYAxisOpts(opt opts.YAxis, index ...int) GlobalOpts {
|
||||
return func(bc *BaseConfiguration) {
|
||||
if len(index) == 0 {
|
||||
index = []int{0}
|
||||
}
|
||||
for i := 0; i < len(index); i++ {
|
||||
bc.XYAxis.YAxisList[index[i]] = opt
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// RectConfiguration contains options for the rectangular coordinates.
|
||||
type RectConfiguration struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
}
|
||||
|
||||
func (rect *RectConfiguration) setRectGlobalOptions(options ...GlobalOpts) {
|
||||
rect.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
}
|
||||
|
||||
func (rect *RectConfiguration) setRectGlobalActions(options ...GlobalActions) {
|
||||
rect.BaseActions.setBaseGlobalActions(options...)
|
||||
}
|
||||
|
||||
// RectChart is a chart in RectChart coordinate.
|
||||
type RectChart struct {
|
||||
RectConfiguration
|
||||
|
||||
xAxisData interface{}
|
||||
}
|
||||
|
||||
func (rc *RectChart) overlap() MultiSeries {
|
||||
return rc.MultiSeries
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the RectChart instance.
|
||||
func (rc *RectChart) SetGlobalOptions(options ...GlobalOpts) *RectChart {
|
||||
rc.RectConfiguration.setRectGlobalOptions(options...)
|
||||
return rc
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the RectChart instance.
|
||||
func (rc *RectChart) SetDispatchActions(options ...GlobalActions) *RectChart {
|
||||
rc.RectConfiguration.setRectGlobalActions(options...)
|
||||
return rc
|
||||
}
|
||||
|
||||
// Overlap composes multiple charts into one single canvas.
|
||||
// It is only suited for some of the charts which are in rectangular coordinate.
|
||||
// Supported charts: Bar/BoxPlot/Line/Scatter/EffectScatter/Kline/HeatMap
|
||||
func (rc *RectChart) Overlap(a ...Overlaper) {
|
||||
for i := 0; i < len(a); i++ {
|
||||
rc.MultiSeries = append(rc.MultiSeries, a[i].overlap()...)
|
||||
}
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (rc *RectChart) Validate() {
|
||||
// Make sure that the data of X axis won't be cleaned for XAxisOpts
|
||||
rc.XAxisList[0].Data = rc.xAxisData
|
||||
// Make sure that the labels of Y axis show correctly
|
||||
for i := 0; i < len(rc.YAxisList); i++ {
|
||||
rc.YAxisList[i].AxisLabel.Show = true
|
||||
}
|
||||
rc.Assets.Validate(rc.AssetsHost)
|
||||
}
|
||||
49
vendor/github.com/go-echarts/go-echarts/v2/charts/sankey.go
generated
vendored
Normal file
49
vendor/github.com/go-echarts/go-echarts/v2/charts/sankey.go
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Sankey represents a sankey chart.
|
||||
type Sankey struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Sankey) Type() string { return types.ChartSankey }
|
||||
|
||||
// NewSankey creates a new sankey chart.
|
||||
func NewSankey() *Sankey {
|
||||
c := &Sankey{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds new data sets.
|
||||
func (c *Sankey) AddSeries(name string, nodes []opts.SankeyNode, links []opts.SankeyLink, options ...SeriesOpts) *Sankey {
|
||||
series := SingleSeries{Name: name, Type: types.ChartSankey, Data: nodes, Links: links}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the Sankey instance.
|
||||
func (c *Sankey) SetGlobalOptions(options ...GlobalOpts) *Sankey {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the Sankey instance.
|
||||
func (c *Sankey) SetDispatchActions(actions ...GlobalActions) *Sankey {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Sankey) Validate() {
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
44
vendor/github.com/go-echarts/go-echarts/v2/charts/scatter.go
generated
vendored
Normal file
44
vendor/github.com/go-echarts/go-echarts/v2/charts/scatter.go
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Scatter represents a scatter chart.
|
||||
type Scatter struct {
|
||||
RectChart
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Scatter) Type() string { return types.ChartScatter }
|
||||
|
||||
// NewScatter creates a new scatter chart.
|
||||
func NewScatter() *Scatter {
|
||||
c := &Scatter{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.hasXYAxis = true
|
||||
return c
|
||||
}
|
||||
|
||||
// SetXAxis adds the X axis.
|
||||
func (c *Scatter) SetXAxis(x interface{}) *Scatter {
|
||||
c.xAxisData = x
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds the new series.
|
||||
func (c *Scatter) AddSeries(name string, data []opts.ScatterData, options ...SeriesOpts) *Scatter {
|
||||
series := SingleSeries{Name: name, Type: types.ChartScatter, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Scatter) Validate() {
|
||||
c.XAxisList[0].Data = c.xAxisData
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
30
vendor/github.com/go-echarts/go-echarts/v2/charts/scatter3d.go
generated
vendored
Normal file
30
vendor/github.com/go-echarts/go-echarts/v2/charts/scatter3d.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Scatter3D represents a 3D scatter chart.
|
||||
type Scatter3D struct {
|
||||
Chart3D
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Scatter3D) Type() string { return types.ChartScatter3D }
|
||||
|
||||
// NewScatter3D creates a new 3D scatter chart.
|
||||
func NewScatter3D() *Scatter3D {
|
||||
c := &Scatter3D{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.initChart3D()
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds the new series.
|
||||
func (c *Scatter3D) AddSeries(name string, data []opts.Chart3DData, options ...SeriesOpts) *Scatter3D {
|
||||
c.addSeries(types.ChartScatter3D, name, data, options...)
|
||||
return c
|
||||
}
|
||||
549
vendor/github.com/go-echarts/go-echarts/v2/charts/series.go
generated
vendored
Normal file
549
vendor/github.com/go-echarts/go-echarts/v2/charts/series.go
generated
vendored
Normal file
@@ -0,0 +1,549 @@
|
||||
package charts
|
||||
|
||||
import "github.com/go-echarts/go-echarts/v2/opts"
|
||||
|
||||
type SingleSeries struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
// Rectangular charts
|
||||
Stack string `json:"stack,omitempty"`
|
||||
XAxisIndex int `json:"xAxisIndex,omitempty"`
|
||||
YAxisIndex int `json:"yAxisIndex,omitempty"`
|
||||
|
||||
// Bar
|
||||
BarGap string `json:"barGap,omitempty"`
|
||||
BarCategoryGap string `json:"barCategoryGap,omitempty"`
|
||||
ShowBackground bool `json:"showBackground,omitempty"`
|
||||
RoundCap bool `json:"roundCap,omitempty"`
|
||||
|
||||
// Bar3D
|
||||
Shading string `json:"shading,omitempty"`
|
||||
|
||||
// Graph
|
||||
Links interface{} `json:"links,omitempty"`
|
||||
Layout string `json:"layout,omitempty"`
|
||||
Force interface{} `json:"force,omitempty"`
|
||||
Categories interface{} `json:"categories,omitempty"`
|
||||
Roam bool `json:"roam,omitempty"`
|
||||
EdgeSymbol interface{} `json:"edgeSymbol,omitempty"`
|
||||
EdgeSymbolSize interface{} `json:"edgeSymbolSize,omitempty"`
|
||||
EdgeLabel interface{} `json:"edgeLabel,omitempty"`
|
||||
Draggable bool `json:"draggable,omitempty"`
|
||||
FocusNodeAdjacency bool `json:"focusNodeAdjacency,omitempty"`
|
||||
SymbolKeepAspect bool `json:"symbolKeepAspect,omitempty"`
|
||||
|
||||
// KLine
|
||||
BarWidth string `json:"barWidth,omitempty"`
|
||||
BarMinWidth string `json:"barMinWidth,omitempty"`
|
||||
BarMaxWidth string `json:"barMaxWidth,omitempty"`
|
||||
|
||||
// Line
|
||||
Step interface{} `json:"step,omitempty"`
|
||||
Smooth bool `json:"smooth"`
|
||||
ConnectNulls bool `json:"connectNulls"`
|
||||
ShowSymbol bool `json:"showSymbol"`
|
||||
Symbol string `json:"symbol,omitempty"`
|
||||
Color string `json:"color,omitempty"`
|
||||
|
||||
// Liquid
|
||||
IsLiquidOutline bool `json:"outline,omitempty"`
|
||||
IsWaveAnimation bool `json:"waveAnimation"`
|
||||
|
||||
// Map
|
||||
MapType string `json:"map,omitempty"`
|
||||
CoordSystem string `json:"coordinateSystem,omitempty"`
|
||||
|
||||
// Pie
|
||||
RoseType interface{} `json:"roseType,omitempty"`
|
||||
Center interface{} `json:"center,omitempty"`
|
||||
Radius interface{} `json:"radius,omitempty"`
|
||||
|
||||
// Scatter
|
||||
SymbolSize interface{} `json:"symbolSize,omitempty"`
|
||||
|
||||
// Tree
|
||||
Orient string `json:"orient,omitempty"`
|
||||
ExpandAndCollapse bool `json:"expandAndCollapse,omitempty"`
|
||||
InitialTreeDepth int `json:"initialTreeDepth,omitempty"`
|
||||
Leaves interface{} `json:"leaves,omitempty"`
|
||||
Left string `json:"left,omitempty"`
|
||||
Right string `json:"right,omitempty"`
|
||||
Top string `json:"top,omitempty"`
|
||||
Bottom string `json:"bottom,omitempty"`
|
||||
|
||||
// TreeMap
|
||||
LeafDepth int `json:"leafDepth,omitempty"`
|
||||
Levels interface{} `json:"levels,omitempty"`
|
||||
UpperLabel interface{} `json:"upperLabel,omitempty"`
|
||||
|
||||
// WordCloud
|
||||
Shape string `json:"shape,omitempty"`
|
||||
SizeRange []float32 `json:"sizeRange,omitempty"`
|
||||
RotationRange []float32 `json:"rotationRange,omitempty"`
|
||||
|
||||
// Sunburst
|
||||
NodeClick string `json:"nodeClick,omitempty"`
|
||||
Sort string `json:"sort,omitempty"`
|
||||
RenderLabelForZeroData bool `json:"renderLabelForZeroData"`
|
||||
SelectedMode bool `json:"selectedMode"`
|
||||
Animation bool `json:"animation" default:"true"`
|
||||
AnimationThreshold int `json:"animationThreshold,omitempty"`
|
||||
AnimationDuration int `json:"animationDuration,omitempty"`
|
||||
AnimationEasing string `json:"animationEasing,omitempty"`
|
||||
AnimationDelay int `json:"animationDelay,omitempty"`
|
||||
AnimationDurationUpdate int `json:"animationDurationUpdate,omitempty"`
|
||||
AnimationEasingUpdate string `json:"animationEasingUpdate,omitempty"`
|
||||
AnimationDelayUpdate int `json:"animationDelayUpdate,omitempty"`
|
||||
|
||||
// series data
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
DatasetIndex int `json:"datasetIndex,omitempty"`
|
||||
|
||||
// series options
|
||||
*opts.Encode `json:"encode,omitempty"`
|
||||
*opts.ItemStyle `json:"itemStyle,omitempty"`
|
||||
*opts.Label `json:"label,omitempty"`
|
||||
*opts.LabelLine `json:"labelLine,omitempty"`
|
||||
*opts.Emphasis `json:"emphasis,omitempty"`
|
||||
*opts.MarkLines `json:"markLine,omitempty"`
|
||||
*opts.MarkAreas `json:"markArea,omitempty"`
|
||||
*opts.MarkPoints `json:"markPoint,omitempty"`
|
||||
*opts.RippleEffect `json:"rippleEffect,omitempty"`
|
||||
*opts.LineStyle `json:"lineStyle,omitempty"`
|
||||
*opts.AreaStyle `json:"areaStyle,omitempty"`
|
||||
*opts.TextStyle `json:"textStyle,omitempty"`
|
||||
*opts.CircularStyle `json:"circular,omitempty"`
|
||||
}
|
||||
|
||||
type SeriesOpts func(s *SingleSeries)
|
||||
|
||||
func WithSeriesAnimation(enable bool) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.Animation = enable
|
||||
}
|
||||
}
|
||||
|
||||
// WithLabelOpts sets the label.
|
||||
func WithLabelOpts(opt opts.Label) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.Label = &opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithEmphasisOpts sets the emphasis.
|
||||
func WithEmphasisOpts(opt opts.Emphasis) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.Emphasis = &opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithAreaStyleOpts sets the area style.
|
||||
func WithAreaStyleOpts(opt opts.AreaStyle) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.AreaStyle = &opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithItemStyleOpts sets the item style.
|
||||
func WithItemStyleOpts(opt opts.ItemStyle) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.ItemStyle = &opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithRippleEffectOpts sets the ripple effect.
|
||||
func WithRippleEffectOpts(opt opts.RippleEffect) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.RippleEffect = &opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithLineStyleOpts sets the line style.
|
||||
func WithLineStyleOpts(opt opts.LineStyle) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.LineStyle = &opt
|
||||
}
|
||||
}
|
||||
|
||||
// With CircularStyle Opts
|
||||
func WithCircularStyleOpts(opt opts.CircularStyle) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.CircularStyle = &opt
|
||||
}
|
||||
}
|
||||
|
||||
/* Chart Options */
|
||||
|
||||
// WithBarChartOpts sets the BarChart option.
|
||||
func WithBarChartOpts(opt opts.BarChart) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.Stack = opt.Stack
|
||||
s.BarGap = opt.BarGap
|
||||
s.BarCategoryGap = opt.BarCategoryGap
|
||||
s.XAxisIndex = opt.XAxisIndex
|
||||
s.YAxisIndex = opt.YAxisIndex
|
||||
s.ShowBackground = opt.ShowBackground
|
||||
s.RoundCap = opt.RoundCap
|
||||
s.CoordSystem = opt.CoordSystem
|
||||
}
|
||||
}
|
||||
|
||||
// WithSunburstOpts sets the SunburstChart option.
|
||||
func WithSunburstOpts(opt opts.SunburstChart) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.NodeClick = opt.NodeClick
|
||||
s.Sort = opt.Sort
|
||||
s.RenderLabelForZeroData = opt.RenderLabelForZeroData
|
||||
s.SelectedMode = opt.SelectedMode
|
||||
s.Animation = opt.Animation
|
||||
s.AnimationThreshold = opt.AnimationThreshold
|
||||
s.AnimationDuration = opt.AnimationDuration
|
||||
s.AnimationEasing = opt.AnimationEasing
|
||||
s.AnimationDelay = opt.AnimationDelay
|
||||
s.AnimationDurationUpdate = opt.AnimationDurationUpdate
|
||||
s.AnimationEasingUpdate = opt.AnimationEasingUpdate
|
||||
s.AnimationDelayUpdate = opt.AnimationDelayUpdate
|
||||
}
|
||||
}
|
||||
|
||||
// WithGraphChartOpts sets the GraphChart option.
|
||||
func WithGraphChartOpts(opt opts.GraphChart) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.Layout = opt.Layout
|
||||
s.Force = opt.Force
|
||||
s.Roam = opt.Roam
|
||||
s.EdgeSymbol = opt.EdgeSymbol
|
||||
s.EdgeSymbolSize = opt.EdgeSymbolSize
|
||||
s.Draggable = opt.Draggable
|
||||
s.FocusNodeAdjacency = opt.FocusNodeAdjacency
|
||||
s.Categories = opt.Categories
|
||||
s.EdgeLabel = opt.EdgeLabel
|
||||
s.SymbolKeepAspect = opt.SymbolKeepAspect
|
||||
}
|
||||
}
|
||||
|
||||
// WithHeatMapChartOpts sets the HeatMapChart option.
|
||||
func WithHeatMapChartOpts(opt opts.HeatMapChart) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.XAxisIndex = opt.XAxisIndex
|
||||
s.YAxisIndex = opt.YAxisIndex
|
||||
}
|
||||
}
|
||||
|
||||
// WithLineChartOpts sets the LineChart option.
|
||||
func WithLineChartOpts(opt opts.LineChart) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.YAxisIndex = opt.YAxisIndex
|
||||
s.Stack = opt.Stack
|
||||
s.Smooth = opt.Smooth
|
||||
s.ShowSymbol = opt.ShowSymbol
|
||||
s.Symbol = opt.Symbol
|
||||
s.SymbolSize = opt.SymbolSize
|
||||
s.Step = opt.Step
|
||||
s.XAxisIndex = opt.XAxisIndex
|
||||
s.YAxisIndex = opt.YAxisIndex
|
||||
s.ConnectNulls = opt.ConnectNulls
|
||||
s.Color = opt.Color
|
||||
s.SymbolKeepAspect = opt.SymbolKeepAspect
|
||||
}
|
||||
}
|
||||
|
||||
// WithLineChartOpts sets the LineChart option.
|
||||
func WithKlineChartOpts(opt opts.KlineChart) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.BarWidth = opt.BarWidth
|
||||
s.BarMinWidth = opt.BarMinWidth
|
||||
s.BarMaxWidth = opt.BarMaxWidth
|
||||
}
|
||||
}
|
||||
|
||||
// WithPieChartOpts sets the PieChart option.
|
||||
func WithPieChartOpts(opt opts.PieChart) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.RoseType = opt.RoseType
|
||||
s.Center = opt.Center
|
||||
s.Radius = opt.Radius
|
||||
}
|
||||
}
|
||||
|
||||
// WithScatterChartOpts sets the ScatterChart option.
|
||||
func WithScatterChartOpts(opt opts.ScatterChart) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.XAxisIndex = opt.XAxisIndex
|
||||
s.YAxisIndex = opt.YAxisIndex
|
||||
s.SymbolKeepAspect = opt.SymbolKeepAspect
|
||||
}
|
||||
}
|
||||
|
||||
// WithLiquidChartOpts sets the LiquidChart option.
|
||||
func WithLiquidChartOpts(opt opts.LiquidChart) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.Shape = opt.Shape
|
||||
s.IsLiquidOutline = opt.IsShowOutline
|
||||
s.IsWaveAnimation = opt.IsWaveAnimation
|
||||
}
|
||||
}
|
||||
|
||||
// WithBar3DChartOpts sets the Bar3DChart option.
|
||||
func WithBar3DChartOpts(opt opts.Bar3DChart) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.Shading = opt.Shading
|
||||
}
|
||||
}
|
||||
|
||||
// WithTreeOpts sets the TreeChart option.
|
||||
func WithTreeOpts(opt opts.TreeChart) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.Layout = opt.Layout
|
||||
s.Orient = opt.Orient
|
||||
s.ExpandAndCollapse = opt.ExpandAndCollapse
|
||||
s.InitialTreeDepth = opt.InitialTreeDepth
|
||||
s.Roam = opt.Roam
|
||||
s.Label = opt.Label
|
||||
s.Leaves = opt.Leaves
|
||||
s.Right = opt.Right
|
||||
s.Left = opt.Left
|
||||
s.Top = opt.Top
|
||||
s.Bottom = opt.Bottom
|
||||
s.SymbolKeepAspect = opt.SymbolKeepAspect
|
||||
}
|
||||
}
|
||||
|
||||
// WithTreeMapOpts sets the TreeMapChart options.
|
||||
func WithTreeMapOpts(opt opts.TreeMapChart) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.Animation = opt.Animation
|
||||
s.LeafDepth = opt.LeafDepth
|
||||
s.Roam = opt.Roam
|
||||
s.Levels = opt.Levels
|
||||
s.UpperLabel = opt.UpperLabel
|
||||
s.Right = opt.Right
|
||||
s.Left = opt.Left
|
||||
s.Top = opt.Top
|
||||
s.Bottom = opt.Bottom
|
||||
}
|
||||
}
|
||||
|
||||
// WithWorldCloudChartOpts sets the WorldCloudChart option.
|
||||
func WithWorldCloudChartOpts(opt opts.WordCloudChart) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.Shape = opt.Shape
|
||||
s.SizeRange = opt.SizeRange
|
||||
s.RotationRange = opt.RotationRange
|
||||
}
|
||||
}
|
||||
|
||||
// WithMarkLineNameTypeItemOpts sets the type of the MarkLine.
|
||||
func WithMarkLineNameTypeItemOpts(opt ...opts.MarkLineNameTypeItem) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
if s.MarkLines == nil {
|
||||
s.MarkLines = &opts.MarkLines{}
|
||||
}
|
||||
for _, o := range opt {
|
||||
s.MarkLines.Data = append(s.MarkLines.Data, o)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WithMarkLineStyleOpts sets the style of the MarkLine.
|
||||
func WithMarkLineStyleOpts(opt opts.MarkLineStyle) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
if s.MarkLines == nil {
|
||||
s.MarkLines = &opts.MarkLines{}
|
||||
}
|
||||
|
||||
s.MarkLines.MarkLineStyle = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithMarkLineNameCoordItemOpts sets the coordinates of the MarkLine.
|
||||
func WithMarkLineNameCoordItemOpts(opt ...opts.MarkLineNameCoordItem) SeriesOpts {
|
||||
type MLNameCoord struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Coord []interface{} `json:"coord"`
|
||||
}
|
||||
return func(s *SingleSeries) {
|
||||
if s.MarkLines == nil {
|
||||
s.MarkLines = &opts.MarkLines{}
|
||||
}
|
||||
for _, o := range opt {
|
||||
s.MarkLines.Data = append(
|
||||
s.MarkLines.Data,
|
||||
[]MLNameCoord{{Name: o.Name, Coord: o.Coordinate0}, {Coord: o.Coordinate1}},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WithMarkLineNameXAxisItemOpts sets the X axis of the MarkLine.
|
||||
func WithMarkLineNameXAxisItemOpts(opt ...opts.MarkLineNameXAxisItem) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
if s.MarkLines == nil {
|
||||
s.MarkLines = &opts.MarkLines{}
|
||||
}
|
||||
for _, o := range opt {
|
||||
s.MarkLines.Data = append(s.MarkLines.Data, o)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WithMarkLineNameYAxisItemOpts sets the Y axis of the MarkLine.
|
||||
func WithMarkLineNameYAxisItemOpts(opt ...opts.MarkLineNameYAxisItem) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
if s.MarkLines == nil {
|
||||
s.MarkLines = &opts.MarkLines{}
|
||||
}
|
||||
for _, o := range opt {
|
||||
s.MarkLines.Data = append(s.MarkLines.Data, o)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WithMarkAreaNameTypeItemOpts sets the type of the MarkArea.
|
||||
func WithMarkAreaNameTypeItemOpts(opt ...opts.MarkAreaNameTypeItem) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
if s.MarkAreas == nil {
|
||||
s.MarkAreas = &opts.MarkAreas{}
|
||||
}
|
||||
for _, o := range opt {
|
||||
s.MarkAreas.Data = append(s.MarkAreas.Data, o)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WithMarkAreaStyleOpts sets the style of the MarkArea.
|
||||
func WithMarkAreaStyleOpts(opt opts.MarkAreaStyle) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
if s.MarkAreas == nil {
|
||||
s.MarkAreas = &opts.MarkAreas{}
|
||||
}
|
||||
|
||||
s.MarkAreas.MarkAreaStyle = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithMarkAreaNameCoordItemOpts sets the coordinates of the MarkLine.
|
||||
func WithMarkAreaNameCoordItemOpts(opt ...opts.MarkAreaNameCoordItem) SeriesOpts {
|
||||
type MANameCoord struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
ItemStyle *opts.ItemStyle `json:"itemStyle"`
|
||||
Coord []interface{} `json:"coord"`
|
||||
}
|
||||
return func(s *SingleSeries) {
|
||||
if s.MarkAreas == nil {
|
||||
s.MarkAreas = &opts.MarkAreas{}
|
||||
}
|
||||
for _, o := range opt {
|
||||
s.MarkAreas.Data = append(
|
||||
s.MarkAreas.Data,
|
||||
[]MANameCoord{
|
||||
{Name: o.Name, ItemStyle: o.ItemStyle, Coord: o.Coordinate0},
|
||||
{Coord: o.Coordinate1},
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WithMarkAreaNameXAxisItemOpts sets the X axis of the MarkLine.
|
||||
func WithMarkAreaNameXAxisItemOpts(opt ...opts.MarkAreaNameXAxisItem) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
if s.MarkAreas == nil {
|
||||
s.MarkAreas = &opts.MarkAreas{}
|
||||
}
|
||||
for _, o := range opt {
|
||||
s.MarkAreas.Data = append(s.MarkAreas.Data, o)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WithMarkAreaNameYAxisItemOpts sets the Y axis of the MarkLine.
|
||||
func WithMarkAreaNameYAxisItemOpts(opt ...opts.MarkAreaNameYAxisItem) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
if s.MarkAreas == nil {
|
||||
s.MarkAreas = &opts.MarkAreas{}
|
||||
}
|
||||
for _, o := range opt {
|
||||
s.MarkAreas.Data = append(s.MarkAreas.Data, o)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WithMarkPointNameTypeItemOpts sets the type of the MarkPoint.
|
||||
func WithMarkPointNameTypeItemOpts(opt ...opts.MarkPointNameTypeItem) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
if s.MarkPoints == nil {
|
||||
s.MarkPoints = &opts.MarkPoints{}
|
||||
}
|
||||
for _, o := range opt {
|
||||
s.MarkPoints.Data = append(s.MarkPoints.Data, o)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WithMarkPointStyleOpts sets the style of the MarkPoint.
|
||||
func WithMarkPointStyleOpts(opt opts.MarkPointStyle) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
if s.MarkPoints == nil {
|
||||
s.MarkPoints = &opts.MarkPoints{}
|
||||
}
|
||||
|
||||
s.MarkPoints.MarkPointStyle = opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithMarkPointNameCoordItemOpts sets the coordinated of the MarkPoint.
|
||||
func WithMarkPointNameCoordItemOpts(opt ...opts.MarkPointNameCoordItem) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
if s.MarkPoints == nil {
|
||||
s.MarkPoints = &opts.MarkPoints{}
|
||||
}
|
||||
for _, o := range opt {
|
||||
s.MarkPoints.Data = append(s.MarkPoints.Data, o)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SingleSeries) InitSeriesDefaultOpts(c BaseConfiguration) {
|
||||
opts.SetDefaultValue(s)
|
||||
// some special inherited options from BaseConfiguration
|
||||
s.Animation = c.Animation
|
||||
}
|
||||
|
||||
func (s *SingleSeries) ConfigureSeriesOpts(options ...SeriesOpts) {
|
||||
for _, opt := range options {
|
||||
opt(s)
|
||||
}
|
||||
}
|
||||
|
||||
// MultiSeries represents multiple series.
|
||||
type MultiSeries []SingleSeries
|
||||
|
||||
// SetSeriesOptions sets options for all the series.
|
||||
// Previous options will be overwrote every time hence setting them on the `AddSeries` if you want
|
||||
// to customize each series individually
|
||||
//
|
||||
// here -> ↓ <-
|
||||
//
|
||||
// func (c *Bar) AddSeries(name string, data []opts.BarData, options ...SeriesOpts)
|
||||
func (ms *MultiSeries) SetSeriesOptions(opts ...SeriesOpts) {
|
||||
s := *ms
|
||||
for i := 0; i < len(s); i++ {
|
||||
s[i].ConfigureSeriesOpts(opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// WithEncodeOpts Set encodes for dataSets
|
||||
func WithEncodeOpts(opt opts.Encode) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.Encode = &opt
|
||||
}
|
||||
}
|
||||
|
||||
// WithDatasetIndex sets the datasetIndex option.
|
||||
func WithDatasetIndex(index int) SeriesOpts {
|
||||
return func(s *SingleSeries) {
|
||||
s.DatasetIndex = index
|
||||
}
|
||||
}
|
||||
49
vendor/github.com/go-echarts/go-echarts/v2/charts/sunburst.go
generated
vendored
Normal file
49
vendor/github.com/go-echarts/go-echarts/v2/charts/sunburst.go
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Sunburst represents a sunburst chart.
|
||||
type Sunburst struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Sunburst) Type() string { return types.ChartSunburst }
|
||||
|
||||
// NewSunburst creates a new sunburst chart instance.
|
||||
func NewSunburst() *Sunburst {
|
||||
c := &Sunburst{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds new data sets.
|
||||
func (c *Sunburst) AddSeries(name string, data []opts.SunBurstData, options ...SeriesOpts) *Sunburst {
|
||||
series := SingleSeries{Name: name, Type: types.ChartSunburst, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the Pie instance.
|
||||
func (c *Sunburst) SetGlobalOptions(options ...GlobalOpts) *Sunburst {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the Sunburst instance.
|
||||
func (c *Sunburst) SetDispatchActions(actions ...GlobalActions) *Sunburst {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Sunburst) Validate() {
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
30
vendor/github.com/go-echarts/go-echarts/v2/charts/surface3d.go
generated
vendored
Normal file
30
vendor/github.com/go-echarts/go-echarts/v2/charts/surface3d.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Surface3D represents a 3D surface chart.
|
||||
type Surface3D struct {
|
||||
Chart3D
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Surface3D) Type() string { return types.ChartSurface3D }
|
||||
|
||||
// NewSurface3D creates a new 3d surface chart.
|
||||
func NewSurface3D() *Surface3D {
|
||||
c := &Surface3D{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.initChart3D()
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds the new series.
|
||||
func (c *Surface3D) AddSeries(name string, data []opts.Chart3DData, options ...SeriesOpts) *Surface3D {
|
||||
c.addSeries(types.ChartScatter3D, name, data, options...)
|
||||
return c
|
||||
}
|
||||
54
vendor/github.com/go-echarts/go-echarts/v2/charts/themeriver.go
generated
vendored
Normal file
54
vendor/github.com/go-echarts/go-echarts/v2/charts/themeriver.go
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// ThemeRiver represents a theme river chart.
|
||||
type ThemeRiver struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*ThemeRiver) Type() string { return types.ChartThemeRiver }
|
||||
|
||||
// NewThemeRiver creates a new theme river chart.
|
||||
func NewThemeRiver() *ThemeRiver {
|
||||
c := &ThemeRiver{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.hasSingleAxis = true
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds new data sets.
|
||||
func (c *ThemeRiver) AddSeries(name string, data []opts.ThemeRiverData, options ...SeriesOpts) *ThemeRiver {
|
||||
cd := make([][3]interface{}, len(data))
|
||||
for i := 0; i < len(data); i++ {
|
||||
cd[i] = data[i].ToList()
|
||||
}
|
||||
series := SingleSeries{Name: name, Type: types.ChartThemeRiver, Data: cd}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the ThemeRiver instance.
|
||||
func (c *ThemeRiver) SetGlobalOptions(options ...GlobalOpts) *ThemeRiver {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the ThemeRiver instance.
|
||||
func (c *ThemeRiver) SetDispatchActions(actions ...GlobalActions) *ThemeRiver {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *ThemeRiver) Validate() {
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
49
vendor/github.com/go-echarts/go-echarts/v2/charts/tree.go
generated
vendored
Normal file
49
vendor/github.com/go-echarts/go-echarts/v2/charts/tree.go
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// Tree represents a Tree chart.
|
||||
type Tree struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*Tree) Type() string { return types.ChartTree }
|
||||
|
||||
// NewTree creates a new Tree chart instance.
|
||||
func NewTree() *Tree {
|
||||
c := &Tree{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds new data sets.
|
||||
func (c *Tree) AddSeries(name string, data []opts.TreeData, options ...SeriesOpts) *Tree {
|
||||
series := SingleSeries{Name: name, Type: types.ChartTree, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the Tree instance.
|
||||
func (c *Tree) SetGlobalOptions(options ...GlobalOpts) *Tree {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the Tree instance.
|
||||
func (c *Tree) SetDispatchActions(actions ...GlobalActions) *Tree {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *Tree) Validate() {
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
49
vendor/github.com/go-echarts/go-echarts/v2/charts/treemap.go
generated
vendored
Normal file
49
vendor/github.com/go-echarts/go-echarts/v2/charts/treemap.go
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// TreeMap represents a TreeMap chart.
|
||||
type TreeMap struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*TreeMap) Type() string { return types.ChartTreeMap }
|
||||
|
||||
// NewTreeMap creates a new TreeMap chart instance.
|
||||
func NewTreeMap() *TreeMap {
|
||||
c := &TreeMap{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds new data sets.
|
||||
func (c *TreeMap) AddSeries(name string, data []opts.TreeMapNode, options ...SeriesOpts) *TreeMap {
|
||||
series := SingleSeries{Name: name, Type: types.ChartTreeMap, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the TreeMap instance.
|
||||
func (c *TreeMap) SetGlobalOptions(options ...GlobalOpts) *TreeMap {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the TreeMap instance.
|
||||
func (c *TreeMap) SetDispatchActions(actions ...GlobalActions) *TreeMap {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *TreeMap) Validate() {
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
67
vendor/github.com/go-echarts/go-echarts/v2/charts/wordcloud.go
generated
vendored
Normal file
67
vendor/github.com/go-echarts/go-echarts/v2/charts/wordcloud.go
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"github.com/go-echarts/go-echarts/v2/opts"
|
||||
"github.com/go-echarts/go-echarts/v2/render"
|
||||
"github.com/go-echarts/go-echarts/v2/types"
|
||||
)
|
||||
|
||||
// WordCloud represents a word cloud chart.
|
||||
type WordCloud struct {
|
||||
BaseConfiguration
|
||||
BaseActions
|
||||
}
|
||||
|
||||
// Type returns the chart type.
|
||||
func (*WordCloud) Type() string { return types.ChartWordCloud }
|
||||
|
||||
var wcTextColor = `function () {
|
||||
return 'rgb(' + [
|
||||
Math.round(Math.random() * 160),
|
||||
Math.round(Math.random() * 160),
|
||||
Math.round(Math.random() * 160)].join(',') + ')';
|
||||
}`
|
||||
|
||||
// NewWordCloud creates a new word cloud chart.
|
||||
func NewWordCloud() *WordCloud {
|
||||
c := &WordCloud{}
|
||||
c.initBaseConfiguration()
|
||||
c.Renderer = render.NewChartRender(c, c.Validate)
|
||||
c.JSAssets.Add(opts.CompatibleEchartsJS)
|
||||
c.JSAssets.Add("echarts-wordcloud.min.js")
|
||||
return c
|
||||
}
|
||||
|
||||
// AddSeries adds new data sets.
|
||||
func (c *WordCloud) AddSeries(name string, data []opts.WordCloudData, options ...SeriesOpts) *WordCloud {
|
||||
series := SingleSeries{Name: name, Type: types.ChartWordCloud, Data: data}
|
||||
series.ConfigureSeriesOpts(options...)
|
||||
|
||||
// set default random color for WordCloud chart
|
||||
if series.TextStyle == nil {
|
||||
series.TextStyle = &opts.TextStyle{Normal: &opts.TextStyle{}}
|
||||
}
|
||||
if series.TextStyle.Normal.Color == "" {
|
||||
series.TextStyle.Normal.Color = opts.FuncOpts(wcTextColor)
|
||||
}
|
||||
|
||||
c.MultiSeries = append(c.MultiSeries, series)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetGlobalOptions sets options for the WordCloud instance.
|
||||
func (c *WordCloud) SetGlobalOptions(options ...GlobalOpts) *WordCloud {
|
||||
c.BaseConfiguration.setBaseGlobalOptions(options...)
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDispatchActions sets actions for the WordCloud instance.
|
||||
func (c *WordCloud) SetDispatchActions(actions ...GlobalActions) *WordCloud {
|
||||
c.BaseActions.setBaseGlobalActions(actions...)
|
||||
return c
|
||||
}
|
||||
|
||||
// Validate validates the given configuration.
|
||||
func (c *WordCloud) Validate() {
|
||||
c.Assets.Validate(c.AssetsHost)
|
||||
}
|
||||
3755
vendor/github.com/go-echarts/go-echarts/v2/datasets/coordinates.go
generated
vendored
Normal file
3755
vendor/github.com/go-echarts/go-echarts/v2/datasets/coordinates.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
404
vendor/github.com/go-echarts/go-echarts/v2/datasets/mapfiles.go
generated
vendored
Normal file
404
vendor/github.com/go-echarts/go-echarts/v2/datasets/mapfiles.go
generated
vendored
Normal file
@@ -0,0 +1,404 @@
|
||||
package datasets
|
||||
|
||||
var MapFileNames = map[string]string{
|
||||
"china": "china",
|
||||
"world": "world",
|
||||
"广东": "guangdong",
|
||||
"安徽": "anhui",
|
||||
"福建": "fujian",
|
||||
"甘肃": "gansu",
|
||||
"广西": "guangxi",
|
||||
"贵州": "guizhou",
|
||||
"海南": "hainan",
|
||||
"河北": "hebei",
|
||||
"黑龙江": "heilongjiang",
|
||||
"河南": "henan",
|
||||
"湖北": "hubei",
|
||||
"湖南": "hunan",
|
||||
"江苏": "jiangsu",
|
||||
"江西": "jiangxi",
|
||||
"吉林": "jilin",
|
||||
"辽宁": "liaoning",
|
||||
"内蒙古": "neimenggu",
|
||||
"宁夏": "ningxia",
|
||||
"青海": "qinghai",
|
||||
"山东": "shandong",
|
||||
"山西": "shanxi",
|
||||
"陕西": "shanxi1",
|
||||
"四川": "sichuan",
|
||||
"台湾": "taiwan",
|
||||
"新疆": "xinjiang",
|
||||
"西藏": "xizang",
|
||||
"云南": "yunnan",
|
||||
"浙江": "zhejiang",
|
||||
"七台河": "hei1_long2_jiang1_qi1_tai2_he2",
|
||||
"万宁": "hai3_nan2_wan4_ning2",
|
||||
"三亚": "hai3_nan2_san1_ya4",
|
||||
"三明": "fu2_jian4_san1_ming2",
|
||||
"三沙": "hai3_nan2_san1_sha1",
|
||||
"三门峡": "he2_nan2_san1_men2_xia2",
|
||||
"上海": "shanghai",
|
||||
"上饶": "jiang1_xi1_shang4_rao2",
|
||||
"东方": "hai3_nan2_dong1_fang1",
|
||||
"东沙群岛": "guang3_dong1_dong1_sha1_qun2_dao3",
|
||||
"东莞": "guang3_dong1_dong1_guan1",
|
||||
"东营": "shan1_dong1_dong1_ying2",
|
||||
"中卫": "ning2_xia4_zhong1_wei4",
|
||||
"中山": "guang3_dong1_zhong1_shan1",
|
||||
"临夏回族自治州": "gan1_su4_lin2_xia4_hui2_zu2_zi4_zhi4_zhou1",
|
||||
"临汾": "shan1_xi1_lin2_fen2",
|
||||
"临沂": "shan1_dong1_lin2_yi2",
|
||||
"临沧": "yun2_nan2_lin2_cang1",
|
||||
"临高县": "hai3_nan2_lin2_gao1_xian4",
|
||||
"丹东": "liao2_ning2_dan1_dong1",
|
||||
"丽水": "zhe4_jiang1_li4_shui3",
|
||||
"丽江": "yun2_nan2_li4_jiang1",
|
||||
"乌兰察布": "nei4_meng2_gu3_wu1_lan2_cha2_bu4",
|
||||
"乌海": "nei4_meng2_gu3_wu1_hai3",
|
||||
"乌鲁木齐": "xin1_jiang1_wu1_lu3_mu4_qi2",
|
||||
"乐东黎族自治县": "hai3_nan2_le4_dong1_li2_zu2_zi4_zhi4_xian4",
|
||||
"乐山": "si4_chuan1_le4_shan1",
|
||||
"九江": "jiang1_xi1_jiu3_jiang1",
|
||||
"云浮": "guang3_dong1_yun2_fu2",
|
||||
"五家渠": "xin1_jiang1_wu3_jia1_qu2",
|
||||
"五指山": "hai3_nan2_wu3_zhi3_shan1",
|
||||
"亳州": "an1_hui1_bo2_zhou1",
|
||||
"仙桃": "hu2_bei3_xian1_tao2",
|
||||
"伊春": "hei1_long2_jiang1_yi1_chun1",
|
||||
"伊犁哈萨克自治州": "xin1_jiang1_yi1_li2_ha1_sa4_ke4_zi4_zhi4_zhou1",
|
||||
"佛山": "guang3_dong1_fo2_shan1",
|
||||
"佳木斯": "hei1_long2_jiang1_jia1_mu4_si1",
|
||||
"保亭黎族苗族自治县": "hai3_nan2_bao3_ting2_li2_zu2_miao2_zu2_zi4_zhi4_xian4",
|
||||
"保定": "he2_bei3_bao3_ding4",
|
||||
"保山": "yun2_nan2_bao3_shan1",
|
||||
"信阳": "he2_nan2_xin4_yang2",
|
||||
"儋州": "hai3_nan2_dan1_zhou1",
|
||||
"克孜勒苏柯尔克孜自治州": "xin1_jiang1_ke4_zi1_le4_su1_ke1_er3_ke4_zi1_zi4_zhi4_zhou1",
|
||||
"克拉玛依": "xin1_jiang1_ke4_la1_ma3_yi1",
|
||||
"六安": "an1_hui1_liu4_an1",
|
||||
"六盘水": "gui4_zhou1_liu4_pan2_shui3",
|
||||
"兰州": "gan1_su4_lan2_zhou1",
|
||||
"兴安盟": "nei4_meng2_gu3_xing1_an1_meng2",
|
||||
"内江": "si4_chuan1_nei4_jiang1",
|
||||
"凉山彝族自治州": "si4_chuan1_liang2_shan1_yi2_zu2_zi4_zhi4_zhou1",
|
||||
"包头": "nei4_meng2_gu3_bao1_tou2",
|
||||
"北京": "beijing",
|
||||
"北屯": "xin1_jiang1_bei3_tun2",
|
||||
"北海": "guang3_xi1_bei3_hai3",
|
||||
"十堰": "hu2_bei3_shi2_yan4",
|
||||
"南京": "jiang1_su1_nan2_jing1",
|
||||
"南充": "si4_chuan1_nan2_chong1",
|
||||
"南宁": "guang3_xi1_nan2_ning2",
|
||||
"南平": "fu2_jian4_nan2_ping2",
|
||||
"南昌": "jiang1_xi1_nan2_chang1",
|
||||
"南通": "jiang1_su1_nan2_tong1",
|
||||
"南阳": "he2_nan2_nan2_yang2",
|
||||
"博尔塔拉蒙古自治州": "xin1_jiang1_bo2_er3_ta3_la1_meng2_gu3_zi4_zhi4_zhou1",
|
||||
"厦门": "fu2_jian4_sha4_men2",
|
||||
"双河": "xin1_jiang1_shuang1_he2",
|
||||
"双鸭山": "hei1_long2_jiang1_shuang1_ya1_shan1",
|
||||
"可克达拉": "xin1_jiang1_ke3_ke4_da2_la1",
|
||||
"台州": "zhe4_jiang1_tai2_zhou1",
|
||||
"合肥": "an1_hui1_he2_fei2",
|
||||
"吉安": "jiang1_xi1_ji2_an1",
|
||||
"吉林市": "ji2_lin2_ji2_lin2",
|
||||
"吐鲁番": "xin1_jiang1_tu3_lu3_fan1",
|
||||
"吕梁": "shan1_xi1_lv3_liang2",
|
||||
"吴忠": "ning2_xia4_wu2_zhong1",
|
||||
"周口": "he2_nan2_zhou1_kou3",
|
||||
"呼伦贝尔": "nei4_meng2_gu3_hu1_lun2_bei4_er3",
|
||||
"呼和浩特": "nei4_meng2_gu3_hu1_he2_hao4_te4",
|
||||
"和田地区": "xin1_jiang1_he2_tian2_di4_qu1",
|
||||
"咸宁": "hu2_bei3_xian2_ning2",
|
||||
"咸阳": "shan3_xi1_xian2_yang2",
|
||||
"哈密": "xin1_jiang1_ha1_mi4",
|
||||
"哈尔滨": "hei1_long2_jiang1_ha1_er3_bin1",
|
||||
"唐山": "he2_bei3_tang2_shan1",
|
||||
"商丘": "he2_nan2_shang1_qiu1",
|
||||
"商洛": "shan3_xi1_shang1_luo4",
|
||||
"喀什地区": "xin1_jiang1_ka1_shi2_di4_qu1",
|
||||
"嘉兴": "zhe4_jiang1_jia1_xing1",
|
||||
"嘉峪关": "gan1_su4_jia1_yu4_guan1",
|
||||
"四平": "ji2_lin2_si4_ping2",
|
||||
"固原": "ning2_xia4_gu4_yuan2",
|
||||
"图木舒克": "xin1_jiang1_tu2_mu4_shu1_ke4",
|
||||
"塔城地区": "xin1_jiang1_ta3_cheng2_di4_qu1",
|
||||
"大兴安岭地区": "hei1_long2_jiang1_da4_xing1_an1_ling2_di4_qu1",
|
||||
"大同": "shan1_xi1_da4_tong2",
|
||||
"大庆": "hei1_long2_jiang1_da4_qing4",
|
||||
"大理白族自治州": "yun2_nan2_da4_li3_bai2_zu2_zi4_zhi4_zhou1",
|
||||
"大连": "liao2_ning2_da4_lian2",
|
||||
"天水": "gan1_su4_tian1_shui3",
|
||||
"天津": "tianjin",
|
||||
"天门": "hu2_bei3_tian1_men2",
|
||||
"太原": "shan1_xi1_tai4_yuan2",
|
||||
"威海": "shan1_dong1_wei1_hai3",
|
||||
"娄底": "hu2_nan2_lou2_di3",
|
||||
"孝感": "hu2_bei3_xiao4_gan3",
|
||||
"宁德": "fu2_jian4_ning2_de2",
|
||||
"宁波": "zhe4_jiang1_ning2_bo1",
|
||||
"安庆": "an1_hui1_an1_qing4",
|
||||
"安康": "shan3_xi1_an1_kang1",
|
||||
"安阳": "he2_nan2_an1_yang2",
|
||||
"安顺": "gui4_zhou1_an1_shun4",
|
||||
"定安县": "hai3_nan2_ding4_an1_xian4",
|
||||
"定西": "gan1_su4_ding4_xi1",
|
||||
"宜宾": "si4_chuan1_yi2_bin1",
|
||||
"宜昌": "hu2_bei3_yi2_chang1",
|
||||
"宜春": "jiang1_xi1_yi2_chun1",
|
||||
"宝鸡": "shan3_xi1_bao3_ji1",
|
||||
"宣城": "an1_hui1_xuan1_cheng2",
|
||||
"宿州": "an1_hui1_su4_zhou1",
|
||||
"宿迁": "jiang1_su1_su4_qian1",
|
||||
"屯昌县": "hai3_nan2_tun2_chang1_xian4",
|
||||
"山南": "xi1_cang2_shan1_nan2",
|
||||
"岳阳": "hu2_nan2_yue4_yang2",
|
||||
"崇左": "guang3_xi1_chong2_zuo3",
|
||||
"巴中": "si4_chuan1_ba1_zhong1",
|
||||
"巴彦淖尔": "nei4_meng2_gu3_ba1_yan4_nao4_er3",
|
||||
"巴音郭楞蒙古自治州": "xin1_jiang1_ba1_yin1_guo1_leng2_meng2_gu3_zi4_zhi4_zhou1",
|
||||
"常州": "jiang1_su1_chang2_zhou1",
|
||||
"常德": "hu2_nan2_chang2_de2",
|
||||
"平凉": "gan1_su4_ping2_liang2",
|
||||
"平顶山": "he2_nan2_ping2_ding3_shan1",
|
||||
"广元": "si4_chuan1_guang3_yuan2",
|
||||
"广安": "si4_chuan1_guang3_an1",
|
||||
"广州": "guang3_dong1_guang3_zhou1",
|
||||
"庆阳": "gan1_su4_qing4_yang2",
|
||||
"廊坊": "he2_bei3_lang2_fang1",
|
||||
"延安": "shan3_xi1_yan2_an1",
|
||||
"延边朝鲜族自治州": "ji2_lin2_yan2_bian1_zhao1_xian1_zu2_zi4_zhi4_zhou1",
|
||||
"开封": "he2_nan2_kai1_feng1",
|
||||
"张家口": "he2_bei3_zhang1_jia1_kou3",
|
||||
"张家界": "hu2_nan2_zhang1_jia1_jie4",
|
||||
"张掖": "gan1_su4_zhang1_ye4",
|
||||
"徐州": "jiang1_su1_xu2_zhou1",
|
||||
"德宏傣族景颇族自治州": "yun2_nan2_de2_hong2_dai3_zu2_jing3_po3_zu2_zi4_zhi4_zhou1",
|
||||
"德州": "shan1_dong1_de2_zhou1",
|
||||
"德阳": "si4_chuan1_de2_yang2",
|
||||
"忻州": "shan1_xi1_xin1_zhou1",
|
||||
"怀化": "hu2_nan2_huai2_hua4",
|
||||
"怒江傈僳族自治州": "yun2_nan2_nu4_jiang1_li4_su4_zu2_zi4_zhi4_zhou1",
|
||||
"恩施土家族苗族自治州": "hu2_bei3_en1_shi1_tu3_jia1_zu2_miao2_zu2_zi4_zhi4_zhou1",
|
||||
"惠州": "guang3_dong1_hui4_zhou1",
|
||||
"成都": "si4_chuan1_cheng2_du1",
|
||||
"扬州": "jiang1_su1_yang2_zhou1",
|
||||
"承德": "he2_bei3_cheng2_de2",
|
||||
"抚州": "jiang1_xi1_fu3_zhou1",
|
||||
"抚顺": "liao2_ning2_fu3_shun4",
|
||||
"拉萨": "xi1_cang2_la1_sa4",
|
||||
"揭阳": "guang3_dong1_jie1_yang2",
|
||||
"攀枝花": "si4_chuan1_pan1_zhi1_hua1",
|
||||
"文山壮族苗族自治州": "yun2_nan2_wen2_shan1_zhuang4_zu2_miao2_zu2_zi4_zhi4_zhou1",
|
||||
"文昌": "hai3_nan2_wen2_chang1",
|
||||
"新乡": "he2_nan2_xin1_xiang1",
|
||||
"新余": "jiang1_xi1_xin1_yu2",
|
||||
"无锡": "jiang1_su1_wu2_xi2",
|
||||
"日喀则": "xi1_cang2_ri4_ka1_ze2",
|
||||
"日照": "shan1_dong1_ri4_zhao4",
|
||||
"昆明": "yun2_nan2_kun1_ming2",
|
||||
"昆玉": "xin1_jiang1_kun1_yu4",
|
||||
"昌吉回族自治州": "xin1_jiang1_chang1_ji2_hui2_zu2_zi4_zhi4_zhou1",
|
||||
"昌江黎族自治县": "hai3_nan2_chang1_jiang1_li2_zu2_zi4_zhi4_xian4",
|
||||
"昌都": "xi1_cang2_chang1_du1",
|
||||
"昭通": "yun2_nan2_zhao1_tong1",
|
||||
"晋中": "shan1_xi1_jin4_zhong1",
|
||||
"晋城": "shan1_xi1_jin4_cheng2",
|
||||
"普洱": "yun2_nan2_pu3_er3",
|
||||
"景德镇": "jiang1_xi1_jing3_de2_zhen4",
|
||||
"曲靖": "yun2_nan2_qu1_jing4",
|
||||
"朔州": "shan1_xi1_shuo4_zhou1",
|
||||
"朝阳": "liao2_ning2_zhao1_yang2",
|
||||
"本溪": "liao2_ning2_ben3_xi1",
|
||||
"来宾": "guang3_xi1_lai2_bin1",
|
||||
"杭州": "zhe4_jiang1_hang2_zhou1",
|
||||
"松原": "ji2_lin2_song1_yuan2",
|
||||
"林芝": "xi1_cang2_lin2_zhi1",
|
||||
"果洛藏族自治州": "qing1_hai3_guo3_luo4_cang2_zu2_zi4_zhi4_zhou1",
|
||||
"枣庄": "shan1_dong1_zao3_zhuang1",
|
||||
"柳州": "guang3_xi1_liu3_zhou1",
|
||||
"株洲": "hu2_nan2_zhu1_zhou1",
|
||||
"桂林": "guang3_xi1_gui4_lin2",
|
||||
"梅州": "guang3_dong1_mei2_zhou1",
|
||||
"梧州": "guang3_xi1_wu2_zhou1",
|
||||
"楚雄彝族自治州": "yun2_nan2_chu3_xiong2_yi2_zu2_zi4_zhi4_zhou1",
|
||||
"榆林": "shan3_xi1_yu2_lin2",
|
||||
"武威": "gan1_su4_wu3_wei1",
|
||||
"武汉": "hu2_bei3_wu3_han4",
|
||||
"毕节": "gui4_zhou1_bi4_jie2",
|
||||
"永州": "hu2_nan2_yong3_zhou1",
|
||||
"汉中": "shan3_xi1_han4_zhong1",
|
||||
"汕头": "guang3_dong1_shan4_tou2",
|
||||
"汕尾": "guang3_dong1_shan4_wei3",
|
||||
"江门": "guang3_dong1_jiang1_men2",
|
||||
"池州": "an1_hui1_chi2_zhou1",
|
||||
"沈阳": "liao2_ning2_shen3_yang2",
|
||||
"沧州": "he2_nan2_cang1_zhou1",
|
||||
"河池": "guang3_xi1_he2_chi2",
|
||||
"河源": "guang3_dong1_he2_yuan2",
|
||||
"泉州": "fu2_jian4_quan2_zhou1",
|
||||
"泰安": "shan1_dong1_tai4_an1",
|
||||
"泰州": "jiang1_su1_tai4_zhou1",
|
||||
"泸州": "si4_chuan1_lu2_zhou1",
|
||||
"洛阳": "he2_nan2_luo4_yang2",
|
||||
"济南": "shan1_dong1_ji4_nan2",
|
||||
"济宁": "shan1_dong1_ji4_ning2",
|
||||
"济源": "he2_nan2_ji4_yuan2",
|
||||
"海东": "qing1_hai3_hai3_dong1",
|
||||
"海北藏族自治州": "qing1_hai3_hai3_bei3_cang2_zu2_zi4_zhi4_zhou1",
|
||||
"海南藏族自治州": "qing1_hai3_hai3_nan2_cang2_zu2_zi4_zhi4_zhou1",
|
||||
"海口": "hai3_nan2_hai3_kou3",
|
||||
"海西蒙古族藏族自治州": "qing1_hai3_hai3_xi1_meng2_gu3_zu2_cang2_zu2_zi4_zhi4_zhou1",
|
||||
"淄博": "shan1_dong1_zi1_bo2",
|
||||
"淮北": "an1_hui1_huai2_bei3",
|
||||
"淮南": "an1_hui1_huai2_nan2",
|
||||
"淮安": "jiang1_su1_huai2_an1",
|
||||
"深圳": "guang3_dong1_shen1_zhen4",
|
||||
"清远": "guang3_dong1_qing1_yuan3",
|
||||
"温州": "zhe4_jiang1_wen1_zhou1",
|
||||
"渭南": "shan3_xi1_wei4_nan2",
|
||||
"湖州": "zhe4_jiang1_hu2_zhou1",
|
||||
"湘潭": "hu2_nan2_xiang1_tan2",
|
||||
"湘西土家族苗族自治州": "hu2_nan2_xiang1_xi1_tu3_jia1_zu2_miao2_zu2_zi4_zhi4_zhou1",
|
||||
"湛江": "guang3_dong1_zhan4_jiang1",
|
||||
"滁州": "an1_hui1_chu2_zhou1",
|
||||
"滨州": "shan1_dong1_bin1_zhou1",
|
||||
"漯河": "he2_nan2_ta4_he2",
|
||||
"漳州": "fu2_jian4_zhang1_zhou1",
|
||||
"潍坊": "shan1_dong1_wei2_fang1",
|
||||
"潜江": "hu2_bei3_qian2_jiang1",
|
||||
"潮州": "guang3_dong1_chao2_zhou1",
|
||||
"澄迈县": "hai3_nan2_cheng2_mai4_xian4",
|
||||
"澳门": "aomen",
|
||||
"濮阳": "he2_nan2_pu2_yang2",
|
||||
"烟台": "shan1_dong1_yan1_tai2",
|
||||
"焦作": "he2_nan2_jiao1_zuo4",
|
||||
"牡丹江": "hei1_long2_jiang1_mu3_dan1_jiang1",
|
||||
"玉林": "guang3_xi1_yu4_lin2",
|
||||
"玉树藏族自治州": "qing1_hai3_yu4_shu4_cang2_zu2_zi4_zhi4_zhou1",
|
||||
"玉溪": "yun2_nan2_yu4_xi1",
|
||||
"珠海": "guang3_dong1_zhu1_hai3",
|
||||
"琼中黎族苗族自治县": "hai3_nan2_qiong2_zhong1_li2_zu2_miao2_zu2_zi4_zhi4_xian4",
|
||||
"琼海": "hai3_nan2_qiong2_hai3",
|
||||
"甘南藏族自治州": "gan1_su4_gan1_nan2_cang2_zu2_zi4_zhi4_zhou1",
|
||||
"甘孜藏族自治州": "si4_chuan1_gan1_zi1_cang2_zu2_zi4_zhi4_zhou1",
|
||||
"白城": "ji2_lin2_bai2_cheng2",
|
||||
"白山": "ji2_lin2_bai2_shan1",
|
||||
"白沙黎族自治县": "hai3_nan2_bai2_sha1_li2_zu2_zi4_zhi4_xian4",
|
||||
"白银": "gan1_su4_bai2_yin2",
|
||||
"百色": "guang3_xi1_bai3_se4",
|
||||
"益阳": "hu2_nan2_yi4_yang2",
|
||||
"盐城": "jiang1_su1_yan2_cheng2",
|
||||
"盘锦": "liao2_ning2_pan2_jin3",
|
||||
"眉山": "si4_chuan1_mei2_shan1",
|
||||
"石嘴山": "ning2_xia4_shi2_zui3_shan1",
|
||||
"石家庄": "he2_bei3_shi2_jia1_zhuang1",
|
||||
"石河子": "xin1_jiang1_shi2_he2_zi3",
|
||||
"神农架林区": "hu2_bei3_shen2_nong2_jia4_lin2_qu1",
|
||||
"福州": "fu2_jian4_fu2_zhou1",
|
||||
"秦皇岛": "he2_bei3_qin2_huang2_dao3",
|
||||
"红河哈尼族彝族自治州": "yun2_nan2_hong2_he2_ha1_ni2_zu2_yi2_zu2_zi4_zhi4_zhou1",
|
||||
"绍兴": "zhe4_jiang1_shao4_xing1",
|
||||
"绥化": "hei1_long2_jiang1_sui1_hua4",
|
||||
"绵阳": "si4_chuan1_mian2_yang2",
|
||||
"聊城": "shan1_dong1_liao2_cheng2",
|
||||
"肇庆": "guang3_dong1_zhao4_qing4",
|
||||
"自贡": "si4_chuan1_zi4_gong4",
|
||||
"舟山": "zhe4_jiang1_zhou1_shan1",
|
||||
"芜湖": "an1_hui1_wu2_hu2",
|
||||
"苏州": "jiang1_su1_su1_zhou1",
|
||||
"茂名": "guang3_dong1_mao4_ming2",
|
||||
"荆州": "hu2_bei3_jing1_zhou1",
|
||||
"荆门": "hu2_bei3_jing1_men2",
|
||||
"莆田": "fu2_jian4_fu3_tian2",
|
||||
"莱芜": "shan1_dong1_lai2_wu2",
|
||||
"菏泽": "shan1_dong1_he2_ze2",
|
||||
"萍乡": "jiang1_xi1_ping2_xiang1",
|
||||
"营口": "liao2_ning2_ying2_kou3",
|
||||
"葫芦岛": "liao2_ning2_hu2_lu2_dao3",
|
||||
"蚌埠": "an1_hui1_bang4_bu4",
|
||||
"衡水": "he2_bei3_heng2_shui3",
|
||||
"衡阳": "hu2_nan2_heng2_yang2",
|
||||
"衢州": "zhe4_jiang1_qu2_zhou1",
|
||||
"襄阳": "hu2_bei3_xiang1_yang2",
|
||||
"西双版纳傣族自治州": "yun2_nan2_xi1_shuang1_ban3_na4_dai3_zu2_zi4_zhi4_zhou1",
|
||||
"西宁": "qing1_hai3_xi1_ning2",
|
||||
"西安": "shan3_xi1_xi1_an1",
|
||||
"许昌": "he2_nan2_xu3_chang1",
|
||||
"贵港": "guang3_xi1_gui4_gang3",
|
||||
"贵阳": "gui4_zhou1_gui4_yang2",
|
||||
"贺州": "guang3_xi1_he4_zhou1",
|
||||
"资阳": "si4_chuan1_zi1_yang2",
|
||||
"赣州": "jiang1_xi1_gan4_zhou1",
|
||||
"赤峰": "nei4_meng2_gu3_chi4_feng1",
|
||||
"辽源": "ji2_lin2_liao2_yuan2",
|
||||
"辽阳": "liao2_ning2_liao2_yang2",
|
||||
"达州": "si4_chuan1_da2_zhou1",
|
||||
"运城": "shan1_xi1_yun4_cheng2",
|
||||
"连云港": "jiang1_su1_lian2_yun2_gang3",
|
||||
"迪庆藏族自治州": "yun2_nan2_di2_qing4_cang2_zu2_zi4_zhi4_zhou1",
|
||||
"通化": "ji2_lin2_tong1_hua4",
|
||||
"通辽": "nei4_meng2_gu3_tong1_liao2",
|
||||
"遂宁": "si4_chuan1_sui4_ning2",
|
||||
"遵义": "gui4_zhou1_zun1_yi4",
|
||||
"邢台": "he2_bei3_xing2_tai2",
|
||||
"那曲地区": "xi1_cang2_na4_qu1_di4_qu1",
|
||||
"邯郸": "he2_bei3_han2_dan1",
|
||||
"邵阳": "hu2_nan2_shao4_yang2",
|
||||
"郑州": "he2_nan2_zheng4_zhou1",
|
||||
"郴州": "hu2_nan2_chen1_zhou1",
|
||||
"鄂尔多斯": "nei4_meng2_gu3_e4_er3_duo1_si1",
|
||||
"鄂州": "hu2_bei3_e4_zhou1",
|
||||
"酒泉": "gan1_su4_jiu3_quan2",
|
||||
"重庆": "chongqing",
|
||||
"金华": "zhe4_jiang1_jin1_hua2",
|
||||
"金昌": "gan1_su4_jin1_chang1",
|
||||
"钦州": "guang3_xi1_qin1_zhou1",
|
||||
"铁岭": "liao2_ning2_tie3_ling2",
|
||||
"铁门关": "xin1_jiang1_tie3_men2_guan1",
|
||||
"铜仁": "gui4_zhou1_tong2_ren2",
|
||||
"铜川": "shan3_xi1_tong2_chuan1",
|
||||
"铜陵": "an1_hui1_tong2_ling2",
|
||||
"银川": "ning2_xia4_yin2_chuan1",
|
||||
"锡林郭勒盟": "nei4_meng2_gu3_xi2_lin2_guo1_le4_meng2",
|
||||
"锦州": "liao2_ning2_jin3_zhou1",
|
||||
"镇江": "jiang1_su1_zhen4_jiang1",
|
||||
"长春": "ji2_lin2_chang2_chun1",
|
||||
"长沙": "hu2_nan2_chang2_sha1",
|
||||
"长治": "shan1_xi1_chang2_zhi4",
|
||||
"阜新": "liao2_ning2_fu4_xin1",
|
||||
"阜阳": "an1_hui1_fu4_yang2",
|
||||
"防城港": "guang3_xi1_fang2_cheng2_gang3",
|
||||
"阳江": "guang3_dong1_yang2_jiang1",
|
||||
"阳泉": "shan1_xi1_yang2_quan2",
|
||||
"阿克苏地区": "xin1_jiang1_a1_ke4_su1_di4_qu1",
|
||||
"阿勒泰地区": "xin1_jiang1_a1_le4_tai4_di4_qu1",
|
||||
"阿坝藏族羌族自治州": "si4_chuan1_a1_ba4_cang2_zu2_qiang1_zu2_zi4_zhi4_zhou1",
|
||||
"阿拉善盟": "nei4_meng2_gu3_a1_la1_shan4_meng2",
|
||||
"阿拉尔": "xin1_jiang1_a1_la1_er3",
|
||||
"阿里地区": "xi1_cang2_a1_li3_di4_qu1",
|
||||
"陇南": "gan1_su4_long3_nan2",
|
||||
"陵水黎族自治县": "hai3_nan2_ling2_shui3_li2_zu2_zi4_zhi4_xian4",
|
||||
"随州": "hu2_bei3_sui2_zhou1",
|
||||
"雅安": "si4_chuan1_ya3_an1",
|
||||
"青岛": "shan1_dong1_qing1_dao3",
|
||||
"鞍山": "liao2_ning2_an1_shan1",
|
||||
"韶关": "guang3_dong1_shao2_guan1",
|
||||
"香港": "xianggang",
|
||||
"马鞍山": "an1_hui1_ma3_an1_shan1",
|
||||
"驻马店": "he2_nan2_zhu4_ma3_dian4",
|
||||
"鸡西": "hei1_long2_jiang1_ji1_xi1",
|
||||
"鹤壁": "he2_nan2_he4_bi4",
|
||||
"鹤岗": "hei1_long2_jiang1_he4_gang3",
|
||||
"鹰潭": "jiang1_xi1_ying1_tan2",
|
||||
"黄冈": "hu2_bei3_huang2_gang1",
|
||||
"黄南藏族自治州": "qing1_hai3_huang2_nan2_cang2_zu2_zi4_zhi4_zhou1",
|
||||
"黄山": "an1_hui1_huang2_shan1",
|
||||
"黄石": "hu2_bei3_huang2_shi2",
|
||||
"黑河": "hei1_long2_jiang1_hei1_he2",
|
||||
"黔东南苗族侗族自治州": "gui4_zhou1_qian2_dong1_nan2_miao2_zu2_tong1_zu2_zi4_zhi4_zhou1",
|
||||
"黔南布依族苗族自治州": "gui4_zhou1_qian2_nan2_bu4_yi1_zu2_miao2_zu2_zi4_zhi4_zhou1",
|
||||
"黔西南布依族苗族自治州": "gui4_zhou1_qian2_xi1_nan2_bu4_yi1_zu2_miao2_zu2_zi4_zhi4_zhou1",
|
||||
"齐齐哈尔": "hei1_long2_jiang1_qi2_qi2_ha1_er3",
|
||||
"龙岩": "fu2_jian4_long2_yan2",
|
||||
}
|
||||
738
vendor/github.com/go-echarts/go-echarts/v2/opts/charts.go
generated
vendored
Normal file
738
vendor/github.com/go-echarts/go-echarts/v2/opts/charts.go
generated
vendored
Normal file
@@ -0,0 +1,738 @@
|
||||
package opts
|
||||
|
||||
// BarChart
|
||||
// https://echarts.apache.org/en/option.html#series-bar
|
||||
type BarChart struct {
|
||||
Type string
|
||||
// Name of stack. On the same category axis, the series with the
|
||||
// same stack name would be put on top of each other.
|
||||
Stack string
|
||||
|
||||
// The gap between bars between different series, is a percent value like '30%',
|
||||
// which means 30% of the bar width.
|
||||
// Set barGap as '-100%' can overlap bars that belong to different series,
|
||||
// which is useful when putting a series of bar as background.
|
||||
// In a single coordinate system, this attribute is shared by multiple 'bar' series.
|
||||
// This attribute should be set on the last 'bar' series in the coordinate system,
|
||||
// then it will be adopted by all 'bar' series in the coordinate system.
|
||||
BarGap string
|
||||
|
||||
// The bar gap of a single series, defaults to be 20% of the category gap,
|
||||
// can be set as a fixed value.
|
||||
// In a single coordinate system, this attribute is shared by multiple 'bar' series.
|
||||
// This attribute should be set on the last 'bar' series in the coordinate system,
|
||||
// then it will be adopted by all 'bar' series in the coordinate system.
|
||||
BarCategoryGap string
|
||||
|
||||
// Index of x axis to combine with, which is useful for multiple x axes in one chart.
|
||||
XAxisIndex int
|
||||
|
||||
// Index of y axis to combine with, which is useful for multiple y axes in one chart.
|
||||
YAxisIndex int
|
||||
|
||||
ShowBackground bool
|
||||
RoundCap bool
|
||||
CoordSystem string
|
||||
}
|
||||
|
||||
// SunburstChart
|
||||
// https://echarts.apache.org/en/option.html#series-sunburst
|
||||
type SunburstChart struct {
|
||||
// The action of clicking a sector
|
||||
NodeClick string `json:"nodeClick,omitempty"`
|
||||
// Sorting method that sectors use based on value
|
||||
Sort string `json:"sort,omitempty"`
|
||||
// If there is no name, whether need to render it.
|
||||
RenderLabelForZeroData bool `json:"renderLabelForZeroData"`
|
||||
// Selected mode
|
||||
SelectedMode bool `json:"selectedMode"`
|
||||
// Whether to enable animation.
|
||||
Animation bool `json:"animation"`
|
||||
// Whether to set graphic number threshold to animation
|
||||
AnimationThreshold int `json:"animationThreshold,omitempty"`
|
||||
// Duration of the first animation
|
||||
AnimationDuration int `json:"animationDuration,omitempty"`
|
||||
// Easing method used for the first animation
|
||||
AnimationEasing string `json:"animationEasing,omitempty"`
|
||||
// Delay before updating the first animation
|
||||
AnimationDelay int `json:"animationDelay,omitempty"`
|
||||
// Time for animation to complete
|
||||
AnimationDurationUpdate int `json:"animationDurationUpdate,omitempty"`
|
||||
// Easing method used for animation.
|
||||
AnimationEasingUpdate string `json:"animationEasingUpdate,omitempty"`
|
||||
// Delay before updating animation
|
||||
AnimationDelayUpdate int `json:"animationDelayUpdate,omitempty"`
|
||||
}
|
||||
|
||||
// BarData
|
||||
// https://echarts.apache.org/en/option.html#series-bar.data
|
||||
type BarData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
|
||||
// The style setting of the text label in a single bar.
|
||||
Label *Label `json:"label,omitempty"`
|
||||
|
||||
// ItemStyle settings in this series data.
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
|
||||
// Tooltip settings in this series data.
|
||||
Tooltip *Tooltip `json:"tooltip,omitempty"`
|
||||
}
|
||||
|
||||
// Bar3DChart is the option set for a 3D bar chart.
|
||||
type Bar3DChart struct {
|
||||
// Shading is the coloring effect of 3D graphics in 3D Bar.
|
||||
// The following three coloring methods are supported in echarts-gl:
|
||||
// Options:
|
||||
//
|
||||
// * "color": Only display colors, not affected by other factors such as lighting.
|
||||
// * "lambert": Through the classic [lambert] coloring, can express the light and dark that the light shows.
|
||||
// * "realistic": Realistic rendering, combined with light.ambientCubemap and postEffect,
|
||||
// can improve the quality and texture of the display.
|
||||
// [Physical Based Rendering (PBR)] (https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/)
|
||||
// is used in ECharts GL to represent realistic materials.
|
||||
Shading string
|
||||
}
|
||||
|
||||
// BoxPlotData
|
||||
// https://echarts.apache.org/en/option.html#series-boxplot.data
|
||||
type BoxPlotData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
|
||||
// The style setting of the text label in a single bar.
|
||||
Label *Label `json:"label,omitempty"`
|
||||
|
||||
// ItemStyle settings in this series data.
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
|
||||
// Emphasis settings in this series data.
|
||||
Emphasis *Emphasis `json:"emphasis,omitempty"`
|
||||
|
||||
// Tooltip settings in this series data.
|
||||
Tooltip *Tooltip `json:"tooltip,omitempty"`
|
||||
}
|
||||
|
||||
// EffectScatterData
|
||||
// https://echarts.apache.org/en/option.html#series-effectScatter.data
|
||||
type EffectScatterData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// FunnelData
|
||||
// https://echarts.apache.org/en/option.html#series-funnel.data
|
||||
type FunnelData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// GeoData
|
||||
type GeoData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// GaugeData
|
||||
// https://echarts.apache.org/en/option.html#series-gauge.data
|
||||
type GaugeData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// GraphChart is the option set for graph chart.
|
||||
// https://echarts.apache.org/en/option.html#series-graph
|
||||
type GraphChart struct {
|
||||
// Graph layout.
|
||||
// * 'none' No layout, use x, y provided in node as the position of node.
|
||||
// * 'circular' Adopt circular layout, see the example Les Miserables.
|
||||
// * 'force' Adopt force-directed layout, see the example Force, the
|
||||
// detail about layout configurations are in graph.force
|
||||
Layout string
|
||||
|
||||
// Force is the option set for graph force layout.
|
||||
Force *GraphForce
|
||||
|
||||
// Whether to enable mouse zooming and translating. false by default.
|
||||
// If either zooming or translating is wanted, it can be set to 'scale' or 'move'.
|
||||
// Otherwise, set it to be true to enable both.
|
||||
Roam bool
|
||||
|
||||
// EdgeSymbol is the symbols of two ends of edge line.
|
||||
// * 'circle'
|
||||
// * 'arrow'
|
||||
// * 'none'
|
||||
// example: ["circle", "arrow"] or "circle"
|
||||
EdgeSymbol interface{}
|
||||
|
||||
// EdgeSymbolSize is size of symbol of two ends of edge line. Can be an array or a single number
|
||||
// example: [5,10] or 5
|
||||
EdgeSymbolSize interface{}
|
||||
|
||||
// Draggable allows you to move the nodes with the mouse if they are not fixed.
|
||||
Draggable bool
|
||||
|
||||
// Whether to focus/highlight the hover node and it's adjacencies.
|
||||
FocusNodeAdjacency bool
|
||||
|
||||
// The categories of node, which is optional. If there is a classification of nodes,
|
||||
// the category of each node can be assigned through data[i].category.
|
||||
// And the style of category will also be applied to the style of nodes. categories can also be used in legend.
|
||||
Categories []*GraphCategory
|
||||
|
||||
// EdgeLabel is the properties of an label of edge.
|
||||
EdgeLabel *EdgeLabel `json:"edgeLabel"`
|
||||
|
||||
// SymbolKeepAspect is whether to keep aspect for symbols in the form of path://.
|
||||
SymbolKeepAspect bool
|
||||
}
|
||||
|
||||
// GraphNode represents a data node in graph chart.
|
||||
// https://echarts.apache.org/en/option.html#series-graph.data
|
||||
type GraphNode struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// x value of node position.
|
||||
X float32 `json:"x,omitempty"`
|
||||
|
||||
// y value of node position.
|
||||
Y float32 `json:"y,omitempty"`
|
||||
|
||||
// Value of data item.
|
||||
Value float32 `json:"value,omitempty"`
|
||||
|
||||
// If node are fixed when doing force directed layout.
|
||||
Fixed bool `json:"fixed,omitempty"`
|
||||
|
||||
// Index of category which the data item belongs to.
|
||||
Category interface{} `json:"category,omitempty"`
|
||||
|
||||
// Symbol of node of this category.
|
||||
// Icon types provided by ECharts includes
|
||||
// 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none'
|
||||
// It can be set to an image with 'image://url' , in which URL is the link to an image, or dataURI of an image.
|
||||
Symbol string `json:"symbol,omitempty"`
|
||||
|
||||
// node of this category symbol size. It can be set to single numbers like 10,
|
||||
// or use an array to represent width and height. For example, [20, 10] means symbol width is 20, and height is10.
|
||||
SymbolSize interface{} `json:"symbolSize,omitempty"`
|
||||
|
||||
// The style of this node.
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
|
||||
// The tooltip of this node.
|
||||
Tooltip *Tooltip `json:"tooltip,omitempty"`
|
||||
}
|
||||
|
||||
// GraphLink represents relationship between two data nodes.
|
||||
// https://echarts.apache.org/en/option.html#series-graph.links
|
||||
type GraphLink struct {
|
||||
// A string representing the name of source node on edge. Can also be a number representing the node index.
|
||||
Source interface{} `json:"source,omitempty"`
|
||||
|
||||
// A string representing the name of target node on edge. Can also be a number representing node index.
|
||||
Target interface{} `json:"target,omitempty"`
|
||||
|
||||
// value of edge, can be mapped to edge length in force graph.
|
||||
Value float32 `json:"value,omitempty"`
|
||||
|
||||
// Label for this link.
|
||||
Label *EdgeLabel `json:"label,omitempty"`
|
||||
}
|
||||
|
||||
// GraphCategory represents a category for data nodes.
|
||||
// The categories of node, which is optional. If there is a classification of nodes,
|
||||
// the category of each node can be assigned through data[i].category.
|
||||
// And the style of category will also be applied to the style of nodes. categories can also be used in legend.
|
||||
// https://echarts.apache.org/en/option.html#series-graph.categories
|
||||
type GraphCategory struct {
|
||||
// Name of category, which is used to correspond with legend and the content of tooltip.
|
||||
Name string `json:"name"`
|
||||
|
||||
// The label style of node in this category.
|
||||
Label *Label `json:"label,omitempty"`
|
||||
}
|
||||
|
||||
// HeatMapChart is the option set for a heatmap chart.
|
||||
// https://echarts.apache.org/en/option.html#series-heatmap
|
||||
type HeatMapChart struct {
|
||||
// Index of x axis to combine with, which is useful for multiple x axes in one chart.
|
||||
XAxisIndex int
|
||||
|
||||
// Index of y axis to combine with, which is useful for multiple y axes in one chart.
|
||||
YAxisIndex int
|
||||
}
|
||||
|
||||
// HeatMapData
|
||||
// https://echarts.apache.org/en/option.html#series-heatmap.data
|
||||
type HeatMapData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// KlineData
|
||||
// https://echarts.apache.org/en/option.html#series-candlestick.data
|
||||
type KlineData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// LineChart is the options set for a line chart.
|
||||
// https://echarts.apache.org/en/option.html#series-line
|
||||
type LineChart struct {
|
||||
// If stack the value. On the same category axis, the series with the same stack name would be put on top of each other.
|
||||
// The effect of the below example could be seen through stack switching of toolbox on the top right corner:
|
||||
Stack string
|
||||
|
||||
// Whether to show as smooth curve.
|
||||
// If is typed in boolean, then it means whether to enable smoothing. If is
|
||||
// typed in number, valued from 0 to 1, then it means smoothness. A smaller value makes it less smooth.
|
||||
Smooth bool
|
||||
|
||||
// Whether to show as a step line. It can be true, false. Or 'start', 'middle', 'end'.
|
||||
// Which will configure the turn point of step line.
|
||||
Step interface{}
|
||||
|
||||
// Index of x axis to combine with, which is useful for multiple x axes in one chart.
|
||||
XAxisIndex int
|
||||
|
||||
// Index of y axis to combine with, which is useful for multiple y axes in one chart.
|
||||
YAxisIndex int
|
||||
|
||||
// Whether to connect the line across null points.
|
||||
ConnectNulls bool
|
||||
|
||||
// Whether to show symbol. It would be shown during tooltip hover.
|
||||
ShowSymbol bool
|
||||
|
||||
// Icon types provided by ECharts includes
|
||||
// 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none'
|
||||
// Full documentation: https://echarts.apache.org/en/option.html#series-line.symbol
|
||||
Symbol string
|
||||
|
||||
// symbol size. It can be set to single numbers like 10, or use an array to represent width and height. For example, [20, 10] means symbol width is 20, and height is10.
|
||||
// Full documentation: https://echarts.apache.org/en/option.html#series-line.symbolSize
|
||||
SymbolSize interface{}
|
||||
|
||||
// color for Line series. it affects Line series including symbols, unlike LineStyle.Color
|
||||
Color string
|
||||
|
||||
// SymbolKeepAspect is whether to keep aspect for symbols in the form of path://.
|
||||
SymbolKeepAspect bool
|
||||
}
|
||||
|
||||
// LineChart is the options set for a chandlestick chart.
|
||||
// https://echarts.apache.org/en/option.html#series-candlestick
|
||||
type KlineChart struct {
|
||||
// Specify bar width. Absolute value (like 10) or percentage (like '20%', according to band width) can be used. Auto adapt by default.
|
||||
BarWidth string
|
||||
|
||||
// Specify bar min width. Absolute value (like 10) or percentage (like '20%', according to band width) can be used. Auto adapt by default.
|
||||
BarMinWidth string
|
||||
|
||||
// Specify bar max width. Absolute value (like 10) or percentage (like '20%', according to band width) can be used. Auto adapt by default.
|
||||
BarMaxWidth string
|
||||
}
|
||||
|
||||
// LineData
|
||||
// https://echarts.apache.org/en/option.html#series-line.data
|
||||
type LineData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
|
||||
// Symbol of single data.
|
||||
// Icon types provided by ECharts includes 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none'
|
||||
// It can be set to an image with 'image://url' , in which URL is the link to an image, or dataURI of an image.
|
||||
Symbol string `json:"symbol,omitempty"`
|
||||
|
||||
// single data symbol size. It can be set to single numbers like 10, or
|
||||
// use an array to represent width and height. For example, [20, 10] means symbol width is 20, and height is10
|
||||
SymbolSize int `json:"symbolSize,omitempty"`
|
||||
|
||||
// Index of x axis to combine with, which is useful for multiple x axes in one chart.
|
||||
XAxisIndex int
|
||||
|
||||
// Index of y axis to combine with, which is useful for multiple y axes in one chart.
|
||||
YAxisIndex int
|
||||
}
|
||||
|
||||
// LiquidChart
|
||||
// reference https://github.com/ecomfe/echarts-liquidfill
|
||||
type LiquidChart struct {
|
||||
// Shape of single data.
|
||||
// Icon types provided by ECharts includes 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none'
|
||||
// It can be set to an image with 'image://url' , in which URL is the link to an image, or dataURI of an image.
|
||||
Shape string
|
||||
|
||||
// Whether to show outline
|
||||
IsShowOutline bool
|
||||
|
||||
// Whether to stop animation
|
||||
IsWaveAnimation bool
|
||||
}
|
||||
|
||||
// LiquidData
|
||||
// reference https://github.com/ecomfe/echarts-liquidfill
|
||||
type LiquidData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// MapData
|
||||
// https://echarts.apache.org/en/option.html#series-map.data
|
||||
type MapData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// ParallelData
|
||||
// https://echarts.apache.org/en/option.html#series-parallel.data
|
||||
type ParallelData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// PieChart is the option set for a pie chart.
|
||||
// https://echarts.apache.org/en/option.html#series-pie
|
||||
type PieChart struct {
|
||||
// Whether to show as Nightingale chart, which distinguishes data through radius. There are 2 optional modes:
|
||||
// * 'radius' Use central angle to show the percentage of data, radius to show data size.
|
||||
// * 'area' All the sectors will share the same central angle, the data size is shown only through radiuses.
|
||||
RoseType string
|
||||
|
||||
// Center position of Pie chart, the first of which is the horizontal position, and the second is the vertical position.
|
||||
// Percentage is supported. When set in percentage, the item is relative to the container width,
|
||||
// and the second item to the height.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// Set to absolute pixel values ->> center: [400, 300]
|
||||
// Set to relative percent ->> center: ['50%', '50%']
|
||||
Center interface{}
|
||||
|
||||
// Radius of Pie chart. Value can be:
|
||||
// * number: Specify outside radius directly.
|
||||
// * string: For example, '20%', means that the outside radius is 20% of the viewport
|
||||
// size (the little one between width and height of the chart container).
|
||||
//
|
||||
// Array.<number|string>: The first item specifies the inside radius, and the
|
||||
// second item specifies the outside radius. Each item follows the definitions above.
|
||||
Radius interface{}
|
||||
}
|
||||
|
||||
// PieData
|
||||
// https://echarts.apache.org/en/option.html#series-pie.data
|
||||
type PieData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
|
||||
// Whether the data item is selected.
|
||||
Selected bool `json:"selected,omitempty"`
|
||||
|
||||
// The label configuration of a single sector.
|
||||
Label *Label `json:"label,omitempty"`
|
||||
|
||||
// Graphic style of , emphasis is the style when it is highlighted, like being hovered by mouse, or highlighted via legend connect.
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
|
||||
// tooltip settings in this series data.
|
||||
Tooltip *Tooltip `json:"tooltip,omitempty"`
|
||||
}
|
||||
|
||||
// RadarData
|
||||
// https://echarts.apache.org/en/option.html#series-radar
|
||||
type RadarData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// SankeyLink represents relationship between two data nodes.
|
||||
// https://echarts.apache.org/en/option.html#series-sankey.links
|
||||
type SankeyLink struct {
|
||||
// The name of source node of edge
|
||||
Source interface{} `json:"source,omitempty"`
|
||||
|
||||
// The name of target node of edge
|
||||
Target interface{} `json:"target,omitempty"`
|
||||
|
||||
// The value of edge, which decides the width of edge.
|
||||
Value float32 `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// SankeyNode represents a data node.
|
||||
// https://echarts.apache.org/en/option.html#series-sankey.nodes
|
||||
type SankeyNode struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value string `json:"value,omitempty"`
|
||||
|
||||
// Depth of the node within the chart
|
||||
Depth *int `json:"depth,omitempty"`
|
||||
|
||||
// ItemStyle settings in this series data.
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
}
|
||||
|
||||
// ScatterChart is the option set for a scatter chart.
|
||||
// https://echarts.apache.org/en/option.html#series-scatter
|
||||
type ScatterChart struct {
|
||||
// Index of x axis to combine with, which is useful for multiple x axes in one chart.
|
||||
XAxisIndex int
|
||||
|
||||
// Index of x axis to combine with, which is useful for multiple y axes in one chart.
|
||||
YAxisIndex int
|
||||
|
||||
// SymbolKeepAspect is whether to keep aspect for symbols in the form of path://.
|
||||
SymbolKeepAspect bool
|
||||
}
|
||||
|
||||
// ScatterData
|
||||
// https://echarts.apache.org/en/option.html#series-scatter.data
|
||||
type ScatterData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
|
||||
// Symbol
|
||||
Symbol string `json:"symbol,omitempty"`
|
||||
|
||||
// SymbolSize
|
||||
SymbolSize int `json:"symbolSize,omitempty"`
|
||||
|
||||
// SymbolRotate
|
||||
SymbolRotate int `json:"symbolRotate,omitempty"`
|
||||
|
||||
// Index of x axis to combine with, which is useful for multiple x axes in one chart.
|
||||
XAxisIndex int `json:"xAxisIndex,omitempty"`
|
||||
|
||||
// Index of y axis to combine with, which is useful for multiple y axes in one chart.
|
||||
YAxisIndex int `json:"yAxisIndex,omitempty"`
|
||||
}
|
||||
|
||||
// ThemeRiverData
|
||||
// https://echarts.apache.org/en/option.html#series-themeRiver
|
||||
type ThemeRiverData struct {
|
||||
// the time attribute of time and theme.
|
||||
Date string `json:"date,omitempty"`
|
||||
|
||||
// the value of an event or theme at a time point.
|
||||
Value float64 `json:"value,omitempty"`
|
||||
|
||||
// the name of an event or theme.
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// ToList converts the themeriver data to a list
|
||||
func (trd ThemeRiverData) ToList() [3]interface{} {
|
||||
return [3]interface{}{trd.Date, trd.Value, trd.Name}
|
||||
}
|
||||
|
||||
// WordCloudChart is the option set for a word cloud chart.
|
||||
type WordCloudChart struct {
|
||||
// Shape of WordCloud
|
||||
// Optional: "circle", "rect", "roundRect", "triangle", "diamond", "pin", "arrow"
|
||||
Shape string
|
||||
|
||||
// range of font size
|
||||
SizeRange []float32
|
||||
|
||||
// range of font rotation angle
|
||||
RotationRange []float32
|
||||
}
|
||||
|
||||
// WordCloudData
|
||||
type WordCloudData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of a single data item.
|
||||
Value interface{} `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
type Chart3DData struct {
|
||||
// Name of the data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of the data item.
|
||||
// []interface{}{1, 2, 3}
|
||||
Value []interface{} `json:"value,omitempty"`
|
||||
|
||||
// ItemStyle settings in this series data.
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
|
||||
// The style setting of the text label in a single bar.
|
||||
Label *Label `json:"label,omitempty"`
|
||||
}
|
||||
|
||||
type TreeChart struct {
|
||||
// The layout of the tree, which can be orthogonal and radial.
|
||||
// * 'orthogonal' refer to the horizontal and vertical direction.
|
||||
// * 'radial' refers to the view that the root node as the center and each layer of nodes as the ring.
|
||||
Layout string
|
||||
|
||||
// The direction of the orthogonal layout in the tree diagram.
|
||||
// * 'from left to right' or 'LR'
|
||||
// * 'from right to left' or 'RL'
|
||||
// * 'from top to bottom' or 'TB'
|
||||
// * 'from bottom to top' or 'BT'
|
||||
Orient string `json:"orient,omitempty"`
|
||||
|
||||
// Whether to enable mouse zooming and translating. false by default.
|
||||
// If either zooming or translating is wanted, it can be set to 'scale' or 'move'.
|
||||
// Otherwise, set it to be true to enable both.
|
||||
Roam bool `json:"roam"`
|
||||
|
||||
// Subtree collapses and expands interaction, default true.
|
||||
ExpandAndCollapse bool `json:"expandAndCollapse,omitempty"`
|
||||
|
||||
// The initial level (depth) of the tree. The root node is the 0th layer, then the first layer, the second layer, ... , until the leaf node.
|
||||
// This configuration item is primarily used in conjunction with collapsing and expansion interactions.
|
||||
// The purpose is to prevent the nodes from obscuring each other. If set as -1 or null or undefined, all nodes are expanded.
|
||||
InitialTreeDepth int `json:"initialTreeDepth,omitempty"`
|
||||
|
||||
// The style setting of the text label in a single bar.
|
||||
Label *Label `json:"label,omitempty"`
|
||||
|
||||
// Leaf node special configuration, the leaf node and non-leaf node label location is different.
|
||||
Leaves *TreeLeaves `json:"leaves,omitempty"`
|
||||
|
||||
// Distance between tree component and the sides of the container.
|
||||
// value can be instant pixel value like 20;
|
||||
// It can also be a percentage value relative to container width like '20%';
|
||||
Left string `json:"left,omitempty"`
|
||||
Right string `json:"right,omitempty"`
|
||||
Top string `json:"top,omitempty"`
|
||||
Bottom string `json:"bottom,omitempty"`
|
||||
|
||||
// SymbolKeepAspect is whether to keep aspect for symbols in the form of path://.
|
||||
SymbolKeepAspect bool
|
||||
}
|
||||
|
||||
type TreeData struct {
|
||||
// Name of the data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Value of the data item.
|
||||
Value int `json:"value,omitempty"`
|
||||
|
||||
Children []*TreeData `json:"children,omitempty"`
|
||||
|
||||
// Symbol of node of this category.
|
||||
// Icon types provided by ECharts includes
|
||||
// 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none'
|
||||
// It can be set to an image with 'image://url' , in which URL is the link to an image, or dataURI of an image.
|
||||
Symbol string `json:"symbol,omitempty"`
|
||||
|
||||
// node of this category symbol size. It can be set to single numbers like 10,
|
||||
// or use an array to represent width and height. For example, [20, 10] means symbol width is 20, and height is10.
|
||||
SymbolSize interface{} `json:"symbolSize,omitempty"`
|
||||
|
||||
// If set as `true`, the node is collapsed in the initialization.
|
||||
Collapsed bool `json:"collapsed,omitempty"`
|
||||
|
||||
// LineStyle settings in this series data.
|
||||
LineStyle *LineStyle `json:"lineStyle,omitempty"`
|
||||
|
||||
// ItemStyle settings in this series data.
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
}
|
||||
|
||||
type TreeMapChart struct {
|
||||
// Whether to enable animation.
|
||||
Animation bool `json:"animation"`
|
||||
|
||||
// leafDepth represents how many levels are shown at most. For example, when leafDepth is set to 1, only one level will be shown.
|
||||
// leafDepth is null/undefined by default, which means that "drill down" is disabled.
|
||||
LeafDepth int `json:"leafDeapth,omitempty"`
|
||||
|
||||
// Roam describes whether to enable mouse zooming and translating. false by default.
|
||||
Roam bool `json:"roam"`
|
||||
|
||||
// Label decribes the style of the label in each node.
|
||||
Label *Label `json:"label,omitempty"`
|
||||
|
||||
// UpperLabel is used to specify whether show label when the treemap node has children.
|
||||
UpperLabel *UpperLabel `json:"upperLabel,omitempty"`
|
||||
|
||||
// ColorMappingBy specifies the rule according to which each node obtain color from color list.
|
||||
ColorMappingBy string `json:"colorMappingBy,omitempty"`
|
||||
|
||||
// Levels provide configration for each node level
|
||||
Levels *[]TreeMapLevel `json:"levels,omitempty"`
|
||||
|
||||
// Distance between treemap component and the sides of the container.
|
||||
// value can be instant pixel value like 20;
|
||||
// It can also be a percentage value relative to container width like '20%';
|
||||
Left string `json:"left,omitempty"`
|
||||
Right string `json:"right,omitempty"`
|
||||
Top string `json:"top,omitempty"`
|
||||
Bottom string `json:"bottom,omitempty"`
|
||||
}
|
||||
|
||||
type TreeMapNode struct {
|
||||
// Name of the tree node item.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Value of the tree node item.
|
||||
Value int `json:"value,omitempty"`
|
||||
|
||||
Children []TreeMapNode `json:"children,omitempty"`
|
||||
}
|
||||
|
||||
// SunBurstData data
|
||||
type SunBurstData struct {
|
||||
// Name of data item.
|
||||
Name string `json:"name,omitempty"`
|
||||
// Value of data item.
|
||||
Value float64 `json:"value,omitempty"`
|
||||
// sub item of data item
|
||||
Children []*SunBurstData `json:"children,omitempty"`
|
||||
}
|
||||
1521
vendor/github.com/go-echarts/go-echarts/v2/opts/global.go
generated
vendored
Normal file
1521
vendor/github.com/go-echarts/go-echarts/v2/opts/global.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
699
vendor/github.com/go-echarts/go-echarts/v2/opts/series.go
generated
vendored
Normal file
699
vendor/github.com/go-echarts/go-echarts/v2/opts/series.go
generated
vendored
Normal file
@@ -0,0 +1,699 @@
|
||||
package opts
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Label contains options for a label text.
|
||||
// https://echarts.apache.org/en/option.html#series-line.label
|
||||
type Label struct {
|
||||
// Whether to show label.
|
||||
Show bool `json:"show"`
|
||||
|
||||
// Color is the text color.
|
||||
// If set as "auto", the color will assigned as visual color, such as series color.
|
||||
Color string `json:"color,omitempty"`
|
||||
|
||||
// font style.
|
||||
// Options are: 'normal', 'italic', 'oblique'
|
||||
FontStyle string `json:"fontStyle,omitempty"`
|
||||
|
||||
// font thick weight.
|
||||
// Options are: 'normal', 'bold', 'bolder', 'lighter', 100 | 200 | 300 | 400...
|
||||
FontWeight string `json:"fontWeight,omitempty"`
|
||||
|
||||
// font family.
|
||||
// Can also be 'serif' , 'monospace', ...
|
||||
FontFamily string `json:"fontFamily,omitempty"`
|
||||
|
||||
// font size.
|
||||
FontSize float32 `json:"fontSize,omitempty"`
|
||||
|
||||
// Horizontal alignment of text, automatic by default.
|
||||
// Options are: 'left', 'center', 'right'
|
||||
Align string `json:"align,omitempty"`
|
||||
|
||||
// Vertical alignment of text, automatic by default.
|
||||
// Options are: 'top', 'middle', 'bottom'
|
||||
VerticalAlign string `json:"verticalAlign,omitempty"`
|
||||
|
||||
// Line height of the text fragment.
|
||||
LineHeight float32 `json:"lineHeight,omitempty"`
|
||||
|
||||
// Background color of the text fragment.
|
||||
BackgroundColor string `json:"backgroundColor,omitempty"`
|
||||
|
||||
// Border color of the text fragment.
|
||||
BorderColor string `json:"borderColor,omitempty"`
|
||||
|
||||
// Border width of the text fragment.
|
||||
BorderWidth float32 `json:"borderWidth,omitempty"`
|
||||
|
||||
// the text fragment border type.
|
||||
// Possible values are: 'solid', 'dashed', 'dotted'
|
||||
BorderType string `json:"borderType,omitempty"`
|
||||
|
||||
// To set the line dash offset. With borderType , we can make the line style more flexible.
|
||||
BorderDashOffset float32 `json:"borderDashOffset,omitempty"`
|
||||
|
||||
// Border radius of the text fragment.
|
||||
BorderRadius float32 `json:"borderRadius,omitempty"`
|
||||
|
||||
// Padding of the text fragment, for example:
|
||||
// padding: [3, 4, 5, 6]: represents padding of [top, right, bottom, left].
|
||||
// padding: 4: represents padding: [4, 4, 4, 4].
|
||||
// padding: [3, 4]: represents padding: [3, 4, 3, 4].
|
||||
// Notice, width and height specifies the width and height of the content, without padding.
|
||||
Padding string `json:"padding,omitempty"`
|
||||
|
||||
// Label position. Followings are the options:
|
||||
//
|
||||
// [x, y]
|
||||
// Use relative percentage, or absolute pixel values to represent position of label
|
||||
// relative to top-left corner of bounding box. For example:
|
||||
//
|
||||
// Absolute pixel values: position: [10, 10],
|
||||
// Relative percentage: position: ["50%", "50%"]
|
||||
//
|
||||
// "top"
|
||||
// "left"
|
||||
// "right"
|
||||
// "bottom"
|
||||
// "inside"
|
||||
// "insideLeft"
|
||||
// "insideRight"
|
||||
// "insideTop"
|
||||
// "insideBottom"
|
||||
// "insideTopLeft"
|
||||
// "insideBottomLeft"
|
||||
// "insideTopRight"
|
||||
// "insideBottomRight"
|
||||
Position string `json:"position,omitempty"`
|
||||
|
||||
// Data label formatter, which supports string template and callback function.
|
||||
// In either form, \n is supported to represent a new line.
|
||||
// String template, Model variation includes:
|
||||
//
|
||||
// {a}: series name.
|
||||
// {b}: the name of a data item.
|
||||
// {c}: the value of a data item.
|
||||
// {@xxx}: the value of a dimension named"xxx", for example,{@product}refers the value of"product"` dimension.
|
||||
// {@[n]}: the value of a dimension at the index ofn, for example,{@[3]}` refers the value at dimensions[3].
|
||||
Formatter string `json:"formatter,omitempty"`
|
||||
}
|
||||
|
||||
// LabelLine Configuration of label guide line.
|
||||
type LabelLine struct {
|
||||
// Whether to show the label guide line.
|
||||
Show bool `json:"show"`
|
||||
// Whether to show the label guide line above the corresponding element.
|
||||
ShowAbove bool `json:"showAbove"`
|
||||
// The length of the second segment of guide line.
|
||||
Length2 float64 `json:"length2,omitempty"`
|
||||
// smoothness of guide line.
|
||||
Smooth bool `json:"smooth"`
|
||||
// Minimum turn angle between two segments of guide line
|
||||
MinTurnAngle float64 `json:"minTurnAngle,omitempty"`
|
||||
// The style of label line
|
||||
LineStyle *LineStyle `json:"lineStyle,omitempty"`
|
||||
}
|
||||
|
||||
// Emphasis is the style when it is highlighted, like being hovered by mouse, or highlighted via legend connect.
|
||||
type Emphasis struct {
|
||||
// the emphasis style of label
|
||||
Label *Label `json:"label,omitempty"`
|
||||
|
||||
// the emphasis style of item
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
}
|
||||
|
||||
// ItemStyle represents a style of an item.
|
||||
type ItemStyle struct {
|
||||
// Color of chart
|
||||
// Kline Up candle color
|
||||
Color string `json:"color,omitempty"`
|
||||
|
||||
// Kline Down candle color
|
||||
Color0 string `json:"color0,omitempty"`
|
||||
|
||||
// BorderColor is the hart border color
|
||||
// Kline Up candle border color
|
||||
BorderColor string `json:"borderColor,omitempty"`
|
||||
|
||||
// Kline Down candle border color
|
||||
BorderColor0 string `json:"borderColor0,omitempty"`
|
||||
|
||||
// Color saturation of a border or gap.
|
||||
BorderColorSaturation float32 `json:"borderColorSaturation,omitempty"`
|
||||
|
||||
// Border width of a node
|
||||
BorderWidth float32 `json:"borderWidth,omitempty"`
|
||||
|
||||
// Gaps between child nodes.
|
||||
GapWidth float32 `json:"gapWidth,omitempty"`
|
||||
|
||||
// Opacity of the component. Supports value from 0 to 1, and the component will not be drawn when set to 0.
|
||||
Opacity float32 `json:"opacity,omitempty"`
|
||||
}
|
||||
|
||||
// MarkLines represents a series of marklines.
|
||||
type MarkLines struct {
|
||||
Data []interface{} `json:"data,omitempty"`
|
||||
MarkLineStyle
|
||||
}
|
||||
|
||||
// MarkLineStyle contains styling options for a MarkLine.
|
||||
type MarkLineStyle struct {
|
||||
// Symbol type at the two ends of the mark line. It can be an array for two ends, or assigned separately.
|
||||
// Options: "circle", "rect", "roundRect", "triangle", "diamond", "pin", "arrow", "none"
|
||||
Symbol []string `json:"symbol,omitempty"`
|
||||
|
||||
// Symbol size.
|
||||
SymbolSize float32 `json:"symbolSize,omitempty"`
|
||||
|
||||
// Mark line text options.
|
||||
Label *Label `json:"label,omitempty"`
|
||||
}
|
||||
|
||||
// CircularStyle contains styling options for circular layout.
|
||||
type CircularStyle struct {
|
||||
RotateLabel bool `json:"rotateLabel,omitempty"`
|
||||
}
|
||||
|
||||
// MarkLineNameTypeItem represents type for a MarkLine.
|
||||
type MarkLineNameTypeItem struct {
|
||||
// Mark line name.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Mark line type, options: "average", "min", "max".
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
// Works only when type is assigned.
|
||||
// It is used to state the dimension used to calculate maximum value or minimum value.
|
||||
// It may be the direct name of a dimension, like x,
|
||||
// or angle for line charts, or open, or close for candlestick charts.
|
||||
ValueDim string `json:"valueDim,omitempty"`
|
||||
}
|
||||
|
||||
// MarkLineNameYAxisItem defines a MarkLine on a Y axis.
|
||||
type MarkLineNameYAxisItem struct {
|
||||
// Mark line name
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Y axis data
|
||||
YAxis interface{} `json:"yAxis,omitempty"`
|
||||
|
||||
// Works only when type is assigned.
|
||||
// It is used to state the dimension used to calculate maximum value or minimum value.
|
||||
// It may be the direct name of a dimension, like x,
|
||||
// or angle for line charts, or open, or close for candlestick charts.
|
||||
ValueDim string `json:"valueDim,omitempty"`
|
||||
}
|
||||
|
||||
// MarkLineNameXAxisItem defines a MarkLine on a X axis.
|
||||
type MarkLineNameXAxisItem struct {
|
||||
// Mark line name
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// X axis data
|
||||
XAxis interface{} `json:"xAxis,omitempty"`
|
||||
|
||||
// Works only when type is assigned.
|
||||
// It is used to state the dimension used to calculate maximum value or minimum value.
|
||||
// It may be the direct name of a dimension, like x,
|
||||
// or angle for line charts, or open, or close for candlestick charts.
|
||||
ValueDim string `json:"valueDim,omitempty"`
|
||||
}
|
||||
|
||||
// MarkLineNameCoordItem represents coordinates for a MarkLine.
|
||||
type MarkLineNameCoordItem struct {
|
||||
// Mark line name
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Mark line start coordinate
|
||||
Coordinate0 []interface{}
|
||||
|
||||
// Mark line end coordinate
|
||||
Coordinate1 []interface{}
|
||||
|
||||
// Works only when type is assigned.
|
||||
// It is used to state the dimension used to calculate maximum value or minimum value.
|
||||
// It may be the direct name of a dimension, like x,
|
||||
// or angle for line charts, or open, or close for candlestick charts.
|
||||
ValueDim string `json:"valueDim,omitempty"`
|
||||
}
|
||||
|
||||
// MarkAreas represents a series of markareas.
|
||||
type MarkAreas struct {
|
||||
Data []interface{} `json:"data,omitempty"`
|
||||
MarkAreaStyle
|
||||
}
|
||||
|
||||
// MarkAreaStyle contains styling options for a MarkArea.
|
||||
type MarkAreaStyle struct {
|
||||
// Mark area text options.
|
||||
Label *Label `json:"label,omitempty"`
|
||||
|
||||
// ItemStyle settings
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
}
|
||||
|
||||
// MarkAreaNameTypeItem represents type for a MarkArea.
|
||||
type MarkAreaNameTypeItem struct {
|
||||
// Mark area name.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Mark area type, options: "average", "min", "max".
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
// Works only when type is assigned.
|
||||
// It is used to state the dimension used to calculate maximum value or minimum value.
|
||||
// It may be the direct name of a dimension, like x,
|
||||
// or angle for line charts, or open, or close for candlestick charts.
|
||||
ValueDim string `json:"valueDim,omitempty"`
|
||||
|
||||
// ItemStyle settings
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
}
|
||||
|
||||
// MarkAreaNameYAxisItem defines a MarkArea on a Y axis.
|
||||
type MarkAreaNameYAxisItem struct {
|
||||
// Mark area name
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Y axis data
|
||||
YAxis interface{} `json:"yAxis,omitempty"`
|
||||
}
|
||||
|
||||
// MarkAreaNameXAxisItem defines a MarkArea on a X axis.
|
||||
type MarkAreaNameXAxisItem struct {
|
||||
// Mark area name
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// X axis data
|
||||
XAxis interface{} `json:"xAxis,omitempty"`
|
||||
}
|
||||
|
||||
// MarkAreaNameCoordItem represents coordinates for a MarkArea.
|
||||
type MarkAreaNameCoordItem struct {
|
||||
// Mark area name
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Mark area start coordinate
|
||||
Coordinate0 []interface{}
|
||||
|
||||
// Mark area end coordinate
|
||||
Coordinate1 []interface{}
|
||||
|
||||
// Works only when type is assigned.
|
||||
// It is used to state the dimension used to calculate maximum value or minimum value.
|
||||
// It may be the direct name of a dimension, like x,
|
||||
// or angle for line charts, or open, or close for candlestick charts.
|
||||
ValueDim string `json:"valueDim,omitempty"`
|
||||
|
||||
// Mark point text options.
|
||||
Label *Label `json:"label,omitempty"`
|
||||
|
||||
// ItemStyle settings
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
}
|
||||
|
||||
// MarkPoints represents a series of markpoints.
|
||||
type MarkPoints struct {
|
||||
Data []interface{} `json:"data,omitempty"`
|
||||
MarkPointStyle
|
||||
}
|
||||
|
||||
// MarkPointStyle contains styling options for a MarkPoint.
|
||||
type MarkPointStyle struct {
|
||||
// Symbol type at the two ends of the mark line. It can be an array for two ends, or assigned separately.
|
||||
// Options: "circle", "rect", "roundRect", "triangle", "diamond", "pin", "arrow", "none"
|
||||
Symbol []string `json:"symbol,omitempty"`
|
||||
|
||||
// Symbol size.
|
||||
SymbolSize float32 `json:"symbolSize,omitempty"`
|
||||
|
||||
// Symbol rotate.
|
||||
SymbolRotate float32 `json:"symbolRotate,omitempty"`
|
||||
|
||||
// Mark point text options.
|
||||
Label *Label `json:"label,omitempty"`
|
||||
}
|
||||
|
||||
// MarkPointNameTypeItem represents type for a MarkPoint.
|
||||
type MarkPointNameTypeItem struct {
|
||||
// Name of markpoint
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Mark point type, options: "average", "min", "max".
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
// Works only when type is assigned.
|
||||
// It is used to state the dimension used to calculate maximum value or minimum value.
|
||||
// It may be the direct name of a dimension, like x,
|
||||
// or angle for line charts, or open, or close for candlestick charts.
|
||||
ValueDim string `json:"valueDim,omitempty"`
|
||||
|
||||
// ItemStyle settings
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
}
|
||||
|
||||
// MarkPointNameCoordItem represents coordinates for a MarkPoint.
|
||||
type MarkPointNameCoordItem struct {
|
||||
// Name of markpoint
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Mark point coordinate
|
||||
Coordinate []interface{} `json:"coord,omitempty"`
|
||||
|
||||
// Value in mark point
|
||||
Value string `json:"value,omitempty"`
|
||||
|
||||
// Works only when type is assigned.
|
||||
// It is used to state the dimension used to calculate maximum value or minimum value.
|
||||
// It may be the direct name of a dimension, like x,
|
||||
// or angle for line charts, or open, or close for candlestick charts.
|
||||
ValueDim string `json:"valueDim,omitempty"`
|
||||
|
||||
// Mark point text options.
|
||||
Label *Label `json:"label,omitempty"`
|
||||
|
||||
// ItemStyle settings
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
|
||||
// Symbol type
|
||||
// Options: "circle", "rect", "roundRect", "triangle", "diamond", "pin", "arrow", "none"
|
||||
Symbol string `json:"symbol,omitempty"`
|
||||
|
||||
// Symbol size.
|
||||
SymbolSize float32 `json:"symbolSize,omitempty"`
|
||||
|
||||
// Symbol rotate.
|
||||
SymbolRotate float32 `json:"symbolRotate,omitempty"`
|
||||
}
|
||||
|
||||
// RippleEffect is the option set for the ripple effect.
|
||||
type RippleEffect struct {
|
||||
// The period duration of animation, in seconds.
|
||||
// default 4(s)
|
||||
Period float32 `json:"period,omitempty"`
|
||||
|
||||
// The maximum zooming scale of ripples in animation.
|
||||
// default 2.5
|
||||
Scale float32 `json:"scale,omitempty"`
|
||||
|
||||
// The brush type for ripples. options: "stroke" and "fill".
|
||||
// default "fill"
|
||||
BrushType string `json:"brushType,omitempty"`
|
||||
}
|
||||
|
||||
// LineStyle is the option set for a link style component.
|
||||
type LineStyle struct {
|
||||
// Line color
|
||||
Color string `json:"color,omitempty"`
|
||||
|
||||
// Width of line. default 1
|
||||
Width float32 `json:"width,omitempty"`
|
||||
|
||||
// Type of line,options: "solid", "dashed", "dotted". default "solid"
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
// Opacity of the component. Supports value from 0 to 1, and the component will not be drawn when set to 0.
|
||||
Opacity float32 `json:"opacity,omitempty"`
|
||||
|
||||
// Curveness of edge. The values from 0 to 1 could be set.
|
||||
// it would be larger as the the value becomes larger. default 0
|
||||
Curveness float32 `json:"curveness,omitempty"`
|
||||
}
|
||||
|
||||
// AreaStyle is the option set for an area style component.
|
||||
type AreaStyle struct {
|
||||
// Fill area color.
|
||||
Color string `json:"color,omitempty"`
|
||||
|
||||
// Opacity of the component. Supports value from 0 to 1, and the component will not be drawn when set to 0.
|
||||
Opacity float32 `json:"opacity,omitempty"`
|
||||
}
|
||||
|
||||
// Configuration items about force-directed layout. Force-directed layout simulates
|
||||
// spring/charge model, which will add a repulsion between 2 nodes and add a attraction
|
||||
// between 2 nodes of each edge. In each iteration nodes will move under the effect
|
||||
// of repulsion and attraction. After several iterations, the nodes will be static in a
|
||||
// balanced position. As a result, the energy local minimum of this whole model will be realized.
|
||||
// The result of force-directed layout has a good symmetries and clustering, which is also aesthetically pleasing.
|
||||
type GraphForce struct {
|
||||
// The initial layout before force-directed layout, which will influence on the result of force-directed layout.
|
||||
// It defaults not to do any layout and use x, y provided in node as the position of node.
|
||||
// If it doesn't exist, the position will be generated randomly.
|
||||
// You can also use circular layout "circular".
|
||||
InitLayout string `json:"initLayout,omitempty"`
|
||||
|
||||
// The repulsion factor between nodes. The repulsion will be stronger and the distance
|
||||
// between 2 nodes becomes further as this value becomes larger.
|
||||
// It can be an array to represent the range of repulsion. In this case larger value have larger
|
||||
// repulsion and smaller value will have smaller repulsion.
|
||||
Repulsion float32 `json:"repulsion,omitempty"`
|
||||
|
||||
// The gravity factor enforcing nodes approach to the center. The nodes will be
|
||||
// closer to the center as the value becomes larger. default 0.1
|
||||
Gravity float32 `json:"gravity,omitempty"`
|
||||
|
||||
// The distance between 2 nodes on edge. This distance is also affected by repulsion.
|
||||
// It can be an array to represent the range of edge length. In this case edge with larger
|
||||
// value will be shorter, which means two nodes are closer. And edge with smaller value will be longer.
|
||||
// default 30
|
||||
EdgeLength float32 `json:"edgeLength,omitempty"`
|
||||
}
|
||||
|
||||
// Leaf node special configuration, the leaf node and non-leaf node label location is different.
|
||||
type TreeLeaves struct {
|
||||
// The style setting of the text label in a single bar.
|
||||
Label *Label `json:"label,omitempty"`
|
||||
|
||||
// LineStyle settings in this series data.
|
||||
LineStyle *LineStyle `json:"lineStyle,omitempty"`
|
||||
|
||||
// ItemStyle settings in this series data.
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
|
||||
// Emphasis settings in this series data.
|
||||
Emphasis *Emphasis `json:"emphasis,omitempty"`
|
||||
}
|
||||
|
||||
// TreeMapLevel is level specific configuration.
|
||||
type TreeMapLevel struct {
|
||||
// Color defines a list for a node level, if empty, retreived from global color list.
|
||||
Color []string `json:"color,omitempty"`
|
||||
|
||||
// ColorAlpha indicates the range of tranparent rate (color alpha) for nodes in a level.
|
||||
ColorAlpha []float32 `json:"colorAlpha,omitempty"`
|
||||
|
||||
// ColorSaturation indicates the range of saturation (color alpha) for nodes in a level.
|
||||
ColorSaturation []float32 `json:"colorSaturation,omitempty"`
|
||||
|
||||
// ColorMappingBy specifies the rule according to which each node obtain color from color list.
|
||||
ColorMappingBy string `json:"colorMappingBy,omitempty"`
|
||||
|
||||
// UpperLabel is used to specify whether show label when the treemap node has children.
|
||||
UpperLabel *UpperLabel `json:"upperLabel,omitempty"`
|
||||
|
||||
// ItemStyle settings in this series data.
|
||||
ItemStyle *ItemStyle `json:"itemStyle,omitempty"`
|
||||
|
||||
// Emphasis settings in this series data.
|
||||
Emphasis *Emphasis `json:"emphasis,omitempty"`
|
||||
}
|
||||
|
||||
// UpperLabel is used to specify whether show label when the treemap node has children.
|
||||
// https://echarts.apache.org/en/option.html#series-treemap.upperLabel
|
||||
type UpperLabel struct {
|
||||
// Show is true to show upper label.
|
||||
Show bool `json:"show,omitempty"`
|
||||
|
||||
// Position is the label's position.
|
||||
// * top
|
||||
// * left
|
||||
// * right
|
||||
// * bottom
|
||||
// * inside
|
||||
// * insideLeft
|
||||
// * insideRight
|
||||
// * insideTop
|
||||
// * insideBottom
|
||||
// * insideTopLeft
|
||||
// * insideBottomLeft
|
||||
// * insideTopRight
|
||||
// * insideBottomRight
|
||||
Position string `json:"position,omitempty"`
|
||||
|
||||
// Distance to the host graphic element.
|
||||
// It is valid only when position is string value (like 'top', 'insideRight').
|
||||
Distance float32 `json:"distance,omitempty"`
|
||||
|
||||
// Rotate label, from -90 degree to 90, positive value represents rotate anti-clockwise.
|
||||
Rotate float32 `json:"rotate,omitempty"`
|
||||
|
||||
// Whether to move text slightly. For example: [30, 40] means move 30 horizontally and move 40 vertically.
|
||||
Offset []float32 `json:"offset,omitempty"`
|
||||
|
||||
// Color is the text color
|
||||
Color string `json:"color,omitempty"`
|
||||
|
||||
// FontStyle
|
||||
// * "normal"
|
||||
// * "italic"
|
||||
// * "oblique"
|
||||
FontStyle string `json:"fontStyle,omitempty"`
|
||||
|
||||
// FontWeight can be the string or a number
|
||||
// * "normal"
|
||||
// * "bold"
|
||||
// * "bolder"
|
||||
// * "lighter"
|
||||
// 100 | 200 | 300| 400 ...
|
||||
FontWeight interface{} `json:"fontWeight,omitempty"`
|
||||
|
||||
// FontSize
|
||||
FontSize float32 `json:"fontSize,omitempty"`
|
||||
|
||||
// Align is a horizontal alignment of text, automatic by default.
|
||||
// * "left"
|
||||
// * "center"
|
||||
// * "right"
|
||||
Align string `json:"align,omitempty"`
|
||||
|
||||
// Align is a horizontal alignment of text, automatic by default.
|
||||
// * "top"
|
||||
// * "middle"
|
||||
// * "bottom"
|
||||
VerticalAlign string `json:"verticalAlign,omitempty"`
|
||||
|
||||
// Padding of the text fragment, for example:
|
||||
// Padding: [3, 4, 5, 6]: represents padding of [top, right, bottom, left].
|
||||
// Padding: 4: represents padding: [4, 4, 4, 4].
|
||||
// Padding: [3, 4]: represents padding: [3, 4, 3, 4].
|
||||
Padding interface{} `json:"padding,omitempty"`
|
||||
|
||||
// Width of text block
|
||||
Width float32 `json:"width,omitempty"`
|
||||
|
||||
// Height of text block
|
||||
Height float32 `json:"height,omitempty"`
|
||||
|
||||
// Upper label formatter, which supports string template and callback function.
|
||||
// In either form, \n is supported to represent a new line.
|
||||
// String template, Model variation includes:
|
||||
//
|
||||
// {a}: series name.
|
||||
// {b}: the name of a data item.
|
||||
// {c}: the value of a data item.
|
||||
// {@xxx}: the value of a dimension named"xxx", for example,{@product}refers the value of"product"` dimension.
|
||||
// {@[n]}: the value of a dimension at the index ofn, for example,{@[3]}` refers the value at dimensions[3].
|
||||
Formatter string `json:"formatter,omitempty"`
|
||||
}
|
||||
|
||||
// RGBColor returns the color with RGB format
|
||||
func RGBColor(r, g, b uint16) string {
|
||||
return fmt.Sprintf("rgb(%d,%d,%d)", r, g, b)
|
||||
}
|
||||
|
||||
// RGBAColor returns the color with RGBA format
|
||||
func RGBAColor(r, g, b uint16, a float32) string {
|
||||
return fmt.Sprintf("rgba(%d,%d,%d,%f)", r, g, b, a)
|
||||
}
|
||||
|
||||
// HSLColor returns the color with HSL format
|
||||
func HSLColor(h, s, l float32) string {
|
||||
return fmt.Sprintf("hsl(%f,%f%%,%f%%)", h, s, l)
|
||||
}
|
||||
|
||||
// HSLAColor returns the color with HSLA format
|
||||
func HSLAColor(h, s, l, a float32) string {
|
||||
return fmt.Sprintf("hsla(%f,%f%%,%f%%,%f)", h, s, l, a)
|
||||
}
|
||||
|
||||
// EdgeLabel is the properties of an label of edge.
|
||||
// https://echarts.apache.org/en/option.html#series-graph.edgeLabel
|
||||
type EdgeLabel struct {
|
||||
// Show is true to show label on edge.
|
||||
Show bool `json:"show,omitempty"`
|
||||
|
||||
// Position is the label's position in line of edge.
|
||||
// * "start"
|
||||
// * "middle"
|
||||
// * "end"
|
||||
Position string `json:"position,omitempty"`
|
||||
|
||||
// Color is the text color
|
||||
Color string `json:"color,omitempty"`
|
||||
|
||||
// FontStyle
|
||||
// * "normal"
|
||||
// * "italic"
|
||||
// * "oblique"
|
||||
FontStyle string `json:"fontStyle,omitempty"`
|
||||
|
||||
// FontWeight can be the string or a number
|
||||
// * "normal"
|
||||
// * "bold"
|
||||
// * "bolder"
|
||||
// * "lighter"
|
||||
// 100 | 200 | 300| 400 ...
|
||||
FontWeight interface{} `json:"fontWeight,omitempty"`
|
||||
|
||||
// FontSize
|
||||
FontSize float32 `json:"fontSize,omitempty"`
|
||||
|
||||
// Align is a horizontal alignment of text, automatic by default.
|
||||
// * "left"
|
||||
// * "center"
|
||||
// * "right"
|
||||
Align string `json:"align,omitempty"`
|
||||
|
||||
// Align is a horizontal alignment of text, automatic by default.
|
||||
// * "top"
|
||||
// * "middle"
|
||||
// * "bottom"
|
||||
VerticalAlign string `json:"verticalAlign,omitempty"`
|
||||
|
||||
// Padding of the text fragment, for example:
|
||||
// Padding: [3, 4, 5, 6]: represents padding of [top, right, bottom, left].
|
||||
// Padding: 4: represents padding: [4, 4, 4, 4].
|
||||
// Padding: [3, 4]: represents padding: [3, 4, 3, 4].
|
||||
Padding interface{} `json:"padding,omitempty"`
|
||||
|
||||
// Width of text block
|
||||
Width float32 `json:"width,omitempty"`
|
||||
|
||||
// Height of text block
|
||||
Height float32 `json:"height,omitempty"`
|
||||
|
||||
// Edge label formatter, which supports string template and callback function.
|
||||
// In either form, \n is supported to represent a new line.
|
||||
// String template, Model variation includes:
|
||||
//
|
||||
// {a}: series name.
|
||||
// {b}: the name of a data item.
|
||||
// {c}: the value of a data item.
|
||||
// {@xxx}: the value of a dimension named"xxx", for example,{@product}refers the value of"product"` dimension.
|
||||
// {@[n]}: the value of a dimension at the index ofn, for example,{@[3]}` refers the value at dimensions[3].
|
||||
Formatter string `json:"formatter,omitempty"`
|
||||
}
|
||||
|
||||
// Define what is encoded to for each dimension of data
|
||||
// https://echarts.apache.org/en/option.html#series-candlestick.encode
|
||||
type Encode struct {
|
||||
X interface{} `json:"x"`
|
||||
|
||||
Y interface{} `json:"y"`
|
||||
|
||||
Tooltip interface{} `json:"tooltip,omitempty"`
|
||||
|
||||
SeriesName interface{} `json:"seriesName,omitempty"`
|
||||
|
||||
ItemID interface{} `json:"itemId,omitempty"`
|
||||
|
||||
ItemName interface{} `json:"itemName,omitempty"`
|
||||
|
||||
ItemGroupID interface{} `json:"itemGroupId,omitempty"`
|
||||
}
|
||||
118
vendor/github.com/go-echarts/go-echarts/v2/render/engine.go
generated
vendored
Normal file
118
vendor/github.com/go-echarts/go-echarts/v2/render/engine.go
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
package render
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
"reflect"
|
||||
"regexp"
|
||||
|
||||
tpls "github.com/go-echarts/go-echarts/v2/templates"
|
||||
)
|
||||
|
||||
// Renderer
|
||||
// Any kinds of charts have their render implementation and
|
||||
// you can define your own render logic easily.
|
||||
type Renderer interface {
|
||||
Render(w io.Writer) error
|
||||
}
|
||||
|
||||
const (
|
||||
ModChart = "chart"
|
||||
ModPage = "page"
|
||||
)
|
||||
|
||||
var pat = regexp.MustCompile(`(__f__")|("__f__)|(__f__)`)
|
||||
|
||||
type pageRender struct {
|
||||
c interface{}
|
||||
before []func()
|
||||
}
|
||||
|
||||
// NewPageRender returns a render implementation for Page.
|
||||
func NewPageRender(c interface{}, before ...func()) Renderer {
|
||||
return &pageRender{c: c, before: before}
|
||||
}
|
||||
|
||||
// Render renders the page into the given io.Writer.
|
||||
func (r *pageRender) Render(w io.Writer) error {
|
||||
for _, fn := range r.before {
|
||||
fn()
|
||||
}
|
||||
|
||||
contents := []string{tpls.HeaderTpl, tpls.BaseTpl, tpls.PageTpl}
|
||||
tpl := MustTemplate(ModPage, contents)
|
||||
|
||||
var buf bytes.Buffer
|
||||
if err := tpl.ExecuteTemplate(&buf, ModPage, r.c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
content := pat.ReplaceAll(buf.Bytes(), []byte(""))
|
||||
|
||||
_, err := w.Write(content)
|
||||
return err
|
||||
}
|
||||
|
||||
type chartRender struct {
|
||||
c interface{}
|
||||
before []func()
|
||||
}
|
||||
|
||||
// NewChartRender returns a render implementation for Chart.
|
||||
func NewChartRender(c interface{}, before ...func()) Renderer {
|
||||
return &chartRender{c: c, before: before}
|
||||
}
|
||||
|
||||
// Render renders the chart into the given io.Writer.
|
||||
func (r *chartRender) Render(w io.Writer) error {
|
||||
for _, fn := range r.before {
|
||||
fn()
|
||||
}
|
||||
|
||||
contents := []string{tpls.HeaderTpl, tpls.BaseTpl, tpls.ChartTpl}
|
||||
tpl := MustTemplate(ModChart, contents)
|
||||
|
||||
var buf bytes.Buffer
|
||||
if err := tpl.ExecuteTemplate(&buf, ModChart, r.c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
content := pat.ReplaceAll(buf.Bytes(), []byte(""))
|
||||
|
||||
_, err := w.Write(content)
|
||||
return err
|
||||
}
|
||||
|
||||
// isSet check if the field exist in the chart instance
|
||||
// Shamed copy from https://stackoverflow.com/questions/44675087/golang-template-variable-isset
|
||||
func isSet(name string, data interface{}) bool {
|
||||
v := reflect.ValueOf(data)
|
||||
|
||||
if v.Kind() == reflect.Ptr {
|
||||
v = v.Elem()
|
||||
}
|
||||
|
||||
if v.Kind() != reflect.Struct {
|
||||
return false
|
||||
}
|
||||
|
||||
return v.FieldByName(name).IsValid()
|
||||
}
|
||||
|
||||
// MustTemplate creates a new template with the given name and parsed contents.
|
||||
func MustTemplate(name string, contents []string) *template.Template {
|
||||
tpl := template.New(name).Funcs(template.FuncMap{
|
||||
"safeJS": func(s interface{}) template.JS {
|
||||
return template.JS(fmt.Sprint(s))
|
||||
},
|
||||
"isSet": isSet,
|
||||
})
|
||||
tpl = template.Must(tpl.Parse(contents[0]))
|
||||
|
||||
for _, cont := range contents[1:] {
|
||||
tpl = template.Must(tpl.Parse(cont))
|
||||
}
|
||||
return tpl
|
||||
}
|
||||
20
vendor/github.com/go-echarts/go-echarts/v2/templates/base.tpl
generated
vendored
Normal file
20
vendor/github.com/go-echarts/go-echarts/v2/templates/base.tpl
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{{- define "base" }}
|
||||
<div class="container">
|
||||
<div class="item" id="{{ .ChartID }}" style="width:{{ .Initialization.Width }};height:{{ .Initialization.Height }};"></div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
let goecharts_{{ .ChartID | safeJS }} = echarts.init(document.getElementById('{{ .ChartID | safeJS }}'), "{{ .Theme }}");
|
||||
let option_{{ .ChartID | safeJS }} = {{ .JSONNotEscaped | safeJS }};
|
||||
{{ if isSet "BaseActions" . }}
|
||||
let action_{{ .ChartID | safeJS }} = {{ .JSONNotEscapedAction | safeJS }};
|
||||
{{ end }}
|
||||
goecharts_{{ .ChartID | safeJS }}.setOption(option_{{ .ChartID | safeJS }});
|
||||
goecharts_{{ .ChartID | safeJS }}.dispatchAction(action_{{ .ChartID | safeJS }});
|
||||
|
||||
{{- range .JSFunctions.Fns }}
|
||||
{{ . | safeJS }}
|
||||
{{- end }}
|
||||
</script>
|
||||
{{ end }}
|
||||
13
vendor/github.com/go-echarts/go-echarts/v2/templates/chart.tpl
generated
vendored
Normal file
13
vendor/github.com/go-echarts/go-echarts/v2/templates/chart.tpl
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{{- define "chart" }}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
{{- template "header" . }}
|
||||
<body>
|
||||
{{- template "base" . }}
|
||||
<style>
|
||||
.container {margin-top:30px; display: flex;justify-content: center;align-items: center;}
|
||||
.item {margin: auto;}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
{{ end }}
|
||||
18
vendor/github.com/go-echarts/go-echarts/v2/templates/header.tpl
generated
vendored
Normal file
18
vendor/github.com/go-echarts/go-echarts/v2/templates/header.tpl
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{{ define "header" }}
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{ .PageTitle }}</title>
|
||||
{{- range .JSAssets.Values }}
|
||||
<script src="{{ . }}"></script>
|
||||
{{- end }}
|
||||
{{- range .CustomizedJSAssets.Values }}
|
||||
<script src="{{ . }}"></script>
|
||||
{{- end }}
|
||||
{{- range .CSSAssets.Values }}
|
||||
<link href="{{ . }}" rel="stylesheet">
|
||||
{{- end }}
|
||||
{{- range .CustomizedCSSAssets.Values }}
|
||||
<link href="{{ . }}" rel="stylesheet">
|
||||
{{- end }}
|
||||
</head>
|
||||
{{ end }}
|
||||
21
vendor/github.com/go-echarts/go-echarts/v2/templates/page.tpl
generated
vendored
Normal file
21
vendor/github.com/go-echarts/go-echarts/v2/templates/page.tpl
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{{- define "page" }}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
{{- template "header" . }}
|
||||
<body>
|
||||
{{ if eq .Layout "none" }}
|
||||
{{- range .Charts }} {{ template "base" . }} {{- end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq .Layout "center" }}
|
||||
<style> .container {display: flex;justify-content: center;align-items: center;} .item {margin: auto;} </style>
|
||||
{{- range .Charts }} {{ template "base" . }} {{- end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq .Layout "flex" }}
|
||||
<style> .box { justify-content:center; display:flex; flex-wrap:wrap } </style>
|
||||
<div class="box"> {{- range .Charts }} {{ template "base" . }} {{- end }} </div>
|
||||
{{ end }}
|
||||
</body>
|
||||
</html>
|
||||
{{ end }}
|
||||
17
vendor/github.com/go-echarts/go-echarts/v2/templates/template.go
generated
vendored
Normal file
17
vendor/github.com/go-echarts/go-echarts/v2/templates/template.go
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
package templates
|
||||
|
||||
import _ "embed"
|
||||
|
||||
// BaseTpl Should check the BaseActions field before call JSONNotEscapedAction since BaseActions only exist in RectCharts
|
||||
//
|
||||
//go:embed base.tpl
|
||||
var BaseTpl string
|
||||
|
||||
//go:embed chart.tpl
|
||||
var ChartTpl string
|
||||
|
||||
//go:embed header.tpl
|
||||
var HeaderTpl string
|
||||
|
||||
//go:embed page.tpl
|
||||
var PageTpl string
|
||||
32
vendor/github.com/go-echarts/go-echarts/v2/types/charts.go
generated
vendored
Normal file
32
vendor/github.com/go-echarts/go-echarts/v2/types/charts.go
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
package types
|
||||
|
||||
// Chart Type contains string representations of chart types.
|
||||
const (
|
||||
ChartBar = "bar"
|
||||
ChartBar3D = "bar3D"
|
||||
ChartBoxPlot = "boxplot"
|
||||
ChartCartesian3D = "cartesian3D"
|
||||
ChartEffectScatter = "effectScatter"
|
||||
ChartFunnel = "funnel"
|
||||
ChartGauge = "gauge"
|
||||
ChartGeo = "geo"
|
||||
ChartGraph = "graph"
|
||||
ChartHeatMap = "heatmap"
|
||||
ChartKline = "candlestick"
|
||||
ChartLine = "line"
|
||||
ChartLine3D = "line3D"
|
||||
ChartLiquid = "liquidFill"
|
||||
ChartMap = "map"
|
||||
ChartParallel = "parallel"
|
||||
ChartPie = "pie"
|
||||
ChartRadar = "radar"
|
||||
ChartSankey = "sankey"
|
||||
ChartScatter = "scatter"
|
||||
ChartScatter3D = "scatter3D"
|
||||
ChartSurface3D = "surface"
|
||||
ChartThemeRiver = "themeRiver"
|
||||
ChartWordCloud = "wordCloud"
|
||||
ChartTree = "tree"
|
||||
ChartTreeMap = "treemap"
|
||||
ChartSunburst = "sunburst"
|
||||
)
|
||||
15
vendor/github.com/go-echarts/go-echarts/v2/types/lang.go
generated
vendored
Normal file
15
vendor/github.com/go-echarts/go-echarts/v2/types/lang.go
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
package types
|
||||
|
||||
// thoughts on those boxed type for default value solution...
|
||||
type (
|
||||
Bool *bool
|
||||
Integer *int
|
||||
)
|
||||
|
||||
func newBool(val bool) Bool {
|
||||
return &val
|
||||
}
|
||||
|
||||
func newInteger(val int) Integer {
|
||||
return &val
|
||||
}
|
||||
54
vendor/github.com/go-echarts/go-echarts/v2/types/orderedset.go
generated
vendored
Normal file
54
vendor/github.com/go-echarts/go-echarts/v2/types/orderedset.go
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
package types
|
||||
|
||||
type Index struct {
|
||||
index int
|
||||
}
|
||||
|
||||
// OrderedSet represents an ordered set.
|
||||
type OrderedSet struct {
|
||||
filter map[string]*Index
|
||||
cur int
|
||||
Values []string
|
||||
}
|
||||
|
||||
// Init creates a new OrderedSet instance, and adds any given items into this set.
|
||||
func (o *OrderedSet) Init(items ...string) {
|
||||
o.filter = make(map[string]*Index)
|
||||
o.cur = 0
|
||||
for _, item := range items {
|
||||
o.Add(item)
|
||||
}
|
||||
}
|
||||
|
||||
// Add adds a new item into the ordered set
|
||||
func (o *OrderedSet) Add(item string) {
|
||||
if o.filter[item] == nil {
|
||||
o.filter[item] = &Index{
|
||||
index: o.cur,
|
||||
}
|
||||
o.cur++
|
||||
o.Values = append(o.Values, item)
|
||||
}
|
||||
}
|
||||
|
||||
func (o *OrderedSet) Remove(item string) {
|
||||
if o.filter[item] != nil {
|
||||
idx := o.filter[item].index
|
||||
o.Values = append(o.Values[:idx], o.Values[idx+1:]...)
|
||||
|
||||
renew := &OrderedSet{}
|
||||
renew.Init(o.Values...)
|
||||
|
||||
o.cur = renew.cur
|
||||
o.filter = renew.filter
|
||||
o.Values = renew.Values
|
||||
}
|
||||
}
|
||||
|
||||
func (o *OrderedSet) Size() int {
|
||||
return o.cur
|
||||
}
|
||||
|
||||
func (o *OrderedSet) Contains(item string) bool {
|
||||
return o.filter[item] != nil
|
||||
}
|
||||
17
vendor/github.com/go-echarts/go-echarts/v2/types/themes.go
generated
vendored
Normal file
17
vendor/github.com/go-echarts/go-echarts/v2/types/themes.go
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
package types
|
||||
|
||||
// Theme Type contains string representations of theme types.
|
||||
const (
|
||||
ThemeChalk = "chalk"
|
||||
ThemeEssos = "essos"
|
||||
ThemeInfographic = "infographic"
|
||||
ThemeMacarons = "macarons"
|
||||
ThemePurplePassion = "purple-passion"
|
||||
ThemeRoma = "roma"
|
||||
ThemeRomantic = "romantic"
|
||||
ThemeShine = "shine"
|
||||
ThemeVintage = "vintage"
|
||||
ThemeWalden = "walden"
|
||||
ThemeWesteros = "westeros"
|
||||
ThemeWonderland = "wonderland"
|
||||
)
|
||||
9
vendor/modules.txt
vendored
Normal file
9
vendor/modules.txt
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# github.com/go-echarts/go-echarts/v2 v2.3.1
|
||||
## explicit; go 1.18
|
||||
github.com/go-echarts/go-echarts/v2/actions
|
||||
github.com/go-echarts/go-echarts/v2/charts
|
||||
github.com/go-echarts/go-echarts/v2/datasets
|
||||
github.com/go-echarts/go-echarts/v2/opts
|
||||
github.com/go-echarts/go-echarts/v2/render
|
||||
github.com/go-echarts/go-echarts/v2/templates
|
||||
github.com/go-echarts/go-echarts/v2/types
|
||||
Reference in New Issue
Block a user