fix: support chinese for axis, #4

This commit is contained in:
vicanso 2022-05-01 11:15:13 +08:00
parent a713c3023e
commit cad8296e28
4 changed files with 7 additions and 0 deletions

View file

@ -23,10 +23,12 @@
package charts
import (
"github.com/golang/freetype/truetype"
"github.com/wcharczuk/go-chart/v2"
)
type XAxisOption struct {
Font *truetype.Font
// The boundary gap on both sides of a coordinate axis.
// Nil or *true means the center part of two axis ticks
BoundaryGap *bool
@ -66,6 +68,7 @@ func drawXAxis(p *Draw, opt *XAxisOption, yAxisCount int) (int, *Range, error) {
Right: right,
}),
)
dXAxis.Font = opt.Font
if err != nil {
return 0, nil, err
}