forked from go-echarts/go-echarts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
boxplot.go
executable file
路44 lines (37 loc) 路 1.07 KB
/
boxplot.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
package charts
import (
"github.com/KiVirgil/go-echarts/v2/opts"
"github.com/KiVirgil/go-echarts/v2/render"
"github.com/KiVirgil/go-echarts/v2/types"
)
// BoxPlot represents a boxplot chart.
type BoxPlot struct {
RectChart
}
// Type returns the chart type.
func (BoxPlot) Type() string { return types.ChartBoxPlot }
// NewBoxPlot creates a new boxplot chart.
func NewBoxPlot() *BoxPlot {
c := &BoxPlot{}
c.initBaseConfiguration()
c.Renderer = render.NewChartRender(c, c.Validate)
c.hasXYAxis = true
return c
}
// SetXAxis adds the X axis.
func (c *BoxPlot) SetXAxis(x interface{}) *BoxPlot {
c.xAxisData = x
return c
}
// AddSeries adds the new series.
func (c *BoxPlot) AddSeries(name string, data []opts.BoxPlotData, options ...SeriesOpts) *BoxPlot {
series := SingleSeries{Name: name, Type: types.ChartBoxPlot, Data: data}
series.configureSeriesOpts(options...)
c.MultiSeries = append(c.MultiSeries, series)
return c
}
// Validate validates the given configuration.
func (c *BoxPlot) Validate() {
c.XAxisList[0].Data = c.xAxisData
c.Assets.Validate(c.AssetsHost)
}