refactor: auto count the split number for x axis

This commit is contained in:
vicanso 2022-02-06 09:55:27 +08:00
parent 3219ce521b
commit c01f4001f1
6 changed files with 134 additions and 58 deletions

View file

@ -29,6 +29,7 @@ type XAxisOption struct {
Data []string
Theme string
Hidden bool
SplitNumber int
// TODO split number
}
@ -47,11 +48,12 @@ func drawXAxis(p *Draw, opt *XAxisOption) (int, *Range, error) {
}
theme := NewTheme(opt.Theme)
data := NewAxisDataListFromStringList(opt.Data)
style := AxisStyle{
style := AxisOption{
BoundaryGap: opt.BoundaryGap,
StrokeColor: theme.GetAxisStrokeColor(),
FontColor: theme.GetAxisStrokeColor(),
StrokeWidth: 1,
SplitNumber: opt.SplitNumber,
}
boundary := true