Skip to content

Commit

Permalink
add: radar series (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
Koooooo-7 committed Feb 7, 2024
1 parent bdd5ec3 commit a844c08
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
22 changes: 18 additions & 4 deletions charts/series.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type SingleSeries struct {
EdgeLabel interface{} `json:"edgeLabel,omitempty"`
Draggable types.Bool `json:"draggable,omitempty"`
FocusNodeAdjacency types.Bool `json:"focusNodeAdjacency,omitempty"`
// Line
// Line | Radar
SymbolKeepAspect types.Bool `json:"symbolKeepAspect,omitempty"`

// BarWidth The width options of the bar. Adaptive when not specified.
Expand All @@ -51,7 +51,7 @@ type SingleSeries struct {
BarMinWidth string `json:"barMinWidth,omitempty"`
BarMaxWidth string `json:"barMaxWidth,omitempty"`

// Line | Bar | Pie | Scatter
// Line | Bar | Pie | Scatter | Radar
ColorBy string `json:"colorBy,omitempty"`
// Line | Bar
PolarIndex int `json:"polarIndex,omitempty"`
Expand All @@ -63,7 +63,7 @@ type SingleSeries struct {
ConnectNulls types.Bool `json:"connectNulls,omitempty"`
// Line
ShowSymbol types.Bool `json:"showSymbol,omitempty"`
// Line | Scatter
// Line | Scatter | Radar
Symbol string `json:"symbol,omitempty"`
Color string `json:"color,omitempty"`

Expand All @@ -83,7 +83,7 @@ type SingleSeries struct {
// Pie
Radius interface{} `json:"radius,omitempty"`

// Line | Scatter
// Line | Scatter | Radar
SymbolSize interface{} `json:"symbolSize,omitempty"`

// Tree
Expand All @@ -96,6 +96,9 @@ type SingleSeries struct {
Top string `json:"top,omitempty"`
Bottom string `json:"bottom,omitempty"`

// Radar
RadarIndex int `json:"radarIndex,omitempty"`

// TreeMap
LeafDepth int `json:"leafDepth,omitempty"`
Levels interface{} `json:"levels,omitempty"`
Expand Down Expand Up @@ -363,6 +366,17 @@ func WithEffectScatterChartOpts(opt opts.EffectScatterChart) SeriesOpts {
}
}

// WithRadarChartOpts sets the RadarChart option.
func WithRadarChartOpts(opt opts.RadarChart) SeriesOpts {
return func(s *SingleSeries) {
s.ColorBy = opt.ColorBy
s.RadarIndex = opt.RadarIndex
s.Symbol = opt.Symbol
s.SymbolSize = opt.SymbolSize
s.SymbolKeepAspect = opt.SymbolKeepAspect
}
}

// WithLiquidChartOpts sets the LiquidChart option.
func WithLiquidChartOpts(opt opts.LiquidChart) SeriesOpts {
return func(s *SingleSeries) {
Expand Down
24 changes: 24 additions & 0 deletions opts/series_radar.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package opts

import "github.com/go-echarts/go-echarts/v2/types"

type RadarChart struct {
// ColorBy The policy to take color from option.color. Valid values:
// 'series': assigns the colors in the palette by series, so that all data in the same series are in the same color;
// 'data': assigns colors in the palette according to data items, with each data item using a different color.
ColorBy string

// RadarIndex Index of radar component that radar chart uses.
RadarIndex int
// Icon types provided by ECharts includes
// 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none'
// Full documentation: https://echarts.apache.org/en/option.html#series-line.symbol
Symbol string

// symbol size. It can be set to single numbers like 10, or use an array to represent width and height. For example, [20, 10] means symbol width is 20, and height is10.
// Full documentation: https://echarts.apache.org/en/option.html#series-line.symbolSize
SymbolSize interface{}

// SymbolKeepAspect is whether to keep aspect for symbols in the form of path://.
SymbolKeepAspect types.Bool
}

0 comments on commit a844c08

Please sign in to comment.