Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xts / shiny / boosting support #8

Closed
TonyDIRL opened this issue Jan 14, 2016 · 4 comments
Closed

xts / shiny / boosting support #8

TonyDIRL opened this issue Jan 14, 2016 · 4 comments
Milestone

Comments

@TonyDIRL
Copy link

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

@ziyadsaeed
Copy link

shiny support is a must nowadays

@jbkunst
Copy link
Owner

jbkunst commented Jan 14, 2016

@TonyDIRL @ziyadsaeed

Hi everyone!

  • Maybe if you can trasform your intraday POSIXct object into a "datetime" and "numeric" value, you can use the 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?
  • Well, every widget based on htmlwidgets is shiny ready ;) so yes, the package have shiny integration. Please check https://jbkunst.shinyapps.io/highcharter/ for minimal example.
  • WHOA! No by now. I didn't know about this module. My only concern is about the experimental status. Anyway I'll test the boost module in the next version of this package. Thanks!

(Highcharter shiny app code: https://github.com/jbkunst/shiny-apps/tree/master/highcharter)

@TonyDIRL
Copy link
Author

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.

@jbkunst
Copy link
Owner

jbkunst commented Jan 14, 2016

@TonyDIRL

Ok, Internaly what we need to do is convert the datetime to timestamps and then create the data put in the serieobject.

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

@jbkunst jbkunst closed this as completed Jan 14, 2016
@jbkunst jbkunst added this to the v0.2.0 milestone Jan 18, 2016
@jbkunst jbkunst mentioned this issue Jan 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants