test: add test for charts

This commit is contained in:
vicanso 2022-06-20 23:23:21 +08:00
parent a6b92f1d47
commit 212a51083f
11 changed files with 963 additions and 16 deletions

View file

@ -62,6 +62,20 @@ type RadarChartOption struct {
backgroundIsFilled bool
}
func NewRadarIndicators(names []string, values []float64) []RadarIndicator {
if len(names) != len(values) {
return nil
}
indicators := make([]RadarIndicator, len(names))
for index, name := range names {
indicators[index] = RadarIndicator{
Name: name,
Max: values[index],
}
}
return indicators
}
func NewRadarChart(p *Painter, opt RadarChartOption) *radarChart {
if opt.Theme == nil {
opt.Theme = defaultTheme