refactor: adjust theme of chart

This commit is contained in:
vicanso 2022-02-01 10:08:59 +08:00
parent 910e2dc422
commit 3a9897f9ad
5 changed files with 79 additions and 44 deletions

View file

@ -27,11 +27,12 @@ import "github.com/wcharczuk/go-chart/v2"
type XAxisOption struct {
BoundaryGap *bool
Data []string
Theme string
// TODO split number
}
// drawXAxis draws x axis, and returns the height, range of if.
func drawXAxis(p *Draw, opt *XAxisOption, theme *Theme) (int, *Range, error) {
func drawXAxis(p *Draw, opt *XAxisOption) (int, *Range, error) {
dXAxis, err := NewDraw(
DrawOption{
Parent: p,
@ -43,6 +44,7 @@ func drawXAxis(p *Draw, opt *XAxisOption, theme *Theme) (int, *Range, error) {
if err != nil {
return 0, nil, err
}
theme := NewTheme(opt.Theme)
data := NewAxisDataListFromStringList(opt.Data)
style := AxisStyle{
BoundaryGap: opt.BoundaryGap,