fixed a rendering issue for long class-names

in case of very long class-names, the legend is written on top of %. this interchange should fix that issue while not breaking anything existing.