Fixed flying legend issues

Sometimes the legend does not display correctly as outerWidth and outerHeight of the rows do not return a number, returning the element itself instead. If you pass an additional parameter to these two functions (includeMargin) seems to fix the issues.