Вопрос

I am trying to recreate an rCharts-based, interactive dygraphs chart by running the code.R from this timelyportfolio/rCharts_dygraphs GitHub repository.

Compared to what it should look like, my chart however doesn't render completely:

By comparing html page sources, I think the problem is that the date array hasn't evaluated properly:

"date": [ "#! new Date(252374400000)!#", "#! new Date(283910400000)!#", .... ]

Corresponding R source code snippet contains #! annotation unfamiliar to me:

fama.df$date <- paste0(
  "#! new Date(",
  as.numeric(as.POSIXct(paste0(fama.df$year,"-12-31"))) * 1000,
  ")!#"
)

What is the background for this annotation and how can I fix this?

Это было полезно?

Решение

I believe this was a newer implementation of rCharts. Try installing from that branch, but after running be sure to get current again. I was playing around with how to handle dates like googleVis.

require(devtools)
install_github("rCharts","timelyportfolio",ref="dimple_layer")

Also, you will need to do like in the updated code.R

dy1$setTemplate(afterScript = "<script></script>"

You might notice that dygraphs is not fully developed. We are starting an rChartsExtra to house the experiments/alternate libraries.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top