| 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 |
|
| 10 |
type Tree struct { |
| 11 |
BaseConfiguration |
| 12 |
} |
| 13 |
|
| 14 |
|
| 15 |
func (*Tree) Type() string { return types.ChartTree } |
| 16 |
|
| 17 |
|
| 18 |
func NewTree() *Tree { |
| 19 |
c := &Tree{} |
| 20 |
c.initBaseConfiguration() |
| 21 |
c.Renderer = render.NewChartRender(c, c.Validate) |
| 22 |
return c |
| 23 |
} |
| 24 |
|
| 25 |
|
| 26 |
func (c *Tree) AddSeries(name string, data []opts.TreeData, options ...SeriesOpts) *Tree { |
| 27 |
series := SingleSeries{Name: name, Type: types.ChartTree, Data: data} |
| 28 |
series.ConfigureSeriesOpts(options...) |
| 29 |
c.MultiSeries = append(c.MultiSeries, series) |
| 30 |
return c |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
func (c *Tree) SetGlobalOptions(options ...GlobalOpts) *Tree { |
| 35 |
c.BaseConfiguration.setBaseGlobalOptions(options...) |
| 36 |
return c |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
func (c *Tree) Validate() { |
| 41 |
c.Assets.Validate(c.AssetsHost) |
| 42 |
} |