diff --git a/03_Components/Main/ConfirmedHeatmap.server.R b/03_Components/Main/ConfirmedHeatmap.server.R
index 6966d44d5b..c866222359 100644
--- a/03_Components/Main/ConfirmedHeatmap.server.R
+++ b/03_Components/Main/ConfirmedHeatmap.server.R
@@ -1,7 +1,9 @@
# 日次都道府県別新規発生数 ====
output$confirmedHeatmap <- renderEcharts4r({
data <- melt(byDate, id.vars = "date")
- data[variable %in% colnames(byDate)[2:48]] %>%
+ data <- data[variable %in% colnames(byDate)[2:48]]
+ data[, variable := sapply(as.character(variable), i18n$t)]
+ data %>%
e_chart(date) %>%
e_heatmap(variable, value, label = list(show = T, fontSize = 5)) %>%
e_visual_map(
@@ -30,20 +32,34 @@ output$confirmedHeatmap <- renderEcharts4r({
e_mark_line(
data = list(
xAxis = "2020-04-07",
- label = list(formatter = i18n$t("4月7日\n緊急事態宣言"), position = "start")
+ label = list(
+ formatter = i18n$t("4月7日\n緊急事態宣言"),
+ position = "start"
+ )
),
lineStyle = list(opacity = 0.5),
silent = T,
- symbol = "circle", symbolSize = 4
+ symbol = "circle",
+ symbolSize = 4
+ ) %>%
+ e_grid(
+ right = "8%",
+ bottom = "15%",
+ left = "2%"
) %>%
- e_grid(right = "8%", bottom = "15%", left = "2%") %>%
e_title(text = i18n$t("日次都道府県別新規発生数")) %>%
- e_tooltip(formatter = htmlwidgets::JS("
+ e_tooltip(
+ formatter = htmlwidgets::JS(
+ "
function(params) {
console.log(params)
- return(`${params.value[0]}
${params.value[1]}:${Math.round(params.value[2])}日`)
+ return(`${params.value[0]}
${params.value[1]}:${Math.round(params.value[2])}",
+ i18n$t("日"),
+ "`)
}
- "))
+ "
+ )
+ )
})
# 倍加時間の経時的変化====
@@ -56,19 +72,38 @@ output$confirmedHeatmapDoublingTime <- renderEcharts4r({
dt$date <- byDate$date
dt <- melt(dt, id.vars = "date")
- dt[variable %in% colnames(byDate)[2:48]] %>%
+ dt <- dt[variable %in% colnames(byDate)[2:48]]
+ dt[, variable := sapply(as.character(variable), i18n$t)]
+ dt %>%
e_chart(date) %>%
- e_heatmap(variable, value,
- label = list(show = T, fontSize = 5, formatter = htmlwidgets::JS("
+ e_heatmap(
+ variable,
+ value,
+ label = list(
+ show = T,
+ fontSize = 5,
+ formatter = htmlwidgets::JS(
+ "
function(params) {
return(Math.round(Number(params.value[2])))
}
- ")),
+ "
+ )
+ ),
itemStyle = list(borderWidth = 1, borderColor = "rgb(255, 255, 255, 0.2)")
) %>%
e_visual_map(
value,
- inRange = list(color = c("white", darkRed, middleRed, middleYellow, lightYellow, "#F6F7FA")),
+ inRange = list(
+ color = c(
+ "white",
+ darkRed,
+ middleRed,
+ middleYellow,
+ lightYellow,
+ "#F6F7FA"
+ )
+ ),
type = "piecewise",
splitList = list(
list(min = 12),
@@ -92,20 +127,34 @@ output$confirmedHeatmapDoublingTime <- renderEcharts4r({
e_mark_line(
data = list(
xAxis = "2020-04-07",
- label = list(formatter = i18n$t("4月7日\n緊急事態宣言"), position = "start")
+ label = list(
+ formatter = i18n$t("4月7日\n緊急事態宣言"),
+ position = "start"
+ )
),
lineStyle = list(opacity = 0.5),
silent = T,
- symbol = "circle", symbolSize = 4
+ symbol = "circle",
+ symbolSize = 4
+ ) %>%
+ e_grid(
+ right = "8%",
+ bottom = "15%",
+ left = "2%"
) %>%
- e_grid(right = "8%", bottom = "15%", left = "2%") %>%
e_title(text = sprintf(i18n$t("倍加時間の経時的変化(直近%s日間で計算)"), 7)) %>%
- e_tooltip(formatter = htmlwidgets::JS("
+ e_tooltip(
+ formatter = htmlwidgets::JS(
+ "
function(params) {
console.log(params)
- return(`${params.value[0]}
${params.value[1]}:${Math.round(params.value[2])}日`)
+ return(`${params.value[0]}
${params.value[1]}:${Math.round(params.value[2])}",
+ i18n$t("日"),
+ "`)
}
- "))
+ "
+ )
+ )
})
output$confirmedHeatmapWrapper <- renderUI({
@@ -119,9 +168,9 @@ output$confirmedHeatmapWrapper <- renderUI({
output$confirmedHeatmapDoublingTimeOptions <- renderUI({
if (input$confirmedHeatmapSelector == "confirmedHeatmapDoublingTime") {
tagList(
- tags$p("日数の計算式は以下になります:"),
+ tags$p(i18n$t("日数の計算式は以下になります:")),
withMathJax("$$7log2 \\div log(\\frac{day_7N}{day_0N})$$"),
- helpText("N:累積感染者数")
+ helpText(i18n$t("N:累積感染者数"))
)
}
})
diff --git a/04_Pages/Main/Main.ui.R b/04_Pages/Main/Main.ui.R
index c2b591d8f9..9300433c5e 100644
--- a/04_Pages/Main/Main.ui.R
+++ b/04_Pages/Main/Main.ui.R
@@ -46,8 +46,8 @@ fluidPage(
inputId = "confirmedHeatmapSelector",
label = i18n$t("ヒートマップ選択"),
size = "sm", justified = T,
- choices = list("日次新規" = "confirmedHeatmap",
- "倍加時間" = "confirmedHeatmapDoublingTime"),
+ choiceNames = c(i18n$t("日次新規"), i18n$t("倍加時間")),
+ choiceValues = list("confirmedHeatmap", "confirmedHeatmapDoublingTime"),
status = "danger"
),
style = "margin-top:5px;"
diff --git a/www/lang/translation.json b/www/lang/translation.json
index 028cc9bec4..27d0f654f6 100644
--- a/www/lang/translation.json
+++ b/www/lang/translation.json
@@ -318,9 +318,29 @@
},
{
"ja": "倍加時間の経時的変化(直近%s日間で計算)",
- "cn": "翻倍所需时间的变化趋势(以最近%s天间隔计算)",
+ "cn": "翻倍需时的变化趋势(以最近%s天间隔计算)",
"en": "Change in doubling time over time (calculated over the last %s days)"
},
+ {
+ "ja": "倍加時間",
+ "cn": "翻倍需时",
+ "en": "Doubling Time"
+ },
+ {
+ "ja": "日次新規",
+ "cn": "每日新增",
+ "en": "New daily"
+ },
+ {
+ "ja": "日数の計算式は以下になります:",
+ "cn": "天数计算方法如下式所示:",
+ "en": "The number of days is calculated by the following formula: "
+ },
+ {
+ "ja": "N:累積感染者数",
+ "cn": "N:累计确诊人数",
+ "en": "N: Cumulative number of infected"
+ },
{
"ja": "コールセンター(累計)",
"cn": "咨询热线(累计)",