Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data(citytemp, package = "highcharter")
- function(input, output) {
- hcbase <- reactive({
- # hcbase <- function() highchart()
- hc <- highchart()
- if (input$credits)
- hc <- hc %>% hc_credits(enabled = TRUE, text = "Highcharter", href = "http://jkunst.com/highcharter/")
- if (input$exporting)
- hc <- hc %>% hc_exporting(enabled = TRUE)
- if (input$theme != FALSE) {
- theme <- switch(input$theme,
- null = hc_theme_null(),
- economist = hc_theme_economist(),
- dotabuff = hc_theme_db(),
- darkunica = hc_theme_darkunica(),
- gridlight = hc_theme_gridlight(),
- sandsignika = hc_theme_sandsignika(),
- fivethirtyeight = hc_theme_538(),
- chalk = hc_theme_chalk(),
- handdrwran = hc_theme_handdrawn()
- )
- hc <- hc %>% hc_add_theme(theme)
- }
- hc
- })
- output$table <-renderDataTable({
- #Output from graph
- data.table(month=citytemp$month,berlin=citytemp$berlin
- ,berlin_dragged=citytemp$berlin)#Here I want to use the dragged data. something linke input$highchart$... should do the trick I guess...
- })
- output$highchart <- renderHighchart({
- data(citytemp)
- highchart() %>%
- hc_chart(animation = FALSE) %>%
- hc_title(text = "draggable points demo") %>%
- hc_xAxis(categories = month.abb) %>%
- hc_plotOptions(
- series = list(
- stickyTracking = FALSE
- ),
- column = list(
- stacking = "normal"
- ),
- line = list(
- cursor = "ns-resize"
- )
- ) %>%
- hc_add_series(
- data = citytemp$berlin,
- draggableY = TRUE
- )
- })
- }
- ui.r
- library("shiny")
- library("shinydashboard")
- library("highcharter")
- library("dplyr")
- library("viridisLite")
- library("markdown")
- library("quantmod")
- library("tidyr")
- library("ggplot2")
- library("treemap")
- library("forecast")
- library("DT")
- rm(list = ls())
- dashboardPage(
- skin = "black",
- dashboardHeader(title = "highcharter", disable = FALSE),
- dashboardSidebar(
- sidebarMenu(
- menuItem("Examples", tabName = "examples", icon = icon("bar-chart"))
- )
- #,
- #div(includeMarkdown("hcterinfo.md"), style = "padding:10px")
- ),
- dashboardBody(
- # tags$head(tags$script(src = "js/ga.js")),
- # tags$head(tags$link(rel = "stylesheet", type = "text/css", href = "css/custom_fixs.css")),
- tabItems(
- tabItem(tabName = "examples",
- fluidRow(
- box(width = 6, highchartOutput("highchart")),
- box(width = 6, dataTableOutput("table"))
- )
- )
- )
- ))
- hc_plotOptions(
- series = list(
- point = list(
- events = list(
- drop = JS("function(){
- console.log(this.series)
- window.data = _.map(this.series.data, function(e) { return e.y })
- Shiny.onInputChange('inputname', data);
- }"))
- )))
- renderDataTable({
- ...
- var <- input$inputname # listening the drop event
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement