我有一个闪亮的应用程序,其中我尝试使用相同的.js代码设置highcharter
图的高度和包括它的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 )
})
}
)