feat: support between ticks

This commit is contained in:
vicanso 2021-12-13 23:46:10 +08:00
parent 402141c484
commit f3009b965f
7 changed files with 175 additions and 29 deletions

View file

@ -69,7 +69,10 @@ func ToSVG(c *chart.Chart) ([]byte, error) {
return render(c, chart.SVG)
}
func New(opt Option) *chart.Chart {
xAxis, xValues := GetXAxisAndValues(opt.XAxis, opt.Theme)
tickPosition := chart.TickPositionBetweenTicks
// tickPosition = chart.TickPositionUnset
xAxis, xValues := GetXAxisAndValues(opt.XAxis, tickPosition, opt.Theme)
legendSize := len(opt.Legend.Data)
for index, item := range opt.Series {
@ -87,7 +90,7 @@ func New(opt Option) *chart.Chart {
Height: opt.Height,
XAxis: xAxis,
YAxis: GetYAxis(opt.Theme),
Series: GetSeries(opt.Series, opt.Theme),
Series: GetSeries(opt.Series, tickPosition, opt.Theme),
}
// 设置secondary的样式
c.YAxisSecondary.Style = c.YAxis.Style