mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-10 02:06:49 +01:00
Update Chart.js
This commit is contained in:
30
Chart.js
vendored
30
Chart.js
vendored
@@ -949,25 +949,25 @@
|
||||
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{
|
||||
@@ -1390,11 +1390,11 @@
|
||||
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(){
|
||||
|
||||
@@ -2139,7 +2139,7 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.animations.push({
|
||||
chartInstance: chartInstance,
|
||||
animationObject: animationObject
|
||||
@@ -2155,7 +2155,7 @@
|
||||
var index = helpers.findNextWhere(this.animations, function(animationWrapper) {
|
||||
return animationWrapper.chartInstance === chartInstance;
|
||||
});
|
||||
|
||||
|
||||
if (index)
|
||||
{
|
||||
this.animations.splice(index, 1);
|
||||
@@ -2185,9 +2185,9 @@
|
||||
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
|
||||
@@ -2650,7 +2650,7 @@
|
||||
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,
|
||||
@@ -3330,7 +3330,7 @@
|
||||
helpers.each(this.segments,function(segment){
|
||||
segment.save();
|
||||
});
|
||||
|
||||
|
||||
this.reflow();
|
||||
this.render();
|
||||
},
|
||||
@@ -3729,4 +3729,4 @@
|
||||
|
||||
|
||||
|
||||
}).call(this);
|
||||
}).call(this);
|
||||
|
||||
Reference in New Issue
Block a user