refactor: support echarts options

This commit is contained in:
vicanso 2021-12-16 23:00:31 +08:00
parent 4d8086a283
commit 8f7587561f
7 changed files with 294 additions and 51 deletions

26
axis.go
View file

@ -102,6 +102,32 @@ func GetXAxisAndValues(xAxis XAxis, tickPosition chart.TickPosition, theme strin
}, xValues
}
func GetSecondaryYAxis(theme string) chart.YAxis {
// TODO
if theme == ThemeDark {
return chart.YAxis{}
}
// strokeColor := drawing.Color{
// R: 224,
// G: 230,
// B: 241,
// A: 255,
// }
return chart.YAxis{
ValueFormatter: func(v interface{}) string {
value, ok := v.(float64)
if !ok {
return ""
}
return humanize.Commaf(value)
},
AxisType: chart.YAxisPrimary,
GridMajorStyle: chart.Hidden(),
GridMinorStyle: chart.Hidden(),
Style: chart.Hidden(),
}
}
func GetYAxis(theme string) chart.YAxis {
// TODO
if theme == ThemeDark {