Coder Social home page Coder Social logo

Comments (4)

ziyadsaeed avatar ziyadsaeed commented on June 22, 2024

shiny support is a must nowadays

from highcharter.

jbkunst avatar jbkunst commented on June 22, 2024

@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)

from highcharter.

TonyDIRL avatar TonyDIRL commented on June 22, 2024

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.

from highcharter.

jbkunst avatar jbkunst commented on June 22, 2024

@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

from highcharter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.