Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
Merge pull request #5180 from tokyo-metropolitan-gov/staging
Browse files Browse the repository at this point in the history
Release 2020/08/03 Ver.2
  • Loading branch information
soutaito authored Aug 3, 2020
2 parents ef3f8a0 + 6d62af0 commit e1fc384
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 37 deletions.
2 changes: 1 addition & 1 deletion components/ConfirmedCasesIncreaseRatioByWeekChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
},
displayDataHeader() {
return {
labels: ['2020/1/1'],
labels: ['2020-01-01'],
datasets: [
{
data: [Math.max(...this.chartData.map((d) => d.transition))],
Expand Down
5 changes: 2 additions & 3 deletions components/DashedRectangleTimeBarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
fontColor: '#808080',
maxRotation: 0,
callback: (label: string) => {
return label.split('/')[1]
return dayjs(label).format('D')
},
},
// #2384: If you set "type" to "time", make sure that the bars at both ends are not hidden.
Expand All @@ -313,7 +313,6 @@ const options: ThisTypedComponentOptionsWithRecordProps<
type: 'time',
time: {
unit: 'month',
parser: 'M/D',
displayFormats: {
month: 'MMM',
},
Expand Down Expand Up @@ -344,7 +343,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
},
displayDataHeader() {
return {
labels: ['2020/1/1'],
labels: ['2020-01-01'],
datasets: [
{
data: [Math.max(...this.chartData.map((d) => d.transition))],
Expand Down
2 changes: 1 addition & 1 deletion components/MixedBarAndLineChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
},
displayDataHeader() {
return {
labels: ['2020/1/1'],
labels: ['2020-01-01'],
datasets: (this.dataLabels as string[]).map((_) => ({
data: [],
backgroundColor: 'transparent',
Expand Down
2 changes: 1 addition & 1 deletion components/MonitoringConfirmedCasesChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
},
displayDataHeader() {
return {
labels: ['2020/1/1'],
labels: ['2020-01-01'],
datasets: (this.dataLabels as string[]).map((_) => ({
data: [],
backgroundColor: 'transparent',
Expand Down
2 changes: 1 addition & 1 deletion components/MonitoringConsultationDeskReportChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
},
displayDataHeader() {
return {
labels: ['2020/1/1'],
labels: ['2020-01-01'],
datasets: (this.dataLabels as string[]).map((_) => ({
data: [],
backgroundColor: 'transparent',
Expand Down
2 changes: 1 addition & 1 deletion components/PositiveRateMixedChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
}
}
return {
labels: ['2020/1/1'],
labels: ['2020-01-01'],
datasets: [
{
data: [this.displayData.datasets[0].data[n]],
Expand Down
7 changes: 3 additions & 4 deletions components/SevereCaseBarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
fontColor: '#808080',
maxRotation: 0,
callback: (label: string) => {
return label.split('/')[1]
return dayjs(label).format('D')
},
},
// #2384: If you set "type" to "time", make sure that the bars at both ends are not hidden.
Expand All @@ -242,7 +242,6 @@ const options: ThisTypedComponentOptionsWithRecordProps<
type: 'time',
time: {
unit: 'month',
parser: 'M/D',
displayFormats: {
month: 'MMM',
},
Expand Down Expand Up @@ -273,7 +272,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
},
displayDataHeader() {
return {
labels: ['2020/1/1', '2020/1/2'],
labels: ['2020-01-01', '2020-01-02'],
datasets: [
{
data: [
Expand Down Expand Up @@ -308,7 +307,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
maxRotation: 0,
minRotation: 0,
callback: (label: string) => {
return label.split('/')[1]
return dayjs(label).format('D')
},
},
},
Expand Down
14 changes: 5 additions & 9 deletions components/TimeBarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
},
title(tooltipItem, data) {
const label = data.labels![tooltipItem[0].index!] as string
return self.$d(
getComplementedDate(label),
'dateWithoutYear'
)
return self.$d(getComplementedDate(label), 'dateWithoutYear')
},
},
},
Expand All @@ -316,7 +313,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
fontColor: '#808080',
maxRotation: 0,
callback: (label: string) => {
return label.split('/')[1]
return dayjs(label).format('D')
},
},
// #2384: If you set "type" to "time", make sure that the bars at both ends are not hidden.
Expand All @@ -340,7 +337,6 @@ const options: ThisTypedComponentOptionsWithRecordProps<
type: 'time',
time: {
unit: 'month',
parser: 'M/D',
displayFormats: {
month: 'MMM',
},
Expand Down Expand Up @@ -372,7 +368,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
displayDataHeader() {
if (this.dataKind === 'transition') {
return {
labels: ['2020/1/1'],
labels: ['2020-01-01'],
datasets: [
{
data: [Math.max(...this.chartData.map((d) => d.transition))],
Expand All @@ -383,7 +379,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
}
}
return {
labels: ['2020/1/1'],
labels: ['2020-01-01'],
datasets: [
{
data: [Math.max(...this.chartData.map((d) => d.cumulative))],
Expand Down Expand Up @@ -415,7 +411,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
maxRotation: 0,
minRotation: 0,
callback: (label: string) => {
return label.split('/')[1]
return dayjs(label).format('D')
},
},
},
Expand Down
12 changes: 4 additions & 8 deletions components/TimeStackedBarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
},
title(tooltipItem, data) {
const label = data.labels![tooltipItem[0].index!] as string
return self.$d(
getComplementedDate(label),
'dateWithoutYear'
)
return self.$d(getComplementedDate(label), 'dateWithoutYear')
},
},
},
Expand All @@ -374,7 +371,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
fontColor: '#808080',
maxRotation: 0,
callback: (label: string) => {
return label.split('/')[1]
return dayjs(label).format('D')
},
},
// #2384: If you set "type" to "time", make sure that the bars at both ends are not hidden.
Expand All @@ -398,7 +395,6 @@ const options: ThisTypedComponentOptionsWithRecordProps<
type: 'time',
time: {
unit: 'month',
parser: 'M/D',
displayFormats: {
month: 'MMM',
},
Expand Down Expand Up @@ -440,7 +436,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
}
}
return {
labels: ['2020/1/1'],
labels: ['2020-01-01'],
datasets: [
{
data: [this.displayData.datasets[0].data[n]],
Expand Down Expand Up @@ -477,7 +473,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
maxRotation: 0,
minRotation: 0,
callback: (label: string) => {
return label.split('/')[1]
return dayjs(label).format('D')
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion components/UntrackedRateMixedChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ const options: ThisTypedComponentOptionsWithRecordProps<
}
}
return {
labels: ['2020/1/1'],
labels: ['2020-01-01'],
datasets: [
{
data: [this.displayData.datasets[0].data[n]],
Expand Down
2 changes: 1 addition & 1 deletion components/cards/HospitalizedNumberCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:chart-data="patientsGraph"
:date="positiveStatus.date"
:unit="$t('人')"
:dashed-rectangle-range="'5/11'"
:dashed-rectangle-range="'2020-05-11'"
:added-value="200"
:table-labels="tableLabels"
>
Expand Down
4 changes: 2 additions & 2 deletions components/cards/SevereCaseCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<script>
import Data from '@/data/positive_status.json'
import SevereCaseBarChart from '@/components/SevereCaseBarChart.vue'
import { convertDateToISO8601Format } from '@/utils/formatDate.ts'
export default {
components: {
Expand All @@ -51,11 +52,10 @@ export default {
Data.data
.filter((d) => new Date(d.date) > new Date('2020-04-26'))
.forEach((d) => {
const date = new Date(d.date)
const subTotal = d.severe_case
if (!isNaN(subTotal)) {
graphData.push({
label: `${date.getMonth() + 1}/${date.getDate()}`,
label: convertDateToISO8601Format(d.date),
transition: subTotal,
})
}
Expand Down
5 changes: 4 additions & 1 deletion components/cards/TestedNumberCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
import Data from '@/data/data.json'
import { getDayjsObject } from '@/utils/formatDate'
import TimeStackedBarChart from '@/components/TimeStackedBarChart.vue'
dayjs.extend(duration)
Expand All @@ -73,7 +74,9 @@ export default {
this.$t('健康安全研究センターが行った検査件数'),
this.$t('医療機関等が行った検査件数'),
]
const inspectionsLabels = Data.inspections_summary.labels
const inspectionsLabels = Data.inspections_summary.labels.map((d) => {
return getDayjsObject(d).format('YYYY-MM-DD')
})
const inspectionsDataLabels = [
this.$t('健康安全研究センターが行った検査件数'),
this.$t('医療機関等が行った検査件数'),
Expand Down
7 changes: 4 additions & 3 deletions utils/formatGraph.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { convertDateToISO8601Format } from '@/utils/formatDate'

type DataType = {
日付: Date
日付: string
小計: number
}

Expand All @@ -21,12 +23,11 @@ export default (data: DataType[]) => {
data
.filter((d) => new Date(d['日付']) < today)
.forEach((d) => {
const date = new Date(d['日付'])
const subTotal = d['小計']
if (!isNaN(subTotal)) {
patSum += subTotal
graphData.push({
label: `${date.getMonth() + 1}/${date.getDate()}`,
label: convertDateToISO8601Format(d['日付']),
transition: subTotal,
cumulative: patSum,
})
Expand Down

0 comments on commit e1fc384

Please sign in to comment.