Using the Stack Overflow: R highcharts multiple stacked bar chart
I am able to create a stacked column chart using the dataset I have. However, the data "types" in this set are dynamic so I am attempting to implement : Highcharter stacked column groupings not using hchart()
However, while the list I am generating appears identical to the example if I download and run that code, the plot shows up empty. The lenged correctly identifies the types, but the chart does not populate. I have tried running this in a browser in case R studio was not handling it correctly but to no avail.
I have attempted and have working a partial solution using: R highcharts multiple stacked bar chart
However, because of the dynamic type of data, I need more of a solution similar to: Highcharter stacked column groupings not using hchart()
I have compared the lists and they appear identical (different data but the structure is correct)
data <- data[!duplicated(data$AcctID), ]
data$ExpireDate <- mdy_hm(data$ExpireDate)
data$ExpireDateGroup <- floor_date(data$ExpireDate, "day")
cheeseData <- data %>%
mutate(Day = as.character(ExpireDateGroup)) %>%
group_by(Day, Cheese) %>%
summarise(CheeseWheels = n())
byCheese.list <- cheeseData %>%
group_by(Cheese) %>%
do(cheeseData = list_parse2(.[, c('Day', 'CheeseWheels')])) %>%
rename(name = Cheese) %>%
mutate(Cheese = 'column') %>%
list_parse()
highchart() %>%
hc_xAxis(categories = cheeseData$Day) %>%
hc_add_series_list(byCheese.list) %>%
hc_plotOptions(series = list(stacking = 'normal'))
Expected Results: There should be a stacked column chart
Sample Data
data <- structure(list(AcctID = c(251981L, 261775L, 275048L, 282754L,
286490L, 279683L, 277289L, 282031L, 287776L, 284062L), CreatedDate = c("4/2/2019 18:48",
"4/18/2019 16:14", "5/10/2019 7:49", "5/22/2019 15:13", "5/29/2019 11:29",
"5/17/2019 14:05", "5/14/2019 10:32", "5/21/2019 16:59", "5/31/2019 7:56",
"5/24/2019 14:09"), ExpireDate = structure(c(1559642040, 1559642100,
1559642160, 1559642220, 1559642220, 1559642280, 1559642340, 1559642340,
1559642400, 1559642460), class = c("POSIXct", "POSIXt"), tzone = "UTC"),
Cheese = c("Gouda", "Gouda", "Gouda", "Gouda", "Gouda", "Gouda",
"Gouda", "Gouda", "Gouda", "Gouda"), ExpireDateGroup = structure(c(1559606400,
1559606400, 1559606400, 1559606400, 1559606400, 1559606400,
1559606400, 1559606400, 1559606400, 1559606400), class = c("POSIXct",
"POSIXt"), tzone = "UTC")), row.names = c(1L, 3L, 5L, 6L,
8L, 10L, 11L, 12L, 13L, 14L), class = "data.frame")