Debian Codegraph @

charts/heatmap.go

raw symbols SCIP
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 // HeatMap represents a heatmap chart.
10 type HeatMap struct {
11 RectChart
12 }
13
14 // Type returns the chart type.
15 func (*HeatMap) Type() string { return types.ChartHeatMap }
16
17 // NewHeatMap creates a new heatmap chart.
18 func NewHeatMap() *HeatMap {
19 c := &HeatMap{}
20 c.initBaseConfiguration()
21 c.Renderer = render.NewChartRender(c, c.Validate)
22 c.hasXYAxis = true
23 return c
24 }
25
26 // SetXAxis adds the X axis.
27 func (c *HeatMap) SetXAxis(x interface{}) *HeatMap {
28 c.xAxisData = x
29 return c
30 }
31
32 // AddSeries adds the new series.
33 func (c *HeatMap) AddSeries(name string, data []opts.HeatMapData, options ...SeriesOpts) *HeatMap {
34 series := SingleSeries{Name: name, Type: types.ChartHeatMap, Data: data}
35 series.ConfigureSeriesOpts(options...)
36 c.MultiSeries = append(c.MultiSeries, series)
37 return c
38 }
39
40 // AddCalendar adds the calendar configuration to the chart.
41 func (c *HeatMap) AddCalendar(calendar ...*opts.Calendar) *HeatMap {
42 c.Calendar = append(c.Calendar, calendar...)
43 c.hasXYAxis = false
44 return c
45 }
46
47 // Validate validates the given configuration.
48 func (c *HeatMap) Validate() {
49 c.Assets.Validate(c.AssetsHost)
50 }