accumulate_by <- function(dat, var) {
  var <- lazyeval::f_eval(var, dat)
  lvls <- plotly:::getLevels(var)
  dats <- lapply(seq_along(lvls), function(x) {
    cbind(dat[var %in% lvls[seq(1, x)], ], frame = lvls[[x]])
  })
  dplyr::bind_rows(dats)
}

library(plotly)
d <- txhousing %>%
  filter(date < 2002) %>%
  accumulate_by(~date)

p <- ggplot(d, aes(date, median)) + 
  geom_line(aes(group = city, ids = city, frame = frame))
## Warning: Ignoring unknown aesthetics: ids, frame
gg <- ggplotly(p)
gg
plotly_json(gg, jsonedit = TRUE)