Debian Codegraph @

charts/radar.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 // Radar represents a radar chart.
10 type Radar struct {
11 BaseConfiguration
12
13 // SymbolKeepAspect is whether to keep aspect for symbols in the form of path://.
14 SymbolKeepAspect types.Bool
15 }
16
17 // Type returns the chart type.
18 func (*Radar) Type() string { return types.ChartRadar }
19
20 // NewRadar creates a new radar chart.
21 func NewRadar() *Radar {
22 c := &Radar{}
23 c.initBaseConfiguration()
24 c.Renderer = render.NewChartRender(c, c.Validate)
25 c.hasRadar = true
26 return c
27 }
28
29 // AddSeries adds new data sets.
30 func (c *Radar) AddSeries(name string, data []opts.RadarData, options ...SeriesOpts) *Radar {
31 series := SingleSeries{Name: name, Type: types.ChartRadar, Data: data, SymbolKeepAspect: c.SymbolKeepAspect}
32 series.ConfigureSeriesOpts(options...)
33 c.MultiSeries = append(c.MultiSeries, series)
34 c.legends = append(c.legends, name)
35 return c
36 }
37
38 // SetGlobalOptions sets options for the Radar instance.
39 func (c *Radar) SetGlobalOptions(options ...GlobalOpts) *Radar {
40 c.BaseConfiguration.setBaseGlobalOptions(options...)
41 return c
42 }
43
44 // Validate validates the given configuration.
45 func (c *Radar) Validate() {
46 c.Legend.Data = c.legends
47 c.Assets.Validate(c.AssetsHost)
48 }