Merge branch 'dev'
This commit is contained in:
commit
4d35186ffe
2
.gitignore
vendored
2
.gitignore
vendored
@ -25,4 +25,4 @@ logs
|
||||
.wrangler
|
||||
site
|
||||
cache
|
||||
assets/location/world-topo.json
|
||||
public/world.json
|
||||
|
||||
@ -1,14 +1,19 @@
|
||||
<script setup>
|
||||
import { VisSingleContainer, VisTopoJSONMap, VisTopoJSONMapSelectors } from '@unovis/vue'
|
||||
import WorldMapTopoJSON from '@/assets/location/world-topo.json' // https://github.com/apache/echarts/blob/master/test/data/map/json/world.json
|
||||
import { ChartTooltip } from '@/components/ui/chart'
|
||||
|
||||
const id = inject('id')
|
||||
const startAt = inject('startAt')
|
||||
const endAt = inject('endAt')
|
||||
|
||||
const worldMapTopoJSON = ref({})
|
||||
const areaData = ref([])
|
||||
|
||||
async function getWorldMapJSON() {
|
||||
const data = await $fetch('/world.json')
|
||||
worldMapTopoJSON.value = data
|
||||
}
|
||||
|
||||
async function getMapData() {
|
||||
areaData.value = []
|
||||
const { data } = await useAPI('/api/stats/metrics', {
|
||||
@ -30,6 +35,7 @@ async function getMapData() {
|
||||
const stopWatchTime = watch([startAt, endAt], getMapData)
|
||||
|
||||
onMounted(() => {
|
||||
getWorldMapJSON()
|
||||
getMapData()
|
||||
})
|
||||
|
||||
@ -60,11 +66,12 @@ const Tooltip = {
|
||||
<CardContent class="flex-1 flex [&_[data-radix-aspect-ratio-wrapper]]:flex-1">
|
||||
<AspectRatio :ratio="65 / 30">
|
||||
<VisSingleContainer
|
||||
v-if="worldMapTopoJSON.type"
|
||||
:data="{ areas: areaData }"
|
||||
class="h-full"
|
||||
>
|
||||
<VisTopoJSONMap
|
||||
:topojson="WorldMapTopoJSON"
|
||||
:topojson="worldMapTopoJSON"
|
||||
map-feature-name="states"
|
||||
/>
|
||||
<ChartSingleTooltip
|
||||
|
||||
@ -5,6 +5,6 @@ provide('id', ref())
|
||||
<template>
|
||||
<main class="space-y-6">
|
||||
<DashboardBreadcrumb title="Analysis" />
|
||||
<LazyDashboard />
|
||||
<Dashboard />
|
||||
</main>
|
||||
</template>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<main class="flex items-center justify-center h-full">
|
||||
<LazyLogin />
|
||||
<Login />
|
||||
</main>
|
||||
</template>
|
||||
|
||||
@ -16,4 +16,4 @@ WorldMapTopoJSON.objects.states.geometries.map((state) => {
|
||||
return state
|
||||
})
|
||||
|
||||
writeFileSync(join(import.meta.dirname, '../assets/location/world-topo.json'), JSON.stringify(WorldMapTopoJSON), 'utf8')
|
||||
writeFileSync(join(import.meta.dirname, '../public/world.json'), JSON.stringify(WorldMapTopoJSON), 'utf8')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user