1138 lines
30 KiB
JavaScript
1138 lines
30 KiB
JavaScript
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 curOption;
|
|
var mapLoadCount = 0;
|
|
|
|
|
|
/* 关注&已关注切换 */
|
|
function doAddCollect(){
|
|
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
|
|
clicked('../user/codeSms.html',true,false,{},{},function(){
|
|
plus.webview.getWebviewById('views/user/userInfo.html').reload();
|
|
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
|
|
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
|
|
doAddCollect();
|
|
})
|
|
return;
|
|
} else {
|
|
addCollect();
|
|
}
|
|
}
|
|
|
|
function addCollect(){
|
|
axios.post("/rest/districts/addCollect",{city:city,region:region,name:name,lat:lat,lng:lng,address:address, poiTags:tags}).then(function (response) {
|
|
var msg = response.data.message
|
|
if(msg){
|
|
$.toast(msg);
|
|
}else{
|
|
$(".collection01").hide();
|
|
$(".collection02").show();
|
|
$.toast("随时掌握小区动态");
|
|
plus.webview.getWebviewById('views/user/userInfo.html').reload();
|
|
}
|
|
|
|
})
|
|
.catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
}
|
|
|
|
$(".collection02").on("click", function () {
|
|
removeCollect();
|
|
});
|
|
|
|
function doRemoveCollect(){
|
|
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
|
|
clicked('../user/codeSms.html',true,false,{},{},function(){
|
|
doRemoveCollect();
|
|
plus.webview.getWebviewById('views/user/userInfo.html').reload();
|
|
})
|
|
return;
|
|
} else {
|
|
removeCollect();
|
|
}
|
|
}
|
|
|
|
function removeCollect(){
|
|
axios.post("/rest/districts/removeCollect",{city:city,region:region,name:name}).then(function (response) {
|
|
var msg = response.data.message
|
|
if(msg){
|
|
$.toast(msg);
|
|
}else{
|
|
$(".collection02").hide();
|
|
$(".collection01").show();
|
|
$.toast("取消关注");
|
|
}
|
|
plus.webview.getWebviewById('views/user/userInfo.html').reload();
|
|
plus.webview.getWebviewById('yfindex.html').reload();
|
|
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
|
|
})
|
|
.catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
}
|
|
|
|
|
|
/* 图表切换 */
|
|
function lineChart() {
|
|
mode = "kLine"
|
|
$(".icon-chart01a").hide();
|
|
$(".icon-chart01").show();
|
|
$("#chart01a").css("z-index","-1");
|
|
$("#chart01").css("z-index","1");
|
|
loadKLineData(city, region, name);
|
|
}
|
|
function kLineChart() {
|
|
mode = "line"
|
|
$(".icon-chart01").hide();
|
|
$(".icon-chart01a").show();
|
|
$("#chart01").css("z-index","-1");
|
|
$("#chart01a").css("z-index","1");
|
|
|
|
};
|
|
|
|
/* button状态切换 */
|
|
/*$("#trendTabDiv .button").on("click", function () {
|
|
$(this).parent().children().removeClass("active");
|
|
$(this).addClass("active");
|
|
});
|
|
*/
|
|
/* 图表切换 */
|
|
/*$("#tabAvgDiv").on("click", function () {
|
|
$("#tabChart1").css("z-index","1");
|
|
$("#tabChart2").css("z-index","-1");
|
|
});
|
|
$("#tabRentDiv").on("click", function () {
|
|
$("#tabChart2").css("z-index","1");
|
|
$("#tabChart1").css("z-index","-1");
|
|
});*/
|
|
|
|
/*var t1 = window.setInterval(loadMap,1000);
|
|
function loadMap(){
|
|
mapLoadCount++;
|
|
if(lng && lat){
|
|
loadMapPoi();
|
|
$("#mapDiv").show();
|
|
window.clearInterval(t1);
|
|
}else{
|
|
if(mapLoadCount == 10){
|
|
$("#mapDiv").hide();
|
|
window.clearInterval(t1);
|
|
}else{
|
|
$("#mapDiv").hide();
|
|
}
|
|
}
|
|
}*/
|
|
function showLoadRentTrends(type) {
|
|
if(type == 3) {
|
|
document.getElementById("trendDivTab3").setAttribute("class","tab-link button active");
|
|
document.getElementById("trendDivTab2").setAttribute("class","tab-link button");
|
|
} else {
|
|
document.getElementById("trendDivTab3").setAttribute("class","tab-link button");
|
|
document.getElementById("trendDivTab2").setAttribute("class","tab-link button active");
|
|
}
|
|
|
|
loadRentTrends(city, region, name,type);
|
|
}
|
|
|
|
//小区详情
|
|
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){
|
|
$(".collection02").show();
|
|
$(".collection01").hide();
|
|
}else{
|
|
$(".collection02").hide();
|
|
$(".collection01").show();
|
|
}
|
|
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.name = 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;
|
|
}
|
|
}
|
|
|
|
var starScore = response.data.data.starScore
|
|
if(starScore && starScore > 0){
|
|
var regionIndex = response.data.data.regionIndex
|
|
var districtPoiCount = response.data.data.districtPoiCount
|
|
|
|
var schoolIndex = response.data.data.schoolIndex
|
|
var arroundIndex = response.data.data.arroundIndex
|
|
|
|
var indexs = []
|
|
indexs.push(vo.index);
|
|
indexs.push(regionIndex);
|
|
indexs.push(schoolIndex);
|
|
indexs.push(arroundIndex);
|
|
|
|
/* 小区评级 */
|
|
loadDistrictLevel(indexs);
|
|
}else{
|
|
$("#distLevelDiv").hide()
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
$("#noDataDiv").show()
|
|
baseInfo.name = "小区详情"
|
|
}
|
|
}
|
|
|
|
}).catch(function (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) {
|
|
console.log(error);
|
|
});
|
|
}*/
|
|
|
|
|
|
|
|
|
|
function loadKLineData(city, region, name){
|
|
var type = $("#trendDiv1 a.active").attr("t-v");
|
|
axios.get("/rest/trend/kData", {
|
|
params: {
|
|
city: city,
|
|
region:region,
|
|
name:name,
|
|
type: type
|
|
}
|
|
}).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]);
|
|
}
|
|
|
|
option01.xAxis[0].data = times
|
|
option01.xAxis[1].data = times
|
|
//option01.series[0].data = counts
|
|
option01.series[0].data = trends
|
|
curOption = option01;
|
|
|
|
var myChart01 = echarts.init(document.getElementById('chart01'));
|
|
myChart01.setOption(option01,true);
|
|
|
|
}
|
|
}).catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
}
|
|
|
|
|
|
function showTrends(v){
|
|
if(v == "36"){
|
|
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
|
|
clicked('../user/codeSms.html',true,false,{},{},function(){
|
|
showTrends(v);
|
|
plus.webview.getWebviewById('views/user/userInfo.html').reload();
|
|
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
|
|
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
|
|
})
|
|
return;
|
|
} else {
|
|
$("#trendDiv1 a").removeClass("active")
|
|
$("a[t-v='36']").addClass("active")
|
|
//curOption.dataZoom[0].start = 0
|
|
loadKLineData(city, region, name)
|
|
}
|
|
}else{
|
|
$("#trendDiv1 a").removeClass("active")
|
|
//myChart01.setOption(curOption,true);
|
|
if(v == 12){
|
|
$("a[t-v='12']").addClass("active")
|
|
}else{
|
|
$("a[t-v='6']").addClass("active")
|
|
}
|
|
loadKLineData(city, region, name)
|
|
}
|
|
|
|
}
|
|
|
|
|
|
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 += '<br/> 月初 : ' + params[0].value[1];
|
|
res += '<br/> 月末 : ' + params[0].value[2];
|
|
res += '<br/> 最低 : ' + params[0].value[3];
|
|
res += '<br/> 最高 : ' + 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: 1,
|
|
end: 99,
|
|
top: 5,
|
|
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: 'line',
|
|
lineStyle: {
|
|
color: '#fff',
|
|
width: 1,
|
|
type: 'solid'
|
|
},
|
|
label: {show: false},
|
|
triggerTooltip: true,
|
|
handle: {
|
|
show: true,
|
|
margin: -70,
|
|
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: 60,
|
|
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: '#F18D00',
|
|
color0: '#666',
|
|
borderColor: '#F18D00',
|
|
borderColor0: '#666'
|
|
}
|
|
}
|
|
}]
|
|
};
|
|
|
|
|
|
/*$("#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, type){
|
|
|
|
if(type == undefined) type= 2;
|
|
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;
|
|
var estateType = re.estateType
|
|
|
|
if(m && rooms.length>0){
|
|
|
|
for(var i=0;i<m.length;i++){
|
|
categories.push(m[i]);
|
|
}
|
|
for(var k in rooms){
|
|
var room = rooms[k]
|
|
if(estateType && estateType.indexOf("别墅")>-1){
|
|
if(room > 8){
|
|
continue;
|
|
}
|
|
}else{
|
|
if(room > 5){
|
|
continue;
|
|
}
|
|
}
|
|
|
|
var distM = pm[room];
|
|
var distObj = new Object();
|
|
var distDatas = new Array();
|
|
|
|
for(var i=0;i<m.length;i++){
|
|
if(distM[m[i]] == undefined){
|
|
distDatas.push(null);
|
|
} else {
|
|
distDatas.push(distM[m[i]]);
|
|
}
|
|
}
|
|
distObj.name = room+"室"
|
|
distObj.data = distDatas;
|
|
distObj.type = 'line';
|
|
distObj.symbolSize = 0;
|
|
series.push(distObj);
|
|
//alert(distDatas);
|
|
}
|
|
//alert(categories);
|
|
|
|
//showRentChart(categories, series);
|
|
showRentChart2(categories, series);
|
|
}else{
|
|
//没数据
|
|
//$("#tabChart2").hide();
|
|
$("#trendDiv2").parent().parent().addClass("dn")
|
|
$("#chart02").addClass("dn")
|
|
$("#rentTrendDiv").addClass("dn")
|
|
}
|
|
}).catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
}
|
|
|
|
|
|
function showRentChart2(categories, series){
|
|
var option03 = {
|
|
tooltip: {
|
|
trigger: 'axis',
|
|
textStyle: {
|
|
fontFamily: 'arial,华文细黑',
|
|
fontSize: 12
|
|
}
|
|
},
|
|
grid:{
|
|
x: 54,
|
|
y: 10,
|
|
x2: 16,
|
|
y2: 60,
|
|
borderWidth: 1
|
|
},
|
|
color: ['#F88C9F', '#FFBF5C', '#AAD672', '#78CDE6', '#AE94E9'],
|
|
legend: {
|
|
y: 'bottom',
|
|
textStyle: {
|
|
fontFamily: '华文细黑',
|
|
fontWeight: 'bold'
|
|
},
|
|
itemWidth: 16,
|
|
itemHeight: 8
|
|
},
|
|
xAxis: {
|
|
type: 'category',
|
|
boundaryGap: false,
|
|
axisLine: {
|
|
lineStyle: {
|
|
color: '#ccc'
|
|
}
|
|
},
|
|
axisLabel: {
|
|
textStyle: {
|
|
fontFamily: 'arial',
|
|
color: '#666'
|
|
}
|
|
},
|
|
data: categories,
|
|
},
|
|
yAxis: {
|
|
type: 'value',
|
|
axisLine: {
|
|
lineStyle: {
|
|
color: '#ccc'
|
|
}
|
|
},
|
|
axisLabel: {
|
|
textStyle: {
|
|
fontFamily: 'arial',
|
|
color: '#666'
|
|
}
|
|
}
|
|
},
|
|
series:series
|
|
};
|
|
|
|
var myChart02 = echarts.init(document.getElementById('chart02'));
|
|
myChart02.setOption(option03,true);
|
|
}
|
|
|
|
/* 小区评级 */
|
|
function loadDistrictLevel(datas){
|
|
var option03 = {
|
|
tooltip: {
|
|
trigger: 'axis',
|
|
formatter: '{d} : {c}'
|
|
},
|
|
calculable: true,
|
|
radar: [
|
|
{
|
|
indicator: [
|
|
{text: '楼盘潜力评级', max: 100},
|
|
{text: '板块评级', max: 100},
|
|
{text: '教育评级', max: 100},
|
|
{text: '生活便利评级', max: 100},
|
|
],
|
|
radius: 70,
|
|
name: {
|
|
textStyle: {
|
|
color: '#333'
|
|
}
|
|
},
|
|
splitArea: {
|
|
areaStyle: {
|
|
color: ['rgba(136,208,83,0.20)',
|
|
'rgba(255,255,255,1)', 'rgba(136,208,83,0.20)',
|
|
'rgba(255,255,255,1)', 'rgba(136,208,83,0.20)'],
|
|
shadowColor: 'rgba(136,208,83,0.20)',
|
|
shadowBlur: 10
|
|
}
|
|
},
|
|
axisLine: {
|
|
lineStyle: {
|
|
color: 'rgba(136,208,83,0.50)'
|
|
}
|
|
},
|
|
splitLine: {
|
|
lineStyle: {
|
|
color: 'rgba(136,208,83,0.25)'
|
|
}
|
|
}
|
|
}
|
|
],
|
|
series: [
|
|
{
|
|
name: '',
|
|
type: 'radar',
|
|
itemStyle: {
|
|
normal: {
|
|
areaStyle: {
|
|
type: 'default'
|
|
},
|
|
color: 'rgba(136,208,83,0.9)'
|
|
}
|
|
},
|
|
data: [
|
|
{
|
|
name: '',
|
|
value: datas
|
|
}
|
|
]
|
|
}
|
|
]
|
|
};
|
|
var myChart03 = echarts.init(document.getElementById('chart03'));
|
|
myChart03.setOption(option03,true);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 小区均价分析 */
|
|
var colorList = ['#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622', '#bda29a', '#6e7074', '#546570', '#c4ccd3'];
|
|
var labelFont = 'bold 12px Sans-serif';
|
|
|
|
function calculateMA(dayCount, data) {
|
|
var result = [];
|
|
for (var i = 0, len = data.length; i < len; i++) {
|
|
if (i < dayCount) {
|
|
result.push('-');
|
|
continue;
|
|
}
|
|
var sum = 0;
|
|
for (var j = 0; j < dayCount; j++) {
|
|
sum += data[i - j][1];
|
|
}
|
|
result.push((sum / dayCount).toFixed(2));
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/*var dates = ["2017-03-29", "2017-03-30", "2017-03-31", "2017-04-01", "2017-04-04", "2017-04-05", "2017-04-06", "2017-04-07", "2017-04-08", "2017-04-11", "2017-04-12", "2017-04-13", "2017-04-14", "2017-04-15", "2017-04-18", "2017-04-19", "2017-04-20", "2017-04-21", "2017-04-22", "2017-04-25", "2017-04-26", "2017-04-27", "2017-04-28", "2017-04-29", "2017-05-02", "2017-05-03", "2017-05-04", "2017-05-05", "2017-05-06", "2017-05-09", "2017-05-10", "2017-05-11", "2017-05-12", "2017-05-13", "2017-05-16", "2017-05-17", "2017-05-18", "2017-05-19", "2017-05-20", "2017-05-23", "2017-05-24", "2017-05-25", "2017-05-26", "2017-05-27", "2017-05-31", "2017-06-01", "2017-06-02", "2017-06-03", "2017-06-06", "2017-06-07", "2017-06-08", "2017-06-09", "2017-06-10", "2017-06-13", "2017-06-14", "2017-06-15", "2017-06-16", "2017-06-17", "2017-06-20", "2017-06-21", "2017-06-22"];
|
|
var data = [[17512.58,17633.11,17434.27,17642.81,86160000],[17652.36,17716.66,17652.36,17790.11,79330000],[17716.05,17685.09,17669.72,17755.7,102600000],[17661.74,17792.75,17568.02,17811.48,104890000],[17799.39,17737,17710.67,17806.38,85230000],[17718.03,17603.32,17579.56,17718.03,115230000],[17605.45,17716.05,17542.54,17723.55,99410000],[17687.28,17541.96,17484.23,17687.28,90120000],[17555.39,17576.96,17528.16,17694.51,79990000],[17586.48,17556.41,17555.9,17731.63,107100000],[17571.34,17721.25,17553.57,17744.43,81020000],[17741.66,17908.28,17741.66,17918.35,91710000],[17912.25,17926.43,17885.44,17962.14,84510000],[17925.95,17897.46,17867.41,17937.65,118160000],[17890.2,18004.16,17848.22,18009.53,89390000],[18012.1,18053.6,17984.43,18103.46,89820000],[18059.49,18096.27,18031.21,18167.63,100210000],[18092.84,17982.52,17963.89,18107.29,102720000],[17985.05,18003.75,17909.89,18026.85,134120000],[17990.94,17977.24,17855.55,17990.94,83770000],[17987.38,17990.32,17934.17,18043.77,92570000],[17996.14,18041.55,17920.26,18084.66,109090000],[18023.88,17830.76,17796.55,18035.73,100920000],[17813.09,17773.64,17651.98,17814.83,136670000],[17783.78,17891.16,17773.71,17912.35,80100000],[17870.75,17750.91,17670.88,17870.75,97060000],[17735.02,17651.26,17609.01,17738.06,95020000],[17664.48,17660.71,17615.82,17736.11,81530000],[17650.3,17740.63,17580.38,17744.54,80020000],[17743.85,17705.91,17668.38,17783.16,85590000],[17726.66,17928.35,17726.66,17934.61,75790000],[17919.03,17711.12,17711.05,17919.03,87390000],[17711.12,17720.5,17625.38,17798.19,88560000],[17711.12,17535.32,17512.48,17734.74,86640000],[17531.76,17710.71,17531.76,17755.8,88440000],[17701.46,17529.98,17469.92,17701.46,103260000],[17501.28,17526.62,17418.21,17636.22,79120000],[17514.16,17435.4,17331.07,17514.16,95530000],[17437.32,17500.94,17437.32,17571.75,111990000],[17507.04,17492.93,17480.05,17550.7,87790000],[17525.19,17706.05,17525.19,17742.59,86480000],[17735.09,17851.51,17735.09,17891.71,79180000],[17859.52,17828.29,17803.82,17888.66,68940000],[17826.85,17873.22,17824.73,17873.22,73190000],[17891.5,17787.2,17724.03,17899.24,147390000],[17754.55,17789.67,17664.79,17809.18,78530000],[17789.05,17838.56,17703.55,17838.56,75560000],[17799.8,17807.06,17689.68,17833.17,82270000],[17825.69,17920.33,17822.81,17949.68,71870000],[17936.22,17938.28,17936.22,18003.23,78750000],[17931.91,18005.05,17931.91,18016,71260000],[17969.98,17985.19,17915.88,18005.22,69690000],[17938.82,17865.34,17812.34,17938.82,90540000],[17830.5,17732.48,17731.35,17893.28,101690000],[17710.77,17674.82,17595.79,17733.92,93740000],[17703.65,17640.17,17629.01,17762.96,94130000],[17602.23,17733.1,17471.29,17754.91,91950000],[17733.44,17675.16,17602.78,17733.44,248680000],[17736.87,17804.87,17736.87,17946.36,99380000],[17827.33,17829.73,17799.8,17877.84,85130000],[17832.67,17780.83,17770.36,17920.16,89440000]];
|
|
var volumes = [86160000,79330000,102600000,104890000,85230000,115230000,99410000,90120000,79990000,107100000,81020000,91710000,84510000,118160000,89390000,89820000,100210000,102720000,134120000,83770000,92570000,109090000,100920000,136670000,80100000,97060000,95020000,81530000,80020000,85590000,75790000,87390000,88560000,86640000,88440000,103260000,79120000,95530000,111990000,87790000,86480000,79180000,68940000,73190000,147390000,78530000,75560000,82270000,71870000,78750000,71260000,69690000,90540000,101690000,93740000,94130000,91950000,248680000,99380000,85130000,89440000];
|
|
|
|
var option01a = {
|
|
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: '#666',
|
|
backgroundColor: 'rgba(255,255,255,0.9)',
|
|
textStyle: {
|
|
fontSize: 12,
|
|
color: '#666'
|
|
},
|
|
formatter: function (params) {
|
|
var res = params[0].seriesName + ' ' + params[0].name;
|
|
res += '<br/>月初: ' + parseInt(params[0].value[1]) + '元/㎡';
|
|
res += '<br/>月末: ' + parseInt(params[0].value[2]) + '元/㎡';
|
|
res += '<br/>最低: ' + parseInt(params[0].value[3]) + '元/㎡';
|
|
res += '<br/>最高: ' + parseInt(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: 1,
|
|
end: 99,
|
|
top: 5,
|
|
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%'
|
|
}],
|
|
xAxis: [{
|
|
type: 'category',
|
|
data: dates,
|
|
boundaryGap: false,
|
|
axisLine: { lineStyle: { color: '#666' } },
|
|
axisLabel: {
|
|
formatter: function (value) {
|
|
return echarts.format.formatTime('yyyy-MM', value);
|
|
},
|
|
textStyle: {
|
|
fontFamily: 'Arial, Verdana, sans-serif',
|
|
color: '#666'
|
|
}
|
|
},
|
|
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: 'line',
|
|
lineStyle: {
|
|
color: '#fff',
|
|
width: 1,
|
|
type: 'solid'
|
|
},
|
|
label: {show: false},
|
|
triggerTooltip: true,
|
|
handle: {
|
|
show: true,
|
|
margin: -70,
|
|
color: '#F18D00'
|
|
}
|
|
}
|
|
}],
|
|
yAxis: [{
|
|
name: '',
|
|
nameRotate: 90,
|
|
nameLocation: 'center',
|
|
nameGap: 5,
|
|
position: 'right',
|
|
nameTextStyle: {
|
|
color: '#666'
|
|
},
|
|
scale: true,
|
|
splitNumber: 2,
|
|
axisLine: {lineStyle: { color: '#666' } },
|
|
splitLine: {show: true },
|
|
axisTick: {show: false },
|
|
axisLabel: {
|
|
inside: true,
|
|
formatter: '{value}\n',
|
|
textStyle: {
|
|
fontFamily: 'Arial, Verdana, sans-serif',
|
|
color: '#666'
|
|
}
|
|
}
|
|
}, {
|
|
show: false,
|
|
name: '',
|
|
nameRotate: 90,
|
|
nameLocation: 'center',
|
|
nameGap: 5,
|
|
position: 'right',
|
|
nameTextStyle: {
|
|
color: '#666'
|
|
},
|
|
scale: true,
|
|
gridIndex: 1,
|
|
splitNumber: 2,
|
|
axisLabel: {show: false},
|
|
axisLine: {show: false},
|
|
axisTick: {show: false},
|
|
splitLine: {show: false}
|
|
}],
|
|
grid: [{
|
|
left: 20,
|
|
right: 20,
|
|
top: 60,
|
|
height: 120
|
|
}, {
|
|
left: 20,
|
|
right: 20,
|
|
height: 40,
|
|
top: 260
|
|
}],
|
|
graphic: [{
|
|
type: 'group',
|
|
left: 'center',
|
|
top: 70,
|
|
width: 300,
|
|
bounding: 'raw'
|
|
}],
|
|
series: [{
|
|
name: '均价',
|
|
type: 'candlestick',
|
|
data: data,
|
|
itemStyle: {
|
|
normal: {
|
|
color: '#EB5F34',
|
|
color0: '#88D053',
|
|
borderColor: '#EB5F34',
|
|
borderColor0: '#88D053'
|
|
},
|
|
emphasis: {
|
|
color: '#F18D00',
|
|
color0: '#666',
|
|
borderColor: '#F18D00',
|
|
borderColor0: '#666'
|
|
}
|
|
}
|
|
}]
|
|
};
|
|
var myChart01a = echarts.init(document.getElementById('chart01'));
|
|
myChart01a.setOption(option01a,true);*/
|
|
|
|
|
|
|
|
//曲线图
|
|
function loadLineData(city, region, name){
|
|
var type = $("#trendDiv1 a.active").attr("t-v");
|
|
axios.get("/rest/trend/distTrends", {
|
|
params: {
|
|
city: city,
|
|
region:region,
|
|
name:name,
|
|
type: type
|
|
}
|
|
}).then(function (response) {
|
|
var distDatas = response.data.data.districtAvgZouShi
|
|
var times = response.data.data.timeKeys
|
|
if(times){
|
|
var districtTrends = [];
|
|
|
|
for(var d in times){
|
|
var t = times[d]
|
|
|
|
var distPrice = distDatas[t]
|
|
if(distPrice){
|
|
districtTrends.push(distPrice);
|
|
}else{
|
|
districtTrends.push(null);
|
|
}
|
|
}
|
|
|
|
//option01b.xAxis.data = times
|
|
//option01b.series.data = districtTrends
|
|
|
|
showLineChart(times, districtTrends);
|
|
|
|
|
|
|
|
}
|
|
}).catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
}
|
|
|
|
|
|
function showLineChart(times, datas){
|
|
var option01b = {
|
|
tooltip: {
|
|
triggerOn: 'none',
|
|
transitionDuration: 0,
|
|
confine: true,
|
|
bordeRadius: 4,
|
|
borderWidth: 1,
|
|
borderColor: '#666',
|
|
backgroundColor: 'rgba(255,255,255,0.9)',
|
|
textStyle: {
|
|
fontSize: 12,
|
|
color: '#666'
|
|
},
|
|
formatter: function (params) {
|
|
var res = params[0].seriesName + ' ' + params[0].name;
|
|
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;
|
|
}
|
|
},
|
|
grid:{
|
|
x: 20,
|
|
y: 10,
|
|
x2: 20,
|
|
y2: 60,
|
|
top: 60,
|
|
height: 120
|
|
},
|
|
color: ['#78CDE6'],
|
|
dataZoom: [{
|
|
realtime: false,
|
|
start: 1,
|
|
end: 99,
|
|
top: 5,
|
|
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%'
|
|
}],
|
|
xAxis: {
|
|
type: 'category',
|
|
boundaryGap: false,
|
|
axisLine: {
|
|
lineStyle: {
|
|
color: '#ccc'
|
|
}
|
|
},
|
|
axisLabel: {
|
|
textStyle: {
|
|
fontFamily: 'Arial, Verdana, sans-serif',
|
|
color: '#666'
|
|
}
|
|
},
|
|
axisPointer: {
|
|
type: 'line',
|
|
label: {show: false},
|
|
triggerTooltip: true,
|
|
handle: {
|
|
show: true,
|
|
margin: 50,
|
|
color: '#F18D00'
|
|
}
|
|
},
|
|
data: times,
|
|
},
|
|
yAxis: {
|
|
type: 'value',
|
|
scale: true,
|
|
position: 'right',
|
|
axisLine: {
|
|
lineStyle: {
|
|
color: '#ccc'
|
|
}
|
|
},
|
|
axisLabel: {
|
|
inside: true,
|
|
textStyle: {
|
|
fontFamily: 'Arial, Verdana, sans-serif',
|
|
color: '#666'
|
|
}
|
|
}
|
|
},
|
|
series: [
|
|
{
|
|
name: '',
|
|
type: 'line',
|
|
smooth: true,
|
|
symbol: 'none',
|
|
sampling: 'average',
|
|
areaStyle: {
|
|
normal: {
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
|
offset: 0,
|
|
color: '#78CDE6'
|
|
}, {
|
|
offset: 1,
|
|
color: '#fff'
|
|
}])
|
|
}
|
|
},
|
|
data: datas
|
|
}
|
|
]
|
|
};
|
|
var myChart01b = echarts.init(document.getElementById('chart01a'));
|
|
myChart01b.setOption(option01b,true);
|
|
}
|
|
|
|
|
|
|