Closed TonyDIRL closed 8 years ago
shiny support is a must nowadays
@TonyDIRL @ziyadsaeed
Hi everyone!
hc_add_serie_ts
like http://jkunst.com/highcharter/#time-series, but I'm not so sure. Can you send me and reproducible example of this type of data to test? what package have this type of data?(Highcharter shiny app code: https://github.com/jbkunst/shiny-apps/tree/master/highcharter)
Thanks for the swift response and the shiny example.
Here is a reproducible example of plotting an xts object with dygraphs, highchart (rcharts) and highcharter.
require(dygraphs)
require(rCharts)
ProdData <- xts(runif(100,0,1), seq(as.POSIXct("2016-01-04 08:00:00"),
as.POSIXct("2016-01-04 08:01:00"), length = 100),tz="GMT")
names(ProdData)<-"Price"
CombData=data.frame(Time=as.numeric(index(ProdData))*1000,coredata(ProdData))
HCGraph <- Highcharts$new()
HCGraph$series(data = toJSONArray2(CombData, json = F, names = F),type = "line")
HCGraph$xAxis(type = "datetime");
HCGraph$chart(zoomType = "x");
HCGraph
highchart() %>% hc_add_serie_ts(CombData$Price, CombData$Time,name = "Data")
highchart() %>% hc_add_serie_ts(ProdData$Price, index(ProdData),name = "Data")
Note, for highcharter, I tried passing the intraday time directly and converting the intraday time to numeric, neither work.
@TonyDIRL
Ok, Internaly what we need to do is convert the datetime to timestamps and then create the data put in the serie
object.
This will be the code to create the hc_add_serie_xts(xtsobject)
. So thanks ;).
By now you can do something like the next code until I add the funcionality to plot xts objects.
library("xts")
library("highcharter")
library("magrittr")
ProdData <- xts(runif(100,0,1), seq(as.POSIXct("2016-01-04 08:00:00"),
as.POSIXct("2016-01-04 08:01:00"),
length = 100),tz="GMT")
timestamps <- time(ProdData) %>%
as.POSIXct() %>%
as.numeric()
values <- as.numeric(ProdData)
ds <- list.parse2(data.frame(timestamps, values))
highchart() %>%
hc_xAxis(type = "datetime") %>%
hc_add_serie(marker = list(enabled = FALSE),
data = ds, name = "data")
I will close this issue and I'll add plot xts object in the issue #7
Hi,
Really nice package, appreciate the detailed introduction with the extended examples and incorporating piping I had some questions: Does the library support plotting xts directly (like dygrpahs). How would I pass an intraday POSIXct object directly? Does the library have shiny integration? Does the library incorporate the new boost module from highcharts? http://www.highcharts.com/articles/2-news/175-highcharts-performance-boost
Awesome package.
Cheers, Anthony