Skip to content

Commit

Permalink
add: effect scatter series (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
Koooooo-7 committed Feb 6, 2024
1 parent 55c37f2 commit bdd5ec3
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
13 changes: 13 additions & 0 deletions charts/series.go
Expand Up @@ -350,6 +350,19 @@ func WithScatterChartOpts(opt opts.ScatterChart) SeriesOpts {
}
}

// WithEffectScatterChartOpts sets the ScatterChart option.
func WithEffectScatterChartOpts(opt opts.EffectScatterChart) SeriesOpts {
return func(s *SingleSeries) {
s.ColorBy = opt.ColorBy
s.CoordSystem = opt.CoordSystem
s.XAxisIndex = opt.XAxisIndex
s.YAxisIndex = opt.YAxisIndex
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
37 changes: 37 additions & 0 deletions opts/series_effect_scatter.go
@@ -0,0 +1,37 @@
package opts

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

// EffectScatterChart is the option set for a effectScatter chart.
// https://echarts.apache.org/en/option.html#series-effectScatter
type EffectScatterChart 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

// CoordinateSystem The coordinate used in the series, whose options are:
//'cartesian2d' Use a two-dimensional rectangular coordinate (also known as Cartesian coordinate), with xAxisIndex and
// yAxisIndex to assign the corresponding axis component.
//
// 'polar' Use polar coordinates, with polarIndex to assign the corresponding polar coordinate component.
CoordSystem string

// Index of x axis to combine with, which is useful for multiple x axes in one chart.
XAxisIndex int

// Index of x axis to combine with, which is useful for multiple y axes in one chart.
YAxisIndex 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 bdd5ec3

Please sign in to comment.