Commits

Oli...@Olivier-PC  committed 3a9a3ac

Improved series legend conversion to picture.
Now hidden series will not be exported to image and legend will be disabled (gray color and no swatch color)

  • Participants
  • Parent commits bbaa15b

Comments (0)

Files changed (1)

File src/jqplot.toImage.js

                     var t = 0.5+top + elem.position().top;
                     newContext.strokeRect(l, t, elem.innerWidth(), elem.innerHeight());
 
+					if($(elem).parent().hasClass('jqplot-series-hidden')) { return; }
                     // now fill the swatch
                     
                     l += 0.5+parseInt(elem.css('padding-left'), 10);
                     var l = left + elem.position().left;
                     var t = top + elem.position().top + parseInt(elem.css('padding-top'), 10);
                     newContext.font = elem.jqplotGetComputedFontStyle();
-                    newContext.fillStyle = elem.css('color');
+					if($(elem).hasClass('jqplot-series-hidden')) {
+                        newContext.fillStyle = "rgba(0,0,0,0.4)";
+                    }
+                    else
+                    {
+						newContext.fillStyle = elem.css('color');
+					}
                     writeWrappedText(elem, newContext, elem.text(), l, t, w);
                 });
 
             }
         }
         $(this).children().each(function() {
+			if($(this).hasClass('jqplot-series-hidden')) { return; }
             _jqpToImage(this, x_offset, y_offset);
         });
         return newCanvas;