test: add test for series

This commit is contained in:
vicanso 2022-02-12 13:47:13 +08:00
parent 1c89ed29be
commit 51682069d7
7 changed files with 370 additions and 18 deletions

View file

@ -94,6 +94,7 @@ type Series struct {
MarkPoint SeriesMarkPoint
MarkLine SeriesMarkLine
}
type SeriesList []Series
type PieSeriesOption struct {
Radius string
@ -158,6 +159,14 @@ func (s *Series) Summary() seriesSummary {
}
}
func (sl SeriesList) Names() []string {
names := make([]string, len(sl))
for index, s := range sl {
names[index] = s.Name
}
return names
}
type LabelFormatter func(index int, value float64, percent float64) string
func NewPieLabelFormatter(seriesNames []string, layout string) LabelFormatter {