Skip to content

Commit

Permalink
radar chart allows negative values - fixes #1029
Browse files Browse the repository at this point in the history
  • Loading branch information
junedchhipa committed Dec 27, 2019
1 parent 11cba5f commit 017f410
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/charts/Radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Radar {
: w.globals.gridWidth

this.maxValue = this.w.globals.maxY
this.minValue = this.w.globals.minY

this.polygons = w.config.plotOptions.radar.polygons

Expand Down Expand Up @@ -112,7 +113,10 @@ class Radar {
this.angleArr[i] = []

s.forEach((dv, j) => {
this.dataRadiusOfPercent[i][j] = dv / this.maxValue
const range = Math.abs(this.maxValue - this.minValue)
dv = dv + Math.abs(this.minValue)
this.dataRadiusOfPercent[i][j] = dv / range

this.dataRadius[i][j] = this.dataRadiusOfPercent[i][j] * this.size
this.angleArr[i][j] = j * this.disAngle
})
Expand Down

0 comments on commit 017f410

Please sign in to comment.