Skip to content

Commit

Permalink
[refactor] 歳代・性別コンポーネントをリファクタリング
Browse files Browse the repository at this point in the history
  • Loading branch information
swsoyee committed Apr 10, 2020
1 parent 83f9c98 commit 67eb074
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
genderAgeData <- reactive({
ComfirmedPyramidData <- reactive({
# TODO ローカル作成
positiveDetail[年齢 == '10歳未満', 年齢 := '00代']
positiveDetail[grepl('', 性別), 性別 := '男性']
Expand All @@ -12,7 +12,7 @@ genderAgeData <- reactive({
})

output$genderBar <- renderEcharts4r({
dt <- genderAgeData()
dt <- ComfirmedPyramidData()
maleCount <- sum(dt$count.男性)
femaleCount <- sum(dt$count.女性)
totalCount <- maleCount + femaleCount
Expand Down
22 changes: 22 additions & 0 deletions Components/Main/ComfirmedPyramid.ui.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Component.ComfirmedPyramid <- function() {
boxPlus(
# 歳代・性別
title = tagList(icon('venus-mars'), lang[[langCode]][124]),
width = 4,
enable_label = T,
collapsible = T,
collapsed = T,
# 集計時間:
label_text = paste(lang[[langCode]][123], max(as.Date(
positiveDetail$発表日
), na.rm = T)),
echarts4rOutput('genderBar') %>% withSpinner(),
closable = F,
# データ提供:
footer = tags$small(lang[[langCode]][125],
# @kenmo_economics
tags$a(icon('twitter'), lang[[langCode]][126],
# https://twitter.com/kenmo_economics
href = lang[[langCode]][127]))
)
}
7 changes: 6 additions & 1 deletion Data/lang.csv
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,9 @@ L__118,新規,新增
L__119,各都道府県からの新規報告なし,尚未收到各都道府县的新增感染报告
L__120,感染ルート・クラスターへ,前往感染来源、集团感染图
L__121,Beta 0.2,Beta 0.2
L__122,情報源リンク集,信息新闻源
L__122,情報源リンク集,信息新闻源
L__123,集計時間:,统计时间:
L__124,歳代・性別,性别年龄层
L__125,データ提供:,数据提供:
L__126,@kenmo_economics,@kenmo_economics
L__127,https://twitter.com/kenmo_economics,https://twitter.com/kenmo_economics
27 changes: 14 additions & 13 deletions Pages/Main/Main.ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,20 @@ fluidPage(
)
),
fluidRow(
boxPlus(title = tagList(icon('venus-mars'), '歳代・性別'),
width = 4,
enable_label = T,
collapsible = T,
collapsed = T,
label_text = paste('集計時間:', max(as.Date(positiveDetail$発表日), na.rm = T)),
echarts4rOutput('genderBar') %>% withSpinner(),
closable = F,
footer = tags$small('データ提供:',
tags$a(icon('twitter'), '@kenmo_economics',
href = 'https://twitter.com/kenmo_economics')
)
),
# boxPlus(title = tagList(icon('venus-mars'), '歳代・性別'),
# width = 4,
# enable_label = T,
# collapsible = T,
# collapsed = T,
# label_text = paste('集計時間:', max(as.Date(positiveDetail$発表日), na.rm = T)),
# echarts4rOutput('genderBar') %>% withSpinner(),
# closable = F,
# footer = tags$small('データ提供:',
# tags$a(icon('twitter'), '@kenmo_economics',
# href = 'https://twitter.com/kenmo_economics')
# )
# ),
Component.ComfirmedPyramid(),
Component.SymptomsProgression()
),
fluidRow(
Expand Down
1 change: 1 addition & 0 deletions global.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ source(file = paste0(PAGE_PATH, 'Main/Utils/ValueBox.R'), local = T, encoding =
source(file = paste0(COMPONENT_PATH, '/Main/NewsList.ui.R'), local = T, encoding = 'UTF-8')
source(file = paste0(COMPONENT_PATH, '/Main/clusterTabButton.ui.R'), local = T, encoding = 'UTF-8')
source(file = paste0(COMPONENT_PATH, '/Main/SymptomsProgression.ui.R'), local = T, encoding = 'UTF-8')
source(file = paste0(COMPONENT_PATH, '/Main/ComfirmedPyramid.ui.R'), local = T, encoding = 'UTF-8')

# ====
# データの読み込み
Expand Down
2 changes: 1 addition & 1 deletion server.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ shinyServer(function(input, output, session) {
local = TRUE,
encoding = "UTF-8")
# 歳代、年齢コンポーネント
source(file = paste0(COMPONENT_PATH, 'GenderAgeBar.R'),
source(file = paste0(COMPONENT_PATH, 'Main/ComfirmedPyramid.server.R'),
local = TRUE,
encoding = "UTF-8")
# 感染ルート
Expand Down

0 comments on commit 67eb074

Please sign in to comment.