Skip to content

Instantly share code, notes, and snippets.

@vuski vuski/data.js
Last active Oct 20, 2016

Embed
What would you like to do?
A Semantic Network of Online News Comments
var gravity = 0.01;
var friction = 0.9;
var graph = {
"nodes": [
{ "name": "서울", "radius": 258, "group": 0 },
{ "name": "아파트", "radius": 210, "group": 1 },
{ "name": "사다", "radius": 125, "group": 2 },
{ "name": "집", "radius": 71, "group": 5 },
{ "name": "사람", "radius": 65, "group": 6 },
{ "name": "살다", "radius": 63, "group": 0 },
{ "name": "돈", "radius": 62, "group": 0 },
{ "name": "집값", "radius": 52, "group": 6 },
{ "name": "만원", "radius": 41, "group": 2 },
{ "name": "많다", "radius": 41, "group": 7 },
{ "name": "3억", "radius": 38, "group": 4 },
{ "name": "좋다", "radius": 37, "group": 8 },
{ "name": "2억", "radius": 35, "group": 3 },
{ "name": "강남", "radius": 34, "group": 9 },
{ "name": "월세", "radius": 34, "group": 6 },
{ "name": "가격", "radius": 32, "group": 1 },
{ "name": "정도", "radius": 28, "group": 2 },
{ "name": "대출", "radius": 28, "group": 2 },
{ "name": "부산", "radius": 26, "group": 10 },
{ "name": "전세", "radius": 25, "group": 11 },
{ "name": "이상", "radius": 24, "group": 8 },
{ "name": "경기", "radius": 24, "group": 2 },
{ "name": "나라", "radius": 24, "group": 9 },
{ "name": "천", "radius": 23, "group": 7 },
{ "name": "부동산", "radius": 21, "group": 9 },
{ "name": "우리", "radius": 20, "group": 3 },
{ "name": "힘들다", "radius": 20, "group": 6 },
{ "name": "요즘", "radius": 20, "group": 3 },
{ "name": "동네", "radius": 20, "group": 3 },
{ "name": "받다", "radius": 20, "group": 2 },
{ "name": "서민", "radius": 20, "group": 5 },
{ "name": "차", "radius": 19, "group": 4 },
{ "name": "안되다", "radius": 19, "group": 7 },
{ "name": "인생", "radius": 18, "group": 10 },
{ "name": "한국", "radius": 17, "group": 7 },
{ "name": "주택", "radius": 17, "group": 2 },
{ "name": "수도권", "radius": 17, "group": 4 },
{ "name": "기사", "radius": 17, "group": 8 },
{ "name": "지금", "radius": 17, "group": 3 },
{ "name": "가면", "radius": 16, "group": 0 },
{ "name": "그돈", "radius": 15, "group": 11 },
{ "name": "1억", "radius": 15, "group": 5 },
{ "name": "강", "radius": 15, "group": 9 },
{ "name": "곳", "radius": 15, "group": 6 },
{ "name": "싸다", "radius": 15, "group": 8 },
{ "name": "사는게", "radius": 15, "group": 5 },
{ "name": "오르다", "radius": 15, "group": 7 },
{ "name": "30평대", "radius": 15, "group": 8 },
{ "name": "소득", "radius": 14, "group": 0 },
{ "name": "넘다", "radius": 14, "group": 4 },
{ "name": "평생", "radius": 14, "group": 5 },
{ "name": "벌다", "radius": 14, "group": 0 },
{ "name": "거지", "radius": 14, "group": 7 },
{ "name": "교통", "radius": 14, "group": 8 },
{ "name": "부자", "radius": 14, "group": 9 },
{ "name": "결혼", "radius": 14, "group": 4 },
{ "name": "얼마", "radius": 13, "group": 7 },
{ "name": "10년", "radius": 13, "group": 3 },
{ "name": "생활", "radius": 13, "group": 5 },
{ "name": "평균", "radius": 13, "group": 0 },
{ "name": "대가", "radius": 13, "group": 10 },
{ "name": "모르다", "radius": 13, "group": 4 },
{ "name": "면적", "radius": 13, "group": 8 },
{ "name": "기준", "radius": 12, "group": 8 },
{ "name": "못하다", "radius": 12, "group": 3 },
{ "name": "도시", "radius": 12, "group": 8 },
{ "name": "도대체", "radius": 12, "group": 10 },
{ "name": "출퇴근", "radius": 12, "group": 2 },
{ "name": "인간", "radius": 12, "group": 10 },
{ "name": "되", "radius": 12, "group": 2 },
{ "name": "남다", "radius": 12, "group": 0 },
{ "name": "30대", "radius": 12, "group": 10 },
{ "name": "분양", "radius": 12, "group": 4 },
{ "name": "거리", "radius": 12, "group": 4 },
{ "name": "비", "radius": 12, "group": 2 },
{ "name": "사고", "radius": 11, "group": 0 },
{ "name": "월급", "radius": 11, "group": 5 },
{ "name": "시골", "radius": 11, "group": 3 },
{ "name": "한달", "radius": 11, "group": 5 },
{ "name": "값", "radius": 11, "group": 9 },
{ "name": "현실", "radius": 11, "group": 5 },
{ "name": "외곽", "radius": 11, "group": 2 },
{ "name": "아니", "radius": 11, "group": 3 },
{ "name": "직장", "radius": 11, "group": 5 },
{ "name": "언제", "radius": 11, "group": 3 },
{ "name": "빌", "radius": 11, "group": 3 },
{ "name": "기자", "radius": 11, "group": 7 },
{ "name": "경기도", "radius": 11, "group": 0 },
{ "name": "모으다", "radius": 10, "group": 5 },
{ "name": "파트", "radius": 10, "group": 8 },
{ "name": "살기", "radius": 10, "group": 8 },
{ "name": "시간", "radius": 10, "group": 4 },
{ "name": "비싼", "radius": 10, "group": 6 },
{ "name": "찾다", "radius": 10, "group": 7 },
{ "name": "한번", "radius": 10, "group": 4 },
{ "name": "경제", "radius": 10, "group": 9 },
{ "name": "평", "radius": 10, "group": 7 },
{ "name": "단지", "radius": 10, "group": 4 },
{ "name": "정부", "radius": 10, "group": 8 },
{ "name": "32평", "radius": 10, "group": 2 },
{ "name": "광역", "radius": 10, "group": 2 },
{ "name": "이해", "radius": 10, "group": 10 },
{ "name": "후반", "radius": 10, "group": 10 },
{ "name": "어떻다", "radius": 10, "group": 3 },
{ "name": "공기", "radius": 10, "group": 4 },
{ "name": "세", "radius": 9, "group": 7 },
{ "name": "하지만", "radius": 9, "group": 10 },
{ "name": "물론", "radius": 9, "group": 3 },
{ "name": "수준", "radius": 9, "group": 9 },
{ "name": "4억", "radius": 9, "group": 0 },
{ "name": "권", "radius": 9, "group": 2 },
{ "name": "건강", "radius": 9, "group": 6 },
{ "name": "좋은", "radius": 9, "group": 4 },
{ "name": "당연", "radius": 9, "group": 7 },
{ "name": "20년", "radius": 9, "group": 11 },
{ "name": "높다", "radius": 9, "group": 4 },
{ "name": "강북", "radius": 9, "group": 7 },
{ "name": "인천", "radius": 9, "group": 2 },
{ "name": "맞다", "radius": 9, "group": 6 },
{ "name": "중반", "radius": 9, "group": 10 },
{ "name": "알다", "radius": 9, "group": 0 },
{ "name": "포기", "radius": 9, "group": 5 },
{ "name": "내다", "radius": 9, "group": 0 },
{ "name": "안하다", "radius": 9, "group": 4 },
{ "name": "매매", "radius": 9, "group": 10 },
{ "name": "오세", "radius": 9, "group": 2 },
{ "name": "폭락", "radius": 8, "group": 6 },
{ "name": "대학", "radius": 8, "group": 0 },
{ "name": "못살다", "radius": 8, "group": 8 },
{ "name": "다른", "radius": 8, "group": 9 },
{ "name": "알아보다", "radius": 8, "group": 4 },
{ "name": "고향", "radius": 8, "group": 0 },
{ "name": "앞", "radius": 8, "group": 11 },
{ "name": "여기", "radius": 8, "group": 4 },
{ "name": "월", "radius": 8, "group": 2 },
{ "name": "평수", "radius": 8, "group": 7 },
{ "name": "굳이", "radius": 8, "group": 0 },
{ "name": "너무", "radius": 8, "group": 7 },
{ "name": "사회", "radius": 8, "group": 4 },
{ "name": "절대", "radius": 8, "group": 8 },
{ "name": "쓰다", "radius": 8, "group": 8 },
{ "name": "남자", "radius": 8, "group": 3 },
{ "name": "편하다", "radius": 8, "group": 8 },
{ "name": "참다", "radius": 8, "group": 10 },
{ "name": "이자", "radius": 8, "group": 6 },
{ "name": "발전", "radius": 8, "group": 10 },
{ "name": "살면", "radius": 8, "group": 11 },
{ "name": "국내", "radius": 8, "group": 4 },
{ "name": "눈", "radius": 8, "group": 7 },
{ "name": "나가다", "radius": 8, "group": 8 },
{ "name": "어차피", "radius": 8, "group": 0 },
{ "name": "지옥", "radius": 8, "group": 8 },
{ "name": "함", "radius": 8, "group": 9 },
{ "name": "노력", "radius": 8, "group": 8 },
{ "name": "25평", "radius": 8, "group": 2 },
{ "name": "사서", "radius": 8, "group": 11 },
{ "name": "30평", "radius": 8, "group": 2 },
{ "name": "똑같다", "radius": 8, "group": 1 },
{ "name": "모아", "radius": 8, "group": 5 },
{ "name": "차이", "radius": 7, "group": 9 },
{ "name": "형편", "radius": 7, "group": 6 },
{ "name": "짓다", "radius": 7, "group": 1 },
{ "name": "살곳", "radius": 7, "group": 6 },
{ "name": "학군", "radius": 7, "group": 4 },
{ "name": "교육", "radius": 7, "group": 4 },
{ "name": "충분", "radius": 7, "group": 3 },
{ "name": "하나", "radius": 7, "group": 10 },
{ "name": "북한", "radius": 7, "group": 0 },
{ "name": "죽다", "radius": 7, "group": 8 },
{ "name": "걱정", "radius": 7, "group": 7 },
{ "name": "아직", "radius": 7, "group": 3 },
{ "name": "비싸", "radius": 7, "group": 0 },
{ "name": "싫다", "radius": 7, "group": 6 },
{ "name": "오피스텔", "radius": 7, "group": 4 },
{ "name": "웃기다", "radius": 7, "group": 1 },
{ "name": "우리나라", "radius": 7, "group": 9 },
{ "name": "그래서", "radius": 7, "group": 3 },
{ "name": "2억9천", "radius": 97, "group": 3 },
{ "name": "지방", "radius": 89, "group": 4 },
{ "name": "가능", "radius": 24, "group": 10 },
{ "name": "연봉", "radius": 18, "group": 6 },
{ "name": "지역", "radius": 16, "group": 8 },
{ "name": "빌라", "radius": 15, "group": 1 },
{ "name": "하지", "radius": 15, "group": 9 },
{ "name": "회사", "radius": 12, "group": 6 },
{ "name": "억", "radius": 11, "group": 7 },
{ "name": "떨어지다", "radius": 11, "group": 6 },
{ "name": "새끼", "radius": 11, "group": 7 },
{ "name": "흙수저", "radius": 11, "group": 3 },
{ "name": "오히려", "radius": 10, "group": 6 },
{ "name": "적다", "radius": 9, "group": 1 },
{ "name": "말다", "radius": 9, "group": 2 },
{ "name": "살아야", "radius": 8, "group": 1 },
{ "name": "나오다", "radius": 8, "group": 0 },
{ "name": "10", "radius": 7, "group": 9 },
{ "name": "20평대", "radius": 7, "group": 4 },
{ "name": "최고", "radius": 7, "group": 1 },
],
"links": [
{ "source": 0, "target": 5, "value": 0.288339525 },
{ "source": 1, "target": 2, "value": 0.206946597 },
{ "source": 2, "target": 8, "value": 0.218259603 },
{ "source": 2, "target": 17, "value": 0.275482059 },
{ "source": 3, "target": 80, "value": 0.205704838 },
{ "source": 3, "target": 83, "value": 0.376141071 },
{ "source": 3, "target": 121, "value": 0.37275967 },
{ "source": 4, "target": 144, "value": 0.323727667 },
{ "source": 4, "target": 162, "value": 0.394994348 },
{ "source": 5, "target": 131, "value": 0.240171775 },
{ "source": 5, "target": 173, "value": 0.229519293 },
{ "source": 6, "target": 87, "value": 0.32826075 },
{ "source": 7, "target": 126, "value": 0.272408813 },
{ "source": 9, "target": 29, "value": 0.202172592 },
{ "source": 9, "target": 46, "value": 0.228369996 },
{ "source": 9, "target": 148, "value": 0.214229509 },
{ "source": 10, "target": 72, "value": 0.288089722 },
{ "source": 10, "target": 102, "value": 0.272565722 },
{ "source": 11, "target": 53, "value": 0.235225767 },
{ "source": 11, "target": 90, "value": 0.330062896 },
{ "source": 11, "target": 98, "value": 0.269469351 },
{ "source": 11, "target": 142, "value": 0.203015789 },
{ "source": 11, "target": 153, "value": 0.217439666 },
{ "source": 12, "target": 84, "value": 0.230336428 },
{ "source": 12, "target": 99, "value": 0.216180667 },
{ "source": 12, "target": 119, "value": 0.20467639 },
{ "source": 13, "target": 108, "value": 0.24666056 },
{ "source": 13, "target": 159, "value": 0.219681218 },
{ "source": 14, "target": 142, "value": 0.350574404 },
{ "source": 14, "target": 144, "value": 0.315360755 },
{ "source": 15, "target": 157, "value": 0.307172954 },
{ "source": 15, "target": 161, "value": 0.204255283 },
{ "source": 16, "target": 29, "value": 0.320322067 },
{ "source": 16, "target": 99, "value": 0.279457599 },
{ "source": 16, "target": 114, "value": 0.282601714 },
{ "source": 16, "target": 154, "value": 0.29192856 },
{ "source": 17, "target": 29, "value": 0.371436 },
{ "source": 17, "target": 154, "value": 0.294592649 },
{ "source": 18, "target": 124, "value": 0.616990268 },
{ "source": 19, "target": 40, "value": 0.415036976 },
{ "source": 20, "target": 22, "value": 0.239022553 },
{ "source": 20, "target": 77, "value": 0.231819019 },
{ "source": 20, "target": 168, "value": 0.296594918 },
{ "source": 21, "target": 44, "value": 0.329282314 },
{ "source": 21, "target": 68, "value": 0.246325687 },
{ "source": 21, "target": 110, "value": 0.331897587 },
{ "source": 22, "target": 129, "value": 0.264942408 },
{ "source": 23, "target": 96, "value": 0.291961908 },
{ "source": 24, "target": 54, "value": 0.402710259 },
{ "source": 24, "target": 79, "value": 0.251428217 },
{ "source": 24, "target": 95, "value": 0.425630599 },
{ "source": 24, "target": 175, "value": 0.376713693 },
{ "source": 25, "target": 28, "value": 0.218061954 },
{ "source": 25, "target": 77, "value": 0.276700526 },
{ "source": 25, "target": 85, "value": 0.212626934 },
{ "source": 25, "target": 109, "value": 0.282737911 },
{ "source": 26, "target": 162, "value": 0.372669965 },
{ "source": 27, "target": 49, "value": 0.252547771 },
{ "source": 27, "target": 141, "value": 0.422883332 },
{ "source": 27, "target": 165, "value": 0.232104808 },
{ "source": 28, "target": 109, "value": 0.256536275 },
{ "source": 29, "target": 154, "value": 0.285623521 },
{ "source": 30, "target": 78, "value": 0.503823876 },
{ "source": 31, "target": 123, "value": 0.587038457 },
{ "source": 32, "target": 38, "value": 0.203787655 },
{ "source": 32, "target": 56, "value": 0.4604114 },
{ "source": 32, "target": 96, "value": 0.396081358 },
{ "source": 32, "target": 116, "value": 0.308113486 },
{ "source": 33, "target": 66, "value": 0.281975329 },
{ "source": 33, "target": 68, "value": 0.326106548 },
{ "source": 33, "target": 143, "value": 0.212031007 },
{ "source": 34, "target": 137, "value": 0.243872523 },
{ "source": 34, "target": 169, "value": 0.291603595 },
{ "source": 35, "target": 100, "value": 0.249711007 },
{ "source": 35, "target": 163, "value": 0.262257636 },
{ "source": 36, "target": 112, "value": 0.569804788 },
{ "source": 36, "target": 173, "value": 0.659255505 },
{ "source": 37, "target": 140, "value": 0.732128322 },
{ "source": 37, "target": 153, "value": 0.361529022 },
{ "source": 38, "target": 56, "value": 0.234094858 },
{ "source": 38, "target": 57, "value": 0.294677198 },
{ "source": 38, "target": 64, "value": 0.277344823 },
{ "source": 38, "target": 71, "value": 0.38559708 },
{ "source": 39, "target": 122, "value": 0.2480703 },
{ "source": 40, "target": 132, "value": 0.233254686 },
{ "source": 41, "target": 50, "value": 0.326069266 },
{ "source": 41, "target": 51, "value": 0.213855788 },
{ "source": 41, "target": 88, "value": 0.494205475 },
{ "source": 42, "target": 129, "value": 0.351965696 },
{ "source": 43, "target": 172, "value": 0.20178625 },
{ "source": 44, "target": 107, "value": 0.278675377 },
{ "source": 44, "target": 142, "value": 0.321777612 },
{ "source": 45, "target": 80, "value": 0.411115348 },
{ "source": 46, "target": 56, "value": 0.244627789 },
{ "source": 46, "target": 135, "value": 0.208701298 },
{ "source": 46, "target": 137, "value": 0.313253254 },
{ "source": 47, "target": 62, "value": 0.311698139 },
{ "source": 47, "target": 65, "value": 0.391604692 },
{ "source": 48, "target": 59, "value": 0.260407627 },
{ "source": 48, "target": 171, "value": 0.44960916 },
{ "source": 49, "target": 61, "value": 0.393816888 },
{ "source": 49, "target": 72, "value": 0.32820186 },
{ "source": 49, "target": 109, "value": 0.246380046 },
{ "source": 50, "target": 88, "value": 0.410115361 },
{ "source": 50, "target": 158, "value": 0.257179916 },
{ "source": 51, "target": 78, "value": 0.206492916 },
{ "source": 51, "target": 120, "value": 0.391729355 },
{ "source": 52, "target": 56, "value": 0.243029431 },
{ "source": 52, "target": 120, "value": 0.276367098 },
{ "source": 53, "target": 65, "value": 0.235735908 },
{ "source": 53, "target": 142, "value": 0.426351845 },
{ "source": 53, "target": 149, "value": 0.277972221 },
{ "source": 53, "target": 151, "value": 0.255025804 },
{ "source": 54, "target": 91, "value": 0.237402886 },
{ "source": 54, "target": 95, "value": 0.38499099 },
{ "source": 54, "target": 164, "value": 0.369374543 },
{ "source": 55, "target": 123, "value": 0.341738552 },
{ "source": 57, "target": 64, "value": 0.241817668 },
{ "source": 57, "target": 71, "value": 0.286488026 },
{ "source": 57, "target": 85, "value": 0.343104422 },
{ "source": 57, "target": 103, "value": 0.366065919 },
{ "source": 58, "target": 76, "value": 0.823761523 },
{ "source": 59, "target": 66, "value": 0.333261013 },
{ "source": 60, "target": 66, "value": 0.219596624 },
{ "source": 60, "target": 68, "value": 0.254447669 },
{ "source": 60, "target": 71, "value": 0.435484171 },
{ "source": 60, "target": 101, "value": 0.378849715 },
{ "source": 60, "target": 102, "value": 0.435458988 },
{ "source": 60, "target": 105, "value": 0.246260703 },
{ "source": 60, "target": 106, "value": 0.421355128 },
{ "source": 60, "target": 119, "value": 0.302460074 },
{ "source": 62, "target": 63, "value": 0.458482176 },
{ "source": 63, "target": 89, "value": 0.394355685 },
{ "source": 64, "target": 71, "value": 0.331987113 },
{ "source": 64, "target": 116, "value": 0.200711608 },
{ "source": 64, "target": 170, "value": 0.308099657 },
{ "source": 64, "target": 174, "value": 0.210364938 },
{ "source": 65, "target": 90, "value": 0.424228728 },
{ "source": 65, "target": 142, "value": 0.21036762 },
{ "source": 66, "target": 68, "value": 0.371966779 },
{ "source": 66, "target": 143, "value": 0.241879523 },
{ "source": 67, "target": 69, "value": 0.437804639 },
{ "source": 67, "target": 73, "value": 0.221010327 },
{ "source": 67, "target": 74, "value": 0.236378819 },
{ "source": 67, "target": 100, "value": 0.212572992 },
{ "source": 68, "target": 143, "value": 0.279468119 },
{ "source": 69, "target": 134, "value": 0.29129383 },
{ "source": 69, "target": 174, "value": 0.251927316 },
{ "source": 70, "target": 122, "value": 0.215686232 },
{ "source": 70, "target": 136, "value": 0.402557194 },
{ "source": 71, "target": 101, "value": 0.248272508 },
{ "source": 71, "target": 102, "value": 0.290173531 },
{ "source": 71, "target": 106, "value": 0.276974261 },
{ "source": 71, "target": 119, "value": 0.211336613 },
{ "source": 72, "target": 94, "value": 0.223677844 },
{ "source": 72, "target": 97, "value": 0.216202542 },
{ "source": 73, "target": 80, "value": 0.215571359 },
{ "source": 73, "target": 91, "value": 0.457760125 },
{ "source": 73, "target": 94, "value": 0.309876591 },
{ "source": 73, "target": 97, "value": 0.328416616 },
{ "source": 73, "target": 130, "value": 0.205680743 },
{ "source": 73, "target": 163, "value": 0.216610774 },
{ "source": 74, "target": 100, "value": 0.327125102 },
{ "source": 74, "target": 110, "value": 0.271788746 },
{ "source": 75, "target": 87, "value": 0.253647506 },
{ "source": 75, "target": 122, "value": 0.296407849 },
{ "source": 77, "target": 165, "value": 0.348295182 },
{ "source": 79, "target": 152, "value": 0.319206595 },
{ "source": 79, "target": 175, "value": 0.598124444 },
{ "source": 81, "target": 156, "value": 0.208743542 },
{ "source": 82, "target": 103, "value": 0.563242853 },
{ "source": 82, "target": 176, "value": 0.417925775 },
{ "source": 83, "target": 121, "value": 0.862454355 },
{ "source": 85, "target": 103, "value": 0.23325555 },
{ "source": 85, "target": 109, "value": 0.321623534 },
{ "source": 86, "target": 113, "value": 0.299276322 },
{ "source": 88, "target": 158, "value": 0.401364416 },
{ "source": 89, "target": 102, "value": 0.244758695 },
{ "source": 90, "target": 91, "value": 0.243996039 },
{ "source": 90, "target": 98, "value": 0.473121792 },
{ "source": 91, "target": 164, "value": 0.386014581 },
{ "source": 92, "target": 118, "value": 0.259145945 },
{ "source": 93, "target": 148, "value": 0.47880438 },
{ "source": 94, "target": 97, "value": 0.613635302 },
{ "source": 94, "target": 102, "value": 0.393117368 },
{ "source": 94, "target": 130, "value": 0.457740813 },
{ "source": 94, "target": 163, "value": 0.446121693 },
{ "source": 96, "target": 116, "value": 0.338771284 },
{ "source": 97, "target": 102, "value": 0.378967226 },
{ "source": 97, "target": 130, "value": 0.40992716 },
{ "source": 97, "target": 163, "value": 0.429596305 },
{ "source": 99, "target": 117, "value": 0.336651891 },
{ "source": 99, "target": 125, "value": 0.420588315 },
{ "source": 101, "target": 102, "value": 0.247097969 },
{ "source": 101, "target": 106, "value": 0.243475243 },
{ "source": 101, "target": 134, "value": 0.233354643 },
{ "source": 102, "target": 106, "value": 0.275841564 },
{ "source": 102, "target": 130, "value": 0.261641055 },
{ "source": 102, "target": 162, "value": 0.238524497 },
{ "source": 102, "target": 163, "value": 0.27497384 },
{ "source": 103, "target": 176, "value": 0.468570828 },
{ "source": 104, "target": 112, "value": 0.269951075 },
{ "source": 104, "target": 115, "value": 0.357443601 },
{ "source": 105, "target": 148, "value": 0.298459679 },
{ "source": 106, "target": 145, "value": 0.33213225 },
{ "source": 106, "target": 166, "value": 0.327882886 },
{ "source": 107, "target": 170, "value": 0.396982461 },
{ "source": 108, "target": 159, "value": 0.369022936 },
{ "source": 109, "target": 150, "value": 0.518688917 },
{ "source": 110, "target": 163, "value": 0.411028683 },
{ "source": 111, "target": 160, "value": 0.247122258 },
{ "source": 112, "target": 115, "value": 0.209749639 },
{ "source": 112, "target": 173, "value": 0.70155251 },
{ "source": 113, "target": 137, "value": 0.256468028 },
{ "source": 113, "target": 141, "value": 0.219051838 },
{ "source": 115, "target": 148, "value": 0.223453805 },
{ "source": 116, "target": 129, "value": 0.217212707 },
{ "source": 117, "target": 125, "value": 0.51628226 },
{ "source": 118, "target": 160, "value": 0.445758045 },
{ "source": 119, "target": 124, "value": 0.497635186 },
{ "source": 120, "target": 131, "value": 0.508602679 },
{ "source": 125, "target": 156, "value": 0.329374164 },
{ "source": 127, "target": 164, "value": 0.260213047 },
{ "source": 128, "target": 151, "value": 0.252787977 },
{ "source": 128, "target": 168, "value": 0.27543366 },
{ "source": 130, "target": 147, "value": 0.559627712 },
{ "source": 130, "target": 163, "value": 0.297735214 },
{ "source": 133, "target": 138, "value": 0.203060284 },
{ "source": 136, "target": 150, "value": 0.280911684 },
{ "source": 136, "target": 167, "value": 0.388462603 },
{ "source": 138, "target": 164, "value": 0.284233004 },
{ "source": 139, "target": 149, "value": 0.538431406 },
{ "source": 145, "target": 166, "value": 0.391041189 },
{ "source": 146, "target": 155, "value": 0.870455801 },
{ "source": 149, "target": 151, "value": 0.274893492 },
{ "source": 150, "target": 167, "value": 0.385500312 },
{ "source": 161, "target": 174, "value": 0.265787005 },
{ "source": 2, "target": 12, "value": 0.195576355 },
{ "source": 2, "target": 117, "value": 0.19555977 },
{ "source": 2, "target": 154, "value": 0.182651296 },
{ "source": 5, "target": 36, "value": 0.191629961 },
{ "source": 5, "target": 112, "value": 0.182039648 },
{ "source": 6, "target": 51, "value": 0.193750203 },
{ "source": 6, "target": 185, "value": 0.192576498 },
{ "source": 9, "target": 56, "value": 0.191108093 },
{ "source": 10, "target": 49, "value": 0.195752293 },
{ "source": 10, "target": 68, "value": 0.190924108 },
{ "source": 12, "target": 17, "value": 0.193834141 },
{ "source": 14, "target": 44, "value": 0.193287998 },
{ "source": 15, "target": 38, "value": 0.186221674 },
{ "source": 15, "target": 71, "value": 0.182091534 },
{ "source": 15, "target": 94, "value": 0.187778011 },
{ "source": 21, "target": 163, "value": 0.188197926 },
{ "source": 22, "target": 24, "value": 0.198651209 },
{ "source": 22, "target": 95, "value": 0.1840197 },
{ "source": 27, "target": 111, "value": 0.188018575 },
{ "source": 28, "target": 85, "value": 0.18926613 },
{ "source": 30, "target": 54, "value": 0.180666938 },
{ "source": 33, "target": 60, "value": 0.192403972 },
{ "source": 181, "target": 130, "value": 0.186355293 },
{ "source": 41, "target": 78, "value": 0.19100897 },
{ "source": 42, "target": 160, "value": 0.196839556 },
{ "source": 43, "target": 64, "value": 0.192739055 },
{ "source": 44, "target": 53, "value": 0.191727445 },
{ "source": 44, "target": 170, "value": 0.194631398 },
{ "source": 47, "target": 63, "value": 0.184890658 },
{ "source": 47, "target": 137, "value": 0.185404733 },
{ "source": 49, "target": 85, "value": 0.184887707 },
{ "source": 53, "target": 90, "value": 0.185976863 },
{ "source": 56, "target": 96, "value": 0.197978795 },
{ "source": 56, "target": 116, "value": 0.190399975 },
{ "source": 62, "target": 190, "value": 0.192702055 },
{ "source": 67, "target": 142, "value": 0.197336227 },
{ "source": 72, "target": 139, "value": 0.192106724 },
{ "source": 73, "target": 102, "value": 0.188879937 },
{ "source": 186, "target": 189, "value": 0.182618245 },
{ "source": 91, "target": 138, "value": 0.182310551 },
{ "source": 92, "target": 189, "value": 0.189004049 },
{ "source": 99, "target": 114, "value": 0.188185468 },
{ "source": 100, "target": 110, "value": 0.181120202 },
{ "source": 102, "target": 119, "value": 0.197895944 },
{ "source": 104, "target": 152, "value": 0.180421606 },
{ "source": 106, "target": 119, "value": 0.195008546 },
{ "source": 106, "target": 193, "value": 0.185253039 },
{ "source": 110, "target": 152, "value": 0.192354053 },
{ "source": 122, "target": 126, "value": 0.184564337 },
{ "source": 192, "target": 174, "value": 0.181346551 },
{ "source": 159, "target": 194, "value": 0.182066888 },
]
};
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<title></title>
<style>
svg text {
font-family:YDIYGO320, '08SeoulNamsan B', 돋움체,Arial;
}
.cir {
stroke: #fff;
stroke-width: 2px;
}
.lines {
fill : none;
stroke-opacity: .6;
transition: opacity 250ms;
-webkit-transition: opacity 250ms;
-moz-transition: opacity 250ms;
}
</style>
</head>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="data.js"></script>
<script>
//해당 프레임에 맞게 이 부분을 조정하면 됨
var width = 1200,
height = 700;
var color = ["#4682B4", "#FF8C00", "#9ACD32", "#8B0000", "#2F4F4F", "#4B0082", "#006400", "#CD5C5C", "#FFD700",
"#A0522D", "#708090", "#008080", "#800080", "#6B8E23", "#DC143C", "#DB7093", "#BDB76B", "#191970", "#D2691E",
"#1E90FF", "#5F9EA0", "#BC8F8F", "#FFA07A", "#FF4500", "#DEB887", "#32CD32", "#7B68EE", "#008080", "#6C0000",
"#655552", "#A02E19", "#A87563", "#A0522D", "#EC6527", "#EC6400", "#765338", "#AE5000", "#F5A300", "#946700",
"#E1AF00"];
var distanceScale = d3.scale.pow().exponent(0.4);
var lineColorScale = d3.scale.linear();
var radiusScale = d3.scale.pow().exponent(1);
var textScale = d3.scale.pow().exponent(1);
var chargeScale = d3.scale.linear();
var xScale = d3.scale.linear()
.domain([0, width])
.range([0, width]);
var yScale = d3.scale.linear()
.domain([0, height])
.range([0, height]);
var zoomer = d3.behavior.zoom().x(xScale).y(yScale).scaleExtent([0.1, 8]).on("zoom", zoom);
function zoom() {
tick();
};
var drag = d3.behavior.drag()
.origin(function (d) { return d; })
.on("dragstart", dragstarted)
.on("drag", dragged)
.on("dragend", dragended);
function dragstarted(d) {
d3.event.sourceEvent.stopPropagation();
d.fixed |= 2;
}
function dragged(d) {
var mouse = d3.mouse(svg.node());
d.x = xScale.invert(mouse[0]);
d.y = yScale.invert(mouse[1]);
d.px = d.x;
d.py = d.y;
force.resume();
}
function dragended(d) {
d.fixed &= ~6;
}
var force = d3.layout.force()
.charge(-120)
.linkDistance(30)
.gravity(gravity)
.friction(friction)
.size([width, height]);
var svg = d3.select("body").append("svg") //"body" 대신 적절한 class나 id를 넣으면 해당 태그에 삽입됨. class의 경우 ".class" 의 형식으로. id의 경우 "#id"의 형식으로.
.attr("width", width)
.attr("height", height);
svg.call(zoomer);
force
.nodes(graph.nodes)
.links(graph.links)
.start();
distanceScale.domain([0, d3.max(graph.links, function (d) { return d.value; })])
.range([150, 15]);
lineColorScale.domain([0, d3.max(graph.links, function (d) { return d.value; })])
.range([255, 50]);
radiusScale.domain([d3.min(graph.nodes, function (d) { return d.radius; }), d3.max(graph.nodes, function (d) { return d.radius; })])
.range([5, 20]);
textScale.domain([d3.min(graph.nodes, function (d) { return d.radius; }), d3.max(graph.nodes, function (d) { return d.radius; })])
.range([15, 30]);
chargeScale.domain([100, 200])
.range([-400, -150]);
force.charge(chargeScale(graph.nodes.length));
var link = svg.selectAll("line")
.data(graph.links);
link.enter()
.insert("line", "g")
.attr("class", "lines")
.style("stroke", function (d) { return d3.rgb(lineColorScale(d.value), lineColorScale(d.value), lineColorScale(d.value)); })
.style("stroke-width", function (d) { return Math.sqrt(d.value * 10); })
.append("title")
.text(function (d) { return (d.value); })
.style("font-size", "8pt");
var node = svg.selectAll(".node")
.data(graph.nodes)
.enter().append("g")
.attr("class", "node")
.call(drag);
node.append("circle")
.attr("class", "cir")
.attr("r", function (d) { if (d.radius == 0) return 2; else return radiusScale(d.radius); })
.style("fill", function (d) { return color[d.group]; });
node.append("text")
.attr("class", "cText")
.attr("dx", 8)
.attr("dy", ".35em")
.style("font-size", function (d) { return textScale(d.radius) + "px" })
.style("opacity", function (d) { if (d.radius == 0) return 0.05; else return 1; })
.text(function (d) { return (d.name); });
force.on("tick", tick);
function tick() {
link.attr("x1", function (d) { return xScale(d.source.x); })
.attr("y1", function (d) { return yScale(d.source.y); })
.attr("x2", function (d) { return xScale(d.target.x); })
.attr("y2", function (d) { return yScale(d.target.y); });
node.attr("transform", function (d) {
return "translate(" + xScale(d.x) + "," + yScale(d.y) + ")";
});
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.