!38 fix: 中国地图组件支持配置是否显示海南群岛

Merge pull request !38 from dodu/dev
This commit is contained in:
奔跑的面条 2022-09-07 01:49:13 +00:00 committed by Gitee
commit 674131a0ae
4 changed files with 25737 additions and 2 deletions

View File

@ -49,7 +49,8 @@ export const option = {
}, },
color: '#ffffff', color: '#ffffff',
borderColor: '#75ecaa', borderColor: '#75ecaa',
borderWidth: 1 borderWidth: 1,
showHainanIsLands: true // 是否显示南海群岛
}, },
label: { label: {
show: true, show: true,

View File

@ -43,6 +43,11 @@
></n-input-number> ></n-input-number>
</SettingItem> </SettingItem>
</SettingItemBox> </SettingItemBox>
<SettingItemBox name="其他">
<SettingItem>
<n-checkbox v-model:checked="seriesList[1].itemStyle.showHainanIsLands" size="small">显示南海群岛</n-checkbox>
</SettingItem>
</SettingItemBox>
</CollapseItem> </CollapseItem>
<CollapseItem name="标记" :expanded="true"> <CollapseItem name="标记" :expanded="true">
<SettingItemBox name="样式"> <SettingItemBox name="样式">

View File

@ -14,8 +14,8 @@ import { useChartDataFetch } from '@/hooks'
import { mergeTheme } from '@/packages/public/chart' import { mergeTheme } from '@/packages/public/chart'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { isPreview } from '@/utils' import { isPreview } from '@/utils'
import dataJson from './data.json'
import mapJson from './map.json' import mapJson from './map.json'
import mapJsonWithoutHainanIsLands from './mapWithoutHainanIsLands.json'
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent, GeoComponent } from 'echarts/components' import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent, GeoComponent } from 'echarts/components'
const props = defineProps({ const props = defineProps({
@ -58,6 +58,24 @@ const dataSetHandle = (dataset: any) => {
}) })
} }
const mapTypeHandle = (show: boolean) => {
show
? registerMap('china', { geoJSON: mapJson as any, specialAreas: {} })
: registerMap('china', { geoJSON: mapJsonWithoutHainanIsLands as any, specialAreas: {} })
option.value = props.chartConfig.option
}
watch(
() => props.chartConfig.option.series[1].itemStyle.showHainanIsLands,
newData => {
mapTypeHandle(newData)
},
{
deep: true,
immediate: true
}
)
watch( watch(
() => props.chartConfig.option.dataset, () => props.chartConfig.option.dataset,
newData => { newData => {

File diff suppressed because it is too large Load Diff