Commits

cleonello  committed be43dad

Fixed point labels to work with click hiding of enhanced legend.
Fixed click hiding of enhanced legend so that series shadows and point labels hidden as well.

  • Participants
  • Parent commits 3c168a2

Comments (0)

Files changed (4)

File examples/stackedBar2.html

 	<script language="javascript" type="text/javascript" src="../src/plugins/jqplot.dateAxisRenderer.js"></script>
 	<script language="javascript" type="text/javascript" src="../src/plugins/jqplot.barRenderer.js"></script>
 	<script language="javascript" type="text/javascript" src="../src/plugins/jqplot.pointLabels.js"></script>
+	<script language="javascript" type="text/javascript" src="../src/plugins/jqplot.enhancedLegendRenderer.js"></script>
 		
 		 
 
 		plot1 = $.jqplot('chart1', [line1, line2], {
 			stackSeries: true,
 			legend: {
+                renderer: $.jqplot.EnhancedLegendRenderer,
 				show: true,
 				location: 'ne'
 			},

File src/jqplot.core.js

             speed = ev.data.speed;
         }
         if (speed) {
-            (s.canvas._elem.is(':hidden')) ? s.canvas._elem.fadeIn(speed) : s.canvas._elem.fadeOut(speed);
+            if (s.canvas._elem.is(':hidden')) {
+                if (s.shadowCanvas._elem) {
+                    s.shadowCanvas._elem.fadeIn(speed);
+                }
+                s.canvas._elem.fadeIn(speed);
+                s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).fadeIn(speed);
+            }
+            else {
+                if (s.shadowCanvas._elem) {
+                    s.shadowCanvas._elem.fadeOut(speed);
+                }
+                s.canvas._elem.fadeOut(speed);
+                s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).fadeOut(speed);
+            }
         }
         else {
-            (s.canvas._elem.is(':hidden')) ? s.canvas._elem.show() : s.canvas._elem.hide();
+            if (s.canvas._elem.is(':hidden')) {
+                if (s.shadowCanvas._elem) {
+                    s.shadowCanvas._elem.show();
+                }
+                s.canvas._elem.show();
+                s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).show();
+            }
+            else {
+                if (s.shadowCanvas._elem) {
+                    s.shadowCanvas._elem.hide();
+                }
+                s.canvas._elem.hide();
+                s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).hide();
+            }
         }
     };
     

File src/plugins/jqplot.enhancedLegendRenderer.js

     
     // called with scope of plot.
     postDraw = function () {
-        var e = this.legend._elem.detach();
-        this.eventCanvas._elem.after(e);
+        if (this.legend.renderer.constructor == $.jqplot.EnhancedLegendRenderer && this.legend.seriesToggle){
+            var e = this.legend._elem.detach();
+            this.eventCanvas._elem.after(e);
+        }
     };
     
     $.jqplot.EnhancedLegendRenderer.prototype.pack = function(offsets) {

File src/plugins/jqplot.pointLabels.js

                 
                 label = p.formatter(p.formatString, label);
                 
-                var elem = $('<div class="jqplot-point-label" style="position:absolute"></div>');
+                var elem = $('<div class="jqplot-point-label jqplot-series-'+this.index+'" style="position:absolute"></div>');
                 elem.insertAfter(sctx.canvas);
                 if (p.escapeHTML) {
                     elem.text(label);