| 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 |
|
| 9 |
type Chart3D struct { |
| 10 |
BaseConfiguration |
| 11 |
} |
| 12 |
|
| 13 |
|
| 14 |
func WithXAxis3DOpts(opt opts.XAxis3D) GlobalOpts { |
| 15 |
return func(bc *BaseConfiguration) { |
| 16 |
bc.XAxis3D = opt |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
|
| 21 |
func WithYAxis3DOpts(opt opts.YAxis3D) GlobalOpts { |
| 22 |
return func(bc *BaseConfiguration) { |
| 23 |
bc.YAxis3D = opt |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
func WithZAxis3DOpts(opt opts.ZAxis3D) GlobalOpts { |
| 29 |
return func(bc *BaseConfiguration) { |
| 30 |
bc.ZAxis3D = opt |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
|
| 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 |
|
| 59 |
func (c *Chart3D) SetGlobalOptions(options ...GlobalOpts) *Chart3D { |
| 60 |
c.BaseConfiguration.setBaseGlobalOptions(options...) |
| 61 |
return c |
| 62 |
} |
| 63 |
|
| 64 |
|
| 65 |
func (c *Chart3D) Validate() { |
| 66 |
c.Assets.Validate(c.AssetsHost) |
| 67 |
} |