if (reflow){
this.reflow();
}
-
+
if (this.options.animation && !reflow){
var animation = new Chart.Animation();
animation.numSteps = this.options.animationSteps;
animation.easing = this.options.animationEasing;
-
+
// render function
animation.render = function(chartInstance, animationObject) {
var easingFunction = helpers.easingEffects[animationObject.easing];
var stepDecimal = animationObject.currentStep / animationObject.numSteps;
var easeDecimal = easingFunction(stepDecimal);
-
+
chartInstance.draw(easeDecimal, stepDecimal, animationObject.currentStep);
};
-
+
// user events
animation.onAnimationProgress = this.options.onAnimationProgress;
animation.onAnimationComplete = this.options.onAnimationComplete;
-
+
Chart.animationService.addAnimation(this, animation);
}
else{
numSteps: 60, // default number of steps
easing: "", // the easing to use for this animation
render: null, // render function used by the animation service
-
- onAnimationProgress: null, // user specified callback to fire on each step of the animation
+
+ onAnimationProgress: null, // user specified callback to fire on each step of the animation
onAnimationComplete: null, // user specified callback to fire when the animation finishes
});
-
+
Chart.Tooltip = Chart.Element.extend({
draw : function(){
return;
}
}
-
+
this.animations.push({
chartInstance: chartInstance,
animationObject: animationObject
var index = helpers.findNextWhere(this.animations, function(animationWrapper) {
return animationWrapper.chartInstance === chartInstance;
});
-
+
if (index)
{
this.animations.splice(index, 1);
if(this.animations[i].animationObject.currentStep > this.animations[i].animationObject.numSteps){
this.animations[i].animationObject.currentStep = this.animations[i].animationObject.numSteps;
}
-
+
this.animations[i].animationObject.render(this.animations[i].chartInstance, this.animations[i].animationObject);
-
+
// Check if executed the last frame.
if (this.animations[i].animationObject.currentStep == this.animations[i].animationObject.numSteps){
// Call onAnimationComplete
var index = atIndex !== undefined ? atIndex : this.segments.length;
if ( typeof(segment.color) === "undefined" ) {
segment.color = Chart.defaults.global.segmentColorDefault[index % Chart.defaults.global.segmentColorDefault.length];
- segment.highlight = Chart.defaults.global.segmentHighlightColorDefaults[index % Chart.defaults.global.segmentHighlightColorDefaults.length];
+ segment.highlight = Chart.defaults.global.segmentHighlightColorDefaults[index % Chart.defaults.global.segmentHighlightColorDefaults.length];
}
this.segments.splice(index, 0, new this.SegmentArc({
value : segment.value,
helpers.each(this.segments,function(segment){
segment.save();
});
-
+
this.reflow();
this.render();
},
-}).call(this);
\ No newline at end of file
+}).call(this);