Description
Repro cases: http://codepen.io/anon/pen/RGozGE
I've encountered an odd behavior on horizontal legends with long series names. If the series names are relatively short, setting layout.legend.orientation
to 'h'
does indeed produce a reasonably laid out horizontal legend where each line of the legend is filled with as many series as possible (first example in the codepen). If, however, a series has a very long name, each series is placed on its own row in the legend (effectively becoming a vertical legend), even though there's clearly room for series with shorter names to be placed on the same rows (second example in the codepen). I think the more logical behavior should be something like this, where the series are packed into rows as closely as their names allow.
I'm happy to make a PR to improve this (it should just involve fiddling with the logic near legend/draw.js:603). Should the current behavior be preserved via a new legend attribute whose default is the current behavior and has an option for the new behavior, or is the current behavior never reasonable and should be replaced?
CC to @markwatabe who originally discussed this issue with me and helped with the proposed solution.