【发布时间】:2020-03-08 17:52:32
【问题描述】:
我有一个闪亮的应用程序,我尝试在其中设置 highcharter 图的高度和包含相同 .js 代码的 box。但它似乎没有反应。
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(highcharter)
jscode <-
'$(document).on("shiny:connected", function(e) {
var jsHeight = 0.65 * document.body.clientWidth;
Shiny.onInputChange("GetScreenHeight", jsHeight);
});
'
shinyApp(
ui = dashboardPagePlus(
header = dashboardHeaderPlus(
),
sidebar = dashboardSidebar(),
body = dashboardBody(
tags$script(jscode),
boxPlus(
title = "Closable Box with dropdown",
closable = TRUE,
width = NULL,
status = "warning",
solidHeader = FALSE,
collapsible = TRUE,
highchartOutput("pl",height = "100%")
)
)
),
server = function(input, output) {
output$pl <- renderHighchart({
data(diamonds, mpg, package = "ggplot2")
hchart(mpg, "scatter", hcaes(x = displ, y = hwy, group = class))%>%
hc_size(height =input$GetScreenHeight )
})
}
)
【问题讨论】:
标签: r highcharts shinydashboard