feat: support funnel chart

This commit is contained in:
vicanso 2022-03-05 07:22:32 +08:00
parent b93d096633
commit 5519d2eca6
9 changed files with 432 additions and 18 deletions

View file

@ -51,9 +51,17 @@ func radarChartRender(opt radarChartOption, result *basicRenderResult) error {
if sides < 3 {
return errors.New("The count of indicator should be >= 3")
}
for _, indicator := range opt.Indicators {
maxValues := make([]float64, len(opt.Indicators))
for _, series := range opt.SeriesList {
for index, item := range series.Data {
if index < len(maxValues) && item.Value > maxValues[index] {
maxValues[index] = item.Value
}
}
}
for index, indicator := range opt.Indicators {
if indicator.Max <= 0 {
return errors.New("The max of indicator should be > 0")
opt.Indicators[index].Max = maxValues[index]
}
}
d, err := NewDraw(DrawOption{