refactor: add examples of chart

This commit is contained in:
vicanso 2022-02-12 11:22:08 +08:00
parent e558634dda
commit 4262b148ca
10 changed files with 796 additions and 100 deletions

View file

@ -49,6 +49,17 @@ type LegendOption struct {
// The layout orientation of legend, it can be horizontal or vertical, default is horizontal.
Orient string
}
func NewLegendOption(data []string, position ...string) LegendOption {
opt := LegendOption{
Data: data,
}
if len(position) != 0 {
opt.Left = position[0]
}
return opt
}
type legend struct {
d *Draw
opt *LegendOption