perf: Simple map

This commit is contained in:
ccbikai 2024-06-08 19:07:27 +08:00
parent 4d35186ffe
commit 426db8d149
3 changed files with 2 additions and 17 deletions

File diff suppressed because one or more lines are too long

View File

@ -72,7 +72,7 @@ const Tooltip = {
>
<VisTopoJSONMap
:topojson="worldMapTopoJSON"
map-feature-name="states"
map-feature-name="countries"
/>
<ChartSingleTooltip
index="id"

View File

@ -1,19 +1,5 @@
import { writeFileSync } from 'fs'
import { join } from 'path'
import { WorldMapSimplestTopoJSON } from '@unovis/ts/maps.js'
import WorldMapTopoJSON from '../assets/location/world.json' with { type: "json" } // https://github.com/apache/echarts/blob/master/test/data/map/json/world.json
WorldMapTopoJSON.objects.states.geometries.map((state) => {
const name = state.properties.name
const country = WorldMapSimplestTopoJSON.objects.countries.geometries.find(country => country.properties.name === name)
state.id = state.name || ''
if (country) {
state.id = country.id || ''
state.properties = {
name: country.properties?.name || '',
}
}
return state
})
writeFileSync(join(import.meta.dirname, '../public/world.json'), JSON.stringify(WorldMapTopoJSON), 'utf8')
writeFileSync(join(import.meta.dirname, '../public/world.json'), JSON.stringify(WorldMapSimplestTopoJSON), 'utf8')