我想将复选框标签的帮助文本作为工具提示.在下面的示例中,我使用了shinyBS包 - 但我只能使用它来处理复选框输入组的标题.
任何想法如何在"Lernerfolg"或"Enthusiasmus"标签之后起作用?
library(shiny)
library(shinyBS)
server <- function(input, output) {
output$distPlot <- renderPlot({
hist(rnorm(input$obs), col = 'darkgray', border = 'white')
output$rendered <- renderUI({
checkboxGroupInput("qualdim", tags$span("Auswahl der Qualitätsdimension",
tipify(bsButton("pB2", "?", style = "inverse", size = "extra-small"),
"Here, I can place some help")),
c("Lernerfolg" = "Lernerfolg" ,
"Enthusiasmus" = "Enthusiasmus"
),
selected = c("Lernerfolg"))
})
})
}
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
sliderInput("obs", "Number of observations:", min = 10, max = 500, value = 100),
uiOutput("rendered")
),
mainPanel(plotOutput("distPlot"))
) …Run Code Online (Sandbox Code Playgroud) 我想知道这些是否是使用bsTooltip()from shinyBSpackage在工具提示标题中包含数学模式的任何选项。
小例子:
rm(list = ls())
library(shiny)
library(shinyBS)
ui <- basicPage(
headerPanel("Tooltip test"),
bsTooltip(id = "Equation", title = "\\(\\bar{X} = \\frac{1}{n}\\sum_{p = 1}^{n}X_p\\)", placement = "bottom", trigger = "hover", options = NULL),
mainPanel(
p("some text", htmlOutput("Equation", inline = TRUE))
)
)
server <- shinyServer(function(input, output,session) {
output$Equation <- renderUI({HTML("<font color='blue'><u>something which needs equation</u></font>")})
})
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)
结果(数学模式)不理想:
我最近使用shinyBS来创建一个模态窗口,如
bsModal(id, title, trigger, ..., size)
Run Code Online (Sandbox Code Playgroud)
size参数是'small'或'large'(或不存在).
正如你所看到的,即使是大窗口也很小,而且东西很紧凑:
是否有任何可能的黑客已发现可以帮助自定义窗口的大小?
我想在窗口小部件的标题旁边添加一个(?),以便用户可以悬停或单击它并获取额外的信息和他们可以单击的链接.
这就是我现在所拥有的:
## app.R ##
library(shiny)
library(shinydashboard)
library(shinyBS)
# Header
header <- dashboardHeader()
# Sidebar
sidebar <- dashboardSidebar(fileInput("chosenfile", label = h4("File input"),
accept = ".csv"),
bsButton("q1", label = "", icon = icon("question"),
style = "info", size = "extra-small"),
bsPopover(id = "q1", title = "Tidy data",
content = paste0("You should read the ",
a("tidy data paper",
href = "http://vita.had.co.nz/papers/tidy-data.pdf",
target="_blank")),
placement = "right",
trigger = "click",
options = list(container = "body")
)
)
# Body
body <- dashboardBody()
# ui
ui …Run Code Online (Sandbox Code Playgroud) 问题
我开始使用shinybs它非常适合在 Shinyapps 中显示弹出窗口或工具提示。但是,在定制方面,我发现软件包提供的帮助有点缺乏。
这个包中的大多数函数都包含options允许“更好地控制工具提示和弹出框的显示方式”的参数。帮助文件只说明了这个参数的用法是它接受list(),您应该查看Twitter Bootstrap 3 文档以获取更多详细信息。然而,这个文档非常强大,我几乎立即迷路了。
问题
使用optionsin的基本逻辑是什么shinybs- 你如何确定传递给什么值和什么形式options?它是否使用CSS, JavaScript, 或其他东西?
您能否提供一些有关如何在shinybsusingoptions参数中自定义弹出窗口和工具提示的基本示例?例如:改变高度、宽度、背景颜色等。
我一直在尝试使用带有dateInput. 问题是日历小部件隐藏在模态后面。这是我的示例代码:
library(shiny)
library(shinyBS)
shinyApp(
ui =fluidPage(
mainPanel(
actionButton("button", label = "Open Modal"),
bsModal("modalExample", "Data Table", "rowtogg", size = "small",
fluidPage(dateInput("dates", "Enter date")))
)
),
server = function(input, output, session) {
observeEvent({
input$button
},{
toggleModal(session, "modalExample", "open")
})
}
)
Run Code Online (Sandbox Code Playgroud)
问题的截图可以在:https : //github.com/ebailey78/shinyBS/issues/46找到,我已经在那里问过这个问题。但是在我看来这是一个更“普遍”的问题,所以我希望这里有人可以帮助我。
编辑:感谢 Yenne Info 它通过添加以下内容来工作:
tags$style(type = "text/css", ".datepicker{z-index: 1100 !important;}"),
Run Code Online (Sandbox Code Playgroud) 我想知道是否可以使用闪亮(和shinyBS)创建一个交互式弹出对话框.
例如,我有一个字符串,我想更改它,然后在做一个对话框显示询问我是否真的想要更改它.如果我说"是",它会这样做,否则它会丢弃更改.这是我的尝试,但我发现了两个问题:1.如果单击"是"或"否",则没有任何更改2.您始终需要通过底部"关闭"关闭该框.
rm(list = ls())
library(shiny)
library(shinyBS)
name <- "myname"
ui =fluidPage(
textOutput("curName"),
br(),
textInput("newName", "Name of variable:", name),
br(),
actionButton("BUTnew", "Change"),
bsModal("modalnew", "Change name", "BUTnew", size = "small",
textOutput("textnew"),
actionButton("BUTyes", "Yes"),
actionButton("BUTno", "No")
)
)
server = function(input, output, session) {
output$curName <- renderText({paste0("Current name: ", name)})
observeEvent(input$BUTnew, {
output$textnew <- renderText({paste0("Do you want to change the name?")})
})
observeEvent(input$BUTyes, {
name <- input$newName
})
}
runApp(list(ui = ui, server = server))
Run Code Online (Sandbox Code Playgroud)
其他建议非常欢迎!!
我已经对这个问题进行了很多研究,但到目前为止,当使用 Shiny 的 showModal() 而不是 bsModal() 时,还没有提供解决方案。
当我第二次在模态对话框中显示rhandsontable时,显示有问题,即并非所有列都显示。
下面是一个例子:
library(shiny)
library(rhandsontable)
u <- shinyUI(fluidPage(
# Will show first pop-up
actionButton("go", "Show Table")
))
s <- shinyServer(function(input,output,session){
df <- data.frame(Wnr = 1:10)
observeEvent(input$go, {
output$table <- renderRHandsontable({
rhandsontable(df, width = "100%", height = 200)
})
showModal(modalDialog(
title = "Table",
rHandsontableOutput("table"),
footer = tagList(actionButton("go2", "Continue"),
modalButton("Stop"))
))
})
observeEvent(input$go2, {
removeModal()
# Recalculate the table, adding new columns
output$table <- renderRHandsontable({
df$AC <- 1
df$BC <- …Run Code Online (Sandbox Code Playgroud) 我正在尝试制作一个具有两层嵌套的数据表。第一个用于对行进行分组(https://github.com/rstudio/shiny-examples/issues/9#issuecomment-295018270),第二个应该打开一个模式(R ShinyBS 弹出窗口)。我可以让它单独工作,但第二层嵌套会产生问题。一旦有第二次嵌套,表中的数据就不再显示在折叠组中。
所以到目前为止我所做的至少有一个问题,那就是如何在有多个嵌套时正确显示它。在那之后,我不确定模式当前是否有效。我想知道这些 id 是否不会与现在的方式发生冲突。
任何提示表示赞赏。
# Libraries ---------------------------------------------------------------
library(DT)
library(shiny)
library(shinyBS)
library(shinyjs)
library(tibble)
library(dplyr)
library(tidyr)
library(purrr)
# Funs --------------------------------------------------------------------
# Callback for nested rows
nest_table_callback <- function(nested_columns, not_nested_columns){
not_nested_columns_str <- not_nested_columns %>% paste(collapse="] + '_' + d[") %>% paste0("d[",.,"]")
paste0("
table.column(1).nodes().to$().css({cursor: 'pointer'});
// Format data object (the nested table) into another table
var format = function(d) {
if(d != null){
var result = ('<table id=\"child_' + ",not_nested_columns_str," + '\">').replace('.','_') + '<thead><tr>'
for (var col …Run Code Online (Sandbox Code Playgroud) 我已经使用Shiny 包中的popify函数创建了一个弹出窗口shinyBS。我想在我的过滤器底部弹出一个与我的过滤器本身一样宽的弹出窗口。我在文档中找不到关于此的任何内容。
示例代码:
library(shiny)
library(shinyBS)
shinyApp(
ui =
fluidPage(
sidebarLayout(
sidebarPanel(
tags$span(
popify(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30),
'a very long popup',"1. I want everything behind 1 on one line and everything that starts after<br> 2. I want to see on the second line without wrapping it to the 3rd line.")),
actionButton("tabBut", "View Table")
),
mainPanel(
plotOutput("distPlot"),
bsModal("modalExample", "Data Table", "tabBut", size = "large",
dataTableOutput("distTable"))
)
) …Run Code Online (Sandbox Code Playgroud) shiny ×10
shinybs ×10
r ×8
datatables ×1
javascript ×1
modal-dialog ×1
popup ×1
shinyjs ×1
tooltip ×1