content="initial-scale=1, maximum-scale=1,user-scalable=no">
<script><br>function getJenksBreaks(data,numclass) {<br>function sortNumber(a,b)//Javascript에서 Array의 정렬 방법은 다음과 같습니다. 이 함수를 사용하세요. 그렇지 않으면 숫자 크기로 정렬되지 않습니다<br>{<br>return a - b<br>}<br>// int numclass;<br>var numdata = data.length;<br>data .sort( sortNumber); //먼저 정렬
<p>var mat1=new Array();<br>var mat2=new Array();<br>var st=new Array();</p>
<p>for (var j = 0; j <= numdata; j ){<BR>mat1[j]=new Array();<BR>mat2[j]=new Array();<BR>st[ j]=0;<BR>for(var i=0;i<=numclass;i ){<BR>mat1[j][i]=0;<BR>mat2[j][i]=0;<BR>}<BR>}</P>
<P>for (var i = 1; i <= numclass; i ) {<BR>mat1[1][i] = 1;<BR>mat2[1][i] = 0;<BR>for ( var j = 2; j <= numdata;
</P>mat2[j][i]=Number.MAX_VALUE;<P>}<BR>}<BR>var v=0;<BR>
</P>for (var l = 2; l <= numdata; l ) {<P>var s1=0;<BR>var s2=0;<BR>var w=0;<BR>var i3=0 ;<BR>for (var m = 1; m <= l; m ) {<BR>i3 = l - m 1;<BR>
</P>var val=parseInt(data[i3-1]);<P>
</P>s2 = 값 * 값;<P>s1 = 값;<BR>
</P>w ;<P>v = s2 - (s1 * s1) / w;<BR>var i4 = i3 - 1;<BR>if (i4 != 0) {<BR>for (var j = 2 ; j <= numclass; j ) {<BR>if (mat2[l][j] >= (v mat2[i4][j - 1])) {<br>mat1[l][j] = i3;<br>mat2[l][j] = v mat2[i4][j - 1];<br>
</p>if(l==200&&j==5) Alert("l=" 200 ",j=" 5 ";mat2[200][5]=" mat1[l][j] "i3=" i3) ;<p>}<br>}<br>}<br>}<br>
</p>mat1[l][1] = 1;<p>mat2[l][1] = v;<br>}<br>
</p>var k = numdata;<p>var kclass=new Array();<br>
</p>/* int[] kclass = new int[numclass]; */<p>kclass[numclass - 1] =parseInt(data[data.length-1]);<br>/* kclass[numclass - 1 ] = (정수) data.get(data.size() - 1) */<br>
</p>for (var j = numclass; j >= 2; j--) {<p>var id =parseInt(mat1[k][j]) - 2;<br>kclass[j - 2] = parseInt( 데이터[id]);<br>k =parseInt( mat1[k][j] - 1);<br>}<br>
</p>kclass 반환;<p>}<br>
</p>함수 doit(){<p>var data = new Array( 9, 9, 9, 9, 8, 1, 9, 7, 6, 7, 10, 7, 7, 8, 5, 7, 8 , 2,<br>6, 6, 9, 10, 2, 2, 3, 9, 9, 1, 9, 1, 6, 7, 1, 9, 6, 5, 2, 8, 6,<br>6, 6, 4, 1, 4, 10, 9, 6, 9, 9, 7, 10, 9, 6, 6, 6, 9, 3, 2, 5,<br>10, 3, 9, 6, 1, 2, 1, 2, 7, 5, 2, 6, 6, 2, 7, 9, 9, 5, 4, 6, 4,<br>1, 1, 5, 1, 4, 4 , 2, 6, 9, 7, 3, 10, 4, 4, 9, 5, 5, 3, 5, 3,<br>161, 136, 22, 113, 48, 114, 166, 33, 159, 182, 135, 22, 174,<br>191, 60, 176, 1, 155, 62, 142, 185, 84, 140, 27, 111, 176, 189,<br>24, 60, 29, 139, 20, 70, 172, 90, 120, 121, 173, 57, 138, 86,<br>180, 143, 155, 35, 10, 136, 158, 26, 29, 136, 97, 193, 194,<br>104, 147, 182, 44, 84, 139, 176, 16, 130, 168, 109, 182, 87,<br>78, 115, 75, 32, 88, 131, 168, 89, 25, 160 , 60, 72, 92, 129,<br>159, 99, 5, 192, 6, 53, 15, 62, 176, 73, 129, 128, 34, 190, 95,<br>19, 19, 196 , 30 );<br>
</p>/* var list = new Array();<p>for(int i = 0; i < data.length; i ){<BR>list.add(data[i]);<BR>} */<BR>//Collections.sort(list);<BR>var text=document.getElementById("text");<BR>text.value="";<BR>var grade = getJenksBreaks(data, 5 );<BR>for (var i = 0; i < grade.length; i ) <BR>text.value=text.value grade[i] ",";<BR>
</P>}<P>
</P></script>