-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path6066a9546e262140b92e.app.js
2 lines (2 loc) · 7.23 KB
/
6066a9546e262140b92e.app.js
1
2
webpackJsonp([0],[,function(t,n,e){"use strict";function a(){var t=parseInt(C.style("width"),10),n=parseInt(C.style("height"),10);D=parseInt(getComputedStyle(document.body).fontSize,10),H.top=Math.round(z.top*D),H.right=Math.round(z.right*D),H.bottom=Math.round(z.bottom*D),H.left=Math.round(z.left*D),B=t-H.left-H.right,U=n-H.top-H.bottom}function i(t,n){var e=t.range()[1]-t.range()[0],a=e*n/100,i=t.invert(t.range()[0]-a),o=t.invert(t.range()[1]+a);t.domain([i,o])}function o(){C=v.select("#"+S).append("svg").attr("width",A).attr("height",I),a(),P=C.append("g").attr("transform","translate("+H.left+","+H.top+")")}function r(){M=v.scaleLog().base(10).nice().domain(v.extent(x,function(t){return t.purchasingPower})).range([0,B]),i(M,8),O=v.scaleLinear().nice().domain(v.extent(x,function(t){return t.lifeExpectancy})).range([U,0]),i(O,5),T=v.scaleSqrt().domain(v.extent(x,function(t){return t.population})).range([1,100]),E=v.scaleOrdinal().domain(["Africa","Asia","Americas","Europe","Oceania"]).range([""+g.default.continentAfrica,""+g.default.continentAsia,""+g.default.continentAmerica,""+g.default.continentEurope,""+g.default.continentOceania])}function l(){P.append("g").attr("class",g.default.axis).attr("transform","translate(0,"+U+")").call(v.axisBottom(M).ticks(Math.max(B/(5*D),2),"$.2s").tickSizeOuter(0)),P.append("g").attr("class",g.default.axis).call(v.axisLeft(O).tickSizeOuter(0))}function u(){P.append("text").attr("class",g.default.axisTitle).attr("text-anchor","middle").attr("transform","translate("+B/2+","+(U+.7*H.bottom)+")").text("Purchasing Power ($US)"),P.append("text").attr("class",g.default.axisTitle).attr("text-anchor","middle").attr("transform","translate("+H.left*-.5+","+U/2+")rotate(-90)").text("Life Expectancy (years)"),P.append("text").attr("class",g.default.mainTitle).attr("text-anchor","middle").attr("transform","translate("+B/2+","+H.top*-.3+")").text("Wealth Distribution per Country")}function c(){L.style("left",v.event.pageX-L.node().getBoundingClientRect().width/2+"px").style("top",v.event.pageY-parseInt(L.style("height"),0)-5+"px")}function s(t){L=L.html('\n <table>\n <tr>\n <th class="'+g.default.infoPopupCaption+'">'+t.country+'</th>\n <th class="'+g.default.infoPopupSubcaption+" "+E(t.continent)+'">'+t.continent+'</th>\n </tr>\n <tr>\n <td class="'+g.default.infoPopupData+'">'+t.purchasingPower.toLocaleString()+'</td>\n <td class="'+g.default.infoPopupUnits+'"><small>$</small></td>\n </tr>\n <tr>\n <td class="'+g.default.infoPopupData+'">'+t.lifeExpectancy.toLocaleString()+'</td>\n <td class="'+g.default.infoPopupUnits+'"><small>Years</small></td>\n </tr>\n <tr>\n <td class="'+g.default.infoPopupData+'">'+t.population.toLocaleString()+'</td>\n <td class="'+g.default.infoPopupUnits+'"><small>Inhabitants<small></td>\n </tr>\n </table>\n '),c(),L.style("opacity",.9)}function p(){L.style("opacity",0)}function _(){L||(L=v.select("#"+S).append("div").attr("class",g.default.infoPopup))}function f(){return w.sort(function(t,n){return n.population-t.population})}function d(){w=P.selectAll("circle").data(x).enter().append("circle").attr("cx",function(t){return M(t.purchasingPower)}).attr("cy",function(t){return O(t.lifeExpectancy)}).attr("r",function(t){return T(t.population)}).attr("class",function(t){return g.default.bubble+" "+E(t.continent)}).on("mouseenter",s).on("mousemove",c).on("mouseleave",p),w=f()}function b(){o(),r(),l(),u(),_(),d()}function h(){S&&(C&&C.remove(),b())}function m(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:I;x=t,S=n,A=e,I=a}Object.defineProperty(n,"__esModule",{value:!0}),n.draw=n.initialize=void 0;var y=e(4),g=function(t){return t&&t.__esModule?t:{default:t}}(y),v=e(0),x=null,S=null,C=null,P=null,w=null,L=null,M=null,O=null,T=null,E=null,A="100%",I="100%",z={top:4,right:1,bottom:4,left:4},D=null,H={},B=null,U=null;n.initialize=m,n.draw=h},function(t,n,e){"use strict";function a(t,n){return"<table><tr>"+n.reduce(function(t,n){return t+"<th>"+n+"</th>"},"")+"<tr>"+t.reduce(function(t,n){return t+"<tr>"+Object.values(n).reduce(function(t,n){return t+"<td>"+n.toLocaleString()+"</td>"},"")+"</tr>"},"")+"</table>"}function i(t,n,e){var i=t.split(u);if(i.length>=2){var o=i.shift().split(l),r=o.length,s=o.map(function(t){var n=t.replace(/\s+/g,"");return n.charAt(0).toLowerCase()+n.slice(1)});if(r>0){var p=i.map(function(t){return t.split(l).reduce(function(t,n,e){var a=Number.parseFloat(n);return t[s[e]]=a?a:n,t},{})});return void(c?n(p,a(p,o)):n(p))}}e("Unexpected format")}function o(t,n,e){var a=new XMLHttpRequest;a.onload=function(){200===a.status?i(a.responseText,n,e):e&&e("Data request failed with reason: "+a.statusText)},a.open("GET",t),a.send(null)}function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c;l=t,u=n,c=e}Object.defineProperty(n,"__esModule",{value:!0});var l=",",u="\r\n",c=!1;n.parse=o,n.setup=r},function(t,n,e){"use strict";function a(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n.default=t,n}var i=e(2),o=a(i),r=e(1),l=a(r);!function(){o.setup("\t","\n",!0),o.parse("./data.txt",function(t,n){document.getElementById("id-data-table").innerHTML='<h2 class="flex-item">Data Source</h2>\n '+n,l.initialize(t,"id-bubble-chart"),l.draw(),window.addEventListener("resize",l.draw),window.addEventListener("orientationchange",l.draw)},function(t){document.getElementById("id-data-table").innerHTML=t})}()},function(t,n){t.exports={"continent--africa":"bubbleChartStyles__continent--africa___36pn8",continentAfrica:"bubbleChartStyles__continent--africa___36pn8","continent--asia":"bubbleChartStyles__continent--asia___2VlrO",continentAsia:"bubbleChartStyles__continent--asia___2VlrO","continent--america":"bubbleChartStyles__continent--america___3M5D6",continentAmerica:"bubbleChartStyles__continent--america___3M5D6","continent--europe":"bubbleChartStyles__continent--europe___2yrHG",continentEurope:"bubbleChartStyles__continent--europe___2yrHG","continent--oceania":"bubbleChartStyles__continent--oceania___3oIRq",continentOceania:"bubbleChartStyles__continent--oceania___3oIRq",bubble:"bubbleChartStyles__bubble___s4Tlc",axis:"bubbleChartStyles__axis___3OLn6",axis_title:"bubbleChartStyles__axis_title___63QfN",axisTitle:"bubbleChartStyles__axis_title___63QfN","main-title":"bubbleChartStyles__main-title___31xon",mainTitle:"bubbleChartStyles__main-title___31xon","info-popup":"bubbleChartStyles__info-popup___3nm6s",infoPopup:"bubbleChartStyles__info-popup___3nm6s","info-popup_data":"bubbleChartStyles__info-popup_data___1ITvz",infoPopupData:"bubbleChartStyles__info-popup_data___1ITvz","info-popup_units":"bubbleChartStyles__info-popup_units___3h_oN",infoPopupUnits:"bubbleChartStyles__info-popup_units___3h_oN","info-popup_caption":"bubbleChartStyles__info-popup_caption___1v5W8",infoPopupCaption:"bubbleChartStyles__info-popup_caption___1v5W8","info-popup_subcaption":"bubbleChartStyles__info-popup_subcaption___2H9dB",infoPopupSubcaption:"bubbleChartStyles__info-popup_subcaption___2H9dB"}}],[3]);
//# sourceMappingURL=6066a9546e262140b92e.app.js.map