update 地图

This commit is contained in:
zk
2023-11-27 18:09:59 +08:00
parent c28a49e45c
commit 975d0e71a2
2 changed files with 204 additions and 105 deletions
+104
View File
@@ -47,6 +47,110 @@ export const legendList = [
{ img: legend5, text: '地方医院' },
{ img: legend6, text: '直升机' },
];
const bgImg = new URL('/@/assets/images/china-textur.jpg', import.meta.url).href;
export function createChartOption({ icons }) {
return {
tooltip: {
show: false,
// formatter: (params) => {
// console.log('params', params);
// if (!params?.data?.id) {
// return '';
// }
// return `<div style="color:red;width:300px"> ${params.name}</div>
// <div>id: ${params?.data?.id}</div>`;
// },
},
geo: [
{
map: 'china',
zlevel: 3,
aspectScale: 0.8, //长宽比
zoom: 1.1,
// roam: true,
// draggable: true,
top: '60',
left: 'center',
itemStyle: {
areaColor: '#173a58',
shadowColor: '#173a58',
shadowOffsetX: 0,
shadowOffsetY: 5,
borderWidth: 6, //外部边框
borderColor: '#6ccffe',
},
},
{
map: 'china',
zlevel: 2,
aspectScale: 0.8, //长宽比
zoom: 1.1,
// roam: true,
// draggable: true,
top: '60',
left: 'center',
itemStyle: {
areaColor: '#1e2c38',
shadowColor: '#1e2c38',
shadowOffsetX: 0,
shadowOffsetY: 10,
borderWidth: 6, //外部边框
borderColor: '#384d61',
},
},
],
series: [
{
map: 'china', // 这个是上面注册时的名字哦,registerMap'这个名字保持一致'
name: '中国地图',
type: 'map',
selected: {}, // 默认所有省份都是未选中状态
selectedMode: 'single', // 选中模式为单选
zlevel: 9,
zoom: 1.1,
aspectScale: 0.8, //长宽比
// roam: true,
// draggable: true,
hoverAnimation: false,
silent: false,
top: '60',
left: 'center',
label: {
show: true,
padding: [0, 10],
height: 31,
lineHeight: 31,
textStyle: {
color: '#fff',
fontSize: 13,
marginLeft: 5,
},
},
itemStyle: {
// 给地图添加背景图片
areaColor: {
type: 'pattern',
image: bgImg,
repeat: 'no-repeat',
},
borderColor: '#359de5',
borderWidth: 2, //内部边框,
},
// 鼠标悬浮
emphasis: {
label: {
color: '#fff',
},
itemStyle: {
areaColor: '#008CFF',
},
},
},
...icons.value,
],
};
}
/**
* @description 秒转小时