Completed overall testing and cases dashboard.
This commit is contained in:
		
							
								
								
									
										142
									
								
								src/components/charts/overall/cases/ChipsCases.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										142
									
								
								src/components/charts/overall/cases/ChipsCases.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,142 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <StatCard>
 | 
			
		||||
    <template v-slot:heading>Confirmed Cases {{last_report_date ? humanDate(last_report_date) : ''}}</template>
 | 
			
		||||
    <template v-slot:value v-if="chips.today_cases != null">
 | 
			
		||||
      {{chips.today_cases.toLocaleString()}}
 | 
			
		||||
    </template>
 | 
			
		||||
    <template v-slot:meta v-if="chips.today_case_change != null">
 | 
			
		||||
      <span v-if="chips.today_case_change > 0">Up </span>
 | 
			
		||||
      <span v-if="chips.today_case_change < 0">Down </span>
 | 
			
		||||
      <span :class="{'font-semibold': true, 'text-red-600': chips.today_case_change > 0, 'text-green-600': chips.today_case_change < 0}">
 | 
			
		||||
        {{Math.abs(chips.today_case_change).toLocaleString()}} ({{chips.today_case_change_percent}}%)
 | 
			
		||||
      </span> compared to previous day
 | 
			
		||||
    </template>
 | 
			
		||||
  </StatCard>
 | 
			
		||||
 | 
			
		||||
  <StatCard>
 | 
			
		||||
    <template v-slot:heading>Cases per 10,000 Residents {{last_report_date ? humanDate(last_report_date) : ''}}</template>
 | 
			
		||||
    <template v-slot:value v-if="chips.today_cases_per_capita != null">
 | 
			
		||||
      ~{{chips.today_cases_per_capita.toLocaleString()}}
 | 
			
		||||
    </template>
 | 
			
		||||
    <template v-slot:meta v-if="chips.population != null">
 | 
			
		||||
      <span class="text-indigo-500 font-semibold">{{chips.today_cases.toLocaleString()}}</span> out of <span class="text-indigo-500 font-semibold">{{chips.population.toLocaleString()}}</span> residents
 | 
			
		||||
    </template>
 | 
			
		||||
  </StatCard>
 | 
			
		||||
 | 
			
		||||
  <StatCard>
 | 
			
		||||
    <template v-slot:heading>Total Confirmed Cases</template>
 | 
			
		||||
    <template v-slot:value v-if="chips.total_cases != null">
 | 
			
		||||
      {{chips.total_cases.toLocaleString()}}
 | 
			
		||||
    </template>
 | 
			
		||||
    <template v-slot:meta v-if="chips.total_case_change != null">
 | 
			
		||||
      <span class="font-semibold text-indigo-500">
 | 
			
		||||
        {{Math.abs(chips.total_case_change).toLocaleString()}} ({{chips.total_case_change_percent}}%)
 | 
			
		||||
      </span> more than previous day
 | 
			
		||||
    </template>
 | 
			
		||||
  </StatCard>
 | 
			
		||||
 | 
			
		||||
  <StatCard>
 | 
			
		||||
    <template v-slot:heading>Total Cases per 10,000 Residents</template>
 | 
			
		||||
    <template v-slot:value v-if="chips.total_cases_per_capita != null">
 | 
			
		||||
      ~{{chips.total_cases_per_capita.toLocaleString()}}
 | 
			
		||||
    </template>
 | 
			
		||||
    <template v-slot:meta v-if="chips.total_cases != null && chips.population != null">
 | 
			
		||||
      <span class="text-indigo-500 font-semibold">{{chips.total_cases.toLocaleString()}}</span> out of <span class="text-indigo-500 font-semibold">{{chips.population.toLocaleString()}}</span> residents
 | 
			
		||||
    </template>
 | 
			
		||||
  </StatCard>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
import { reactive, computed } from 'vue'
 | 
			
		||||
import { col, humanDate } from '@/components/charts/util'
 | 
			
		||||
import store from '@/components/charts/overall/cases/store.js'
 | 
			
		||||
 | 
			
		||||
const data = store.data
 | 
			
		||||
 | 
			
		||||
