Debian Codegraph @

charts/parallel.go

raw symbols SCIP
1 package charts
2
3 import (
4 "github.com/go-echarts/go-echarts/v2/opts"
5 "github.com/go-echarts/go-echarts/v2/render"
6 "github.com/go-echarts/go-echarts/v2/types"
7 )
8
9 // Parallel represents a parallel axis.
10 type Parallel struct {
11 BaseConfiguration
12 }
13
14 // Type returns the chart type.
15 func (*Parallel) Type() string { return types.ChartParallel }
16
17 // NewParallel creates a new parallel instance.
18 func NewParallel() *Parallel {
19 c := &Parallel{}
20 c.initBaseConfiguration()
21 c.Renderer = render.NewChartRender(c, c.Validate)
22 c.hasParallel = true
23 return c
24 }
25
26 // AddSeries adds new data sets.
27 func (c *Parallel) AddSeries(name string, data []opts.ParallelData, options ...SeriesOpts) *Parallel {
28 series := SingleSeries{Name: name, Type: types.ChartParallel, Data: data}
29 series.ConfigureSeriesOpts(options...)
30 c.MultiSeries = append(c.MultiSeries, series)
31 return c
32 }
33
34 // SetGlobalOptions sets options for the Parallel instance.
35 func (c *Parallel) SetGlobalOptions(options ...GlobalOpts) *Parallel {
36 c.BaseConfiguration.setBaseGlobalOptions(options...)
37 return c
38 }
39
40 // Validate validates the given configuration.
41 func (c *Parallel) Validate() {
42 c.Assets.Validate(c.AssetsHost)
43 }