Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf525d1
commit 69c70bf
Showing
4 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package charts | ||
|
||
import ( | ||
"github.com/go-echarts/go-echarts/v2/opts" | ||
"github.com/go-echarts/go-echarts/v2/render" | ||
"github.com/go-echarts/go-echarts/v2/types" | ||
) | ||
|
||
// Tree represents a Tree chart. | ||
type Tree struct { | ||
RectChart | ||
} | ||
|
||
// Type returns the chart type. | ||
func (Tree) Type() string { return types.Tree } | ||
|
||
// NewTree creates a new Tree chart instance. | ||
func NewTree() *Tree { | ||
c := &Tree{} | ||
c.initBaseConfiguration() | ||
c.Renderer = render.NewChartRender(c, c.Validate) | ||
return c | ||
} | ||
|
||
func (c *Tree) AddSeries(name string, data []opts.TreeData, options ...SeriesOpts) *Tree { | ||
series := SingleSeries{Name: name, Type: types.Tree, Data: data} | ||
series.configureSeriesOpts(options...) | ||
c.MultiSeries = append(c.MultiSeries, series) | ||
return c | ||
} | ||
|
||
// Validate validates the given configuration. | ||
func (c *Tree) Validate() { | ||
c.Assets.Validate(c.AssetsHost) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,5 @@ const ( | |
ChartSurface3D = "surface" | ||
ChartThemeRiver = "themeRiver" | ||
ChartWordCloud = "wordCloud" | ||
Tree = "tree" | ||
) |