var colorList = ['#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622', '#bda29a', '#6e7074', '#546570', '#c4ccd3']; var labelFont = 'bold 12px Sans-serif'; var dates; var data; var volumes; var myChart01 = echarts.init(document.getElementById('chart01')); var curOption; //小区详情 function loadDistrictInfo(){ axios.get("/rest/districts/detail", { params: { city: city, region:region, name: name } }).then(function (response) { var vo = response.data.data.detail var cityPrice = response.data.data.cityPrice var collected = response.data.data.collected if(cityPrice){ baseInfo.cityPrice = cityPrice } if(collected){ baseInfo.collect = true; }else{ baseInfo.collect = false; } if(vo){ if(vo.avgPrice){ lat = vo.lat2; lng = vo.lng2; loadMapPoi(); baseInfo.city = vo.city baseInfo.region = vo.region baseInfo.address = vo.address; baseInfo.districtName = vo.name baseInfo.avgPrice = vo.avgPrice; baseInfo.oneMonthUpDownRange = vo.oneMonthUpDownRange; if(vo.rank){ baseInfo.priceRate = vo.rank.substring(0, vo.rank.indexOf("/")); } //baseInfo.cityPrice = vo.cityPrice; var finishDate = "" if(vo.finishBuildingDate){ if(vo.finishBuildingDate.indexOf("~")!=-1){ finishDate = vo.finishBuildingDate.replace("年",""); }else{ finishDate = vo.finishBuildingDate.substring(0,4)+"年" } } baseInfo.finishBuildingDate = finishDate; baseInfo.householdCount = vo.householdCount; baseInfo.cubagePercent = vo.cubagePercent; baseInfo.carSiteCount = vo.carSiteCount; baseInfo.virescencePercent = vo.virescencePercent; baseInfo.estateCharge = vo.estateCharge; baseInfo.moreArea = vo.moreArea; baseInfo.developer = vo.developer; baseInfo.estateCompany = vo.estateCompany; address = vo.address; tags = vo.poiTags; if(vo.poiTags){ if(vo.poiTags.length>=3){ baseInfo.tags = vo.poiTags.slice(0,3); }else{ baseInfo.tags = vo.poiTags; } } loadNearDistrict(vo.lat2, vo.lng2); }else{ $("#noDataDiv").show() baseInfo.districtName = "小区详情" } } }).catch(function (error) { alert(error) console.log(error); }); } //附近小区 function loadNearDistrict(lat, lng){ axios.get("/rest/districts/nearDistrict", { params: { lat: lat, lng:lng } }).then(function (response) { var datas = response.data.data if(datas){ var ret = [] for(var v in datas){ var o = datas[v] if(o.city == city && o.district == region && o.name == name){ continue; }else{ if(ret.length <= 5){ ret.push(o); } } } baseInfo.nearDists = ret; $("#nearDistDiv .cardNearbyWin").css("width",(7.5*ret.length)+"rem"); }else{ $("#nearDistDiv").hide() } }).catch(function (error) { alert(error) console.log(error); }); } function loadKLineData(city, region, name){ axios.get("/rest/trend/kData", { params: { city: city, region:region, name:name } }).then(function (response) { var datas = response.data.data if(datas){ var trends = []; var counts = []; var times = [] var haveCount = false; for(var d in datas){ times.push(d); var prices = new Array(); for(var m in datas[d]){ prices.push(datas[d][m]); } trends.push(prices); if(haveCount==false && datas[d][4]){ haveCount = true; } counts.push(datas[d][4]); } // if(haveCount){ option01.xAxis[0].data = times option01.xAxis[1].data = times //option01.series[0].data = counts option01.series[0].data = trends curOption = option01; myChart01.setOption(option01,true); // }else{ // option02.xAxis[0].data = times // option02.xAxis[1].data = times // option02.series[0].data = trends // curOption = option02; // myChart01.setOption(option02,true); // } } }).catch(function (error) { alert(error) console.log(error); }); } $("#trendDiv1 a").click(function(){ $("#trendDiv1 a").removeClass("active") $(this).addClass("active") var v = $(this).attr("t-v"); if(v == "1"){ curOption.dataZoom[0].start = 95 }else if(v == "3"){ curOption.dataZoom[0].start = 90 }else if(v == "6"){ curOption.dataZoom[0].start = 80 }else if(v == "12"){ curOption.dataZoom[0].start = 50 }else if(v == "24"){ curOption.dataZoom[0].start = 0 }else if(v == "36"){ curOption.dataZoom[0].start = 0 } myChart01.setOption(curOption,true); }); var option01 = { animation: false, color: colorList, title: { text: null, left: 'center' }, legend: { show: false, top: 30, data: ['均价', '成交量'] }, tooltip: { triggerOn: 'none', transitionDuration: 0, confine: true, bordeRadius: 4, borderWidth: 1, borderColor: '#333', backgroundColor: 'rgba(255,255,255,0.9)', textStyle: { fontSize: 12, color: '#333' }, formatter: function (params) { var res = params[0].seriesName + ' ' + params[0].name; res += '
月初 : ' + params[0].value[1]; res += '
月末 : ' + params[0].value[2]; res += '
最低 : ' + params[0].value[3]; res += '
最高 : ' + params[0].value[4]; res += '
'+params[0].seriesName + ' : ' +params[0].value; return res; }, position: function (pos, params, el, elRect, size) { var obj = { top: 60 }; obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 5; return obj; } }, axisPointer: { link: [{ xAxisIndex: [0, 1] }] }, dataZoom: [{ type: 'slider', xAxisIndex: [0, 1], realtime: false, start: 50, end: 100, top: 65, height: 20, handleIcon: 'M10.7,11.9H9.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z', handleSize: '120%' }, { type: 'inside', xAxisIndex: [0, 1], start: 40, end: 70, top: 30, height: 20 }], xAxis: [{ type: 'category', data: dates, boundaryGap : false, axisLine: { lineStyle: { color: '#666' } }, axisLabel: { formatter: function (value) { return echarts.format.formatTime('MM-dd', value); } }, min: 'dataMin', max: 'dataMax', axisPointer: { show: true } }, { type: 'category', gridIndex: 1, data: dates, scale: false, boundaryGap : false, splitLine: {show: false}, axisLabel: {show: false}, axisTick: {show: false}, axisLine: {lineStyle: { color: '#fff' } }, splitNumber: 20, min: 'dataMin', max: 'dataMax', axisPointer: { //type: 'shadow', label: {show: false}, triggerTooltip: true, handle: { show: true, margin: -20, color: '#F18D00' } } }], yAxis: [{ name: '均价(元/㎡)', nameRotate: 90, nameLocation: 'center', nameGap: 5, position: 'right', nameTextStyle: { color: '#999' }, scale: true, splitNumber: 2, axisLine: { lineStyle: { color: '#999' } }, splitLine: { show: true }, axisTick: { show: false }, axisLabel: { inside: true, formatter: '{value}\n' } }, { name: '成交量(套)', nameRotate: 90, nameLocation: 'center', nameGap: 5, position: 'right', nameTextStyle: { color: '#999' }, scale: true, gridIndex: 1, splitNumber: 2, axisLabel: {show: false}, axisLine: {show: false}, axisTick: {show: false}, splitLine: {show: false} }], grid: [{ left: 20, right: 20, top: 110, height: 120 }, { left: 20, right: 20, height: 40, top: 260 }], graphic: [{ type: 'group', left: 'center', top: 70, width: 300, bounding: 'raw' }], series: [/*{ name: '成交量', type: 'bar', xAxisIndex: 1, yAxisIndex: 1, itemStyle: { normal: { color: '#87cefa' }, emphasis: { color: 'black' } }, data: volumes }, */{ type: 'candlestick', name: '均价', data: data, itemStyle: { normal: { color: '#EB5F34', color0: '#88D053', borderColor: '#EB5F34', borderColor0: '#88D053' }, emphasis: { color: 'black', color0: '#333', borderColor: 'black', borderColor0: '#333' } } }] }; /*var option02 = { animation: false, color: colorList, title: { text: null, left: 'center' }, legend: { show: false, top: 30, data: ['均价'] }, tooltip: { triggerOn: 'none', transitionDuration: 0, confine: true, bordeRadius: 4, borderWidth: 1, borderColor: '#333', backgroundColor: 'rgba(255,255,255,0.9)', textStyle: { fontSize: 12, color: '#333' }, formatter: function (params) { var res = params[0].seriesName + ' ' + params[0].name; res += '
月初 : ' + params[0].value[1] res += '
月末 : ' + params[0].value[2]; res += '
最低 : ' + params[0].value[3]; res += '
最高 : ' + params[0].value[4]; return res; }, position: function (pos, params, el, elRect, size) { var obj = { top: 60 }; obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 5; return obj; } }, axisPointer: { link: [{ xAxisIndex: [0, 1] }] }, dataZoom: [{ type: 'slider', xAxisIndex: [0, 1], realtime: false, start: 50, end: 100, top: 65, height: 20, handleIcon: 'M10.7,11.9H9.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z', handleSize: '120%' }, { type: 'inside', xAxisIndex: [0, 1], start: 40, end: 70, top: 30, height: 20 }], xAxis: [{ type: 'category', data: dates, boundaryGap : false, axisLine: { lineStyle: { color: '#999' } }, axisLabel: { formatter: function (value) { return echarts.format.formatTime('yy-MM', value); } }, min: 'dataMin', max: 'dataMax', axisPointer: { show: true } }, { type: 'category', gridIndex: 1, data: dates, scale: true, boundaryGap : false, splitLine: {show: false}, axisLabel: {show: false}, axisTick: {show: false}, axisLine: { lineStyle: { color: '#fff' } }, splitNumber: 20, min: 'dataMin', max: 'dataMax', axisPointer: { type: 'shadow', label: {show: false}, triggerTooltip: true, handle: { show: true, margin: 30, color: '#B80C00' } } }], yAxis: [{ name: '均价(元/㎡)', nameRotate: 90, nameLocation: 'center', nameGap: 5, position: 'right', nameTextStyle: { color: '#999' }, scale: true, splitNumber: 2, axisLine: { lineStyle: { color: '#999' } }, splitLine: { show: true }, axisTick: { show: false }, axisLabel: { inside: true, formatter: '{value}\n' } }, { name: '成交量(套)', nameRotate: 90, nameLocation: 'center', nameGap: 5, position: 'right', nameTextStyle: { color: '#999' }, scale: true, gridIndex: 1, splitNumber: 2, axisLabel: {show: false}, axisLine: {show: false}, axisTick: {show: false}, splitLine: {show: false} }], grid: [{ left: 20, right: 20, top: 110, height: 120 }, { left: 20, right: 20, height: 40, top: 260 }], graphic: [{ type: 'group', left: 'center', top: 70, width: 300, bounding: 'raw' }], series: [ { type: 'candlestick', name: '均价', data: data, itemStyle: { normal: { color: '#ff4500', color0: '#22ac38', borderColor: '#ff4500', borderColor0: '#22ac38' }, emphasis: { color: 'black', color0: '#444', borderColor: 'black', borderColor0: '#444' } } }] }; */ $("#trendDiv2 a").click(function(){ $("#trendDiv2 a").removeClass("active") $(this).addClass("active") //var v = $(this).attr("t-v"); loadRentTrends(city, region, name); }); /* 小区租金走势 */ function loadRentTrends(city, region, name){ var type = $("#trendDiv2 a.active").attr("t-v") axios.get("/rest/trend/distRentTrends", { params: { city: city, region:region, name:name, type:type } }).then(function (response) { var re = response.data.data var categories = new Array(); var series = new Array(); var m = re.times; var pm = re.distMap var rooms = re.rooms; if(m && rooms.length>0){ for(var i=0;i