/** *@Author : TengZH *@CreateTime : 2019-02-15 9:05 *@Description : */ function area(name, color) { var a = { name: name, selected: true, itemStyle: { emphasis: { areaColor: color, //地图边缘颜色 e100b1 borderColor: name === '重点湿地' ? '#00daf4' : name === '江西省' ? '#008080' : '#767676', borderType: name === '重点湿地' ? 'solid' : name.indexOf('市') != -1 ? 'dashed' : name === '江西省' ? 'solid' : 'dotted', borderWidth: name === '重点湿地' ? 1 : name.indexOf('市') != -1 ? 0.5 : name === '江西省' ? 3 : 0.2 } }, label: { emphasis: { show: name.indexOf('市') != -1 ? true : false, color: '#565656', fontSize: 13, fontWeight: 300, textBorderColor: '#565656', textShadowColor: '#ffffff', textShadowBlur: 10, textShadowOffsetX: 0, textShadowOffsetY: 0, } } }; return a; } var geodata = [{ name: '长江', value: [116.117461338000110, 29.958777864000058] }, { name: '鄱阳湖', value: [116.282654499000050, 29.112554511000042] }, { name: '抚河', value: [116.272134128000080, 27.612049965000040] }, { name: '修河', value: [115.085004082000070, 28.950607076000063] }, { name: '饶河', value: [117.273813465000100, 29.167618898000057] }, { name: '赣江', value: [114.871629582000080, 27.433090708000066] }, { name: '信江', value: [117.556018448000030, 28.083342980000077] }], country = [ {name: '南昌市', value: [116.0046, 28.6633, 0]}, {name: '赣州市', value: [115.2795, 25.8124, 13]}, {name: '九江市', value: [115.4224, 29.3774, 3]}, {name: '新余市', value: [114.95, 27.8174, 1]}, {name: '宜春市', value: [115.0159, 28.3228, 2]}, {name: '抚州市', value: [116.4441, 27.4933, 6]}, {name: '鹰潭市', value: [117.0813, 28.2349, 1]}, {name: '吉安市', value: [114.884, 26.9659, 5]}, {name: '景德镇市', value: [117.334, 29.3225, 1]}, {name: '萍乡市', value: [113.9282, 27.4823, 2]}, {name: '上饶市', value: [117.8613, 28.7292, 5]} ], city = [ {name: '南昌市', value: [116.0046, 28.6633, 2]}, {name: '赣州市', value: [115.2795, 25.8124, 7]}, {name: '九江市', value: [115.4224, 29.3774, 9]}, {name: '新余市', value: [114.95, 27.8174, 1]}, {name: '宜春市', value: [115.0159, 28.3228, 9]}, {name: '抚州市', value: [116.4441, 27.4933, 11]}, {name: '鹰潭市', value: [117.0813, 28.2349, 4]}, {name: '吉安市', value: [114.884, 26.9659, 5]}, {name: '景德镇市', value: [117.334, 29.3225, 3]}, {name: '萍乡市', value: [113.9282, 27.4823, 2]}, {name: '上饶市', value: [117.8613, 28.7292, 7]} ], station = [], lines = [], scene = []; var mapChart = echarts.init(document.getElementById('map-charts')); option = { backgroundColor: "transparent", legend: { show: true, bottom: 20, right: 20, type: 'scroll', orient: 'vertical', textStyle: { color: '#ffffff' }, selected: { // 选中true不选择false // '河流水系': true, '环境监测点': true, // '监测站网': true, '国家级湿地公园': false, // 不选中'系列2' '省级湿地公园': false, '全景': false } }, geo: { map: 'jiangxi', label: { emphasis: { show: false, color: '#000' } }, roam: true, center: [116.210391, 27.432378], zoom: 1.2, scaleLimit: { min: 1, max: 6, }, //zlevel: 0, itemStyle: { normal: { areaColor: '#6c8fa0', borderColor: '#404a59' }, emphasis: { areaColor: '#6c8fa0' } }, regions: [ area('南昌市', 'rgba(0,0,0,0)'), area('赣州市', 'rgba(0,0,0,0)'), area('九江市', 'rgba(0,0,0,0)'), area('新余市', 'rgba(0,0,0,0)'), area('宜春市', 'rgba(0,0,0,0)'), area('抚州市', 'rgba(0,0,0,0)'), area('鹰潭市', 'rgba(0,0,0,0)'), area('吉安市', 'rgba(0,0,0,0)'), area('景德镇市', 'rgba(0,0,0,0)'), area('萍乡市', 'rgba(0,0,0,0)'), area('上饶市', 'rgba(0,0,0,0)'), area('赣江', '#D9D0A9'), area('重点湿地', '#00b6e7'), area('鄱阳湖', '#86C127'), area('赣江', '#D9D0A9'), area('修河', '#FDF79F'), area('抚河', '#D8E849'), area('信江', '#B9DB7D'), area('饶河', '#F4C4B6'), area('江西省', 'rgba(0,0,0,0)'), ] }, series: [ // { // name: '河流水系',//鄱阳湖 // type: 'lines', // coordinateSystem: 'geo', // //polyline:true, // // symbol: ['none', 'triangle'], // zlevel: 2, // effect: { // show: true, // symbol: 'roundRect', // period: 2, // delay: 100, // trailLength: 0.8, // symbolSize: 5, // }, // lineStyle: { // normal: { // color: { // type: 'linear', // x: 0, // y: 0, // x2: 0, // y2: 1, // colorStops: [{ // offset: 0, // color: '#004bff' // }, { // offset: 1, // color: '#00FFFF' // }], // globalCoord: false // }, // width: 1, // opacity: 0.8, // //type: 'dotted', // curveness: 0.05, // } // }, // data: [{ // coords: [ // [116.144993531000070, 29.259952655000075], // [116.198110483000100, 29.800859348000074], // ] // }] // }, { // name: '河流水系',//长江 // type: 'lines', // coordinateSystem: 'geo', // //polyline:true, // // symbol: ['none', 'triangle'], // zlevel: 2, // effect: { // show: true, // symbol: 'roundRect', // period: 2, // delay: 100, // trailLength: 0.8, // symbolSize: 5, // }, // lineStyle: { // normal: { // color: { // type: 'linear', // x: 0, // y: 0, // x2: 0, // y2: 1, // colorStops: [{ // offset: 0, // color: '#004bff' // }, { // offset: 1, // color: '#00FFFF' // }], // globalCoord: false // }, // width: 1, // opacity: 0.8, // //type: 'dotted', // curveness: 0.05, // } // }, // data: [{ // coords: [ // [115.385586512000030, 29.880911279000031], // [115.442693576000010, 29.820235024000056], // ] // }, { // coords: [ // [115.442693576000010, 29.820235024000056], // [115.631860726000010, 29.880911279000031], // ] // }, { // coords: [ // [115.631860726000010, 29.880911279000031], // [115.910257664000030, 29.748851194000054], // ] // }, { // coords: [ // [115.910257664000030, 29.748851194000054], // [116.049456132000050, 29.870203705000051], // ] // }, { // coords: [ // [116.049456132000050, 29.870203705000051], // [116.152962686000020, 29.870203705000051], // ] // }, { // coords: [ // [116.152962686000020, 29.870203705000051], // [116.306437921000110, 29.830942598000036], // ] // }, { // coords: [ // [116.306437921000110, 29.830942598000036], // [116.406375283000100, 29.963002684000060], // ] // }, { // coords: [ // [116.406375283000100, 29.963002684000060], // [116.509881837000080, 29.948725918000036], // ] // }, { // coords: [ // [116.509881837000080, 29.948725918000036], // [116.777571200000010, 30.162877409000032], // ] // }] // }, { // name: '河流水系',//赣江 // type: 'lines', // coordinateSystem: 'geo', // polyline: true, // // symbol: ['none', 'triangle'], // zlevel: 2, // effect: { // show: true, // symbol: 'roundRect', // period: 3, // delay: 100, // trailLength: 0.8, // symbolSize: 5 // }, // lineStyle: { // normal: { // color: { // type: 'linear', // x: 0, // y: 0, // x2: 0, // y2: 1, // colorStops: [{ // offset: 0, // color: '#004bff' // }, { // offset: 1, // color: '#00FFFF' // }], // globalCoord: false // }, // width: 1, // opacity: 0.8, // //type: 'dotted', // curveness: 0.05, // } // }, // data: river['赣江'] // }, { // name: '河流水系',//修河 // type: 'lines', // coordinateSystem: 'geo', // polyline: true, // // symbol: ['none', 'triangle'], // zlevel: 2, // effect: { // show: true, // symbol: 'roundRect', // period: 3, // delay: 100, // trailLength: 0.8, // symbolSize: 5 // }, // lineStyle: { // normal: { // color: { // type: 'linear', // x: 0, // y: 0, // x2: 0, // y2: 1, // colorStops: [{ // offset: 0, // color: '#004bff' // }, { // offset: 1, // color: '#00FFFF' // }], // globalCoord: false // }, // width: 1, // opacity: 0.8, // //type: 'dotted', // curveness: 0.05 // } // }, // data: river['修河'] // }, { // name: '河流水系',//信江 // type: 'lines', // coordinateSystem: 'geo', // polyline: true, // // symbol: ['none', 'triangle'], // zlevel: 2, // effect: { // show: true, // symbol: 'roundRect', // period: 5, // delay: 100, // trailLength: 0.8, // symbolSize: 5 // }, // lineStyle: { // normal: { // color: { // type: 'linear', // x: 0, // y: 0, // x2: 0, // y2: 1, // colorStops: [{ // offset: 0, // color: '#004bff' // }, { // offset: 1, // color: '#00FFFF' // }], // globalCoord: false // }, // width: 1, // opacity: 0.8, // //type: 'dotted', // curveness: 0.05 // } // }, // data: river['信江'] // }, { // name: '河流水系',//抚河 // type: 'lines', // coordinateSystem: 'geo', // polyline: true, // // symbol: ['none', 'triangle'], // zlevel: 2, // effect: { // show: true, // symbol: 'roundRect', // period: 3, // delay: 100, // trailLength: 1, // symbolSize: 5 // }, // lineStyle: { // normal: { // color: { // type: 'linear', // x: 0, // y: 0, // x2: 0, // y2: 1, // colorStops: [{ // offset: 0, // color: '#004bff' // }, { // offset: 1, // color: '#00FFFF' // }], // globalCoord: false // }, // width: 1, // opacity: 0.8, // //type: 'dotted', // curveness: 0.05 // } // }, // data: river['抚河'] // }, { // name: '河流水系',//饶河 // type: 'lines', // coordinateSystem: 'geo', // polyline: true, // // symbol: ['none', 'triangle'], // zlevel: 2, // effect: { // show: true, // symbol: 'roundRect', // period: 4, // delay: 100, // trailLength: 0.8, // symbolSize: 5 // }, // lineStyle: { // normal: { // color: { // type: 'linear', // x: 0, // y: 0, // x2: 0, // y2: 1, // colorStops: [{ // offset: 0, // color: '#004bff' // }, { // offset: 1, // color: '#00FFFF' // }], // globalCoord: false // }, // width: 1, // opacity: 0.8, // //type: 'dotted', // curveness: 0.05 // } // }, // data: river['饶河'] // }, { type: 'scatter', coordinateSystem: 'geo', zlevel: 4, label: { normal: { formatter: '{b}', position: 'top', offset: [0, 10], show: true, textStyle: { color: "#fff", fontSize: 20, fontWeight: 300, // shadowColor:'#fff', // shadowBlur:20, textBorderColor: '#17d8ff', textShadowColor: '#0093ff', textShadowBlur: 20, textShadowOffsetX: 0, textShadowOffsetY: 0, } } }, itemStyle: { normal: { show: true, color: 'rgba(128, 128, 128, 0)' } }, data: geodata }, { // name: '监测站点', // type: 'effectScatter', // coordinateSystem: 'geo', //// showEffectOn: 'render', //// zlevel: 3, //// symbol: 'circle', //// symbolSize: 10, //// rippleEffect: { //// brushType: 'stroke', //// period: 4, //// scale: 5 //// }, // label: { // normal: { // formatter: function (e) { // return e.name; // }, // position: 'right', // offset: [0, 0], // show: true, // textStyle: { // color: "#565656", // fontSize: 13, // fontWeight: 400, // textBorderColor: '#E6E6FA', // textShadowColor: '#A9A9A9', // textShadowBlur: 20, // textShadowOffsetX: 0, // textShadowOffsetY: 0 // } // } // }, name: '环境监测点', type: 'effectScatter', coordinateSystem: 'geo', // showEffectOn: 'render', zlevel: 5, symbol: 'circle', // symbolSize: function (val) { // return val[2] * 2; // }, // rippleEffect: { // brushType: 'fill', // period: 4, // scale: 5 // }, selectedMode: 'single', hoverAnimation: false,//鼠标接触动画效果 label: { normal: { formatter: function (e) { return e.name; }, position: 'right', offset: [0, 0], show: true, textStyle: { color: "#565656", fontSize: 13, fontWeight: 400, textBorderColor: '#E6E6FA', textShadowColor: '#A9A9A9', textShadowBlur: 20, textShadowOffsetX: 0, textShadowOffsetY: 0 } } }, itemStyle: { normal: { show: true, color: 'rgba(255, 130, 58, 255)' } }, data: station }, // { // name: '监测站网', // type: 'lines', // coordinateSystem: 'geo', // zlevel: 1, // large: true, // polyline: true, // effect: { // show: true, // constantSpeed: 80, // symbol: 'pin',//ECharts 提供的标记类型包括 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow' // symbolSize: 5, // trailLength: 0.5 // }, // hoverAnimation: true, // lineStyle: { // normal: { // // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ // // offset: 0, color: '#ff5833' // // }, { // // offset: 1, color: '#f40df5' // // }], false), // color: { // type: 'linear', // x: 0, // y: 0, // x2: 0, // y2: 1, // colorStops: [{ // offset: 0, // color: '#ff5833' // }, { // offset: 1, // color: '#f40df5' // }], // globalCoord: false // }, // width: 1, // opacity: 1.0, // // curveness: 0.1 // } // }, // data: lines // }, { name: '国家级湿地公园', type: 'effectScatter', coordinateSystem: 'geo', showEffectOn: 'render', zlevel: 6, symbol: 'circle', symbolSize: function (val) { return val[2] * 2; }, rippleEffect: { brushType: 'fill', period: 4, scale: 5 }, hoverAnimation: false,//鼠标接触动画效果 label: { normal: { formatter: function (e) { return e.name + '\n ' + e.value[2]; }, position: 'center', offset: [-8, 0], show: true, textStyle: { color: "#fff", fontSize: 14, fontWeight: 400, textBorderColor: '#f40df5', textShadowColor: '#ffa730', textShadowBlur: 20, textShadowOffsetX: 0, textShadowOffsetY: 0 } } }, itemStyle: { normal: { show: true, color: 'rgba(244, 13, 245, 255)' // color: 'rgba(255, 167, 48, 255)' } }, data: country }, { name: '省级湿地公园', type: 'effectScatter', coordinateSystem: 'geo', showEffectOn: 'render', zlevel: 5, symbol: 'circle', symbolSize: function (val) { return val[2] * 2; }, rippleEffect: { brushType: 'fill', period: 4, scale: 5 }, hoverAnimation: false,//鼠标接触动画效果 label: { normal: { formatter: function (e) { return e.name + '\n ' + e.value[2]; }, position: 'center', offset: [-8, 0], show: true, textStyle: { color: "#fff", fontSize: 14, fontWeight: 400, textBorderColor: '#0022f5', textShadowColor: '#00b8ff', textShadowBlur: 20, textShadowOffsetX: 0, textShadowOffsetY: 0 } } }, itemStyle: { normal: { show: true, color: 'rgba(0, 82, 255, 255)' } }, data: city },{ name: '全景', type: 'effectScatter', coordinateSystem: 'geo', // showEffectOn: 'render', zlevel: 5, symbol: 'circle', // symbolSize: function (val) { // return val[2] * 2; // }, // rippleEffect: { // brushType: 'fill', // period: 4, // scale: 5 // }, selectedMode: 'single', hoverAnimation: false,//鼠标接触动画效果 label: { normal: { formatter: function (e) { return e.name; }, position: 'right', offset: [0, 0], show: true, textStyle: { color: "#565656", fontSize: 13, fontWeight: 400, textBorderColor: '#E6E6FA', textShadowColor: '#A9A9A9', textShadowBlur: 20, textShadowOffsetX: 0, textShadowOffsetY: 0 } } }, itemStyle: { normal: { show: true, color: '#00FFFF' } }, data: scene }] }; $.ajax({ url: getNativePath() + 'station/findStationTree.do', dataType: 'json', type: 'get', async: true, success: function (e) { /*if (e.success) { var points = []; for (var dataKey in e.data) { if (e.data[dataKey].hasOwnProperty('children')) { var thisNode = e.data[dataKey].children; for (var thisNodeKey in thisNode) { if (thisNode[thisNodeKey].hasOwnProperty('children')) { var childNode = thisNode[thisNodeKey].children; for (var childNodeKey in childNode) { if (childNode[childNodeKey].hasOwnProperty('lon') && childNode[childNodeKey].lon && childNode[childNodeKey].hasOwnProperty('lat') && childNode[childNodeKey].lat) { points.push([Number(childNode[childNodeKey].lon), Number(childNode[childNodeKey].lat)]); //地图上添加标注点 station.push({ name: childNode[childNodeKey].text || "监控点", value: [Number(childNode[childNodeKey].lon), Number(childNode[childNodeKey].lat)], //方便添加点击事件 type: 1, stcd: childNode[childNodeKey].id }); } } }else{ if (thisNode[thisNodeKey].hasOwnProperty('lon') && thisNode[thisNodeKey].lon && thisNode[thisNodeKey].hasOwnProperty('lat') && thisNode[thisNodeKey].lat) { points.push([Number(thisNode[thisNodeKey].lon), Number(thisNode[thisNodeKey].lat)]); station.push({ name: thisNode[thisNodeKey].text || "监控点", value: [Number(thisNode[thisNodeKey].lon), Number(thisNode[thisNodeKey].lat)], type: 1, stcd: childNode[childNodeKey].id }); } } } } }*/ // console.log(points) //var triangles = Delaunay.triangulate(points); // for (var i = triangles.length; i;) { // var triangle = {coords: []}; // // var triangle1 = {coords:[]}; // // var triangle2 = {coords:[]}; // --i; // var firstPt = [points[triangles[i]][0], points[triangles[i]][1]]; // triangle.coords.push([points[triangles[i]][0], points[triangles[i]][1]]); // --i; // triangle.coords.push([points[triangles[i]][0], points[triangles[i]][1]]); // // triangle1.coords.push([points[triangles[i]][0], points[triangles[i]][1]]); // --i; // triangle.coords.push([points[triangles[i]][0], points[triangles[i]][1]]); // // triangle1.coords.push([points[triangles[i]][0], points[triangles[i]][1]]); // // triangle2.coords.push([points[triangles[i]][0], points[triangles[i]][1]]); // // triangle2.coords.push(firstPt); // triangle.coords.push(firstPt); // lines.push(triangle); // // lines.push(triangle1); // // lines.push(triangle2); // } // initEcharts(); // } else { // console.warn(e); // alert('站点获取失败!'); // } var points = []; if(e.success){ var data = e.data; for(var i in data){ points.push([data[i]['lon'],data[i]['lat']]); station.push({ name: data[i]['stnm'] || "监控点", value: [data[i]['lon'],data[i]['lat']], //方便添加点击事件 type: 1, stcd: data[i]['stcd'] }) } var triangles = Delaunay.triangulate(points); for (var i = triangles.length; i;) { var triangle = {coords: []}; --i; var firstPt = [points[triangles[i]][0], points[triangles[i]][1]]; triangle.coords.push([points[triangles[i]][0], points[triangles[i]][1]]); --i; triangle.coords.push([points[triangles[i]][0], points[triangles[i]][1]]); --i; triangle.coords.push([points[triangles[i]][0], points[triangles[i]][1]]); triangle.coords.push(firstPt); lines.push(triangle); } initEcharts(); }else{ console.warn(e); alert('站点获取失败!'); } } }); $.ajax({ type:"get", url:getNativePath() + "panorama/queryAllPanoramas.do", success:function(res){ res = res.data; for(var i in res){ var obj = {}; obj.name = res[i]['name']; obj.value = []; obj.Url = res[i]['url']; obj.value.push(res[i]['lon']); obj.value.push(res[i]['lat']); scene.push(obj); } initEcharts(); } }); var flag = 1; function initEcharts() { var timer = null; mapChart.setOption(option); var sthtml = ""; mapChart.on('click','series.effectScatter', function(params){ if(params.data.Url){ var url = params.data.Url $('.sceneBox').show(); $('.sceneBox').html(''+ ''); parent.$("#main-sketch-map").attr('class','').height("100%"); $(".video-close").unbind().click(function(){ parent.$("#main-sketch-map").attr('class','main-sketch-map'); $('.sceneBox').hide(); $('.sceneBox').html(""); }); } if(params.data.type){ // $('.messageBox').remove(); // var x = params.event.offsetX; // var y = params.event.offsetY; // var name = params.name; // var stcd = params.data.stcd; // $.ajax({ // url: getNativePath() + "naturalFactors/findElementCurrentByStcd.do", // type: "get", // data:{"stcd":stcd}, // dataType: "json", // success: function(data) { // var num = 0; // sthtml = ""; // for(var i in data.data){ // for(var z in data.data[i]){ // num++; // } // } // if(data.success && num){ // if(data.data.waterList.length > 0){// 水文 // sthtml += mapStationShow(data.data.waterList, "水文与水环境"); // } // // if(data.data.airList.length > 0){// 空气 // sthtml += mapStationShow(data.data.airList, "空气环境"); // } // // if(data.data.soilList.length > 0){// 土壤 // sthtml += mapStationShow(data.data.soilList, "土壤"); // } // // if(data.data.weatherList.length > 0){// 气象 // sthtml += mapStationShow(data.data.weatherList, "气象"); // } // infoboxShow(1); // // }else{ // infoboxShow(0); // // } // var div = $('#map-charts > div:first-child'); // var uptime = ''; // //// console.log(params) //// console.log(x) //// console.log(y) // function infoboxShow(type){ // if(type){ // flag = 1; //// sthtml = '
' + name + '
' + sthtml + '
'; // sthtml = '
' + name + '
' + sthtml + '
'; //// $(".messageBox").hide(); //// $(".messageBox").html(sthtml); // $('#map-charts').append(sthtml) // $('.messageImg').click(function(){ // flag = 0; // $(".messageBox").hide(); // }) // }else{ // flag = 1; // sthtml = '
' + name + '
暂无数据
'; // $(".messageBox").html(sthtml); // $('.messageImg').click(function(){ // flag = 0; // $(".messageBox").hide(); // }) // } // $('.messageBox').css({'left':x - 130, "top":y}); // $('.messageImg').css('width','35px'); //// $(".messageBox").show() // } // // function mapStationShow(data, nametil){ // var html = '', htmltil = ''; // for(var i=0; i'+parseFloat(data[i].value).toFixed(2)+data[i].unit+''; // }else{ //// htmltil = '
'+(data[i].value).substring(0, 16)+'
'; // htmltil = '
'; // uptime = (data[i].value).substring(0, 16) // } // } // return htmltil + html + '
' + uptime + '
'; // } // } // }); } }); mapChart.on('datazoom',function (e) { console.log(e) }); var auto; mapChart.off('mouseover'); mapChart.on('mouseover','series.effectScatter', function(params){ clearTimeout(timer) clearInterval(auto) var top = 0; if(params.data.type){ var x = params.event.offsetX; var y = params.event.offsetY; var name = params.name; var stcd = params.data.stcd; $.ajax({ url: getNativePath() + "naturalFactors/findElementCurrentByStcd.do", type: "get", data:{"stcd":stcd}, dataType: "json", success: function(data) { var num = 0; sthtml = ""; for(var i in data.data){ for(var z in data.data[i]){ num++; } } if(data.success && num){ if(data.data.waterList.length > 0){// 水文 sthtml += mapStationShow(data.data.waterList, "水文与水环境"); } if(data.data.airList.length > 0){// 空气 sthtml += mapStationShow(data.data.airList, "空气环境"); } if(data.data.soilList.length > 0){// 土壤 sthtml += mapStationShow(data.data.soilList, "土壤"); } if(data.data.weatherList.length > 0){// 气象 sthtml += mapStationShow(data.data.weatherList, "气象"); } infoboxShow(1); }else{ infoboxShow(0); } var div = $('#map-charts > div:first-child'); var uptime = ''; function infoboxShow(type){ if(type){ flag = 1; sthtml = '
' + name + '
' + sthtml + '
'; $('#map-charts').append(sthtml) $('.messageImg').click(function(){ flag = 0; $(".messageBox").hide(); }) }else{ flag = 1; sthtml = '
' + name + '
暂无数据
'; $(".messageBox").html(sthtml); $('.messageImg').click(function(){ flag = 0; $(".messageBox").hide(); }) } var h = $("#map-charts").height(); var w = $("#map-charts").width(); var bh = $('.messageBox').height(); var bw = $('.messageBox').width(); var ytop = y-($('.messageBox').height()/2); var xleft = x +15; var dh = (y-(bh/2))+bh; if(y-(bh/2) <= 0){ ytop = 10; }else if(dh >= h){ var th = (y-(bh/2)) - (dh-h)-30; ytop = th; } if((x +15) + bw >= w){ xleft = x - (bw+15);} $('.messageBox').css({'left':xleft, "top":ytop}); $('.messageImg').css('width','35px'); } function mapStationShow(data, nametil){ var html = '', htmltil = ''; for(var i=0; i'+parseFloat(data[i].value).toFixed(2)+data[i].unit+''; }else{ // htmltil = '
'+(data[i].value).substring(0, 16)+'
'; htmltil = '
'; uptime = (data[i].value).substring(0, 16) } } return htmltil + html + '
' + uptime + '
'; } var height = '-' + $('.map-pup>div').height(); auto = setInterval(function(){ top--; if(top == height - 0){ top = $('.map-pup').height(); } $('.map-pup>div').css('top', top + 'px') },35) } }); } }); mapChart.off('mouseout'); mapChart.on('mouseout','series.effectScatter',function (params) { clearInterval(auto); timer = setTimeout(function(){ $(".messageBox").remove(); }, 200); $(".messageBox").hover(function(){ clearTimeout(timer); }, function(){ timer = setTimeout(function(){ $(".messageBox").remove(); }, 200); }); }); $(window).on('resize', function () { mapChart.resize(); }); }