Gantt chart in Shiny

Hi,

Does anyone know if it is possible to create a chart like this one :
https://www.highcharts.com/docs/chart-and-series-types/x-range-series
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.

3 Likes

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).

library(lubridate)
# devtools::install_github("jbkunst/highcharter")
library(highcharter)
library(dplyr)

# dummy table
set.seed(1234)
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
  mutate(
    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

library(highcharter)
#> Highcharts (www.highcharts.com) is a Highsoft software product which is
#> not free for commercial and Governmental use
2 Likes

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