小编Chr*_* D.的帖子

使用shinydashboard的infoBox变成闪亮的

我正在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但我无法弄清楚如何做到这一点.

这是它的样子shinydashboard:
在此输入图像描述

这是我在我的应用程序中使用的样子shiny:
在此输入图像描述

以下是由以下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样式和信息框功能.

css r shiny

10
推荐指数
1
解决办法
3219
查看次数

d3.js刷填充颜色直方图

我用它创建了一些直方图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)

但我没有事件了解这个函数中发生了什么,以及如果他们没有其他方法可以做到这一点,如何点对它.

javascript brush d3.js clip-path

8
推荐指数
2
解决办法
1622
查看次数

使用href信息框作为动作按钮

我是建设一个AppRshiny.

我有几个,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)

r infobox shiny shinydashboard action-button

6
推荐指数
1
解决办法
3462
查看次数

在传单中的传单地图中使用标签和颜色时,图例标签不显示内联

当我想使用labels和图例中的功能colors参数显示在楼梯中时,如下所示.但是,如果我只使用标签外部的地图渲染,则内联正确显示. 我已经看到这个帖子有同样的问题,但他们不是可复制的例子所以我决定发表我自己的问题.addLegend()shinyAppleafletshinyApp

  • 错误的显示(闪亮的仪表板)

wrongDisplay

  • 正确显示(单张独立)

correctDisplay

我做了一个可复制的例子:

# ----- 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)

r leaflet shinydashboard

6
推荐指数
1
解决办法
984
查看次数