Skip to content

Instantly share code, notes, and snippets.

@ialarmedalien
Last active September 16, 2018 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ialarmedalien/8c7ceee7c0293bc6f922d98ae86a24a8 to your computer and use it in GitHub Desktop.
Save ialarmedalien/8c7ceee7c0293bc6f922d98ae86a24a8 to your computer and use it in GitHub Desktop.
dc.js treemap demonstration
license: mit
border: yes
scrolling: yes
height: 600

SVG treemap implementation for dc.js, demonstrating the effects of the different treemap layout algorithms and internal and external padding.

One of a set of hierarchical charts I have written for the dc.js library.

Data from https://unstats.un.org/

View the .block!

Global Code Global Name Region Code Region Name Sub-region Code Sub-region Name Intermediate Region Code Intermediate Region Name Country or Area M49 Code ISO-alpha3 Code Least Developed Countries (LDC) Land Locked Developing Countries (LLDC) Small Island Developing States (SIDS) Developed / Developing Countries
001 World 002 Africa 015 Northern Africa Algeria 012 DZA Developing
001 World 002 Africa 015 Northern Africa Egypt 818 EGY Developing
001 World 002 Africa 015 Northern Africa Libya 434 LBY Developing
001 World 002 Africa 015 Northern Africa Morocco 504 MAR Developing
001 World 002 Africa 015 Northern Africa Sudan 729 SDN x Developing
001 World 002 Africa 015 Northern Africa Tunisia 788 TUN Developing
001 World 002 Africa 015 Northern Africa Western Sahara 732 ESH Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa British Indian Ocean Territory 086 IOT Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Burundi 108 BDI x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Comoros 174 COM x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Djibouti 262 DJI x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Eritrea 232 ERI x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Ethiopia 231 ETH x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa French Southern Territories 260 ATF Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Kenya 404 KEN Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Madagascar 450 MDG x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Malawi 454 MWI x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Mauritius 480 MUS x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Mayotte 175 MYT Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Mozambique 508 MOZ x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Réunion 638 REU Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Rwanda 646 RWA x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Seychelles 690 SYC x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Somalia 706 SOM x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa South Sudan 728 SSD x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Uganda 800 UGA x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa United Republic of Tanzania 834 TZA x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Zambia 894 ZMB x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 014 Eastern Africa Zimbabwe 716 ZWE x Developing
001 World 002 Africa 202 Sub-Saharan Africa 017 Middle Africa Angola 024 AGO x Developing
001 World 002 Africa 202 Sub-Saharan Africa 017 Middle Africa Cameroon 120 CMR Developing
001 World 002 Africa 202 Sub-Saharan Africa 017 Middle Africa Central African Republic 140 CAF x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 017 Middle Africa Chad 148 TCD x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 017 Middle Africa Congo 178 COG Developing
001 World 002 Africa 202 Sub-Saharan Africa 017 Middle Africa Democratic Republic of the Congo 180 COD x Developing
001 World 002 Africa 202 Sub-Saharan Africa 017 Middle Africa Equatorial Guinea 226 GNQ Developing
001 World 002 Africa 202 Sub-Saharan Africa 017 Middle Africa Gabon 266 GAB Developing
001 World 002 Africa 202 Sub-Saharan Africa 017 Middle Africa Sao Tome and Principe 678 STP x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 018 Southern Africa Botswana 072 BWA x Developing
001 World 002 Africa 202 Sub-Saharan Africa 018 Southern Africa Eswatini 748 SWZ x Developing
001 World 002 Africa 202 Sub-Saharan Africa 018 Southern Africa Lesotho 426 LSO x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 018 Southern Africa Namibia 516 NAM Developing
001 World 002 Africa 202 Sub-Saharan Africa 018 Southern Africa South Africa 710 ZAF Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Benin 204 BEN x Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Burkina Faso 854 BFA x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Cabo Verde 132 CPV x Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Côte d’Ivoire 384 CIV Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Gambia 270 GMB x Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Ghana 288 GHA Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Guinea 324 GIN x Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Guinea-Bissau 624 GNB x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Liberia 430 LBR x Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Mali 466 MLI x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Mauritania 478 MRT x Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Niger 562 NER x x Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Nigeria 566 NGA Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Saint Helena 654 SHN Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Senegal 686 SEN x Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Sierra Leone 694 SLE x Developing
001 World 002 Africa 202 Sub-Saharan Africa 011 Western Africa Togo 768 TGO x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Anguilla 660 AIA x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Antigua and Barbuda 028 ATG x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Aruba 533 ABW x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Bahamas 044 BHS x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Barbados 052 BRB x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Bonaire, Sint Eustatius and Saba 535 BES x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean British Virgin Islands 092 VGB x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Cayman Islands 136 CYM Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Cuba 192 CUB x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Curaçao 531 CUW x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Dominica 212 DMA x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Dominican Republic 214 DOM x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Grenada 308 GRD x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Guadeloupe 312 GLP Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Haiti 332 HTI x x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Jamaica 388 JAM x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Martinique 474 MTQ Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Montserrat 500 MSR x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Puerto Rico 630 PRI x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Saint Barthélemy 652 BLM Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Saint Kitts and Nevis 659 KNA x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Saint Lucia 662 LCA x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Saint Martin (French Part) 663 MAF Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Saint Vincent and the Grenadines 670 VCT x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Sint Maarten (Dutch part) 534 SXM x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Trinidad and Tobago 780 TTO x Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean Turks and Caicos Islands 796 TCA Developing
001 World 019 Americas 419 Latin America and the Caribbean 029 Caribbean United States Virgin Islands 850 VIR x Developing
001 World 019 Americas 419 Latin America and the Caribbean 013 Central America Belize 084 BLZ x Developing
001 World 019 Americas 419 Latin America and the Caribbean 013 Central America Costa Rica 188 CRI Developing
001 World 019 Americas 419 Latin America and the Caribbean 013 Central America El Salvador 222 SLV Developing
001 World 019 Americas 419 Latin America and the Caribbean 013 Central America Guatemala 320 GTM Developing
001 World 019 Americas 419 Latin America and the Caribbean 013 Central America Honduras 340 HND Developing
001 World 019 Americas 419 Latin America and the Caribbean 013 Central America Mexico 484 MEX Developing
001 World 019 Americas 419 Latin America and the Caribbean 013 Central America Nicaragua 558 NIC Developing
001 World 019 Americas 419 Latin America and the Caribbean 013 Central America Panama 591 PAN Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America Argentina 032 ARG Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America Bolivia (Plurinational State of) 068 BOL x Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America Bouvet Island 074 BVT Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America Brazil 076 BRA Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America Chile 152 CHL Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America Colombia 170 COL Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America Ecuador 218 ECU Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America Falkland Islands (Malvinas) 238 FLK Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America French Guiana 254 GUF Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America Guyana 328 GUY x Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America Paraguay 600 PRY x Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America Peru 604 PER Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America South Georgia and the South Sandwich Islands 239 SGS Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America Suriname 740 SUR x Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America Uruguay 858 URY Developing
001 World 019 Americas 419 Latin America and the Caribbean 005 South America Venezuela (Bolivarian Republic of) 862 VEN Developing
001 World 019 Americas 021 Northern America Bermuda 060 BMU Developed
001 World 019 Americas 021 Northern America Canada 124 CAN Developed
001 World 019 Americas 021 Northern America Greenland 304 GRL Developed
001 World 019 Americas 021 Northern America Saint Pierre and Miquelon 666 SPM Developed
001 World 019 Americas 021 Northern America United States of America 840 USA Developed
001 World Antarctica 010 ATA
001 World 142 Asia 143 Central Asia Kazakhstan 398 KAZ x Developing
001 World 142 Asia 143 Central Asia Kyrgyzstan 417 KGZ x Developing
001 World 142 Asia 143 Central Asia Tajikistan 762 TJK x Developing
001 World 142 Asia 143 Central Asia Turkmenistan 795 TKM x Developing
001 World 142 Asia 143 Central Asia Uzbekistan 860 UZB x Developing
001 World 142 Asia 030 Eastern Asia China 156 CHN Developing
001 World 142 Asia 030 Eastern Asia China, Hong Kong Special Administrative Region 344 HKG Developing
001 World 142 Asia 030 Eastern Asia China, Macao Special Administrative Region 446 MAC Developing
001 World 142 Asia 030 Eastern Asia Democratic People's Republic of Korea 408 PRK Developing
001 World 142 Asia 030 Eastern Asia Japan 392 JPN Developed
001 World 142 Asia 030 Eastern Asia Mongolia 496 MNG x Developing
001 World 142 Asia 030 Eastern Asia Republic of Korea 410 KOR Developing
001 World 142 Asia 035 South-eastern Asia Brunei Darussalam 096 BRN Developing
001 World 142 Asia 035 South-eastern Asia Cambodia 116 KHM x Developing
001 World 142 Asia 035 South-eastern Asia Indonesia 360 IDN Developing
001 World 142 Asia 035 South-eastern Asia Lao People's Democratic Republic 418 LAO x x Developing
001 World 142 Asia 035 South-eastern Asia Malaysia 458 MYS Developing
001 World 142 Asia 035 South-eastern Asia Myanmar 104 MMR x Developing
001 World 142 Asia 035 South-eastern Asia Philippines 608 PHL Developing
001 World 142 Asia 035 South-eastern Asia Singapore 702 SGP x Developing
001 World 142 Asia 035 South-eastern Asia Thailand 764 THA Developing
001 World 142 Asia 035 South-eastern Asia Timor-Leste 626 TLS x x Developing
001 World 142 Asia 035 South-eastern Asia Viet Nam 704 VNM Developing
001 World 142 Asia 034 Southern Asia Afghanistan 004 AFG x x Developing
001 World 142 Asia 034 Southern Asia Bangladesh 050 BGD x Developing
001 World 142 Asia 034 Southern Asia Bhutan 064 BTN x x Developing
001 World 142 Asia 034 Southern Asia India 356 IND Developing
001 World 142 Asia 034 Southern Asia Iran (Islamic Republic of) 364 IRN Developing
001 World 142 Asia 034 Southern Asia Maldives 462 MDV x Developing
001 World 142 Asia 034 Southern Asia Nepal 524 NPL x x Developing
001 World 142 Asia 034 Southern Asia Pakistan 586 PAK Developing
001 World 142 Asia 034 Southern Asia Sri Lanka 144 LKA Developing
001 World 142 Asia 145 Western Asia Armenia 051 ARM x Developing
001 World 142 Asia 145 Western Asia Azerbaijan 031 AZE x Developing
001 World 142 Asia 145 Western Asia Bahrain 048 BHR Developing
001 World 142 Asia 145 Western Asia Cyprus 196 CYP Developed
001 World 142 Asia 145 Western Asia Georgia 268 GEO Developing
001 World 142 Asia 145 Western Asia Iraq 368 IRQ Developing
001 World 142 Asia 145 Western Asia Israel 376 ISR Developed
001 World 142 Asia 145 Western Asia Jordan 400 JOR Developing
001 World 142 Asia 145 Western Asia Kuwait 414 KWT Developing
001 World 142 Asia 145 Western Asia Lebanon 422 LBN Developing
001 World 142 Asia 145 Western Asia Oman 512 OMN Developing
001 World 142 Asia 145 Western Asia Qatar 634 QAT Developing
001 World 142 Asia 145 Western Asia Saudi Arabia 682 SAU Developing
001 World 142 Asia 145 Western Asia State of Palestine 275 PSE Developing
001 World 142 Asia 145 Western Asia Syrian Arab Republic 760 SYR Developing
001 World 142 Asia 145 Western Asia Turkey 792 TUR Developing
001 World 142 Asia 145 Western Asia United Arab Emirates 784 ARE Developing
001 World 142 Asia 145 Western Asia Yemen 887 YEM x Developing
001 World 150 Europe 151 Eastern Europe Belarus 112 BLR Developed
001 World 150 Europe 151 Eastern Europe Bulgaria 100 BGR Developed
001 World 150 Europe 151 Eastern Europe Czechia 203 CZE Developed
001 World 150 Europe 151 Eastern Europe Hungary 348 HUN Developed
001 World 150 Europe 151 Eastern Europe Poland 616 POL Developed
001 World 150 Europe 151 Eastern Europe Republic of Moldova 498 MDA x Developed
001 World 150 Europe 151 Eastern Europe Romania 642 ROU Developed
001 World 150 Europe 151 Eastern Europe Russian Federation 643 RUS Developed
001 World 150 Europe 151 Eastern Europe Slovakia 703 SVK Developed
001 World 150 Europe 151 Eastern Europe Ukraine 804 UKR Developed
001 World 150 Europe 154 Northern Europe Åland Islands 248 ALA Developed
001 World 150 Europe 154 Northern Europe 830 Channel Islands Guernsey 831 GGY Developed
001 World 150 Europe 154 Northern Europe 830 Channel Islands Jersey 832 JEY Developed
001 World 150 Europe 154 Northern Europe 830 Channel Islands Sark 680 Developed
001 World 150 Europe 154 Northern Europe Denmark 208 DNK Developed
001 World 150 Europe 154 Northern Europe Estonia 233 EST Developed
001 World 150 Europe 154 Northern Europe Faroe Islands 234 FRO Developed
001 World 150 Europe 154 Northern Europe Finland 246 FIN Developed
001 World 150 Europe 154 Northern Europe Iceland 352 ISL Developed
001 World 150 Europe 154 Northern Europe Ireland 372 IRL Developed
001 World 150 Europe 154 Northern Europe Isle of Man 833 IMN Developed
001 World 150 Europe 154 Northern Europe Latvia 428 LVA Developed
001 World 150 Europe 154 Northern Europe Lithuania 440 LTU Developed
001 World 150 Europe 154 Northern Europe Norway 578 NOR Developed
001 World 150 Europe 154 Northern Europe Svalbard and Jan Mayen Islands 744 SJM Developed
001 World 150 Europe 154 Northern Europe Sweden 752 SWE Developed
001 World 150 Europe 154 Northern Europe United Kingdom of Great Britain and Northern Ireland 826 GBR Developed
001 World 150 Europe 039 Southern Europe Albania 008 ALB Developed
001 World 150 Europe 039 Southern Europe Andorra 020 AND Developed
001 World 150 Europe 039 Southern Europe Bosnia and Herzegovina 070 BIH Developed
001 World 150 Europe 039 Southern Europe Croatia 191 HRV Developed
001 World 150 Europe 039 Southern Europe Gibraltar 292 GIB Developed
001 World 150 Europe 039 Southern Europe Greece 300 GRC Developed
001 World 150 Europe 039 Southern Europe Holy See 336 VAT Developed
001 World 150 Europe 039 Southern Europe Italy 380 ITA Developed
001 World 150 Europe 039 Southern Europe Malta 470 MLT Developed
001 World 150 Europe 039 Southern Europe Montenegro 499 MNE Developed
001 World 150 Europe 039 Southern Europe Portugal 620 PRT Developed
001 World 150 Europe 039 Southern Europe San Marino 674 SMR Developed
001 World 150 Europe 039 Southern Europe Serbia 688 SRB Developed
001 World 150 Europe 039 Southern Europe Slovenia 705 SVN Developed
001 World 150 Europe 039 Southern Europe Spain 724 ESP Developed
001 World 150 Europe 039 Southern Europe The former Yugoslav Republic of Macedonia 807 MKD x Developed
001 World 150 Europe 155 Western Europe Austria 040 AUT Developed
001 World 150 Europe 155 Western Europe Belgium 056 BEL Developed
001 World 150 Europe 155 Western Europe France 250 FRA Developed
001 World 150 Europe 155 Western Europe Germany 276 DEU Developed
001 World 150 Europe 155 Western Europe Liechtenstein 438 LIE Developed
001 World 150 Europe 155 Western Europe Luxembourg 442 LUX Developed
001 World 150 Europe 155 Western Europe Monaco 492 MCO Developed
001 World 150 Europe 155 Western Europe Netherlands 528 NLD Developed
001 World 150 Europe 155 Western Europe Switzerland 756 CHE Developed
001 World 009 Oceania 053 Australia and New Zealand Australia 036 AUS Developed
001 World 009 Oceania 053 Australia and New Zealand Christmas Island 162 CXR Developed
001 World 009 Oceania 053 Australia and New Zealand Cocos (Keeling) Islands 166 CCK Developed
001 World 009 Oceania 053 Australia and New Zealand Heard Island and McDonald Islands 334 HMD Developed
001 World 009 Oceania 053 Australia and New Zealand New Zealand 554 NZL Developed
001 World 009 Oceania 053 Australia and New Zealand Norfolk Island 574 NFK Developed
001 World 009 Oceania 054 Melanesia Fiji 242 FJI x Developing
001 World 009 Oceania 054 Melanesia New Caledonia 540 NCL x Developing
001 World 009 Oceania 054 Melanesia Papua New Guinea 598 PNG x Developing
001 World 009 Oceania 054 Melanesia Solomon Islands 090 SLB x x Developing
001 World 009 Oceania 054 Melanesia Vanuatu 548 VUT x x Developing
001 World 009 Oceania 057 Micronesia Guam 316 GUM x Developing
001 World 009 Oceania 057 Micronesia Kiribati 296 KIR x x Developing
001 World 009 Oceania 057 Micronesia Marshall Islands 584 MHL x Developing
001 World 009 Oceania 057 Micronesia Micronesia (Federated States of) 583 FSM x Developing
001 World 009 Oceania 057 Micronesia Nauru 520 NRU x Developing
001 World 009 Oceania 057 Micronesia Northern Mariana Islands 580 MNP x Developing
001 World 009 Oceania 057 Micronesia Palau 585 PLW x Developing
001 World 009 Oceania 057 Micronesia United States Minor Outlying Islands 581 UMI Developing
001 World 009 Oceania 061 Polynesia American Samoa 016 ASM x Developing
001 World 009 Oceania 061 Polynesia Cook Islands 184 COK x Developing
001 World 009 Oceania 061 Polynesia French Polynesia 258 PYF x Developing
001 World 009 Oceania 061 Polynesia Niue 570 NIU x Developing
001 World 009 Oceania 061 Polynesia Pitcairn 612 PCN Developing
001 World 009 Oceania 061 Polynesia Samoa 882 WSM x Developing
001 World 009 Oceania 061 Polynesia Tokelau 772 TKL Developing
001 World 009 Oceania 061 Polynesia Tonga 776 TON x Developing
001 World 009 Oceania 061 Polynesia Tuvalu 798 TUV x x Developing
001 World 009 Oceania 061 Polynesia Wallis and Futuna Islands 876 WLF Developing
/*!
* dc 3.0.6
* http://dc-js.github.io/dc.js/
* Copyright 2012-2016 Nick Zhu & the dc.js Developers
* https://github.com/dc-js/dc.js/blob/master/AUTHORS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
!function(){function t(t,e){"use strict";var n={version:"3.0.6",constants:{CHART_CLASS:"dc-chart",DEBUG_GROUP_CLASS:"debug",STACK_CLASS:"stack",DESELECTED_CLASS:"deselected",SELECTED_CLASS:"selected",NODE_INDEX_NAME:"__index__",GROUP_INDEX_NAME:"__group_index__",DEFAULT_CHART_GROUP:"__default_chart_group__",EVENT_DELAY:40,NEGLIGIBLE_NUMBER:1e-10},_renderlet:null};n.chartRegistry=function(){function t(t){return t||(t=n.constants.DEFAULT_CHART_GROUP),e[t]||(e[t]=[]),t}var e={};return{has:function(t){for(var n in e)if(e[n].indexOf(t)>=0)return!0;return!1},register:function(n,r){r=t(r),e[r].push(n)},deregister:function(n,r){r=t(r);for(var i=0;i<e[r].length;i++)if(e[r][i].anchorName()===n.anchorName()){e[r].splice(i,1);break}},clear:function(t){t?delete e[t]:e={}},list:function(n){return n=t(n),e[n]}}}(),n.registerChart=function(t,e){n.chartRegistry.register(t,e)},n.deregisterChart=function(t,e){n.chartRegistry.deregister(t,e)},n.hasChart=function(t){return n.chartRegistry.has(t)},n.deregisterAllCharts=function(t){n.chartRegistry.clear(t)},n.filterAll=function(t){for(var e=n.chartRegistry.list(t),r=0;r<e.length;++r)e[r].filterAll()},n.refocusAll=function(t){for(var e=n.chartRegistry.list(t),r=0;r<e.length;++r)e[r].focus&&e[r].focus()},n.renderAll=function(t){for(var e=n.chartRegistry.list(t),r=0;r<e.length;++r)e[r].render();null!==n._renderlet&&n._renderlet(t)},n.redrawAll=function(t){for(var e=n.chartRegistry.list(t),r=0;r<e.length;++r)e[r].redraw();null!==n._renderlet&&n._renderlet(t)},n.disableTransitions=!1,n.transition=function(t,e,r,i){if(n.disableTransitions||e<=0)return t;var a=t.transition(i);return(e>=0||void 0!==e)&&(a=a.duration(e)),(r>=0||void 0!==r)&&(a=a.delay(r)),a},n.optionalTransition=function(t,e,r,i){return t?function(t){return n.transition(t,e,r,i)}:function(t){return t}},n.afterTransition=function(t,e){if(t.empty()||!t.duration)e.call(t);else{var n=0;t.each(function(){++n}).on("end",function(){--n||e.call(t)})}},n.units={},n.units.integers=function(t,e){return Math.abs(e-t)},n.units.ordinal=function(){throw new Error("dc.units.ordinal should not be called - it is a placeholder")},n.units.fp={},n.units.fp.precision=function(t){var e=function(t,r){var i=Math.abs((r-t)/e.resolution);return n.utils.isNegligible(i-Math.floor(i))?Math.floor(i):Math.ceil(i)};return e.resolution=t,e},n.round={},n.round.floor=function(t){return Math.floor(t)},n.round.ceil=function(t){return Math.ceil(t)},n.round.round=function(t){return Math.round(t)},n.override=function(t,e,n){var r=t[e];t["_"+e]=r,t[e]=n},n.renderlet=function(t){return arguments.length?(n._renderlet=t,n):n._renderlet},n.instanceOfChart=function(t){return t instanceof Object&&t.__dcFlag__&&!0},n.errors={},n.errors.Exception=function(t){var e=t||"Unexpected internal error";this.message=e,this.toString=function(){return e},this.stack=(new Error).stack},n.errors.Exception.prototype=Object.create(Error.prototype),n.errors.Exception.prototype.constructor=n.errors.Exception,n.errors.InvalidStateException=function(){n.errors.Exception.apply(this,arguments)},n.errors.InvalidStateException.prototype=Object.create(n.errors.Exception.prototype),n.errors.InvalidStateException.prototype.constructor=n.errors.InvalidStateException,n.errors.BadArgumentException=function(){n.errors.Exception.apply(this,arguments)},n.errors.BadArgumentException.prototype=Object.create(n.errors.Exception.prototype),n.errors.BadArgumentException.prototype.constructor=n.errors.BadArgumentException,n.dateFormat=t.timeFormat("%m/%d/%Y"),n.printers={},n.printers.filters=function(t){for(var e="",r=0;r<t.length;++r)r>0&&(e+=", "),e+=n.printers.filter(t[r]);return e},n.printers.filter=function(t){var e="";return void 0!==t&&null!==t&&(t instanceof Array?t.length>=2?e="["+t.map(function(t){return n.utils.printSingleValue(t)}).join(" -> ")+"]":t.length>=1&&(e=n.utils.printSingleValue(t[0])):e=n.utils.printSingleValue(t)),e},n.pluck=function(t,e){return e?function(n,r){return e.call(n,n[t],r)}:function(e){return e[t]}},n.utils={},n.utils.printSingleValue=function(t){var e=""+t;return t instanceof Date?e=n.dateFormat(t):"string"==typeof t?e=t:n.utils.isFloat(t)?e=n.utils.printSingleValue.fformat(t):n.utils.isInteger(t)&&(e=Math.round(t)),e},n.utils.printSingleValue.fformat=t.format(".2f"),n.utils.toTimeFunc=function(t){return"time"+t.charAt(0).toUpperCase()+t.slice(1)},n.utils.add=function(e,r,i){if("string"==typeof r&&(r=r.replace("%","")),e instanceof Date)return"string"==typeof r&&(r=+r),"millis"===i?new Date(e.getTime()+r):("function"!=typeof(i=i||t.timeDay)&&(i=t[n.utils.toTimeFunc(i)]),i.offset(e,r));if("string"==typeof r){var a=+r/100;return e>0?e*(1+a):e*(1-a)}return e+r},n.utils.subtract=function(e,r,i){if("string"==typeof r&&(r=r.replace("%","")),e instanceof Date)return"string"==typeof r&&(r=+r),"millis"===i?new Date(e.getTime()-r):("function"!=typeof(i=i||t.timeDay)&&(i=t[n.utils.toTimeFunc(i)]),i.offset(e,-r));if("string"==typeof r){var a=+r/100;return e<0?e*(1+a):e*(1-a)}return e-r},n.utils.isNumber=function(t){return t===+t},n.utils.isFloat=function(t){return t===+t&&t!==(0|t)},n.utils.isInteger=function(t){return t===+t&&t===(0|t)},n.utils.isNegligible=function(t){return!n.utils.isNumber(t)||t<n.constants.NEGLIGIBLE_NUMBER&&t>-n.constants.NEGLIGIBLE_NUMBER},n.utils.clamp=function(t,e,n){return t<e?e:t>n?n:t},n.utils.constant=function(t){return function(){return t}};var r=0;n.utils.uniqueId=function(){return++r},n.utils.nameToId=function(t){return t.toLowerCase().replace(/[\s]/g,"_").replace(/[\.']/g,"")},n.utils.appendOrSelect=function(t,e,n){n=n||e;var r=t.select(e);return r.empty()&&(r=t.append(n)),r},n.utils.safeNumber=function(t){return n.utils.isNumber(+t)?+t:0},n.utils.arraysEqual=function(t,e){return!t&&!e||!(!t||!e)&&(t.length===e.length&&t.every(function(t,n){return t.valueOf()===e[n].valueOf()}))},n.utils.arraysIdentical=function(t,e){var n=t.length;if(n!==e.length)return!1;for(;n--;)if(t[n]!==e[n])return!1;return!0},n.utils.allChildren=function(t){var e=[];if(e.push(t.path),console.log("currentNode",t),t.children)for(var r=0;r<t.children.length;r++)e=e.concat(n.utils.allChildren(t.children[r]));return e},n.utils.toHierarchy=function(t,e){for(var n={key:"root",children:[]},r=0;r<t.length;r++)for(var i=t[r],a=i.key,o=e(i),l=n,c=0;c<a.length;c++){var u,s=a.slice(0,c+1),d=l.children,f=a[c];c+1<a.length?(void 0===(u=function(t,e){for(var n=0;n<t.length;n++)if(t[n].key===e)return t[n]}(d,f))&&(u={key:f,children:[],path:s},d.push(u)),l=u):(u={key:f,value:o,data:i,path:s},d.push(u))}return n},n.utils.getAncestors=function(t){for(var e=[],n=t;n.parent;)e.unshift(n.name),n=n.parent;return e},n.logger=function(){var t={};t.enableDebugLog=!1,t.warn=function(e){return console&&(console.warn?console.warn(e):console.log&&console.log(e)),t};var e={};return t.warnOnce=function(r){return e[r]||(e[r]=!0,n.logger.warn(r)),t},t.debug=function(e){return t.enableDebugLog&&console&&(console.debug?console.debug(e):console.log&&console.log(e)),t},t.deprecate=function(e,n){var r=!1;return function(){return r||(t.warn(n),r=!0),e.apply(this,arguments)}},t}(),n.config=function(){var t={},e=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"],r=e;return t.defaultColors=function(i){return arguments.length?(r=i,t):(r===e&&n.logger.warnOnce("You are using d3.schemeCategory20c, which has been removed in D3v5. See the explanation at https://github.com/d3/d3/blob/master/CHANGES.md#changes-in-d3-50. DC is using it for backward compatibility, however it will be changed in DCv3.1. You can change it by calling dc.config.defaultColors(newScheme). See https://github.com/d3/d3-scale-chromatic for some alternatives."),r)},t}(),n.events={current:null},n.events.trigger=function(t,e){e?(n.events.current=t,setTimeout(function(){t===n.events.current&&t()},e)):t()},n.filters={},n.filters.RangedFilter=function(t,e){var n=new Array(t,e);return n.isFiltered=function(t){return t>=this[0]&&t<this[1]},n.filterType="RangedFilter",n},n.filters.TwoDimensionalFilter=function(t){if(null===t)return null;var e=t;return e.isFiltered=function(t){return t.length&&t.length===e.length&&t[0]===e[0]&&t[1]===e[1]},e.filterType="TwoDimensionalFilter",e},n.filters.RangedTwoDimensionalFilter=function(t){if(null===t)return null;var e,n=t;return e=n[0]instanceof Array?[[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1])],[Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])]]:[[t[0],-1/0],[t[1],1/0]],n.isFiltered=function(t){var n,r;return t instanceof Array?(n=t[0],r=t[1]):(n=t,r=e[0][1]),n>=e[0][0]&&n<e[1][0]&&r>=e[0][1]&&r<e[1][1]},n.filterType="RangedTwoDimensionalFilter",n},n.filters.HierarchyFilter=function(t){if(null===t)return null;var e=t.slice(0);return e.isFiltered=function(t){if(!(e.length&&t&&t.length&&t.length>=e.length))return!1;for(var n=0;n<e.length;n++)if(t[n]!==e[n])return!1;return!0},e},n.baseMixin=function(r){function i(){s&&(k?s.attr("viewBox")||s.attr("viewBox","0 0 "+r.width()+" "+r.height()):s.attr("width",r.width()).attr("height",r.height()))}function a(t){if(!r[t]||!r[t]())throw new n.errors.InvalidStateException("Mandatory attribute chart."+t+" is missing on chart[#"+r.anchorName()+"]")}r.__dcFlag__=n.utils.uniqueId();var o,l,c,u,s,d,f,h,g,p,y,x=200,m=function(t){var e=t&&t.getBoundingClientRect&&t.getBoundingClientRect().width;return e&&e>x?e:x},v=m,A=200,b=function(t){var e=t&&t.getBoundingClientRect&&t.getBoundingClientRect().height;return e&&e>A?e:A},_=b,k=!1,D=n.pluck("key"),C=n.pluck("value"),w=n.pluck("key"),M=!1,E=function(t){return r.keyAccessor()(t)+": "+r.valueAccessor()(t)},L=!0,R=!1,S=n.pluck("key"),O=750,T=0,F=n.printers.filters,B=["dimension","group"],N=n.constants.DEFAULT_CHART_GROUP,P=t.dispatch("preRender","postRender","preRedraw","postRedraw","filtered","zoomed","renderlet","pretransition"),H=[],z=function(t,e){return 0===e.length?t.filter(null):1!==e.length||e[0].isFiltered?1===e.length&&"RangedFilter"===e[0].filterType?t.filterRange(e[0]):t.filterFunction(function(t){for(var n=0;n<e.length;n++){var r=e[n];if(r.isFiltered&&r.isFiltered(t))return!0;if(r<=t&&r>=t)return!0}return!1}):t.filterExact(e[0]),e},G=function(t){return t.all()};r.height=function(t){return arguments.length?(_=t?"function"==typeof t?t:n.utils.constant(t):b,h=void 0,r):(n.utils.isNumber(h)||(h=_(u.node())),h)},r.width=function(t){return arguments.length?(v=t?"function"==typeof t?t:n.utils.constant(t):m,f=void 0,r):(n.utils.isNumber(f)||(f=v(u.node())),f)},r.minWidth=function(t){return arguments.length?(x=t,r):x},r.minHeight=function(t){return arguments.length?(A=t,r):A},r.useViewBoxResizing=function(t){return arguments.length?(k=t,r):k},r.dimension=function(t){return arguments.length?(o=t,r.expireCache(),r):o},r.data=function(t){return arguments.length?(G="function"==typeof t?t:n.utils.constant(t),r.expireCache(),r):G.call(r,l)},r.group=function(t,e){return arguments.length?(l=t,r._groupName=e,r.expireCache(),r):l},r.ordering=function(t){return arguments.length?(S=t,g=e.quicksort.by(S),r.expireCache(),r):S},r._computeOrderedGroups=function(t,n){var r=t.slice(0),i=g;return r.length<=1?r:(2===arguments.length?i=e.quicksort.by(n):1!==arguments.length||g||(i=e.quicksort.by(ordering)),i(r,0,r.length))},r.filterAll=function(){return r.filter(null)},r.select=function(t){return u.select(t)},r.selectAll=function(t){return u?u.selectAll(t):null},r.anchor=function(e,i){if(!arguments.length)return c;if(n.instanceOfChart(e))c=e.anchor(),u=e.root(),d=!0;else{if(!e)throw new n.errors.BadArgumentException("parent must be defined");c=e.select&&e.classed?e.node():e,(u=t.select(c)).classed(n.constants.CHART_CLASS,!0),n.registerChart(r,i),d=!1}return N=i,r},r.anchorName=function(){var t=r.anchor();return t&&t.id?t.id:t&&t.replace?t.replace("#",""):"dc-chart"+r.chartID()},r.root=function(t){return arguments.length?(u=t,r):u},r.svg=function(t){return arguments.length?(s=t,r):s},r.resetSvg=function(){return r.select("svg").remove(),s=r.root().append("svg"),i(),s},r.filterPrinter=function(t){return arguments.length?(F=t,r):F},r.controlsUseVisibility=function(t){return arguments.length?(R=t,r):R},r.turnOnControls=function(){if(u){var t=r.controlsUseVisibility()?"visibility":"display";r.selectAll(".reset").style(t,null),r.selectAll(".filter").text(F(r.filters())).style(t,null)}return r},r.turnOffControls=function(){if(u){var t=r.controlsUseVisibility()?"visibility":"display",e=r.controlsUseVisibility()?"hidden":"none";r.selectAll(".reset").style(t,e),r.selectAll(".filter").style(t,e).text(r.filter())}return r},r.transitionDuration=function(t){return arguments.length?(O=t,r):O},r.transitionDelay=function(t){return arguments.length?(T=t,r):T},r._mandatoryAttributes=function(t){return arguments.length?(B=t,r):B},r.render=function(){h=f=void 0,P.call("preRender",r,r),B&&B.forEach(a);var t=r._doRender();return p&&p.render(),r._activateRenderlets("postRender"),t},r._activateRenderlets=function(t){P.call("pretransition",r,r),r.transitionDuration()>0&&s?s.transition().duration(r.transitionDuration()).delay(r.transitionDelay()).on("end",function(){P.call("renderlet",r,r),t&&P.call(t,r,r)}):(P.call("renderlet",r,r),t&&P.call(t,r,r))},r.redraw=function(){i(),P.call("preRedraw",r,r);var t=r._doRedraw();return p&&p.render(),r._activateRenderlets("postRedraw"),t},r.commitHandler=function(t){return arguments.length?(y=t,r):y},r.redrawGroup=function(){return y?y(!1,function(t,e){t?console.log(t):n.redrawAll(r.chartGroup())}):n.redrawAll(r.chartGroup()),r},r.renderGroup=function(){return y?y(!1,function(t,e){t?console.log(t):n.renderAll(r.chartGroup())}):n.renderAll(r.chartGroup()),r},r._invokeFilteredListener=function(t){void 0!==t&&P.call("filtered",r,r,t)},r._invokeZoomedListener=function(){P.call("zoomed",r,r)};var I=function(t,e){return null===e||void 0===e?t.length>0:t.some(function(t){return e<=t&&e>=t})};r.hasFilterHandler=function(t){return arguments.length?(I=t,r):I},r.hasFilter=function(t){return I(H,t)};var V=function(t,e){for(var n=0;n<t.length;n++)if(t[n]<=e&&t[n]>=e){t.splice(n,1);break}return t};r.removeFilterHandler=function(t){return arguments.length?(V=t,r):V};var U=function(t,e){return t.push(e),t};r.addFilterHandler=function(t){return arguments.length?(U=t,r):U};var Y=function(t){return[]};return r.resetFilterHandler=function(t){return arguments.length?(Y=t,r):Y},r.replaceFilter=function(t){return H=Y(H),r.filter(t),r},r.filter=function(t){if(!arguments.length)return H.length>0?H[0]:null;var e=H;return t instanceof Array&&t[0]instanceof Array&&!t.isFiltered?t[0].forEach(function(t){e=I(e,t)?V(e,t):U(e,t)}):e=null===t?Y(e):I(e,t)?V(e,t):U(e,t),H=function(t){if(r.dimension()&&r.dimension().filter){var e=z(r.dimension(),t);e&&(t=e)}return t}(e),r._invokeFilteredListener(t),null!==u&&r.hasFilter()?r.turnOnControls():r.turnOffControls(),r},r.filters=function(){return H},r.highlightSelected=function(e){t.select(e).classed(n.constants.SELECTED_CLASS,!0),t.select(e).classed(n.constants.DESELECTED_CLASS,!1)},r.fadeDeselected=function(e){t.select(e).classed(n.constants.SELECTED_CLASS,!1),t.select(e).classed(n.constants.DESELECTED_CLASS,!0)},r.resetHighlight=function(e){t.select(e).classed(n.constants.SELECTED_CLASS,!1),t.select(e).classed(n.constants.DESELECTED_CLASS,!1)},r.onClick=function(t){var e=r.keyAccessor()(t);n.events.trigger(function(){r.filter(e),r.redrawGroup()})},r.filterHandler=function(t){return arguments.length?(z=t,r):z},r._doRender=function(){return r},r._doRedraw=function(){return r},r.legendables=function(){return[]},r.legendHighlight=function(){},r.legendReset=function(){},r.legendToggle=function(){},r.isLegendableHidden=function(){return!1},r.keyAccessor=function(t){return arguments.length?(D=t,r):D},r.valueAccessor=function(t){return arguments.length?(C=t,r):C},r.label=function(t,e){return arguments.length?(w=t,(void 0===e||e)&&(M=!0),r):w},r.renderLabel=function(t){return arguments.length?(M=t,r):M},r.title=function(t){return arguments.length?(E=t,r):E},r.renderTitle=function(t){return arguments.length?(L=t,r):L},r.renderlet=n.logger.deprecate(function(t){return r.on("renderlet."+n.utils.uniqueId(),t),r},'chart.renderlet has been deprecated. Please use chart.on("renderlet.<renderletKey>", renderletFunction)'),r.chartGroup=function(t){return arguments.length?(d||n.deregisterChart(r,N),N=t,d||n.registerChart(r,N),r):N},r.expireCache=function(){return r},r.legend=function(t){return arguments.length?((p=t).parent(r),r):p},r.chartID=function(){return r.__dcFlag__},r.options=function(t){var e=["anchor","group","xAxisLabel","yAxisLabel","stack","title","point","getColor","overlayGeoJson"];for(var i in t)"function"==typeof r[i]?t[i]instanceof Array&&-1!==e.indexOf(i)?r[i].apply(r,t[i]):r[i].call(r,t[i]):n.logger.debug("Not a valid option setter name: "+i);return r},r.on=function(t,e){return P.on(t,e),r},r},n.marginMixin=function(t){var e={top:10,right:50,bottom:30,left:30};return t.margins=function(n){return arguments.length?(e=n,t):e},t.effectiveWidth=function(){return t.width()-t.margins().left-t.margins().right},t.effectiveHeight=function(){return t.height()-t.margins().top-t.margins().bottom},t.hasMargins=function(){return 0!==e.top||0!==e.bottom||0!==e.left||0!==e.right},t},n.colorMixin=function(e){var r=t.scaleOrdinal(n.config.defaultColors()),i=!0,a=function(t){return e.keyAccessor()(t)};return e.colors=function(i){return arguments.length?(r=i instanceof Array?t.scaleQuantize().range(i):"function"==typeof i?i:n.utils.constant(i),e):r},e.ordinalColors=function(n){return e.colors(t.scaleOrdinal().range(n))},e.linearColors=function(n){return e.colors(t.scaleLinear().range(n).interpolate(t.interpolateHcl))},e.colorAccessor=function(t){return arguments.length?(a=t,i=!1,e):a},e.defaultColorAccessor=function(){return i},e.colorDomain=function(t){return arguments.length?(r.domain(t),e):r.domain()},e.calculateColorDomain=function(){var n=[t.min(e.data(),e.colorAccessor()),t.max(e.data(),e.colorAccessor())];return r.domain(n),e},e.getColor=function(t,e){return r(a.call(this,t,e))},e.colorCalculator=n.logger.deprecate(function(t){return arguments.length?(e.getColor=t,e):e.getColor},"colorMixin.colorCalculator has been deprecated. Please colorMixin.colors and colorMixin.colorAccessor instead"),e},n.coordinateGridMixin=function(e){function r(r,i){e.isOrdinal()?(x.bandwidth||(n.logger.warn("For compatibility with d3v4+, dc.js d3.0 ordinal bar/line/bubble charts need d3.scaleBand() for the x scale, instead of d3.scaleOrdinal(). Replacing .x() with a d3.scaleBand with the same domain - make the same change in your code to avoid this warning!"),x=t.scaleBand().domain(x.domain())),(e.elasticX()||0===x.domain().length)&&x.domain(e._ordinalXDomain())):e.elasticX()&&x.domain([e.xAxisMin(),e.xAxisMax()]);var a=x.domain();!i&&n.utils.arraysEqual(b,a)||e.rescale(),b=a,e.isOrdinal()?x.range([0,e.xAxisLength()]).paddingInner($).paddingOuter(e._useOuterPadding()?Q:0):x.range([0,e.xAxisLength()]),L=L.scale(e.x()),function(t){var r=t.select("g."+f);if(U){r.empty()&&(r=t.insert("g",":first-child").attr("class",d+" "+f).attr("transform","translate("+e.margins().left+","+e.margins().top+")"));var i=L.tickValues()?L.tickValues():"function"==typeof x.ticks?x.ticks.apply(x,L.tickArguments()):x.domain(),a=r.selectAll("line").data(i),o=a.enter().append("line").attr("x1",function(t){return x(t)}).attr("y1",e._xAxisY()-e.margins().top).attr("x2",function(t){return x(t)}).attr("y2",0).attr("opacity",0);n.transition(o,e.transitionDuration(),e.transitionDelay()).attr("opacity",1);var l=o.merge(a);n.transition(l,e.transitionDuration(),e.transitionDelay()).attr("x1",function(t){return x(t)}).attr("y1",e._xAxisY()-e.margins().top).attr("x2",function(t){return x(t)}).attr("y2",0),a.exit().remove()}else r.selectAll("line").remove()}(r)}function i(){return tt?t.axisRight():t.axisLeft()}function a(){return e.anchorName().replace(/[ .#=\[\]"]/g,"-")+"-clip"}function o(){var t=n.utils.appendOrSelect(g,"defs"),r=a(),i=n.utils.appendOrSelect(t,"#"+r,"clipPath").attr("id",r),o=2*J;n.utils.appendOrSelect(i,"rect").attr("width",e.xAxisLength()+o).attr("height",e.yAxisHeight()+o).attr("transform","translate(-"+J+", -"+J+")")}function l(t){e.isOrdinal()&&(G=!1),r(e.g(),t),e._prepareYAxis(e.g()),e.plotData(),(e.elasticX()||Y||t)&&e.renderXAxis(e.g()),(e.elasticY()||Y||t)&&e.renderYAxis(e.g()),t?e.renderBrush(e.g(),!1):e.redrawBrush(e.filter(),Y),e.fadeDeselectedArea(e.filter()),Y=!1}function c(t,r){var i;!function(t){return t instanceof Array&&t.length>1}(t)?(e.x().domain(v),i=null):(e.x().domain(t),i=n.filters.RangedFilter(t[0],t[1])),e.replaceFilter(i),e.rescale(),e.redraw(),r||(M&&!n.utils.arraysEqual(e.filter(),M.filter())&&n.events.trigger(function(){M.replaceFilter(i),M.redraw()}),e._invokeZoomedListener(),n.events.trigger(function(){e.redrawGroup()},n.constants.EVENT_DELAY))}function u(){X&&X.transform(e.root(),function(e,n,r){var i=(n[1]-n[0])/(e[1]-e[0]),a=-1*r(e[0]);return t.zoomIdentity.scale(i).translate(a,0)}(e.x().domain(),v,m))}function s(t,e){return t&&2===t.length&&e&&2===e.length?((t[0]>e[1]||t[1]<e[0])&&console.warn("Could not intersect extents, will reset"),[t[0]>e[0]?t[0]:e[0],t[1]<e[1]?t[1]:e[1]]):t}var d="grid-line",f="vertical",h="custom-brush-handle";(e=n.colorMixin(n.marginMixin(n.baseMixin(e)))).colors(t.scaleOrdinal(t.schemeCategory10)),e._mandatoryAttributes().push("x");var g,p,y,x,m,v,A,b,_,k,D,C,w,M,E,L=t.axisBottom(),R=n.units.integers,S=0,O=t.timeDay,T=!1,F=0,B=null,N=0,P=!1,H=0,z=t.brushX(),G=!0,I=!1,V=!1,U=!1,Y=!1,W=[1,1/0],j=!0,X=t.zoom().on("zoom",function(){if(t.event.sourceEvent&&(!t.event.sourceEvent.type||-1===["start","zoom","end"].indexOf(t.event.sourceEvent.type))){var n=t.event.transform.rescaleX(m).domain();e.focus(n,!1)}}),q=t.zoom().on("zoom",null),K=!1,Z=!1,J=0,Q=.5,$=0,tt=!1;return e.rescale=function(){return w=void 0,Y=!0,e},e.resizing=function(){return Y},e.rangeChart=function(t){return arguments.length?((M=t).focusChart(e),e):M},e.zoomScale=function(t){return arguments.length?(W=t,e):W},e.zoomOutRestrict=function(t){return arguments.length?(j=t,e):j},e._generateG=function(t){g=void 0===t?e.svg():t;var n=window.location.href.split("#")[0];return p=g.append("g"),y=p.append("g").attr("class","chart-body").attr("transform","translate("+e.margins().left+", "+e.margins().top+")").attr("clip-path","url("+n+"#"+a()+")"),p},e.g=function(t){return arguments.length?(p=t,e):p},e.mouseZoomable=function(t){return arguments.length?(Z=t,e):Z},e.chartBodyG=function(t){return arguments.length?(y=t,e):y},e.x=function(t){return arguments.length?(x=t,v=x.domain(),e.rescale(),e):x},e.xOriginalDomain=function(){return v},e.xUnits=function(t){return arguments.length?(R=t,e):R},e.xAxis=function(t){return arguments.length?(L=t,e):L},e.elasticX=function(t){return arguments.length?(T=t,e):T},e.xAxisPadding=function(t){return arguments.length?(S=t,e):S},e.xAxisPaddingUnit=function(t){return arguments.length?(O=t,e):O},e.xUnitCount=function(){return void 0===w&&(e.isOrdinal()?w=e.x().domain().length:(w=e.xUnits()(e.x().domain()[0],e.x().domain()[1]))instanceof Array&&(w=w.length)),w},e.useRightYAxis=function(t){return arguments.length?(tt!==t&&B&&n.logger.warn("Value of useRightYAxis has been altered, after yAxis was created. You might get unexpected yAxis behavior. Make calls to useRightYAxis sooner in your chart creation process."),tt=t,e):tt},e.isOrdinal=function(){return e.xUnits()===n.units.ordinal},e._useOuterPadding=function(){return!0},e._ordinalXDomain=function(){return e._computeOrderedGroups(e.data()).map(e.keyAccessor())},e.renderXAxis=function(t){var r=t.select("g.x");r.empty()&&(r=t.append("g").attr("class","axis x").attr("transform","translate("+e.margins().left+","+e._xAxisY()+")"));var i=t.select("text.x-axis-label");i.empty()&&e.xAxisLabel()&&(i=t.append("text").attr("class","x-axis-label").attr("transform","translate("+(e.margins().left+e.xAxisLength()/2)+","+(e.height()-F)+")").attr("text-anchor","middle")),e.xAxisLabel()&&i.text()!==e.xAxisLabel()&&i.text(e.xAxisLabel()),n.transition(r,e.transitionDuration(),e.transitionDelay()).attr("transform","translate("+e.margins().left+","+e._xAxisY()+")").call(L),n.transition(i,e.transitionDuration(),e.transitionDelay()).attr("transform","translate("+(e.margins().left+e.xAxisLength()/2)+","+(e.height()-F)+")")},e._xAxisY=function(){return e.height()-e.margins().bottom},e.xAxisLength=function(){return e.effectiveWidth()},e.xAxisLabel=function(t,n){return arguments.length?(A=t,e.margins().bottom-=F,F=void 0===n?12:n,e.margins().bottom+=F,e):A},e._prepareYAxis=function(n){if(void 0===_||e.elasticY()){void 0===_&&(_=t.scaleLinear());var r=e.yAxisMin()||0,a=e.yAxisMax()||0;_.domain([r,a]).rangeRound([e.yAxisHeight(),0])}_.range([e.yAxisHeight(),0]),B||(B=i()),B.scale(_),e._renderHorizontalGridLinesForAxis(n,_,B)},e.renderYAxisLabel=function(t,r,i,a){a=a||H;var o=e.g().select("text.y-axis-label."+t+"-label"),l=e.margins().top+e.yAxisHeight()/2;o.empty()&&r&&(o=e.g().append("text").attr("transform","translate("+a+","+l+"),rotate("+i+")").attr("class","y-axis-label "+t+"-label").attr("text-anchor","middle").text(r)),r&&o.text()!==r&&o.text(r),n.transition(o,e.transitionDuration(),e.transitionDelay()).attr("transform","translate("+a+","+l+"),rotate("+i+")")},e.renderYAxisAt=function(t,r,i){var a=e.g().select("g."+t);a.empty()&&(a=e.g().append("g").attr("class","axis "+t).attr("transform","translate("+i+","+e.margins().top+")")),n.transition(a,e.transitionDuration(),e.transitionDelay()).attr("transform","translate("+i+","+e.margins().top+")").call(r)},e.renderYAxis=function(){var t=tt?e.width()-e.margins().right:e._yAxisX();e.renderYAxisAt("y",B,t);var n=tt?e.width()-H:H,r=tt?90:-90;e.renderYAxisLabel("y",e.yAxisLabel(),r,n)},e._renderHorizontalGridLinesForAxis=function(t,r,i){var a=t.select("g.horizontal");if(V){var o=i.tickValues()?i.tickValues():r.ticks?r.ticks.apply(r,i.tickArguments()):r.domain();a.empty()&&(a=t.insert("g",":first-child").attr("class",d+" horizontal").attr("transform","translate("+e.margins().left+","+e.margins().top+")"));var l=a.selectAll("line").data(o),c=l.enter().append("line").attr("x1",1).attr("y1",function(t){return r(t)}).attr("x2",e.xAxisLength()).attr("y2",function(t){return r(t)}).attr("opacity",0);n.transition(c,e.transitionDuration(),e.transitionDelay()).attr("opacity",1);var u=c.merge(l);n.transition(u,e.transitionDuration(),e.transitionDelay()).attr("x1",1).attr("y1",function(t){return r(t)}).attr("x2",e.xAxisLength()).attr("y2",function(t){return r(t)}),l.exit().remove()}else a.selectAll("line").remove()},e._yAxisX=function(){return e.useRightYAxis()?e.width()-e.margins().right:e.margins().left},e.yAxisLabel=function(t,n){return arguments.length?(k=t,e.margins().left-=H,H=void 0===n?12:n,e.margins().left+=H,e):k},e.y=function(t){return arguments.length?(_=t,e.rescale(),e):_},e.yAxis=function(t){return arguments.length?(B=t,e):(B||(B=i()),B)},e.elasticY=function(t){return arguments.length?(P=t,e):P},e.renderHorizontalGridLines=function(t){return arguments.length?(V=t,e):V},e.renderVerticalGridLines=function(t){return arguments.length?(U=t,e):U},e.xAxisMin=function(){var r=t.min(e.data(),function(t){return e.keyAccessor()(t)});return n.utils.subtract(r,S,O)},e.xAxisMax=function(){var r=t.max(e.data(),function(t){return e.keyAccessor()(t)});return n.utils.add(r,S,O)},e.yAxisMin=function(){var r=t.min(e.data(),function(t){return e.valueAccessor()(t)});return n.utils.subtract(r,N)},e.yAxisMax=function(){var r=t.max(e.data(),function(t){return e.valueAccessor()(t)});return n.utils.add(r,N)},e.yAxisPadding=function(t){return arguments.length?(N=t,e):N},e.yAxisHeight=function(){return e.effectiveHeight()},e.round=function(t){return arguments.length?(C=t,e):C},e._rangeBandPadding=function(t){return arguments.length?($=t,e):$},e._outerRangeBandPadding=function(t){return arguments.length?(Q=t,e):Q},n.override(e,"filter",function(t){return arguments.length?(e._filter(t),e.redrawBrush(t,!1),e):e._filter()}),e.brush=function(t){return arguments.length?(z=t,e):z},e.renderBrush=function(t,n){G&&(z.on("start brush end",e._brushing),D=t.append("g").attr("class","brush").attr("transform","translate("+e.margins().left+","+e.margins().top+")"),e.setBrushExtents(),e.createBrushHandlePaths(D,n),e.redrawBrush(e.filter(),n))},e.createBrushHandlePaths=function(t){var n=t.selectAll("path."+h).data([{type:"w"},{type:"e"}]);(n=n.enter().append("path").attr("class",h).merge(n)).attr("d",e.resizeHandlePath)},e.extendBrush=function(t){return t&&e.round()&&(t[0]=e.round()(t[0]),t[1]=e.round()(t[1])),t},e.brushIsEmpty=function(t){return!t||t[1]<=t[0]},e._brushing=function(){if(t.event.sourceEvent&&(!t.event.sourceEvent.type||-1===["start","brush","end"].indexOf(t.event.sourceEvent.type))){var r=t.event.selection;r&&(r=r.map(e.x().invert)),r=e.extendBrush(r),e.redrawBrush(r,!1);var i=e.brushIsEmpty(r)?null:n.filters.RangedFilter(r[0],r[1]);n.events.trigger(function(){e.applyBrushSelection(i)},n.constants.EVENT_DELAY)}},e.applyBrushSelection=function(t){e.replaceFilter(t),e.redrawGroup()},e.setBrushExtents=function(t){z.extent([[0,0],[e.effectiveWidth(),e.effectiveHeight()]]),D.call(z)},e.redrawBrush=function(t,r){if(G&&D)if(Y&&e.setBrushExtents(r),t){var i=[x(t[0]),x(t[1])],a=n.optionalTransition(r,e.transitionDuration(),e.transitionDelay())(D);a.call(z.move,i),a.selectAll("path."+h).attr("display",null).attr("transform",function(e,n){return"translate("+x(t[n])+", 0)"}).attr("d",e.resizeHandlePath)}else D.call(z.move,null),D.selectAll("path."+h).attr("display","none");e.fadeDeselectedArea(t)},e.fadeDeselectedArea=function(t){},e.resizeHandlePath=function(t){var n=+("e"===(t=t.type)),r=n?1:-1,i=e.effectiveHeight()/3;return"M"+.5*r+","+i+"A6,6 0 0 "+n+" "+6.5*r+","+(i+6)+"V"+(2*i-6)+"A6,6 0 0 "+n+" "+.5*r+","+2*i+"ZM"+2.5*r+","+(i+8)+"V"+(2*i-8)+"M"+4.5*r+","+(i+8)+"V"+(2*i-8)},e.clipPadding=function(t){return arguments.length?(J=t,e):J},e._preprocessData=function(){},e._doRender=function(){return e.resetSvg(),e._preprocessData(),e._generateG(),o(),l(!0),m=x.copy(),Z?e._enableMouseZoom():K&&e._disableMouseZoom(),e},e._doRedraw=function(){return e._preprocessData(),l(!1),o(),e},e._enableMouseZoom=function(){K=!0;var t=[[0,0],[e.effectiveWidth(),e.effectiveHeight()]];if(X.scaleExtent(W).extent(t).duration(e.transitionDuration()),j){var n=Math.max(W[0],1);X.translateExtent(t).scaleExtent([n,W[1]])}e.root().call(X),u()},e._disableMouseZoom=function(){e.root().call(q)},e.focus=function(t,e){j&&(t=s(t,v),M&&(t=s(t,M.x().domain()))),c(t,e),u()},e.refocused=function(){return!n.utils.arraysEqual(e.x().domain(),v)},e.focusChart=function(t){return arguments.length?(E=t,e.on("filtered.dcjs-range-chart",function(t){t.filter()?n.utils.arraysEqual(t.filter(),E.filter())||n.events.trigger(function(){E.focus(t.filter(),!0)}):n.events.trigger(function(){E.x().domain(E.xOriginalDomain(),!0)})}),e):E},e.brushOn=function(t){return arguments.length?(G=t,e):G},e.parentBrushOn=function(t){return arguments.length?(I=t,e):I},e.gBrush=function(){return D},e},n.stackMixin=function(e){function r(t,r){var i=t.accessor||e.valueAccessor();t.name=String(t.name||r);var a=t.group.all().map(function(n,r){return{x:e.keyAccessor()(n,r),y:t.hidden?null:i(n,r),data:n,layer:t.name,hidden:t.hidden}});t.domainValues=a.filter(function(){if(!e.x())return n.utils.constant(!0);var t=e.x().domain();if(e.isOrdinal())return function(){return!0};if(e.elasticX())return function(){return!0};return function(e){return e.x>=t[0]&&e.x<=t[t.length-1]}}()),t.values=e.evadeDomainFilter()?a:t.domainValues}function i(t){var e=c.map(n.pluck("name")).indexOf(t);return c[e]}function a(){var t=e.data().map(function(t){return t.domainValues});return Array.prototype.concat.apply([],t)}function o(t){return!t.hidden}var l=t.stack(),c=[],u={},s=!1,d=!1;return e.stack=function(t,n,r){if(!arguments.length)return c;arguments.length<=2&&(r=n);var i={group:t};return"string"==typeof n&&(i.name=n),"function"==typeof r&&(i.accessor=r),c.push(i),e},n.override(e,"group",function(t,n,r){return arguments.length?(c=[],u={},e.stack(t,n),r&&e.valueAccessor(r),e._group(t,n)):e._group()}),e.hidableStacks=function(t){return arguments.length?(s=t,e):s},e.hideStack=function(t){var n=i(t);return n&&(n.hidden=!0),e},e.showStack=function(t){var n=i(t);return n&&(n.hidden=!1),e},e.getValueAccessorByIndex=function(t){return c[t].accessor||e.valueAccessor()},e.yAxisMin=function(){var r=t.min(a(),function(t){return t.y<0?t.y+t.y0:t.y0});return n.utils.subtract(r,e.yAxisPadding())},e.yAxisMax=function(){var r=t.max(a(),function(t){return t.y>0?t.y+t.y0:t.y0});return n.utils.add(r,e.yAxisPadding())},e.xAxisMin=function(){var r=t.min(a(),n.pluck("x"));return n.utils.subtract(r,e.xAxisPadding(),e.xAxisPaddingUnit())},e.xAxisMax=function(){var r=t.max(a(),n.pluck("x"));return n.utils.add(r,e.xAxisPadding(),e.xAxisPaddingUnit())},n.override(e,"title",function(t,n){return t?"function"==typeof t?e._title(t):t===e._groupName&&"function"==typeof n?e._title(n):"function"!=typeof n?u[t]||e._title():(u[t]=n,e):e._title()}),e.stackLayout=function(t){return arguments.length?(l=t,e):l},e.evadeDomainFilter=function(t){return arguments.length?(d=t,e):d},e.data(function(){var t=c.filter(o);if(!t.length)return[];t.forEach(r);var n=t[0].values.map(function(e,n){var r={x:e.x};return t.forEach(function(t){r[t.name]=t.values[n].y}),r}),i=t.map(function(t){return t.name});return e.stackLayout().keys(i)(n).forEach(function(e,n){e.forEach(function(e,r){t[n].values[r].y0=e[0],t[n].values[r].y1=e[1]})}),t}),e._ordinalXDomain=function(){var t=a().map(n.pluck("data"));return e._computeOrderedGroups(t).map(e.keyAccessor())},e.colorAccessor(function(t){return this.layer||this.name||t.name||t.layer}),e.legendables=function(){return c.map(function(t,n){return{chart:e,name:t.name,hidden:t.hidden||!1,color:e.getColor.call(t,t.values,n)}})},e.isLegendableHidden=function(t){var e=i(t.name);return!!e&&e.hidden},e.legendToggle=function(t){s&&(e.isLegendableHidden(t)?e.showStack(t.name):e.hideStack(t.name),e.renderGroup())},e},n.capMixin=function(e){var r=1/0,i=!0,a="Others";e.ordering(function(t){return-t.value});var o=function(t){return-t.value},l=function(n,r){var i=t.sum(r,e.valueAccessor()),a=r.map(e.keyAccessor());return i>0?n.concat([{others:a,key:e.othersLabel(),value:i}]):n};return e.cappedKeyAccessor=function(t,n){return t.hasOwnProperty("others")?t.key:e.keyAccessor()(t,n)},e.cappedValueAccessor=function(t,n){return t.hasOwnProperty("others")?t.value:e.valueAccessor()(t,n)},e.data(function(t){if(r===1/0)return e._computeOrderedGroups(t.all());var n,a=t.all();if(a=e._computeOrderedGroups(a,o),r)if(i)n=a.slice(r),a=a.slice(0,r);else{var c=Math.max(0,a.length-r);n=a.slice(0,c),a=a.slice(c)}return l?l(a,n):a}),e.cap=function(t){return arguments.length?(r=t,e):r},e.takeFront=function(t){return arguments.length?(i=t,e):i},e.othersLabel=function(t){return arguments.length?(a=t,e):a},e.othersGrouper=function(t){return arguments.length?(l=t,e):l},n.override(e,"onClick",function(t){t.others&&e.filter([t.others]),e._onClick(t)}),e},n.bubbleMixin=function(e){var r=.3,i=10,a=!1,o=!1;e.BUBBLE_NODE_CLASS="node",e.BUBBLE_CLASS="bubble",e.MIN_RADIUS=10,(e=n.colorMixin(e)).renderLabel(!0),e.data(function(n){var r=n.all();if(a){var i=e.radiusValueAccessor();r.sort(function(e,n){return t.descending(i(e),i(n))})}return r});var l=t.scaleLinear().domain([0,100]),c=function(t){return t.r};e.r=function(t){return arguments.length?(l=t,e):l},e.elasticRadius=function(t){return arguments.length?(o=t,e):o},e.calculateRadiusDomain=function(){o&&e.r().domain([e.rMin(),e.rMax()])},e.radiusValueAccessor=function(t){return arguments.length?(c=t,e):c},e.rMin=function(){return t.min(e.data(),function(t){return e.radiusValueAccessor()(t)})},e.rMax=function(){return t.max(e.data(),function(t){return e.radiusValueAccessor()(t)})},e.bubbleR=function(t){var n=e.radiusValueAccessor()(t),r=e.r()(n);return(isNaN(r)||n<=0)&&(r=0),r};var u=function(t){return e.label()(t)},s=function(t){return e.bubbleR(t)>i},d=function(t){return s(t)?1:0},f=function(t){return s(t)?"all":"none"};e._doRenderLabel=function(t){if(e.renderLabel()){var r=t.select("text");r.empty()&&(r=t.append("text").attr("text-anchor","middle").attr("dy",".3em").on("click",e.onClick)),r.attr("opacity",0).attr("pointer-events",f).text(u),n.transition(r,e.transitionDuration(),e.transitionDelay()).attr("opacity",d)}},e.doUpdateLabels=function(t){if(e.renderLabel()){var r=t.select("text").attr("pointer-events",f).text(u);n.transition(r,e.transitionDuration(),e.transitionDelay()).attr("opacity",d)}};var h=function(t){return e.title()(t)};return e._doRenderTitles=function(t){if(e.renderTitle()){t.select("title").empty()&&t.append("title").text(h)}},e.doUpdateTitles=function(t){e.renderTitle()&&t.select("title").text(h)},e.sortBubbleSize=function(t){return arguments.length?(a=t,e):a},e.minRadius=function(t){return arguments.length?(e.MIN_RADIUS=t,e):e.MIN_RADIUS},e.minRadiusWithLabel=function(t){return arguments.length?(i=t,e):i},e.maxBubbleRelativeSize=function(t){return arguments.length?(r=t,e):r},e.fadeDeselectedArea=function(t){e.hasFilter()?e.selectAll("g."+e.BUBBLE_NODE_CLASS).each(function(t){e.isSelectedNode(t)?e.highlightSelected(this):e.fadeDeselected(this)}):e.selectAll("g."+e.BUBBLE_NODE_CLASS).each(function(){e.resetHighlight(this)})},e.isSelectedNode=function(t){return e.hasFilter(t.key)},e.onClick=function(t){var r=t.key;n.events.trigger(function(){e.filter(r),e.redrawGroup()})},e},n.pieChart=function(e,r){function i(){return t.pie().sort(null).value(a.cappedValueAccessor)}var a={tweenType:"pie"};return["base","color","cap","legendable","text","pieType"].forEach(function(t){a=n[t+"Mixin"](a)}),a.slicesCap=a.cap,a.filteredData=function(){return a.data()},a.prepareData=function(t,e){return e?i()([{key:a.emptyTitle(),value:1,others:[a.emptyTitle()]}]):i()(t)},a.__clickHandler=function(t,e){a.onClick(t.data,e)},a.isSelectedElement=function(t){return a.hasFilter(a.cappedKeyAccessor(t.data))},a.anchor(e,r)},n.legendableMixin=function(e){function n(n,r,i){e.selectAll("g."+e.elementCssClass).each(function(e){n.name===e.data.key&&t.select(this).classed("highlight",i)}),t.select(r).classed("highlight",i)}return e.legendablesData=function(){return e.data()},e.legendables=function(){return e.legendablesData().map(function(t,n){var r={name:t.key,data:t.value,others:t.others,chart:e};return r.color=e.getColor(t,n),r}).sort(function(e,n){return t.ascending(e.name,n.name)})},e.legendHighlight=function(t,e){n(t,e,!0)},e.legendReset=function(t,e){n(t,e,!1)},e.legendToggle=function(t,n){e.onClick({key:t.name,others:t.others})},e},n.highlighterMixin=function(t){var e=[];return t._highlightableClasses=function(n){return arguments.length?(e=n,t):e},t._highlightElement=function(n,r){e.forEach(function(e){t.select(e+"._"+n).classed("highlight",r)})},t._highlightFilter=function(){t.hasFilter()?e.forEach(function(e){t.selectAll(e).each(function(e){t.isSelectedElement(e)?t.highlightSelected(this):t.fadeDeselected(this)})}):e.forEach(function(e){t.selectAll(e).each(function(){t.resetHighlight(this)})})},t},n.pieTypeMixin=function(e){function r(){var n=0;!function(){var n=t.min([e.width(),e.height()])/2;d=f&&f<n?f:n,e.hasOwnProperty("_d3")&&e._d3.hasOwnProperty("scale")&&e._d3.scale.y.range([e.innerRadius(),e.radius()-e.externalRadiusPadding()])}();var r=e.filteredData(),o=0===r.length,u=e.prepareData(r,o);if(e.hasOwnProperty("nodes")&&(y=u[0]),h){h.classed(e.emptyCssClass(),o);var g=j(),p=t.transition().duration(e.transitionDuration()).delay(e.transitionDelay()),k=h.select("g."+A).selectAll("g."+x).data(u,function(t){return t.id||(t.id=++n)}),D=h.select("g."+b).selectAll("g."+m).data(u,function(t){return t.id||(t.id=++n)}),C=h.select("g."+_).selectAll("polyline."+v).data(u,function(t){return t.id||(t.id=++n)});h.attr("transform","translate("+e.cx()+","+e.cy()+")"),function(t,n,r,a,o){t.exit().transition(o).select("path").attr("fill","none"),t.exit().transition(o).remove();var l=t.enter().append("g").attr("class",i);l.append("path").on("mouseover",function(t,n){e._highlightElement(n,!0)}).on("mouseout",function(t,n){e._highlightElement(n,!1)}).on("click",e.hasOwnProperty("collapsible")&&e.collapsible()?s:z),e.renderTitle()&&e.text.addTitleElements(l);t.merge(l).transition(o).select("path").attr("fill",c).attrTween("d",B),e.renderTitle()&&e.text.updateTitleElements(t)}(k,0,0,0,p),function(n,r,i,o){n.exit().transition(o).remove();var c=!w;if(e.renderLabel()){var u=n.enter().append("g").attr("class",a);if(c?(u.append("path").attr("class","label-path").attr("d",function(t){return Y(t,i)}).attr("id",function(t,e){return"label-path-"+e}).style("fill","none").style("stroke","red"),u.append("text").on("mouseover",function(t,n){e._highlightElement(n,!0)}).on("mouseout",function(t,n){e._highlightElement(n,!1)}).attr("opacity",0).append("textPath").attr("startOffset","50%").attr("text-anchor","middle").attr("xlink:href",function(t,e){return"#label-path-"+e}).text(function(t){return e.label()(t)})):u.append("text").attr("text-anchor","middle").on("click",z).on("mouseover",function(t,n){e._highlightElement(n,!0)}).on("mouseout",function(t,n){e._highlightElement(n,!1)}).attr("transform",function(t){return G(t,i)}).attr("opacity",0).text(function(t){return e.label()(t)}),(n=u.merge(n).transition(o)).select("text").attr("opacity",1).attr("transform",function(t){return c?"":G(t,i)}).text(function(t){return e.label()(t)}).attr("class",function(t){return this.classList.value}).attr("visibility",function(t){return l(t)?"hidden":"visible"}),c&&n.select("path").attrTween("d",function(t){return H(V(t),this)}),r.exit().transition(o).remove(),w&&M){var s=q();(r=r.enter().append("polyline").attr("class",function(t,e){return v+" _"+e+" "+x}).on("click",z).on("mouseover",function(t,n){e._highlightElement(n,!0)}).on("mouseout",function(t,n){e._highlightElement(n,!1)}).merge(r)).transition(o).attrTween("points",function(e){var n={startAngle:T(e),endAngle:F(e)},r=t.interpolate(n,e);return this._current=r(0),function(t){var e=r(t);return[i.centroid(e),s.centroid(e)]}}).style("visibility",function(t){return t.height&&0!==t.height?"hidden":F(t)-T(t)<1e-4?"hidden":"visible"})}}}(D,C,g,p),e._highlightFilter()}}function i(t,e){var n=x+" _"+e;return t.depth?n+" "+x+"-level-"+t.depth+(0===t.height?" leaf":0===t.depth?" root":" internal"):n}function a(t,e){return m+(w?" external":"")}function o(t){var e=F(t)-T(t);return isNaN(e)||e<C}function l(t){return 0===e.cappedValueAccessor(t)}function c(t,n){return e.getColor(t.data,n)}function u(t,e){var n=t(e);return n.indexOf("NaN")>=0&&(n="M0,0"),n}function s(t){y=e.collapse(y.id===t.id?e.nodes[0]:t)}var d,f,h,g,p,y,x="pie-slice",m="pie-label",v="pie-path",A="pie-slice-group",b="pie-label-group",_="pie-path-group",k=0,D=0,C=.5,w=0,M=!1,E=!1;(e=n.emptyChartMixin(e)).colorAccessor(e.cappedKeyAccessor),(e=n.highlighterMixin(e)._highlightableClasses(["g."+x])).elementCssClass=x,e.renderLabel(!0),e.transitionDuration(350),e.transitionDelay(0),e._doRender=function(){return E||("slice"===e.tweenType?(T=S,F=O,B=P,j=X,q=K,L,R,G=I,V=U,e.onClick=z):B=N,e.text.setChartTextFunctions(),E=!0),e.resetSvg(),(h=e.svg().append("g").attr("transform","translate("+e.cx()+","+e.cy()+")")).append("g").attr("class",A),h.append("g").attr("class",b),h.append("g").attr("class",_),e._doRedraw()},e._doRedraw=function(){return r(),e};var L=function(t){return R(t)?e.label()(t):""},R=function(t){if(!e.isSelectedElement(t)){if(l(t))return!1;if(o(t))return!(0!==t.height||!w)}},S=function(t){return t.x0},O=function(t){return t.x1},T=function(t){return t.startAngle},F=function(t){return t.endAngle},B=function(t){},N=function(e){e.innerRadius=k;var n=this._current;n=function(t){return!t||isNaN(T(t))||isNaN(F(t))}(n)?{startAngle:0,endAngle:0}:{startAngle:n.startAngle,endAngle:n.endAngle};var r=t.interpolate(n,e);return this._current=r(0),function(t){return u(j(),r(t))}},P=function(e){var n=this._current;(function(t){return!t||isNaN(t.x0)||isNaN(t.y0)})(n)&&(n={x0:0,x1:0,y0:0,y1:0});var r={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},i=t.interpolate(n,r);return this._current=i(0),function(t){return u(j(),Object.assign({},e,i(t)))}},H=function(e,n){var r=n._current||{startAngle:0,endAngle:0,radius:0},i=t.interpolate(r,e);return n._current=i(0),function(t){return W(i(t))}},z=function(t,n){h.attr("class")!==e.emptyCssClass()&&e.__clickHandler(t,n)},G=function(e,n){var r;return r=w?t.arc().innerRadius(d-D+w).outerRadius(d-D+w).centroid(e):n.centroid(e),isNaN(r[0])||isNaN(r[1])?"translate(0,0)":"translate("+r+")"},I=function(e,n){var r;return r=w&&0===e.height?t.arc().innerRadius(d-D+w).outerRadius(d-D+w).centroid(e.hasOwnProperty("x0")?{startAngle:e.x1,endAngle:e.x0}:e):n.centroid(e),isNaN(r[0])||isNaN(r[1])?"translate(0,0)":"translate("+r+")"},V=function(t){return{radius:w?d-D+w:Math.max(0,(k+d)/2),startAngle:t.startAngle,endAngle:t.endAngle}},U=function(t){return{radius:Math.max(0,(e._d3.scale.y(t.y0)+e._d3.scale.y(t.y1))/2),startAngle:e._d3.scale.x(t.x0),endAngle:e._d3.scale.x(t.x1)}},Y=function(t){return W(V(t))},W=function(e){var n=[e.startAngle,e.endAngle],r=(e.startAngle+e.endAngle)/2,i=-8,a=r>.5*Math.PI&&r<1.5*Math.PI;a&&(n.reverse(),i=8),e.radius+i<0&&(i=0);var o=t.path();return o.arc(0,0,e.radius+i,n[0]-.5*Math.PI,n[1]-.5*Math.PI,a),o.toString()},j=function(){return t.arc().innerRadius(k).outerRadius(d-D)},X=function(){return t.arc().startAngle(function(t){return Math.max(0,Math.min(2*Math.PI,e._d3.scale.x(t.x0)))}).endAngle(function(t){return Math.max(0,Math.min(2*Math.PI,e._d3.scale.x(t.x1)))}).innerRadius(function(t){return Math.max(0,e._d3.scale.y(t.y0))}).outerRadius(function(t){return Math.max(0,e._d3.scale.y(t.y1))})},q=function(){return t.arc().innerRadius(d-D).outerRadius(d-D+w)},K=function(){return t.arc().startAngle(function(t){return Math.max(0,Math.min(2*Math.PI,e._d3.scale.x(t.x0)))}).endAngle(function(t){return Math.max(0,Math.min(2*Math.PI,e._d3.scale.x(t.x1)))}).innerRadius(d-D).outerRadius(d-D+w)};return e.collapse=function(n){var r=t.interpolate(e._d3.scale.x.domain(),[n.x0,n.x1]),i=t.interpolate(e._d3.scale.y.domain(),[n.y0,1]),a=t.interpolate(e._d3.scale.y.range(),[n.y0?20:e.innerRadius(),e.radius()-e.externalRadiusPadding()]),o=e.svg().transition().tween("scale",function(){return function(t){e._d3.scale.x.domain(r(t)),e._d3.scale.y.domain(i(t)).range(a(t))}});return o.selectAll("."+A+" path").attrTween("d",function(t){return function(e){return j()(t)}}),o.selectAll(".label-path").attrTween("d",function(t){return H(V(t),this)}),n},e.externalRadiusPadding=function(t){return arguments.length?(D=t,e):D},e.innerRadius=function(t){return arguments.length?(k=t,e):k},e.radius=function(t){return arguments.length?(f=t,e):f||d},e.cx=function(t){return arguments.length?(g=t,e):g||e.width()/2},e.cy=function(t){return arguments.length?(p=t,e):p||e.height()/2},e.minAngleForLabel=function(t){return arguments.length?(C=t,e):C},e.externalLabels=function(t){return 0===arguments.length?w:(w=t||void 0,e)},e.drawPaths=function(t){return 0===arguments.length?M:(M=t,e)},e};var i={path:{direct:function(){return[]},l_shape:function(t,e,n,r){return[{x:n,y:e}]},l_shape_alt:function(t,e,n,r){return[{x:t,y:r}]},dogleg:function(t,e,n,r){return[{x:t,y:(e+r)/2},{x:(t+n)/2,y:(e+r)/2},{x:n,y:(e+r)/2}]},dogleg_alt:function(t,e,n,r){return[{x:(t+n)/2,y:e},{x:(t+n)/2,y:(e+r)/2},{x:(t+n)/2,y:r}]}},cartesian:{},radial:{}};return Object.keys(i.path).forEach(function(e){i.cartesian[e]=function(){return t.mklink(function(t,n,r,a,o){var l=i.path[e](n,r,a,o);t.moveTo(n,r),l.forEach(function(e){t.lineTo(e.x,e.y)}),t.lineTo(a,o)})},i.radial[e]=function(){return t.mklink(function(n,r,a,o,l){var c=r===o?[]:i.path[e](r,a,o,l),u=t.pointRadial(r,a),s={x:r,y:a};n.moveTo(u[0],u[1]),c.push({x:o,y:l}),c.forEach(function(e,r){var i=t.pointRadial(e.x,e.y);e.x===s.x?n.lineTo(i[0],i[1]):n.arc(0,0,e.y,s.x-.5*Math.PI,e.x-.5*Math.PI,e.x>s.x?0:1),s={x:e.x,y:e.y}})})}}),n.diagonalMixin=function(e){var n="curved";return e.diagonalTypes=function(){return["curved"].concat(Object.keys(i.path))},e.diagonal=function(t){return 0===arguments.length?e._setDiagonal(n):(n=t,e._setDiagonal(n),e)},e._setDiagonal=function(r){0===arguments.length&&(r=n);var a="cartesian";if(e.hasOwnProperty("_d3")||(e._d3={}),"curved"!==r){e.radialLayout()&&(a="radial");try{return e.horizontalOrientation()?e._d3.diagonal=i[a][r]().x(function(t){return t.y}).y(function(t){return t.x}):e._d3.diagonal=i[a][r]().x(function(t){return t.x}).y(function(t){return t.y}),e._d3.diagonal}catch(t){throw t}}return e.radialLayout()?e._d3.diagonal=t.linkRadial().angle(function(t){return t.x}).radius(function(t){return t.y}):e.horizontalOrientation()?e._d3.diagonal=t.linkHorizontal().x(function(t){return t.y}).y(function(t){return t.x}):e._d3.diagonal=t.linkVertical().x(function(t){return t.x}).y(function(t){return t.y}),e._d3.diagonal},e},n.clusterLayoutMixin=function(e){e.layout={};var n={};["nodeSize","separation","round"].forEach(function(t){e.layout[t]=function(r){return arguments.length?(n[t]=r,e):n.hasOwnProperty(t)?n[t]:e._layout()[t]()}});var r="cluster",i=64,a="symbolCircle",o=["Circle","Cross","Diamond","Square","Star","Triangle","Wye"].map(function(t){return"symbol"+t});return e.layoutType=function(t){return 0===arguments.length?r:"cluster"!==t&&"tree"!==t?(console.log('Could not set layoutType; permitted values are "cluster" and "tree"'),e):(r=t,e)},e.nodeMarkerSize=function(t){return 0===arguments.length?i:(i=t,e)},e.nodeMarkerSymbol=function(t){if(0===arguments.length)return a;if(!o.includes(t))throw"Illegal symbol type: "+t;return a=t,e},e._layout=function(){var i=t[r]();for(var a in n)i[a](n[a]);return n.size||n.nodeSize||(e.radialLayout()?i.size([2*Math.PI,Math.min(e.effectiveHeight(),e.effectiveWidth())/2]):i.size([e.effectiveHeight(),e.effectiveWidth()])),i},e},n.clusterChart=function(e,r){function i(t,e){f.attr("class")!==d.emptyCssClass()&&d.__clickHandler(t,e)}function a(){var e=d.filteredData(),n=0===e.length,r=d.prepareData(e,n);r.x0=r.x,r.y0=r.y;var a=0;if(d.source=r,f){f.classed(d.emptyCssClass(),n),f.attr("transform",p);var _=f.select("g."+v).selectAll("path."+y).data(r.descendants().slice(1),function(t){return t.id||(t.id=++a)}),k=f.select("g."+A).selectAll("g."+x).data(r.descendants(),function(t){return t.id||(t.id=++a)});if(d.radialLayout()){var D={};r.descendants().forEach(function(t){D.hasOwnProperty(t.y)?D[t.y]++:D[t.y]=1});!function(t,e){t.exit().transition(e).attr("r",1e-6);t.enter().append("circle").attr("r",1e-6).attr("class","circClass").merge(t).transition(e).attr("r",function(t){return t})}(f.select("g."+b).selectAll("circle.circClass").data(Object.keys(D)),C)}var C=t.transition().duration(d.transitionDuration()).delay(d.transitionDelay());!function(e,n){var r=t.symbol().size(1e-6).type(t[d.nodeMarkerSymbol()]),a=e.exit().transition(n);a.attr("transform",function(t){return h(d.source)}).remove(),a.select("path").attr("d",r()),a.select("text").style("opacity",0);var f=e.enter().append("g").attr("class",u).attr("transform",function(t){return h({x:d.source.x0,y:d.source.y0})}).on("mouseover",o).on("mouseout",l),p=f.append("path").attr("d",r()).attr("class","node-"+d.nodeMarkerSymbol()).on("click",d.collapsible()?c:i);d.renderTitle()&&d.text.addTitleElements(p);d.renderLabel()&&f.append("text").attr("class",m).text(function(t){return d.label()(t)}).style("opacity",0).attr("dy",function(t){return t.height?"-.35em":".35em"}).style("text-anchor",function(t){return d.radialLayout()?t.x<Math.PI?"start":"end":t.children?"end":"start"}).attr("transform",g);var y=e.merge(f).transition(n);y.attr("transform",h),y.select("path").style("fill",s).attr("d",r.size(d.nodeMarkerSize())()),y.select("text").text(function(t){return d.label()(t)}).style("opacity",1).style("text-anchor",function(t){return d.radialLayout()?t.x<Math.PI?"start":"end":t.children?"end":"start"}).attr("transform",g),d.renderTitle()&&d.text.updateTitleElements(y.select("title"))}(k,C),function(e,n){e.exit().transition().attr("d",function(t){return delete t.x0,delete t.y0,d.diagonal()({source:d.source,target:d.source})}).remove();e.enter().insert("path","g").attr("class",y).attr("d",function(t){var e={x:d.source.x0,y:d.source.y0};return d.diagonal()({source:e,target:e})}).merge(e).transition(n).attrTween("d",function(e){var n,r;return e.x0&&e.y0?(r={x:e.x0,y:e.y0},n={x:e.parent.x0,y:e.parent.y0}):n=r={x:d.source.x0,y:d.source.y0},function(e,n){var r=t.interpolateObject(e.source,n.source),i=t.interpolateObject(e.target,n.target);return function(t){return d.diagonal()({source:r(t),target:i(t)})}}({source:n,target:r},{source:e.parent,target:e})})}(_,C),d._highlightFilter(),r.each(function(t){t.x0=t.x,t.y0=t.y})}}function o(t){for(var e=[t.id];null!==t.parent;)e.push(t.parent.id),t=t.parent;f.select("g."+v).selectAll("path."+y).each(function(t){e.includes(t.id)&&(this.parentNode.append(this),this.classList.add("toRoot"))})}function l(t){f.select("g."+v).selectAll("path."+y).classed("toRoot",!1)}function c(t){t.children?(t._children=t.children,t.children=null):t._children&&(t.children=t._children,t._children=null),a()}function u(t,e){return x+" _"+e+" "+x+"-level-"+t.depth+(0===t.height?" leaf":0===t.depth?" root":" internal")}function s(t,e){return d.getColor(t.data,e)}var d={};["base","color","margin","legendable","orientation","hierarchy","collapsible","radialLayout","clusterLayout","highlighter","diagonal","emptyChart"].forEach(function(t){d=n[t+"Mixin"](d)});var f,h,g,p,y="cluster-link",x="cluster-node",m="cluster-label",v="cluster-link-group",A="cluster-node-group",b="cluster-label-group",_={pt:{radial:function(e){return"translate("+t.pointRadial(e.x,e.y)+")"},h:function(t){return"translate("+t.y+","+t.x+")"},v:function(t){return"translate("+t.x+","+t.y+")"}},base:{radial:function(){return"translate("+(d.margins().left+d.effectiveWidth()/2)+","+(d.margins().top+d.effectiveHeight()/2)+")"},cartesian:function(){return"translate("+d.margins().left+","+(void 0!==d.layout.nodeSize()&&null!==d.layout.nodeSize()?d.margins().top+d.effectiveHeight()/2:d.margins().top)+")"}},text:{radial:function(t){return"rotate("+(180*t.x/Math.PI-90)+")translate(8,0)"+(t.x<Math.PI?"":"rotate(180)")},h:function(t){return"translate("+(t.height?"-":"")+"8,0)"},v:function(t){return"rotate(90)translate("+(t.height?"-":"")+"8,0)"}}},k=!1;return d._highlightableClasses(["g."+x,"path."+y]),d.margins({top:10,right:10,bottom:10,left:10}),d.colorAccessor(d.keyAccessor()),d.transitionDuration(350),d.transitionDelay(0),d.onClick=i,d.hasOwnProperty("_d3")||(d._d3={}),d._doRender=function(){return k||(d.radialLayout()?(p=_.base.radial,h=_.pt.radial,g=_.text.radial):(p=_.base.cartesian,h=d.horizontalOrientation()?_.pt.h:_.pt.v,g=d.horizontalOrientation()?_.text.h:_.text.v),d._setDiagonal(),d.text.setChartTextFunctions(),k=!0),d.resetSvg(),f=d.svg().append("g"),[b,v,A].forEach(function(t){f.append("g").attr("class",t)}),d._doRedraw()},d._doRedraw=function(){return a(),d},d.anchor(e,r)},n.hierarchyMixin=function(t){return t.isHierarchical=function(){return!0},t=n.hierarchyAccessorHandlerMixin(n.hierarchyDataMixin(n.hierarchyFilterMixin(n.hierarchyClickHandlerMixin(n.hierarchyTextMixin(t)))))},n.hierarchyDataMixin=function(e){return e.filteredData=function(){var t=e.valueAccessor();return e.hasOwnProperty("cap")&&e.cap()!==1/0&&(t=e.cappedValueAccessor),e.data().filter(function(e){return t(e)>0})},e.prepareData=function(t,n){var r,i;return n?i=e.layoutData([],e._layout()):(r=e.stratify(t),i=e.layoutData(r,e._layout())),i},e.layoutData=function(n,r){var i=e.valueAccessor();return e.hasOwnProperty("cap")&&e.cap()!==1/0&&(i=e.cappedValueAccessor),r(n.sum(function(t){return i(t)||0}).sort(function(n,r){return t.ascending(e.ordering()(n),e.ordering()(r))}))},e.createMissingAncestors=function(t,e){for(var n=[],r=t.map(function(t){return{data:t,ix:e(t).join("\0")}}).sort(function(t,e){return t.ix===e.ix?0:t.ix>e.ix}).map(function(t){return t.data}),i=[],a=0;a<r.length;a++){for(var o=r[a].key,l=0;l<o.length-1;l++)if(void 0===i[l]||i[l]!==o[l]){for(var c=1;c<o.length-l;c++)n.push({key:o.slice(0,l+c)});break}i=o}return n.concat(t)},e.stratify=function(n){var r=e.keyAccessor(),i=e.createMissingAncestors(n,r);try{return t.stratify().id(function(t){return r(t)}).parentId(function(t){return r(t).slice(0,-1)})(i)}catch(t){}try{return t.stratify().id(function(t){return["root"].concat(r(t))}).parentId(function(t){return 0===r(t).length?[]:["root"].concat(r(t).slice(0,-1))})(i.concat([{key:[]}]))}catch(t){console.log(t)}},e},n.hierarchyFilterMixin=function(t){return t.filterHandler(function(t,e){return 0===e.length?t.filter(null):t.filterFunction(function(t){for(var n=0;n<e.length;n++){var r=e[n];if(r.isFiltered&&r.isFiltered(t))return!0}return!1}),e}),t.isSelectedElement=function(e){return function(e){for(var n=0;n<t.filters().length;n++)if(t.filters()[n].isFiltered(e))return!0;return!1}(e.data.key||e.key)},t.filtersForPath=function(e){for(var r=n.filters.HierarchyFilter(e),i=[],a=0;a<t.filters().length;a++){var o=t.filters()[a];(o.isFiltered(e)||r.isFiltered(o))&&i.push(o)}return i},t.filterOnDatum=function(e){for(var r,i=e.hasOwnProperty("key")?e.key:e.data.key,a=n.filters.HierarchyFilter(i),o=t.filtersForPath(i),l=!1,c=o.length-1;c>=0;c--)r=o[c],n.utils.arraysIdentical(r,i)&&(l=!0),t.filter(o[c]);if(!l)return a},t},n.hierarchyClickHandlerMixin=function(t){return t.__clickHandler=function(e){var r=t.filterOnDatum(e);n.events.trigger(function(){void 0!==r&&t.filter(r),t.redrawGroup()})},t},n.textMixin=function(t){var e,r={uncapped:{acc:t.keyAccessor(),data_acc:function(e){return t.keyAccessor()(e.data)}},capped:{acc:t.cappedKeyAccessor,data_acc:function(e){return t.cappedKeyAccessor(e.data)}},label:function(t){return l(e(t))},title:function(t){return l(e(t))+": "+o(t)},title_this:function(t){return l(e(t),this)+": "+o(t)},label_this:function(t){return l(e(t),this)},display:function(t){return t},displaySep:function(t,e){return"string"==typeof t?t:t.length>1?e&&e.separator?t.join(e.separator):t.slice(-1)[0]:0===t.length?e&&e.rootName?e.rootName:"":t[0]}},i="uncapped",a={},o=t.valueAccessor(),l=r.display,c={};return t.text={},t.text.addTitleElements=function(e){e.append("title").text(function(e){return t.title()(e)})},t.text.updateTitleElements=function(e){e.select("title").text(function(e){return t.title()(e)})},t.text.bboxFit=function(t,e){var n=t.getBBox();return n.width>=e.x1-e.x0||n.height>=e.y1-e.y0},t.text.bboxFitCircle=function(t,e){var n=t.getBBox();return n.width+2>=2*e.r||n.height+2>=2*e.r},t.renderLabel(!0),t.text.setChartTextFunctions=function(){t.hasOwnProperty("cap")&&t.cap()!==1/0&&(i="capped",o=t.cappedValueAccessor),e=r[i].data_acc,t.text.hasOwnProperty("rootName")&&(l=r.displaySep,a={rootName:t.text.rootName(),separator:t.text.keySeparator()}),r.bound={title:r.title_this.bind(a),label:r.label_this.bind(a)},c.title||t._title(r.bound.title),c.label||t._label(r.bound.label)},n.override(t,"title",function(e){return arguments.length?(c.title=!0,t._title(e)):t._title()}),n.override(t,"label",function(e){return arguments.length?(c.label=!0,t._label(e)):t._label()}),t},n.hierarchyTextMixin=function(t){t=n.textMixin(t);var e={rootName:"root",keySeparator:null};return["rootName","keySeparator"].forEach(function(n){t.text[n]=function(r){return arguments.length?(e[n]=r,t):e.hasOwnProperty(n)?e[n]:""}}),t},n.hierarchyAccessorHandlerMixin=function(t){var e=n.pluck("key"),r=n.pluck("value");return t.keyAccessor=function(n){return arguments.length?(e=n,t.keyAccessorCustom=!0,t):e},t.valueAccessor=function(e){return arguments.length?(r=e,t.valueAccessorCustom=!0,t):r},n.override(t,"cappedValueAccessor",function(e){try{var n=t._cappedValueAccessor(e);if(n)return n;throw"No value returned"}catch(t){return e.data&&e.data.key&&e.value?e.value:0}}),n.override(t,"cappedKeyAccessor",function(e){var n=t._cappedKeyAccessor(e);return"string"==typeof n?[n]:n}),t},n.orientationMixin=function(t){var e=!1;return t.horizontalOrientation=function(n){return arguments.length?(e=n,t):e},t},n.radialLayoutMixin=function(t){var e=!1;return t.radialLayout=function(n){return arguments.length?(e=n,t):e},t},n.emptyChartMixin=function(t){var e="empty-chart",n="empty";return t.emptyTitle=function(e){return 0===arguments.length?n:(n=e,t)},t.emptyCssClass=function(n){return 0===arguments.length?e:(e=n,t)},t},n.collapsibleMixin=function(t){var e=!1;return t.collapsible=function(n){return arguments.length?(e=n,t):e},t},n.packLayoutMixin=function(e){e.layout={};var n={};return["radius","padding","size"].forEach(function(t){e.layout[t]=function(r){return arguments.length?(n[t]=r,e):n.hasOwnProperty(t)?n[t]:e._layout()[t]()}}),e._layout=function(){var r=t.pack();for(var i in n)r[i](n[i]);return n.size||r.size([e.effectiveWidth(),e.effectiveHeight()]),r},e},n.packChart=function(e,r){function i(t,e){c.attr("class")!==g.emptyCssClass()&&g.__clickHandler(t,e)}function a(t,e){return u+" _"+e+" "+u+"-level-"+t.depth+(0===t.height?" leaf":0===t.depth?" root":" internal")}function o(t,e){return g.getColor(t.data,e)}function l(){var e=g.filteredData(),n=0===e.length,r=g.prepareData(e,n),l=0;if(r[0],c){c.classed(g.emptyCssClass(),n),c.attr("transform","translate("+g.margins().left+","+g.margins().top+")");!function(t,e){var n=t.exit().transition(e);n.remove(),n.select("text").attr("opacity",0);var r=t.enter().append("g").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).attr("class",a).each(function(t){t.node=this}).on("mouseover",function(t,e){g._highlightElement(e,!0)}).on("mouseout",function(t,e){g._highlightElement(e,!1)}).on("click",i);r.append("circle").attr("id",function(t){return"circ-"+g.chartID()+"-"+t.id.replace(/\W/g,"_")}).attr("r",0).style("fill","transparent"),g.renderTitle()&&g.text.addTitleElements(r);r.append("clipPath").attr("id",function(t){return"clip-"+g.chartID()+"-"+t.id.replace(/\W/g,"_")}).append("use").attr("xlink:href",function(t){return"#circ-"+g.chartID()+"-"+t.id.replace(/\W/g,"_")}),r.append("text").attr("clip-path",function(t){return"url(#clip-"+g.chartID()+"-"+t.id.replace(/\W/g,"_")+")"}).attr("opacity",0).attr("text-anchor","middle").attr("dy",".35em").text(function(t){return g.label()(t)}).attr("class",s);var l=t.merge(r).transition(e);l.attr("transform",function(t){return"translate("+t.x+","+t.y+")"}),l.select("circle").attr("r",function(t){return isNaN(t.r)?0:t.r}).style("fill",o),l.select("text").text(function(t){return g.label()(t)}).attr("opacity",function(t){return 0!==g.valueAccessor()(t)?1:0}).attr("class",function(t){return isNaN(t.r)||t.height>0||t.r<h/2||g.text.bboxFitCircle(this,t)?s+" oversize":s}).style("visibility",function(t){return t.children?"hidden":"visible"}),g.renderTitle()&&g.text.updateTitleElements(l.select("title"))}(c.select("g."+d).selectAll("g."+u).data(r.descendants(),function(t){return t.id||(t.id=++l)}),t.transition().duration(g.transitionDuration()).delay(g.transitionDelay())),g._highlightFilter()}}var c,u="pack-element",s="pack-label",d=u+"-group",f=s+"-group",h=12,g={};["base","color","margin","legendable","orientation","hierarchy","packLayout","highlighter","emptyChart"].forEach(function(t){g=n[t+"Mixin"](g)});var p=!1;return g._highlightableClasses(["g."+u]),g.margins({top:10,right:10,bottom:10,left:10}),g.colorAccessor(g.keyAccessor()),g.transitionDuration(350),g.transitionDelay(0),g.onClick=i,g._doRender=function(){return p||(g.text.setChartTextFunctions(),p=!0),g.resetSvg(),(c=g.svg().append("g")).append("g").attr("class",d),c.append("g").attr("class",f),g._doRedraw()},g._doRedraw=function(){return l(),g},g.anchor(e,r)},n.partitionMixin=function(e){e.layout={};var n={};return["size","padding"].forEach(function(t){e.layout[t]=function(r){return arguments.length?(n[t]=r,e):n.hasOwnProperty(t)?n[t]:e._layout()[t]()}}),e.othersLabel([e.othersLabel()]),e._layout=function(){var r=t.partition();return n.padding&&(e.horizontalOrientation()?r.padding(e._d3.scale.y.invert(n.padding)):r.padding(e._d3.scale.x.invert(n.padding))),r},e.legendablesData=function(){return e.nodes.slice(1)||e.data()},e.layoutData=function(n,r){var i=r(n.sum(function(t){try{return e.cappedValueAccessor(t)||0}catch(t){return 0}}).sort(function(n,r){return t.ascending(e.ordering()(n),e.ordering()(r))})).descendants().map(function(t){return t.key=t.data.key,t});return e.nodes=i,i},e},n.partitionRectangle=function(e,r){function i(t,e){d.attr("class")!==s.emptyCssClass()&&s.__clickHandler(t,e)}function a(){s._d3.scale.x.range([0,1]),s._d3.scale.y.range([0,1]);var e=s.filteredData(),n=0===e.length,r=s.prepareData(e,n),a=0;if(f=r[0],console.log(r),d){d.classed(s.emptyCssClass(),n);var x=d.select("g."+y).selectAll("g."+g).data(r,function(t){return t.id||(t.id=++a)}),m=t.transition().duration(s.transitionDuration()).delay(s.transitionDelay());!function(t,e){t.exit().transition(e).remove();var n=t.enter().append("g").on("click",s.collapsible()?u:i).on("mouseover",function(t,e){s._highlightElement(e,!0)}).on("mouseout",function(t,e){s._highlightElement(e,!1)}).attr("class",o);s.renderTitle()&&s.text.addTitleElements(n);n.append("rect").attr("fill",l).attr("opacity",0).attr("width",0).attr("height",0),s.renderLabel()&&n.append("text").attr("class",p).attr("transform",function(t){return"translate(8,"+(h.height(t)/2+4)+")"}).attr("opacity",0).attr("text-anchor","middle").attr("dy",".35em").text(function(t){return s.label()(t)});c(t.merge(n),e)}(x,m),s._highlightFilter(),d.transition(m).attr("transform","translate("+s.margins().left+","+s.margins().top+")")}}function o(t,e){return g+" _"+e+" "+g+"-level-"+t.depth+(0===t.height?" leaf":0===t.depth?" root":" internal")}function l(t,e){return s.getColor(t.data,e)}function c(t,e){var n=t.transition(e);n.attr("transform",h.transform),n.select("rect").attr("opacity",1).attr("fill",l).attr("width",h.width).attr("height",h.height),s.renderLabel()&&n.select("text").text(function(t){return s.label()(t)}).attr("opacity",1).attr("transform",function(t){return"translate(8,"+h.height(t)/2+")"}).attr("class",function(t){return h.height(t)<m||s.text.bboxFit(this,t)?p+" oversize":p}),s.renderTitle()&&s.text.updateTitleElements(n.select("title"))}function u(t){f=s.collapse(f.id===t.id?s.nodes[0]:t)}var s={};["base","color","cap","margin","legendable","orientation","hierarchy","partition","highlighter","collapsible","emptyChart"].forEach(function(t){s=n[t+"Mixin"](s)});var d,f,h,g="partition-slice",p="partition-label",y="partition-slice-group",x="partition-label-group",m=12,v={v:{width:function(t){return s._d3.scale.x(t.x1)-s._d3.scale.x(t.x0)},height:function(t){return s._d3.scale.y(t.y1)-s._d3.scale.y(t.y0)},transform:function(t){return"translate("+s._d3.scale.x(t.x0)+","+s._d3.scale.y(t.y0)+")"},rescale:function(t){s._d3.scale.x.domain([t.x0,t.x1]).range([t.x0?20:0,1===t.x1?s.effectiveWidth():s.effectiveWidth()-20]),s._d3.scale.y.domain([t.y0,1]).range([t.y0?20:0,s.effectiveHeight()])}},h:{width:function(t){return s._d3.scale.x(t.y1)-s._d3.scale.x(t.y0)},height:function(t){return s._d3.scale.y(t.x1)-s._d3.scale.y(t.x0)},transform:function(t){return"translate("+s._d3.scale.x(t.y0)+","+s._d3.scale.y(t.x0)+")"},rescale:function(t){s._d3.scale.x.domain([t.y0,1]).range([t.y0?20:0,s.effectiveWidth()]),s._d3.scale.y.domain([t.x0,t.x1]).range([t.x0?20:0,1===t.x1?s.effectiveHeight():s.effectiveHeight()-20])}}};s.elementCssClass=g,s._highlightableClasses(["g."+g]),s.margins({top:0,right:0,bottom:0,left:0}),s.colorAccessor(s.cappedKeyAccessor),s.transitionDuration(350),s.transitionDelay(0),s.onClick=i,s._d3={scale:{x:t.scaleLinear(),y:t.scaleLinear()}};var A=!1;return s._doRender=function(){return A||(s.horizontalOrientation(),h=v.h,s.text.setChartTextFunctions(),A=!0),s.resetSvg(),(d=s.svg().append("g")).append("clipPath").attr("id",function(){return"clip-path-"+s.__dcFlag__}).append("rect").attr("x",0).attr("y",0).attr("width",s.effectiveWidth()).attr("height",s.effectiveHeight()),d.append("g").attr("class",y).attr("clip-path","url('#clip-path-"+s.__dcFlag__+"')"),d.append("g").attr("class",x),s._doRedraw()},s._doRedraw=function(){return a(),s},s.collapse=function(e){h.rescale(e);return c(d.select("g."+y).selectAll("g."+g),t.transition().duration(s.transitionDuration()).delay(s.transitionDelay())),e},s.minHeightForLabel=function(t){return arguments.length?(m=t,s):m},s.anchor(e,r)},n.partitionRectangleChart=n.partitionRectangle,n.partitionNodeLinkMixin=function(e){function r(t){for(var e=[t.id];null!==t.parent;)e.push(t.parent.id),t=t.parent;u.select("g."+h).selectAll("path."+s).each(function(t){e.includes(t.id)&&(this.parentNode.append(this),this.classList.add("toRoot"))})}function i(t){u.select("g."+h).selectAll("path."+s).classed("toRoot",!1)}function a(t,n){return e.getColor(t.data,n)}function o(t,n){u.attr("class")!==e.emptyCssClass()&&e.__clickHandler(t,n)}function l(t,e){return d+" _"+e+" "+d+"-level-"+t.depth+(0===t.height?" leaf":0===t.depth?" root":" internal")}function c(){var n=e.filteredData(),c=0===n.length,p=e.prepareData(n,c),x=0;if(console.log(p),p.forEach(function(t){t.x=(t.x0+t.x1)/2,t.y=(t.y0+t.y1)/2}),e.source=p[0],u){u.classed(e.emptyCssClass(),c);var m=u.select("g."+h).selectAll("path."+s).data(p.slice(1),function(t){return t.id||(t.id=++x)}),v=u.select("g."+g).selectAll("g."+d).data(p,function(t){return t.id||(t.id=++x)}),A=t.transition().duration(e.transitionDuration()).delay(e.transitionDelay());u.transition(A).attr("transform","translate("+e.margins().left+","+e.margins().top+")"),function(t,n){var c=t.exit().transition(n);c.attr("transform",function(t){return y(e.source)}).remove(),c.select("circle").attr("r",1e-6),c.select("text").style("opacity",0);var u=t.enter().append("g").attr("class",l).attr("transform",function(t){return y(e.source)}).on("mouseover",r).on("mouseout",i);u.append("rect").attr("fill",a).style("opacity",0).attr("width",0).attr("height",0);var s=u.append("circle").attr("r",1e-6).on("click",o);u.transition(n).attr("transform",function(t){return y(t)}),s.transition(n).attr("r",e.nodeMarkerSize).style("fill",a),e.renderTitle()&&e.text.addTitleElements(s);e.renderLabel()&&u.append("text").attr("class",f).text(function(t){return e.label()(t)}).style("opacity",0).attr("dy",function(t){return t.children||t._children?"-.35em":".35em"}).attr("x",function(t){return t.children||t._children?-10:0}).style("text-anchor",function(t){return t.children?"end":"middle"});var d=t.merge(u).transition(n);d.attr("transform",function(t){return y(t)}),d.select("rect").transition(n).style("opacity",function(t){return 0===e.cappedValueAccessor(t)?0:.2}).attr("fill",a).attr("width",function(t){return e._d3.scale.x(t.y1)-e._d3.scale.x(t.y0)}).attr("height",function(t){return e._d3.scale.y(t.x1)-e._d3.scale.y(t.x0)}).attr("transform",function(t){return"translate("+(e._d3.scale.x(t.y)-e._d3.scale.x(t.y1))+","+(e._d3.scale.y(t.x)-e._d3.scale.y(t.x1))+")"}),d.select("circle").attr("r",e.nodeMarkerSize).style("opacity",function(t){return 0===e.cappedValueAccessor(t)?0:1}).style("fill",a),d.select("text").style("opacity",function(t){return 0===e.cappedValueAccessor(t)?0:1}).text(function(t){return e.label()(t)}),e.renderTitle()&&e.text.updateTitleElements(d.select("title"))}(v,A),function(t,n){t.exit().transition(n).attr("d",function(t){var n={x:e._d3.scale.y(e.source.x),y:e._d3.scale.x(e.source.y)};return e._d3.diagonal({source:n,target:n})}).remove();t.enter().insert("path","g").attr("class",s).attr("d",function(t){var n={x:e._d3.scale.y(e.source.x0),y:e._d3.scale.x(e.source.y0)};return e._d3.diagonal({source:n,target:n})}).merge(t).transition(n).style("opacity",function(t){return 0===e.cappedValueAccessor(t)?0:1}).attr("d",function(t){return e._d3.diagonal({source:{x:e._d3.scale.y(t.parent.x),y:e._d3.scale.x(t.parent.y)},target:{x:e._d3.scale.y(t.x),y:e._d3.scale.x(t.y)}})})}(m,A),e._highlightFilter()}}e.radialLayout=function(){return!1},e._highlightableClasses(["g."+d,"path."+s]);var u,s="cluster-link",d="cluster-node",f="cluster-label",h="cluster-link-group",g="cluster-node-group",p="cluster-label-group";e.hasOwnProperty("_d3")||(e._d3={});var y,x={h:function(t){return"translate("+e._d3.scale.x(t.y)+","+e._d3.scale.y(t.x)+")"},v:function(t){return"translate("+e._d3.scale.x(t.x)+","+e._d3.scale.y(t.y)+")"}},m=!1;return(e=n.diagonalMixin(e))._doRedraw=function(){return c(),e},e._doRender=function(){return m||(e.text.setChartTextFunctions(),y=e.horizontalOrientation()?x.h:x.v,e.diagonal("curved"),m=!0),e._d3.scale.x.range([0,e.effectiveWidth()]),e._d3.scale.y.range([0,e.effectiveHeight()]),e.resetSvg(),u=e.svg().append("g"),[p,h,g].forEach(function(t){u.append("g").attr("class",t)}),c(),e},e.nodeMarkerSize=function(t){return t.children||t._children?5:0===t.height?e._d3.scale.x(.375*(t.x1-t.x0)):void 0},e},n.partitionClusterChart=function(t,e){return n.partitionNodeLinkMixin(n.partitionRectangle(t,e)).anchor(t,e)},n.treemapLayoutMixin=function(e){e.layout={};var n={};return["tile","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingBottom","paddingLeft","paddingRight"].forEach(function(t){e.layout[t]=function(r){return arguments.length?(n[t]=r,e):n.hasOwnProperty(t)?n[t]:e.layout()[t]()}}),e._layout=function(){var r=t.treemap();for(var i in n)r[i](n[i]);return n.size||r.size([e.effectiveWidth(),e.effectiveHeight()]),r},e},n.treemapChart=function(e,r){function i(t,e){c.attr("class")!==g.emptyCssClass()&&g.__clickHandler(t,e)}function a(t,e){return s+" _"+e+" "+s+"-level-"+t.depth+(0===t.height?" leaf":0===t.depth?" root":" internal")}function o(t,e){return g.getColor(t.data,e)}function l(){var e=g.filteredData(),n=0===e.length,r=g.prepareData(e,n),l=0;if(r[0],c){c.classed(g.emptyCssClass(),n),c.attr("transform","translate("+g.margins().left+","+g.margins().top+")");var h=u?"leaves":"descendants";!function(t,e){var n=t.exit().transition(e);n.attr("transform",function(t){return"translate("+(t.x0+t.x1)/2+","+(t.y0+t.y1)/2+")"}).remove(),n.select("rect").attr("width",0).attr("height",0),n.select("text").style("fill-opacity",0);var r=t.enter().append("g").attr("class",a).attr("transform",function(t){return"translate("+t.x0+","+t.y0+")"});r.append("rect").attr("id",function(t){return"rect_"+g.chartID()+"_"+t.id.replace(/\W/g,"_")}).attr("width",0).attr("height",0).attr("fill","none").on("click",i),r.append("clipPath").attr("id",function(t){return"clip_"+g.chartID()+"_"+t.id.replace(/\W/g,"_")}).append("use").attr("xlink:href",function(t){return"#rect_"+g.chartID()+"_"+t.id.replace(/\W/g,"_")}),g.renderLabel()&&r.append("text").attr("class",d).attr("clip-path",function(t){return"url(#clip_"+g.chartID()+"_"+t.id.replace(/\W/g,"_")+")"}).attr("x",function(t){return(t.x1-t.x0)/2}).attr("y",function(t){return(t.y1-t.y0)/2}).attr("opacity",0).attr("text-anchor","middle").attr("dy",".35em").text(function(t){return g.label()(t)});g.renderTitle()&&g.text.addTitleElements(r);var l=t.merge(r).transition(e);l.attr("transform",function(t){return"translate("+t.x0+","+t.y0+")"}),l.select("rect").attr("fill",o).attr("width",function(t){return isNaN(t.x1)||isNaN(t.x0)?0:t.x1-t.x0}).attr("height",function(t){return isNaN(t.y1)||isNaN(t.y0)?0:t.y1-t.y0}),l.select("text").text(function(t){return g.label()(t)}).attr("opacity",1).attr("x",function(t){return(t.x1-t.x0)/2}).attr("y",function(t){return(t.y1-t.y0)/2}),g.renderTitle()&&g.text.updateTitleElements(l.select("title"))}(c.select("g."+f).selectAll("g."+s).data(r[h](),function(t){return t.id||(t.id=++l)}),t.transition().duration(g.transitionDuration()).delay(g.transitionDelay())),g._highlightFilter()}}var c,u=!0,s="treemap-element",d="treemap-label",f=s+"-group",h=d+"-group",g={};["base","color","margin","legendable","orientation","hierarchy","treemapLayout","highlighter","emptyChart"].forEach(function(t){g=n[t+"Mixin"](g)});var p=!1;return g._highlightableClasses(["g."+s]),g.margins({top:10,right:10,bottom:10,left:10}),g.colorAccessor(g.keyAccessor()),g.transitionDuration(350),g.transitionDelay(0),g.onClick=i,g._doRender=function(){return p||(g.text.setChartTextFunctions(),p=!0),g.resetSvg(),(c=g.svg().append("g")).append("g").attr("class",f),c.append("g").attr("class",h),g._doRedraw()},g._doRedraw=function(){return l(),g},g.layout.leafNodesOnly=function(t){return arguments.length?(u=t,g):u},g.anchor(e,r)},n.sunburstChart=function(e,r){var i={tweenType:"slice"};return["base","color","cap","legendable","pieType","hierarchy","collapsible","partition"].forEach(function(t){i=n[t+"Mixin"](i)}),i._d3={scale:{x:t.scaleLinear().range([0,2*Math.PI]).clamp(!0),y:t.scaleLinear()}},i.anchor(e,r)},n.partitionArc=n.sunburstChart,n.barChart=function(e,r){function i(t){return n.utils.safeNumber(Math.abs(f.y()(t.y+t.y0)-f.y()(t.y0)))}function a(t){var e=f.x()(t.x);return g||(e+=u/2),f.isOrdinal()&&void 0!==h&&(e+=h/2),n.utils.safeNumber(e)}function o(t){var e=f.y()(t.y+t.y0);return t.y<0&&(e-=i(t)),n.utils.safeNumber(e-d)}function l(t){var e=f.x()(t.x);return g&&(e-=u/2),f.isOrdinal()&&void 0!==h&&(e+=h/2),n.utils.safeNumber(e)}function c(e,n){return function(){var r=t.select(this).attr("fill")===e;return n?!r:r}}var u,s=1,d=3,f=n.stackMixin(n.coordinateGridMixin({})),h=2,g=!1,p=!1;return n.override(f,"rescale",function(){return f._rescale(),u=void 0,f}),n.override(f,"render",function(){return f.round()&&g&&!p&&n.logger.warn("By default, brush rounding is disabled if bars are centered. See dc.js bar chart API documentation for details."),f._render()}),f.label(function(t){return n.utils.printSingleValue(t.y0+t.y)},!1),f.plotData=function(){var e=f.chartBodyG().selectAll("g.stack").data(f.data());!function(){if(void 0===u){var t=f.xUnitCount();((u=f.isOrdinal()&&void 0===h?Math.floor(f.x().bandwidth()):h?Math.floor((f.xAxisLength()-(t-1)*h)/t):Math.floor(f.xAxisLength()/(1+f.barPadding())/t))===1/0||isNaN(u)||u<s)&&(u=s)}}();var r=(e=e.enter().append("g").attr("class",function(t,e){return"stack _"+e}).merge(e)).size()-1;e.each(function(e,c){var s=t.select(this);!function(t,e,r){var a=t.selectAll("rect.bar").data(r.values,n.pluck("x")),o=a.enter().append("rect").attr("class","bar").attr("fill",n.pluck("data",f.getColor)).attr("x",l).attr("y",f.yAxisHeight()).attr("height",0),c=o.merge(a);f.renderTitle()&&o.append("title").text(n.pluck("data",f.title(r.name))),f.isOrdinal()&&c.on("click",f.onClick),n.transition(c,f.transitionDuration(),f.transitionDelay()).attr("x",l).attr("y",function(t){var e=f.y()(t.y+t.y0);return t.y<0&&(e-=i(t)),n.utils.safeNumber(e)}).attr("width",u).attr("height",function(t){return i(t)}).attr("fill",n.pluck("data",f.getColor)).select("title").text(n.pluck("data",f.title(r.name))),n.transition(a.exit(),f.transitionDuration(),f.transitionDelay()).attr("x",function(t){return f.x()(t.x)}).attr("width",.9*u).remove()}(s,0,e),f.renderLabel()&&r===c&&function(t,e,r){var i=t.selectAll("text.barLabel").data(r.values,n.pluck("x")),l=i.enter().append("text").attr("class","barLabel").attr("text-anchor","middle").attr("x",a).attr("y",o).merge(i);f.isOrdinal()&&(l.on("click",f.onClick),l.attr("cursor","pointer")),n.transition(l,f.transitionDuration(),f.transitionDelay()).attr("x",a).attr("y",o).text(function(t){return f.label()(t)}),n.transition(i.exit(),f.transitionDuration(),f.transitionDelay()).attr("height",0).remove()}(s,0,e)})},f.fadeDeselectedArea=function(t){var e=f.chartBodyG().selectAll("rect.bar");if(f.isOrdinal())f.hasFilter()?(e.classed(n.constants.SELECTED_CLASS,function(t){return f.hasFilter(t.x)}),e.classed(n.constants.DESELECTED_CLASS,function(t){return!f.hasFilter(t.x)})):(e.classed(n.constants.SELECTED_CLASS,!1),e.classed(n.constants.DESELECTED_CLASS,!1));else if(f.brushOn()||f.parentBrushOn())if(f.brushIsEmpty(t))e.classed(n.constants.DESELECTED_CLASS,!1);else{var r=t[0],i=t[1];e.classed(n.constants.DESELECTED_CLASS,function(t){return t.x<r||t.x>=i})}},f.centerBar=function(t){return arguments.length?(g=t,f):g},n.override(f,"onClick",function(t){f._onClick(t.data)}),f.barPadding=function(t){return arguments.length?(f._rangeBandPadding(t),h=void 0,f):f._rangeBandPadding()},f._useOuterPadding=function(){return void 0===h},f.outerPadding=f._outerRangeBandPadding,f.gap=function(t){return arguments.length?(h=t,f):h},f.extendBrush=function(t){return t&&f.round()&&(!g||p)&&(t[0]=f.round()(t[0]),t[1]=f.round()(t[1])),t},f.alwaysUseRounding=function(t){return arguments.length?(p=t,f):p},f.legendHighlight=function(t){f.isLegendableHidden(t)||f.g().selectAll("rect.bar").classed("highlight",c(t.color)).classed("fadeout",c(t.color,!0))},f.legendReset=function(){f.g().selectAll("rect.bar").classed("highlight",!1).classed("fadeout",!1)},n.override(f,"xAxisMax",function(){var t=this._xAxisMax();if("resolution"in f.xUnits()){t+=f.xUnits().resolution}return t}),f.anchor(e,r)},n.lineChart=function(e,r){function i(t,e){return m.getColor.call(t,t.values,e)}function a(){var e=null;if(D)return D;if("function"==typeof C)e=C;else{e={linear:t.curveLinear,"linear-closed":t.curveLinearClosed,step:t.curveStep,"step-before":t.curveStepBefore,"step-after":t.curveStepAfter,basis:t.curveBasis,"basis-open":t.curveBasisOpen,"basis-closed":t.curveBasisClosed,bundle:t.curveBundle,cardinal:t.curveCardinal,"cardinal-open":t.curveCardinalOpen,"cardinal-closed":t.curveCardinalClosed,monotone:t.curveMonotoneX}[C]}return e||(e=t.curveLinear),null!==w&&("function"!=typeof e.tension?n.logger.warn("tension was specified but the curve/interpolate does not support it."):e=e.tension(w)),e}function o(t){return!t||t.indexOf("NaN")>=0?"M0,0":t}function l(e,r){if("always"===m.xyTipsOn()||!m.brushOn()&&!m.parentBrushOn()&&m.xyTipsOn()){var i=h+"-list",a=e.select("g."+i);a.empty()&&(a=e.append("g").attr("class",i)),r.each(function(e,r){var i=e.values;d&&(i=i.filter(d));var o=a.select("g."+h+"._"+r);o.empty()&&(o=a.append("g").attr("class",h+" _"+r)),function(t){(t.select("path."+p).empty()?t.append("path").attr("class",p):t.select("path."+p)).style("display","none").attr("stroke-dasharray","5,5");(t.select("path."+y).empty()?t.append("path").attr("class",y):t.select("path."+y)).style("display","none").attr("stroke-dasharray","5,5")}(o);var l=o.selectAll("circle."+g).data(i,n.pluck("x")),s=l.enter().append("circle").attr("class",g).attr("cx",function(t){return n.utils.safeNumber(m.x()(t.x))}).attr("cy",function(t){return n.utils.safeNumber(m.y()(t.y+t.y0))}).attr("r",c()).style("fill-opacity",_).style("stroke-opacity",k).attr("fill",m.getColor).attr("stroke",m.getColor).on("mousemove",function(){var e=t.select(this);!function(t){t.style("fill-opacity",.8),t.style("stroke-opacity",.8),t.attr("r",A)}(e),function(t,e){var n=t.attr("cx"),r=t.attr("cy"),i="M"+(m._yAxisX()-m.margins().left)+" "+r+"L"+n+" "+r,a="M"+n+" "+m.yAxisHeight()+"L"+n+" "+r;e.select("path."+p).style("display","").attr("d",i),e.select("path."+y).style("display","").attr("d",a)}(e,o)}).on("mouseout",function(){!function(t){t.style("fill-opacity",_).style("stroke-opacity",k).attr("r",c())}(t.select(this)),function(t){t.select("path."+p).style("display","none"),t.select("path."+y).style("display","none")}(o)}).merge(l);s.call(u,e),n.transition(s,m.transitionDuration()).attr("cx",function(t){return n.utils.safeNumber(m.x()(t.x))}).attr("cy",function(t){return n.utils.safeNumber(m.y()(t.y+t.y0))}).attr("fill",m.getColor),l.exit().remove()})}}function c(){return b||A}function u(t,e){m.renderTitle()&&(t.select("title").remove(),t.append("title").text(n.pluck("data",m.title(e.name))))}function s(e,n,r){return function(){var i=t.select(this),a=i.attr("stroke")===e&&i.attr("stroke-dasharray")===(n instanceof Array?n.join(","):null)||i.attr("fill")===e;return r?!a:a}}var d,f,h="dc-tooltip",g="dot",p="yRef",y="xRef",x=3,m=n.stackMixin(n.coordinateGridMixin({})),v=!1,A=5,b=null,_=1e-6,k=1e-6,D=null,C=null,w=null,M=!0;return m.transitionDuration(500),m.transitionDelay(0),m._rangeBandPadding(1),m.plotData=function(){var e=m.chartBodyG(),r=e.select("g.stack-list");r.empty()&&(r=e.append("g").attr("class","stack-list"));var c=r.selectAll("g.stack").data(m.data()),u=c.enter().append("g").attr("class",function(t,e){return"stack _"+e});(function(e,r){var l=t.line().x(function(t){return m.x()(t.x)}).y(function(t){return m.y()(t.y+t.y0)}).curve(a());d&&l.defined(d);var c=e.append("path").attr("class","line").attr("stroke",i);f&&c.attr("stroke-dasharray",f),n.transition(r.select("path.line"),m.transitionDuration(),m.transitionDelay()).attr("stroke",i).attr("d",function(t){return o(l(t.values))})})(u,c=u.merge(c)),function(e,r){if(v){var l=t.area().x(function(t){return m.x()(t.x)}).y1(function(t){return m.y()(t.y+t.y0)}).y0(function(t){return m.y()(t.y0)}).curve(a());d&&l.defined(d),e.append("path").attr("class","area").attr("fill",i).attr("d",function(t){return o(l(t.values))}),n.transition(r.select("path.area"),m.transitionDuration(),m.transitionDelay()).attr("fill",i).attr("d",function(t){return o(l(t.values))})}}(u,c),l(e,c),m.renderLabel()&&function(e){e.each(function(e,r){var i=t.select(this).selectAll("text.lineLabel").data(e.values,n.pluck("x")),a=i.enter().append("text").attr("class","lineLabel").attr("text-anchor","middle").merge(i);n.transition(a,m.transitionDuration()).attr("x",function(t){return n.utils.safeNumber(m.x()(t.x))}).attr("y",function(t){var e=m.y()(t.y+t.y0)-x;return n.utils.safeNumber(e)}).text(function(t){return m.label()(t)}),n.transition(i.exit(),m.transitionDuration()).attr("height",0).remove()})}(c)},m.curve=function(t){return arguments.length?(D=t,m):D},m.interpolate=n.logger.deprecate(function(t){return arguments.length?(C=t,m):C},"dc.lineChart.interpolate has been deprecated since version 3.0 use dc.lineChart.curve instead"),m.tension=n.logger.deprecate(function(t){return arguments.length?(w=t,m):w},"dc.lineChart.tension has been deprecated since version 3.0 use dc.lineChart.curve instead"),m.defined=function(t){return arguments.length?(d=t,m):d},m.dashStyle=function(t){return arguments.length?(f=t,m):f},m.renderArea=function(t){return arguments.length?(v=t,m):v},m.label(function(t){return n.utils.printSingleValue(t.y0+t.y)},!1),m.xyTipsOn=function(t){return arguments.length?(M=t,m):M},m.dotRadius=function(t){return arguments.length?(A=t,m):A},m.renderDataPoints=function(t){return arguments.length?(t?(_=t.fillOpacity||.8,k=t.strokeOpacity||0,b=t.radius||2):(_=1e-6,k=1e-6,b=null),m):{fillOpacity:_,strokeOpacity:k,radius:b}},m.legendHighlight=function(t){m.isLegendableHidden(t)||m.g().selectAll("path.line, path.area").classed("highlight",s(t.color,t.dashstyle)).classed("fadeout",s(t.color,t.dashstyle,!0))},m.legendReset=function(){m.g().selectAll("path.line, path.area").classed("highlight",!1).classed("fadeout",!1)},n.override(m,"legendables",function(){var t=m._legendables();return f?t.map(function(t){return t.dashstyle=f,t}):t}),m.anchor(e,r)},n.dataCount=function(e,r){var i=t.format(",d"),a=n.baseMixin({}),o={some:"",all:""};return a.html=function(t){return arguments.length?(t.all&&(o.all=t.all),t.some&&(o.some=t.some),a):o},a.formatNumber=function(t){return arguments.length?(i=t,a):i},a._doRender=function(){var t=a.dimension().size(),e=a.group().value(),n=i(t),r=i(e);return t===e&&""!==o.all?a.root().html(o.all.replace("%total-count",n).replace("%filter-count",r)):""!==o.some?a.root().html(o.some.replace("%total-count",n).replace("%filter-count",r)):(a.selectAll(".total-count").text(n),a.selectAll(".filter-count").text(r)),a},a._doRedraw=function(){return a._doRender()},a.anchor(e,r)},n.dataTable=function(e,r){function i(){var e=!0;if(h.forEach(function(t){e&="function"==typeof t}),!e){var n=d.selectAll("thead").data([0]);n.exit().remove();var r=(n=n.enter().append("thead").merge(n)).selectAll("tr").data([0]);r.exit().remove();var i=(r=r.enter().append("tr").merge(r)).selectAll("th").data(h);i.exit().remove(),i.enter().append("th").merge(i).attr("class",s).html(function(t){return d._doColumnHeaderFormat(t)})}var l=d.root().selectAll("tbody").data(function(){var e;e=p===t.ascending?d.dimension().bottom(f):d.dimension().top(f);return t.nest().key(d.group()).sortKeys(p).entries(e.sort(function(t,e){return p(g(t),g(e))}).slice(y,a))}(),function(t){return d.keyAccessor()(t)}),c=l.enter().append("tbody");return!0===x&&c.append("tr").attr("class",u).append("td").attr("class",o).attr("colspan",h.length).html(function(t){return d.keyAccessor()(t)}),l.exit().remove(),c}var a,o="dc-table-label",l="dc-table-row",c="dc-table-column",u="dc-table-group",s="dc-table-head",d=n.baseMixin({}),f=25,h=[],g=function(t){return t},p=t.ascending,y=0,x=!0;return d._doRender=function(){return d.selectAll("tbody").remove(),function(t){var e=t.order().selectAll("tr."+l).data(function(t){return t.values}),n=e.enter().append("tr").attr("class",l);h.forEach(function(t,e){n.append("td").attr("class",c+" _"+e).html(function(e){return d._doColumnValueFormat(t,e)})}),e.exit().remove()}(i()),d},d._doColumnValueFormat=function(t,e){return"function"==typeof t?t(e):"string"==typeof t?e[t]:t.format(e)},d._doColumnHeaderFormat=function(t){return"function"==typeof t?d._doColumnHeaderFnToString(t):"string"==typeof t?d._doColumnHeaderCapitalize(t):String(t.label)},d._doColumnHeaderCapitalize=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},d._doColumnHeaderFnToString=function(t){var e=String(t),n=e.indexOf("return ");if(n>=0){var r=e.lastIndexOf(";");if(r>=0){(e=e.substring(n+7,r)).indexOf("numberFormat")>=0&&(e=e.replace("numberFormat",""))}}return e},d._doRedraw=function(){return d._doRender()},d.size=function(t){return arguments.length?(f=t,d):f},d.beginSlice=function(t){return arguments.length?(y=t,d):y},d.endSlice=function(t){return arguments.length?(a=t,d):a},d.columns=function(t){return arguments.length?(h=t,d):h},d.sortBy=function(t){return arguments.length?(g=t,d):g},d.order=function(t){return arguments.length?(p=t,d):p},d.showGroups=function(t){return arguments.length?(x=t,d):x},d.anchor(e,r)},n.dataGrid=function(e,r){function i(){var e=c.root().selectAll("div."+l).data(function(){var e=c.dimension().top(u);return t.nest().key(c.group()).sortKeys(f).entries(e.sort(function(t,e){return f(d(t),d(e))}).slice(h,a))}(),function(t){return c.keyAccessor()(t)}),n=e.enter().append("div").attr("class",l);return g&&n.html(function(t){return g(t)}),e.exit().remove(),n}var a,o="dc-grid-item",l="dc-grid-top",c=n.baseMixin({}),u=999,s=function(t){return"you need to provide an html() handling param: "+JSON.stringify(t)},d=function(t){return t},f=t.ascending,h=0,g=function(t){return"<div class='dc-grid-group'><h1 class='dc-grid-label'>"+c.keyAccessor()(t)+"</h1></div>"};return c._doRender=function(){return c.selectAll("div."+l).remove(),function(t){var e=t.order().selectAll("div."+o).data(function(t){return t.values});e.exit().remove(),e=e.enter().append("div").attr("class",o).html(function(t){return s(t)}).merge(e)}(i()),c},c._doRedraw=function(){return c._doRender()},c.beginSlice=function(t){return arguments.length?(h=t,c):h},c.endSlice=function(t){return arguments.length?(a=t,c):a},c.size=function(t){return arguments.length?(u=t,c):u},c.html=function(t){return arguments.length?(s=t,c):s},c.htmlGroup=function(t){return arguments.length?(g=t,c):g},c.sortBy=function(t){return arguments.length?(d=t,c):d},c.order=function(t){return arguments.length?(f=t,c):f},c.anchor(e,r)},n.bubbleChart=function(t,e){var r=n.bubbleMixin(n.coordinateGridMixin({}));r.transitionDuration(750),r.transitionDelay(0);var i=function(t){return"translate("+function(t){var e=r.x()(r.keyAccessor()(t));return!isNaN(e)&&isFinite(e)||(e=0),e}(t)+","+function(t){var e=r.y()(r.valueAccessor()(t));return!isNaN(e)&&isFinite(e)||(e=0),e}(t)+")"};return r.plotData=function(){r.calculateRadiusDomain(),r.r().range([r.MIN_RADIUS,r.xAxisLength()*r.maxBubbleRelativeSize()]);var t=r.data(),e=r.chartBodyG().selectAll("g."+r.BUBBLE_NODE_CLASS).data(t,function(t){return t.key});r.sortBubbleSize()&&e.order(),function(t){t.exit().remove()}(e),function(t){n.transition(t,r.transitionDuration(),r.transitionDelay()).attr("transform",i).select("circle."+r.BUBBLE_CLASS).attr("fill",r.getColor).attr("r",function(t){return r.bubbleR(t)}).attr("opacity",function(t){return r.bubbleR(t)>0?1:0}),r.doUpdateLabels(t),r.doUpdateTitles(t)}(e=function(t){var e=t.enter().append("g");return e.attr("class",r.BUBBLE_NODE_CLASS).attr("transform",i).append("circle").attr("class",function(t,e){return r.BUBBLE_CLASS+" _"+e}).on("click",r.onClick).attr("fill",r.getColor).attr("r",0),t=e.merge(t),n.transition(t,r.transitionDuration(),r.transitionDelay()).select("circle."+r.BUBBLE_CLASS).attr("r",function(t){return r.bubbleR(t)}).attr("opacity",function(t){return r.bubbleR(t)>0?1:0}),r._doRenderLabel(e),r._doRenderTitles(e),t}(e)),r.fadeDeselectedArea(r.filter())},r.renderBrush=function(){},r.redrawBrush=function(t,e){r.fadeDeselectedArea(t)},r.anchor(t,e)},n.compositeChart=function(e,r){function i(e,r){var i,a,s,d,h;return e&&(i=t.min(c(o())),a=n.utils.add(t.max(u(o())),f.yAxisPadding())),r&&(s=t.min(c(l())),d=n.utils.add(t.max(u(l())),f.yAxisPadding())),f.alignYAxes()&&e&&r&&(h=function(t,e,n,r){var i=(r-n)/(e-t);return{lyAxisMin:Math.min(t,n/i),lyAxisMax:Math.max(e,r/i),ryAxisMin:Math.min(n,t*i),ryAxisMax:Math.max(r,e*i)}}(i,a,s,d)),h||{lyAxisMin:i,lyAxisMax:a,ryAxisMin:s,ryAxisMax:d}}function a(t,e){t._generateG(f.g()),t.g().attr("class",d+" _"+e)}function o(){return h.filter(function(t){return!t.useRightYAxis()})}function l(){return h.filter(function(t){return t.useRightYAxis()})}function c(t){return t.map(function(t){return t.yAxisMin()})}function u(t){return t.map(function(t){return t.yAxisMax()})}var s,d="sub",f=n.coordinateGridMixin({}),h=[],g={},p=!1,y=!0,x=!1,m=t.axisRight(),v=0,A=12,b=!1;return f._mandatoryAttributes([]),f.transitionDuration(500),f.transitionDelay(0),n.override(f,"_generateG",function(){for(var t=this.__generateG(),e=0;e<h.length;++e){var n=h[e];a(n,e),n.dimension()||n.dimension(f.dimension()),n.group()||n.group(f.group()),n.chartGroup(f.chartGroup()),n.svg(f.svg()),n.xUnits(f.xUnits()),n.transitionDuration(f.transitionDuration(),f.transitionDelay()),n.parentBrushOn(f.brushOn()),n.brushOn(!1),n.renderTitle(f.renderTitle()),n.elasticX(f.elasticX())}return t}),f.on("filtered.dcjs-composite-chart",function(t){for(var e=0;e<h.length;++e)h[e].replaceFilter(f.filter())}),f._prepareYAxis=function(){var e=0!==o().length,n=0!==l().length,r=i(e,n);e&&function(e){var n=void 0===f.y()||f.elasticY(),r=n||f.resizing();void 0===f.y()&&f.y(t.scaleLinear()),n&&f.y().domain([e.lyAxisMin,e.lyAxisMax]),r&&f.y().rangeRound([f.yAxisHeight(),0]),f.y().range([f.yAxisHeight(),0]),f.yAxis(f.yAxis().scale(f.y()))}(r),n&&function(e){var n=void 0===f.rightY()||f.elasticY(),r=n||f.resizing();void 0===f.rightY()&&f.rightY(t.scaleLinear()),n&&f.rightY().domain([e.ryAxisMin,e.ryAxisMax]),r&&f.rightY().rangeRound([f.yAxisHeight(),0]),f.rightY().range([f.yAxisHeight(),0]),f.rightYAxis(f.rightYAxis().scale(f.rightY()))}(r),o().length>0&&!b?f._renderHorizontalGridLinesForAxis(f.g(),f.y(),f.yAxis()):l().length>0&&f._renderHorizontalGridLinesForAxis(f.g(),s,m)},f.renderYAxis=function(){0!==o().length&&(f.renderYAxisAt("y",f.yAxis(),f.margins().left),f.renderYAxisLabel("y",f.yAxisLabel(),-90)),0!==l().length&&(f.renderYAxisAt("yr",f.rightYAxis(),f.width()-f.margins().right),f.renderYAxisLabel("yr",f.rightYAxisLabel(),90,f.width()-A))},f.plotData=function(){for(var t=0;t<h.length;++t){var e=h[t];e.g()||a(e,t),p&&e.colors(f.colors()),e.x(f.x()),e.xAxis(f.xAxis()),e.useRightYAxis()?(e.y(f.rightY()),e.yAxis(f.rightYAxis())):(e.y(f.y()),e.yAxis(f.yAxis())),e.plotData(),e._activateRenderlets()}},f.useRightAxisGridLines=function(t){return arguments?(b=t,f):b},f.childOptions=function(t){return arguments.length?(g=t,h.forEach(function(t){t.options(g)}),f):g},f.fadeDeselectedArea=function(t){if(f.brushOn())for(var e=0;e<h.length;++e){h[e].fadeDeselectedArea(t)}},f.rightYAxisLabel=function(t,e){return arguments.length?(v=t,f.margins().right-=A,A=void 0===e?12:e,f.margins().right+=A,f):v},f.compose=function(t){return(h=t).forEach(function(t){t.height(f.height()),t.width(f.width()),t.margins(f.margins()),y&&t.title(f.title()),t.options(g)}),f},f.children=function(){return h},f.shareColors=function(t){return arguments.length?(p=t,f):p},f.shareTitle=function(t){return arguments.length?(y=t,f):y},f.rightY=function(t){return arguments.length?(s=t,f.rescale(),f):s},f.alignYAxes=function(t){return arguments.length?(x=t,f.rescale(),f):x},delete f.yAxisMin,delete f.yAxisMax,n.override(f,"xAxisMin",function(){return n.utils.subtract(t.min(h.map(function(t){return t.xAxisMin()})),f.xAxisPadding(),f.xAxisPaddingUnit())}),n.override(f,"xAxisMax",function(){return n.utils.add(t.max(h.map(function(t){return t.xAxisMax()})),f.xAxisPadding(),f.xAxisPaddingUnit())}),f.legendables=function(){return h.reduce(function(t,e){return p&&e.colors(f.colors()),t.push.apply(t,e.legendables()),t},[])},f.legendHighlight=function(t){for(var e=0;e<h.length;++e){h[e].legendHighlight(t)}},f.legendReset=function(t){for(var e=0;e<h.length;++e){h[e].legendReset(t)}},f.legendToggle=function(){console.log("composite should not be getting legendToggle itself")},f.rightYAxis=function(t){return arguments.length?(m=t,f):m},f.anchor(e,r)},n.seriesChart=function(e,r){function i(t){c[t].g()&&c[t].g().remove(),delete c[t]}function a(){Object.keys(c).map(i),c={}}var o,l=n.compositeChart(e,r),c={},u=n.lineChart,s=t.ascending,d=function(e,n){return t.ascending(l.keyAccessor()(e),l.keyAccessor()(n))};return l._mandatoryAttributes().push("seriesAccessor","chart"),l.shareColors(!0),l._preprocessData=function(){var e,a=[],f=t.nest().key(o);s&&f.sortKeys(s),d&&f.sortValues(d);var h=f.entries(l.data()).map(function(t,i){var o=c[t.key]||u.call(l,l,r,t.key,i);return c[t.key]||(e=!0),c[t.key]=o,a.push(t.key),o.dimension(l.dimension()).group({all:"function"==typeof t.values?t.values:n.utils.constant(t.values)},t.key).keyAccessor(l.keyAccessor()).valueAccessor(l.valueAccessor()).brushOn(!1)});Object.keys(c).filter(function(t){return-1===a.indexOf(t)}).forEach(function(t){i(t),e=!0}),l._compose(h),e&&l.legend()&&l.legend().render()},l.chart=function(t){return arguments.length?(u=t,a(),l):u},l.seriesAccessor=function(t){return arguments.length?(o=t,a(),l):o},l.seriesSort=function(t){return arguments.length?(s=t,a(),l):s},l.valueSort=function(t){return arguments.length?(d=t,a(),l):d},l._compose=l.compose,delete l.compose,l},n.geoChoroplethChart=function(e,r){function i(e){var r=function(){for(var t={},e=u.data(),n=0;n<e.length;++n)t[u.keyAccessor()(e[n])]=u.valueAccessor()(e[n]);return t}();if(function(t){return c(t).keyAccessor}(e)){var i=function(t){return u.svg().selectAll(function(t){return"g.layer"+t+" g."+c(t).name}(t)).classed("selected",function(e){return a(t,e)}).classed("deselected",function(e){return o(t,e)}).attr("class",function(e){var r=c(t).name,i=n.utils.nameToId(c(t).keyAccessor(e)),l=r+" "+i;return a(t,e)&&(l+=" selected"),o(t,e)&&(l+=" deselected"),l})}(e);!function(e,r,i){var a=e.select("path").attr("fill",function(){var e=t.select(this).attr("fill");return e||"none"}).on("click",function(t){return u.onClick(t,r)});n.transition(a,u.transitionDuration(),u.transitionDelay()).attr("fill",function(t,e){return u.getColor(i[c(r).keyAccessor(t)],e)})}(i,e,r),function(t,e,n){u.renderTitle()&&t.selectAll("title").text(function(t){var r=l(e,t),i=n[r];return u.title()({key:r,value:i})})}(i,e,r)}}function a(t,e){return u.hasFilter()&&u.hasFilter(l(t,e))}function o(t,e){return u.hasFilter()&&!u.hasFilter(l(t,e))}function l(t,e){return c(t).keyAccessor(e)}function c(t){return h[t]}var u=n.colorMixin(n.baseMixin({}));u.colorAccessor(function(t){return t||0});var s,d,f=t.geoPath(),h=[];u._doRender=function(){u.resetSvg();for(var t=0;t<h.length;++t){var e=u.svg().append("g").attr("class","layer"+t).selectAll("g."+c(t).name).data(c(t).data);(e=e.enter().append("g").attr("class",c(t).name).merge(e)).append("path").attr("fill","white").attr("d",g()),e.append("title"),i(t)}s=!1},u.onClick=function(t,e){var r=c(e).keyAccessor(t);n.events.trigger(function(){u.filter(r),u.redrawGroup()})},u._doRedraw=function(){for(var t=0;t<h.length;++t)i(t),s&&u.svg().selectAll("g."+c(t).name+" path").attr("d",g());s=!1},u.overlayGeoJson=function(t,e,n){for(var r=0;r<h.length;++r)if(h[r].name===e)return h[r].data=t,h[r].keyAccessor=n,u;return h.push({name:e,data:t,keyAccessor:n}),u},u.projection=function(t){return arguments.length?(d=t,s=!0,u):d};var g=function(){return void 0===d?(n.logger.warn("choropleth projection default of geoAlbers is deprecated, in next version projection will need to be set explicitly"),f.projection(t.geoAlbersUsa())):f.projection(d)};return u.geoJsons=function(){return h},u.geoPath=function(){return f},u.removeGeoJson=function(t){for(var e=[],n=0;n<h.length;++n){var r=h[n];r.name!==t&&e.push(r)}return h=e,u},u.anchor(e,r)},n.bubbleOverlay=function(e,r){function i(){var t={};return s.data().forEach(function(e){t[s.keyAccessor()(e)]=e}),t}function a(t,e){var r=c+" "+n.utils.nameToId(t.name),i=o.select("g."+n.utils.nameToId(t.name));return i.empty()&&(i=o.append("g").attr("class",r).attr("transform","translate("+t.x+","+t.y+")")),i.datum(e[t.name]),i}var o,l="bubble-overlay",c="node",u="bubble",s=n.bubbleMixin(n.baseMixin({})),d=[];return s.transitionDuration(750),s.transitionDelay(0),s.radiusValueAccessor(function(t){return t.value}),s.point=function(t,e,n){return d.push({name:t,x:e,y:n}),s},s._doRender=function(){return(o=s.select("g."+l)).empty()&&(o=s.svg().append("g").attr("class",l)),o=o,s.r().range([s.MIN_RADIUS,s.width()*s.maxBubbleRelativeSize()]),function(){var t=i();s.calculateRadiusDomain(),d.forEach(function(e){var r=a(e,t),i=r.select("circle."+u);i.empty()&&(i=r.append("circle").attr("class",u).attr("r",0).attr("fill",s.getColor).on("click",s.onClick)),n.transition(i,s.transitionDuration(),s.transitionDelay()).attr("r",function(t){return s.bubbleR(t)}),s._doRenderLabel(r),s._doRenderTitles(r)})}(),s.fadeDeselectedArea(s.filter()),s},s._doRedraw=function(){return function(){var t=i();s.calculateRadiusDomain(),d.forEach(function(e){var r=a(e,t),i=r.select("circle."+u);n.transition(i,s.transitionDuration(),s.transitionDelay()).attr("r",function(t){return s.bubbleR(t)}).attr("fill",s.getColor),s.doUpdateLabels(r),s.doUpdateTitles(r)})}(),s.fadeDeselectedArea(s.filter()),s},s.debug=function(e){if(e){var r=s.select("g."+n.constants.DEBUG_GROUP_CLASS);r.empty()&&(r=s.svg().append("g").attr("class",n.constants.DEBUG_GROUP_CLASS));var i=r.append("text").attr("x",10).attr("y",20);r.append("rect").attr("width",s.width()).attr("height",s.height()).on("mousemove",function(){var e=t.mouse(r.node()),n=e[0]+", "+e[1];i.text(n)})}else s.selectAll(".debug").remove();return s},s.anchor(e,r),s},n.rowChart=function(e,r){function i(){var e=s.select("g.axis");!function(){if(!d||f){var e=t.extent(h,D.cappedValueAccessor);e[0]>0&&(e[0]=0),e[1]<0&&(e[1]=0),d=t.scaleLinear().domain(e).range([0,D.effectiveWidth()])}C.scale(d)}(),e.empty()&&(e=s.append("g").attr("class","axis")),e.attr("transform","translate(0, "+D.effectiveHeight()+")"),n.transition(e,D.transitionDuration(),D.transitionDelay()).call(C)}function a(){h=D.data(),i(),s.selectAll("g.tick").select("line.grid-line").remove(),s.selectAll("g.tick").append("line").attr("class","grid-line").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",function(){return-D.effectiveHeight()});var t=s.selectAll("g."+b).data(h);!function(t){t.exit().remove()}(t),function(t){var e,r=h.length;e=A||(D.effectiveHeight()-(r+1)*v)/r;y||(p=e/2);var i=t.attr("transform",function(t,n){return"translate(0,"+((n+1)*v+n*e)+")"}).select("rect").attr("height",e).attr("fill",D.getColor).on("click",l).classed("deselected",function(t){return!!D.hasFilter()&&!u(t)}).classed("selected",function(t){return!!D.hasFilter()&&u(t)});n.transition(i,D.transitionDuration(),D.transitionDelay()).attr("width",function(t){return Math.abs(o()-d(D.valueAccessor()(t)))}).attr("transform",c),function(t){D.renderTitle()&&(t.select("title").remove(),t.append("title").text(D.title()))}(t),function(t){if(D.renderLabel()){var e=t.select("text").attr("x",g).attr("y",p).attr("dy",x).on("click",l).attr("class",function(t,e){return b+" _"+e}).text(function(t){return D.label()(t)});n.transition(e,D.transitionDuration(),D.transitionDelay()).attr("transform",c)}if(D.renderTitleLabel()){var r=t.select("."+_).attr("x",D.effectiveWidth()-m).attr("y",p).attr("dy",x).attr("text-anchor","end").on("click",l).attr("class",function(t,e){return _+" _"+e}).text(function(t){return D.title()(t)});n.transition(r,D.transitionDuration(),D.transitionDelay()).attr("transform",c)}}(t)}(t=function(t){var e=t.enter().append("g").attr("class",function(t,e){return b+" _"+e});return e.append("rect").attr("width",0),function(t){D.renderLabel()&&t.append("text").on("click",l),D.renderTitleLabel()&&t.append("text").attr("class",_).on("click",l)}(e),e}(t).merge(t))}function o(){var t=d(0);return t===-1/0||t!=t?d(1):t}function l(t){D.onClick(t)}function c(t){var e=d(D.cappedValueAccessor(t)),n=o();return"translate("+(e>n?n:e)+",0)"}function u(t){return D.hasFilter(D.cappedKeyAccessor(t))}var s,d,f,h,g=10,p=15,y=!1,x="0.35em",m=2,v=5,A=!1,b="row",_="titlerow",k=!1,D=n.capMixin(n.marginMixin(n.colorMixin(n.baseMixin({})))),C=t.axisBottom();return D.rowsCap=D.cap,D._doRender=function(){return D.resetSvg(),s=D.svg().append("g").attr("transform","translate("+D.margins().left+","+D.margins().top+")"),a(),D},D.title(function(t){return D.cappedKeyAccessor(t)+": "+D.cappedValueAccessor(t)}),D.label(D.cappedKeyAccessor),D.x=function(t){return arguments.length?(d=t,D):d},D.renderTitleLabel=function(t){return arguments.length?(k=t,D):k},D._doRedraw=function(){return a(),D},D.xAxis=function(t){return arguments.length?(C=t,this):C},D.fixedBarHeight=function(t){return arguments.length?(A=t,D):A},D.gap=function(t){return arguments.length?(v=t,D):v},D.elasticX=function(t){return arguments.length?(f=t,D):f},D.labelOffsetX=function(t){return arguments.length?(g=t,D):g},D.labelOffsetY=function(t){return arguments.length?(p=t,y=!0,D):p},D.titleLabelOffsetX=function(t){return arguments.length?(m=t,D):m},D.anchor(e,r)},n.legend=function(){function t(){return u+c}var e,r,i,a={},o=0,l=0,c=12,u=5,s=!1,d=560,f=70,h=!1,g=n.pluck("name");return a.parent=function(t){return arguments.length?(e=t,a):e},a.render=function(){e.svg().select("g.dc-legend").remove(),i=e.svg().append("g").attr("class","dc-legend").attr("transform","translate("+o+","+l+")");var a=e.legendables();void 0!==r&&(a=a.slice(0,r));var p=i.selectAll("g.dc-legend-item").data(a).enter().append("g").attr("class","dc-legend-item").on("mouseover",function(t){e.legendHighlight(t,this)}).on("mouseout",function(t){e.legendReset(t,this)}).on("click",function(t){t.chart.legendToggle(t,this)});i.selectAll("g.dc-legend-item").classed("fadeout",function(t){return t.chart.isLegendableHidden(t)}),a.some(n.pluck("dashstyle"))?p.append("line").attr("x1",0).attr("y1",c/2).attr("x2",c).attr("y2",c/2).attr("stroke-width",2).attr("stroke-dasharray",n.pluck("dashstyle")).attr("stroke",n.pluck("color")):p.append("rect").attr("width",c).attr("height",c).attr("fill",function(t){return t?t.color:"blue"}),p.append("text").text(g).attr("x",c+2).attr("y",function(){return c/2+(this.clientHeight?this.clientHeight:13)/2-2});var y=0,x=0;p.attr("transform",function(e,n){if(s){var r=!0===h?this.getBBox().width+u:f;y+r>d&&y>0&&(++x,y=0);var i="translate("+y+","+x*t()+")";return y+=r,i}return"translate(0,"+n*t()+")"})},a.x=function(t){return arguments.length?(o=t,a):o},a.y=function(t){return arguments.length?(l=t,a):l},a.gap=function(t){return arguments.length?(u=t,a):u},a.itemHeight=function(t){return arguments.length?(c=t,a):c},a.horizontal=function(t){return arguments.length?(s=t,a):s},a.legendWidth=function(t){return arguments.length?(d=t,a):d},a.itemWidth=function(t){return arguments.length?(f=t,a):f},a.autoItemWidth=function(t){return arguments.length?(h=t,a):h},a.legendText=function(t){return arguments.length?(g=t,a):g},a.maxItems=function(t){return arguments.length?(r=n.utils.isNumber(t)?t:void 0,a):r},a},n.htmlLegend=function(){var e,r,i,a,o={},l=n.pluck("name"),c=!1,u=!1;return o.parent=function(t){return arguments.length?(e=t,o):e},o.render=function(){var t=c?"dc-legend-item-horizontal":"dc-legend-item-vertical";r.select("div.dc-html-legend").remove();var o=r.append("div").attr("class","dc-html-legend");o.attr("style","max-width:"+r.nodes()[0].style.width);var s=e.legendables(),d=e.filters();void 0!==i&&(s=s.slice(0,i));var f=a||t,h=o.selectAll("div."+f).data(s).enter().append("div").classed(f,!0).on("mouseover",e.legendHighlight).on("mouseout",e.legendReset).on("click",e.legendToggle);u&&h.classed(n.constants.SELECTED_CLASS,function(t){return-1!==d.indexOf(t.name)}),h.append("span").attr("class","dc-legend-item-color").style("background-color",n.pluck("color")),h.append("span").attr("class","dc-legend-item-label").attr("title",l).text(l)},o.container=function(e){return arguments.length?(r=t.select(e),o):r},o.legendItemClass=function(t){return arguments.length?(a=t,o):a},o.highlightSelected=function(t){return arguments.length?(u=t,o):u},o.horizontal=function(t){return arguments.length?(c=t,o):c},o.legendText=function(t){return arguments.length?(l=t,o):l},o.maxItems=function(t){return arguments.length?(i=n.utils.isNumber(t)?t:void 0,o):i},o},n.scatterPlot=function(e,r){function i(t,e){return u(t)?b[e]?Math.pow(h,2):Math.pow(g,2):Math.pow(x,2)}function a(t,e){l.renderTitle()&&(t.selectAll("title").remove(),t.append("title").text(function(t){return l.title()(t)}))}function o(e,r){var i=l.chartBodyG().selectAll(".chart-body path.symbol").filter(function(){return e(t.select(this))}),a=c.size();c.size(Math.pow(r,2)),n.transition(i,l.transitionDuration(),l.transitionDelay()).attr("d",c),c.size(a)}var l=n.coordinateGridMixin({}),c=t.symbol(),u=function(t){return t.value},s=l.keyAccessor();l.keyAccessor(function(t){return s(t)[0]}),l.valueAccessor(function(t){return s(t)[1]}),l.colorAccessor(function(){return l._groupName}),l.title(function(t){return l.keyAccessor()(t)+","+l.valueAccessor()(t)+": "+l.existenceAccessor()(t)});var d=function(t){return"translate("+l.x()(l.keyAccessor()(t))+","+l.y()(l.valueAccessor()(t))+")"},f=7,h=5,g=3,p=null,y=1,x=0,m=0,v=1,A=null,b=[];return l.brush(t.brush()),c.size(i),n.override(l,"_filter",function(t){return arguments.length?l.__filter(n.filters.RangedTwoDimensionalFilter(t)):l.__filter()}),l.plotData=function(){var t=l.chartBodyG().selectAll("path.symbol").data(l.data());n.transition(t.exit(),l.transitionDuration(),l.transitionDelay()).attr("opacity",0).remove(),(t=t.enter().append("path").attr("class","symbol").attr("opacity",0).attr("fill",l.getColor).attr("transform",d).merge(t)).call(a,l.data()),t.each(function(t,e){b[e]=!l.filter()||l.filter().isFiltered([l.keyAccessor()(t),l.valueAccessor()(t)])}),n.transition(t,l.transitionDuration(),l.transitionDelay()).attr("opacity",function(t,e){return u(t)?b[e]?v:l.excludedOpacity():m}).attr("fill",function(t,e){return A&&!u(t)?A:l.excludedColor()&&!b[e]?l.excludedColor():l.getColor(t)}).attr("transform",d).attr("d",c)},l.existenceAccessor=function(t){return arguments.length?(u=t,this):u},l.symbol=function(t){return arguments.length?(c.type(t),l):c.type()},l.customSymbol=function(t){return arguments.length?((c=t).size(i),l):c},l.symbolSize=function(t){return arguments.length?(h=t,l):h},l.highlightedSize=function(t){return arguments.length?(f=t,l):f},l.excludedSize=function(t){return arguments.length?(g=t,l):g},l.excludedColor=function(t){return arguments.length?(p=t,l):p},l.excludedOpacity=function(t){return arguments.length?(y=t,l):y},l.hiddenSize=l.emptySize=function(t){return arguments.length?(x=t,l):x},l.emptyColor=function(t){return arguments.length?(A=t,l):A},l.emptyOpacity=function(t){return arguments.length?(m=t,l):m},l.nonemptyOpacity=function(t){return arguments.length?(v=t,l):m},l.legendables=function(){return[{chart:l,name:l._groupName,color:l.getColor()}]},l.legendHighlight=function(e){o(function(t){return t.attr("fill")===e.color},f),l.chartBodyG().selectAll(".chart-body path.symbol").filter(function(){return t.select(this).attr("fill")!==e.color}).classed("fadeout",!0)},l.legendReset=function(e){o(function(t){return t.attr("fill")===e.color},h),l.chartBodyG().selectAll(".chart-body path.symbol").filter(function(){return t.select(this).attr("fill")!==e.color}).classed("fadeout",!1)},l.createBrushHandlePaths=function(){},l.extendBrush=function(t){return l.round()&&(t[0]=t[0].map(l.round()),t[1]=t[1].map(l.round())),t},l.brushIsEmpty=function(t){return!t||t[0][0]>=t[1][0]||t[0][1]>=t[1][1]},l._brushing=function(){if(t.event.sourceEvent&&(!t.event.sourceEvent.type||-1===["start","brush","end"].indexOf(t.event.sourceEvent.type))){var e=t.event.selection,r=l.brushIsEmpty(e);e&&(e=e.map(function(t){return t.map(function(t,e){return(0===e?l.x():l.y()).invert(t)})}),e=l.extendBrush(e),r=r&&l.brushIsEmpty(e)),l.redrawBrush(e,!1);var i=r?null:n.filters.RangedTwoDimensionalFilter(e);n.events.trigger(function(){l.replaceFilter(i),l.redrawGroup()},n.constants.EVENT_DELAY)}},l.redrawBrush=function(t,e){var r=l.brush(),i=l.gBrush();if(l.brushOn()&&i)if(l.resizing()&&l.setBrushExtents(e),t){t=t.map(function(t){return t.map(function(t,e){return(0===e?l.x():l.y())(t)})});n.optionalTransition(e,l.transitionDuration(),l.transitionDelay())(i).call(r.move,t)}else i.call(r.move,t);l.fadeDeselectedArea(t)},l.setBrushY=function(t){t.call(l.brush().y(l.y()))},l.anchor(e,r)},n.numberDisplay=function(e,r){var i,a=t.format(".2s"),o=n.baseMixin({}),l={one:"",some:"",none:""};return o._mandatoryAttributes(["group"]),o.ordering(function(t){return t.value}),o.html=function(t){return arguments.length?(t.none?l.none=t.none:t.one?l.none=t.one:t.some&&(l.none=t.some),t.one?l.one=t.one:t.some&&(l.one=t.some),t.some?l.some=t.some:t.one&&(l.some=t.one),o):l},o.value=function(){return o.data()},o.data(function(t){var e=t.value?t.value():function(t){if(!t.length)return null;var e=o._computeOrderedGroups(t);return e[e.length-1]}(t.all());return o.valueAccessor()(e)}),o.transitionDuration(250),o.transitionDelay(0),o._doRender=function(){var e=o.value(),n=o.selectAll(".number-display");n.empty()&&(n=n.data([0]).enter().append("span").attr("class","number-display").merge(n)),n.transition().duration(o.transitionDuration()).delay(o.transitionDelay()).ease(t.easeQuad).tween("text",function(){var n=isFinite(i)?i:0,r=t.interpolateNumber(n||0,e);i=e;var a=this;return function(t){var n=null,i=o.formatNumber()(r(t));0===e&&""!==l.none?n=l.none:1===e&&""!==l.one?n=l.one:""!==l.some&&(n=l.some),a.innerHTML=n?n.replace("%number",i):i}})},o._doRedraw=function(){return o._doRender()},o.formatNumber=function(t){return arguments.length?(a=t,o):a},o.anchor(e,r)},n.heatMap=function(e,r){function i(t,e){var r=g.selectAll(".box-group").filter(function(n){return n.key[t]===e}),i=r.filter(function(t){return!g.hasFilter(t.key)});n.events.trigger(function(){var t=(i.empty()?r:i).data().map(function(t){return n.filters.TwoDimensionalFilter(t.key)});g._filter([t]),g.redrawGroup()})}var a,o,l,c=t.ascending,u=t.ascending,s=t.scaleBand(),d=t.scaleBand(),f=6.75,h=6.75,g=n.colorMixin(n.marginMixin(n.baseMixin({})));g._mandatoryAttributes(["group"]),g.title(g.colorAccessor());var p=function(t){return t},y=function(t){return t};g.colsLabel=function(t){return arguments.length?(p=t,g):p},g.rowsLabel=function(t){return arguments.length?(y=t,g):y};var x=function(t){i(0,t)},m=function(t){i(1,t)},v=function(t){var e=t.key;n.events.trigger(function(){g.filter(e),g.redrawGroup()})};return n.override(g,"filter",function(t){return arguments.length?g._filter(n.filters.TwoDimensionalFilter(t)):g._filter()}),g.rows=function(t){return arguments.length?(l=t,g):l},g.rowOrdering=function(t){return arguments.length?(u=t,g):u},g.cols=function(t){return arguments.length?(o=t,g):o},g.colOrdering=function(t){return arguments.length?(c=t,g):c},g._doRender=function(){return g.resetSvg(),a=g.svg().append("g").attr("class","heatmap").attr("transform","translate("+g.margins().left+","+g.margins().top+")"),g._doRedraw()},g._doRedraw=function(){var t=g.data(),e=g.rows()||t.map(g.valueAccessor()),r=g.cols()||t.map(g.keyAccessor());u&&(e=e.sort(u)),c&&(r=r.sort(c)),e=d.domain(e),r=s.domain(r);var i=e.domain().length,o=r.domain().length,l=Math.floor(g.effectiveWidth()/o),p=Math.floor(g.effectiveHeight()/i);r.rangeRound([0,g.effectiveWidth()]),e.rangeRound([g.effectiveHeight(),0]);var y=a.selectAll("g.box-group").data(g.data(),function(t,e){return g.keyAccessor()(t,e)+"\0"+g.valueAccessor()(t,e)});y.exit().remove();var x=y.enter().append("g").attr("class","box-group");x.append("rect").attr("class","heat-box").attr("fill","white").attr("x",function(t,e){return r(g.keyAccessor()(t,e))}).attr("y",function(t,n){return e(g.valueAccessor()(t,n))}).on("click",g.boxOnClick()),g.renderTitle()&&(x.append("title"),y.select("title").text(g.title())),y=x.merge(y),n.transition(y.select("rect"),g.transitionDuration(),g.transitionDelay()).attr("x",function(t,e){return r(g.keyAccessor()(t,e))}).attr("y",function(t,n){return e(g.valueAccessor()(t,n))}).attr("rx",f).attr("ry",h).attr("fill",g.getColor).attr("width",l).attr("height",p);var m=a.select("g.cols");m.empty()&&(m=a.append("g").attr("class","cols axis"));var v=m.selectAll("text").data(r.domain());v.exit().remove(),v=v.enter().append("text").attr("x",function(t){return r(t)+l/2}).style("text-anchor","middle").attr("y",g.effectiveHeight()).attr("dy",12).on("click",g.xAxisOnClick()).text(g.colsLabel()).merge(v),n.transition(v,g.transitionDuration(),g.transitionDelay()).text(g.colsLabel()).attr("x",function(t){return r(t)+l/2}).attr("y",g.effectiveHeight());var A=a.select("g.rows");A.empty()&&(A=a.append("g").attr("class","rows axis"));var b=A.selectAll("text").data(e.domain());return b.exit().remove(),b=b.enter().append("text").style("text-anchor","end").attr("x",0).attr("dx",-2).attr("y",function(t){return e(t)+p/2}).attr("dy",6).on("click",g.yAxisOnClick()).text(g.rowsLabel()).merge(b),n.transition(b,g.transitionDuration(),g.transitionDelay()).text(g.rowsLabel()).attr("y",function(t){return e(t)+p/2}),g.hasFilter()?g.selectAll("g.box-group").each(function(t){g.isSelectedNode(t)?g.highlightSelected(this):g.fadeDeselected(this)}):g.selectAll("g.box-group").each(function(){g.resetHighlight(this)}),g},g.boxOnClick=function(t){return arguments.length?(v=t,g):v},g.xAxisOnClick=function(t){return arguments.length?(x=t,g):x},g.yAxisOnClick=function(t){return arguments.length?(m=t,g):m},g.xBorderRadius=function(t){return arguments.length?(f=t,g):f},g.yBorderRadius=function(t){return arguments.length?(h=t,g):h},g.isSelectedNode=function(t){return g.hasFilter(t.key)},g.anchor(e,r)},function(){function e(t){return[0,t.length-1]}function r(e){return[t.quantile(e,.25),t.quantile(e,.5),t.quantile(e,.75)]}t.box=function(){function i(e){e.each(function(e,n){e=e.map(s).sort(t.ascending);var r,i,b=t.select(this),_=e.length;if(0!==_){var k=e.quartiles=f(e),D=d&&d.call(this,e,n),C=D&&D.map(function(t){return e[t]}),w=D?t.range(0,D[0]).concat(t.range(D[1]+1,_)):t.range(_);v?(r=e[0],i=e[_-1]):(r=e[D[0]],i=e[D[1]]);var M=t.range(D[0],D[1]+1),E=t.scaleLinear().domain(u&&u.call(this,e,n)||[r,i]).range([o,0]),L=this.__chart__||t.scaleLinear().domain([0,1/0]).range(E.range());this.__chart__=E;var R=b.selectAll("line.center").data(C?[C]:[]);R.enter().insert("line","rect").attr("class","center").attr("x1",a/2).attr("y1",function(t){return L(t[0])}).attr("x2",a/2).attr("y2",function(t){return L(t[1])}).style("opacity",1e-6).transition().duration(l).delay(c).style("opacity",1).attr("y1",function(t){return E(t[0])}).attr("y2",function(t){return E(t[1])}),R.transition().duration(l).delay(c).style("opacity",1).attr("x1",a/2).attr("x2",a/2).attr("y1",function(t){return E(t[0])}).attr("y2",function(t){return E(t[1])}),R.exit().transition().duration(l).delay(c).style("opacity",1e-6).attr("y1",function(t){return E(t[0])}).attr("y2",function(t){return E(t[1])}).remove();var S=b.selectAll("rect.box").data([k]);S.enter().append("rect").attr("class","box").attr("x",0).attr("y",function(t){return L(t[2])}).attr("width",a).attr("height",function(t){return L(t[0])-L(t[2])}).style("fill-opacity",g?.1:1).transition().duration(l).delay(c).attr("y",function(t){return E(t[2])}).attr("height",function(t){return E(t[0])-E(t[2])}),S.transition().duration(l).delay(c).attr("width",a).attr("y",function(t){return E(t[2])}).attr("height",function(t){return E(t[0])-E(t[2])});var O=b.selectAll("line.median").data([k[1]]);O.enter().append("line").attr("class","median").attr("x1",0).attr("y1",L).attr("x2",a).attr("y2",L).transition().duration(l).delay(c).attr("y1",E).attr("y2",E),O.transition().duration(l).delay(c).attr("x1",0).attr("x2",a).attr("y1",E).attr("y2",E);var T=b.selectAll("line.whisker").data(C||[]);if(T.enter().insert("line","circle, text").attr("class","whisker").attr("x1",0).attr("y1",L).attr("x2",a).attr("y2",L).style("opacity",1e-6).transition().duration(l).delay(c).attr("y1",E).attr("y2",E).style("opacity",1),T.transition().duration(l).delay(c).attr("x1",0).attr("x2",a).attr("y1",E).attr("y2",E).style("opacity",1),T.exit().transition().duration(l).delay(c).attr("y1",E).attr("y2",E).style("opacity",1e-6).remove(),v){var F=A?"outlierBold":"outlier",B=A?3:5,N=A?function(){return Math.floor(Math.random()*(a*x)+1+(a-a*x)/2)}:function(){return a/2},P=b.selectAll("circle."+F).data(w,Number);P.enter().insert("circle","text").attr("class",F).attr("r",B).attr("cx",N).attr("cy",function(t){return L(e[t])}).style("opacity",1e-6).transition().duration(l).delay(c).attr("cy",function(t){return E(e[t])}).style("opacity",.6),m&&(P.selectAll("title").remove(),P.append("title").text(function(t){return e[t]})),P.transition().duration(l).delay(c).attr("cx",N).attr("cy",function(t){return E(e[t])}).style("opacity",.6),P.exit().transition().duration(l).delay(c).attr("cy",0).style("opacity",1e-6).remove()}if(g){var H=b.selectAll("circle.data").data(M);H.enter().insert("circle","text").attr("class","data").attr("r",p).attr("cx",function(){return Math.floor(Math.random()*(a*x)+1+(a-a*x)/2)}).attr("cy",function(t){return L(e[t])}).style("opacity",1e-6).transition().duration(l).delay(c).attr("cy",function(t){return E(e[t])}).style("opacity",y),m&&(H.selectAll("title").remove(),H.append("title").text(function(t){return e[t]})),H.transition().duration(l).delay(c).attr("cx",function(){return Math.floor(Math.random()*(a*x)+1+(a-a*x)/2)}).attr("cy",function(t){return E(e[t])}).style("opacity",y),H.exit().transition().duration(l).delay(c).attr("cy",0).style("opacity",1e-6).remove()}var z=h||E.tickFormat(8),G=b.selectAll("text.box").data(k);G.enter().append("text").attr("class","box").attr("dy",".3em").attr("dx",function(t,e){return 1&e?6:-6}).attr("x",function(t,e){return 1&e?a:0}).attr("y",L).attr("text-anchor",function(t,e){return 1&e?"start":"end"}).text(z).transition().duration(l).delay(c).attr("y",E),G.transition().duration(l).delay(c).text(z).attr("x",function(t,e){return 1&e?a:0}).attr("y",E);var I=b.selectAll("text.whisker").data(C||[]);I.enter().append("text").attr("class","whisker").attr("dy",".3em").attr("dx",6).attr("x",a).attr("y",L).text(z).style("opacity",1e-6).transition().duration(l).delay(c).attr("y",E).style("opacity",1),I.transition().duration(l).delay(c).text(z).attr("x",a).attr("y",E).style("opacity",1),I.exit().transition().duration(l).delay(c).attr("y",E).style("opacity",1e-6).remove(),delete e.quartiles}}),t.timerFlush()}var a=1,o=1,l=0,c=0,u=null,s=Number,d=e,f=r,h=null,g=!1,p=3,y=.3,x=.8,m=!1,v=!0,A=!1;return i.width=function(t){return arguments.length?(a=t,i):a},i.height=function(t){return arguments.length?(o=t,i):o},i.tickFormat=function(t){return arguments.length?(h=t,i):h},i.showOutliers=function(t){return arguments.length?(v=t,i):v},i.boldOutlier=function(t){return arguments.length?(A=t,i):A},i.renderDataPoints=function(t){return arguments.length?(g=t,i):g},i.renderTitle=function(t){return arguments.length?(m=t,i):m},i.dataOpacity=function(t){return arguments.length?(y=t,i):y},i.dataWidthPortion=function(t){return arguments.length?(x=t,i):x},i.duration=function(t){return arguments.length?(l=t,i):l},i.domain=function(t){return arguments.length?(u=null===t?t:"function"==typeof t?t:n.utils.constant(t),i):u},i.value=function(t){return arguments.length?(s=t,i):s},i.whiskers=function(t){return arguments.length?(d=t,i):d},i.quartiles=function(t){return arguments.length?(f=t,i):f},i}}(),n.boxPlot=function(e,r){function i(){return t.min(l.data(),function(e){return t.min(l.valueAccessor()(e))})}function a(){return t.max(l.data(),function(e){return t.max(l.valueAccessor()(e))})}function o(){return(a()-i())/l.effectiveHeight()}var l=n.coordinateGridMixin({}),c=function(t){return function(e){var n=e.quartiles[0],r=e.quartiles[2],i=(r-n)*t,a=-1,o=e.length;do{++a}while(e[a]<n-i);do{--o}while(e[o]>r+i);return[a,o]}}(1.5),u=t.box(),s=null,d=!1,f=.3,h=.8,g=!0,p=!1,y=8,x=function(t,e){return l.isOrdinal()?l.x().bandwidth():t/(1+l.boxPadding())/e};l.x(t.scaleBand()),l.xUnits(n.units.ordinal),l.data(function(t){return t.all().map(function(t){return t.map=function(e){return e.call(t,t)},t}).filter(function(t){return 0!==l.valueAccessor()(t).length})}),l.boxPadding=l._rangeBandPadding,l.boxPadding(.8),l.outerPadding=l._outerRangeBandPadding,l.outerPadding(.5),l.boxWidth=function(t){return arguments.length?(x="function"==typeof t?t:n.utils.constant(t),l):x};var m=function(t,e){return"translate("+l.x()(l.keyAccessor()(t,e))+", 0)"};return l._preprocessData=function(){l.elasticX()&&l.x().domain([])},l.plotData=function(){var e=x(l.effectiveWidth(),l.xUnitCount());u.whiskers(c).width(e).height(l.effectiveHeight()).value(l.valueAccessor()).domain(l.y().domain()).duration(l.transitionDuration()).tickFormat(s).renderDataPoints(d).dataOpacity(f).dataWidthPortion(h).renderTitle(l.renderTitle()).showOutliers(g).boldOutlier(p);var r=l.chartBodyG().selectAll("g.box").data(l.data(),l.keyAccessor());!function(e){n.transition(e,l.transitionDuration(),l.transitionDelay()).attr("transform",m).call(u).each(function(e){var n=l.getColor(e,0);t.select(this).select("rect.box").attr("fill",n),t.select(this).selectAll("circle.data").attr("fill",n)})}(function(t){var e=t.enter().append("g");return e.attr("class","box").attr("transform",m).call(u).on("click",function(t){l.filter(l.keyAccessor()(t)),l.redrawGroup()}),e.merge(t)}(r)),function(t){t.exit().remove().call(u)}(r),l.fadeDeselectedArea(l.filter())},l.fadeDeselectedArea=function(t){if(l.hasFilter())if(l.isOrdinal())l.g().selectAll("g.box").each(function(t){l.isSelectedNode(t)?l.highlightSelected(this):l.fadeDeselected(this)});else{if(!l.brushOn()&&!l.parentBrushOn())return;var e=t[0],n=t[1],r=l.keyAccessor();l.g().selectAll("g.box").each(function(t){var i=r(t);i<e||i>=n?l.fadeDeselected(this):l.highlightSelected(this)})}else l.g().selectAll("g.box").each(function(){l.resetHighlight(this)})},l.isSelectedNode=function(t){return l.hasFilter(l.keyAccessor()(t))},l.yAxisMin=function(){var t=y*o();return n.utils.subtract(i()-t,l.yAxisPadding())},l.yAxisMax=function(){var t=y*o();return n.utils.add(a()+t,l.yAxisPadding())},l.tickFormat=function(t){return arguments.length?(s=t,l):s},l.yRangePadding=function(t){return arguments.length?(y=t,l):y},l.renderDataPoints=function(t){return arguments.length?(d=t,l):d},l.dataOpacity=function(t){return arguments.length?(f=t,l):f},l.dataWidthPortion=function(t){return arguments.length?(h=t,l):h},l.showOutliers=function(t){return arguments.length?(g=t,l):g},l.boldOutlier=function(t){return arguments.length?(p=t,l):p},l.anchor(e,r)},n.selectMenu=function(e,r){function i(e,n){var r,i=t.event.target;if(i.selectedOptions){r=Array.prototype.slice.call(i.selectedOptions).map(function(t){return t.value})}else{r=[].slice.call(t.event.target.options).filter(function(t){return t.selected}).map(function(t){return t.value})}1===r.length&&""===r[0]?r=s||null:u||1!==r.length||(r=r[0]),l.onChange(r)}var a,o="dc-select-option",l=n.baseMixin({}),c="Select all",u=!1,s=null,d=null,f=function(t,e){return l.keyAccessor()(t)>l.keyAccessor()(e)?1:l.keyAccessor()(e)>l.keyAccessor()(t)?-1:0},h=function(t){return l.valueAccessor()(t)>0};l.data(function(t){return t.all().filter(h)}),l._doRender=function(){return l.select("select").remove(),(a=l.root().append("select").classed("dc-select-menu",!0)).append("option").text(c).attr("value",""),l._doRedraw(),l};var g=window.navigator.userAgent;return g.indexOf("Trident/")>0&&-1===g.indexOf("MSIE")&&(l.redraw=l.render),l._doRedraw=function(){return u?a.attr("multiple",!0):a.attr("multiple",null),null!==d?a.attr("size",d):a.attr("size",null),function(){var t=a.selectAll("option."+o).data(l.data(),function(t){return l.keyAccessor()(t)});t.exit().remove(),t.enter().append("option").classed(o,!0).attr("value",function(t){return l.keyAccessor()(t)}).merge(t).text(l.title()),a.selectAll("option."+o).sort(f),a.on("change",i)}(),l.hasFilter()&&u?a.selectAll("option").property("selected",function(t){return void 0!==t&&l.filters().indexOf(String(l.keyAccessor()(t)))>=0}):l.hasFilter()?a.property("value",l.filter()):a.property("value",""),l},l.onChange=function(t){t&&u?l.replaceFilter([t]):t?l.replaceFilter(t):l.filterAll(),n.events.trigger(function(){l.redrawGroup()})},l.order=function(t){return arguments.length?(f=t,l):f},l.promptText=function(t){return arguments.length?(c=t,l):c},l.filterDisplayed=function(t){return arguments.length?(h=t,l):h},l.multiple=function(t){return arguments.length?(u=t,l):u},l.promptValue=function(t){return arguments.length?(s=t,l):s},l.numberVisible=function(t){return arguments.length?(d=t,l):d},l.size=n.logger.deprecate(l.numberVisible,"selectMenu.size is ambiguous - use numberVisible instead"),l.anchor(e,r)},n.textFilterWidget=function(t,e){var r=n.baseMixin({}),i=function(t){return t.toLowerCase()},a=function(t){return t=i(t),function(e){return-1!==i(e).indexOf(t)}},o="search";return r.group(function(){throw"the group function on textFilterWidget should never be called, please report the issue"}),r._doRender=function(){r.select("input").remove();return r.root().append("input").classed("dc-text-filter-input",!0).on("input",function(){r.dimension().filterFunction(a(this.value)),n.events.trigger(function(){n.redrawAll()},n.constants.EVENT_DELAY)}),r._doRedraw(),r},r._doRedraw=function(){return r.root().selectAll("input").attr("placeholder",o),r},r.normalize=function(t){return arguments.length?(i=t,r):i},r.placeHolder=function(t){return arguments.length?(o=t,r):o},r.filterFunctionFactory=function(t){return arguments.length?(a=t,r):a},r.anchor(t,e)},n.cboxMenu=function(e,r){function i(e,n){var r;t.select(t.event.target).datum()?(r=t.select(this).selectAll("input").filter(function(t){if(t)return this.checked}).nodes().map(function(t){return t.value}),u||1!==r.length||(r=r[0])):r=d||null,l.onChange(r)}var a,o="dc-cbox-item",l=n.baseMixin({}),c="Select all",u=!1,s="radio",d=null,f=Math.floor(1e5*Math.random())+1,h=function(t,e){return l.keyAccessor()(t)>l.keyAccessor()(e)?1:l.keyAccessor()(e)>l.keyAccessor()(t)?-1:0},g=function(t){return l.valueAccessor()(t)>0};return l.data(function(t){return t.all().filter(g)}),l._doRender=function(){return l._doRedraw()},l._doRedraw=function(){return l.select("ul").remove(),a=l.root().append("ul").classed("dc-cbox-group",!0),function(){var t=a.selectAll("li."+o).data(l.data(),function(t){return l.keyAccessor()(t)});if(t.exit().remove(),(t=t.enter().append("li").classed(o,!0).merge(t)).append("input").attr("type",s).attr("value",function(t){return l.keyAccessor()(t)}).attr("name","domain_"+f).attr("id",function(t,e){return"input_"+f+"_"+e}),t.append("label").attr("for",function(t,e){return"input_"+f+"_"+e}).text(l.title()),u)a.append("li").append("input").attr("type","reset").text(c).on("click",i);else{var e=a.append("li");e.append("input").attr("type",s).attr("value",d).attr("name","domain_"+f).attr("id",function(t,e){return"input_"+f+"_all"}).property("checked",!0),e.append("label").attr("for",function(t,e){return"input_"+f+"_all"}).text(c)}a.selectAll("li."+o).sort(h),a.on("change",i)}(),l.hasFilter()&&u?a.selectAll("input").property("checked",function(t){return t&&l.filters().indexOf(String(l.keyAccessor()(t)))>=0||!1}):l.hasFilter()&&a.selectAll("input").property("checked",function(t){return!!t&&l.keyAccessor()(t)===l.filter()}),l},l.onChange=function(t){t&&u?l.replaceFilter([t]):t?l.replaceFilter(t):l.filterAll(),n.events.trigger(function(){l.redrawGroup()})},l.order=function(t){return arguments.length?(h=t,l):h},l.promptText=function(t){return arguments.length?(c=t,l):c},l.filterDisplayed=function(t){return arguments.length?(g=t,l):g},l.multiple=function(t){return arguments.length?(u=t,s=u?"checkbox":"radio",l):u},l.promptValue=function(t){return arguments.length?(d=t,l):d},l.anchor(e,r)},n.abstractBubbleChart=n.bubbleMixin,n.baseChart=n.baseMixin,n.capped=n.capMixin,n.colorChart=n.colorMixin,n.coordinateGridChart=n.coordinateGridMixin,n.marginable=n.marginMixin,n.stackableChart=n.stackMixin,n.d3=t,n.crossfilter=e,n}if("function"==typeof define&&define.amd)define(["d3","crossfilter2"],t);else if("object"==typeof module&&module.exports){var e=require("d3"),n=require("crossfilter2");"function"!=typeof n&&(n=n.crossfilter),module.exports=t(e,n)}else this.dc=t(d3,crossfilter)}();
<!DOCTYPE html>
<html lang="en">
<head>
<title>dc.js - Treemap Example</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/dc/3.0.6/dc.min.css"/>
<style>
.oversize { display: none }
.treemap-element { stroke: black; stroke-width: 0.5px }
svg text { font-size: 10px; stroke: none }
select {
margin-bottom: .25rem;
}
label {
display: block;
}
.chart-div {
margin-right: 20px;
}
.chart-div.pie {
width: 280px;
}
.page {
margin: 0 5rem;
}
#dev {
clear: left;
}
.internal .treemap-label, .root .treemap-label {
display: none
}
</style>
</head>
<body>
<div class="page">
<h2>dc.js Treemap Implementation</h2>
<div id="test"></div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/crossfilter2/1.4.6/crossfilter.min.js"></script>
<script type="text/javascript" src="dc.min.js"></script>
<script type="text/javascript">
function add_chart ( id, title, ctype, div_class ) {
if ( ! ctype ) ctype = id
if ( ! title ) title = id
if ( ! div_class ) div_class = ''
d3.select('#test')
.append('div')
.classed('chart-div ' + div_class, true)
.attr('id', id)
.append('h4')
.text( title );
return dc[ctype + 'Chart']('#' + id );
}
var tr = {
global: 'Global Name',
region: 'Region Name',
subregion: 'Sub-region Name',
intermed_region: 'Intermediate Region Name',
country: 'Country or Area',
ldc: 'Least Developed Countries (LDC)',
lldc: 'Land Locked Developing Countries (LLDC)',
sids: 'Small Island Developing States (SIDS)',
dev: 'Developed / Developing Countries'
}
d3.csv('countries-regions.csv', function (d) {
return {
global: d['Global Name'],
region: d['Region Name'],
subregion: d['Sub-region Name'],
intermed_region: d['Intermediate Region Name'],
country: d['Country or Area'],
ldc: d['Least Developed Countries (LDC)'] === 'x' ? 'Yes' : 'No',
lldc: d['Land Locked Developing Countries (LLDC)'] === 'x' ? 'Yes' : 'No',
sids: d['Small Island Developing States (SIDS)'] === 'x' ? 'Yes' : 'No',
dev: d['Developed / Developing Countries'] === '' ? 'N/A' : d['Developed / Developing Countries']
};
}).then( function(geo) {
var ndx = crossfilter(geo),
xf_dim = {
location: ndx.dimension( d => [d.global, d.region, d.subregion, d.intermed_region, d.country] )
}
Object.keys(tr).forEach( n => {
if ( n !== 'global' )
xf_dim[n] = ndx.dimension( d => d[n] )
});
var tiles = ['Binary', 'Dice', 'Slice', 'SliceDice', 'Squarify', 'Resquarify' ]
var cntrls = {}
cntrls.treemap_tile = d3.select('#test').append('div')
.append('select');
cntrls.treemap_tile
.selectAll('option')
.data( tiles )
.enter()
.append('option')
.attr('value', function(d){ return d })
.text( function(d){ return d })
var opt = ['descendants', 'leaves'];
cntrls.treemap_parents = d3.select('#test').append('div')
.append('select');
cntrls.treemap_parents
.selectAll('option')
.data( opt )
.enter()
.append('option')
.attr('value', function(d){ return d })
.text( function(d){ return 'show all ' + d })
var padType = [ 'Inner', 'Outer' ]
padType.forEach( function(n) {
var padding = d3.select('#test').append('div')
padding.append('label')
.attr('for', n + 'padding')
.text(n + ' padding value');
padding
.append('text')
.text(' 0 ');
cntrls[ 'treemap_' + n + 'pad'] = padding
.append('input')
.attr('type', 'range')
.attr('name', 'pad')
.attr('id', n + 'padding')
.attr('min', 0)
.attr('max', 10)
.attr('value', 2)
padding
.append('text')
.text(' 10 ');
});
var chart_ix = {};
chart_ix.treemap = add_chart( 'treemap', 'Treemap', 'treemap');
chart_ix.row = add_chart( 'row', 'Global Regions' );
var pies = [ 'dev', 'ldc', 'lldc', 'sids' ]
pies.forEach( n => chart_ix[n] = add_chart( n, tr[n], 'pie', 'pie' ) )
var i = 0;
// set up colour scales
var num = xf_dim.region.group().top(Infinity).map( () => ++i )
var spectral = d3.schemeSpectral[num.length]
var spectralite = d3.schemeSpectral[num.length].map( x => d3.color(x).darker(0.2).hex() )
var colDomain = xf_dim.region.group().top(Infinity).map( x => x.key )
.concat( xf_dim.region.group().top(Infinity).map( x => '_' + x.key ), [ 'World', '_undefined' ] )
var specscale = d3.scaleOrdinal().domain( colDomain )
.range( spectral.concat(spectralite, [ '#999', 'none' ]) )
var colorAcc = function (d) {
var key = (d.key[4] ? '' : '_') + d.key[1]
if ( d.key[1] === undefined ) {
return d.key[0]
}
return key
}
chart_ix.treemap
.width(1200)
.height(750)
.dimension(xf_dim.location)
.group(xf_dim.location.group().reduceCount())
.colors( specscale )
.colorAccessor( colorAcc )
.layout.tile(d3.treemapBinary)
.layout.padding(2)
.layout.leafNodesOnly(false)
chart_ix.row
.width(300)
.height(300)
.colorAccessor( function(d){ return specscale( d.key ) })
.colors( specscale )
.dimension(xf_dim.region)
.group(xf_dim.region.group())
.legend(dc.legend())
pies.forEach( function(p) {
chart_ix[p]
.width(280)
.height(250)
.innerRadius(25)
.dimension(xf_dim[p])
.group(xf_dim[p].group())
.drawPaths(true)
.externalRadiusPadding(50)
.externalLabels(25)
.legend(dc.legend())
})
dc.renderAll();
cntrls.treemap_tile.on('change', function (e) {
chart_ix.treemap.layout.tile( d3['treemap' + this.value] ).redraw();
});
cntrls.treemap_parents.on('change', function (e) {
chart_ix.treemap.layout.leafNodesOnly( this.value === 'leaves' ).redraw();
});
padType.forEach( function(n) {
cntrls['treemap_' + n + 'pad'].on('change', function (e) {
chart_ix.treemap.layout['padding' + n ]( this.value ).redraw();
});
})
});
</script>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment