Horizontal legend traces wrap to new lines#786
Conversation
…tarting new row of legend items
Horizontal legend in columns
Legend item wrap with layout.legend.orientation = h
|
@psalmody looking good. Thanks a lot for doing this. To complete this PR:
Let me know if you have any questions. |
|
@etpinard I added the mock and test. On the mock, I added more traces in the legend for better visibility (particularly in vertical legend orientation). I setup docker (I'm on Win10 and new to docker) and had some problems. Even extracting the linux commands from |
|
Here's the link image baseline associated with the mock you added. Simpy download it and move it to
Yeah that's correct. I've been wanting to rewrite the shell scripts found in |
test/jasmine/tests/legend_test.js
Outdated
|
|
||
| it('changed to vertical, scrollbar appeared', function(done) { | ||
| //changed orientation to vertical | ||
| expect(gd._fullLayout.legend.orientation).toBe('v'); |
There was a problem hiding this comment.
@psalmody can you rewrite this test as
Plotly.relayout(gd, 'legend.orientation', 'v').then(function() {
/* assertions */
return Plotly.relayout(gd, 'legend.orientation', 'h');
}.then(function() {
/* assertions (back to base case) /*
});and remove the assertion-less it('changing to vertical orientation', ... above? Thanks.
|
@psalmody Great. I'll merge this PR in as soon as #786 (comment) is addressed. Thanks again for this PR! |
|
@etpinard I updated the test (I think) the way you would like it. However, I had to completely destroy the graph and recreate in order to get the legend scrollbar to appear. Using |
Oh. Looks like you discovered some buggy
So, I suggest removing the jasmine test you added in 3a2cf7b and patched in c31eb68 and instead add a jasmine test case testing some that |
Ah - that makes sense. Removed old tests and created new test as recommended. |
|
@psalmody Great. Thanks very much for this PR. You get my vote for PR of the week 🏆 |
Resolves #769
Iterate through traces, get maximum width, use margin and trace width to calculate if a new row is needed. Thanks @n-riesco for reviewing.