Debian Codegraph @

charts/chart3d.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/types"
6 )
7
8 // Chart3D is a chart in 3D coordinates.
9 type Chart3D struct {
10 BaseConfiguration
11 }
12
13 // WithXAxis3DOpts sets the X axis of the Chart3D instance.
14 func WithXAxis3DOpts(opt opts.XAxis3D) GlobalOpts {
15 return func(bc *BaseConfiguration) {
16 bc.XAxis3D = opt
17 }
18 }
19
20 // WithYAxis3DOpts sets the Y axis of the Chart3D instance.
21 func WithYAxis3DOpts(opt opts.YAxis3D) GlobalOpts {
22 return func(bc *BaseConfiguration) {
23 bc.YAxis3D = opt
24 }
25 }
26
27 // WithZAxis3DOpts sets the Z axis of the Chart3D instance.
28 func WithZAxis3DOpts(opt opts.ZAxis3D) GlobalOpts {
29 return func(bc *BaseConfiguration) {
30 bc.ZAxis3D = opt
31 }
32 }
33
34 // WithGrid3DOpts sets the grid of the Chart3D instance.
35 func WithGrid3DOpts(opt opts.Grid3D) GlobalOpts {
36 return func(bc *BaseConfiguration) {
37 bc.Grid3D = opt
38 }
39 }
40
41 func (c *Chart3D) initChart3D() {
42 c.JSAssets.Add(opts.CompatibleEchartsJS)
43 c.JSAssets.Add("echarts-gl.min.js")
44 c.has3DAxis = true
45 }
46
47 func (c *Chart3D) addSeries(chartType, name string, data []opts.Chart3DData, options ...SeriesOpts) {
48 series := SingleSeries{
49 Name: name,
50 Type: chartType,
51 Data: data,
52 CoordSystem: types.ChartCartesian3D,
53 }
54 series.ConfigureSeriesOpts(options...)
55 c.MultiSeries = append(c.MultiSeries, series)
56 }
57
58 // SetGlobalOptions sets options for the Chart3D instance.
59 func (c *Chart3D) SetGlobalOptions(options ...GlobalOpts) *Chart3D {
60 c.BaseConfiguration.setBaseGlobalOptions(options...)
61 return c
62 }
63
64 // Validate validates the given configuration.
65 func (c *Chart3D) Validate() {
66 c.Assets.Validate(c.AssetsHost)
67 }