All examples By author By category About

timelyportfolio

rd3fc with shiny.semantic

Playing in R with shiny.semantic and rd3fc.


Code

# devtools::install_github("Appsilon/shiny.semantic")

library(rd3fc)
library(shiny.semantic)
library(htmltools)
library(quantmod)
library(pipeR)

getSymbols("IWM", from="2016-12-31")
getSymbols("SPY", from="2016-12-31")

cs_iwm <- chart_Series(IWM, name=NA)
cs_spy <- chart_Series(SPY, name=NA)

# use card example from shiny.semantic
card <- function(img_tag=NULL, title_left ="Title", title_right = "" ) {
  div(
    class = "ui card",
    div(
      class = "content", 
      div(class = "right floated meta", title_right),
      title_left
    ),
    div(
      class = "image",
      img_tag
    ),
    div(
      class = "content",
      span(
        class = "right floated",
        uiicon("heart outline like"),
        "17 likes"
      ),
      uiicon("comment"),
      "3 comments"
    ),
    div(class = "extra content", 
     div(
      class = "ui large transparent left icon input",
      uiicon("heart ouline"), 
      tags$input(type = "text", placeholder = "Add Comment...")
    )
   )
  )
}

tagList(
  div(
    class = "ui grid",
    div(
      class = "row",
      div(class = "four wide column",
        card(
          chartseries(cs_spy, width="100%", height=200),
          "SPY",
          "2017-03-21"
        )
      ),
      div(class = "four wide column",
        card(chartseries(
          cs_iwm, width="100%", height=200),
          "IWM",
          "2017-03-21"
        )
      )
    )
  ),
  rmarkdown::html_dependency_jquery(),
  shiny.semantic:::getDeps()
) %>>%
  browsable()

Thanks

Thanks RStudio for htmltools.

Thanks Mike Bostock for d3.js.

Thanks to Colin, Chris, and others at Scott Logic for d3fc

Thanks for the Semantic UI team.