feat: echarts add china geo

This commit is contained in:
xingyu4j
2025-06-24 12:51:38 +08:00
parent 51bd200ad8
commit 3f304cdb76
3 changed files with 26 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ import {
} from '@vueuse/core';
import echarts from './echarts';
import chinaMap from './map/china.json';
type EchartsUIType = typeof EchartsUI | undefined;
@@ -32,6 +33,18 @@ function useEcharts(chartRef: Ref<EchartsUIType>) {
const { height, width } = useWindowSize();
const resizeHandler: () => void = useDebounceFn(resize, 200);
echarts.registerMap('china', {
geoJSON: chinaMap as any,
specialAreas: {
china: {
left: 500,
top: 500,
width: 1000,
height: 1000,
},
},
});
const getOptions = computed((): EChartsOption => {
if (!isDark.value) {
return {};