R/valueBox.R

Defines functions Component.MainValueBox.Info Component.MainValueBox

Documented in Component.MainValueBox Component.MainValueBox.Info

#' 首页数值框
#'
#' @param mainValue 主标题
#' @param mainValueSub 副标题
#' @param sparklineName 线图
#' @param diffNumber 数据
#' @param text 文本
#' @param icon 图标
#' @param color 颜色
#'
#' @return 返回值
#' @export
#'
#' @examples
#' Component.MainValueBox()
Component.MainValueBox <-function(mainValue,
           mainValueSub,
           sparklineName,
           diffNumber,
           text,
           icon,
           color) {
    valueBox(
      width = 6,
      value = tagList(
        countup(mainValue),
        tags$small(paste0("| ", mainValueSub),
                   style = "color:white;font-size:16px;margin-top:10px;margin-right:10px;opacity:0.8"
        )
      ),
      subtitle = tagList(
        " ",
        sparklineOutput(sparklineName),
        tags$span(
          countup(diffNumber),
          getChangeIconWrapper(diffNumber),
          text,
          style = "float:right;"
        )
      ),
      icon = icon(icon),
      color = color
    )
  }


#' 首页信息表
#'
#' @param mainValue 主要值
#' @param mainValueSub 副标题
#' @param sparklineName 图
#' @param diffNumber 数据
#' @param text 文本
#' @param icon 图标
#' @param color 颜色
#'
#' @return 返回值
#' @export
#'
#' @examples
#' Component.MainValueBox.Info()
Component.MainValueBox.Info <-
  function(mainValue,
           mainValueSub,
           sparklineName,
           diffNumber,
           text,
           icon,
           color) {
    
    valueBox(
      width = 6,
      value = tagList(
        countup(mainValue),
        tags$small(paste0("| ", mainValueSub),
                   tags$span(id = "discharged_info", icon("info-circle")),
                   bsTooltip(id = "discharged_info",
                             title = sprintf(i18n$t("確定済みの退院者数は%s名、他にも%s名の退院者は個々の陽性者との突合作業中。従って、入退院等の状況の合計とPCR検査陽性者数は一致しない。<br><br>※令和2年4月22日から厚労省公開している退院者数の基準が変わりました。"),
                                             mainValueSub, (mainValue - mainValueSub)),
                             placement = "right"),
                   style = "color:white;font-size:16px;margin-top:10px;margin-right:10px;opacity:0.8"
        )
      ),
      subtitle = tagList(
        " ",
        sparklineOutput(sparklineName),
        tags$span(
          countup(diffNumber),
          getChangeIconWrapper(diffNumber),
          text,
          style = "float:right;"
        )
      ),
      icon = icon(icon),
      color = color
    )
  }
takewiki/tsui documentation built on July 5, 2023, 10:59 p.m.