perf: Simple map
This commit is contained in:
parent
4d35186ffe
commit
426db8d149
3 changed files with 2 additions and 17 deletions
File diff suppressed because one or more lines are too long
|
|
@ -72,7 +72,7 @@ const Tooltip = {
|
||||||
>
|
>
|
||||||
<VisTopoJSONMap
|
<VisTopoJSONMap
|
||||||
:topojson="worldMapTopoJSON"
|
:topojson="worldMapTopoJSON"
|
||||||
map-feature-name="states"
|
map-feature-name="countries"
|
||||||
/>
|
/>
|
||||||
<ChartSingleTooltip
|
<ChartSingleTooltip
|
||||||
index="id"
|
index="id"
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,5 @@
|
||||||
import { writeFileSync } from 'fs'
|
import { writeFileSync } from 'fs'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { WorldMapSimplestTopoJSON } from '@unovis/ts/maps.js'
|
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) => {
|
writeFileSync(join(import.meta.dirname, '../public/world.json'), JSON.stringify(WorldMapSimplestTopoJSON), 'utf8')
|
||||||
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')
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue