forked from go-echarts/go-echarts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chart3d.go
executable file
路66 lines (56 loc) 路 1.39 KB
/
chart3d.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package charts
import (
"github.com/KiVirgil/go-echarts/v2/opts"
"github.com/KiVirgil/go-echarts/v2/types"
)
// Chart3D is a chart in 3D coordinates.
type Chart3D struct {
BaseConfiguration
}
// WithXAxis3DOpts
func WithXAxis3DOpts(opt opts.XAxis3D) GlobalOpts {
return func(bc *BaseConfiguration) {
bc.XAxis3D = opt
}
}
// WithYAxis3DOpts
func WithYAxis3DOpts(opt opts.YAxis3D) GlobalOpts {
return func(bc *BaseConfiguration) {
bc.YAxis3D = opt
}
}
// WithZAxis3DOpts
func WithZAxis3DOpts(opt opts.ZAxis3D) GlobalOpts {
return func(bc *BaseConfiguration) {
bc.ZAxis3D = opt
}
}
// WithGrid3DOpts
func WithGrid3DOpts(opt opts.Grid3D) GlobalOpts {
return func(bc *BaseConfiguration) {
bc.Grid3D = opt
}
}
func (c *Chart3D) initChart3D() {
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
func (c *Chart3D) Validate() {
c.Assets.Validate(c.AssetsHost)
}