test: add test for x axis
This commit is contained in:
parent
cc6a1832fe
commit
e07cb90607
3 changed files with 106 additions and 5 deletions
16
xaxis.go
16
xaxis.go
|
|
@ -25,16 +25,24 @@ package charts
|
|||
import "github.com/wcharczuk/go-chart/v2"
|
||||
|
||||
type XAxisOption struct {
|
||||
// The boundary gap on both sides of a coordinate axis.
|
||||
// Nil or *true means the center part of two axis ticks
|
||||
BoundaryGap *bool
|
||||
Data []string
|
||||
Theme string
|
||||
Hidden bool
|
||||
// The data value of x axis
|
||||
Data []string
|
||||
// The theme of chart
|
||||
Theme string
|
||||
// Hidden x axis
|
||||
Hidden bool
|
||||
// Number of segments that the axis is split into. Note that this number serves only as a recommendation.
|
||||
SplitNumber int
|
||||
// TODO split number
|
||||
}
|
||||
|
||||
// drawXAxis draws x axis, and returns the height, range of if.
|
||||
func drawXAxis(p *Draw, opt *XAxisOption) (int, *Range, error) {
|
||||
if opt.Hidden {
|
||||
return 0, nil, nil
|
||||
}
|
||||
dXAxis, err := NewDraw(
|
||||
DrawOption{
|
||||
Parent: p,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue