fix: fix min and max option of y axis
This commit is contained in:
parent
128d5b2774
commit
4a1ff80556
2 changed files with 7 additions and 6 deletions
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
|
|
@ -14,6 +14,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go:
|
go:
|
||||||
|
- '1.19'
|
||||||
- '1.18'
|
- '1.18'
|
||||||
- '1.17'
|
- '1.17'
|
||||||
- '1.16'
|
- '1.16'
|
||||||
|
|
|
||||||
12
charts.go
12
charts.go
|
|
@ -174,12 +174,6 @@ func defaultRender(p *Painter, opt defaultRenderOption) (*defaultRenderResult, e
|
||||||
yAxisOption = opt.YAxisOptions[index]
|
yAxisOption = opt.YAxisOptions[index]
|
||||||
}
|
}
|
||||||
max, min := opt.SeriesList.GetMaxMin(index)
|
max, min := opt.SeriesList.GetMaxMin(index)
|
||||||
if yAxisOption.Min != nil {
|
|
||||||
min = *yAxisOption.Min
|
|
||||||
}
|
|
||||||
if yAxisOption.Max != nil {
|
|
||||||
max = *yAxisOption.Max
|
|
||||||
}
|
|
||||||
r := NewRange(AxisRangeOption{
|
r := NewRange(AxisRangeOption{
|
||||||
Min: min,
|
Min: min,
|
||||||
Max: max,
|
Max: max,
|
||||||
|
|
@ -188,6 +182,12 @@ func defaultRender(p *Painter, opt defaultRenderOption) (*defaultRenderResult, e
|
||||||
// 分隔数量
|
// 分隔数量
|
||||||
DivideCount: defaultAxisDivideCount,
|
DivideCount: defaultAxisDivideCount,
|
||||||
})
|
})
|
||||||
|
if yAxisOption.Min != nil && *yAxisOption.Min <= min {
|
||||||
|
r.min = *yAxisOption.Min
|
||||||
|
}
|
||||||
|
if yAxisOption.Max != nil && *yAxisOption.Max >= max {
|
||||||
|
r.max = *yAxisOption.Max
|
||||||
|
}
|
||||||
result.axisRanges[index] = r
|
result.axisRanges[index] = r
|
||||||
|
|
||||||
if yAxisOption.Theme == nil {
|
if yAxisOption.Theme == nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue