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

Feature_request: Add label_wrap #35

Closed
danielsbrewer opened this issue Sep 13, 2022 · 2 comments
Closed

Feature_request: Add label_wrap #35

danielsbrewer opened this issue Sep 13, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@danielsbrewer
Copy link

Sometimes my item titles can get rather long. Is there any chance to add in label_wrap()? I use that in ggplot2 quite a bit.

I tied adding:
"+ ggplot2::scale_y_discrete(labels = scales::label_wrap(10))"
but that just destroyed everything.

@giocomai
Copy link
Owner

Good point, I guess this is probably a relatively common issue. I will introduce a new parameter. In the meantime, as a workaround, you can simply pre-process the relevant columns with stringr::str_wrap(), see example.

library("ganttrify")

project_df <- tibble::tribble(~wp, ~activity, ~start_date, ~end_date,
                              "WP 1", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquet eget sit amet tellus", 1, 6,
                              "WP 1", "Proin sed libero enim sed faucibus turpis in eu mi. Massa ultricies mi quis hendrerit dolor magna eget est.", 3, 8) %>% 
  dplyr::mutate(activity = stringr::str_wrap(string = activity, width = 24))

gantt_gg <- ganttrify(project = project_df,
                      project_start_date = "2022-09-13",
                      font_family = "Roboto Condensed")

gantt_gg

Created on 2022-09-13 with reprex v2.0.2

@giocomai giocomai added the enhancement New feature or request label Sep 13, 2022
@giocomai giocomai self-assigned this Sep 13, 2022
@danielsbrewer
Copy link
Author

Oh that's great. Thanks for the work-around, that works a treat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants