我正在尝试制作几个滑块,其中标签位于滑块的左侧而不是顶部。
我看到了这两个解决方案:
https://github.com/rstudio/shiny/issues/1737
但是,它们似乎不适用于新的闪亮模板。标签和滑块确实成为内联的,但滑块的尺寸确实缩小了。
如果我手动将 .irs-line 宽度设置为特定数量的像素,我会得到一个合适大小的滑块,但它在不同的屏幕上或窗口被最小化时看起来很糟糕。如果我尝试将其设为“自动”或“100%”,我将回到“点”而不是滑块。
可重现的例子:
library(shiny)
ui <- fluidPage(
sidebarPanel(
width = 4,
div(HTML("<b>Bla bla bla bla bla</b>")),
br(),
tags$head(
tags$style(type="text/css",
"label.control-label, .selectize-control.single {
display: table-cell;
text-align: center;
vertical-align: middle;
}
label.control-label {
padding-right: 10px;
}
.form-group {
display: table-row;
}
.selectize-control.single div.item {
padding-right: 15px;
}
.irs-line{
width: 100%;
}")
),
sliderInput("lbl1", "label 1", min = 0, max = 10, value = 0, step = 1),
sliderInput("lbl2", "label 2", min = 0, max = …Run Code Online (Sandbox Code Playgroud) 我正在 R 中绘制饼图。我希望我的标签位于图表上,所以我使用textposition = "inside",并且对于非常小的切片,这些值不可见。我正在尝试找到一种方法来排除这些标签。理想情况下,我不想在我的绘图上打印任何低于 10% 的标签。设置textposition = "auto"效果不好,因为有很多小切片,并且使图形看起来很混乱。有办法做到吗?
例如来自plotly网站的这些饼图(https://plot.ly/r/pie-charts/)
library(plotly)
library(dplyr)
cut <- diamonds %>%
group_by(cut) %>%
summarize(count = n())
color <- diamonds %>%
group_by(color) %>%
summarize(count = n())
clarity <- diamonds %>%
group_by(clarity) %>%
summarize(count = n())
plot_ly(cut, labels = cut, values = count, type = "pie", domain = list(x = c(0, 0.4), y = c(0.4, 1)),
name = "Cut", showlegend = F) %>%
add_trace(data = color, labels = color, values = …Run Code Online (Sandbox Code Playgroud) 是否可以使用闪亮的应用程序在 highcharter 中存储缩放区域的坐标?
我想要类似于这个例子的东西:
function getSelection(event) {
alert(event.xAxis[0].min);
alert(event.xAxis[0].max);
}
Run Code Online (Sandbox Code Playgroud)
但不是警报,而是存储和使用它们。
示例闪亮的应用程序:
library(shiny)
library(dplyr)
library(highcharter)
library(tidyr)
df_plot <- cbind(
seq(0, 1, by = 0.1),
sample(seq(from = 100, to = 300, by = 10), size = 11, replace = TRUE),
sample(seq(from = 1, to = 100, by = 9), size = 11, replace = TRUE),
sample(seq(from = 50, to = 60, by = 2), size = 11, replace = TRUE),
sample(seq(from = 100, to = 130, by = 1), …Run Code Online (Sandbox Code Playgroud) 最多6个变量,它必须是被动的.
我尝试了一下,但是在情节上我会在曲线上得到轴刻度,并且它变得混乱,我设法只得到一个y轴.
有没有办法在剧情或任何其他互动图书馆重建情节?
我的情节代码:
library(dplyr)
library(plotly)
library(tidyr)
data <- cbind(
seq(from = 1, to = 30, by = 1),
sample(seq(from = 100, to = 300, by = 10), size = 30, replace = TRUE),
sample(seq(from = 1, to = 100, by = 9), size = 30, replace = TRUE),
sample(seq(from = 50, to = 60, by = 2), size = 30, replace = TRUE),
sample(seq(from = 100, to = 130, by = 1), size = 30, replace = TRUE) …Run Code Online (Sandbox Code Playgroud) 我正在创建一个允许用户删除一些信息的应用程序。但是,我不想立即删除它,而是要确保被删除的文件是正确的文件。我遇到了shinyalerts允许显示“你确定吗?”的包。弹出。但是,我怎么知道用户选择了什么并将其传递给闪亮的?
library(shiny)
library(shinyalert)
shinyApp(
ui = fluidPage(
useShinyalert(), # Set up shinyalert
actionButton("btn", "Delete")
),
server = function(input, output) {
observeEvent(input$btn, {
shinyalert(
title = "Are you sure you want to delete this file?",
text = "You will not be able to recover this imaginary file!",
type = "warning",
showCancelButton = TRUE,
confirmButtonCol = '#DD6B55',
confirmButtonText = 'Yes, delete it!'
)
})
}
)
Run Code Online (Sandbox Code Playgroud) 我试图将12小时后包含单词"length"的变量的所有值更改为NA.
df_data <- cbind(
seq(0, 15, by = 0.5),
sample(seq(from = 100, to = 300, by = 10), size = 31, replace = TRUE),
sample(seq(from = 1, to = 100, by = 9), size = 31, replace = TRUE),
sample(seq(from = 50, to = 60, by = 2), size = 31, replace = TRUE),
sample(seq(from = 100, to = 130, by = 1), size = 31, replace = TRUE)
) %>% as.data.frame()
colnames(df_data) <- c("hour", "a", "a_lenght", "b", "b_length")
df_new …Run Code Online (Sandbox Code Playgroud)