Commits

cleonello  committed de898f4

Fixed bug introduced recently where text of single line centered text wasn't centered.

  • Participants
  • Parent commits b5754b6

Comments (0)

Files changed (1)

File src/jqplot.toImage.js

                 }   
             }
             if (breaks.length === 0) {
-                context.fillText(text, left, top);
+                // center text if necessary
+                if ($(el).css('textAlign') === 'center') {
+                    templeft = left + (canvasWidth - context.measureText(w).width)/2  - transx;
+                }
+                context.fillText(text, templeft, top);
             }
             else {
                 w = words.slice(0, breaks[0]).join(' ');