# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1354227263 -3600
# Thu Nov 29 23:14:23 2012 +0100
# Node ID 7da008827c9963488e4c9edd953d4dfb8af331f9
# Parent d58cc0d66822f6b208a7341c457c610060acd1d6
consider border width to avoid displaying it when disabled in html. Closes #2527797
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1354227263 -3600
# Thu Nov 29 23:14:23 2012 +0100
# Node ID 7da008827c9963488e4c9edd953d4dfb8af331f9
# Parent d58cc0d66822f6b208a7341c457c610060acd1d6
consider border width to avoid displaying it when disabled in html. Closes #2527797
@@ -57,10 +57,13 @@
1 } 2 }); 3 4 // code below is coming from 5 // https://bitbucket.org/cleonello/jqplot/issue/14/export-capabilities#comment-554274 6 +// changes by Logilab: 7 +// * check border width before drawing it 8 +// * don't attempt to auto wrap text, search for <br> instead 9 $(function() { 10 $.fn.jqplotToImage = function() { 11 var obj = $(this); 12 var newCanvas = document.createElement("canvas"); 13 var size = cwplot.findPlotSize(obj);
@@ -122,16 +125,18 @@
14 }); 15 // add the legend 16 obj.children("table.jqplot-table-legend").each(function() { 17 var offset = $(this).offset(); 18 var context = newCanvas.getContext("2d"); 19 - context.strokeStyle = $(this).css('border-top-color'); 20 - context.strokeRect( 21 - offset.left - baseOffset.left, 22 - offset.top - baseOffset.top, 23 - $(this).width(),$(this).height() 24 - ); 25 + if ($(this).css('border-top-width') != '0px') { 26 + context.strokeStyle = $(this).css('border-top-color'); 27 + context.strokeRect( 28 + offset.left - baseOffset.left, 29 + offset.top - baseOffset.top, 30 + $(this).width(), $(this).height() 31 + ); 32 + } 33 context.fillStyle = $(this).css('background-color'); 34 context.fillRect( 35 offset.left - baseOffset.left, 36 offset.top - baseOffset.top, 37 $(this).width(),$(this).height()
@@ -139,16 +144,18 @@
38 }); 39 // add the swatches 40 obj.find("div.jqplot-table-legend-swatch").each(function() { 41 var offset = $(this).offset(); 42 var context = newCanvas.getContext("2d"); 43 - context.fillStyle = $(this).css('border-top-color'); 44 - context.fillRect( 45 - offset.left - baseOffset.left, 46 - offset.top - baseOffset.top, 47 - $(this).parent().width(),$(this).parent().height() 48 - ); 49 + if ($(this).css('border-top-width') != '0px') { 50 + context.fillStyle = $(this).css('border-top-color'); 51 + context.fillRect( 52 + offset.left - baseOffset.left, 53 + offset.top - baseOffset.top, 54 + $(this).parent().width(),$(this).parent().height() 55 + ); 56 + } 57 }); 58 obj.find("td.jqplot-table-legend").each(function() { 59 var offset = $(this).offset(); 60 var context = newCanvas.getContext("2d"); 61 context.textBaseline = $(this).css('vertical-align');