const last_report_date = computed(() => {
 | 
			
		||||
  if (!data.value) return null
 | 
			
		||||
  return col(data, data.value.rows.at(-1), 'report_date')
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const chips = reactive({
 | 
			
		||||
  population: computed(() => {
 | 
			
		||||
    if (!data.value) return null
 | 
			
		||||
 | 
			
		||||
    const r = data.value.rows.at(-1)
 | 
			
		||||
    return col(data, r, 'population')
 | 
			
		||||
  }),
 | 
			
		||||
 | 
			
		||||
  today_cases: computed(() => {
 | 
			
		||||
    if (!data.value) return null
 | 
			
		||||
 | 
			
		||||
    const r = data.value.rows.at(-1)
 | 
			
		||||
    return col(data, r, 'cases')
 | 
			
		||||
  }),
 | 
			
		||||
 | 
			
		||||
  today_case_change: computed(() => {
 | 
			
		||||
    if (!data.value) return null
 | 
			
		||||
 | 
			
		||||
    const today = col(data, data.value.rows.at(-1), 'cases')
 | 
			
		||||
    const yesterday = col(data, data.value.rows.at(-2), 'cases')
 | 
			
		||||
    return today - yesterday
 | 
			
		||||
  }),
 | 
			
		||||
 | 
			
		||||
  today_case_change_percent: computed(() => {
 | 
			
		||||
    if (!data.value) return null
 | 
			
		||||
 | 
			
		||||
    const today = col(data, data.value.rows.at(-1), 'cases')
 | 
			
		||||
    const yesterday = col(data, data.value.rows.at(-2), 'cases')
 | 
			
		||||
    const change = today - yesterday
 | 
			
		||||
 | 
			
		||||
    const percent = change > 0
 | 
			
		||||
      ? ((change / yesterday) * 100)
 | 
			
		||||
      : ((change / today) * 100)
 | 
			
		||||
 | 
			
		||||
    return Math.abs(percent.toFixed(1))
 | 
			
		||||
  }),
 | 
			
		||||
 | 
			
		||||
  today_cases_per_capita: computed(() => {
 | 
			
		||||
    if (!data.value) return null
 | 
			
		||||
 | 
			
		||||
    const r = data.value.rows.at(-1)
 | 
			
		||||
    return Math.round(col(data, r, 'cases_per_capita') * 10000)
 | 
			
		||||
  }),
 | 
			
		||||
 | 
			
		||||
  total_cases: computed(() => {
 | 
			
		||||
    if (!data.value) return null
 | 
			
		||||
 | 
			
		||||
    const r = data.value.rows.at(-1)
 | 
			
		||||
    return col(data, r, 'total_cases')
 | 
			
		||||
  }),
 | 
			
		||||
 | 
			
		||||
  total_case_change: computed(() => {
 | 
			
		||||
    if (!data.value) return null
 | 
			
		||||
 | 
			
		||||
    const today = col(data, data.value.rows.at(-1), 'total_cases')
 | 
			
		||||
    const yesterday = today - col(data, data.value.rows.at(-1), 'cases')
 | 
			
		||||
    return today - yesterday
 | 
			
		||||
  }),
 | 
			
		||||
 | 
			
		||||
  total_case_change_percent: computed(() => {
 | 
			
		||||
    if (!data.value) return null
 | 
			
		||||
 | 
			
		||||
    const today = col(data, data.value.rows.at(-1), 'total_cases')
 | 
			
		||||
    const yesterday = today - col(data, data.value.rows.at(-1), 'cases')
 | 
			
		||||
    const change = today - yesterday
 | 
			
		||||
 | 
			
		||||
    const percent = change > 0
 | 
			
		||||
      ? ((change / yesterday) * 100)
 | 
			
		||||
      : ((change / today) * 100)
 | 
			
		||||
 | 
			
		||||
    return Math.abs(percent.toFixed(1))
 | 
			
		||||
  }),
 | 
			
		||||
 | 
			
		||||
  total_cases_per_capita: computed(() => {
 | 
			
		||||
    if (!data.value) return null
 | 
			
		||||
 | 
			
		||||
    const r = data.value.rows.at(-1)
 | 
			
		||||
    return Math.round(col(data, r, 'total_cases_per_capita') * 10000)
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
							
								
								
									
										67
									
								
								src/components/charts/overall/cases/MapCases.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								src/components/charts/overall/cases/MapCases.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <Card class="flex flex-col">
 | 
			
		||||
    <h2 class="mb-1 text-xl text-indigo-900 flex justify-between items-center">
 | 
			
		||||
      Cases per 10,000 Residents
 | 
			
		||||
    </h2>
 | 
			
		||||
    <p class="mb-4 text-sm text-indigo-700">Last two weeks</p>
 | 
			
		||||
    <JSCharting :options="mapOptions" class="flex-1"/>
 | 
			
		||||
  </Card>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
import { computed, onMounted } from 'vue'
 | 
			
		||||
import { col, colors, formatDate} from '@/components/charts/util'
 | 
			
		||||
 | 
			
		||||
import store from '@/components/charts/overall/cases/store_combined.js'
 | 
			
		||||
 | 
			
		||||
const column = 'total_cases'
 | 
			
		||||
const data = store.data
 | 
			
		||||
 | 
			
		||||
const rows = computed(() => {
 | 
			
		||||
  if (!data.value) return []
 | 
			
		||||
  return data.value.rows
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const mapOptions = computed(() => {
 | 
			
		||||
  if (!data.value) return {}
 | 
			
		||||
  const current_date = data.value.segment.report_date.at(-1)
 | 
			
		||||
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'map solid',
 | 
			
		||||
    legend_position: 'bottom',
 | 
			
		||||
    palette: {
 | 
			
		||||
      pointValue: point => {
 | 
			
		||||
        return point?.userOptions?.attributes?.rate || 0
 | 
			
		||||
      },
 | 
			
		||||
      colors
 | 
			
		||||
    },
 | 
			
		||||
    defaultPoint: {
 | 
			
		||||
      tooltip: '%name County <b>(%rate)</b>',
 | 
			
		||||
      states: {
 | 
			
		||||
        hover: { fill: 'currentColor' }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    series: [{
 | 
			
		||||
      map: '/maps/ga-13-georgia-counties.json',
 | 
			
		||||
      points: rows.value
 | 
			
		||||
        .filter(r => {
 | 
			
		||||
          return col(data, r, 'report_date') === current_date
 | 
			
		||||
        })
 | 
			
		||||
        .map(r => {
 | 
			
		||||
          const id = `ga-13-georgia-counties.${col(data, r, 'county').toLowerCase().split(' ').join('-')}`
 | 
			
		||||
          return {
 | 
			
		||||
            map: id,
 | 
			
		||||
            attributes: {
 | 
			
		||||
              rate: Math.round(col(data, r, 'case_rate_14_days') / 10)
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
    }],
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
onMounted(() => {
 | 
			
		||||
  var chart;
 | 
			
		||||
  var countiesData;
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
							
								
								
									
										9
									
								
								src/components/charts/overall/cases/ParametersCases.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								src/components/charts/overall/cases/ParametersCases.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <SliceSelector :parameters="parameters" :unknown="true"></SliceSelector>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup lang='ts'>
 | 
			
		||||
import store from '@/components/charts/overall/cases/store.js'
 | 
			
		||||
 | 
			
		||||
const parameters = store.parameters
 | 
			
		||||
</script>
 | 
			
		||||
							
								
								
									
										68
									
								
								src/components/charts/overall/cases/TrendDailyCases.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								src/components/charts/overall/cases/TrendDailyCases.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,68 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <Card>
 | 
			
		||||
    <h2 class="mb-6 text-xl text-indigo-900 flex justify-between items-center">
 | 
			
		||||
      Daily Cases
 | 
			
		||||
 | 
			
		||||
      <select v-model="chart" class="text-base m-0">
 | 
			
		||||
        <option value="calendar">Calendar</option>
 | 
			
		||||
        <option value="line">Line Chart</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </h2>
 | 
			
		||||
    <JSCharting v-if="chart === 'calendar'" :options="calendarOptions"></JSCharting>
 | 
			
		||||
    <JSCharting v-if="chart === 'line'" :options="areaOptions"></JSCharting>
 | 
			
		||||
  </Card>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
import { ref, computed } from 'vue'
 | 
			
		||||
import { col, colors } from '@/components/charts/util'
 | 
			
		||||
import store from '@/components/charts/overall/cases/store.js'
 | 
			
		||||
 | 
			
		||||
const chart = ref('calendar')
 | 
			
		||||
 | 
			
		||||
const column = 'cases'
 | 
			
		||||
const parameters = store.parameters
 | 
			
		||||
const data = store.data
 | 
			
		||||
 | 
			
		||||
const rows = computed(() => {
 | 
			
		||||
  if (!data.value || !parameters.value) return []
 | 
			
		||||
  return data.value.rows
 | 
			
		||||
    .filter(r => {
 | 
			
		||||
      return col(data, r, 'report_date') >= parameters.value.start && col(data, r, 'report_date') <= parameters.value.end
 | 
			
		||||
    })
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const calendarOptions = computed(() => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'calendar month solid',
 | 
			
		||||
    palette: { colors },
 | 
			
		||||
    calendar_initial: parameters.value ? parameters.value.end : null,
 | 
			
		||||
    data: rows.value.map(r => ([
 | 
			
		||||
      `${col(data, r, 'report_date')} 12:00:00`,
 | 
			
		||||
      col(data, r, column)
 | 
			
		||||
    ]))
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const areaOptions = computed(() => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'lineSpline',
 | 
			
		||||
    legend_visible: false,
 | 
			
		||||
    xAxis: { crosshair_enabled: true, scale_type: 'time' },
 | 
			
		||||
    palette: { colors },
 | 
			
		||||
    defaultSeries: {
 | 
			
		||||
      shape_opacity: 0.55,
 | 
			
		||||
      color: colors[Math.round(colors.length / 2)],
 | 
			
		||||
      defaultPoint_marker_visible: false
 | 
			
		||||
    },
 | 
			
		||||
    series: [
 | 
			
		||||
      {
 | 
			
		||||
        points: rows.value.map(r => ([
 | 
			
		||||
          `${col(data, r, 'report_date')} 12:00:00`,
 | 
			
		||||
          col(data, r, column)
 | 
			
		||||
        ]))
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
@@ -0,0 +1,68 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <Card>
 | 
			
		||||
    <h2 class="mb-6 text-xl text-indigo-900 flex justify-between items-center">
 | 
			
		||||
      Daily Cases per 10,000 Residents
 | 
			
		||||
 | 
			
		||||
      <select v-model="chart" class="text-base m-0">
 | 
			
		||||
        <option value="calendar">Calendar</option>
 | 
			
		||||
        <option value="line">Line Chart</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </h2>
 | 
			
		||||
    <JSCharting v-if="chart === 'calendar'" :options="calendarOptions"></JSCharting>
 | 
			
		||||
    <JSCharting v-if="chart === 'line'" :options="areaOptions"></JSCharting>
 | 
			
		||||
  </Card>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
import { ref, computed } from 'vue'
 | 
			
		||||
import { col, colors } from '@/components/charts/util'
 | 
			
		||||
import store from '@/components/charts/overall/cases/store.js'
 | 
			
		||||
 | 
			
		||||
const chart = ref('calendar')
 | 
			
		||||
 | 
			
		||||
const column = 'cases_per_capita'
 | 
			
		||||
const parameters = store.parameters
 | 
			
		||||
const data = store.data
 | 
			
		||||
 | 
			
		||||
const rows = computed(() => {
 | 
			
		||||
  if (!data.value || !parameters.value) return []
 | 
			
		||||
  return data.value.rows
 | 
			
		||||
    .filter(r => {
 | 
			
		||||
      return col(data, r, 'report_date') >= parameters.value.start && col(data, r, 'report_date') <= parameters.value.end
 | 
			
		||||
    })
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const calendarOptions = computed(() => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'calendar month solid',
 | 
			
		||||
    palette: { colors },
 | 
			
		||||
    calendar_initial: parameters.value ? parameters.value.end : null,
 | 
			
		||||
    data: rows.value.map(r => ([
 | 
			
		||||
      `${col(data, r, 'report_date')} 12:00:00`,
 | 
			
		||||
      Math.round(col(data, r, column) * 10000)
 | 
			
		||||
    ]))
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const areaOptions = computed(() => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'lineSpline',
 | 
			
		||||
    legend_visible: false,
 | 
			
		||||
    xAxis: { crosshair_enabled: true, scale_type: 'time' },
 | 
			
		||||
    palette: { colors },
 | 
			
		||||
    defaultSeries: {
 | 
			
		||||
      shape_opacity: 0.55,
 | 
			
		||||
      color: colors[Math.round(colors.length / 2)],
 | 
			
		||||
      defaultPoint_marker_visible: false
 | 
			
		||||
    },
 | 
			
		||||
    series: [
 | 
			
		||||
      {
 | 
			
		||||
        points: rows.value.map(r => ([
 | 
			
		||||
          `${col(data, r, 'report_date')} 12:00:00`,
 | 
			
		||||
          Math.round(col(data, r, column) * 10000)
 | 
			
		||||
        ]))
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
							
								
								
									
										48
									
								
								src/components/charts/overall/cases/TrendTotalCases.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								src/components/charts/overall/cases/TrendTotalCases.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <Card>
 | 
			
		||||
    <h2 class="mb-6 text-xl text-indigo-900 flex justify-between items-center">
 | 
			
		||||
      Total Cases
 | 
			
		||||
    </h2>
 | 
			
		||||
    <JSCharting :options="areaOptions"></JSCharting>
 | 
			
		||||
  </Card>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
import { ref, computed } from 'vue'
 | 
			
		||||
import { col, colors } from '@/components/charts/util'
 | 
			
		||||
import store from '@/components/charts/overall/cases/store.js'
 | 
			
		||||
 | 
			
		||||
const column = 'total_cases'
 | 
			
		||||
const parameters = store.parameters
 | 
			
		||||
const data = store.data
 | 
			
		||||
 | 
			
		||||
const rows = computed(() => {
 | 
			
		||||
  if (!data.value || !parameters.value) return []
 | 
			
		||||
  return data.value.rows
 | 
			
		||||
    .filter(r => {
 | 
			
		||||
      return col(data, r, 'report_date') >= parameters.value.start && col(data, r, 'report_date') <= parameters.value.end
 | 
			
		||||
    })
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const areaOptions = computed(() => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'lineSpline',
 | 
			
		||||
    legend_visible: false,
 | 
			
		||||
    xAxis: { crosshair_enabled: true, scale_type: 'time' },
 | 
			
		||||
    palette: { colors },
 | 
			
		||||
    defaultSeries: {
 | 
			
		||||
      shape_opacity: 0.55,
 | 
			
		||||
      color: colors[Math.round(colors.length / 2)],
 | 
			
		||||
      defaultPoint_marker_visible: false
 | 
			
		||||
    },
 | 
			
		||||
    series: [
 | 
			
		||||
      {
 | 
			
		||||
        points: rows.value.map(r => ([
 | 
			
		||||
          `${col(data, r, 'report_date')} 12:00:00`,
 | 
			
		||||
          col(data, r, column)
 | 
			
		||||
        ]))
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
@@ -0,0 +1,48 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <Card>
 | 
			
		||||
    <h2 class="mb-6 text-xl text-indigo-900 flex justify-between items-center">
 | 
			
		||||
      Total Cases per 10,000 Residents
 | 
			
		||||
    </h2>
 | 
			
		||||
    <JSCharting :options="areaOptions"></JSCharting>
 | 
			
		||||
  </Card>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
import { ref, computed } from 'vue'
 | 
			
		||||
import { col, colors } from '@/components/charts/util'
 | 
			
		||||
import store from '@/components/charts/overall/cases/store.js'
 | 
			
		||||
 | 
			
		||||
const column = 'total_cases_per_capita'
 | 
			
		||||
const parameters = store.parameters
 | 
			
		||||
const data = store.data
 | 
			
		||||
 | 
			
		||||
const rows = computed(() => {
 | 
			
		||||
  if (!data.value || !parameters.value) return []
 | 
			
		||||
  return data.value.rows
 | 
			
		||||
    .filter(r => {
 | 
			
		||||
      return col(data, r, 'report_date') >= parameters.value.start && col(data, r, 'report_date') <= parameters.value.end
 | 
			
		||||
    })
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const areaOptions = computed(() => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'lineSpline',
 | 
			
		||||
    legend_visible: false,
 | 
			
		||||
    xAxis: { crosshair_enabled: true, scale_type: 'time' },
 | 
			
		||||
    palette: { colors },
 | 
			
		||||
    defaultSeries: {
 | 
			
		||||
      shape_opacity: 0.55,
 | 
			
		||||
      color: colors[Math.round(colors.length / 2)],
 | 
			
		||||
      defaultPoint_marker_visible: false
 | 
			
		||||
    },
 | 
			
		||||
    series: [
 | 
			
		||||
      {
 | 
			
		||||
        points: rows.value.map(r => ([
 | 
			
		||||
          `${col(data, r, 'report_date')} 12:00:00`,
 | 
			
		||||
          Math.round(col(data, r, column) * 10000)
 | 
			
		||||
        ]))
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
							
								
								
									
										35
									
								
								src/components/charts/overall/cases/store.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								src/components/charts/overall/cases/store.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
import { reactive, ref, watch } from 'vue'
 | 
			
		||||
import { col, formatDate } from '@/components/charts/util.js'
 | 
			
		||||
 | 
			
		||||
const today = new Date()
 | 
			
		||||
const end = new Date()
 | 
			
		||||
const start = new Date(today.valueOf() - 2592000000)
 | 
			
		||||
 | 
			
		||||
const store = {
 | 
			
		||||
  parameters: ref({
 | 
			
		||||
    county: '-- All --',
 | 
			
		||||
    start: formatDate(start),
 | 
			
		||||
    end: formatDate(end)
 | 
			
		||||
  }),
 | 
			
		||||
  data: ref(null)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function refreshData() {
 | 
			
		||||
  store.data.value = await fetch(`/data/state/cases/by-county/${store.parameters.value.county}.json`).then(res => res.json())
 | 
			
		||||
 | 
			
		||||
  // Annoyingly complicated way to reset the end date to the most recent report date.
 | 
			
		||||
  if (formatDate(end) === formatDate(new Date())) {
 | 
			
		||||
    const mostRecentReportDate = formatDate(new Date(col(store.data, store.data.value.rows.at(-1), 'report_date') + ' 23:59:59'))
 | 
			
		||||
    store.parameters.value.end = mostRecentReportDate
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
watch(() => store.parameters.value.county, () => {
 | 
			
		||||
  refreshData()
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
if (globalThis.window) {
 | 
			
		||||
  refreshData()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default store
 | 
			
		||||
							
								
								
									
										15
									
								
								src/components/charts/overall/cases/store_combined.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/components/charts/overall/cases/store_combined.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
import { reactive, ref, watch } from 'vue'
 | 
			
		||||
 | 
			
		||||
const store = {
 | 
			
		||||
  data: ref(null)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function refreshData() {
 | 
			
		||||
  store.data.value = await fetch(`/data/state/cases/combined.json`).then(res => res.json())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (globalThis.window) {
 | 
			
		||||
  refreshData()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default store
 | 
			
		||||
							
								
								
									
										109
									
								
								src/components/charts/overall/testing/ChipsTesting.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								src/components/charts/overall/testing/ChipsTesting.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,109 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <StatCard>
 | 
			
		||||
    <template v-slot:heading>Total Tests Performed</template>
 | 
			
		||||
    <template v-slot:value v-if="chips.total_tests">
 | 
			
		||||
      {{chips.total_tests.toLocaleString()}}
 | 
			
		||||
    </template>
 | 
			
		||||
    <template v-slot:meta v-if="chips.total_tests">
 | 
			
		||||
      PCR + Antigen
 | 
			
		||||
    </template>
 | 
			
		||||
  </StatCard>
 | 
			
		||||
 | 
			
		||||
  <StatCard>
 | 
			
		||||
    <template v-slot:heading>Highest Testing Day</template>
 | 
			
		||||
    <template v-slot:value v-if="chips.tests">
 | 
			
		||||
      {{chips.tests.date.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}}
 | 
			
		||||
    </template>
 | 
			
		||||
    <template v-slot:meta v-if="chips.tests">
 | 
			
		||||
      <span class="text-indigo-500 font-bold">{{chips.tests.value.toLocaleString()}}</span> tests performed
 | 
			
		||||
    </template>
 | 
			
		||||
  </StatCard>
 | 
			
		||||
 | 
			
		||||
  <StatCard>
 | 
			
		||||
    <template v-slot:heading>Highest Positive Day</template>
 | 
			
		||||
    <template v-slot:value v-if="chips.positive">
 | 
			
		||||
      <span class="text-red-800">{{chips.positive.date.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}}</span>
 | 
			
		||||
    </template>
 | 
			
		||||
    <template v-slot:meta v-if="chips.positive">
 | 
			
		||||
      <span class="text-red-800 font-bold">{{chips.positive.value.toLocaleString()}}</span> new cases
 | 
			
		||||
    </template>
 | 
			
		||||
  </StatCard>
 | 
			
		||||
 | 
			
		||||
  <StatCard>
 | 
			
		||||
    <template v-slot:heading>7-Day Percent Positive</template>
 | 
			
		||||
    <template v-slot:value v-if="chips.percent_positive">
 | 
			
		||||
      <span :class="{
 | 
			
		||||
        'text-green-600': chips.percent_positive < 2,
 | 
			
		||||
        'text-yellow-500': chips.percent_positive >= 2 && chips.percent_positive < 5,
 | 
			
		||||
        'text-orange-500': chips.percent_positive >= 5 && chips.percent_positive < 20,
 | 
			
		||||
        'text-red-800': chips.percent_positive > 20
 | 
			
		||||
      }">
 | 
			
		||||
        {{chips.percent_positive}}<span class="font-light">%</span>
 | 
			
		||||
      </span>
 | 
			
		||||
    </template>
 | 
			
		||||
    <template v-slot:meta v-if="chips.positive">
 | 
			
		||||
      <div class="inline-flex flex-wrap text-xs -mx-1">
 | 
			
		||||
        <div class="flex-1">
 | 
			
		||||
          <div class="px-1 text-green-600 font-medium whitespace-nowrap">Low: < 2%</div>
 | 
			
		||||
          <div class="px-1 text-yellow-600 font-medium whitespace-nowrap">Moderate < 5%</div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="flex-1">
 | 
			
		||||
          <div class="px-1 text-orange-600 font-medium whitespace-nowrap">High < 20%</div>
 | 
			
		||||
          <div class="px-1 text-red-700 font-medium whitespace-nowrap">Very high > 20%</div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <a class="link block mt-2 text-xs" href="https://www.who.int/publications/i/item/considerations-in-adjusting-public-health-and-social-measures-in-the-context-of-covid-19-interim-guidanceLow">
 | 
			
		||||
        Source, see p. 18
 | 
			
		||||
      </a>
 | 
			
		||||
    </template>
 | 
			
		||||
  </StatCard>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
import { reactive, computed } from 'vue'
 | 
			
		||||
import { col } from '@/components/charts/util'
 | 
			
		||||
import store from '@/components/charts/overall/testing/store.js'
 | 
			
		||||
 | 
			
		||||
const data = store.data
 | 
			
		||||
 | 
			
		||||
const chips = reactive({
 | 
			
		||||
  total_tests: computed(() => {
 | 
			
		||||
    if (!data.value) return null
 | 
			
		||||
 | 
			
		||||
    const r = data.value.rows.at(-1)
 | 
			
		||||
    return col(data, r, 'combined_performed_running_total')
 | 
			
		||||
  }),
 | 
			
		||||
 | 
			
		||||
  tests: computed(() => {
 | 
			
		||||
    if (!data.value) return null
 | 
			
		||||
 | 
			
		||||
    return data.value.rows.reduce((prev, r) => {
 | 
			
		||||
      const date = new Date(col(data, r, 'report_date'))
 | 
			
		||||
      const value = +col(data, r, 'combined_performed')
 | 
			
		||||
 | 
			
		||||
      if (prev && prev.value > value) return prev
 | 
			
		||||
      else return { date, value }
 | 
			
		||||
    })
 | 
			
		||||
  }),
 | 
			
		||||
 | 
			
		||||
  positive: computed(() => {
 | 
			
		||||
    if (!data.value) return null
 | 
			
		||||
 | 
			
		||||
    return data.value.rows.reduce((prev, r) => {
 | 
			
		||||
      const date = new Date(col(data, r, 'report_date'))
 | 
			
		||||
      const value = +col(data, r, 'combined_positive')
 | 
			
		||||
 | 
			
		||||
      if (prev && prev.value > value) return prev
 | 
			
		||||
      else return { date, value }
 | 
			
		||||
    })
 | 
			
		||||
  }),
 | 
			
		||||
 | 
			
		||||
  percent_positive: computed(() => {
 | 
			
		||||
    if (!data.value) return null
 | 
			
		||||
 | 
			
		||||
    const r = data.value.rows.at(-1)
 | 
			
		||||
    return col(data, r, 'seven_day_percent_positive')
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <SliceSelector :parameters="parameters"></SliceSelector>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup lang='ts'>
 | 
			
		||||
import store from '@/components/charts/overall/testing/store.js'
 | 
			
		||||
 | 
			
		||||
const parameters = store.parameters
 | 
			
		||||
</script>
 | 
			
		||||
@@ -0,0 +1,68 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <Card>
 | 
			
		||||
    <h2 class="mb-6 text-xl text-indigo-900 flex justify-between items-center">
 | 
			
		||||
      Daily Positive Antigen Results
 | 
			
		||||
 | 
			
		||||
      <select v-model="chart" class="text-base m-0">
 | 
			
		||||
        <option value="calendar">Calendar</option>
 | 
			
		||||
        <option value="line">Line Chart</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </h2>
 | 
			
		||||
    <JSCharting v-if="chart === 'calendar'" :options="calendarOptions"></JSCharting>
 | 
			
		||||
    <JSCharting v-if="chart === 'line'" :options="areaOptions"></JSCharting>
 | 
			
		||||
  </Card>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
import { ref, computed } from 'vue'
 | 
			
		||||
import { col, colors } from '@/components/charts/util'
 | 
			
		||||
import store from '@/components/charts/overall/testing/store.js'
 | 
			
		||||
 | 
			
		||||
const chart = ref('calendar')
 | 
			
		||||
 | 
			
		||||
const column = 'antigen_positive'
 | 
			
		||||
const parameters = store.parameters
 | 
			
		||||
const data = store.data
 | 
			
		||||
 | 
			
		||||
const rows = computed(() => {
 | 
			
		||||
  if (!data.value || !parameters.value) return []
 | 
			
		||||
  return data.value.rows
 | 
			
		||||
    .filter(r => {
 | 
			
		||||
      return col(data, r, 'report_date') >= parameters.value.start && col(data, r, 'report_date') <= parameters.value.end
 | 
			
		||||
    })
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const calendarOptions = computed(() => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'calendar month solid',
 | 
			
		||||
    palette: { colors },
 | 
			
		||||
    calendar_initial: parameters.value ? parameters.value.end : null,
 | 
			
		||||
    data: rows.value.map(r => ([
 | 
			
		||||
      `${col(data, r, 'report_date')} 12:00:00`,
 | 
			
		||||
      col(data, r, column)
 | 
			
		||||
    ]))
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const areaOptions = computed(() => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'lineSpline',
 | 
			
		||||
    legend_visible: false,
 | 
			
		||||
    xAxis: { crosshair_enabled: true, scale_type: 'time' },
 | 
			
		||||
    palette: { colors },
 | 
			
		||||
    defaultSeries: {
 | 
			
		||||
      shape_opacity: 0.55,
 | 
			
		||||
      color: colors[Math.round(colors.length / 2)],
 | 
			
		||||
      defaultPoint_marker_visible: false
 | 
			
		||||
    },
 | 
			
		||||
    series: [
 | 
			
		||||
      {
 | 
			
		||||
        points: rows.value.map(r => ([
 | 
			
		||||
          `${col(data, r, 'report_date')} 12:00:00`,
 | 
			
		||||
          col(data, r, column)
 | 
			
		||||
        ]))
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
							
								
								
									
										67
									
								
								src/components/charts/overall/testing/TrendAntigenTests.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								src/components/charts/overall/testing/TrendAntigenTests.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <Card>
 | 
			
		||||
    <h2 class="mb-6 text-xl text-indigo-900 flex justify-between items-center">
 | 
			
		||||
      Daily Antigen Tests Performed
 | 
			
		||||
      <select v-model="chart" class="text-base m-0">
 | 
			
		||||
        <option value="calendar">Calendar</option>
 | 
			
		||||
        <option value="line">Line Chart</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </h2>
 | 
			
		||||
    <JSCharting v-if="chart === 'calendar'" :options="calendarOptions"></JSCharting>
 | 
			
		||||
    <JSCharting v-if="chart === 'line'" :options="areaOptions"></JSCharting>
 | 
			
		||||
  </Card>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
import { ref, computed } from 'vue'
 | 
			
		||||
import { col, colors } from '@/components/charts/util'
 | 
			
		||||
import store from '@/components/charts/overall/testing/store.js'
 | 
			
		||||
 | 
			
		||||
const chart = ref('calendar')
 | 
			
		||||
 | 
			
		||||
const column = 'antigen_performed'
 | 
			
		||||
const parameters = store.parameters
 | 
			
		||||
const data = store.data
 | 
			
		||||
 | 
			
		||||
const rows = computed(() => {
 | 
			
		||||
  if (!data.value || !parameters.value) return []
 | 
			
		||||
  return data.value.rows
 | 
			
		||||
    .filter(r => {
 | 
			
		||||
      return col(data, r, 'report_date') >= parameters.value.start && col(data, r, 'report_date') <= parameters.value.end
 | 
			
		||||
    })
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const calendarOptions = computed(() => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'calendar month solid',
 | 
			
		||||
    palette: { colors },
 | 
			
		||||
    calendar_initial: parameters.value ? parameters.value.end : null,
 | 
			
		||||
    data: rows.value.map(r => ([
 | 
			
		||||
      `${col(data, r, 'report_date')} 12:00:00`,
 | 
			
		||||
      col(data, r, column)
 | 
			
		||||
    ]))
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const areaOptions = computed(() => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'lineSpline',
 | 
			
		||||
    legend_visible: false,
 | 
			
		||||
    xAxis: { crosshair_enabled: true, scale_type: 'time' },
 | 
			
		||||
    palette: { colors },
 | 
			
		||||
    defaultSeries: {
 | 
			
		||||
      shape_opacity: 0.55,
 | 
			
		||||
      color: colors[Math.round(colors.length / 2)],
 | 
			
		||||
      defaultPoint_marker_visible: false
 | 
			
		||||
    },
 | 
			
		||||
    series: [
 | 
			
		||||
      {
 | 
			
		||||
        points: rows.value.map(r => ([
 | 
			
		||||
          `${col(data, r, 'report_date')} 12:00:00`,
 | 
			
		||||
          col(data, r, column)
 | 
			
		||||
        ]))
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
							
								
								
									
										68
									
								
								src/components/charts/overall/testing/TrendPCRPositive.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								src/components/charts/overall/testing/TrendPCRPositive.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,68 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <Card>
 | 
			
		||||
    <h2 class="mb-6 text-xl text-indigo-900 flex justify-between items-center">
 | 
			
		||||
      Daily Positive PCR Results
 | 
			
		||||
 | 
			
		||||
      <select v-model="chart" class="text-base m-0">
 | 
			
		||||
        <option value="calendar">Calendar</option>
 | 
			
		||||
        <option value="line">Line Chart</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </h2>
 | 
			
		||||
    <JSCharting v-if="chart === 'calendar'" :options="calendarOptions"></JSCharting>
 | 
			
		||||
    <JSCharting v-if="chart === 'line'" :options="areaOptions"></JSCharting>
 | 
			
		||||
  </Card>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
import { ref, computed } from 'vue'
 | 
			
		||||
import { col, colors } from '@/components/charts/util'
 | 
			
		||||
import store from '@/components/charts/overall/testing/store.js'
 | 
			
		||||
 | 
			
		||||
const chart = ref('calendar')
 | 
			
		||||
 | 
			
		||||
const column = 'pcr_positive'
 | 
			
		||||
const parameters = store.parameters
 | 
			
		||||
const data = store.data
 | 
			
		||||
 | 
			
		||||
const rows = computed(() => {
 | 
			
		||||
  if (!data.value || !parameters.value) return []
 | 
			
		||||
  return data.value.rows
 | 
			
		||||
    .filter(r => {
 | 
			
		||||
      return col(data, r, 'report_date') >= parameters.value.start && col(data, r, 'report_date') <= parameters.value.end
 | 
			
		||||
    })
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const calendarOptions = computed(() => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'calendar month solid',
 | 
			
		||||
    palette: { colors },
 | 
			
		||||
    calendar_initial: parameters.value ? parameters.value.end : null,
 | 
			
		||||
    data: rows.value.map(r => ([
 | 
			
		||||
      `${col(data, r, 'report_date')} 12:00:00`,
 | 
			
		||||
      col(data, r, column)
 | 
			
		||||
    ]))
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const areaOptions = computed(() => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'lineSpline',
 | 
			
		||||
    legend_visible: false,
 | 
			
		||||
    xAxis: { crosshair_enabled: true, scale_type: 'time' },
 | 
			
		||||
    palette: { colors },
 | 
			
		||||
    defaultSeries: {
 | 
			
		||||
      shape_opacity: 0.55,
 | 
			
		||||
      color: colors[Math.round(colors.length / 2)],
 | 
			
		||||
      defaultPoint_marker_visible: false
 | 
			
		||||
    },
 | 
			
		||||
    series: [
 | 
			
		||||
      {
 | 
			
		||||
        points: rows.value.map(r => ([
 | 
			
		||||
          `${col(data, r, 'report_date')} 12:00:00`,
 | 
			
		||||
          col(data, r, column)
 | 
			
		||||
        ]))
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
							
								
								
									
										68
									
								
								src/components/charts/overall/testing/TrendPCRTests.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								src/components/charts/overall/testing/TrendPCRTests.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,68 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <Card>
 | 
			
		||||
    <h2 class="mb-6 text-xl text-indigo-900 flex justify-between items-center">
 | 
			
		||||
      Daily PCR Tests Performed
 | 
			
		||||
 | 
			
		||||
      <select v-model="chart" class="text-base m-0">
 | 
			
		||||
        <option value="calendar">Calendar</option>
 | 
			
		||||
        <option value="line">Line Chart</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </h2>
 | 
			
		||||
    <JSCharting v-if="chart === 'calendar'" :options="calendarOptions"></JSCharting>
 | 
			
		||||
    <JSCharting v-if="chart === 'line'" :options="areaOptions"></JSCharting>
 | 
			
		||||
  </Card>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
import { ref, computed } from 'vue'
 | 
			
		||||
import { col, colors } from '@/components/charts/util'
 | 
			
		||||
import store from '@/components/charts/overall/testing/store.js'
 | 
			
		||||
 | 
			
		||||
const chart = ref('calendar')
 | 
			
		||||
 | 
			
		||||
const column = 'pcr_performed'
 | 
			
		||||
const parameters = store.parameters
 | 
			
		||||
const data = store.data
 | 
			
		||||
 | 
			
		||||
const rows = computed(() => {
 | 
			
		||||
  if (!data.value || !parameters.value) return []
 | 
			
		||||
  return data.value.rows
 | 
			
		||||
    .filter(r => {
 | 
			
		||||
      return col(data, r, 'report_date') >= parameters.value.start && col(data, r, 'report_date') <= parameters.value.end
 | 
			
		||||
    })
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const calendarOptions = computed(() => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'calendar month solid',
 | 
			
		||||
    palette: { colors },
 | 
			
		||||
    calendar_initial: parameters.value ? parameters.value.end : null,
 | 
			
		||||
    data: rows.value.map(r => ([
 | 
			
		||||
      `${col(data, r, 'report_date')} 12:00:00`,
 | 
			
		||||
      col(data, r, column)
 | 
			
		||||
    ]))
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const areaOptions = computed(() => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: 'lineSpline',
 | 
			
		||||
    legend_visible: false,
 | 
			
		||||
    xAxis: { crosshair_enabled: true, scale_type: 'time' },
 | 
			
		||||
    palette: { colors },
 | 
			
		||||
    defaultSeries: {
 | 
			
		||||
      shape_opacity: 0.55,
 | 
			
		||||
      color: colors[Math.round(colors.length / 2)],
 | 
			
		||||
      defaultPoint_marker_visible: false
 | 
			
		||||
    },
 | 
			
		||||
    series: [
 | 
			
		||||
      {
 | 
			
		||||
        points: rows.value.map(r => ([
 | 
			
		||||
          `${col(data, r, 'report_date')} 12:00:00`,
 | 
			
		||||
          col(data, r, column)
 | 
			
		||||
        ]))
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
							
								
								
									
										29
									
								
								src/components/charts/overall/testing/store.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								src/components/charts/overall/testing/store.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
import { reactive, ref, watch } from 'vue'
 | 
			
		||||
import { formatDate } from '@/components/charts/util.js'
 | 
			
		||||
 | 
			
		||||
const today = new Date()
 | 
			
		||||
const end = new Date()
 | 
			
		||||
const start = new Date(today.valueOf() - 2592000000)
 | 
			
		||||
 | 
			
		||||
const store = {
 | 
			
		||||
  parameters: ref({
 | 
			
		||||
    county: '-- All --',
 | 
			
		||||
    start: formatDate(start),
 | 
			
		||||
    end: formatDate(end)
 | 
			
		||||
  }),
 | 
			
		||||
  data: ref(null)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function refreshData() {
 | 
			
		||||
  store.data.value = await fetch(`/data/state/testing/by-county/${store.parameters.value.county}.json`).then(res => res.json())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
watch(() => store.parameters.value.county, () => {
 | 
			
		||||
  refreshData()
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
if (globalThis.window) {
 | 
			
		||||
  refreshData()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default store
 | 
			
		||||
		Reference in New Issue
	
	Block a user