农场 nuxt3实现的大屏界面
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

93 lines
1.9 KiB

import ShanXiMap from 'config/map/shanxi';
import { values as ShanXiValues } from 'config/map/values';
/**
* 获取城市的value
* @param {string} cityName 城市名称
* @returns {string|*}
*/
function getValueByCity(cityName) {
try {
const city = ShanXiValues.find(item => item.name === cityName);
return city.value;
} catch (error) {
console.log('getValueByCity value: ', error);
return '';
}
}
// 初始化城市value及height等值
function initValues() {
const regions = ShanXiMap.features.map(feature => {
const value = getValueByCity(feature.properties.name);
return {
name: feature.properties.name,
value,
height: value,
label: {
show: true,
textStyle: { color: '#000' },
},
};
});
return regions;
}
export function initOptions() {
return {
backgroundColor: 'transparent',
visualMap: {
show: true,
min: 0,
max: 12,
inRange: {
color: [
'#313695',
'#4575b4',
'#74add1',
'#abd9e9',
'#e0f3f8',
'#ffffbf',
'#fee090',
'#fdae61',
'#f46d43',
'#d73027',
'#a50026',
],
},
},
series: [
{
type: 'map3D',
map: 'shanxi',
shading: 'realistic',
realisticMaterial: {
roughness: 0.6,
textureTiling: 20,
},
environment: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: '#0c2771', // 天空颜色
},
{
offset: 0.7,
color: '#026fab', // 地面颜色
},
{
offset: 1,
color: '#01285c', // 地面颜色
},
],
false,
),
data: initValues(),
},
],
};
}