我正在shiny办公室里建一个应用程序,我想使用infoBox内置功能shinydashboard.
是否有可能使用infoBox()到navbarPage?
shinyUI(fluidPage(
navbarPage(title="my title",collapsible=T,
tabPanel("Update",icon=icon("refresh","fa-2x",lib="font-awesome"),
dashboardBody(
fluidRow(infoBox("New Orders", 10 * 2, icon = icon("credit-card"))
)))
Run Code Online (Sandbox Code Playgroud)
我知道这肯定只是一个故事,css style但我无法弄清楚如何做到这一点.
以下是由以下html代码制作的代码infoBox():
<div class="col-sm-4">
<div class="info-box bg-purple">
<span class="info-box-icon">
<i class="fa fa-download"></i>
</span>
<div class="info-box-content">
<span class="info-box-text">Progress</span>
<span class="info-box-number">25%</span>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我可以制作一个css文件,使我的shiny输出看起来像shinydashboard输出?
##编辑:
感谢@Victorp和@MrFlick我已将所有css style链接中的框或信息框frome shinydashboard.css和adminLTE.css 复制/粘贴到我的boostrap.css文件中,它可以正常工作.我可以使用自己的CSS样式和信息框功能.
我用它创建了一些直方图d3.js.我设法改变填充颜色rect取决于的位置brush.但我想改变一个内部的颜色rect.例如,如果brush start是在rect我想要的rect两个颜色的中间.
我见过像Here这样的例子.我是d3的新手,我试着理解代码.
我看到他们使用clip-path它肯定会隐藏背景栏,当他们没有画笔时,根据画笔的范围显示它们.
这是一个JS Bin
我已经详细阅读了链接中提供的代码.我发现他们不创建<rect>元素来制作图表,但是barPath如下:
function barPath(groups) {
var path = [],
i = -1,
n = groups.length,
d;
while (++i < n) {
d = groups[i];
path.push("M", x(d.key), ",", height, "V", y(d.value), "h9V", height);
}
return path.join("");
}
Run Code Online (Sandbox Code Playgroud)
但我没有事件了解这个函数中发生了什么,以及如果他们没有其他方法可以做到这一点,如何点对它.
我是建设一个App有Rshiny.
我有几个,infoBox我想使用该href选项在点击时弹出一个infoBox.
我使用shinyBS作为弹出选项.这是我试过的:
valueBox(value=entry_01, icon = icon("users","fa-lg",lib="font-awesome"),href=shinyInput(actionLink,id='button_01',len=1,class="btn btn-default action-button",label=""),
width=NULL,color = "light-blue",subtitle = ""
)
Run Code Online (Sandbox Code Playgroud)
但我发现,href如果我们想在外部网站上链接,href = "http://stackoverflow.com/"
但我不知道如何链接应用程序的内部链接,该选项可以正常工作.
我做了这个编辑,因为我发现了一个解决方案,通过在valueBox输出列表中添加两个变量,使框可点击并使闪亮认为它是一个动作按钮.
- 类action-button
- id允许我们使用observe或observeEvent来检测单击valuebox的时间.
require(shiny)
require(shinydashboard)
header <- dashboardHeader(title="ReproductibleExample")
sidebar <- dashboardSidebar(disable=T)
body <- dashboardBody(valueBoxOutput("box_01"),
textOutput("print"))
ui <- dashboardPage(header, sidebar, body)
server<-shinyServer(function(input, output,session) {
output$box_01 <- renderValueBox({
entry_01<-20
box1<-valueBox(value=entry_01
,icon = icon("users",lib="font-awesome")
,width=NULL
,color = "blue"
,href="#"
,subtitle=HTML("<b>Test click on valueBox</b>")
)
box1$children[[1]]$attribs$class<-"action-button" …Run Code Online (Sandbox Code Playgroud) 当我想使用labels和图例中的功能colors参数显示在楼梯中时,如下所示.但是,如果我只使用标签外部的地图渲染,则内联正确显示.
我已经看到这个帖子有同样的问题,但他们不是可复制的例子所以我决定发表我自己的问题.addLegend()shinyAppleafletshinyApp
我做了一个可复制的例子:
# ----- Load and install missing packages
packages<-c("shiny","shinydashboard","leaflet")
new.packages <- packages[!(packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
lapply(packages, require, character.only = TRUE)
rm(list = c("new.packages","packages"))
# ----- Reproductible Example
# ----- UI
header <- dashboardHeader(title = "Repoductible Example")
sidebar <- dashboardSidebar(
sidebarMenu(
menuItem("map", tabName = "map", icon = icon("globe",lib="font-awesome"))
)
)
body <- dashboardBody(
tabItems(
tabItem(tabName= "map",
column(width=12,
leafletOutput("mapExmpl", width="100%",height=600)))
)
)
ui <- dashboardPage(header, sidebar, body,skin="blue") …Run Code Online (Sandbox Code Playgroud)