Issue #526 duplicate

_jqpToImage does not wrap legend text

Anonymous created an issue

Text inside the legend box does not wrap and stretches beyond the legend box and off the right side of the image (when position is set to 'outside').

Proposed solution: Change {{{

!javascript

            $(el).find('td.jqplot-table-legend-label').each(function(){
                var elem = $(this);
                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');
                newContext.fillText(elem.text(), l, t);

            });

}}}

to this: {{{

!javascript

            $(el).find('td.jqplot-table-legend-label').each(function(){
                var elem = $(this);
                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');
                writeWrappedText(el, newContext, elem.text(), l, t, w); /* bugfix */

            });

}}}

Comments (1)

  1. Log in to comment