fix: fix NaN of radar chart, #17
This commit is contained in:
parent
550b9874d2
commit
93e03856ca
1 changed files with 5 additions and 1 deletions
|
|
@ -200,7 +200,11 @@ func (r *radarChart) render(result *defaultRenderResult, seriesList SeriesList)
|
|||
continue
|
||||
}
|
||||
indicator := indicators[j]
|
||||
percent := (item.Value - indicator.Min) / (indicator.Max - indicator.Min)
|
||||
var percent float64
|
||||
offset := indicator.Max - indicator.Min
|
||||
if offset > 0 {
|
||||
percent = (item.Value - indicator.Min) / offset
|
||||
}
|
||||
r := percent * radius
|
||||
p := getPolygonPoint(center, r, angles[j])
|
||||
linePoints = append(linePoints, p)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue