forked from p51497208/geo_info_platform
1299 lines
46 KiB
HTML
1299 lines
46 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<!-- 引入 echarts.js -->
|
||
<!-- 这里是加载刚下好的echarts.min.js,注意路径 -->
|
||
<script src="echarts.min.js"></script>
|
||
<!-- 引入 china.js -->
|
||
<script src="china.js"></script>
|
||
</head>
|
||
<body>
|
||
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
|
||
<div id="main" style="width: 1260px;height:660px;"></div>
|
||
<script type="text/javascript">
|
||
// 基于准备好的dom,初始化echarts实例
|
||
var myChart = echarts.init(document.getElementById('main'));
|
||
|
||
function tooltipCharts() {
|
||
console.log(arguments[0]);
|
||
var myChart1 = echarts.init(document.getElementById('tooltipBarId'));
|
||
var option = {
|
||
tooltip: {},
|
||
dataset: {
|
||
source: [
|
||
['xAxis', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13'],
|
||
['amount', 41.1, 30.4, 65.1, 53.3, 53.8, 98.7, 65.1, 53.3, 41.1, 30.4, 53.3, 41.1, 53.3, 53.8]
|
||
]
|
||
},
|
||
xAxis: {
|
||
type: 'category',
|
||
interval: true,
|
||
axisLabel: {
|
||
rotate: 45
|
||
},
|
||
axisTick: {
|
||
show: false
|
||
}
|
||
},
|
||
yAxis: {},
|
||
color: ['#4FA8F9', '#F5A623'],
|
||
grid: {
|
||
show: true,
|
||
backgroundColor: '#FAFAFA',
|
||
left: 30,
|
||
right: 10,
|
||
top: 10,
|
||
bottom: 20,
|
||
},
|
||
series: [{
|
||
type: 'bar',
|
||
smooth: true,
|
||
seriesLayoutBy: 'row',
|
||
barWidth: 10
|
||
}]
|
||
};
|
||
myChart1.setOption(option);
|
||
}
|
||
|
||
|
||
|
||
function tooltipCharts1() {
|
||
console.log(arguments[0]);
|
||
var myChart1 = echarts.init(document.getElementById('tooltipBarId1'));
|
||
var option = {
|
||
tooltip: {},
|
||
dataset: {
|
||
source: [
|
||
['xAxis', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13'],
|
||
['amount', 41.1, 30.4, 65.1, 53.3, 53.8, 98.7, 65.1, 53.3, 41.1, 30.4, 53.3, 41.1, 53.3, 53.8]
|
||
]
|
||
},
|
||
xAxis: {
|
||
type: 'category',
|
||
interval: true,
|
||
axisLabel: {
|
||
rotate: 45
|
||
},
|
||
axisTick: {
|
||
show: false
|
||
}
|
||
},
|
||
yAxis: {},
|
||
color: ['#4FA8F9', '#F5A623'],
|
||
grid: {
|
||
show: true,
|
||
backgroundColor: '#000000',
|
||
left: 30,
|
||
right: 20,
|
||
top: 10,
|
||
bottom: 20
|
||
},
|
||
series: [{
|
||
type: 'line',
|
||
smooth: true,
|
||
seriesLayoutBy: 'row',
|
||
barWidth: 10
|
||
}]
|
||
};
|
||
myChart1.setOption(option);
|
||
}
|
||
|
||
|
||
|
||
function tooltipCharts2() {
|
||
console.log(arguments[0]);
|
||
var myChart1 = echarts.init(document.getElementById('tooltipBarId2'));
|
||
var option = {
|
||
tooltip: {},
|
||
dataset: {
|
||
source: [
|
||
['xAxis', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13'],
|
||
['amount', 41.1, 30.4, 65.1, 53.3, 53.8, 98.7, 65.1, 53.3, 41.1, 30.4, 53.3, 41.1, 53.3, 53.8]
|
||
]
|
||
},
|
||
|
||
series: [{
|
||
type: 'pie',
|
||
smooth: true,
|
||
seriesLayoutBy: 'row',
|
||
barWidth: 10
|
||
}]
|
||
};
|
||
myChart1.setOption(option);
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
var chinaGeoCoordMap = {
|
||
'黑龙江': [127.9688, 45.368],
|
||
'内蒙古': [110.3467, 41.4899],
|
||
"吉林": [125.8154, 44.2584],
|
||
'北京': [116.4551, 40.2539],
|
||
"辽宁": [123.1238, 42.1216],
|
||
"河北": [114.4995, 38.1006],
|
||
"天津": [117.4219, 39.4189],
|
||
"山西": [112.3352, 37.9413],
|
||
"陕西": [109.1162, 34.2004],
|
||
"甘肃": [103.5901, 36.3043],
|
||
"宁夏": [106.3586, 38.1775],
|
||
"青海": [101.4038, 36.8207],
|
||
"新疆": [87.9236, 43.5883],
|
||
"西藏": [91.11, 29.97],
|
||
"四川": [103.9526, 30.7617],
|
||
"重庆": [108.384366, 30.439702],
|
||
"山东": [117.1582, 36.8701],
|
||
"河南": [113.4668, 34.6234],
|
||
"江苏": [118.8062, 31.9208],
|
||
"安徽": [117.29, 32.0581],
|
||
"湖北": [114.3896, 30.6628],
|
||
"浙江": [119.5313, 29.8773],
|
||
"福建": [119.4543, 25.9222],
|
||
"江西": [116.0046, 28.6633],
|
||
"湖南": [113.0823, 28.2568],
|
||
"贵州": [106.6992, 26.7682],
|
||
"云南": [102.9199, 25.4663],
|
||
"广东": [113.12244, 23.009505],
|
||
"广西": [108.479, 23.1152],
|
||
"海南": [110.3893, 19.8516],
|
||
'上海': [121.48, 31.22],
|
||
"香港": [114.15, 22.15],
|
||
"澳门": [113.5, 22.2],
|
||
'台湾': [121.31, 25.03],
|
||
"班公湖": [78.744718,33.670094],
|
||
"洞朗": [88.951476,27.298102],
|
||
"桑多河谷":[92.21,26.97]
|
||
};
|
||
var chinaDatas = [
|
||
[{
|
||
name: '黑龙江',
|
||
value: 0,
|
||
ave:"黑",
|
||
provincialcapital:"哈尔滨",
|
||
diqu:"中国东北地区",
|
||
qihou:"温带大陆性季风气候、寒温带气候",
|
||
people:"3773.1万人" ,
|
||
num:"47.3万平方公里" ,
|
||
GDP:"16361.6亿元",
|
||
renjunGDP:"43274元"
|
||
}],
|
||
[{
|
||
name: '内蒙古',
|
||
value: 0,
|
||
ave:"内蒙古",
|
||
provincialcapital:"呼和浩特",
|
||
diqu:"中国北部边疆",
|
||
qihou:"温带大陆性气候、温带季风气候",
|
||
people:"2534万人" ,
|
||
num:"118.3万平方公里" ,
|
||
GDP:"17289.2亿元",
|
||
renjunGDP:"68302元"
|
||
}],
|
||
[{
|
||
name: '吉林',
|
||
value: 0,
|
||
ave:"吉",
|
||
provincialcapital:"长春",
|
||
diqu:"中国东北地区",
|
||
qihou:"温带季风气候",
|
||
people:"2704.06万人" ,
|
||
num:"18.74万平方公里" ,
|
||
GDP:"15074.62亿元",
|
||
renjunGDP:"55611元"
|
||
}],
|
||
[{
|
||
name: '北京',
|
||
value: 0,
|
||
ave:"京",
|
||
provincialcapital:"直辖市",
|
||
diqu:"中国华北地区",
|
||
qihou:"温带季风性气候",
|
||
people:"2154.2万人" ,
|
||
num:"1.64万平方公里" ,
|
||
GDP:"30320亿元",
|
||
renjunGDP:"140000元"
|
||
}],
|
||
[{
|
||
name: '辽宁',
|
||
value: 0,
|
||
ave:"辽",
|
||
provincialcapital:"沈阳",
|
||
diqu:"中国东北地区",
|
||
qihou:"温带季风气候",
|
||
people:"4359.3万人" ,
|
||
num:"14.86万平方公里" ,
|
||
GDP:"25315.4亿元",
|
||
renjunGDP:"58008元"
|
||
}],
|
||
[{
|
||
name: '河北',
|
||
value: 0,
|
||
ave:"冀",
|
||
provincialcapital:"石家庄",
|
||
diqu:"中国华北地区",
|
||
qihou:"温带大陆性季风气候",
|
||
people:"7556.30万人" ,
|
||
num:"18.88万平方公里" ,
|
||
GDP:"36010.3亿元",
|
||
renjunGDP:"47772元"
|
||
}],
|
||
[{
|
||
name: '天津',
|
||
value: 0,
|
||
ave:"黑",
|
||
provincialcapital:"哈尔滨",
|
||
diqu:"中国华北地区",
|
||
qihou:"温带大陆性季风气候",
|
||
people:"3773.1万人" ,
|
||
num:"47.3万平方公里" ,
|
||
GDP:"16361.6亿元",
|
||
renjunGDP:"120000元"
|
||
}],
|
||
[{
|
||
name: '山西',
|
||
value: 0,
|
||
ave:"晋",
|
||
provincialcapital:"太原",
|
||
diqu:"中国华北地区",
|
||
qihou:"温带大陆性季风气候",
|
||
people:"3718.34万人" ,
|
||
num:"15.67万平方公里" ,
|
||
GDP:"16818.1亿元",
|
||
renjunGDP:"45328元"
|
||
}],
|
||
[{
|
||
name: '陕西',
|
||
value: 0,
|
||
ave:"“陕”或“秦”",
|
||
provincialcapital:"西安",
|
||
diqu:"中国西北地区",
|
||
qihou:"温带季风气候、亚热带季风气候",
|
||
people:"3864.40万" ,
|
||
num:"20.56万平方公里" ,
|
||
GDP:"24438.32亿元",
|
||
renjunGDP:"63477元"
|
||
}],
|
||
[{
|
||
name: '甘肃',
|
||
value: 0,
|
||
ave:"“甘”或“陇”",
|
||
provincialcapital:"兰州",
|
||
diqu:"中国西北地区",
|
||
qihou:"温带大陆性气候、高原山地气候",
|
||
people:"2637.26万人" ,
|
||
num:"42.58万平方公里" ,
|
||
GDP:"8246.1亿元",
|
||
renjunGDP:"31336元"
|
||
}],
|
||
[{
|
||
name: '宁夏',
|
||
value: 0,
|
||
ave:"宁",
|
||
provincialcapital:"银川",
|
||
diqu:"中国西北地区",
|
||
qihou:"温带大陆性气候",
|
||
people:"688.11万人" ,
|
||
num:"6.64万平方公里" ,
|
||
GDP:"3705.18亿元",
|
||
renjunGDP:"54094元"
|
||
}],
|
||
[{
|
||
name: '青海',
|
||
value: 0,
|
||
ave:"青",
|
||
provincialcapital:"西宁",
|
||
diqu:"中国西北地区",
|
||
qihou:"高原大陆性气候",
|
||
people:"603.23万人" ,
|
||
num:"72万平方公里" ,
|
||
GDP:"2865.23亿元",
|
||
renjunGDP:"47689元"
|
||
}],
|
||
[{
|
||
name: '新疆',
|
||
value: 0,
|
||
ave:"新",
|
||
provincialcapital:"乌鲁木齐",
|
||
diqu:"中国西北地区",
|
||
qihou:"温带大陆性气候",
|
||
people:"2486.76万人" ,
|
||
num:"166万平方公里" ,
|
||
GDP:"12199.08亿元",
|
||
renjunGDP:"49474元"
|
||
}],
|
||
[{
|
||
name: '西藏',
|
||
value: 0,
|
||
ave:"藏",
|
||
provincialcapital:"拉萨",
|
||
diqu:"中国西南地区",
|
||
qihou:"西北严寒、东南温暖湿润",
|
||
people:"343.82万人" ,
|
||
num:"122.84万平方公里" ,
|
||
GDP:"1477.63亿元",
|
||
renjunGDP:"43397元"
|
||
}],
|
||
[{
|
||
name: '四川',
|
||
value: 0,
|
||
ave:"“川”或“蜀”",
|
||
provincialcapital:"成都",
|
||
diqu:"中国西南地区",
|
||
qihou:"亚热带季风气候、高原山地气候",
|
||
people:"8341万人" ,
|
||
num:"47.3万平方公里" ,
|
||
GDP:"40678.13亿元",
|
||
renjunGDP:"48883元"
|
||
}],
|
||
[{
|
||
name: '重庆',
|
||
value: 0,
|
||
ave:"渝",
|
||
provincialcapital:"直辖市",
|
||
diqu:"中国西南地区",
|
||
qihou:"亚热带季风性湿润气候",
|
||
people:"3101.79万人" ,
|
||
num:"48.6万平方公里" ,
|
||
GDP:"20363.19亿元",
|
||
renjunGDP:"65933元"
|
||
}],
|
||
[{
|
||
name: '山东',
|
||
value: 0,
|
||
ave:"鲁",
|
||
provincialcapital:"济南",
|
||
diqu:"中国华北地区",
|
||
qihou:"温带季风气候",
|
||
people:"10047.24万人" ,
|
||
num:"15.79万平方公里" ,
|
||
GDP:"76469.7亿元",
|
||
renjunGDP:"76267元"
|
||
}],
|
||
[{
|
||
name: '河南',
|
||
value: 0,
|
||
ave:"豫",
|
||
provincialcapital:"郑州",
|
||
diqu:"中国华中地区",
|
||
qihou:"温带季风气候,亚热带季风气候",
|
||
people:"9605万人" ,
|
||
num:"16.7万平方公里" ,
|
||
GDP:"48055.86亿元",
|
||
renjunGDP:"50152元"
|
||
}],
|
||
[{
|
||
name: '江苏',
|
||
value: 0,
|
||
ave:"黑",
|
||
provincialcapital:"南京",
|
||
diqu:"中国华东地区",
|
||
qihou:"亚热带季风气候,温带季风气候",
|
||
people:"8050.7万人" ,
|
||
num:"10.72万平方公里" ,
|
||
GDP:"92595.4亿元",
|
||
renjunGDP:"115000元"
|
||
}],
|
||
[{
|
||
name: '安徽',
|
||
value: 0,
|
||
ave:"皖",
|
||
provincialcapital:"合肥",
|
||
diqu:"中国华北地区",
|
||
qihou:"温带季风气候、亚热带季风气候",
|
||
people:"6323.6万人" ,
|
||
num:"14.01万平方公里" ,
|
||
GDP:"30006.8亿元",
|
||
renjunGDP:"47712元"
|
||
}],
|
||
[{
|
||
name: '湖北',
|
||
value: 0,
|
||
ave:"鄂",
|
||
provincialcapital:"武汉",
|
||
diqu:"中国中部地区",
|
||
qihou:"亚热带季风气候、高原山地气候",
|
||
people:"5917万人" ,
|
||
num:"18.59万平方公里" ,
|
||
GDP:"39366.55亿元",
|
||
renjunGDP:"66615元"
|
||
}],
|
||
[{
|
||
name: '浙江',
|
||
value: 0,
|
||
ave:"浙",
|
||
provincialcapital:"杭州",
|
||
diqu:"中国华东地区",
|
||
qihou:"亚热带季风气候",
|
||
people:"5737万人" ,
|
||
num:"10.55万平方公里" ,
|
||
GDP:"56197亿元",
|
||
renjunGDP:"98643元"
|
||
}],
|
||
[{
|
||
name: '福建',
|
||
value: 0,
|
||
ave:"闽",
|
||
provincialcapital:"福州",
|
||
diqu:"中国华东地区",
|
||
qihou:"亚热带季风气候",
|
||
people:"3941万人" ,
|
||
num:"12.4万平方公里" ,
|
||
GDP:"35804.04亿元",
|
||
renjunGDP:"91197元"
|
||
}],
|
||
[{
|
||
name: '江西',
|
||
value: 0,
|
||
ave:"赣",
|
||
provincialcapital:"南昌",
|
||
diqu:"中国华东地区",
|
||
qihou:"亚热带季风性湿润气候",
|
||
people:"4647.6万人" ,
|
||
num:"16.69万平方公里" ,
|
||
GDP:"21984.8亿元",
|
||
renjunGDP:"47433元"
|
||
}],
|
||
[{
|
||
name: '湖南',
|
||
value: 0,
|
||
ave:"湘",
|
||
provincialcapital:"长沙",
|
||
diqu:"中南地区",
|
||
qihou:"亚热带季风气候",
|
||
people:"6898.8万人" ,
|
||
num:"21.18万平方公里" ,
|
||
GDP:"36425.8亿元",
|
||
renjunGDP:"53097元"
|
||
}],
|
||
[{
|
||
name: '贵州',
|
||
value: 0,
|
||
ave:"贵",
|
||
provincialcapital:"贵阳",
|
||
diqu:"西南地区",
|
||
qihou:"亚热带季风气候",
|
||
people:"3600.0万人" ,
|
||
num:"17.6167万平方公里" ,
|
||
GDP:"14806.4亿元",
|
||
renjunGDP:"41400元"
|
||
}],
|
||
[{
|
||
name: '云南',
|
||
value: 0,
|
||
ave:"云",
|
||
provincialcapital:"昆明",
|
||
diqu:"西南地区",
|
||
qihou:"亚热带季风气候、热带季风气候、高原山地气候",
|
||
people:"4829.5万人" ,
|
||
num:"47.3万平方公里" ,
|
||
GDP:"14869.9亿元",
|
||
renjunGDP:"31358元"
|
||
}],
|
||
[{
|
||
name: '广东',
|
||
value: 0,
|
||
ave:"粤",
|
||
provincialcapital:"广州",
|
||
diqu:"华南地区",
|
||
qihou:"亚热带季风气候",
|
||
people:"11346.0万人" ,
|
||
num:"17.97万平方公里" ,
|
||
GDP:"89879.2亿元",
|
||
renjunGDP:"81089元"
|
||
}],
|
||
[{
|
||
name: '广西',
|
||
value: 0,
|
||
ave:"桂",
|
||
provincialcapital:"南宁",
|
||
diqu:"华南地区",
|
||
qihou:"亚热带季风气候",
|
||
people:"4926万人" ,
|
||
num:"23.76万平方公里" ,
|
||
GDP:"20396.2亿元",
|
||
renjunGDP:"41752元"
|
||
}],
|
||
[{
|
||
name: '海南',
|
||
value: 0,
|
||
ave:"琼",
|
||
provincialcapital:"海口",
|
||
diqu:"华南地区",
|
||
qihou:"热带海洋性季风气候",
|
||
people:"934.32万人" ,
|
||
num:"3.54万平方公里" ,
|
||
GDP:"4832.05亿元",
|
||
renjunGDP:"52195.5元"
|
||
}],
|
||
[{
|
||
name: '上海',
|
||
value: 0,
|
||
ave:"沪",
|
||
provincialcapital:"上海",
|
||
diqu:"华东地区",
|
||
qihou:"亚热带季风气候",
|
||
people:"2423.78万人" ,
|
||
num:"6340.5平方公里" ,
|
||
GDP:"32679.87亿元",
|
||
renjunGDP:"135000元"
|
||
}],
|
||
[{
|
||
name: '香港',
|
||
value: 0,
|
||
ave:"港",
|
||
provincialcapital:"香港",
|
||
diqu:"华南地区",
|
||
qihou:"亚热带季风气候",
|
||
people:"748.25万人" ,
|
||
num:"1106.34平方公里" ,
|
||
GDP:"24042.15亿元",
|
||
renjunGDP:"343595.02元"
|
||
}],
|
||
[{
|
||
name: '澳门',
|
||
value: 0,
|
||
ave:"澳",
|
||
provincialcapital:"澳门",
|
||
diqu:"华南地区",
|
||
qihou:"亚热带季风气候",
|
||
people:"67.2万" ,
|
||
num:"32.8平方公里" ,
|
||
GDP:"4448.88亿元",
|
||
renjunGDP:"676564.63元"
|
||
}],
|
||
[{
|
||
name: '台湾',
|
||
value: 0,
|
||
ave:"台",
|
||
provincialcapital:"台湾",
|
||
diqu:"华东地区",
|
||
qihou:"北回归线以北属亚热带季风气候,以南属热带季风气候",
|
||
people:"2358万人" ,
|
||
num:"36192.8155平方公里" ,
|
||
GDP:"3.9万亿元人民币",
|
||
renjunGDP:"165400元"
|
||
}],
|
||
[{
|
||
name: '班公湖',
|
||
value: 0,
|
||
ave:"班公湖(班公错)",
|
||
provincialcapital:"Pangong Tso",
|
||
diqu:"西藏阿里日土县",
|
||
qihou:"高原气候",
|
||
people:"600-700平方公里" ,
|
||
num:"汉藏语系-藏语" ,
|
||
GDP:"4250m",
|
||
renjunGDP:"鸟岛"
|
||
}],
|
||
[{
|
||
name: '洞朗',
|
||
value: 0,
|
||
ave:"洞朗",
|
||
provincialcapital:"Dong Lang Village",
|
||
diqu:"日喀则市亚东县下亚东乡",
|
||
qihou:"高原山地气候",
|
||
people:"109平方公里" ,
|
||
num:"汉藏语系-藏语" ,
|
||
GDP:"1655米-4363米",
|
||
renjunGDP:"卓木麻曲、姐普山"
|
||
}],
|
||
[{
|
||
name: '桑多河谷',
|
||
value: 0,
|
||
ave:"桑多河谷",
|
||
provincialcapital:"Sumdorong Chu",
|
||
diqu:"西藏自治区山南市",
|
||
qihou:"亚热带山地湿润半湿润季风气候",
|
||
people:"34979平方公里" ,
|
||
num:"汉藏语系-藏语-门巴语" ,
|
||
GDP:"4380米",
|
||
renjunGDP:"克节朗河谷,兼则玛尼"
|
||
}]
|
||
|
||
]
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
var convertData = function(data) {
|
||
var res = [];
|
||
var i1 = 35;
|
||
var dataItem = data[i1];
|
||
var fromCoord = [78.744718,33.670094];
|
||
var toCoord = chinaGeoCoordMap[dataItem[0].name];
|
||
if (fromCoord && toCoord) {
|
||
res.push([{
|
||
coord: fromCoord,
|
||
value: dataItem[0].value,
|
||
}, {
|
||
coord: toCoord,
|
||
dataItem: dataItem
|
||
}]);
|
||
}
|
||
var i2 = 36;
|
||
var dataItem = data[i2];
|
||
var fromCoord = [88.951476,27.298102];
|
||
var toCoord = chinaGeoCoordMap[dataItem[0].name];
|
||
if (fromCoord && toCoord) {
|
||
res.push([{
|
||
coord: fromCoord,
|
||
value: dataItem[0].value,
|
||
}, {
|
||
coord: toCoord,
|
||
dataItem: dataItem
|
||
}]);
|
||
}
|
||
var i3 = 34;
|
||
var dataItem = data[i3];
|
||
var fromCoord = [92.21,26.97];
|
||
var toCoord = chinaGeoCoordMap[dataItem[0].name];
|
||
if (fromCoord && toCoord) {
|
||
res.push([{
|
||
coord: fromCoord,
|
||
value: dataItem[0].value,
|
||
}, {
|
||
coord: toCoord,
|
||
dataItem: dataItem
|
||
}]);
|
||
}
|
||
|
||
|
||
|
||
|
||
return res;
|
||
};
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
let redName = '上海';
|
||
var series = [];
|
||
[ ['北京', chinaDatas] ].forEach(function(item, i) {
|
||
// console.log('得到数据',item)
|
||
series.push(
|
||
{
|
||
type: 'lines',
|
||
zlevel: 2,
|
||
effect: {
|
||
// 括 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none'
|
||
show: true,
|
||
period: 4, //箭头指向速度,值越小速度越快
|
||
trailLength: 0.9, //特效尾迹长度[0,1]值越大,尾迹越长重
|
||
symbol: 'circle', //箭头图标
|
||
symbolSize: 10, //图标大小
|
||
},
|
||
lineStyle: {
|
||
normal: {
|
||
width: 2, //尾迹线条宽度
|
||
opacity: .5, //尾迹线条透明度
|
||
curveness: -0.5, //尾迹线条曲直度
|
||
color: function(params) { //圆环显示文字
|
||
// console.log('redName',redName)
|
||
if (params.data.dataItem[0].name == redName) {
|
||
return '#2bd291' // 疑似地点
|
||
} else {
|
||
return '#70c4eb'
|
||
}
|
||
},
|
||
},
|
||
color: 'red'
|
||
},
|
||
tooltip: {
|
||
show:true,
|
||
trigger: 'item',
|
||
backgroundColor: 'rgba(8, 18, 42, 0.85)',
|
||
borderColor: '#040616',
|
||
showDelay: 0,
|
||
hideDelay: 0,
|
||
enterable: true,
|
||
transitionDuration: 0,
|
||
extraCssText: 'z-index:100',
|
||
formatter: function(params, ticket, callback) {
|
||
//根据业务自己拓展要显示的内容
|
||
//console.log('params--1',params)
|
||
let res = "";
|
||
let name = params.data.dataItem[0].name;
|
||
let price = params.data.dataItem[0].price;
|
||
let num = params.data.dataItem[0].num;
|
||
// res = "<div style='color:#fff;'><span>北京->" + name + "</span><br/><span>均价:" + price + "</span><br/><span>线路数:" + num + "</span></div>";
|
||
|
||
//res = '<div class="mapTableContent"><div class="tableTop">任意输入 -> 任意输入</div> <div class="tableList"> <div class="item itemTop"> <p>人口</p > <p>面积</p > <p>经济总量</p > </div> <div class="item"> <p>人均GDP</p > </div> <div class="item"> <p>城市幸福指数</p > </div> </div> </div>'
|
||
|
||
|
||
//let html = '<div class="mapTableContent"><div class="tableTop">任意输入 -> 任意输入</div> <div class="tableList"> <div class="item itemTop"> <p>人口</p > <p>面积</p > <p>经济总量</p > </div> <div class="item"> <p>人均GDP</p > </div> <div class="item"> <p>城市幸福指数</p > </div> </div> </div>'
|
||
|
||
|
||
res = '<div class="mapTableContent"><div class="tableTop">任意输入 -> 任意输入</div> <div class="tableList"> <div class="item itemTop">'
|
||
|
||
|
||
let html = '<div class="mapTableContent"><div class="tableTop">任意输入 -> 任意输入</div> <div class="tableList"> <div class="item itemTop">'
|
||
if(name == redName){
|
||
return html;
|
||
}else{
|
||
return res;
|
||
}
|
||
}
|
||
},
|
||
data: convertData(item[1])
|
||
},
|
||
{
|
||
type: 'effectScatter',
|
||
coordinateSystem: 'geo',
|
||
zlevel: 2,
|
||
rippleEffect: { //涟漪特效
|
||
period: 4, //动画时间,值越小速度越快
|
||
brushType: 'fill', //波纹绘制方式 stroke, fill
|
||
scale: .5 //波纹圆环最大限制,值越大波纹越大
|
||
},
|
||
label: {
|
||
normal: {
|
||
show: true,
|
||
position: 'right', //显示位置
|
||
offset: [5, 0], //偏移设置
|
||
formatter: function(params) { //圆环显示文字
|
||
// console.log('params',params)
|
||
return params.data.name;
|
||
},
|
||
fontSize: 14
|
||
},
|
||
// emphasis: {
|
||
// show: true,
|
||
// color: "#0f0"
|
||
// }
|
||
},
|
||
// 括 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none'
|
||
symbol: 'circle',
|
||
symbolSize: function(val) {
|
||
return 10; //圆环大小
|
||
},
|
||
itemStyle: {
|
||
normal: {
|
||
show: false,
|
||
// color: '#f00'
|
||
color: function(params) { //圆环显示文字
|
||
// console.log('redName',redName)
|
||
if (params.data.dataItem[0].name == redName) {
|
||
return '#2bd291'
|
||
} else {
|
||
return '#70c4eb'
|
||
}
|
||
},
|
||
}
|
||
},
|
||
// 在这里修改悬浮框,加了一个show:true
|
||
tooltip: {
|
||
show:true,
|
||
trigger: 'item',
|
||
backgroundColor: 'rgba(8, 18, 42, 0.85)',
|
||
borderColor: '#040616',
|
||
showDelay: 0,
|
||
hideDelay: 0,
|
||
enterable: true,
|
||
transitionDuration: 0,
|
||
extraCssText: 'z-index:100',
|
||
formatter: function(params, ticket, callback) {
|
||
// 根据业务自己拓展要显示的内容
|
||
//console.log('params--2',params)
|
||
let res = "";
|
||
let name = params.data.dataItem[0].name;
|
||
let ave = params.data.dataItem[0].ave;
|
||
let provincialcapital= params.data.dataItem[0].provincialcapital;
|
||
let diqu = params.data.dataItem[0].diqu;
|
||
let qihou = params.data.dataItem[0].qihou;
|
||
let people = params.data.dataItem[0].people;
|
||
let num = params.data.dataItem[0].num;
|
||
let GDP = params.data.dataItem[0].GDP;
|
||
let renjunGDP = params.data.dataItem[0].renjunGDP;
|
||
|
||
|
||
|
||
res = "<div style='color:#fff;padding:10px;'><span>名称:" + name + "</span><br/><span>中文名:" + ave + "</span><br/><span>外文名:" + provincialcapital + "</span><br/><span>所属地区:" + diqu + "</span><br/><span>气候:" + qihou + "</span><br/><span>面积:" + people + "</span><br/><span>语言:" + num + "</span><br/><span>海拔:" + GDP + "</span><br/><span>著名景点:" + renjunGDP +
|
||
' </div>' +
|
||
' </div>' +
|
||
'<div id="tooltipBarId" style="height:100px;width:100%;border-radius:0 0 5px 0;background:#fff"></div>'+ "</span><br/><span>演示表格可以任意定制输入及其他参数";
|
||
setTimeout(function() {
|
||
tooltipCharts(params.name);
|
||
}, 10);
|
||
setTimeout(function() {
|
||
tooltipCharts1(params.name);
|
||
}, 10);
|
||
setTimeout(function() {
|
||
tooltipCharts2(params.name);
|
||
}, 10);
|
||
return res;
|
||
}
|
||
},
|
||
data: item[1].map(function(dataItem) {
|
||
// console.log('dataItem',dataItem[0]);
|
||
return {
|
||
dataItem: dataItem,
|
||
name: dataItem[0].name,
|
||
value: chinaGeoCoordMap[dataItem[0].name].concat([dataItem[0].value])
|
||
};
|
||
}),
|
||
},
|
||
//被攻击点
|
||
{
|
||
type: 'scatter',
|
||
coordinateSystem: 'geo',
|
||
zlevel: 2,
|
||
rippleEffect: {
|
||
period: 4,
|
||
brushType: 'stroke',
|
||
scale: 4
|
||
},
|
||
|
||
label: {
|
||
normal: {
|
||
show: true,
|
||
position: 'right',
|
||
fontSize: 14,
|
||
offset: [5, 0],
|
||
color: '#2bd291',
|
||
formatter: '{b}',
|
||
textStyle: {
|
||
color: "#2bd291"
|
||
// color: "#0f0"
|
||
}
|
||
},
|
||
// emphasis: {
|
||
// show: true,
|
||
// color: "#0f0"
|
||
// }
|
||
},
|
||
symbol: 'pin',
|
||
color:'#2bd291',
|
||
symbolSize: 50,
|
||
data: [{
|
||
name: item[0],
|
||
value: chinaGeoCoordMap[item[0]].concat([10]),
|
||
}],
|
||
},
|
||
{
|
||
type: 'map',
|
||
geoIndex: 0
|
||
}
|
||
|
||
);
|
||
});
|
||
|
||
// 在这里修改悬浮框,把 show:true 改为 show:false
|
||
option = {
|
||
tooltip: {
|
||
show:false,
|
||
trigger: 'item',
|
||
backgroundColor: 'rgba(166, 200, 76, 0.82)',
|
||
borderColor: '#040616',
|
||
showDelay: 0,
|
||
hideDelay: 0,
|
||
enterable: true,
|
||
transitionDuration: 0,
|
||
extraCssText: 'z-index:100'
|
||
},
|
||
backgroundColor: "#001339",
|
||
// visualMap: { //图例值控制
|
||
// min: 0,
|
||
// max: 1,
|
||
// calculable: true,
|
||
// show: false,
|
||
// color: ['#4fc6ef', '#4fc6ef', '#4fc6ef', '#4fc6ef', '#4fc6ef'],
|
||
// textStyle: {
|
||
// color: '#fff'
|
||
// }
|
||
// },
|
||
geo: {
|
||
map: 'china',
|
||
zoom: 1.2,
|
||
label: {
|
||
emphasis: {
|
||
show: false
|
||
}
|
||
},
|
||
roam: true, //是否允许缩放
|
||
itemStyle: {
|
||
normal: {
|
||
color: "#092765", //地图背景色
|
||
borderColor: '#6481a0', //省市边界线00fcff 516a89
|
||
borderWidth: 1
|
||
},
|
||
emphasis: {
|
||
//color: '#092765', //悬浮背景
|
||
areaColor: '#05ff09'
|
||
|
||
}
|
||
}
|
||
},
|
||
series: series
|
||
};
|
||
|
||
|
||
myChart.on('mouseover', function(params) {
|
||
var city = params.name;
|
||
|
||
|
||
if (city == '广东' || city == '广西' || city == '海南'|| city == '云南' || city == '湖南' || city == '贵州') {
|
||
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "广东"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "广西"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "海南"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "云南"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "湖南"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "贵州"
|
||
});
|
||
|
||
}
|
||
|
||
if (city == '江西' || city == '江苏' || city == '浙江' || city == '安徽' || city == '福建' || city == '上海') {
|
||
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "江西"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "江苏"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "浙江"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "安徽"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "福建"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "上海"
|
||
});
|
||
|
||
}
|
||
|
||
|
||
|
||
if (city == '北京' || city == '天津' || city == '河北' || city == '河南' || city == '山西' || city == '陕西' || city == '湖北') {
|
||
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "北京"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "天津"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "河北"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "河南"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "山西"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "陕西"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "湖北"
|
||
});
|
||
|
||
|
||
}
|
||
if (city == '四川' || city == '甘肃' || city == '青海' || city == '宁夏' || city == '新疆' || city == '西藏' || city == '重庆') {
|
||
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "四川"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "甘肃"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "青海"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "宁夏"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "新疆"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "西藏"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "重庆"
|
||
});
|
||
|
||
|
||
}
|
||
|
||
if (city == '辽宁' || city == '山东' || city == '吉林' || city == '黑龙江' || city == '内蒙古') {
|
||
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "辽宁"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "山东"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "吉林"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "黑龙江"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "内蒙古"
|
||
});
|
||
|
||
|
||
}
|
||
if (city == '台湾' || city == '香港' || city == '澳门') {
|
||
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "台湾"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "香港"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'highlight',
|
||
name: "澳门"
|
||
});
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
});
|
||
|
||
myChart.on('mouseout', function(params) {
|
||
var city = params.name;
|
||
|
||
|
||
if (city == '广东' || city == '广西' || city == '海南'|| city == '云南' || city == '湖南' || city == '贵州') {
|
||
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "广东"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "广西"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "海南"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "云南"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "湖南"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "贵州"
|
||
});
|
||
|
||
}
|
||
if (city == '江西' || city == '江苏' || city == '浙江' || city == '安徽' || city == '福建' || city == '上海') {
|
||
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "江西"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "江苏"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "浙江"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "安徽"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "福建"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "上海"
|
||
});
|
||
|
||
}
|
||
|
||
if (city == '北京' || city == '天津' || city == '河北' || city == '河南' || city == '山西' || city == '陕西' || city == '湖北') {
|
||
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "北京"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "天津"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "河北"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "河南"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "山西"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "陕西"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "湖北"
|
||
});
|
||
|
||
}
|
||
if (city == '四川' || city == '甘肃' || city == '青海' || city == '宁夏' || city == '新疆' || city == '西藏' || city == '重庆') {
|
||
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "四川"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "甘肃"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "青海"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "宁夏"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "新疆"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "西藏"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "重庆"
|
||
});
|
||
|
||
}
|
||
if (city == '辽宁' || city == '山东' || city == '吉林' || city == '黑龙江' || city == '内蒙古') {
|
||
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "辽宁"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "山东"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "吉林"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "黑龙江"
|
||
});
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "内蒙古"
|
||
});
|
||
|
||
}
|
||
|
||
if (city == '台湾' || city == '香港' || city == '澳门') {
|
||
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "台湾"
|
||
});
|
||
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "香港"
|
||
});
|
||
|
||
|
||
myChart.dispatchAction({
|
||
type: 'downplay',
|
||
name: "澳门"
|
||
});
|
||
|
||
}
|
||
|
||
});
|
||
|
||
myChart.setOption(option);
|
||
|
||
</script>
|
||
</body>
|
||
</html> |