",var2=chartRingVotes.data();for(var r=0;r"+var2[r].name+"
",var1+=var2a,var1+="--------
",var1+='# Votes : '+numberFormat(var2[r].value)+" ",var1+=' | '+numberFormat(var2[r].totvalue)+" ( "+numberFormat2(var2[r].percentage)+"% )
",sendInfo("graphinfo",var1);break}}function _(a){if(var1a=chartRingVotes.filters(),var2a="",0==var1a.length)var2a='-all-selected-';else for(r=0;r'+l(var1a[r])+" ";var2a='Capres : '+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/o(+a)*100)+" %
",var1+='# Votes/Population : '+numberFormat2(var2[r].value/var2[r].population*100)+" % ( Max: "+numberFormat2(o(+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}}data6=[];for(var k=0;kvar_suara2?(peringkat1=1,peringkat2=2):var_suara2>var_suara1&&(peringkat1=2,peringkat2=1),data6.push({id_prov:var_idprov,id_capres:varh_idcapres[0],jumlah_suara:var_suara1,rank:peringkat1}),data6.push({id_prov:var_idprov,id_capres:varh_idcapres[1],jumlah_suara:var_suara2,rank:peringkat2});for(var y=crossfilter(data6),S=y.dimension(function(a){return a.id_capres}),P=S.group().reduceSum(function(a){return a.jumlah_suara}),w=y.dimension(function(a){return a.id_prov}),A=w.group().reduceSum(function(a){return a.jumlah_suara}),F=crossfilter(r),R=F.dimension(function(a){return a.id}),D=R.group().reduceSum(function(a){return a.jumlah_penduduk/1}),C=R.group().reduceSum(function(a){return a.jumlah_kursi}),V=R.group().reduceSum(function(a){return d3.geo.area(g(a.id))/4/Math.PI*510.1*1e6}),x=[],k=0;kOpenStreetMap contributors, CC-BY-SA'}).addTo(map);var N=L.control.sidebar("sidebar-control",{closeButton:!0,position:"left"});map.addControl(N),L.easyButton("fa-bars",function(){N.toggle(),T.isVisible()&&T.toggle()},""),N.on("show",function(){$("#change-01").bootstrapSwitch("toggleState"),$("#change-02").bootstrapSwitch("toggleState"),$("#change-03").bootstrapSwitch("toggleState")}),N.on("shown",function(){$("#change-01").bootstrapSwitch("toggleState"),$("#change-02").bootstrapSwitch("toggleState"),$("#change-03").bootstrapSwitch("toggleState"),controlFlag=!0}),N.on("hidden",function(){controlFlag=!1,$("#change-01").bootstrapSwitch("toggleState"),$("#change-02").bootstrapSwitch("toggleState"),$("#change-03").bootstrapSwitch("toggleState")}),N.on("hide",function(){controlFlag=!1,$("#change-01").bootstrapSwitch("toggleState"),$("#change-02").bootstrapSwitch("toggleState"),$("#change-03").bootstrapSwitch("toggleState")});var T=L.control.sidebar("sidebar-chart",{closeButton:!0,position:"left"});map.addControl(T),L.easyButton("fa-bar-chart-o",function(){T.toggle(),N.isVisible()&&N.toggle()},""),T.on("shown",function(){});var I=L.control();I.onAdd=function(){return this._div=L.DomUtil.create("div","info notes hidethis"),this.update(),this._div},I.update=function(a){this._div.innerHTML=""+(a?""+a.nm_provinsi+"
Population : "+numberFormat(e(a.id_provinsi))+"
P. Seats : "+numberFormat(n(a.id_provinsi))+" ":"... INFO ...")+""},I.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:c,onEachFeature:b}).addTo(map),map.attributionControl.addAttribution('Data Source © ...');var B=L.control();B.onAdd=function(){for(var a=L.DomUtil.create("div","info legend hidethis"),r=[1,2],t=[],e=0;e '+l(r[e])+" ");return a.innerHTML=t.join("
"),a},B.addTo(map);var M=L.control();M.onAdd=function(){var a=L.DomUtil.create("div","info piechart");return a.innerHTML='# Votes
',a},M.addTo(map),chartRingVotes=dc.pieChart("#chart-ring-votes");var E=h(),z=d3.range(1,3),O=d3.sum(P.all(),function(a){return a.value}),H=d3.sum(A.all(),function(a){return a.value}),Q=d3.sum(D.all(),function(a){return a.value}),U=d3.sum(C.all(),function(a){return a.value}),J=d3.sum(V.all(),function(a){return a.value});chartRingVotes.width(150).height(150).dimension(S).group(P).innerRadius(20).ordinalColors(E).colorDomain(z).colorAccessor(function(a){return+a.key}).renderLabel(!1).data(function(a){var r=[];return a.all().forEach(function(a){varperc=d3.round(a.value/O*100,1),r.push({key:a.key,value:a.value,totvalue:O,percentage:varperc,name:l(a.key)})}),r}),chartRingProv.width(180).height(180).dimension(w).group(A).innerRadius(20).renderLabel(!1).data(function(a){var r=[];return a.all().forEach(function(a){varperc=d3.round(a.value/H*100,1),varPop=e(a.key),varpercPop=d3.round(varPop/Q*100,1),varSeats=n(a.key),varpercSeats=d3.round(varSeats/U*100,1),varArea=d3.geo.area(g(a.key))/4/Math.PI*510.1*1e6,varpercArea=d3.round(varArea/J*100,1),varDensity=varPop/varArea,r.push({key:a.key,value:a.value,totvalue:H,percentage:varperc,name_prov:i(a.key),population:varPop,totPop:Q,popPerc:varpercPop,seats:varSeats,totSeats:U,seatsPerc:varpercSeats,area:varArea,totArea:J,areaPerc:varpercArea,density:varDensity,avDensity:Q/J})}),r}),maxRank=P.size();var K=y.groupAll().reduce(function(a,r){return++a.n,a.totVotes+=+r.jumlah_suara,a.bpRaw.push([+r.id_prov,+r.id_capres,+r.rank]),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};abcND01a.group(K).valueAccessor(G).formatNumber(d3.format(",.0f")),abcND01b.group(K).valueAccessor(Y).formatNumber(d3.format(",.1f")),abcND01c.group(K).valueAccessor(q).formatNumber(d3.format(",.1f")),abcND02a.group(K).valueAccessor(W).formatNumber(d3.format(",.0f")),dc.renderAll(),chartRingVotes.selectAll(".pie-slice").on("mouseover",function(a){m(a.data.key)}),chartRingProv.selectAll(".pie-slice").on("mouseover",function(a){if(var1a=chartRingVotes.filters(),var2a="",0==var1a.length)var2a='-all-selected-';else for(k=0;k'+l(var1a[k])+" ";var2a='Capres : '+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/o(+a.data.key)*100)+" %
",var1+='# Votes/Population : '+numberFormat2(a.data.value/a.data.population*100)+" % ( Max: "+numberFormat2(o(+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(k=0;k'+i(var1[k])+" ";sendInfo("filterchart1",'Provinsi : '+var2),sAP()}),chartRingVotes.on("filtered",function(){if(var1=chartRingVotes.filters(),var2="",0==var1.length)var2='-all-selected-';else for(k=0;k'+l(var1[k])+" ";sendInfo("filterchart2",'Capres : '+var2),sAP()}),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")})});