| Type: | Package |
| Title: | Create Interactive Gantt Charts with Work Breakdown Structure |
| Version: | 0.1.6 |
| Description: | Create Primavera-style interactive Gantt charts with Work Breakdown Structure (WBS) hierarchy and activities. Features include color-coded WBS items, indented labels, scrollable views for large projects, dynamic date formatting, and the ability to dim past activities. Built on top of 'plotly' for interactive visualizations. |
| License: | GPL-3 |
| Encoding: | UTF-8 |
| LazyData: | true |
| Depends: | R (≥ 3.5.0) |
| Imports: | plotly (≥ 4.9.0), dplyr (≥ 1.0.0), htmlwidgets (≥ 1.5.0), magrittr, rlang |
| RoxygenNote: | 7.3.3 |
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
| URL: | https://github.com/AhmedAredah/Ganttify |
| BugReports: | https://github.com/AhmedAredah/Ganttify/issues |
| NeedsCompilation: | no |
| Packaged: | 2025-10-28 14:10:03 UTC; A-Aredah |
| Author: | Ahmed Aredah [aut, cre] |
| Maintainer: | Ahmed Aredah <Ahmed.Aredah@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2025-10-28 23:10:02 UTC |
Create Interactive Gantt Chart with WBS Structure
Description
Creates a Primavera-style interactive Gantt chart with Work Breakdown Structure (WBS) hierarchy and activities. The chart features color-coded WBS items, indented labels, scrollable view for large projects, and dynamic date formatting.
Usage
Ganttify(
wbs_structure,
activities,
chart_title = "Project Gantt Chart with WBS",
x_range = NULL,
milestone_lines = NULL,
color_config = NULL,
display_config = NULL,
label_config = NULL,
bar_config = NULL,
layout_config = NULL
)
Arguments
wbs_structure |
A data frame with 3 columns: ID (character), Name (character), and Parent (character). Parent should be "None" or "" for root level items. |
activities |
A data frame with 5 required columns, 2 optional columns, and any number of additional columns:
When actual dates are provided, activities display as stacked bars: planned on top (solid color) and actual on bottom (diagonal stripe pattern). |
chart_title |
Character. Title displayed at the top of the chart. Default "Project Gantt Chart with WBS". |
x_range |
Character vector. Date range for x-axis zoom (e.g., c("2024-01-01", "2024-12-31")). If NULL, shows full project range. |
milestone_lines |
Data frame or NULL. Optional milestone lines to display on the chart. If provided, must be a data frame with the following columns:
Default NULL (no milestone lines). |
color_config |
List or NULL. Configuration for chart colors. Structure depends on mode:
If NULL, uses mode="wbs" with default color palette. Default NULL. |
display_config |
List or NULL. Controls visibility of chart elements. Structure:
Example: list( wbs = list(show = TRUE, show_labels = TRUE, show_names_on_bars = TRUE), activity = list(show = TRUE, show_names_on_bars = FALSE) ) If NULL, uses defaults shown above. Default NULL. |
label_config |
List or NULL. Template strings for labels. Structure:
Available placeholders for activity: list(
activity = list(yaxis = "{name} ({start} - {end})", bar = "{name}"),
wbs = list(yaxis = "{name}", bar = "{name}")
)
If NULL, uses default template for all labels. Default NULL. |
bar_config |
List or NULL. Styling configuration for bars. Structure:
The dim_past_activities field controls whether activities that end before today are dimmed. When TRUE, completed activities use the dim_opacity value instead of the regular opacity. Example: list( wbs = list(opacity = 0.3, height = 0.3), activity = list(opacity = 1.0, height = 0.8, dim_opacity = 0.3, dim_past_activities = FALSE) ) If NULL, uses defaults shown above. Default NULL. |
layout_config |
List or NULL. Chart layout settings. Structure:
Example: list( buffer_days = 30, indent_size = 2, max_visible_rows = 20, y_scroll_position = NULL, yaxis_label_width = 300, yaxis_label_max_chars = NULL, hover_popup_max_chars = 50 ) If NULL, uses defaults shown above. Default NULL. |
Value
A plotly object containing the interactive Gantt chart. Can be displayed directly or saved using htmlwidgets::saveWidget().
Examples
# Load test data
data(test_project)
# Basic Gantt chart with WBS colors
chart <- Ganttify(
wbs_structure = test_project$wbs_structure,
activities = test_project$activities,
color_config = list(mode = "wbs", wbs = test_project$colors)
)
chart
# Uniform color mode
chart <- Ganttify(
wbs_structure = test_project$wbs_structure,
activities = test_project$activities,
color_config = list(
mode = "uniform",
uniform = list(wbs = "#34495E", activity = "#2ECC71")
)
)
chart
# Attribute-based coloring (requires extra column in activities)
# Add a Status column to activities dataframe
activities_with_status <- test_project$activities
activities_with_status$Status <- sample(c("completed", "in-progress", "pending"),
nrow(activities_with_status), replace = TRUE)
chart <- Ganttify(
wbs_structure = test_project$wbs_structure,
activities = activities_with_status,
color_config = list(
mode = "attribute",
attribute = list(
column = "Status",
mapping = list("completed" = "green", "in-progress" = "orange", "pending" = "gray"),
wbs = "#34495E"
)
)
)
chart
# WBS-only view using display_config
chart <- Ganttify(
wbs_structure = test_project$wbs_structure,
activities = test_project$activities,
display_config = list(activity = list(show = FALSE))
)
chart
# Custom labels showing date ranges
chart <- Ganttify(
wbs_structure = test_project$wbs_structure,
activities = test_project$activities,
label_config = list(
activity = list(yaxis = "{name} ({start} - {end})")
)
)
chart
# Customize bar heights and enable dimming for past activities
chart <- Ganttify(
wbs_structure = test_project$wbs_structure,
activities = test_project$activities,
bar_config = list(
wbs = list(opacity = 0.5, height = 0.4),
activity = list(height = 0.9, dim_past_activities = TRUE, dim_opacity = 0.4)
)
)
chart
# Add "today" line as a milestone
chart <- Ganttify(
wbs_structure = test_project$wbs_structure,
activities = test_project$activities,
milestone_lines = data.frame(
date = Sys.Date(),
label = "Today",
color = "red"
)
)
chart
# Narrow label area with truncation
chart <- Ganttify(
wbs_structure = test_project$wbs_structure,
activities = test_project$activities,
layout_config = list(
yaxis_label_width = 200,
yaxis_label_max_chars = 25
)
)
chart
Test Project Data for Ganttify
Description
A sample project dataset for testing and demonstrating the Ganttify package. Contains a complete Work Breakdown Structure (WBS), activities, and custom colors for an example software development project.
Usage
test_project
Format
A list with 3 components:
- wbs_structure
A data frame with 8 rows and 3 columns:
ID: WBS item identifier (W1-W8)
Name: WBS item name (e.g., "Project Summary", "Design Phase")
Parent: Parent WBS ID or "None" for root items
- activities
A data frame with 15 rows and 7 columns:
WBS_ID: Associated WBS item identifier
Activity_ID: Activity identifier (A1-A15)
Activity_Name: Activity name (e.g., "Design UI", "Code Frontend")
Start_Date: Planned start date in MM/DD/YYYY format
End_Date: Planned end date in MM/DD/YYYY format
Start_Date_Actual: Actual start date in MM/DD/YYYY format (some NA for not started)
End_Date_Actual: Actual end date in MM/DD/YYYY format (some NA for in-progress)
Includes examples of on-time, delayed, ahead-of-schedule, and in-progress activities.
- colors
A named list of 8 colors:
Each WBS item (W1-W8) is assigned a custom hex color
Source
Example software development project
Examples
# Load the test data
data(test_project)
# View structure
str(test_project)
# Create a Gantt chart
chart <- Ganttify(
wbs_structure = test_project$wbs_structure,
activities = test_project$activities,
color_config = list(mode = "wbs", wbs = test_project$colors)
)
chart