使用时shinydashboard
我发现有些图标似乎有效,而有些则没有.在下面的示例中,当clock-o图标正常工作时,电池已满的图标不起作用.我无法弄清楚为什么会发生这种情况.
library(shiny)
library(shinydashboard)
header <- dashboardHeader(title="Some Icons Not Working?")
# No sidebar --------------------------------------------------------------
sm <- sidebarMenu(
sm <- sidebarMenu(
menuItem(
text="asdf",
tabName="asdfasdf",
icon=icon("battery-full")),
menuItem(
text="qwer",
tabName="qwerqwer",
icon=icon("clock-o"))
)
)
sidebar <- dashboardSidebar(sm)
# Compose dashboard body --------------------------------------------------
body <- dashboardBody(
tabItems(
)
)
# Setup Shiny app UI components -------------------------------------------
ui <- dashboardPage(header, sidebar, body, skin="black")
# Setup Shiny app back-end components -------------------------------------
server <- function(input, output) {
}
# Render Shiny app --------------------------------------------------------
shinyApp(ui, server)
Run Code Online (Sandbox Code Playgroud) 我有两个selectInput
s,我想在第一个(Brand)中选择更改第二个(Candy)中的可能选择.因此,例如,如果有人在第一个输入框中选择了"雀巢",那么只有雀巢糖果将出现在第二个框中.我的数据表有一个Brand列和一个Candy bar类型列.
我有以下代码开始,但这显示了所有选项,无论选择如何.
selectInput(inputId="brand",
label="Brand:",
choices=as.character
(unique(candyData$Brand)),
selected = "Nestle"
),
selectInput(inputId="candy",
label="Candy:",
choices=as.character
(unique(candyData$Candy)),
selected = "100Grand"
Run Code Online (Sandbox Code Playgroud)
数据集如下所示:
Brand Candy
Nestle 100Grand
Netle Butterfinger
Nestle Crunch
Hershey's KitKat
Hershey's Reeses
Hershey's Mounds
Mars Snickers
Mars Twix
Mars M&Ms
Run Code Online (Sandbox Code Playgroud)
更新的问题 如何根据后续过滤更新仪表板中的ValueBox?
output$count <- renderValueBox({
valueBox(
value = nrow(candyData),
subtitle = "Number of Candy Bars",
icon = icon("table")
)
})
Run Code Online (Sandbox Code Playgroud) 我想自定义我的闪亮应用程序的框状态的颜色.我找到一种css方式来改变这些盒子的盒子背景颜色,但不是自定义状态颜色,但是我没有在css中看到等效的"status"参数?因此,我打印一个包含所考虑的参数"status"的简单页面的源代码,我正在查看它的类(我认为class ="box box-solid box-primary")但我无法在几个中找到它.css在这个网页上提供...... :(
你有好主意吗 ?
这是一个简单的代码:
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
fluidRow(
box(width = 6, title = "youhou", status = "primary", solidHeader = TRUE,
"Box content"
)
)
)
)
server <- function(input, output) {}
shinyApp(ui, server)
Run Code Online (Sandbox Code Playgroud)
预先感谢您的任何帮助 !
查
是否可以在旁边的水平栏中放置一些物品dashboardHeader
?我知道你可以notificationItem
像这个例子一样放在最右边.但我想使用与dashboardSidebar
添加过滤器等相同的选项.我想在顶部使用这样的过滤器:
在我的闪亮应用程序中,我想添加一个选项,让用户tab
通过点击infoBox
(或我想要的任何其他对象)跳转到应用程序中的特定元素(表格,情节,任何具有id的内容),当前或不同).
我的解决方案是围绕infoBox
与div
并添加href=#id_of_element
属性.不幸的是,这个解决方案只适用tabs
于额外的"data-toggle" = "tab"
属性(它也不会改变打开tab
的active
),但这不是我想要的.
我的问题是:如何添加上述选项以及为什么此解决方案不起作用?这是我想要做的一个小例子:
UI
library(shiny)
library(shinydashboard)
shinyUI(
dashboardPage(
skin = "blue",
dashboardHeader(title = "Example"),
dashboardSidebar(
sidebarMenu(id = "sidebarmenu",
menuItem("Tab1", icon = icon("line-chart"),
menuSubItem("SubTab1", tabName = "sub1", icon = icon("bar-chart")),
menuSubItem("SubTab2", tabName = "sub2", icon = icon("database"))),
menuItem("Tab2", tabName = "tab2", icon = icon("users"))
)
),
dashboardBody(
tabItems(
tabItem(tabName = "sub1",
tags$div(href="#s2t2",
infoBox(value = "Go to table 2 in SubTab2 (not …
Run Code Online (Sandbox Code Playgroud) 我正在使用Rshinydashboard,当我尝试使用includeHTML在我的应用程序中包含一个html文档时,我遇到了一个问题.一旦menuItems&menSubItems被展开,它们就无法收回.我已经探索了其他解决方案,但没有找到.如果你有任何想法可能是什么问题或有另一种方式在应用程序中包含HTML报告,我将不胜感激.如果可以,请参阅下面的代码并提供帮助!
创建一个RMD文件来创建一个html报告(如果你没有一个人躺着)
---
title: "test"
output: html_document
---
## Test HTML Document
This is just a test.
Run Code Online (Sandbox Code Playgroud)
构建测试html报告
# Build Test HTML file
rmarkdown::render(
input = "~/test.rmd",
output_format = "html_document",
output_file = file.path(tempdir(), "Test.html")
)
Run Code Online (Sandbox Code Playgroud)
构建测试应用程序
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
sidebarMenu(
id = "sidebarmenu",
menuItem(
"A", tabName = "a", icon = icon("group", lib="font-awesome"),
menuSubItem("AA", tabName = "aa"),
conditionalPanel(
"input.sidebarmenu === 'aa'",
sliderInput("b", "Under sidebarMenu", 1, 100, 50)
),
menuSubItem("AB", tabName = "ab")
)
)
),
dashboardBody(
tabItems(
tabItem(tabName = …
Run Code Online (Sandbox Code Playgroud) 我在Linux服务器上部署了一个闪亮的应用程序.如果一分钟没有活动,我希望应用程序超时.根据我读到的内容,我将行app_idle_timeout添加到shiny-server.conf文件中,但我注意到它不起作用.有人可以建议我如何确保会话在一分钟后超时?注意:我没有闪亮的服务器PRO.
下面是我的shiny-server.conf的样子.
Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;
# Define a server that listens on port 3838
server {
listen 3838;
# Define a location at the base URL
location / {
# Host the directory of Shiny Apps stored in this directory
site_dir /srv/shiny-server;
# Log all Shiny output to files in this directory
log_dir /var/log/shiny-server;
app_idle_timeout 60;
# When a user visits the base URL rather than a particular application,
# an …
Run Code Online (Sandbox Code Playgroud) 我曾经shinydashboard
创建我的应用程序.我想在桌面环境(例如Windows)上默认隐藏sidear,但不要禁用它.在移动设备上,边栏默认为隐藏.我想我需要改变css类,但不知道该怎么做.
谢谢你的任何建议.
这是我的游戏代码:
library(shiny)
library(shinydashboard)
ui <- shinyUI(dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody()
))
server <- shinyServer(function(input, output, session) {
})
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud) 有没有办法dateRangeInput()
在Shiny中使用Hack或者创建一个选择器,以便它只选择月份(没有一天),或者它是否自动选择所选月份的第一天而不显示日期选择?或者我应该创建另一个月份日期选择器(滑块,选择框......)
dateRangeInput('dateRange',label = "Pédiode d'analyse : ",format = "mm/yyyy",language="fr",
start = Sys.Date() %m-% months(12), end=Sys.Date(),startview = "year",separator = " - ")
Run Code Online (Sandbox Code Playgroud)
我想要的是在选择日期时删除此步骤:dateRangeInput
我有一个闪亮的应用程序(使用navbarPage)有很多选项卡,并希望添加一个侧栏菜单,无论选择哪个选项卡都可以看到.侧栏中的输入值会影响所有选项卡的内容.此外,应该可以隐藏sidebarMenu,因为它在shinydashboard中.
我看到两种可能的方式:
(A)使用shinydashboard并以某种方式添加顶部导航栏或
(B)使用navbarPage并以某种方式添加可隐藏的侧边栏菜单.
(A)使用shinydashboard,最接近我想要的是(简化的MWE):
library("shiny")
library("shinydashboard")
cases <- list(A=seq(50,500, length.out=10), B=seq(1000,10000, length.out=10))
ui <- dashboardPage(
dashboardHeader(title = "dash w/ navbarMenu"),
dashboardSidebar(selectizeInput('case', 'Pick a case', selected="A", choices = c("A", "B"), multiple = FALSE), numericInput('num', 'Number', min = 1, max = 10, value = 1, step = 1)),
dashboardBody(
tabsetPanel(
tabPanel(h4("Perspective 1"),
tabsetPanel(
tabPanel("Subtab 1.1", plotOutput("plot11")),
tabPanel("Subtab 1.2")
)),
tabPanel(h4("Perspective 2"),
tabsetPanel(
tabPanel("Subtab 2.1"),
tabPanel("Subtab 2.2")
))
)
)
)
server <- function(input, output) {
output$plot11 <- renderPlot({ …
Run Code Online (Sandbox Code Playgroud) r ×10
shiny ×10
shinydashboard ×10
box ×1
css ×1
date-range ×1
filter ×1
font-awesome ×1
href ×1
html ×1
shiny-server ×1
sidebar ×1