Skip to content

Instantly share code, notes, and snippets.

@tmayer
Last active August 29, 2015 13:56
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 tmayer/9225521 to your computer and use it in GitHub Desktop.
Save tmayer/9225521 to your computer and use it in GitHub Desktop.
Bulgarian dialect data

Implemented by Thomas Mayer. Data and MDS results by Jelena Prokić.

var hessen = [ [ 22.919561808000054, 43.834224752000068 ], [ 23.052551215000108, 43.842819856000062 ], [ 23.13184859200004, 43.847944845000086 ], [ 23.161924275000104, 43.857324117000132 ], [ 23.196960896000121, 43.862750143000113 ], [ 23.23447798700002, 43.877297059000057 ], [ 23.325150732000054, 43.886592281000077 ], [ 23.484695272000096, 43.880604350000056 ], [ 23.592699016000068, 43.837428691000127 ], [ 23.620853516000068, 43.834009930000036 ], [ 23.636107219000053, 43.832157695000092 ], [ 23.720753215000059, 43.845826111000093 ], [ 23.742870727000053, 43.842699687000049 ], [ 23.799921509000058, 43.818463440000073 ], [ 24.149605832000134, 43.754719949000105 ], [ 24.159382772000129, 43.752937724000077 ], [ 24.336705387000052, 43.759250925000089 ], [ 24.35823368400014, 43.760017395000091 ], [ 24.375493612000042, 43.763867290000036 ], [ 24.431200806000078, 43.79417551700007 ], [ 24.46634077900012, 43.802417908000109 ], [ 24.500137166000115, 43.799498190000122 ], [ 24.661763224000083, 43.755656716000061 ], [ 24.705602661000057, 43.743765158000087 ], [ 24.752628215000101, 43.738804220000134 ], [ 24.963674764000075, 43.749604594000061 ], [ 25.08160038200009, 43.71893463100011 ], [ 25.211308227000131, 43.711880799000113 ], [ 25.252339315000086, 43.70464609800004 ], [ 25.285404775000075, 43.690391315000113 ], [ 25.288719523000083, 43.688962301000089 ], [ 25.323032674000103, 43.669712830000066 ], [ 25.359619588000044, 43.654287415000056 ], [ 25.403131144000071, 43.650049948000117 ], [ 25.426075480000094, 43.654390767000081 ], [ 25.467416626000045, 43.667749125000114 ], [ 25.482450035000113, 43.669714753000051 ], [ 25.488758993000118, 43.670539653000077 ], [ 25.533820841000079, 43.668679301000083 ], [ 25.556558472000063, 43.670358785000133 ], [ 25.575058634000072, 43.677386780000035 ], [ 25.593868856000086, 43.680668234000024 ], [ 25.616503134000141, 43.687747904000048 ], [ 25.637897176000138, 43.697282207000057 ], [ 25.653503458000102, 43.708134257000097 ], [ 25.671383504000062, 43.717358500000103 ], [ 25.73294793700012, 43.718781011000033 ], [ 25.739596395000092, 43.71893463100011 ], [ 25.781144246000082, 43.732008769000089 ], [ 25.804398641000091, 43.759914042000077 ], [ 25.806258993000085, 43.763660584000093 ], [ 25.839331909000094, 43.788439433000121 ], [ 25.869304240000133, 43.8008934530001 ], [ 25.916433146000116, 43.844379171000099 ], [ 25.924494670000115, 43.858616028000085 ], [ 25.93400313300009, 43.870320740000068 ], [ 26.054305868000085, 43.934322001000055 ], [ 26.061643921000098, 43.949773254000064 ], [ 26.079317260000096, 43.969048564000076 ], [ 26.116214233000107, 43.998865865000084 ], [ 26.150734091000089, 44.012405090000073 ], [ 26.231452678000039, 44.027494609000058 ], [ 26.310517619000109, 44.052609355000101 ], [ 26.332335498000106, 44.054926298000026 ], [ 26.41579067300006, 44.063788794000033 ], [ 26.614168335000102, 44.084855448000042 ], [ 26.647758016000125, 44.093382060000067 ], [ 26.667808471000086, 44.095087382000116 ], [ 26.677316935000079, 44.097051087000068 ], [ 26.697212361000084, 44.106094463000034 ], [ 26.708684530000085, 44.108109843000079 ], [ 26.753694702000104, 44.108109843000079 ], [ 26.789454793000033, 44.115964661000106 ], [ 26.884126017000142, 44.156530660000044 ], [ 27.001534871000075, 44.165108949000057 ], [ 27.027476441000118, 44.177046204000106 ], [ 27.100236857000084, 44.144490052000066 ], [ 27.20555342600008, 44.129245504000011 ], [ 27.226740763000066, 44.120718893000088 ], [ 27.251132039000083, 44.122372539000139 ], [ 27.252662458000145, 44.121518866000116 ], [ 27.269012085000043, 44.112398987000034 ], [ 27.264309530000048, 44.089764710000082 ], [ 27.285341838000079, 44.072453105000079 ], [ 27.341669149000069, 44.053074443000099 ], [ 27.353554728000091, 44.045271302000089 ], [ 27.372881714000073, 44.020724996000126 ], [ 27.383837117000041, 44.015092265000106 ], [ 27.57452315200004, 44.016280823000017 ], [ 27.633434285000135, 44.029768372000092 ], [ 27.656275268000059, 44.023877259000074 ], [ 27.676119019000055, 43.99354319300005 ], [ 27.682514976000078, 43.987256010000038 ], [ 27.72169763100004, 43.948739726000071 ], [ 27.787326701000069, 43.960418600000139 ], [ 27.856469767000135, 43.988633932000113 ], [ 27.912073608000071, 43.993336487000079 ], [ 27.912073608000071, 43.993233134000064 ], [ 27.935844767000106, 43.964397685000023 ], [ 27.981009969000098, 43.849340109000053 ], [ 28.014806355000076, 43.830038961000099 ], [ 28.221253703000059, 43.761981100000128 ], [ 28.434574015000123, 43.735212707000045 ], [ 28.578379754000082, 43.741278387000108 ], [ 28.576182488000086, 43.727525132000011 ], [ 28.573090040000125, 43.606146552000098 ], [ 28.575531446000042, 43.593329169000043 ], [ 28.58570397200009, 43.575832424000112 ], [ 28.595876498000052, 43.563706773 ], [ 28.602712436000076, 43.552720445000062 ], [ 28.603526238000086, 43.538153387000108 ], [ 28.594574415000039, 43.512518622000044 ], [ 28.578461134000065, 43.480780341000099 ], [ 28.560313347000061, 43.453843492000033 ], [ 28.545176629000082, 43.442531643000052 ], [ 28.53500410200013, 43.438625393000052 ], [ 28.488617384000065, 43.406439520000106 ], [ 28.479258660000113, 43.396795966000042 ], [ 28.473887566000087, 43.384263414000117 ], [ 28.473155144000145, 43.366848049000055 ], [ 28.459483269000117, 43.380682684000078 ], [ 28.414561394000089, 43.398871161000045 ], [ 28.404958530000044, 43.40468984600011 ], [ 28.393809441000116, 43.414292710000097 ], [ 28.368662957000112, 43.421779690000051 ], [ 28.321625196000099, 43.428290106000048 ], [ 28.299164259000094, 43.425034898 ], [ 28.261566602000102, 43.410956122000073 ], [ 28.243174675000063, 43.4077822940001 ], [ 28.177989129000139, 43.409979559000078 ], [ 28.157237175000063, 43.4077822940001 ], [ 28.11882571700005, 43.391546942000048 ], [ 28.091563347000147, 43.363959052000041 ], [ 28.087006056000092, 43.355251369000058 ], [ 28.031097852000045, 43.248968817000048 ], [ 28.017588738000086, 43.232733466000099 ], [ 28.000173373000109, 43.223211981000105 ], [ 27.931976759000094, 43.209784247000101 ], [ 27.920583530000016, 43.204046942000048 ], [ 27.91382897200009, 43.202337958000044 ], [ 27.903981967000078, 43.202337958000044 ], [ 27.903981967000078, 43.195502020000021 ], [ 27.938731316000116, 43.176499742000033 ], [ 27.945567254000139, 43.168850002000084 ], [ 27.944346550000034, 43.157131252000084 ], [ 27.92514082100007, 43.11359284100007 ], [ 27.911387566000144, 43.06517161700009 ], [ 27.904307488000086, 43.055853583000044 ], [ 27.895518425000034, 43.049261786000073 ], [ 27.887705925000034, 43.042141018000024 ], [ 27.883555535000085, 43.030991929000095 ], [ 27.885427280000073, 43.008612372000073 ], [ 27.900401238000086, 42.962876695000062 ], [ 27.903981967000078, 42.942287502000028 ], [ 27.898448113000143, 42.874660549000083 ], [ 27.903981967000078, 42.859686591000042 ], [ 27.883962436000104, 42.848374742000061 ], [ 27.883555535000085, 42.831935940000051 ], [ 27.891612175000034, 42.81037018400005 ], [ 27.897146030000044, 42.784002997000044 ], [ 27.897146030000044, 42.736232815000108 ], [ 27.894704623000109, 42.717474677000041 ], [ 27.892263217000078, 42.710516669000071 ], [ 27.841075066000116, 42.708319403000075 ], [ 27.787364129000139, 42.71515534100007 ], [ 27.743174675000091, 42.716050523000064 ], [ 27.73267662900011, 42.714504299000026 ], [ 27.725596550000063, 42.708482164000117 ], [ 27.719004754000082, 42.694566148000064 ], [ 27.715830925, 42.683742580000057 ], [ 27.716970248000052, 42.674505927000098 ], [ 27.724131707000083, 42.666978257000039 ], [ 27.739512566000116, 42.661078192000105 ], [ 27.71273847700013, 42.657660223000079 ], [ 27.669200066000087, 42.643703518000024 ], [ 27.646739129000082, 42.640570380000042 ], [ 27.62842858200014, 42.628973700000131 ], [ 27.630381707000083, 42.602728583000015 ], [ 27.641449415000125, 42.574774481000077 ], [ 27.65015709700009, 42.55805084800005 ], [ 27.634043816000116, 42.563706773000035 ], [ 27.540863477000102, 42.565497137000108 ], [ 27.51148522200009, 42.553045966000099 ], [ 27.498545769000089, 42.532456773000064 ], [ 27.491465691000116, 42.507757880000071 ], [ 27.48015384200005, 42.482896226000037 ], [ 27.462250196000099, 42.489569403000075 ], [ 27.452891472000147, 42.480129299000083 ], [ 27.453379754000139, 42.465236721000025 ], [ 27.465668165000096, 42.455633856000048 ], [ 27.462087436000047, 42.448716539000145 ], [ 27.461110873000052, 42.443548895000049 ], [ 27.465668165000096, 42.428290106000077 ], [ 27.46843509200005, 42.435777085000041 ], [ 27.469899936000019, 42.437079169000043 ], [ 27.469411655000044, 42.437201239000018 ], [ 27.465668165000096, 42.441351630000042 ], [ 27.472666863000086, 42.461859442000105 ], [ 27.503916863000143, 42.437323309000078 ], [ 27.514170769000089, 42.4351260440001 ], [ 27.526377800000063, 42.443670966000099 ], [ 27.534434441000087, 42.455267645000021 ], [ 27.544444207000083, 42.460028387000108 ], [ 27.562022332000112, 42.448187567000076 ], [ 27.571055535000113, 42.458482164000088 ], [ 27.57960045700014, 42.457220770000077 ], [ 27.587738477000045, 42.451483466000099 ], [ 27.59555097700013, 42.448187567000076 ], [ 27.609629754000082, 42.451157945000091 ], [ 27.619476759000094, 42.455877997000073 ], [ 27.629405144000117, 42.458644924000055 ], [ 27.643321160000085, 42.455633856000048 ], [ 27.64283287900011, 42.450506903000132 ], [ 27.641774936000047, 42.44953034100007 ], [ 27.639821811000104, 42.449774481000105 ], [ 27.636485222000061, 42.448187567000076 ], [ 27.642425977000102, 42.430894273000064 ], [ 27.65219160200013, 42.418524481000134 ], [ 27.667735222000118, 42.416083075000103 ], [ 27.69166100400011, 42.428290106000077 ], [ 27.693532748000081, 42.418890692000048 ], [ 27.699066602000073, 42.413885809000107 ], [ 27.707855665000068, 42.41274648600006 ], [ 27.719004754000082, 42.414699611000117 ], [ 27.719004754000082, 42.407212632000039 ], [ 27.713226759000094, 42.405951239000046 ], [ 27.698008660000113, 42.400376695000034 ], [ 27.705414259000122, 42.39061107 ], [ 27.709646030000044, 42.388128973000079 ], [ 27.719004754000082, 42.38670482 ], [ 27.709483269000089, 42.376776434000078 ], [ 27.708343946000127, 42.36310455900005 ], [ 27.71436608200014, 42.349188544000071 ], [ 27.725840691000087, 42.338934637000051 ], [ 27.740407748000109, 42.334295966000127 ], [ 27.752126498000109, 42.335394598000079 ], [ 27.764496290000039, 42.338324286000102 ], [ 27.780446811000047, 42.338934637000051 ], [ 27.780446811000047, 42.332709052000098 ], [ 27.774587436000104, 42.327215887000051 ], [ 27.774424675000063, 42.32172272300005 ], [ 27.779144727000045, 42.316310940000079 ], [ 27.787852410000141, 42.310980536000017 ], [ 27.762950066000087, 42.29559967700007 ], [ 27.751149936000047, 42.277044989000075 ], [ 27.755869988000143, 42.25849030200007 ], [ 27.780446811000047, 42.243353583000072 ], [ 27.776052280000073, 42.240668036000102 ], [ 27.775645379000053, 42.23965078300003 ], [ 27.77369225400011, 42.2359072940001 ], [ 27.809743686000076, 42.218410549000055 ], [ 27.815277540000096, 42.211981512000136 ], [ 27.819997592000107, 42.204657294000128 ], [ 27.83139082100007, 42.195013739000046 ], [ 27.844899936000047, 42.186102606000105 ], [ 27.856211785000113, 42.181301174000026 ], [ 27.854177280000101, 42.177923895000021 ], [ 27.85141035200013, 42.170111395000021 ], [ 27.84937584700009, 42.167059637000108 ], [ 27.879079623000024, 42.154242255000099 ], [ 27.886729363000143, 42.147365627000084 ], [ 27.903981967000078, 42.11981842700007 ], [ 27.957774285000113, 42.094305731000077 ], [ 27.964366082000083, 42.084621486000088 ], [ 27.972666863000057, 42.075384833000044 ], [ 27.986582879000139, 42.072088934000107 ], [ 27.982432488000114, 42.061102606000048 ], [ 27.987315300000091, 42.051743882000011 ], [ 27.996918165000068, 42.044012762000108 ], [ 28.007009311000019, 42.037909247000101 ], [ 28.00757897200009, 42.032904364000075 ], [ 28.00611412900011, 42.03156159100007 ], [ 28.00342858200014, 42.031480210000012 ], [ 28.000173373000109, 42.030462958000044 ], [ 28.011566602000073, 42.021389065000051 ], [ 28.01905358200014, 42.008449611000032 ], [ 28.020355665000125, 41.994574286000045 ], [ 28.013845248000052, 41.982652085000012 ], [ 28.016774936000076, 41.972560940000051 ], [ 28.016783431046946, 41.972531457013588 ], [ 27.981009969000098, 41.978524069000059 ], [ 27.965920451000102, 41.982141419000129 ], [ 27.91703454600011, 41.977903951000087 ], [ 27.903391968000108, 41.981056213000045 ], [ 27.876933634000096, 41.990719707000068 ], [ 27.852232300000111, 41.995448100000061 ], [ 27.843033895000104, 41.995758159000047 ], [ 27.824016968000137, 41.99348439500011 ], [ 27.819934529000108, 41.994698792000037 ], [ 27.815955445000043, 41.995138042000065 ], [ 27.81192468200004, 41.994698792000037 ], [ 27.807997274000087, 41.99348439500011 ], [ 27.804948364000069, 41.983433329000093 ], [ 27.804896687000053, 41.969894104000105 ], [ 27.802726278000137, 41.960049744000031 ], [ 27.818280884000075, 41.952866720000088 ], [ 27.815335327000071, 41.94679473900004 ], [ 27.802829631000066, 41.943074036000013 ], [ 27.789807170000131, 41.942686463000115 ], [ 27.776164592000043, 41.946122945000042 ], [ 27.723971395000063, 41.967594503000072 ], [ 27.687074422000109, 41.968602193000066 ], [ 27.609301392000106, 41.953486837000042 ], [ 27.606872599000042, 41.943513285000051 ], [ 27.603358602000071, 41.938629863000102 ], [ 27.598087606000064, 41.938604025000103 ], [ 27.590542847000108, 41.942893169000058 ], [ 27.582377970000067, 41.934883322000076 ], [ 27.572197713, 41.929844869000107 ], [ 27.55075199400008, 41.924212138000087 ], [ 27.55209558100006, 41.921835022000039 ], [ 27.554886108000119, 41.920336405000029 ], [ 27.557935018000137, 41.919070334000082 ], [ 27.560673869000084, 41.917675070000115 ], [ 27.55746993000011, 41.915504659000106 ], [ 27.55126875800002, 41.913101705000059 ], [ 27.548891642000086, 41.91087961900007 ], [ 27.56274092600006, 41.906435445000056 ], [ 27.546411173000109, 41.901164449000134 ], [ 27.533182007000107, 41.908063253000108 ], [ 27.509462524000071, 41.933177999000122 ], [ 27.494321330000048, 41.942841492000042 ], [ 27.420837443000096, 41.973718160000033 ], [ 27.396859578000061, 41.989324443000072 ], [ 27.374845418000092, 42.008703105000052 ], [ 27.332470744000091, 42.057433981000088 ], [ 27.305288940000082, 42.077587789000063 ], [ 27.273352906000099, 42.091747132000108 ], [ 27.238212931000078, 42.097922465000096 ], [ 27.216405477000137, 42.095622864000063 ], [ 27.203796427000015, 42.088129781000134 ], [ 27.181575561000074, 42.06588307700008 ], [ 27.178991740000072, 42.061878154000084 ], [ 27.178164917000061, 42.058364156000039 ], [ 27.173824097000079, 42.057072246000075 ], [ 27.149587849000085, 42.061826478000086 ], [ 27.127211954000103, 42.062575786000082 ], [ 27.116049845000077, 42.061826478000086 ], [ 27.100650268000095, 42.071102397000089 ], [ 27.083700398000076, 42.078414612000074 ], [ 27.065510294000035, 42.082703756000058 ], [ 27.047903041000097, 42.082919649000075 ], [ 27.046545044000084, 42.082936300000114 ], [ 27.022618856000094, 42.073892924000063 ], [ 27.000397990000067, 42.042809550000101 ], [ 26.981071004000086, 42.032861837000013 ], [ 26.967170044000113, 42.028495179000117 ], [ 26.958230021000105, 42.018237406000139 ], [ 26.950065144000064, 42.006170960000048 ], [ 26.938903035000038, 41.996223247000046 ], [ 26.930221395000075, 41.994517924000093 ], [ 26.911462850000078, 41.996791687000012 ], [ 26.901075887000076, 41.99348439500011 ], [ 26.890327189000061, 41.985422873000118 ], [ 26.881128784000055, 41.985526225000058 ], [ 26.871723674000094, 41.988135885000048 ], [ 26.860768269000118, 41.987903341000106 ], [ 26.850019572000093, 41.982864889000041 ], [ 26.837899181000097, 41.975219503000091 ], [ 26.827695353000109, 41.968783061000096 ], [ 26.819427124000072, 41.965656636000062 ], [ 26.808420044000087, 41.967878724000059 ], [ 26.78991988100006, 41.979945170000036 ], [ 26.780566447000126, 41.983433329000093 ], [ 26.768577515000061, 41.980771994000065 ], [ 26.746976766000103, 41.964493917000141 ], [ 26.736744833000103, 41.958964539000135 ], [ 26.717572876000105, 41.957310893000084 ], [ 26.62357344600008, 41.969041444000084 ], [ 26.605693400000092, 41.967413636000032 ], [ 26.589467, 41.958757834000068 ], [ 26.560631552000075, 41.935684306000013 ], [ 26.553293497000084, 41.931576030000087 ], [ 26.547092326000097, 41.926899312000018 ], [ 26.542958211000069, 41.920362244000046 ], [ 26.544715210000049, 41.916434835000075 ], [ 26.556807495000044, 41.910750427000039 ], [ 26.559804728000131, 41.907339783000111 ], [ 26.55897790500012, 41.90173289000009 ], [ 26.554740438000067, 41.892947897000084 ], [ 26.553603557000145, 41.887702739000076 ], [ 26.552894853000026, 41.881643325000084 ], [ 26.552053263000118, 41.874447734000057 ], [ 26.547815796000094, 41.856283468000129 ], [ 26.539547567000028, 41.837990011000073 ], [ 26.526111694000093, 41.824244080000113 ], [ 26.478362671000099, 41.813288676000042 ], [ 26.37552657100008, 41.816621806000057 ], [ 26.334185425000044, 41.789543355 ], [ 26.320026082000084, 41.765462138000146 ], [ 26.316305379000084, 41.74375803600006 ], [ 26.323230021000143, 41.7236817430001 ], [ 26.333358602000118, 41.71303639700011 ], [ 26.294911336000069, 41.710323385000066 ], [ 26.273930705000055, 41.714896749000019 ], [ 26.261011597000049, 41.723061626000032 ], [ 26.234449910000137, 41.745825094000026 ], [ 26.226181681000099, 41.749674988000066 ], [ 26.2118156330001, 41.750475973000079 ], [ 26.189904826000117, 41.734688823000084 ], [ 26.13512780800005, 41.733396912000046 ], [ 26.108359415000081, 41.72789337200004 ], [ 26.081487671000076, 41.71151194300009 ], [ 26.07404626500005, 41.709134827000042 ], [ 26.067224975000101, 41.708850606000084 ], [ 26.06050704000009, 41.707300314000065 ], [ 26.053685750000113, 41.701512553000072 ], [ 26.048104695000092, 41.689084371 ], [ 26.047484578000137, 41.674614970000079 ], [ 26.0502751060001, 41.660455627000033 ], [ 26.055029337000093, 41.64875091600004 ], [ 26.05948958500008, 41.643776770000073 ], [ 26.066914917000105, 41.635495911000135 ], [ 26.08117761200009, 41.63045745900007 ], [ 26.095233602000121, 41.628390401000019 ], [ 26.106705770000133, 41.624282125000093 ], [ 26.115284057000054, 41.616634013000123 ], [ 26.121071818000132, 41.60821075500013 ], [ 26.130270223000139, 41.582682597000087 ], [ 26.130993693000022, 41.575137838000046 ], [ 26.129443400000099, 41.559376527000069 ], [ 26.13120039800009, 41.552658590000135 ], [ 26.136781453000111, 41.549196269000106 ], [ 26.15249108900008, 41.547025859000115 ], [ 26.158072144000073, 41.542323303000046 ], [ 26.163136434000052, 41.529145813000042 ], [ 26.164480021000116, 41.517725322000047 ], [ 26.162929728000108, 41.506459860000092 ], [ 26.159312378000038, 41.493799134000142 ], [ 26.147633504000055, 41.484755758000091 ], [ 26.145876506000064, 41.478037822000061 ], [ 26.156211792000079, 41.460416158000072 ], [ 26.160449260000121, 41.455868632000033 ], [ 26.174298543000106, 41.445998434000046 ], [ 26.177399129000037, 41.439952291000111 ], [ 26.175642130000142, 41.431890767000112 ], [ 26.170577840000078, 41.429565328000081 ], [ 26.164273316000077, 41.427860006000031 ], [ 26.159002319000138, 41.421813863000096 ], [ 26.147840210000112, 41.396905823000111 ], [ 26.132440633000016, 41.371532695000042 ], [ 26.120865112000075, 41.357786764000082 ], [ 26.114663941000089, 41.355202942000091 ], [ 26.107325887000087, 41.356598206000058 ], [ 26.02185306800007, 41.341663717000102 ], [ 26.008933960000064, 41.336806132000078 ], [ 25.982268921000127, 41.323266907000118 ], [ 25.959634643000072, 41.314998678000052 ], [ 25.948575887000061, 41.313965150000087 ], [ 25.935140015000115, 41.31592885400002 ], [ 25.921187378000127, 41.316032206000045 ], [ 25.896279338000056, 41.306265361000101 ], [ 25.882016642000082, 41.304043274000094 ], [ 25.862689657000118, 41.310089417000114 ], [ 25.833337443000062, 41.334635722000087 ], [ 25.811013224000078, 41.341043600000035 ], [ 25.800781290000117, 41.338046366000128 ], [ 25.763470906000066, 41.319029440000065 ], [ 25.72874434400012, 41.317065735000114 ], [ 25.71747888200008, 41.314120178000024 ], [ 25.705179891000029, 41.307298889000066 ], [ 25.698048543000084, 41.301924540000101 ], [ 25.691227255000058, 41.298410543000045 ], [ 25.679961792000086, 41.297170309000109 ], [ 25.670453328000093, 41.299185689000069 ], [ 25.649576050000121, 41.30848744700009 ], [ 25.639757528000047, 41.311071269000081 ], [ 25.551494182000084, 41.315670471000146 ], [ 25.537954956000107, 41.312208150000089 ], [ 25.530203491000094, 41.30275136400013 ], [ 25.523692261000122, 41.29169260700013 ], [ 25.514907267000126, 41.28347605400009 ], [ 25.50508874500008, 41.280582174000102 ], [ 25.497337280000067, 41.281202291000085 ], [ 25.489482462000126, 41.283062643000079 ], [ 25.479095500000113, 41.283786112000087 ], [ 25.453463989000056, 41.280427144000072 ], [ 25.285722290000052, 41.239396057000107 ], [ 25.262261190000089, 41.238104147000058 ], [ 25.239110148000094, 41.240894674000032 ], [ 25.219679810000116, 41.249731344000026 ], [ 25.177098430000058, 41.293863017000035 ], [ 25.157874797000119, 41.30611033200006 ], [ 25.153847445000054, 41.307535008000059 ], [ 25.116533650000093, 41.320734762000114 ], [ 25.112606242000112, 41.324145406000042 ], [ 25.104854777000128, 41.334067282000035 ], [ 25.101857544000097, 41.336651103000037 ], [ 25.096793254000119, 41.336702779000063 ], [ 25.080360148000068, 41.334067282000035 ], [ 24.916959269000074, 41.386363831000068 ], [ 24.88636682200007, 41.400626526000025 ], [ 24.872930949000107, 41.401866761000065 ], [ 24.863009074000104, 41.400316468000142 ], [ 24.842131795000029, 41.394735413000035 ], [ 24.803271118000083, 41.392668355000069 ], [ 24.800170532000038, 41.379335836000052 ], [ 24.802857706000054, 41.361920878 ], [ 24.794279419000134, 41.34739980100008 ], [ 24.774435669000127, 41.34807159500005 ], [ 24.752628215000101, 41.362747701000046 ], [ 24.718728475000091, 41.395717265000087 ], [ 24.69919478300011, 41.408946432000079 ], [ 24.680901326000111, 41.415509338000078 ], [ 24.661264282000104, 41.417679749000058 ], [ 24.638216594000113, 41.417679749000058 ], [ 24.644314413000075, 41.42765330000006 ], [ 24.609484497000039, 41.427239888000059 ], [ 24.595841919000122, 41.429772034000052 ], [ 24.58044234200014, 41.440520732000067 ], [ 24.579718872000029, 41.444189759000068 ], [ 24.58219934100012, 41.455248515000079 ], [ 24.581062459000094, 41.460209453000118 ], [ 24.577238403000052, 41.463568421000048 ], [ 24.567729939000088, 41.468115947000058 ], [ 24.564112589000104, 41.471061504000062 ], [ 24.558738241000128, 41.476849264000037 ], [ 24.553570598000135, 41.480776673 ], [ 24.549436483000108, 41.485427552000061 ], [ 24.54654260300012, 41.493644104000111 ], [ 24.543338664000146, 41.521342672000031 ], [ 24.53093632000008, 41.54754262300014 ], [ 24.510162395000123, 41.561650289000085 ], [ 24.481326945000092, 41.553227031000091 ], [ 24.45920943200008, 41.549506328000092 ], [ 24.438848917000144, 41.527698873000048 ], [ 24.423966105000119, 41.525218405000089 ], [ 24.40288212100009, 41.527853902000089 ], [ 24.387482544000108, 41.526665345000083 ], [ 24.353892863000084, 41.519120586000042 ], [ 24.345004517000064, 41.518397115000113 ], [ 24.318236124000094, 41.520774231000075 ], [ 24.309554484000046, 41.519792379000108 ], [ 24.303043254000073, 41.516950175000034 ], [ 24.296118612000072, 41.51524485300007 ], [ 24.286816854000051, 41.517621969000118 ], [ 24.285059855000071, 41.523151347000123 ], [ 24.287333618000105, 41.531626282000019 ], [ 24.286403442000051, 41.540359599000084 ], [ 24.26686975100003, 41.549764710000062 ], [ 24.250746704000051, 41.563458964000063 ], [ 24.23328007, 41.56180531800004 ], [ 24.214366496000082, 41.555759176000066 ], [ 24.197697918000074, 41.547710635000101 ], [ 24.196279744000066, 41.547025859000115 ], [ 24.18160363800007, 41.537362366000082 ], [ 24.177469523000127, 41.531006165000065 ], [ 24.173128703000145, 41.515296529000096 ], [ 24.170234823000072, 41.511575826000069 ], [ 24.162793416000056, 41.512040914000096 ], [ 24.158452596000075, 41.516330058000079 ], [ 24.154008423000079, 41.52211781800014 ], [ 24.146256958000066, 41.526768697000108 ], [ 24.116491333000084, 41.533383280000095 ], [ 24.076597127000127, 41.536018779000102 ], [ 24.047348267000075, 41.525735169000114 ], [ 24.049828736000052, 41.493644104000111 ], [ 24.052515910000096, 41.471474915000073 ], [ 24.051999146000043, 41.462999980000063 ], [ 24.045901327000081, 41.455455221000108 ], [ 24.034739217000066, 41.451321106000108 ], [ 24.022853637000139, 41.453078105000088 ], [ 24.000736125000117, 41.464136861000071 ], [ 23.997118774000057, 41.457005514000059 ], [ 23.992364542000132, 41.454628398000096 ], [ 23.986886841000057, 41.453698222000043 ], [ 23.981305786000036, 41.450856019000071 ], [ 23.964665975000116, 41.438350322000076 ], [ 23.949886515000117, 41.437575175000063 ], [ 23.902860962000119, 41.463516745000021 ], [ 23.894799438000035, 41.464343567000043 ], [ 23.867720988000087, 41.445481669000117 ], [ 23.851597941000108, 41.439590556000013 ], [ 23.83092736800009, 41.43561147000014 ], [ 23.809740031000047, 41.433802795000133 ], [ 23.792066691000116, 41.434474589000018 ], [ 23.777080526000049, 41.429048564000141 ], [ 23.754446248000107, 41.400678202000051 ], [ 23.738219848000085, 41.397474264000067 ], [ 23.705353638000076, 41.403158671000114 ], [ 23.672177368000064, 41.402951965000057 ], [ 23.6528503830001, 41.397629293000108 ], [ 23.627735637000086, 41.378509014000116 ], [ 23.624846740000066, 41.377093845000076 ], [ 23.612439412000128, 41.371015931000073 ], [ 23.578953084000119, 41.37199778300004 ], [ 23.513013957000112, 41.397732646000037 ], [ 23.414518677000046, 41.399903056000113 ], [ 23.395501750000079, 41.39525217700006 ], [ 23.36511600700004, 41.378560690000114 ], [ 23.34723596200007, 41.371222636000141 ], [ 23.326048625000112, 41.369310608000035 ], [ 23.315609985000066, 41.376855367000076 ], [ 23.306204875000105, 41.388379212000103 ], [ 23.287704712000078, 41.398197734000064 ], [ 23.269928019000048, 41.397267558000124 ], [ 23.246570272000099, 41.389722799000054 ], [ 23.224246053000059, 41.379025778000056 ], [ 23.209776652000102, 41.368587138000123 ], [ 23.206366007000099, 41.36093902600004 ], [ 23.204815714000063, 41.342697245000096 ], [ 23.19954471900013, 41.332982076000064 ], [ 23.190656372000035, 41.326057435000081 ], [ 23.179700968000134, 41.321354879000097 ], [ 23.157170043000121, 41.316342265000031 ], [ 23.115208781000035, 41.312673238000031 ], [ 22.916977986000063, 41.335772604000113 ], [ 22.94085249800014, 41.349828593000041 ], [ 22.944469849000114, 41.368432109000082 ], [ 22.939405558000146, 41.389412740000068 ], [ 22.937338501000085, 41.410755107000085 ], [ 22.940542440000058, 41.416904602000045 ], [ 22.952117960000095, 41.427704976000086 ], [ 22.954598429000072, 41.43240753200007 ], [ 22.953358195000135, 41.438195293000035 ], [ 22.947570435000074, 41.448375549000104 ], [ 22.946226848000094, 41.453233135000119 ], [ 22.943599338000126, 41.523201176000072 ], [ 22.943022909000035, 41.538550924000106 ], [ 22.947880493000071, 41.555139059000112 ], [ 22.948707316000082, 41.560978495000086 ], [ 22.946433553000077, 41.567748108000046 ], [ 22.936925090000074, 41.578910218000061 ], [ 22.9337211510001, 41.584594625000108 ], [ 22.932067505000049, 41.597952983000141 ], [ 22.932997681000103, 41.612344869000054 ], [ 22.936098266000045, 41.626168315000115 ], [ 22.94085249800014, 41.637640483000041 ], [ 22.945813436000094, 41.641076966000071 ], [ 22.961523071000073, 41.644487611000073 ], [ 22.967000773000052, 41.647045594000076 ], [ 22.970101359000097, 41.65203236900004 ], [ 22.976612590000059, 41.66655344600008 ], [ 22.985434528000098, 41.677197757000073 ], [ 22.998626750000142, 41.693115133000106 ], [ 23.00958215300011, 41.716369528000115 ], [ 23.008858683000113, 41.739933980000018 ], [ 22.991185344000115, 41.760992127000037 ], [ 22.98053999800004, 41.764738668000064 ], [ 22.956872192000105, 41.765668844000118 ], [ 22.945916788000119, 41.769337870000101 ], [ 22.939715617000047, 41.776701762000101 ], [ 22.918321573000128, 41.814348043000052 ], [ 22.907676229000117, 41.848583679000058 ], [ 22.901371704000013, 41.860417582000053 ], [ 22.896720825000045, 41.864448344000067 ], [ 22.88504195200008, 41.869150899000033 ], [ 22.88208830500011, 41.871618275000088 ], [ 22.880804484000123, 41.872690735000077 ], [ 22.878220662000047, 41.88026133300005 ], [ 22.878634073000057, 41.895014954000146 ], [ 22.877083781000124, 41.902042949000077 ], [ 22.866335083000109, 41.924883932000085 ], [ 22.858893677000083, 41.947879944000107 ], [ 22.857136678000103, 41.971883647000141 ], [ 22.85475956200014, 41.98263234500007 ], [ 22.846904744000113, 41.99348439500011 ], [ 22.846594686000032, 41.993639425000055 ], [ 22.845767863000106, 42.006868592000046 ], [ 22.845621159000132, 42.007407729000079 ], [ 22.843700806000044, 42.014465027000114 ], [ 22.838223104000065, 42.019477641000066 ], [ 22.82695764200011, 42.025084534000086 ], [ 22.821273234000046, 42.025368754000084 ], [ 22.805977010000106, 42.021389669000087 ], [ 22.79894901500009, 42.021234640000046 ], [ 22.791094198000053, 42.025808004000083 ], [ 22.787683553000136, 42.03257761600014 ], [ 22.785306437000088, 42.0391405230001 ], [ 22.780862264000064, 42.043171286000103 ], [ 22.770630330000103, 42.043998108000039 ], [ 22.725051717000099, 42.04247365400002 ], [ 22.718437134000112, 42.044463196000066 ], [ 22.713992961000116, 42.048623149000093 ], [ 22.710272258000089, 42.052989808000092 ], [ 22.705724731000146, 42.055935364000078 ], [ 22.675855753000036, 42.060612081000045 ], [ 22.627176665000036, 42.079126592000108 ], [ 22.617771443000066, 42.082703756000058 ], [ 22.531058390000112, 42.129109193000062 ], [ 22.510181112000026, 42.144792990000042 ], [ 22.506938534000142, 42.148927276000052 ], [ 22.494678182000115, 42.16455922500009 ], [ 22.481449015000123, 42.193317160000106 ], [ 22.443621867000047, 42.214426982000134 ], [ 22.345023234000053, 42.31343902600014 ], [ 22.364143514000148, 42.320983785000095 ], [ 22.405794718000067, 42.321552226000051 ], [ 22.423984822000108, 42.325893047000136 ], [ 22.438454223000036, 42.340052388000089 ], [ 22.454370565000147, 42.376768494000146 ], [ 22.46977014100014, 42.391702983000101 ], [ 22.485066365000108, 42.397154846000092 ], [ 22.497572062000103, 42.399196065000041 ], [ 22.508837525000075, 42.40493215 ], [ 22.519482870000047, 42.420926005000041 ], [ 22.533125448000078, 42.45759043400011 ], [ 22.536536092000091, 42.478390198000056 ], [ 22.532505330000106, 42.493402202000141 ], [ 22.532505330000106, 42.493557231000096 ], [ 22.524857218000108, 42.507664897000012 ], [ 22.512144816000074, 42.51918874200004 ], [ 22.481449015000123, 42.535621846000112 ], [ 22.429669230000059, 42.571407776000029 ], [ 22.425328410000077, 42.572854716000023 ], [ 22.428842407000047, 42.592775981000045 ], [ 22.441318219000038, 42.632891463000107 ], [ 22.444552042000083, 42.64328969400006 ], [ 22.449202921000051, 42.667965190000075 ], [ 22.442071573000106, 42.681685282000103 ], [ 22.468116496000107, 42.718323873000145 ], [ 22.481449015000123, 42.727677307000107 ], [ 22.482585897000035, 42.730674541000013 ], [ 22.482895955000117, 42.733775126000069 ], [ 22.482585897000035, 42.736824036000087 ], [ 22.481449015000123, 42.739821269000089 ], [ 22.46656620300007, 42.748528748000069 ], [ 22.453130331000125, 42.763592428000067 ], [ 22.429359172000062, 42.806122131000109 ], [ 22.425845174000102, 42.80984283500004 ], [ 22.427395467000053, 42.813615214000038 ], [ 22.430446174000025, 42.81707659300011 ], [ 22.436800578000089, 42.82428639800014 ], [ 22.445482218000052, 42.830177511000045 ], [ 22.470907023000052, 42.840125224000047 ], [ 22.481449015000123, 42.846739807000063 ], [ 22.497055298000078, 42.86441314700005 ], [ 22.506046997000112, 42.870123393000085 ], [ 22.519792928000129, 42.870355937000056 ], [ 22.537569621000074, 42.868340556000106 ], [ 22.544494262000057, 42.871389466000039 ], [ 22.544785162000068, 42.871706438000075 ], [ 22.549971965000054, 42.877358093000055 ], [ 22.563614542000039, 42.884282735000056 ], [ 22.590899699000147, 42.886892395000046 ], [ 22.666243937000047, 42.871932068000092 ], [ 22.696629680000086, 42.877409770000071 ], [ 22.727015422000136, 42.886892395000046 ], [ 22.738797648000059, 42.897382711 ], [ 22.73957861800011, 42.898857543000105 ], [ 22.74551558400006, 42.910069275000069 ], [ 22.763188924000076, 42.958645121000046 ], [ 22.769390096000052, 42.971280009000083 ], [ 22.776418091000068, 42.979729106000093 ], [ 22.788096964000147, 42.984896749000086 ], [ 22.815795532000067, 42.989702657000095 ], [ 22.828817993000115, 42.993449198000093 ], [ 22.828921346000129, 42.993449198000093 ], [ 22.829024699000058, 42.993500875000024 ], [ 22.829024699000058, 42.993655905000054 ], [ 22.842253865000146, 43.007505188000039 ], [ 22.884215128000051, 43.036650696000038 ], [ 22.889486124000086, 43.044376323000051 ], [ 22.896720825000045, 43.062721457000123 ], [ 22.901681763000113, 43.069749451000035 ], [ 22.910156698000094, 43.075278829000041 ], [ 22.927106568000113, 43.081144105000135 ], [ 22.935271443000119, 43.085562439000029 ], [ 22.955631958000055, 43.108274232000014 ], [ 22.974028768000068, 43.141192118000049 ], [ 22.984570760000111, 43.174626771000135 ], [ 22.982901935000143, 43.187317919000094 ], [ 22.981366822000069, 43.19899220800005 ], [ 22.964727010000047, 43.20441823400003 ], [ 22.915531046000069, 43.212247213000069 ], [ 22.897754353000039, 43.220334574000049 ], [ 22.88380171700004, 43.23059234700014 ], [ 22.857343384000046, 43.256947327 ], [ 22.833158814000086, 43.274646505000106 ], [ 22.82695764200011, 43.28139027900005 ], [ 22.823857056000065, 43.289296773000103 ], [ 22.820756469000116, 43.307538554000047 ], [ 22.817139119000046, 43.315496724000099 ], [ 22.804530070000112, 43.328984274000078 ], [ 22.733009888000083, 43.381513367000139 ], [ 22.724343132000087, 43.386060131000107 ], [ 22.719367309000063, 43.388670553000082 ], [ 22.702934204000087, 43.394044902000047 ], [ 22.693219035000055, 43.394871725000087 ], [ 22.674202108000088, 43.39414825500009 ], [ 22.664693644000096, 43.396732077000081 ], [ 22.658926066000106, 43.401295034000071 ], [ 22.656528768000101, 43.403191631000141 ], [ 22.645366658000057, 43.420296529000098 ], [ 22.63782190000012, 43.426368511000135 ], [ 22.628520141000081, 43.428254700000139 ], [ 22.606919393000112, 43.42740203800011 ], [ 22.596274048000112, 43.42915903800008 ], [ 22.586765584000119, 43.434430033000126 ], [ 22.572709595000106, 43.448150127000048 ], [ 22.565784953000048, 43.453343608000068 ], [ 22.53260868400011, 43.464841614000079 ], [ 22.518862752000075, 43.474246725000057 ], [ 22.509354288000111, 43.49334116600005 ], [ 22.49064742000013, 43.540883485000052 ], [ 22.478451783000111, 43.559228617000116 ], [ 22.477624959000082, 43.564163717000071 ], [ 22.478658488000065, 43.569176331000051 ], [ 22.481449015000123, 43.574111430000073 ], [ 22.48268925000005, 43.576695252000093 ], [ 22.483102661000061, 43.579279073000095 ], [ 22.48268925000005, 43.581733704000044 ], [ 22.481449015000123, 43.584136658 ], [ 22.478141723000107, 43.587573141000036 ], [ 22.477108194000039, 43.591293844000063 ], [ 22.478141723000107, 43.594911194000133 ], [ 22.481449015000123, 43.598528545000107 ], [ 22.481759074000109, 43.598941956000033 ], [ 22.481965780000053, 43.599458720000058 ], [ 22.481759074000109, 43.599975485000101 ], [ 22.481449015000123, 43.600647278000082 ], [ 22.47380090300004, 43.612997946000036 ], [ 22.472870728000089, 43.635942282000087 ], [ 22.466256144000084, 43.649119772000063 ], [ 22.455920858000098, 43.656406149000134 ], [ 22.426465291000085, 43.668214213000056 ], [ 22.41395959500008, 43.676663310000038 ], [ 22.404864543000116, 43.68717946400011 ], [ 22.396906372000046, 43.699400940000118 ], [ 22.390498495000116, 43.712449240000069 ], [ 22.386054321000103, 43.725497538000099 ], [ 22.385847616000063, 43.733817444000067 ], [ 22.389568319000148, 43.750508932000116 ], [ 22.38853479000008, 43.758286235000128 ], [ 22.362593221000026, 43.780842998000139 ], [ 22.349467407000077, 43.807921448000116 ], [ 22.354738403000084, 43.829703065000018 ], [ 22.367554159000065, 43.852750753000095 ], [ 22.377062622000068, 43.883524068000042 ], [ 22.379026326000087, 43.913496399000081 ], [ 22.382023560000107, 43.918560690000078 ], [ 22.39194543500011, 43.931867371000095 ], [ 22.394529256000112, 43.936337382 ], [ 22.396803019000117, 43.951943665000044 ], [ 22.397319783000057, 43.980934144000116 ], [ 22.399593546000091, 43.993336487000079 ], [ 22.411789184000099, 44.006927389000083 ], [ 22.434320109000112, 44.013955384000099 ], [ 22.465885257000139, 44.017624140000066 ], [ 22.481449015000123, 44.019433085000088 ], [ 22.503669882000054, 44.019898173000087 ], [ 22.514935343000019, 44.030285136000117 ], [ 22.522583455000103, 44.044702861000133 ], [ 22.534158976000128, 44.057156881000111 ], [ 22.554622844000107, 44.062427877000061 ], [ 22.575190064000083, 44.061394348000078 ], [ 22.592966757000113, 44.063926494000071 ], [ 22.604748982000018, 44.079377747000052 ], [ 22.604645630000107, 44.088162740000143 ], [ 22.598134399000116, 44.109298401000103 ], [ 22.597100871000038, 44.119065247000037 ], [ 22.599064575000085, 44.130330709000106 ], [ 22.609399861000099, 44.159941305000046 ], [ 22.607952921000106, 44.159992981000073 ], [ 22.605989217000058, 44.163145244000106 ], [ 22.604852335000146, 44.168467916000083 ], [ 22.606195923000115, 44.174565735000044 ], [ 22.608573039000078, 44.175857646000082 ], [ 22.624799438000082, 44.189396872000145 ], [ 22.63999231000011, 44.207328593000028 ], [ 22.648777303000088, 44.213994853000145 ], [ 22.691640373000098, 44.228434539 ], [ 22.906435995000095, 44.122889303000079 ], [ 22.942609497000035, 44.111468811000094 ], [ 22.988084757000081, 44.10702463800007 ], [ 23.008306709000095, 44.100446413000071 ], [ 23.03097619600004, 44.093072002000071 ], [ 23.040071248000089, 44.062324524000132 ], [ 23.023018025000084, 44.031628723000097 ], [ 22.988084757000081, 44.017676087000098 ], [ 22.96627730300014, 44.015557353000105 ], [ 22.926486450000141, 44.006152243000059 ], [ 22.905815877000123, 44.003981832000079 ], [ 22.885868774000102, 43.994525045000103 ], [ 22.874706665000076, 43.972045797000106 ], [ 22.850522095000088, 43.896985779 ], [ 22.851038859000141, 43.874351502000053 ], [ 22.863441203, 43.855412089000112 ], [ 22.888762655000079, 43.839521587000092 ], [ 22.919561808000054, 43.834224752000068 ] ]
;
lon lat name dim1 dim2 dim3
22.9811111 42.8497222 aldomirovci, slivnica 0.0470588 0.764706 0.239216
23.217 43.7 asparuhovo, lom 0.372549 0.843137 0.686275
27.8833333 43.1666667 asparuhovo, prov 0.960784 0.886275 0.647059
23.6833333 41.95 babjak, razl 0.568627 0.694118 0.976471
24.867 41.95 bachkovo, asgr 0.627451 0.411765 0.505882
22.76083 42.28028 bagrenci, kjust 0.188235 0.752941 0.643137
27.733 42.1 balgari, carev 0.615686 0.580392 0.670588
22.7286 42.7222 banishte, brezn 0.054902 0.784314 0.278431
23.5 41.8394444 bansko, razl 0.580392 0.709804 0.976471
24.4833333 43.25 beglezh, luk 0.737255 0.870588 0.780392
25.1166667 43.65 belene, svisht 0.87451 0.952941 0.607843
23.2333333 41.65 belica, razl 0.568627 0.745098 0.952941
23.08333 41.98333 bistrica, blgr 0.309804 0.760784 0.807843
22.9622222 42.6166667 bogdanov dol, pern 0.282353 0.8 0.611765
26.733 42.3 borisovo, elh 0.886275 1 0.784314
23.3780556 43.0325 bov, svog 0.27451 0.737255 0.698039
27.4333333 42.05 brashljan, mtarn 0.65098 0.52549 0.643137
23.13333 42.9666 buchin prohod, god 0.258824 0.792157 0.592157
23.1 41.63334 caparevo, sand 0.388235 0.831373 0.929412
22.53028 42.34833 cerovica, kjust 0.258824 0.780392 0.721569
24.683 41.733 chepelare, asgr 0.592157 0.196078 0.490196
24.4 42.267 chernogorovo, paz 0.607843 0.85098 0.764706
27.65 42.45 chernomorec, bs 0.894118 0.811765 0.74902
23.03333 42.41667 chukovec, radom 0.180392 0.756863 0.643137
24.28333 43.15 dermanci, luk 0.529412 0.807843 0.792157
24.1666667 43.3166667 devenci, luk 0.588235 0.811765 0.768627
25.71667 41.35 devesilica, krgr 0.568627 0.301961 0.482353
25.483 43.217 dichin, vtarn 0.952941 0.921569 0.572549
25.7 41.8833333 dinevo, hask 0.784314 0.494118 0.658824
22.9136111 43.2847222 diva slatina, mont 0.14902 0.784314 0.313725
26.9333333 43.2333333 divdjadovo, shum 0.968627 0.866667 0.658824
23.4833333 41.9666667 dobarsko, razl 0.596078 0.717647 1
26.31667 42.15 dobroselec, topgr 0.886275 0.968627 0.721569
23.2833333 42.8166667 dobroslavci, sof 0.247059 0.772549 0.6
23.683 41.583 dobrotino, gd 0.776471 0.615686 0.952941
23.8833333 43.1833333 dolna beshovica, vrach 0.407843 0.811765 0.666667
23.117 42.433 dolna dikanja, radom 0.215686 0.772549 0.686275
22.5255556 42.6705556 dolna melna, tran 0.121569 0.807843 0.223529
23.017 43.55 dolna riksa, mont 0.376471 0.854902 0.709804
25.7 43.5166667 dolna srudena, bel 0.921569 0.901961 0.6
23.5 42.7 dolni bogrov, sof 0.337255 0.737255 0.729412
24.2833 42.3667 dolno levski, pan 0.552941 0.901961 0.694118
24.13333 42.03333 dorkovo, velgr 0.580392 0.439216 0.490196
26.1583333 41.5022222 drabishna, ivgr 0.792157 0.427451 0.65098
25.733 43.067 dragizhevo, vtarn 0.901961 0.890196 0.627451
26.5666667 42.6166667 dragodanovo, sliv 0.890196 0.901961 0.756863
26.867 43.117 dragoevo, presl 0.992157 0.894118 0.682353
22.5 42.61666 dragojchinci, kjust 0.0784314 0.764706 0.27451
22.745 42.623 elov dol, pk 0.164706 0.792157 0.482353
25.4 42.6666667 enina, kaz 0.909804 0.870588 0.654902
24.7166667 41.6333333 ezerovo, parvom 0.658824 0.65098 0.639216
23.6 43.517 furen, vrach 0.380392 0.8 0.662745
23.9166667 43.3166667 gabare, bslat 0.462745 0.686275 0.596078
23.633 42.583 gabra, elpel 0.298039 0.772549 0.74902
24.283 43.01 galata, tetev 0.627451 0.819608 0.74902
25.5166667 42.9833333 ganchovec, drjan 0.878431 0.886275 0.698039
23.81667 41.6 garmen, gd 0.686275 0.533333 0.666667
26.91 44.117 garvan, sil 0.952941 0.898039 0.647059
23 41.45 gega, petr 0.431373 0.823529 0.921569
23.81667 43.7 glozhene, orjah 0.45098 0.8 0.658824
23.8 42.61666 golema rakovica, elpel 0.364706 0.756863 0.701961
23 42.9333333 golemo malovo, sliven 0.137255 0.772549 0.270588
27.55 42.9166667 golica, varn 0.901961 0.811765 0.690196
24.4666667 42.9666667 goljama zheljazna, tet 0.721569 0.843137 0.713725
26.0333 42.6833 goljamo shivachevo, sl 0.952941 0.92549 0.74902
25.13333 42.95 gorna rosica, sevl 0.913725 0.890196 0.65098
25.433 42.933 gorni varpishta, drjan 0.858824 0.960784 0.752941
23.4833333 42.25 govedarci, sam 0.298039 0.772549 0.741176
22.7519444 44.0288889 gradec, vd 0.305882 0.819608 0.592157
25.8 41.8833333 huhla, ivgr 0.752941 0.419608 0.662745
24.68333 41.86666 hvojna, asgr 0.635294 0.435294 0.419608
27.4167 42.2167 indzhe vojvoda, mtarn 0.647059 0.443137 0.635294
27.017 43.133 ivanski, shum 0.960784 0.878431 0.658824
25.3166667 42.3 izvorovo, harm 0.85098 0.72549 0.737255
25.283 41.75 javorovo, asgr 0.607843 0.423529 0.494118
27.2333333 44.083333 kalipetrovo, sil 0.929412 0.882353 0.619608
24.7333 42.35 kalojanovo, plov 0.843137 0.976471 0.647059
25.35 43.383 karaisen, pavl 0.952941 0.933333 0.619608
27.2 42.65 karanovo, ajt 0.886275 0.858824 0.733333
27.183 43.3 kaspichan, np 0.960784 0.854902 0.654902
25.1667 42.3833 kolju marinovo, chirp 0.811765 0.811765 0.682353
22.844 42.733 konska, brezn 0 0.780392 0.278431
22.9136111 43.3311111 kopilovci, mont 0.145098 0.784314 0.254902
24.35 42.63334 koprivshtica, pird 0.517647 0.862745 0.788235
26 42.55 korten, nzag 0.882353 0.901961 0.65098
23.81667 42.26667 kostenec, iht 0.341176 0.788235 0.827451
23.33333 42.45 kovachevci, sam 0.239216 0.764706 0.611765
27.5666667 42.8333333 kozichino, pom 0.894118 0.807843 0.690196
25.083 43.133 kramolin, sevl 0.937255 0.92549 0.545098
25.017 42.85 kravenik, sevl 0.878431 1 0.741176
23.7 43.1166667 kreta, vrach 0.521569 0.733333 0.8
26.3333333 43.65 krivnja, razgr 0.952941 0.909804 0.639216
23.3 41.483 levunovo, sand 0.384314 0.827451 0.945098
23.517 43.333 liljache, vr 0.4 0.843137 0.807843
23.75 43.03333 lipnica, botgr 0.32549 0.756863 0.682353
25.9666667 42.35 ljubenova mahala, nzag 0.894118 0.882353 0.662745
22.817 42.5 lobosh, rad 0.254902 0.784314 0.607843
23.483 42.6 lozen, sof 0.384314 0.807843 0.717647
26.633 42.133 malomirovo, elh 0.843137 0.929412 0.807843
23.1833 42.6 marchaevo, sof 0.239216 0.756863 0.603922
23.35 41.433 marikostinovo, petr 0.482353 0.811765 0.968627
27.233 43.2 markovo, shum 0.921569 0.870588 0.670588
25.783 43.05 merdanja, vtarn 0.913725 0.913725 0.619608
25.5 42.1333333 merichleri, chirp 0.878431 0.67451 0.741176
25.35 43.2 mihalci, pavl 0.929412 0.898039 0.588235
22.686 43.888 milchina laka, kul 0.368627 0.827451 0.607843
24.7833333 41.6666667 momchilovci, smol 0.572549 0.0509804 0.462745
24.7 42.5 momina banja, pl 0.772549 0.8 0.74902
23.967 42.217 momina klisura, pz 0.521569 0.713725 0.835294
26.15 41.85 momkovo, svgr 0.772549 0.74902 0.705882
24.5 41.617 mugla, dev 0.454902 0.168627 0.435294
26.1 43.85 nikolovo\lipnik\, rus 0.945098 0.937255 0.607843
25.417 41.833 nikolovo, hask 0.745098 0.556863 0.647059
22.87111 42.67944 noevci, brezn 0.129412 0.827451 0.411765
23.717 41.417 nova lovcha, gd 0.686275 0.509804 0.666667
25.7166667 42.0166667 nova nadezhda, hs 0.921569 0.560784 0.662745
25.367 43.067 novoselo, trojan 0.886275 0.882353 0.67451
26.817 42.7 ognen, karn 0.909804 0.866667 0.768627
26.133 42.45 omarchevo, nzag 0.894118 0.894118 0.662745
25.7 42.2166667 opan, stzag 0.901961 0.815686 0.717647
26.3833333 43.55 osenec, razgr 1 0.960784 0.627451
24.183 42.5 panagjurishte, gd 0.611765 0.807843 0.67451
25.48333 43.25 paskalevec, pavl 0.921569 0.894118 0.623529
24.7 41.8666667 pavelsko, asgr 0.639216 0.396078 0.439216
22.774 42.177 pelatikovo, kjust 0.243137 0.737255 0.686275
24.4833333 43.3166667 petarnica, plev 0.611765 0.729412 0.701961
26.6833333 43.2166667 pevec, targ 0.992157 0.894118 0.686275
25.683 42.967 plakovo, vt 0.870588 0.858824 0.619608
26.85 42.833 podvis, karn 0.878431 0.831373 0.72549
26.717 44.05 pozharevo, tutr 0.960784 0.901961 0.678431
22.6 43.717 rabisha, belgr 0.176471 0.8 0.352941
23.967 43.167 radovene, vr 0.478431 0.792157 0.788235
23.45 43.417 rakevo, vr 0.352941 0.807843 0.694118
22.47639 43.76611 rakovica, kul 0.337255 0.827451 0.596078
22.487 42.822 rani lug, tryn 0.0431373 0.792157 0.243137
22.957 43.014 razboishte, god 0.172549 0.807843 0.286275
22.5547222 42.3944444 ruzhinci, belgr 0.317647 0.811765 0.588235
26.3 43.483 sadina, pop 0.929412 0.886275 0.615686
23.3 42.3 saparevo, dup 0.266667 0.764706 0.752941
24.95 42.2666667 sekirovo, plov 0.878431 0.952941 0.533333
23.2333333 41.8166667 senokos, blgr 0.360784 0.807843 0.886275
23.1833 41.5167 sestrino, petr 0.407843 0.811765 0.929412
25.3333333 42.7166667 shipka, kaz 0.854902 0.854902 0.627451
24.583 41.683 shiroka laka, dev 0.72549 0.12549 0.482353
23.5166667 42.4 shiroki dol, sam 0.25098 0.752941 0.709804
27.5333333 43.3833333 shtipsko, prov 0.921569 0.85098 0.654902
26.317 42.483 skobelevo, sliv 0.941176 0.968627 0.643137
24.867 41.633 slaveino, smol 0.619608 0 0.458824
24.867 43.467 slavjanovo, plev 0.8 0.862745 0.694118
23.1 42.15 smochevo, dupn 0.384314 0.65098 0.686275
23.95 42.633 smolsko, pird 0.45098 0.811765 0.705882
24.583 41.65 solishta, dev 0.698039 0.14902 0.45098
25.66667 42.25 sredec, zlgr 0.666667 0.372549 0.52549
22.5669444 43.5461111 stakevci, blgr. 0.168627 0.811765 0
25.65 41.7666667 stambolovo, hask 0.862745 0.498039 0.619608
25.6833333 43.4833333 starmen, bel 0.894118 0.890196 0.623529
27.5166667 42.0333333 stoilovo, mt 0.631373 0.545098 0.639216
26.6833333 42.6 straldzha, jamb 0.929412 0.905882 0.74902
24.683 42.233 stroevo, plov 0.8 0.807843 0.72549
25.181 43.192 suhindol, vtarn 0.913725 0.894118 0.592157
23.08333 41.83333 sushica, blgr 0.341176 0.803922 0.878431
26.1833 42.15 svetlina, topgr 0.909804 0.886275 0.709804
25.9333333 42.0333333 svirkovo, harm 0.8 0.592157 0.690196
25.5 41.3 tihomir, krgr 0.533333 0.0705882 0.419608
25.8666667 42.2666667 tihomirovo, stzag 0.894118 0.890196 0.639216
26.433 42.65 topolchane, sliv 0.894118 0.882353 0.772549
25 43.4833333 trancovica, nik 0.862745 0.984314 0.658824
24.4666667 43.5166667 trastenik, plev 0.521569 0.913725 0.709804
24.7833333 41.5666667 ustovo, sm 0.54902 0.180392 0.431373
24.9 43.65 vabel, nik 0.913725 0.909804 0.65098
24.067 41.6 vaklinovo, gd 0.619608 0.509804 0.639216
26.017 41.7 valche pole, svgr 0.666667 0.580392 0.627451
26.633339 43 varbica, presl 0.968627 0.894118 0.694118
22.646 43.543 varbovo, blgr 0.188235 0.835294 0.141176
26.533 42.81667 vardun, targ 0.929412 0.882353 0.686275
24.13333 42.15 varvara, paz 0.447059 0.752941 0.733333
24.38333 42.88334 vasiljovo, tetev 0.505882 0.843137 0.67451
22.94278 42.66611 velkovci, pk 0.215686 0.8 0.52549
22.8161111 44.0958333 vinarovo, vid 0.329412 0.835294 0.592157
23.07 43.483 vinishte, mont 0.321569 0.811765 0.6
24.8 43.283 vladinja, lov 0.866667 0.894118 0.635294
26.9 42.083 voden, elh 0.568627 0.768627 0.921569
24.75 42.567 vojnjagovo, karl 0.854902 0.937255 0.745098
23.75 42.883 vrachesh, botgr 0.337255 0.756863 0.678431
25.2166667 42.9166667 vranilovci, gabr 0.878431 0.894118 0.67451
27.2 42.817 vresovo, ajt 0.878431 0.843137 0.729412
24.6 41.783 zabardo, asgr 0.603922 0.2 0.454902
27.5666667 42.1 zabernovo, mt 0.654902 0.560784 0.705882
23.2425 43.2961111 zamfirovo, berk 0.317647 0.85098 0.658824
23.2630556 43.1761111 zanozhene, berk 0.286275 0.764706 0.698039
25.2333333 42.95 zdravkovec, gabr 0.878431 0.894118 0.678431
22.5619444 42.8375 zelenigrad, tran 0.101961 0.784314 0.184314
25.05 41.53333 zhaltusha, ard 0.513725 0.235294 0.47451
22.8 43.88028 zheglica, vid 0.34902 0.807843 0.576471
23.38333 42.98333 zhelen, svog 0.337255 0.784314 0.713725
27.0167 42.15 zheljazkovo, sred 0.631373 0.768627 0.921569
26.46667 42.83333 zheravna, kot 0.937255 0.882353 0.768627
lon lat name dim1 dim2 dim3
22.9811111 42.8497222 aldomirovci, slivnica -4.3294039e-05 -5.9686358e-06 2.5815158e-05
23.217 43.7 asparuhovo, lom -2.9635825e-05 -7.0867664e-06 -1.1993185e-06
27.8833333 43.1666667 asparuhovo, prov 3.3464997e-05 -7.1113452e-06 5.4664908e-06
23.6833333 41.95 babjak, razl -1.6763038e-05 1.7408748e-05 -1.5513971e-05
24.867 41.95 bachkovo, asgr 8.3222322e-06 2.7446663e-05 3.0804845e-06
22.76083 42.28028 bagrenci, kjust -3.8276673e-05 -3.0496879e-06 -5.6505592e-06
27.733 42.1 balgari, carev 3.6268877e-06 1.8992032e-05 2.6163886e-07
22.7286 42.7222 banishte, brezn -4.5191322e-05 -8.7568968e-06 2.636648e-05
23.5 41.8394444 bansko, razl -1.7421096e-05 1.6902738e-05 -1.5029946e-05
24.4833333 43.25 beglezh, luk 8.4988867e-06 -1.1881415e-05 -7.4241943e-06
25.1166667 43.65 belene, svisht 1.9995854e-05 -1.8049455e-05 5.9871268e-06
23.2333333 41.65 belica, razl -1.7458699e-05 1.1242891e-05 -1.5224907e-05
23.08333 41.98333 bistrica, blgr -3.0647403e-05 2.5546247e-06 -1.4518225e-05
22.9622222 42.6166667 bogdanov dol, pern -3.2951861e-05 -5.7791768e-06 -5.5781628e-07
26.733 42.3 borisovo, elh 2.2101192e-05 -2.079556e-05 -5.7974009e-06
23.3780556 43.0325 bov, svog -3.2408437e-05 -2.7971127e-06 -7.8957295e-06
27.4333333 42.05 brashljan, mtarn 9.2292314e-06 2.1343818e-05 1.3797873e-06
23.13333 42.9666 buchin prohod, god -3.4757661e-05 -5.6031692e-06 1.919842e-06
23.1 41.63334 caparevo, sand -2.8504096e-05 1.5874673e-06 -2.3159599e-05
22.53028 42.34833 cerovica, kjust -3.5011272e-05 -4.4203224e-06 -7.9313668e-06
24.683 41.733 chepelare, asgr 4.2881438e-06 3.7596948e-05 8.5233663e-06
24.4 42.267 chernogorovo, paz -5.5492064e-06 -8.9076512e-06 -9.8113402e-06
27.65 42.45 chernomorec, bs 2.9267727e-05 9.5068115e-07 -4.1341474e-06
23.03333 42.41667 chukovec, radom -3.8153633e-05 -3.3782187e-06 -4.0120265e-06
24.28333 43.15 dermanci, luk -1.2351594e-05 -5.496079e-06 -1.2102826e-05
24.1666667 43.3166667 devenci, luk -9.2046249e-06 -6.4145368e-06 -7.1089137e-06
25.71667 41.35 devesilica, krgr 6.3245011e-06 3.3747947e-05 2.3799513e-06
25.483 43.217 dichin, vtarn 3.5492884e-05 -1.3864467e-05 6.0082692e-06
25.7 41.8833333 dinevo, hask 2.1990573e-05 2.6502634e-05 3.6643764e-06
22.9136111 43.2847222 diva slatina, mont -4.1445887e-05 -5.5523043e-06 2.330807e-05
26.9333333 43.2333333 divdjadovo, shum 3.3736067e-05 -6.0798756e-06 5.1241712e-06
23.4833333 41.9666667 dobarsko, razl -1.5903659e-05 1.6337146e-05 -1.8009336e-05
26.31667 42.15 dobroselec, topgr 2.4232745e-05 -1.3915179e-05 -7.9610627e-08
23.2833333 42.8166667 dobroslavci, sof -3.5076101e-05 -3.5254322e-06 1.2391595e-06
23.683 41.583 dobrotino, gd 7.5628898e-06 2.5529296e-05 -1.4650292e-05
23.8833333 43.1833333 dolna beshovica, vrach -2.2366143e-05 -4.6652451e-06 -6.1937338e-06
23.117 42.433 dolna dikanja, radom -3.6488796e-05 -3.7013524e-06 -5.6802662e-06
22.5255556 42.6705556 dolna melna, tran -4.3473105e-05 -9.0413085e-06 2.4362945e-05
23.017 43.55 dolna riksa, mont -2.8093569e-05 -6.8652671e-06 -4.031082e-07
25.7 43.5166667 dolna srudena, bel 2.8893775e-05 -1.2768777e-05 6.2188211e-06
23.5 42.7 dolni bogrov, sof -2.7742866e-05 8.3553735e-07 -1.1484544e-05
24.2833 42.3667 dolno levski, pan -1.0333199e-05 -1.4746663e-05 -6.5420705e-06
24.13333 42.03333 dorkovo, velgr 6.4952097e-06 2.0531031e-05 -8.1171155e-07
26.1583333 41.5022222 drabishna, ivgr 2.0573017e-05 3.037314e-05 3.8348679e-06
25.733 43.067 dragizhevo, vtarn 2.8919381e-05 -1.299675e-05 1.5541859e-06
26.5666667 42.6166667 dragodanovo, sliv 2.8412759e-05 -1.3622215e-05 -2.2520806e-06
26.867 43.117 dragoevo, presl 3.4663856e-05 -6.4353772e-06 2.8077217e-06
22.5 42.61666 dragojchinci, kjust -4.3909502e-05 -5.6182237e-06 2.2359578e-05
22.745 42.623 elov dol, pk -4.0129884e-05 -6.9482966e-06 1.0687553e-05
25.4 42.6666667 enina, kaz 2.9000988e-05 -9.6334454e-06 4.6429002e-06
24.7166667 41.6333333 ezerovo, parvom 1.3869064e-05 1.3540037e-05 -6.4241684e-07
23.6 43.517 furen, vrach -2.4747932e-05 -4.6880043e-06 -4.7205516e-06
23.9166667 43.3166667 gabare, bslat -1.5501585e-05 -3.8941911e-07 -2.9430475e-06
23.633 42.583 gabra, elpel -3.1030067e-05 -2.8609568e-06 -1.3779467e-05
24.283 43.01 galata, tetev -2.9594292e-06 -7.9688386e-06 -8.7368144e-06
25.5166667 42.9833333 ganchovec, drjan 2.6624667e-05 -1.1821136e-05 -4.2777911e-07
23.81667 41.6 garmen, gd 1.4625183e-05 2.5479009e-05 -2.8532468e-07
26.91 44.117 garvan, sil 3.3132409e-05 -8.3298833e-06 9.7627981e-07
23 41.45 gega, petr -2.4564031e-05 3.466903e-06 -2.1844216e-05
23.81667 43.7 glozhene, orjah -1.865095e-05 -6.5069062e-06 -6.8505924e-06
23.8 42.61666 golema rakovica, elpel -2.391936e-05 -2.1363199e-06 -8.355141e-06
23 42.9333333 golemo malovo, sliven -4.26239e-05 -4.8616152e-06 2.3709059e-05
27.55 42.9166667 golica, varn 2.8341597e-05 -3.6450012e-06 -2.550027e-06
24.4666667 42.9666667 goljama zheljazna, tet 8.8594055e-06 -9.4655728e-06 -5.2048688e-06
26.0333 42.6833 goljamo shivachevo, sl 3.3035712e-05 -1.3629292e-05 -1.9982091e-06
25.13333 42.95 gorna rosica, sevl 2.9690204e-05 -1.0961682e-05 1.8588763e-06
25.433 42.933 gorni varpishta, drjan 1.7513555e-05 -1.6621202e-05 -3.9810946e-06
23.4833333 42.25 govedarci, sam -3.2647071e-05 -1.859107e-06 -8.9780454e-06
22.7519444 44.0288889 gradec, vd -3.2631339e-05 -6.8674335e-06 3.7096913e-06
25.8 41.8833333 huhla, ivgr 1.8302358e-05 2.8558411e-05 4.6901547e-06
24.68333 41.86666 hvojna, asgr 8.8774744e-06 2.4597998e-05 1.2066717e-05
27.4167 42.2167 indzhe vojvoda, mtarn 8.4434487e-06 2.6293803e-05 2.03669e-07
27.017 43.133 ivanski, shum 3.3122882e-05 -6.5076204e-06 5.1179599e-06
25.3166667 42.3 izvorovo, harm 2.5963373e-05 1.0459594e-05 -4.3556861e-06
25.283 41.75 javorovo, asgr 6.4088507e-06 2.3864104e-05 8.4061086e-06
27.2333333 44.083333 kalipetrovo, sil 3.1924196e-05 -7.9297725e-06 4.7122143e-06
24.7333 42.35 kalojanovo, plov 1.4807936e-05 -1.8018866e-05 5.0995022e-06
25.35 43.383 karaisen, pavl 3.301021e-05 -1.3796468e-05 4.0961586e-06
27.2 42.65 karanovo, ajt 3.0267786e-05 -7.3289632e-06 -1.7978374e-06
27.183 43.3 kaspichan, np 3.313479e-05 -4.06286e-06 5.3412777e-06
25.1667 42.3833 kolju marinovo, chirp 2.1402388e-05 -6.603568e-06 -1.1193605e-06
22.844 42.733 konska, brezn -4.5216653e-05 -8.4503687e-06 2.4876942e-05
22.9136111 43.3311111 kopilovci, mont -4.2185285e-05 -6.3047278e-06 2.670255e-05
24.35 42.63334 koprivshtica, pird -1.4295672e-05 -9.0197526e-06 -9.7443473e-06
26 42.55 korten, nzag 2.7577741e-05 -1.3207756e-05 -6.9313106e-08
23.81667 42.26667 kostenec, iht -2.9852773e-05 1.5761757e-07 -1.5763247e-05
23.33333 42.45 kovachevci, sam -3.5968526e-05 -2.2806622e-06 1.1632577e-06
27.5666667 42.8333333 kozichino, pom 2.801762e-05 -3.3732505e-06 -2.2197799e-06
25.083 43.133 kramolin, sevl 3.1342975e-05 -1.4769835e-05 7.1485932e-06
25.017 42.85 kravenik, sevl 1.8192346e-05 -2.125166e-05 -3.0897978e-06
23.7 43.1166667 kreta, vrach -1.6351076e-05 1.6907751e-06 -1.1815046e-05
26.3333333 43.65 krivnja, razgr 3.2763103e-05 -9.6990114e-06 3.065356e-06
23.3 41.483 levunovo, sand -2.7992427e-05 5.2629614e-06 -2.0296287e-05
23.517 43.333 liljache, vr -2.4529403e-05 -6.8350621e-06 -1.1387254e-05
23.75 43.03333 lipnica, botgr -2.7057003e-05 -2.3312706e-06 -9.8598871e-06
25.9666667 42.35 ljubenova mahala, nzag 3.2812509e-05 -1.0650043e-05 1.2180453e-07
22.817 42.5 lobosh, rad -3.5685429e-05 -5.9587717e-06 -8.498253e-07
23.483 42.6 lozen, sof -2.772222e-05 -5.20976e-06 -4.6739965e-06
26.633 42.133 malomirovo, elh 2.0021208e-05 -1.3439551e-05 -8.6546308e-06
23.1833 42.6 marchaevo, sof -3.6517036e-05 -2.2846178e-06 -2.2530126e-08
23.35 41.433 marikostinovo, petr -2.0662521e-05 7.2326471e-06 -2.1182887e-05
27.233 43.2 markovo, shum 3.0383448e-05 -8.180664e-06 3.4052729e-06
25.783 43.05 merdanja, vtarn 3.0661522e-05 -1.4851691e-05 2.0579714e-06
25.5 42.1333333 merichleri, chirp 2.9070892e-05 1.3810144e-05 -9.5478103e-07
25.35 43.2 mihalci, pavl 3.2940269e-05 -1.0639078e-05 5.1377233e-06
22.686 43.888 milchina laka, kul -2.9148867e-05 -8.2216813e-06 1.6657001e-06
24.7833333 41.6666667 momchilovci, smol 5.9816219e-06 3.9460944e-05 8.5162428e-06
24.7 42.5 momina banja, pl 1.4474749e-05 -4.4804047e-06 -5.5275712e-06
23.967 42.217 momina klisura, pz -1.6383258e-05 7.9598083e-06 -1.468731e-05
26.15 41.85 momkovo, svgr 1.9184158e-05 3.2875116e-06 -3.6175574e-06
24.5 41.617 mugla, dev -1.5772717e-06 3.7855282e-05 4.4338562e-06
26.1 43.85 nikolovo\lipnik\, rus 3.3057862e-05 -1.55211e-05 2.449246e-06
25.417 41.833 nikolovo, hask 2.0910443e-05 2.5551976e-05 2.2708035e-06
22.87111 42.67944 noevci, brezn -4.1843797e-05 -1.0379472e-05 1.9964523e-05
23.717 41.417 nova lovcha, gd 1.2762475e-05 2.5140449e-05 -1.1076166e-06
25.7166667 42.0166667 nova nadezhda, hs 3.0286661e-05 2.6326666e-05 5.6887711e-06
25.367 43.067 novoselo, trojan 2.5423545e-05 -1.3211814e-05 -3.0781825e-07
26.817 42.7 ognen, karn 3.0870517e-05 -6.5690904e-06 -2.9705143e-06
26.133 42.45 omarchevo, nzag 3.0149833e-05 -1.2033831e-05 1.4803161e-06
25.7 42.2166667 opan, stzag 3.0586433e-05 2.2809225e-06 -3.7338719e-07
26.3833333 43.55 osenec, razgr 3.3745916e-05 -1.0891296e-05 6.3491737e-06
24.183 42.5 panagjurishte, gd -2.6603504e-06 -6.6080306e-06 -2.8281979e-06
25.48333 43.25 paskalevec, pavl 3.0976678e-05 -1.1381075e-05 2.8492828e-06
24.7 41.8666667 pavelsko, asgr 1.0433848e-05 2.7466091e-05 1.2567123e-05
22.774 42.177 pelatikovo, kjust -3.47982e-05 -1.3455106e-06 -1.0551052e-05
24.4833333 43.3166667 petarnica, plev -1.3498778e-06 -1.5702781e-06 -9.0241089e-06
26.6833333 43.2166667 pevec, targ 3.365181e-05 -4.7200638e-06 2.7613747e-06
25.683 42.967 plakovo, vt 2.5676722e-05 -1.0109107e-05 1.6047366e-06
26.85 42.833 podvis, karn 2.7232305e-05 -4.2477122e-06 -2.6202659e-07
26.717 44.05 pozharevo, tutr 3.3845814e-05 -7.7379386e-06 -2.8567921e-07
22.6 43.717 rabisha, belgr -4.0073001e-05 -7.6917275e-06 2.0110348e-05
23.967 43.167 radovene, vr -1.7176588e-05 -2.4969787e-06 -1.3360907e-05
23.45 43.417 rakevo, vr -2.7508386e-05 -4.4753432e-06 -8.433793e-06
22.47639 43.76611 rakovica, kul -3.0931957e-05 -7.0071581e-06 2.5436514e-06
22.487 42.822 rani lug, tryn -4.4275039e-05 -6.3524387e-06 2.410394e-05
22.957 43.014 razboishte, god -4.1501164e-05 -5.8513907e-06 2.5721274e-05
22.5547222 42.3944444 ruzhinci, belgr -3.1002449e-05 -5.8114216e-06 3.5564595e-06
26.3 43.483 sadina, pop 3.2157589e-05 -9.2981898e-06 4.3422532e-06
23.3 42.3 saparevo, dup -3.504219e-05 -1.4954035e-06 -1.021168e-05
24.95 42.2666667 sekirovo, plov 2.1728316e-05 -1.8705066e-05 1.2711473e-05
23.2333333 41.8166667 senokos, blgr -2.8194471e-05 5.9499837e-07 -1.7701912e-05
23.1833 41.5167 sestrino, petr -2.5346766e-05 4.9349351e-06 -2.1985458e-05
25.3333333 42.7166667 shipka, kaz 2.6330685e-05 -9.7525674e-06 2.1054896e-06
24.583 41.683 shiroka laka, dev 1.3378707e-05 3.9394782e-05 1.0116393e-05
23.5166667 42.4 shiroki dol, sam -3.683653e-05 -8.8922139e-07 -4.2899001e-06
27.5333333 43.3833333 shtipsko, prov 2.8958358e-05 -3.9073263e-06 -1.2681318e-06
26.317 42.483 skobelevo, sliv 3.1810765e-05 -1.7274933e-05 4.4126036e-06
24.867 41.633 slaveino, smol 8.6764293e-06 3.8577557e-05 1.1806195e-05
24.867 43.467 slavjanovo, plev 1.4189467e-05 -1.2742859e-05 -3.6214104e-06
23.1 42.15 smochevo, dupn -2.5776167e-05 5.2211527e-06 -1.0751102e-05
23.95 42.633 smolsko, pird -1.78338e-05 -8.1165068e-06 -1.0662827e-05
24.583 41.65 solishta, dev 1.2797267e-05 3.8718026e-05 1.1413626e-05
25.66667 42.25 sredec, zlgr 1.1617805e-05 2.9954406e-05 7.4846787e-06
22.5669444 43.5461111 stakevci, blgr. -4.2511176e-05 -9.4641503e-06 2.9763447e-05
25.65 41.7666667 stambolovo, hask 2.8901418e-05 2.7746969e-05 5.6122823e-06
25.6833333 43.4833333 starmen, bel 2.6934606e-05 -1.2798967e-05 4.3595972e-06
27.5166667 42.0333333 stoilovo, mt 7.7001575e-06 1.9114032e-05 1.0988863e-06
26.6833333 42.6 straldzha, jamb 3.3019291e-05 -1.1519578e-05 -2.2493803e-06
24.683 42.233 stroevo, plov 1.9137708e-05 -6.8930897e-06 -3.6207468e-06
25.181 43.192 suhindol, vtarn 2.9563028e-05 -1.2044874e-05 3.93494e-06
23.08333 41.83333 sushica, blgr -3.0537973e-05 1.1138813e-06 -1.7474378e-05
26.1833 42.15 svetlina, topgr 3.1319856e-05 -8.0449119e-06 -6.7997679e-07
25.9333333 42.0333333 svirkovo, harm 2.2004739e-05 2.1238303e-05 1.4833139e-06
25.5 41.3 tihomir, krgr 2.2784493e-06 4.179079e-05 7.7853959e-06
25.8666667 42.2666667 tihomirovo, stzag 3.0533724e-05 -1.0945369e-05 -4.8810981e-07
26.433 42.65 topolchane, sliv 2.8253195e-05 -1.1121309e-05 -3.5311905e-06
25 43.4833333 trancovica, nik 2.1129323e-05 -2.036158e-05 3.9436333e-06
24.4666667 43.5166667 trastenik, plev -1.4759758e-05 -1.5087389e-05 -6.1820634e-06
24.7833333 41.5666667 ustovo, sm 5.2630177e-06 3.7713072e-05 1.0169553e-05
24.9 43.65 vabel, nik 2.818125e-05 -1.5594336e-05 6.4295263e-07
24.067 41.6 vaklinovo, gd 9.5931776e-06 2.4768756e-05 -2.3505629e-06
26.017 41.7 valche pole, svgr 1.1501335e-05 1.433596e-05 -2.4717486e-06
26.633339 43 varbica, presl 3.208225e-05 -6.3855228e-06 8.8633601e-07
22.646 43.543 varbovo, blgr -4.2073704e-05 -1.0591675e-05 2.8027113e-05
26.533 42.81667 vardun, targ 3.2424623e-05 -6.2067825e-06 -1.0975212e-06
24.13333 42.15 varvara, paz -2.113783e-05 1.2572241e-06 -1.0678677e-05
24.38333 42.88334 vasiljovo, tetev -1.16641e-05 -8.4509156e-06 -7.4872989e-06
22.94278 42.66611 velkovci, pk -3.9495203e-05 -6.6708512e-06 7.0406055e-06
22.8161111 44.0958333 vinarovo, vid -3.0405091e-05 -6.1512718e-06 3.6490036e-06
23.07 43.483 vinishte, mont -3.1259536e-05 -6.4438706e-06 2.1321277e-06
24.8 43.283 vladinja, lov 2.4591489e-05 -1.4399703e-05 2.2580188e-06
26.9 42.083 voden, elh -1.3768302e-05 1.0644424e-05 -1.8505601e-05
24.75 42.567 vojnjagovo, karl 1.9107946e-05 -1.3689093e-05 -1.5140773e-06
23.75 42.883 vrachesh, botgr -2.6991222e-05 -1.4062868e-06 -9.5981139e-06
25.2166667 42.9166667 vranilovci, gabr 2.5550322e-05 -1.2038891e-05 1.7027982e-06
27.2 42.817 vresovo, ajt 2.9357739e-05 -6.1937515e-06 -1.5203594e-06
24.6 41.783 zabardo, asgr 5.7858122e-06 3.7638967e-05 1.1376614e-05
27.5666667 42.1 zabernovo, mt 6.6855341e-06 2.1446772e-05 -4.184955e-07
23.2425 43.2961111 zamfirovo, berk -3.1902139e-05 -9.8984971e-06 -1.125414e-06
23.2630556 43.1761111 zanozhene, berk -3.0319272e-05 -1.2230417e-06 -9.8192058e-06
25.2333333 42.95 zdravkovec, gabr 2.5980516e-05 -1.1386649e-05 1.4334922e-06
22.5619444 42.8375 zelenigrad, tran -4.5327649e-05 -7.0334648e-06 2.6599843e-05
25.05 41.53333 zhaltusha, ard 3.8484486e-06 3.5322568e-05 1.3295119e-06
22.8 43.88028 zheglica, vid -3.0448675e-05 -5.7737714e-06 4.2648697e-06
23.38333 42.98333 zhelen, svog -2.7844198e-05 -4.1911205e-06 -9.1751886e-06
27.0167 42.15 zheljazkovo, sred -7.5498609e-06 9.1318379e-06 -1.4769748e-05
26.46667 42.83333 zheravna, kot 3.1250045e-05 -6.3045313e-06 -2.2630051e-06
d3 = function() {
var π = Math.PI, ε = 1e-6, d3 = {
version: "3.0.8"
}, d3_radians = π / 180, d3_degrees = 180 / π, d3_document = document, d3_window = window;
function d3_target(d) {
return d.target;
}
function d3_source(d) {
return d.source;
}
var d3_format_decimalPoint = ".", d3_format_thousandsSeparator = ",", d3_format_grouping = [ 3, 3 ];
if (!Date.now) Date.now = function() {
return +new Date();
};
try {
d3_document.createElement("div").style.setProperty("opacity", 0, "");
} catch (error) {
var d3_style_prototype = d3_window.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;
d3_style_prototype.setProperty = function(name, value, priority) {
d3_style_setProperty.call(this, name, value + "", priority);
};
}
function d3_class(ctor, properties) {
try {
for (var key in properties) {
Object.defineProperty(ctor.prototype, key, {
value: properties[key],
enumerable: false
});
}
} catch (e) {
ctor.prototype = properties;
}
}
var d3_array = d3_arraySlice;
function d3_arrayCopy(pseudoarray) {
var i = -1, n = pseudoarray.length, array = [];
while (++i < n) array.push(pseudoarray[i]);
return array;
}
function d3_arraySlice(pseudoarray) {
return Array.prototype.slice.call(pseudoarray);
}
try {
d3_array(d3_document.documentElement.childNodes)[0].nodeType;
} catch (e) {
d3_array = d3_arrayCopy;
}
var d3_arraySubclass = [].__proto__ ? function(array, prototype) {
array.__proto__ = prototype;
} : function(array, prototype) {
for (var property in prototype) array[property] = prototype[property];
};
d3.map = function(object) {
var map = new d3_Map();
for (var key in object) map.set(key, object[key]);
return map;
};
function d3_Map() {}
d3_class(d3_Map, {
has: function(key) {
return d3_map_prefix + key in this;
},
get: function(key) {
return this[d3_map_prefix + key];
},
set: function(key, value) {
return this[d3_map_prefix + key] = value;
},
remove: function(key) {
key = d3_map_prefix + key;
return key in this && delete this[key];
},
keys: function() {
var keys = [];
this.forEach(function(key) {
keys.push(key);
});
return keys;
},
values: function() {
var values = [];
this.forEach(function(key, value) {
values.push(value);
});
return values;
},
entries: function() {
var entries = [];
this.forEach(function(key, value) {
entries.push({
key: key,
value: value
});
});
return entries;
},
forEach: function(f) {
for (var key in this) {
if (key.charCodeAt(0) === d3_map_prefixCode) {
f.call(this, key.substring(1), this[key]);
}
}
}
});
var d3_map_prefix = "\0", d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
function d3_identity(d) {
return d;
}
function d3_true() {
return true;
}
function d3_functor(v) {
return typeof v === "function" ? v : function() {
return v;
};
}
d3.functor = d3_functor;
d3.rebind = function(target, source) {
var i = 1, n = arguments.length, method;
while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
return target;
};
function d3_rebind(target, source, method) {
return function() {
var value = method.apply(source, arguments);
return value === source ? target : value;
};
}
d3.ascending = function(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
};
d3.descending = function(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
};
d3.mean = function(array, f) {
var n = array.length, a, m = 0, i = -1, j = 0;
if (arguments.length === 1) {
while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
} else {
while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
}
return j ? m : undefined;
};
d3.median = function(array, f) {
if (arguments.length > 1) array = array.map(f);
array = array.filter(d3_number);
return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
};
d3.min = function(array, f) {
var i = -1, n = array.length, a, b;
if (arguments.length === 1) {
while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
while (++i < n) if ((b = array[i]) != null && a > b) a = b;
} else {
while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
}
return a;
};
d3.max = function(array, f) {
var i = -1, n = array.length, a, b;
if (arguments.length === 1) {
while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
while (++i < n) if ((b = array[i]) != null && b > a) a = b;
} else {
while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
}
return a;
};
d3.extent = function(array, f) {
var i = -1, n = array.length, a, b, c;
if (arguments.length === 1) {
while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
while (++i < n) if ((b = array[i]) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
} else {
while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
}
return [ a, c ];
};
d3.random = {
normal: function(µ, σ) {
var n = arguments.length;
if (n < 2) σ = 1;
if (n < 1) µ = 0;
return function() {
var x, y, r;
do {
x = Math.random() * 2 - 1;
y = Math.random() * 2 - 1;
r = x * x + y * y;
} while (!r || r > 1);
return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);
};
},
logNormal: function() {
var random = d3.random.normal.apply(d3, arguments);
return function() {
return Math.exp(random());
};
},
irwinHall: function(m) {
return function() {
for (var s = 0, j = 0; j < m; j++) s += Math.random();
return s / m;
};
}
};
function d3_number(x) {
return x != null && !isNaN(x);
}
d3.sum = function(array, f) {
var s = 0, n = array.length, a, i = -1;
if (arguments.length === 1) {
while (++i < n) if (!isNaN(a = +array[i])) s += a;
} else {
while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
}
return s;
};
d3.quantile = function(values, p) {
var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h;
return e ? v + e * (values[h] - v) : v;
};
d3.shuffle = function(array) {
var m = array.length, t, i;
while (m) {
i = Math.random() * m-- | 0;
t = array[m], array[m] = array[i], array[i] = t;
}
return array;
};
d3.transpose = function(matrix) {
return d3.zip.apply(d3, matrix);
};
d3.zip = function() {
if (!(n = arguments.length)) return [];
for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) {
for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) {
zip[j] = arguments[j][i];
}
}
return zips;
};
function d3_zipLength(d) {
return d.length;
}
d3.bisector = function(f) {
return {
left: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid;
}
return lo;
},
right: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1;
}
return lo;
}
};
};
var d3_bisector = d3.bisector(function(d) {
return d;
});
d3.bisectLeft = d3_bisector.left;
d3.bisect = d3.bisectRight = d3_bisector.right;
d3.nest = function() {
var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
function map(array, depth) {
if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
var i = -1, n = array.length, key = keys[depth++], keyValue, object, valuesByKey = new d3_Map(), values, o = {};
while (++i < n) {
if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
values.push(object);
} else {
valuesByKey.set(keyValue, [ object ]);
}
}
valuesByKey.forEach(function(keyValue, values) {
o[keyValue] = map(values, depth);
});
return o;
}
function entries(map, depth) {
if (depth >= keys.length) return map;
var a = [], sortKey = sortKeys[depth++], key;
for (key in map) {
a.push({
key: key,
values: entries(map[key], depth)
});
}
if (sortKey) a.sort(function(a, b) {
return sortKey(a.key, b.key);
});
return a;
}
nest.map = function(array) {
return map(array, 0);
};
nest.entries = function(array) {
return entries(map(array, 0), 0);
};
nest.key = function(d) {
keys.push(d);
return nest;
};
nest.sortKeys = function(order) {
sortKeys[keys.length - 1] = order;
return nest;
};
nest.sortValues = function(order) {
sortValues = order;
return nest;
};
nest.rollup = function(f) {
rollup = f;
return nest;
};
return nest;
};
d3.keys = function(map) {
var keys = [];
for (var key in map) keys.push(key);
return keys;
};
d3.values = function(map) {
var values = [];
for (var key in map) values.push(map[key]);
return values;
};
d3.entries = function(map) {
var entries = [];
for (var key in map) entries.push({
key: key,
value: map[key]
});
return entries;
};
d3.permute = function(array, indexes) {
var permutes = [], i = -1, n = indexes.length;
while (++i < n) permutes[i] = array[indexes[i]];
return permutes;
};
d3.merge = function(arrays) {
return Array.prototype.concat.apply([], arrays);
};
function d3_collapse(s) {
return s.trim().replace(/\s+/g, " ");
}
d3.range = function(start, stop, step) {
if (arguments.length < 3) {
step = 1;
if (arguments.length < 2) {
stop = start;
start = 0;
}
}
if ((stop - start) / step === Infinity) throw new Error("infinite range");
var range = [], k = d3_range_integerScale(Math.abs(step)), i = -1, j;
start *= k, stop *= k, step *= k;
if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k);
return range;
};
function d3_range_integerScale(x) {
var k = 1;
while (x * k % 1) k *= 10;
return k;
}
d3.requote = function(s) {
return s.replace(d3_requote_re, "\\$&");
};
var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
d3.round = function(x, n) {
return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);
};
d3.xhr = function(url, mimeType, callback) {
var xhr = {}, dispatch = d3.dispatch("progress", "load", "error"), headers = {}, response = d3_identity, request = new (d3_window.XDomainRequest && /^(http(s)?:)?\/\//.test(url) ? XDomainRequest : XMLHttpRequest)();
"onload" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() {
request.readyState > 3 && respond();
};
function respond() {
var s = request.status;
!s && request.responseText || s >= 200 && s < 300 || s === 304 ? dispatch.load.call(xhr, response.call(xhr, request)) : dispatch.error.call(xhr, request);
}
request.onprogress = function(event) {
var o = d3.event;
d3.event = event;
try {
dispatch.progress.call(xhr, request);
} finally {
d3.event = o;
}
};
xhr.header = function(name, value) {
name = (name + "").toLowerCase();
if (arguments.length < 2) return headers[name];
if (value == null) delete headers[name]; else headers[name] = value + "";
return xhr;
};
xhr.mimeType = function(value) {
if (!arguments.length) return mimeType;
mimeType = value == null ? null : value + "";
return xhr;
};
xhr.response = function(value) {
response = value;
return xhr;
};
[ "get", "post" ].forEach(function(method) {
xhr[method] = function() {
return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments)));
};
});
xhr.send = function(method, data, callback) {
if (arguments.length === 2 && typeof data === "function") callback = data, data = null;
request.open(method, url, true);
if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*";
if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]);
if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType);
if (callback != null) xhr.on("error", callback).on("load", function(request) {
callback(null, request);
});
request.send(data == null ? null : data);
return xhr;
};
xhr.abort = function() {
request.abort();
return xhr;
};
d3.rebind(xhr, dispatch, "on");
if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType,
mimeType = null;
return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback));
};
function d3_xhr_fixCallback(callback) {
return callback.length === 1 ? function(error, request) {
callback(error == null ? request : null);
} : callback;
}
d3.text = function() {
return d3.xhr.apply(d3, arguments).response(d3_text);
};
function d3_text(request) {
return request.responseText;
}
d3.json = function(url, callback) {
return d3.xhr(url, "application/json", callback).response(d3_json);
};
function d3_json(request) {
return JSON.parse(request.responseText);
}
d3.html = function(url, callback) {
return d3.xhr(url, "text/html", callback).response(d3_html);
};
function d3_html(request) {
var range = d3_document.createRange();
range.selectNode(d3_document.body);
return range.createContextualFragment(request.responseText);
}
d3.xml = function() {
return d3.xhr.apply(d3, arguments).response(d3_xml);
};
function d3_xml(request) {
return request.responseXML;
}
var d3_nsPrefix = {
svg: "http://www.w3.org/2000/svg",
xhtml: "http://www.w3.org/1999/xhtml",
xlink: "http://www.w3.org/1999/xlink",
xml: "http://www.w3.org/XML/1998/namespace",
xmlns: "http://www.w3.org/2000/xmlns/"
};
d3.ns = {
prefix: d3_nsPrefix,
qualify: function(name) {
var i = name.indexOf(":"), prefix = name;
if (i >= 0) {
prefix = name.substring(0, i);
name = name.substring(i + 1);
}
return d3_nsPrefix.hasOwnProperty(prefix) ? {
space: d3_nsPrefix[prefix],
local: name
} : name;
}
};
d3.dispatch = function() {
var dispatch = new d3_dispatch(), i = -1, n = arguments.length;
while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
return dispatch;
};
function d3_dispatch() {}
d3_dispatch.prototype.on = function(type, listener) {
var i = type.indexOf("."), name = "";
if (i > 0) {
name = type.substring(i + 1);
type = type.substring(0, i);
}
return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);
};
function d3_dispatch_event(dispatch) {
var listeners = [], listenerByName = new d3_Map();
function event() {
var z = listeners, i = -1, n = z.length, l;
while (++i < n) if (l = z[i].on) l.apply(this, arguments);
return dispatch;
}
event.on = function(name, listener) {
var l = listenerByName.get(name), i;
if (arguments.length < 2) return l && l.on;
if (l) {
l.on = null;
listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
listenerByName.remove(name);
}
if (listener) listeners.push(listenerByName.set(name, {
on: listener
}));
return dispatch;
};
return event;
}
d3.format = function(specifier) {
var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "", basePrefix = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false;
if (precision) precision = +precision.substring(1);
if (zfill || fill === "0" && align === "=") {
zfill = fill = "0";
align = "=";
if (comma) width -= Math.floor((width - 1) / 4);
}
switch (type) {
case "n":
comma = true;
type = "g";
break;
case "%":
scale = 100;
suffix = "%";
type = "f";
break;
case "p":
scale = 100;
suffix = "%";
type = "r";
break;
case "b":
case "o":
case "x":
case "X":
if (basePrefix) basePrefix = "0" + type.toLowerCase();
case "c":
case "d":
integer = true;
precision = 0;
break;
case "s":
scale = -1;
type = "r";
break;
}
if (basePrefix === "#") basePrefix = "";
if (type == "r" && !precision) type = "g";
type = d3_format_types.get(type) || d3_format_typeDefault;
var zcomma = zfill && comma;
return function(value) {
if (integer && value % 1) return "";
var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign;
if (scale < 0) {
var prefix = d3.formatPrefix(value, precision);
value = prefix.scale(value);
suffix = prefix.symbol;
} else {
value *= scale;
}
value = type(value, precision);
if (!zfill && comma) value = d3_format_group(value);
var length = basePrefix.length + value.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : "";
if (zcomma) value = d3_format_group(padding + value);
if (d3_format_decimalPoint) value.replace(".", d3_format_decimalPoint);
negative += basePrefix;
return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + suffix;
};
};
var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;
var d3_format_types = d3.map({
b: function(x) {
return x.toString(2);
},
c: function(x) {
return String.fromCharCode(x);
},
o: function(x) {
return x.toString(8);
},
x: function(x) {
return x.toString(16);
},
X: function(x) {
return x.toString(16).toUpperCase();
},
g: function(x, p) {
return x.toPrecision(p);
},
e: function(x, p) {
return x.toExponential(p);
},
f: function(x, p) {
return x.toFixed(p);
},
r: function(x, p) {
return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p))));
}
});
function d3_format_precision(x, p) {
return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1);
}
function d3_format_typeDefault(x) {
return x + "";
}
var d3_format_group = d3_identity;
if (d3_format_grouping) {
var d3_format_groupingLength = d3_format_grouping.length;
d3_format_group = function(value) {
var i = value.lastIndexOf("."), f = i >= 0 ? "." + value.substring(i + 1) : (i = value.length,
""), t = [], j = 0, g = d3_format_grouping[0];
while (i > 0 && g > 0) {
t.push(value.substring(i -= g, i + g));
g = d3_format_grouping[j = (j + 1) % d3_format_groupingLength];
}
return t.reverse().join(d3_format_thousandsSeparator || "") + f;
};
}
var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
d3.formatPrefix = function(value, precision) {
var i = 0;
if (value) {
if (value < 0) value *= -1;
if (precision) value = d3.round(value, d3_format_precision(value, precision));
i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
}
return d3_formatPrefixes[8 + i / 3];
};
function d3_formatPrefix(d, i) {
var k = Math.pow(10, Math.abs(8 - i) * 3);
return {
scale: i > 8 ? function(d) {
return d / k;
} : function(d) {
return d * k;
},
symbol: d
};
}
var d3_ease_default = function() {
return d3_identity;
};
var d3_ease = d3.map({
linear: d3_ease_default,
poly: d3_ease_poly,
quad: function() {
return d3_ease_quad;
},
cubic: function() {
return d3_ease_cubic;
},
sin: function() {
return d3_ease_sin;
},
exp: function() {
return d3_ease_exp;
},
circle: function() {
return d3_ease_circle;
},
elastic: d3_ease_elastic,
back: d3_ease_back,
bounce: function() {
return d3_ease_bounce;
}
});
var d3_ease_mode = d3.map({
"in": d3_identity,
out: d3_ease_reverse,
"in-out": d3_ease_reflect,
"out-in": function(f) {
return d3_ease_reflect(d3_ease_reverse(f));
}
});
d3.ease = function(name) {
var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in";
t = d3_ease.get(t) || d3_ease_default;
m = d3_ease_mode.get(m) || d3_identity;
return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1))));
};
function d3_ease_clamp(f) {
return function(t) {
return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
};
}
function d3_ease_reverse(f) {
return function(t) {
return 1 - f(1 - t);
};
}
function d3_ease_reflect(f) {
return function(t) {
return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t));
};
}
function d3_ease_quad(t) {
return t * t;
}
function d3_ease_cubic(t) {
return t * t * t;
}
function d3_ease_cubicInOut(t) {
if (t <= 0) return 0;
if (t >= 1) return 1;
var t2 = t * t, t3 = t2 * t;
return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75);
}
function d3_ease_poly(e) {
return function(t) {
return Math.pow(t, e);
};
}
function d3_ease_sin(t) {
return 1 - Math.cos(t * π / 2);
}
function d3_ease_exp(t) {
return Math.pow(2, 10 * (t - 1));
}
function d3_ease_circle(t) {
return 1 - Math.sqrt(1 - t * t);
}
function d3_ease_elastic(a, p) {
var s;
if (arguments.length < 2) p = .45;
if (arguments.length) s = p / (2 * π) * Math.asin(1 / a); else a = 1, s = p / 4;
return function(t) {
return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * π / p);
};
}
function d3_ease_back(s) {
if (!s) s = 1.70158;
return function(t) {
return t * t * ((s + 1) * t - s);
};
}
function d3_ease_bounce(t) {
return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
}
d3.event = null;
function d3_eventCancel() {
d3.event.stopPropagation();
d3.event.preventDefault();
}
function d3_eventSource() {
var e = d3.event, s;
while (s = e.sourceEvent) e = s;
return e;
}
function d3_eventDispatch(target) {
var dispatch = new d3_dispatch(), i = 0, n = arguments.length;
while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
dispatch.of = function(thiz, argumentz) {
return function(e1) {
try {
var e0 = e1.sourceEvent = d3.event;
e1.target = target;
d3.event = e1;
dispatch[e1.type].apply(thiz, argumentz);
} finally {
d3.event = e0;
}
};
};
return dispatch;
}
d3.transform = function(string) {
var g = d3_document.createElementNS(d3.ns.prefix.svg, "g");
return (d3.transform = function(string) {
g.setAttribute("transform", string);
var t = g.transform.baseVal.consolidate();
return new d3_transform(t ? t.matrix : d3_transformIdentity);
})(string);
};
function d3_transform(m) {
var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
if (r0[0] * r1[1] < r1[0] * r0[1]) {
r0[0] *= -1;
r0[1] *= -1;
kx *= -1;
kz *= -1;
}
this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees;
this.translate = [ m.e, m.f ];
this.scale = [ kx, ky ];
this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0;
}
d3_transform.prototype.toString = function() {
return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
};
function d3_transformDot(a, b) {
return a[0] * b[0] + a[1] * b[1];
}
function d3_transformNormalize(a) {
var k = Math.sqrt(d3_transformDot(a, a));
if (k) {
a[0] /= k;
a[1] /= k;
}
return k;
}
function d3_transformCombine(a, b, k) {
a[0] += k * b[0];
a[1] += k * b[1];
return a;
}
var d3_transformIdentity = {
a: 1,
b: 0,
c: 0,
d: 1,
e: 0,
f: 0
};
d3.interpolate = function(a, b) {
var i = d3.interpolators.length, f;
while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;
return f;
};
d3.interpolateNumber = function(a, b) {
b -= a;
return function(t) {
return a + b * t;
};
};
d3.interpolateRound = function(a, b) {
b -= a;
return function(t) {
return Math.round(a + b * t);
};
};
d3.interpolateString = function(a, b) {
var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o;
d3_interpolate_number.lastIndex = 0;
for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
if (m.index) s.push(b.substring(s0, s1 = m.index));
q.push({
i: s.length,
x: m[0]
});
s.push(null);
s0 = d3_interpolate_number.lastIndex;
}
if (s0 < b.length) s.push(b.substring(s0));
for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
o = q[i];
if (o.x == m[0]) {
if (o.i) {
if (s[o.i + 1] == null) {
s[o.i - 1] += o.x;
s.splice(o.i, 1);
for (j = i + 1; j < n; ++j) q[j].i--;
} else {
s[o.i - 1] += o.x + s[o.i + 1];
s.splice(o.i, 2);
for (j = i + 1; j < n; ++j) q[j].i -= 2;
}
} else {
if (s[o.i + 1] == null) {
s[o.i] = o.x;
} else {
s[o.i] = o.x + s[o.i + 1];
s.splice(o.i + 1, 1);
for (j = i + 1; j < n; ++j) q[j].i--;
}
}
q.splice(i, 1);
n--;
i--;
} else {
o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
}
}
while (i < n) {
o = q.pop();
if (s[o.i + 1] == null) {
s[o.i] = o.x;
} else {
s[o.i] = o.x + s[o.i + 1];
s.splice(o.i + 1, 1);
}
n--;
}
if (s.length === 1) {
return s[0] == null ? q[0].x : function() {
return b;
};
}
return function(t) {
for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
return s.join("");
};
};
d3.interpolateTransform = function(a, b) {
var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale;
if (ta[0] != tb[0] || ta[1] != tb[1]) {
s.push("translate(", null, ",", null, ")");
q.push({
i: 1,
x: d3.interpolateNumber(ta[0], tb[0])
}, {
i: 3,
x: d3.interpolateNumber(ta[1], tb[1])
});
} else if (tb[0] || tb[1]) {
s.push("translate(" + tb + ")");
} else {
s.push("");
}
if (ra != rb) {
if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
q.push({
i: s.push(s.pop() + "rotate(", null, ")") - 2,
x: d3.interpolateNumber(ra, rb)
});
} else if (rb) {
s.push(s.pop() + "rotate(" + rb + ")");
}
if (wa != wb) {
q.push({
i: s.push(s.pop() + "skewX(", null, ")") - 2,
x: d3.interpolateNumber(wa, wb)
});
} else if (wb) {
s.push(s.pop() + "skewX(" + wb + ")");
}
if (ka[0] != kb[0] || ka[1] != kb[1]) {
n = s.push(s.pop() + "scale(", null, ",", null, ")");
q.push({
i: n - 4,
x: d3.interpolateNumber(ka[0], kb[0])
}, {
i: n - 2,
x: d3.interpolateNumber(ka[1], kb[1])
});
} else if (kb[0] != 1 || kb[1] != 1) {
s.push(s.pop() + "scale(" + kb + ")");
}
n = q.length;
return function(t) {
var i = -1, o;
while (++i < n) s[(o = q[i]).i] = o.x(t);
return s.join("");
};
};
d3.interpolateRgb = function(a, b) {
a = d3.rgb(a);
b = d3.rgb(b);
var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;
return function(t) {
return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));
};
};
d3.interpolateHsl = function(a, b) {
a = d3.hsl(a);
b = d3.hsl(b);
var h0 = a.h, s0 = a.s, l0 = a.l, h1 = b.h - h0, s1 = b.s - s0, l1 = b.l - l0;
if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360;
return function(t) {
return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t) + "";
};
};
d3.interpolateLab = function(a, b) {
a = d3.lab(a);
b = d3.lab(b);
var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;
return function(t) {
return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
};
};
d3.interpolateHcl = function(a, b) {
a = d3.hcl(a);
b = d3.hcl(b);
var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;
if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
return function(t) {
return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";
};
};
d3.interpolateArray = function(a, b) {
var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;
for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));
for (;i < na; ++i) c[i] = a[i];
for (;i < nb; ++i) c[i] = b[i];
return function(t) {
for (i = 0; i < n0; ++i) c[i] = x[i](t);
return c;
};
};
d3.interpolateObject = function(a, b) {
var i = {}, c = {}, k;
for (k in a) {
if (k in b) {
i[k] = d3_interpolateByName(k)(a[k], b[k]);
} else {
c[k] = a[k];
}
}
for (k in b) {
if (!(k in a)) {
c[k] = b[k];
}
}
return function(t) {
for (k in i) c[k] = i[k](t);
return c;
};
};
var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
function d3_interpolateByName(name) {
return name == "transform" ? d3.interpolateTransform : d3.interpolate;
}
d3.interpolators = [ d3.interpolateObject, function(a, b) {
return b instanceof Array && d3.interpolateArray(a, b);
}, function(a, b) {
return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + "");
}, function(a, b) {
return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Color) && d3.interpolateRgb(a, b);
}, function(a, b) {
return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b);
} ];
function d3_uninterpolateNumber(a, b) {
b = b - (a = +a) ? 1 / (b - a) : 0;
return function(x) {
return (x - a) * b;
};
}
function d3_uninterpolateClamp(a, b) {
b = b - (a = +a) ? 1 / (b - a) : 0;
return function(x) {
return Math.max(0, Math.min(1, (x - a) * b));
};
}
function d3_Color() {}
d3_Color.prototype.toString = function() {
return this.rgb() + "";
};
d3.rgb = function(r, g, b) {
return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b);
};
function d3_rgb(r, g, b) {
return new d3_Rgb(r, g, b);
}
function d3_Rgb(r, g, b) {
this.r = r;
this.g = g;
this.b = b;
}
var d3_rgbPrototype = d3_Rgb.prototype = new d3_Color();
d3_rgbPrototype.brighter = function(k) {
k = Math.pow(.7, arguments.length ? k : 1);
var r = this.r, g = this.g, b = this.b, i = 30;
if (!r && !g && !b) return d3_rgb(i, i, i);
if (r && r < i) r = i;
if (g && g < i) g = i;
if (b && b < i) b = i;
return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k)));
};
d3_rgbPrototype.darker = function(k) {
k = Math.pow(.7, arguments.length ? k : 1);
return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b));
};
d3_rgbPrototype.hsl = function() {
return d3_rgb_hsl(this.r, this.g, this.b);
};
d3_rgbPrototype.toString = function() {
return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
};
function d3_rgb_hex(v) {
return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);
}
function d3_rgb_parse(format, rgb, hsl) {
var r = 0, g = 0, b = 0, m1, m2, name;
m1 = /([a-z]+)\((.*)\)/i.exec(format);
if (m1) {
m2 = m1[2].split(",");
switch (m1[1]) {
case "hsl":
{
return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);
}
case "rgb":
{
return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));
}
}
}
if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);
if (format != null && format.charAt(0) === "#") {
if (format.length === 4) {
r = format.charAt(1);
r += r;
g = format.charAt(2);
g += g;
b = format.charAt(3);
b += b;
} else if (format.length === 7) {
r = format.substring(1, 3);
g = format.substring(3, 5);
b = format.substring(5, 7);
}
r = parseInt(r, 16);
g = parseInt(g, 16);
b = parseInt(b, 16);
}
return rgb(r, g, b);
}
function d3_rgb_hsl(r, g, b) {
var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2;
if (d) {
s = l < .5 ? d / (max + min) : d / (2 - max - min);
if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4;
h *= 60;
} else {
s = h = 0;
}
return d3_hsl(h, s, l);
}
function d3_rgb_lab(r, g, b) {
r = d3_rgb_xyz(r);
g = d3_rgb_xyz(g);
b = d3_rgb_xyz(b);
var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z);
return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
}
function d3_rgb_xyz(r) {
return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4);
}
function d3_rgb_parseNumber(c) {
var f = parseFloat(c);
return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
}
var d3_rgb_names = d3.map({
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aqua: "#00ffff",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
black: "#000000",
blanchedalmond: "#ffebcd",
blue: "#0000ff",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyan: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkgrey: "#a9a9a9",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkslategrey: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dimgrey: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
fuchsia: "#ff00ff",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
gold: "#ffd700",
goldenrod: "#daa520",
gray: "#808080",
green: "#008000",
greenyellow: "#adff2f",
grey: "#808080",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
indianred: "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavender: "#e6e6fa",
lavenderblush: "#fff0f5",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgray: "#d3d3d3",
lightgreen: "#90ee90",
lightgrey: "#d3d3d3",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightslategrey: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
lime: "#00ff00",
limegreen: "#32cd32",
linen: "#faf0e6",
magenta: "#ff00ff",
maroon: "#800000",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370db",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
navy: "#000080",
oldlace: "#fdf5e6",
olive: "#808000",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#db7093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
purple: "#800080",
red: "#ff0000",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
silver: "#c0c0c0",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
slategrey: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
steelblue: "#4682b4",
tan: "#d2b48c",
teal: "#008080",
thistle: "#d8bfd8",
tomato: "#ff6347",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
white: "#ffffff",
whitesmoke: "#f5f5f5",
yellow: "#ffff00",
yellowgreen: "#9acd32"
});
d3_rgb_names.forEach(function(key, value) {
d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));
});
d3.hsl = function(h, s, l) {
return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l);
};
function d3_hsl(h, s, l) {
return new d3_Hsl(h, s, l);
}
function d3_Hsl(h, s, l) {
this.h = h;
this.s = s;
this.l = l;
}
var d3_hslPrototype = d3_Hsl.prototype = new d3_Color();
d3_hslPrototype.brighter = function(k) {
k = Math.pow(.7, arguments.length ? k : 1);
return d3_hsl(this.h, this.s, this.l / k);
};
d3_hslPrototype.darker = function(k) {
k = Math.pow(.7, arguments.length ? k : 1);
return d3_hsl(this.h, this.s, k * this.l);
};
d3_hslPrototype.rgb = function() {
return d3_hsl_rgb(this.h, this.s, this.l);
};
function d3_hsl_rgb(h, s, l) {
var m1, m2;
h = h % 360;
if (h < 0) h += 360;
s = s < 0 ? 0 : s > 1 ? 1 : s;
l = l < 0 ? 0 : l > 1 ? 1 : l;
m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
m1 = 2 * l - m2;
function v(h) {
if (h > 360) h -= 360; else if (h < 0) h += 360;
if (h < 60) return m1 + (m2 - m1) * h / 60;
if (h < 180) return m2;
if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
return m1;
}
function vv(h) {
return Math.round(v(h) * 255);
}
return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
}
d3.hcl = function(h, c, l) {
return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l);
};
function d3_hcl(h, c, l) {
return new d3_Hcl(h, c, l);
}
function d3_Hcl(h, c, l) {
this.h = h;
this.c = c;
this.l = l;
}
var d3_hclPrototype = d3_Hcl.prototype = new d3_Color();
d3_hclPrototype.brighter = function(k) {
return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));
};
d3_hclPrototype.darker = function(k) {
return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));
};
d3_hclPrototype.rgb = function() {
return d3_hcl_lab(this.h, this.c, this.l).rgb();
};
function d3_hcl_lab(h, c, l) {
return d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c);
}
d3.lab = function(l, a, b) {
return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b);
};
function d3_lab(l, a, b) {
return new d3_Lab(l, a, b);
}
function d3_Lab(l, a, b) {
this.l = l;
this.a = a;
this.b = b;
}
var d3_lab_K = 18;
var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;
var d3_labPrototype = d3_Lab.prototype = new d3_Color();
d3_labPrototype.brighter = function(k) {
return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
};
d3_labPrototype.darker = function(k) {
return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
};
d3_labPrototype.rgb = function() {
return d3_lab_rgb(this.l, this.a, this.b);
};
function d3_lab_rgb(l, a, b) {
var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
x = d3_lab_xyz(x) * d3_lab_X;
y = d3_lab_xyz(y) * d3_lab_Y;
z = d3_lab_xyz(z) * d3_lab_Z;
return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z));
}
function d3_lab_hcl(l, a, b) {
return d3_hcl(Math.atan2(b, a) / π * 180, Math.sqrt(a * a + b * b), l);
}
function d3_lab_xyz(x) {
return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
}
function d3_xyz_lab(x) {
return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
}
function d3_xyz_rgb(r) {
return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055));
}
function d3_selection(groups) {
d3_arraySubclass(groups, d3_selectionPrototype);
return groups;
}
var d3_select = function(s, n) {
return n.querySelector(s);
}, d3_selectAll = function(s, n) {
return n.querySelectorAll(s);
}, d3_selectRoot = d3_document.documentElement, d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) {
return d3_selectMatcher.call(n, s);
};
if (typeof Sizzle === "function") {
d3_select = function(s, n) {
return Sizzle(s, n)[0] || null;
};
d3_selectAll = function(s, n) {
return Sizzle.uniqueSort(Sizzle(s, n));
};
d3_selectMatches = Sizzle.matchesSelector;
}
var d3_selectionPrototype = [];
d3.selection = function() {
return d3_selectionRoot;
};
d3.selection.prototype = d3_selectionPrototype;
d3_selectionPrototype.select = function(selector) {
var subgroups = [], subgroup, subnode, group, node;
if (typeof selector !== "function") selector = d3_selection_selector(selector);
for (var j = -1, m = this.length; ++j < m; ) {
subgroups.push(subgroup = []);
subgroup.parentNode = (group = this[j]).parentNode;
for (var i = -1, n = group.length; ++i < n; ) {
if (node = group[i]) {
subgroup.push(subnode = selector.call(node, node.__data__, i));
if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
} else {
subgroup.push(null);
}
}
}
return d3_selection(subgroups);
};
function d3_selection_selector(selector) {
return function() {
return d3_select(selector, this);
};
}
d3_selectionPrototype.selectAll = function(selector) {
var subgroups = [], subgroup, node;
if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
for (var j = -1, m = this.length; ++j < m; ) {
for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
if (node = group[i]) {
subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));
subgroup.parentNode = node;
}
}
}
return d3_selection(subgroups);
};
function d3_selection_selectorAll(selector) {
return function() {
return d3_selectAll(selector, this);
};
}
d3_selectionPrototype.attr = function(name, value) {
if (arguments.length < 2) {
if (typeof name === "string") {
var node = this.node();
name = d3.ns.qualify(name);
return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name);
}
for (value in name) this.each(d3_selection_attr(value, name[value]));
return this;
}
return this.each(d3_selection_attr(name, value));
};
function d3_selection_attr(name, value) {
name = d3.ns.qualify(name);
function attrNull() {
this.removeAttribute(name);
}
function attrNullNS() {
this.removeAttributeNS(name.space, name.local);
}
function attrConstant() {
this.setAttribute(name, value);
}
function attrConstantNS() {
this.setAttributeNS(name.space, name.local, value);
}
function attrFunction() {
var x = value.apply(this, arguments);
if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);
}
function attrFunctionNS() {
var x = value.apply(this, arguments);
if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);
}
return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;
}
d3_selectionPrototype.classed = function(name, value) {
if (arguments.length < 2) {
if (typeof name === "string") {
var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1;
if (value = node.classList) {
while (++i < n) if (!value.contains(name[i])) return false;
} else {
value = node.className;
if (value.baseVal != null) value = value.baseVal;
while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false;
}
return true;
}
for (value in name) this.each(d3_selection_classed(value, name[value]));
return this;
}
return this.each(d3_selection_classed(name, value));
};
function d3_selection_classedRe(name) {
return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g");
}
function d3_selection_classed(name, value) {
name = name.trim().split(/\s+/).map(d3_selection_classedName);
var n = name.length;
function classedConstant() {
var i = -1;
while (++i < n) name[i](this, value);
}
function classedFunction() {
var i = -1, x = value.apply(this, arguments);
while (++i < n) name[i](this, x);
}
return typeof value === "function" ? classedFunction : classedConstant;
}
function d3_selection_classedName(name) {
var re = d3_selection_classedRe(name);
return function(node, value) {
if (c = node.classList) return value ? c.add(name) : c.remove(name);
var c = node.className, cb = c.baseVal != null, cv = cb ? c.baseVal : c;
if (value) {
re.lastIndex = 0;
if (!re.test(cv)) {
cv = d3_collapse(cv + " " + name);
if (cb) c.baseVal = cv; else node.className = cv;
}
} else if (cv) {
cv = d3_collapse(cv.replace(re, " "));
if (cb) c.baseVal = cv; else node.className = cv;
}
};
}
d3_selectionPrototype.style = function(name, value, priority) {
var n = arguments.length;
if (n < 3) {
if (typeof name !== "string") {
if (n < 2) value = "";
for (priority in name) this.each(d3_selection_style(priority, name[priority], value));
return this;
}
if (n < 2) return d3_window.getComputedStyle(this.node(), null).getPropertyValue(name);
priority = "";
}
return this.each(d3_selection_style(name, value, priority));
};
function d3_selection_style(name, value, priority) {
function styleNull() {
this.style.removeProperty(name);
}
function styleConstant() {
this.style.setProperty(name, value, priority);
}
function styleFunction() {
var x = value.apply(this, arguments);
if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority);
}
return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant;
}
d3_selectionPrototype.property = function(name, value) {
if (arguments.length < 2) {
if (typeof name === "string") return this.node()[name];
for (value in name) this.each(d3_selection_property(value, name[value]));
return this;
}
return this.each(d3_selection_property(name, value));
};
function d3_selection_property(name, value) {
function propertyNull() {
delete this[name];
}
function propertyConstant() {
this[name] = value;
}
function propertyFunction() {
var x = value.apply(this, arguments);
if (x == null) delete this[name]; else this[name] = x;
}
return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant;
}
d3_selectionPrototype.text = function(value) {
return arguments.length ? this.each(typeof value === "function" ? function() {
var v = value.apply(this, arguments);
this.textContent = v == null ? "" : v;
} : value == null ? function() {
this.textContent = "";
} : function() {
this.textContent = value;
}) : this.node().textContent;
};
d3_selectionPrototype.html = function(value) {
return arguments.length ? this.each(typeof value === "function" ? function() {
var v = value.apply(this, arguments);
this.innerHTML = v == null ? "" : v;
} : value == null ? function() {
this.innerHTML = "";
} : function() {
this.innerHTML = value;
}) : this.node().innerHTML;
};
d3_selectionPrototype.append = function(name) {
name = d3.ns.qualify(name);
function append() {
return this.appendChild(d3_document.createElementNS(this.namespaceURI, name));
}
function appendNS() {
return this.appendChild(d3_document.createElementNS(name.space, name.local));
}
return this.select(name.local ? appendNS : append);
};
d3_selectionPrototype.insert = function(name, before) {
name = d3.ns.qualify(name);
function insert() {
return this.insertBefore(d3_document.createElementNS(this.namespaceURI, name), d3_select(before, this));
}
function insertNS() {
return this.insertBefore(d3_document.createElementNS(name.space, name.local), d3_select(before, this));
}
return this.select(name.local ? insertNS : insert);
};
d3_selectionPrototype.remove = function() {
return this.each(function() {
var parent = this.parentNode;
if (parent) parent.removeChild(this);
});
};
d3_selectionPrototype.data = function(value, key) {
var i = -1, n = this.length, group, node;
if (!arguments.length) {
value = new Array(n = (group = this[0]).length);
while (++i < n) {
if (node = group[i]) {
value[i] = node.__data__;
}
}
return value;
}
function bind(group, groupData) {
var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData;
if (key) {
var nodeByKeyValue = new d3_Map(), dataByKeyValue = new d3_Map(), keyValues = [], keyValue;
for (i = -1; ++i < n; ) {
keyValue = key.call(node = group[i], node.__data__, i);
if (nodeByKeyValue.has(keyValue)) {
exitNodes[i] = node;
} else {
nodeByKeyValue.set(keyValue, node);
}
keyValues.push(keyValue);
}
for (i = -1; ++i < m; ) {
keyValue = key.call(groupData, nodeData = groupData[i], i);
if (node = nodeByKeyValue.get(keyValue)) {
updateNodes[i] = node;
node.__data__ = nodeData;
} else if (!dataByKeyValue.has(keyValue)) {
enterNodes[i] = d3_selection_dataNode(nodeData);
}
dataByKeyValue.set(keyValue, nodeData);
nodeByKeyValue.remove(keyValue);
}
for (i = -1; ++i < n; ) {
if (nodeByKeyValue.has(keyValues[i])) {
exitNodes[i] = group[i];
}
}
} else {
for (i = -1; ++i < n0; ) {
node = group[i];
nodeData = groupData[i];
if (node) {
node.__data__ = nodeData;
updateNodes[i] = node;
} else {
enterNodes[i] = d3_selection_dataNode(nodeData);
}
}
for (;i < m; ++i) {
enterNodes[i] = d3_selection_dataNode(groupData[i]);
}
for (;i < n; ++i) {
exitNodes[i] = group[i];
}
}
enterNodes.update = updateNodes;
enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode;
enter.push(enterNodes);
update.push(updateNodes);
exit.push(exitNodes);
}
var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);
if (typeof value === "function") {
while (++i < n) {
bind(group = this[i], value.call(group, group.parentNode.__data__, i));
}
} else {
while (++i < n) {
bind(group = this[i], value);
}
}
update.enter = function() {
return enter;
};
update.exit = function() {
return exit;
};
return update;
};
function d3_selection_dataNode(data) {
return {
__data__: data
};
}
d3_selectionPrototype.datum = function(value) {
return arguments.length ? this.property("__data__", value) : this.property("__data__");
};
d3_selectionPrototype.filter = function(filter) {
var subgroups = [], subgroup, group, node;
if (typeof filter !== "function") filter = d3_selection_filter(filter);
for (var j = 0, m = this.length; j < m; j++) {
subgroups.push(subgroup = []);
subgroup.parentNode = (group = this[j]).parentNode;
for (var i = 0, n = group.length; i < n; i++) {
if ((node = group[i]) && filter.call(node, node.__data__, i)) {
subgroup.push(node);
}
}
}
return d3_selection(subgroups);
};
function d3_selection_filter(selector) {
return function() {
return d3_selectMatches(this, selector);
};
}
d3_selectionPrototype.order = function() {
for (var j = -1, m = this.length; ++j < m; ) {
for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
if (node = group[i]) {
if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
next = node;
}
}
}
return this;
};
d3_selectionPrototype.sort = function(comparator) {
comparator = d3_selection_sortComparator.apply(this, arguments);
for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);
return this.order();
};
function d3_selection_sortComparator(comparator) {
if (!arguments.length) comparator = d3.ascending;
return function(a, b) {
return !a - !b || comparator(a.__data__, b.__data__);
};
}
d3_selectionPrototype.on = function(type, listener, capture) {
var n = arguments.length;
if (n < 3) {
if (typeof type !== "string") {
if (n < 2) listener = false;
for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));
return this;
}
if (n < 2) return (n = this.node()["__on" + type]) && n._;
capture = false;
}
return this.each(d3_selection_on(type, listener, capture));
};
function d3_selection_on(type, listener, capture) {
var name = "__on" + type, i = type.indexOf(".");
if (i > 0) type = type.substring(0, i);
function onRemove() {
var wrapper = this[name];
if (wrapper) {
this.removeEventListener(type, wrapper, wrapper.$);
delete this[name];
}
}
function onAdd() {
var node = this, args = d3_array(arguments);
onRemove.call(this);
this.addEventListener(type, this[name] = wrapper, wrapper.$ = capture);
wrapper._ = listener;
function wrapper(e) {
var o = d3.event;
d3.event = e;
args[0] = node.__data__;
try {
listener.apply(node, args);
} finally {
d3.event = o;
}
}
}
return listener ? onAdd : onRemove;
}
d3_selectionPrototype.each = function(callback) {
return d3_selection_each(this, function(node, i, j) {
callback.call(node, node.__data__, i, j);
});
};
function d3_selection_each(groups, callback) {
for (var j = 0, m = groups.length; j < m; j++) {
for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {
if (node = group[i]) callback(node, i, j);
}
}
return groups;
}
d3_selectionPrototype.call = function(callback) {
var args = d3_array(arguments);
callback.apply(args[0] = this, args);
return this;
};
d3_selectionPrototype.empty = function() {
return !this.node();
};
d3_selectionPrototype.node = function() {
for (var j = 0, m = this.length; j < m; j++) {
for (var group = this[j], i = 0, n = group.length; i < n; i++) {
var node = group[i];
if (node) return node;
}
}
return null;
};
d3_selectionPrototype.transition = function() {
var id = d3_transitionInheritId || ++d3_transitionId, subgroups = [], subgroup, node, transition = Object.create(d3_transitionInherit);
transition.time = Date.now();
for (var j = -1, m = this.length; ++j < m; ) {
subgroups.push(subgroup = []);
for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
if (node = group[i]) d3_transitionNode(node, i, id, transition);
subgroup.push(node);
}
}
return d3_transition(subgroups, id);
};
var d3_selectionRoot = d3_selection([ [ d3_document ] ]);
d3_selectionRoot[0].parentNode = d3_selectRoot;
d3.select = function(selector) {
return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]);
};
d3.selectAll = function(selector) {
return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]);
};
function d3_selection_enter(selection) {
d3_arraySubclass(selection, d3_selection_enterPrototype);
return selection;
}
var d3_selection_enterPrototype = [];
d3.selection.enter = d3_selection_enter;
d3.selection.enter.prototype = d3_selection_enterPrototype;
d3_selection_enterPrototype.append = d3_selectionPrototype.append;
d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
d3_selection_enterPrototype.node = d3_selectionPrototype.node;
d3_selection_enterPrototype.select = function(selector) {
var subgroups = [], subgroup, subnode, upgroup, group, node;
for (var j = -1, m = this.length; ++j < m; ) {
upgroup = (group = this[j]).update;
subgroups.push(subgroup = []);
subgroup.parentNode = group.parentNode;
for (var i = -1, n = group.length; ++i < n; ) {
if (node = group[i]) {
subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
subnode.__data__ = node.__data__;
} else {
subgroup.push(null);
}
}
}
return d3_selection(subgroups);
};
function d3_transition(groups, id) {
d3_arraySubclass(groups, d3_transitionPrototype);
groups.id = id;
return groups;
}
var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit = {
ease: d3_ease_cubicInOut,
delay: 0,
duration: 250
};
d3_transitionPrototype.call = d3_selectionPrototype.call;
d3_transitionPrototype.empty = d3_selectionPrototype.empty;
d3_transitionPrototype.node = d3_selectionPrototype.node;
d3.transition = function(selection) {
return arguments.length ? d3_transitionInheritId ? selection.transition() : selection : d3_selectionRoot.transition();
};
d3.transition.prototype = d3_transitionPrototype;
function d3_transitionNode(node, i, id, inherit) {
var lock = node.__transition__ || (node.__transition__ = {
active: 0,
count: 0
}), transition = lock[id];
if (!transition) {
var time = inherit.time;
transition = lock[id] = {
tween: new d3_Map(),
event: d3.dispatch("start", "end"),
time: time,
ease: inherit.ease,
delay: inherit.delay,
duration: inherit.duration
};
++lock.count;
d3.timer(function(elapsed) {
var d = node.__data__, ease = transition.ease, event = transition.event, delay = transition.delay, duration = transition.duration, tweened = [];
return delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time), 1;
function start(elapsed) {
if (lock.active > id) return stop();
lock.active = id;
event.start.call(node, d, i);
transition.tween.forEach(function(key, value) {
if (value = value.call(node, d, i)) {
tweened.push(value);
}
});
if (!tick(elapsed)) d3.timer(tick, 0, time);
return 1;
}
function tick(elapsed) {
if (lock.active !== id) return stop();
var t = (elapsed - delay) / duration, e = ease(t), n = tweened.length;
while (n > 0) {
tweened[--n].call(node, e);
}
if (t >= 1) {
stop();
event.end.call(node, d, i);
return 1;
}
}
function stop() {
if (--lock.count) delete lock[id]; else delete node.__transition__;
return 1;
}
}, 0, time);
return transition;
}
}
d3_transitionPrototype.select = function(selector) {
var id = this.id, subgroups = [], subgroup, subnode, node;
if (typeof selector !== "function") selector = d3_selection_selector(selector);
for (var j = -1, m = this.length; ++j < m; ) {
subgroups.push(subgroup = []);
for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i))) {
if ("__data__" in node) subnode.__data__ = node.__data__;
d3_transitionNode(subnode, i, id, node.__transition__[id]);
subgroup.push(subnode);
} else {
subgroup.push(null);
}
}
}
return d3_transition(subgroups, id);
};
d3_transitionPrototype.selectAll = function(selector) {
var id = this.id, subgroups = [], subgroup, subnodes, node, subnode, transition;
if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
for (var j = -1, m = this.length; ++j < m; ) {
for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
if (node = group[i]) {
transition = node.__transition__[id];
subnodes = selector.call(node, node.__data__, i);
subgroups.push(subgroup = []);
for (var k = -1, o = subnodes.length; ++k < o; ) {
d3_transitionNode(subnode = subnodes[k], k, id, transition);
subgroup.push(subnode);
}
}
}
}
return d3_transition(subgroups, id);
};
d3_transitionPrototype.filter = function(filter) {
var subgroups = [], subgroup, group, node;
if (typeof filter !== "function") filter = d3_selection_filter(filter);
for (var j = 0, m = this.length; j < m; j++) {
subgroups.push(subgroup = []);
for (var group = this[j], i = 0, n = group.length; i < n; i++) {
if ((node = group[i]) && filter.call(node, node.__data__, i)) {
subgroup.push(node);
}
}
}
return d3_transition(subgroups, this.id, this.time).ease(this.ease());
};
d3_transitionPrototype.attr = function(nameNS, value) {
if (arguments.length < 2) {
for (value in nameNS) this.attr(value, nameNS[value]);
return this;
}
var interpolate = d3_interpolateByName(nameNS), name = d3.ns.qualify(nameNS);
function attrNull() {
this.removeAttribute(name);
}
function attrNullNS() {
this.removeAttributeNS(name.space, name.local);
}
return d3_transition_tween(this, "attr." + nameNS, value, function(b) {
function attrString() {
var a = this.getAttribute(name), i;
return a !== b && (i = interpolate(a, b), function(t) {
this.setAttribute(name, i(t));
});
}
function attrStringNS() {
var a = this.getAttributeNS(name.space, name.local), i;
return a !== b && (i = interpolate(a, b), function(t) {
this.setAttributeNS(name.space, name.local, i(t));
});
}
return b == null ? name.local ? attrNullNS : attrNull : (b += "", name.local ? attrStringNS : attrString);
});
};
d3_transitionPrototype.attrTween = function(nameNS, tween) {
var name = d3.ns.qualify(nameNS);
function attrTween(d, i) {
var f = tween.call(this, d, i, this.getAttribute(name));
return f && function(t) {
this.setAttribute(name, f(t));
};
}
function attrTweenNS(d, i) {
var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
return f && function(t) {
this.setAttributeNS(name.space, name.local, f(t));
};
}
return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
};
d3_transitionPrototype.style = function(name, value, priority) {
var n = arguments.length;
if (n < 3) {
if (typeof name !== "string") {
if (n < 2) value = "";
for (priority in name) this.style(priority, name[priority], value);
return this;
}
priority = "";
}
var interpolate = d3_interpolateByName(name);
function styleNull() {
this.style.removeProperty(name);
}
return d3_transition_tween(this, "style." + name, value, function(b) {
function styleString() {
var a = d3_window.getComputedStyle(this, null).getPropertyValue(name), i;
return a !== b && (i = interpolate(a, b), function(t) {
this.style.setProperty(name, i(t), priority);
});
}
return b == null ? styleNull : (b += "", styleString);
});
};
d3_transitionPrototype.styleTween = function(name, tween, priority) {
if (arguments.length < 3) priority = "";
return this.tween("style." + name, function(d, i) {
var f = tween.call(this, d, i, d3_window.getComputedStyle(this, null).getPropertyValue(name));
return f && function(t) {
this.style.setProperty(name, f(t), priority);
};
});
};
d3_transitionPrototype.text = function(value) {
return d3_transition_tween(this, "text", value, d3_transition_text);
};
function d3_transition_text(b) {
if (b == null) b = "";
return function() {
this.textContent = b;
};
}
d3_transitionPrototype.remove = function() {
return this.each("end.transition", function() {
var p;
if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);
});
};
d3_transitionPrototype.ease = function(value) {
var id = this.id;
if (arguments.length < 1) return this.node().__transition__[id].ease;
if (typeof value !== "function") value = d3.ease.apply(d3, arguments);
return d3_selection_each(this, function(node) {
node.__transition__[id].ease = value;
});
};
d3_transitionPrototype.delay = function(value) {
var id = this.id;
return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
node.__transition__[id].delay = value.call(node, node.__data__, i, j) | 0;
} : (value |= 0, function(node) {
node.__transition__[id].delay = value;
}));
};
d3_transitionPrototype.duration = function(value) {
var id = this.id;
return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j) | 0);
} : (value = Math.max(1, value | 0), function(node) {
node.__transition__[id].duration = value;
}));
};
d3_transitionPrototype.each = function(type, listener) {
var id = this.id;
if (arguments.length < 2) {
var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId;
d3_transitionInheritId = id;
d3_selection_each(this, function(node, i, j) {
d3_transitionInherit = node.__transition__[id];
type.call(node, node.__data__, i, j);
});
d3_transitionInherit = inherit;
d3_transitionInheritId = inheritId;
} else {
d3_selection_each(this, function(node) {
node.__transition__[id].event.on(type, listener);
});
}
return this;
};
d3_transitionPrototype.transition = function() {
var id0 = this.id, id1 = ++d3_transitionId, subgroups = [], subgroup, group, node, transition;
for (var j = 0, m = this.length; j < m; j++) {
subgroups.push(subgroup = []);
for (var group = this[j], i = 0, n = group.length; i < n; i++) {
if (node = group[i]) {
transition = Object.create(node.__transition__[id0]);
transition.delay += transition.duration;
d3_transitionNode(node, i, id1, transition);
}
subgroup.push(node);
}
}
return d3_transition(subgroups, id1);
};
d3_transitionPrototype.tween = function(name, tween) {
var id = this.id;
if (arguments.length < 2) return this.node().__transition__[id].tween.get(name);
return d3_selection_each(this, tween == null ? function(node) {
node.__transition__[id].tween.remove(name);
} : function(node) {
node.__transition__[id].tween.set(name, tween);
});
};
function d3_transition_tween(groups, name, value, tween) {
var id = groups.id;
return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) {
node.__transition__[id].tween.set(name, tween(value.call(node, node.__data__, i, j)));
} : (value = tween(value), function(node) {
node.__transition__[id].tween.set(name, value);
}));
}
var d3_timer_id = 0, d3_timer_byId = {}, d3_timer_queue = null, d3_timer_interval, d3_timer_timeout;
d3.timer = function(callback, delay, then) {
if (arguments.length < 3) {
if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return;
then = Date.now();
}
var timer = d3_timer_byId[callback.id];
if (timer && timer.callback === callback) {
timer.then = then;
timer.delay = delay;
} else d3_timer_byId[callback.id = ++d3_timer_id] = d3_timer_queue = {
callback: callback,
then: then,
delay: delay,
next: d3_timer_queue
};
if (!d3_timer_interval) {
d3_timer_timeout = clearTimeout(d3_timer_timeout);
d3_timer_interval = 1;
d3_timer_frame(d3_timer_step);
}
};
function d3_timer_step() {
var elapsed, now = Date.now(), t1 = d3_timer_queue;
while (t1) {
elapsed = now - t1.then;
if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);
t1 = t1.next;
}
var delay = d3_timer_flush() - now;
if (delay > 24) {
if (isFinite(delay)) {
clearTimeout(d3_timer_timeout);
d3_timer_timeout = setTimeout(d3_timer_step, delay);
}
d3_timer_interval = 0;
} else {
d3_timer_interval = 1;
d3_timer_frame(d3_timer_step);
}
}
d3.timer.flush = function() {
var elapsed, now = Date.now(), t1 = d3_timer_queue;
while (t1) {
elapsed = now - t1.then;
if (!t1.delay) t1.flush = t1.callback(elapsed);
t1 = t1.next;
}
d3_timer_flush();
};
function d3_timer_flush() {
var t0 = null, t1 = d3_timer_queue, then = Infinity;
while (t1) {
if (t1.flush) {
delete d3_timer_byId[t1.callback.id];
t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;
} else {
then = Math.min(then, t1.then + t1.delay);
t1 = (t0 = t1).next;
}
}
return then;
}
var d3_timer_frame = d3_window.requestAnimationFrame || d3_window.webkitRequestAnimationFrame || d3_window.mozRequestAnimationFrame || d3_window.oRequestAnimationFrame || d3_window.msRequestAnimationFrame || function(callback) {
setTimeout(callback, 17);
};
d3.mouse = function(container) {
return d3_mousePoint(container, d3_eventSource());
};
var d3_mouse_bug44083 = /WebKit/.test(d3_window.navigator.userAgent) ? -1 : 0;
function d3_mousePoint(container, e) {
var svg = container.ownerSVGElement || container;
if (svg.createSVGPoint) {
var point = svg.createSVGPoint();
if (d3_mouse_bug44083 < 0 && (d3_window.scrollX || d3_window.scrollY)) {
svg = d3.select(d3_document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0);
var ctm = svg[0][0].getScreenCTM();
d3_mouse_bug44083 = !(ctm.f || ctm.e);
svg.remove();
}
if (d3_mouse_bug44083) {
point.x = e.pageX;
point.y = e.pageY;
} else {
point.x = e.clientX;
point.y = e.clientY;
}
point = point.matrixTransform(container.getScreenCTM().inverse());
return [ point.x, point.y ];
}
var rect = container.getBoundingClientRect();
return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
}
d3.touches = function(container, touches) {
if (arguments.length < 2) touches = d3_eventSource().touches;
return touches ? d3_array(touches).map(function(touch) {
var point = d3_mousePoint(container, touch);
point.identifier = touch.identifier;
return point;
}) : [];
};
function d3_noop() {}
d3.scale = {};
function d3_scaleExtent(domain) {
var start = domain[0], stop = domain[domain.length - 1];
return start < stop ? [ start, stop ] : [ stop, start ];
}
function d3_scaleRange(scale) {
return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
}
function d3_scale_nice(domain, nice) {
var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;
if (x1 < x0) {
dx = i0, i0 = i1, i1 = dx;
dx = x0, x0 = x1, x1 = dx;
}
if (nice = nice(x1 - x0)) {
domain[i0] = nice.floor(x0);
domain[i1] = nice.ceil(x1);
}
return domain;
}
function d3_scale_niceDefault() {
return Math;
}
d3.scale.linear = function() {
return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3.interpolate, false);
};
function d3_scale_linear(domain, range, interpolate, clamp) {
var output, input;
function rescale() {
var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
output = linear(domain, range, uninterpolate, interpolate);
input = linear(range, domain, uninterpolate, d3.interpolate);
return scale;
}
function scale(x) {
return output(x);
}
scale.invert = function(y) {
return input(y);
};
scale.domain = function(x) {
if (!arguments.length) return domain;
domain = x.map(Number);
return rescale();
};
scale.range = function(x) {
if (!arguments.length) return range;
range = x;
return rescale();
};
scale.rangeRound = function(x) {
return scale.range(x).interpolate(d3.interpolateRound);
};
scale.clamp = function(x) {
if (!arguments.length) return clamp;
clamp = x;
return rescale();
};
scale.interpolate = function(x) {
if (!arguments.length) return interpolate;
interpolate = x;
return rescale();
};
scale.ticks = function(m) {
return d3_scale_linearTicks(domain, m);
};
scale.tickFormat = function(m) {
return d3_scale_linearTickFormat(domain, m);
};
scale.nice = function() {
d3_scale_nice(domain, d3_scale_linearNice);
return rescale();
};
scale.copy = function() {
return d3_scale_linear(domain, range, interpolate, clamp);
};
return rescale();
}
function d3_scale_linearRebind(scale, linear) {
return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
}
function d3_scale_linearNice(dx) {
dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
return dx && {
floor: function(x) {
return Math.floor(x / dx) * dx;
},
ceil: function(x) {
return Math.ceil(x / dx) * dx;
}
};
}
function d3_scale_linearTickRange(domain, m) {
var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step;
if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
extent[0] = Math.ceil(extent[0] / step) * step;
extent[1] = Math.floor(extent[1] / step) * step + step * .5;
extent[2] = step;
return extent;
}
function d3_scale_linearTicks(domain, m) {
return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
}
function d3_scale_linearTickFormat(domain, m) {
return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f");
}
function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);
return function(x) {
return i(u(x));
};
}
function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;
if (domain[k] < domain[0]) {
domain = domain.slice().reverse();
range = range.slice().reverse();
}
while (++j <= k) {
u.push(uninterpolate(domain[j - 1], domain[j]));
i.push(interpolate(range[j - 1], range[j]));
}
return function(x) {
var j = d3.bisect(domain, x, 1, k) - 1;
return i[j](u[j](x));
};
}
d3.scale.log = function() {
return d3_scale_log(d3.scale.linear(), d3_scale_logp);
};
function d3_scale_log(linear, log) {
var pow = log.pow;
function scale(x) {
return linear(log(x));
}
scale.invert = function(x) {
return pow(linear.invert(x));
};
scale.domain = function(x) {
if (!arguments.length) return linear.domain().map(pow);
log = x[0] < 0 ? d3_scale_logn : d3_scale_logp;
pow = log.pow;
linear.domain(x.map(log));
return scale;
};
scale.nice = function() {
linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault));
return scale;
};
scale.ticks = function() {
var extent = d3_scaleExtent(linear.domain()), ticks = [];
if (extent.every(isFinite)) {
var i = Math.floor(extent[0]), j = Math.ceil(extent[1]), u = pow(extent[0]), v = pow(extent[1]);
if (log === d3_scale_logn) {
ticks.push(pow(i));
for (;i++ < j; ) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
} else {
for (;i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);
ticks.push(pow(i));
}
for (i = 0; ticks[i] < u; i++) {}
for (j = ticks.length; ticks[j - 1] > v; j--) {}
ticks = ticks.slice(i, j);
}
return ticks;
};
scale.tickFormat = function(n, format) {
if (arguments.length < 2) format = d3_scale_logFormat;
if (!arguments.length) return format;
var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12,
Math.floor) : (e = 1e-12, Math.ceil), e;
return function(d) {
return d / pow(f(log(d) + e)) <= k ? format(d) : "";
};
};
scale.copy = function() {
return d3_scale_log(linear.copy(), log);
};
return d3_scale_linearRebind(scale, linear);
}
var d3_scale_logFormat = d3.format(".0e");
function d3_scale_logp(x) {
return Math.log(x < 0 ? 0 : x) / Math.LN10;
}
function d3_scale_logn(x) {
return -Math.log(x > 0 ? 0 : -x) / Math.LN10;
}
d3_scale_logp.pow = function(x) {
return Math.pow(10, x);
};
d3_scale_logn.pow = function(x) {
return -Math.pow(10, -x);
};
d3.scale.pow = function() {
return d3_scale_pow(d3.scale.linear(), 1);
};
function d3_scale_pow(linear, exponent) {
var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);
function scale(x) {
return linear(powp(x));
}
scale.invert = function(x) {
return powb(linear.invert(x));
};
scale.domain = function(x) {
if (!arguments.length) return linear.domain().map(powb);
linear.domain(x.map(powp));
return scale;
};
scale.ticks = function(m) {
return d3_scale_linearTicks(scale.domain(), m);
};
scale.tickFormat = function(m) {
return d3_scale_linearTickFormat(scale.domain(), m);
};
scale.nice = function() {
return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
};
scale.exponent = function(x) {
if (!arguments.length) return exponent;
var domain = scale.domain();
powp = d3_scale_powPow(exponent = x);
powb = d3_scale_powPow(1 / exponent);
return scale.domain(domain);
};
scale.copy = function() {
return d3_scale_pow(linear.copy(), exponent);
};
return d3_scale_linearRebind(scale, linear);
}
function d3_scale_powPow(e) {
return function(x) {
return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
};
}
d3.scale.sqrt = function() {
return d3.scale.pow().exponent(.5);
};
d3.scale.ordinal = function() {
return d3_scale_ordinal([], {
t: "range",
a: [ [] ]
});
};
function d3_scale_ordinal(domain, ranger) {
var index, range, rangeBand;
function scale(x) {
return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length];
}
function steps(start, step) {
return d3.range(domain.length).map(function(i) {
return start + step * i;
});
}
scale.domain = function(x) {
if (!arguments.length) return domain;
domain = [];
index = new d3_Map();
var i = -1, n = x.length, xi;
while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
return scale[ranger.t].apply(scale, ranger.a);
};
scale.range = function(x) {
if (!arguments.length) return range;
range = x;
rangeBand = 0;
ranger = {
t: "range",
a: arguments
};
return scale;
};
scale.rangePoints = function(x, padding) {
if (arguments.length < 2) padding = 0;
var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding);
range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
rangeBand = 0;
ranger = {
t: "rangePoints",
a: arguments
};
return scale;
};
scale.rangeBands = function(x, padding, outerPadding) {
if (arguments.length < 2) padding = 0;
if (arguments.length < 3) outerPadding = padding;
var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);
range = steps(start + step * outerPadding, step);
if (reverse) range.reverse();
rangeBand = step * (1 - padding);
ranger = {
t: "rangeBands",
a: arguments
};
return scale;
};
scale.rangeRoundBands = function(x, padding, outerPadding) {
if (arguments.length < 2) padding = 0;
if (arguments.length < 3) outerPadding = padding;
var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step;
range = steps(start + Math.round(error / 2), step);
if (reverse) range.reverse();
rangeBand = Math.round(step * (1 - padding));
ranger = {
t: "rangeRoundBands",
a: arguments
};
return scale;
};
scale.rangeBand = function() {
return rangeBand;
};
scale.rangeExtent = function() {
return d3_scaleExtent(ranger.a[0]);
};
scale.copy = function() {
return d3_scale_ordinal(domain, ranger);
};
return scale.domain(domain);
}
d3.scale.category10 = function() {
return d3.scale.ordinal().range(d3_category10);
};
d3.scale.category20 = function() {
return d3.scale.ordinal().range(d3_category20);
};
d3.scale.category20b = function() {
return d3.scale.ordinal().range(d3_category20b);
};
d3.scale.category20c = function() {
return d3.scale.ordinal().range(d3_category20c);
};
var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ];
var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ];
var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ];
var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ];
d3.scale.quantile = function() {
return d3_scale_quantile([], []);
};
function d3_scale_quantile(domain, range) {
var thresholds;
function rescale() {
var k = 0, q = range.length;
thresholds = [];
while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
return scale;
}
function scale(x) {
if (isNaN(x = +x)) return NaN;
return range[d3.bisect(thresholds, x)];
}
scale.domain = function(x) {
if (!arguments.length) return domain;
domain = x.filter(function(d) {
return !isNaN(d);
}).sort(d3.ascending);
return rescale();
};
scale.range = function(x) {
if (!arguments.length) return range;
range = x;
return rescale();
};
scale.quantiles = function() {
return thresholds;
};
scale.copy = function() {
return d3_scale_quantile(domain, range);
};
return rescale();
}
d3.scale.quantize = function() {
return d3_scale_quantize(0, 1, [ 0, 1 ]);
};
function d3_scale_quantize(x0, x1, range) {
var kx, i;
function scale(x) {
return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
}
function rescale() {
kx = range.length / (x1 - x0);
i = range.length - 1;
return scale;
}
scale.domain = function(x) {
if (!arguments.length) return [ x0, x1 ];
x0 = +x[0];
x1 = +x[x.length - 1];
return rescale();
};
scale.range = function(x) {
if (!arguments.length) return range;
range = x;
return rescale();
};
scale.copy = function() {
return d3_scale_quantize(x0, x1, range);
};
return rescale();
}
d3.scale.threshold = function() {
return d3_scale_threshold([ .5 ], [ 0, 1 ]);
};
function d3_scale_threshold(domain, range) {
function scale(x) {
return range[d3.bisect(domain, x)];
}
scale.domain = function(_) {
if (!arguments.length) return domain;
domain = _;
return scale;
};
scale.range = function(_) {
if (!arguments.length) return range;
range = _;
return scale;
};
scale.copy = function() {
return d3_scale_threshold(domain, range);
};
return scale;
}
d3.scale.identity = function() {
return d3_scale_identity([ 0, 1 ]);
};
function d3_scale_identity(domain) {
function identity(x) {
return +x;
}
identity.invert = identity;
identity.domain = identity.range = function(x) {
if (!arguments.length) return domain;
domain = x.map(identity);
return identity;
};
identity.ticks = function(m) {
return d3_scale_linearTicks(domain, m);
};
identity.tickFormat = function(m) {
return d3_scale_linearTickFormat(domain, m);
};
identity.copy = function() {
return d3_scale_identity(domain);
};
return identity;
}
d3.svg = {};
d3.svg.arc = function() {
var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
function arc() {
var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0,
a0 = a1, a1 = da), a1 - a0), df = da < π ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1);
return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z";
}
arc.innerRadius = function(v) {
if (!arguments.length) return innerRadius;
innerRadius = d3_functor(v);
return arc;
};
arc.outerRadius = function(v) {
if (!arguments.length) return outerRadius;
outerRadius = d3_functor(v);
return arc;
};
arc.startAngle = function(v) {
if (!arguments.length) return startAngle;
startAngle = d3_functor(v);
return arc;
};
arc.endAngle = function(v) {
if (!arguments.length) return endAngle;
endAngle = d3_functor(v);
return arc;
};
arc.centroid = function() {
var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
return [ Math.cos(a) * r, Math.sin(a) * r ];
};
return arc;
};
var d3_svg_arcOffset = -π / 2, d3_svg_arcMax = 2 * π - 1e-6;
function d3_svg_arcInnerRadius(d) {
return d.innerRadius;
}
function d3_svg_arcOuterRadius(d) {
return d.outerRadius;
}
function d3_svg_arcStartAngle(d) {
return d.startAngle;
}
function d3_svg_arcEndAngle(d) {
return d.endAngle;
}
function d3_svg_line(projection) {
var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;
function line(data) {
var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);
function segment() {
segments.push("M", interpolate(projection(points), tension));
}
while (++i < n) {
if (defined.call(this, d = data[i], i)) {
points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);
} else if (points.length) {
segment();
points = [];
}
}
if (points.length) segment();
return segments.length ? segments.join("") : null;
}
line.x = function(_) {
if (!arguments.length) return x;
x = _;
return line;
};
line.y = function(_) {
if (!arguments.length) return y;
y = _;
return line;
};
line.defined = function(_) {
if (!arguments.length) return defined;
defined = _;
return line;
};
line.interpolate = function(_) {
if (!arguments.length) return interpolateKey;
if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
return line;
};
line.tension = function(_) {
if (!arguments.length) return tension;
tension = _;
return line;
};
return line;
}
d3.svg.line = function() {
return d3_svg_line(d3_identity);
};
function d3_svg_lineX(d) {
return d[0];
}
function d3_svg_lineY(d) {
return d[1];
}
var d3_svg_lineInterpolators = d3.map({
linear: d3_svg_lineLinear,
"linear-closed": d3_svg_lineLinearClosed,
"step-before": d3_svg_lineStepBefore,
"step-after": d3_svg_lineStepAfter,
basis: d3_svg_lineBasis,
"basis-open": d3_svg_lineBasisOpen,
"basis-closed": d3_svg_lineBasisClosed,
bundle: d3_svg_lineBundle,
cardinal: d3_svg_lineCardinal,
"cardinal-open": d3_svg_lineCardinalOpen,
"cardinal-closed": d3_svg_lineCardinalClosed,
monotone: d3_svg_lineMonotone
});
d3_svg_lineInterpolators.forEach(function(key, value) {
value.key = key;
value.closed = /-closed$/.test(key);
});
function d3_svg_lineLinear(points) {
return points.join("L");
}
function d3_svg_lineLinearClosed(points) {
return d3_svg_lineLinear(points) + "Z";
}
function d3_svg_lineStepBefore(points) {
var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
return path.join("");
}
function d3_svg_lineStepAfter(points) {
var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
return path.join("");
}
function d3_svg_lineCardinalOpen(points, tension) {
return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension));
}
function d3_svg_lineCardinalClosed(points, tension) {
return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]),
points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
}
function d3_svg_lineCardinal(points, tension) {
return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));
}
function d3_svg_lineHermite(points, tangents) {
if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {
return d3_svg_lineLinear(points);
}
var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;
if (quad) {
path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];
p0 = points[1];
pi = 2;
}
if (tangents.length > 1) {
t = tangents[1];
p = points[pi];
pi++;
path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
for (var i = 2; i < tangents.length; i++, pi++) {
p = points[pi];
t = tangents[i];
path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
}
}
if (quad) {
var lp = points[pi];
path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];
}
return path;
}
function d3_svg_lineCardinalTangents(points, tension) {
var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;
while (++i < n) {
p0 = p1;
p1 = p2;
p2 = points[i];
tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);
}
return tangents;
}
function d3_svg_lineBasis(points) {
if (points.length < 3) return d3_svg_lineLinear(points);
var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0 ];
d3_svg_lineBasisBezier(path, px, py);
while (++i < n) {
pi = points[i];
px.shift();
px.push(pi[0]);
py.shift();
py.push(pi[1]);
d3_svg_lineBasisBezier(path, px, py);
}
i = -1;
while (++i < 2) {
px.shift();
px.push(pi[0]);
py.shift();
py.push(pi[1]);
d3_svg_lineBasisBezier(path, px, py);
}
return path.join("");
}
function d3_svg_lineBasisOpen(points) {
if (points.length < 4) return d3_svg_lineLinear(points);
var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];
while (++i < 3) {
pi = points[i];
px.push(pi[0]);
py.push(pi[1]);
}
path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
--i;
while (++i < n) {
pi = points[i];
px.shift();
px.push(pi[0]);
py.shift();
py.push(pi[1]);
d3_svg_lineBasisBezier(path, px, py);
}
return path.join("");
}
function d3_svg_lineBasisClosed(points) {
var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];
while (++i < 4) {
pi = points[i % n];
px.push(pi[0]);
py.push(pi[1]);
}
path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
--i;
while (++i < m) {
pi = points[i % n];
px.shift();
px.push(pi[0]);
py.shift();
py.push(pi[1]);
d3_svg_lineBasisBezier(path, px, py);
}
return path.join("");
}
function d3_svg_lineBundle(points, tension) {
var n = points.length - 1;
if (n) {
var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;
while (++i <= n) {
p = points[i];
t = i / n;
p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
}
}
return d3_svg_lineBasis(points);
}
function d3_svg_lineDot4(a, b) {
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
}
var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ];
function d3_svg_lineBasisBezier(path, x, y) {
path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
}
function d3_svg_lineSlope(p0, p1) {
return (p1[1] - p0[1]) / (p1[0] - p0[0]);
}
function d3_svg_lineFiniteDifferences(points) {
var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);
while (++i < j) {
m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;
}
m[i] = d;
return m;
}
function d3_svg_lineMonotoneTangents(points) {
var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;
while (++i < j) {
d = d3_svg_lineSlope(points[i], points[i + 1]);
if (Math.abs(d) < 1e-6) {
m[i] = m[i + 1] = 0;
} else {
a = m[i] / d;
b = m[i + 1] / d;
s = a * a + b * b;
if (s > 9) {
s = d * 3 / Math.sqrt(s);
m[i] = s * a;
m[i + 1] = s * b;
}
}
}
i = -1;
while (++i <= j) {
s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
tangents.push([ s || 0, m[i] * s || 0 ]);
}
return tangents;
}
function d3_svg_lineMonotone(points) {
return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
}
d3.svg.line.radial = function() {
var line = d3_svg_line(d3_svg_lineRadial);
line.radius = line.x, delete line.x;
line.angle = line.y, delete line.y;
return line;
};
function d3_svg_lineRadial(points) {
var point, i = -1, n = points.length, r, a;
while (++i < n) {
point = points[i];
r = point[0];
a = point[1] + d3_svg_arcOffset;
point[0] = r * Math.cos(a);
point[1] = r * Math.sin(a);
}
return points;
}
function d3_svg_area(projection) {
var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
function area(data) {
var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
return x;
} : d3_functor(x1), fy1 = y0 === y1 ? function() {
return y;
} : d3_functor(y1), x, y;
function segment() {
segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");
}
while (++i < n) {
if (defined.call(this, d = data[i], i)) {
points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);
points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);
} else if (points0.length) {
segment();
points0 = [];
points1 = [];
}
}
if (points0.length) segment();
return segments.length ? segments.join("") : null;
}
area.x = function(_) {
if (!arguments.length) return x1;
x0 = x1 = _;
return area;
};
area.x0 = function(_) {
if (!arguments.length) return x0;
x0 = _;
return area;
};
area.x1 = function(_) {
if (!arguments.length) return x1;
x1 = _;
return area;
};
area.y = function(_) {
if (!arguments.length) return y1;
y0 = y1 = _;
return area;
};
area.y0 = function(_) {
if (!arguments.length) return y0;
y0 = _;
return area;
};
area.y1 = function(_) {
if (!arguments.length) return y1;
y1 = _;
return area;
};
area.defined = function(_) {
if (!arguments.length) return defined;
defined = _;
return area;
};
area.interpolate = function(_) {
if (!arguments.length) return interpolateKey;
if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
interpolateReverse = interpolate.reverse || interpolate;
L = interpolate.closed ? "M" : "L";
return area;
};
area.tension = function(_) {
if (!arguments.length) return tension;
tension = _;
return area;
};
return area;
}
d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
d3.svg.area = function() {
return d3_svg_area(d3_identity);
};
d3.svg.area.radial = function() {
var area = d3_svg_area(d3_svg_lineRadial);
area.radius = area.x, delete area.x;
area.innerRadius = area.x0, delete area.x0;
area.outerRadius = area.x1, delete area.x1;
area.angle = area.y, delete area.y;
area.startAngle = area.y0, delete area.y0;
area.endAngle = area.y1, delete area.y1;
return area;
};
d3.svg.chord = function() {
var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
function chord(d, i) {
var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z";
}
function subgroup(self, f, d, i) {
var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
return {
r: r,
a0: a0,
a1: a1,
p0: [ r * Math.cos(a0), r * Math.sin(a0) ],
p1: [ r * Math.cos(a1), r * Math.sin(a1) ]
};
}
function equals(a, b) {
return a.a0 == b.a0 && a.a1 == b.a1;
}
function arc(r, p, a) {
return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p;
}
function curve(r0, p0, r1, p1) {
return "Q 0,0 " + p1;
}
chord.radius = function(v) {
if (!arguments.length) return radius;
radius = d3_functor(v);
return chord;
};
chord.source = function(v) {
if (!arguments.length) return source;
source = d3_functor(v);
return chord;
};
chord.target = function(v) {
if (!arguments.length) return target;
target = d3_functor(v);
return chord;
};
chord.startAngle = function(v) {
if (!arguments.length) return startAngle;
startAngle = d3_functor(v);
return chord;
};
chord.endAngle = function(v) {
if (!arguments.length) return endAngle;
endAngle = d3_functor(v);
return chord;
};
return chord;
};
function d3_svg_chordRadius(d) {
return d.radius;
}
d3.svg.diagonal = function() {
var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection;
function diagonal(d, i) {
var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {
x: p0.x,
y: m
}, {
x: p3.x,
y: m
}, p3 ];
p = p.map(projection);
return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
}
diagonal.source = function(x) {
if (!arguments.length) return source;
source = d3_functor(x);
return diagonal;
};
diagonal.target = function(x) {
if (!arguments.length) return target;
target = d3_functor(x);
return diagonal;
};
diagonal.projection = function(x) {
if (!arguments.length) return projection;
projection = x;
return diagonal;
};
return diagonal;
};
function d3_svg_diagonalProjection(d) {
return [ d.x, d.y ];
}
d3.svg.diagonal.radial = function() {
var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;
diagonal.projection = function(x) {
return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;
};
return diagonal;
};
function d3_svg_diagonalRadialProjection(projection) {
return function() {
var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset;
return [ r * Math.cos(a), r * Math.sin(a) ];
};
}
d3.svg.symbol = function() {
var type = d3_svg_symbolType, size = d3_svg_symbolSize;
function symbol(d, i) {
return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));
}
symbol.type = function(x) {
if (!arguments.length) return type;
type = d3_functor(x);
return symbol;
};
symbol.size = function(x) {
if (!arguments.length) return size;
size = d3_functor(x);
return symbol;
};
return symbol;
};
function d3_svg_symbolSize() {
return 64;
}
function d3_svg_symbolType() {
return "circle";
}
function d3_svg_symbolCircle(size) {
var r = Math.sqrt(size / π);
return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
}
var d3_svg_symbols = d3.map({
circle: d3_svg_symbolCircle,
cross: function(size) {
var r = Math.sqrt(size / 5) / 2;
return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z";
},
diamond: function(size) {
var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;
return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
},
square: function(size) {
var r = Math.sqrt(size) / 2;
return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
},
"triangle-down": function(size) {
var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
},
"triangle-up": function(size) {
var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";
}
});
d3.svg.symbolTypes = d3_svg_symbols.keys();
var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians);
d3.svg.axis = function() {
var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0;
function axis(g) {
g.each(function() {
var g = d3.select(this);
var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_;
var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".tick.minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", ".tick").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1);
var tick = g.selectAll(".tick.major").data(ticks, String), tickEnter = tick.enter().insert("g", "path").attr("class", "tick major").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform;
var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"),
d3.transition(path));
var scale1 = scale.copy(), scale0 = this.__chart__ || scale1;
this.__chart__ = scale1;
tickEnter.append("line");
tickEnter.append("text");
var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
switch (orient) {
case "bottom":
{
tickTransform = d3_svg_axisX;
subtickEnter.attr("y2", tickMinorSize);
subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
lineEnter.attr("y2", tickMajorSize);
textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding);
lineUpdate.attr("x2", 0).attr("y2", tickMajorSize);
textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding);
text.attr("dy", ".71em").style("text-anchor", "middle");
pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
break;
}
case "top":
{
tickTransform = d3_svg_axisX;
subtickEnter.attr("y2", -tickMinorSize);
subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
lineEnter.attr("y2", -tickMajorSize);
textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize);
textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
text.attr("dy", "0em").style("text-anchor", "middle");
pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
break;
}
case "left":
{
tickTransform = d3_svg_axisY;
subtickEnter.attr("x2", -tickMinorSize);
subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
lineEnter.attr("x2", -tickMajorSize);
textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0);
textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0);
text.attr("dy", ".32em").style("text-anchor", "end");
pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
break;
}
case "right":
{
tickTransform = d3_svg_axisY;
subtickEnter.attr("x2", tickMinorSize);
subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
lineEnter.attr("x2", tickMajorSize);
textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding);
lineUpdate.attr("x2", tickMajorSize).attr("y2", 0);
textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0);
text.attr("dy", ".32em").style("text-anchor", "start");
pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
break;
}
}
if (scale.ticks) {
tickEnter.call(tickTransform, scale0);
tickUpdate.call(tickTransform, scale1);
tickExit.call(tickTransform, scale1);
subtickEnter.call(tickTransform, scale0);
subtickUpdate.call(tickTransform, scale1);
subtickExit.call(tickTransform, scale1);
} else {
var dx = scale1.rangeBand() / 2, x = function(d) {
return scale1(d) + dx;
};
tickEnter.call(tickTransform, x);
tickUpdate.call(tickTransform, x);
}
});
}
axis.scale = function(x) {
if (!arguments.length) return scale;
scale = x;
return axis;
};
axis.orient = function(x) {
if (!arguments.length) return orient;
orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient;
return axis;
};
axis.ticks = function() {
if (!arguments.length) return tickArguments_;
tickArguments_ = arguments;
return axis;
};
axis.tickValues = function(x) {
if (!arguments.length) return tickValues;
tickValues = x;
return axis;
};
axis.tickFormat = function(x) {
if (!arguments.length) return tickFormat_;
tickFormat_ = x;
return axis;
};
axis.tickSize = function(x, y) {
if (!arguments.length) return tickMajorSize;
var n = arguments.length - 1;
tickMajorSize = +x;
tickMinorSize = n > 1 ? +y : tickMajorSize;
tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
return axis;
};
axis.tickPadding = function(x) {
if (!arguments.length) return tickPadding;
tickPadding = +x;
return axis;
};
axis.tickSubdivide = function(x) {
if (!arguments.length) return tickSubdivide;
tickSubdivide = +x;
return axis;
};
return axis;
};
var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = {
top: 1,
right: 1,
bottom: 1,
left: 1
};
function d3_svg_axisX(selection, x) {
selection.attr("transform", function(d) {
return "translate(" + x(d) + ",0)";
});
}
function d3_svg_axisY(selection, y) {
selection.attr("transform", function(d) {
return "translate(0," + y(d) + ")";
});
}
function d3_svg_axisSubdivide(scale, ticks, m) {
subticks = [];
if (m && ticks.length > 1) {
var extent = d3_scaleExtent(scale.domain()), subticks, i = -1, n = ticks.length, d = (ticks[1] - ticks[0]) / ++m, j, v;
while (++i < n) {
for (j = m; --j > 0; ) {
if ((v = +ticks[i] - j * d) >= extent[0]) {
subticks.push(v);
}
}
}
for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1]; ) {
subticks.push(v);
}
}
return subticks;
}
d3.svg.brush = function() {
var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain;
function brush(g) {
g.each(function() {
var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e;
g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
fg.enter().append("rect").attr("class", "extent").style("cursor", "move");
tz.enter().append("g").attr("class", function(d) {
return "resize " + d;
}).style("cursor", function(d) {
return d3_svg_brushCursor[d];
}).append("rect").attr("x", function(d) {
return /[ew]$/.test(d) ? -3 : null;
}).attr("y", function(d) {
return /^[ns]/.test(d) ? -3 : null;
}).attr("width", 6).attr("height", 6).style("visibility", "hidden");
tz.style("display", brush.empty() ? "none" : null);
tz.exit().remove();
if (x) {
e = d3_scaleRange(x);
bg.attr("x", e[0]).attr("width", e[1] - e[0]);
redrawX(g);
}
if (y) {
e = d3_scaleRange(y);
bg.attr("y", e[0]).attr("height", e[1] - e[0]);
redrawY(g);
}
redraw(g);
});
}
function redraw(g) {
g.selectAll(".resize").attr("transform", function(d) {
return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";
});
}
function redrawX(g) {
g.select(".extent").attr("x", extent[0][0]);
g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]);
}
function redrawY(g) {
g.select(".extent").attr("y", extent[0][1]);
g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);
}
function brushstart() {
var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset;
var w = d3.select(d3_window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup);
if (dragging) {
origin[0] = extent[0][0] - origin[0];
origin[1] = extent[0][1] - origin[1];
} else if (resizing) {
var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);
offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ];
origin[0] = extent[ex][0];
origin[1] = extent[ey][1];
} else if (d3.event.altKey) center = origin.slice();
g.style("pointer-events", "none").selectAll(".resize").style("display", null);
d3.select("body").style("cursor", eventTarget.style("cursor"));
event_({
type: "brushstart"
});
brushmove();
d3_eventCancel();
function mouse() {
var touches = d3.event.changedTouches;
return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
}
function keydown() {
if (d3.event.keyCode == 32) {
if (!dragging) {
center = null;
origin[0] -= extent[1][0];
origin[1] -= extent[1][1];
dragging = 2;
}
d3_eventCancel();
}
}
function keyup() {
if (d3.event.keyCode == 32 && dragging == 2) {
origin[0] += extent[1][0];
origin[1] += extent[1][1];
dragging = 0;
d3_eventCancel();
}
}
function brushmove() {
var point = mouse(), moved = false;
if (offset) {
point[0] += offset[0];
point[1] += offset[1];
}
if (!dragging) {
if (d3.event.altKey) {
if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ];
origin[0] = extent[+(point[0] < center[0])][0];
origin[1] = extent[+(point[1] < center[1])][1];
} else center = null;
}
if (resizingX && move1(point, x, 0)) {
redrawX(g);
moved = true;
}
if (resizingY && move1(point, y, 1)) {
redrawY(g);
moved = true;
}
if (moved) {
redraw(g);
event_({
type: "brush",
mode: dragging ? "move" : "resize"
});
}
}
function move1(point, scale, i) {
var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max;
if (dragging) {
r0 -= position;
r1 -= size + position;
}
min = Math.max(r0, Math.min(r1, point[i]));
if (dragging) {
max = (min += position) + size;
} else {
if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
if (position < min) {
max = min;
min = position;
} else {
max = position;
}
}
if (extent[0][i] !== min || extent[1][i] !== max) {
extentDomain = null;
extent[0][i] = min;
extent[1][i] = max;
return true;
}
}
function brushend() {
brushmove();
g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
d3.select("body").style("cursor", null);
w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null);
event_({
type: "brushend"
});
d3_eventCancel();
}
}
brush.x = function(z) {
if (!arguments.length) return x;
x = z;
resizes = d3_svg_brushResizes[!x << 1 | !y];
return brush;
};
brush.y = function(z) {
if (!arguments.length) return y;
y = z;
resizes = d3_svg_brushResizes[!x << 1 | !y];
return brush;
};
brush.extent = function(z) {
var x0, x1, y0, y1, t;
if (!arguments.length) {
z = extentDomain || extent;
if (x) {
x0 = z[0][0], x1 = z[1][0];
if (!extentDomain) {
x0 = extent[0][0], x1 = extent[1][0];
if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
if (x1 < x0) t = x0, x0 = x1, x1 = t;
}
}
if (y) {
y0 = z[0][1], y1 = z[1][1];
if (!extentDomain) {
y0 = extent[0][1], y1 = extent[1][1];
if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
if (y1 < y0) t = y0, y0 = y1, y1 = t;
}
}
return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];
}
extentDomain = [ [ 0, 0 ], [ 0, 0 ] ];
if (x) {
x0 = z[0], x1 = z[1];
if (y) x0 = x0[0], x1 = x1[0];
extentDomain[0][0] = x0, extentDomain[1][0] = x1;
if (x.invert) x0 = x(x0), x1 = x(x1);
if (x1 < x0) t = x0, x0 = x1, x1 = t;
extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;
}
if (y) {
y0 = z[0], y1 = z[1];
if (x) y0 = y0[1], y1 = y1[1];
extentDomain[0][1] = y0, extentDomain[1][1] = y1;
if (y.invert) y0 = y(y0), y1 = y(y1);
if (y1 < y0) t = y0, y0 = y1, y1 = t;
extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;
}
return brush;
};
brush.clear = function() {
extentDomain = null;
extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0;
return brush;
};
brush.empty = function() {
return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1];
};
return d3.rebind(brush, event, "on");
};
var d3_svg_brushCursor = {
n: "ns-resize",
e: "ew-resize",
s: "ns-resize",
w: "ew-resize",
nw: "nwse-resize",
ne: "nesw-resize",
se: "nwse-resize",
sw: "nesw-resize"
};
var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ];
d3.behavior = {};
d3.behavior.drag = function() {
var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null;
function drag() {
this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown);
}
function mousedown() {
var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches ? d3.event.changedTouches[0].identifier : null, offset, origin_ = point(), moved = 0;
var w = d3.select(d3_window).on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true);
if (origin) {
offset = origin.apply(target, arguments);
offset = [ offset.x - origin_[0], offset.y - origin_[1] ];
} else {
offset = [ 0, 0 ];
}
if (touchId == null) d3_eventCancel();
event_({
type: "dragstart"
});
function point() {
var p = target.parentNode;
return touchId != null ? d3.touches(p).filter(function(p) {
return p.identifier === touchId;
})[0] : d3.mouse(p);
}
function dragmove() {
if (!target.parentNode) return dragend();
var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1];
moved |= dx | dy;
origin_ = p;
d3_eventCancel();
event_({
type: "drag",
x: p[0] + offset[0],
y: p[1] + offset[1],
dx: dx,
dy: dy
});
}
function dragend() {
event_({
type: "dragend"
});
if (moved) {
d3_eventCancel();
if (d3.event.target === eventTarget) w.on("click.drag", click, true);
}
w.on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", null);
}
function click() {
d3_eventCancel();
w.on("click.drag", null);
}
}
drag.origin = function(x) {
if (!arguments.length) return origin;
origin = x;
return drag;
};
return d3.rebind(drag, event, "on");
};
d3.behavior.zoom = function() {
var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;
function zoom() {
this.on("mousedown.zoom", mousedown).on("mousemove.zoom", mousemove).on(d3_behavior_zoomWheel + ".zoom", mousewheel).on("dblclick.zoom", dblclick).on("touchstart.zoom", touchstart).on("touchmove.zoom", touchmove).on("touchend.zoom", touchstart);
}
zoom.translate = function(x) {
if (!arguments.length) return translate;
translate = x.map(Number);
rescale();
return zoom;
};
zoom.scale = function(x) {
if (!arguments.length) return scale;
scale = +x;
rescale();
return zoom;
};
zoom.scaleExtent = function(x) {
if (!arguments.length) return scaleExtent;
scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number);
return zoom;
};
zoom.x = function(z) {
if (!arguments.length) return x1;
x1 = z;
x0 = z.copy();
translate = [ 0, 0 ];
scale = 1;
return zoom;
};
zoom.y = function(z) {
if (!arguments.length) return y1;
y1 = z;
y0 = z.copy();
translate = [ 0, 0 ];
scale = 1;
return zoom;
};
function location(p) {
return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ];
}
function point(l) {
return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ];
}
function scaleTo(s) {
scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
}
function translateTo(p, l) {
l = point(l);
translate[0] += p[0] - l[0];
translate[1] += p[1] - l[1];
}
function rescale() {
if (x1) x1.domain(x0.range().map(function(x) {
return (x - translate[0]) / scale;
}).map(x0.invert));
if (y1) y1.domain(y0.range().map(function(y) {
return (y - translate[1]) / scale;
}).map(y0.invert));
}
function dispatch(event) {
rescale();
d3.event.preventDefault();
event({
type: "zoom",
scale: scale,
translate: translate
});
}
function mousedown() {
var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(d3_window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target));
d3_window.focus();
d3_eventCancel();
function mousemove() {
moved = 1;
translateTo(d3.mouse(target), l);
dispatch(event_);
}
function mouseup() {
if (moved) d3_eventCancel();
w.on("mousemove.zoom", null).on("mouseup.zoom", null);
if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true);
}
function click() {
d3_eventCancel();
w.on("click.zoom", null);
}
}
function mousewheel() {
if (!translate0) translate0 = location(d3.mouse(this));
scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale);
translateTo(d3.mouse(this), translate0);
dispatch(event.of(this, arguments));
}
function mousemove() {
translate0 = null;
}
function dblclick() {
var p = d3.mouse(this), l = location(p), k = Math.log(scale) / Math.LN2;
scaleTo(Math.pow(2, d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1));
translateTo(p, l);
dispatch(event.of(this, arguments));
}
function touchstart() {
var touches = d3.touches(this), now = Date.now();
scale0 = scale;
translate0 = {};
touches.forEach(function(t) {
translate0[t.identifier] = location(t);
});
d3_eventCancel();
if (touches.length === 1) {
if (now - touchtime < 500) {
var p = touches[0], l = location(touches[0]);
scaleTo(scale * 2);
translateTo(p, l);
dispatch(event.of(this, arguments));
}
touchtime = now;
}
}
function touchmove() {
var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier];
if (p1 = touches[1]) {
var p1, l1 = translate0[p1.identifier];
p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];
l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];
scaleTo(d3.event.scale * scale0);
}
translateTo(p0, l0);
touchtime = null;
dispatch(event.of(this, arguments));
}
return d3.rebind(zoom, event, "on");
};
var d3_behavior_zoomInfinity = [ 0, Infinity ];
var d3_behavior_zoomDelta, d3_behavior_zoomWheel = "onwheel" in document ? (d3_behavior_zoomDelta = function() {
return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1);
}, "wheel") : "onmousewheel" in document ? (d3_behavior_zoomDelta = function() {
return d3.event.wheelDelta;
}, "mousewheel") : (d3_behavior_zoomDelta = function() {
return -d3.event.detail;
}, "MozMousePixelScroll");
d3.layout = {};
d3.layout.bundle = function() {
return function(links) {
var paths = [], i = -1, n = links.length;
while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
return paths;
};
};
function d3_layout_bundlePath(link) {
var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ];
while (start !== lca) {
start = start.parent;
points.push(start);
}
var k = points.length;
while (end !== lca) {
points.splice(k, 0, end);
end = end.parent;
}
return points;
}
function d3_layout_bundleAncestors(node) {
var ancestors = [], parent = node.parent;
while (parent != null) {
ancestors.push(node);
node = parent;
parent = parent.parent;
}
ancestors.push(node);
return ancestors;
}
function d3_layout_bundleLeastCommonAncestor(a, b) {
if (a === b) return a;
var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;
while (aNode === bNode) {
sharedNode = aNode;
aNode = aNodes.pop();
bNode = bNodes.pop();
}
return sharedNode;
}
d3.layout.chord = function() {
var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
function relayout() {
var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;
chords = [];
groups = [];
k = 0, i = -1;
while (++i < n) {
x = 0, j = -1;
while (++j < n) {
x += matrix[i][j];
}
groupSums.push(x);
subgroupIndex.push(d3.range(n));
k += x;
}
if (sortGroups) {
groupIndex.sort(function(a, b) {
return sortGroups(groupSums[a], groupSums[b]);
});
}
if (sortSubgroups) {
subgroupIndex.forEach(function(d, i) {
d.sort(function(a, b) {
return sortSubgroups(matrix[i][a], matrix[i][b]);
});
});
}
k = (2 * π - padding * n) / k;
x = 0, i = -1;
while (++i < n) {
x0 = x, j = -1;
while (++j < n) {
var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
subgroups[di + "-" + dj] = {
index: di,
subindex: dj,
startAngle: a0,
endAngle: a1,
value: v
};
}
groups[di] = {
index: di,
startAngle: x0,
endAngle: x,
value: (x - x0) / k
};
x += padding;
}
i = -1;
while (++i < n) {
j = i - 1;
while (++j < n) {
var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
if (source.value || target.value) {
chords.push(source.value < target.value ? {
source: target,
target: source
} : {
source: source,
target: target
});
}
}
}
if (sortChords) resort();
}
function resort() {
chords.sort(function(a, b) {
return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);
});
}
chord.matrix = function(x) {
if (!arguments.length) return matrix;
n = (matrix = x) && matrix.length;
chords = groups = null;
return chord;
};
chord.padding = function(x) {
if (!arguments.length) return padding;
padding = x;
chords = groups = null;
return chord;
};
chord.sortGroups = function(x) {
if (!arguments.length) return sortGroups;
sortGroups = x;
chords = groups = null;
return chord;
};
chord.sortSubgroups = function(x) {
if (!arguments.length) return sortSubgroups;
sortSubgroups = x;
chords = null;
return chord;
};
chord.sortChords = function(x) {
if (!arguments.length) return sortChords;
sortChords = x;
if (chords) resort();
return chord;
};
chord.chords = function() {
if (!chords) relayout();
return chords;
};
chord.groups = function() {
if (!groups) relayout();
return groups;
};
return chord;
};
d3.layout.force = function() {
var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, nodes = [], links = [], distances, strengths, charges;
function repulse(node) {
return function(quad, x1, _, x2) {
if (quad.point !== node) {
var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy);
if ((x2 - x1) * dn < theta) {
var k = quad.charge * dn * dn;
node.px -= dx * k;
node.py -= dy * k;
return true;
}
if (quad.point && isFinite(dn)) {
var k = quad.pointCharge * dn * dn;
node.px -= dx * k;
node.py -= dy * k;
}
}
return !quad.charge;
};
}
force.tick = function() {
if ((alpha *= .99) < .005) {
event.end({
type: "end",
alpha: alpha = 0
});
return true;
}
var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;
for (i = 0; i < m; ++i) {
o = links[i];
s = o.source;
t = o.target;
x = t.x - s.x;
y = t.y - s.y;
if (l = x * x + y * y) {
l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
x *= l;
y *= l;
t.x -= x * (k = s.weight / (t.weight + s.weight));
t.y -= y * k;
s.x += x * (k = 1 - k);
s.y += y * k;
}
}
if (k = alpha * gravity) {
x = size[0] / 2;
y = size[1] / 2;
i = -1;
if (k) while (++i < n) {
o = nodes[i];
o.x += (x - o.x) * k;
o.y += (y - o.y) * k;
}
}
if (charge) {
d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
i = -1;
while (++i < n) {
if (!(o = nodes[i]).fixed) {
q.visit(repulse(o));
}
}
}
i = -1;
while (++i < n) {
o = nodes[i];
if (o.fixed) {
o.x = o.px;
o.y = o.py;
} else {
o.x -= (o.px - (o.px = o.x)) * friction;
o.y -= (o.py - (o.py = o.y)) * friction;
}
}
event.tick({
type: "tick",
alpha: alpha
});
};
force.nodes = function(x) {
if (!arguments.length) return nodes;
nodes = x;
return force;
};
force.links = function(x) {
if (!arguments.length) return links;
links = x;
return force;
};
force.size = function(x) {
if (!arguments.length) return size;
size = x;
return force;
};
force.linkDistance = function(x) {
if (!arguments.length) return linkDistance;
linkDistance = typeof x === "function" ? x : +x;
return force;
};
force.distance = force.linkDistance;
force.linkStrength = function(x) {
if (!arguments.length) return linkStrength;
linkStrength = typeof x === "function" ? x : +x;
return force;
};
force.friction = function(x) {
if (!arguments.length) return friction;
friction = +x;
return force;
};
force.charge = function(x) {
if (!arguments.length) return charge;
charge = typeof x === "function" ? x : +x;
return force;
};
force.gravity = function(x) {
if (!arguments.length) return gravity;
gravity = +x;
return force;
};
force.theta = function(x) {
if (!arguments.length) return theta;
theta = +x;
return force;
};
force.alpha = function(x) {
if (!arguments.length) return alpha;
x = +x;
if (alpha) {
if (x > 0) alpha = x; else alpha = 0;
} else if (x > 0) {
event.start({
type: "start",
alpha: alpha = x
});
d3.timer(force.tick);
}
return force;
};
force.start = function() {
var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;
for (i = 0; i < n; ++i) {
(o = nodes[i]).index = i;
o.weight = 0;
}
for (i = 0; i < m; ++i) {
o = links[i];
if (typeof o.source == "number") o.source = nodes[o.source];
if (typeof o.target == "number") o.target = nodes[o.target];
++o.source.weight;
++o.target.weight;
}
for (i = 0; i < n; ++i) {
o = nodes[i];
if (isNaN(o.x)) o.x = position("x", w);
if (isNaN(o.y)) o.y = position("y", h);
if (isNaN(o.px)) o.px = o.x;
if (isNaN(o.py)) o.py = o.y;
}
distances = [];
if (typeof linkDistance === "function") for (i = 0; i < m; ++i) distances[i] = +linkDistance.call(this, links[i], i); else for (i = 0; i < m; ++i) distances[i] = linkDistance;
strengths = [];
if (typeof linkStrength === "function") for (i = 0; i < m; ++i) strengths[i] = +linkStrength.call(this, links[i], i); else for (i = 0; i < m; ++i) strengths[i] = linkStrength;
charges = [];
if (typeof charge === "function") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i); else for (i = 0; i < n; ++i) charges[i] = charge;
function position(dimension, size) {
var neighbors = neighbor(i), j = -1, m = neighbors.length, x;
while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
return Math.random() * size;
}
function neighbor() {
if (!neighbors) {
neighbors = [];
for (j = 0; j < n; ++j) {
neighbors[j] = [];
}
for (j = 0; j < m; ++j) {
var o = links[j];
neighbors[o.source.index].push(o.target);
neighbors[o.target.index].push(o.source);
}
}
return neighbors[i];
}
return force.resume();
};
force.resume = function() {
return force.alpha(.1);
};
force.stop = function() {
return force.alpha(0);
};
force.drag = function() {
if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart.force", d3_layout_forceDragstart).on("drag.force", dragmove).on("dragend.force", d3_layout_forceDragend);
if (!arguments.length) return drag;
this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag);
};
function dragmove(d) {
d.px = d3.event.x, d.py = d3.event.y;
force.resume();
}
return d3.rebind(force, event, "on");
};
function d3_layout_forceDragstart(d) {
d.fixed |= 2;
}
function d3_layout_forceDragend(d) {
d.fixed &= ~6;
}
function d3_layout_forceMouseover(d) {
d.fixed |= 4;
d.px = d.x, d.py = d.y;
}
function d3_layout_forceMouseout(d) {
d.fixed &= ~4;
}
function d3_layout_forceAccumulate(quad, alpha, charges) {
var cx = 0, cy = 0;
quad.charge = 0;
if (!quad.leaf) {
var nodes = quad.nodes, n = nodes.length, i = -1, c;
while (++i < n) {
c = nodes[i];
if (c == null) continue;
d3_layout_forceAccumulate(c, alpha, charges);
quad.charge += c.charge;
cx += c.charge * c.cx;
cy += c.charge * c.cy;
}
}
if (quad.point) {
if (!quad.leaf) {
quad.point.x += Math.random() - .5;
quad.point.y += Math.random() - .5;
}
var k = alpha * charges[quad.point.index];
quad.charge += quad.pointCharge = k;
cx += k * quad.point.x;
cy += k * quad.point.y;
}
quad.cx = cx / quad.charge;
quad.cy = cy / quad.charge;
}
var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1;
d3.layout.partition = function() {
var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];
function position(node, x, dx, dy) {
var children = node.children;
node.x = x;
node.y = node.depth * dy;
node.dx = dx;
node.dy = dy;
if (children && (n = children.length)) {
var i = -1, n, c, d;
dx = node.value ? dx / node.value : 0;
while (++i < n) {
position(c = children[i], x, d = c.value * dx, dy);
x += d;
}
}
}
function depth(node) {
var children = node.children, d = 0;
if (children && (n = children.length)) {
var i = -1, n;
while (++i < n) d = Math.max(d, depth(children[i]));
}
return 1 + d;
}
function partition(d, i) {
var nodes = hierarchy.call(this, d, i);
position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
return nodes;
}
partition.size = function(x) {
if (!arguments.length) return size;
size = x;
return partition;
};
return d3_layout_hierarchyRebind(partition, hierarchy);
};
d3.layout.pie = function() {
var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * π;
function pie(data) {
var values = data.map(function(d, i) {
return +value.call(pie, d, i);
});
var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle);
var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - startAngle) / d3.sum(values);
var index = d3.range(data.length);
if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
return values[j] - values[i];
} : function(i, j) {
return sort(data[i], data[j]);
});
var arcs = [];
index.forEach(function(i) {
var d;
arcs[i] = {
data: data[i],
value: d = values[i],
startAngle: a,
endAngle: a += d * k
};
});
return arcs;
}
pie.value = function(x) {
if (!arguments.length) return value;
value = x;
return pie;
};
pie.sort = function(x) {
if (!arguments.length) return sort;
sort = x;
return pie;
};
pie.startAngle = function(x) {
if (!arguments.length) return startAngle;
startAngle = x;
return pie;
};
pie.endAngle = function(x) {
if (!arguments.length) return endAngle;
endAngle = x;
return pie;
};
return pie;
};
var d3_layout_pieSortByValue = {};
d3.layout.stack = function() {
var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
function stack(data, index) {
var series = data.map(function(d, i) {
return values.call(stack, d, i);
});
var points = series.map(function(d) {
return d.map(function(v, i) {
return [ x.call(stack, v, i), y.call(stack, v, i) ];
});
});
var orders = order.call(stack, points, index);
series = d3.permute(series, orders);
points = d3.permute(points, orders);
var offsets = offset.call(stack, points, index);
var n = series.length, m = series[0].length, i, j, o;
for (j = 0; j < m; ++j) {
out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
for (i = 1; i < n; ++i) {
out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
}
}
return data;
}
stack.values = function(x) {
if (!arguments.length) return values;
values = x;
return stack;
};
stack.order = function(x) {
if (!arguments.length) return order;
order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
return stack;
};
stack.offset = function(x) {
if (!arguments.length) return offset;
offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
return stack;
};
stack.x = function(z) {
if (!arguments.length) return x;
x = z;
return stack;
};
stack.y = function(z) {
if (!arguments.length) return y;
y = z;
return stack;
};
stack.out = function(z) {
if (!arguments.length) return out;
out = z;
return stack;
};
return stack;
};
function d3_layout_stackX(d) {
return d.x;
}
function d3_layout_stackY(d) {
return d.y;
}
function d3_layout_stackOut(d, y0, y) {
d.y0 = y0;
d.y = y;
}
var d3_layout_stackOrders = d3.map({
"inside-out": function(data) {
var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) {
return max[a] - max[b];
}), top = 0, bottom = 0, tops = [], bottoms = [];
for (i = 0; i < n; ++i) {
j = index[i];
if (top < bottom) {
top += sums[j];
tops.push(j);
} else {
bottom += sums[j];
bottoms.push(j);
}
}
return bottoms.reverse().concat(tops);
},
reverse: function(data) {
return d3.range(data.length).reverse();
},
"default": d3_layout_stackOrderDefault
});
var d3_layout_stackOffsets = d3.map({
silhouette: function(data) {
var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];
for (j = 0; j < m; ++j) {
for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
if (o > max) max = o;
sums.push(o);
}
for (j = 0; j < m; ++j) {
y0[j] = (max - sums[j]) / 2;
}
return y0;
},
wiggle: function(data) {
var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];
y0[0] = o = o0 = 0;
for (j = 1; j < m; ++j) {
for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
}
s2 += s3 * data[i][j][1];
}
y0[j] = o -= s1 ? s2 / s1 * dx : 0;
if (o < o0) o0 = o;
}
for (j = 0; j < m; ++j) y0[j] -= o0;
return y0;
},
expand: function(data) {
var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];
for (j = 0; j < m; ++j) {
for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k;
}
for (j = 0; j < m; ++j) y0[j] = 0;
return y0;
},
zero: d3_layout_stackOffsetZero
});
function d3_layout_stackOrderDefault(data) {
return d3.range(data.length);
}
function d3_layout_stackOffsetZero(data) {
var j = -1, m = data[0].length, y0 = [];
while (++j < m) y0[j] = 0;
return y0;
}
function d3_layout_stackMaxIndex(array) {
var i = 1, j = 0, v = array[0][1], k, n = array.length;
for (;i < n; ++i) {
if ((k = array[i][1]) > v) {
j = i;
v = k;
}
}
return j;
}
function d3_layout_stackReduceSum(d) {
return d.reduce(d3_layout_stackSum, 0);
}
function d3_layout_stackSum(p, d) {
return p + d[1];
}
d3.layout.histogram = function() {
var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;
function histogram(data, i) {
var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x;
while (++i < m) {
bin = bins[i] = [];
bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
bin.y = 0;
}
if (m > 0) {
i = -1;
while (++i < n) {
x = values[i];
if (x >= range[0] && x <= range[1]) {
bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
bin.y += k;
bin.push(data[i]);
}
}
}
return bins;
}
histogram.value = function(x) {
if (!arguments.length) return valuer;
valuer = x;
return histogram;
};
histogram.range = function(x) {
if (!arguments.length) return ranger;
ranger = d3_functor(x);
return histogram;
};
histogram.bins = function(x) {
if (!arguments.length) return binner;
binner = typeof x === "number" ? function(range) {
return d3_layout_histogramBinFixed(range, x);
} : d3_functor(x);
return histogram;
};
histogram.frequency = function(x) {
if (!arguments.length) return frequency;
frequency = !!x;
return histogram;
};
return histogram;
};
function d3_layout_histogramBinSturges(range, values) {
return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
}
function d3_layout_histogramBinFixed(range, n) {
var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];
while (++x <= n) f[x] = m * x + b;
return f;
}
function d3_layout_histogramRange(values) {
return [ d3.min(values), d3.max(values) ];
}
d3.layout.hierarchy = function() {
var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;
function recurse(node, depth, nodes) {
var childs = children.call(hierarchy, node, depth);
node.depth = depth;
nodes.push(node);
if (childs && (n = childs.length)) {
var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d;
while (++i < n) {
d = recurse(childs[i], j, nodes);
d.parent = node;
c.push(d);
v += d.value;
}
if (sort) c.sort(sort);
if (value) node.value = v;
} else if (value) {
node.value = +value.call(hierarchy, node, depth) || 0;
}
return node;
}
function revalue(node, depth) {
var children = node.children, v = 0;
if (children && (n = children.length)) {
var i = -1, n, j = depth + 1;
while (++i < n) v += revalue(children[i], j);
} else if (value) {
v = +value.call(hierarchy, node, depth) || 0;
}
if (value) node.value = v;
return v;
}
function hierarchy(d) {
var nodes = [];
recurse(d, 0, nodes);
return nodes;
}
hierarchy.sort = function(x) {
if (!arguments.length) return sort;
sort = x;
return hierarchy;
};
hierarchy.children = function(x) {
if (!arguments.length) return children;
children = x;
return hierarchy;
};
hierarchy.value = function(x) {
if (!arguments.length) return value;
value = x;
return hierarchy;
};
hierarchy.revalue = function(root) {
revalue(root, 0);
return root;
};
return hierarchy;
};
function d3_layout_hierarchyRebind(object, hierarchy) {
d3.rebind(object, hierarchy, "sort", "children", "value");
object.nodes = object;
object.links = d3_layout_hierarchyLinks;
return object;
}
function d3_layout_hierarchyChildren(d) {
return d.children;
}
function d3_layout_hierarchyValue(d) {
return d.value;
}
function d3_layout_hierarchySort(a, b) {
return b.value - a.value;
}
function d3_layout_hierarchyLinks(nodes) {
return d3.merge(nodes.map(function(parent) {
return (parent.children || []).map(function(child) {
return {
source: parent,
target: child
};
});
}));
}
d3.layout.pack = function() {
var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ];
function pack(d, i) {
var nodes = hierarchy.call(this, d, i), root = nodes[0];
root.x = 0;
root.y = 0;
d3_layout_treeVisitAfter(root, function(d) {
d.r = Math.sqrt(d.value);
});
d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h);
if (padding > 0) {
var dr = padding * k / 2;
d3_layout_treeVisitAfter(root, function(d) {
d.r += dr;
});
d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
d3_layout_treeVisitAfter(root, function(d) {
d.r -= dr;
});
k = Math.max(2 * root.r / w, 2 * root.r / h);
}
d3_layout_packTransform(root, w / 2, h / 2, 1 / k);
return nodes;
}
pack.size = function(x) {
if (!arguments.length) return size;
size = x;
return pack;
};
pack.padding = function(_) {
if (!arguments.length) return padding;
padding = +_;
return pack;
};
return d3_layout_hierarchyRebind(pack, hierarchy);
};
function d3_layout_packSort(a, b) {
return a.value - b.value;
}
function d3_layout_packInsert(a, b) {
var c = a._pack_next;
a._pack_next = b;
b._pack_prev = a;
b._pack_next = c;
c._pack_prev = b;
}
function d3_layout_packSplice(a, b) {
a._pack_next = b;
b._pack_prev = a;
}
function d3_layout_packIntersects(a, b) {
var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;
return dr * dr - dx * dx - dy * dy > .001;
}
function d3_layout_packSiblings(node) {
if (!(nodes = node.children) || !(n = nodes.length)) return;
var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;
function bound(node) {
xMin = Math.min(node.x - node.r, xMin);
xMax = Math.max(node.x + node.r, xMax);
yMin = Math.min(node.y - node.r, yMin);
yMax = Math.max(node.y + node.r, yMax);
}
nodes.forEach(d3_layout_packLink);
a = nodes[0];
a.x = -a.r;
a.y = 0;
bound(a);
if (n > 1) {
b = nodes[1];
b.x = b.r;
b.y = 0;
bound(b);
if (n > 2) {
c = nodes[2];
d3_layout_packPlace(a, b, c);
bound(c);
d3_layout_packInsert(a, c);
a._pack_prev = c;
d3_layout_packInsert(c, b);
b = a._pack_next;
for (i = 3; i < n; i++) {
d3_layout_packPlace(a, b, c = nodes[i]);
var isect = 0, s1 = 1, s2 = 1;
for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
if (d3_layout_packIntersects(j, c)) {
isect = 1;
break;
}
}
if (isect == 1) {
for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
if (d3_layout_packIntersects(k, c)) {
break;
}
}
}
if (isect) {
if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b);
i--;
} else {
d3_layout_packInsert(a, c);
b = c;
bound(c);
}
}
}
}
var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;
for (i = 0; i < n; i++) {
c = nodes[i];
c.x -= cx;
c.y -= cy;
cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));
}
node.r = cr;
nodes.forEach(d3_layout_packUnlink);
}
function d3_layout_packLink(node) {
node._pack_next = node._pack_prev = node;
}
function d3_layout_packUnlink(node) {
delete node._pack_next;
delete node._pack_prev;
}
function d3_layout_packTransform(node, x, y, k) {
var children = node.children;
node.x = x += k * node.x;
node.y = y += k * node.y;
node.r *= k;
if (children) {
var i = -1, n = children.length;
while (++i < n) d3_layout_packTransform(children[i], x, y, k);
}
}
function d3_layout_packPlace(a, b, c) {
var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;
if (db && (dx || dy)) {
var da = b.r + c.r, dc = dx * dx + dy * dy;
da *= da;
db *= db;
var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
c.x = a.x + x * dx + y * dy;
c.y = a.y + x * dy - y * dx;
} else {
c.x = a.x + db;
c.y = a.y;
}
}
d3.layout.cluster = function() {
var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
function cluster(d, i) {
var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0;
d3_layout_treeVisitAfter(root, function(node) {
var children = node.children;
if (children && children.length) {
node.x = d3_layout_clusterX(children);
node.y = d3_layout_clusterY(children);
} else {
node.x = previousNode ? x += separation(node, previousNode) : 0;
node.y = 0;
previousNode = node;
}
});
var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;
d3_layout_treeVisitAfter(root, function(node) {
node.x = (node.x - x0) / (x1 - x0) * size[0];
node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
});
return nodes;
}
cluster.separation = function(x) {
if (!arguments.length) return separation;
separation = x;
return cluster;
};
cluster.size = function(x) {
if (!arguments.length) return size;
size = x;
return cluster;
};
return d3_layout_hierarchyRebind(cluster, hierarchy);
};
function d3_layout_clusterY(children) {
return 1 + d3.max(children, function(child) {
return child.y;
});
}
function d3_layout_clusterX(children) {
return children.reduce(function(x, child) {
return x + child.x;
}, 0) / children.length;
}
function d3_layout_clusterLeft(node) {
var children = node.children;
return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
}
function d3_layout_clusterRight(node) {
var children = node.children, n;
return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
}
d3.layout.tree = function() {
var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
function tree(d, i) {
var nodes = hierarchy.call(this, d, i), root = nodes[0];
function firstWalk(node, previousSibling) {
var children = node.children, layout = node._tree;
if (children && (n = children.length)) {
var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1;
while (++i < n) {
child = children[i];
firstWalk(child, previousChild);
ancestor = apportion(child, previousChild, ancestor);
previousChild = child;
}
d3_layout_treeShift(node);
var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
if (previousSibling) {
layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
layout.mod = layout.prelim - midpoint;
} else {
layout.prelim = midpoint;
}
} else {
if (previousSibling) {
layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
}
}
}
function secondWalk(node, x) {
node.x = node._tree.prelim + x;
var children = node.children;
if (children && (n = children.length)) {
var i = -1, n;
x += node._tree.mod;
while (++i < n) {
secondWalk(children[i], x);
}
}
}
function apportion(node, previousSibling, ancestor) {
if (previousSibling) {
var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift;
while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
vom = d3_layout_treeLeft(vom);
vop = d3_layout_treeRight(vop);
vop._tree.ancestor = node;
shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
if (shift > 0) {
d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
sip += shift;
sop += shift;
}
sim += vim._tree.mod;
sip += vip._tree.mod;
som += vom._tree.mod;
sop += vop._tree.mod;
}
if (vim && !d3_layout_treeRight(vop)) {
vop._tree.thread = vim;
vop._tree.mod += sim - sop;
}
if (vip && !d3_layout_treeLeft(vom)) {
vom._tree.thread = vip;
vom._tree.mod += sip - som;
ancestor = node;
}
}
return ancestor;
}
d3_layout_treeVisitAfter(root, function(node, previousSibling) {
node._tree = {
ancestor: node,
prelim: 0,
mod: 0,
change: 0,
shift: 0,
number: previousSibling ? previousSibling._tree.number + 1 : 0
};
});
firstWalk(root);
secondWalk(root, -root._tree.prelim);
var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1;
d3_layout_treeVisitAfter(root, function(node) {
node.x = (node.x - x0) / (x1 - x0) * size[0];
node.y = node.depth / y1 * size[1];
delete node._tree;
});
return nodes;
}
tree.separation = function(x) {
if (!arguments.length) return separation;
separation = x;
return tree;
};
tree.size = function(x) {
if (!arguments.length) return size;
size = x;
return tree;
};
return d3_layout_hierarchyRebind(tree, hierarchy);
};
function d3_layout_treeSeparation(a, b) {
return a.parent == b.parent ? 1 : 2;
}
function d3_layout_treeLeft(node) {
var children = node.children;
return children && children.length ? children[0] : node._tree.thread;
}
function d3_layout_treeRight(node) {
var children = node.children, n;
return children && (n = children.length) ? children[n - 1] : node._tree.thread;
}
function d3_layout_treeSearch(node, compare) {
var children = node.children;
if (children && (n = children.length)) {
var child, n, i = -1;
while (++i < n) {
if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
node = child;
}
}
}
return node;
}
function d3_layout_treeRightmost(a, b) {
return a.x - b.x;
}
function d3_layout_treeLeftmost(a, b) {
return b.x - a.x;
}
function d3_layout_treeDeepest(a, b) {
return a.depth - b.depth;
}
function d3_layout_treeVisitAfter(node, callback) {
function visit(node, previousSibling) {
var children = node.children;
if (children && (n = children.length)) {
var child, previousChild = null, i = -1, n;
while (++i < n) {
child = children[i];
visit(child, previousChild);
previousChild = child;
}
}
callback(node, previousSibling);
}
visit(node, null);
}
function d3_layout_treeShift(node) {
var shift = 0, change = 0, children = node.children, i = children.length, child;
while (--i >= 0) {
child = children[i]._tree;
child.prelim += shift;
child.mod += shift;
shift += child.shift + (change += child.change);
}
}
function d3_layout_treeMove(ancestor, node, shift) {
ancestor = ancestor._tree;
node = node._tree;
var change = shift / (node.number - ancestor.number);
ancestor.change += change;
node.change -= change;
node.shift += shift;
node.prelim += shift;
node.mod += shift;
}
function d3_layout_treeAncestor(vim, node, ancestor) {
return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor;
}
d3.layout.treemap = function() {
var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = .5 * (1 + Math.sqrt(5));
function scale(children, k) {
var i = -1, n = children.length, child, area;
while (++i < n) {
area = (child = children[i]).value * (k < 0 ? 0 : k);
child.area = isNaN(area) || area <= 0 ? 0 : area;
}
}
function squarify(node) {
var children = node.children;
if (children && children.length) {
var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === "slice" ? rect.dx : mode === "dice" ? rect.dy : mode === "slice-dice" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n;
scale(remaining, rect.dx * rect.dy / node.value);
row.area = 0;
while ((n = remaining.length) > 0) {
row.push(child = remaining[n - 1]);
row.area += child.area;
if (mode !== "squarify" || (score = worst(row, u)) <= best) {
remaining.pop();
best = score;
} else {
row.area -= row.pop().area;
position(row, u, rect, false);
u = Math.min(rect.dx, rect.dy);
row.length = row.area = 0;
best = Infinity;
}
}
if (row.length) {
position(row, u, rect, true);
row.length = row.area = 0;
}
children.forEach(squarify);
}
}
function stickify(node) {
var children = node.children;
if (children && children.length) {
var rect = pad(node), remaining = children.slice(), child, row = [];
scale(remaining, rect.dx * rect.dy / node.value);
row.area = 0;
while (child = remaining.pop()) {
row.push(child);
row.area += child.area;
if (child.z != null) {
position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
row.length = row.area = 0;
}
}
children.forEach(stickify);
}
}
function worst(row, u) {
var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;
while (++i < n) {
if (!(r = row[i].area)) continue;
if (r < rmin) rmin = r;
if (r > rmax) rmax = r;
}
s *= s;
u *= u;
return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;
}
function position(row, u, rect, flush) {
var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;
if (u == rect.dx) {
if (flush || v > rect.dy) v = rect.dy;
while (++i < n) {
o = row[i];
o.x = x;
o.y = y;
o.dy = v;
x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
}
o.z = true;
o.dx += rect.x + rect.dx - x;
rect.y += v;
rect.dy -= v;
} else {
if (flush || v > rect.dx) v = rect.dx;
while (++i < n) {
o = row[i];
o.x = x;
o.y = y;
o.dx = v;
y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
}
o.z = false;
o.dy += rect.y + rect.dy - y;
rect.x += v;
rect.dx -= v;
}
}
function treemap(d) {
var nodes = stickies || hierarchy(d), root = nodes[0];
root.x = 0;
root.y = 0;
root.dx = size[0];
root.dy = size[1];
if (stickies) hierarchy.revalue(root);
scale([ root ], root.dx * root.dy / root.value);
(stickies ? stickify : squarify)(root);
if (sticky) stickies = nodes;
return nodes;
}
treemap.size = function(x) {
if (!arguments.length) return size;
size = x;
return treemap;
};
treemap.padding = function(x) {
if (!arguments.length) return padding;
function padFunction(node) {
var p = x.call(treemap, node, node.depth);
return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p);
}
function padConstant(node) {
return d3_layout_treemapPad(node, x);
}
var type;
pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ],
padConstant) : padConstant;
return treemap;
};
treemap.round = function(x) {
if (!arguments.length) return round != Number;
round = x ? Math.round : Number;
return treemap;
};
treemap.sticky = function(x) {
if (!arguments.length) return sticky;
sticky = x;
stickies = null;
return treemap;
};
treemap.ratio = function(x) {
if (!arguments.length) return ratio;
ratio = x;
return treemap;
};
treemap.mode = function(x) {
if (!arguments.length) return mode;
mode = x + "";
return treemap;
};
return d3_layout_hierarchyRebind(treemap, hierarchy);
};
function d3_layout_treemapPadNull(node) {
return {
x: node.x,
y: node.y,
dx: node.dx,
dy: node.dy
};
}
function d3_layout_treemapPad(node, padding) {
var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2];
if (dx < 0) {
x += dx / 2;
dx = 0;
}
if (dy < 0) {
y += dy / 2;
dy = 0;
}
return {
x: x,
y: y,
dx: dx,
dy: dy
};
}
function d3_dsv(delimiter, mimeType) {
var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);
function dsv(url, callback) {
return d3.xhr(url, mimeType, callback).response(response);
}
function response(request) {
return dsv.parse(request.responseText);
}
dsv.parse = function(text) {
var o;
return dsv.parseRows(text, function(row) {
if (o) return o(row);
o = new Function("d", "return {" + row.map(function(name, i) {
return JSON.stringify(name) + ": d[" + i + "]";
}).join(",") + "}");
});
};
dsv.parseRows = function(text, f) {
var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol;
function token() {
if (I >= N) return EOF;
if (eol) return eol = false, EOL;
var j = I;
if (text.charCodeAt(j) === 34) {
var i = j;
while (i++ < N) {
if (text.charCodeAt(i) === 34) {
if (text.charCodeAt(i + 1) !== 34) break;
++i;
}
}
I = i + 2;
var c = text.charCodeAt(i + 1);
if (c === 13) {
eol = true;
if (text.charCodeAt(i + 2) === 10) ++I;
} else if (c === 10) {
eol = true;
}
return text.substring(j + 1, i).replace(/""/g, '"');
}
while (I < N) {
var c = text.charCodeAt(I++), k = 1;
if (c === 10) eol = true; else if (c === 13) {
eol = true;
if (text.charCodeAt(I) === 10) ++I, ++k;
} else if (c !== delimiterCode) continue;
return text.substring(j, I - k);
}
return text.substring(j);
}
while ((t = token()) !== EOF) {
var a = [];
while (t !== EOL && t !== EOF) {
a.push(t);
t = token();
}
if (f && !(a = f(a, n++))) continue;
rows.push(a);
}
return rows;
};
dsv.format = function(rows) {
return rows.map(formatRow).join("\n");
};
function formatRow(row) {
return row.map(formatValue).join(delimiter);
}
function formatValue(text) {
return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text;
}
return dsv;
}
d3.csv = d3_dsv(",", "text/csv");
d3.tsv = d3_dsv(" ", "text/tab-separated-values");
d3.geo = {};
d3.geo.stream = function(object, listener) {
if (d3_geo_streamObjectType.hasOwnProperty(object.type)) {
d3_geo_streamObjectType[object.type](object, listener);
} else {
d3_geo_streamGeometry(object, listener);
}
};
function d3_geo_streamGeometry(geometry, listener) {
if (d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) {
d3_geo_streamGeometryType[geometry.type](geometry, listener);
}
}
var d3_geo_streamObjectType = {
Feature: function(feature, listener) {
d3_geo_streamGeometry(feature.geometry, listener);
},
FeatureCollection: function(object, listener) {
var features = object.features, i = -1, n = features.length;
while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener);
}
};
var d3_geo_streamGeometryType = {
Sphere: function(object, listener) {
listener.sphere();
},
Point: function(object, listener) {
var coordinate = object.coordinates;
listener.point(coordinate[0], coordinate[1]);
},
MultiPoint: function(object, listener) {
var coordinates = object.coordinates, i = -1, n = coordinates.length, coordinate;
while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1]);
},
LineString: function(object, listener) {
d3_geo_streamLine(object.coordinates, listener, 0);
},
MultiLineString: function(object, listener) {
var coordinates = object.coordinates, i = -1, n = coordinates.length;
while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0);
},
Polygon: function(object, listener) {
d3_geo_streamPolygon(object.coordinates, listener);
},
MultiPolygon: function(object, listener) {
var coordinates = object.coordinates, i = -1, n = coordinates.length;
while (++i < n) d3_geo_streamPolygon(coordinates[i], listener);
},
GeometryCollection: function(object, listener) {
var geometries = object.geometries, i = -1, n = geometries.length;
while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
}
};
function d3_geo_streamLine(coordinates, listener, closed) {
var i = -1, n = coordinates.length - closed, coordinate;
listener.lineStart();
while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1]);
listener.lineEnd();
}
function d3_geo_streamPolygon(coordinates, listener) {
var i = -1, n = coordinates.length;
listener.polygonStart();
while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1);
listener.polygonEnd();
}
function d3_geo_spherical(cartesian) {
return [ Math.atan2(cartesian[1], cartesian[0]), Math.asin(Math.max(-1, Math.min(1, cartesian[2]))) ];
}
function d3_geo_sphericalEqual(a, b) {
return Math.abs(a[0] - b[0]) < ε && Math.abs(a[1] - b[1]) < ε;
}
function d3_geo_cartesian(spherical) {
var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ);
return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ];
}
function d3_geo_cartesianDot(a, b) {
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}
function d3_geo_cartesianCross(a, b) {
return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ];
}
function d3_geo_cartesianAdd(a, b) {
a[0] += b[0];
a[1] += b[1];
a[2] += b[2];
}
function d3_geo_cartesianScale(vector, k) {
return [ vector[0] * k, vector[1] * k, vector[2] * k ];
}
function d3_geo_cartesianNormalize(d) {
var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
d[0] /= l;
d[1] /= l;
d[2] /= l;
}
function d3_geo_resample(project) {
var δ2 = .5, maxDepth = 16;
function resample(stream) {
var λ0, x0, y0, a0, b0, c0;
var resample = {
point: point,
lineStart: lineStart,
lineEnd: lineEnd,
polygonStart: function() {
stream.polygonStart();
resample.lineStart = polygonLineStart;
},
polygonEnd: function() {
stream.polygonEnd();
resample.lineStart = lineStart;
}
};
function point(x, y) {
x = project(x, y);
stream.point(x[0], x[1]);
}
function lineStart() {
x0 = NaN;
resample.point = linePoint;
stream.lineStart();
}
function linePoint(λ, φ) {
var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ);
resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);
stream.point(x0, y0);
}
function lineEnd() {
resample.point = point;
stream.lineEnd();
}
function polygonLineStart() {
var λ00, φ00, x00, y00, a00, b00, c00;
lineStart();
resample.point = function(λ, φ) {
linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;
resample.point = linePoint;
};
resample.lineEnd = function() {
resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream);
resample.lineEnd = lineEnd;
lineEnd();
};
}
return resample;
}
function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) {
var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;
if (d2 > 4 * δ2 && depth--) {
var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = Math.abs(Math.abs(c) - 1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2;
if (dz * dz / d2 > δ2 || Math.abs((dx * dx2 + dy * dy2) / d2 - .5) > .3) {
resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream);
stream.point(x2, y2);
resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream);
}
}
}
resample.precision = function(_) {
if (!arguments.length) return Math.sqrt(δ2);
maxDepth = (δ2 = _ * _) > 0 && 16;
return resample;
};
return resample;
}
d3.geo.albersUsa = function() {
var lower48 = d3.geo.albers();
var alaska = d3.geo.albers().rotate([ 160, 0 ]).center([ 0, 60 ]).parallels([ 55, 65 ]);
var hawaii = d3.geo.albers().rotate([ 160, 0 ]).center([ 0, 20 ]).parallels([ 8, 18 ]);
var puertoRico = d3.geo.albers().rotate([ 60, 0 ]).center([ 0, 10 ]).parallels([ 8, 18 ]);
function albersUsa(coordinates) {
return projection(coordinates)(coordinates);
}
function projection(point) {
var lon = point[0], lat = point[1];
return lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48;
}
albersUsa.scale = function(x) {
if (!arguments.length) return lower48.scale();
lower48.scale(x);
alaska.scale(x * .6);
hawaii.scale(x);
puertoRico.scale(x * 1.5);
return albersUsa.translate(lower48.translate());
};
albersUsa.translate = function(x) {
if (!arguments.length) return lower48.translate();
var dz = lower48.scale(), dx = x[0], dy = x[1];
lower48.translate(x);
alaska.translate([ dx - .4 * dz, dy + .17 * dz ]);
hawaii.translate([ dx - .19 * dz, dy + .2 * dz ]);
puertoRico.translate([ dx + .58 * dz, dy + .43 * dz ]);
return albersUsa;
};
return albersUsa.scale(lower48.scale());
};
function d3_geo_albers(φ0, φ1) {
var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), ρ0 = Math.sqrt(C) / n;
function albers(λ, φ) {
var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n;
return [ ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ) ];
}
albers.invert = function(x, y) {
var ρ0_y = ρ0 - y;
return [ Math.atan2(x, ρ0_y) / n, Math.asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ];
};
return albers;
}
(d3.geo.albers = function() {
var φ0 = 29.5 * d3_radians, φ1 = 45.5 * d3_radians, m = d3_geo_projectionMutator(d3_geo_albers), p = m(φ0, φ1);
p.parallels = function(_) {
if (!arguments.length) return [ φ0 * d3_degrees, φ1 * d3_degrees ];
return m(φ0 = _[0] * d3_radians, φ1 = _[1] * d3_radians);
};
return p.rotate([ 98, 0 ]).center([ 0, 38 ]).scale(1e3);
}).raw = d3_geo_albers;
var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) {
return Math.sqrt(2 / (1 + cosλcosφ));
}, function(ρ) {
return 2 * Math.asin(ρ / 2);
});
(d3.geo.azimuthalEqualArea = function() {
return d3_geo_projection(d3_geo_azimuthalEqualArea);
}).raw = d3_geo_azimuthalEqualArea;
var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) {
var c = Math.acos(cosλcosφ);
return c && c / Math.sin(c);
}, d3_identity);
(d3.geo.azimuthalEquidistant = function() {
return d3_geo_projection(d3_geo_azimuthalEquidistant);
}).raw = d3_geo_azimuthalEquidistant;
d3.geo.bounds = d3_geo_bounds(d3_identity);
function d3_geo_bounds(projectStream) {
var x0, y0, x1, y1;
var bound = {
point: boundPoint,
lineStart: d3_noop,
lineEnd: d3_noop,
polygonStart: function() {
bound.lineEnd = boundPolygonLineEnd;
},
polygonEnd: function() {
bound.point = boundPoint;
}
};
function boundPoint(x, y) {
if (x < x0) x0 = x;
if (x > x1) x1 = x;
if (y < y0) y0 = y;
if (y > y1) y1 = y;
}
function boundPolygonLineEnd() {
bound.point = bound.lineEnd = d3_noop;
}
return function(feature) {
y1 = x1 = -(x0 = y0 = Infinity);
d3.geo.stream(feature, projectStream(bound));
return [ [ x0, y0 ], [ x1, y1 ] ];
};
}
d3.geo.centroid = function(object) {
d3_geo_centroidDimension = d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
d3.geo.stream(object, d3_geo_centroid);
var m;
if (d3_geo_centroidW && Math.abs(m = Math.sqrt(d3_geo_centroidX * d3_geo_centroidX + d3_geo_centroidY * d3_geo_centroidY + d3_geo_centroidZ * d3_geo_centroidZ)) > ε) {
return [ Math.atan2(d3_geo_centroidY, d3_geo_centroidX) * d3_degrees, Math.asin(Math.max(-1, Math.min(1, d3_geo_centroidZ / m))) * d3_degrees ];
}
};
var d3_geo_centroidDimension, d3_geo_centroidW, d3_geo_centroidX, d3_geo_centroidY, d3_geo_centroidZ;
var d3_geo_centroid = {
sphere: function() {
if (d3_geo_centroidDimension < 2) {
d3_geo_centroidDimension = 2;
d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
}
},
point: d3_geo_centroidPoint,
lineStart: d3_geo_centroidLineStart,
lineEnd: d3_geo_centroidLineEnd,
polygonStart: function() {
if (d3_geo_centroidDimension < 2) {
d3_geo_centroidDimension = 2;
d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
}
d3_geo_centroid.lineStart = d3_geo_centroidRingStart;
},
polygonEnd: function() {
d3_geo_centroid.lineStart = d3_geo_centroidLineStart;
}
};
function d3_geo_centroidPoint(λ, φ) {
if (d3_geo_centroidDimension) return;
++d3_geo_centroidW;
λ *= d3_radians;
var cosφ = Math.cos(φ *= d3_radians);
d3_geo_centroidX += (cosφ * Math.cos(λ) - d3_geo_centroidX) / d3_geo_centroidW;
d3_geo_centroidY += (cosφ * Math.sin(λ) - d3_geo_centroidY) / d3_geo_centroidW;
d3_geo_centroidZ += (Math.sin(φ) - d3_geo_centroidZ) / d3_geo_centroidW;
}
function d3_geo_centroidRingStart() {
var λ00, φ00;
d3_geo_centroidDimension = 1;
d3_geo_centroidLineStart();
d3_geo_centroidDimension = 2;
var linePoint = d3_geo_centroid.point;
d3_geo_centroid.point = function(λ, φ) {
linePoint(λ00 = λ, φ00 = φ);
};
d3_geo_centroid.lineEnd = function() {
d3_geo_centroid.point(λ00, φ00);
d3_geo_centroidLineEnd();
d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd;
};
}
function d3_geo_centroidLineStart() {
var x0, y0, z0;
if (d3_geo_centroidDimension > 1) return;
if (d3_geo_centroidDimension < 1) {
d3_geo_centroidDimension = 1;
d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
}
d3_geo_centroid.point = function(λ, φ) {
λ *= d3_radians;
var cosφ = Math.cos(φ *= d3_radians);
x0 = cosφ * Math.cos(λ);
y0 = cosφ * Math.sin(λ);
z0 = Math.sin(φ);
d3_geo_centroid.point = nextPoint;
};
function nextPoint(λ, φ) {
λ *= d3_radians;
var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);
d3_geo_centroidW += w;
d3_geo_centroidX += w * (x0 + (x0 = x));
d3_geo_centroidY += w * (y0 + (y0 = y));
d3_geo_centroidZ += w * (z0 + (z0 = z));
}
}
function d3_geo_centroidLineEnd() {
d3_geo_centroid.point = d3_geo_centroidPoint;
}
d3.geo.circle = function() {
var origin = [ 0, 0 ], angle, precision = 6, interpolate;
function circle() {
var center = typeof origin === "function" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = [];
interpolate(null, null, 1, {
point: function(x, y) {
ring.push(x = rotate(x, y));
x[0] *= d3_degrees, x[1] *= d3_degrees;
}
});
return {
type: "Polygon",
coordinates: [ ring ]
};
}
circle.origin = function(x) {
if (!arguments.length) return origin;
origin = x;
return circle;
};
circle.angle = function(x) {
if (!arguments.length) return angle;
interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians);
return circle;
};
circle.precision = function(_) {
if (!arguments.length) return precision;
interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians);
return circle;
};
return circle.angle(90);
};
function d3_geo_circleInterpolate(radians, precision) {
var cr = Math.cos(radians), sr = Math.sin(radians);
return function(from, to, direction, listener) {
if (from != null) {
from = d3_geo_circleAngle(cr, from);
to = d3_geo_circleAngle(cr, to);
if (direction > 0 ? from < to : from > to) from += direction * 2 * π;
} else {
from = radians + direction * 2 * π;
to = radians;
}
var point;
for (var step = direction * precision, t = from; direction > 0 ? t > to : t < to; t -= step) {
listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]);
}
};
}
function d3_geo_circleAngle(cr, point) {
var a = d3_geo_cartesian(point);
a[0] -= cr;
d3_geo_cartesianNormalize(a);
var angle = Math.acos(Math.max(-1, Math.min(1, -a[1])));
return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI);
}
function d3_geo_clip(pointVisible, clipLine, interpolate) {
return function(listener) {
var line = clipLine(listener);
var clip = {
point: point,
lineStart: lineStart,
lineEnd: lineEnd,
polygonStart: function() {
clip.point = pointRing;
clip.lineStart = ringStart;
clip.lineEnd = ringEnd;
invisible = false;
invisibleArea = visibleArea = 0;
segments = [];
listener.polygonStart();
},
polygonEnd: function() {
clip.point = point;
clip.lineStart = lineStart;
clip.lineEnd = lineEnd;
segments = d3.merge(segments);
if (segments.length) {
d3_geo_clipPolygon(segments, interpolate, listener);
} else if (visibleArea < -ε || invisible && invisibleArea < -ε) {
listener.lineStart();
interpolate(null, null, 1, listener);
listener.lineEnd();
}
listener.polygonEnd();
segments = null;
},
sphere: function() {
listener.polygonStart();
listener.lineStart();
interpolate(null, null, 1, listener);
listener.lineEnd();
listener.polygonEnd();
}
};
function point(λ, φ) {
if (pointVisible(λ, φ)) listener.point(λ, φ);
}
function pointLine(λ, φ) {
line.point(λ, φ);
}
function lineStart() {
clip.point = pointLine;
line.lineStart();
}
function lineEnd() {
clip.point = point;
line.lineEnd();
}
var segments, visibleArea, invisibleArea, invisible;
var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), ring;
function pointRing(λ, φ) {
ringListener.point(λ, φ);
ring.push([ λ, φ ]);
}
function ringStart() {
ringListener.lineStart();
ring = [];
}
function ringEnd() {
pointRing(ring[0][0], ring[0][1]);
ringListener.lineEnd();
var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length;
if (!n) {
invisible = true;
invisibleArea += d3_geo_clipAreaRing(ring, -1);
ring = null;
return;
}
ring = null;
if (clean & 1) {
segment = ringSegments[0];
visibleArea += d3_geo_clipAreaRing(segment, 1);
var n = segment.length - 1, i = -1, point;
listener.lineStart();
while (++i < n) listener.point((point = segment[i])[0], point[1]);
listener.lineEnd();
return;
}
if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
segments.push(ringSegments.filter(d3_geo_clipSegmentLength1));
}
return clip;
};
}
function d3_geo_clipPolygon(segments, interpolate, listener) {
var subject = [], clip = [];
segments.forEach(function(segment) {
if ((n = segment.length) <= 1) return;
var n, p0 = segment[0], p1 = segment[n - 1];
if (d3_geo_sphericalEqual(p0, p1)) {
listener.lineStart();
for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]);
listener.lineEnd();
return;
}
var a = {
point: p0,
points: segment,
other: null,
visited: false,
entry: true,
subject: true
}, b = {
point: p0,
points: [ p0 ],
other: a,
visited: false,
entry: false,
subject: false
};
a.other = b;
subject.push(a);
clip.push(b);
a = {
point: p1,
points: [ p1 ],
other: null,
visited: false,
entry: false,
subject: true
};
b = {
point: p1,
points: [ p1 ],
other: a,
visited: false,
entry: true,
subject: false
};
a.other = b;
subject.push(a);
clip.push(b);
});
clip.sort(d3_geo_clipSort);
d3_geo_clipLinkCircular(subject);
d3_geo_clipLinkCircular(clip);
if (!subject.length) return;
var start = subject[0], current, points, point;
while (1) {
current = start;
while (current.visited) if ((current = current.next) === start) return;
points = current.points;
listener.lineStart();
do {
current.visited = current.other.visited = true;
if (current.entry) {
if (current.subject) {
for (var i = 0; i < points.length; i++) listener.point((point = points[i])[0], point[1]);
} else {
interpolate(current.point, current.next.point, 1, listener);
}
current = current.next;
} else {
if (current.subject) {
points = current.prev.points;
for (var i = points.length; --i >= 0; ) listener.point((point = points[i])[0], point[1]);
} else {
interpolate(current.point, current.prev.point, -1, listener);
}
current = current.prev;
}
current = current.other;
points = current.points;
} while (!current.visited);
listener.lineEnd();
}
}
function d3_geo_clipLinkCircular(array) {
if (!(n = array.length)) return;
var n, i = 0, a = array[0], b;
while (++i < n) {
a.next = b = array[i];
b.prev = a;
a = b;
}
a.next = b = array[0];
b.prev = a;
}
function d3_geo_clipSort(a, b) {
return ((a = a.point)[0] < 0 ? a[1] - π / 2 - ε : π / 2 - a[1]) - ((b = b.point)[0] < 0 ? b[1] - π / 2 - ε : π / 2 - b[1]);
}
function d3_geo_clipSegmentLength1(segment) {
return segment.length > 1;
}
function d3_geo_clipBufferListener() {
var lines = [], line;
return {
lineStart: function() {
lines.push(line = []);
},
point: function(λ, φ) {
line.push([ λ, φ ]);
},
lineEnd: d3_noop,
buffer: function() {
var buffer = lines;
lines = [];
line = null;
return buffer;
}
};
}
function d3_geo_clipAreaRing(ring, invisible) {
if (!(n = ring.length)) return 0;
var n, i = 0, area = 0, p = ring[0], λ = p[0], φ = p[1], cosφ = Math.cos(φ), x0 = Math.atan2(invisible * Math.sin(λ) * cosφ, Math.sin(φ)), y0 = 1 - invisible * Math.cos(λ) * cosφ, x1 = x0, x, y;
while (++i < n) {
p = ring[i];
cosφ = Math.cos(φ = p[1]);
x = Math.atan2(invisible * Math.sin(λ = p[0]) * cosφ, Math.sin(φ));
y = 1 - invisible * Math.cos(λ) * cosφ;
if (Math.abs(y0 - 2) < ε && Math.abs(y - 2) < ε) continue;
if (Math.abs(y) < ε || Math.abs(y0) < ε) {} else if (Math.abs(Math.abs(x - x0) - π) < ε) {
if (y + y0 > 2) area += 4 * (x - x0);
} else if (Math.abs(y0 - 2) < ε) area += 4 * (x - x1); else area += ((3 * π + x - x0) % (2 * π) - π) * (y0 + y);
x1 = x0, x0 = x, y0 = y;
}
return area;
}
var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate);
function d3_geo_clipAntimeridianLine(listener) {
var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean;
return {
lineStart: function() {
listener.lineStart();
clean = 1;
},
point: function(λ1, φ1) {
var sλ1 = λ1 > 0 ? π : -π, dλ = Math.abs(λ1 - λ0);
if (Math.abs(dλ - π) < ε) {
listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? π / 2 : -π / 2);
listener.point(sλ0, φ0);
listener.lineEnd();
listener.lineStart();
listener.point(sλ1, φ0);
listener.point(λ1, φ0);
clean = 0;
} else if (sλ0 !== sλ1 && dλ >= π) {
if (Math.abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε;
if (Math.abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε;
φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1);
listener.point(sλ0, φ0);
listener.lineEnd();
listener.lineStart();
listener.point(sλ1, φ0);
clean = 0;
}
listener.point(λ0 = λ1, φ0 = φ1);
sλ0 = sλ1;
},
lineEnd: function() {
listener.lineEnd();
λ0 = φ0 = NaN;
},
clean: function() {
return 2 - clean;
}
};
}
function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) {
var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1);
return Math.abs(sinλ0_λ1) > ε ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2;
}
function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) {
var φ;
if (from == null) {
φ = direction * π / 2;
listener.point(-π, φ);
listener.point(0, φ);
listener.point(π, φ);
listener.point(π, 0);
listener.point(π, -φ);
listener.point(0, -φ);
listener.point(-π, -φ);
listener.point(-π, 0);
listener.point(-π, φ);
} else if (Math.abs(from[0] - to[0]) > ε) {
var s = (from[0] < to[0] ? 1 : -1) * π;
φ = direction * s / 2;
listener.point(-s, φ);
listener.point(0, φ);
listener.point(s, φ);
} else {
listener.point(to[0], to[1]);
}
}
function d3_geo_clipCircle(degrees) {
var radians = degrees * d3_radians, cr = Math.cos(radians), interpolate = d3_geo_circleInterpolate(radians, 6 * d3_radians);
return d3_geo_clip(visible, clipLine, interpolate);
function visible(λ, φ) {
return Math.cos(λ) * Math.cos(φ) > cr;
}
function clipLine(listener) {
var point0, v0, v00, clean;
return {
lineStart: function() {
v00 = v0 = false;
clean = 1;
},
point: function(λ, φ) {
var point1 = [ λ, φ ], point2, v = visible(λ, φ);
if (!point0 && (v00 = v0 = v)) listener.lineStart();
if (v !== v0) {
point2 = intersect(point0, point1);
if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) {
point1[0] += ε;
point1[1] += ε;
v = visible(point1[0], point1[1]);
}
}
if (v !== v0) {
clean = 0;
if (v0 = v) {
listener.lineStart();
point2 = intersect(point1, point0);
listener.point(point2[0], point2[1]);
} else {
point2 = intersect(point0, point1);
listener.point(point2[0], point2[1]);
listener.lineEnd();
}
point0 = point2;
}
if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) listener.point(point1[0], point1[1]);
point0 = point1;
},
lineEnd: function() {
if (v0) listener.lineEnd();
point0 = null;
},
clean: function() {
return clean | (v00 && v0) << 1;
}
};
}
function intersect(a, b) {
var pa = d3_geo_cartesian(a, 0), pb = d3_geo_cartesian(b, 0);
var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
if (!determinant) return a;
var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2);
d3_geo_cartesianAdd(A, B);
var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t = Math.sqrt(w * w - uu * (d3_geo_cartesianDot(A, A) - 1)), q = d3_geo_cartesianScale(u, (-w - t) / uu);
d3_geo_cartesianAdd(q, A);
return d3_geo_spherical(q);
}
}
function d3_geo_compose(a, b) {
function compose(x, y) {
return x = a(x, y), b(x[0], x[1]);
}
if (a.invert && b.invert) compose.invert = function(x, y) {
return x = b.invert(x, y), x && a.invert(x[0], x[1]);
};
return compose;
}
function d3_geo_equirectangular(λ, φ) {
return [ λ, φ ];
}
(d3.geo.equirectangular = function() {
return d3_geo_projection(d3_geo_equirectangular).scale(250 / π);
}).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular;
var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) {
return 1 / cosλcosφ;
}, Math.atan);
(d3.geo.gnomonic = function() {
return d3_geo_projection(d3_geo_gnomonic);
}).raw = d3_geo_gnomonic;
d3.geo.graticule = function() {
var x1, x0, y1, y0, dx = 22.5, dy = dx, x, y, precision = 2.5;
function graticule() {
return {
type: "MultiLineString",
coordinates: lines()
};
}
function lines() {
return d3.range(Math.ceil(x0 / dx) * dx, x1, dx).map(x).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).map(y));
}
graticule.lines = function() {
return lines().map(function(coordinates) {
return {
type: "LineString",
coordinates: coordinates
};
});
};
graticule.outline = function() {
return {
type: "Polygon",
coordinates: [ x(x0).concat(y(y1).slice(1), x(x1).reverse().slice(1), y(y0).reverse().slice(1)) ]
};
};
graticule.extent = function(_) {
if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ];
x0 = +_[0][0], x1 = +_[1][0];
y0 = +_[0][1], y1 = +_[1][1];
if (x0 > x1) _ = x0, x0 = x1, x1 = _;
if (y0 > y1) _ = y0, y0 = y1, y1 = _;
return graticule.precision(precision);
};
graticule.step = function(_) {
if (!arguments.length) return [ dx, dy ];
dx = +_[0], dy = +_[1];
return graticule;
};
graticule.precision = function(_) {
if (!arguments.length) return precision;
precision = +_;
x = d3_geo_graticuleX(y0, y1, precision);
y = d3_geo_graticuleY(x0, x1, precision);
return graticule;
};
return graticule.extent([ [ -180 + ε, -90 + ε ], [ 180 - ε, 90 - ε ] ]);
};
function d3_geo_graticuleX(y0, y1, dy) {
var y = d3.range(y0, y1 - ε, dy).concat(y1);
return function(x) {
return y.map(function(y) {
return [ x, y ];
});
};
}
function d3_geo_graticuleY(x0, x1, dx) {
var x = d3.range(x0, x1 - ε, dx).concat(x1);
return function(y) {
return x.map(function(x) {
return [ x, y ];
});
};
}
function d3_geo_haversin(x) {
return (x = Math.sin(x / 2)) * x;
}
d3.geo.interpolate = function(source, target) {
return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians);
};
function d3_geo_interpolate(x0, y0, x1, y1) {
var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = 2 * Math.asin(Math.sqrt(d3_geo_haversin(y1 - y0) + cy0 * cy1 * d3_geo_haversin(x1 - x0))), k = 1 / Math.sin(d);
var interpolate = d ? function(t) {
var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;
return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ];
} : function() {
return [ x0 * d3_degrees, y0 * d3_degrees ];
};
interpolate.distance = d;
return interpolate;
}
d3.geo.greatArc = function() {
var source = d3_source, source_, target = d3_target, target_, precision = 6 * d3_radians, interpolate;
function greatArc() {
var p0 = source_ || source.apply(this, arguments), p1 = target_ || target.apply(this, arguments), i = interpolate || d3.geo.interpolate(p0, p1), t = 0, dt = precision / i.distance, coordinates = [ p0 ];
while ((t += dt) < 1) coordinates.push(i(t));
coordinates.push(p1);
return {
type: "LineString",
coordinates: coordinates
};
}
greatArc.distance = function() {
return (interpolate || d3.geo.interpolate(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments))).distance;
};
greatArc.source = function(_) {
if (!arguments.length) return source;
source = _, source_ = typeof _ === "function" ? null : _;
interpolate = source_ && target_ ? d3.geo.interpolate(source_, target_) : null;
return greatArc;
};
greatArc.target = function(_) {
if (!arguments.length) return target;
target = _, target_ = typeof _ === "function" ? null : _;
interpolate = source_ && target_ ? d3.geo.interpolate(source_, target_) : null;
return greatArc;
};
greatArc.precision = function(_) {
if (!arguments.length) return precision / d3_radians;
precision = _ * d3_radians;
return greatArc;
};
return greatArc;
};
function d3_geo_mercator(λ, φ) {
return [ λ / (2 * π), Math.max(-.5, Math.min(+.5, Math.log(Math.tan(π / 4 + φ / 2)) / (2 * π))) ];
}
d3_geo_mercator.invert = function(x, y) {
return [ 2 * π * x, 2 * Math.atan(Math.exp(2 * π * y)) - π / 2 ];
};
(d3.geo.mercator = function() {
return d3_geo_projection(d3_geo_mercator).scale(500);
}).raw = d3_geo_mercator;
var d3_geo_orthographic = d3_geo_azimuthal(function() {
return 1;
}, Math.asin);
(d3.geo.orthographic = function() {
return d3_geo_projection(d3_geo_orthographic);
}).raw = d3_geo_orthographic;
d3.geo.path = function() {
var pointRadius = 4.5, projection, context, projectStream, contextStream;
function path(object) {
if (object) d3.geo.stream(object, projectStream(contextStream.pointRadius(typeof pointRadius === "function" ? +pointRadius.apply(this, arguments) : pointRadius)));
return contextStream.result();
}
path.area = function(object) {
d3_geo_pathAreaSum = 0;
d3.geo.stream(object, projectStream(d3_geo_pathArea));
return d3_geo_pathAreaSum;
};
path.centroid = function(object) {
d3_geo_centroidDimension = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
d3.geo.stream(object, projectStream(d3_geo_pathCentroid));
return d3_geo_centroidZ ? [ d3_geo_centroidX / d3_geo_centroidZ, d3_geo_centroidY / d3_geo_centroidZ ] : undefined;
};
path.bounds = function(object) {
return d3_geo_bounds(projectStream)(object);
};
path.projection = function(_) {
if (!arguments.length) return projection;
projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity;
return path;
};
path.context = function(_) {
if (!arguments.length) return context;
contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_);
return path;
};
path.pointRadius = function(_) {
if (!arguments.length) return pointRadius;
pointRadius = typeof _ === "function" ? _ : +_;
return path;
};
return path.projection(d3.geo.albersUsa()).context(null);
};
function d3_geo_pathCircle(radius) {
return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + +2 * radius + "z";
}
function d3_geo_pathProjectStream(project) {
var resample = d3_geo_resample(function(λ, φ) {
return project([ λ * d3_degrees, φ * d3_degrees ]);
});
return function(stream) {
stream = resample(stream);
return {
point: function(λ, φ) {
stream.point(λ * d3_radians, φ * d3_radians);
},
sphere: function() {
stream.sphere();
},
lineStart: function() {
stream.lineStart();
},
lineEnd: function() {
stream.lineEnd();
},
polygonStart: function() {
stream.polygonStart();
},
polygonEnd: function() {
stream.polygonEnd();
}
};
};
}
function d3_geo_pathBuffer() {
var pointCircle = d3_geo_pathCircle(4.5), buffer = [];
var stream = {
point: point,
lineStart: function() {
stream.point = pointLineStart;
},
lineEnd: lineEnd,
polygonStart: function() {
stream.lineEnd = lineEndPolygon;
},
polygonEnd: function() {
stream.lineEnd = lineEnd;
stream.point = point;
},
pointRadius: function(_) {
pointCircle = d3_geo_pathCircle(_);
return stream;
},
result: function() {
if (buffer.length) {
var result = buffer.join("");
buffer = [];
return result;
}
}
};
function point(x, y) {
buffer.push("M", x, ",", y, pointCircle);
}
function pointLineStart(x, y) {
buffer.push("M", x, ",", y);
stream.point = pointLine;
}
function pointLine(x, y) {
buffer.push("L", x, ",", y);
}
function lineEnd() {
stream.point = point;
}
function lineEndPolygon() {
buffer.push("Z");
}
return stream;
}
function d3_geo_pathContext(context) {
var pointRadius = 4.5;
var stream = {
point: point,
lineStart: function() {
stream.point = pointLineStart;
},
lineEnd: lineEnd,
polygonStart: function() {
stream.lineEnd = lineEndPolygon;
},
polygonEnd: function() {
stream.lineEnd = lineEnd;
stream.point = point;
},
pointRadius: function(_) {
pointRadius = _;
return stream;
},
result: d3_noop
};
function point(x, y) {
context.moveTo(x, y);
context.arc(x, y, pointRadius, 0, 2 * π);
}
function pointLineStart(x, y) {
context.moveTo(x, y);
stream.point = pointLine;
}
function pointLine(x, y) {
context.lineTo(x, y);
}
function lineEnd() {
stream.point = point;
}
function lineEndPolygon() {
context.closePath();
}
return stream;
}
var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = {
point: d3_noop,
lineStart: d3_noop,
lineEnd: d3_noop,
polygonStart: function() {
d3_geo_pathAreaPolygon = 0;
d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart;
},
polygonEnd: function() {
d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop;
d3_geo_pathAreaSum += Math.abs(d3_geo_pathAreaPolygon / 2);
}
};
function d3_geo_pathAreaRingStart() {
var x00, y00, x0, y0;
d3_geo_pathArea.point = function(x, y) {
d3_geo_pathArea.point = nextPoint;
x00 = x0 = x, y00 = y0 = y;
};
function nextPoint(x, y) {
d3_geo_pathAreaPolygon += y0 * x - x0 * y;
x0 = x, y0 = y;
}
d3_geo_pathArea.lineEnd = function() {
nextPoint(x00, y00);
};
}
var d3_geo_pathCentroid = {
point: d3_geo_pathCentroidPoint,
lineStart: d3_geo_pathCentroidLineStart,
lineEnd: d3_geo_pathCentroidLineEnd,
polygonStart: function() {
d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart;
},
polygonEnd: function() {
d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;
d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart;
d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd;
}
};
function d3_geo_pathCentroidPoint(x, y) {
if (d3_geo_centroidDimension) return;
d3_geo_centroidX += x;
d3_geo_centroidY += y;
++d3_geo_centroidZ;
}
function d3_geo_pathCentroidLineStart() {
var x0, y0;
if (d3_geo_centroidDimension !== 1) {
if (d3_geo_centroidDimension < 1) {
d3_geo_centroidDimension = 1;
d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
} else return;
}
d3_geo_pathCentroid.point = function(x, y) {
d3_geo_pathCentroid.point = nextPoint;
x0 = x, y0 = y;
};
function nextPoint(x, y) {
var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy);
d3_geo_centroidX += z * (x0 + x) / 2;
d3_geo_centroidY += z * (y0 + y) / 2;
d3_geo_centroidZ += z;
x0 = x, y0 = y;
}
}
function d3_geo_pathCentroidLineEnd() {
d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;
}
function d3_geo_pathCentroidRingStart() {
var x00, y00, x0, y0;
if (d3_geo_centroidDimension < 2) {
d3_geo_centroidDimension = 2;
d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
}
d3_geo_pathCentroid.point = function(x, y) {
d3_geo_pathCentroid.point = nextPoint;
x00 = x0 = x, y00 = y0 = y;
};
function nextPoint(x, y) {
var z = y0 * x - x0 * y;
d3_geo_centroidX += z * (x0 + x);
d3_geo_centroidY += z * (y0 + y);
d3_geo_centroidZ += z * 3;
x0 = x, y0 = y;
}
d3_geo_pathCentroid.lineEnd = function() {
nextPoint(x00, y00);
};
}
d3.geo.area = function(object) {
d3_geo_areaSum = 0;
d3.geo.stream(object, d3_geo_area);
return d3_geo_areaSum;
};
var d3_geo_areaSum, d3_geo_areaRingU, d3_geo_areaRingV;
var d3_geo_area = {
sphere: function() {
d3_geo_areaSum += 4 * π;
},
point: d3_noop,
lineStart: d3_noop,
lineEnd: d3_noop,
polygonStart: function() {
d3_geo_areaRingU = 1, d3_geo_areaRingV = 0;
d3_geo_area.lineStart = d3_geo_areaRingStart;
},
polygonEnd: function() {
var area = 2 * Math.atan2(d3_geo_areaRingV, d3_geo_areaRingU);
d3_geo_areaSum += area < 0 ? 4 * π + area : area;
d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop;
}
};
function d3_geo_areaRingStart() {
var λ00, φ00, λ0, cosφ0, sinφ0;
d3_geo_area.point = function(λ, φ) {
d3_geo_area.point = nextPoint;
λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4),
sinφ0 = Math.sin(φ);
};
function nextPoint(λ, φ) {
λ *= d3_radians;
φ = φ * d3_radians / 2 + π / 4;
var dλ = λ - λ0, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u0 = d3_geo_areaRingU, v0 = d3_geo_areaRingV, u = cosφ0 * cosφ + k * Math.cos(dλ), v = k * Math.sin(dλ);
d3_geo_areaRingU = u0 * u - v0 * v;
d3_geo_areaRingV = v0 * u + u0 * v;
λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ;
}
d3_geo_area.lineEnd = function() {
nextPoint(λ00, φ00);
};
}
d3.geo.projection = d3_geo_projection;
d3.geo.projectionMutator = d3_geo_projectionMutator;
function d3_geo_projection(project) {
return d3_geo_projectionMutator(function() {
return project;
})();
}
function d3_geo_projectionMutator(projectAt) {
var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) {
x = project(x, y);
return [ x[0] * k + δx, δy - x[1] * k ];
}), k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, clip = d3_geo_clipAntimeridian, clipAngle = null;
function projection(point) {
point = projectRotate(point[0] * d3_radians, point[1] * d3_radians);
return [ point[0] * k + δx, δy - point[1] * k ];
}
function invert(point) {
point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k);
return point && [ point[0] * d3_degrees, point[1] * d3_degrees ];
}
projection.stream = function(stream) {
return d3_geo_projectionRadiansRotate(rotate, clip(projectResample(stream)));
};
projection.clipAngle = function(_) {
if (!arguments.length) return clipAngle;
clip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle(clipAngle = +_);
return projection;
};
projection.scale = function(_) {
if (!arguments.length) return k;
k = +_;
return reset();
};
projection.translate = function(_) {
if (!arguments.length) return [ x, y ];
x = +_[0];
y = +_[1];
return reset();
};
projection.center = function(_) {
if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ];
λ = _[0] % 360 * d3_radians;
φ = _[1] % 360 * d3_radians;
return reset();
};
projection.rotate = function(_) {
if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ];
δλ = _[0] % 360 * d3_radians;
δφ = _[1] % 360 * d3_radians;
δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0;
return reset();
};
d3.rebind(projection, projectResample, "precision");
function reset() {
projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project);
var center = project(λ, φ);
δx = x - center[0] * k;
δy = y + center[1] * k;
return projection;
}
return function() {
project = projectAt.apply(this, arguments);
projection.invert = project.invert && invert;
return reset();
};
}
function d3_geo_projectionRadiansRotate(rotate, stream) {
return {
point: function(x, y) {
y = rotate(x * d3_radians, y * d3_radians), x = y[0];
stream.point(x > π ? x - 2 * π : x < -π ? x + 2 * π : x, y[1]);
},
sphere: function() {
stream.sphere();
},
lineStart: function() {
stream.lineStart();
},
lineEnd: function() {
stream.lineEnd();
},
polygonStart: function() {
stream.polygonStart();
},
polygonEnd: function() {
stream.polygonEnd();
}
};
}
function d3_geo_rotation(δλ, δφ, δγ) {
return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_equirectangular;
}
function d3_geo_forwardRotationλ(δλ) {
return function(λ, φ) {
return λ += δλ, [ λ > π ? λ - 2 * π : λ < -π ? λ + 2 * π : λ, φ ];
};
}
function d3_geo_rotationλ(δλ) {
var rotation = d3_geo_forwardRotationλ(δλ);
rotation.invert = d3_geo_forwardRotationλ(-δλ);
return rotation;
}
function d3_geo_rotationφγ(δφ, δγ) {
var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ);
function rotation(λ, φ) {
var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ;
return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), Math.asin(Math.max(-1, Math.min(1, k * cosδγ + y * sinδγ))) ];
}
rotation.invert = function(λ, φ) {
var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ;
return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), Math.asin(Math.max(-1, Math.min(1, k * cosδφ - x * sinδφ))) ];
};
return rotation;
}
var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) {
return 1 / (1 + cosλcosφ);
}, function(ρ) {
return 2 * Math.atan(ρ);
});
(d3.geo.stereographic = function() {
return d3_geo_projection(d3_geo_stereographic);
}).raw = d3_geo_stereographic;
function d3_geo_azimuthal(scale, angle) {
function azimuthal(λ, φ) {
var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ);
return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ];
}
azimuthal.invert = function(x, y) {
var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c);
return [ Math.atan2(x * sinc, ρ * cosc), Math.asin(ρ && y * sinc / ρ) ];
};
return azimuthal;
}
d3.geom = {};
d3.geom.hull = function(vertices) {
if (vertices.length < 3) return [];
var len = vertices.length, plen = len - 1, points = [], stack = [], i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
for (i = 1; i < len; ++i) {
if (vertices[i][1] < vertices[h][1]) {
h = i;
} else if (vertices[i][1] == vertices[h][1]) {
h = vertices[i][0] < vertices[h][0] ? i : h;
}
}
for (i = 0; i < len; ++i) {
if (i === h) continue;
y1 = vertices[i][1] - vertices[h][1];
x1 = vertices[i][0] - vertices[h][0];
points.push({
angle: Math.atan2(y1, x1),
index: i
});
}
points.sort(function(a, b) {
return a.angle - b.angle;
});
a = points[0].angle;
v = points[0].index;
u = 0;
for (i = 1; i < plen; ++i) {
j = points[i].index;
if (a == points[i].angle) {
x1 = vertices[v][0] - vertices[h][0];
y1 = vertices[v][1] - vertices[h][1];
x2 = vertices[j][0] - vertices[h][0];
y2 = vertices[j][1] - vertices[h][1];
if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) {
points[i].index = -1;
} else {
points[u].index = -1;
a = points[i].angle;
u = i;
v = j;
}
} else {
a = points[i].angle;
u = i;
v = j;
}
}
stack.push(h);
for (i = 0, j = 0; i < 2; ++j) {
if (points[j].index !== -1) {
stack.push(points[j].index);
i++;
}
}
sp = stack.length;
for (;j < plen; ++j) {
if (points[j].index === -1) continue;
while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) {
--sp;
}
stack[sp++] = points[j].index;
}
var poly = [];
for (i = 0; i < sp; ++i) {
poly.push(vertices[stack[i]]);
}
return poly;
};
function d3_geom_hullCCW(i1, i2, i3, v) {
var t, a, b, c, d, e, f;
t = v[i1];
a = t[0];
b = t[1];
t = v[i2];
c = t[0];
d = t[1];
t = v[i3];
e = t[0];
f = t[1];
return (f - b) * (c - a) - (d - b) * (e - a) > 0;
}
d3.geom.polygon = function(coordinates) {
coordinates.area = function() {
var i = 0, n = coordinates.length, area = coordinates[n - 1][1] * coordinates[0][0] - coordinates[n - 1][0] * coordinates[0][1];
while (++i < n) {
area += coordinates[i - 1][1] * coordinates[i][0] - coordinates[i - 1][0] * coordinates[i][1];
}
return area * .5;
};
coordinates.centroid = function(k) {
var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c;
if (!arguments.length) k = -1 / (6 * coordinates.area());
while (++i < n) {
a = b;
b = coordinates[i];
c = a[0] * b[1] - b[0] * a[1];
x += (a[0] + b[0]) * c;
y += (a[1] + b[1]) * c;
}
return [ x * k, y * k ];
};
coordinates.clip = function(subject) {
var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d;
while (++i < n) {
input = subject.slice();
subject.length = 0;
b = coordinates[i];
c = input[(m = input.length) - 1];
j = -1;
while (++j < m) {
d = input[j];
if (d3_geom_polygonInside(d, a, b)) {
if (!d3_geom_polygonInside(c, a, b)) {
subject.push(d3_geom_polygonIntersect(c, d, a, b));
}
subject.push(d);
} else if (d3_geom_polygonInside(c, a, b)) {
subject.push(d3_geom_polygonIntersect(c, d, a, b));
}
c = d;
}
a = b;
}
return subject;
};
return coordinates;
};
function d3_geom_polygonInside(p, a, b) {
return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
}
function d3_geom_polygonIntersect(c, d, a, b) {
var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21);
return [ x1 + ua * x21, y1 + ua * y21 ];
}
d3.geom.voronoi = function(vertices) {
var polygons = vertices.map(function() {
return [];
}), Z = 1e6;
d3_voronoi_tessellate(vertices, function(e) {
var s1, s2, x1, x2, y1, y2;
if (e.a === 1 && e.b >= 0) {
s1 = e.ep.r;
s2 = e.ep.l;
} else {
s1 = e.ep.l;
s2 = e.ep.r;
}
if (e.a === 1) {
y1 = s1 ? s1.y : -Z;
x1 = e.c - e.b * y1;
y2 = s2 ? s2.y : Z;
x2 = e.c - e.b * y2;
} else {
x1 = s1 ? s1.x : -Z;
y1 = e.c - e.a * x1;
x2 = s2 ? s2.x : Z;
y2 = e.c - e.a * x2;
}
var v1 = [ x1, y1 ], v2 = [ x2, y2 ];
polygons[e.region.l.index].push(v1, v2);
polygons[e.region.r.index].push(v1, v2);
});
polygons = polygons.map(function(polygon, i) {
var cx = vertices[i][0], cy = vertices[i][1], angle = polygon.map(function(v) {
return Math.atan2(v[0] - cx, v[1] - cy);
}), order = d3.range(polygon.length).sort(function(a, b) {
return angle[a] - angle[b];
});
return order.filter(function(d, i) {
return !i || angle[d] - angle[order[i - 1]] > ε;
}).map(function(d) {
return polygon[d];
});
});
polygons.forEach(function(polygon, i) {
var n = polygon.length;
if (!n) return polygon.push([ -Z, -Z ], [ -Z, Z ], [ Z, Z ], [ Z, -Z ]);
if (n > 2) return;
var p0 = vertices[i], p1 = polygon[0], p2 = polygon[1], x0 = p0[0], y0 = p0[1], x1 = p1[0], y1 = p1[1], x2 = p2[0], y2 = p2[1], dx = Math.abs(x2 - x1), dy = y2 - y1;
if (Math.abs(dy) < ε) {
var y = y0 < y1 ? -Z : Z;
polygon.push([ -Z, y ], [ Z, y ]);
} else if (dx < ε) {
var x = x0 < x1 ? -Z : Z;
polygon.push([ x, -Z ], [ x, Z ]);
} else {
var y = (x2 - x1) * (y1 - y0) < (x1 - x0) * (y2 - y1) ? Z : -Z, z = Math.abs(dy) - dx;
if (Math.abs(z) < ε) {
polygon.push([ dy < 0 ? y : -y, y ]);
} else {
if (z > 0) y *= -1;
polygon.push([ -Z, y ], [ Z, y ]);
}
}
});
return polygons;
};
var d3_voronoi_opposite = {
l: "r",
r: "l"
};
function d3_voronoi_tessellate(vertices, callback) {
var Sites = {
list: vertices.map(function(v, i) {
return {
index: i,
x: v[0],
y: v[1]
};
}).sort(function(a, b) {
return a.y < b.y ? -1 : a.y > b.y ? 1 : a.x < b.x ? -1 : a.x > b.x ? 1 : 0;
}),
bottomSite: null
};
var EdgeList = {
list: [],
leftEnd: null,
rightEnd: null,
init: function() {
EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
EdgeList.leftEnd.r = EdgeList.rightEnd;
EdgeList.rightEnd.l = EdgeList.leftEnd;
EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
},
createHalfEdge: function(edge, side) {
return {
edge: edge,
side: side,
vertex: null,
l: null,
r: null
};
},
insert: function(lb, he) {
he.l = lb;
he.r = lb.r;
lb.r.l = he;
lb.r = he;
},
leftBound: function(p) {
var he = EdgeList.leftEnd;
do {
he = he.r;
} while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
he = he.l;
return he;
},
del: function(he) {
he.l.r = he.r;
he.r.l = he.l;
he.edge = null;
},
right: function(he) {
return he.r;
},
left: function(he) {
return he.l;
},
leftRegion: function(he) {
return he.edge == null ? Sites.bottomSite : he.edge.region[he.side];
},
rightRegion: function(he) {
return he.edge == null ? Sites.bottomSite : he.edge.region[d3_voronoi_opposite[he.side]];
}
};
var Geom = {
bisect: function(s1, s2) {
var newEdge = {
region: {
l: s1,
r: s2
},
ep: {
l: null,
r: null
}
};
var dx = s2.x - s1.x, dy = s2.y - s1.y, adx = dx > 0 ? dx : -dx, ady = dy > 0 ? dy : -dy;
newEdge.c = s1.x * dx + s1.y * dy + (dx * dx + dy * dy) * .5;
if (adx > ady) {
newEdge.a = 1;
newEdge.b = dy / dx;
newEdge.c /= dx;
} else {
newEdge.b = 1;
newEdge.a = dx / dy;
newEdge.c /= dy;
}
return newEdge;
},
intersect: function(el1, el2) {
var e1 = el1.edge, e2 = el2.edge;
if (!e1 || !e2 || e1.region.r == e2.region.r) {
return null;
}
var d = e1.a * e2.b - e1.b * e2.a;
if (Math.abs(d) < 1e-10) {
return null;
}
var xint = (e1.c * e2.b - e2.c * e1.b) / d, yint = (e2.c * e1.a - e1.c * e2.a) / d, e1r = e1.region.r, e2r = e2.region.r, el, e;
if (e1r.y < e2r.y || e1r.y == e2r.y && e1r.x < e2r.x) {
el = el1;
e = e1;
} else {
el = el2;
e = e2;
}
var rightOfSite = xint >= e.region.r.x;
if (rightOfSite && el.side === "l" || !rightOfSite && el.side === "r") {
return null;
}
return {
x: xint,
y: yint
};
},
rightOf: function(he, p) {
var e = he.edge, topsite = e.region.r, rightOfSite = p.x > topsite.x;
if (rightOfSite && he.side === "l") {
return 1;
}
if (!rightOfSite && he.side === "r") {
return 0;
}
if (e.a === 1) {
var dyp = p.y - topsite.y, dxp = p.x - topsite.x, fast = 0, above = 0;
if (!rightOfSite && e.b < 0 || rightOfSite && e.b >= 0) {
above = fast = dyp >= e.b * dxp;
} else {
above = p.x + p.y * e.b > e.c;
if (e.b < 0) {
above = !above;
}
if (!above) {
fast = 1;
}
}
if (!fast) {
var dxs = topsite.x - e.region.l.x;
above = e.b * (dxp * dxp - dyp * dyp) < dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b);
if (e.b < 0) {
above = !above;
}
}
} else {
var yl = e.c - e.a * p.x, t1 = p.y - yl, t2 = p.x - topsite.x, t3 = yl - topsite.y;
above = t1 * t1 > t2 * t2 + t3 * t3;
}
return he.side === "l" ? above : !above;
},
endPoint: function(edge, side, site) {
edge.ep[side] = site;
if (!edge.ep[d3_voronoi_opposite[side]]) return;
callback(edge);
},
distance: function(s, t) {
var dx = s.x - t.x, dy = s.y - t.y;
return Math.sqrt(dx * dx + dy * dy);
}
};
var EventQueue = {
list: [],
insert: function(he, site, offset) {
he.vertex = site;
he.ystar = site.y + offset;
for (var i = 0, list = EventQueue.list, l = list.length; i < l; i++) {
var next = list[i];
if (he.ystar > next.ystar || he.ystar == next.ystar && site.x > next.vertex.x) {
continue;
} else {
break;
}
}
list.splice(i, 0, he);
},
del: function(he) {
for (var i = 0, ls = EventQueue.list, l = ls.length; i < l && ls[i] != he; ++i) {}
ls.splice(i, 1);
},
empty: function() {
return EventQueue.list.length === 0;
},
nextEvent: function(he) {
for (var i = 0, ls = EventQueue.list, l = ls.length; i < l; ++i) {
if (ls[i] == he) return ls[i + 1];
}
return null;
},
min: function() {
var elem = EventQueue.list[0];
return {
x: elem.vertex.x,
y: elem.ystar
};
},
extractMin: function() {
return EventQueue.list.shift();
}
};
EdgeList.init();
Sites.bottomSite = Sites.list.shift();
var newSite = Sites.list.shift(), newIntStar;
var lbnd, rbnd, llbnd, rrbnd, bisector;
var bot, top, temp, p, v;
var e, pm;
while (true) {
if (!EventQueue.empty()) {
newIntStar = EventQueue.min();
}
if (newSite && (EventQueue.empty() || newSite.y < newIntStar.y || newSite.y == newIntStar.y && newSite.x < newIntStar.x)) {
lbnd = EdgeList.leftBound(newSite);
rbnd = EdgeList.right(lbnd);
bot = EdgeList.rightRegion(lbnd);
e = Geom.bisect(bot, newSite);
bisector = EdgeList.createHalfEdge(e, "l");
EdgeList.insert(lbnd, bisector);
p = Geom.intersect(lbnd, bisector);
if (p) {
EventQueue.del(lbnd);
EventQueue.insert(lbnd, p, Geom.distance(p, newSite));
}
lbnd = bisector;
bisector = EdgeList.createHalfEdge(e, "r");
EdgeList.insert(lbnd, bisector);
p = Geom.intersect(bisector, rbnd);
if (p) {
EventQueue.insert(bisector, p, Geom.distance(p, newSite));
}
newSite = Sites.list.shift();
} else if (!EventQueue.empty()) {
lbnd = EventQueue.extractMin();
llbnd = EdgeList.left(lbnd);
rbnd = EdgeList.right(lbnd);
rrbnd = EdgeList.right(rbnd);
bot = EdgeList.leftRegion(lbnd);
top = EdgeList.rightRegion(rbnd);
v = lbnd.vertex;
Geom.endPoint(lbnd.edge, lbnd.side, v);
Geom.endPoint(rbnd.edge, rbnd.side, v);
EdgeList.del(lbnd);
EventQueue.del(rbnd);
EdgeList.del(rbnd);
pm = "l";
if (bot.y > top.y) {
temp = bot;
bot = top;
top = temp;
pm = "r";
}
e = Geom.bisect(bot, top);
bisector = EdgeList.createHalfEdge(e, pm);
EdgeList.insert(llbnd, bisector);
Geom.endPoint(e, d3_voronoi_opposite[pm], v);
p = Geom.intersect(llbnd, bisector);
if (p) {
EventQueue.del(llbnd);
EventQueue.insert(llbnd, p, Geom.distance(p, bot));
}
p = Geom.intersect(bisector, rrbnd);
if (p) {
EventQueue.insert(bisector, p, Geom.distance(p, bot));
}
} else {
break;
}
}
for (lbnd = EdgeList.right(EdgeList.leftEnd); lbnd != EdgeList.rightEnd; lbnd = EdgeList.right(lbnd)) {
callback(lbnd.edge);
}
}
d3.geom.delaunay = function(vertices) {
var edges = vertices.map(function() {
return [];
}), triangles = [];
d3_voronoi_tessellate(vertices, function(e) {
edges[e.region.l.index].push(vertices[e.region.r.index]);
});
edges.forEach(function(edge, i) {
var v = vertices[i], cx = v[0], cy = v[1];
edge.forEach(function(v) {
v.angle = Math.atan2(v[0] - cx, v[1] - cy);
});
edge.sort(function(a, b) {
return a.angle - b.angle;
});
for (var j = 0, m = edge.length - 1; j < m; j++) {
triangles.push([ v, edge[j], edge[j + 1] ]);
}
});
return triangles;
};
d3.geom.quadtree = function(points, x1, y1, x2, y2) {
var p, i = -1, n = points.length;
if (arguments.length < 5) {
if (arguments.length === 3) {
y2 = y1;
x2 = x1;
y1 = x1 = 0;
} else {
x1 = y1 = Infinity;
x2 = y2 = -Infinity;
while (++i < n) {
p = points[i];
if (p.x < x1) x1 = p.x;
if (p.y < y1) y1 = p.y;
if (p.x > x2) x2 = p.x;
if (p.y > y2) y2 = p.y;
}
}
}
var dx = x2 - x1, dy = y2 - y1;
if (dx > dy) y2 = y1 + dx; else x2 = x1 + dy;
function insert(n, p, x1, y1, x2, y2) {
if (isNaN(p.x) || isNaN(p.y)) return;
if (n.leaf) {
var v = n.point;
if (v) {
if (Math.abs(v.x - p.x) + Math.abs(v.y - p.y) < .01) {
insertChild(n, p, x1, y1, x2, y2);
} else {
n.point = null;
insertChild(n, v, x1, y1, x2, y2);
insertChild(n, p, x1, y1, x2, y2);
}
} else {
n.point = p;
}
} else {
insertChild(n, p, x1, y1, x2, y2);
}
}
function insertChild(n, p, x1, y1, x2, y2) {
var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = p.x >= sx, bottom = p.y >= sy, i = (bottom << 1) + right;
n.leaf = false;
n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
if (right) x1 = sx; else x2 = sx;
if (bottom) y1 = sy; else y2 = sy;
insert(n, p, x1, y1, x2, y2);
}
var root = d3_geom_quadtreeNode();
root.add = function(p) {
insert(root, p, x1, y1, x2, y2);
};
root.visit = function(f) {
d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
};
points.forEach(root.add);
return root;
};
function d3_geom_quadtreeNode() {
return {
leaf: true,
nodes: [],
point: null
};
}
function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
if (!f(node, x1, y1, x2, y2)) {
var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes;
if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
}
}
d3.time = {};
var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
function d3_time_utc() {
this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]);
}
d3_time_utc.prototype = {
getDate: function() {
return this._.getUTCDate();
},
getDay: function() {
return this._.getUTCDay();
},
getFullYear: function() {
return this._.getUTCFullYear();
},
getHours: function() {
return this._.getUTCHours();
},
getMilliseconds: function() {
return this._.getUTCMilliseconds();
},
getMinutes: function() {
return this._.getUTCMinutes();
},
getMonth: function() {
return this._.getUTCMonth();
},
getSeconds: function() {
return this._.getUTCSeconds();
},
getTime: function() {
return this._.getTime();
},
getTimezoneOffset: function() {
return 0;
},
valueOf: function() {
return this._.valueOf();
},
setDate: function() {
d3_time_prototype.setUTCDate.apply(this._, arguments);
},
setDay: function() {
d3_time_prototype.setUTCDay.apply(this._, arguments);
},
setFullYear: function() {
d3_time_prototype.setUTCFullYear.apply(this._, arguments);
},
setHours: function() {
d3_time_prototype.setUTCHours.apply(this._, arguments);
},
setMilliseconds: function() {
d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);
},
setMinutes: function() {
d3_time_prototype.setUTCMinutes.apply(this._, arguments);
},
setMonth: function() {
d3_time_prototype.setUTCMonth.apply(this._, arguments);
},
setSeconds: function() {
d3_time_prototype.setUTCSeconds.apply(this._, arguments);
},
setTime: function() {
d3_time_prototype.setTime.apply(this._, arguments);
}
};
var d3_time_prototype = Date.prototype;
var d3_time_formatDateTime = "%a %b %e %X %Y", d3_time_formatDate = "%m/%d/%Y", d3_time_formatTime = "%H:%M:%S";
var d3_time_days = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], d3_time_dayAbbreviations = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
d3.time.format = function(template) {
var n = template.length;
function format(date) {
var string = [], i = -1, j = 0, c, p, f;
while (++i < n) {
if (template.charCodeAt(i) === 37) {
string.push(template.substring(j, i));
if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i);
if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p);
string.push(c);
j = i + 1;
}
}
string.push(template.substring(j, i));
return string.join("");
}
format.parse = function(string) {
var d = {
y: 1900,
m: 0,
d: 1,
H: 0,
M: 0,
S: 0,
L: 0
}, i = d3_time_parse(d, template, string, 0);
if (i != string.length) return null;
if ("p" in d) d.H = d.H % 12 + d.p * 12;
var date = new d3_time();
date.setFullYear(d.y, d.m, d.d);
date.setHours(d.H, d.M, d.S, d.L);
return date;
};
format.toString = function() {
return template;
};
return format;
};
function d3_time_parse(date, template, string, j) {
var c, p, i = 0, n = template.length, m = string.length;
while (i < n) {
if (j >= m) return -1;
c = template.charCodeAt(i++);
if (c === 37) {
p = d3_time_parsers[template.charAt(i++)];
if (!p || (j = p(date, string, j)) < 0) return -1;
} else if (c != string.charCodeAt(j++)) {
return -1;
}
}
return j;
}
function d3_time_formatRe(names) {
return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i");
}
function d3_time_formatLookup(names) {
var map = new d3_Map(), i = -1, n = names.length;
while (++i < n) map.set(names[i].toLowerCase(), i);
return map;
}
function d3_time_formatPad(value, fill, width) {
value += "";
var length = value.length;
return length < width ? new Array(width - length + 1).join(fill) + value : value;
}
var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_monthRe = d3_time_formatRe(d3_time_months), d3_time_monthLookup = d3_time_formatLookup(d3_time_months), d3_time_monthAbbrevRe = d3_time_formatRe(d3_time_monthAbbreviations), d3_time_monthAbbrevLookup = d3_time_formatLookup(d3_time_monthAbbreviations);
var d3_time_formatPads = {
"-": "",
_: " ",
"0": "0"
};
var d3_time_formats = {
a: function(d) {
return d3_time_dayAbbreviations[d.getDay()];
},
A: function(d) {
return d3_time_days[d.getDay()];
},
b: function(d) {
return d3_time_monthAbbreviations[d.getMonth()];
},
B: function(d) {
return d3_time_months[d.getMonth()];
},
c: d3.time.format(d3_time_formatDateTime),
d: function(d, p) {
return d3_time_formatPad(d.getDate(), p, 2);
},
e: function(d, p) {
return d3_time_formatPad(d.getDate(), p, 2);
},
H: function(d, p) {
return d3_time_formatPad(d.getHours(), p, 2);
},
I: function(d, p) {
return d3_time_formatPad(d.getHours() % 12 || 12, p, 2);
},
j: function(d, p) {
return d3_time_formatPad(1 + d3.time.dayOfYear(d), p, 3);
},
L: function(d, p) {
return d3_time_formatPad(d.getMilliseconds(), p, 3);
},
m: function(d, p) {
return d3_time_formatPad(d.getMonth() + 1, p, 2);
},
M: function(d, p) {
return d3_time_formatPad(d.getMinutes(), p, 2);
},
p: function(d) {
return d.getHours() >= 12 ? "PM" : "AM";
},
S: function(d, p) {
return d3_time_formatPad(d.getSeconds(), p, 2);
},
U: function(d, p) {
return d3_time_formatPad(d3.time.sundayOfYear(d), p, 2);
},
w: function(d) {
return d.getDay();
},
W: function(d, p) {
return d3_time_formatPad(d3.time.mondayOfYear(d), p, 2);
},
x: d3.time.format(d3_time_formatDate),
X: d3.time.format(d3_time_formatTime),
y: function(d, p) {
return d3_time_formatPad(d.getFullYear() % 100, p, 2);
},
Y: function(d, p) {
return d3_time_formatPad(d.getFullYear() % 1e4, p, 4);
},
Z: d3_time_zone,
"%": function() {
return "%";
}
};
var d3_time_parsers = {
a: d3_time_parseWeekdayAbbrev,
A: d3_time_parseWeekday,
b: d3_time_parseMonthAbbrev,
B: d3_time_parseMonth,
c: d3_time_parseLocaleFull,
d: d3_time_parseDay,
e: d3_time_parseDay,
H: d3_time_parseHour24,
I: d3_time_parseHour24,
L: d3_time_parseMilliseconds,
m: d3_time_parseMonthNumber,
M: d3_time_parseMinutes,
p: d3_time_parseAmPm,
S: d3_time_parseSeconds,
x: d3_time_parseLocaleDate,
X: d3_time_parseLocaleTime,
y: d3_time_parseYear,
Y: d3_time_parseFullYear
};
function d3_time_parseWeekdayAbbrev(date, string, i) {
d3_time_dayAbbrevRe.lastIndex = 0;
var n = d3_time_dayAbbrevRe.exec(string.substring(i));
return n ? i += n[0].length : -1;
}
function d3_time_parseWeekday(date, string, i) {
d3_time_dayRe.lastIndex = 0;
var n = d3_time_dayRe.exec(string.substring(i));
return n ? i += n[0].length : -1;
}
function d3_time_parseMonthAbbrev(date, string, i) {
d3_time_monthAbbrevRe.lastIndex = 0;
var n = d3_time_monthAbbrevRe.exec(string.substring(i));
return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
}
function d3_time_parseMonth(date, string, i) {
d3_time_monthRe.lastIndex = 0;
var n = d3_time_monthRe.exec(string.substring(i));
return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
}
function d3_time_parseLocaleFull(date, string, i) {
return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
}
function d3_time_parseLocaleDate(date, string, i) {
return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
}
function d3_time_parseLocaleTime(date, string, i) {
return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
}
function d3_time_parseFullYear(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 4));
return n ? (date.y = +n[0], i += n[0].length) : -1;
}
function d3_time_parseYear(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
return n ? (date.y = d3_time_expandYear(+n[0]), i += n[0].length) : -1;
}
function d3_time_expandYear(d) {
return d + (d > 68 ? 1900 : 2e3);
}
function d3_time_parseMonthNumber(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
return n ? (date.m = n[0] - 1, i += n[0].length) : -1;
}
function d3_time_parseDay(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
return n ? (date.d = +n[0], i += n[0].length) : -1;
}
function d3_time_parseHour24(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
return n ? (date.H = +n[0], i += n[0].length) : -1;
}
function d3_time_parseMinutes(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
return n ? (date.M = +n[0], i += n[0].length) : -1;
}
function d3_time_parseSeconds(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
return n ? (date.S = +n[0], i += n[0].length) : -1;
}
function d3_time_parseMilliseconds(date, string, i) {
d3_time_numberRe.lastIndex = 0;
var n = d3_time_numberRe.exec(string.substring(i, i + 3));
return n ? (date.L = +n[0], i += n[0].length) : -1;
}
var d3_time_numberRe = /^\s*\d+/;
function d3_time_parseAmPm(date, string, i) {
var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());
return n == null ? -1 : (date.p = n, i);
}
var d3_time_amPmLookup = d3.map({
am: 0,
pm: 1
});
function d3_time_zone(d) {
var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(Math.abs(z) / 60), zm = Math.abs(z) % 60;
return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2);
}
d3.time.format.utc = function(template) {
var local = d3.time.format(template);
function format(date) {
try {
d3_time = d3_time_utc;
var utc = new d3_time();
utc._ = date;
return local(utc);
} finally {
d3_time = Date;
}
}
format.parse = function(string) {
try {
d3_time = d3_time_utc;
var date = local.parse(string);
return date && date._;
} finally {
d3_time = Date;
}
};
format.toString = local.toString;
return format;
};
var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
d3.time.format.iso = Date.prototype.toISOString && +new Date("2000-01-01T00:00:00.000Z") ? d3_time_formatIsoNative : d3_time_formatIso;
function d3_time_formatIsoNative(date) {
return date.toISOString();
}
d3_time_formatIsoNative.parse = function(string) {
var date = new Date(string);
return isNaN(date) ? null : date;
};
d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
function d3_time_interval(local, step, number) {
function round(date) {
var d0 = local(date), d1 = offset(d0, 1);
return date - d0 < d1 - date ? d0 : d1;
}
function ceil(date) {
step(date = local(new d3_time(date - 1)), 1);
return date;
}
function offset(date, k) {
step(date = new d3_time(+date), k);
return date;
}
function range(t0, t1, dt) {
var time = ceil(t0), times = [];
if (dt > 1) {
while (time < t1) {
if (!(number(time) % dt)) times.push(new Date(+time));
step(time, 1);
}
} else {
while (time < t1) times.push(new Date(+time)), step(time, 1);
}
return times;
}
function range_utc(t0, t1, dt) {
try {
d3_time = d3_time_utc;
var utc = new d3_time_utc();
utc._ = t0;
return range(utc, t1, dt);
} finally {
d3_time = Date;
}
}
local.floor = local;
local.round = round;
local.ceil = ceil;
local.offset = offset;
local.range = range;
var utc = local.utc = d3_time_interval_utc(local);
utc.floor = utc;
utc.round = d3_time_interval_utc(round);
utc.ceil = d3_time_interval_utc(ceil);
utc.offset = d3_time_interval_utc(offset);
utc.range = range_utc;
return local;
}
function d3_time_interval_utc(method) {
return function(date, k) {
try {
d3_time = d3_time_utc;
var utc = new d3_time_utc();
utc._ = date;
return method(utc, k)._;
} finally {
d3_time = Date;
}
};
}
d3.time.second = d3_time_interval(function(date) {
return new d3_time(Math.floor(date / 1e3) * 1e3);
}, function(date, offset) {
date.setTime(date.getTime() + Math.floor(offset) * 1e3);
}, function(date) {
return date.getSeconds();
});
d3.time.seconds = d3.time.second.range;
d3.time.seconds.utc = d3.time.second.utc.range;
d3.time.minute = d3_time_interval(function(date) {
return new d3_time(Math.floor(date / 6e4) * 6e4);
}, function(date, offset) {
date.setTime(date.getTime() + Math.floor(offset) * 6e4);
}, function(date) {
return date.getMinutes();
});
d3.time.minutes = d3.time.minute.range;
d3.time.minutes.utc = d3.time.minute.utc.range;
d3.time.hour = d3_time_interval(function(date) {
var timezone = date.getTimezoneOffset() / 60;
return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
}, function(date, offset) {
date.setTime(date.getTime() + Math.floor(offset) * 36e5);
}, function(date) {
return date.getHours();
});
d3.time.hours = d3.time.hour.range;
d3.time.hours.utc = d3.time.hour.utc.range;
d3.time.day = d3_time_interval(function(date) {
var day = new d3_time(1970, 0);
day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
return day;
}, function(date, offset) {
date.setDate(date.getDate() + offset);
}, function(date) {
return date.getDate() - 1;
});
d3.time.days = d3.time.day.range;
d3.time.days.utc = d3.time.day.utc.range;
d3.time.dayOfYear = function(date) {
var year = d3.time.year(date);
return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
};
d3_time_daySymbols.forEach(function(day, i) {
day = day.toLowerCase();
i = 7 - i;
var interval = d3.time[day] = d3_time_interval(function(date) {
(date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
return date;
}, function(date, offset) {
date.setDate(date.getDate() + Math.floor(offset) * 7);
}, function(date) {
var day = d3.time.year(date).getDay();
return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
});
d3.time[day + "s"] = interval.range;
d3.time[day + "s"].utc = interval.utc.range;
d3.time[day + "OfYear"] = function(date) {
var day = d3.time.year(date).getDay();
return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7);
};
});
d3.time.week = d3.time.sunday;
d3.time.weeks = d3.time.sunday.range;
d3.time.weeks.utc = d3.time.sunday.utc.range;
d3.time.weekOfYear = d3.time.sundayOfYear;
d3.time.month = d3_time_interval(function(date) {
date = d3.time.day(date);
date.setDate(1);
return date;
}, function(date, offset) {
date.setMonth(date.getMonth() + offset);
}, function(date) {
return date.getMonth();
});
d3.time.months = d3.time.month.range;
d3.time.months.utc = d3.time.month.utc.range;
d3.time.year = d3_time_interval(function(date) {
date = d3.time.day(date);
date.setMonth(0, 1);
return date;
}, function(date, offset) {
date.setFullYear(date.getFullYear() + offset);
}, function(date) {
return date.getFullYear();
});
d3.time.years = d3.time.year.range;
d3.time.years.utc = d3.time.year.utc.range;
function d3_time_scale(linear, methods, format) {
function scale(x) {
return linear(x);
}
scale.invert = function(x) {
return d3_time_scaleDate(linear.invert(x));
};
scale.domain = function(x) {
if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
linear.domain(x);
return scale;
};
scale.nice = function(m) {
return scale.domain(d3_scale_nice(scale.domain(), function() {
return m;
}));
};
scale.ticks = function(m, k) {
var extent = d3_time_scaleExtent(scale.domain());
if (typeof m !== "function") {
var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target);
if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
if (!i) return linear.ticks(m).map(d3_time_scaleDate);
if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
m = methods[i];
k = m[1];
m = m[0].range;
}
return m(extent[0], new Date(+extent[1] + 1), k);
};
scale.tickFormat = function() {
return format;
};
scale.copy = function() {
return d3_time_scale(linear.copy(), methods, format);
};
return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
}
function d3_time_scaleExtent(domain) {
var start = domain[0], stop = domain[domain.length - 1];
return start < stop ? [ start, stop ] : [ stop, start ];
}
function d3_time_scaleDate(t) {
return new Date(t);
}
function d3_time_scaleFormat(formats) {
return function(date) {
var i = formats.length - 1, f = formats[i];
while (!f[1](date)) f = formats[--i];
return f[0](date);
};
}
function d3_time_scaleSetYear(y) {
var d = new Date(y, 0, 1);
d.setFullYear(y);
return d;
}
function d3_time_scaleGetYear(d) {
var y = d.getFullYear(), d0 = d3_time_scaleSetYear(y), d1 = d3_time_scaleSetYear(y + 1);
return y + (d - d0) / (d1 - d0);
}
var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];
var d3_time_scaleLocalMethods = [ [ d3.time.second, 1 ], [ d3.time.second, 5 ], [ d3.time.second, 15 ], [ d3.time.second, 30 ], [ d3.time.minute, 1 ], [ d3.time.minute, 5 ], [ d3.time.minute, 15 ], [ d3.time.minute, 30 ], [ d3.time.hour, 1 ], [ d3.time.hour, 3 ], [ d3.time.hour, 6 ], [ d3.time.hour, 12 ], [ d3.time.day, 1 ], [ d3.time.day, 2 ], [ d3.time.week, 1 ], [ d3.time.month, 1 ], [ d3.time.month, 3 ], [ d3.time.year, 1 ] ];
var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), d3_true ], [ d3.time.format("%B"), function(d) {
return d.getMonth();
} ], [ d3.time.format("%b %d"), function(d) {
return d.getDate() != 1;
} ], [ d3.time.format("%a %d"), function(d) {
return d.getDay() && d.getDate() != 1;
} ], [ d3.time.format("%I %p"), function(d) {
return d.getHours();
} ], [ d3.time.format("%I:%M"), function(d) {
return d.getMinutes();
} ], [ d3.time.format(":%S"), function(d) {
return d.getSeconds();
} ], [ d3.time.format(".%L"), function(d) {
return d.getMilliseconds();
} ] ];
var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
d3_time_scaleLocalMethods.year = function(extent, m) {
return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear);
};
d3.time.scale = function() {
return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
};
var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
return [ m[0].utc, m[1] ];
});
var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), d3_true ], [ d3.time.format.utc("%B"), function(d) {
return d.getUTCMonth();
} ], [ d3.time.format.utc("%b %d"), function(d) {
return d.getUTCDate() != 1;
} ], [ d3.time.format.utc("%a %d"), function(d) {
return d.getUTCDay() && d.getUTCDate() != 1;
} ], [ d3.time.format.utc("%I %p"), function(d) {
return d.getUTCHours();
} ], [ d3.time.format.utc("%I:%M"), function(d) {
return d.getUTCMinutes();
} ], [ d3.time.format.utc(":%S"), function(d) {
return d.getUTCSeconds();
} ], [ d3.time.format.utc(".%L"), function(d) {
return d.getUTCMilliseconds();
} ] ];
var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
function d3_time_scaleUTCSetYear(y) {
var d = new Date(Date.UTC(y, 0, 1));
d.setUTCFullYear(y);
return d;
}
function d3_time_scaleUTCGetYear(d) {
var y = d.getUTCFullYear(), d0 = d3_time_scaleUTCSetYear(y), d1 = d3_time_scaleUTCSetYear(y + 1);
return y + (d - d0) / (d1 - d0);
}
d3_time_scaleUTCMethods.year = function(extent, m) {
return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear);
};
d3.time.scale.utc = function() {
return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
};
return d3;
}();
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bulgarian dialect data</title>
<script type="text/javascript" src="d3.v3.js"></script>
<script type="text/javascript" src="bulgaria.js"></script>
<style type="text/css">
#states path {
stroke: #fff;
}
path.arc {
pointer-events: none;
fill: none;
stroke: #000;
display: none;
}
path.cell {
fill: none;
pointer-events: none;
}
circle {
fill: steelblue;
fill-opacity: .8;
stroke: #fff;
}
#cells.voronoi path.cell {
stroke: white;
stroke-width: 1;
}
#cells g:hover path.arc {
display: inherit;
}
.poly:hover {
stroke: white;
stroke-width: 2;
}
</style>
</head>
<body>
<div id="map" style="position:absolute; left: 70px;"></div>
<div style="position:absolute;top:10px;font-size:18px;">
<input type="checkbox" id="voronoi"> <label for="voronoi">show voronoi</label> <br>
<input type="checkbox" id="locations"> <label for="voronoi">show locations</label> <br>
<select name="inputdata" id="inputdata" size="1">
<option value="bulgaria_non.txt">raw MDS values</option>
<option value="bulgaria.txt">scaled MDS values</option>
</select> <label for='colorspace'>select input data</label> <br>
<select name="colorspace" id="colorspace" size="1" onchange="
if(this.selectedIndex != 0){ document.getElementById('luminationcontrol').style.visibility = 'hidden';}
else{ document.getElementById('luminationcontrol').style.visibility = 'visible';}">
<option>L*a*b*</option>
<option>L*a*b* (using formula)</option>
<option>RGB</option>
<option>HSL</option>
<option>HCL</option>
<option>RYB</option>
</select> <label for='colorspace'>select color space</label>
<div id="luminationcontrol">
<input id="lumination" type='range' min="0" max="100" value="60">
<label for="lumination">L value: <span id="lvalue">60</span></label>
</div>
<div id="infopanel" style="display: none;">
Name: <span id="info" style="text-transform: capitalize;"></span> <br>
Dim 1: <span id="mds1"></span> <br>
Dim 2: <span id="mds2"></span> <br>
Dim 3: <span id="mds3"></span>
</div>
</div>
<script type="text/javascript">
var inputdatafile = "bulgaria_non.txt";
var currscale = 'lab';
var data = [];
//Width and height
var w = 1000;
var h = 1000;
var dim1values = [];
var dim2values = [];
var dim3values = [];
var dim1scale = d3.scale.linear();
var dim2scale = d3.scale.linear();
var dim3scale = d3.scale.linear();
d3.tsv(inputdatafile, function(data) {
data.forEach(function(a){
dim1values.push(parseFloat(a.dim1));
dim2values.push(parseFloat(a.dim2));
dim3values.push(parseFloat(a.dim3));
});
dim1scale
.domain([d3.min(dim1values),d3.max(dim1values)])
.range([0,1])
;
dim2scale
.domain([d3.min(dim2values),d3.max(dim2values)])
.range([0,1])
;
dim3scale
.domain([d3.min(dim3values),d3.max(dim3values)])
.range([0,1])
;
});
// l*a*b* scale
var aScale = d3.scale.linear()
.domain([0,1])
.range([-150,100]);
;
var bScale = d3.scale.linear()
.domain([0,1])
.range([-100,150]);
;
// l*a*b* scale
var aScaleInv = d3.scale.linear()
.domain([-1,1])
.range([-150,100]);
;
// RGB scale
var rgbScale = d3.scale.linear()
.domain([0,1])
.range([0,255]);
;
// HSL scale
var hslScale = d3.scale.linear()
.domain([0,1])
.range([0,360]);
;
// HCLHue scale
var hclHueScale = d3.scale.linear()
.domain([0,1])
.range([0,360]);
;
// HCLChromaLuminance scale
var hclCLScale = d3.scale.linear()
.domain([0,1])
.range([0,100]);
;
var bScaleInv = d3.scale.linear()
.domain([-1,1])
.range([-100,150]);
;
// lvalue for L*a*b*
var lvalue = 60;
//Define map projection
var projection = d3.geo.mercator()
.center([24.7, 42.55])
.scale([7000 * 5]);
//Define path generator
var path = d3.geo.path()
.projection(projection);
//Create SVG element
var svg = d3.select("#map")
.append("svg")
.attr("width", w)
.attr("height", h);
var polys = svg.append("svg:g")
.attr("id","polys")
;
var circles = svg.append("svg:g")
.attr("id", "circles")
;
var cells = svg.append("svg:g")
.attr("id", "cells")
.attr("pointer-events",'none')
;
var states = svg.append("svg:g")
.attr("id", "states")
;
d3.select("#voronoi").on("change", function() {
cells.classed("voronoi", this.checked);
});
d3.select("#locations").on("change", function() {
var locationopacity = this.checked ? 1 : 0;
var locationpointer = this.checked ? 'all' : 'none';
//console.log(locationopacity);
d3.selectAll('.location')
.style("opacity",locationopacity)
.attr('pointer-events', locationpointer)
;
});
//Load in GeoJSON data
d3.json("geo.json", function(json) {
//Bind data and create one path per GeoJSON feature
states.selectAll("path")
.data(json.features)
.enter()
.append("path")
.attr("d", path)
.style("fill", "none")
.style("stroke","#d0d0d0")
.style("stroke-width","0.1px")
.attr('pointer-events','none')
;
d3.tsv(inputdatafile, function(inputdata) {
// get the positions and polygons for the voronoi
data = inputdata;
positions = [];
data.forEach(function(a){
positions.push(projection([a.lon,a.lat]));
});
circles.selectAll("circle")
.data(data)
.enter()
.append("circle")
.attr('class','location')
.attr("cx", function(d) {
return projection([d.lon, d.lat])[0];
})
.attr("cy", function(d) {
return projection([d.lon, d.lat])[1];
})
.attr("r", 4)
.attr('pointer-events','none')
.style("fill", "steelblue")
.style("stroke","white")
.style("stroke-weight",3)
.style("opacity", 0)
.style('cursor','pointer')
.append("title")
.text(function(d){
return d.name;
})
;
var polygons = d3.geom.voronoi(positions);
var hesse = [];
hessen.forEach(function(a){
//parts = a.split(';').reverse()
parts = a;
hesse.push(projection(parts));
//hesse.push(parts);
});
//console.log(hesse);
var hesse_poly = d3.geom.polygon(hesse);
//console.log(polygons);
// plot the voronoi polygons
var g = cells.selectAll("g")
.data(data)
.enter().append("svg:g");
g.append("svg:path")
.attr("class", "cell")
.attr("d", function(d, i) { return "M" + polygons[i].join("L") + "Z"; })
.attr('pointer-events','none')
;
// make the clipped polygons
// non-contiguous polygons: 43,48,56,58
polys.selectAll('polygon')
.data(polygons)
.enter()
.append("polygon")
.attr('class',function(d,i){return 'poly poly_' + i;})
.attr("points",function(d,i) {
var currHesse = hesse.slice(0);
var hesse_poly = d3.geom.polygon(currHesse);
var currPoly = d3.geom.polygon(d).clip(hesse_poly);
return currPoly.map(function(m){
//return d.map(function(m){
return [m[0],m[1]].join(',');
}).join(" ");
})
//.attr("fill",'green')
.attr("fill",function(d,i){
//console.log(data[i].dim1,data[i].dim2);
//console.log(dim1scale(data[i].dim1));
return d3.lab(lvalue,aScale(dim1scale(data[i].dim1)),bScale(dim2scale(data[i].dim2)));
})
.style("cursor","pointer")
.style('opacity',1)//function(d,i){return (156-i)/156;})
.on("mouseover",function(d,i){
document.getElementById('info').innerHTML = data[i].name;
document.getElementById('mds1').innerHTML = data[i].dim1;
document.getElementById('mds2').innerHTML = data[i].dim2;
document.getElementById('mds3').innerHTML = data[i].dim3;
d3.select('#infopanel').style('display','block');
})
.on("mouseout",function(d,i){
document.getElementById('info').innerHTML = "";
document.getElementById('mds1').innerHTML = "";
document.getElementById('mds2').innerHTML = "";
document.getElementById('mds3').innerHTML = "";
d3.select('#infopanel').style('display','none');
})
;
// non-contiguous polygons: 43,48,56,58
polys.selectAll('polygon2')
.data([hesse])
.enter()
.append("polygon")
.attr("points",function(d,i) {
//console.log(d);
return d.map(function(m){
return [m[0],m[1]].join(',');
}).join(" ");
})
.attr('fill','none')
.attr("stroke","black")
.attr("stroke-width",1)
;
//############### Lumination slider ###############
d3.select("#lumination").on("change", function() {
lvalue = this.value;
//console.log(lvalue);
document.getElementById("lvalue").innerHTML = lvalue;
polys.selectAll('.poly')
.data(polygons)
.attr("fill",function(d,i){
//console.log(data[i].dim1,data[i].dim2);
return d3.lab(lvalue,aScale(dim1scale(data[i].dim1)),bScale(dim2scale(data[i].dim2)));
})
;
});
//############### Lumination slider ###############
d3.select("#inputdata").on("change", function() {
inputdatafile = this.value;
console.log(inputdatafile);
d3.tsv(inputdatafile, function(datanew) {
data = datanew;
if(inputdatafile == 'bulgaria.txt'){
dim1scale
.domain([0,1])
;
dim2scale
.domain([0,1])
;
dim3scale
.domain([0,1])
;
}
else{
data.forEach(function(a){
dim1values.push(parseFloat(a.dim1));
dim2values.push(parseFloat(a.dim2));
dim3values.push(parseFloat(a.dim3));
});
dim1scale
.domain([d3.min(dim1values),d3.max(dim1values)])
.range([0,1])
;
dim2scale
.domain([d3.min(dim2values),d3.max(dim2values)])
.range([0,1])
;
dim3scale
.domain([d3.min(dim3values),d3.max(dim3values)])
.range([0,1])
;
}
colormap(currscale);
});
});
//############### Dropdown menu ###############
d3.select("#colorspace").on("change", function() {
// L*a*b* with formula below
if(this.selectedIndex == 1){
currscale = 'labform';
colormap(currscale);
}
// RGB
else if(this.selectedIndex == 2){
currscale = 'rgb';
colormap(currscale);
}
// HSL
else if(this.selectedIndex == 3){
currscale = 'hsl';
colormap(currscale);
}
// HCL
else if(this.selectedIndex == 4){
currscale = 'hcl';
colormap(currscale);
}
// RYB
else if(this.selectedIndex == 5){
currscale = 'ryb';
colormap(currscale);
}
// L*a*b* directly with dim1 as a and dim2 as b (L value variable in slider)
else{
currscale = 'lab';
colormap(currscale);
}
});
// change values in map
function colormap(colorscale){
polys.selectAll('.poly')
.data(polygons)
.transition()
.duration(1000)
.attr("fill",function(d,i){
//console.log(data[i].dim1,data[i].dim2);
if(colorscale == 'labform'){
var colarray = cl2pix(dim1scale(data[i].dim1),dim2scale(data[i].dim2));
return d3.lab(colarray[0]*100,aScaleInv(colarray[1]),bScaleInv(colarray[2]));
}
else if(colorscale == 'rgb'){
return d3.rgb(rgbScale(dim1scale(data[i].dim1)),rgbScale(dim2scale(data[i].dim2)),rgbScale(dim3scale(data[i].dim3)));
}
else if(colorscale == 'hsl'){
return d3.hsl(hslScale(dim1scale(data[i].dim1)),dim2scale(data[i].dim2),dim3scale(data[i].dim3));
}
else if(colorscale == 'hcl'){
return d3.hcl(hclHueScale(dim1scale(data[i].dim1)),hclCLScale(dim2scale(data[i].dim2)),hclCLScale(dim3scale(data[i].dim3)));
}
else if(colorscale == 'ryb'){
var rgbvalues = RYB2RGB(dim1scale(data[i].dim1),dim2scale(data[i].dim2),dim3scale(data[i].dim3));
return d3.rgb(rgbvalues[0],rgbvalues[1],rgbvalues[2]);
}
else{
return d3.lab(lvalue,aScale(dim1scale(data[i].dim1)),bScale(dim2scale(data[i].dim2)));
}
})
;
};
// taken from http://davidad.net/colorviz/
// convert into lab color
function cl2pix(c,l){
var TAU = 6.283185307179586476925287 // also known as "two pi"
var L = l*0.61 + 0.09; // L of L*a*b*
var angle = TAU/6.0 - c*TAU;
var r = l*0.311 + 0.125 //~chroma
var a = Math.sin(angle)*r;
var b = Math.cos(angle)*r;
return [L,a,b];
};
// taken from http://www.delphipraxis.net/152223-rgb-ryb.html
function cubicInt(t, A, B){
var weight = t*t*(3-2*t);
return A + weight*(B-A);
}
function getR (iR, iY, iB) {
var x0, x1, x2, x3, y0, y1;
//red
var x0 = cubicInt(iB, 1.0, 0.163);
var x1 = cubicInt(iB, 1.0, 0.0);
var x2 = cubicInt(iB, 1.0, 0.5);
var x3 = cubicInt(iB, 1.0, 0.2);
var y0 = cubicInt(iY, x0, x1);
var y1 = cubicInt(iY, x2, x3);
return Math.ceil (255 * cubicInt(iR, y0, y1));
}
function getG (iR, iY, iB) {
var x0, x1, x2, x3, y0, y1;
//green
x0 = cubicInt(iB, 1.0, 0.373);
x1 = cubicInt(iB, 1.0, 0.66);
x2 = cubicInt(iB, 0.0, 0.0);
x3 = cubicInt(iB, 0.5, 0.094);
y0 = cubicInt(iY, x0, x1);
y1 = cubicInt(iY, x2, x3);
return Math.ceil (255 * cubicInt(iR, y0, y1));
}
function getB (iR, iY, iB) {
var x0, x1, x2, x3, y0, y1;
//blue
x0 = cubicInt(iB, 1.0, 0.6);
x1 = cubicInt(iB, 0.0, 0.2);
x2 = cubicInt(iB, 0.0, 0.5);
x3 = cubicInt(iB, 0.0, 0.0);
y0 = cubicInt(iY, x0, x1);
y1 = cubicInt(iY, x2, x3);
return Math.ceil (255 * cubicInt(iR, y0, y1));
}
function RYB2RGB(R,Y,B){
if (
isNaN( R ) || isNaN( Y ) || isNaN( B ) ||
(R < 0 || R > 1) ||
(Y < 0 || Y > 1) ||
(B < 0 || B > 1)
)
{
alert('Invalid RYB values');
return;
}
//----------------------------
var R1 = getR(R,Y,B) ;
var G1 = getG(R,Y,B) ;
var B1 = getB(R,Y,B) ;
return [R1,G1,B1];
}
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment