Commits

Chris Leonello  committed 4658599

Fixes to animation for IE compatibility.

  • Participants
  • Parent commits 37b64f6

Comments (0)

Files changed (2)

File src/jqplot.core.js

         // True to animate the series on initial plot draw (renderer dependent).
         // Actual animation functionality must be supported in the renderer.
         this.animate = false;
+        // prop: animateReplot
+        // True to animate series after a call to the replot() method.
+        // Use with caution!  Replots can happen very frequently under
+        // certain circumstances (e.g. resizing, dragging points) and
+        // animation in these situations can cause problems.
+        this.animateReplot = false;
         // prop: axes
         // up to 4 axes are supported, each with it's own options, 
         // See <Axis> for axis specific options.
             this.options = $.extend(true, {}, this.defaults, options);
             var opts = this.options;
             this.animate = opts.animate;
+            this.animateReplot = opts.animateReplot;
             this.stackSeries = opts.stackSeries;
             if ($.isPlainObject(opts.fillBetween)) {
 
                     temps = series[i];
                     tempr = temps.renderer;
                     sel = '.jqplot-point-label.jqplot-series-'+i;
-                    if (tempr.animation && tempr.animation._supported && tempr.animation.show && this._drawCount < 2) {
+                    if (tempr.animation && tempr.animation._supported && tempr.animation.show && (this._drawCount < 2 || this.animateReplot)) {
                         _els = this.target.find(sel);
-                        _els.hide();
-                        temps.canvas._elem.hide();
-                        temps.shadowCanvas._elem.hide();
+                        _els.stop(true, true).hide();
+                        temps.canvas._elem.stop(true, true).hide();
+                        temps.shadowCanvas._elem.stop(true, true).hide();
                         temps.canvas._elem.jqplotEffect('blind', {mode: 'show', direction: tempr.animation.direction}, tempr.animation.speed);
                         temps.shadowCanvas._elem.jqplotEffect('blind', {mode: 'show', direction: tempr.animation.direction}, tempr.animation.speed);
                         _els.fadeIn(tempr.animation.speed*0.8);

File src/jqplot.effects.blind.js

             show = mode === "show",
             wrapper, distance, top;
 
-        // if already wrapped, the wrapper's properties are my property. #6245
+        // // if already wrapped, the wrapper's properties are my property. #6245
         if ( el.parent().is( ".ui-effects-wrapper" ) ) {
             $.jqplot.effects.save( el.parent(), props );
         } else {
 
         distance = vertical ? wrapper[ ref ]() + top : wrapper[ ref ]();
 
-        animation[ ref ] = show ? distance : 0;
+        animation[ ref ] = show ? String(distance) : '0';
         if ( !motion ) {
             el
                 .css( vertical ? "bottom" : "right", 0 )
                 .css( vertical ? "top" : "left", "" )
                 .css({ position: "absolute" });
-            animation[ ref2 ] = show ? 0 : distance;
+            animation[ ref2 ] = show ? '0' : String(distance);
         }
 
-        // start at 0 if we are showing
+        // // start at 0 if we are showing
         if ( show ) {
             wrapper.css( ref, 0 );
             if ( ! motion ) {
             }
         }
 
-        // Animate
+        // // Animate
         wrapper.animate( animation, {
             duration: o.duration,
             easing: o.easing,