Facet function in highcharts

2019-07-13 17:36发布

问题:

I have a data like this example:

df <-
  data.frame(
    date = seq(as.Date("2015-01-01"), as.Date("2015-12-31"), 100),
    id = rep(LETTERS, each = 4)[1:100],
    replicate(2, sample(1001, 100))
  )

Plotting with ggplot is Ok

ggplot(df, aes(x = date)) +
  geom_line(aes(y = X1)) +
  geom_line(aes(y = X2), linetype = 2) +
  facet_wrap( ~ id , scales = "free") 

I found some info about facet implementation in highchart higcharter-grid-test and I tried to plot it with highchart in order to make an interactive plot, but highchart::hw_grid() and browsable() are deprecated. Can anybody help me with ploting my data?

My snippet :

  highchart() %>% 
    hc_add_series(name = "X1", data = df$X1) %>% 
    hc_add_series(name = "X2", data = df$X2) %>% 
    hw_grid(id, rowheight = 200, ncol = 3)