Skip to content

Commit

Permalink
radialbar animation issue - fixes #348
Browse files Browse the repository at this point in the history
  • Loading branch information
junedchhipa committed Feb 23, 2019
1 parent cec7f76 commit f8c6463
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/charts/Pie.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,18 +412,17 @@ class Pie {
me.animateArc(el, fromStartAngle, toStartAngle, angle, prevAngle, opts)
}

animateArc(el, fromStartAngle, toStartAngle, angle, prevAngle, params) {
animateArc(el, fromStartAngle, toStartAngle, angle, prevAngle, opts) {
let me = this
const w = this.w

let size = me.size

if (!size) {
size = params.size
size = opts.size
}

let path
let opts = params

if (isNaN(fromStartAngle) || isNaN(prevAngle)) {
fromStartAngle = toStartAngle
Expand All @@ -435,7 +434,7 @@ class Pie {
let startAngle = toStartAngle
let fromAngle = fromStartAngle - toStartAngle

if (w.globals.dataChanged && params.shouldSetPrevPaths) {
if (w.globals.dataChanged && opts.shouldSetPrevPaths) {
// to avoid flickering, set prev path first and then we will animate from there
path = me.getPiePath({
me,
Expand All @@ -462,7 +461,7 @@ class Pie {
})
.during(function(pos) {
currAngle = fromAngle + (angle - fromAngle) * pos
if (params.animateStartingPos) {
if (opts.animateStartingPos) {
currAngle = prevAngle + (angle - prevAngle) * pos
startAngle =
fromStartAngle -
Expand Down Expand Up @@ -491,7 +490,9 @@ class Pie {
size
})

w.globals.animationEnded = true
if (!opts.isTrack) {
w.globals.animationEnded = true
}
el.node.setAttribute('data:pathOrig', path)

el.attr({
Expand Down
1 change: 1 addition & 0 deletions src/charts/Radial.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ class Radial extends Pie {
totalItems: 2,
animBeginArr: 0,
dur: 0,
isTrack: true,
easing: w.globals.easing
})
}
Expand Down

0 comments on commit f8c6463

Please sign in to comment.