",var2=chartRingVotes.data();for(var r=0;r"+var2[r].name_pp+"
",var1+=var2a,var1+="--------
",var1+='# Votes : '+numberFormat(var2[r].value)+" ",var1+=' | '+numberFormat(var2[r].totvalue)+" ( "+numberFormat2(var2[r].percentage)+"% )
",sendInfo("graphinfo",var1);break}}function S(a){if(var1a=chartRingVotes.filters(),var2a="",0==var1a.length)var2a='-all-selected-';else for(r=0;r'+c(var1a[r])+" ";var2a='PP : '+var2a+"
",var2=chartRingProv.data();for(var r=0;r"+var2[r].name_prov+"
",var1+=var2a,var1+="--------
",var1+='# Votes : '+numberFormat(var2[r].value)+" ",var1+=' | '+numberFormat(var2[r].totvalue)+" ( "+numberFormat2(var2[r].percentage)+"% )
",var1+='# Votes/T.Votes : '+numberFormat2(var2[r].value/s(+a)*100)+" %
",var1+='# Votes/Population : '+numberFormat2(var2[r].value/var2[r].population*100)+" % ( Max: "+numberFormat2(s(+a)/var2[r].population*100)+"% )
",var1+="--------
",var1+='# T.Population : '+numberFormat(var2[r].population)+" ",var1+=' | '+numberFormat(var2[r].totPop)+" ( "+var2[r].popPerc+"% )
",var1+='# T.Parliamentary Seats : '+var2[r].seats+" ",var1+=' | '+var2[r].totSeats+" ( "+var2[r].seatsPerc+"% )
",var1+='# Av. Representation : '+numberFormat(var2[r].population/var2[r].seats)+" / Seat",var1+=' | Nat.: '+numberFormat(var2[r].totPop/var2[r].totSeats)+" / Seat
",var1+='# Appx. Area : '+numberFormat2(var2[r].area)+" km2",var1+=' | '+numberFormat2(var2[r].totArea)+" km2 ( "+var2[r].areaPerc+"% )
",var1+='# Appx. Density : '+numberFormat2(var2[r].density)+" / km2",var1+=' | Ave.: '+numberFormat2(var2[r].avDensity)+" / km2 ",sendInfo("graphinfo",var1);break}}data4=[];for(var w=0;w0&&data4.push({id_prov:var_idprov,id_pp:varh_idpp[A],jumlah_kursi:+e[w]["pp"+varh_idpp[A].toString()]})}for(var F=crossfilter(data4),R=F.dimension(function(a){return a.id_pp}),D=(R.group().reduceSum(function(a){return a.jumlah_kursi}),F.dimension(function(a){return a.id_prov})),j=D.group().reduceSum(function(a){return a.jumlah_kursi}),C=crossfilter(t),V=C.dimension(function(a){return a.id_pp}),N=V.group().reduceSum(function(a){return a.jumlah_suara}),x=C.dimension(function(a){return a.id_prov}),I=x.group().reduceSum(function(a){return a.jumlah_suara}),T=crossfilter(r),B=T.dimension(function(a){return a.id}),E=B.group().reduceSum(function(a){return a.jumlah_penduduk/1}),M=B.group().reduceSum(function(a){return a.jumlah_kursi}),z=B.group().reduceSum(function(a){return d3.geo.area(P(a.id))/4/Math.PI*510.1*1e6}),O=[],w=0;wOpenStreetMap contributors, CC-BY-SA'}).addTo(map);var K=L.control.sidebar("sidebar-control",{closeButton:!0,position:"left"});map.addControl(K),L.easyButton("fa-bars",function(){K.toggle(),Q.isVisible()&&Q.toggle()},""),K.on("show",function(){$("#change-01").bootstrapSwitch("toggleState"),$("#change-02").bootstrapSwitch("toggleState"),$("#change-03").bootstrapSwitch("toggleState")}),K.on("shown",function(){$("#change-01").bootstrapSwitch("toggleState"),$("#change-02").bootstrapSwitch("toggleState"),$("#change-03").bootstrapSwitch("toggleState"),controlFlag=!0}),K.on("hidden",function(){controlFlag=!1,$("#change-01").bootstrapSwitch("toggleState"),$("#change-02").bootstrapSwitch("toggleState"),$("#change-03").bootstrapSwitch("toggleState")}),K.on("hide",function(){controlFlag=!1,$("#change-01").bootstrapSwitch("toggleState"),$("#change-02").bootstrapSwitch("toggleState"),$("#change-03").bootstrapSwitch("toggleState")});var Q=L.control.sidebar("sidebar-chart",{closeButton:!0,position:"left"});map.addControl(Q),L.easyButton("fa-bar-chart-o",function(){Q.toggle(),K.isVisible()&&K.toggle()},""),Q.on("shown",function(){});var U=L.control();U.onAdd=function(){return this._div=L.DomUtil.create("div","info notes hidethis"),this.update(),this._div},U.update=function(a){this._div.innerHTML=""+(a?""+a.nm_provinsi+"
Populasi : "+numberFormat(n(a.id_provinsi))+"
Kursi : "+numberFormat(o(a.id_provinsi))+" ":"... INFO ...")+""},U.addTo(map),sAP=function(){varFilter=chartRingProv.filters(),geojson.eachLayer(varFilter.length?function(a){geojson.resetStyle(a),-1==varFilter.indexOf(+a.feature.properties.id_provinsi)&&a.setStyle({fillColor:"#999",fillOpacity:.7})}:function(a){geojson.resetStyle(a)})},geojson=L.geoJson(statesData,{style:b,onEachFeature:_}).addTo(map),map.attributionControl.addAttribution('Data Source © ...');var G=L.control();G.onAdd=function(){for(var a=L.DomUtil.create("div","info legend hidethis"),r=[1,2,3,4,5,6,7,8,9,10,14,15],t=[],e=0;e '+c(r[e])+" ");return a.innerHTML=t.join("
"),a},G.addTo(map);var J=L.control();J.onAdd=function(){var a=L.DomUtil.create("div","info piechart");return a.innerHTML='# Votes
',a},J.addTo(map),chartRingVotes=dc.pieChart("#chart-ring-votes");var Y=k(),q=d3.range(1,16),W=d3.sum(N.all(),function(a){return a.value}),X=d3.sum(I.all(),function(a){return a.value}),Z=d3.sum(E.all(),function(a){return a.value}),ar=d3.sum(M.all(),function(a){return a.value}),rr=d3.sum(z.all(),function(a){return a.value});chartRingVotes.width(150).height(150).dimension(V).group(N).innerRadius(20).ordinalColors(Y).colorDomain(q).colorAccessor(function(a){return+a.key}).renderLabel(!1).data(function(a){var r=[];return a.all().forEach(function(a){varperc=d3.round(a.value/W*100,1),r.push({key:a.key,value:a.value,totvalue:W,percentage:varperc,name_pp:u(a.key)})}),r}),chartRingProv.width(180).height(180).dimension(x).group(I).innerRadius(20).renderLabel(!1).data(function(a){var r=[];return a.all().forEach(function(a){varperc=d3.round(a.value/X*100,1),varPop=n(a.key),varpercPop=d3.round(varPop/Z*100,1),varSeats=o(a.key),varpercSeats=d3.round(varSeats/ar*100,1),varArea=d3.geo.area(P(a.key))/4/Math.PI*510.1*1e6,varpercArea=d3.round(varArea/rr*100,1),varDensity=varPop/varArea,r.push({key:a.key,value:a.value,totvalue:X,percentage:varperc,name_prov:l(a.key),population:varPop,totPop:Z,popPerc:varpercPop,seats:varSeats,totSeats:ar,seatsPerc:varpercSeats,area:varArea,totArea:rr,areaPerc:varpercArea,density:varDensity,avDensity:Z/rr})}),r}),maxRank=N.size();var tr=C.groupAll().reduce(function(a,r){return++a.n,a.totVotes+=+r.jumlah_suara,a.bpRaw.push([+r.id_prov,+r.id_pp,+r.peringkat_js]),a},function(a,r){--a.n,a.totVotes-=+r.jumlah_suara,varindex=-1;for(var t=0;t=r;r++){for(var t=0;t0){bestRank=r;break}}return updateRest(),varCount},ir=F.groupAll().reduce(function(a,r){return++a.n,a.totSeats+=+r.jumlah_kursi,a},function(a,r){return--a.n,a.totSeats-=+r.jumlah_kursi,a},function(){return{n:0,totSeats:0}}),pr=function(a){return a.totSeats},lr=function(a){return a.totSeats/ar*100},ur=function(a){return a.totSeats/p()*100};abcND01a.group(tr).valueAccessor(er).formatNumber(d3.format(",.0f")),abcND01b.group(tr).valueAccessor(nr).formatNumber(d3.format(",.1f")),abcND01c.group(tr).valueAccessor(or).formatNumber(d3.format(",.1f")),abcND02a.group(tr).valueAccessor(sr).formatNumber(d3.format(",.0f")),abcND03a.group(ir).valueAccessor(pr).formatNumber(d3.format(",.0f")),abcND03b.group(ir).valueAccessor(lr).formatNumber(d3.format(",.1f")),abcND03c.group(ir).valueAccessor(ur).formatNumber(d3.format(",.1f")),dc.renderAll(),chartRingVotes.selectAll(".pie-slice").on("mouseover",function(a){y(a.data.key)}),chartRingProv.selectAll(".pie-slice").on("mouseover",function(a){if(var1a=chartRingVotes.filters(),var2a="",0==var1a.length)var2a='-all-selected-';else for(w=0;w'+c(var1a[w])+" ";var2a='PP : '+var2a+"
",var1="Province : "+a.data.name_prov+"
",var1+=var2a,var1+="--------
",var1+='# Votes : '+numberFormat(a.data.value)+" ",var1+=' | '+numberFormat(a.data.totvalue)+" ( "+numberFormat2(a.data.percentage)+"% )
",var1+='# Votes/T.Votes : '+numberFormat2(a.data.value/s(+a.data.key)*100)+" %
",var1+='# Votes/Population : '+numberFormat2(a.data.value/a.data.population*100)+" % ( Max: "+numberFormat2(s(+a.data.key)/a.data.population*100)+"% )
",var1+="--------
",var1+='# T.Population : '+numberFormat(a.data.population)+" ",var1+=' | '+numberFormat(a.data.totPop)+" ( "+a.data.popPerc+"% )
",var1+='# T.Parliamentary Seats : '+a.data.seats+" ",var1+=' | '+a.data.totSeats+" ( "+a.data.seatsPerc+"% )
",var1+='# Appx. Area : '+numberFormat2(a.data.area)+" km2",var1+=' | '+numberFormat2(a.data.totArea)+" km2 ( "+a.data.areaPerc+"% )
",var1+='# Appx. Density : '+numberFormat2(a.data.density)+" / km2",var1+=' | Ave.: '+numberFormat2(a.data.avDensity)+" / km2 ",sendInfo("graphinfo",var1)}),chartRingProv.on("filtered",function(){if(var1=chartRingProv.filters(),var2="",0==var1.length)var2='-all-selected-';else for(w=0;w'+l(var1[w])+" ";sendInfo("filterchart1",'Provinsi : '+var2),sAP(),f=chartRingProv.filters(),f.length>0?D.filter(function(a){return f.indexOf(a)>-1}):D.filter()}),chartRingVotes.on("filtered",function(){if(var1=chartRingVotes.filters(),var2="",0==var1.length)var2='-all-selected-';else for(w=0;w'+c(var1[w])+" ";sendInfo("filterchart2",'Partai : '+var2),sAP(),f=chartRingVotes.filters(),f.length>0?R.filter(function(a){return f.indexOf(a)>-1}):R.filter()}),updateRest()})})}),$.fn.bootstrapSwitch.defaults.onColor="success",$.fn.bootstrapSwitch.defaults.offColor="danger",$("#change-01").bootstrapSwitch(),$("#change-02").bootstrapSwitch(),$("#change-03").bootstrapSwitch(),$("#change-01").on("switchChange.bootstrapSwitch",function(){controlFlag&&($("#change-01").bootstrapSwitch("state")?$(".info.notes").removeClass("hidethis"):$(".info.notes").addClass("hidethis"))}),$("#change-02").on("switchChange.bootstrapSwitch",function(){controlFlag&&($("#change-02").bootstrapSwitch("state")?$(".info.legend").removeClass("hidethis"):$(".info.legend").addClass("hidethis"))}),$("#change-03").on("switchChange.bootstrapSwitch",function(){controlFlag&&($("#change-03").bootstrapSwitch("state")?$(".info.piechart").removeClass("hidethis"):$(".info.piechart").addClass("hidethis"))}),jQuery(function(){jQuery("#tab01 a").on("click",function(){$(this).tab("show")}),jQuery("#tab02 a").on("click",function(){$(this).tab("show")})});