let lang = 'null';
var annotations = [];
$( document ).ready(function() {
/*------------------------ CONSTANT & VARIALBLE ------------------------*/
var G_SIDO_CD = null;
var G_SIDO_NM = null;
var G_SIG_CD = null;
var G_SIG_NM = null;
var G_CURRENT_YEAR = '2019';
var G_CURRENT_DATE = '2019-03';
var G_ISOPEN_TSERIES = false;
var L_BOUNDARY_SIDO = 'tl_scco_ctprvn_201904';
var L_BOUNDARY_SIG = 'tl_scco_sig_201904';
var L_STATS_SIG = 'land_estateopen_stats_sig';
var L_ESTATEOPEN_POI = 'land_estateopen_poi';
var L_APTHOUSE_POI = 'land_apthouse_poi';
var D_START_DATE = new Date('2000-01-01T00:00:00');
var D_END_DATE = new Date('2019-03-01T00:01:00');
var D_ESTATE_POLICY = [];
//colorbrew2
//var D_MONTH_COLOR = ['a6cee3','1f78b4','b2df8a','33a02c','fb9a99','e31a1c','fdbf6f','ff7f00','cab2d6','6a3d9a','ffff99','b15928'];
var D_MONTH_COLOR = ['a6cee3','1f78b4','8eb26e','33a02c','fb9a99','e31a1c','fdbf6f','ff7f00','cab2d6','6a3d9a','cccc7a','b15928'];
/*------------------------------ 버튼 이벤트 ------------------------------*/
/**
* 제목 버튼 클릭시 페이지 로딩
*/
$('#pg-btn-reload').on('click', function(e) {
location.reload();
});
$('.pg-btn-menuitem').on('click', function(e) {
$('.pg-btn-menuitem').removeClass('btn-success');
$('.pg-btn-analysis-tool').click();
if ($(this).data('id') == 'estateopen') {
olLayer.boundary.sigStatsRaster.setVisible(false);
olLayer.boundary.sigVector.setVisible(false);
olInteraction.sigStatsVectorHover.setActive(false);
olInteraction.sigStatsVectorClick.setActive(false);
olInteraction.sigStatsVectorHover.getFeatures().clear();
//POI 추가
$('#pg-overlay-layer-item1').prop('checked', true);
olLayer.poi.estateopenRaster.setVisible(true);
// UI show
$('#pg-boundary-select-cover').show();
$('#estateAnalysisTool').show();
$(this).addClass('btn-success');
// event listener on
map.on('click', handleIdentifyPOIInfo);
getLegend('estateopen');
}
if ($(this).data('id') == 'trading') {
GetFunctionLog('est', '부동산 개업으로 보는 핫이슈 지역은 어디?', '기초지자체별 추세 조회', '');
// event listener off
map.un('click', handleIdentifyPOIInfo);
console.log('trading');
// 시도/시군구 선택 취소
$('#pg-btn-sido-select').find("option:eq(0)").prop("selected", true);
$("#pg-btn-sido-select").change();
olLayer.boundary.sigStatsRaster.setVisible(true);
olLayer.boundary.sigVector.setVisible(true);
olInteraction.sigStatsVectorHover.setActive(true);
olInteraction.sigStatsVectorClick.setActive(true);
//POI 제거
$('#pg-overlay-layer-item1').prop('checked', false);
$('#pg-overlay-layer-item2').prop('checked', false);
olLayer.poi.estateopenRaster.setVisible(false);
olLayer.poi.estateopenRaster.setVisible(false);
// UI hide
$('#pg-boundary-select-cover').hide();
$('#estateAnalysisTool').hide();
$(this).addClass('btn-success');
if (G_ISOPEN_TSERIES) {
getLegend('trading', 'land_estateopen_stats_sig_month');
} else {
getLegend('trading', 'land_estateopen_stats_sig_all');
}
}
});
/**
* 기획의도 모달창 - 하루동안보지않기
*/
$('#pg-readme-modal-1day').on('click', function(e) {
var date = new Date();
date.setTime(date.getTime() + 1*24*60*60*1000);
document.cookie='estateopenReadmeOpen=false;expires=' + date.toUTCString() + ';path=/';
});
$('.pg-btn-embed-modal-open').on('click', function(e) {
$('#pg-readme-modal').modal('hide');
$('#pg-embed-modal').modal('show');
});
/**
* 배경지도 레이어 스위치
*/
$('.pg-basemap-item').on('click', function(e) {
var id = e.currentTarget.value;
var array = map.getLayerGroup().getLayers().getArray();
for (var i in array) {
if (array[i].get('id') == 'baseGroup') {
array = array[i].getLayers().getArray();
for (var j in array) {
if (array[j].get('id') == id) {
array[j].setVisible(true);
} else {
array[j].setVisible(false);
}
}
break;
}
}
});
/**
* 포인트 레이어 스위치
*/
$('.pg-overlay-layer-item').change(function(e) {
var id = e.currentTarget.value;
if(id == 'ESTATEOPEN') {
olLayer.poi.estateopenRaster.setVisible(!olLayer.poi.estateopenRaster.getVisible());
}
if(id == 'APTHOUSE') {
olLayer.poi.apthouseRaster.setVisible(!olLayer.poi.apthouseRaster.getVisible());
}
});
$('#pg-legend .expand').on('click', function(e) {
$('#pg-legend .card-body').toggle();
});
function getLegend(layerType, style) {
$('#pg-legend').show();
$('#pg-legend > .card-body').empty();
if (layerType == 'estateopen') {
$('#pg-legend > .card-body').append('
부동산중개업체
'
+ '
');
$('#pg-legend > .card-body').append('공동주택
'
+ '
');
} else if (layerType == 'trading') {
$('#pg-legend > .card-body').append('기초지자체별 개업수
'
+ '
');
} else {
$('#pg-legend').hide();
}
}
getLegend('estateopen');
/**
* 슬라이더 바 움직이기
*/
$('.pg-btn-pre').on('click', function(e) {
var sliderCurrentValue = $('#pg-slider-bar').slider('option', 'value');
var month = new Date(sliderCurrentValue).getMonth();
var preValue = new Date(sliderCurrentValue).setMonth(month-1);
$('#pg-slider-bar').slider('value', preValue);
});
$('.pg-btn-next').on('click', function(e) {
var sliderCurrentValue = $('#pg-slider-bar').slider('option', 'value');
var month = new Date(sliderCurrentValue).getMonth();
var nextValue = new Date(sliderCurrentValue).setMonth(month+1);
$('#pg-slider-bar').slider('value', nextValue);
});
/**
* 날짜선택 및 전체보기 활성화 버튼
*/
$('.pg-btn-timeseries').on('click', function(e) {
// 최근 데이터 기준 슬라이드바 초기화
var date = new Date(D_END_DATE);
G_CURRENT_YEAR = date.getFullYear();
G_CURRENT_DATE = getYMFormat(date);
if ( G_ISOPEN_TSERIES ) { // 슬라이더바 끄기, 누적년도 통계
// 슬라이더 바 조절 버튼 숨김
$('#pg-timseries-btn').hide();
// 측정도구
$('#estateAnalysisTool').show();
// UI 기본 설정
$('.pg-timeseries-cover').hide();
$('.pg-btn-timeseries').html("날짜선택
슬라이드 보기");
$('.pg-timseries-policy .card-body').empty();
$('.pg-timseries-policy').hide();
// 시도 선택확인
if (G_SIG_CD == null) {
getSigRankingByYear();
} else {
getSigRankingBySig(null, G_SIG_CD);
}
$("#pg-slider-bar").slider('value', date.getTime());
$('.pg-timseries-now .card-body > h3').empty();
$('.pg-timseries-now .card-body > h3').html('현재 ' + G_CURRENT_DATE);
olLayer.poi.estateopenRaster.getSource().refresh();
olLayer.poi.estateopenRaster.getSource().updateParams({
'CQL_FILTER': G_SIG_CD == null ? null : 'sgg_code = ' + G_SIG_CD,
'STYLES': null,
'ENV': null
});
olLayer.boundary.sigStatsRaster.getSource().refresh();
olLayer.boundary.sigStatsRaster.getSource().updateParams({
'LAYERS': 'pinogio:' + L_STATS_SIG,
'STYLES': L_STATS_SIG + '_all'
});
if ($('.pg-btn-menuitem[data-id=trading]').hasClass('btn-success')) {
getLegend('trading', 'land_estateopen_stats_sig_all');
} else {
getLegend('estateopen');
}
G_ISOPEN_TSERIES = false;
} else { // 슬라이더바 켜기, 선택년도 통계
GetFunctionLog('est', '부동산 개업으로 보는 핫이슈 지역은 어디?', '연도별 조회', '');
// 슬라이더 바 조절 버튼 보이기
$('#pg-timseries-btn').show();
// 측정도구
$('#estateAnalysisTool').hide();
$('.pg-btn-analysis-tool').click();
// UI 기본 설정
$('.pg-timeseries-cover').show();
$('.pg-btn-timeseries').html('2000~2019
전체보기');
// 시도 선택확인
if (G_SIG_CD == null) {
olLayer.poi.estateopenRaster.getSource().refresh();
olLayer.poi.estateopenRaster.getSource().updateParams({
'CQL_FILTER': 'date_cd BETWEEN ' + G_CURRENT_DATE + '-01' +' AND ' + G_CURRENT_DATE + '-31',
'STYLES': 'poi_env',
'ENV': 'color:' + getMonthColor(date)
});
getSigRankingByYear(G_CURRENT_YEAR);
} else {
olLayer.poi.estateopenRaster.getSource().refresh();
olLayer.poi.estateopenRaster.getSource().updateParams({
'CQL_FILTER': 'date_cd BETWEEN ' + G_CURRENT_DATE + '-01' +' AND ' + G_CURRENT_DATE + '-31' + ' AND sgg_code =' + G_SIG_CD,
'STYLES': 'poi_env',
'ENV': 'color:' + getMonthColor(date)
});
getSigRankingBySig(G_CURRENT_YEAR, G_SIG_CD)
}
var envparam = 'p1:MONTH;p2:MONTH;p3:MONTH;p4:MONTH;p5:MONTH;p6:MONTH;p7:MONTH;p8:MONTH';
var month = getYMColFormat(date);
olLayer.boundary.sigStatsRaster.getSource().refresh();
olLayer.boundary.sigStatsRaster.getSource().updateParams({
'LAYERS': 'pinogio:' + L_STATS_SIG,
'STYLES': L_STATS_SIG + '_month',
'ENV': envparam.split('MONTH').join(month)
});
if ($('.pg-btn-menuitem[data-id=trading]').hasClass('btn-success')) {
getLegend('trading', 'land_estateopen_stats_sig_month');
} else {
getLegend('estateopen');
}
G_ISOPEN_TSERIES = true;
}
});
/**
* 공간조회 툴 버튼 이벤트
*/
$('.pg-btn-analysis-tool').on('click', function(e) {
var drawType = e.currentTarget.value;
$('.analysisResultDiv').hide();
// 초기화 draw vector, interaction, analysisvector
olLayer.draw.analysisVector.getSource().clear();
map.removeInteraction(olInteraction.draw.analysisDraw);
olLayer.highlight.analysisVector.getSource().clear();
if (drawType == 'Polygon' || drawType == 'Circle') {
olInteraction.draw.analysisDraw = new ol.interaction.Draw({
source: olLayer.draw.analysisVector.getSource(),
type: drawType
});
map.addInteraction(olInteraction.draw.analysisDraw);
olInteraction.draw.analysisDraw.on('drawend', function(e) {
var geometry = e.feature.getGeometry();
var area = null;
var radius = null;
if (drawType == 'Polygon') {
area = geometry.getArea();
if (geometry.getArea() > 50000000) {
olLayer.draw.analysisVector.getSource().clear();
map.removeInteraction(olInteraction.draw.analysisDraw);
olLayer.highlight.analysisVector.getSource().clear();
alert('범위가 너무 넓습니다.');
return;
}
} else if (drawType == 'Circle') {
radius = geometry.getRadius();
if (radius > 5000) {
olLayer.draw.analysisVector.getSource().clear();
map.removeInteraction(olInteraction.draw.analysisDraw);
olLayer.highlight.analysisVector.getSource().clear();
alert('범위가 너무 넓습니다.');
return;
}
}
var formatGML = new ol.format.GML({
featureNS: 'http://pngos.io/',
featureType: 'pinogio',
srsName: 'EPSG:3857'
});
//var formatGML = new ol.format.GML();
var geometry = drawType == 'Circle' ? ol.geom.Polygon.fromCircle(e.feature.getGeometry()) : e.feature.getGeometry();
var getFeatureRequest = new ol.format.WFS().writeGetFeature({
srsName: 'EPSG:3857',
featureNS: 'http://pngos.io/',
featurePrefix: 'pinogio',
featureTypes: [ L_ESTATEOPEN_POI, L_APTHOUSE_POI ],
outputFormat: 'json',
filter: ol.format.filter.intersects('geom', geometry, 'EPSG:3857')
});
var xmlStr = new XMLSerializer().serializeToString(getFeatureRequest);
$.ajax({
type: 'POST',
url: PROXY_URL + GISSERVER_URL,
contentType: 'text/xml',
data: xmlStr,
success:function(res) {
GetFunctionLog('est', '부동산 개업으로 보는 핫이슈 지역은 어디?', '사용자 정의 범위 부동산중개업체 개업 순위 조회', '');
map.removeInteraction(olInteraction.draw.analysisDraw);
olLayer.highlight.analysisVector.getSource().clear();
olLayer.highlight.analysisVector.getSource().addFeatures((new ol.format.GeoJSON()).readFeatures(res));
var eCnt = 0;
var aCnt = 0;
var features = res.features;
for (var i in features) {
if (features[i].id.split('.')[0] == L_ESTATEOPEN_POI) {
eCnt++;
}
if (features[i].id.split('.')[0] == L_APTHOUSE_POI) {
aCnt++;
}
}
$('.analysisResultDiv .estateCnt').html(eCnt + '개소');
$('.analysisResultDiv .apthouseCnt').html(aCnt + '개소');
if (drawType == 'Polygon') {
var toArea = area > 1000000 ? (area/1000000).toFixed(2) + 'km2' : area.toFixed(0) + 'm2';
$('.analysisResultDiv .desc').html('※ 면적 : 약 ' + toArea);
}
if (drawType == 'Circle') {
var toRadius = radius > 1000 ? (radius/100).toFixed(2) + 'km' : radius.toFixed(0) + 'm';
$('.analysisResultDiv .desc').html('※ 반경 : 약 ' + toRadius);
}
$('.analysisResultDiv').show();
}
});
});
} else {
}
});
/*------------------------------ OL OBJECT -----------------------------*/
/**
* 공통 스타일
*/
var olStyle = {
whiteStroke: new ol.style.Style({
stroke: new ol.style.Stroke({
color: [255,255,255,1],
width: 1
})
}),
blackStroke: new ol.style.Style({
stroke: new ol.style.Stroke({
color: [0,0,0,1],
width: 1
})
}),
selectHover: new ol.style.Style({
stroke: new ol.style.Stroke({
color: [255,255,255,1],
width: 4
})
}),
selectClick: new ol.style.Style({
stroke: new ol.style.Stroke({
color: [0,0,0,1],
width: 2
})
})
};
/**
* 레이어
*/
olLayer = {
overlay: {
identify: new ol.Overlay({
element: document.getElementById("pg-identify-popup"),
autoPan: true,
autoPanAnimation: {
duration: 250
}
})
},
highlight: {
analysisVector: new ol.layer.Vector({
visible: true,
renderMode : 'vector',
opacity: 1,
zIndex: 99,
style: function(feature) {
// 부동산중개업소 포인트
if (feature.getId().split('.')[0] == L_ESTATEOPEN_POI) {
return [
new ol.style.Style({
image: new ol.style.Circle({
radius: 6,
stroke: new ol.style.Stroke({
color: '#000',
width: 2
}),
fill: new ol.style.Fill({
color: '#ff0000'
})
})
})
]
}
// 공동주택 포인트
if (feature.getId().split('.')[0] == L_APTHOUSE_POI) {
return [
new ol.style.Style({
image: new ol.style.Circle({
radius: 6,
stroke: new ol.style.Stroke({
color: '#000',
width: 2
}),
fill: new ol.style.Fill({
color: '#ffff00'
})
})
})
]
}
},
source: new ol.source.Vector({
format: new ol.format.GeoJSON()
})
})
},
draw: {
analysisVector: new ol.layer.Vector({
visible: true,
source: new ol.source.Vector({
wrapX: false
})
})
},
boundary: {
sidoRaster: new ol.layer.Tile({
title: '시도 경계',
visible: false,
opacity: .8,
zIndex: 99,
source: new ol.source.TileWMS({
url: GISSERVER_URL,
params: {
VERSION: '1.3.0',
FORMAT: 'image/png',
TRANSPARENT: 'true',
LAYERS: 'pinogio:tl_scco_ctprvn_201904',
tiled: 'true'
}
})
}),
sidoVector: new ol.layer.Vector({
title: '시도 영역',
renderMode : 'vector',
visible: false,
opacity: 0,
zIndex: 99,
source : new ol.source.Vector({
url : PROXY_URL + GISSERVER_URL
+ '?service=WFS&version=1.1.0&request=GetFeature&outputFormat=application/json'
+ '&typeName=pinogio:tl_scco_ctprvn_201904_s',
format : new ol.format.GeoJSON()
}),
style: olStyle.blackStroke
}),
sigRaster: new ol.layer.Tile({
title: '시군구 경계',
visible: true,
opacity: .8,
source: new ol.source.TileWMS({
url: GISSERVER_URL,
params: {
VERSION: '1.3.0',
FORMAT: 'image/png',
TRANSPARENT: 'true',
LAYERS: 'pinogio:tl_scco_sig_201904',
tiled: 'true'
}
})
}),
sigVector: new ol.layer.Vector({
title: '시군구 영역',
renderMode : 'vector',
visible: true,
opacity: 0,
source : new ol.source.Vector({
url : PROXY_URL + GISSERVER_URL
+ '?service=WFS&version=1.0.0&request=GetFeature&outputFormat=application/json'
+ '&typeName=pinogio:tl_scco_sig_201904_s',
format : new ol.format.GeoJSON()
}),
style: function(feature) {
if (feature.getProperties().sido_cd == G_SIDO_CD) {
return [
olStyle.whiteStroke
]
}
}
}),
sigStatsRaster: new ol.layer.Tile({
title: '기초지자체별 추세',
visible: false,
opacity: .9,
source: new ol.source.TileWMS({
url: GISSERVER_URL,
params: {
VERSION: '1.3.0',
FORMAT: 'image/png',
TRANSPARENT: 'true',
LAYERS: 'pinogio:land_estateopen_stats_sig',
STYLES: 'land_estateopen_stats_sig_all',
tiled: 'true'
}
})
})
},
poi: {
estateopenRaster: new ol.layer.Tile({
title: '부동산중개업체 POI',
visible: false,
opacity: 1,
source: new ol.source.TileWMS({
url: GISSERVER_URL,
params: {
VERSION: '1.3.0',
FORMAT: 'image/png',
TRANSPARENT: 'true',
LAYERS: 'pinogio:' + L_ESTATEOPEN_POI,
TILED: true
}
})
}),
apthouseRaster: new ol.layer.Tile({
title: '공동주택 POI',
visible: false,
opacity: .8,
source: new ol.source.TileWMS({
url: GISSERVER_URL,
params: {
VERSION: '1.3.0',
FORMAT: 'image/png',
TRANSPARENT: 'true',
LAYERS: 'pinogio:' + L_APTHOUSE_POI,
tiled: 'true'
}
})
})
}
};
olInteraction = {
draw: {
analysisDraw: null
},
sigStatsVectorHover: new ol.interaction.Select({
condition: ol.events.condition.pointerMove,
layers: [ olLayer.boundary.sigVector ],
style: olStyle.selectHover
}),
sigStatsVectorClick: new ol.interaction.Select({
condition: ol.events.condition.click,
layers: [ olLayer.boundary.sigVector ],
style: olStyle.selectClick
}),
};
olInteraction.sigStatsVectorClick.on('select', function(e) {
var features = e.selected;
if (features.length > 0) {
var sigCd = features[0].getProperties().sig_cd;
var sigNm = features[0].getProperties().sig_kor_nm;
e.target.getFeatures().clear();
var sidoNm = '';
$('#pg-btn-sido-select option').each(function(){
if (this.value == sigCd.toString().substr(0,2)) {
sidoNm = this.text;
}
});
$('#pg-trading-modal .modal-title').html(sidoNm + ' ' + sigNm);
$('#pg-trading-modal .sidoAndSigNm').html(sidoNm + ' ' + sigNm);
$('#pg-trading-modal').modal('show');
$.ajax({
url: CONTEXT_PATH + '/api/estate/sigEstateOpenAndTrading.json',
dataType: 'json',
data: {
sigCd: sigCd
},
success:function(res) {
console.log(res);
try {
var labels = res.data.LABEL;
for (var i in labels) {
labels[i] = labels[i].substring(1,5) + '년 ' + labels[i].substring(5,7) + '월'
}
var chartData = {
//labels: ['m200001', 'm200002', 'm200003', 'm200004', 'm200005', 'm200006', 'm200007', 'm200008', 'm200009', 'm200010', 'm200011', 'm200012', 'm200101', 'm200102', 'm200103', 'm200104', 'm200105', 'm200106', 'm200107', 'm200108', 'm200109', 'm200110', 'm200111', 'm200112', 'm200201', 'm200202', 'm200203', 'm200204', 'm200205', 'm200206', 'm200207', 'm200208', 'm200209', 'm200210', 'm200211', 'm200212', 'm200301', 'm200302', 'm200303', 'm200304', 'm200305', 'm200306', 'm200307', 'm200308', 'm200309', 'm200310', 'm200311', 'm200312', 'm200401', 'm200402', 'm200403', 'm200404', 'm200405', 'm200406', 'm200407', 'm200408', 'm200409', 'm200410', 'm200411', 'm200412', 'm200501', 'm200502', 'm200503', 'm200504', 'm200505', 'm200506', 'm200507', 'm200508', 'm200509', 'm200510', 'm200511', 'm200512', 'm200601', 'm200602', 'm200603', 'm200604', 'm200605', 'm200606', 'm200607', 'm200608', 'm200609', 'm200610', 'm200611', 'm200612', 'm200701', 'm200702', 'm200703', 'm200704', 'm200705', 'm200706', 'm200707', 'm200708', 'm200709', 'm200710', 'm200711', 'm200712', 'm200801', 'm200802', 'm200803', 'm200804', 'm200805', 'm200806', 'm200807', 'm200808', 'm200809', 'm200810', 'm200811', 'm200812', 'm200901', 'm200902', 'm200903', 'm200904', 'm200905', 'm200906', 'm200907', 'm200908', 'm200909', 'm200910', 'm200911', 'm200912', 'm201001', 'm201002', 'm201003', 'm201004', 'm201005', 'm201006', 'm201007', 'm201008', 'm201009', 'm201010', 'm201011', 'm201012', 'm201101', 'm201102', 'm201103', 'm201104', 'm201105', 'm201106', 'm201107', 'm201108', 'm201109', 'm201110', 'm201111', 'm201112', 'm201201', 'm201202', 'm201203', 'm201204', 'm201205', 'm201206', 'm201207', 'm201208', 'm201209', 'm201210', 'm201211', 'm201212', 'm201301', 'm201302', 'm201303', 'm201304', 'm201305', 'm201306', 'm201307', 'm201308', 'm201309', 'm201310', 'm201311', 'm201312', 'm201401', 'm201402', 'm201403', 'm201404', 'm201405', 'm201406', 'm201407', 'm201408', 'm201409', 'm201410', 'm201411', 'm201412', 'm201501', 'm201502', 'm201503', 'm201504', 'm201505', 'm201506', 'm201507', 'm201508', 'm201509', 'm201510', 'm201511', 'm201512', 'm201601', 'm201602', 'm201603', 'm201604', 'm201605', 'm201606', 'm201607', 'm201608', 'm201609', 'm201610', 'm201611', 'm201612', 'm201701', 'm201702', 'm201703', 'm201704', 'm201705', 'm201706', 'm201707', 'm201708', 'm201709', 'm201710', 'm201711', 'm201712', 'm201801', 'm201802', 'm201803', 'm201804', 'm201805', 'm201806', 'm201807', 'm201808', 'm201809', 'm201810', 'm201811', 'm201812', 'm201901', 'm201902', 'm201903'],
//labels: ['2000년 01월', '2000년 02월', '2000년 03월', '2000년 04월', '2000년 05월', '2000년 06월', '2000년 07월', '2000년 08월', '2000년 09월', '2000년 10월', '2000년 11월', '2000년 12월', '2001년 01월', '2001년 02월', '2001년 03월', '2001년 04월', '2001년 05월', '2001년 06월', '2001년 07월', '2001년 08월', '2001년 09월', '2001년 10월', '2001년 11월', '2001년 12월', '2002년 01월', '2002년 02월', '2002년 03월', '2002년 04월', '2002년 05월', '2002년 06월', '2002년 07월', '2002년 08월', '2002년 09월', '2002년 10월', '2002년 11월', '2002년 12월', '2003년 01월', '2003년 02월', '2003년 03월', '2003년 04월', '2003년 05월', '2003년 06월', '2003년 07월', '2003년 08월', '2003년 09월', '2003년 10월', '2003년 11월', '2003년 12월', '2004년 01월', '2004년 02월', '2004년 03월', '2004년 04월', '2004년 05월', '2004년 06월', '2004년 07월', '2004년 08월', '2004년 09월', '2004년 10월', '2004년 11월', '2004년 12월', '2005년 01월', '2005년 02월', '2005년 03월', '2005년 04월', '2005년 05월', '2005년 06월', '2005년 07월', '2005년 08월', '2005년 09월', '2005년 10월', '2005년 11월', '2005년 12월', '2006년 01월', '2006년 02월', '2006년 03월', '2006년 04월', '2006년 05월', '2006년 06월', '2006년 07월', '2006년 08월', '2006년 09월', '2006년 10월', '2006년 11월', '2006년 12월', '2007년 01월', '2007년 02월', '2007년 03월', '2007년 04월', '2007년 05월', '2007년 06월', '2007년 07월', '2007년 08월', '2007년 09월', '2007년 10월', '2007년 11월', '2007년 12월', '2008년 01월', '2008년 02월', '2008년 03월', '2008년 04월', '2008년 05월', '2008년 06월', '2008년 07월', '2008년 08월', '2008년 09월', '2008년 10월', '2008년 11월', '2008년 12월', '2009년 01월', '2009년 02월', '2009년 03월', '2009년 04월', '2009년 05월', '2009년 06월', '2009년 07월', '2009년 08월', '2009년 09월', '2009년 10월', '2009년 11월', '2009년 12월', '2010년 01월', '2010년 02월', '2010년 03월', '2010년 04월', '2010년 05월', '2010년 06월', '2010년 07월', '2010년 08월', '2010년 09월', '2010년 10월', '2010년 11월', '2010년 12월', '2011년 01월', '2011년 02월', '2011년 03월', '2011년 04월', '2011년 05월', '2011년 06월', '2011년 07월', '2011년 08월', '2011년 09월', '2011년 10월', '2011년 11월', '2011년 12월', '2012년 01월', '2012년 02월', '2012년 03월', '2012년 04월', '2012년 05월', '2012년 06월', '2012년 07월', '2012년 08월', '2012년 09월', '2012년 10월', '2012년 11월', '2012년 12월', '2013년 01월', '2013년 02월', '2013년 03월', '2013년 04월', '2013년 05월', '2013년 06월', '2013년 07월', '2013년 08월', '2013년 09월', '2013년 10월', '2013년 11월', '2013년 12월', '2014년 01월', '2014년 02월', '2014년 03월', '2014년 04월', '2014년 05월', '2014년 06월', '2014년 07월', '2014년 08월', '2014년 09월', '2014년 10월', '2014년 11월', '2014년 12월', '2015년 01월', '2015년 02월', '2015년 03월', '2015년 04월', '2015년 05월', '2015년 06월', '2015년 07월', '2015년 08월', '2015년 09월', '2015년 10월', '2015년 11월', '2015년 12월', '2016년 01월', '2016년 02월', '2016년 03월', '2016년 04월', '2016년 05월', '2016년 06월', '2016년 07월', '2016년 08월', '2016년 09월', '2016년 10월', '2016년 11월', '2016년 12월', '2017년 01월', '2017년 02월', '2017년 03월', '2017년 04월', '2017년 05월', '2017년 06월', '2017년 07월', '2017년 08월', '2017년 09월', '2017년 10월', '2017년 11월', '2017년 12월', '2018년 01월', '2018년 02월', '2018년 03월', '2018년 04월', '2018년 05월', '2018년 06월', '2018년 07월', '2018년 08월', '2018년 09월', '2018년 10월', '2018년 11월', '2018년 12월', '2019년 01월', '2019년 02월', '2019년 03월'],
labels: res.data.LABEL,
datasets: [{
type: 'line',
label: '부동산중개업체 개업 건수',
backgroundColor: window.chartColors.red,
borderColor: window.chartColors.red,
borderWidth: 2,
fill: false,
yAxisID: 'y-axis-1',
data: res.data.ESTATEOPEN
//data: [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 0, 0, 1, 1, 0, 0, 0, 2, 3, 2, 1, 1, 1, 2, 0, 1, 0, 1, 0, 0, 2, 1, 0, 1, 1, 2, 0, 1, 5, 2, 0, 0, 1, 3, 0, 2, 1, 1, 0, 1, 4, 3, 0, 1, 3, 3, 5, 2, 2, 0, 3, 0, 0, 1, 1, 0, 3, 6, 2, 3, 1, 2, 0, 1, 2, 0, 0, 3, 0, 2, 0, 4, 1, 2, 2, 1, 0, 1, 2, 1, 5, 3, 5, 2, 3, 1, 3, 0, 1, 1, 1, 7, 8, 1, 2, 4, 2, 3, 0, 1, 0, 1, 0, 2, 4, 2, 4, 1, 5, 6, 1, 0, 0, 1, 0, 3, 0, 2, 2, 2, 3, 3, 0, 4, 2, 0, 2, 3, 6, 6, 2, 4, 2, 2, 2, 2, 2, 1, 4, 1, 0, 0, 2, 4, 5, 1, 4, 3, 5, 0, 1, 1, 2, 4, 4, 2, 5, 9, 2, 3, 10, 6, 6, 7, 7, 10, 5, 13, 7, 4, 3, 11, 5, 3, 9, 1, 10, 10, 10, 13, 6, 3, 8, 11, 11, 6, 5, 7, 6, 12, 10, 1]
}, {
type: 'bar',
label: '아파트 매매거래 건수',
backgroundColor: window.chartColors.yellow,
borderColor: window.chartColors.yellow,
borderWidth: 2,
yAxisID: 'y-axis-2',
data: res.data.TRADING
//data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 138, 203, 218, 217, 245, 169, 204, 350, 354, 560, 431, 193, 175, 185, 169, 203, 109, 110, 78, 71, 136, 120, 107, 86, 81, 129, 162, 143, 128, 141, 109, 88, 141, 72, 36, 42, 67, 99, 128, 127, 135, 146, 157, 173, 192, 104, 96, 74, 99, 104, 117, 91, 74, 101, 88, 82, 134, 144, 135, 108, 178, 200, 159, 138, 140, 140, 108, 120, 161, 158, 171, 43, 83, 118, 123, 106, 87, 110, 80, 62, 118, 143, 315, 47, 68, 88, 124, 143, 214, 72, 77, 110, 503, 157, 400, 105, 162, 207, 206, 161, 141, 127, 119, 173, 250, 190, 216, 121, 138, 234, 273, 219, 234, 238, 157, 169, 185, 186, 174, 159, 224, 151, 156, 202, 178, 195, 176, 150, 181, 180, 151, 86, 144, 157, 164, 208, 154, 161, 202, 166, 146, 179, 190, 151, 84, 159, 141, 131, 140, 128, 148, 127, 206, 174, 100, 233, 123, 181]
}]
};
if (window.myMixedChart != undefined) {
window.myMixedChart.destroy();
}
var ctx = document.getElementById('pg-trading-modal.chart').getContext('2d');
window.myMixedChart = new Chart(ctx, {
type: 'bar',
data: chartData,
options: {
responsive: true,
maintainAspectRatio: false,
title: {
display: false,
position: 'top',
text: sigNm
},
tooltips: {
mode: 'index',
intersect: true
},
layout: {
padding: {
top: 30,
bottom: 100,
left: 0,
right: 0
}
},
legend: {
display: false,
position: 'bottom'
},
scales:{
xAxes: [{
ticks: {
autoSkip: false,
minRotation: 90
}
}],
yAxes: [{
type: 'linear',
display: true,
position: 'left',
label: '',
id: 'y-axis-1',
gridLines: {
drawOnChartArea: false
},
scaleLabel: {
display: true,
labelString: '부동산중개업체 개업 건수'
}
},{
type: 'linear',
display: true,
position: 'right',
id: 'y-axis-2',
gridLines: {
drawOnChartArea: false
},
scaleLabel: {
display: true,
labelString: '아파트 매매거래 건수'
}
}]
},
annotation: {
events: ['mouseenter', 'mouseleave'],
annotations: annotations
}
}
});
} catch (e) {
}
}
});
}
});
var map = new ol.Map({
target : 'pg-mapview',
layers : [
BASEMAP_GROUP,
olLayer.boundary.sidoRaster,
olLayer.boundary.sidoVector,
olLayer.boundary.sigRaster,
olLayer.boundary.sigVector,
olLayer.poi.estateopenRaster,
olLayer.poi.apthouseRaster,
olLayer.draw.analysisVector,
olLayer.highlight.analysisVector,
olLayer.boundary.sigStatsRaster
],
controls: ol.control.defaults({attribution: false}).extend([
new ol.control.Attribution({
collapsible: false
})
]),
interactions: ol.interaction.defaults({
doubleClickZoom: false,
mouseWheelZoom: true,
dragPan: true,
pinchZoom: true
}).extend([
]),
view : new ol.View({
center : ol.proj.transform([ 128.0292, 36.6332 ], 'EPSG:4326', 'EPSG:3857'),
zoom : 7,
enableRotation: false
})
});
$('#pg-mapview').data('map', map);
var map = $('#pg-mapview').data('map');
olLayer.boundary.sidoRaster.setVisible(false);
olLayer.boundary.sidoVector.setVisible(true);
olLayer.boundary.sigRaster.setVisible(false);
olLayer.boundary.sigVector.setVisible(true);
olLayer.poi.estateopenRaster.setVisible(true);
olLayer.poi.apthouseRaster.setVisible(false);
// 기초지자체별 추세
olLayer.boundary.sigStatsRaster.setVisible(false);
map.addInteraction(olInteraction.sigStatsVectorHover);
map.addInteraction(olInteraction.sigStatsVectorClick);
olInteraction.sigStatsVectorHover.setActive(false);
olInteraction.sigStatsVectorClick.setActive(false);
/*var identifyOverlay = new ol.Overlay({
element: document.getElementById("pg-identify-popup"),
autoPan: true,
autoPanAnimation: {
duration: 250
}
});*/
map.addOverlay(olLayer.overlay.identify);
map.on('click', handleIdentifyPOIInfo);
function handleIdentifyPOIInfo(evt) {
var estateFeatureInfoURL = olLayer.poi.estateopenRaster.getSource().getGetFeatureInfoUrl(
evt.coordinate,
map.getView().getResolution(),
map.getView().getProjection(),
{
'INFO_FORMAT': 'application/json',
'STYLES': '',
'LAYERS': L_ESTATEOPEN_POI,
'QUERY_LAYERS': L_ESTATEOPEN_POI
}
);
$.ajax({
url: PROXY_URL + estateFeatureInfoURL,
async: true
}).done(function (jsonData) {
if (jsonData.features.length > 0) {
var content = document.getElementById('pg-identify-popup-content');
var feature = new ol.format.GeoJSON().readFeature(jsonData.features[0]);
olLayer.highlight.analysisVector.getSource().clear();
if (feature != null) {
$('#pg-identify-popup-closer').click();
var prop = feature.getProperties();
olLayer.highlight.analysisVector.getSource().addFeature(feature);
var element = olLayer.overlay.identify.getElement();
var coordinate = [feature.getGeometry().getExtent()[2], feature.getGeometry().getExtent()[3]];
var result = '' +
'' +
'- ' +
'부동산중개업체' +
'
' +
'- ' +
'개업 연월일' +
'' + prop.date_cd.substr(0,10) +' ' +
'
' +
'
';
result = handleIdentifyApthouseInfo(evt.coordinate, result, true);
content.innerHTML = result;
olLayer.overlay.identify.setPosition(coordinate);
} else {
handleIdentifyApthouseInfo(evt.coordinate, '', false);
// $('#pg-identify-popup-closer').click();
}
} else {
handleIdentifyApthouseInfo(evt.coordinate, '', false);
// olLayer.highlight.analysisVector.getSource().clear();
// $('#pg-identify-popup-closer').click();
}
});
}
function handleIdentifyApthouseInfo(coordinate, result, estateFeature) {
var info = result;
var checked = $('#pg-overlay-layer-item2').prop('checked');
if (checked) {
var apthouseFeatureInfoURL = olLayer.poi.apthouseRaster.getSource().getGetFeatureInfoUrl(
coordinate,
map.getView().getResolution(),
map.getView().getProjection(),
{
'INFO_FORMAT': 'application/json',
'STYLES': '',
'LAYERS': L_APTHOUSE_POI,
'QUERY_LAYERS': L_APTHOUSE_POI
}
);
$.ajax({
url: PROXY_URL + apthouseFeatureInfoURL,
async: false
}).done(function (jsonData) {
if (jsonData.features.length > 0) {
var feature = new ol.format.GeoJSON().readFeature(jsonData.features[0]);
if (feature != null) {
var prop = feature.getProperties();
info += '' +
'- ' +
'공동주택' +
'
' +
'- ' +
'사용승인일' +
'' + prop.use_aprv_y.substr(0,4) + '-' + prop.use_aprv_y.substr(4,2) + '-' + prop.use_aprv_y.substr(6,2) +' ' +
'
' +
'
';
if (!estateFeature) {
olLayer.highlight.analysisVector.getSource().clear();
var content = document.getElementById('pg-identify-popup-content');
olLayer.highlight.analysisVector.getSource().addFeature(feature);
var element = olLayer.overlay.identify.getElement();
var coordinate = [feature.getGeometry().getExtent()[2], feature.getGeometry().getExtent()[3]];
content.innerHTML = info;
olLayer.overlay.identify.setPosition(coordinate);
}
} else {
if (!estateFeature) {
$('#pg-identify-popup-closer').click();
}
}
} else {
if (!estateFeature) {
olLayer.highlight.analysisVector.getSource().clear();
$('#pg-identify-popup-closer').click();
}
}
});
} else {
if (!estateFeature) {
olLayer.highlight.analysisVector.getSource().clear();
$('#pg-identify-popup-closer').click();
}
}
return info;
}
/**
* 팝업창 닫기 이벤트
*/
$('#pg-identify-popup-closer').on('click', function(e){
olLayer.overlay.identify.setPosition(undefined);
document.getElementById("pg-identify-popup-closer").blur();
$('#pg-identify-popup').css('left', '-50px');
$('#pg-identify-popup').css('top', 'unset');
return false;
});
var reqSidoList = function() {
$.ajax({
url: CONTEXT_PATH + '/api/ctprvnList.json',
success:function(res) {
try {
for (i = 0; i < res.data.length; i++) {
$('#pg-btn-sido-select').append(
''
);
}
//olLayer.boundary.sidoVector.setVisible(false);
//olLayer.boundary.sigVector.setVisible(false);
} catch (e) {
alert('동기화되지 못한 데이터가 있습니다.')
}
}
});
}
reqSidoList();
/**
* 시도 선택박스 변경 이벤트
*/
$("#pg-btn-sido-select").on('change', function(e) { // 시도 선택박스 변경 이벤트
GetFunctionLog('est', '부동산 개업으로 보는 핫이슈 지역은 어디?', '부동산중개업체 개업 순위 조회', '');
sidoCd = e.currentTarget.value;
sidoNm = $("#pg-btn-sido-select :selected").text();
G_SIDO_CD = (sidoCd=='' ? null : sidoCd);
G_SIDO_NM = sidoNm;
G_SIG_CD = null;
G_SIG_NM = null;
$("#estateRankingSigYear").show();
$("#estateRankingSigYearUD").hide();
olLayer.poi.estateopenRaster.getSource().refresh();
if ( G_ISOPEN_TSERIES ) {
olLayer.poi.estateopenRaster.getSource().updateParams({
'CQL_FILTER': 'date_cd BETWEEN ' + G_CURRENT_DATE + '-01' +' AND ' + G_CURRENT_DATE + '-31'
});
getSigRankingByYear(G_CURRENT_YEAR);
} else {
olLayer.poi.estateopenRaster.getSource().updateParams({
'CQL_FILTER': null, 'ENV': null, 'STYLES': null
});
}
if (G_SIDO_CD == null) {
olLayer.boundary.sidoRaster.getSource().updateParams({
'CQL_FILTER': null
});
olLayer.boundary.sigRaster.getSource().updateParams({
'CQL_FILTER': null
});
olLayer.boundary.sidoRaster.setVisible(false);
olLayer.boundary.sigRaster.setVisible(false);
map.getView().fit( olLayer.boundary.sidoVector.getSource().getExtent(), map.getSize() );
$('#pg-btn-sig-select').empty();
$('#pg-btn-sig-select').append('');
} else {
olLayer.boundary.sidoRaster.getSource().updateParams({
'CQL_FILTER': "ctprvn_cd = '"+ sidoCd +"'"
});
olLayer.boundary.sidoRaster.setVisible(true);
olLayer.boundary.sigRaster.setVisible(false);
var features = olLayer.boundary.sidoVector.getSource().getFeatures();
for (i = 0; i < features.length; i++) {
if (features[i].getProperties().ctprvn_cd == sidoCd) {
map.getView().fit(features[i].getGeometry().getExtent(), map.getSize());
$.ajax({
url: CONTEXT_PATH + '/api/sigList.json',
method: 'get',
data: {
ctprvnCd: sidoCd
},
success:function(res) {
try {
$('#pg-btn-sig-select').empty();
$('#pg-btn-sig-select').append('');
for (i = 0; i < res.data.length; i++) {
$('#pg-btn-sig-select').append(
''
);
}
if (sigRankingClicked) {
var currIdx = 0;
$("#pg-btn-sig-select option").each(function(idx, item){
if (sigRankingSigCd == item.value) {
currIdx = idx;
}
});
$('#pg-btn-sig-select').find("option:eq("+ currIdx +")").prop("selected", true);
$("#pg-btn-sig-select").change();
sigRankingClicked = false;
sigRankingSigCd = null;
console.log('e');
}
} catch (e) {
}
}
});
break;
}
}
}
});
/**
* 시군구 선택박스 변경 이벤트
*/
$("#pg-btn-sig-select").on('change', function(e) { // 시도 선택박스 변경 이벤트
GetFunctionLog('est', '부동산 개업으로 보는 핫이슈 지역은 어디?', '부동산중개업체 개업 순위 조회', '');
sigCd = e.target.value;
G_SIG_CD = (sigCd=='' ? null : sigCd);
G_SIG_NM = $('#pg-btn-sig-select :selected').text();
if (G_SIG_CD == null) {
$("#pg-btn-sido-select").change();
} else {
if ( G_ISOPEN_TSERIES ) {
getSigRankingBySig(G_CURRENT_YEAR, G_SIG_CD);
olLayer.poi.estateopenRaster.getSource().updateParams({
'CQL_FILTER': G_SIG_CD == null ? null : 'date_cd BETWEEN ' + G_CURRENT_DATE + '-01' +' AND ' + G_CURRENT_DATE + '-31' + ' AND sgg_code =' + G_SIG_CD
});
} else {
getSigRankingBySig(null, G_SIG_CD);
olLayer.poi.estateopenRaster.getSource().updateParams({
'CQL_FILTER': G_SIG_CD == null ? null : 'sgg_code = ' + G_SIG_CD,
'ENV': null, 'STYLES': null
});
}
olLayer.poi.estateopenRaster.getSource().refresh();
var features = olLayer.boundary.sigVector.getSource().getFeatures();
for (var i in features) {
if (features[i].getProperties().sig_cd == sigCd) {
map.getView().fit( features[i].getGeometry().getExtent(), map.getSize() );
olLayer.boundary.sigRaster.getSource().updateParams({
'CQL_FILTER': "sig_cd = '"+ sigCd +"'"
});
olLayer.boundary.sidoRaster.setVisible(true);
olLayer.boundary.sigRaster.setVisible(true);
}
}
}
});
/**
* 부동산중개업체 개업순위 - 종합 or 년도 선택
*/
function getSigRankingByYear(year) {
$.ajax({
url: CONTEXT_PATH + '/api/estate/sigRankingByYear.json',
method: 'get',
dataType: 'json',
data: {
year: year==null ? '' : year,
limit: 10
},
success:function(res) {
try {
var datas = res.data;
$('#estateRankingSigYear .year').empty();
if (year == null) {
$('#estateRankingSigYear .year').html('2000~2019');
} else {
$('#estateRankingSigYear .year').html(year);
}
var tbody = $('#estateRankingSigYear > .card-body table tbody');
tbody.empty();
for (var i in datas) {
tbody.append(
'' +
'| '+ datas[i].rank +' | ' +
''+ datas[i].sig_kor_nm +' | ' +
''+ numeral(datas[i].cnt).format('0,0') +' | ' +
''+ numeral(datas[i].trading).format('0,0') +' | ' +
'
'
);
}
$("#estateRankingSigYear").show();
$("#estateRankingSigYearUD").hide();
} catch (e) {
}
}
});
}
getSigRankingByYear();
// 선택 시군구기준(상,하위) 부동산중개업체 개업순위
function getSigRankingBySig(year, sigCd) {
$.ajax({
url: CONTEXT_PATH + '/api/estate/sigRankingByYearAndSig.json',
method: 'get',
dataType: 'json',
data: {
year: year==null ? '' : year,
sigCd: sigCd,
limit: 5
},
success:function(res) {
try {
var datas = res.data;
var tbody = $('#estateRankingSigYearUD > .card-body table tbody');
tbody.empty();
for (var i in datas) {
if (sigCd == datas[i].sgg_cd) {
$('#estateRankingSigYearUD .sig').html( datas[i].sig_kor_nm );
$('#estateRankingSigYearUD .year').html( year == null ? '2000~2019' : year );
$('#estateRankingSigYearUD .rank').html( datas[i].rank );
tbody.append(
'' +
'| '+ datas[i].rank +' | ' +
''+ datas[i].sig_kor_nm +' | ' +
''+ numeral(datas[i].val).format('0,0') +' | ' +
''+ numeral(datas[i].trading).format('0,0') +' | ' +
'
'
);
} else {
tbody.append(
'' +
'| '+ datas[i].rank +' | ' +
''+ datas[i].sig_kor_nm +' | ' +
''+ numeral(datas[i].val).format('0,0') +' | ' +
''+ numeral(datas[i].trading).format('0,0') +' | ' +
'
'
);
}
}
$("#estateRankingSigYear").hide();
$("#estateRankingSigYearUD").show();
} catch (e) {
}
}
});
}
/**
* 부동산정책 목록 2003년 ~ 2018년
*/
function getEstatePolicy() {
$.ajax({
url: CONTEXT_PATH + '/api/estate/listEstatePolicy.json',
method: 'get',
success:function(res) {
try {
D_ESTATE_POLICY = res.data;
annotations = [];
for (var i in D_ESTATE_POLICY) {
var date = D_ESTATE_POLICY[i].d_date;
annotations.push({
type: "box",
//drawTime: "beforeDatasetsDraw",
drawTime: "afterDraw",
xScaleID: "x-axis-0",
xMin: dateCalc(date, 0, 'm'),
xMax: dateCalc(date, 1, 'm'),
backgroundColor: 'rgb(54, 162, 235, 0.1)',
borderColor: 'rgb(54, 162, 235, 0.1)',//window.chartColors.blue,
borderWidth: 2,
label: {
enabled: true,
content: D_ESTATE_POLICY[i].measures
},
onMouseenter: function(e) {
console.log($(this)[0].options.label.content);
console.log($('#pg-trading-modal .modal-content .chart-cover').scrollLeft() + e.screenX - 100);
$('#estatePolicyTooltip').css({
top: e.screenY / 2,
left: $('#pg-trading-modal .modal-content .chart-cover').scrollLeft() + e.screenX - 100
});
$('#estatePolicyTooltip').html($(this)[0].options.label.content);
$('#estatePolicyTooltip').show();
},
onMouseleave: function(e) {
console.log('annoOnMouseleave');
$('#estatePolicyTooltip').empty();
$('#estatePolicyTooltip').hide();
}
})
}
} catch (e) {
}
}
});
}
getEstatePolicy();
var years = [];
var startYear = D_START_DATE.getFullYear();
var endYear = D_END_DATE.getFullYear();
while (endYear >= startYear) {
years.push(startYear);
startYear += 1;
}
/**
* 슬라이드바 설정 및 이벤트
*/
$("#pg-slider-bar").slider({
range: false,
min: D_START_DATE.getTime(),
max: D_END_DATE.getTime(),
step: 86400001,
value: D_END_DATE.getTime(),
slide: function (e, ui) {
var date = new Date(ui.value);
$('.pg-timseries-now .card-body > h3').empty();
$('.pg-timseries-now .card-body > h3').html('현재 ' + getYMFormat(date));
var policy = D_ESTATE_POLICY.filter(function(e) {
return e.d_year == date.getFullYear() && e.d_month == (date.getMonth()+1)
});
$('.pg-timseries-policy .card-body').empty();
if (policy.length > 0) {
for (var i in policy) {
$('.pg-timseries-policy .card-body').append('- ' + policy[i].measures + '
');
}
$('.pg-timseries-policy').show();
} else {
$('.pg-timseries-policy').hide();
}
},
change: function (e, ui) {
GetFunctionLog('est', '부동산 개업으로 보는 핫이슈 지역은 어디?', '연도별 조회', '');
$(this).slider('option', 'slide').call($(this), e, ui);
$(this).slider('option', 'stop').call($(this), e, ui);
},
stop: function( e, ui ) {
var date = new Date(ui.value);
G_CURRENT_YEAR = date.getFullYear();
G_CURRENT_DATE = getYMFormat(date);
if (G_SIG_CD == null) {
olLayer.poi.estateopenRaster.getSource().refresh();
olLayer.poi.estateopenRaster.getSource().updateParams({
'CQL_FILTER': 'date_cd BETWEEN ' + G_CURRENT_DATE + '-01' +' AND ' + G_CURRENT_DATE + '-31',
'STYLES': 'poi_env',
'ENV': 'color:' + getMonthColor(date)
});
getSigRankingByYear(G_CURRENT_YEAR);
} else {
olLayer.poi.estateopenRaster.getSource().refresh();
olLayer.poi.estateopenRaster.getSource().updateParams({
'CQL_FILTER': 'date_cd BETWEEN ' + G_CURRENT_DATE + '-01' +' AND ' + G_CURRENT_DATE + '-31' + ' AND sgg_code =' + G_SIG_CD,
'STYLES': 'poi_env',
'ENV': 'color:' + getMonthColor(date)
});
getSigRankingBySig(G_CURRENT_YEAR, G_SIG_CD);
}
var envparam = 'p1:MONTH;p2:MONTH;p3:MONTH;p4:MONTH;p5:MONTH;p6:MONTH;p7:MONTH;p8:MONTH';
var month = getYMColFormat(date);
//olLayer.boundary.sigStatsRaster.getSource().refresh();
olLayer.boundary.sigStatsRaster.getSource().updateParams({
'LAYERS': 'pinogio:' + L_STATS_SIG,
'STYLES': L_STATS_SIG + '_month',
'ENV': envparam.split('MONTH').join(month)
});
}
})
.slider('pips', {
last: false,
rest: 'label',
// labels: years,
step: 366,
});
$('.ui-slider-label').each(function(index) {
$(this).text(years[index]);
});
function getYMFormat(date) {
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = (m.toString().length > 1 ? m : '0'+ m);
return y + '-' + m;
}
function getYMColFormat(date) {
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = (m.toString().length > 1 ? m : '0'+ m);
return 'm' + y + m;
}
function dateCalc(date, nNum, type) {
try {
var yy = parseInt(date.substr(0, 4), 10);
var mm = parseInt(date.substr(5, 2), 10);
var dd = parseInt(date.substr(8), 10);
if (type == "d") {
d = new Date(yy, mm - 1, dd + nNum);
}
else if (type == "m") {
d = new Date(yy, mm - 1, dd + (nNum * 31));
}
else if (type == "y") {
d = new Date(yy + nNum, mm - 1, dd);
}
yy = d.getFullYear();
mm = d.getMonth() + 1; mm = (mm < 10) ? '0' + mm : mm;
dd = d.getDate(); dd = (dd < 10) ? '0' + dd : dd;
return yy + '년 ' + mm + '월';
} catch (e) {
console.log(e);
}
}
/**
* 월별 색상 설정
*/
function getMonthColor(date) {
try {
var monthIndex = date.getMonth();
return D_MONTH_COLOR[monthIndex]
} catch (e) {
return D_MONTH_COLOR[0]
}
}
});