1. # install from html_assets branch
  2. # install_github("rCharts", "ramnathv", ref = "html_assets")
  3. # utility function to convert data frame to format required for funnel
  4. make_dataset = function(x, y, data){
  5. require(rCharts)
  6. toJSONArray2(data[c(x, y)], json = F, names = F)
  7. }
  8. options(stringsAsFactors = F)
  9. dat = data.frame(
  10. x = c('Visits', 'Downloads', 'Requested price list', 'Invoice', 'Finalized'),
  11. y = c(15654, 4064, 1987, 976, 846)
  12. )
  13. h1 <- Highcharts$new()
  14. h1$chart(type = 'funnel')
  15. h1$series(data = make_dataset('x', 'y', dat))
  16. h1$addAssets(js = '//github.highcharts.com/rambera/modules/funnel.js')
  17. h1