Gantt chart in Shiny


Does anyone know if it is possible to create a chart like this one :
using R/Shiny?

Thanks in advance

You could check out timevis which is an R package for making interactive charts similar to what you are describing.


I don't know if you can do that with the highchartr :package: (not sure because xrange is not a module in the doc... :thinking:) but here is a SO post with some options

All these options give you some similar 'grant type' graph usable with shiny.

1 Like

It seems you can with last dev version of {highcharter} :package:. It is not very well documented, but xrange module is included in the package. You can do something like that (and surely with another way if you read the documentation of higcharter API).

# devtools::install_github("jbkunst/highcharter")

# dummy table
size <- 10
df <- tibble(
  start = today() + months(sample(10:20, size = size)),
  end = start + months(sample(1:3, size = size, replace = TRUE)),
  category = rep(1:3, length.out = size) - 1,
  progress = round(runif(size), 1)
) %>%
  # needs to convert to highchart timestamp format
    start = datetime_to_timestamp(start),
    end = datetime_to_timestamp(end)

hchart(df, type = "xrange", 
       mapping = hcaes(x = start, x2 = end, y = category, partialFill = progress),
       dataLabels = list(enabled = TRUE)) %>% 
  hc_xAxis(type = "datetime") %>% 
  hc_yAxis(categories = c("Protyping", "Dev", "Testing"))

the example is adapted from one in the GH repo when you look for xrange

About Highcharts and R, notice the warning when loading the package

#> Highcharts ( is a Highsoft software product which is
#> not free for commercial and Governmental use

Thank you for fantastic answers!
Dev version of highcharter has done the job.
I was not aware of packages like timevis and DiagrammeR - they look very nice and I will definitely check them out!

1 Like