fix: fix overflow point
This commit is contained in:
parent
bbbdbe7c5e
commit
28bb9c57bc
3 changed files with 10 additions and 4 deletions
|
|
@ -98,7 +98,7 @@ func barChartRender(opt barChartOption, result *basicRenderResult) ([]markPointR
|
||||||
})
|
})
|
||||||
divideValues := xRange.AutoDivide()
|
divideValues := xRange.AutoDivide()
|
||||||
for j, item := range series.Data {
|
for j, item := range series.Data {
|
||||||
if j >= len(divideValues) {
|
if j >= xRange.divideCount {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
x := divideValues[j]
|
x := divideValues[j]
|
||||||
|
|
|
||||||
|
|
@ -423,6 +423,7 @@ func indexHandler(w http.ResponseWriter, req *http.Request) {
|
||||||
20.0,
|
20.0,
|
||||||
6.4,
|
6.4,
|
||||||
3.3,
|
3.3,
|
||||||
|
10.2,
|
||||||
}),
|
}),
|
||||||
YAxisIndex: 1,
|
YAxisIndex: 1,
|
||||||
},
|
},
|
||||||
|
|
@ -441,6 +442,7 @@ func indexHandler(w http.ResponseWriter, req *http.Request) {
|
||||||
18.8,
|
18.8,
|
||||||
6.0,
|
6.0,
|
||||||
2.3,
|
2.3,
|
||||||
|
20.2,
|
||||||
}),
|
}),
|
||||||
YAxisIndex: 1,
|
YAxisIndex: 1,
|
||||||
},
|
},
|
||||||
|
|
@ -458,6 +460,7 @@ func indexHandler(w http.ResponseWriter, req *http.Request) {
|
||||||
16.5,
|
16.5,
|
||||||
12.0,
|
12.0,
|
||||||
6.2,
|
6.2,
|
||||||
|
30.3,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ func lineChartRender(opt lineChartOption, result *basicRenderResult) ([]markPoin
|
||||||
seriesColor := theme.GetSeriesColor(index)
|
seriesColor := theme.GetSeriesColor(index)
|
||||||
|
|
||||||
yRange := result.getYRange(series.YAxisIndex)
|
yRange := result.getYRange(series.YAxisIndex)
|
||||||
points := make([]Point, len(series.Data))
|
points := make([]Point, 0, len(series.Data))
|
||||||
// mark line
|
// mark line
|
||||||
markLineRender(markLineRenderOption{
|
markLineRender(markLineRenderOption{
|
||||||
Draw: d,
|
Draw: d,
|
||||||
|
|
@ -76,12 +76,15 @@ func lineChartRender(opt lineChartOption, result *basicRenderResult) ([]markPoin
|
||||||
})
|
})
|
||||||
|
|
||||||
for j, item := range series.Data {
|
for j, item := range series.Data {
|
||||||
|
if j >= xRange.divideCount {
|
||||||
|
continue
|
||||||
|
}
|
||||||
y := yRange.getRestHeight(item.Value)
|
y := yRange.getRestHeight(item.Value)
|
||||||
x := xRange.getWidth(float64(j))
|
x := xRange.getWidth(float64(j))
|
||||||
points[j] = Point{
|
points = append(points, Point{
|
||||||
Y: y,
|
Y: y,
|
||||||
X: x,
|
X: x,
|
||||||
}
|
})
|
||||||
if !series.Label.Show {
|
if !series.Label.Show {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue