【问题标题】:R shiny text scroll of sidebar panel侧边栏面板的R闪亮文本滚动
【发布时间】:2018-07-27 15:21:35
【问题描述】:

我在 R 闪亮的仪表板中有以下侧栏面板

dashboardSidebar(
tags$style(".fa-ship {color:#5DADE2}"),
tags$style(".fa-shopping-cart {color:#5DADE2}"),
tags$style(".fa-dollar {color:#5DADE2}"),
tags$style(".fa-keyboard-o {color:#5DADE2}"),
tags$style(".fa-line-chart {color:#5DADE2}"),

sidebarMenu(
  menuItem("Vessel Line-Up Coal Quantity", tabName = "coal_quantity",
           icon = icon("ship", lib="font-awesome")),

  menuItem("Coal Stocks at Port", tabName = "coal_stocks",
           icon = icon("fa fa-shopping-cart", lib="font-awesome")),

  menuItem("Coal Price", tabName = "coal_quan_price",
           icon = icon("dollar", lib="font-awesome")),

  menuItem("Forecasting Weeks", tabName = "man_input",
           icon = icon("keyboard-o", lib="font-awesome"),
           numericInput("forecast_days", "Week ahead forecast:",5, min = 1, max = 500)
  ),

  menuItem("Coal Price Forecasting", tabName = "coal_forecasting",
           icon = icon("line-chart", class = "fa-spin",lib="font-awesome"))

)
),

我想为侧边栏中的Coal Price forecasting 文本添加文本滚动效果。 如何添加?

【问题讨论】:

  • 文字滚动是什么意思?
  • 从左到右
  • 就像我们从<marquee behavior="scroll" direction="right">Your slide-in text goes here</marquee>得到的一样

标签: r shiny


【解决方案1】:

这是你想要的吗?

rm(list = ls())
library(shiny)
library(shinydashboard)

ui <- fluidPage(
  dashboardPage(
    dashboardHeader(title = "Text Scrolling"),
    dashboardSidebar(
      tags$style(".fa-ship {color:#5DADE2}"),
      tags$style(".fa-shopping-cart {color:#5DADE2}"),
      tags$style(".fa-dollar {color:#5DADE2}"),
      tags$style(".fa-keyboard-o {color:#5DADE2}"),
      tags$style(".fa-line-chart {color:#5DADE2}"),

      sidebarMenu(
        menuItem("Vessel Line-Up Coal Quantity", tabName = "coal_quantity",
                 icon = icon("ship", lib="font-awesome")),

        menuItem("Coal Stocks at Port", tabName = "coal_stocks",
                 icon = icon("fa fa-shopping-cart", lib="font-awesome")),

        menuItem("Coal Price", tabName = "coal_quan_price",
                 icon = icon("dollar", lib="font-awesome")),

        menuItem("Forecasting Weeks", tabName = "man_input",
                 icon = icon("keyboard-o", lib="font-awesome"),
                 numericInput("forecast_days", "Week ahead forecast:",5, min = 1, max = 500)
        ),
        menuItem(
          HTML('<marquee behavior="scroll" direction="left">Coal Price Forecasting</marquee>'),
          "Coal Price Forecasting", tabName = "coal_forecasting",
                 icon = icon("line-chart", class = "fa-spin",lib="font-awesome"))
      )
    ),
    dashboardBody()
  )
)

server <- function(input, output, session){}

shinyApp(ui, server)

【讨论】:

  • 是的。非常感谢。工作就像一个魅力:) 我怎样才能改变相同文本的颜色?
  • 您可以像这样更改背景颜色:tagindex.net/html/text/marquee_example.html 和像这样的文本:&lt;font color="red"&gt;&lt;marquee behavior="scroll" direction="left"&gt; Coal Price Forecasting&lt;/marquee&gt;' 但它会移动小箭头
  • 是的。它将箭头向下移动一点。
猜你喜欢
  • 2016-02-26
  • 1970-01-01
  • 2017-04-23
  • 2015-10-27
  • 1970-01-01
  • 1970-01-01
  • 2020-09-20
  • 2019-11-13
  • 1970-01-01
相关资源
最近更新 更多