Live shiny app here:
https://jemus42.shinyapps.io/tRakt/
Everything worked fine for the ggvis plot until I tried to add the regression lines, and trying the regression lines outside of shiny worked, too:
plot <- epdata %>% ggvis(x = ~epnum, y = ~rating)
plot <- plot %>% layer_points(fill = ~season)
plot <- plot %>% layer_model_predictions(formula = rating ~ epnum, model = "lm", se = F)
plot <- plot %>% group_by(season) %>% layer_model_predictions(model = "lm", se = F, stroke = ~season)
plot <- plot %>% add_axis("x", title = "Episode Number")
plot <- plot %>% add_axis("y", title = "Rating")
plot <- plot %>% add_legend("fill", title = "Season", orient = "left")
But in the app, the lines appear shortly and vanish, except for the rightmost season trendline, which seems to behave as intended.
The data looks roughly like this:
> str(epdata[c("epnum", "rating", "season")])
'data.frame': 97 obs. of 3 variables:
$ epnum : int 1 2 3 4 5 6 7 8 9 10 ...
$ rating: num 82 83 85 86 85 84 88 83 87 86 ...
$ season: Ord.factor w/ 6 levels "1"<"2"<"3"<"4"<..: 1 1 1 1 1 1 1 1 1 1 ...
I have no idea whether this is a shiny, ggvis, vega or browser issue, so I'd appreciate any hint I can get on this.
Regards,
Jemus42