You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is currently not an easy way to show projects based on weeks, rather than months.
A consistent implementation requires some choices that may not be obvious, e.g. should the gray stripes in the background be then based on weeks rather than months? Probably.
Which dates should be shown on the x-axis? Probably the date in which each 7-day period starts.
Until a more consistent implementation will be introduced, here's a hacky workaround.
It requires providing as dates the start and end points of activities (a more consistent way would allow to pass week numbers).
library("ganttrify")
project<-ganttrify::test_project_date_day# This is just to shorten a bit the example projectproject$end_date[project$activity=="Active promo"] <-"2020-11-17"base_gg<- ganttrify(project=project,
by_date=TRUE,
# colour_stripe = "lightgray",colour_stripe=NA,
exact_date=TRUE)
# break by weeks week_breaks<- seq.Date(from= min(lubridate::as_date(project$start_date)),
to= max(lubridate::as_date(project$end_date)),
by=7)
base_gg+ggplot2::scale_x_date(name="",
breaks=week_breaks,
date_labels="%e %b\n%Y",
minor_breaks=NULL,
limits= c(min(lubridate::as_date(project$start_date)),
max(lubridate::as_date(project$end_date))+3),
sec.axis=ggplot2::dup_axis(breaks=week_breaks+3.5,
labels= paste0("W", seq_along(week_breaks))))
#> Scale for x is already present.#> Adding another scale for x, which will replace the existing scale.#> Warning: Removed 1 rows containing missing values (`geom_rect()`).
There is currently not an easy way to show projects based on weeks, rather than months.
A consistent implementation requires some choices that may not be obvious, e.g. should the gray stripes in the background be then based on weeks rather than months? Probably.
Which dates should be shown on the x-axis? Probably the date in which each 7-day period starts.
Until a more consistent implementation will be introduced, here's a hacky workaround.
It requires providing as dates the start and end points of activities (a more consistent way would allow to pass week numbers).
Created on 2023-07-29 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: