728x90
작업 전, 정리하기
자바에서 2021_인구관련연간자료_20221006_45659.csv파일을 읽는다.읽은 파일의 내용 중 전출, 전입 코드 분석하여 split을 한 뒤 Class에 저장한다.생산자에 대입된 Class의 정보를 txt파일로 저장한다.저장된 txt파일을 읽은 뒤 차트 양식에 맞춰서 데이터를 수정한다.수정된 데이터에 원하는 정보 값(지역별 인구 이동 결과)을 얻기 위한 가공을 시작한다.가공된 정보를 차트 양식에 맞춰 txt 파일로 추출한다.- 추출한 값을 차트 양식에 대입한다
HeatMap Chart
function getPointCategoryName(point, dimension) {
var series = point.series,
isY = dimension === 'y',
axis = series[isY ? 'yAxis' : 'xAxis'];
return axis.categories[point[isY ? 'y' : 'x']];
}
Highcharts.chart('container', {
chart: {
type: 'heatmap',
marginTop: 40,
marginBottom: 80,
plotBorderWidth: 1
},
title: {
text: // 차트 제목
},
xAxis: {
categories: //X축 좌표 [ 'A', 'B' ,'C'] 형태로 값이 대입된다.
},
yAxis: {
categories: // Y축 좌표 [ 'A', 'B' ,'C'] 형태로 값이 대입된다.
title: null,
reversed: true
},
accessibility: {
point: {
descriptionFormatter: function (point) {
var ix = point.index + 1,
xName = getPointCategoryName(point, 'x'),
yName = getPointCategoryName(point, 'y'),
val = point.value;
return ix + '. ' + xName + ' sales ' + yName + ', ' + val + '.';
}
}
},
colorAxis: {
min: 0,
minColor: '#FFFFFF',
maxColor: Highcharts.getOptions().colors[0]
},
legend: {
align: 'right',
layout: 'vertical',
margin: 0,
verticalAlign: 'top',
y: 25,
symbolHeight: 280
},
tooltip: {
formatter: function () {
return '<b>' + getPointCategoryName(this.point, 'x') + '</b> sold <br><b>' +
this.point.value + '</b> items on <br><b>' + getPointCategoryName(this.point, 'y') + '</b>';
}
},
series: [{
name: // 표 이름
borderWidth: 1,
data: // 데이터가 들어가는 부분 [ [x, y, z] ] 형태로 값이 들어간다.
dataLabels: {
enabled: true,
color: '#000000'
}
}],
responsive: {
rules: [{
condition: {
maxWidth: 500
},
chartOptions: {
yAxis: {
labels: {
formatter: function () {
return this.value.charAt(0);
}
}
}
}
}]
}
});
추출 데이터 대입하기
function getPointCategoryName(point, dimension) {
var series = point.series,
isY = dimension === 'y',
axis = series[isY ? 'yAxis' : 'xAxis'];
return axis.categories[point[isY ? 'y' : 'x']];
}
Highcharts.chart('container', {
chart: {
type: 'heatmap',
marginTop: 40,
marginBottom: 80,
plotBorderWidth: 1
},
title: {
text: '지역별 전입 전출 데이터'
},
xAxis: {
categories: ['서울', '부산', '대구', '인천', '광주', '대전', '울산', '세종', '경기도', '강원도', '충청북도', '충청남도', '전라북도', '전라남도', '경상북도', '경상남도', '제주도']
},
yAxis: {
categories: ['서울', '부산', '대구', '인천', '광주', '대전', '울산', '세종', '경기도', '강원도', '충청북도', '충청남도', '전라북도', '전라남도', '경상북도', '경상남도', '제주도'],
title: null,
reversed: true
},
accessibility: {
point: {
descriptionFormatter: function (point) {
var ix = point.index + 1,
xName = getPointCategoryName(point, 'x'),
yName = getPointCategoryName(point, 'y'),
val = point.value;
return ix + '. ' + xName + ' sales ' + yName + ', ' + val + '.';
}
}
},
colorAxis: {
min: 0,
minColor: '#FFFFFF',
maxColor: Highcharts.getOptions().colors[0]
},
legend: {
align: 'right',
layout: 'vertical',
margin: 0,
verticalAlign: 'top',
y: 25,
symbolHeight: 280
},
tooltip: {
formatter: function () {
return '<b>' + getPointCategoryName(this.point, 'x') + '</b> sold <br><b>' +
this.point.value + '</b> items on <br><b>' + getPointCategoryName(this.point, 'y') + '</b>';
}
},
series: [{
name: 'every DDong',
borderWidth: 1,
data: [[11, 2, 1403] ,[11, 1, 1896] ,[11, 4, 1261] ,[11, 3, 5560] ,[16, 6, 413] ,[16, 5, 635] ,[1, 7, 700] ,[16, 7, 261] ,[1, 5, 1859] ,[10, 16, 675] ,[1, 6, 7878] ,[10, 14, 3310] ,[10, 15, 1508] ,[16, 9, 664] ,[16, 8, 6588] ,[16, 11, 894] ,[1, 12, 1238] ,[16, 10, 718] ,[1, 11, 2627] ,[16, 13, 1047] ,[1, 14, 8554] ,[16, 12, 846] ,[1, 13, 2678] ,[16, 15, 1497] ,[16, 14, 1054] ,[1, 15, 40113] ,[15, 16, 1643] ,[10, 10, 131580] ,[11, 0, 16964] ,[10, 11, 5607] ,[10, 12, 1586] ,[10, 13, 1052] ,[1, 8, 14358] ,[2, 0, 12774] ,[10, 8, 18670] ,[1, 10, 1746] ,[10, 9, 3706] ,[1, 9, 1759] ,[10, 7, 3589] ,[6, 16, 492] ,[16, 16, 57970] ,[15, 9, 2148] ,[1, 0, 18039] ,[15, 10, 2191] ,[15, 8, 16059] ,[15, 15, 255443] ,[15, 13, 3669] ,[15, 14, 8298] ,[10, 5, 7419] ,[15, 11, 3379] ,[10, 6, 593] ,[15, 12, 1833] ,[10, 4, 713] ,[7, 16, 200] ,[10, 1, 1355] ,[10, 2, 1354] ,[10, 3, 2889] ,[6, 10, 940] ,[6, 9, 814] ,[6, 12, 483] ,[6, 11, 1357] ,[6, 8, 5731] ,[15, 6, 5587] ,[15, 5, 2464] ,[1, 2, 4020] ,[6, 14, 7695] ,[1, 1, 292439] ,[6, 13, 773] ,[1, 4, 972] ,[1, 3, 2332] ,[6, 15, 6002] ,[15, 7, 732] ,[9, 16, 636] ,[7, 9, 444] ,[7, 8, 3873] ,[9, 13, 987] ,[9, 14, 2738] ,[9, 15, 1682] ,[6, 6, 84552] ,[7, 15, 449] ,[7, 14, 545] ,[7, 13, 396] ,[7, 12, 725] ,[6, 5, 716] ,[7, 11, 3843] ,[7, 10, 2973] ,[14, 16, 1038] ,[6, 7, 244] ,[15, 3, 2792] ,[9, 9, 129948] ,[10, 0, 12121] ,[15, 4, 1171] ,[9, 10, 3649] ,[15, 1, 39222] ,[9, 11, 2606] ,[15, 2, 6834] ,[9, 12, 1016] ,[9, 8, 22899] ,[7, 6, 142] ,[7, 5, 5105] ,[9, 7, 595] ,[7, 7, 25000] ,[5, 16, 670] ,[6, 4, 307] ,[14, 8, 18295] ,[6, 3, 866] ,[14, 9, 3045] ,[6, 2, 2434] ,[6, 1, 8416] ,[9, 6, 598] ,[14, 14, 196062] ,[14, 15, 7046] ,[14, 12, 1200] ,[14, 13, 1364] ,[15, 0, 15844] ,[14, 10, 3786] ,[9, 5, 1828] ,[14, 11, 3550] ,[9, 3, 3854] ,[9, 4, 585] ,[9, 1, 1496] ,[9, 2, 1205] ,[7, 3, 604] ,[5, 9, 1628] ,[7, 2, 361] ,[5, 8, 12980] ,[7, 1, 455] ,[5, 11, 12509] ,[6, 0, 6024] ,[5, 10, 7120] ,[14, 5, 3275] ,[14, 6, 5623] ,[4, 15, 994] ,[4, 14, 727] ,[5, 13, 1352] ,[5, 12, 3154] ,[5, 15, 1715] ,[7, 4, 358] ,[5, 14, 2453] ,[4, 9, 683] ,[4, 8, 8586] ,[8, 16, 7370] ,[14, 7, 810] ,[4, 13, 25773] ,[4, 12, 4429] ,[4, 11, 1624] ,[4, 10, 906] ,[8, 15, 10914] ,[8, 14, 14109] ,[8, 13, 10926] ,[8, 12, 11938] ,[14, 4, 666] ,[5, 6, 527] ,[5, 5, 120238] ,[7, 0, 3746] ,[13, 16, 944] ,[5, 7, 8373] ,[14, 2, 31740] ,[14, 3, 3064] ,[9, 0, 17014] ,[14, 1, 7977] ,[4, 16, 810] ,[8, 11, 29391] ,[8, 10, 18285] ,[8, 9, 23725] ,[8, 8, 1164252] ,[8, 7, 4416] ,[5, 3, 2084] ,[4, 3, 1679] ,[4, 2, 465] ,[5, 2, 1278] ,[4, 1, 992] ,[13, 8, 12694] ,[5, 4, 975] ,[5, 1, 1521] ,[4, 4, 124594] ,[13, 14, 1509] ,[13, 13, 147530] ,[13, 15, 3113] ,[3, 16, 1736] ,[13, 10, 1273] ,[13, 9, 1185] ,[8, 6, 3329] ,[13, 12, 4502] ,[14, 0, 14546] ,[8, 5, 10599] ,[13, 11, 2932] ,[8, 1, 9790] ,[8, 4, 6043] ,[8, 3, 50263] ,[8, 2, 7093] ,[5, 0, 12229] ,[13, 5, 1646] ,[4, 7, 577] ,[4, 6, 223] ,[13, 7, 549] ,[4, 5, 1195] ,[13, 6, 695] ,[0, 8, 248409] ,[0, 10, 11239] ,[0, 9, 17293] ,[13, 4, 27816] ,[0, 12, 10200] ,[13, 3, 2799] ,[0, 11, 16848] ,[0, 14, 11027] ,[0, 13, 9596] ,[3, 7, 753] ,[12, 16, 776] ,[3, 5, 2014] ,[0, 15, 10100] ,[13, 2, 735] ,[13, 1, 2600] ,[8, 0, 182995] ,[3, 6, 713] ,[0, 16, 7426] ,[3, 15, 2278] ,[3, 13, 2574] ,[3, 14, 2966] ,[12, 13, 4278] ,[3, 8, 50793] ,[12, 12, 154519] ,[12, 15, 1517] ,[12, 14, 1233] ,[12, 9, 1118] ,[3, 11, 6699] ,[12, 8, 14282] ,[3, 12, 2575] ,[4, 0, 9368] ,[3, 9, 4359] ,[12, 11, 5109] ,[13, 0, 11010] ,[3, 10, 3339] ,[12, 10, 1996] ,[2, 14, 37182] ,[2, 15, 6729] ,[2, 12, 784] ,[2, 13, 851] ,[0, 2, 7274] ,[0, 1, 11376] ,[0, 4, 6316] ,[0, 3, 33653] ,[12, 7, 1105] ,[3, 0, 28402] ,[12, 6, 468] ,[2, 10, 1916] ,[12, 5, 3726] ,[2, 11, 2145] ,[2, 8, 11760] ,[2, 9, 1514] ,[0, 5, 9650] ,[0, 6, 3600] ,[12, 3, 2752] ,[12, 2, 699] ,[0, 7, 4283] ,[12, 4, 4849] ,[3, 1, 1793] ,[3, 2, 1177] ,[11, 16, 858] ,[3, 3, 238183] ,[3, 4, 1217] ,[2, 16, 1098] ,[12, 1, 1136] ,[11, 15, 2419] ,[16, 0, 7272] ,[2, 1, 4441] ,[2, 4, 546] ,[2, 2, 179894] ,[2, 3, 1716] ,[11, 12, 4568] ,[11, 11, 162239] ,[11, 14, 2818] ,[1, 16, 2190] ,[11, 13, 2217] ,[11, 8, 29687] ,[12, 0, 12449] ,[11, 10, 5514] ,[11, 9, 2327] ,[0, 0, 809201] ,[2, 7, 622] ,[16, 1, 1964] ,[16, 3, 1433] ,[16, 2, 918] ,[16, 4, 769] ,[11, 7, 4391] ,[11, 5, 12593] ,[2, 5, 1896] ,[2, 6, 2460] ,[11, 6, 836]],
dataLabels: {
enabled: true,
color: '#000000'
}
}],
responsive: {
rules: [{
condition: {
maxWidth: 500
},
chartOptions: {
yAxis: {
labels: {
formatter: function () {
return this.value.charAt(0);
}
}
}
}
}]
}
});
데이터 차트화
반응형
'회고록 > Archive' 카테고리의 다른 글
retrospect: 멋쟁이 사자처럼 백앤드 스쿨 2022.09.30 회고 (0) | 2022.12.02 |
---|---|
docs: 멋쟁이 사자처럼 백앤드 스쿨 2기 수업 일지 READ ME(2022-11-13) (7) | 2022.11.13 |
[Java] 대용량 데이터 분석 - 3 (0) | 2022.10.11 |
[Java] 대용량 데이터 분석 - 2 (0) | 2022.10.10 |
[Java] 대용량 데이터 분석 - 1 (0) | 2022.10.10 |