diff --git a/mark_line_test.go b/mark_line_test.go
index 84152ce..ef29e6f 100644
--- a/mark_line_test.go
+++ b/mark_line_test.go
@@ -67,7 +67,7 @@ func TestMarkLine(t *testing.T) {
}
return p.Bytes()
},
- result: "",
+ result: "",
},
}
for _, tt := range tests {
diff --git a/range.go b/range.go
index 579a77f..ebd0b2d 100644
--- a/range.go
+++ b/range.go
@@ -60,7 +60,10 @@ func NewRange(opt AxisRangeOption) axisRange {
r := math.Abs(max - min)
// 最小单位计算
- unit := 2
+ unit := 1
+ if r > 5 {
+ unit = 2
+ }
if r > 10 {
unit = 4
}
@@ -85,6 +88,10 @@ func NewRange(opt AxisRangeOption) axisRange {
}
}
max = min + float64(unit*divideCount)
+ expectMax := opt.Max * 2
+ if max > expectMax {
+ max = float64(ceilFloatToInt(expectMax))
+ }
return axisRange{
divideCount: divideCount,
min: min,