feat: support option function for chart render

This commit is contained in:
vicanso 2022-03-08 23:33:16 +08:00
parent 1be8d43405
commit 2316689ce5
5 changed files with 429 additions and 3 deletions

View file

@ -283,7 +283,10 @@ func (r *basicRenderResult) getYRange(index int) *Range {
}
// Render renders the chart by option
func Render(opt ChartOption) (*Draw, error) {
func Render(opt ChartOption, optFuncs ...OptionFunc) (*Draw, error) {
for _, optFunc := range optFuncs {
optFunc(&opt)
}
if len(opt.SeriesList) == 0 {
return nil, errors.New("series can not be nil")
}