1. Chris Leonello
  2. jqplot

Commits

Chris Leonello  committed 732fb7d

Fade in tooltips simultaneously with animated plot. Don't use animation in IE on the barTest.html example.

  • Participants
  • Parent commits 62e7c4e
  • Branches default

Comments (0)

Files changed (2)

File examples/barTest.html

View file
         var ticks = ['a', 'b', 'c', 'd'];
         
         plot1 = $.jqplot('chart1', [s1], {
-            animate: true,
+            // Only animate if we're not using excanvas (not in IE 7 or IE 8).
+            // excanvas is too slow to handle this many animations.
+            animate: !$.jqplot.use_excanvas,
             seriesDefaults:{
                 renderer:$.jqplot.BarRenderer,
                 pointLabels: { show: true }
         var ticks = ['a', 'b', 'c', 'd'];
         
         plot2 = $.jqplot('chart2', [s1, s2], {
-            animate: true,
+            // Only animate if we're not using excanvas (not in IE 7 or IE 8).
+            // excanvas is too slow to handle this many animations.
             seriesDefaults: {
                 renderer:$.jqplot.BarRenderer,
                 pointLabels: { show: true }
     
   <script class="code" type="text/javascript">$(document).ready(function(){
         plot2b = $.jqplot('chart2b', [[[2,1], [4,2], [6,3], [3,4]], [[5,1], [1,2], [3,3], [4,4]], [[4,1], [7,2], [1,3], [2,4]]], {
-            animate: true,
+            // Only animate if we're not using excanvas (not in IE 7 or IE 8).
+            // excanvas is too slow to handle this many animations.
             seriesDefaults: {
                 renderer:$.jqplot.BarRenderer,
                 pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
         var s2 = [7, 5, 3, 2];
         var s3 = [14, 9, 3, 8];
         plot3 = $.jqplot('chart3', [s1, s2, s3], {
-            animate: true,
+            // Only animate if we're not using excanvas (not in IE 7 or IE 8).
+            // excanvas is too slow to handle this many animations.
             stackSeries: true,
             captureRightClick: true,
             seriesDefaults:{
     
   <script class="code" type="text/javascript">$(document).ready(function(){
         plot4 = $.jqplot('chart4', [[[2,1], [6,2], [7,3], [10,4]], [[7,1], [5,2],[3,3],[2,4]], [[14,1], [9,2], [9,3], [8,4]]], {
-            animate: true,
+            // Only animate if we're not using excanvas (not in IE 7 or IE 8).
+            // excanvas is too slow to handle this many animations.
             stackSeries: true,
             captureRightClick: true,
             seriesDefaults:{
     
   <script class="code" type="text/javascript">$(document).ready(function(){
         plot5 = $.jqplot('chart5', [[[2,1], [null,2], [7,3], [10,4]]], {
-            animate: true,
+            // Only animate if we're not using excanvas (not in IE 7 or IE 8).
+            // excanvas is too slow to handle this many animations.
             captureRightClick: true,
             seriesDefaults:{
                 renderer:$.jqplot.BarRenderer,
 		var ticks = ['a', 'b', 'c', 'd'];
 
 		plot7 = $.jqplot('chart7', [s1], {
-            animate: true,
+            // Only animate if we're not using excanvas (not in IE 7 or IE 8).
+            // excanvas is too slow to handle this many animations.
 			seriesDefaults:{
 				renderer:$.jqplot.BarRenderer,
 				rendererOptions: { fillToZero: true },

File src/jqplot.core.js

View file
     };
     
     $.jqplot.HooksManager.prototype.addOnce = function(fn, args) {
+        args = args || [];
         var havehook = false;
         for (var i=0, l=this.hooks.length; i<l; i++) {
             if (this.hooks[i][0] == fn) {
     };
     
     $.jqplot.HooksManager.prototype.add = function(fn, args) {
+        args = args || [];
         this.hooks.push(fn);
         this.args.push(args);
     };
 
                 var temps, 
                     tempr,
-                    sel = '.jqplot-point-label';
+                    sel,
+                    _els;
                 // ughh.  ideally would hide all series then show them.
                 for (i=0, l=this.series.length; i<l; i++) {
                     temps = this.series[i];
                     tempr = temps.renderer;
+                    sel = '.jqplot-point-label.jqplot-series-'+i;
                     if (tempr.animation && tempr.animation._supported && tempr.animation.show && this._drawCount < 2) {
-                        this.target.find(sel).hide();
+                        _els = this.target.find(sel);
+                        _els.hide();
                         temps.canvas._elem.hide();
                         temps.shadowCanvas._elem.hide();
-                        temps.canvas._elem.jqplotEffect('blind', {mode: 'show', direction: tempr.animation.direction}, tempr.animation.speed, 
-                            function(){ 
-                                $(this).parent().find(sel).fadeIn(500);
-                             } );
+                        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);
                     }
                 }
+                _els = null;
             
                 this.target.trigger('jqplotPostDraw', [this]);
             }