From 67eb07405d004ebfb8fb881e5962fcbdfda55d1c Mon Sep 17 00:00:00 2001 From: swsoyee Date: Sat, 11 Apr 2020 08:14:16 +0900 Subject: [PATCH] =?UTF-8?q?[refactor]=20=E6=AD=B3=E4=BB=A3=E3=83=BB?= =?UTF-8?q?=E6=80=A7=E5=88=A5=E3=82=B3=E3=83=B3=E3=83=9D=E3=83=BC=E3=83=8D?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=82=92=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF?= =?UTF-8?q?=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ComfirmedPyramid.server.R} | 4 +-- Components/Main/ComfirmedPyramid.ui.R | 22 +++++++++++++++ Data/lang.csv | 7 ++++- Pages/Main/Main.ui.R | 27 ++++++++++--------- global.R | 1 + server.R | 2 +- 6 files changed, 46 insertions(+), 17 deletions(-) rename Components/{GenderAgeBar.R => Main/ComfirmedPyramid.server.R} (97%) create mode 100644 Components/Main/ComfirmedPyramid.ui.R diff --git a/Components/GenderAgeBar.R b/Components/Main/ComfirmedPyramid.server.R similarity index 97% rename from Components/GenderAgeBar.R rename to Components/Main/ComfirmedPyramid.server.R index 0b30cd453b..d9959f4de8 100644 --- a/Components/GenderAgeBar.R +++ b/Components/Main/ComfirmedPyramid.server.R @@ -1,4 +1,4 @@ -genderAgeData <- reactive({ +ComfirmedPyramidData <- reactive({ # TODO ローカル作成 positiveDetail[年齢 == '10歳未満', 年齢 := '00代'] positiveDetail[grepl('男', 性別), 性別 := '男性'] @@ -12,7 +12,7 @@ genderAgeData <- reactive({ }) output$genderBar <- renderEcharts4r({ - dt <- genderAgeData() + dt <- ComfirmedPyramidData() maleCount <- sum(dt$count.男性) femaleCount <- sum(dt$count.女性) totalCount <- maleCount + femaleCount diff --git a/Components/Main/ComfirmedPyramid.ui.R b/Components/Main/ComfirmedPyramid.ui.R new file mode 100644 index 0000000000..8ccc2ae9f5 --- /dev/null +++ b/Components/Main/ComfirmedPyramid.ui.R @@ -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])) + ) +} \ No newline at end of file diff --git a/Data/lang.csv b/Data/lang.csv index ac9926df7e..8c5d51d74e 100644 --- a/Data/lang.csv +++ b/Data/lang.csv @@ -120,4 +120,9 @@ L__118,新規,新增 L__119,各都道府県からの新規報告なし,尚未收到各都道府县的新增感染报告 L__120,感染ルート・クラスターへ,前往感染来源、集团感染图 L__121,Beta 0.2,Beta 0.2 -L__122,情報源リンク集,信息新闻源 \ No newline at end of file +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 \ No newline at end of file diff --git a/Pages/Main/Main.ui.R b/Pages/Main/Main.ui.R index b0962e081e..8cbbd025c7 100644 --- a/Pages/Main/Main.ui.R +++ b/Pages/Main/Main.ui.R @@ -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( diff --git a/global.R b/global.R index cba63fddc5..b745512900 100644 --- a/global.R +++ b/global.R @@ -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') # ==== # データの読み込み diff --git a/server.R b/server.R index 170a2ddd60..35ecd53144 100644 --- a/server.R +++ b/server.R @@ -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") # 感染ルート