123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082 |
- 'use strict';
- (function (factory) {
- if (typeof module === 'object' && module.exports) {
- factory['default'] = factory;
- module.exports = factory;
- } else if (typeof define === 'function' && define.amd) {
- define('highcharts/modules/map', ['highcharts'], function (Highcharts) {
- factory(Highcharts);
- factory.Highcharts = Highcharts;
- return factory;
- });
- } else {
- factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
- }
- }(function (Highcharts) {
- var _modules = Highcharts ? Highcharts._modules : {};
- function _registerModule(obj, path, args, fn) {
- if (!obj.hasOwnProperty(path)) {
- obj[path] = fn.apply(null, args);
- }
- }
- _registerModule(_modules, 'Core/Axis/MapAxis.js', [_modules['Core/Axis/Axis.js'], _modules['Core/Utilities.js']], function (Axis, U) {
-
- var addEvent = U.addEvent,
- pick = U.pick;
-
- var MapAxisAdditions = (function () {
-
- function MapAxisAdditions(axis) {
- this.axis = axis;
- }
- return MapAxisAdditions;
- }());
-
- var MapAxis = (function () {
- function MapAxis() {
- }
-
- MapAxis.compose = function (AxisClass) {
- AxisClass.keepProps.push('mapAxis');
-
- addEvent(AxisClass, 'init', function () {
- var axis = this;
- if (!axis.mapAxis) {
- axis.mapAxis = new MapAxisAdditions(axis);
- }
- });
-
-
- addEvent(AxisClass, 'getSeriesExtremes', function () {
- if (!this.mapAxis) {
- return;
- }
- var axis = this;
- var xData = [];
-
-
- if (axis.isXAxis) {
- axis.series.forEach(function (series, i) {
- if (series.useMapGeometry) {
- xData[i] = series.xData;
- series.xData = [];
- }
- });
- axis.mapAxis.seriesXData = xData;
- }
- });
- addEvent(AxisClass, 'afterGetSeriesExtremes', function () {
- if (!this.mapAxis) {
- return;
- }
- var axis = this;
- var xData = axis.mapAxis.seriesXData || [];
- var dataMin,
- dataMax,
- useMapGeometry;
-
- if (axis.isXAxis) {
- dataMin = pick(axis.dataMin, Number.MAX_VALUE);
- dataMax = pick(axis.dataMax, -Number.MAX_VALUE);
- axis.series.forEach(function (series, i) {
- if (series.useMapGeometry) {
- dataMin = Math.min(dataMin, pick(series.minX, dataMin));
- dataMax = Math.max(dataMax, pick(series.maxX, dataMax));
- series.xData = xData[i];
- useMapGeometry = true;
- }
- });
- if (useMapGeometry) {
- axis.dataMin = dataMin;
- axis.dataMax = dataMax;
- }
- axis.mapAxis.seriesXData = void 0;
- }
- });
-
-
- addEvent(AxisClass, 'afterSetAxisTranslation', function () {
- if (!this.mapAxis) {
- return;
- }
- var axis = this;
- var chart = axis.chart;
- var plotRatio = chart.plotWidth / chart.plotHeight;
- var xAxis = chart.xAxis[0];
- var mapRatio,
- adjustedAxisLength,
- padAxis,
- fixTo,
- fixDiff,
- preserveAspectRatio;
-
- if (axis.coll === 'yAxis' && typeof xAxis.transA !== 'undefined') {
- axis.series.forEach(function (series) {
- if (series.preserveAspectRatio) {
- preserveAspectRatio = true;
- }
- });
- }
-
- if (preserveAspectRatio) {
-
- axis.transA = xAxis.transA = Math.min(axis.transA, xAxis.transA);
- mapRatio = plotRatio / ((xAxis.max - xAxis.min) /
- (axis.max - axis.min));
-
- padAxis = mapRatio < 1 ? axis : xAxis;
-
- adjustedAxisLength =
- (padAxis.max - padAxis.min) * padAxis.transA;
- padAxis.mapAxis.pixelPadding = padAxis.len - adjustedAxisLength;
- padAxis.minPixelPadding = padAxis.mapAxis.pixelPadding / 2;
- fixTo = padAxis.mapAxis.fixTo;
- if (fixTo) {
- fixDiff = fixTo[1] - padAxis.toValue(fixTo[0], true);
- fixDiff *= padAxis.transA;
- if (Math.abs(fixDiff) > padAxis.minPixelPadding ||
- (padAxis.min === padAxis.dataMin &&
- padAxis.max === padAxis.dataMax)) {
- fixDiff = 0;
- }
- padAxis.minPixelPadding -= fixDiff;
- }
- }
- });
-
- addEvent(AxisClass, 'render', function () {
- var axis = this;
- if (axis.mapAxis) {
- axis.mapAxis.fixTo = void 0;
- }
- });
-
- };
- return MapAxis;
- }());
- MapAxis.compose(Axis);
- return MapAxis;
- });
- _registerModule(_modules, 'Mixins/ColorSeries.js', [], function () {
-
-
- var colorPointMixin = {
-
-
- setVisible: function (vis) {
- var point = this,
- method = vis ? 'show' : 'hide';
- point.visible = point.options.visible = Boolean(vis);
-
- ['graphic', 'dataLabel'].forEach(function (key) {
- if (point[key]) {
- point[key][method]();
- }
- });
- this.series.buildKDTree();
- }
-
- };
-
- var colorSeriesMixin = {
- optionalAxis: 'colorAxis',
- colorAxis: 0,
-
-
- translateColors: function () {
- var series = this,
- points = this.data.length ? this.data : this.points,
- nullColor = this.options.nullColor,
- colorAxis = this.colorAxis,
- colorKey = this.colorKey;
- points.forEach(function (point) {
- var value = point.getNestedProperty(colorKey),
- color;
- color = point.options.color ||
- (point.isNull || point.value === null ?
- nullColor :
- (colorAxis && typeof value !== 'undefined') ?
- colorAxis.toColor(value, point) :
- point.color || series.color);
- if (color && point.color !== color) {
- point.color = color;
- if (series.options.legendType === 'point' && point.legendItem) {
- series.chart.legend.colorizeItem(point, point.visible);
- }
- }
- });
- }
-
- };
- var exports = {
- colorPointMixin: colorPointMixin,
- colorSeriesMixin: colorSeriesMixin
- };
- return exports;
- });
- _registerModule(_modules, 'Core/Axis/ColorAxis.js', [_modules['Core/Axis/Axis.js'], _modules['Core/Chart/Chart.js'], _modules['Core/Color/Color.js'], _modules['Mixins/ColorSeries.js'], _modules['Core/Animation/Fx.js'], _modules['Core/Globals.js'], _modules['Core/Legend.js'], _modules['Mixins/LegendSymbol.js'], _modules['Core/Color/Palette.js'], _modules['Core/Series/Point.js'], _modules['Core/Series/Series.js'], _modules['Core/Utilities.js']], function (Axis, Chart, Color, ColorSeriesModule, Fx, H, Legend, LegendSymbolMixin, palette, Point, Series, U) {
-
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d,
- b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d,
- b) { d.__proto__ = b; }) ||
- function (d,
- b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var color = Color.parse;
- var colorPointMixin = ColorSeriesModule.colorPointMixin,
- colorSeriesMixin = ColorSeriesModule.colorSeriesMixin;
- var noop = H.noop;
- var addEvent = U.addEvent,
- erase = U.erase,
- extend = U.extend,
- isNumber = U.isNumber,
- merge = U.merge,
- pick = U.pick,
- splat = U.splat;
-
- '';
- extend(Series.prototype, colorSeriesMixin);
- extend(Point.prototype, colorPointMixin);
- Chart.prototype.collectionsWithUpdate.push('colorAxis');
- Chart.prototype.collectionsWithInit.colorAxis = [Chart.prototype.addColorAxis];
-
-
- var ColorAxis = (function (_super) {
- __extends(ColorAxis, _super);
-
-
- function ColorAxis(chart, userOptions) {
- var _this = _super.call(this,
- chart,
- userOptions) || this;
- _this.beforePadding = false;
- _this.chart = void 0;
- _this.coll = 'colorAxis';
- _this.dataClasses = void 0;
- _this.legendItem = void 0;
- _this.legendItems = void 0;
- _this.name = '';
- _this.options = void 0;
- _this.stops = void 0;
- _this.visible = true;
- _this.init(chart, userOptions);
- return _this;
- }
-
-
- ColorAxis.prototype.init = function (chart, userOptions) {
- var axis = this;
- var legend = chart.options.legend || {},
- horiz = userOptions.layout ?
- userOptions.layout !== 'vertical' :
- legend.layout !== 'vertical';
- var options = merge(ColorAxis.defaultColorAxisOptions,
- userOptions, {
- showEmpty: false,
- title: null,
- visible: legend.enabled &&
- (userOptions ? userOptions.visible !== false : true)
- });
- axis.coll = 'colorAxis';
- axis.side = userOptions.side || horiz ? 2 : 1;
- axis.reversed = userOptions.reversed || !horiz;
- axis.opposite = !horiz;
- _super.prototype.init.call(this, chart, options);
-
-
-
- if (userOptions.dataClasses) {
- axis.initDataClasses(userOptions);
- }
- axis.initStops();
-
- axis.horiz = horiz;
- axis.zoomEnabled = false;
- };
-
- ColorAxis.prototype.initDataClasses = function (userOptions) {
- var axis = this;
- var chart = axis.chart,
- dataClasses,
- colorCounter = 0,
- colorCount = chart.options.chart.colorCount,
- options = axis.options,
- len = userOptions.dataClasses.length;
- axis.dataClasses = dataClasses = [];
- axis.legendItems = [];
- userOptions.dataClasses.forEach(function (dataClass, i) {
- var colors;
- dataClass = merge(dataClass);
- dataClasses.push(dataClass);
- if (!chart.styledMode && dataClass.color) {
- return;
- }
- if (options.dataClassColor === 'category') {
- if (!chart.styledMode) {
- colors = chart.options.colors;
- colorCount = colors.length;
- dataClass.color = colors[colorCounter];
- }
- dataClass.colorIndex = colorCounter;
-
- colorCounter++;
- if (colorCounter === colorCount) {
- colorCounter = 0;
- }
- }
- else {
- dataClass.color = color(options.minColor).tweenTo(color(options.maxColor), len < 2 ? 0.5 : i / (len - 1)
- );
- }
- });
- };
-
- ColorAxis.prototype.hasData = function () {
- return !!(this.tickPositions || []).length;
- };
-
- ColorAxis.prototype.setTickPositions = function () {
- if (!this.dataClasses) {
- return _super.prototype.setTickPositions.call(this);
- }
- };
-
- ColorAxis.prototype.initStops = function () {
- var axis = this;
- axis.stops = axis.options.stops || [
- [0, axis.options.minColor],
- [1, axis.options.maxColor]
- ];
- axis.stops.forEach(function (stop) {
- stop.color = color(stop[1]);
- });
- };
-
- ColorAxis.prototype.setOptions = function (userOptions) {
- var axis = this;
- _super.prototype.setOptions.call(this, userOptions);
- axis.options.crosshair = axis.options.marker;
- };
-
- ColorAxis.prototype.setAxisSize = function () {
- var axis = this;
- var symbol = axis.legendSymbol;
- var chart = axis.chart;
- var legendOptions = chart.options.legend || {};
- var x,
- y,
- width,
- height;
- if (symbol) {
- this.left = x = symbol.attr('x');
- this.top = y = symbol.attr('y');
- this.width = width = symbol.attr('width');
- this.height = height = symbol.attr('height');
- this.right = chart.chartWidth - x - width;
- this.bottom = chart.chartHeight - y - height;
- this.len = this.horiz ? width : height;
- this.pos = this.horiz ? x : y;
- }
- else {
-
-
- this.len = (this.horiz ?
- legendOptions.symbolWidth :
- legendOptions.symbolHeight) || ColorAxis.defaultLegendLength;
- }
- };
-
- ColorAxis.prototype.normalizedValue = function (value) {
- var axis = this;
- if (axis.logarithmic) {
- value = axis.logarithmic.log2lin(value);
- }
- return 1 - ((axis.max - value) /
- ((axis.max - axis.min) || 1));
- };
-
- ColorAxis.prototype.toColor = function (value, point) {
- var axis = this;
- var dataClasses = axis.dataClasses;
- var stops = axis.stops;
- var pos,
- from,
- to,
- color,
- dataClass,
- i;
- if (dataClasses) {
- i = dataClasses.length;
- while (i--) {
- dataClass = dataClasses[i];
- from = dataClass.from;
- to = dataClass.to;
- if ((typeof from === 'undefined' || value >= from) &&
- (typeof to === 'undefined' || value <= to)) {
- color = dataClass.color;
- if (point) {
- point.dataClass = i;
- point.colorIndex = dataClass.colorIndex;
- }
- break;
- }
- }
- }
- else {
- pos = axis.normalizedValue(value);
- i = stops.length;
- while (i--) {
- if (pos > stops[i][0]) {
- break;
- }
- }
- from = stops[i] || stops[i + 1];
- to = stops[i + 1] || from;
-
- pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1);
- color = from.color.tweenTo(to.color, pos);
- }
- return color;
- };
-
- ColorAxis.prototype.getOffset = function () {
- var axis = this;
- var group = axis.legendGroup;
- var sideOffset = axis.chart.axisOffset[axis.side];
- if (group) {
-
-
- axis.axisParent = group;
-
- _super.prototype.getOffset.call(this);
-
- if (!axis.added) {
- axis.added = true;
- axis.labelLeft = 0;
- axis.labelRight = axis.width;
- }
-
- axis.chart.axisOffset[axis.side] = sideOffset;
- }
- };
-
- ColorAxis.prototype.setLegendColor = function () {
- var axis = this;
- var horiz = axis.horiz;
- var reversed = axis.reversed;
- var one = reversed ? 1 : 0;
- var zero = reversed ? 0 : 1;
- var grad = horiz ? [one, 0,
- zero, 0] : [0,
- zero, 0,
- one];
- axis.legendColor = {
- linearGradient: {
- x1: grad[0],
- y1: grad[1],
- x2: grad[2],
- y2: grad[3]
- },
- stops: axis.stops
- };
- };
-
- ColorAxis.prototype.drawLegendSymbol = function (legend, item) {
- var axis = this;
- var padding = legend.padding;
- var legendOptions = legend.options;
- var horiz = axis.horiz;
- var width = pick(legendOptions.symbolWidth,
- horiz ? ColorAxis.defaultLegendLength : 12);
- var height = pick(legendOptions.symbolHeight,
- horiz ? 12 : ColorAxis.defaultLegendLength);
- var labelPadding = pick(legendOptions.labelPadding,
- horiz ? 16 : 30);
- var itemDistance = pick(legendOptions.itemDistance, 10);
- this.setLegendColor();
-
- item.legendSymbol = this.chart.renderer.rect(0, legend.baseline - 11, width, height).attr({
- zIndex: 1
- }).add(item.legendGroup);
-
- axis.legendItemWidth = width + padding + (horiz ? itemDistance : labelPadding);
- axis.legendItemHeight = height + padding + (horiz ? labelPadding : 0);
- };
-
- ColorAxis.prototype.setState = function (state) {
- this.series.forEach(function (series) {
- series.setState(state);
- });
- };
-
- ColorAxis.prototype.setVisible = function () {
- };
-
- ColorAxis.prototype.getSeriesExtremes = function () {
- var axis = this;
- var series = axis.series;
- var colorValArray,
- colorKey,
- colorValIndex,
- pointArrayMap,
- calculatedExtremes,
- cSeries,
- i = series.length,
- yData,
- j;
- this.dataMin = Infinity;
- this.dataMax = -Infinity;
- while (i--) {
- cSeries = series[i];
- colorKey = cSeries.colorKey = pick(cSeries.options.colorKey, cSeries.colorKey, cSeries.pointValKey, cSeries.zoneAxis, 'y');
- pointArrayMap = cSeries.pointArrayMap;
- calculatedExtremes = cSeries[colorKey + 'Min'] &&
- cSeries[colorKey + 'Max'];
- if (cSeries[colorKey + 'Data']) {
- colorValArray = cSeries[colorKey + 'Data'];
- }
- else {
- if (!pointArrayMap) {
- colorValArray = cSeries.yData;
- }
- else {
- colorValArray = [];
- colorValIndex = pointArrayMap.indexOf(colorKey);
- yData = cSeries.yData;
- if (colorValIndex >= 0 && yData) {
- for (j = 0; j < yData.length; j++) {
- colorValArray.push(pick(yData[j][colorValIndex], yData[j]));
- }
- }
- }
- }
-
- if (calculatedExtremes) {
- cSeries.minColorValue = cSeries[colorKey + 'Min'];
- cSeries.maxColorValue = cSeries[colorKey + 'Max'];
- }
- else {
- var cExtremes = Series.prototype.getExtremes.call(cSeries,
- colorValArray);
- cSeries.minColorValue = cExtremes.dataMin;
- cSeries.maxColorValue = cExtremes.dataMax;
- }
- if (typeof cSeries.minColorValue !== 'undefined') {
- this.dataMin =
- Math.min(this.dataMin, cSeries.minColorValue);
- this.dataMax =
- Math.max(this.dataMax, cSeries.maxColorValue);
- }
- if (!calculatedExtremes) {
- Series.prototype.applyExtremes.call(cSeries);
- }
- }
- };
-
- ColorAxis.prototype.drawCrosshair = function (e, point) {
- var axis = this;
- var plotX = point && point.plotX;
- var plotY = point && point.plotY;
- var axisPos = axis.pos;
- var axisLen = axis.len;
- var crossPos;
- if (point) {
- crossPos = axis.toPixels(point.getNestedProperty(point.series.colorKey));
- if (crossPos < axisPos) {
- crossPos = axisPos - 2;
- }
- else if (crossPos > axisPos + axisLen) {
- crossPos = axisPos + axisLen + 2;
- }
- point.plotX = crossPos;
- point.plotY = axis.len - crossPos;
- _super.prototype.drawCrosshair.call(this, e, point);
- point.plotX = plotX;
- point.plotY = plotY;
- if (axis.cross &&
- !axis.cross.addedToColorAxis &&
- axis.legendGroup) {
- axis.cross
- .addClass('highcharts-coloraxis-marker')
- .add(axis.legendGroup);
- axis.cross.addedToColorAxis = true;
- if (!axis.chart.styledMode &&
- typeof axis.crosshair === 'object') {
- axis.cross.attr({
- fill: axis.crosshair.color
- });
- }
- }
- }
- };
-
- ColorAxis.prototype.getPlotLinePath = function (options) {
- var axis = this,
- left = axis.left,
- pos = options.translatedValue,
- top = axis.top;
-
- return isNumber(pos) ?
- (axis.horiz ? [
- ['M', pos - 4, top - 6],
- ['L', pos + 4, top - 6],
- ['L', pos, top],
- ['Z']
- ] : [
- ['M', left, pos],
- ['L', left - 6, pos + 6],
- ['L', left - 6, pos - 6],
- ['Z']
- ]) :
- _super.prototype.getPlotLinePath.call(this, options);
- };
-
- ColorAxis.prototype.update = function (newOptions, redraw) {
- var axis = this,
- chart = axis.chart,
- legend = chart.legend;
- this.series.forEach(function (series) {
-
- series.isDirtyData = true;
- });
-
-
- if (newOptions.dataClasses && legend.allItems || axis.dataClasses) {
- axis.destroyItems();
- }
- _super.prototype.update.call(this, newOptions, redraw);
- if (axis.legendItem) {
- axis.setLegendColor();
- legend.colorizeItem(this, true);
- }
- };
-
- ColorAxis.prototype.destroyItems = function () {
- var axis = this;
- var chart = axis.chart;
- if (axis.legendItem) {
- chart.legend.destroyItem(axis);
- }
- else if (axis.legendItems) {
- axis.legendItems.forEach(function (item) {
- chart.legend.destroyItem(item);
- });
- }
- chart.isDirtyLegend = true;
- };
-
- ColorAxis.prototype.destroy = function () {
- this.chart.isDirtyLegend = true;
- this.destroyItems();
- _super.prototype.destroy.apply(this, [].slice.call(arguments));
- };
-
- ColorAxis.prototype.remove = function (redraw) {
- this.destroyItems();
- _super.prototype.remove.call(this, redraw);
- };
-
- ColorAxis.prototype.getDataClassLegendSymbols = function () {
- var axis = this;
- var chart = axis.chart;
- var legendItems = axis.legendItems;
- var legendOptions = chart.options.legend;
- var valueDecimals = legendOptions.valueDecimals;
- var valueSuffix = legendOptions.valueSuffix || '';
- var name;
- if (!legendItems.length) {
- axis.dataClasses.forEach(function (dataClass, i) {
- var vis = true,
- from = dataClass.from,
- to = dataClass.to;
- var numberFormatter = chart.numberFormatter;
-
-
- name = '';
- if (typeof from === 'undefined') {
- name = '< ';
- }
- else if (typeof to === 'undefined') {
- name = '> ';
- }
- if (typeof from !== 'undefined') {
- name += numberFormatter(from, valueDecimals) + valueSuffix;
- }
- if (typeof from !== 'undefined' && typeof to !== 'undefined') {
- name += ' - ';
- }
- if (typeof to !== 'undefined') {
- name += numberFormatter(to, valueDecimals) + valueSuffix;
- }
-
- legendItems.push(extend({
- chart: chart,
- name: name,
- options: {},
- drawLegendSymbol: LegendSymbolMixin.drawRectangle,
- visible: true,
- setState: noop,
- isDataClass: true,
- setVisible: function () {
- vis = axis.visible = !vis;
- axis.series.forEach(function (series) {
- series.points.forEach(function (point) {
- if (point.dataClass === i) {
- point.setVisible(vis);
- }
- });
- });
- chart.legend.colorizeItem(this, vis);
- }
- }, dataClass));
- });
- }
- return legendItems;
- };
-
- ColorAxis.defaultLegendLength = 200;
-
- ColorAxis.defaultColorAxisOptions = {
-
-
-
-
-
-
-
-
-
- lineWidth: 0,
-
- minPadding: 0,
-
-
-
- maxPadding: 0,
-
-
- gridLineWidth: 1,
-
-
- tickPixelInterval: 72,
-
- startOnTick: true,
-
- endOnTick: true,
-
- offset: 0,
-
- marker: {
-
- animation: {
-
- duration: 50
- },
-
- width: 0.01,
-
- color: palette.neutralColor40
- },
-
- labels: {
-
- overflow: 'justify',
- rotation: 0
- },
-
- minColor: palette.highlightColor10,
-
- maxColor: palette.highlightColor100,
-
-
- tickLength: 5,
-
-
-
-
-
- showInLegend: true
- };
-
- ColorAxis.keepProps = [
- 'legendGroup',
- 'legendItemHeight',
- 'legendItemWidth',
- 'legendItem',
- 'legendSymbol'
- ];
- return ColorAxis;
- }(Axis));
-
- Array.prototype.push.apply(Axis.keepProps, ColorAxis.keepProps);
- H.ColorAxis = ColorAxis;
-
-
- ['fill', 'stroke'].forEach(function (prop) {
- Fx.prototype[prop + 'Setter'] = function () {
- this.elem.attr(prop, color(this.start).tweenTo(color(this.end), this.pos), null, true);
- };
- });
-
- addEvent(Chart, 'afterGetAxes', function () {
- var chart = this,
- options = chart.options;
- this.colorAxis = [];
- if (options.colorAxis) {
- options.colorAxis = splat(options.colorAxis);
- options.colorAxis.forEach(function (axisOptions, i) {
- axisOptions.index = i;
- new ColorAxis(chart, axisOptions);
- });
- }
- });
-
- addEvent(Series, 'bindAxes', function () {
- var axisTypes = this.axisTypes;
- if (!axisTypes) {
- this.axisTypes = ['colorAxis'];
- }
- else if (axisTypes.indexOf('colorAxis') === -1) {
- axisTypes.push('colorAxis');
- }
- });
-
-
- addEvent(Legend, 'afterGetAllItems', function (e) {
- var _this = this;
- var colorAxisItems = [],
- colorAxes = this.chart.colorAxis || [],
- options,
- i;
- var destroyItem = function (item) {
- var i = e.allItems.indexOf(item);
- if (i !== -1) {
-
- _this.destroyItem(e.allItems[i]);
- e.allItems.splice(i, 1);
- }
- };
- colorAxes.forEach(function (colorAxis) {
- options = colorAxis.options;
- if (options && options.showInLegend) {
-
- if (options.dataClasses && options.visible) {
- colorAxisItems = colorAxisItems.concat(colorAxis.getDataClassLegendSymbols());
-
- }
- else if (options.visible) {
-
- colorAxisItems.push(colorAxis);
- }
-
-
- colorAxis.series.forEach(function (series) {
- if (!series.options.showInLegend || options.dataClasses) {
- if (series.options.legendType === 'point') {
- series.points.forEach(function (point) {
- destroyItem(point);
- });
- }
- else {
- destroyItem(series);
- }
- }
- });
- }
- });
- i = colorAxisItems.length;
- while (i--) {
- e.allItems.unshift(colorAxisItems[i]);
- }
- });
- addEvent(Legend, 'afterColorizeItem', function (e) {
- if (e.visible && e.item.legendColor) {
- e.item.legendSymbol.attr({
- fill: e.item.legendColor
- });
- }
- });
-
- addEvent(Legend, 'afterUpdate', function () {
- var colorAxes = this.chart.colorAxis;
- if (colorAxes) {
- colorAxes.forEach(function (colorAxis) {
- colorAxis.update({}, arguments[2]);
- });
- }
- });
-
- addEvent(Series, 'afterTranslate', function () {
- if (this.chart.colorAxis &&
- this.chart.colorAxis.length ||
- this.colorAttribs) {
- this.translateColors();
- }
- });
- return ColorAxis;
- });
- _registerModule(_modules, 'Mixins/ColorMapSeries.js', [_modules['Core/Globals.js'], _modules['Core/Series/Point.js'], _modules['Core/Utilities.js']], function (H, Point, U) {
-
- var defined = U.defined,
- addEvent = U.addEvent;
- var noop = H.noop,
- seriesTypes = H.seriesTypes;
-
- addEvent(Point, 'afterSetState', function (e) {
- var point = this;
- if (point.moveToTopOnHover && point.graphic) {
- point.graphic.attr({
- zIndex: e && e.state === 'hover' ? 1 : 0
- });
- }
- });
-
- var colorMapPointMixin = {
- dataLabelOnNull: true,
- moveToTopOnHover: true,
-
-
- isValid: function () {
-
- return (this.value !== null &&
- this.value !== Infinity &&
- this.value !== -Infinity);
- }
-
- };
-
- var colorMapSeriesMixin = {
- pointArrayMap: ['value'],
- axisTypes: ['xAxis', 'yAxis', 'colorAxis'],
- trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'],
- getSymbol: noop,
- parallelArrays: ['x', 'y', 'value'],
- colorKey: 'value',
- pointAttribs: seriesTypes.column.prototype.pointAttribs,
-
-
- colorAttribs: function (point) {
- var ret = {};
- if (defined(point.color) &&
- (!point.state || point.state === 'normal')
- ) {
- ret[this.colorProp || 'fill'] = point.color;
- }
- return ret;
- }
- };
- var exports = {
- colorMapPointMixin: colorMapPointMixin,
- colorMapSeriesMixin: colorMapSeriesMixin
- };
- return exports;
- });
- _registerModule(_modules, 'Maps/MapNavigationOptionsDefault.js', [_modules['Core/DefaultOptions.js'], _modules['Core/Utilities.js']], function (D, U) {
-
- var extend = U.extend;
-
-
- var defaultOptions = {
-
- buttonOptions: {
-
- alignTo: 'plotBox',
-
- align: 'left',
-
- verticalAlign: 'top',
-
- x: 0,
-
- width: 18,
-
- height: 18,
-
- padding: 5,
-
- style: {
-
- fontSize: '15px',
-
- fontWeight: 'bold'
- },
-
- theme: {
-
- 'stroke-width': 1,
-
- 'text-align': 'center'
- }
- },
-
- buttons: {
-
- zoomIn: {
-
-
- onclick: function () {
- this.mapZoom(0.5);
- },
-
- text: '+',
-
- y: 0
- },
-
- zoomOut: {
-
-
- onclick: function () {
- this.mapZoom(2);
- },
-
- text: '-',
-
- y: 28
- }
- },
-
-
-
-
-
-
-
- mouseWheelSensitivity: 1.1
-
-
-
-
-
-
- };
-
-
- extend(D.defaultOptions.lang, {
- zoomIn: 'Zoom in',
- zoomOut: 'Zoom out'
- });
-
- D.defaultOptions.mapNavigation = defaultOptions;
-
- return defaultOptions;
- });
- _registerModule(_modules, 'Maps/MapNavigation.js', [_modules['Core/Chart/Chart.js'], _modules['Core/Globals.js'], _modules['Core/Utilities.js']], function (Chart, H, U) {
-
- var doc = H.doc;
- var addEvent = U.addEvent,
- extend = U.extend,
- merge = U.merge,
- objectEach = U.objectEach,
- pick = U.pick;
-
-
- function stopEvent(e) {
- if (e) {
- if (e.preventDefault) {
- e.preventDefault();
- }
- if (e.stopPropagation) {
- e.stopPropagation();
- }
- e.cancelBubble = true;
- }
- }
-
- function MapNavigation(chart) {
- this.init(chart);
- }
-
- MapNavigation.prototype.init = function (chart) {
- this.chart = chart;
- chart.mapNavButtons = [];
- };
-
- MapNavigation.prototype.update = function (options) {
- var chart = this.chart,
- o = chart.options.mapNavigation,
- attr,
- states,
- hoverStates,
- selectStates,
- outerHandler = function (e) {
- this.handler.call(chart,
- e);
- stopEvent(e);
- }, mapNavButtons = chart.mapNavButtons;
-
-
- if (options) {
- o = chart.options.mapNavigation =
- merge(chart.options.mapNavigation, options);
- }
-
- while (mapNavButtons.length) {
- mapNavButtons.pop().destroy();
- }
- if (pick(o.enableButtons, o.enabled) && !chart.renderer.forExport) {
- objectEach(o.buttons, function (buttonOptions, n) {
- buttonOptions = merge(o.buttonOptions, buttonOptions);
-
- if (!chart.styledMode && buttonOptions.theme) {
- attr = buttonOptions.theme;
- attr.style = merge(buttonOptions.theme.style, buttonOptions.style
- );
- states = attr.states;
- hoverStates = states && states.hover;
- selectStates = states && states.select;
- delete attr.states;
- }
- var button = chart.renderer
- .button(buttonOptions.text || '', 0, 0, outerHandler, attr, hoverStates, selectStates, void 0, n === 'zoomIn' ? 'topbutton' : 'bottombutton')
- .addClass('highcharts-map-navigation highcharts-' + {
- zoomIn: 'zoom-in',
- zoomOut: 'zoom-out'
- }[n])
- .attr({
- width: buttonOptions.width,
- height: buttonOptions.height,
- title: chart.options.lang[n],
- padding: buttonOptions.padding,
- zIndex: 5
- })
- .add();
- button.handler = buttonOptions.onclick;
-
- addEvent(button.element, 'dblclick', stopEvent);
- mapNavButtons.push(button);
- extend(buttonOptions, {
- width: button.width,
- height: 2 * button.height
- });
- if (!chart.hasLoaded) {
-
- var unbind_1 = addEvent(chart, 'load',
- function () {
-
- if (button.element) {
- button.align(buttonOptions,
- false,
- buttonOptions.alignTo);
- }
- unbind_1();
- });
- }
- else {
- button.align(buttonOptions, false, buttonOptions.alignTo);
- }
- });
- }
- this.updateEvents(o);
- };
-
- MapNavigation.prototype.updateEvents = function (options) {
- var chart = this.chart;
-
- if (pick(options.enableDoubleClickZoom, options.enabled) ||
- options.enableDoubleClickZoomTo) {
- this.unbindDblClick = this.unbindDblClick || addEvent(chart.container, 'dblclick', function (e) {
- chart.pointer.onContainerDblClick(e);
- });
- }
- else if (this.unbindDblClick) {
-
- this.unbindDblClick = this.unbindDblClick();
- }
-
- if (pick(options.enableMouseWheelZoom, options.enabled)) {
- this.unbindMouseWheel = this.unbindMouseWheel || addEvent(chart.container, doc.onwheel !== void 0 ? 'wheel' :
- doc.onmousewheel !== void 0 ? 'mousewheel' :
- 'DOMMouseScroll', function (e) {
-
-
- if (!chart.pointer.inClass(e.target, 'highcharts-no-mousewheel')) {
- chart.pointer.onContainerMouseWheel(e);
-
-
- stopEvent(e);
- }
- return false;
- });
- }
- else if (this.unbindMouseWheel) {
-
- this.unbindMouseWheel = this.unbindMouseWheel();
- }
- };
-
- extend(Chart.prototype, {
-
- fitToBox: function (inner, outer) {
- [['x', 'width'], ['y', 'height']].forEach(function (dim) {
- var pos = dim[0],
- size = dim[1];
- if (inner[pos] + inner[size] >
- outer[pos] + outer[size]) {
-
- if (inner[size] > outer[size]) {
- inner[size] = outer[size];
- inner[pos] = outer[pos];
- }
- else {
- inner[pos] = outer[pos] +
- outer[size] - inner[size];
- }
- }
- if (inner[size] > outer[size]) {
- inner[size] = outer[size];
- }
- if (inner[pos] < outer[pos]) {
- inner[pos] = outer[pos];
- }
- });
- return inner;
- },
-
- mapZoom: function (howMuch, centerXArg, centerYArg, mouseX, mouseY, animation) {
- var chart = this,
- xAxis = chart.xAxis[0],
- xRange = xAxis.max - xAxis.min,
- centerX = pick(centerXArg,
- xAxis.min + xRange / 2),
- newXRange = xRange * howMuch,
- yAxis = chart.yAxis[0],
- yRange = yAxis.max - yAxis.min,
- centerY = pick(centerYArg,
- yAxis.min + yRange / 2),
- newYRange = yRange * howMuch,
- fixToX = mouseX ? ((mouseX - xAxis.pos) / xAxis.len) : 0.5,
- fixToY = mouseY ? ((mouseY - yAxis.pos) / yAxis.len) : 0.5,
- newXMin = centerX - newXRange * fixToX,
- newYMin = centerY - newYRange * fixToY,
- newExt = chart.fitToBox({
- x: newXMin,
- y: newYMin,
- width: newXRange,
- height: newYRange
- }, {
- x: xAxis.dataMin,
- y: yAxis.dataMin,
- width: xAxis.dataMax - xAxis.dataMin,
- height: yAxis.dataMax - yAxis.dataMin
- }),
- zoomOut = (newExt.x <= xAxis.dataMin &&
- newExt.width >=
- xAxis.dataMax - xAxis.dataMin &&
- newExt.y <= yAxis.dataMin &&
- newExt.height >= yAxis.dataMax - yAxis.dataMin);
-
- if (mouseX && xAxis.mapAxis) {
- xAxis.mapAxis.fixTo = [mouseX - xAxis.pos, centerXArg];
- }
- if (mouseY && yAxis.mapAxis) {
- yAxis.mapAxis.fixTo = [mouseY - yAxis.pos, centerYArg];
- }
-
- if (typeof howMuch !== 'undefined' && !zoomOut) {
- xAxis.setExtremes(newExt.x, newExt.x + newExt.width, false);
- yAxis.setExtremes(newExt.y, newExt.y + newExt.height, false);
-
- }
- else {
- xAxis.setExtremes(void 0, void 0, false);
- yAxis.setExtremes(void 0, void 0, false);
- }
-
-
-
- chart.redraw(animation);
- }
- });
-
- addEvent(Chart, 'beforeRender', function () {
-
-
- this.mapNavigation = new MapNavigation(this);
- this.mapNavigation.update();
- });
- H.MapNavigation = MapNavigation;
- });
- _registerModule(_modules, 'Maps/MapPointer.js', [_modules['Core/Pointer.js'], _modules['Core/Utilities.js']], function (Pointer, U) {
-
- var extend = U.extend,
- pick = U.pick,
- wrap = U.wrap;
-
- var totalWheelDelta = 0;
- var totalWheelDeltaTimer;
-
- extend(Pointer.prototype, {
-
- onContainerDblClick: function (e) {
- var chart = this.chart;
- e = this.normalize(e);
- if (chart.options.mapNavigation.enableDoubleClickZoomTo) {
- if (chart.pointer.inClass(e.target, 'highcharts-tracker') &&
- chart.hoverPoint) {
- chart.hoverPoint.zoomTo();
- }
- }
- else if (chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop)) {
- chart.mapZoom(0.5, chart.xAxis[0].toValue(e.chartX), chart.yAxis[0].toValue(e.chartY), e.chartX, e.chartY);
- }
- },
-
- onContainerMouseWheel: function (e) {
- var chart = this.chart;
- e = this.normalize(e);
-
- var delta = e.deltaY || e.detail || -(e.wheelDelta / 120);
-
-
-
-
-
-
- if (Math.abs(delta) >= 1) {
- totalWheelDelta += Math.abs(delta);
- if (totalWheelDeltaTimer) {
- clearTimeout(totalWheelDeltaTimer);
- }
- totalWheelDeltaTimer = setTimeout(function () {
- totalWheelDelta = 0;
- }, 50);
- }
- if (totalWheelDelta < 10 && chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop)) {
- chart.mapZoom(Math.pow(chart.options.mapNavigation.mouseWheelSensitivity, delta), chart.xAxis[0].toValue(e.chartX), chart.yAxis[0].toValue(e.chartY), e.chartX, e.chartY,
-
-
- Math.abs(delta) < 1 ? false : void 0);
- }
- }
- });
-
- wrap(Pointer.prototype, 'zoomOption', function (proceed) {
- var mapNavigation = this.chart.options.mapNavigation;
-
- if (pick(mapNavigation.enableTouchZoom, mapNavigation.enabled)) {
- this.chart.options.chart.pinchType = 'xy';
- }
- proceed.apply(this, [].slice.call(arguments, 1));
- });
-
- wrap(Pointer.prototype, 'pinchTranslate', function (proceed, pinchDown, touches, transform, selectionMarker, clip, lastValidTouch) {
- var xBigger;
- proceed.call(this, pinchDown, touches, transform, selectionMarker, clip, lastValidTouch);
-
- if (this.chart.options.chart.type === 'map' && this.hasZoom) {
- xBigger = transform.scaleX > transform.scaleY;
- this.pinchTranslateDirection(!xBigger, pinchDown, touches, transform, selectionMarker, clip, lastValidTouch, xBigger ? transform.scaleX : transform.scaleY);
- }
- });
- });
- _registerModule(_modules, 'Maps/MapSymbols.js', [_modules['Core/Renderer/SVG/SVGRenderer.js']], function (SVGRenderer) {
-
- var symbols = SVGRenderer.prototype.symbols;
-
-
- function bottomButton(x, y, w, h, options) {
- var r = (options && options.r) || 0;
- return selectiveRoundedRect(x - 1, y - 1, w, h, 0, 0, r, r);
- }
-
- function selectiveRoundedRect(x, y, w, h, rTopLeft, rTopRight, rBottomRight, rBottomLeft) {
- return [
- ['M', x + rTopLeft, y],
-
- ['L', x + w - rTopRight, y],
-
- ['C', x + w - rTopRight / 2, y, x + w, y + rTopRight / 2, x + w, y + rTopRight],
-
- ['L', x + w, y + h - rBottomRight],
-
- ['C', x + w, y + h - rBottomRight / 2, x + w - rBottomRight / 2, y + h, x + w - rBottomRight, y + h],
-
- ['L', x + rBottomLeft, y + h],
-
- ['C', x + rBottomLeft / 2, y + h, x, y + h - rBottomLeft / 2, x, y + h - rBottomLeft],
-
- ['L', x, y + rTopLeft],
-
- ['C', x, y + rTopLeft / 2, x + rTopLeft / 2, y, x + rTopLeft, y],
- ['Z']
- ];
- }
- function topButton(x, y, w, h, options) {
- var r = (options && options.r) || 0;
- return selectiveRoundedRect(x - 1, y - 1, w, h, r, r, 0, 0);
- }
- symbols.bottombutton = bottomButton;
- symbols.topbutton = topButton;
-
- return symbols;
- });
- _registerModule(_modules, 'Core/Chart/MapChart.js', [_modules['Core/Chart/Chart.js'], _modules['Core/DefaultOptions.js'], _modules['Core/Renderer/SVG/SVGRenderer.js'], _modules['Core/Utilities.js']], function (Chart, D, SVGRenderer, U) {
-
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d,
- b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d,
- b) { d.__proto__ = b; }) ||
- function (d,
- b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var getOptions = D.getOptions;
- var merge = U.merge,
- pick = U.pick;
-
- var MapChart = (function (_super) {
- __extends(MapChart, _super);
- function MapChart() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
-
- MapChart.prototype.init = function (userOptions, callback) {
- var hiddenAxis = {
- endOnTick: false,
- visible: false,
- minPadding: 0,
- maxPadding: 0,
- startOnTick: false
- },
- defaultCreditsOptions = getOptions().credits;
-
- var options = merge({
- chart: {
- panning: {
- enabled: true,
- type: 'xy'
- },
- type: 'map'
- },
- credits: {
- mapText: pick(defaultCreditsOptions.mapText, ' \u00a9 <a href="{geojson.copyrightUrl}">' +
- '{geojson.copyrightShort}</a>'),
- mapTextFull: pick(defaultCreditsOptions.mapTextFull, '{geojson.copyright}')
- },
- tooltip: {
- followTouchMove: false
- },
- xAxis: hiddenAxis,
- yAxis: merge(hiddenAxis, { reversed: true })
- },
- userOptions,
- {
- chart: {
- inverted: false,
- alignTicks: false
- }
- });
- _super.prototype.init.call(this, options, callback);
- };
- return MapChart;
- }(Chart));
-
- (function (MapChart) {
-
- MapChart.maps = {};
-
- function mapChart(a, b, c) {
- return new MapChart(a, b, c);
- }
- MapChart.mapChart = mapChart;
-
- function splitPath(path) {
- var arr;
- if (typeof path === 'string') {
- path = path
-
- .replace(/([A-Za-z])/g, ' $1 ')
-
- .replace(/^\s*/, '').replace(/\s*$/, '');
-
-
-
- var split = path.split(/[ ,;]+/);
- arr = split.map(function (item) {
- if (!/[A-za-z]/.test(item)) {
- return parseFloat(item);
- }
- return item;
- });
- }
- else {
- arr = path;
- }
- return SVGRenderer.prototype.pathToSegments(arr);
- }
- MapChart.splitPath = splitPath;
- })(MapChart || (MapChart = {}));
-
- return MapChart;
- });
- _registerModule(_modules, 'Series/Map/MapPoint.js', [_modules['Mixins/ColorMapSeries.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (ColorMapMixin, SeriesRegistry, U) {
-
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d,
- b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d,
- b) { d.__proto__ = b; }) ||
- function (d,
- b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var colorMapPointMixin = ColorMapMixin.colorMapPointMixin;
- var ScatterSeries = SeriesRegistry.seriesTypes.scatter;
- var extend = U.extend;
-
- var MapPoint = (function (_super) {
- __extends(MapPoint, _super);
- function MapPoint() {
-
- var _this = _super !== null && _super.apply(this,
- arguments) || this;
- _this.options = void 0;
- _this.path = void 0;
- _this.series = void 0;
- return _this;
-
- }
-
-
-
- MapPoint.prototype.applyOptions = function (options, x) {
- var series = this.series,
- point = _super.prototype.applyOptions.call(this,
- options,
- x),
- joinBy = series.joinBy,
- mapPoint;
- if (series.mapData && series.mapMap) {
- var joinKey = joinBy[1];
- var mapKey = _super.prototype.getNestedProperty.call(point,
- joinKey);
- mapPoint = typeof mapKey !== 'undefined' &&
- series.mapMap[mapKey];
- if (mapPoint) {
-
- if (series.xyFromShape) {
- point.x = mapPoint._midX;
- point.y = mapPoint._midY;
- }
- extend(point, mapPoint);
- }
- else {
- point.value = point.value || null;
- }
- }
- return point;
- };
-
- MapPoint.prototype.onMouseOver = function (e) {
- U.clearTimeout(this.colorInterval);
- if (this.value !== null || this.series.options.nullInteraction) {
- _super.prototype.onMouseOver.call(this, e);
- }
- else {
-
- this.series.onMouseOut(e);
- }
- };
-
- MapPoint.prototype.zoomTo = function () {
- var point = this,
- series = point.series;
- series.xAxis.setExtremes(point._minX, point._maxX, false);
- series.yAxis.setExtremes(point._minY, point._maxY, false);
- series.chart.redraw();
- };
- return MapPoint;
- }(ScatterSeries.prototype.pointClass));
- extend(MapPoint.prototype, {
- dataLabelOnNull: colorMapPointMixin.dataLabelOnNull,
- isValid: colorMapPointMixin.isValid,
- moveToTopOnHover: colorMapPointMixin.moveToTopOnHover
- });
-
- return MapPoint;
- });
- _registerModule(_modules, 'Series/Map/MapSeries.js', [_modules['Mixins/ColorMapSeries.js'], _modules['Core/Globals.js'], _modules['Mixins/LegendSymbol.js'], _modules['Core/Chart/MapChart.js'], _modules['Series/Map/MapPoint.js'], _modules['Core/Color/Palette.js'], _modules['Core/Series/Series.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Renderer/SVG/SVGRenderer.js'], _modules['Core/Utilities.js']], function (ColorMapMixin, H, LegendSymbolMixin, MapChart, MapPoint, palette, Series, SeriesRegistry, SVGRenderer, U) {
-
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d,
- b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d,
- b) { d.__proto__ = b; }) ||
- function (d,
- b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var colorMapSeriesMixin = ColorMapMixin.colorMapSeriesMixin;
- var noop = H.noop;
- var maps = MapChart.maps,
- splitPath = MapChart.splitPath;
- var
-
- _a = SeriesRegistry.seriesTypes,
- ColumnSeries = _a.column,
- ScatterSeries = _a.scatter;
- var extend = U.extend,
- fireEvent = U.fireEvent,
- getNestedProperty = U.getNestedProperty,
- isArray = U.isArray,
- isNumber = U.isNumber,
- merge = U.merge,
- objectEach = U.objectEach,
- pick = U.pick,
- splat = U.splat;
-
-
- var MapSeries = (function (_super) {
- __extends(MapSeries, _super);
- function MapSeries() {
-
- var _this = _super !== null && _super.apply(this,
- arguments) || this;
-
- _this.baseTrans = void 0;
- _this.chart = void 0;
- _this.data = void 0;
- _this.group = void 0;
- _this.joinBy = void 0;
- _this.options = void 0;
- _this.points = void 0;
- _this.transformGroup = void 0;
- return _this;
-
- }
-
-
-
- MapSeries.prototype.animate = function (init) {
- var chart = this.chart,
- animation = this.options.animation,
- group = this.group,
- xAxis = this.xAxis,
- yAxis = this.yAxis,
- left = xAxis.pos,
- top = yAxis.pos;
- if (chart.renderer.isSVG) {
- if (animation === true) {
- animation = {
- duration: 1000
- };
- }
-
- if (init) {
-
- group.attr({
- translateX: left + xAxis.len / 2,
- translateY: top + yAxis.len / 2,
- scaleX: 0.001,
- scaleY: 0.001
- });
-
- }
- else {
- group.animate({
- translateX: left,
- translateY: top,
- scaleX: 1,
- scaleY: 1
- }, animation);
- }
- }
- };
-
- MapSeries.prototype.animateDrilldown = function (init) {
- var toBox = this.chart.plotBox,
- level = this.chart.drilldownLevels[this.chart.drilldownLevels.length - 1],
- fromBox = level.bBox,
- animationOptions = this.chart.options.drilldown.animation,
- scale;
- if (!init) {
- scale = Math.min(fromBox.width / toBox.width, fromBox.height / toBox.height);
- level.shapeArgs = {
- scaleX: scale,
- scaleY: scale,
- translateX: fromBox.x,
- translateY: fromBox.y
- };
- this.points.forEach(function (point) {
- if (point.graphic) {
- point.graphic
- .attr(level.shapeArgs)
- .animate({
- scaleX: 1,
- scaleY: 1,
- translateX: 0,
- translateY: 0
- }, animationOptions);
- }
- });
- }
- };
-
- MapSeries.prototype.animateDrillupFrom = function (level) {
- ColumnSeries.prototype.animateDrillupFrom.call(this, level);
- };
-
- MapSeries.prototype.animateDrillupTo = function (init) {
- ColumnSeries.prototype.animateDrillupTo.call(this, init);
- };
-
- MapSeries.prototype.doFullTranslate = function () {
- return (this.isDirtyData ||
- this.chart.isResizing ||
- this.chart.renderer.isVML ||
- !this.baseTrans);
- };
-
- MapSeries.prototype.drawMapDataLabels = function () {
- Series.prototype.drawDataLabels.call(this);
- if (this.dataLabelsGroup) {
- this.dataLabelsGroup.clip(this.chart.clipRect);
- }
- };
-
- MapSeries.prototype.drawPoints = function () {
- var series = this,
- xAxis = series.xAxis,
- yAxis = series.yAxis,
- group = series.group,
- chart = series.chart,
- renderer = chart.renderer,
- scaleX,
- scaleY,
- translateX,
- translateY,
- baseTrans = this.baseTrans,
- transformGroup,
- startTranslateX,
- startTranslateY,
- startScaleX,
- startScaleY;
-
-
- if (!series.transformGroup) {
- series.transformGroup = renderer.g()
- .attr({
- scaleX: 1,
- scaleY: 1
- })
- .add(group);
- series.transformGroup.survive = true;
- }
-
- if (series.doFullTranslate()) {
-
- if (chart.hasRendered && !chart.styledMode) {
- series.points.forEach(function (point) {
-
- if (point.shapeArgs) {
- point.shapeArgs.fill = series.pointAttribs(point, point.state).fill;
- }
- });
- }
-
- series.group = series.transformGroup;
- ColumnSeries.prototype.drawPoints.apply(series);
- series.group = group;
-
- series.points.forEach(function (point) {
- if (point.graphic) {
- var className = '';
- if (point.name) {
- className +=
- 'highcharts-name-' +
- point.name.replace(/ /g, '-').toLowerCase();
- }
- if (point.properties &&
- point.properties['hc-key']) {
- className +=
- ' highcharts-key-' +
- point.properties['hc-key'].toLowerCase();
- }
- if (className) {
- point.graphic.addClass(className);
- }
-
- if (chart.styledMode) {
- point.graphic.css(series.pointAttribs(point, point.selected && 'select' || void 0));
- }
- }
- });
-
-
-
- this.baseTrans = {
- originX: (xAxis.min -
- xAxis.minPixelPadding / xAxis.transA),
- originY: (yAxis.min -
- yAxis.minPixelPadding / yAxis.transA +
- (yAxis.reversed ? 0 : yAxis.len / yAxis.transA)),
- transAX: xAxis.transA,
- transAY: yAxis.transA
- };
-
-
- this.transformGroup.animate({
- translateX: 0,
- translateY: 0,
- scaleX: 1,
- scaleY: 1
- });
-
- }
- else {
- scaleX = xAxis.transA / baseTrans.transAX;
- scaleY = yAxis.transA / baseTrans.transAY;
- translateX = xAxis.toPixels(baseTrans.originX, true);
- translateY = yAxis.toPixels(baseTrans.originY, true);
-
- if (scaleX > 0.99 &&
- scaleX < 1.01 &&
- scaleY > 0.99 &&
- scaleY < 1.01) {
- scaleX = 1;
- scaleY = 1;
- translateX = Math.round(translateX);
- translateY = Math.round(translateY);
- }
-
- transformGroup = this.transformGroup;
- if (chart.renderer.globalAnimation) {
- startTranslateX = transformGroup.attr('translateX');
- startTranslateY = transformGroup.attr('translateY');
- startScaleX = transformGroup.attr('scaleX');
- startScaleY = transformGroup.attr('scaleY');
- transformGroup
- .attr({ animator: 0 })
- .animate({
- animator: 1
- }, {
- step: function (now, fx) {
- transformGroup.attr({
- translateX: (startTranslateX +
- (translateX - startTranslateX) * fx.pos),
- translateY: (startTranslateY +
- (translateY - startTranslateY) * fx.pos),
- scaleX: (startScaleX +
- (scaleX - startScaleX) *
- fx.pos),
- scaleY: (startScaleY +
- (scaleY - startScaleY) * fx.pos)
- });
- }
- });
-
- }
- else {
- transformGroup.attr({
- translateX: translateX,
- translateY: translateY,
- scaleX: scaleX,
- scaleY: scaleY
- });
- }
- }
-
- if (!chart.styledMode) {
- group.element.setAttribute('stroke-width', (pick(series.options[(series.pointAttrToOptions &&
- series.pointAttrToOptions['stroke-width']) || 'borderWidth'], 1
- ) / (scaleX || 1)));
- }
- this.drawMapDataLabels();
- };
-
- MapSeries.prototype.getBox = function (paths) {
- var MAX_VALUE = Number.MAX_VALUE,
- maxX = -MAX_VALUE,
- minX = MAX_VALUE,
- maxY = -MAX_VALUE,
- minY = MAX_VALUE,
- minRange = MAX_VALUE,
- xAxis = this.xAxis,
- yAxis = this.yAxis,
- hasBox;
-
- (paths || []).forEach(function (point) {
- if (point.path) {
- if (typeof point.path === 'string') {
- point.path = splitPath(point.path);
-
- }
- else if (point.path[0] === 'M') {
- point.path = SVGRenderer.prototype.pathToSegments(point.path);
- }
- var path = point.path || [],
- pointMaxX_1 = -MAX_VALUE,
- pointMinX_1 = MAX_VALUE,
- pointMaxY_1 = -MAX_VALUE,
- pointMinY_1 = MAX_VALUE,
- properties = point.properties;
-
- if (!point._foundBox) {
- path.forEach(function (seg) {
- var x = seg[seg.length - 2];
- var y = seg[seg.length - 1];
- if (typeof x === 'number' && typeof y === 'number') {
- pointMinX_1 = Math.min(pointMinX_1, x);
- pointMaxX_1 = Math.max(pointMaxX_1, x);
- pointMinY_1 = Math.min(pointMinY_1, y);
- pointMaxY_1 = Math.max(pointMaxY_1, y);
- }
- });
-
-
- point._midX = (pointMinX_1 + (pointMaxX_1 - pointMinX_1) * pick(point.middleX, properties &&
- properties['hc-middle-x'], 0.5));
- point._midY = (pointMinY_1 + (pointMaxY_1 - pointMinY_1) * pick(point.middleY, properties &&
- properties['hc-middle-y'], 0.5));
- point._maxX = pointMaxX_1;
- point._minX = pointMinX_1;
- point._maxY = pointMaxY_1;
- point._minY = pointMinY_1;
- point.labelrank = pick(point.labelrank, (pointMaxX_1 - pointMinX_1) * (pointMaxY_1 - pointMinY_1));
- point._foundBox = true;
- }
- maxX = Math.max(maxX, point._maxX);
- minX = Math.min(minX, point._minX);
- maxY = Math.max(maxY, point._maxY);
- minY = Math.min(minY, point._minY);
- minRange = Math.min(point._maxX - point._minX, point._maxY - point._minY, minRange);
- hasBox = true;
- }
- });
-
- if (hasBox) {
- this.minY = Math.min(minY, pick(this.minY, MAX_VALUE));
- this.maxY = Math.max(maxY, pick(this.maxY, -MAX_VALUE));
- this.minX = Math.min(minX, pick(this.minX, MAX_VALUE));
- this.maxX = Math.max(maxX, pick(this.maxX, -MAX_VALUE));
-
-
- if (xAxis && typeof xAxis.options.minRange === 'undefined') {
- xAxis.minRange = Math.min(5 * minRange, (this.maxX - this.minX) / 5, xAxis.minRange || MAX_VALUE);
- }
- if (yAxis && typeof yAxis.options.minRange === 'undefined') {
- yAxis.minRange = Math.min(5 * minRange, (this.maxY - this.minY) / 5, yAxis.minRange || MAX_VALUE);
- }
- }
- };
- MapSeries.prototype.getExtremes = function () {
-
- var _a = Series.prototype.getExtremes
- .call(this,
- this.valueData),
- dataMin = _a.dataMin,
- dataMax = _a.dataMax;
-
- if (this.chart.hasRendered && this.isDirtyData) {
- this.getBox(this.options.data);
- }
- if (isNumber(dataMin)) {
- this.valueMin = dataMin;
- }
- if (isNumber(dataMax)) {
- this.valueMax = dataMax;
- }
-
- return { dataMin: this.minY, dataMax: this.maxY };
- };
-
- MapSeries.prototype.hasData = function () {
- return !!this.processedXData.length;
- };
-
- MapSeries.prototype.pointAttribs = function (point, state) {
- var attr = point.series.chart.styledMode ?
- this.colorAttribs(point) :
- ColumnSeries.prototype.pointAttribs.call(this,
- point,
- state);
-
-
-
- attr['stroke-width'] = pick(point.options[(this.pointAttrToOptions &&
- this.pointAttrToOptions['stroke-width']) || 'borderWidth'], 'inherit');
- return attr;
- };
-
- MapSeries.prototype.render = function () {
- var series = this,
- render = Series.prototype.render;
-
- if (series.chart.renderer.isVML && series.data.length > 3000) {
- setTimeout(function () {
- render.call(series);
- });
- }
- else {
- render.call(series);
- }
- };
-
- MapSeries.prototype.setData = function (data, redraw, animation, updatePoints) {
- var options = this.options,
- chartOptions = this.chart.options.chart,
- globalMapData = chartOptions && chartOptions.map,
- mapData = options.mapData,
- joinBy = this.joinBy,
- pointArrayMap = options.keys || this.pointArrayMap,
- dataUsed = [],
- mapMap = {},
- mapPoint,
- mapTransforms = this.chart.mapTransforms,
- props,
- i;
-
- if (!mapData && globalMapData) {
- mapData = typeof globalMapData === 'string' ?
- maps[globalMapData] :
- globalMapData;
- }
-
-
- if (data) {
- data.forEach(function (val, i) {
- var ix = 0;
- if (isNumber(val)) {
- data[i] = {
- value: val
- };
- }
- else if (isArray(val)) {
- data[i] = {};
-
-
- if (!options.keys &&
- val.length > pointArrayMap.length &&
- typeof val[0] === 'string') {
- data[i]['hc-key'] = val[0];
- ++ix;
- }
-
-
- for (var j = 0; j < pointArrayMap.length; ++j, ++ix) {
- if (pointArrayMap[j] &&
- typeof val[ix] !== 'undefined') {
- if (pointArrayMap[j].indexOf('.') > 0) {
- MapPoint.prototype.setNestedProperty(data[i], val[ix], pointArrayMap[j]);
- }
- else {
- data[i][pointArrayMap[j]] =
- val[ix];
- }
- }
- }
- }
- if (joinBy && joinBy[0] === '_i') {
- data[i]._i = i;
- }
- });
- }
- this.getBox(data);
-
- this.chart.mapTransforms = mapTransforms =
- chartOptions.mapTransforms ||
- mapData && mapData['hc-transform'] ||
- mapTransforms;
-
- if (mapTransforms) {
- objectEach(mapTransforms, function (transform) {
- if (transform.rotation) {
- transform.cosAngle = Math.cos(transform.rotation);
- transform.sinAngle = Math.sin(transform.rotation);
- }
- });
- }
- if (mapData) {
- if (mapData.type === 'FeatureCollection') {
- this.mapTitle = mapData.title;
- mapData = H.geojson(mapData, this.type, this);
- }
- this.mapData = mapData;
- this.mapMap = {};
- for (i = 0; i < mapData.length; i++) {
- mapPoint = mapData[i];
- props = mapPoint.properties;
- mapPoint._i = i;
-
- if (joinBy[0] && props && props[joinBy[0]]) {
- mapPoint[joinBy[0]] = props[joinBy[0]];
- }
- mapMap[mapPoint[joinBy[0]]] = mapPoint;
- }
- this.mapMap = mapMap;
-
- if (data && joinBy[1]) {
- var joinKey_1 = joinBy[1];
- data.forEach(function (pointOptions) {
- var mapKey = getNestedProperty(joinKey_1,
- pointOptions);
- if (mapMap[mapKey]) {
- dataUsed.push(mapMap[mapKey]);
- }
- });
- }
- if (options.allAreas) {
- this.getBox(mapData);
- data = data || [];
-
- if (joinBy[1]) {
- var joinKey_2 = joinBy[1];
- data.forEach(function (pointOptions) {
- dataUsed.push(getNestedProperty(joinKey_2, pointOptions));
- });
- }
-
-
- dataUsed = ('|' + dataUsed.map(function (point) {
- return point && point[joinBy[0]];
- }).join('|') + '|');
- mapData.forEach(function (mapPoint) {
- if (!joinBy[0] ||
- dataUsed.indexOf('|' + mapPoint[joinBy[0]] + '|') === -1) {
- data.push(merge(mapPoint, { value: null }));
-
-
-
- updatePoints = false;
- }
- });
- }
- else {
- this.getBox(dataUsed);
- }
- }
- Series.prototype.setData.call(this, data, redraw, animation, updatePoints);
- };
-
- MapSeries.prototype.setOptions = function (itemOptions) {
- var options = Series.prototype.setOptions.call(this,
- itemOptions),
- joinBy = options.joinBy,
- joinByNull = joinBy === null;
- if (joinByNull) {
- joinBy = '_i';
- }
- joinBy = this.joinBy = splat(joinBy);
- if (!joinBy[1]) {
- joinBy[1] = joinBy[0];
- }
- return options;
- };
-
- MapSeries.prototype.translate = function () {
- var series = this,
- xAxis = series.xAxis,
- yAxis = series.yAxis,
- doFullTranslate = series.doFullTranslate();
- series.generatePoints();
- series.data.forEach(function (point) {
-
-
- if (isNumber(point._midX) && isNumber(point._midY)) {
- point.plotX = xAxis.toPixels(point._midX, true);
- point.plotY = yAxis.toPixels(point._midY, true);
- }
- if (doFullTranslate) {
- point.shapeType = 'path';
- point.shapeArgs = {
- d: series.translatePath(point.path)
- };
- }
- });
- fireEvent(series, 'afterTranslate');
- };
-
- MapSeries.prototype.translatePath = function (path) {
- var series = this,
- xAxis = series.xAxis,
- yAxis = series.yAxis,
- xMin = xAxis.min,
- xTransA = xAxis.transA,
- xMinPixelPadding = xAxis.minPixelPadding,
- yMin = yAxis.min,
- yTransA = yAxis.transA,
- yMinPixelPadding = yAxis.minPixelPadding,
- ret = [];
-
- if (path) {
- path.forEach(function (seg) {
- if (seg[0] === 'M') {
- ret.push([
- 'M',
- (seg[1] - (xMin || 0)) * xTransA + xMinPixelPadding,
- (seg[2] - (yMin || 0)) * yTransA + yMinPixelPadding
- ]);
- }
- else if (seg[0] === 'L') {
- ret.push([
- 'L',
- (seg[1] - (xMin || 0)) * xTransA + xMinPixelPadding,
- (seg[2] - (yMin || 0)) * yTransA + yMinPixelPadding
- ]);
- }
- else if (seg[0] === 'C') {
- ret.push([
- 'C',
- (seg[1] - (xMin || 0)) * xTransA + xMinPixelPadding,
- (seg[2] - (yMin || 0)) * yTransA + yMinPixelPadding,
- (seg[3] - (xMin || 0)) * xTransA + xMinPixelPadding,
- (seg[4] - (yMin || 0)) * yTransA + yMinPixelPadding,
- (seg[5] - (xMin || 0)) * xTransA + xMinPixelPadding,
- (seg[6] - (yMin || 0)) * yTransA + yMinPixelPadding
- ]);
- }
- else if (seg[0] === 'Q') {
- ret.push([
- 'Q',
- (seg[1] - (xMin || 0)) * xTransA + xMinPixelPadding,
- (seg[2] - (yMin || 0)) * yTransA + yMinPixelPadding,
- (seg[3] - (xMin || 0)) * xTransA + xMinPixelPadding,
- (seg[4] - (yMin || 0)) * yTransA + yMinPixelPadding
- ]);
- }
- else if (seg[0] === 'Z') {
- ret.push(['Z']);
- }
- });
- }
- return ret;
- };
-
- MapSeries.defaultOptions = merge(ScatterSeries.defaultOptions, {
- animation: false,
- dataLabels: {
- crop: false,
- formatter: function () {
- return this.point.value;
- },
- inside: true,
- overflow: false,
- padding: 0,
- verticalAlign: 'middle'
- },
-
- marker: null,
-
- nullColor: palette.neutralColor3,
-
- stickyTracking: false,
- tooltip: {
- followPointer: true,
- pointFormat: '{point.name}: {point.value}<br/>'
- },
-
- turboThreshold: 0,
-
- allAreas: true,
-
- borderColor: palette.neutralColor20,
-
- borderWidth: 1,
-
-
- joinBy: 'hc-key',
-
-
- states: {
-
- hover: {
-
- halo: null,
-
-
-
-
- brightness: 0.2
- },
-
- normal: {
-
- animation: true
- },
-
- select: {
-
- color: palette.neutralColor20
- },
- inactive: {
- opacity: 1
- }
- }
- });
- return MapSeries;
- }(ScatterSeries));
- extend(MapSeries.prototype, {
- type: 'map',
- axisTypes: colorMapSeriesMixin.axisTypes,
- colorAttribs: colorMapSeriesMixin.colorAttribs,
- colorKey: colorMapSeriesMixin.colorKey,
-
-
- directTouch: true,
-
-
- drawDataLabels: noop,
-
- drawGraph: noop,
- drawLegendSymbol: LegendSymbolMixin.drawRectangle,
- forceDL: true,
- getExtremesFromAll: true,
- getSymbol: colorMapSeriesMixin.getSymbol,
- parallelArrays: colorMapSeriesMixin.parallelArrays,
- pointArrayMap: colorMapSeriesMixin.pointArrayMap,
- pointClass: MapPoint,
-
- preserveAspectRatio: true,
- searchPoint: noop,
- trackerGroups: colorMapSeriesMixin.trackerGroups,
-
- useMapGeometry: true
- });
- SeriesRegistry.registerSeriesType('map', MapSeries);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- '';
- return MapSeries;
- });
- _registerModule(_modules, 'Series/MapLine/MapLineSeries.js', [_modules['Series/Map/MapSeries.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (MapSeries, SeriesRegistry, U) {
-
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d,
- b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d,
- b) { d.__proto__ = b; }) ||
- function (d,
- b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var Series = SeriesRegistry.series;
- var extend = U.extend,
- merge = U.merge;
-
-
- var MapLineSeries = (function (_super) {
- __extends(MapLineSeries, _super);
- function MapLineSeries() {
-
- var _this = _super !== null && _super.apply(this,
- arguments) || this;
-
- _this.data = void 0;
- _this.options = void 0;
- _this.points = void 0;
- return _this;
-
- }
-
-
-
- MapLineSeries.prototype.pointAttribs = function (point, state) {
- var attr = MapSeries.prototype.pointAttribs.call(this,
- point,
- state);
-
-
- attr.fill = this.options.fillColor;
- return attr;
- };
-
- MapLineSeries.defaultOptions = merge(MapSeries.defaultOptions, {
-
- lineWidth: 1,
-
- fillColor: 'none'
- });
- return MapLineSeries;
- }(MapSeries));
- extend(MapLineSeries.prototype, {
- type: 'mapline',
- colorProp: 'stroke',
- drawLegendSymbol: Series.prototype.drawLegendSymbol,
- pointAttrToOptions: {
- 'stroke': 'color',
- 'stroke-width': 'lineWidth'
- }
- });
- SeriesRegistry.registerSeriesType('mapline', MapLineSeries);
-
-
-
-
- '';
- return MapLineSeries;
- });
- _registerModule(_modules, 'Series/MapPoint/MapPointPoint.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) {
-
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d,
- b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d,
- b) { d.__proto__ = b; }) ||
- function (d,
- b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var ScatterSeries = SeriesRegistry.seriesTypes.scatter;
- var merge = U.merge;
-
- var MapPointPoint = (function (_super) {
- __extends(MapPointPoint, _super);
- function MapPointPoint() {
-
- var _this = _super !== null && _super.apply(this,
- arguments) || this;
- _this.options = void 0;
- _this.series = void 0;
- return _this;
-
- }
-
-
- MapPointPoint.prototype.applyOptions = function (options, x) {
- var mergedOptions = (typeof options.lat !== 'undefined' &&
- typeof options.lon !== 'undefined' ?
- merge(options,
- this.series.chart.fromLatLonToPoint(options)) :
- options);
- return _super.prototype.applyOptions.call(this, mergedOptions, x);
- };
- return MapPointPoint;
- }(ScatterSeries.prototype.pointClass));
-
- return MapPointPoint;
- });
- _registerModule(_modules, 'Series/MapPoint/MapPointSeries.js', [_modules['Series/MapPoint/MapPointPoint.js'], _modules['Core/Color/Palette.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (MapPointPoint, palette, SeriesRegistry, U) {
-
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d,
- b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d,
- b) { d.__proto__ = b; }) ||
- function (d,
- b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var ScatterSeries = SeriesRegistry.seriesTypes.scatter;
- var extend = U.extend,
- merge = U.merge;
-
-
- var MapPointSeries = (function (_super) {
- __extends(MapPointSeries, _super);
- function MapPointSeries() {
-
- var _this = _super !== null && _super.apply(this,
- arguments) || this;
-
- _this.data = void 0;
- _this.options = void 0;
- _this.points = void 0;
- return _this;
-
- }
-
-
- MapPointSeries.prototype.drawDataLabels = function () {
- _super.prototype.drawDataLabels.call(this);
- if (this.dataLabelsGroup) {
- this.dataLabelsGroup.clip(this.chart.clipRect);
- }
- };
-
- MapPointSeries.defaultOptions = merge(ScatterSeries.defaultOptions, {
- dataLabels: {
- crop: false,
- defer: false,
- enabled: true,
- formatter: function () {
- return this.point.name;
- },
- overflow: false,
- style: {
-
- color: palette.neutralColor100
- }
- }
- });
- return MapPointSeries;
- }(ScatterSeries));
- extend(MapPointSeries.prototype, {
- type: 'mappoint',
- forceDL: true,
- pointClass: MapPointPoint
- });
- SeriesRegistry.registerSeriesType('mappoint', MapPointSeries);
-
-
-
-
-
-
-
-
- '';
- return MapPointSeries;
- });
- _registerModule(_modules, 'Series/Bubble/BubblePoint.js', [_modules['Core/Series/Point.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (Point, SeriesRegistry, U) {
-
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d,
- b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d,
- b) { d.__proto__ = b; }) ||
- function (d,
- b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var ScatterPoint = SeriesRegistry.seriesTypes.scatter.prototype.pointClass;
- var extend = U.extend;
-
- var BubblePoint = (function (_super) {
- __extends(BubblePoint, _super);
- function BubblePoint() {
-
- var _this = _super !== null && _super.apply(this,
- arguments) || this;
- _this.options = void 0;
- _this.series = void 0;
- return _this;
-
- }
-
-
-
- BubblePoint.prototype.haloPath = function (size) {
- return Point.prototype.haloPath.call(this,
-
- size === 0 ? 0 : (this.marker ? this.marker.radius || 0 : 0) + size);
- };
- return BubblePoint;
- }(ScatterPoint));
- extend(BubblePoint.prototype, {
- ttBelow: false
- });
-
- return BubblePoint;
- });
- _registerModule(_modules, 'Series/Bubble/BubbleLegend.js', [_modules['Core/Chart/Chart.js'], _modules['Core/Color/Color.js'], _modules['Core/FormatUtilities.js'], _modules['Core/Globals.js'], _modules['Core/Legend.js'], _modules['Core/DefaultOptions.js'], _modules['Core/Color/Palette.js'], _modules['Core/Series/Series.js'], _modules['Core/Utilities.js']], function (Chart, Color, F, H, Legend, D, palette, Series, U) {
-
- var color = Color.parse;
- var noop = H.noop;
- var setOptions = D.setOptions;
- var addEvent = U.addEvent,
- arrayMax = U.arrayMax,
- arrayMin = U.arrayMin,
- isNumber = U.isNumber,
- merge = U.merge,
- objectEach = U.objectEach,
- pick = U.pick,
- stableSort = U.stableSort,
- wrap = U.wrap;
-
-
-
-
- '';
- setOptions({
- legend: {
-
- bubbleLegend: {
-
- borderColor: void 0,
-
- borderWidth: 2,
-
- className: void 0,
-
- color: void 0,
-
- connectorClassName: void 0,
-
- connectorColor: void 0,
-
- connectorDistance: 60,
-
- connectorWidth: 1,
-
- enabled: false,
-
- labels: {
-
- className: void 0,
-
- allowOverlap: false,
-
- format: '',
-
- formatter: void 0,
-
- align: 'right',
-
- style: {
-
- fontSize: '10px',
-
- color: palette.neutralColor100
- },
-
- x: 0,
-
- y: 0
- },
-
- maxSize: 60,
-
- minSize: 10,
-
- legendIndex: 0,
-
- ranges: {
-
- value: void 0,
-
- borderColor: void 0,
-
- color: void 0,
-
- connectorColor: void 0
- },
-
- sizeBy: 'area',
-
- sizeByAbsoluteValue: false,
-
- zIndex: 1,
-
- zThreshold: 0
- }
- }
- });
-
-
- var BubbleLegend = (function () {
- function BubbleLegend(options, legend) {
- this.chart = void 0;
- this.fontMetrics = void 0;
- this.legend = void 0;
- this.legendGroup = void 0;
- this.legendItem = void 0;
- this.legendItemHeight = void 0;
- this.legendItemWidth = void 0;
- this.legendSymbol = void 0;
- this.maxLabel = void 0;
- this.movementX = void 0;
- this.ranges = void 0;
- this.visible = void 0;
- this.symbols = void 0;
- this.options = void 0;
- this.setState = noop;
- this.init(options, legend);
- }
-
- BubbleLegend.prototype.init = function (options, legend) {
- this.options = options;
- this.visible = true;
- this.chart = legend.chart;
- this.legend = legend;
- };
-
- BubbleLegend.prototype.addToLegend = function (items) {
-
- items.splice(this.options.legendIndex, 0, this);
- };
-
- BubbleLegend.prototype.drawLegendSymbol = function (legend) {
- var chart = this.chart,
- options = this.options,
- size,
- itemDistance = pick(legend.options.itemDistance, 20),
- connectorSpace,
- ranges = options.ranges,
- radius,
- maxLabel,
- connectorDistance = options.connectorDistance;
-
- this.fontMetrics = chart.renderer.fontMetrics(options.labels.style.fontSize);
-
-
- if (!ranges || !ranges.length || !isNumber(ranges[0].value)) {
- legend.options.bubbleLegend.autoRanges = true;
- return;
- }
-
- stableSort(ranges, function (a, b) {
- return b.value - a.value;
- });
- this.ranges = ranges;
- this.setOptions();
- this.render();
-
- maxLabel = this.getMaxLabelSize();
- radius = this.ranges[0].radius;
- size = radius * 2;
-
- connectorSpace =
- connectorDistance - radius + maxLabel.width;
- connectorSpace = connectorSpace > 0 ? connectorSpace : 0;
- this.maxLabel = maxLabel;
- this.movementX = options.labels.align === 'left' ?
- connectorSpace : 0;
- this.legendItemWidth = size + connectorSpace + itemDistance;
- this.legendItemHeight = size + this.fontMetrics.h / 2;
- };
-
- BubbleLegend.prototype.setOptions = function () {
- var ranges = this.ranges,
- options = this.options,
- series = this.chart.series[options.seriesIndex],
- baseline = this.legend.baseline,
- bubbleAttribs = {
- zIndex: options.zIndex,
- 'stroke-width': options.borderWidth
- },
- connectorAttribs = {
- zIndex: options.zIndex,
- 'stroke-width': options.connectorWidth
- },
- labelAttribs = {
- align: (this.legend.options.rtl ||
- options.labels.align === 'left') ? 'right' : 'left',
- zIndex: options.zIndex
- },
- fillOpacity = series.options.marker.fillOpacity,
- styledMode = this.chart.styledMode;
-
- ranges.forEach(function (range, i) {
- if (!styledMode) {
- bubbleAttribs.stroke = pick(range.borderColor, options.borderColor, series.color);
- bubbleAttribs.fill = pick(range.color, options.color, fillOpacity !== 1 ?
- color(series.color).setOpacity(fillOpacity)
- .get('rgba') :
- series.color);
- connectorAttribs.stroke = pick(range.connectorColor, options.connectorColor, series.color);
- }
-
- ranges[i].radius = this.getRangeRadius(range.value);
- ranges[i] = merge(ranges[i], {
- center: (ranges[0].radius - ranges[i].radius +
- baseline)
- });
- if (!styledMode) {
- merge(true, ranges[i], {
- bubbleAttribs: merge(bubbleAttribs),
- connectorAttribs: merge(connectorAttribs),
- labelAttribs: labelAttribs
- });
- }
- }, this);
- };
-
- BubbleLegend.prototype.getRangeRadius = function (value) {
- var options = this.options,
- seriesIndex = this.options.seriesIndex,
- bubbleSeries = this.chart.series[seriesIndex],
- zMax = options.ranges[0].value,
- zMin = options.ranges[options.ranges.length - 1].value,
- minSize = options.minSize,
- maxSize = options.maxSize;
- return bubbleSeries.getRadius.call(this, zMin, zMax, minSize, maxSize, value);
- };
-
- BubbleLegend.prototype.render = function () {
- var renderer = this.chart.renderer,
- zThreshold = this.options.zThreshold;
- if (!this.symbols) {
- this.symbols = {
- connectors: [],
- bubbleItems: [],
- labels: []
- };
- }
-
- this.legendSymbol = renderer.g('bubble-legend');
- this.legendItem = renderer.g('bubble-legend-item');
-
- this.legendSymbol.translateX = 0;
- this.legendSymbol.translateY = 0;
- this.ranges.forEach(function (range) {
- if (range.value >= zThreshold) {
- this.renderRange(range);
- }
- }, this);
-
- this.legendSymbol.add(this.legendItem);
- this.legendItem.add(this.legendGroup);
- this.hideOverlappingLabels();
- };
-
- BubbleLegend.prototype.renderRange = function (range) {
- var mainRange = this.ranges[0],
- legend = this.legend,
- options = this.options,
- labelsOptions = options.labels,
- chart = this.chart,
- bubbleSeries = chart.series[options.seriesIndex],
- renderer = chart.renderer,
- symbols = this.symbols,
- labels = symbols.labels,
- label,
- elementCenter = range.center,
- absoluteRadius = Math.abs(range.radius),
- connectorDistance = options.connectorDistance || 0,
- labelsAlign = labelsOptions.align,
- rtl = legend.options.rtl,
- connectorLength = rtl || labelsAlign === 'left' ?
- -connectorDistance : connectorDistance,
- borderWidth = options.borderWidth,
- connectorWidth = options.connectorWidth,
- posX = mainRange.radius || 0,
- posY = elementCenter - absoluteRadius -
- borderWidth / 2 + connectorWidth / 2,
- labelY,
- labelX,
- fontMetrics = this.fontMetrics,
- labelMovement = fontMetrics.f / 2 -
- (fontMetrics.h - fontMetrics.f) / 2,
- crispMovement = (posY % 1 ? 1 : 0.5) -
- (connectorWidth % 2 ? 0 : 0.5),
- styledMode = renderer.styledMode;
-
- if (labelsAlign === 'center') {
- connectorLength = 0;
- options.connectorDistance = 0;
- range.labelAttribs.align = 'center';
- }
- labelY = posY + options.labels.y;
- labelX = posX + connectorLength + options.labels.x;
-
- symbols.bubbleItems.push(renderer
- .circle(posX, elementCenter + crispMovement, absoluteRadius)
- .attr(styledMode ? {} : range.bubbleAttribs)
- .addClass((styledMode ?
- 'highcharts-color-' +
- bubbleSeries.colorIndex + ' ' :
- '') +
- 'highcharts-bubble-legend-symbol ' +
- (options.className || '')).add(this.legendSymbol));
-
- symbols.connectors.push(renderer
- .path(renderer.crispLine([
- ['M', posX, posY],
- ['L', posX + connectorLength, posY]
- ], options.connectorWidth))
- .attr((styledMode ? {} : range.connectorAttribs))
- .addClass((styledMode ?
- 'highcharts-color-' +
- this.options.seriesIndex + ' ' : '') +
- 'highcharts-bubble-legend-connectors ' +
- (options.connectorClassName || '')).add(this.legendSymbol));
-
- label = renderer
- .text(this.formatLabel(range), labelX, labelY + labelMovement)
- .attr((styledMode ? {} : range.labelAttribs))
- .css(styledMode ? {} : labelsOptions.style)
- .addClass('highcharts-bubble-legend-labels ' +
- (options.labels.className || '')).add(this.legendSymbol);
- labels.push(label);
-
- label.placed = true;
- label.alignAttr = {
- x: labelX,
- y: labelY + labelMovement
- };
- };
-
- BubbleLegend.prototype.getMaxLabelSize = function () {
- var labels = this.symbols.labels,
- maxLabel,
- labelSize;
- labels.forEach(function (label) {
- labelSize = label.getBBox(true);
- if (maxLabel) {
- maxLabel = labelSize.width > maxLabel.width ?
- labelSize : maxLabel;
- }
- else {
- maxLabel = labelSize;
- }
- });
- return maxLabel || {};
- };
-
- BubbleLegend.prototype.formatLabel = function (range) {
- var options = this.options,
- formatter = options.labels.formatter,
- format = options.labels.format;
- var numberFormatter = this.chart.numberFormatter;
- return format ? F.format(format, range) :
- formatter ? formatter.call(range) :
- numberFormatter(range.value, 1);
- };
-
- BubbleLegend.prototype.hideOverlappingLabels = function () {
- var chart = this.chart,
- allowOverlap = this.options.labels.allowOverlap,
- symbols = this.symbols;
- if (!allowOverlap && symbols) {
- chart.hideOverlappingLabels(symbols.labels);
-
- symbols.labels.forEach(function (label, index) {
- if (!label.newOpacity) {
- symbols.connectors[index].hide();
- }
- else if (label.newOpacity !== label.oldOpacity) {
- symbols.connectors[index].show();
- }
- });
- }
- };
-
- BubbleLegend.prototype.getRanges = function () {
- var bubbleLegend = this.legend.bubbleLegend,
- series = bubbleLegend.chart.series,
- ranges,
- rangesOptions = bubbleLegend.options.ranges,
- zData,
- minZ = Number.MAX_VALUE,
- maxZ = -Number.MAX_VALUE;
- series.forEach(function (s) {
-
- if (s.isBubble && !s.ignoreSeries) {
- zData = s.zData.filter(isNumber);
- if (zData.length) {
- minZ = pick(s.options.zMin, Math.min(minZ, Math.max(arrayMin(zData), s.options.displayNegative === false ?
- s.options.zThreshold :
- -Number.MAX_VALUE)));
- maxZ = pick(s.options.zMax, Math.max(maxZ, arrayMax(zData)));
- }
- }
- });
-
- if (minZ === maxZ) {
-
- ranges = [{ value: maxZ }];
- }
- else {
- ranges = [
- { value: minZ },
- { value: (minZ + maxZ) / 2 },
- { value: maxZ, autoRanges: true }
- ];
- }
-
- if (rangesOptions.length && rangesOptions[0].radius) {
- ranges.reverse();
- }
-
- ranges.forEach(function (range, i) {
- if (rangesOptions && rangesOptions[i]) {
- ranges[i] = merge(rangesOptions[i], range);
- }
- });
- return ranges;
- };
-
- BubbleLegend.prototype.predictBubbleSizes = function () {
- var chart = this.chart,
- fontMetrics = this.fontMetrics,
- legendOptions = chart.legend.options,
- floating = legendOptions.floating,
- horizontal = legendOptions.layout === 'horizontal',
- lastLineHeight = horizontal ? chart.legend.lastLineHeight : 0,
- plotSizeX = chart.plotSizeX,
- plotSizeY = chart.plotSizeY,
- bubbleSeries = chart.series[this.options.seriesIndex],
- minSize = Math.ceil(bubbleSeries.minPxSize),
- maxPxSize = Math.ceil(bubbleSeries.maxPxSize),
- maxSize = bubbleSeries.options.maxSize,
- plotSize = Math.min(plotSizeY,
- plotSizeX),
- calculatedSize;
-
- if (floating || !(/%$/.test(maxSize))) {
- calculatedSize = maxPxSize;
- }
- else {
- maxSize = parseFloat(maxSize);
- calculatedSize = ((plotSize + lastLineHeight -
- fontMetrics.h / 2) * maxSize / 100) / (maxSize / 100 + 1);
-
-
- if ((horizontal && plotSizeY - calculatedSize >=
- plotSizeX) || (!horizontal && plotSizeX -
- calculatedSize >= plotSizeY)) {
- calculatedSize = maxPxSize;
- }
- }
- return [minSize, Math.ceil(calculatedSize)];
- };
-
- BubbleLegend.prototype.updateRanges = function (min, max) {
- var bubbleLegendOptions = this.legend.options.bubbleLegend;
- bubbleLegendOptions.minSize = min;
- bubbleLegendOptions.maxSize = max;
- bubbleLegendOptions.ranges = this.getRanges();
- };
-
- BubbleLegend.prototype.correctSizes = function () {
- var legend = this.legend,
- chart = this.chart,
- bubbleSeries = chart.series[this.options.seriesIndex],
- bubbleSeriesSize = bubbleSeries.maxPxSize,
- bubbleLegendSize = this.options.maxSize;
- if (Math.abs(Math.ceil(bubbleSeriesSize) - bubbleLegendSize) >
- 1) {
- this.updateRanges(this.options.minSize, bubbleSeries.maxPxSize);
- legend.render();
- }
- };
- return BubbleLegend;
- }());
-
- addEvent(Legend, 'afterGetAllItems', function (e) {
- var legend = this,
- bubbleLegend = legend.bubbleLegend,
- legendOptions = legend.options,
- options = legendOptions.bubbleLegend,
- bubbleSeriesIndex = legend.chart.getVisibleBubbleSeriesIndex();
-
- if (bubbleLegend && bubbleLegend.ranges && bubbleLegend.ranges.length) {
-
- if (options.ranges.length) {
- options.autoRanges =
- !!options.ranges[0].autoRanges;
- }
-
- legend.destroyItem(bubbleLegend);
- }
-
- if (bubbleSeriesIndex >= 0 &&
- legendOptions.enabled &&
- options.enabled) {
- options.seriesIndex = bubbleSeriesIndex;
- legend.bubbleLegend = new H.BubbleLegend(options, legend);
- legend.bubbleLegend.addToLegend(e.allItems);
- }
- });
-
- Chart.prototype.getVisibleBubbleSeriesIndex = function () {
- var series = this.series,
- i = 0;
- while (i < series.length) {
- if (series[i] &&
- series[i].isBubble &&
- series[i].visible &&
- series[i].zData.length) {
- return i;
- }
- i++;
- }
- return -1;
- };
-
- Legend.prototype.getLinesHeights = function () {
- var items = this.allItems,
- lines = [],
- lastLine,
- length = items.length,
- i = 0,
- j = 0;
- for (i = 0; i < length; i++) {
- if (items[i].legendItemHeight) {
-
- items[i].itemHeight = items[i].legendItemHeight;
- }
- if (
- items[i] === items[length - 1] ||
- items[i + 1] &&
- items[i]._legendItemPos[1] !==
- items[i + 1]._legendItemPos[1]) {
- lines.push({ height: 0 });
- lastLine = lines[lines.length - 1];
-
- for (j; j <= i; j++) {
- if (items[j].itemHeight > lastLine.height) {
- lastLine.height = items[j].itemHeight;
- }
- }
- lastLine.step = i;
- }
- }
- return lines;
- };
-
- Legend.prototype.retranslateItems = function (lines) {
- var items = this.allItems,
- orgTranslateX,
- orgTranslateY,
- movementX,
- rtl = this.options.rtl,
- actualLine = 0;
- items.forEach(function (item, index) {
- orgTranslateX = item.legendGroup.translateX;
- orgTranslateY = item._legendItemPos[1];
- movementX = item.movementX;
- if (movementX || (rtl && item.ranges)) {
- movementX = rtl ?
- orgTranslateX - item.options.maxSize / 2 :
- orgTranslateX + movementX;
- item.legendGroup.attr({ translateX: movementX });
- }
- if (index > lines[actualLine].step) {
- actualLine++;
- }
- item.legendGroup.attr({
- translateY: Math.round(orgTranslateY + lines[actualLine].height / 2)
- });
- item._legendItemPos[1] = orgTranslateY +
- lines[actualLine].height / 2;
- });
- };
-
- addEvent(Series, 'legendItemClick', function () {
- var series = this,
- chart = series.chart,
- visible = series.visible,
- legend = series.chart.legend,
- status;
- if (legend && legend.bubbleLegend) {
-
- series.visible = !visible;
-
- series.ignoreSeries = visible;
-
- status = chart.getVisibleBubbleSeriesIndex() >= 0;
-
- if (legend.bubbleLegend.visible !== status) {
-
- legend.update({
- bubbleLegend: { enabled: status }
- });
- legend.bubbleLegend.visible = status;
- }
- series.visible = visible;
- }
- });
-
-
- wrap(Chart.prototype, 'drawChartBox', function (proceed, options, callback) {
- var chart = this,
- legend = chart.legend,
- bubbleSeries = chart.getVisibleBubbleSeriesIndex() >= 0,
- bubbleLegendOptions,
- bubbleSizes;
- if (legend && legend.options.enabled && legend.bubbleLegend &&
- legend.options.bubbleLegend.autoRanges && bubbleSeries) {
- bubbleLegendOptions = legend.bubbleLegend.options;
- bubbleSizes = legend.bubbleLegend.predictBubbleSizes();
- legend.bubbleLegend.updateRanges(bubbleSizes[0], bubbleSizes[1]);
-
- if (!bubbleLegendOptions.placed) {
- legend.group.placed = false;
- legend.allItems.forEach(function (item) {
- item.legendGroup.translateY = null;
- });
- }
-
- legend.render();
- chart.getMargins();
- chart.axes.forEach(function (axis) {
- if (axis.visible) {
- axis.render();
- }
- if (!bubbleLegendOptions.placed) {
- axis.setScale();
- axis.updateNames();
-
- objectEach(axis.ticks, function (tick) {
- tick.isNew = true;
- tick.isNewLabel = true;
- });
- }
- });
- bubbleLegendOptions.placed = true;
-
- chart.getMargins();
-
- proceed.call(chart, options, callback);
-
- legend.bubbleLegend.correctSizes();
-
- legend.retranslateItems(legend.getLinesHeights());
- }
- else {
- proceed.call(chart, options, callback);
-
- if (legend && legend.options.enabled && legend.bubbleLegend) {
- legend.render();
- legend.retranslateItems(legend.getLinesHeights());
- }
- }
- });
- H.BubbleLegend = BubbleLegend;
- return H.BubbleLegend;
- });
- _registerModule(_modules, 'Series/Bubble/BubbleSeries.js', [_modules['Core/Axis/Axis.js'], _modules['Series/Bubble/BubblePoint.js'], _modules['Core/Color/Color.js'], _modules['Core/Globals.js'], _modules['Core/Series/Series.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (Axis, BubblePoint, Color, H, Series, SeriesRegistry, U) {
-
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d,
- b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d,
- b) { d.__proto__ = b; }) ||
- function (d,
- b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var color = Color.parse;
- var noop = H.noop;
- var _a = SeriesRegistry.seriesTypes,
- ColumnSeries = _a.column,
- ScatterSeries = _a.scatter;
- var arrayMax = U.arrayMax,
- arrayMin = U.arrayMin,
- clamp = U.clamp,
- extend = U.extend,
- isNumber = U.isNumber,
- merge = U.merge,
- pick = U.pick,
- pInt = U.pInt;
-
- var BubbleSeries = (function (_super) {
- __extends(BubbleSeries, _super);
- function BubbleSeries() {
-
- var _this = _super !== null && _super.apply(this,
- arguments) || this;
-
- _this.data = void 0;
- _this.maxPxSize = void 0;
- _this.minPxSize = void 0;
- _this.options = void 0;
- _this.points = void 0;
- _this.radii = void 0;
- _this.yData = void 0;
- _this.zData = void 0;
- return _this;
-
- }
-
-
-
- BubbleSeries.prototype.animate = function (init) {
- if (!init &&
- this.points.length < this.options.animationLimit
- ) {
- this.points.forEach(function (point) {
- var graphic = point.graphic;
- if (graphic && graphic.width) {
-
- if (!this.hasRendered) {
- graphic.attr({
- x: point.plotX,
- y: point.plotY,
- width: 1,
- height: 1
- });
- }
-
- graphic.animate(this.markerAttribs(point), this.options.animation);
- }
- }, this);
- }
- };
-
- BubbleSeries.prototype.getRadii = function (zMin, zMax, series) {
- var len,
- i,
- zData = this.zData,
- yData = this.yData,
- minSize = series.minPxSize,
- maxSize = series.maxPxSize,
- radii = [],
- value;
-
- for (i = 0, len = zData.length; i < len; i++) {
- value = zData[i];
-
- radii.push(this.getRadius(zMin, zMax, minSize, maxSize, value, yData[i]));
- }
- this.radii = radii;
- };
-
- BubbleSeries.prototype.getRadius = function (zMin, zMax, minSize, maxSize, value, yValue) {
- var options = this.options,
- sizeByArea = options.sizeBy !== 'width',
- zThreshold = options.zThreshold,
- zRange = zMax - zMin,
- pos = 0.5;
-
- if (yValue === null || value === null) {
- return null;
- }
- if (isNumber(value)) {
-
-
- if (options.sizeByAbsoluteValue) {
- value = Math.abs(value - zThreshold);
- zMax = zRange = Math.max(zMax - zThreshold, Math.abs(zMin - zThreshold));
- zMin = 0;
- }
-
-
- if (value < zMin) {
- return minSize / 2 - 1;
- }
-
- if (zRange > 0) {
- pos = (value - zMin) / zRange;
- }
- }
- if (sizeByArea && pos >= 0) {
- pos = Math.sqrt(pos);
- }
- return Math.ceil(minSize + pos * (maxSize - minSize)) / 2;
- };
-
- BubbleSeries.prototype.hasData = function () {
- return !!this.processedXData.length;
- };
-
- BubbleSeries.prototype.pointAttribs = function (point, state) {
- var markerOptions = this.options.marker,
- fillOpacity = markerOptions.fillOpacity,
- attr = Series.prototype.pointAttribs.call(this,
- point,
- state);
- if (fillOpacity !== 1) {
- attr.fill = color(attr.fill)
- .setOpacity(fillOpacity)
- .get('rgba');
- }
- return attr;
- };
-
- BubbleSeries.prototype.translate = function () {
- var i,
- data = this.data,
- point,
- radius,
- radii = this.radii;
-
- _super.prototype.translate.call(this);
-
- i = data.length;
- while (i--) {
- point = data[i];
- radius = radii ? radii[i] : 0;
- if (isNumber(radius) && radius >= this.minPxSize / 2) {
-
- point.marker = extend(point.marker, {
- radius: radius,
- width: 2 * radius,
- height: 2 * radius
- });
-
- point.dlBox = {
- x: point.plotX - radius,
- y: point.plotY - radius,
- width: 2 * radius,
- height: 2 * radius
- };
- }
- else {
-
- point.shapeArgs = point.plotY = point.dlBox = void 0;
- }
- }
- };
-
- BubbleSeries.defaultOptions = merge(ScatterSeries.defaultOptions, {
- dataLabels: {
- formatter: function () {
- return this.point.z;
- },
- inside: true,
- verticalAlign: 'middle'
- },
-
- animationLimit: 250,
-
-
- marker: {
- lineColor: null,
- lineWidth: 1,
-
- fillOpacity: 0.5,
-
- radius: null,
- states: {
- hover: {
- radiusPlus: 0
- }
- },
-
- symbol: 'circle'
- },
-
- minSize: 8,
-
- maxSize: '20%',
-
-
-
-
- softThreshold: false,
- states: {
- hover: {
- halo: {
- size: 5
- }
- }
- },
- tooltip: {
- pointFormat: '({point.x}, {point.y}), Size: {point.z}'
- },
- turboThreshold: 0,
-
-
-
-
- zThreshold: 0,
- zoneAxis: 'z'
- });
- return BubbleSeries;
- }(ScatterSeries));
- extend(BubbleSeries.prototype, {
- alignDataLabel: ColumnSeries.prototype.alignDataLabel,
- applyZones: noop,
- bubblePadding: true,
- buildKDTree: noop,
- directTouch: true,
- isBubble: true,
- pointArrayMap: ['y', 'z'],
- pointClass: BubblePoint,
- parallelArrays: ['x', 'y', 'z'],
- trackerGroups: ['group', 'dataLabelsGroup'],
- specialGroup: 'group',
- zoneAxis: 'z'
- });
-
-
-
- Axis.prototype.beforePadding = function () {
- var axis = this,
- axisLength = this.len,
- chart = this.chart,
- pxMin = 0,
- pxMax = axisLength,
- isXAxis = this.isXAxis,
- dataKey = isXAxis ? 'xData' : 'yData',
- min = this.min,
- extremes = {},
- smallestSize = Math.min(chart.plotWidth,
- chart.plotHeight),
- zMin = Number.MAX_VALUE,
- zMax = -Number.MAX_VALUE,
- range = this.max - min,
- transA = axisLength / range,
- activeSeries = [];
-
- this.series.forEach(function (series) {
- var seriesOptions = series.options,
- zData;
- if (series.bubblePadding &&
- (series.visible || !chart.options.chart.ignoreHiddenSeries)) {
-
- axis.allowZoomOutside = true;
-
- activeSeries.push(series);
- if (isXAxis) {
-
- ['minSize', 'maxSize'].forEach(function (prop) {
- var length = seriesOptions[prop],
- isPercent = /%$/.test(length);
- length = pInt(length);
- extremes[prop] = isPercent ?
- smallestSize * length / 100 :
- length;
- });
- series.minPxSize = extremes.minSize;
-
-
- series.maxPxSize = Math.max(extremes.maxSize, extremes.minSize);
-
- zData = series.zData.filter(isNumber);
- if (zData.length) {
- zMin = pick(seriesOptions.zMin, clamp(arrayMin(zData), seriesOptions.displayNegative === false ?
- seriesOptions.zThreshold :
- -Number.MAX_VALUE, zMin));
- zMax = pick(seriesOptions.zMax, Math.max(zMax, arrayMax(zData)));
- }
- }
- }
- });
- activeSeries.forEach(function (series) {
- var data = series[dataKey],
- i = data.length,
- radius;
- if (isXAxis) {
- series.getRadii(zMin, zMax, series);
- }
- if (range > 0) {
- while (i--) {
- if (isNumber(data[i]) &&
- axis.dataMin <= data[i] &&
- data[i] <= axis.max) {
- radius = series.radii ? series.radii[i] : 0;
- pxMin = Math.min(((data[i] - min) * transA) - radius, pxMin);
- pxMax = Math.max(((data[i] - min) * transA) + radius, pxMax);
- }
- }
- }
- });
-
- if (activeSeries.length && range > 0 && !this.logarithmic) {
- pxMax -= axisLength;
- transA *= (axisLength +
- Math.max(0, pxMin) -
- Math.min(pxMax, axisLength)) / axisLength;
- [
- ['min', 'userMin', pxMin],
- ['max', 'userMax', pxMax]
- ].forEach(function (keys) {
- if (typeof pick(axis.options[keys[0]], axis[keys[1]]) === 'undefined') {
- axis[keys[0]] += keys[2] / transA;
- }
- });
- }
-
- };
- SeriesRegistry.registerSeriesType('bubble', BubbleSeries);
-
-
-
- '';
-
-
-
-
-
-
- '';
- return BubbleSeries;
- });
- _registerModule(_modules, 'Series/MapBubble/MapBubblePoint.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) {
-
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d,
- b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d,
- b) { d.__proto__ = b; }) ||
- function (d,
- b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var _a = SeriesRegistry.seriesTypes,
- BubbleSeries = _a.bubble,
- MapSeries = _a.map;
- var extend = U.extend,
- merge = U.merge;
-
- var MapBubblePoint = (function (_super) {
- __extends(MapBubblePoint, _super);
- function MapBubblePoint() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
-
-
-
- MapBubblePoint.prototype.applyOptions = function (options, x) {
- var point;
- if (options &&
- typeof options.lat !== 'undefined' &&
- typeof options.lon !== 'undefined') {
- point = _super.prototype.applyOptions.call(this, merge(options, this.series.chart.fromLatLonToPoint(options)), x);
- }
- else {
- point = MapSeries.prototype.pointClass.prototype
- .applyOptions.call(this, options, x);
- }
- return point;
- };
-
- MapBubblePoint.prototype.isValid = function () {
- return typeof this.z === 'number';
- };
- return MapBubblePoint;
- }(BubbleSeries.prototype.pointClass));
- extend(MapBubblePoint.prototype, {
- ttBelow: false
- });
-
- return MapBubblePoint;
- });
- _registerModule(_modules, 'Series/MapBubble/MapBubbleSeries.js', [_modules['Series/Bubble/BubbleSeries.js'], _modules['Series/MapBubble/MapBubblePoint.js'], _modules['Series/Map/MapSeries.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (BubbleSeries, MapBubblePoint, MapSeries, SeriesRegistry, U) {
-
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d,
- b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d,
- b) { d.__proto__ = b; }) ||
- function (d,
- b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var extend = U.extend,
- merge = U.merge;
-
-
- var MapBubbleSeries = (function (_super) {
- __extends(MapBubbleSeries, _super);
- function MapBubbleSeries() {
-
- var _this = _super !== null && _super.apply(this,
- arguments) || this;
-
- _this.data = void 0;
- _this.options = void 0;
- _this.points = void 0;
- return _this;
- }
-
- MapBubbleSeries.defaultOptions = merge(BubbleSeries.defaultOptions, {
-
-
-
-
-
-
-
-
-
-
- animationLimit: 500,
- tooltip: {
- pointFormat: '{point.name}: {point.z}'
- }
- });
- return MapBubbleSeries;
- }(BubbleSeries));
- extend(MapBubbleSeries.prototype, {
- type: 'mapbubble',
- getBox: MapSeries.prototype.getBox,
-
- pointArrayMap: ['z'],
- pointClass: MapBubblePoint,
- setData: MapSeries.prototype.setData,
- setOptions: MapSeries.prototype.setOptions,
- xyFromShape: true
- });
- SeriesRegistry.registerSeriesType('mapbubble', MapBubbleSeries);
-
-
-
-
-
-
- '';
- return MapBubbleSeries;
- });
- _registerModule(_modules, 'Series/Heatmap/HeatmapPoint.js', [_modules['Mixins/ColorMapSeries.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (ColorMapMixin, SeriesRegistry, U) {
-
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d,
- b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d,
- b) { d.__proto__ = b; }) ||
- function (d,
- b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var colorMapPointMixin = ColorMapMixin.colorMapPointMixin;
- var ScatterPoint = SeriesRegistry.seriesTypes.scatter.prototype.pointClass;
- var clamp = U.clamp,
- extend = U.extend,
- pick = U.pick;
-
- var HeatmapPoint = (function (_super) {
- __extends(HeatmapPoint, _super);
- function HeatmapPoint() {
-
- var _this = _super !== null && _super.apply(this,
- arguments) || this;
- _this.options = void 0;
- _this.series = void 0;
- _this.value = void 0;
- _this.x = void 0;
- _this.y = void 0;
- return _this;
-
- }
-
-
-
- HeatmapPoint.prototype.applyOptions = function (options, x) {
- var point = _super.prototype.applyOptions.call(this,
- options,
- x);
- point.formatPrefix = point.isNull || point.value === null ? 'null' : 'point';
- return point;
- };
- HeatmapPoint.prototype.getCellAttributes = function () {
- var point = this,
- series = point.series,
- seriesOptions = series.options,
- xPad = (seriesOptions.colsize || 1) / 2,
- yPad = (seriesOptions.rowsize || 1) / 2,
- xAxis = series.xAxis,
- yAxis = series.yAxis,
- markerOptions = point.options.marker || series.options.marker,
- pointPlacement = series.pointPlacementToXValue(),
- pointPadding = pick(point.pointPadding,
- seriesOptions.pointPadding, 0),
- cellAttr = {
- x1: clamp(Math.round(xAxis.len -
- (xAxis.translate(point.x - xPad,
- false,
- true,
- false,
- true, -pointPlacement) || 0)), -xAxis.len, 2 * xAxis.len),
- x2: clamp(Math.round(xAxis.len -
- (xAxis.translate(point.x + xPad,
- false,
- true,
- false,
- true, -pointPlacement) || 0)), -xAxis.len, 2 * xAxis.len),
- y1: clamp(Math.round((yAxis.translate(point.y - yPad,
- false,
- true,
- false,
- true) || 0)), -yAxis.len, 2 * yAxis.len),
- y2: clamp(Math.round((yAxis.translate(point.y + yPad,
- false,
- true,
- false,
- true) || 0)), -yAxis.len, 2 * yAxis.len)
- };
-
-
- [['width', 'x'], ['height', 'y']].forEach(function (dimension) {
- var prop = dimension[0],
- direction = dimension[1];
- var start = direction + '1', end = direction + '2';
- var side = Math.abs(cellAttr[start] - cellAttr[end]),
- borderWidth = markerOptions &&
- markerOptions.lineWidth || 0,
- plotPos = Math.abs(cellAttr[start] + cellAttr[end]) / 2;
- if (markerOptions[prop] &&
- markerOptions[prop] < side) {
- cellAttr[start] = plotPos - (markerOptions[prop] / 2) -
- (borderWidth / 2);
- cellAttr[end] = plotPos + (markerOptions[prop] / 2) +
- (borderWidth / 2);
- }
-
- if (pointPadding) {
- if (direction === 'y') {
- start = end;
- end = direction + '1';
- }
- cellAttr[start] += pointPadding;
- cellAttr[end] -= pointPadding;
- }
- });
- return cellAttr;
- };
-
- HeatmapPoint.prototype.haloPath = function (size) {
- if (!size) {
- return [];
- }
- var rect = this.shapeArgs;
- return [
- 'M',
- rect.x - size,
- rect.y - size,
- 'L',
- rect.x - size,
- rect.y + rect.height + size,
- rect.x + rect.width + size,
- rect.y + rect.height + size,
- rect.x + rect.width + size,
- rect.y - size,
- 'Z'
- ];
- };
-
- HeatmapPoint.prototype.isValid = function () {
-
- return (this.value !== Infinity &&
- this.value !== -Infinity);
- };
- return HeatmapPoint;
- }(ScatterPoint));
- extend(HeatmapPoint.prototype, {
- dataLabelOnNull: colorMapPointMixin.dataLabelOnNull,
- moveToTopOnHover: colorMapPointMixin.moveToTopOnHover
- });
-
- return HeatmapPoint;
- });
- _registerModule(_modules, 'Series/Heatmap/HeatmapSeries.js', [_modules['Core/Color/Color.js'], _modules['Mixins/ColorMapSeries.js'], _modules['Series/Heatmap/HeatmapPoint.js'], _modules['Mixins/LegendSymbol.js'], _modules['Core/Color/Palette.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Renderer/SVG/SVGRenderer.js'], _modules['Core/Utilities.js']], function (Color, ColorMapMixin, HeatmapPoint, LegendSymbolMixin, palette, SeriesRegistry, SVGRenderer, U) {
-
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d,
- b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d,
- b) { d.__proto__ = b; }) ||
- function (d,
- b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var colorMapSeriesMixin = ColorMapMixin.colorMapSeriesMixin;
- var Series = SeriesRegistry.series,
- _a = SeriesRegistry.seriesTypes,
- ColumnSeries = _a.column,
- ScatterSeries = _a.scatter;
- var symbols = SVGRenderer.prototype.symbols;
- var extend = U.extend,
- fireEvent = U.fireEvent,
- isNumber = U.isNumber,
- merge = U.merge,
- pick = U.pick;
-
-
- var HeatmapSeries = (function (_super) {
- __extends(HeatmapSeries, _super);
- function HeatmapSeries() {
-
- var _this = _super !== null && _super.apply(this,
- arguments) || this;
-
- _this.colorAxis = void 0;
- _this.data = void 0;
- _this.options = void 0;
- _this.points = void 0;
- _this.valueMax = NaN;
- _this.valueMin = NaN;
- return _this;
-
- }
-
-
-
- HeatmapSeries.prototype.drawPoints = function () {
- var _this = this;
-
-
- var seriesMarkerOptions = this.options.marker || {};
- if (seriesMarkerOptions.enabled || this._hasPointMarkers) {
- Series.prototype.drawPoints.call(this);
- this.points.forEach(function (point) {
- if (point.graphic) {
- point.graphic[_this.chart.styledMode ? 'css' : 'animate'](_this.colorAttribs(point));
- if (_this.options.borderRadius) {
- point.graphic.attr({
- r: _this.options.borderRadius
- });
- }
- if (point.value === null) {
- point.graphic.addClass('highcharts-null-point');
- }
- }
- });
- }
- };
-
- HeatmapSeries.prototype.getExtremes = function () {
-
- var _a = Series.prototype.getExtremes
- .call(this,
- this.valueData),
- dataMin = _a.dataMin,
- dataMax = _a.dataMax;
- if (isNumber(dataMin)) {
- this.valueMin = dataMin;
- }
- if (isNumber(dataMax)) {
- this.valueMax = dataMax;
- }
-
- return Series.prototype.getExtremes.call(this);
- };
-
- HeatmapSeries.prototype.getValidPoints = function (points, insideOnly) {
- return Series.prototype.getValidPoints.call(this, points, insideOnly, true);
- };
-
- HeatmapSeries.prototype.hasData = function () {
- return !!this.processedXData.length;
- };
-
- HeatmapSeries.prototype.init = function () {
- var options;
- Series.prototype.init.apply(this, arguments);
- options = this.options;
-
- options.pointRange = pick(options.pointRange, options.colsize || 1);
-
- this.yAxis.axisPointRange = options.rowsize || 1;
-
- symbols.ellipse = symbols.circle;
- };
-
- HeatmapSeries.prototype.markerAttribs = function (point, state) {
- var pointMarkerOptions = point.marker || {},
- seriesMarkerOptions = this.options.marker || {},
- seriesStateOptions,
- pointStateOptions,
- shapeArgs = point.shapeArgs || {},
- hasImage = point.hasImage,
- attribs = {};
- if (hasImage) {
- return {
- x: point.plotX,
- y: point.plotY
- };
- }
-
-
- if (state) {
- seriesStateOptions = seriesMarkerOptions.states[state] || {};
- pointStateOptions = pointMarkerOptions.states &&
- pointMarkerOptions.states[state] || {};
- [['width', 'x'], ['height', 'y']].forEach(function (dimension) {
-
- attribs[dimension[0]] = (pointStateOptions[dimension[0]] ||
- seriesStateOptions[dimension[0]] ||
- shapeArgs[dimension[0]]) + (pointStateOptions[dimension[0] + 'Plus'] ||
- seriesStateOptions[dimension[0] + 'Plus'] || 0);
-
- attribs[dimension[1]] =
- shapeArgs[dimension[1]] +
- (shapeArgs[dimension[0]] -
- attribs[dimension[0]]) / 2;
- });
- }
- return state ? attribs : shapeArgs;
- };
-
- HeatmapSeries.prototype.pointAttribs = function (point, state) {
- var series = this,
- attr = Series.prototype.pointAttribs.call(series,
- point,
- state),
- seriesOptions = series.options || {},
- plotOptions = series.chart.options.plotOptions || {},
- seriesPlotOptions = plotOptions.series || {},
- heatmapPlotOptions = plotOptions.heatmap || {},
- stateOptions,
- brightness,
-
- borderColor = seriesOptions.borderColor ||
- heatmapPlotOptions.borderColor ||
- seriesPlotOptions.borderColor,
- borderWidth = seriesOptions.borderWidth ||
- heatmapPlotOptions.borderWidth ||
- seriesPlotOptions.borderWidth ||
- attr['stroke-width'];
-
- attr.stroke = ((point && point.marker && point.marker.lineColor) ||
- (seriesOptions.marker && seriesOptions.marker.lineColor) ||
- borderColor ||
- this.color);
-
- attr['stroke-width'] = borderWidth;
- if (state) {
- stateOptions =
- merge(seriesOptions.states[state], seriesOptions.marker &&
- seriesOptions.marker.states[state], point &&
- point.options.states &&
- point.options.states[state] || {});
- brightness = stateOptions.brightness;
- attr.fill =
- stateOptions.color ||
- Color.parse(attr.fill).brighten(brightness || 0).get();
- attr.stroke = stateOptions.lineColor;
- }
- return attr;
- };
-
- HeatmapSeries.prototype.setClip = function (animation) {
- var series = this,
- chart = series.chart;
- Series.prototype.setClip.apply(series, arguments);
- if (series.options.clip !== false || animation) {
- series.markerGroup
- .clip((animation || series.clipBox) && series.sharedClipKey ?
- chart.sharedClips[series.sharedClipKey] :
- chart.clipRect);
- }
- };
-
- HeatmapSeries.prototype.translate = function () {
- var series = this, options = series.options, symbol = options.marker && options.marker.symbol || 'rect', shape = symbols[symbol] ? symbol : 'rect', hasRegularShape = ['circle', 'square'].indexOf(shape) !== -1;
- series.generatePoints();
- series.points.forEach(function (point) {
- var pointAttr,
- sizeDiff,
- hasImage,
- cellAttr = point.getCellAttributes(),
- shapeArgs = {};
- shapeArgs.x = Math.min(cellAttr.x1, cellAttr.x2);
- shapeArgs.y = Math.min(cellAttr.y1, cellAttr.y2);
- shapeArgs.width = Math.max(Math.abs(cellAttr.x2 - cellAttr.x1), 0);
- shapeArgs.height = Math.max(Math.abs(cellAttr.y2 - cellAttr.y1), 0);
- hasImage = point.hasImage =
- (point.marker && point.marker.symbol || symbol || '')
- .indexOf('url') === 0;
-
-
- if (hasRegularShape) {
- sizeDiff = Math.abs(shapeArgs.width - shapeArgs.height);
- shapeArgs.x = Math.min(cellAttr.x1, cellAttr.x2) +
- (shapeArgs.width < shapeArgs.height ? 0 : sizeDiff / 2);
- shapeArgs.y = Math.min(cellAttr.y1, cellAttr.y2) +
- (shapeArgs.width < shapeArgs.height ? sizeDiff / 2 : 0);
- shapeArgs.width = shapeArgs.height =
- Math.min(shapeArgs.width, shapeArgs.height);
- }
- pointAttr = {
- plotX: (cellAttr.x1 + cellAttr.x2) / 2,
- plotY: (cellAttr.y1 + cellAttr.y2) / 2,
- clientX: (cellAttr.x1 + cellAttr.x2) / 2,
- shapeType: 'path',
- shapeArgs: merge(true, shapeArgs, {
- d: symbols[shape](shapeArgs.x, shapeArgs.y, shapeArgs.width, shapeArgs.height)
- })
- };
- if (hasImage) {
- point.marker = {
- width: shapeArgs.width,
- height: shapeArgs.height
- };
- }
- extend(point, pointAttr);
- });
- fireEvent(series, 'afterTranslate');
- };
-
- HeatmapSeries.defaultOptions = merge(ScatterSeries.defaultOptions, {
-
- animation: false,
-
- borderRadius: 0,
-
- borderWidth: 0,
-
-
-
-
-
-
- nullColor: palette.neutralColor3,
- dataLabels: {
- formatter: function () {
- return this.point.value;
- },
- inside: true,
- verticalAlign: 'middle',
- crop: false,
- overflow: false,
- padding: 0
- },
-
- marker: {
-
- symbol: 'rect',
-
- radius: 0,
- lineColor: void 0,
- states: {
-
- hover: {
-
-
-
-
-
- lineWidthPlus: 0
- },
-
- select: {
-
-
-
-
- }
- }
- },
- clip: true,
-
- pointRange: null,
- tooltip: {
- pointFormat: '{point.x}, {point.y}: {point.value}<br/>'
- },
- states: {
- hover: {
-
- halo: false,
-
- brightness: 0.2
- }
- }
- });
- return HeatmapSeries;
- }(ScatterSeries));
- extend(HeatmapSeries.prototype, {
-
- alignDataLabel: ColumnSeries.prototype.alignDataLabel,
- axisTypes: colorMapSeriesMixin.axisTypes,
- colorAttribs: colorMapSeriesMixin.colorAttribs,
- colorKey: colorMapSeriesMixin.colorKey,
- directTouch: true,
-
- drawLegendSymbol: LegendSymbolMixin.drawRectangle,
- getExtremesFromAll: true,
- getSymbol: Series.prototype.getSymbol,
- parallelArrays: colorMapSeriesMixin.parallelArrays,
- pointArrayMap: ['y', 'value'],
- pointClass: HeatmapPoint,
- trackerGroups: colorMapSeriesMixin.trackerGroups
- });
- SeriesRegistry.registerSeriesType('heatmap', HeatmapSeries);
-
-
-
-
-
-
-
- '';
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- '';
- return HeatmapSeries;
- });
- _registerModule(_modules, 'Extensions/GeoJSON.js', [_modules['Core/Chart/Chart.js'], _modules['Core/FormatUtilities.js'], _modules['Core/Globals.js'], _modules['Core/Utilities.js']], function (Chart, F, H, U) {
-
- var format = F.format;
- var win = H.win;
- var error = U.error,
- extend = U.extend,
- merge = U.merge,
- wrap = U.wrap;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- '';
-
-
- function pointInPolygon(point, polygon) {
- var i,
- j,
- rel1,
- rel2,
- c = false,
- x = point.x,
- y = point.y;
- for (i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
- rel1 = polygon[i][1] > y;
- rel2 = polygon[j][1] > y;
- if (rel1 !== rel2 &&
- (x < (polygon[j][0] -
- polygon[i][0]) * (y - polygon[i][1]) /
- (polygon[j][1] - polygon[i][1]) +
- polygon[i][0])) {
- c = !c;
- }
- }
- return c;
- }
-
- Chart.prototype.transformFromLatLon = function (latLon, transform) {
-
- var proj4 = (this.userOptions.chart &&
- this.userOptions.chart.proj4 ||
- win.proj4);
- if (!proj4) {
- error(21, false, this);
- return {
- x: 0,
- y: null
- };
- }
- var projected = proj4(transform.crs,
- [latLon.lon,
- latLon.lat]),
- cosAngle = transform.cosAngle ||
- (transform.rotation && Math.cos(transform.rotation)),
- sinAngle = transform.sinAngle ||
- (transform.rotation && Math.sin(transform.rotation)),
- rotated = transform.rotation ? [
- projected[0] * cosAngle + projected[1] * sinAngle,
- -projected[0] * sinAngle + projected[1] * cosAngle
- ] : projected;
- return {
- x: ((rotated[0] - (transform.xoffset || 0)) * (transform.scale || 1) +
- (transform.xpan || 0)) * (transform.jsonres || 1) +
- (transform.jsonmarginX || 0),
- y: (((transform.yoffset || 0) - rotated[1]) * (transform.scale || 1) +
- (transform.ypan || 0)) * (transform.jsonres || 1) -
- (transform.jsonmarginY || 0)
- };
- };
-
- Chart.prototype.transformToLatLon = function (point, transform) {
- if (typeof win.proj4 === 'undefined') {
- error(21, false, this);
- return;
- }
- var normalized = {
- x: ((point.x -
- (transform.jsonmarginX || 0)) / (transform.jsonres || 1) -
- (transform.xpan || 0)) / (transform.scale || 1) +
- (transform.xoffset || 0),
- y: ((-point.y - (transform.jsonmarginY || 0)) / (transform.jsonres || 1) +
- (transform.ypan || 0)) / (transform.scale || 1) +
- (transform.yoffset || 0)
- },
- cosAngle = transform.cosAngle ||
- (transform.rotation && Math.cos(transform.rotation)),
- sinAngle = transform.sinAngle ||
- (transform.rotation && Math.sin(transform.rotation)),
-
- projected = win.proj4(transform.crs, 'WGS84',
- transform.rotation ? {
- x: normalized.x * cosAngle + normalized.y * -sinAngle,
- y: normalized.x * sinAngle + normalized.y * cosAngle
- } : normalized);
- return { lat: projected.y, lon: projected.x };
- };
-
- Chart.prototype.fromPointToLatLon = function (point) {
- var transforms = this.mapTransforms,
- transform;
- if (!transforms) {
- error(22, false, this);
- return;
- }
- for (transform in transforms) {
- if (Object.hasOwnProperty.call(transforms, transform) &&
- transforms[transform].hitZone &&
- pointInPolygon({ x: point.x, y: -point.y }, transforms[transform].hitZone.coordinates[0])) {
- return this.transformToLatLon(point, transforms[transform]);
- }
- }
- return this.transformToLatLon(point, transforms['default']
- );
- };
-
- Chart.prototype.fromLatLonToPoint = function (latLon) {
- var transforms = this.mapTransforms,
- transform,
- coords;
- if (!transforms) {
- error(22, false, this);
- return {
- x: 0,
- y: null
- };
- }
- for (transform in transforms) {
- if (Object.hasOwnProperty.call(transforms, transform) &&
- transforms[transform].hitZone) {
- coords = this.transformFromLatLon(latLon, transforms[transform]);
- if (pointInPolygon({ x: coords.x, y: -coords.y }, transforms[transform].hitZone.coordinates[0])) {
- return coords;
- }
- }
- }
- return this.transformFromLatLon(latLon, transforms['default']
- );
- };
-
- H.geojson = function (geojson, hType, series) {
- var mapData = [],
- path = [],
- polygonToPath = function (polygon) {
- polygon.forEach(function (point,
- i) {
- if (i === 0) {
- path.push(['M',
- point[0], -point[1]]);
- }
- else {
- path.push(['L', point[0], -point[1]]);
- }
- });
- };
- hType = hType || 'map';
- geojson.features.forEach(function (feature) {
- var geometry = feature.geometry,
- type = geometry.type,
- coordinates = geometry.coordinates,
- properties = feature.properties,
- point;
- path = [];
- if (hType === 'map' || hType === 'mapbubble') {
- if (type === 'Polygon') {
- coordinates.forEach(polygonToPath);
- path.push(['Z']);
- }
- else if (type === 'MultiPolygon') {
- coordinates.forEach(function (items) {
- items.forEach(polygonToPath);
- });
- path.push(['Z']);
- }
- if (path.length) {
- point = { path: path };
- }
- }
- else if (hType === 'mapline') {
- if (type === 'LineString') {
- polygonToPath(coordinates);
- }
- else if (type === 'MultiLineString') {
- coordinates.forEach(polygonToPath);
- }
- if (path.length) {
- point = { path: path };
- }
- }
- else if (hType === 'mappoint') {
- if (type === 'Point') {
- point = {
- x: coordinates[0],
- y: -coordinates[1]
- };
- }
- }
- if (point) {
- mapData.push(extend(point, {
- name: properties.name || properties.NAME,
-
- properties: properties
- }));
- }
- });
-
-
- if (series && geojson.copyrightShort) {
- series.chart.mapCredits = format(series.chart.options.credits.mapText, { geojson: geojson });
- series.chart.mapCreditsFull = format(series.chart.options.credits.mapTextFull, { geojson: geojson });
- }
- return mapData;
- };
-
- wrap(Chart.prototype, 'addCredits', function (proceed, credits) {
- credits = merge(true, this.options.credits, credits);
-
-
- if (this.mapCredits) {
- credits.href = null;
- }
- proceed.call(this, credits);
-
- if (this.credits && this.mapCreditsFull) {
- this.credits.attr({
- title: this.mapCreditsFull
- });
- }
- });
- });
- _registerModule(_modules, 'masters/modules/map.src.js', [_modules['Core/Globals.js'], _modules['Core/Chart/MapChart.js']], function (Highcharts, MapChart) {
- Highcharts.MapChart = MapChart;
- Highcharts.mapChart = Highcharts.Map = MapChart.mapChart;
- Highcharts.maps = MapChart.maps;
- });
- }));
|