With Fit Y by X I assume you are using the Row Legend to create the legend. Unfortunately this legend is essentially a Table Box with a single column, which does not have an option to wrap. I tried doing it another way - adding two legends and then removing some of the rows through scripting, but this does not leave the legend in a usable state. The number of rows in the column has to equal the number of rows in the table.