Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline legend items #173

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

chicio
Copy link
Contributor

@chicio chicio commented Nov 23, 2024

Hi,

as discussed in #169,I tried to add multiline support for legend items with long names. I used tspan as discussed and some dynamic height calculations (based on the bounding box (getBBox) + getComputedTextLength).
It works as expected. The items lines are aligned after the legend number.

There is still room for improvement, because we should be able to calculate the entire structure of the legends dynamically. Anyway for now, if a legend list of items is too long we should play with the parameters I added the previous PRs to fix the offset (in particular the legends offsets).
Attached you can find some example:

  • the Zalando tech radar rendered, where we have an example of an item going on 2 lines
  • the a video + a zip containing a working example of the Lastminute tech radar where we have a lot more items (and a lot of them going on 2 lines). Basically you can see from the code that by playing with the offset you can have "infinity legends".

I tested it carefully, but please do all the checks that you want/need on your side, and let me know if this PR makes sense and can be useful (like the previous one).
zalando-tech-radar-example

lastminute-tech-radar-example-video-720.mov

lastminute-tech-radar-example-code.zip

@bocytko bocytko added the major Major feature changes or updates, e.g. feature rollout to a new country, new API calls. label Nov 27, 2024
@bocytko
Copy link
Member

bocytko commented Nov 27, 2024

Thanks for the PR. It's a busy week for us (Cyber Week/Black Friday), so realistically I can take a look at this earliest next week.

@chicio
Copy link
Contributor Author

chicio commented Nov 27, 2024

@bocytko sure, no problem.
Take you're time (this week is a busy one for everyone working in online retail company I guess😅)

@chicio
Copy link
Contributor Author

chicio commented Dec 9, 2024

Hi @bocytko, don't forget about this MR. Thanks 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major Major feature changes or updates, e.g. feature rollout to a new country, new API calls.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants