
A Gantt chart is an essential tool for visually representing project tasks and progress over time. By displaying tasks’ start dates, end dates, and assignees along a timeline, it enables at-a-glance understanding of overall project progress.
We’ll use a R package called timevis to create Gantt
charts.
For details about the timevis package, please see here.
Select “Manage R Packages” from the project menu.

When the R Package Management dialog opens, select “Install New
Package,” enter “timevis” and click the install button.

A confirmation dialog will appear, click the OK button.

We’ll use a sample project management dataset called “project_schedule”. The data can be downloaded from here.

This data is used for managing project task schedules, where each row represents one task and includes the following columns:
Click the + button on the right side of the report and select “Create Note.”

This will open the note window.

Since we need to write R script to visualize the Gantt chart, select “R Script” from the plus button inside the toolbar.

Copy and paste the following script into this R script:
# Load libraries
library(timevis)
# Data preparation (formatting data for timevis)
timeline_data <- project_schedule %>%
 mutate(
   content = task,
   start = start_date,
   end = end_date,
   group = team,
   # Progress bar style settings 
   style = paste0(
     "background-color: rgba(33, 150, 243, 0.3); ",
     "height: 30px; ",
     "border-radius: 5px; ",
     "border-left: 4px solid rgb(33, 150, 243);"
   )
 ) %>%
 select(content, start, end, group, style)
# Create Gantt chart
timevis(
 data = timeline_data,
 options = list(
   locale = "en",  # English date display
   orientation = "both",  # Show both groups and timeline
   stack = TRUE,  # Stack tasks
   showCurrentTime = FALSE,  # Hide current time line
   height = "500px",  # Specify height
   horizontalScroll = TRUE,  # Enable horizontal scroll
   verticalScroll = TRUE,  # Enable vertical scroll
   zoomKey = "ctrlKey",  # Zoom while pressing Ctrl key and scrolling
   start = min(project_schedule$start_date),  # Display start date
   end = max(project_schedule$end_date)  # Display end date
 ),
 groups = data.frame(
   id = unique(project_schedule$team),
   content = unique(project_schedule$team)
 )
)
It should look something like this.

When using your own data, modify the following parts inside the code:
project_schedule.task,
start_date, end_date, team.After the R script is ready, click the “Preview” button.

To enlarge the chart size, click the chart and then click the expand button.

When previewed, you can see the following features in the Gantt Chart:

When creating Gantt charts with the timevis package, you
can modify chart settings using the following options:
These options should be listed with commas inside the
list brackets.

For example, by changing the following two options, we can display timeline labels only at the top and position it to show the current time line:
