chunk-O6ZB44ZF.js 297 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614
  1. import {
  2. AxisModelCommonMixin,
  3. Axis_default,
  4. BezierCurve_default,
  5. Circle_default,
  6. Component_default,
  7. Component_default2,
  8. DataDiffer_default,
  9. Ellipse_default,
  10. GeoJSONRegion,
  11. GeoSVGRegion,
  12. Interval_default,
  13. Line_default,
  14. LinearGradient_default,
  15. Model_default,
  16. OrdinalMeta_default,
  17. Polygon_default,
  18. Polyline_default,
  19. RadialGradient_default,
  20. Ring_default,
  21. SINGLE_REFERRING,
  22. SPECIAL_STATES,
  23. __extends,
  24. applyTransform as applyTransform2,
  25. asc,
  26. clear,
  27. clipPointsByRect,
  28. createFromString,
  29. createOrUpdate,
  30. createOrUpdatePatternFromDecal,
  31. createScaleByModel,
  32. createSymbol,
  33. createTextStyle,
  34. defaultEmphasis,
  35. enableComponentHighDownFeatures,
  36. enterEmphasis,
  37. estimateLabelUnionRect,
  38. fetchLayoutMode,
  39. findEventDispatcher,
  40. getAnimationConfig,
  41. getDataDimensionsOnAxis,
  42. getECData,
  43. getLabelStatesModels,
  44. getLayoutParams,
  45. getLayoutRect,
  46. getPrecisionSafe,
  47. getScaleExtent,
  48. getTransform,
  49. getUID,
  50. groupTransition,
  51. hideOverlap,
  52. ifAxisCrossZero,
  53. increaseInterval,
  54. initProps,
  55. isIntervalOrLogScale,
  56. isRadianAroundZero,
  57. isValueNice,
  58. leaveEmphasis,
  59. linearMap,
  60. makeInner,
  61. makeStyleMapper,
  62. mergeLayoutParam,
  63. mergePath,
  64. niceScaleExtent,
  65. normalizeSymbolOffset,
  66. normalizeSymbolSize,
  67. normalizeToArray,
  68. parseGeoJSON,
  69. parsePercent,
  70. prepareLayoutList,
  71. registerAction,
  72. remRadian,
  73. removeElement,
  74. retrieveRawValue,
  75. round,
  76. saveOldStyle,
  77. setDefaultStateProxy,
  78. setLabelStyle,
  79. setTooltipConfig,
  80. shouldShowAllLabels,
  81. subPixelOptimizeLine,
  82. toggleHoverEmphasis,
  83. transformDirection,
  84. traverseElements,
  85. updateProps,
  86. warn
  87. } from "./chunk-PRJRDRZN.js";
  88. import {
  89. BoundingRect_default,
  90. CompoundPath_default,
  91. Displayable_default,
  92. Eventful_default,
  93. Group_default,
  94. Image_default,
  95. Path_default,
  96. Rect_default,
  97. TRANSFORMABLE_PROPS,
  98. TSpan_default,
  99. Text_default,
  100. Transformable_default,
  101. applyTransform,
  102. assert,
  103. bind,
  104. clone,
  105. cloneValue,
  106. copy,
  107. copy2,
  108. create2 as create,
  109. createHashMap,
  110. curry,
  111. defaults,
  112. each,
  113. eqNaN,
  114. extend,
  115. fastLerp,
  116. filter,
  117. hasOwn,
  118. identity,
  119. indexOf,
  120. invert,
  121. isArray,
  122. isArrayLike,
  123. isFunction,
  124. isMiddleOrRightButtonOnMouseUpDown,
  125. isNumber,
  126. isObject,
  127. isString,
  128. keys,
  129. map,
  130. max,
  131. merge,
  132. mergeAll,
  133. min,
  134. mixin,
  135. modifyAlpha,
  136. modifyHSL,
  137. mul,
  138. noop,
  139. normalize,
  140. parse,
  141. reduce,
  142. retrieve,
  143. retrieve2,
  144. retrieve3,
  145. rotate,
  146. scale2 as scale,
  147. stop,
  148. stringify,
  149. sub,
  150. translate,
  151. trim
  152. } from "./chunk-7YIZLZUW.js";
  153. // node_modules/echarts/lib/coord/cartesian/GridModel.js
  154. var GridModel = (
  155. /** @class */
  156. function(_super) {
  157. __extends(GridModel2, _super);
  158. function GridModel2() {
  159. return _super !== null && _super.apply(this, arguments) || this;
  160. }
  161. GridModel2.type = "grid";
  162. GridModel2.dependencies = ["xAxis", "yAxis"];
  163. GridModel2.layoutMode = "box";
  164. GridModel2.defaultOption = {
  165. show: false,
  166. // zlevel: 0,
  167. z: 0,
  168. left: "10%",
  169. top: 60,
  170. right: "10%",
  171. bottom: 70,
  172. // If grid size contain label
  173. containLabel: false,
  174. // width: {totalWidth} - left - right,
  175. // height: {totalHeight} - top - bottom,
  176. backgroundColor: "rgba(0,0,0,0)",
  177. borderWidth: 1,
  178. borderColor: "#ccc"
  179. };
  180. return GridModel2;
  181. }(Component_default)
  182. );
  183. var GridModel_default = GridModel;
  184. // node_modules/echarts/lib/coord/cartesian/AxisModel.js
  185. var CartesianAxisModel = (
  186. /** @class */
  187. function(_super) {
  188. __extends(CartesianAxisModel2, _super);
  189. function CartesianAxisModel2() {
  190. return _super !== null && _super.apply(this, arguments) || this;
  191. }
  192. CartesianAxisModel2.prototype.getCoordSysModel = function() {
  193. return this.getReferringComponents("grid", SINGLE_REFERRING).models[0];
  194. };
  195. CartesianAxisModel2.type = "cartesian2dAxis";
  196. return CartesianAxisModel2;
  197. }(Component_default)
  198. );
  199. mixin(CartesianAxisModel, AxisModelCommonMixin);
  200. // node_modules/echarts/lib/coord/axisDefault.js
  201. var defaultOption = {
  202. show: true,
  203. // zlevel: 0,
  204. z: 0,
  205. // Inverse the axis.
  206. inverse: false,
  207. // Axis name displayed.
  208. name: "",
  209. // 'start' | 'middle' | 'end'
  210. nameLocation: "end",
  211. // By degree. By default auto rotate by nameLocation.
  212. nameRotate: null,
  213. nameTruncate: {
  214. maxWidth: null,
  215. ellipsis: "...",
  216. placeholder: "."
  217. },
  218. // Use global text style by default.
  219. nameTextStyle: {},
  220. // The gap between axisName and axisLine.
  221. nameGap: 15,
  222. // Default `false` to support tooltip.
  223. silent: false,
  224. // Default `false` to avoid legacy user event listener fail.
  225. triggerEvent: false,
  226. tooltip: {
  227. show: false
  228. },
  229. axisPointer: {},
  230. axisLine: {
  231. show: true,
  232. onZero: true,
  233. onZeroAxisIndex: null,
  234. lineStyle: {
  235. color: "#6E7079",
  236. width: 1,
  237. type: "solid"
  238. },
  239. // The arrow at both ends the the axis.
  240. symbol: ["none", "none"],
  241. symbolSize: [10, 15]
  242. },
  243. axisTick: {
  244. show: true,
  245. // Whether axisTick is inside the grid or outside the grid.
  246. inside: false,
  247. // The length of axisTick.
  248. length: 5,
  249. lineStyle: {
  250. width: 1
  251. }
  252. },
  253. axisLabel: {
  254. show: true,
  255. // Whether axisLabel is inside the grid or outside the grid.
  256. inside: false,
  257. rotate: 0,
  258. // true | false | null/undefined (auto)
  259. showMinLabel: null,
  260. // true | false | null/undefined (auto)
  261. showMaxLabel: null,
  262. margin: 8,
  263. // formatter: null,
  264. fontSize: 12
  265. },
  266. splitLine: {
  267. show: true,
  268. lineStyle: {
  269. color: ["#E0E6F1"],
  270. width: 1,
  271. type: "solid"
  272. }
  273. },
  274. splitArea: {
  275. show: false,
  276. areaStyle: {
  277. color: ["rgba(250,250,250,0.2)", "rgba(210,219,238,0.2)"]
  278. }
  279. }
  280. };
  281. var categoryAxis = merge({
  282. // The gap at both ends of the axis. For categoryAxis, boolean.
  283. boundaryGap: true,
  284. // Set false to faster category collection.
  285. deduplication: null,
  286. // splitArea: {
  287. // show: false
  288. // },
  289. splitLine: {
  290. show: false
  291. },
  292. axisTick: {
  293. // If tick is align with label when boundaryGap is true
  294. alignWithLabel: false,
  295. interval: "auto"
  296. },
  297. axisLabel: {
  298. interval: "auto"
  299. }
  300. }, defaultOption);
  301. var valueAxis = merge({
  302. boundaryGap: [0, 0],
  303. axisLine: {
  304. // Not shown when other axis is categoryAxis in cartesian
  305. show: "auto"
  306. },
  307. axisTick: {
  308. // Not shown when other axis is categoryAxis in cartesian
  309. show: "auto"
  310. },
  311. // TODO
  312. // min/max: [30, datamin, 60] or [20, datamin] or [datamin, 60]
  313. splitNumber: 5,
  314. minorTick: {
  315. // Minor tick, not available for cateogry axis.
  316. show: false,
  317. // Split number of minor ticks. The value should be in range of (0, 100)
  318. splitNumber: 5,
  319. // Length of minor tick
  320. length: 3,
  321. // Line style
  322. lineStyle: {
  323. // Default to be same with axisTick
  324. }
  325. },
  326. minorSplitLine: {
  327. show: false,
  328. lineStyle: {
  329. color: "#F4F7FD",
  330. width: 1
  331. }
  332. }
  333. }, defaultOption);
  334. var timeAxis = merge({
  335. splitNumber: 6,
  336. axisLabel: {
  337. // To eliminate labels that are not nice
  338. showMinLabel: false,
  339. showMaxLabel: false,
  340. rich: {
  341. primary: {
  342. fontWeight: "bold"
  343. }
  344. }
  345. },
  346. splitLine: {
  347. show: false
  348. }
  349. }, valueAxis);
  350. var logAxis = defaults({
  351. logBase: 10
  352. }, valueAxis);
  353. var axisDefault_default = {
  354. category: categoryAxis,
  355. value: valueAxis,
  356. time: timeAxis,
  357. log: logAxis
  358. };
  359. // node_modules/echarts/lib/coord/axisCommonTypes.js
  360. var AXIS_TYPES = {
  361. value: 1,
  362. category: 1,
  363. time: 1,
  364. log: 1
  365. };
  366. // node_modules/echarts/lib/coord/axisModelCreator.js
  367. function axisModelCreator(registers, axisName, BaseAxisModelClass, extraDefaultOption) {
  368. each(AXIS_TYPES, function(v, axisType) {
  369. var defaultOption2 = merge(merge({}, axisDefault_default[axisType], true), extraDefaultOption, true);
  370. var AxisModel = (
  371. /** @class */
  372. function(_super) {
  373. __extends(AxisModel2, _super);
  374. function AxisModel2() {
  375. var _this = _super !== null && _super.apply(this, arguments) || this;
  376. _this.type = axisName + "Axis." + axisType;
  377. return _this;
  378. }
  379. AxisModel2.prototype.mergeDefaultAndTheme = function(option, ecModel) {
  380. var layoutMode = fetchLayoutMode(this);
  381. var inputPositionParams = layoutMode ? getLayoutParams(option) : {};
  382. var themeModel = ecModel.getTheme();
  383. merge(option, themeModel.get(axisType + "Axis"));
  384. merge(option, this.getDefaultOption());
  385. option.type = getAxisType(option);
  386. if (layoutMode) {
  387. mergeLayoutParam(option, inputPositionParams, layoutMode);
  388. }
  389. };
  390. AxisModel2.prototype.optionUpdated = function() {
  391. var thisOption = this.option;
  392. if (thisOption.type === "category") {
  393. this.__ordinalMeta = OrdinalMeta_default.createByAxisModel(this);
  394. }
  395. };
  396. AxisModel2.prototype.getCategories = function(rawData) {
  397. var option = this.option;
  398. if (option.type === "category") {
  399. if (rawData) {
  400. return option.data;
  401. }
  402. return this.__ordinalMeta.categories;
  403. }
  404. };
  405. AxisModel2.prototype.getOrdinalMeta = function() {
  406. return this.__ordinalMeta;
  407. };
  408. AxisModel2.type = axisName + "Axis." + axisType;
  409. AxisModel2.defaultOption = defaultOption2;
  410. return AxisModel2;
  411. }(BaseAxisModelClass)
  412. );
  413. registers.registerComponentModel(AxisModel);
  414. });
  415. registers.registerSubTypeDefaulter(axisName + "Axis", getAxisType);
  416. }
  417. function getAxisType(option) {
  418. return option.type || (option.data ? "category" : "value");
  419. }
  420. // node_modules/echarts/lib/coord/cartesian/Cartesian.js
  421. var Cartesian = (
  422. /** @class */
  423. function() {
  424. function Cartesian2(name) {
  425. this.type = "cartesian";
  426. this._dimList = [];
  427. this._axes = {};
  428. this.name = name || "";
  429. }
  430. Cartesian2.prototype.getAxis = function(dim) {
  431. return this._axes[dim];
  432. };
  433. Cartesian2.prototype.getAxes = function() {
  434. return map(this._dimList, function(dim) {
  435. return this._axes[dim];
  436. }, this);
  437. };
  438. Cartesian2.prototype.getAxesByScale = function(scaleType) {
  439. scaleType = scaleType.toLowerCase();
  440. return filter(this.getAxes(), function(axis) {
  441. return axis.scale.type === scaleType;
  442. });
  443. };
  444. Cartesian2.prototype.addAxis = function(axis) {
  445. var dim = axis.dim;
  446. this._axes[dim] = axis;
  447. this._dimList.push(dim);
  448. };
  449. return Cartesian2;
  450. }()
  451. );
  452. var Cartesian_default = Cartesian;
  453. // node_modules/echarts/lib/coord/cartesian/Cartesian2D.js
  454. var cartesian2DDimensions = ["x", "y"];
  455. function canCalculateAffineTransform(scale2) {
  456. return scale2.type === "interval" || scale2.type === "time";
  457. }
  458. var Cartesian2D = (
  459. /** @class */
  460. function(_super) {
  461. __extends(Cartesian2D2, _super);
  462. function Cartesian2D2() {
  463. var _this = _super !== null && _super.apply(this, arguments) || this;
  464. _this.type = "cartesian2d";
  465. _this.dimensions = cartesian2DDimensions;
  466. return _this;
  467. }
  468. Cartesian2D2.prototype.calcAffineTransform = function() {
  469. this._transform = this._invTransform = null;
  470. var xAxisScale = this.getAxis("x").scale;
  471. var yAxisScale = this.getAxis("y").scale;
  472. if (!canCalculateAffineTransform(xAxisScale) || !canCalculateAffineTransform(yAxisScale)) {
  473. return;
  474. }
  475. var xScaleExtent = xAxisScale.getExtent();
  476. var yScaleExtent = yAxisScale.getExtent();
  477. var start = this.dataToPoint([xScaleExtent[0], yScaleExtent[0]]);
  478. var end = this.dataToPoint([xScaleExtent[1], yScaleExtent[1]]);
  479. var xScaleSpan = xScaleExtent[1] - xScaleExtent[0];
  480. var yScaleSpan = yScaleExtent[1] - yScaleExtent[0];
  481. if (!xScaleSpan || !yScaleSpan) {
  482. return;
  483. }
  484. var scaleX = (end[0] - start[0]) / xScaleSpan;
  485. var scaleY = (end[1] - start[1]) / yScaleSpan;
  486. var translateX = start[0] - xScaleExtent[0] * scaleX;
  487. var translateY = start[1] - yScaleExtent[0] * scaleY;
  488. var m = this._transform = [scaleX, 0, 0, scaleY, translateX, translateY];
  489. this._invTransform = invert([], m);
  490. };
  491. Cartesian2D2.prototype.getBaseAxis = function() {
  492. return this.getAxesByScale("ordinal")[0] || this.getAxesByScale("time")[0] || this.getAxis("x");
  493. };
  494. Cartesian2D2.prototype.containPoint = function(point) {
  495. var axisX = this.getAxis("x");
  496. var axisY = this.getAxis("y");
  497. return axisX.contain(axisX.toLocalCoord(point[0])) && axisY.contain(axisY.toLocalCoord(point[1]));
  498. };
  499. Cartesian2D2.prototype.containData = function(data) {
  500. return this.getAxis("x").containData(data[0]) && this.getAxis("y").containData(data[1]);
  501. };
  502. Cartesian2D2.prototype.containZone = function(data1, data2) {
  503. var zoneDiag1 = this.dataToPoint(data1);
  504. var zoneDiag2 = this.dataToPoint(data2);
  505. var area = this.getArea();
  506. var zone = new BoundingRect_default(zoneDiag1[0], zoneDiag1[1], zoneDiag2[0] - zoneDiag1[0], zoneDiag2[1] - zoneDiag1[1]);
  507. return area.intersect(zone);
  508. };
  509. Cartesian2D2.prototype.dataToPoint = function(data, clamp, out) {
  510. out = out || [];
  511. var xVal = data[0];
  512. var yVal = data[1];
  513. if (this._transform && xVal != null && isFinite(xVal) && yVal != null && isFinite(yVal)) {
  514. return applyTransform(out, data, this._transform);
  515. }
  516. var xAxis = this.getAxis("x");
  517. var yAxis = this.getAxis("y");
  518. out[0] = xAxis.toGlobalCoord(xAxis.dataToCoord(xVal, clamp));
  519. out[1] = yAxis.toGlobalCoord(yAxis.dataToCoord(yVal, clamp));
  520. return out;
  521. };
  522. Cartesian2D2.prototype.clampData = function(data, out) {
  523. var xScale = this.getAxis("x").scale;
  524. var yScale = this.getAxis("y").scale;
  525. var xAxisExtent = xScale.getExtent();
  526. var yAxisExtent = yScale.getExtent();
  527. var x = xScale.parse(data[0]);
  528. var y = yScale.parse(data[1]);
  529. out = out || [];
  530. out[0] = Math.min(Math.max(Math.min(xAxisExtent[0], xAxisExtent[1]), x), Math.max(xAxisExtent[0], xAxisExtent[1]));
  531. out[1] = Math.min(Math.max(Math.min(yAxisExtent[0], yAxisExtent[1]), y), Math.max(yAxisExtent[0], yAxisExtent[1]));
  532. return out;
  533. };
  534. Cartesian2D2.prototype.pointToData = function(point, clamp) {
  535. var out = [];
  536. if (this._invTransform) {
  537. return applyTransform(out, point, this._invTransform);
  538. }
  539. var xAxis = this.getAxis("x");
  540. var yAxis = this.getAxis("y");
  541. out[0] = xAxis.coordToData(xAxis.toLocalCoord(point[0]), clamp);
  542. out[1] = yAxis.coordToData(yAxis.toLocalCoord(point[1]), clamp);
  543. return out;
  544. };
  545. Cartesian2D2.prototype.getOtherAxis = function(axis) {
  546. return this.getAxis(axis.dim === "x" ? "y" : "x");
  547. };
  548. Cartesian2D2.prototype.getArea = function(tolerance) {
  549. tolerance = tolerance || 0;
  550. var xExtent = this.getAxis("x").getGlobalExtent();
  551. var yExtent = this.getAxis("y").getGlobalExtent();
  552. var x = Math.min(xExtent[0], xExtent[1]) - tolerance;
  553. var y = Math.min(yExtent[0], yExtent[1]) - tolerance;
  554. var width = Math.max(xExtent[0], xExtent[1]) - x + tolerance;
  555. var height = Math.max(yExtent[0], yExtent[1]) - y + tolerance;
  556. return new BoundingRect_default(x, y, width, height);
  557. };
  558. return Cartesian2D2;
  559. }(Cartesian_default)
  560. );
  561. var Cartesian2D_default = Cartesian2D;
  562. // node_modules/echarts/lib/coord/cartesian/Axis2D.js
  563. var Axis2D = (
  564. /** @class */
  565. function(_super) {
  566. __extends(Axis2D2, _super);
  567. function Axis2D2(dim, scale2, coordExtent, axisType, position) {
  568. var _this = _super.call(this, dim, scale2, coordExtent) || this;
  569. _this.index = 0;
  570. _this.type = axisType || "value";
  571. _this.position = position || "bottom";
  572. return _this;
  573. }
  574. Axis2D2.prototype.isHorizontal = function() {
  575. var position = this.position;
  576. return position === "top" || position === "bottom";
  577. };
  578. Axis2D2.prototype.getGlobalExtent = function(asc2) {
  579. var ret = this.getExtent();
  580. ret[0] = this.toGlobalCoord(ret[0]);
  581. ret[1] = this.toGlobalCoord(ret[1]);
  582. asc2 && ret[0] > ret[1] && ret.reverse();
  583. return ret;
  584. };
  585. Axis2D2.prototype.pointToData = function(point, clamp) {
  586. return this.coordToData(this.toLocalCoord(point[this.dim === "x" ? 0 : 1]), clamp);
  587. };
  588. Axis2D2.prototype.setCategorySortInfo = function(info) {
  589. if (this.type !== "category") {
  590. return false;
  591. }
  592. this.model.option.categorySortInfo = info;
  593. this.scale.setSortInfo(info);
  594. };
  595. return Axis2D2;
  596. }(Axis_default)
  597. );
  598. var Axis2D_default = Axis2D;
  599. // node_modules/echarts/lib/coord/cartesian/cartesianAxisHelper.js
  600. function layout(gridModel, axisModel, opt) {
  601. opt = opt || {};
  602. var grid = gridModel.coordinateSystem;
  603. var axis = axisModel.axis;
  604. var layout2 = {};
  605. var otherAxisOnZeroOf = axis.getAxesOnZeroOf()[0];
  606. var rawAxisPosition = axis.position;
  607. var axisPosition = otherAxisOnZeroOf ? "onZero" : rawAxisPosition;
  608. var axisDim = axis.dim;
  609. var rect = grid.getRect();
  610. var rectBound = [rect.x, rect.x + rect.width, rect.y, rect.y + rect.height];
  611. var idx = {
  612. left: 0,
  613. right: 1,
  614. top: 0,
  615. bottom: 1,
  616. onZero: 2
  617. };
  618. var axisOffset = axisModel.get("offset") || 0;
  619. var posBound = axisDim === "x" ? [rectBound[2] - axisOffset, rectBound[3] + axisOffset] : [rectBound[0] - axisOffset, rectBound[1] + axisOffset];
  620. if (otherAxisOnZeroOf) {
  621. var onZeroCoord = otherAxisOnZeroOf.toGlobalCoord(otherAxisOnZeroOf.dataToCoord(0));
  622. posBound[idx.onZero] = Math.max(Math.min(onZeroCoord, posBound[1]), posBound[0]);
  623. }
  624. layout2.position = [axisDim === "y" ? posBound[idx[axisPosition]] : rectBound[0], axisDim === "x" ? posBound[idx[axisPosition]] : rectBound[3]];
  625. layout2.rotation = Math.PI / 2 * (axisDim === "x" ? 0 : 1);
  626. var dirMap = {
  627. top: -1,
  628. bottom: 1,
  629. left: -1,
  630. right: 1
  631. };
  632. layout2.labelDirection = layout2.tickDirection = layout2.nameDirection = dirMap[rawAxisPosition];
  633. layout2.labelOffset = otherAxisOnZeroOf ? posBound[idx[rawAxisPosition]] - posBound[idx.onZero] : 0;
  634. if (axisModel.get(["axisTick", "inside"])) {
  635. layout2.tickDirection = -layout2.tickDirection;
  636. }
  637. if (retrieve(opt.labelInside, axisModel.get(["axisLabel", "inside"]))) {
  638. layout2.labelDirection = -layout2.labelDirection;
  639. }
  640. var labelRotate = axisModel.get(["axisLabel", "rotate"]);
  641. layout2.labelRotate = axisPosition === "top" ? -labelRotate : labelRotate;
  642. layout2.z2 = 1;
  643. return layout2;
  644. }
  645. function isCartesian2DSeries(seriesModel) {
  646. return seriesModel.get("coordinateSystem") === "cartesian2d";
  647. }
  648. function findAxisModels(seriesModel) {
  649. var axisModelMap = {
  650. xAxisModel: null,
  651. yAxisModel: null
  652. };
  653. each(axisModelMap, function(v, key) {
  654. var axisType = key.replace(/Model$/, "");
  655. var axisModel = seriesModel.getReferringComponents(axisType, SINGLE_REFERRING).models[0];
  656. if (true) {
  657. if (!axisModel) {
  658. throw new Error(axisType + ' "' + retrieve3(seriesModel.get(axisType + "Index"), seriesModel.get(axisType + "Id"), 0) + '" not found');
  659. }
  660. }
  661. axisModelMap[key] = axisModel;
  662. });
  663. return axisModelMap;
  664. }
  665. // node_modules/echarts/lib/coord/axisAlignTicks.js
  666. var mathLog = Math.log;
  667. function alignScaleTicks(scale2, axisModel, alignToScale) {
  668. var intervalScaleProto = Interval_default.prototype;
  669. var alignToTicks = intervalScaleProto.getTicks.call(alignToScale);
  670. var alignToNicedTicks = intervalScaleProto.getTicks.call(alignToScale, true);
  671. var alignToSplitNumber = alignToTicks.length - 1;
  672. var alignToInterval = intervalScaleProto.getInterval.call(alignToScale);
  673. var scaleExtent = getScaleExtent(scale2, axisModel);
  674. var rawExtent = scaleExtent.extent;
  675. var isMinFixed = scaleExtent.fixMin;
  676. var isMaxFixed = scaleExtent.fixMax;
  677. if (scale2.type === "log") {
  678. var logBase = mathLog(scale2.base);
  679. rawExtent = [mathLog(rawExtent[0]) / logBase, mathLog(rawExtent[1]) / logBase];
  680. }
  681. scale2.setExtent(rawExtent[0], rawExtent[1]);
  682. scale2.calcNiceExtent({
  683. splitNumber: alignToSplitNumber,
  684. fixMin: isMinFixed,
  685. fixMax: isMaxFixed
  686. });
  687. var extent = intervalScaleProto.getExtent.call(scale2);
  688. if (isMinFixed) {
  689. rawExtent[0] = extent[0];
  690. }
  691. if (isMaxFixed) {
  692. rawExtent[1] = extent[1];
  693. }
  694. var interval = intervalScaleProto.getInterval.call(scale2);
  695. var min2 = rawExtent[0];
  696. var max2 = rawExtent[1];
  697. if (isMinFixed && isMaxFixed) {
  698. interval = (max2 - min2) / alignToSplitNumber;
  699. } else if (isMinFixed) {
  700. max2 = rawExtent[0] + interval * alignToSplitNumber;
  701. while (max2 < rawExtent[1] && isFinite(max2) && isFinite(rawExtent[1])) {
  702. interval = increaseInterval(interval);
  703. max2 = rawExtent[0] + interval * alignToSplitNumber;
  704. }
  705. } else if (isMaxFixed) {
  706. min2 = rawExtent[1] - interval * alignToSplitNumber;
  707. while (min2 > rawExtent[0] && isFinite(min2) && isFinite(rawExtent[0])) {
  708. interval = increaseInterval(interval);
  709. min2 = rawExtent[1] - interval * alignToSplitNumber;
  710. }
  711. } else {
  712. var nicedSplitNumber = scale2.getTicks().length - 1;
  713. if (nicedSplitNumber > alignToSplitNumber) {
  714. interval = increaseInterval(interval);
  715. }
  716. var range = interval * alignToSplitNumber;
  717. max2 = Math.ceil(rawExtent[1] / interval) * interval;
  718. min2 = round(max2 - range);
  719. if (min2 < 0 && rawExtent[0] >= 0) {
  720. min2 = 0;
  721. max2 = round(range);
  722. } else if (max2 > 0 && rawExtent[1] <= 0) {
  723. max2 = 0;
  724. min2 = -round(range);
  725. }
  726. }
  727. var t0 = (alignToTicks[0].value - alignToNicedTicks[0].value) / alignToInterval;
  728. var t1 = (alignToTicks[alignToSplitNumber].value - alignToNicedTicks[alignToSplitNumber].value) / alignToInterval;
  729. intervalScaleProto.setExtent.call(scale2, min2 + interval * t0, max2 + interval * t1);
  730. intervalScaleProto.setInterval.call(scale2, interval);
  731. if (t0 || t1) {
  732. intervalScaleProto.setNiceExtent.call(scale2, min2 + interval, max2 - interval);
  733. }
  734. if (true) {
  735. var ticks = intervalScaleProto.getTicks.call(scale2);
  736. if (ticks[1] && (!isValueNice(interval) || getPrecisionSafe(ticks[1].value) > getPrecisionSafe(interval))) {
  737. warn(
  738. // eslint-disable-next-line
  739. "The ticks may be not readable when set min: " + axisModel.get("min") + ", max: " + axisModel.get("max") + " and alignTicks: true"
  740. );
  741. }
  742. }
  743. }
  744. // node_modules/echarts/lib/coord/cartesian/Grid.js
  745. var Grid = (
  746. /** @class */
  747. function() {
  748. function Grid2(gridModel, ecModel, api) {
  749. this.type = "grid";
  750. this._coordsMap = {};
  751. this._coordsList = [];
  752. this._axesMap = {};
  753. this._axesList = [];
  754. this.axisPointerEnabled = true;
  755. this.dimensions = cartesian2DDimensions;
  756. this._initCartesian(gridModel, ecModel, api);
  757. this.model = gridModel;
  758. }
  759. Grid2.prototype.getRect = function() {
  760. return this._rect;
  761. };
  762. Grid2.prototype.update = function(ecModel, api) {
  763. var axesMap = this._axesMap;
  764. this._updateScale(ecModel, this.model);
  765. function updateAxisTicks(axes) {
  766. var alignTo;
  767. var axesIndices = keys(axes);
  768. var len = axesIndices.length;
  769. if (!len) {
  770. return;
  771. }
  772. var axisNeedsAlign = [];
  773. for (var i = len - 1; i >= 0; i--) {
  774. var idx = +axesIndices[i];
  775. var axis = axes[idx];
  776. var model = axis.model;
  777. var scale2 = axis.scale;
  778. if (
  779. // Only value and log axis without interval support alignTicks.
  780. isIntervalOrLogScale(scale2) && model.get("alignTicks") && model.get("interval") == null
  781. ) {
  782. axisNeedsAlign.push(axis);
  783. } else {
  784. niceScaleExtent(scale2, model);
  785. if (isIntervalOrLogScale(scale2)) {
  786. alignTo = axis;
  787. }
  788. }
  789. }
  790. ;
  791. if (axisNeedsAlign.length) {
  792. if (!alignTo) {
  793. alignTo = axisNeedsAlign.pop();
  794. niceScaleExtent(alignTo.scale, alignTo.model);
  795. }
  796. each(axisNeedsAlign, function(axis2) {
  797. alignScaleTicks(axis2.scale, axis2.model, alignTo.scale);
  798. });
  799. }
  800. }
  801. updateAxisTicks(axesMap.x);
  802. updateAxisTicks(axesMap.y);
  803. var onZeroRecords = {};
  804. each(axesMap.x, function(xAxis) {
  805. fixAxisOnZero(axesMap, "y", xAxis, onZeroRecords);
  806. });
  807. each(axesMap.y, function(yAxis) {
  808. fixAxisOnZero(axesMap, "x", yAxis, onZeroRecords);
  809. });
  810. this.resize(this.model, api);
  811. };
  812. Grid2.prototype.resize = function(gridModel, api, ignoreContainLabel) {
  813. var boxLayoutParams = gridModel.getBoxLayoutParams();
  814. var isContainLabel = !ignoreContainLabel && gridModel.get("containLabel");
  815. var gridRect = getLayoutRect(boxLayoutParams, {
  816. width: api.getWidth(),
  817. height: api.getHeight()
  818. });
  819. this._rect = gridRect;
  820. var axesList = this._axesList;
  821. adjustAxes();
  822. if (isContainLabel) {
  823. each(axesList, function(axis) {
  824. if (!axis.model.get(["axisLabel", "inside"])) {
  825. var labelUnionRect = estimateLabelUnionRect(axis);
  826. if (labelUnionRect) {
  827. var dim = axis.isHorizontal() ? "height" : "width";
  828. var margin = axis.model.get(["axisLabel", "margin"]);
  829. gridRect[dim] -= labelUnionRect[dim] + margin;
  830. if (axis.position === "top") {
  831. gridRect.y += labelUnionRect.height + margin;
  832. } else if (axis.position === "left") {
  833. gridRect.x += labelUnionRect.width + margin;
  834. }
  835. }
  836. }
  837. });
  838. adjustAxes();
  839. }
  840. each(this._coordsList, function(coord) {
  841. coord.calcAffineTransform();
  842. });
  843. function adjustAxes() {
  844. each(axesList, function(axis) {
  845. var isHorizontal = axis.isHorizontal();
  846. var extent = isHorizontal ? [0, gridRect.width] : [0, gridRect.height];
  847. var idx = axis.inverse ? 1 : 0;
  848. axis.setExtent(extent[idx], extent[1 - idx]);
  849. updateAxisTransform(axis, isHorizontal ? gridRect.x : gridRect.y);
  850. });
  851. }
  852. };
  853. Grid2.prototype.getAxis = function(dim, axisIndex) {
  854. var axesMapOnDim = this._axesMap[dim];
  855. if (axesMapOnDim != null) {
  856. return axesMapOnDim[axisIndex || 0];
  857. }
  858. };
  859. Grid2.prototype.getAxes = function() {
  860. return this._axesList.slice();
  861. };
  862. Grid2.prototype.getCartesian = function(xAxisIndex, yAxisIndex) {
  863. if (xAxisIndex != null && yAxisIndex != null) {
  864. var key = "x" + xAxisIndex + "y" + yAxisIndex;
  865. return this._coordsMap[key];
  866. }
  867. if (isObject(xAxisIndex)) {
  868. yAxisIndex = xAxisIndex.yAxisIndex;
  869. xAxisIndex = xAxisIndex.xAxisIndex;
  870. }
  871. for (var i = 0, coordList = this._coordsList; i < coordList.length; i++) {
  872. if (coordList[i].getAxis("x").index === xAxisIndex || coordList[i].getAxis("y").index === yAxisIndex) {
  873. return coordList[i];
  874. }
  875. }
  876. };
  877. Grid2.prototype.getCartesians = function() {
  878. return this._coordsList.slice();
  879. };
  880. Grid2.prototype.convertToPixel = function(ecModel, finder, value) {
  881. var target = this._findConvertTarget(finder);
  882. return target.cartesian ? target.cartesian.dataToPoint(value) : target.axis ? target.axis.toGlobalCoord(target.axis.dataToCoord(value)) : null;
  883. };
  884. Grid2.prototype.convertFromPixel = function(ecModel, finder, value) {
  885. var target = this._findConvertTarget(finder);
  886. return target.cartesian ? target.cartesian.pointToData(value) : target.axis ? target.axis.coordToData(target.axis.toLocalCoord(value)) : null;
  887. };
  888. Grid2.prototype._findConvertTarget = function(finder) {
  889. var seriesModel = finder.seriesModel;
  890. var xAxisModel = finder.xAxisModel || seriesModel && seriesModel.getReferringComponents("xAxis", SINGLE_REFERRING).models[0];
  891. var yAxisModel = finder.yAxisModel || seriesModel && seriesModel.getReferringComponents("yAxis", SINGLE_REFERRING).models[0];
  892. var gridModel = finder.gridModel;
  893. var coordsList = this._coordsList;
  894. var cartesian;
  895. var axis;
  896. if (seriesModel) {
  897. cartesian = seriesModel.coordinateSystem;
  898. indexOf(coordsList, cartesian) < 0 && (cartesian = null);
  899. } else if (xAxisModel && yAxisModel) {
  900. cartesian = this.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex);
  901. } else if (xAxisModel) {
  902. axis = this.getAxis("x", xAxisModel.componentIndex);
  903. } else if (yAxisModel) {
  904. axis = this.getAxis("y", yAxisModel.componentIndex);
  905. } else if (gridModel) {
  906. var grid = gridModel.coordinateSystem;
  907. if (grid === this) {
  908. cartesian = this._coordsList[0];
  909. }
  910. }
  911. return {
  912. cartesian,
  913. axis
  914. };
  915. };
  916. Grid2.prototype.containPoint = function(point) {
  917. var coord = this._coordsList[0];
  918. if (coord) {
  919. return coord.containPoint(point);
  920. }
  921. };
  922. Grid2.prototype._initCartesian = function(gridModel, ecModel, api) {
  923. var _this = this;
  924. var grid = this;
  925. var axisPositionUsed = {
  926. left: false,
  927. right: false,
  928. top: false,
  929. bottom: false
  930. };
  931. var axesMap = {
  932. x: {},
  933. y: {}
  934. };
  935. var axesCount = {
  936. x: 0,
  937. y: 0
  938. };
  939. ecModel.eachComponent("xAxis", createAxisCreator("x"), this);
  940. ecModel.eachComponent("yAxis", createAxisCreator("y"), this);
  941. if (!axesCount.x || !axesCount.y) {
  942. this._axesMap = {};
  943. this._axesList = [];
  944. return;
  945. }
  946. this._axesMap = axesMap;
  947. each(axesMap.x, function(xAxis, xAxisIndex) {
  948. each(axesMap.y, function(yAxis, yAxisIndex) {
  949. var key = "x" + xAxisIndex + "y" + yAxisIndex;
  950. var cartesian = new Cartesian2D_default(key);
  951. cartesian.master = _this;
  952. cartesian.model = gridModel;
  953. _this._coordsMap[key] = cartesian;
  954. _this._coordsList.push(cartesian);
  955. cartesian.addAxis(xAxis);
  956. cartesian.addAxis(yAxis);
  957. });
  958. });
  959. function createAxisCreator(dimName) {
  960. return function(axisModel, idx) {
  961. if (!isAxisUsedInTheGrid(axisModel, gridModel)) {
  962. return;
  963. }
  964. var axisPosition = axisModel.get("position");
  965. if (dimName === "x") {
  966. if (axisPosition !== "top" && axisPosition !== "bottom") {
  967. axisPosition = axisPositionUsed.bottom ? "top" : "bottom";
  968. }
  969. } else {
  970. if (axisPosition !== "left" && axisPosition !== "right") {
  971. axisPosition = axisPositionUsed.left ? "right" : "left";
  972. }
  973. }
  974. axisPositionUsed[axisPosition] = true;
  975. var axis = new Axis2D_default(dimName, createScaleByModel(axisModel), [0, 0], axisModel.get("type"), axisPosition);
  976. var isCategory = axis.type === "category";
  977. axis.onBand = isCategory && axisModel.get("boundaryGap");
  978. axis.inverse = axisModel.get("inverse");
  979. axisModel.axis = axis;
  980. axis.model = axisModel;
  981. axis.grid = grid;
  982. axis.index = idx;
  983. grid._axesList.push(axis);
  984. axesMap[dimName][idx] = axis;
  985. axesCount[dimName]++;
  986. };
  987. }
  988. };
  989. Grid2.prototype._updateScale = function(ecModel, gridModel) {
  990. each(this._axesList, function(axis) {
  991. axis.scale.setExtent(Infinity, -Infinity);
  992. if (axis.type === "category") {
  993. var categorySortInfo = axis.model.get("categorySortInfo");
  994. axis.scale.setSortInfo(categorySortInfo);
  995. }
  996. });
  997. ecModel.eachSeries(function(seriesModel) {
  998. if (isCartesian2DSeries(seriesModel)) {
  999. var axesModelMap = findAxisModels(seriesModel);
  1000. var xAxisModel = axesModelMap.xAxisModel;
  1001. var yAxisModel = axesModelMap.yAxisModel;
  1002. if (!isAxisUsedInTheGrid(xAxisModel, gridModel) || !isAxisUsedInTheGrid(yAxisModel, gridModel)) {
  1003. return;
  1004. }
  1005. var cartesian = this.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex);
  1006. var data = seriesModel.getData();
  1007. var xAxis = cartesian.getAxis("x");
  1008. var yAxis = cartesian.getAxis("y");
  1009. unionExtent(data, xAxis);
  1010. unionExtent(data, yAxis);
  1011. }
  1012. }, this);
  1013. function unionExtent(data, axis) {
  1014. each(getDataDimensionsOnAxis(data, axis.dim), function(dim) {
  1015. axis.scale.unionExtentFromData(data, dim);
  1016. });
  1017. }
  1018. };
  1019. Grid2.prototype.getTooltipAxes = function(dim) {
  1020. var baseAxes = [];
  1021. var otherAxes = [];
  1022. each(this.getCartesians(), function(cartesian) {
  1023. var baseAxis = dim != null && dim !== "auto" ? cartesian.getAxis(dim) : cartesian.getBaseAxis();
  1024. var otherAxis = cartesian.getOtherAxis(baseAxis);
  1025. indexOf(baseAxes, baseAxis) < 0 && baseAxes.push(baseAxis);
  1026. indexOf(otherAxes, otherAxis) < 0 && otherAxes.push(otherAxis);
  1027. });
  1028. return {
  1029. baseAxes,
  1030. otherAxes
  1031. };
  1032. };
  1033. Grid2.create = function(ecModel, api) {
  1034. var grids = [];
  1035. ecModel.eachComponent("grid", function(gridModel, idx) {
  1036. var grid = new Grid2(gridModel, ecModel, api);
  1037. grid.name = "grid_" + idx;
  1038. grid.resize(gridModel, api, true);
  1039. gridModel.coordinateSystem = grid;
  1040. grids.push(grid);
  1041. });
  1042. ecModel.eachSeries(function(seriesModel) {
  1043. if (!isCartesian2DSeries(seriesModel)) {
  1044. return;
  1045. }
  1046. var axesModelMap = findAxisModels(seriesModel);
  1047. var xAxisModel = axesModelMap.xAxisModel;
  1048. var yAxisModel = axesModelMap.yAxisModel;
  1049. var gridModel = xAxisModel.getCoordSysModel();
  1050. if (true) {
  1051. if (!gridModel) {
  1052. throw new Error('Grid "' + retrieve3(xAxisModel.get("gridIndex"), xAxisModel.get("gridId"), 0) + '" not found');
  1053. }
  1054. if (xAxisModel.getCoordSysModel() !== yAxisModel.getCoordSysModel()) {
  1055. throw new Error("xAxis and yAxis must use the same grid");
  1056. }
  1057. }
  1058. var grid = gridModel.coordinateSystem;
  1059. seriesModel.coordinateSystem = grid.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex);
  1060. });
  1061. return grids;
  1062. };
  1063. Grid2.dimensions = cartesian2DDimensions;
  1064. return Grid2;
  1065. }()
  1066. );
  1067. function isAxisUsedInTheGrid(axisModel, gridModel) {
  1068. return axisModel.getCoordSysModel() === gridModel;
  1069. }
  1070. function fixAxisOnZero(axesMap, otherAxisDim, axis, onZeroRecords) {
  1071. axis.getAxesOnZeroOf = function() {
  1072. return otherAxisOnZeroOf ? [otherAxisOnZeroOf] : [];
  1073. };
  1074. var otherAxes = axesMap[otherAxisDim];
  1075. var otherAxisOnZeroOf;
  1076. var axisModel = axis.model;
  1077. var onZero = axisModel.get(["axisLine", "onZero"]);
  1078. var onZeroAxisIndex = axisModel.get(["axisLine", "onZeroAxisIndex"]);
  1079. if (!onZero) {
  1080. return;
  1081. }
  1082. if (onZeroAxisIndex != null) {
  1083. if (canOnZeroToAxis(otherAxes[onZeroAxisIndex])) {
  1084. otherAxisOnZeroOf = otherAxes[onZeroAxisIndex];
  1085. }
  1086. } else {
  1087. for (var idx in otherAxes) {
  1088. if (otherAxes.hasOwnProperty(idx) && canOnZeroToAxis(otherAxes[idx]) && !onZeroRecords[getOnZeroRecordKey(otherAxes[idx])]) {
  1089. otherAxisOnZeroOf = otherAxes[idx];
  1090. break;
  1091. }
  1092. }
  1093. }
  1094. if (otherAxisOnZeroOf) {
  1095. onZeroRecords[getOnZeroRecordKey(otherAxisOnZeroOf)] = true;
  1096. }
  1097. function getOnZeroRecordKey(axis2) {
  1098. return axis2.dim + "_" + axis2.index;
  1099. }
  1100. }
  1101. function canOnZeroToAxis(axis) {
  1102. return axis && axis.type !== "category" && axis.type !== "time" && ifAxisCrossZero(axis);
  1103. }
  1104. function updateAxisTransform(axis, coordBase) {
  1105. var axisExtent = axis.getExtent();
  1106. var axisExtentSum = axisExtent[0] + axisExtent[1];
  1107. axis.toGlobalCoord = axis.dim === "x" ? function(coord) {
  1108. return coord + coordBase;
  1109. } : function(coord) {
  1110. return axisExtentSum - coord + coordBase;
  1111. };
  1112. axis.toLocalCoord = axis.dim === "x" ? function(coord) {
  1113. return coord - coordBase;
  1114. } : function(coord) {
  1115. return axisExtentSum - coord + coordBase;
  1116. };
  1117. }
  1118. var Grid_default = Grid;
  1119. // node_modules/echarts/lib/component/axis/AxisBuilder.js
  1120. var PI = Math.PI;
  1121. var AxisBuilder = (
  1122. /** @class */
  1123. function() {
  1124. function AxisBuilder2(axisModel, opt) {
  1125. this.group = new Group_default();
  1126. this.opt = opt;
  1127. this.axisModel = axisModel;
  1128. defaults(opt, {
  1129. labelOffset: 0,
  1130. nameDirection: 1,
  1131. tickDirection: 1,
  1132. labelDirection: 1,
  1133. silent: true,
  1134. handleAutoShown: function() {
  1135. return true;
  1136. }
  1137. });
  1138. var transformGroup = new Group_default({
  1139. x: opt.position[0],
  1140. y: opt.position[1],
  1141. rotation: opt.rotation
  1142. });
  1143. transformGroup.updateTransform();
  1144. this._transformGroup = transformGroup;
  1145. }
  1146. AxisBuilder2.prototype.hasBuilder = function(name) {
  1147. return !!builders[name];
  1148. };
  1149. AxisBuilder2.prototype.add = function(name) {
  1150. builders[name](this.opt, this.axisModel, this.group, this._transformGroup);
  1151. };
  1152. AxisBuilder2.prototype.getGroup = function() {
  1153. return this.group;
  1154. };
  1155. AxisBuilder2.innerTextLayout = function(axisRotation, textRotation, direction) {
  1156. var rotationDiff = remRadian(textRotation - axisRotation);
  1157. var textAlign;
  1158. var textVerticalAlign;
  1159. if (isRadianAroundZero(rotationDiff)) {
  1160. textVerticalAlign = direction > 0 ? "top" : "bottom";
  1161. textAlign = "center";
  1162. } else if (isRadianAroundZero(rotationDiff - PI)) {
  1163. textVerticalAlign = direction > 0 ? "bottom" : "top";
  1164. textAlign = "center";
  1165. } else {
  1166. textVerticalAlign = "middle";
  1167. if (rotationDiff > 0 && rotationDiff < PI) {
  1168. textAlign = direction > 0 ? "right" : "left";
  1169. } else {
  1170. textAlign = direction > 0 ? "left" : "right";
  1171. }
  1172. }
  1173. return {
  1174. rotation: rotationDiff,
  1175. textAlign,
  1176. textVerticalAlign
  1177. };
  1178. };
  1179. AxisBuilder2.makeAxisEventDataBase = function(axisModel) {
  1180. var eventData = {
  1181. componentType: axisModel.mainType,
  1182. componentIndex: axisModel.componentIndex
  1183. };
  1184. eventData[axisModel.mainType + "Index"] = axisModel.componentIndex;
  1185. return eventData;
  1186. };
  1187. AxisBuilder2.isLabelSilent = function(axisModel) {
  1188. var tooltipOpt = axisModel.get("tooltip");
  1189. return axisModel.get("silent") || !(axisModel.get("triggerEvent") || tooltipOpt && tooltipOpt.show);
  1190. };
  1191. return AxisBuilder2;
  1192. }()
  1193. );
  1194. var builders = {
  1195. axisLine: function(opt, axisModel, group, transformGroup) {
  1196. var shown = axisModel.get(["axisLine", "show"]);
  1197. if (shown === "auto" && opt.handleAutoShown) {
  1198. shown = opt.handleAutoShown("axisLine");
  1199. }
  1200. if (!shown) {
  1201. return;
  1202. }
  1203. var extent = axisModel.axis.getExtent();
  1204. var matrix = transformGroup.transform;
  1205. var pt1 = [extent[0], 0];
  1206. var pt2 = [extent[1], 0];
  1207. var inverse = pt1[0] > pt2[0];
  1208. if (matrix) {
  1209. applyTransform(pt1, pt1, matrix);
  1210. applyTransform(pt2, pt2, matrix);
  1211. }
  1212. var lineStyle = extend({
  1213. lineCap: "round"
  1214. }, axisModel.getModel(["axisLine", "lineStyle"]).getLineStyle());
  1215. var line = new Line_default({
  1216. shape: {
  1217. x1: pt1[0],
  1218. y1: pt1[1],
  1219. x2: pt2[0],
  1220. y2: pt2[1]
  1221. },
  1222. style: lineStyle,
  1223. strokeContainThreshold: opt.strokeContainThreshold || 5,
  1224. silent: true,
  1225. z2: 1
  1226. });
  1227. subPixelOptimizeLine(line.shape, line.style.lineWidth);
  1228. line.anid = "line";
  1229. group.add(line);
  1230. var arrows = axisModel.get(["axisLine", "symbol"]);
  1231. if (arrows != null) {
  1232. var arrowSize = axisModel.get(["axisLine", "symbolSize"]);
  1233. if (isString(arrows)) {
  1234. arrows = [arrows, arrows];
  1235. }
  1236. if (isString(arrowSize) || isNumber(arrowSize)) {
  1237. arrowSize = [arrowSize, arrowSize];
  1238. }
  1239. var arrowOffset = normalizeSymbolOffset(axisModel.get(["axisLine", "symbolOffset"]) || 0, arrowSize);
  1240. var symbolWidth_1 = arrowSize[0];
  1241. var symbolHeight_1 = arrowSize[1];
  1242. each([{
  1243. rotate: opt.rotation + Math.PI / 2,
  1244. offset: arrowOffset[0],
  1245. r: 0
  1246. }, {
  1247. rotate: opt.rotation - Math.PI / 2,
  1248. offset: arrowOffset[1],
  1249. r: Math.sqrt((pt1[0] - pt2[0]) * (pt1[0] - pt2[0]) + (pt1[1] - pt2[1]) * (pt1[1] - pt2[1]))
  1250. }], function(point, index) {
  1251. if (arrows[index] !== "none" && arrows[index] != null) {
  1252. var symbol = createSymbol(arrows[index], -symbolWidth_1 / 2, -symbolHeight_1 / 2, symbolWidth_1, symbolHeight_1, lineStyle.stroke, true);
  1253. var r = point.r + point.offset;
  1254. var pt = inverse ? pt2 : pt1;
  1255. symbol.attr({
  1256. rotation: point.rotate,
  1257. x: pt[0] + r * Math.cos(opt.rotation),
  1258. y: pt[1] - r * Math.sin(opt.rotation),
  1259. silent: true,
  1260. z2: 11
  1261. });
  1262. group.add(symbol);
  1263. }
  1264. });
  1265. }
  1266. },
  1267. axisTickLabel: function(opt, axisModel, group, transformGroup) {
  1268. var ticksEls = buildAxisMajorTicks(group, transformGroup, axisModel, opt);
  1269. var labelEls = buildAxisLabel(group, transformGroup, axisModel, opt);
  1270. fixMinMaxLabelShow(axisModel, labelEls, ticksEls);
  1271. buildAxisMinorTicks(group, transformGroup, axisModel, opt.tickDirection);
  1272. if (axisModel.get(["axisLabel", "hideOverlap"])) {
  1273. var labelList = prepareLayoutList(map(labelEls, function(label) {
  1274. return {
  1275. label,
  1276. priority: label.z2,
  1277. defaultAttr: {
  1278. ignore: label.ignore
  1279. }
  1280. };
  1281. }));
  1282. hideOverlap(labelList);
  1283. }
  1284. },
  1285. axisName: function(opt, axisModel, group, transformGroup) {
  1286. var name = retrieve(opt.axisName, axisModel.get("name"));
  1287. if (!name) {
  1288. return;
  1289. }
  1290. var nameLocation = axisModel.get("nameLocation");
  1291. var nameDirection = opt.nameDirection;
  1292. var textStyleModel = axisModel.getModel("nameTextStyle");
  1293. var gap = axisModel.get("nameGap") || 0;
  1294. var extent = axisModel.axis.getExtent();
  1295. var gapSignal = extent[0] > extent[1] ? -1 : 1;
  1296. var pos = [
  1297. nameLocation === "start" ? extent[0] - gapSignal * gap : nameLocation === "end" ? extent[1] + gapSignal * gap : (extent[0] + extent[1]) / 2,
  1298. // Reuse labelOffset.
  1299. isNameLocationCenter(nameLocation) ? opt.labelOffset + nameDirection * gap : 0
  1300. ];
  1301. var labelLayout;
  1302. var nameRotation = axisModel.get("nameRotate");
  1303. if (nameRotation != null) {
  1304. nameRotation = nameRotation * PI / 180;
  1305. }
  1306. var axisNameAvailableWidth;
  1307. if (isNameLocationCenter(nameLocation)) {
  1308. labelLayout = AxisBuilder.innerTextLayout(
  1309. opt.rotation,
  1310. nameRotation != null ? nameRotation : opt.rotation,
  1311. // Adapt to axis.
  1312. nameDirection
  1313. );
  1314. } else {
  1315. labelLayout = endTextLayout(opt.rotation, nameLocation, nameRotation || 0, extent);
  1316. axisNameAvailableWidth = opt.axisNameAvailableWidth;
  1317. if (axisNameAvailableWidth != null) {
  1318. axisNameAvailableWidth = Math.abs(axisNameAvailableWidth / Math.sin(labelLayout.rotation));
  1319. !isFinite(axisNameAvailableWidth) && (axisNameAvailableWidth = null);
  1320. }
  1321. }
  1322. var textFont = textStyleModel.getFont();
  1323. var truncateOpt = axisModel.get("nameTruncate", true) || {};
  1324. var ellipsis = truncateOpt.ellipsis;
  1325. var maxWidth = retrieve(opt.nameTruncateMaxWidth, truncateOpt.maxWidth, axisNameAvailableWidth);
  1326. var textEl = new Text_default({
  1327. x: pos[0],
  1328. y: pos[1],
  1329. rotation: labelLayout.rotation,
  1330. silent: AxisBuilder.isLabelSilent(axisModel),
  1331. style: createTextStyle(textStyleModel, {
  1332. text: name,
  1333. font: textFont,
  1334. overflow: "truncate",
  1335. width: maxWidth,
  1336. ellipsis,
  1337. fill: textStyleModel.getTextColor() || axisModel.get(["axisLine", "lineStyle", "color"]),
  1338. align: textStyleModel.get("align") || labelLayout.textAlign,
  1339. verticalAlign: textStyleModel.get("verticalAlign") || labelLayout.textVerticalAlign
  1340. }),
  1341. z2: 1
  1342. });
  1343. setTooltipConfig({
  1344. el: textEl,
  1345. componentModel: axisModel,
  1346. itemName: name
  1347. });
  1348. textEl.__fullText = name;
  1349. textEl.anid = "name";
  1350. if (axisModel.get("triggerEvent")) {
  1351. var eventData = AxisBuilder.makeAxisEventDataBase(axisModel);
  1352. eventData.targetType = "axisName";
  1353. eventData.name = name;
  1354. getECData(textEl).eventData = eventData;
  1355. }
  1356. transformGroup.add(textEl);
  1357. textEl.updateTransform();
  1358. group.add(textEl);
  1359. textEl.decomposeTransform();
  1360. }
  1361. };
  1362. function endTextLayout(rotation, textPosition, textRotate, extent) {
  1363. var rotationDiff = remRadian(textRotate - rotation);
  1364. var textAlign;
  1365. var textVerticalAlign;
  1366. var inverse = extent[0] > extent[1];
  1367. var onLeft = textPosition === "start" && !inverse || textPosition !== "start" && inverse;
  1368. if (isRadianAroundZero(rotationDiff - PI / 2)) {
  1369. textVerticalAlign = onLeft ? "bottom" : "top";
  1370. textAlign = "center";
  1371. } else if (isRadianAroundZero(rotationDiff - PI * 1.5)) {
  1372. textVerticalAlign = onLeft ? "top" : "bottom";
  1373. textAlign = "center";
  1374. } else {
  1375. textVerticalAlign = "middle";
  1376. if (rotationDiff < PI * 1.5 && rotationDiff > PI / 2) {
  1377. textAlign = onLeft ? "left" : "right";
  1378. } else {
  1379. textAlign = onLeft ? "right" : "left";
  1380. }
  1381. }
  1382. return {
  1383. rotation: rotationDiff,
  1384. textAlign,
  1385. textVerticalAlign
  1386. };
  1387. }
  1388. function fixMinMaxLabelShow(axisModel, labelEls, tickEls) {
  1389. if (shouldShowAllLabels(axisModel.axis)) {
  1390. return;
  1391. }
  1392. var showMinLabel = axisModel.get(["axisLabel", "showMinLabel"]);
  1393. var showMaxLabel = axisModel.get(["axisLabel", "showMaxLabel"]);
  1394. labelEls = labelEls || [];
  1395. tickEls = tickEls || [];
  1396. var firstLabel = labelEls[0];
  1397. var nextLabel = labelEls[1];
  1398. var lastLabel = labelEls[labelEls.length - 1];
  1399. var prevLabel = labelEls[labelEls.length - 2];
  1400. var firstTick = tickEls[0];
  1401. var nextTick = tickEls[1];
  1402. var lastTick = tickEls[tickEls.length - 1];
  1403. var prevTick = tickEls[tickEls.length - 2];
  1404. if (showMinLabel === false) {
  1405. ignoreEl(firstLabel);
  1406. ignoreEl(firstTick);
  1407. } else if (isTwoLabelOverlapped(firstLabel, nextLabel)) {
  1408. if (showMinLabel) {
  1409. ignoreEl(nextLabel);
  1410. ignoreEl(nextTick);
  1411. } else {
  1412. ignoreEl(firstLabel);
  1413. ignoreEl(firstTick);
  1414. }
  1415. }
  1416. if (showMaxLabel === false) {
  1417. ignoreEl(lastLabel);
  1418. ignoreEl(lastTick);
  1419. } else if (isTwoLabelOverlapped(prevLabel, lastLabel)) {
  1420. if (showMaxLabel) {
  1421. ignoreEl(prevLabel);
  1422. ignoreEl(prevTick);
  1423. } else {
  1424. ignoreEl(lastLabel);
  1425. ignoreEl(lastTick);
  1426. }
  1427. }
  1428. }
  1429. function ignoreEl(el) {
  1430. el && (el.ignore = true);
  1431. }
  1432. function isTwoLabelOverlapped(current, next) {
  1433. var firstRect = current && current.getBoundingRect().clone();
  1434. var nextRect = next && next.getBoundingRect().clone();
  1435. if (!firstRect || !nextRect) {
  1436. return;
  1437. }
  1438. var mRotationBack = identity([]);
  1439. rotate(mRotationBack, mRotationBack, -current.rotation);
  1440. firstRect.applyTransform(mul([], mRotationBack, current.getLocalTransform()));
  1441. nextRect.applyTransform(mul([], mRotationBack, next.getLocalTransform()));
  1442. return firstRect.intersect(nextRect);
  1443. }
  1444. function isNameLocationCenter(nameLocation) {
  1445. return nameLocation === "middle" || nameLocation === "center";
  1446. }
  1447. function createTicks(ticksCoords, tickTransform, tickEndCoord, tickLineStyle, anidPrefix) {
  1448. var tickEls = [];
  1449. var pt1 = [];
  1450. var pt2 = [];
  1451. for (var i = 0; i < ticksCoords.length; i++) {
  1452. var tickCoord = ticksCoords[i].coord;
  1453. pt1[0] = tickCoord;
  1454. pt1[1] = 0;
  1455. pt2[0] = tickCoord;
  1456. pt2[1] = tickEndCoord;
  1457. if (tickTransform) {
  1458. applyTransform(pt1, pt1, tickTransform);
  1459. applyTransform(pt2, pt2, tickTransform);
  1460. }
  1461. var tickEl = new Line_default({
  1462. shape: {
  1463. x1: pt1[0],
  1464. y1: pt1[1],
  1465. x2: pt2[0],
  1466. y2: pt2[1]
  1467. },
  1468. style: tickLineStyle,
  1469. z2: 2,
  1470. autoBatch: true,
  1471. silent: true
  1472. });
  1473. subPixelOptimizeLine(tickEl.shape, tickEl.style.lineWidth);
  1474. tickEl.anid = anidPrefix + "_" + ticksCoords[i].tickValue;
  1475. tickEls.push(tickEl);
  1476. }
  1477. return tickEls;
  1478. }
  1479. function buildAxisMajorTicks(group, transformGroup, axisModel, opt) {
  1480. var axis = axisModel.axis;
  1481. var tickModel = axisModel.getModel("axisTick");
  1482. var shown = tickModel.get("show");
  1483. if (shown === "auto" && opt.handleAutoShown) {
  1484. shown = opt.handleAutoShown("axisTick");
  1485. }
  1486. if (!shown || axis.scale.isBlank()) {
  1487. return;
  1488. }
  1489. var lineStyleModel = tickModel.getModel("lineStyle");
  1490. var tickEndCoord = opt.tickDirection * tickModel.get("length");
  1491. var ticksCoords = axis.getTicksCoords();
  1492. var ticksEls = createTicks(ticksCoords, transformGroup.transform, tickEndCoord, defaults(lineStyleModel.getLineStyle(), {
  1493. stroke: axisModel.get(["axisLine", "lineStyle", "color"])
  1494. }), "ticks");
  1495. for (var i = 0; i < ticksEls.length; i++) {
  1496. group.add(ticksEls[i]);
  1497. }
  1498. return ticksEls;
  1499. }
  1500. function buildAxisMinorTicks(group, transformGroup, axisModel, tickDirection) {
  1501. var axis = axisModel.axis;
  1502. var minorTickModel = axisModel.getModel("minorTick");
  1503. if (!minorTickModel.get("show") || axis.scale.isBlank()) {
  1504. return;
  1505. }
  1506. var minorTicksCoords = axis.getMinorTicksCoords();
  1507. if (!minorTicksCoords.length) {
  1508. return;
  1509. }
  1510. var lineStyleModel = minorTickModel.getModel("lineStyle");
  1511. var tickEndCoord = tickDirection * minorTickModel.get("length");
  1512. var minorTickLineStyle = defaults(lineStyleModel.getLineStyle(), defaults(axisModel.getModel("axisTick").getLineStyle(), {
  1513. stroke: axisModel.get(["axisLine", "lineStyle", "color"])
  1514. }));
  1515. for (var i = 0; i < minorTicksCoords.length; i++) {
  1516. var minorTicksEls = createTicks(minorTicksCoords[i], transformGroup.transform, tickEndCoord, minorTickLineStyle, "minorticks_" + i);
  1517. for (var k = 0; k < minorTicksEls.length; k++) {
  1518. group.add(minorTicksEls[k]);
  1519. }
  1520. }
  1521. }
  1522. function buildAxisLabel(group, transformGroup, axisModel, opt) {
  1523. var axis = axisModel.axis;
  1524. var show = retrieve(opt.axisLabelShow, axisModel.get(["axisLabel", "show"]));
  1525. if (!show || axis.scale.isBlank()) {
  1526. return;
  1527. }
  1528. var labelModel = axisModel.getModel("axisLabel");
  1529. var labelMargin = labelModel.get("margin");
  1530. var labels = axis.getViewLabels();
  1531. var labelRotation = (retrieve(opt.labelRotate, labelModel.get("rotate")) || 0) * PI / 180;
  1532. var labelLayout = AxisBuilder.innerTextLayout(opt.rotation, labelRotation, opt.labelDirection);
  1533. var rawCategoryData = axisModel.getCategories && axisModel.getCategories(true);
  1534. var labelEls = [];
  1535. var silent = AxisBuilder.isLabelSilent(axisModel);
  1536. var triggerEvent = axisModel.get("triggerEvent");
  1537. each(labels, function(labelItem, index) {
  1538. var tickValue = axis.scale.type === "ordinal" ? axis.scale.getRawOrdinalNumber(labelItem.tickValue) : labelItem.tickValue;
  1539. var formattedLabel = labelItem.formattedLabel;
  1540. var rawLabel = labelItem.rawLabel;
  1541. var itemLabelModel = labelModel;
  1542. if (rawCategoryData && rawCategoryData[tickValue]) {
  1543. var rawCategoryItem = rawCategoryData[tickValue];
  1544. if (isObject(rawCategoryItem) && rawCategoryItem.textStyle) {
  1545. itemLabelModel = new Model_default(rawCategoryItem.textStyle, labelModel, axisModel.ecModel);
  1546. }
  1547. }
  1548. var textColor = itemLabelModel.getTextColor() || axisModel.get(["axisLine", "lineStyle", "color"]);
  1549. var tickCoord = axis.dataToCoord(tickValue);
  1550. var align = itemLabelModel.getShallow("align", true) || labelLayout.textAlign;
  1551. var alignMin = retrieve2(itemLabelModel.getShallow("alignMinLabel", true), align);
  1552. var alignMax = retrieve2(itemLabelModel.getShallow("alignMaxLabel", true), align);
  1553. var verticalAlign = itemLabelModel.getShallow("verticalAlign", true) || itemLabelModel.getShallow("baseline", true) || labelLayout.textVerticalAlign;
  1554. var verticalAlignMin = retrieve2(itemLabelModel.getShallow("verticalAlignMinLabel", true), verticalAlign);
  1555. var verticalAlignMax = retrieve2(itemLabelModel.getShallow("verticalAlignMaxLabel", true), verticalAlign);
  1556. var textEl = new Text_default({
  1557. x: tickCoord,
  1558. y: opt.labelOffset + opt.labelDirection * labelMargin,
  1559. rotation: labelLayout.rotation,
  1560. silent,
  1561. z2: 10 + (labelItem.level || 0),
  1562. style: createTextStyle(itemLabelModel, {
  1563. text: formattedLabel,
  1564. align: index === 0 ? alignMin : index === labels.length - 1 ? alignMax : align,
  1565. verticalAlign: index === 0 ? verticalAlignMin : index === labels.length - 1 ? verticalAlignMax : verticalAlign,
  1566. fill: isFunction(textColor) ? textColor(
  1567. // (1) In category axis with data zoom, tick is not the original
  1568. // index of axis.data. So tick should not be exposed to user
  1569. // in category axis.
  1570. // (2) Compatible with previous version, which always use formatted label as
  1571. // input. But in interval scale the formatted label is like '223,445', which
  1572. // maked user replace ','. So we modify it to return original val but remain
  1573. // it as 'string' to avoid error in replacing.
  1574. axis.type === "category" ? rawLabel : axis.type === "value" ? tickValue + "" : tickValue,
  1575. index
  1576. ) : textColor
  1577. })
  1578. });
  1579. textEl.anid = "label_" + tickValue;
  1580. if (triggerEvent) {
  1581. var eventData = AxisBuilder.makeAxisEventDataBase(axisModel);
  1582. eventData.targetType = "axisLabel";
  1583. eventData.value = rawLabel;
  1584. eventData.tickIndex = index;
  1585. if (axis.type === "category") {
  1586. eventData.dataIndex = tickValue;
  1587. }
  1588. getECData(textEl).eventData = eventData;
  1589. }
  1590. transformGroup.add(textEl);
  1591. textEl.updateTransform();
  1592. labelEls.push(textEl);
  1593. group.add(textEl);
  1594. textEl.decomposeTransform();
  1595. });
  1596. return labelEls;
  1597. }
  1598. var AxisBuilder_default = AxisBuilder;
  1599. // node_modules/echarts/lib/component/axisPointer/modelHelper.js
  1600. function collect(ecModel, api) {
  1601. var result = {
  1602. /**
  1603. * key: makeKey(axis.model)
  1604. * value: {
  1605. * axis,
  1606. * coordSys,
  1607. * axisPointerModel,
  1608. * triggerTooltip,
  1609. * triggerEmphasis,
  1610. * involveSeries,
  1611. * snap,
  1612. * seriesModels,
  1613. * seriesDataCount
  1614. * }
  1615. */
  1616. axesInfo: {},
  1617. seriesInvolved: false,
  1618. /**
  1619. * key: makeKey(coordSys.model)
  1620. * value: Object: key makeKey(axis.model), value: axisInfo
  1621. */
  1622. coordSysAxesInfo: {},
  1623. coordSysMap: {}
  1624. };
  1625. collectAxesInfo(result, ecModel, api);
  1626. result.seriesInvolved && collectSeriesInfo(result, ecModel);
  1627. return result;
  1628. }
  1629. function collectAxesInfo(result, ecModel, api) {
  1630. var globalTooltipModel = ecModel.getComponent("tooltip");
  1631. var globalAxisPointerModel = ecModel.getComponent("axisPointer");
  1632. var linksOption = globalAxisPointerModel.get("link", true) || [];
  1633. var linkGroups = [];
  1634. each(api.getCoordinateSystems(), function(coordSys) {
  1635. if (!coordSys.axisPointerEnabled) {
  1636. return;
  1637. }
  1638. var coordSysKey = makeKey(coordSys.model);
  1639. var axesInfoInCoordSys = result.coordSysAxesInfo[coordSysKey] = {};
  1640. result.coordSysMap[coordSysKey] = coordSys;
  1641. var coordSysModel = coordSys.model;
  1642. var baseTooltipModel = coordSysModel.getModel("tooltip", globalTooltipModel);
  1643. each(coordSys.getAxes(), curry(saveTooltipAxisInfo, false, null));
  1644. if (coordSys.getTooltipAxes && globalTooltipModel && baseTooltipModel.get("show")) {
  1645. var triggerAxis = baseTooltipModel.get("trigger") === "axis";
  1646. var cross = baseTooltipModel.get(["axisPointer", "type"]) === "cross";
  1647. var tooltipAxes = coordSys.getTooltipAxes(baseTooltipModel.get(["axisPointer", "axis"]));
  1648. if (triggerAxis || cross) {
  1649. each(tooltipAxes.baseAxes, curry(saveTooltipAxisInfo, cross ? "cross" : true, triggerAxis));
  1650. }
  1651. if (cross) {
  1652. each(tooltipAxes.otherAxes, curry(saveTooltipAxisInfo, "cross", false));
  1653. }
  1654. }
  1655. function saveTooltipAxisInfo(fromTooltip, triggerTooltip, axis) {
  1656. var axisPointerModel = axis.model.getModel("axisPointer", globalAxisPointerModel);
  1657. var axisPointerShow = axisPointerModel.get("show");
  1658. if (!axisPointerShow || axisPointerShow === "auto" && !fromTooltip && !isHandleTrigger(axisPointerModel)) {
  1659. return;
  1660. }
  1661. if (triggerTooltip == null) {
  1662. triggerTooltip = axisPointerModel.get("triggerTooltip");
  1663. }
  1664. axisPointerModel = fromTooltip ? makeAxisPointerModel(axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip) : axisPointerModel;
  1665. var snap = axisPointerModel.get("snap");
  1666. var triggerEmphasis = axisPointerModel.get("triggerEmphasis");
  1667. var axisKey = makeKey(axis.model);
  1668. var involveSeries = triggerTooltip || snap || axis.type === "category";
  1669. var axisInfo = result.axesInfo[axisKey] = {
  1670. key: axisKey,
  1671. axis,
  1672. coordSys,
  1673. axisPointerModel,
  1674. triggerTooltip,
  1675. triggerEmphasis,
  1676. involveSeries,
  1677. snap,
  1678. useHandle: isHandleTrigger(axisPointerModel),
  1679. seriesModels: [],
  1680. linkGroup: null
  1681. };
  1682. axesInfoInCoordSys[axisKey] = axisInfo;
  1683. result.seriesInvolved = result.seriesInvolved || involveSeries;
  1684. var groupIndex = getLinkGroupIndex(linksOption, axis);
  1685. if (groupIndex != null) {
  1686. var linkGroup = linkGroups[groupIndex] || (linkGroups[groupIndex] = {
  1687. axesInfo: {}
  1688. });
  1689. linkGroup.axesInfo[axisKey] = axisInfo;
  1690. linkGroup.mapper = linksOption[groupIndex].mapper;
  1691. axisInfo.linkGroup = linkGroup;
  1692. }
  1693. }
  1694. });
  1695. }
  1696. function makeAxisPointerModel(axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip) {
  1697. var tooltipAxisPointerModel = baseTooltipModel.getModel("axisPointer");
  1698. var fields = ["type", "snap", "lineStyle", "shadowStyle", "label", "animation", "animationDurationUpdate", "animationEasingUpdate", "z"];
  1699. var volatileOption = {};
  1700. each(fields, function(field) {
  1701. volatileOption[field] = clone(tooltipAxisPointerModel.get(field));
  1702. });
  1703. volatileOption.snap = axis.type !== "category" && !!triggerTooltip;
  1704. if (tooltipAxisPointerModel.get("type") === "cross") {
  1705. volatileOption.type = "line";
  1706. }
  1707. var labelOption = volatileOption.label || (volatileOption.label = {});
  1708. labelOption.show == null && (labelOption.show = false);
  1709. if (fromTooltip === "cross") {
  1710. var tooltipAxisPointerLabelShow = tooltipAxisPointerModel.get(["label", "show"]);
  1711. labelOption.show = tooltipAxisPointerLabelShow != null ? tooltipAxisPointerLabelShow : true;
  1712. if (!triggerTooltip) {
  1713. var crossStyle = volatileOption.lineStyle = tooltipAxisPointerModel.get("crossStyle");
  1714. crossStyle && defaults(labelOption, crossStyle.textStyle);
  1715. }
  1716. }
  1717. return axis.model.getModel("axisPointer", new Model_default(volatileOption, globalAxisPointerModel, ecModel));
  1718. }
  1719. function collectSeriesInfo(result, ecModel) {
  1720. ecModel.eachSeries(function(seriesModel) {
  1721. var coordSys = seriesModel.coordinateSystem;
  1722. var seriesTooltipTrigger = seriesModel.get(["tooltip", "trigger"], true);
  1723. var seriesTooltipShow = seriesModel.get(["tooltip", "show"], true);
  1724. if (!coordSys || seriesTooltipTrigger === "none" || seriesTooltipTrigger === false || seriesTooltipTrigger === "item" || seriesTooltipShow === false || seriesModel.get(["axisPointer", "show"], true) === false) {
  1725. return;
  1726. }
  1727. each(result.coordSysAxesInfo[makeKey(coordSys.model)], function(axisInfo) {
  1728. var axis = axisInfo.axis;
  1729. if (coordSys.getAxis(axis.dim) === axis) {
  1730. axisInfo.seriesModels.push(seriesModel);
  1731. axisInfo.seriesDataCount == null && (axisInfo.seriesDataCount = 0);
  1732. axisInfo.seriesDataCount += seriesModel.getData().count();
  1733. }
  1734. });
  1735. });
  1736. }
  1737. function getLinkGroupIndex(linksOption, axis) {
  1738. var axisModel = axis.model;
  1739. var dim = axis.dim;
  1740. for (var i = 0; i < linksOption.length; i++) {
  1741. var linkOption = linksOption[i] || {};
  1742. if (checkPropInLink(linkOption[dim + "AxisId"], axisModel.id) || checkPropInLink(linkOption[dim + "AxisIndex"], axisModel.componentIndex) || checkPropInLink(linkOption[dim + "AxisName"], axisModel.name)) {
  1743. return i;
  1744. }
  1745. }
  1746. }
  1747. function checkPropInLink(linkPropValue, axisPropValue) {
  1748. return linkPropValue === "all" || isArray(linkPropValue) && indexOf(linkPropValue, axisPropValue) >= 0 || linkPropValue === axisPropValue;
  1749. }
  1750. function fixValue(axisModel) {
  1751. var axisInfo = getAxisInfo(axisModel);
  1752. if (!axisInfo) {
  1753. return;
  1754. }
  1755. var axisPointerModel = axisInfo.axisPointerModel;
  1756. var scale2 = axisInfo.axis.scale;
  1757. var option = axisPointerModel.option;
  1758. var status = axisPointerModel.get("status");
  1759. var value = axisPointerModel.get("value");
  1760. if (value != null) {
  1761. value = scale2.parse(value);
  1762. }
  1763. var useHandle = isHandleTrigger(axisPointerModel);
  1764. if (status == null) {
  1765. option.status = useHandle ? "show" : "hide";
  1766. }
  1767. var extent = scale2.getExtent().slice();
  1768. extent[0] > extent[1] && extent.reverse();
  1769. if (
  1770. // Pick a value on axis when initializing.
  1771. value == null || value > extent[1]
  1772. ) {
  1773. value = extent[1];
  1774. }
  1775. if (value < extent[0]) {
  1776. value = extent[0];
  1777. }
  1778. option.value = value;
  1779. if (useHandle) {
  1780. option.status = axisInfo.axis.scale.isBlank() ? "hide" : "show";
  1781. }
  1782. }
  1783. function getAxisInfo(axisModel) {
  1784. var coordSysAxesInfo = (axisModel.ecModel.getComponent("axisPointer") || {}).coordSysAxesInfo;
  1785. return coordSysAxesInfo && coordSysAxesInfo.axesInfo[makeKey(axisModel)];
  1786. }
  1787. function getAxisPointerModel(axisModel) {
  1788. var axisInfo = getAxisInfo(axisModel);
  1789. return axisInfo && axisInfo.axisPointerModel;
  1790. }
  1791. function isHandleTrigger(axisPointerModel) {
  1792. return !!axisPointerModel.get(["handle", "show"]);
  1793. }
  1794. function makeKey(model) {
  1795. return model.type + "||" + model.id;
  1796. }
  1797. // node_modules/echarts/lib/component/axis/AxisView.js
  1798. var axisPointerClazz = {};
  1799. var AxisView = (
  1800. /** @class */
  1801. function(_super) {
  1802. __extends(AxisView2, _super);
  1803. function AxisView2() {
  1804. var _this = _super !== null && _super.apply(this, arguments) || this;
  1805. _this.type = AxisView2.type;
  1806. return _this;
  1807. }
  1808. AxisView2.prototype.render = function(axisModel, ecModel, api, payload) {
  1809. this.axisPointerClass && fixValue(axisModel);
  1810. _super.prototype.render.apply(this, arguments);
  1811. this._doUpdateAxisPointerClass(axisModel, api, true);
  1812. };
  1813. AxisView2.prototype.updateAxisPointer = function(axisModel, ecModel, api, payload) {
  1814. this._doUpdateAxisPointerClass(axisModel, api, false);
  1815. };
  1816. AxisView2.prototype.remove = function(ecModel, api) {
  1817. var axisPointer = this._axisPointer;
  1818. axisPointer && axisPointer.remove(api);
  1819. };
  1820. AxisView2.prototype.dispose = function(ecModel, api) {
  1821. this._disposeAxisPointer(api);
  1822. _super.prototype.dispose.apply(this, arguments);
  1823. };
  1824. AxisView2.prototype._doUpdateAxisPointerClass = function(axisModel, api, forceRender) {
  1825. var Clazz = AxisView2.getAxisPointerClass(this.axisPointerClass);
  1826. if (!Clazz) {
  1827. return;
  1828. }
  1829. var axisPointerModel = getAxisPointerModel(axisModel);
  1830. axisPointerModel ? (this._axisPointer || (this._axisPointer = new Clazz())).render(axisModel, axisPointerModel, api, forceRender) : this._disposeAxisPointer(api);
  1831. };
  1832. AxisView2.prototype._disposeAxisPointer = function(api) {
  1833. this._axisPointer && this._axisPointer.dispose(api);
  1834. this._axisPointer = null;
  1835. };
  1836. AxisView2.registerAxisPointerClass = function(type, clazz) {
  1837. if (true) {
  1838. if (axisPointerClazz[type]) {
  1839. throw new Error("axisPointer " + type + " exists");
  1840. }
  1841. }
  1842. axisPointerClazz[type] = clazz;
  1843. };
  1844. ;
  1845. AxisView2.getAxisPointerClass = function(type) {
  1846. return type && axisPointerClazz[type];
  1847. };
  1848. ;
  1849. AxisView2.type = "axis";
  1850. return AxisView2;
  1851. }(Component_default2)
  1852. );
  1853. var AxisView_default = AxisView;
  1854. // node_modules/echarts/lib/component/axis/axisSplitHelper.js
  1855. var inner = makeInner();
  1856. function rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel) {
  1857. var axis = axisModel.axis;
  1858. if (axis.scale.isBlank()) {
  1859. return;
  1860. }
  1861. var splitAreaModel = axisModel.getModel("splitArea");
  1862. var areaStyleModel = splitAreaModel.getModel("areaStyle");
  1863. var areaColors = areaStyleModel.get("color");
  1864. var gridRect = gridModel.coordinateSystem.getRect();
  1865. var ticksCoords = axis.getTicksCoords({
  1866. tickModel: splitAreaModel,
  1867. clamp: true
  1868. });
  1869. if (!ticksCoords.length) {
  1870. return;
  1871. }
  1872. var areaColorsLen = areaColors.length;
  1873. var lastSplitAreaColors = inner(axisView).splitAreaColors;
  1874. var newSplitAreaColors = createHashMap();
  1875. var colorIndex = 0;
  1876. if (lastSplitAreaColors) {
  1877. for (var i = 0; i < ticksCoords.length; i++) {
  1878. var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
  1879. if (cIndex != null) {
  1880. colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
  1881. break;
  1882. }
  1883. }
  1884. }
  1885. var prev = axis.toGlobalCoord(ticksCoords[0].coord);
  1886. var areaStyle = areaStyleModel.getAreaStyle();
  1887. areaColors = isArray(areaColors) ? areaColors : [areaColors];
  1888. for (var i = 1; i < ticksCoords.length; i++) {
  1889. var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
  1890. var x = void 0;
  1891. var y = void 0;
  1892. var width = void 0;
  1893. var height = void 0;
  1894. if (axis.isHorizontal()) {
  1895. x = prev;
  1896. y = gridRect.y;
  1897. width = tickCoord - x;
  1898. height = gridRect.height;
  1899. prev = x + width;
  1900. } else {
  1901. x = gridRect.x;
  1902. y = prev;
  1903. width = gridRect.width;
  1904. height = tickCoord - y;
  1905. prev = y + height;
  1906. }
  1907. var tickValue = ticksCoords[i - 1].tickValue;
  1908. tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
  1909. axisGroup.add(new Rect_default({
  1910. anid: tickValue != null ? "area_" + tickValue : null,
  1911. shape: {
  1912. x,
  1913. y,
  1914. width,
  1915. height
  1916. },
  1917. style: defaults({
  1918. fill: areaColors[colorIndex]
  1919. }, areaStyle),
  1920. autoBatch: true,
  1921. silent: true
  1922. }));
  1923. colorIndex = (colorIndex + 1) % areaColorsLen;
  1924. }
  1925. inner(axisView).splitAreaColors = newSplitAreaColors;
  1926. }
  1927. function rectCoordAxisHandleRemove(axisView) {
  1928. inner(axisView).splitAreaColors = null;
  1929. }
  1930. // node_modules/echarts/lib/component/axis/CartesianAxisView.js
  1931. var axisBuilderAttrs = ["axisLine", "axisTickLabel", "axisName"];
  1932. var selfBuilderAttrs = ["splitArea", "splitLine", "minorSplitLine"];
  1933. var CartesianAxisView = (
  1934. /** @class */
  1935. function(_super) {
  1936. __extends(CartesianAxisView2, _super);
  1937. function CartesianAxisView2() {
  1938. var _this = _super !== null && _super.apply(this, arguments) || this;
  1939. _this.type = CartesianAxisView2.type;
  1940. _this.axisPointerClass = "CartesianAxisPointer";
  1941. return _this;
  1942. }
  1943. CartesianAxisView2.prototype.render = function(axisModel, ecModel, api, payload) {
  1944. this.group.removeAll();
  1945. var oldAxisGroup = this._axisGroup;
  1946. this._axisGroup = new Group_default();
  1947. this.group.add(this._axisGroup);
  1948. if (!axisModel.get("show")) {
  1949. return;
  1950. }
  1951. var gridModel = axisModel.getCoordSysModel();
  1952. var layout2 = layout(gridModel, axisModel);
  1953. var axisBuilder = new AxisBuilder_default(axisModel, extend({
  1954. handleAutoShown: function(elementType) {
  1955. var cartesians = gridModel.coordinateSystem.getCartesians();
  1956. for (var i = 0; i < cartesians.length; i++) {
  1957. if (isIntervalOrLogScale(cartesians[i].getOtherAxis(axisModel.axis).scale)) {
  1958. return true;
  1959. }
  1960. }
  1961. return false;
  1962. }
  1963. }, layout2));
  1964. each(axisBuilderAttrs, axisBuilder.add, axisBuilder);
  1965. this._axisGroup.add(axisBuilder.getGroup());
  1966. each(selfBuilderAttrs, function(name) {
  1967. if (axisModel.get([name, "show"])) {
  1968. axisElementBuilders[name](this, this._axisGroup, axisModel, gridModel);
  1969. }
  1970. }, this);
  1971. var isInitialSortFromBarRacing = payload && payload.type === "changeAxisOrder" && payload.isInitSort;
  1972. if (!isInitialSortFromBarRacing) {
  1973. groupTransition(oldAxisGroup, this._axisGroup, axisModel);
  1974. }
  1975. _super.prototype.render.call(this, axisModel, ecModel, api, payload);
  1976. };
  1977. CartesianAxisView2.prototype.remove = function() {
  1978. rectCoordAxisHandleRemove(this);
  1979. };
  1980. CartesianAxisView2.type = "cartesianAxis";
  1981. return CartesianAxisView2;
  1982. }(AxisView_default)
  1983. );
  1984. var axisElementBuilders = {
  1985. splitLine: function(axisView, axisGroup, axisModel, gridModel) {
  1986. var axis = axisModel.axis;
  1987. if (axis.scale.isBlank()) {
  1988. return;
  1989. }
  1990. var splitLineModel = axisModel.getModel("splitLine");
  1991. var lineStyleModel = splitLineModel.getModel("lineStyle");
  1992. var lineColors = lineStyleModel.get("color");
  1993. lineColors = isArray(lineColors) ? lineColors : [lineColors];
  1994. var gridRect = gridModel.coordinateSystem.getRect();
  1995. var isHorizontal = axis.isHorizontal();
  1996. var lineCount = 0;
  1997. var ticksCoords = axis.getTicksCoords({
  1998. tickModel: splitLineModel
  1999. });
  2000. var p1 = [];
  2001. var p2 = [];
  2002. var lineStyle = lineStyleModel.getLineStyle();
  2003. for (var i = 0; i < ticksCoords.length; i++) {
  2004. var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
  2005. if (isHorizontal) {
  2006. p1[0] = tickCoord;
  2007. p1[1] = gridRect.y;
  2008. p2[0] = tickCoord;
  2009. p2[1] = gridRect.y + gridRect.height;
  2010. } else {
  2011. p1[0] = gridRect.x;
  2012. p1[1] = tickCoord;
  2013. p2[0] = gridRect.x + gridRect.width;
  2014. p2[1] = tickCoord;
  2015. }
  2016. var colorIndex = lineCount++ % lineColors.length;
  2017. var tickValue = ticksCoords[i].tickValue;
  2018. var line = new Line_default({
  2019. anid: tickValue != null ? "line_" + ticksCoords[i].tickValue : null,
  2020. autoBatch: true,
  2021. shape: {
  2022. x1: p1[0],
  2023. y1: p1[1],
  2024. x2: p2[0],
  2025. y2: p2[1]
  2026. },
  2027. style: defaults({
  2028. stroke: lineColors[colorIndex]
  2029. }, lineStyle),
  2030. silent: true
  2031. });
  2032. subPixelOptimizeLine(line.shape, lineStyle.lineWidth);
  2033. axisGroup.add(line);
  2034. }
  2035. },
  2036. minorSplitLine: function(axisView, axisGroup, axisModel, gridModel) {
  2037. var axis = axisModel.axis;
  2038. var minorSplitLineModel = axisModel.getModel("minorSplitLine");
  2039. var lineStyleModel = minorSplitLineModel.getModel("lineStyle");
  2040. var gridRect = gridModel.coordinateSystem.getRect();
  2041. var isHorizontal = axis.isHorizontal();
  2042. var minorTicksCoords = axis.getMinorTicksCoords();
  2043. if (!minorTicksCoords.length) {
  2044. return;
  2045. }
  2046. var p1 = [];
  2047. var p2 = [];
  2048. var lineStyle = lineStyleModel.getLineStyle();
  2049. for (var i = 0; i < minorTicksCoords.length; i++) {
  2050. for (var k = 0; k < minorTicksCoords[i].length; k++) {
  2051. var tickCoord = axis.toGlobalCoord(minorTicksCoords[i][k].coord);
  2052. if (isHorizontal) {
  2053. p1[0] = tickCoord;
  2054. p1[1] = gridRect.y;
  2055. p2[0] = tickCoord;
  2056. p2[1] = gridRect.y + gridRect.height;
  2057. } else {
  2058. p1[0] = gridRect.x;
  2059. p1[1] = tickCoord;
  2060. p2[0] = gridRect.x + gridRect.width;
  2061. p2[1] = tickCoord;
  2062. }
  2063. var line = new Line_default({
  2064. anid: "minor_line_" + minorTicksCoords[i][k].tickValue,
  2065. autoBatch: true,
  2066. shape: {
  2067. x1: p1[0],
  2068. y1: p1[1],
  2069. x2: p2[0],
  2070. y2: p2[1]
  2071. },
  2072. style: lineStyle,
  2073. silent: true
  2074. });
  2075. subPixelOptimizeLine(line.shape, lineStyle.lineWidth);
  2076. axisGroup.add(line);
  2077. }
  2078. }
  2079. },
  2080. splitArea: function(axisView, axisGroup, axisModel, gridModel) {
  2081. rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel);
  2082. }
  2083. };
  2084. var CartesianXAxisView = (
  2085. /** @class */
  2086. function(_super) {
  2087. __extends(CartesianXAxisView2, _super);
  2088. function CartesianXAxisView2() {
  2089. var _this = _super !== null && _super.apply(this, arguments) || this;
  2090. _this.type = CartesianXAxisView2.type;
  2091. return _this;
  2092. }
  2093. CartesianXAxisView2.type = "xAxis";
  2094. return CartesianXAxisView2;
  2095. }(CartesianAxisView)
  2096. );
  2097. var CartesianYAxisView = (
  2098. /** @class */
  2099. function(_super) {
  2100. __extends(CartesianYAxisView2, _super);
  2101. function CartesianYAxisView2() {
  2102. var _this = _super !== null && _super.apply(this, arguments) || this;
  2103. _this.type = CartesianXAxisView.type;
  2104. return _this;
  2105. }
  2106. CartesianYAxisView2.type = "yAxis";
  2107. return CartesianYAxisView2;
  2108. }(CartesianAxisView)
  2109. );
  2110. // node_modules/echarts/lib/component/grid/installSimple.js
  2111. var GridView = (
  2112. /** @class */
  2113. function(_super) {
  2114. __extends(GridView2, _super);
  2115. function GridView2() {
  2116. var _this = _super !== null && _super.apply(this, arguments) || this;
  2117. _this.type = "grid";
  2118. return _this;
  2119. }
  2120. GridView2.prototype.render = function(gridModel, ecModel) {
  2121. this.group.removeAll();
  2122. if (gridModel.get("show")) {
  2123. this.group.add(new Rect_default({
  2124. shape: gridModel.coordinateSystem.getRect(),
  2125. style: defaults({
  2126. fill: gridModel.get("backgroundColor")
  2127. }, gridModel.getItemStyle()),
  2128. silent: true,
  2129. z2: -1
  2130. }));
  2131. }
  2132. };
  2133. GridView2.type = "grid";
  2134. return GridView2;
  2135. }(Component_default2)
  2136. );
  2137. var extraOption = {
  2138. // gridIndex: 0,
  2139. // gridId: '',
  2140. offset: 0
  2141. };
  2142. function install(registers) {
  2143. registers.registerComponentView(GridView);
  2144. registers.registerComponentModel(GridModel_default);
  2145. registers.registerCoordinateSystem("cartesian2d", Grid_default);
  2146. axisModelCreator(registers, "x", CartesianAxisModel, extraOption);
  2147. axisModelCreator(registers, "y", CartesianAxisModel, extraOption);
  2148. registers.registerComponentView(CartesianXAxisView);
  2149. registers.registerComponentView(CartesianYAxisView);
  2150. registers.registerPreprocessor(function(option) {
  2151. if (option.xAxis && option.yAxis && !option.grid) {
  2152. option.grid = {};
  2153. }
  2154. });
  2155. }
  2156. // node_modules/echarts/lib/coord/radar/RadarModel.js
  2157. var valueAxisDefault = axisDefault_default.value;
  2158. function defaultsShow(opt, show) {
  2159. return defaults({
  2160. show
  2161. }, opt);
  2162. }
  2163. var RadarModel = (
  2164. /** @class */
  2165. function(_super) {
  2166. __extends(RadarModel2, _super);
  2167. function RadarModel2() {
  2168. var _this = _super !== null && _super.apply(this, arguments) || this;
  2169. _this.type = RadarModel2.type;
  2170. return _this;
  2171. }
  2172. RadarModel2.prototype.optionUpdated = function() {
  2173. var boundaryGap = this.get("boundaryGap");
  2174. var splitNumber = this.get("splitNumber");
  2175. var scale2 = this.get("scale");
  2176. var axisLine = this.get("axisLine");
  2177. var axisTick = this.get("axisTick");
  2178. var axisLabel = this.get("axisLabel");
  2179. var nameTextStyle = this.get("axisName");
  2180. var showName = this.get(["axisName", "show"]);
  2181. var nameFormatter = this.get(["axisName", "formatter"]);
  2182. var nameGap = this.get("axisNameGap");
  2183. var triggerEvent = this.get("triggerEvent");
  2184. var indicatorModels = map(this.get("indicator") || [], function(indicatorOpt) {
  2185. if (indicatorOpt.max != null && indicatorOpt.max > 0 && !indicatorOpt.min) {
  2186. indicatorOpt.min = 0;
  2187. } else if (indicatorOpt.min != null && indicatorOpt.min < 0 && !indicatorOpt.max) {
  2188. indicatorOpt.max = 0;
  2189. }
  2190. var iNameTextStyle = nameTextStyle;
  2191. if (indicatorOpt.color != null) {
  2192. iNameTextStyle = defaults({
  2193. color: indicatorOpt.color
  2194. }, nameTextStyle);
  2195. }
  2196. var innerIndicatorOpt = merge(clone(indicatorOpt), {
  2197. boundaryGap,
  2198. splitNumber,
  2199. scale: scale2,
  2200. axisLine,
  2201. axisTick,
  2202. // axisType: axisType,
  2203. axisLabel,
  2204. // Compatible with 2 and use text
  2205. name: indicatorOpt.text,
  2206. showName,
  2207. nameLocation: "end",
  2208. nameGap,
  2209. // min: 0,
  2210. nameTextStyle: iNameTextStyle,
  2211. triggerEvent
  2212. }, false);
  2213. if (isString(nameFormatter)) {
  2214. var indName = innerIndicatorOpt.name;
  2215. innerIndicatorOpt.name = nameFormatter.replace("{value}", indName != null ? indName : "");
  2216. } else if (isFunction(nameFormatter)) {
  2217. innerIndicatorOpt.name = nameFormatter(innerIndicatorOpt.name, innerIndicatorOpt);
  2218. }
  2219. var model = new Model_default(innerIndicatorOpt, null, this.ecModel);
  2220. mixin(model, AxisModelCommonMixin.prototype);
  2221. model.mainType = "radar";
  2222. model.componentIndex = this.componentIndex;
  2223. return model;
  2224. }, this);
  2225. this._indicatorModels = indicatorModels;
  2226. };
  2227. RadarModel2.prototype.getIndicatorModels = function() {
  2228. return this._indicatorModels;
  2229. };
  2230. RadarModel2.type = "radar";
  2231. RadarModel2.defaultOption = {
  2232. // zlevel: 0,
  2233. z: 0,
  2234. center: ["50%", "50%"],
  2235. radius: "75%",
  2236. startAngle: 90,
  2237. axisName: {
  2238. show: true
  2239. // formatter: null
  2240. // textStyle: {}
  2241. },
  2242. boundaryGap: [0, 0],
  2243. splitNumber: 5,
  2244. axisNameGap: 15,
  2245. scale: false,
  2246. // Polygon or circle
  2247. shape: "polygon",
  2248. axisLine: merge({
  2249. lineStyle: {
  2250. color: "#bbb"
  2251. }
  2252. }, valueAxisDefault.axisLine),
  2253. axisLabel: defaultsShow(valueAxisDefault.axisLabel, false),
  2254. axisTick: defaultsShow(valueAxisDefault.axisTick, false),
  2255. // axisType: 'value',
  2256. splitLine: defaultsShow(valueAxisDefault.splitLine, true),
  2257. splitArea: defaultsShow(valueAxisDefault.splitArea, true),
  2258. // {text, min, max}
  2259. indicator: []
  2260. };
  2261. return RadarModel2;
  2262. }(Component_default)
  2263. );
  2264. var RadarModel_default = RadarModel;
  2265. // node_modules/echarts/lib/component/radar/RadarView.js
  2266. var axisBuilderAttrs2 = ["axisLine", "axisTickLabel", "axisName"];
  2267. var RadarView = (
  2268. /** @class */
  2269. function(_super) {
  2270. __extends(RadarView2, _super);
  2271. function RadarView2() {
  2272. var _this = _super !== null && _super.apply(this, arguments) || this;
  2273. _this.type = RadarView2.type;
  2274. return _this;
  2275. }
  2276. RadarView2.prototype.render = function(radarModel, ecModel, api) {
  2277. var group = this.group;
  2278. group.removeAll();
  2279. this._buildAxes(radarModel);
  2280. this._buildSplitLineAndArea(radarModel);
  2281. };
  2282. RadarView2.prototype._buildAxes = function(radarModel) {
  2283. var radar = radarModel.coordinateSystem;
  2284. var indicatorAxes = radar.getIndicatorAxes();
  2285. var axisBuilders = map(indicatorAxes, function(indicatorAxis) {
  2286. var axisName = indicatorAxis.model.get("showName") ? indicatorAxis.name : "";
  2287. var axisBuilder = new AxisBuilder_default(indicatorAxis.model, {
  2288. axisName,
  2289. position: [radar.cx, radar.cy],
  2290. rotation: indicatorAxis.angle,
  2291. labelDirection: -1,
  2292. tickDirection: -1,
  2293. nameDirection: 1
  2294. });
  2295. return axisBuilder;
  2296. });
  2297. each(axisBuilders, function(axisBuilder) {
  2298. each(axisBuilderAttrs2, axisBuilder.add, axisBuilder);
  2299. this.group.add(axisBuilder.getGroup());
  2300. }, this);
  2301. };
  2302. RadarView2.prototype._buildSplitLineAndArea = function(radarModel) {
  2303. var radar = radarModel.coordinateSystem;
  2304. var indicatorAxes = radar.getIndicatorAxes();
  2305. if (!indicatorAxes.length) {
  2306. return;
  2307. }
  2308. var shape = radarModel.get("shape");
  2309. var splitLineModel = radarModel.getModel("splitLine");
  2310. var splitAreaModel = radarModel.getModel("splitArea");
  2311. var lineStyleModel = splitLineModel.getModel("lineStyle");
  2312. var areaStyleModel = splitAreaModel.getModel("areaStyle");
  2313. var showSplitLine = splitLineModel.get("show");
  2314. var showSplitArea = splitAreaModel.get("show");
  2315. var splitLineColors = lineStyleModel.get("color");
  2316. var splitAreaColors = areaStyleModel.get("color");
  2317. var splitLineColorsArr = isArray(splitLineColors) ? splitLineColors : [splitLineColors];
  2318. var splitAreaColorsArr = isArray(splitAreaColors) ? splitAreaColors : [splitAreaColors];
  2319. var splitLines = [];
  2320. var splitAreas = [];
  2321. function getColorIndex(areaOrLine, areaOrLineColorList, idx) {
  2322. var colorIndex2 = idx % areaOrLineColorList.length;
  2323. areaOrLine[colorIndex2] = areaOrLine[colorIndex2] || [];
  2324. return colorIndex2;
  2325. }
  2326. if (shape === "circle") {
  2327. var ticksRadius = indicatorAxes[0].getTicksCoords();
  2328. var cx = radar.cx;
  2329. var cy = radar.cy;
  2330. for (var i = 0; i < ticksRadius.length; i++) {
  2331. if (showSplitLine) {
  2332. var colorIndex = getColorIndex(splitLines, splitLineColorsArr, i);
  2333. splitLines[colorIndex].push(new Circle_default({
  2334. shape: {
  2335. cx,
  2336. cy,
  2337. r: ticksRadius[i].coord
  2338. }
  2339. }));
  2340. }
  2341. if (showSplitArea && i < ticksRadius.length - 1) {
  2342. var colorIndex = getColorIndex(splitAreas, splitAreaColorsArr, i);
  2343. splitAreas[colorIndex].push(new Ring_default({
  2344. shape: {
  2345. cx,
  2346. cy,
  2347. r0: ticksRadius[i].coord,
  2348. r: ticksRadius[i + 1].coord
  2349. }
  2350. }));
  2351. }
  2352. }
  2353. } else {
  2354. var realSplitNumber_1;
  2355. var axesTicksPoints = map(indicatorAxes, function(indicatorAxis, idx) {
  2356. var ticksCoords = indicatorAxis.getTicksCoords();
  2357. realSplitNumber_1 = realSplitNumber_1 == null ? ticksCoords.length - 1 : Math.min(ticksCoords.length - 1, realSplitNumber_1);
  2358. return map(ticksCoords, function(tickCoord) {
  2359. return radar.coordToPoint(tickCoord.coord, idx);
  2360. });
  2361. });
  2362. var prevPoints = [];
  2363. for (var i = 0; i <= realSplitNumber_1; i++) {
  2364. var points3 = [];
  2365. for (var j = 0; j < indicatorAxes.length; j++) {
  2366. points3.push(axesTicksPoints[j][i]);
  2367. }
  2368. if (points3[0]) {
  2369. points3.push(points3[0].slice());
  2370. } else {
  2371. if (true) {
  2372. console.error("Can't draw value axis " + i);
  2373. }
  2374. }
  2375. if (showSplitLine) {
  2376. var colorIndex = getColorIndex(splitLines, splitLineColorsArr, i);
  2377. splitLines[colorIndex].push(new Polyline_default({
  2378. shape: {
  2379. points: points3
  2380. }
  2381. }));
  2382. }
  2383. if (showSplitArea && prevPoints) {
  2384. var colorIndex = getColorIndex(splitAreas, splitAreaColorsArr, i - 1);
  2385. splitAreas[colorIndex].push(new Polygon_default({
  2386. shape: {
  2387. points: points3.concat(prevPoints)
  2388. }
  2389. }));
  2390. }
  2391. prevPoints = points3.slice().reverse();
  2392. }
  2393. }
  2394. var lineStyle = lineStyleModel.getLineStyle();
  2395. var areaStyle = areaStyleModel.getAreaStyle();
  2396. each(splitAreas, function(splitAreas2, idx) {
  2397. this.group.add(mergePath(splitAreas2, {
  2398. style: defaults({
  2399. stroke: "none",
  2400. fill: splitAreaColorsArr[idx % splitAreaColorsArr.length]
  2401. }, areaStyle),
  2402. silent: true
  2403. }));
  2404. }, this);
  2405. each(splitLines, function(splitLines2, idx) {
  2406. this.group.add(mergePath(splitLines2, {
  2407. style: defaults({
  2408. fill: "none",
  2409. stroke: splitLineColorsArr[idx % splitLineColorsArr.length]
  2410. }, lineStyle),
  2411. silent: true
  2412. }));
  2413. }, this);
  2414. };
  2415. RadarView2.type = "radar";
  2416. return RadarView2;
  2417. }(Component_default2)
  2418. );
  2419. var RadarView_default = RadarView;
  2420. // node_modules/echarts/lib/coord/radar/IndicatorAxis.js
  2421. var IndicatorAxis = (
  2422. /** @class */
  2423. function(_super) {
  2424. __extends(IndicatorAxis2, _super);
  2425. function IndicatorAxis2(dim, scale2, radiusExtent) {
  2426. var _this = _super.call(this, dim, scale2, radiusExtent) || this;
  2427. _this.type = "value";
  2428. _this.angle = 0;
  2429. _this.name = "";
  2430. return _this;
  2431. }
  2432. return IndicatorAxis2;
  2433. }(Axis_default)
  2434. );
  2435. var IndicatorAxis_default = IndicatorAxis;
  2436. // node_modules/echarts/lib/coord/radar/Radar.js
  2437. var Radar = (
  2438. /** @class */
  2439. function() {
  2440. function Radar2(radarModel, ecModel, api) {
  2441. this.dimensions = [];
  2442. this._model = radarModel;
  2443. this._indicatorAxes = map(radarModel.getIndicatorModels(), function(indicatorModel, idx) {
  2444. var dim = "indicator_" + idx;
  2445. var indicatorAxis = new IndicatorAxis_default(
  2446. dim,
  2447. new Interval_default()
  2448. // (indicatorModel.get('axisType') === 'log') ? new LogScale() : new IntervalScale()
  2449. );
  2450. indicatorAxis.name = indicatorModel.get("name");
  2451. indicatorAxis.model = indicatorModel;
  2452. indicatorModel.axis = indicatorAxis;
  2453. this.dimensions.push(dim);
  2454. return indicatorAxis;
  2455. }, this);
  2456. this.resize(radarModel, api);
  2457. }
  2458. Radar2.prototype.getIndicatorAxes = function() {
  2459. return this._indicatorAxes;
  2460. };
  2461. Radar2.prototype.dataToPoint = function(value, indicatorIndex) {
  2462. var indicatorAxis = this._indicatorAxes[indicatorIndex];
  2463. return this.coordToPoint(indicatorAxis.dataToCoord(value), indicatorIndex);
  2464. };
  2465. Radar2.prototype.coordToPoint = function(coord, indicatorIndex) {
  2466. var indicatorAxis = this._indicatorAxes[indicatorIndex];
  2467. var angle = indicatorAxis.angle;
  2468. var x = this.cx + coord * Math.cos(angle);
  2469. var y = this.cy - coord * Math.sin(angle);
  2470. return [x, y];
  2471. };
  2472. Radar2.prototype.pointToData = function(pt) {
  2473. var dx = pt[0] - this.cx;
  2474. var dy = pt[1] - this.cy;
  2475. var radius = Math.sqrt(dx * dx + dy * dy);
  2476. dx /= radius;
  2477. dy /= radius;
  2478. var radian = Math.atan2(-dy, dx);
  2479. var minRadianDiff = Infinity;
  2480. var closestAxis;
  2481. var closestAxisIdx = -1;
  2482. for (var i = 0; i < this._indicatorAxes.length; i++) {
  2483. var indicatorAxis = this._indicatorAxes[i];
  2484. var diff = Math.abs(radian - indicatorAxis.angle);
  2485. if (diff < minRadianDiff) {
  2486. closestAxis = indicatorAxis;
  2487. closestAxisIdx = i;
  2488. minRadianDiff = diff;
  2489. }
  2490. }
  2491. return [closestAxisIdx, +(closestAxis && closestAxis.coordToData(radius))];
  2492. };
  2493. Radar2.prototype.resize = function(radarModel, api) {
  2494. var center = radarModel.get("center");
  2495. var viewWidth = api.getWidth();
  2496. var viewHeight = api.getHeight();
  2497. var viewSize = Math.min(viewWidth, viewHeight) / 2;
  2498. this.cx = parsePercent(center[0], viewWidth);
  2499. this.cy = parsePercent(center[1], viewHeight);
  2500. this.startAngle = radarModel.get("startAngle") * Math.PI / 180;
  2501. var radius = radarModel.get("radius");
  2502. if (isString(radius) || isNumber(radius)) {
  2503. radius = [0, radius];
  2504. }
  2505. this.r0 = parsePercent(radius[0], viewSize);
  2506. this.r = parsePercent(radius[1], viewSize);
  2507. each(this._indicatorAxes, function(indicatorAxis, idx) {
  2508. indicatorAxis.setExtent(this.r0, this.r);
  2509. var angle = this.startAngle + idx * Math.PI * 2 / this._indicatorAxes.length;
  2510. angle = Math.atan2(Math.sin(angle), Math.cos(angle));
  2511. indicatorAxis.angle = angle;
  2512. }, this);
  2513. };
  2514. Radar2.prototype.update = function(ecModel, api) {
  2515. var indicatorAxes = this._indicatorAxes;
  2516. var radarModel = this._model;
  2517. each(indicatorAxes, function(indicatorAxis) {
  2518. indicatorAxis.scale.setExtent(Infinity, -Infinity);
  2519. });
  2520. ecModel.eachSeriesByType("radar", function(radarSeries, idx) {
  2521. if (radarSeries.get("coordinateSystem") !== "radar" || ecModel.getComponent("radar", radarSeries.get("radarIndex")) !== radarModel) {
  2522. return;
  2523. }
  2524. var data = radarSeries.getData();
  2525. each(indicatorAxes, function(indicatorAxis) {
  2526. indicatorAxis.scale.unionExtentFromData(data, data.mapDimension(indicatorAxis.dim));
  2527. });
  2528. }, this);
  2529. var splitNumber = radarModel.get("splitNumber");
  2530. var dummyScale = new Interval_default();
  2531. dummyScale.setExtent(0, splitNumber);
  2532. dummyScale.setInterval(1);
  2533. each(indicatorAxes, function(indicatorAxis, idx) {
  2534. alignScaleTicks(indicatorAxis.scale, indicatorAxis.model, dummyScale);
  2535. });
  2536. };
  2537. Radar2.prototype.convertToPixel = function(ecModel, finder, value) {
  2538. console.warn("Not implemented.");
  2539. return null;
  2540. };
  2541. Radar2.prototype.convertFromPixel = function(ecModel, finder, pixel) {
  2542. console.warn("Not implemented.");
  2543. return null;
  2544. };
  2545. Radar2.prototype.containPoint = function(point) {
  2546. console.warn("Not implemented.");
  2547. return false;
  2548. };
  2549. Radar2.create = function(ecModel, api) {
  2550. var radarList = [];
  2551. ecModel.eachComponent("radar", function(radarModel) {
  2552. var radar = new Radar2(radarModel, ecModel, api);
  2553. radarList.push(radar);
  2554. radarModel.coordinateSystem = radar;
  2555. });
  2556. ecModel.eachSeriesByType("radar", function(radarSeries) {
  2557. if (radarSeries.get("coordinateSystem") === "radar") {
  2558. radarSeries.coordinateSystem = radarList[radarSeries.get("radarIndex") || 0];
  2559. }
  2560. });
  2561. return radarList;
  2562. };
  2563. Radar2.dimensions = [];
  2564. return Radar2;
  2565. }()
  2566. );
  2567. var Radar_default = Radar;
  2568. // node_modules/echarts/lib/component/radar/install.js
  2569. function install2(registers) {
  2570. registers.registerCoordinateSystem("radar", Radar_default);
  2571. registers.registerComponentModel(RadarModel_default);
  2572. registers.registerComponentView(RadarView_default);
  2573. registers.registerVisual({
  2574. seriesType: "radar",
  2575. reset: function(seriesModel) {
  2576. var data = seriesModel.getData();
  2577. data.each(function(idx) {
  2578. data.setItemVisual(idx, "legendIcon", "roundRect");
  2579. });
  2580. data.setVisual("legendIcon", "roundRect");
  2581. }
  2582. });
  2583. }
  2584. // node_modules/echarts/lib/coord/View.js
  2585. var v2ApplyTransform = applyTransform;
  2586. var View = (
  2587. /** @class */
  2588. function(_super) {
  2589. __extends(View2, _super);
  2590. function View2(name) {
  2591. var _this = _super.call(this) || this;
  2592. _this.type = "view";
  2593. _this.dimensions = ["x", "y"];
  2594. _this._roamTransformable = new Transformable_default();
  2595. _this._rawTransformable = new Transformable_default();
  2596. _this.name = name;
  2597. return _this;
  2598. }
  2599. View2.prototype.setBoundingRect = function(x, y, width, height) {
  2600. this._rect = new BoundingRect_default(x, y, width, height);
  2601. return this._rect;
  2602. };
  2603. View2.prototype.getBoundingRect = function() {
  2604. return this._rect;
  2605. };
  2606. View2.prototype.setViewRect = function(x, y, width, height) {
  2607. this._transformTo(x, y, width, height);
  2608. this._viewRect = new BoundingRect_default(x, y, width, height);
  2609. };
  2610. View2.prototype._transformTo = function(x, y, width, height) {
  2611. var rect = this.getBoundingRect();
  2612. var rawTransform = this._rawTransformable;
  2613. rawTransform.transform = rect.calculateTransform(new BoundingRect_default(x, y, width, height));
  2614. var rawParent = rawTransform.parent;
  2615. rawTransform.parent = null;
  2616. rawTransform.decomposeTransform();
  2617. rawTransform.parent = rawParent;
  2618. this._updateTransform();
  2619. };
  2620. View2.prototype.setCenter = function(centerCoord, api) {
  2621. if (!centerCoord) {
  2622. return;
  2623. }
  2624. this._center = [parsePercent(centerCoord[0], api.getWidth()), parsePercent(centerCoord[1], api.getHeight())];
  2625. this._updateCenterAndZoom();
  2626. };
  2627. View2.prototype.setZoom = function(zoom) {
  2628. zoom = zoom || 1;
  2629. var zoomLimit = this.zoomLimit;
  2630. if (zoomLimit) {
  2631. if (zoomLimit.max != null) {
  2632. zoom = Math.min(zoomLimit.max, zoom);
  2633. }
  2634. if (zoomLimit.min != null) {
  2635. zoom = Math.max(zoomLimit.min, zoom);
  2636. }
  2637. }
  2638. this._zoom = zoom;
  2639. this._updateCenterAndZoom();
  2640. };
  2641. View2.prototype.getDefaultCenter = function() {
  2642. var rawRect = this.getBoundingRect();
  2643. var cx = rawRect.x + rawRect.width / 2;
  2644. var cy = rawRect.y + rawRect.height / 2;
  2645. return [cx, cy];
  2646. };
  2647. View2.prototype.getCenter = function() {
  2648. return this._center || this.getDefaultCenter();
  2649. };
  2650. View2.prototype.getZoom = function() {
  2651. return this._zoom || 1;
  2652. };
  2653. View2.prototype.getRoamTransform = function() {
  2654. return this._roamTransformable.getLocalTransform();
  2655. };
  2656. View2.prototype._updateCenterAndZoom = function() {
  2657. var rawTransformMatrix = this._rawTransformable.getLocalTransform();
  2658. var roamTransform = this._roamTransformable;
  2659. var defaultCenter = this.getDefaultCenter();
  2660. var center = this.getCenter();
  2661. var zoom = this.getZoom();
  2662. center = applyTransform([], center, rawTransformMatrix);
  2663. defaultCenter = applyTransform([], defaultCenter, rawTransformMatrix);
  2664. roamTransform.originX = center[0];
  2665. roamTransform.originY = center[1];
  2666. roamTransform.x = defaultCenter[0] - center[0];
  2667. roamTransform.y = defaultCenter[1] - center[1];
  2668. roamTransform.scaleX = roamTransform.scaleY = zoom;
  2669. this._updateTransform();
  2670. };
  2671. View2.prototype._updateTransform = function() {
  2672. var roamTransformable = this._roamTransformable;
  2673. var rawTransformable = this._rawTransformable;
  2674. rawTransformable.parent = roamTransformable;
  2675. roamTransformable.updateTransform();
  2676. rawTransformable.updateTransform();
  2677. copy2(this.transform || (this.transform = []), rawTransformable.transform || create());
  2678. this._rawTransform = rawTransformable.getLocalTransform();
  2679. this.invTransform = this.invTransform || [];
  2680. invert(this.invTransform, this.transform);
  2681. this.decomposeTransform();
  2682. };
  2683. View2.prototype.getTransformInfo = function() {
  2684. var rawTransformable = this._rawTransformable;
  2685. var roamTransformable = this._roamTransformable;
  2686. var dummyTransformable = new Transformable_default();
  2687. dummyTransformable.transform = roamTransformable.transform;
  2688. dummyTransformable.decomposeTransform();
  2689. return {
  2690. roam: {
  2691. x: dummyTransformable.x,
  2692. y: dummyTransformable.y,
  2693. scaleX: dummyTransformable.scaleX,
  2694. scaleY: dummyTransformable.scaleY
  2695. },
  2696. raw: {
  2697. x: rawTransformable.x,
  2698. y: rawTransformable.y,
  2699. scaleX: rawTransformable.scaleX,
  2700. scaleY: rawTransformable.scaleY
  2701. }
  2702. };
  2703. };
  2704. View2.prototype.getViewRect = function() {
  2705. return this._viewRect;
  2706. };
  2707. View2.prototype.getViewRectAfterRoam = function() {
  2708. var rect = this.getBoundingRect().clone();
  2709. rect.applyTransform(this.transform);
  2710. return rect;
  2711. };
  2712. View2.prototype.dataToPoint = function(data, noRoam, out) {
  2713. var transform = noRoam ? this._rawTransform : this.transform;
  2714. out = out || [];
  2715. return transform ? v2ApplyTransform(out, data, transform) : copy(out, data);
  2716. };
  2717. View2.prototype.pointToData = function(point) {
  2718. var invTransform = this.invTransform;
  2719. return invTransform ? v2ApplyTransform([], point, invTransform) : [point[0], point[1]];
  2720. };
  2721. View2.prototype.convertToPixel = function(ecModel, finder, value) {
  2722. var coordSys = getCoordSys(finder);
  2723. return coordSys === this ? coordSys.dataToPoint(value) : null;
  2724. };
  2725. View2.prototype.convertFromPixel = function(ecModel, finder, pixel) {
  2726. var coordSys = getCoordSys(finder);
  2727. return coordSys === this ? coordSys.pointToData(pixel) : null;
  2728. };
  2729. View2.prototype.containPoint = function(point) {
  2730. return this.getViewRectAfterRoam().contain(point[0], point[1]);
  2731. };
  2732. View2.dimensions = ["x", "y"];
  2733. return View2;
  2734. }(Transformable_default)
  2735. );
  2736. function getCoordSys(finder) {
  2737. var seriesModel = finder.seriesModel;
  2738. return seriesModel ? seriesModel.coordinateSystem : null;
  2739. }
  2740. var View_default = View;
  2741. // node_modules/zrender/lib/tool/parseXML.js
  2742. function parseXML(svg) {
  2743. if (isString(svg)) {
  2744. var parser = new DOMParser();
  2745. svg = parser.parseFromString(svg, "text/xml");
  2746. }
  2747. var svgNode = svg;
  2748. if (svgNode.nodeType === 9) {
  2749. svgNode = svgNode.firstChild;
  2750. }
  2751. while (svgNode.nodeName.toLowerCase() !== "svg" || svgNode.nodeType !== 1) {
  2752. svgNode = svgNode.nextSibling;
  2753. }
  2754. return svgNode;
  2755. }
  2756. // node_modules/zrender/lib/tool/parseSVG.js
  2757. var nodeParsers;
  2758. var INHERITABLE_STYLE_ATTRIBUTES_MAP = {
  2759. "fill": "fill",
  2760. "stroke": "stroke",
  2761. "stroke-width": "lineWidth",
  2762. "opacity": "opacity",
  2763. "fill-opacity": "fillOpacity",
  2764. "stroke-opacity": "strokeOpacity",
  2765. "stroke-dasharray": "lineDash",
  2766. "stroke-dashoffset": "lineDashOffset",
  2767. "stroke-linecap": "lineCap",
  2768. "stroke-linejoin": "lineJoin",
  2769. "stroke-miterlimit": "miterLimit",
  2770. "font-family": "fontFamily",
  2771. "font-size": "fontSize",
  2772. "font-style": "fontStyle",
  2773. "font-weight": "fontWeight",
  2774. "text-anchor": "textAlign",
  2775. "visibility": "visibility",
  2776. "display": "display"
  2777. };
  2778. var INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS = keys(INHERITABLE_STYLE_ATTRIBUTES_MAP);
  2779. var SELF_STYLE_ATTRIBUTES_MAP = {
  2780. "alignment-baseline": "textBaseline",
  2781. "stop-color": "stopColor"
  2782. };
  2783. var SELF_STYLE_ATTRIBUTES_MAP_KEYS = keys(SELF_STYLE_ATTRIBUTES_MAP);
  2784. var SVGParser = function() {
  2785. function SVGParser2() {
  2786. this._defs = {};
  2787. this._root = null;
  2788. }
  2789. SVGParser2.prototype.parse = function(xml, opt) {
  2790. opt = opt || {};
  2791. var svg = parseXML(xml);
  2792. if (true) {
  2793. if (!svg) {
  2794. throw new Error("Illegal svg");
  2795. }
  2796. }
  2797. this._defsUsePending = [];
  2798. var root = new Group_default();
  2799. this._root = root;
  2800. var named = [];
  2801. var viewBox = svg.getAttribute("viewBox") || "";
  2802. var width = parseFloat(svg.getAttribute("width") || opt.width);
  2803. var height = parseFloat(svg.getAttribute("height") || opt.height);
  2804. isNaN(width) && (width = null);
  2805. isNaN(height) && (height = null);
  2806. parseAttributes(svg, root, null, true, false);
  2807. var child = svg.firstChild;
  2808. while (child) {
  2809. this._parseNode(child, root, named, null, false, false);
  2810. child = child.nextSibling;
  2811. }
  2812. applyDefs(this._defs, this._defsUsePending);
  2813. this._defsUsePending = [];
  2814. var viewBoxRect;
  2815. var viewBoxTransform;
  2816. if (viewBox) {
  2817. var viewBoxArr = splitNumberSequence(viewBox);
  2818. if (viewBoxArr.length >= 4) {
  2819. viewBoxRect = {
  2820. x: parseFloat(viewBoxArr[0] || 0),
  2821. y: parseFloat(viewBoxArr[1] || 0),
  2822. width: parseFloat(viewBoxArr[2]),
  2823. height: parseFloat(viewBoxArr[3])
  2824. };
  2825. }
  2826. }
  2827. if (viewBoxRect && width != null && height != null) {
  2828. viewBoxTransform = makeViewBoxTransform(viewBoxRect, { x: 0, y: 0, width, height });
  2829. if (!opt.ignoreViewBox) {
  2830. var elRoot = root;
  2831. root = new Group_default();
  2832. root.add(elRoot);
  2833. elRoot.scaleX = elRoot.scaleY = viewBoxTransform.scale;
  2834. elRoot.x = viewBoxTransform.x;
  2835. elRoot.y = viewBoxTransform.y;
  2836. }
  2837. }
  2838. if (!opt.ignoreRootClip && width != null && height != null) {
  2839. root.setClipPath(new Rect_default({
  2840. shape: { x: 0, y: 0, width, height }
  2841. }));
  2842. }
  2843. return {
  2844. root,
  2845. width,
  2846. height,
  2847. viewBoxRect,
  2848. viewBoxTransform,
  2849. named
  2850. };
  2851. };
  2852. SVGParser2.prototype._parseNode = function(xmlNode, parentGroup, named, namedFrom, isInDefs, isInText) {
  2853. var nodeName = xmlNode.nodeName.toLowerCase();
  2854. var el;
  2855. var namedFromForSub = namedFrom;
  2856. if (nodeName === "defs") {
  2857. isInDefs = true;
  2858. }
  2859. if (nodeName === "text") {
  2860. isInText = true;
  2861. }
  2862. if (nodeName === "defs" || nodeName === "switch") {
  2863. el = parentGroup;
  2864. } else {
  2865. if (!isInDefs) {
  2866. var parser_1 = nodeParsers[nodeName];
  2867. if (parser_1 && hasOwn(nodeParsers, nodeName)) {
  2868. el = parser_1.call(this, xmlNode, parentGroup);
  2869. var nameAttr = xmlNode.getAttribute("name");
  2870. if (nameAttr) {
  2871. var newNamed = {
  2872. name: nameAttr,
  2873. namedFrom: null,
  2874. svgNodeTagLower: nodeName,
  2875. el
  2876. };
  2877. named.push(newNamed);
  2878. if (nodeName === "g") {
  2879. namedFromForSub = newNamed;
  2880. }
  2881. } else if (namedFrom) {
  2882. named.push({
  2883. name: namedFrom.name,
  2884. namedFrom,
  2885. svgNodeTagLower: nodeName,
  2886. el
  2887. });
  2888. }
  2889. parentGroup.add(el);
  2890. }
  2891. }
  2892. var parser = paintServerParsers[nodeName];
  2893. if (parser && hasOwn(paintServerParsers, nodeName)) {
  2894. var def = parser.call(this, xmlNode);
  2895. var id = xmlNode.getAttribute("id");
  2896. if (id) {
  2897. this._defs[id] = def;
  2898. }
  2899. }
  2900. }
  2901. if (el && el.isGroup) {
  2902. var child = xmlNode.firstChild;
  2903. while (child) {
  2904. if (child.nodeType === 1) {
  2905. this._parseNode(child, el, named, namedFromForSub, isInDefs, isInText);
  2906. } else if (child.nodeType === 3 && isInText) {
  2907. this._parseText(child, el);
  2908. }
  2909. child = child.nextSibling;
  2910. }
  2911. }
  2912. };
  2913. SVGParser2.prototype._parseText = function(xmlNode, parentGroup) {
  2914. var text = new TSpan_default({
  2915. style: {
  2916. text: xmlNode.textContent
  2917. },
  2918. silent: true,
  2919. x: this._textX || 0,
  2920. y: this._textY || 0
  2921. });
  2922. inheritStyle(parentGroup, text);
  2923. parseAttributes(xmlNode, text, this._defsUsePending, false, false);
  2924. applyTextAlignment(text, parentGroup);
  2925. var textStyle = text.style;
  2926. var fontSize = textStyle.fontSize;
  2927. if (fontSize && fontSize < 9) {
  2928. textStyle.fontSize = 9;
  2929. text.scaleX *= fontSize / 9;
  2930. text.scaleY *= fontSize / 9;
  2931. }
  2932. var font = (textStyle.fontSize || textStyle.fontFamily) && [
  2933. textStyle.fontStyle,
  2934. textStyle.fontWeight,
  2935. (textStyle.fontSize || 12) + "px",
  2936. textStyle.fontFamily || "sans-serif"
  2937. ].join(" ");
  2938. textStyle.font = font;
  2939. var rect = text.getBoundingRect();
  2940. this._textX += rect.width;
  2941. parentGroup.add(text);
  2942. return text;
  2943. };
  2944. SVGParser2.internalField = function() {
  2945. nodeParsers = {
  2946. "g": function(xmlNode, parentGroup) {
  2947. var g = new Group_default();
  2948. inheritStyle(parentGroup, g);
  2949. parseAttributes(xmlNode, g, this._defsUsePending, false, false);
  2950. return g;
  2951. },
  2952. "rect": function(xmlNode, parentGroup) {
  2953. var rect = new Rect_default();
  2954. inheritStyle(parentGroup, rect);
  2955. parseAttributes(xmlNode, rect, this._defsUsePending, false, false);
  2956. rect.setShape({
  2957. x: parseFloat(xmlNode.getAttribute("x") || "0"),
  2958. y: parseFloat(xmlNode.getAttribute("y") || "0"),
  2959. width: parseFloat(xmlNode.getAttribute("width") || "0"),
  2960. height: parseFloat(xmlNode.getAttribute("height") || "0")
  2961. });
  2962. rect.silent = true;
  2963. return rect;
  2964. },
  2965. "circle": function(xmlNode, parentGroup) {
  2966. var circle = new Circle_default();
  2967. inheritStyle(parentGroup, circle);
  2968. parseAttributes(xmlNode, circle, this._defsUsePending, false, false);
  2969. circle.setShape({
  2970. cx: parseFloat(xmlNode.getAttribute("cx") || "0"),
  2971. cy: parseFloat(xmlNode.getAttribute("cy") || "0"),
  2972. r: parseFloat(xmlNode.getAttribute("r") || "0")
  2973. });
  2974. circle.silent = true;
  2975. return circle;
  2976. },
  2977. "line": function(xmlNode, parentGroup) {
  2978. var line = new Line_default();
  2979. inheritStyle(parentGroup, line);
  2980. parseAttributes(xmlNode, line, this._defsUsePending, false, false);
  2981. line.setShape({
  2982. x1: parseFloat(xmlNode.getAttribute("x1") || "0"),
  2983. y1: parseFloat(xmlNode.getAttribute("y1") || "0"),
  2984. x2: parseFloat(xmlNode.getAttribute("x2") || "0"),
  2985. y2: parseFloat(xmlNode.getAttribute("y2") || "0")
  2986. });
  2987. line.silent = true;
  2988. return line;
  2989. },
  2990. "ellipse": function(xmlNode, parentGroup) {
  2991. var ellipse = new Ellipse_default();
  2992. inheritStyle(parentGroup, ellipse);
  2993. parseAttributes(xmlNode, ellipse, this._defsUsePending, false, false);
  2994. ellipse.setShape({
  2995. cx: parseFloat(xmlNode.getAttribute("cx") || "0"),
  2996. cy: parseFloat(xmlNode.getAttribute("cy") || "0"),
  2997. rx: parseFloat(xmlNode.getAttribute("rx") || "0"),
  2998. ry: parseFloat(xmlNode.getAttribute("ry") || "0")
  2999. });
  3000. ellipse.silent = true;
  3001. return ellipse;
  3002. },
  3003. "polygon": function(xmlNode, parentGroup) {
  3004. var pointsStr = xmlNode.getAttribute("points");
  3005. var pointsArr;
  3006. if (pointsStr) {
  3007. pointsArr = parsePoints(pointsStr);
  3008. }
  3009. var polygon = new Polygon_default({
  3010. shape: {
  3011. points: pointsArr || []
  3012. },
  3013. silent: true
  3014. });
  3015. inheritStyle(parentGroup, polygon);
  3016. parseAttributes(xmlNode, polygon, this._defsUsePending, false, false);
  3017. return polygon;
  3018. },
  3019. "polyline": function(xmlNode, parentGroup) {
  3020. var pointsStr = xmlNode.getAttribute("points");
  3021. var pointsArr;
  3022. if (pointsStr) {
  3023. pointsArr = parsePoints(pointsStr);
  3024. }
  3025. var polyline = new Polyline_default({
  3026. shape: {
  3027. points: pointsArr || []
  3028. },
  3029. silent: true
  3030. });
  3031. inheritStyle(parentGroup, polyline);
  3032. parseAttributes(xmlNode, polyline, this._defsUsePending, false, false);
  3033. return polyline;
  3034. },
  3035. "image": function(xmlNode, parentGroup) {
  3036. var img = new Image_default();
  3037. inheritStyle(parentGroup, img);
  3038. parseAttributes(xmlNode, img, this._defsUsePending, false, false);
  3039. img.setStyle({
  3040. image: xmlNode.getAttribute("xlink:href") || xmlNode.getAttribute("href"),
  3041. x: +xmlNode.getAttribute("x"),
  3042. y: +xmlNode.getAttribute("y"),
  3043. width: +xmlNode.getAttribute("width"),
  3044. height: +xmlNode.getAttribute("height")
  3045. });
  3046. img.silent = true;
  3047. return img;
  3048. },
  3049. "text": function(xmlNode, parentGroup) {
  3050. var x = xmlNode.getAttribute("x") || "0";
  3051. var y = xmlNode.getAttribute("y") || "0";
  3052. var dx = xmlNode.getAttribute("dx") || "0";
  3053. var dy = xmlNode.getAttribute("dy") || "0";
  3054. this._textX = parseFloat(x) + parseFloat(dx);
  3055. this._textY = parseFloat(y) + parseFloat(dy);
  3056. var g = new Group_default();
  3057. inheritStyle(parentGroup, g);
  3058. parseAttributes(xmlNode, g, this._defsUsePending, false, true);
  3059. return g;
  3060. },
  3061. "tspan": function(xmlNode, parentGroup) {
  3062. var x = xmlNode.getAttribute("x");
  3063. var y = xmlNode.getAttribute("y");
  3064. if (x != null) {
  3065. this._textX = parseFloat(x);
  3066. }
  3067. if (y != null) {
  3068. this._textY = parseFloat(y);
  3069. }
  3070. var dx = xmlNode.getAttribute("dx") || "0";
  3071. var dy = xmlNode.getAttribute("dy") || "0";
  3072. var g = new Group_default();
  3073. inheritStyle(parentGroup, g);
  3074. parseAttributes(xmlNode, g, this._defsUsePending, false, true);
  3075. this._textX += parseFloat(dx);
  3076. this._textY += parseFloat(dy);
  3077. return g;
  3078. },
  3079. "path": function(xmlNode, parentGroup) {
  3080. var d = xmlNode.getAttribute("d") || "";
  3081. var path = createFromString(d);
  3082. inheritStyle(parentGroup, path);
  3083. parseAttributes(xmlNode, path, this._defsUsePending, false, false);
  3084. path.silent = true;
  3085. return path;
  3086. }
  3087. };
  3088. }();
  3089. return SVGParser2;
  3090. }();
  3091. var paintServerParsers = {
  3092. "lineargradient": function(xmlNode) {
  3093. var x1 = parseInt(xmlNode.getAttribute("x1") || "0", 10);
  3094. var y1 = parseInt(xmlNode.getAttribute("y1") || "0", 10);
  3095. var x2 = parseInt(xmlNode.getAttribute("x2") || "10", 10);
  3096. var y2 = parseInt(xmlNode.getAttribute("y2") || "0", 10);
  3097. var gradient = new LinearGradient_default(x1, y1, x2, y2);
  3098. parsePaintServerUnit(xmlNode, gradient);
  3099. parseGradientColorStops(xmlNode, gradient);
  3100. return gradient;
  3101. },
  3102. "radialgradient": function(xmlNode) {
  3103. var cx = parseInt(xmlNode.getAttribute("cx") || "0", 10);
  3104. var cy = parseInt(xmlNode.getAttribute("cy") || "0", 10);
  3105. var r = parseInt(xmlNode.getAttribute("r") || "0", 10);
  3106. var gradient = new RadialGradient_default(cx, cy, r);
  3107. parsePaintServerUnit(xmlNode, gradient);
  3108. parseGradientColorStops(xmlNode, gradient);
  3109. return gradient;
  3110. }
  3111. };
  3112. function parsePaintServerUnit(xmlNode, gradient) {
  3113. var gradientUnits = xmlNode.getAttribute("gradientUnits");
  3114. if (gradientUnits === "userSpaceOnUse") {
  3115. gradient.global = true;
  3116. }
  3117. }
  3118. function parseGradientColorStops(xmlNode, gradient) {
  3119. var stop2 = xmlNode.firstChild;
  3120. while (stop2) {
  3121. if (stop2.nodeType === 1 && stop2.nodeName.toLocaleLowerCase() === "stop") {
  3122. var offsetStr = stop2.getAttribute("offset");
  3123. var offset = void 0;
  3124. if (offsetStr && offsetStr.indexOf("%") > 0) {
  3125. offset = parseInt(offsetStr, 10) / 100;
  3126. } else if (offsetStr) {
  3127. offset = parseFloat(offsetStr);
  3128. } else {
  3129. offset = 0;
  3130. }
  3131. var styleVals = {};
  3132. parseInlineStyle(stop2, styleVals, styleVals);
  3133. var stopColor = styleVals.stopColor || stop2.getAttribute("stop-color") || "#000000";
  3134. gradient.colorStops.push({
  3135. offset,
  3136. color: stopColor
  3137. });
  3138. }
  3139. stop2 = stop2.nextSibling;
  3140. }
  3141. }
  3142. function inheritStyle(parent, child) {
  3143. if (parent && parent.__inheritedStyle) {
  3144. if (!child.__inheritedStyle) {
  3145. child.__inheritedStyle = {};
  3146. }
  3147. defaults(child.__inheritedStyle, parent.__inheritedStyle);
  3148. }
  3149. }
  3150. function parsePoints(pointsString) {
  3151. var list = splitNumberSequence(pointsString);
  3152. var points3 = [];
  3153. for (var i = 0; i < list.length; i += 2) {
  3154. var x = parseFloat(list[i]);
  3155. var y = parseFloat(list[i + 1]);
  3156. points3.push([x, y]);
  3157. }
  3158. return points3;
  3159. }
  3160. function parseAttributes(xmlNode, el, defsUsePending, onlyInlineStyle, isTextGroup) {
  3161. var disp = el;
  3162. var inheritedStyle = disp.__inheritedStyle = disp.__inheritedStyle || {};
  3163. var selfStyle = {};
  3164. if (xmlNode.nodeType === 1) {
  3165. parseTransformAttribute(xmlNode, el);
  3166. parseInlineStyle(xmlNode, inheritedStyle, selfStyle);
  3167. if (!onlyInlineStyle) {
  3168. parseAttributeStyle(xmlNode, inheritedStyle, selfStyle);
  3169. }
  3170. }
  3171. disp.style = disp.style || {};
  3172. if (inheritedStyle.fill != null) {
  3173. disp.style.fill = getFillStrokeStyle(disp, "fill", inheritedStyle.fill, defsUsePending);
  3174. }
  3175. if (inheritedStyle.stroke != null) {
  3176. disp.style.stroke = getFillStrokeStyle(disp, "stroke", inheritedStyle.stroke, defsUsePending);
  3177. }
  3178. each([
  3179. "lineWidth",
  3180. "opacity",
  3181. "fillOpacity",
  3182. "strokeOpacity",
  3183. "miterLimit",
  3184. "fontSize"
  3185. ], function(propName) {
  3186. if (inheritedStyle[propName] != null) {
  3187. disp.style[propName] = parseFloat(inheritedStyle[propName]);
  3188. }
  3189. });
  3190. each([
  3191. "lineDashOffset",
  3192. "lineCap",
  3193. "lineJoin",
  3194. "fontWeight",
  3195. "fontFamily",
  3196. "fontStyle",
  3197. "textAlign"
  3198. ], function(propName) {
  3199. if (inheritedStyle[propName] != null) {
  3200. disp.style[propName] = inheritedStyle[propName];
  3201. }
  3202. });
  3203. if (isTextGroup) {
  3204. disp.__selfStyle = selfStyle;
  3205. }
  3206. if (inheritedStyle.lineDash) {
  3207. disp.style.lineDash = map(splitNumberSequence(inheritedStyle.lineDash), function(str) {
  3208. return parseFloat(str);
  3209. });
  3210. }
  3211. if (inheritedStyle.visibility === "hidden" || inheritedStyle.visibility === "collapse") {
  3212. disp.invisible = true;
  3213. }
  3214. if (inheritedStyle.display === "none") {
  3215. disp.ignore = true;
  3216. }
  3217. }
  3218. function applyTextAlignment(text, parentGroup) {
  3219. var parentSelfStyle = parentGroup.__selfStyle;
  3220. if (parentSelfStyle) {
  3221. var textBaseline = parentSelfStyle.textBaseline;
  3222. var zrTextBaseline = textBaseline;
  3223. if (!textBaseline || textBaseline === "auto") {
  3224. zrTextBaseline = "alphabetic";
  3225. } else if (textBaseline === "baseline") {
  3226. zrTextBaseline = "alphabetic";
  3227. } else if (textBaseline === "before-edge" || textBaseline === "text-before-edge") {
  3228. zrTextBaseline = "top";
  3229. } else if (textBaseline === "after-edge" || textBaseline === "text-after-edge") {
  3230. zrTextBaseline = "bottom";
  3231. } else if (textBaseline === "central" || textBaseline === "mathematical") {
  3232. zrTextBaseline = "middle";
  3233. }
  3234. text.style.textBaseline = zrTextBaseline;
  3235. }
  3236. var parentInheritedStyle = parentGroup.__inheritedStyle;
  3237. if (parentInheritedStyle) {
  3238. var textAlign = parentInheritedStyle.textAlign;
  3239. var zrTextAlign = textAlign;
  3240. if (textAlign) {
  3241. if (textAlign === "middle") {
  3242. zrTextAlign = "center";
  3243. }
  3244. text.style.textAlign = zrTextAlign;
  3245. }
  3246. }
  3247. }
  3248. var urlRegex = /^url\(\s*#(.*?)\)/;
  3249. function getFillStrokeStyle(el, method, str, defsUsePending) {
  3250. var urlMatch = str && str.match(urlRegex);
  3251. if (urlMatch) {
  3252. var url = trim(urlMatch[1]);
  3253. defsUsePending.push([el, method, url]);
  3254. return;
  3255. }
  3256. if (str === "none") {
  3257. str = null;
  3258. }
  3259. return str;
  3260. }
  3261. function applyDefs(defs, defsUsePending) {
  3262. for (var i = 0; i < defsUsePending.length; i++) {
  3263. var item = defsUsePending[i];
  3264. item[0].style[item[1]] = defs[item[2]];
  3265. }
  3266. }
  3267. var numberReg = /-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;
  3268. function splitNumberSequence(rawStr) {
  3269. return rawStr.match(numberReg) || [];
  3270. }
  3271. var transformRegex = /(translate|scale|rotate|skewX|skewY|matrix)\(([\-\s0-9\.eE,]*)\)/g;
  3272. var DEGREE_TO_ANGLE = Math.PI / 180;
  3273. function parseTransformAttribute(xmlNode, node) {
  3274. var transform = xmlNode.getAttribute("transform");
  3275. if (transform) {
  3276. transform = transform.replace(/,/g, " ");
  3277. var transformOps_1 = [];
  3278. var mt = null;
  3279. transform.replace(transformRegex, function(str, type2, value2) {
  3280. transformOps_1.push(type2, value2);
  3281. return "";
  3282. });
  3283. for (var i = transformOps_1.length - 1; i > 0; i -= 2) {
  3284. var value = transformOps_1[i];
  3285. var type = transformOps_1[i - 1];
  3286. var valueArr = splitNumberSequence(value);
  3287. mt = mt || create();
  3288. switch (type) {
  3289. case "translate":
  3290. translate(mt, mt, [parseFloat(valueArr[0]), parseFloat(valueArr[1] || "0")]);
  3291. break;
  3292. case "scale":
  3293. scale(mt, mt, [parseFloat(valueArr[0]), parseFloat(valueArr[1] || valueArr[0])]);
  3294. break;
  3295. case "rotate":
  3296. rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE, [
  3297. parseFloat(valueArr[1] || "0"),
  3298. parseFloat(valueArr[2] || "0")
  3299. ]);
  3300. break;
  3301. case "skewX":
  3302. var sx = Math.tan(parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);
  3303. mul(mt, [1, 0, sx, 1, 0, 0], mt);
  3304. break;
  3305. case "skewY":
  3306. var sy = Math.tan(parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);
  3307. mul(mt, [1, sy, 0, 1, 0, 0], mt);
  3308. break;
  3309. case "matrix":
  3310. mt[0] = parseFloat(valueArr[0]);
  3311. mt[1] = parseFloat(valueArr[1]);
  3312. mt[2] = parseFloat(valueArr[2]);
  3313. mt[3] = parseFloat(valueArr[3]);
  3314. mt[4] = parseFloat(valueArr[4]);
  3315. mt[5] = parseFloat(valueArr[5]);
  3316. break;
  3317. }
  3318. }
  3319. node.setLocalTransform(mt);
  3320. }
  3321. }
  3322. var styleRegex = /([^\s:;]+)\s*:\s*([^:;]+)/g;
  3323. function parseInlineStyle(xmlNode, inheritableStyleResult, selfStyleResult) {
  3324. var style = xmlNode.getAttribute("style");
  3325. if (!style) {
  3326. return;
  3327. }
  3328. styleRegex.lastIndex = 0;
  3329. var styleRegResult;
  3330. while ((styleRegResult = styleRegex.exec(style)) != null) {
  3331. var svgStlAttr = styleRegResult[1];
  3332. var zrInheritableStlAttr = hasOwn(INHERITABLE_STYLE_ATTRIBUTES_MAP, svgStlAttr) ? INHERITABLE_STYLE_ATTRIBUTES_MAP[svgStlAttr] : null;
  3333. if (zrInheritableStlAttr) {
  3334. inheritableStyleResult[zrInheritableStlAttr] = styleRegResult[2];
  3335. }
  3336. var zrSelfStlAttr = hasOwn(SELF_STYLE_ATTRIBUTES_MAP, svgStlAttr) ? SELF_STYLE_ATTRIBUTES_MAP[svgStlAttr] : null;
  3337. if (zrSelfStlAttr) {
  3338. selfStyleResult[zrSelfStlAttr] = styleRegResult[2];
  3339. }
  3340. }
  3341. }
  3342. function parseAttributeStyle(xmlNode, inheritableStyleResult, selfStyleResult) {
  3343. for (var i = 0; i < INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS.length; i++) {
  3344. var svgAttrName = INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS[i];
  3345. var attrValue = xmlNode.getAttribute(svgAttrName);
  3346. if (attrValue != null) {
  3347. inheritableStyleResult[INHERITABLE_STYLE_ATTRIBUTES_MAP[svgAttrName]] = attrValue;
  3348. }
  3349. }
  3350. for (var i = 0; i < SELF_STYLE_ATTRIBUTES_MAP_KEYS.length; i++) {
  3351. var svgAttrName = SELF_STYLE_ATTRIBUTES_MAP_KEYS[i];
  3352. var attrValue = xmlNode.getAttribute(svgAttrName);
  3353. if (attrValue != null) {
  3354. selfStyleResult[SELF_STYLE_ATTRIBUTES_MAP[svgAttrName]] = attrValue;
  3355. }
  3356. }
  3357. }
  3358. function makeViewBoxTransform(viewBoxRect, boundingRect) {
  3359. var scaleX = boundingRect.width / viewBoxRect.width;
  3360. var scaleY = boundingRect.height / viewBoxRect.height;
  3361. var scale2 = Math.min(scaleX, scaleY);
  3362. return {
  3363. scale: scale2,
  3364. x: -(viewBoxRect.x + viewBoxRect.width / 2) * scale2 + (boundingRect.x + boundingRect.width / 2),
  3365. y: -(viewBoxRect.y + viewBoxRect.height / 2) * scale2 + (boundingRect.y + boundingRect.height / 2)
  3366. };
  3367. }
  3368. function parseSVG(xml, opt) {
  3369. var parser = new SVGParser();
  3370. return parser.parse(xml, opt);
  3371. }
  3372. // node_modules/echarts/lib/coord/geo/GeoSVGResource.js
  3373. var REGION_AVAILABLE_SVG_TAG_MAP = createHashMap([
  3374. "rect",
  3375. "circle",
  3376. "line",
  3377. "ellipse",
  3378. "polygon",
  3379. "polyline",
  3380. "path",
  3381. // <text> <tspan> are also enabled because some SVG might paint text itself,
  3382. // but still need to trigger events or tooltip.
  3383. "text",
  3384. "tspan",
  3385. // <g> is also enabled because this case: if multiple tags share one name
  3386. // and need label displayed, every tags will display the name, which is not
  3387. // expected. So we can put them into a <g name="xxx">. Thereby only one label
  3388. // displayed and located based on the bounding rect of the <g>.
  3389. "g"
  3390. ]);
  3391. var GeoSVGResource = (
  3392. /** @class */
  3393. function() {
  3394. function GeoSVGResource2(mapName, svg) {
  3395. this.type = "geoSVG";
  3396. this._usedGraphicMap = createHashMap();
  3397. this._freedGraphics = [];
  3398. this._mapName = mapName;
  3399. this._parsedXML = parseXML(svg);
  3400. }
  3401. GeoSVGResource2.prototype.load = function() {
  3402. var firstGraphic = this._firstGraphic;
  3403. if (!firstGraphic) {
  3404. firstGraphic = this._firstGraphic = this._buildGraphic(this._parsedXML);
  3405. this._freedGraphics.push(firstGraphic);
  3406. this._boundingRect = this._firstGraphic.boundingRect.clone();
  3407. var _a = createRegions(firstGraphic.named), regions = _a.regions, regionsMap = _a.regionsMap;
  3408. this._regions = regions;
  3409. this._regionsMap = regionsMap;
  3410. }
  3411. return {
  3412. boundingRect: this._boundingRect,
  3413. regions: this._regions,
  3414. regionsMap: this._regionsMap
  3415. };
  3416. };
  3417. GeoSVGResource2.prototype._buildGraphic = function(svgXML) {
  3418. var result;
  3419. var rootFromParse;
  3420. try {
  3421. result = svgXML && parseSVG(svgXML, {
  3422. ignoreViewBox: true,
  3423. ignoreRootClip: true
  3424. }) || {};
  3425. rootFromParse = result.root;
  3426. assert(rootFromParse != null);
  3427. } catch (e) {
  3428. throw new Error("Invalid svg format\n" + e.message);
  3429. }
  3430. var root = new Group_default();
  3431. root.add(rootFromParse);
  3432. root.isGeoSVGGraphicRoot = true;
  3433. var svgWidth = result.width;
  3434. var svgHeight = result.height;
  3435. var viewBoxRect = result.viewBoxRect;
  3436. var boundingRect = this._boundingRect;
  3437. if (!boundingRect) {
  3438. var bRectX = void 0;
  3439. var bRectY = void 0;
  3440. var bRectWidth = void 0;
  3441. var bRectHeight = void 0;
  3442. if (svgWidth != null) {
  3443. bRectX = 0;
  3444. bRectWidth = svgWidth;
  3445. } else if (viewBoxRect) {
  3446. bRectX = viewBoxRect.x;
  3447. bRectWidth = viewBoxRect.width;
  3448. }
  3449. if (svgHeight != null) {
  3450. bRectY = 0;
  3451. bRectHeight = svgHeight;
  3452. } else if (viewBoxRect) {
  3453. bRectY = viewBoxRect.y;
  3454. bRectHeight = viewBoxRect.height;
  3455. }
  3456. if (bRectX == null || bRectY == null) {
  3457. var calculatedBoundingRect = rootFromParse.getBoundingRect();
  3458. if (bRectX == null) {
  3459. bRectX = calculatedBoundingRect.x;
  3460. bRectWidth = calculatedBoundingRect.width;
  3461. }
  3462. if (bRectY == null) {
  3463. bRectY = calculatedBoundingRect.y;
  3464. bRectHeight = calculatedBoundingRect.height;
  3465. }
  3466. }
  3467. boundingRect = this._boundingRect = new BoundingRect_default(bRectX, bRectY, bRectWidth, bRectHeight);
  3468. }
  3469. if (viewBoxRect) {
  3470. var viewBoxTransform = makeViewBoxTransform(viewBoxRect, boundingRect);
  3471. rootFromParse.scaleX = rootFromParse.scaleY = viewBoxTransform.scale;
  3472. rootFromParse.x = viewBoxTransform.x;
  3473. rootFromParse.y = viewBoxTransform.y;
  3474. }
  3475. root.setClipPath(new Rect_default({
  3476. shape: boundingRect.plain()
  3477. }));
  3478. var named = [];
  3479. each(result.named, function(namedItem) {
  3480. if (REGION_AVAILABLE_SVG_TAG_MAP.get(namedItem.svgNodeTagLower) != null) {
  3481. named.push(namedItem);
  3482. setSilent(namedItem.el);
  3483. }
  3484. });
  3485. return {
  3486. root,
  3487. boundingRect,
  3488. named
  3489. };
  3490. };
  3491. GeoSVGResource2.prototype.useGraphic = function(hostKey) {
  3492. var usedRootMap = this._usedGraphicMap;
  3493. var svgGraphic = usedRootMap.get(hostKey);
  3494. if (svgGraphic) {
  3495. return svgGraphic;
  3496. }
  3497. svgGraphic = this._freedGraphics.pop() || this._buildGraphic(this._parsedXML);
  3498. usedRootMap.set(hostKey, svgGraphic);
  3499. return svgGraphic;
  3500. };
  3501. GeoSVGResource2.prototype.freeGraphic = function(hostKey) {
  3502. var usedRootMap = this._usedGraphicMap;
  3503. var svgGraphic = usedRootMap.get(hostKey);
  3504. if (svgGraphic) {
  3505. usedRootMap.removeKey(hostKey);
  3506. this._freedGraphics.push(svgGraphic);
  3507. }
  3508. };
  3509. return GeoSVGResource2;
  3510. }()
  3511. );
  3512. function setSilent(el) {
  3513. el.silent = false;
  3514. if (el.isGroup) {
  3515. el.traverse(function(child) {
  3516. child.silent = false;
  3517. });
  3518. }
  3519. }
  3520. function createRegions(named) {
  3521. var regions = [];
  3522. var regionsMap = createHashMap();
  3523. each(named, function(namedItem) {
  3524. if (namedItem.namedFrom != null) {
  3525. return;
  3526. }
  3527. var region = new GeoSVGRegion(namedItem.name, namedItem.el);
  3528. regions.push(region);
  3529. regionsMap.set(namedItem.name, region);
  3530. });
  3531. return {
  3532. regions,
  3533. regionsMap
  3534. };
  3535. }
  3536. // node_modules/echarts/lib/coord/geo/fix/nanhai.js
  3537. var geoCoord = [126, 25];
  3538. var nanhaiName = "南海诸岛";
  3539. var points = [[[0, 3.5], [7, 11.2], [15, 11.9], [30, 7], [42, 0.7], [52, 0.7], [56, 7.7], [59, 0.7], [64, 0.7], [64, 0], [5, 0], [0, 3.5]], [[13, 16.1], [19, 14.7], [16, 21.7], [11, 23.1], [13, 16.1]], [[12, 32.2], [14, 38.5], [15, 38.5], [13, 32.2], [12, 32.2]], [[16, 47.6], [12, 53.2], [13, 53.2], [18, 47.6], [16, 47.6]], [[6, 64.4], [8, 70], [9, 70], [8, 64.4], [6, 64.4]], [[23, 82.6], [29, 79.8], [30, 79.8], [25, 82.6], [23, 82.6]], [[37, 70.7], [43, 62.3], [44, 62.3], [39, 70.7], [37, 70.7]], [[48, 51.1], [51, 45.5], [53, 45.5], [50, 51.1], [48, 51.1]], [[51, 35], [51, 28.7], [53, 28.7], [53, 35], [51, 35]], [[52, 22.4], [55, 17.5], [56, 17.5], [53, 22.4], [52, 22.4]], [[58, 12.6], [62, 7], [63, 7], [60, 12.6], [58, 12.6]], [[0, 3.5], [0, 93.1], [64, 93.1], [64, 0], [63, 0], [63, 92.4], [1, 92.4], [1, 3.5], [0, 3.5]]];
  3540. for (i = 0; i < points.length; i++) {
  3541. for (k = 0; k < points[i].length; k++) {
  3542. points[i][k][0] /= 10.5;
  3543. points[i][k][1] /= -10.5 / 0.75;
  3544. points[i][k][0] += geoCoord[0];
  3545. points[i][k][1] += geoCoord[1];
  3546. }
  3547. }
  3548. var k;
  3549. var i;
  3550. function fixNanhai(mapType, regions) {
  3551. if (mapType === "china") {
  3552. for (var i = 0; i < regions.length; i++) {
  3553. if (regions[i].name === nanhaiName) {
  3554. return;
  3555. }
  3556. }
  3557. regions.push(new GeoJSONRegion(nanhaiName, map(points, function(exterior) {
  3558. return {
  3559. type: "polygon",
  3560. exterior
  3561. };
  3562. }), geoCoord));
  3563. }
  3564. }
  3565. // node_modules/echarts/lib/coord/geo/fix/textCoord.js
  3566. var coordsOffsetMap = {
  3567. "南海诸岛": [32, 80],
  3568. // 全国
  3569. "广东": [0, -10],
  3570. "香港": [10, 5],
  3571. "澳门": [-10, 10],
  3572. // '北京': [-10, 0],
  3573. "天津": [5, 5]
  3574. };
  3575. function fixTextCoords(mapType, region) {
  3576. if (mapType === "china") {
  3577. var coordFix = coordsOffsetMap[region.name];
  3578. if (coordFix) {
  3579. var cp = region.getCenter();
  3580. cp[0] += coordFix[0] / 10.5;
  3581. cp[1] += -coordFix[1] / (10.5 / 0.75);
  3582. region.setCenter(cp);
  3583. }
  3584. }
  3585. }
  3586. // node_modules/echarts/lib/coord/geo/fix/diaoyuIsland.js
  3587. var points2 = [[[123.45165252685547, 25.73527164402261], [123.49731445312499, 25.73527164402261], [123.49731445312499, 25.750734064600884], [123.45165252685547, 25.750734064600884], [123.45165252685547, 25.73527164402261]]];
  3588. function fixDiaoyuIsland(mapType, region) {
  3589. if (mapType === "china" && region.name === "台湾") {
  3590. region.geometries.push({
  3591. type: "polygon",
  3592. exterior: points2[0]
  3593. });
  3594. }
  3595. }
  3596. // node_modules/echarts/lib/coord/geo/GeoJSONResource.js
  3597. var DEFAULT_NAME_PROPERTY = "name";
  3598. var GeoJSONResource = (
  3599. /** @class */
  3600. function() {
  3601. function GeoJSONResource2(mapName, geoJSON, specialAreas) {
  3602. this.type = "geoJSON";
  3603. this._parsedMap = createHashMap();
  3604. this._mapName = mapName;
  3605. this._specialAreas = specialAreas;
  3606. this._geoJSON = parseInput(geoJSON);
  3607. }
  3608. GeoJSONResource2.prototype.load = function(nameMap, nameProperty) {
  3609. nameProperty = nameProperty || DEFAULT_NAME_PROPERTY;
  3610. var parsed = this._parsedMap.get(nameProperty);
  3611. if (!parsed) {
  3612. var rawRegions = this._parseToRegions(nameProperty);
  3613. parsed = this._parsedMap.set(nameProperty, {
  3614. regions: rawRegions,
  3615. boundingRect: calculateBoundingRect(rawRegions)
  3616. });
  3617. }
  3618. var regionsMap = createHashMap();
  3619. var finalRegions = [];
  3620. each(parsed.regions, function(region) {
  3621. var regionName = region.name;
  3622. if (nameMap && hasOwn(nameMap, regionName)) {
  3623. region = region.cloneShallow(regionName = nameMap[regionName]);
  3624. }
  3625. finalRegions.push(region);
  3626. regionsMap.set(regionName, region);
  3627. });
  3628. return {
  3629. regions: finalRegions,
  3630. boundingRect: parsed.boundingRect || new BoundingRect_default(0, 0, 0, 0),
  3631. regionsMap
  3632. };
  3633. };
  3634. GeoJSONResource2.prototype._parseToRegions = function(nameProperty) {
  3635. var mapName = this._mapName;
  3636. var geoJSON = this._geoJSON;
  3637. var rawRegions;
  3638. try {
  3639. rawRegions = geoJSON ? parseGeoJSON(geoJSON, nameProperty) : [];
  3640. } catch (e) {
  3641. throw new Error("Invalid geoJson format\n" + e.message);
  3642. }
  3643. fixNanhai(mapName, rawRegions);
  3644. each(rawRegions, function(region) {
  3645. var regionName = region.name;
  3646. fixTextCoords(mapName, region);
  3647. fixDiaoyuIsland(mapName, region);
  3648. var specialArea = this._specialAreas && this._specialAreas[regionName];
  3649. if (specialArea) {
  3650. region.transformTo(specialArea.left, specialArea.top, specialArea.width, specialArea.height);
  3651. }
  3652. }, this);
  3653. return rawRegions;
  3654. };
  3655. GeoJSONResource2.prototype.getMapForUser = function() {
  3656. return {
  3657. // For backward compatibility, use geoJson
  3658. // PENDING: it has been returning them without clone.
  3659. // do we need to avoid outsite modification?
  3660. geoJson: this._geoJSON,
  3661. geoJSON: this._geoJSON,
  3662. specialAreas: this._specialAreas
  3663. };
  3664. };
  3665. return GeoJSONResource2;
  3666. }()
  3667. );
  3668. function calculateBoundingRect(regions) {
  3669. var rect;
  3670. for (var i = 0; i < regions.length; i++) {
  3671. var regionRect = regions[i].getBoundingRect();
  3672. rect = rect || regionRect.clone();
  3673. rect.union(regionRect);
  3674. }
  3675. return rect;
  3676. }
  3677. function parseInput(source) {
  3678. return !isString(source) ? source : typeof JSON !== "undefined" && JSON.parse ? JSON.parse(source) : new Function("return (" + source + ");")();
  3679. }
  3680. // node_modules/echarts/lib/coord/geo/geoSourceManager.js
  3681. var storage = createHashMap();
  3682. var geoSourceManager_default = {
  3683. /**
  3684. * Compatible with previous `echarts.registerMap`.
  3685. *
  3686. * @usage
  3687. * ```js
  3688. *
  3689. * echarts.registerMap('USA', geoJson, specialAreas);
  3690. *
  3691. * echarts.registerMap('USA', {
  3692. * geoJson: geoJson,
  3693. * specialAreas: {...}
  3694. * });
  3695. * echarts.registerMap('USA', {
  3696. * geoJSON: geoJson,
  3697. * specialAreas: {...}
  3698. * });
  3699. *
  3700. * echarts.registerMap('airport', {
  3701. * svg: svg
  3702. * }
  3703. * ```
  3704. *
  3705. * Note:
  3706. * Do not support that register multiple geoJSON or SVG
  3707. * one map name. Because different geoJSON and SVG have
  3708. * different unit. It's not easy to make sure how those
  3709. * units are mapping/normalize.
  3710. * If intending to use multiple geoJSON or SVG, we can
  3711. * use multiple geo coordinate system.
  3712. */
  3713. registerMap: function(mapName, rawDef, rawSpecialAreas) {
  3714. if (rawDef.svg) {
  3715. var resource = new GeoSVGResource(mapName, rawDef.svg);
  3716. storage.set(mapName, resource);
  3717. } else {
  3718. var geoJSON = rawDef.geoJson || rawDef.geoJSON;
  3719. if (geoJSON && !rawDef.features) {
  3720. rawSpecialAreas = rawDef.specialAreas;
  3721. } else {
  3722. geoJSON = rawDef;
  3723. }
  3724. var resource = new GeoJSONResource(mapName, geoJSON, rawSpecialAreas);
  3725. storage.set(mapName, resource);
  3726. }
  3727. },
  3728. getGeoResource: function(mapName) {
  3729. return storage.get(mapName);
  3730. },
  3731. /**
  3732. * Only for exporting to users.
  3733. * **MUST NOT** used internally.
  3734. */
  3735. getMapForUser: function(mapName) {
  3736. var resource = storage.get(mapName);
  3737. return resource && resource.type === "geoJSON" && resource.getMapForUser();
  3738. },
  3739. load: function(mapName, nameMap, nameProperty) {
  3740. var resource = storage.get(mapName);
  3741. if (!resource) {
  3742. if (true) {
  3743. console.error("Map " + mapName + " not exists. The GeoJSON of the map must be provided.");
  3744. }
  3745. return;
  3746. }
  3747. return resource.load(nameMap, nameProperty);
  3748. }
  3749. };
  3750. // node_modules/echarts/lib/coord/geo/Geo.js
  3751. var GEO_DEFAULT_PARAMS = {
  3752. "geoJSON": {
  3753. aspectScale: 0.75,
  3754. invertLongitute: true
  3755. },
  3756. "geoSVG": {
  3757. aspectScale: 1,
  3758. invertLongitute: false
  3759. }
  3760. };
  3761. var geo2DDimensions = ["lng", "lat"];
  3762. var Geo = (
  3763. /** @class */
  3764. function(_super) {
  3765. __extends(Geo2, _super);
  3766. function Geo2(name, map2, opt) {
  3767. var _this = _super.call(this, name) || this;
  3768. _this.dimensions = geo2DDimensions;
  3769. _this.type = "geo";
  3770. _this._nameCoordMap = createHashMap();
  3771. _this.map = map2;
  3772. var projection = opt.projection;
  3773. var source = geoSourceManager_default.load(map2, opt.nameMap, opt.nameProperty);
  3774. var resource = geoSourceManager_default.getGeoResource(map2);
  3775. var resourceType = _this.resourceType = resource ? resource.type : null;
  3776. var regions = _this.regions = source.regions;
  3777. var defaultParams = GEO_DEFAULT_PARAMS[resource.type];
  3778. _this._regionsMap = source.regionsMap;
  3779. _this.regions = source.regions;
  3780. if (projection) {
  3781. if (resourceType === "geoSVG") {
  3782. if (true) {
  3783. warn("Map " + map2 + " with SVG source can't use projection. Only GeoJSON source supports projection.");
  3784. }
  3785. projection = null;
  3786. }
  3787. if (!(projection.project && projection.unproject)) {
  3788. if (true) {
  3789. warn("project and unproject must be both provided in the projeciton.");
  3790. }
  3791. projection = null;
  3792. }
  3793. }
  3794. _this.projection = projection;
  3795. var boundingRect;
  3796. if (projection) {
  3797. for (var i = 0; i < regions.length; i++) {
  3798. var regionRect = regions[i].getBoundingRect(projection);
  3799. boundingRect = boundingRect || regionRect.clone();
  3800. boundingRect.union(regionRect);
  3801. }
  3802. } else {
  3803. boundingRect = source.boundingRect;
  3804. }
  3805. _this.setBoundingRect(boundingRect.x, boundingRect.y, boundingRect.width, boundingRect.height);
  3806. _this.aspectScale = projection ? 1 : retrieve2(opt.aspectScale, defaultParams.aspectScale);
  3807. _this._invertLongitute = projection ? false : defaultParams.invertLongitute;
  3808. return _this;
  3809. }
  3810. Geo2.prototype._transformTo = function(x, y, width, height) {
  3811. var rect = this.getBoundingRect();
  3812. var invertLongitute = this._invertLongitute;
  3813. rect = rect.clone();
  3814. if (invertLongitute) {
  3815. rect.y = -rect.y - rect.height;
  3816. }
  3817. var rawTransformable = this._rawTransformable;
  3818. rawTransformable.transform = rect.calculateTransform(new BoundingRect_default(x, y, width, height));
  3819. var rawParent = rawTransformable.parent;
  3820. rawTransformable.parent = null;
  3821. rawTransformable.decomposeTransform();
  3822. rawTransformable.parent = rawParent;
  3823. if (invertLongitute) {
  3824. rawTransformable.scaleY = -rawTransformable.scaleY;
  3825. }
  3826. this._updateTransform();
  3827. };
  3828. Geo2.prototype.getRegion = function(name) {
  3829. return this._regionsMap.get(name);
  3830. };
  3831. Geo2.prototype.getRegionByCoord = function(coord) {
  3832. var regions = this.regions;
  3833. for (var i = 0; i < regions.length; i++) {
  3834. var region = regions[i];
  3835. if (region.type === "geoJSON" && region.contain(coord)) {
  3836. return regions[i];
  3837. }
  3838. }
  3839. };
  3840. Geo2.prototype.addGeoCoord = function(name, geoCoord2) {
  3841. this._nameCoordMap.set(name, geoCoord2);
  3842. };
  3843. Geo2.prototype.getGeoCoord = function(name) {
  3844. var region = this._regionsMap.get(name);
  3845. return this._nameCoordMap.get(name) || region && region.getCenter();
  3846. };
  3847. Geo2.prototype.dataToPoint = function(data, noRoam, out) {
  3848. if (isString(data)) {
  3849. data = this.getGeoCoord(data);
  3850. }
  3851. if (data) {
  3852. var projection = this.projection;
  3853. if (projection) {
  3854. data = projection.project(data);
  3855. }
  3856. return data && this.projectedToPoint(data, noRoam, out);
  3857. }
  3858. };
  3859. Geo2.prototype.pointToData = function(point) {
  3860. var projection = this.projection;
  3861. if (projection) {
  3862. point = projection.unproject(point);
  3863. }
  3864. return point && this.pointToProjected(point);
  3865. };
  3866. Geo2.prototype.pointToProjected = function(point) {
  3867. return _super.prototype.pointToData.call(this, point);
  3868. };
  3869. Geo2.prototype.projectedToPoint = function(projected, noRoam, out) {
  3870. return _super.prototype.dataToPoint.call(this, projected, noRoam, out);
  3871. };
  3872. Geo2.prototype.convertToPixel = function(ecModel, finder, value) {
  3873. var coordSys = getCoordSys2(finder);
  3874. return coordSys === this ? coordSys.dataToPoint(value) : null;
  3875. };
  3876. Geo2.prototype.convertFromPixel = function(ecModel, finder, pixel) {
  3877. var coordSys = getCoordSys2(finder);
  3878. return coordSys === this ? coordSys.pointToData(pixel) : null;
  3879. };
  3880. return Geo2;
  3881. }(View_default)
  3882. );
  3883. mixin(Geo, View_default);
  3884. function getCoordSys2(finder) {
  3885. var geoModel = finder.geoModel;
  3886. var seriesModel = finder.seriesModel;
  3887. return geoModel ? geoModel.coordinateSystem : seriesModel ? seriesModel.coordinateSystem || (seriesModel.getReferringComponents("geo", SINGLE_REFERRING).models[0] || {}).coordinateSystem : null;
  3888. }
  3889. var Geo_default = Geo;
  3890. // node_modules/echarts/lib/coord/geo/geoCreator.js
  3891. function resizeGeo(geoModel, api) {
  3892. var boundingCoords = geoModel.get("boundingCoords");
  3893. if (boundingCoords != null) {
  3894. var leftTop_1 = boundingCoords[0];
  3895. var rightBottom_1 = boundingCoords[1];
  3896. if (!(isFinite(leftTop_1[0]) && isFinite(leftTop_1[1]) && isFinite(rightBottom_1[0]) && isFinite(rightBottom_1[1]))) {
  3897. if (true) {
  3898. console.error("Invalid boundingCoords");
  3899. }
  3900. } else {
  3901. var projection_1 = this.projection;
  3902. if (projection_1) {
  3903. var xMin = leftTop_1[0];
  3904. var yMin = leftTop_1[1];
  3905. var xMax = rightBottom_1[0];
  3906. var yMax = rightBottom_1[1];
  3907. leftTop_1 = [Infinity, Infinity];
  3908. rightBottom_1 = [-Infinity, -Infinity];
  3909. var sampleLine = function(x0, y0, x1, y1) {
  3910. var dx = x1 - x0;
  3911. var dy = y1 - y0;
  3912. for (var i = 0; i <= 100; i++) {
  3913. var p = i / 100;
  3914. var pt = projection_1.project([x0 + dx * p, y0 + dy * p]);
  3915. min(leftTop_1, leftTop_1, pt);
  3916. max(rightBottom_1, rightBottom_1, pt);
  3917. }
  3918. };
  3919. sampleLine(xMin, yMin, xMax, yMin);
  3920. sampleLine(xMax, yMin, xMax, yMax);
  3921. sampleLine(xMax, yMax, xMin, yMax);
  3922. sampleLine(xMin, yMax, xMax, yMin);
  3923. }
  3924. this.setBoundingRect(leftTop_1[0], leftTop_1[1], rightBottom_1[0] - leftTop_1[0], rightBottom_1[1] - leftTop_1[1]);
  3925. }
  3926. }
  3927. var rect = this.getBoundingRect();
  3928. var centerOption = geoModel.get("layoutCenter");
  3929. var sizeOption = geoModel.get("layoutSize");
  3930. var viewWidth = api.getWidth();
  3931. var viewHeight = api.getHeight();
  3932. var aspect = rect.width / rect.height * this.aspectScale;
  3933. var useCenterAndSize = false;
  3934. var center;
  3935. var size;
  3936. if (centerOption && sizeOption) {
  3937. center = [parsePercent(centerOption[0], viewWidth), parsePercent(centerOption[1], viewHeight)];
  3938. size = parsePercent(sizeOption, Math.min(viewWidth, viewHeight));
  3939. if (!isNaN(center[0]) && !isNaN(center[1]) && !isNaN(size)) {
  3940. useCenterAndSize = true;
  3941. } else {
  3942. if (true) {
  3943. console.warn("Given layoutCenter or layoutSize data are invalid. Use left/top/width/height instead.");
  3944. }
  3945. }
  3946. }
  3947. var viewRect;
  3948. if (useCenterAndSize) {
  3949. viewRect = {};
  3950. if (aspect > 1) {
  3951. viewRect.width = size;
  3952. viewRect.height = size / aspect;
  3953. } else {
  3954. viewRect.height = size;
  3955. viewRect.width = size * aspect;
  3956. }
  3957. viewRect.y = center[1] - viewRect.height / 2;
  3958. viewRect.x = center[0] - viewRect.width / 2;
  3959. } else {
  3960. var boxLayoutOption = geoModel.getBoxLayoutParams();
  3961. boxLayoutOption.aspect = aspect;
  3962. viewRect = getLayoutRect(boxLayoutOption, {
  3963. width: viewWidth,
  3964. height: viewHeight
  3965. });
  3966. }
  3967. this.setViewRect(viewRect.x, viewRect.y, viewRect.width, viewRect.height);
  3968. this.setCenter(geoModel.get("center"), api);
  3969. this.setZoom(geoModel.get("zoom"));
  3970. }
  3971. function setGeoCoords(geo, model) {
  3972. each(model.get("geoCoord"), function(geoCoord2, name) {
  3973. geo.addGeoCoord(name, geoCoord2);
  3974. });
  3975. }
  3976. var GeoCreator = (
  3977. /** @class */
  3978. function() {
  3979. function GeoCreator2() {
  3980. this.dimensions = geo2DDimensions;
  3981. }
  3982. GeoCreator2.prototype.create = function(ecModel, api) {
  3983. var geoList = [];
  3984. function getCommonGeoProperties(model) {
  3985. return {
  3986. nameProperty: model.get("nameProperty"),
  3987. aspectScale: model.get("aspectScale"),
  3988. projection: model.get("projection")
  3989. };
  3990. }
  3991. ecModel.eachComponent("geo", function(geoModel, idx) {
  3992. var mapName = geoModel.get("map");
  3993. var geo = new Geo_default(mapName + idx, mapName, extend({
  3994. nameMap: geoModel.get("nameMap")
  3995. }, getCommonGeoProperties(geoModel)));
  3996. geo.zoomLimit = geoModel.get("scaleLimit");
  3997. geoList.push(geo);
  3998. geoModel.coordinateSystem = geo;
  3999. geo.model = geoModel;
  4000. geo.resize = resizeGeo;
  4001. geo.resize(geoModel, api);
  4002. });
  4003. ecModel.eachSeries(function(seriesModel) {
  4004. var coordSys = seriesModel.get("coordinateSystem");
  4005. if (coordSys === "geo") {
  4006. var geoIndex = seriesModel.get("geoIndex") || 0;
  4007. seriesModel.coordinateSystem = geoList[geoIndex];
  4008. }
  4009. });
  4010. var mapModelGroupBySeries = {};
  4011. ecModel.eachSeriesByType("map", function(seriesModel) {
  4012. if (!seriesModel.getHostGeoModel()) {
  4013. var mapType = seriesModel.getMapType();
  4014. mapModelGroupBySeries[mapType] = mapModelGroupBySeries[mapType] || [];
  4015. mapModelGroupBySeries[mapType].push(seriesModel);
  4016. }
  4017. });
  4018. each(mapModelGroupBySeries, function(mapSeries, mapType) {
  4019. var nameMapList = map(mapSeries, function(singleMapSeries) {
  4020. return singleMapSeries.get("nameMap");
  4021. });
  4022. var geo = new Geo_default(mapType, mapType, extend({
  4023. nameMap: mergeAll(nameMapList)
  4024. }, getCommonGeoProperties(mapSeries[0])));
  4025. geo.zoomLimit = retrieve.apply(null, map(mapSeries, function(singleMapSeries) {
  4026. return singleMapSeries.get("scaleLimit");
  4027. }));
  4028. geoList.push(geo);
  4029. geo.resize = resizeGeo;
  4030. geo.resize(mapSeries[0], api);
  4031. each(mapSeries, function(singleMapSeries) {
  4032. singleMapSeries.coordinateSystem = geo;
  4033. setGeoCoords(geo, singleMapSeries);
  4034. });
  4035. });
  4036. return geoList;
  4037. };
  4038. GeoCreator2.prototype.getFilledRegions = function(originRegionArr, mapName, nameMap, nameProperty) {
  4039. var regionsArr = (originRegionArr || []).slice();
  4040. var dataNameMap = createHashMap();
  4041. for (var i = 0; i < regionsArr.length; i++) {
  4042. dataNameMap.set(regionsArr[i].name, regionsArr[i]);
  4043. }
  4044. var source = geoSourceManager_default.load(mapName, nameMap, nameProperty);
  4045. each(source.regions, function(region) {
  4046. var name = region.name;
  4047. !dataNameMap.get(name) && regionsArr.push({
  4048. name
  4049. });
  4050. });
  4051. return regionsArr;
  4052. };
  4053. return GeoCreator2;
  4054. }()
  4055. );
  4056. var geoCreator = new GeoCreator();
  4057. var geoCreator_default = geoCreator;
  4058. // node_modules/echarts/lib/coord/geo/GeoModel.js
  4059. var GeoModel = (
  4060. /** @class */
  4061. function(_super) {
  4062. __extends(GeoModel2, _super);
  4063. function GeoModel2() {
  4064. var _this = _super !== null && _super.apply(this, arguments) || this;
  4065. _this.type = GeoModel2.type;
  4066. return _this;
  4067. }
  4068. GeoModel2.prototype.init = function(option, parentModel, ecModel) {
  4069. var source = geoSourceManager_default.getGeoResource(option.map);
  4070. if (source && source.type === "geoJSON") {
  4071. var itemStyle = option.itemStyle = option.itemStyle || {};
  4072. if (!("color" in itemStyle)) {
  4073. itemStyle.color = "#eee";
  4074. }
  4075. }
  4076. this.mergeDefaultAndTheme(option, ecModel);
  4077. defaultEmphasis(option, "label", ["show"]);
  4078. };
  4079. GeoModel2.prototype.optionUpdated = function() {
  4080. var _this = this;
  4081. var option = this.option;
  4082. option.regions = geoCreator_default.getFilledRegions(option.regions, option.map, option.nameMap, option.nameProperty);
  4083. var selectedMap = {};
  4084. this._optionModelMap = reduce(option.regions || [], function(optionModelMap, regionOpt) {
  4085. var regionName = regionOpt.name;
  4086. if (regionName) {
  4087. optionModelMap.set(regionName, new Model_default(regionOpt, _this, _this.ecModel));
  4088. if (regionOpt.selected) {
  4089. selectedMap[regionName] = true;
  4090. }
  4091. }
  4092. return optionModelMap;
  4093. }, createHashMap());
  4094. if (!option.selectedMap) {
  4095. option.selectedMap = selectedMap;
  4096. }
  4097. };
  4098. GeoModel2.prototype.getRegionModel = function(name) {
  4099. return this._optionModelMap.get(name) || new Model_default(null, this, this.ecModel);
  4100. };
  4101. GeoModel2.prototype.getFormattedLabel = function(name, status) {
  4102. var regionModel = this.getRegionModel(name);
  4103. var formatter = status === "normal" ? regionModel.get(["label", "formatter"]) : regionModel.get(["emphasis", "label", "formatter"]);
  4104. var params = {
  4105. name
  4106. };
  4107. if (isFunction(formatter)) {
  4108. params.status = status;
  4109. return formatter(params);
  4110. } else if (isString(formatter)) {
  4111. return formatter.replace("{a}", name != null ? name : "");
  4112. }
  4113. };
  4114. GeoModel2.prototype.setZoom = function(zoom) {
  4115. this.option.zoom = zoom;
  4116. };
  4117. GeoModel2.prototype.setCenter = function(center) {
  4118. this.option.center = center;
  4119. };
  4120. GeoModel2.prototype.select = function(name) {
  4121. var option = this.option;
  4122. var selectedMode = option.selectedMode;
  4123. if (!selectedMode) {
  4124. return;
  4125. }
  4126. if (selectedMode !== "multiple") {
  4127. option.selectedMap = null;
  4128. }
  4129. var selectedMap = option.selectedMap || (option.selectedMap = {});
  4130. selectedMap[name] = true;
  4131. };
  4132. GeoModel2.prototype.unSelect = function(name) {
  4133. var selectedMap = this.option.selectedMap;
  4134. if (selectedMap) {
  4135. selectedMap[name] = false;
  4136. }
  4137. };
  4138. GeoModel2.prototype.toggleSelected = function(name) {
  4139. this[this.isSelected(name) ? "unSelect" : "select"](name);
  4140. };
  4141. GeoModel2.prototype.isSelected = function(name) {
  4142. var selectedMap = this.option.selectedMap;
  4143. return !!(selectedMap && selectedMap[name]);
  4144. };
  4145. GeoModel2.type = "geo";
  4146. GeoModel2.layoutMode = "box";
  4147. GeoModel2.defaultOption = {
  4148. // zlevel: 0,
  4149. z: 0,
  4150. show: true,
  4151. left: "center",
  4152. top: "center",
  4153. // Default value:
  4154. // for geoSVG source: 1,
  4155. // for geoJSON source: 0.75.
  4156. aspectScale: null,
  4157. // /// Layout with center and size
  4158. // If you want to put map in a fixed size box with right aspect ratio
  4159. // This two properties may be more convenient
  4160. // layoutCenter: [50%, 50%]
  4161. // layoutSize: 100
  4162. silent: false,
  4163. // Map type
  4164. map: "",
  4165. // Define left-top, right-bottom coords to control view
  4166. // For example, [ [180, 90], [-180, -90] ]
  4167. boundingCoords: null,
  4168. // Default on center of map
  4169. center: null,
  4170. zoom: 1,
  4171. scaleLimit: null,
  4172. // selectedMode: false
  4173. label: {
  4174. show: false,
  4175. color: "#000"
  4176. },
  4177. itemStyle: {
  4178. borderWidth: 0.5,
  4179. borderColor: "#444"
  4180. // Default color:
  4181. // + geoJSON: #eee
  4182. // + geoSVG: null (use SVG original `fill`)
  4183. // color: '#eee'
  4184. },
  4185. emphasis: {
  4186. label: {
  4187. show: true,
  4188. color: "rgb(100,0,0)"
  4189. },
  4190. itemStyle: {
  4191. color: "rgba(255,215,0,0.8)"
  4192. }
  4193. },
  4194. select: {
  4195. label: {
  4196. show: true,
  4197. color: "rgb(100,0,0)"
  4198. },
  4199. itemStyle: {
  4200. color: "rgba(255,215,0,0.8)"
  4201. }
  4202. },
  4203. regions: []
  4204. // tooltip: {
  4205. // show: false
  4206. // }
  4207. };
  4208. return GeoModel2;
  4209. }(Component_default)
  4210. );
  4211. var GeoModel_default = GeoModel;
  4212. // node_modules/echarts/lib/action/roamHelper.js
  4213. function getCenterCoord(view, point) {
  4214. return view.pointToProjected ? view.pointToProjected(point) : view.pointToData(point);
  4215. }
  4216. function updateCenterAndZoom(view, payload, zoomLimit, api) {
  4217. var previousZoom = view.getZoom();
  4218. var center = view.getCenter();
  4219. var zoom = payload.zoom;
  4220. var point = view.projectedToPoint ? view.projectedToPoint(center) : view.dataToPoint(center);
  4221. if (payload.dx != null && payload.dy != null) {
  4222. point[0] -= payload.dx;
  4223. point[1] -= payload.dy;
  4224. view.setCenter(getCenterCoord(view, point), api);
  4225. }
  4226. if (zoom != null) {
  4227. if (zoomLimit) {
  4228. var zoomMin = zoomLimit.min || 0;
  4229. var zoomMax = zoomLimit.max || Infinity;
  4230. zoom = Math.max(Math.min(previousZoom * zoom, zoomMax), zoomMin) / previousZoom;
  4231. }
  4232. view.scaleX *= zoom;
  4233. view.scaleY *= zoom;
  4234. var fixX = (payload.originX - view.x) * (zoom - 1);
  4235. var fixY = (payload.originY - view.y) * (zoom - 1);
  4236. view.x -= fixX;
  4237. view.y -= fixY;
  4238. view.updateTransform();
  4239. view.setCenter(getCenterCoord(view, point), api);
  4240. view.setZoom(zoom * previousZoom);
  4241. }
  4242. return {
  4243. center: view.getCenter(),
  4244. zoom: view.getZoom()
  4245. };
  4246. }
  4247. // node_modules/echarts/lib/component/helper/interactionMutex.js
  4248. var ATTR = "\0_ec_interaction_mutex";
  4249. function take(zr, resourceKey, userKey) {
  4250. var store = getStore(zr);
  4251. store[resourceKey] = userKey;
  4252. }
  4253. function release(zr, resourceKey, userKey) {
  4254. var store = getStore(zr);
  4255. var uKey = store[resourceKey];
  4256. if (uKey === userKey) {
  4257. store[resourceKey] = null;
  4258. }
  4259. }
  4260. function isTaken(zr, resourceKey) {
  4261. return !!getStore(zr)[resourceKey];
  4262. }
  4263. function getStore(zr) {
  4264. return zr[ATTR] || (zr[ATTR] = {});
  4265. }
  4266. registerAction({
  4267. type: "takeGlobalCursor",
  4268. event: "globalCursorTaken",
  4269. update: "update"
  4270. }, noop);
  4271. // node_modules/echarts/lib/component/helper/RoamController.js
  4272. var RoamController = (
  4273. /** @class */
  4274. function(_super) {
  4275. __extends(RoamController2, _super);
  4276. function RoamController2(zr) {
  4277. var _this = _super.call(this) || this;
  4278. _this._zr = zr;
  4279. var mousedownHandler = bind(_this._mousedownHandler, _this);
  4280. var mousemoveHandler = bind(_this._mousemoveHandler, _this);
  4281. var mouseupHandler = bind(_this._mouseupHandler, _this);
  4282. var mousewheelHandler = bind(_this._mousewheelHandler, _this);
  4283. var pinchHandler = bind(_this._pinchHandler, _this);
  4284. _this.enable = function(controlType, opt) {
  4285. this.disable();
  4286. this._opt = defaults(clone(opt) || {}, {
  4287. zoomOnMouseWheel: true,
  4288. moveOnMouseMove: true,
  4289. // By default, wheel do not trigger move.
  4290. moveOnMouseWheel: false,
  4291. preventDefaultMouseMove: true
  4292. });
  4293. if (controlType == null) {
  4294. controlType = true;
  4295. }
  4296. if (controlType === true || controlType === "move" || controlType === "pan") {
  4297. zr.on("mousedown", mousedownHandler);
  4298. zr.on("mousemove", mousemoveHandler);
  4299. zr.on("mouseup", mouseupHandler);
  4300. }
  4301. if (controlType === true || controlType === "scale" || controlType === "zoom") {
  4302. zr.on("mousewheel", mousewheelHandler);
  4303. zr.on("pinch", pinchHandler);
  4304. }
  4305. };
  4306. _this.disable = function() {
  4307. zr.off("mousedown", mousedownHandler);
  4308. zr.off("mousemove", mousemoveHandler);
  4309. zr.off("mouseup", mouseupHandler);
  4310. zr.off("mousewheel", mousewheelHandler);
  4311. zr.off("pinch", pinchHandler);
  4312. };
  4313. return _this;
  4314. }
  4315. RoamController2.prototype.isDragging = function() {
  4316. return this._dragging;
  4317. };
  4318. RoamController2.prototype.isPinching = function() {
  4319. return this._pinching;
  4320. };
  4321. RoamController2.prototype.setPointerChecker = function(pointerChecker) {
  4322. this.pointerChecker = pointerChecker;
  4323. };
  4324. RoamController2.prototype.dispose = function() {
  4325. this.disable();
  4326. };
  4327. RoamController2.prototype._mousedownHandler = function(e) {
  4328. if (isMiddleOrRightButtonOnMouseUpDown(e)) {
  4329. return;
  4330. }
  4331. var el = e.target;
  4332. while (el) {
  4333. if (el.draggable) {
  4334. return;
  4335. }
  4336. el = el.__hostTarget || el.parent;
  4337. }
  4338. var x = e.offsetX;
  4339. var y = e.offsetY;
  4340. if (this.pointerChecker && this.pointerChecker(e, x, y)) {
  4341. this._x = x;
  4342. this._y = y;
  4343. this._dragging = true;
  4344. }
  4345. };
  4346. RoamController2.prototype._mousemoveHandler = function(e) {
  4347. if (!this._dragging || !isAvailableBehavior("moveOnMouseMove", e, this._opt) || e.gestureEvent === "pinch" || isTaken(this._zr, "globalPan")) {
  4348. return;
  4349. }
  4350. var x = e.offsetX;
  4351. var y = e.offsetY;
  4352. var oldX = this._x;
  4353. var oldY = this._y;
  4354. var dx = x - oldX;
  4355. var dy = y - oldY;
  4356. this._x = x;
  4357. this._y = y;
  4358. this._opt.preventDefaultMouseMove && stop(e.event);
  4359. trigger(this, "pan", "moveOnMouseMove", e, {
  4360. dx,
  4361. dy,
  4362. oldX,
  4363. oldY,
  4364. newX: x,
  4365. newY: y,
  4366. isAvailableBehavior: null
  4367. });
  4368. };
  4369. RoamController2.prototype._mouseupHandler = function(e) {
  4370. if (!isMiddleOrRightButtonOnMouseUpDown(e)) {
  4371. this._dragging = false;
  4372. }
  4373. };
  4374. RoamController2.prototype._mousewheelHandler = function(e) {
  4375. var shouldZoom = isAvailableBehavior("zoomOnMouseWheel", e, this._opt);
  4376. var shouldMove = isAvailableBehavior("moveOnMouseWheel", e, this._opt);
  4377. var wheelDelta = e.wheelDelta;
  4378. var absWheelDeltaDelta = Math.abs(wheelDelta);
  4379. var originX = e.offsetX;
  4380. var originY = e.offsetY;
  4381. if (wheelDelta === 0 || !shouldZoom && !shouldMove) {
  4382. return;
  4383. }
  4384. if (shouldZoom) {
  4385. var factor = absWheelDeltaDelta > 3 ? 1.4 : absWheelDeltaDelta > 1 ? 1.2 : 1.1;
  4386. var scale2 = wheelDelta > 0 ? factor : 1 / factor;
  4387. checkPointerAndTrigger(this, "zoom", "zoomOnMouseWheel", e, {
  4388. scale: scale2,
  4389. originX,
  4390. originY,
  4391. isAvailableBehavior: null
  4392. });
  4393. }
  4394. if (shouldMove) {
  4395. var absDelta = Math.abs(wheelDelta);
  4396. var scrollDelta = (wheelDelta > 0 ? 1 : -1) * (absDelta > 3 ? 0.4 : absDelta > 1 ? 0.15 : 0.05);
  4397. checkPointerAndTrigger(this, "scrollMove", "moveOnMouseWheel", e, {
  4398. scrollDelta,
  4399. originX,
  4400. originY,
  4401. isAvailableBehavior: null
  4402. });
  4403. }
  4404. };
  4405. RoamController2.prototype._pinchHandler = function(e) {
  4406. if (isTaken(this._zr, "globalPan")) {
  4407. return;
  4408. }
  4409. var scale2 = e.pinchScale > 1 ? 1.1 : 1 / 1.1;
  4410. checkPointerAndTrigger(this, "zoom", null, e, {
  4411. scale: scale2,
  4412. originX: e.pinchX,
  4413. originY: e.pinchY,
  4414. isAvailableBehavior: null
  4415. });
  4416. };
  4417. return RoamController2;
  4418. }(Eventful_default)
  4419. );
  4420. function checkPointerAndTrigger(controller, eventName, behaviorToCheck, e, contollerEvent) {
  4421. if (controller.pointerChecker && controller.pointerChecker(e, contollerEvent.originX, contollerEvent.originY)) {
  4422. stop(e.event);
  4423. trigger(controller, eventName, behaviorToCheck, e, contollerEvent);
  4424. }
  4425. }
  4426. function trigger(controller, eventName, behaviorToCheck, e, contollerEvent) {
  4427. contollerEvent.isAvailableBehavior = bind(isAvailableBehavior, null, behaviorToCheck, e);
  4428. controller.trigger(eventName, contollerEvent);
  4429. }
  4430. function isAvailableBehavior(behaviorToCheck, e, settings) {
  4431. var setting = settings[behaviorToCheck];
  4432. return !behaviorToCheck || setting && (!isString(setting) || e.event[setting + "Key"]);
  4433. }
  4434. var RoamController_default = RoamController;
  4435. // node_modules/echarts/lib/component/helper/roamHelper.js
  4436. function updateViewOnPan(controllerHost, dx, dy) {
  4437. var target = controllerHost.target;
  4438. target.x += dx;
  4439. target.y += dy;
  4440. target.dirty();
  4441. }
  4442. function updateViewOnZoom(controllerHost, zoomDelta, zoomX, zoomY) {
  4443. var target = controllerHost.target;
  4444. var zoomLimit = controllerHost.zoomLimit;
  4445. var newZoom = controllerHost.zoom = controllerHost.zoom || 1;
  4446. newZoom *= zoomDelta;
  4447. if (zoomLimit) {
  4448. var zoomMin = zoomLimit.min || 0;
  4449. var zoomMax = zoomLimit.max || Infinity;
  4450. newZoom = Math.max(Math.min(zoomMax, newZoom), zoomMin);
  4451. }
  4452. var zoomScale = newZoom / controllerHost.zoom;
  4453. controllerHost.zoom = newZoom;
  4454. target.x -= (zoomX - target.x) * (zoomScale - 1);
  4455. target.y -= (zoomY - target.y) * (zoomScale - 1);
  4456. target.scaleX *= zoomScale;
  4457. target.scaleY *= zoomScale;
  4458. target.dirty();
  4459. }
  4460. // node_modules/echarts/lib/component/helper/cursorHelper.js
  4461. var IRRELEVANT_EXCLUDES = {
  4462. "axisPointer": 1,
  4463. "tooltip": 1,
  4464. "brush": 1
  4465. };
  4466. function onIrrelevantElement(e, api, targetCoordSysModel) {
  4467. var model = api.getComponentByElement(e.topTarget);
  4468. var coordSys = model && model.coordinateSystem;
  4469. return model && model !== targetCoordSysModel && !IRRELEVANT_EXCLUDES.hasOwnProperty(model.mainType) && coordSys && coordSys.model !== targetCoordSysModel;
  4470. }
  4471. // node_modules/echarts/lib/component/helper/MapDraw.js
  4472. var OPTION_STYLE_ENABLED_TAGS = ["rect", "circle", "line", "ellipse", "polygon", "polyline", "path"];
  4473. var OPTION_STYLE_ENABLED_TAG_MAP = createHashMap(OPTION_STYLE_ENABLED_TAGS);
  4474. var STATE_TRIGGER_TAG_MAP = createHashMap(OPTION_STYLE_ENABLED_TAGS.concat(["g"]));
  4475. var LABEL_HOST_MAP = createHashMap(OPTION_STYLE_ENABLED_TAGS.concat(["g"]));
  4476. var mapLabelRaw = makeInner();
  4477. function getFixedItemStyle(model) {
  4478. var itemStyle = model.getItemStyle();
  4479. var areaColor = model.get("areaColor");
  4480. if (areaColor != null) {
  4481. itemStyle.fill = areaColor;
  4482. }
  4483. return itemStyle;
  4484. }
  4485. function fixLineStyle(styleHost) {
  4486. var style = styleHost.style;
  4487. if (style) {
  4488. style.stroke = style.stroke || style.fill;
  4489. style.fill = null;
  4490. }
  4491. }
  4492. var MapDraw = (
  4493. /** @class */
  4494. function() {
  4495. function MapDraw2(api) {
  4496. var group = new Group_default();
  4497. this.uid = getUID("ec_map_draw");
  4498. this._controller = new RoamController_default(api.getZr());
  4499. this._controllerHost = {
  4500. target: group
  4501. };
  4502. this.group = group;
  4503. group.add(this._regionsGroup = new Group_default());
  4504. group.add(this._svgGroup = new Group_default());
  4505. }
  4506. MapDraw2.prototype.draw = function(mapOrGeoModel, ecModel, api, fromView, payload) {
  4507. var isGeo = mapOrGeoModel.mainType === "geo";
  4508. var data = mapOrGeoModel.getData && mapOrGeoModel.getData();
  4509. isGeo && ecModel.eachComponent({
  4510. mainType: "series",
  4511. subType: "map"
  4512. }, function(mapSeries) {
  4513. if (!data && mapSeries.getHostGeoModel() === mapOrGeoModel) {
  4514. data = mapSeries.getData();
  4515. }
  4516. });
  4517. var geo = mapOrGeoModel.coordinateSystem;
  4518. var regionsGroup = this._regionsGroup;
  4519. var group = this.group;
  4520. var transformInfo = geo.getTransformInfo();
  4521. var transformInfoRaw = transformInfo.raw;
  4522. var transformInfoRoam = transformInfo.roam;
  4523. var isFirstDraw = !regionsGroup.childAt(0) || payload;
  4524. if (isFirstDraw) {
  4525. group.x = transformInfoRoam.x;
  4526. group.y = transformInfoRoam.y;
  4527. group.scaleX = transformInfoRoam.scaleX;
  4528. group.scaleY = transformInfoRoam.scaleY;
  4529. group.dirty();
  4530. } else {
  4531. updateProps(group, transformInfoRoam, mapOrGeoModel);
  4532. }
  4533. var isVisualEncodedByVisualMap = data && data.getVisual("visualMeta") && data.getVisual("visualMeta").length > 0;
  4534. var viewBuildCtx = {
  4535. api,
  4536. geo,
  4537. mapOrGeoModel,
  4538. data,
  4539. isVisualEncodedByVisualMap,
  4540. isGeo,
  4541. transformInfoRaw
  4542. };
  4543. if (geo.resourceType === "geoJSON") {
  4544. this._buildGeoJSON(viewBuildCtx);
  4545. } else if (geo.resourceType === "geoSVG") {
  4546. this._buildSVG(viewBuildCtx);
  4547. }
  4548. this._updateController(mapOrGeoModel, ecModel, api);
  4549. this._updateMapSelectHandler(mapOrGeoModel, regionsGroup, api, fromView);
  4550. };
  4551. MapDraw2.prototype._buildGeoJSON = function(viewBuildCtx) {
  4552. var regionsGroupByName = this._regionsGroupByName = createHashMap();
  4553. var regionsInfoByName = createHashMap();
  4554. var regionsGroup = this._regionsGroup;
  4555. var transformInfoRaw = viewBuildCtx.transformInfoRaw;
  4556. var mapOrGeoModel = viewBuildCtx.mapOrGeoModel;
  4557. var data = viewBuildCtx.data;
  4558. var projection = viewBuildCtx.geo.projection;
  4559. var projectionStream = projection && projection.stream;
  4560. function transformPoint(point, project) {
  4561. if (project) {
  4562. point = project(point);
  4563. }
  4564. return point && [point[0] * transformInfoRaw.scaleX + transformInfoRaw.x, point[1] * transformInfoRaw.scaleY + transformInfoRaw.y];
  4565. }
  4566. ;
  4567. function transformPolygonPoints(inPoints) {
  4568. var outPoints = [];
  4569. var project = !projectionStream && projection && projection.project;
  4570. for (var i = 0; i < inPoints.length; ++i) {
  4571. var newPt = transformPoint(inPoints[i], project);
  4572. newPt && outPoints.push(newPt);
  4573. }
  4574. return outPoints;
  4575. }
  4576. function getPolyShape(points3) {
  4577. return {
  4578. shape: {
  4579. points: transformPolygonPoints(points3)
  4580. }
  4581. };
  4582. }
  4583. regionsGroup.removeAll();
  4584. each(viewBuildCtx.geo.regions, function(region) {
  4585. var regionName = region.name;
  4586. var regionGroup = regionsGroupByName.get(regionName);
  4587. var _a = regionsInfoByName.get(regionName) || {}, dataIdx = _a.dataIdx, regionModel = _a.regionModel;
  4588. if (!regionGroup) {
  4589. regionGroup = regionsGroupByName.set(regionName, new Group_default());
  4590. regionsGroup.add(regionGroup);
  4591. dataIdx = data ? data.indexOfName(regionName) : null;
  4592. regionModel = viewBuildCtx.isGeo ? mapOrGeoModel.getRegionModel(regionName) : data ? data.getItemModel(dataIdx) : null;
  4593. regionsInfoByName.set(regionName, {
  4594. dataIdx,
  4595. regionModel
  4596. });
  4597. }
  4598. var polygonSubpaths = [];
  4599. var polylineSubpaths = [];
  4600. each(region.geometries, function(geometry) {
  4601. if (geometry.type === "polygon") {
  4602. var polys = [geometry.exterior].concat(geometry.interiors || []);
  4603. if (projectionStream) {
  4604. polys = projectPolys(polys, projectionStream);
  4605. }
  4606. each(polys, function(poly) {
  4607. polygonSubpaths.push(new Polygon_default(getPolyShape(poly)));
  4608. });
  4609. } else {
  4610. var points3 = geometry.points;
  4611. if (projectionStream) {
  4612. points3 = projectPolys(points3, projectionStream, true);
  4613. }
  4614. each(points3, function(points4) {
  4615. polylineSubpaths.push(new Polyline_default(getPolyShape(points4)));
  4616. });
  4617. }
  4618. });
  4619. var centerPt = transformPoint(region.getCenter(), projection && projection.project);
  4620. function createCompoundPath(subpaths, isLine) {
  4621. if (!subpaths.length) {
  4622. return;
  4623. }
  4624. var compoundPath = new CompoundPath_default({
  4625. culling: true,
  4626. segmentIgnoreThreshold: 1,
  4627. shape: {
  4628. paths: subpaths
  4629. }
  4630. });
  4631. regionGroup.add(compoundPath);
  4632. applyOptionStyleForRegion(viewBuildCtx, compoundPath, dataIdx, regionModel);
  4633. resetLabelForRegion(viewBuildCtx, compoundPath, regionName, regionModel, mapOrGeoModel, dataIdx, centerPt);
  4634. if (isLine) {
  4635. fixLineStyle(compoundPath);
  4636. each(compoundPath.states, fixLineStyle);
  4637. }
  4638. }
  4639. createCompoundPath(polygonSubpaths);
  4640. createCompoundPath(polylineSubpaths, true);
  4641. });
  4642. regionsGroupByName.each(function(regionGroup, regionName) {
  4643. var _a = regionsInfoByName.get(regionName), dataIdx = _a.dataIdx, regionModel = _a.regionModel;
  4644. resetEventTriggerForRegion(viewBuildCtx, regionGroup, regionName, regionModel, mapOrGeoModel, dataIdx);
  4645. resetTooltipForRegion(viewBuildCtx, regionGroup, regionName, regionModel, mapOrGeoModel);
  4646. resetStateTriggerForRegion(viewBuildCtx, regionGroup, regionName, regionModel, mapOrGeoModel);
  4647. }, this);
  4648. };
  4649. MapDraw2.prototype._buildSVG = function(viewBuildCtx) {
  4650. var mapName = viewBuildCtx.geo.map;
  4651. var transformInfoRaw = viewBuildCtx.transformInfoRaw;
  4652. this._svgGroup.x = transformInfoRaw.x;
  4653. this._svgGroup.y = transformInfoRaw.y;
  4654. this._svgGroup.scaleX = transformInfoRaw.scaleX;
  4655. this._svgGroup.scaleY = transformInfoRaw.scaleY;
  4656. if (this._svgResourceChanged(mapName)) {
  4657. this._freeSVG();
  4658. this._useSVG(mapName);
  4659. }
  4660. var svgDispatcherMap = this._svgDispatcherMap = createHashMap();
  4661. var focusSelf = false;
  4662. each(this._svgGraphicRecord.named, function(namedItem) {
  4663. var regionName = namedItem.name;
  4664. var mapOrGeoModel = viewBuildCtx.mapOrGeoModel;
  4665. var data = viewBuildCtx.data;
  4666. var svgNodeTagLower = namedItem.svgNodeTagLower;
  4667. var el = namedItem.el;
  4668. var dataIdx = data ? data.indexOfName(regionName) : null;
  4669. var regionModel = mapOrGeoModel.getRegionModel(regionName);
  4670. if (OPTION_STYLE_ENABLED_TAG_MAP.get(svgNodeTagLower) != null && el instanceof Displayable_default) {
  4671. applyOptionStyleForRegion(viewBuildCtx, el, dataIdx, regionModel);
  4672. }
  4673. if (el instanceof Displayable_default) {
  4674. el.culling = true;
  4675. }
  4676. el.z2EmphasisLift = 0;
  4677. if (!namedItem.namedFrom) {
  4678. if (LABEL_HOST_MAP.get(svgNodeTagLower) != null) {
  4679. resetLabelForRegion(viewBuildCtx, el, regionName, regionModel, mapOrGeoModel, dataIdx, null);
  4680. }
  4681. resetEventTriggerForRegion(viewBuildCtx, el, regionName, regionModel, mapOrGeoModel, dataIdx);
  4682. resetTooltipForRegion(viewBuildCtx, el, regionName, regionModel, mapOrGeoModel);
  4683. if (STATE_TRIGGER_TAG_MAP.get(svgNodeTagLower) != null) {
  4684. var focus_1 = resetStateTriggerForRegion(viewBuildCtx, el, regionName, regionModel, mapOrGeoModel);
  4685. if (focus_1 === "self") {
  4686. focusSelf = true;
  4687. }
  4688. var els = svgDispatcherMap.get(regionName) || svgDispatcherMap.set(regionName, []);
  4689. els.push(el);
  4690. }
  4691. }
  4692. }, this);
  4693. this._enableBlurEntireSVG(focusSelf, viewBuildCtx);
  4694. };
  4695. MapDraw2.prototype._enableBlurEntireSVG = function(focusSelf, viewBuildCtx) {
  4696. if (focusSelf && viewBuildCtx.isGeo) {
  4697. var blurStyle = viewBuildCtx.mapOrGeoModel.getModel(["blur", "itemStyle"]).getItemStyle();
  4698. var opacity_1 = blurStyle.opacity;
  4699. this._svgGraphicRecord.root.traverse(function(el) {
  4700. if (!el.isGroup) {
  4701. setDefaultStateProxy(el);
  4702. var style = el.ensureState("blur").style || {};
  4703. if (style.opacity == null && opacity_1 != null) {
  4704. style.opacity = opacity_1;
  4705. }
  4706. el.ensureState("emphasis");
  4707. }
  4708. });
  4709. }
  4710. };
  4711. MapDraw2.prototype.remove = function() {
  4712. this._regionsGroup.removeAll();
  4713. this._regionsGroupByName = null;
  4714. this._svgGroup.removeAll();
  4715. this._freeSVG();
  4716. this._controller.dispose();
  4717. this._controllerHost = null;
  4718. };
  4719. MapDraw2.prototype.findHighDownDispatchers = function(name, geoModel) {
  4720. if (name == null) {
  4721. return [];
  4722. }
  4723. var geo = geoModel.coordinateSystem;
  4724. if (geo.resourceType === "geoJSON") {
  4725. var regionsGroupByName = this._regionsGroupByName;
  4726. if (regionsGroupByName) {
  4727. var regionGroup = regionsGroupByName.get(name);
  4728. return regionGroup ? [regionGroup] : [];
  4729. }
  4730. } else if (geo.resourceType === "geoSVG") {
  4731. return this._svgDispatcherMap && this._svgDispatcherMap.get(name) || [];
  4732. }
  4733. };
  4734. MapDraw2.prototype._svgResourceChanged = function(mapName) {
  4735. return this._svgMapName !== mapName;
  4736. };
  4737. MapDraw2.prototype._useSVG = function(mapName) {
  4738. var resource = geoSourceManager_default.getGeoResource(mapName);
  4739. if (resource && resource.type === "geoSVG") {
  4740. var svgGraphic = resource.useGraphic(this.uid);
  4741. this._svgGroup.add(svgGraphic.root);
  4742. this._svgGraphicRecord = svgGraphic;
  4743. this._svgMapName = mapName;
  4744. }
  4745. };
  4746. MapDraw2.prototype._freeSVG = function() {
  4747. var mapName = this._svgMapName;
  4748. if (mapName == null) {
  4749. return;
  4750. }
  4751. var resource = geoSourceManager_default.getGeoResource(mapName);
  4752. if (resource && resource.type === "geoSVG") {
  4753. resource.freeGraphic(this.uid);
  4754. }
  4755. this._svgGraphicRecord = null;
  4756. this._svgDispatcherMap = null;
  4757. this._svgGroup.removeAll();
  4758. this._svgMapName = null;
  4759. };
  4760. MapDraw2.prototype._updateController = function(mapOrGeoModel, ecModel, api) {
  4761. var geo = mapOrGeoModel.coordinateSystem;
  4762. var controller = this._controller;
  4763. var controllerHost = this._controllerHost;
  4764. controllerHost.zoomLimit = mapOrGeoModel.get("scaleLimit");
  4765. controllerHost.zoom = geo.getZoom();
  4766. controller.enable(mapOrGeoModel.get("roam") || false);
  4767. var mainType = mapOrGeoModel.mainType;
  4768. function makeActionBase() {
  4769. var action = {
  4770. type: "geoRoam",
  4771. componentType: mainType
  4772. };
  4773. action[mainType + "Id"] = mapOrGeoModel.id;
  4774. return action;
  4775. }
  4776. controller.off("pan").on("pan", function(e) {
  4777. this._mouseDownFlag = false;
  4778. updateViewOnPan(controllerHost, e.dx, e.dy);
  4779. api.dispatchAction(extend(makeActionBase(), {
  4780. dx: e.dx,
  4781. dy: e.dy,
  4782. animation: {
  4783. duration: 0
  4784. }
  4785. }));
  4786. }, this);
  4787. controller.off("zoom").on("zoom", function(e) {
  4788. this._mouseDownFlag = false;
  4789. updateViewOnZoom(controllerHost, e.scale, e.originX, e.originY);
  4790. api.dispatchAction(extend(makeActionBase(), {
  4791. zoom: e.scale,
  4792. originX: e.originX,
  4793. originY: e.originY,
  4794. animation: {
  4795. duration: 0
  4796. }
  4797. }));
  4798. }, this);
  4799. controller.setPointerChecker(function(e, x, y) {
  4800. return geo.containPoint([x, y]) && !onIrrelevantElement(e, api, mapOrGeoModel);
  4801. });
  4802. };
  4803. MapDraw2.prototype.resetForLabelLayout = function() {
  4804. this.group.traverse(function(el) {
  4805. var label = el.getTextContent();
  4806. if (label) {
  4807. label.ignore = mapLabelRaw(label).ignore;
  4808. }
  4809. });
  4810. };
  4811. MapDraw2.prototype._updateMapSelectHandler = function(mapOrGeoModel, regionsGroup, api, fromView) {
  4812. var mapDraw = this;
  4813. regionsGroup.off("mousedown");
  4814. regionsGroup.off("click");
  4815. if (mapOrGeoModel.get("selectedMode")) {
  4816. regionsGroup.on("mousedown", function() {
  4817. mapDraw._mouseDownFlag = true;
  4818. });
  4819. regionsGroup.on("click", function(e) {
  4820. if (!mapDraw._mouseDownFlag) {
  4821. return;
  4822. }
  4823. mapDraw._mouseDownFlag = false;
  4824. });
  4825. }
  4826. };
  4827. return MapDraw2;
  4828. }()
  4829. );
  4830. function applyOptionStyleForRegion(viewBuildCtx, el, dataIndex, regionModel) {
  4831. var normalStyleModel = regionModel.getModel("itemStyle");
  4832. var emphasisStyleModel = regionModel.getModel(["emphasis", "itemStyle"]);
  4833. var blurStyleModel = regionModel.getModel(["blur", "itemStyle"]);
  4834. var selectStyleModel = regionModel.getModel(["select", "itemStyle"]);
  4835. var normalStyle = getFixedItemStyle(normalStyleModel);
  4836. var emphasisStyle = getFixedItemStyle(emphasisStyleModel);
  4837. var selectStyle = getFixedItemStyle(selectStyleModel);
  4838. var blurStyle = getFixedItemStyle(blurStyleModel);
  4839. var data = viewBuildCtx.data;
  4840. if (data) {
  4841. var style = data.getItemVisual(dataIndex, "style");
  4842. var decal = data.getItemVisual(dataIndex, "decal");
  4843. if (viewBuildCtx.isVisualEncodedByVisualMap && style.fill) {
  4844. normalStyle.fill = style.fill;
  4845. }
  4846. if (decal) {
  4847. normalStyle.decal = createOrUpdatePatternFromDecal(decal, viewBuildCtx.api);
  4848. }
  4849. }
  4850. el.setStyle(normalStyle);
  4851. el.style.strokeNoScale = true;
  4852. el.ensureState("emphasis").style = emphasisStyle;
  4853. el.ensureState("select").style = selectStyle;
  4854. el.ensureState("blur").style = blurStyle;
  4855. setDefaultStateProxy(el);
  4856. }
  4857. function resetLabelForRegion(viewBuildCtx, el, regionName, regionModel, mapOrGeoModel, dataIdx, labelXY) {
  4858. var data = viewBuildCtx.data;
  4859. var isGeo = viewBuildCtx.isGeo;
  4860. var isDataNaN = data && isNaN(data.get(data.mapDimension("value"), dataIdx));
  4861. var itemLayout = data && data.getItemLayout(dataIdx);
  4862. if (isGeo || isDataNaN || itemLayout && itemLayout.showLabel) {
  4863. var query = !isGeo ? dataIdx : regionName;
  4864. var labelFetcher = void 0;
  4865. if (!data || dataIdx >= 0) {
  4866. labelFetcher = mapOrGeoModel;
  4867. }
  4868. var specifiedTextOpt = labelXY ? {
  4869. normal: {
  4870. align: "center",
  4871. verticalAlign: "middle"
  4872. }
  4873. } : null;
  4874. setLabelStyle(el, getLabelStatesModels(regionModel), {
  4875. labelFetcher,
  4876. labelDataIndex: query,
  4877. defaultText: regionName
  4878. }, specifiedTextOpt);
  4879. var textEl = el.getTextContent();
  4880. if (textEl) {
  4881. mapLabelRaw(textEl).ignore = textEl.ignore;
  4882. if (el.textConfig && labelXY) {
  4883. var rect = el.getBoundingRect().clone();
  4884. el.textConfig.layoutRect = rect;
  4885. el.textConfig.position = [(labelXY[0] - rect.x) / rect.width * 100 + "%", (labelXY[1] - rect.y) / rect.height * 100 + "%"];
  4886. }
  4887. }
  4888. el.disableLabelAnimation = true;
  4889. } else {
  4890. el.removeTextContent();
  4891. el.removeTextConfig();
  4892. el.disableLabelAnimation = null;
  4893. }
  4894. }
  4895. function resetEventTriggerForRegion(viewBuildCtx, eventTrigger, regionName, regionModel, mapOrGeoModel, dataIdx) {
  4896. if (viewBuildCtx.data) {
  4897. viewBuildCtx.data.setItemGraphicEl(dataIdx, eventTrigger);
  4898. } else {
  4899. getECData(eventTrigger).eventData = {
  4900. componentType: "geo",
  4901. componentIndex: mapOrGeoModel.componentIndex,
  4902. geoIndex: mapOrGeoModel.componentIndex,
  4903. name: regionName,
  4904. region: regionModel && regionModel.option || {}
  4905. };
  4906. }
  4907. }
  4908. function resetTooltipForRegion(viewBuildCtx, el, regionName, regionModel, mapOrGeoModel) {
  4909. if (!viewBuildCtx.data) {
  4910. setTooltipConfig({
  4911. el,
  4912. componentModel: mapOrGeoModel,
  4913. itemName: regionName,
  4914. // @ts-ignore FIXME:TS fix the "compatible with each other"?
  4915. itemTooltipOption: regionModel.get("tooltip")
  4916. });
  4917. }
  4918. }
  4919. function resetStateTriggerForRegion(viewBuildCtx, el, regionName, regionModel, mapOrGeoModel) {
  4920. el.highDownSilentOnTouch = !!mapOrGeoModel.get("selectedMode");
  4921. var emphasisModel = regionModel.getModel("emphasis");
  4922. var focus = emphasisModel.get("focus");
  4923. toggleHoverEmphasis(el, focus, emphasisModel.get("blurScope"), emphasisModel.get("disabled"));
  4924. if (viewBuildCtx.isGeo) {
  4925. enableComponentHighDownFeatures(el, mapOrGeoModel, regionName);
  4926. }
  4927. return focus;
  4928. }
  4929. function projectPolys(rings, createStream, isLine) {
  4930. var polygons = [];
  4931. var curPoly;
  4932. function startPolygon() {
  4933. curPoly = [];
  4934. }
  4935. function endPolygon() {
  4936. if (curPoly.length) {
  4937. polygons.push(curPoly);
  4938. curPoly = [];
  4939. }
  4940. }
  4941. var stream = createStream({
  4942. polygonStart: startPolygon,
  4943. polygonEnd: endPolygon,
  4944. lineStart: startPolygon,
  4945. lineEnd: endPolygon,
  4946. point: function(x, y) {
  4947. if (isFinite(x) && isFinite(y)) {
  4948. curPoly.push([x, y]);
  4949. }
  4950. },
  4951. sphere: function() {
  4952. }
  4953. });
  4954. !isLine && stream.polygonStart();
  4955. each(rings, function(ring) {
  4956. stream.lineStart();
  4957. for (var i = 0; i < ring.length; i++) {
  4958. stream.point(ring[i][0], ring[i][1]);
  4959. }
  4960. stream.lineEnd();
  4961. });
  4962. !isLine && stream.polygonEnd();
  4963. return polygons;
  4964. }
  4965. var MapDraw_default = MapDraw;
  4966. // node_modules/echarts/lib/component/geo/GeoView.js
  4967. var GeoView = (
  4968. /** @class */
  4969. function(_super) {
  4970. __extends(GeoView2, _super);
  4971. function GeoView2() {
  4972. var _this = _super !== null && _super.apply(this, arguments) || this;
  4973. _this.type = GeoView2.type;
  4974. _this.focusBlurEnabled = true;
  4975. return _this;
  4976. }
  4977. GeoView2.prototype.init = function(ecModel, api) {
  4978. this._api = api;
  4979. };
  4980. GeoView2.prototype.render = function(geoModel, ecModel, api, payload) {
  4981. this._model = geoModel;
  4982. if (!geoModel.get("show")) {
  4983. this._mapDraw && this._mapDraw.remove();
  4984. this._mapDraw = null;
  4985. return;
  4986. }
  4987. if (!this._mapDraw) {
  4988. this._mapDraw = new MapDraw_default(api);
  4989. }
  4990. var mapDraw = this._mapDraw;
  4991. mapDraw.draw(geoModel, ecModel, api, this, payload);
  4992. mapDraw.group.on("click", this._handleRegionClick, this);
  4993. mapDraw.group.silent = geoModel.get("silent");
  4994. this.group.add(mapDraw.group);
  4995. this.updateSelectStatus(geoModel, ecModel, api);
  4996. };
  4997. GeoView2.prototype._handleRegionClick = function(e) {
  4998. var eventData;
  4999. findEventDispatcher(e.target, function(current) {
  5000. return (eventData = getECData(current).eventData) != null;
  5001. }, true);
  5002. if (eventData) {
  5003. this._api.dispatchAction({
  5004. type: "geoToggleSelect",
  5005. geoId: this._model.id,
  5006. name: eventData.name
  5007. });
  5008. }
  5009. };
  5010. GeoView2.prototype.updateSelectStatus = function(model, ecModel, api) {
  5011. var _this = this;
  5012. this._mapDraw.group.traverse(function(node) {
  5013. var eventData = getECData(node).eventData;
  5014. if (eventData) {
  5015. _this._model.isSelected(eventData.name) ? api.enterSelect(node) : api.leaveSelect(node);
  5016. return true;
  5017. }
  5018. });
  5019. };
  5020. GeoView2.prototype.findHighDownDispatchers = function(name) {
  5021. return this._mapDraw && this._mapDraw.findHighDownDispatchers(name, this._model);
  5022. };
  5023. GeoView2.prototype.dispose = function() {
  5024. this._mapDraw && this._mapDraw.remove();
  5025. };
  5026. GeoView2.type = "geo";
  5027. return GeoView2;
  5028. }(Component_default2)
  5029. );
  5030. var GeoView_default = GeoView;
  5031. // node_modules/echarts/lib/component/geo/install.js
  5032. function registerMap(mapName, geoJson, specialAreas) {
  5033. geoSourceManager_default.registerMap(mapName, geoJson, specialAreas);
  5034. }
  5035. function install3(registers) {
  5036. registers.registerCoordinateSystem("geo", geoCreator_default);
  5037. registers.registerComponentModel(GeoModel_default);
  5038. registers.registerComponentView(GeoView_default);
  5039. registers.registerImpl("registerMap", registerMap);
  5040. registers.registerImpl("getMap", function(mapName) {
  5041. return geoSourceManager_default.getMapForUser(mapName);
  5042. });
  5043. function makeAction(method, actionInfo2) {
  5044. actionInfo2.update = "geo:updateSelectStatus";
  5045. registers.registerAction(actionInfo2, function(payload, ecModel) {
  5046. var selected = {};
  5047. var allSelected = [];
  5048. ecModel.eachComponent({
  5049. mainType: "geo",
  5050. query: payload
  5051. }, function(geoModel) {
  5052. geoModel[method](payload.name);
  5053. var geo = geoModel.coordinateSystem;
  5054. each(geo.regions, function(region) {
  5055. selected[region.name] = geoModel.isSelected(region.name) || false;
  5056. });
  5057. var names = [];
  5058. each(selected, function(v, name) {
  5059. selected[name] && names.push(name);
  5060. });
  5061. allSelected.push({
  5062. geoIndex: geoModel.componentIndex,
  5063. // Use singular, the same naming convention as the event `selectchanged`.
  5064. name: names
  5065. });
  5066. });
  5067. return {
  5068. selected,
  5069. allSelected,
  5070. name: payload.name
  5071. };
  5072. });
  5073. }
  5074. makeAction("toggleSelected", {
  5075. type: "geoToggleSelect",
  5076. event: "geoselectchanged"
  5077. });
  5078. makeAction("select", {
  5079. type: "geoSelect",
  5080. event: "geoselected"
  5081. });
  5082. makeAction("unSelect", {
  5083. type: "geoUnSelect",
  5084. event: "geounselected"
  5085. });
  5086. registers.registerAction({
  5087. type: "geoRoam",
  5088. event: "geoRoam",
  5089. update: "updateTransform"
  5090. }, function(payload, ecModel, api) {
  5091. var componentType = payload.componentType || "series";
  5092. ecModel.eachComponent({
  5093. mainType: componentType,
  5094. query: payload
  5095. }, function(componentModel) {
  5096. var geo = componentModel.coordinateSystem;
  5097. if (geo.type !== "geo") {
  5098. return;
  5099. }
  5100. var res = updateCenterAndZoom(geo, payload, componentModel.get("scaleLimit"), api);
  5101. componentModel.setCenter && componentModel.setCenter(res.center);
  5102. componentModel.setZoom && componentModel.setZoom(res.zoom);
  5103. if (componentType === "series") {
  5104. each(componentModel.seriesGroup, function(seriesModel) {
  5105. seriesModel.setCenter(res.center);
  5106. seriesModel.setZoom(res.zoom);
  5107. });
  5108. }
  5109. });
  5110. });
  5111. }
  5112. // node_modules/echarts/lib/coord/parallel/parallelPreprocessor.js
  5113. function parallelPreprocessor(option) {
  5114. createParallelIfNeeded(option);
  5115. mergeAxisOptionFromParallel(option);
  5116. }
  5117. function createParallelIfNeeded(option) {
  5118. if (option.parallel) {
  5119. return;
  5120. }
  5121. var hasParallelSeries = false;
  5122. each(option.series, function(seriesOpt) {
  5123. if (seriesOpt && seriesOpt.type === "parallel") {
  5124. hasParallelSeries = true;
  5125. }
  5126. });
  5127. if (hasParallelSeries) {
  5128. option.parallel = [{}];
  5129. }
  5130. }
  5131. function mergeAxisOptionFromParallel(option) {
  5132. var axes = normalizeToArray(option.parallelAxis);
  5133. each(axes, function(axisOption) {
  5134. if (!isObject(axisOption)) {
  5135. return;
  5136. }
  5137. var parallelIndex = axisOption.parallelIndex || 0;
  5138. var parallelOption = normalizeToArray(option.parallel)[parallelIndex];
  5139. if (parallelOption && parallelOption.parallelAxisDefault) {
  5140. merge(axisOption, parallelOption.parallelAxisDefault, false);
  5141. }
  5142. });
  5143. }
  5144. // node_modules/echarts/lib/component/parallel/ParallelView.js
  5145. var CLICK_THRESHOLD = 5;
  5146. var ParallelView = (
  5147. /** @class */
  5148. function(_super) {
  5149. __extends(ParallelView2, _super);
  5150. function ParallelView2() {
  5151. var _this = _super !== null && _super.apply(this, arguments) || this;
  5152. _this.type = ParallelView2.type;
  5153. return _this;
  5154. }
  5155. ParallelView2.prototype.render = function(parallelModel, ecModel, api) {
  5156. this._model = parallelModel;
  5157. this._api = api;
  5158. if (!this._handlers) {
  5159. this._handlers = {};
  5160. each(handlers, function(handler, eventName) {
  5161. api.getZr().on(eventName, this._handlers[eventName] = bind(handler, this));
  5162. }, this);
  5163. }
  5164. createOrUpdate(this, "_throttledDispatchExpand", parallelModel.get("axisExpandRate"), "fixRate");
  5165. };
  5166. ParallelView2.prototype.dispose = function(ecModel, api) {
  5167. clear(this, "_throttledDispatchExpand");
  5168. each(this._handlers, function(handler, eventName) {
  5169. api.getZr().off(eventName, handler);
  5170. });
  5171. this._handlers = null;
  5172. };
  5173. ParallelView2.prototype._throttledDispatchExpand = function(opt) {
  5174. this._dispatchExpand(opt);
  5175. };
  5176. ParallelView2.prototype._dispatchExpand = function(opt) {
  5177. opt && this._api.dispatchAction(extend({
  5178. type: "parallelAxisExpand"
  5179. }, opt));
  5180. };
  5181. ParallelView2.type = "parallel";
  5182. return ParallelView2;
  5183. }(Component_default2)
  5184. );
  5185. var handlers = {
  5186. mousedown: function(e) {
  5187. if (checkTrigger(this, "click")) {
  5188. this._mouseDownPoint = [e.offsetX, e.offsetY];
  5189. }
  5190. },
  5191. mouseup: function(e) {
  5192. var mouseDownPoint = this._mouseDownPoint;
  5193. if (checkTrigger(this, "click") && mouseDownPoint) {
  5194. var point = [e.offsetX, e.offsetY];
  5195. var dist = Math.pow(mouseDownPoint[0] - point[0], 2) + Math.pow(mouseDownPoint[1] - point[1], 2);
  5196. if (dist > CLICK_THRESHOLD) {
  5197. return;
  5198. }
  5199. var result = this._model.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX, e.offsetY]);
  5200. result.behavior !== "none" && this._dispatchExpand({
  5201. axisExpandWindow: result.axisExpandWindow
  5202. });
  5203. }
  5204. this._mouseDownPoint = null;
  5205. },
  5206. mousemove: function(e) {
  5207. if (this._mouseDownPoint || !checkTrigger(this, "mousemove")) {
  5208. return;
  5209. }
  5210. var model = this._model;
  5211. var result = model.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX, e.offsetY]);
  5212. var behavior = result.behavior;
  5213. behavior === "jump" && this._throttledDispatchExpand.debounceNextCall(model.get("axisExpandDebounce"));
  5214. this._throttledDispatchExpand(behavior === "none" ? null : {
  5215. axisExpandWindow: result.axisExpandWindow,
  5216. // Jumping uses animation, and sliding suppresses animation.
  5217. animation: behavior === "jump" ? null : {
  5218. duration: 0
  5219. // Disable animation.
  5220. }
  5221. });
  5222. }
  5223. };
  5224. function checkTrigger(view, triggerOn) {
  5225. var model = view._model;
  5226. return model.get("axisExpandable") && model.get("axisExpandTriggerOn") === triggerOn;
  5227. }
  5228. var ParallelView_default = ParallelView;
  5229. // node_modules/echarts/lib/coord/parallel/ParallelModel.js
  5230. var ParallelModel = (
  5231. /** @class */
  5232. function(_super) {
  5233. __extends(ParallelModel2, _super);
  5234. function ParallelModel2() {
  5235. var _this = _super !== null && _super.apply(this, arguments) || this;
  5236. _this.type = ParallelModel2.type;
  5237. return _this;
  5238. }
  5239. ParallelModel2.prototype.init = function() {
  5240. _super.prototype.init.apply(this, arguments);
  5241. this.mergeOption({});
  5242. };
  5243. ParallelModel2.prototype.mergeOption = function(newOption) {
  5244. var thisOption = this.option;
  5245. newOption && merge(thisOption, newOption, true);
  5246. this._initDimensions();
  5247. };
  5248. ParallelModel2.prototype.contains = function(model, ecModel) {
  5249. var parallelIndex = model.get("parallelIndex");
  5250. return parallelIndex != null && ecModel.getComponent("parallel", parallelIndex) === this;
  5251. };
  5252. ParallelModel2.prototype.setAxisExpand = function(opt) {
  5253. each(["axisExpandable", "axisExpandCenter", "axisExpandCount", "axisExpandWidth", "axisExpandWindow"], function(name) {
  5254. if (opt.hasOwnProperty(name)) {
  5255. this.option[name] = opt[name];
  5256. }
  5257. }, this);
  5258. };
  5259. ParallelModel2.prototype._initDimensions = function() {
  5260. var dimensions = this.dimensions = [];
  5261. var parallelAxisIndex = this.parallelAxisIndex = [];
  5262. var axisModels = filter(this.ecModel.queryComponents({
  5263. mainType: "parallelAxis"
  5264. }), function(axisModel) {
  5265. return (axisModel.get("parallelIndex") || 0) === this.componentIndex;
  5266. }, this);
  5267. each(axisModels, function(axisModel) {
  5268. dimensions.push("dim" + axisModel.get("dim"));
  5269. parallelAxisIndex.push(axisModel.componentIndex);
  5270. });
  5271. };
  5272. ParallelModel2.type = "parallel";
  5273. ParallelModel2.dependencies = ["parallelAxis"];
  5274. ParallelModel2.layoutMode = "box";
  5275. ParallelModel2.defaultOption = {
  5276. // zlevel: 0,
  5277. z: 0,
  5278. left: 80,
  5279. top: 60,
  5280. right: 80,
  5281. bottom: 60,
  5282. // width: {totalWidth} - left - right,
  5283. // height: {totalHeight} - top - bottom,
  5284. layout: "horizontal",
  5285. // FIXME
  5286. // naming?
  5287. axisExpandable: false,
  5288. axisExpandCenter: null,
  5289. axisExpandCount: 0,
  5290. axisExpandWidth: 50,
  5291. axisExpandRate: 17,
  5292. axisExpandDebounce: 50,
  5293. // [out, in, jumpTarget]. In percentage. If use [null, 0.05], null means full.
  5294. // Do not doc to user until necessary.
  5295. axisExpandSlideTriggerArea: [-0.15, 0.05, 0.4],
  5296. axisExpandTriggerOn: "click",
  5297. parallelAxisDefault: null
  5298. };
  5299. return ParallelModel2;
  5300. }(Component_default)
  5301. );
  5302. var ParallelModel_default = ParallelModel;
  5303. // node_modules/echarts/lib/coord/parallel/ParallelAxis.js
  5304. var ParallelAxis = (
  5305. /** @class */
  5306. function(_super) {
  5307. __extends(ParallelAxis2, _super);
  5308. function ParallelAxis2(dim, scale2, coordExtent, axisType, axisIndex) {
  5309. var _this = _super.call(this, dim, scale2, coordExtent) || this;
  5310. _this.type = axisType || "value";
  5311. _this.axisIndex = axisIndex;
  5312. return _this;
  5313. }
  5314. ParallelAxis2.prototype.isHorizontal = function() {
  5315. return this.coordinateSystem.getModel().get("layout") !== "horizontal";
  5316. };
  5317. return ParallelAxis2;
  5318. }(Axis_default)
  5319. );
  5320. var ParallelAxis_default = ParallelAxis;
  5321. // node_modules/echarts/lib/component/helper/sliderMove.js
  5322. function sliderMove(delta, handleEnds, extent, handleIndex, minSpan, maxSpan) {
  5323. delta = delta || 0;
  5324. var extentSpan = extent[1] - extent[0];
  5325. if (minSpan != null) {
  5326. minSpan = restrict(minSpan, [0, extentSpan]);
  5327. }
  5328. if (maxSpan != null) {
  5329. maxSpan = Math.max(maxSpan, minSpan != null ? minSpan : 0);
  5330. }
  5331. if (handleIndex === "all") {
  5332. var handleSpan = Math.abs(handleEnds[1] - handleEnds[0]);
  5333. handleSpan = restrict(handleSpan, [0, extentSpan]);
  5334. minSpan = maxSpan = restrict(handleSpan, [minSpan, maxSpan]);
  5335. handleIndex = 0;
  5336. }
  5337. handleEnds[0] = restrict(handleEnds[0], extent);
  5338. handleEnds[1] = restrict(handleEnds[1], extent);
  5339. var originalDistSign = getSpanSign(handleEnds, handleIndex);
  5340. handleEnds[handleIndex] += delta;
  5341. var extentMinSpan = minSpan || 0;
  5342. var realExtent = extent.slice();
  5343. originalDistSign.sign < 0 ? realExtent[0] += extentMinSpan : realExtent[1] -= extentMinSpan;
  5344. handleEnds[handleIndex] = restrict(handleEnds[handleIndex], realExtent);
  5345. var currDistSign;
  5346. currDistSign = getSpanSign(handleEnds, handleIndex);
  5347. if (minSpan != null && (currDistSign.sign !== originalDistSign.sign || currDistSign.span < minSpan)) {
  5348. handleEnds[1 - handleIndex] = handleEnds[handleIndex] + originalDistSign.sign * minSpan;
  5349. }
  5350. currDistSign = getSpanSign(handleEnds, handleIndex);
  5351. if (maxSpan != null && currDistSign.span > maxSpan) {
  5352. handleEnds[1 - handleIndex] = handleEnds[handleIndex] + currDistSign.sign * maxSpan;
  5353. }
  5354. return handleEnds;
  5355. }
  5356. function getSpanSign(handleEnds, handleIndex) {
  5357. var dist = handleEnds[handleIndex] - handleEnds[1 - handleIndex];
  5358. return {
  5359. span: Math.abs(dist),
  5360. sign: dist > 0 ? -1 : dist < 0 ? 1 : handleIndex ? -1 : 1
  5361. };
  5362. }
  5363. function restrict(value, extend2) {
  5364. return Math.min(extend2[1] != null ? extend2[1] : Infinity, Math.max(extend2[0] != null ? extend2[0] : -Infinity, value));
  5365. }
  5366. // node_modules/echarts/lib/coord/parallel/Parallel.js
  5367. var each2 = each;
  5368. var mathMin = Math.min;
  5369. var mathMax = Math.max;
  5370. var mathFloor = Math.floor;
  5371. var mathCeil = Math.ceil;
  5372. var round2 = round;
  5373. var PI2 = Math.PI;
  5374. var Parallel = (
  5375. /** @class */
  5376. function() {
  5377. function Parallel2(parallelModel, ecModel, api) {
  5378. this.type = "parallel";
  5379. this._axesMap = createHashMap();
  5380. this._axesLayout = {};
  5381. this.dimensions = parallelModel.dimensions;
  5382. this._model = parallelModel;
  5383. this._init(parallelModel, ecModel, api);
  5384. }
  5385. Parallel2.prototype._init = function(parallelModel, ecModel, api) {
  5386. var dimensions = parallelModel.dimensions;
  5387. var parallelAxisIndex = parallelModel.parallelAxisIndex;
  5388. each2(dimensions, function(dim, idx) {
  5389. var axisIndex = parallelAxisIndex[idx];
  5390. var axisModel = ecModel.getComponent("parallelAxis", axisIndex);
  5391. var axis = this._axesMap.set(dim, new ParallelAxis_default(dim, createScaleByModel(axisModel), [0, 0], axisModel.get("type"), axisIndex));
  5392. var isCategory = axis.type === "category";
  5393. axis.onBand = isCategory && axisModel.get("boundaryGap");
  5394. axis.inverse = axisModel.get("inverse");
  5395. axisModel.axis = axis;
  5396. axis.model = axisModel;
  5397. axis.coordinateSystem = axisModel.coordinateSystem = this;
  5398. }, this);
  5399. };
  5400. Parallel2.prototype.update = function(ecModel, api) {
  5401. this._updateAxesFromSeries(this._model, ecModel);
  5402. };
  5403. Parallel2.prototype.containPoint = function(point) {
  5404. var layoutInfo = this._makeLayoutInfo();
  5405. var axisBase = layoutInfo.axisBase;
  5406. var layoutBase = layoutInfo.layoutBase;
  5407. var pixelDimIndex = layoutInfo.pixelDimIndex;
  5408. var pAxis = point[1 - pixelDimIndex];
  5409. var pLayout = point[pixelDimIndex];
  5410. return pAxis >= axisBase && pAxis <= axisBase + layoutInfo.axisLength && pLayout >= layoutBase && pLayout <= layoutBase + layoutInfo.layoutLength;
  5411. };
  5412. Parallel2.prototype.getModel = function() {
  5413. return this._model;
  5414. };
  5415. Parallel2.prototype._updateAxesFromSeries = function(parallelModel, ecModel) {
  5416. ecModel.eachSeries(function(seriesModel) {
  5417. if (!parallelModel.contains(seriesModel, ecModel)) {
  5418. return;
  5419. }
  5420. var data = seriesModel.getData();
  5421. each2(this.dimensions, function(dim) {
  5422. var axis = this._axesMap.get(dim);
  5423. axis.scale.unionExtentFromData(data, data.mapDimension(dim));
  5424. niceScaleExtent(axis.scale, axis.model);
  5425. }, this);
  5426. }, this);
  5427. };
  5428. Parallel2.prototype.resize = function(parallelModel, api) {
  5429. this._rect = getLayoutRect(parallelModel.getBoxLayoutParams(), {
  5430. width: api.getWidth(),
  5431. height: api.getHeight()
  5432. });
  5433. this._layoutAxes();
  5434. };
  5435. Parallel2.prototype.getRect = function() {
  5436. return this._rect;
  5437. };
  5438. Parallel2.prototype._makeLayoutInfo = function() {
  5439. var parallelModel = this._model;
  5440. var rect = this._rect;
  5441. var xy = ["x", "y"];
  5442. var wh = ["width", "height"];
  5443. var layout2 = parallelModel.get("layout");
  5444. var pixelDimIndex = layout2 === "horizontal" ? 0 : 1;
  5445. var layoutLength = rect[wh[pixelDimIndex]];
  5446. var layoutExtent = [0, layoutLength];
  5447. var axisCount = this.dimensions.length;
  5448. var axisExpandWidth = restrict2(parallelModel.get("axisExpandWidth"), layoutExtent);
  5449. var axisExpandCount = restrict2(parallelModel.get("axisExpandCount") || 0, [0, axisCount]);
  5450. var axisExpandable = parallelModel.get("axisExpandable") && axisCount > 3 && axisCount > axisExpandCount && axisExpandCount > 1 && axisExpandWidth > 0 && layoutLength > 0;
  5451. var axisExpandWindow = parallelModel.get("axisExpandWindow");
  5452. var winSize;
  5453. if (!axisExpandWindow) {
  5454. winSize = restrict2(axisExpandWidth * (axisExpandCount - 1), layoutExtent);
  5455. var axisExpandCenter = parallelModel.get("axisExpandCenter") || mathFloor(axisCount / 2);
  5456. axisExpandWindow = [axisExpandWidth * axisExpandCenter - winSize / 2];
  5457. axisExpandWindow[1] = axisExpandWindow[0] + winSize;
  5458. } else {
  5459. winSize = restrict2(axisExpandWindow[1] - axisExpandWindow[0], layoutExtent);
  5460. axisExpandWindow[1] = axisExpandWindow[0] + winSize;
  5461. }
  5462. var axisCollapseWidth = (layoutLength - winSize) / (axisCount - axisExpandCount);
  5463. axisCollapseWidth < 3 && (axisCollapseWidth = 0);
  5464. var winInnerIndices = [mathFloor(round2(axisExpandWindow[0] / axisExpandWidth, 1)) + 1, mathCeil(round2(axisExpandWindow[1] / axisExpandWidth, 1)) - 1];
  5465. var axisExpandWindow0Pos = axisCollapseWidth / axisExpandWidth * axisExpandWindow[0];
  5466. return {
  5467. layout: layout2,
  5468. pixelDimIndex,
  5469. layoutBase: rect[xy[pixelDimIndex]],
  5470. layoutLength,
  5471. axisBase: rect[xy[1 - pixelDimIndex]],
  5472. axisLength: rect[wh[1 - pixelDimIndex]],
  5473. axisExpandable,
  5474. axisExpandWidth,
  5475. axisCollapseWidth,
  5476. axisExpandWindow,
  5477. axisCount,
  5478. winInnerIndices,
  5479. axisExpandWindow0Pos
  5480. };
  5481. };
  5482. Parallel2.prototype._layoutAxes = function() {
  5483. var rect = this._rect;
  5484. var axes = this._axesMap;
  5485. var dimensions = this.dimensions;
  5486. var layoutInfo = this._makeLayoutInfo();
  5487. var layout2 = layoutInfo.layout;
  5488. axes.each(function(axis) {
  5489. var axisExtent = [0, layoutInfo.axisLength];
  5490. var idx = axis.inverse ? 1 : 0;
  5491. axis.setExtent(axisExtent[idx], axisExtent[1 - idx]);
  5492. });
  5493. each2(dimensions, function(dim, idx) {
  5494. var posInfo = (layoutInfo.axisExpandable ? layoutAxisWithExpand : layoutAxisWithoutExpand)(idx, layoutInfo);
  5495. var positionTable = {
  5496. horizontal: {
  5497. x: posInfo.position,
  5498. y: layoutInfo.axisLength
  5499. },
  5500. vertical: {
  5501. x: 0,
  5502. y: posInfo.position
  5503. }
  5504. };
  5505. var rotationTable = {
  5506. horizontal: PI2 / 2,
  5507. vertical: 0
  5508. };
  5509. var position = [positionTable[layout2].x + rect.x, positionTable[layout2].y + rect.y];
  5510. var rotation = rotationTable[layout2];
  5511. var transform = create();
  5512. rotate(transform, transform, rotation);
  5513. translate(transform, transform, position);
  5514. this._axesLayout[dim] = {
  5515. position,
  5516. rotation,
  5517. transform,
  5518. axisNameAvailableWidth: posInfo.axisNameAvailableWidth,
  5519. axisLabelShow: posInfo.axisLabelShow,
  5520. nameTruncateMaxWidth: posInfo.nameTruncateMaxWidth,
  5521. tickDirection: 1,
  5522. labelDirection: 1
  5523. };
  5524. }, this);
  5525. };
  5526. Parallel2.prototype.getAxis = function(dim) {
  5527. return this._axesMap.get(dim);
  5528. };
  5529. Parallel2.prototype.dataToPoint = function(value, dim) {
  5530. return this.axisCoordToPoint(this._axesMap.get(dim).dataToCoord(value), dim);
  5531. };
  5532. Parallel2.prototype.eachActiveState = function(data, callback, start, end) {
  5533. start == null && (start = 0);
  5534. end == null && (end = data.count());
  5535. var axesMap = this._axesMap;
  5536. var dimensions = this.dimensions;
  5537. var dataDimensions = [];
  5538. var axisModels = [];
  5539. each(dimensions, function(axisDim) {
  5540. dataDimensions.push(data.mapDimension(axisDim));
  5541. axisModels.push(axesMap.get(axisDim).model);
  5542. });
  5543. var hasActiveSet = this.hasAxisBrushed();
  5544. for (var dataIndex = start; dataIndex < end; dataIndex++) {
  5545. var activeState = void 0;
  5546. if (!hasActiveSet) {
  5547. activeState = "normal";
  5548. } else {
  5549. activeState = "active";
  5550. var values = data.getValues(dataDimensions, dataIndex);
  5551. for (var j = 0, lenj = dimensions.length; j < lenj; j++) {
  5552. var state = axisModels[j].getActiveState(values[j]);
  5553. if (state === "inactive") {
  5554. activeState = "inactive";
  5555. break;
  5556. }
  5557. }
  5558. }
  5559. callback(activeState, dataIndex);
  5560. }
  5561. };
  5562. Parallel2.prototype.hasAxisBrushed = function() {
  5563. var dimensions = this.dimensions;
  5564. var axesMap = this._axesMap;
  5565. var hasActiveSet = false;
  5566. for (var j = 0, lenj = dimensions.length; j < lenj; j++) {
  5567. if (axesMap.get(dimensions[j]).model.getActiveState() !== "normal") {
  5568. hasActiveSet = true;
  5569. }
  5570. }
  5571. return hasActiveSet;
  5572. };
  5573. Parallel2.prototype.axisCoordToPoint = function(coord, dim) {
  5574. var axisLayout = this._axesLayout[dim];
  5575. return applyTransform2([coord, 0], axisLayout.transform);
  5576. };
  5577. Parallel2.prototype.getAxisLayout = function(dim) {
  5578. return clone(this._axesLayout[dim]);
  5579. };
  5580. Parallel2.prototype.getSlidedAxisExpandWindow = function(point) {
  5581. var layoutInfo = this._makeLayoutInfo();
  5582. var pixelDimIndex = layoutInfo.pixelDimIndex;
  5583. var axisExpandWindow = layoutInfo.axisExpandWindow.slice();
  5584. var winSize = axisExpandWindow[1] - axisExpandWindow[0];
  5585. var extent = [0, layoutInfo.axisExpandWidth * (layoutInfo.axisCount - 1)];
  5586. if (!this.containPoint(point)) {
  5587. return {
  5588. behavior: "none",
  5589. axisExpandWindow
  5590. };
  5591. }
  5592. var pointCoord = point[pixelDimIndex] - layoutInfo.layoutBase - layoutInfo.axisExpandWindow0Pos;
  5593. var delta;
  5594. var behavior = "slide";
  5595. var axisCollapseWidth = layoutInfo.axisCollapseWidth;
  5596. var triggerArea = this._model.get("axisExpandSlideTriggerArea");
  5597. var useJump = triggerArea[0] != null;
  5598. if (axisCollapseWidth) {
  5599. if (useJump && axisCollapseWidth && pointCoord < winSize * triggerArea[0]) {
  5600. behavior = "jump";
  5601. delta = pointCoord - winSize * triggerArea[2];
  5602. } else if (useJump && axisCollapseWidth && pointCoord > winSize * (1 - triggerArea[0])) {
  5603. behavior = "jump";
  5604. delta = pointCoord - winSize * (1 - triggerArea[2]);
  5605. } else {
  5606. (delta = pointCoord - winSize * triggerArea[1]) >= 0 && (delta = pointCoord - winSize * (1 - triggerArea[1])) <= 0 && (delta = 0);
  5607. }
  5608. delta *= layoutInfo.axisExpandWidth / axisCollapseWidth;
  5609. delta ? sliderMove(delta, axisExpandWindow, extent, "all") : behavior = "none";
  5610. } else {
  5611. var winSize2 = axisExpandWindow[1] - axisExpandWindow[0];
  5612. var pos = extent[1] * pointCoord / winSize2;
  5613. axisExpandWindow = [mathMax(0, pos - winSize2 / 2)];
  5614. axisExpandWindow[1] = mathMin(extent[1], axisExpandWindow[0] + winSize2);
  5615. axisExpandWindow[0] = axisExpandWindow[1] - winSize2;
  5616. }
  5617. return {
  5618. axisExpandWindow,
  5619. behavior
  5620. };
  5621. };
  5622. return Parallel2;
  5623. }()
  5624. );
  5625. function restrict2(len, extent) {
  5626. return mathMin(mathMax(len, extent[0]), extent[1]);
  5627. }
  5628. function layoutAxisWithoutExpand(axisIndex, layoutInfo) {
  5629. var step = layoutInfo.layoutLength / (layoutInfo.axisCount - 1);
  5630. return {
  5631. position: step * axisIndex,
  5632. axisNameAvailableWidth: step,
  5633. axisLabelShow: true
  5634. };
  5635. }
  5636. function layoutAxisWithExpand(axisIndex, layoutInfo) {
  5637. var layoutLength = layoutInfo.layoutLength;
  5638. var axisExpandWidth = layoutInfo.axisExpandWidth;
  5639. var axisCount = layoutInfo.axisCount;
  5640. var axisCollapseWidth = layoutInfo.axisCollapseWidth;
  5641. var winInnerIndices = layoutInfo.winInnerIndices;
  5642. var position;
  5643. var axisNameAvailableWidth = axisCollapseWidth;
  5644. var axisLabelShow = false;
  5645. var nameTruncateMaxWidth;
  5646. if (axisIndex < winInnerIndices[0]) {
  5647. position = axisIndex * axisCollapseWidth;
  5648. nameTruncateMaxWidth = axisCollapseWidth;
  5649. } else if (axisIndex <= winInnerIndices[1]) {
  5650. position = layoutInfo.axisExpandWindow0Pos + axisIndex * axisExpandWidth - layoutInfo.axisExpandWindow[0];
  5651. axisNameAvailableWidth = axisExpandWidth;
  5652. axisLabelShow = true;
  5653. } else {
  5654. position = layoutLength - (axisCount - 1 - axisIndex) * axisCollapseWidth;
  5655. nameTruncateMaxWidth = axisCollapseWidth;
  5656. }
  5657. return {
  5658. position,
  5659. axisNameAvailableWidth,
  5660. axisLabelShow,
  5661. nameTruncateMaxWidth
  5662. };
  5663. }
  5664. var Parallel_default = Parallel;
  5665. // node_modules/echarts/lib/coord/parallel/parallelCreator.js
  5666. function createParallelCoordSys(ecModel, api) {
  5667. var coordSysList = [];
  5668. ecModel.eachComponent("parallel", function(parallelModel, idx) {
  5669. var coordSys = new Parallel_default(parallelModel, ecModel, api);
  5670. coordSys.name = "parallel_" + idx;
  5671. coordSys.resize(parallelModel, api);
  5672. parallelModel.coordinateSystem = coordSys;
  5673. coordSys.model = parallelModel;
  5674. coordSysList.push(coordSys);
  5675. });
  5676. ecModel.eachSeries(function(seriesModel) {
  5677. if (seriesModel.get("coordinateSystem") === "parallel") {
  5678. var parallelModel = seriesModel.getReferringComponents("parallel", SINGLE_REFERRING).models[0];
  5679. seriesModel.coordinateSystem = parallelModel.coordinateSystem;
  5680. }
  5681. });
  5682. return coordSysList;
  5683. }
  5684. var parallelCoordSysCreator = {
  5685. create: createParallelCoordSys
  5686. };
  5687. var parallelCreator_default = parallelCoordSysCreator;
  5688. // node_modules/echarts/lib/coord/parallel/AxisModel.js
  5689. var ParallelAxisModel = (
  5690. /** @class */
  5691. function(_super) {
  5692. __extends(ParallelAxisModel2, _super);
  5693. function ParallelAxisModel2() {
  5694. var _this = _super !== null && _super.apply(this, arguments) || this;
  5695. _this.type = ParallelAxisModel2.type;
  5696. _this.activeIntervals = [];
  5697. return _this;
  5698. }
  5699. ParallelAxisModel2.prototype.getAreaSelectStyle = function() {
  5700. return makeStyleMapper([
  5701. ["fill", "color"],
  5702. ["lineWidth", "borderWidth"],
  5703. ["stroke", "borderColor"],
  5704. ["width", "width"],
  5705. ["opacity", "opacity"]
  5706. // Option decal is in `DecalObject` but style.decal is in `PatternObject`.
  5707. // So do not transfer decal directly.
  5708. ])(this.getModel("areaSelectStyle"));
  5709. };
  5710. ParallelAxisModel2.prototype.setActiveIntervals = function(intervals) {
  5711. var activeIntervals = this.activeIntervals = clone(intervals);
  5712. if (activeIntervals) {
  5713. for (var i = activeIntervals.length - 1; i >= 0; i--) {
  5714. asc(activeIntervals[i]);
  5715. }
  5716. }
  5717. };
  5718. ParallelAxisModel2.prototype.getActiveState = function(value) {
  5719. var activeIntervals = this.activeIntervals;
  5720. if (!activeIntervals.length) {
  5721. return "normal";
  5722. }
  5723. if (value == null || isNaN(+value)) {
  5724. return "inactive";
  5725. }
  5726. if (activeIntervals.length === 1) {
  5727. var interval = activeIntervals[0];
  5728. if (interval[0] <= value && value <= interval[1]) {
  5729. return "active";
  5730. }
  5731. } else {
  5732. for (var i = 0, len = activeIntervals.length; i < len; i++) {
  5733. if (activeIntervals[i][0] <= value && value <= activeIntervals[i][1]) {
  5734. return "active";
  5735. }
  5736. }
  5737. }
  5738. return "inactive";
  5739. };
  5740. return ParallelAxisModel2;
  5741. }(Component_default)
  5742. );
  5743. mixin(ParallelAxisModel, AxisModelCommonMixin);
  5744. var AxisModel_default = ParallelAxisModel;
  5745. // node_modules/echarts/lib/component/helper/BrushController.js
  5746. var BRUSH_PANEL_GLOBAL = true;
  5747. var mathMin2 = Math.min;
  5748. var mathMax2 = Math.max;
  5749. var mathPow = Math.pow;
  5750. var COVER_Z = 1e4;
  5751. var UNSELECT_THRESHOLD = 6;
  5752. var MIN_RESIZE_LINE_WIDTH = 6;
  5753. var MUTEX_RESOURCE_KEY = "globalPan";
  5754. var DIRECTION_MAP = {
  5755. w: [0, 0],
  5756. e: [0, 1],
  5757. n: [1, 0],
  5758. s: [1, 1]
  5759. };
  5760. var CURSOR_MAP = {
  5761. w: "ew",
  5762. e: "ew",
  5763. n: "ns",
  5764. s: "ns",
  5765. ne: "nesw",
  5766. sw: "nesw",
  5767. nw: "nwse",
  5768. se: "nwse"
  5769. };
  5770. var DEFAULT_BRUSH_OPT = {
  5771. brushStyle: {
  5772. lineWidth: 2,
  5773. stroke: "rgba(210,219,238,0.3)",
  5774. fill: "#D2DBEE"
  5775. },
  5776. transformable: true,
  5777. brushMode: "single",
  5778. removeOnClick: false
  5779. };
  5780. var baseUID = 0;
  5781. var BrushController = (
  5782. /** @class */
  5783. function(_super) {
  5784. __extends(BrushController2, _super);
  5785. function BrushController2(zr) {
  5786. var _this = _super.call(this) || this;
  5787. _this._track = [];
  5788. _this._covers = [];
  5789. _this._handlers = {};
  5790. if (true) {
  5791. assert(zr);
  5792. }
  5793. _this._zr = zr;
  5794. _this.group = new Group_default();
  5795. _this._uid = "brushController_" + baseUID++;
  5796. each(pointerHandlers, function(handler, eventName) {
  5797. this._handlers[eventName] = bind(handler, this);
  5798. }, _this);
  5799. return _this;
  5800. }
  5801. BrushController2.prototype.enableBrush = function(brushOption) {
  5802. if (true) {
  5803. assert(this._mounted);
  5804. }
  5805. this._brushType && this._doDisableBrush();
  5806. brushOption.brushType && this._doEnableBrush(brushOption);
  5807. return this;
  5808. };
  5809. BrushController2.prototype._doEnableBrush = function(brushOption) {
  5810. var zr = this._zr;
  5811. if (!this._enableGlobalPan) {
  5812. take(zr, MUTEX_RESOURCE_KEY, this._uid);
  5813. }
  5814. each(this._handlers, function(handler, eventName) {
  5815. zr.on(eventName, handler);
  5816. });
  5817. this._brushType = brushOption.brushType;
  5818. this._brushOption = merge(clone(DEFAULT_BRUSH_OPT), brushOption, true);
  5819. };
  5820. BrushController2.prototype._doDisableBrush = function() {
  5821. var zr = this._zr;
  5822. release(zr, MUTEX_RESOURCE_KEY, this._uid);
  5823. each(this._handlers, function(handler, eventName) {
  5824. zr.off(eventName, handler);
  5825. });
  5826. this._brushType = this._brushOption = null;
  5827. };
  5828. BrushController2.prototype.setPanels = function(panelOpts) {
  5829. if (panelOpts && panelOpts.length) {
  5830. var panels_1 = this._panels = {};
  5831. each(panelOpts, function(panelOpts2) {
  5832. panels_1[panelOpts2.panelId] = clone(panelOpts2);
  5833. });
  5834. } else {
  5835. this._panels = null;
  5836. }
  5837. return this;
  5838. };
  5839. BrushController2.prototype.mount = function(opt) {
  5840. opt = opt || {};
  5841. if (true) {
  5842. this._mounted = true;
  5843. }
  5844. this._enableGlobalPan = opt.enableGlobalPan;
  5845. var thisGroup = this.group;
  5846. this._zr.add(thisGroup);
  5847. thisGroup.attr({
  5848. x: opt.x || 0,
  5849. y: opt.y || 0,
  5850. rotation: opt.rotation || 0,
  5851. scaleX: opt.scaleX || 1,
  5852. scaleY: opt.scaleY || 1
  5853. });
  5854. this._transform = thisGroup.getLocalTransform();
  5855. return this;
  5856. };
  5857. BrushController2.prototype.updateCovers = function(coverConfigList) {
  5858. if (true) {
  5859. assert(this._mounted);
  5860. }
  5861. coverConfigList = map(coverConfigList, function(coverConfig) {
  5862. return merge(clone(DEFAULT_BRUSH_OPT), coverConfig, true);
  5863. });
  5864. var tmpIdPrefix = "\0-brush-index-";
  5865. var oldCovers = this._covers;
  5866. var newCovers = this._covers = [];
  5867. var controller = this;
  5868. var creatingCover = this._creatingCover;
  5869. new DataDiffer_default(oldCovers, coverConfigList, oldGetKey, getKey).add(addOrUpdate).update(addOrUpdate).remove(remove).execute();
  5870. return this;
  5871. function getKey(brushOption, index) {
  5872. return (brushOption.id != null ? brushOption.id : tmpIdPrefix + index) + "-" + brushOption.brushType;
  5873. }
  5874. function oldGetKey(cover, index) {
  5875. return getKey(cover.__brushOption, index);
  5876. }
  5877. function addOrUpdate(newIndex, oldIndex) {
  5878. var newBrushInternal = coverConfigList[newIndex];
  5879. if (oldIndex != null && oldCovers[oldIndex] === creatingCover) {
  5880. newCovers[newIndex] = oldCovers[oldIndex];
  5881. } else {
  5882. var cover = newCovers[newIndex] = oldIndex != null ? (oldCovers[oldIndex].__brushOption = newBrushInternal, oldCovers[oldIndex]) : endCreating(controller, createCover(controller, newBrushInternal));
  5883. updateCoverAfterCreation(controller, cover);
  5884. }
  5885. }
  5886. function remove(oldIndex) {
  5887. if (oldCovers[oldIndex] !== creatingCover) {
  5888. controller.group.remove(oldCovers[oldIndex]);
  5889. }
  5890. }
  5891. };
  5892. BrushController2.prototype.unmount = function() {
  5893. if (true) {
  5894. if (!this._mounted) {
  5895. return;
  5896. }
  5897. }
  5898. this.enableBrush(false);
  5899. clearCovers(this);
  5900. this._zr.remove(this.group);
  5901. if (true) {
  5902. this._mounted = false;
  5903. }
  5904. return this;
  5905. };
  5906. BrushController2.prototype.dispose = function() {
  5907. this.unmount();
  5908. this.off();
  5909. };
  5910. return BrushController2;
  5911. }(Eventful_default)
  5912. );
  5913. function createCover(controller, brushOption) {
  5914. var cover = coverRenderers[brushOption.brushType].createCover(controller, brushOption);
  5915. cover.__brushOption = brushOption;
  5916. updateZ(cover, brushOption);
  5917. controller.group.add(cover);
  5918. return cover;
  5919. }
  5920. function endCreating(controller, creatingCover) {
  5921. var coverRenderer = getCoverRenderer(creatingCover);
  5922. if (coverRenderer.endCreating) {
  5923. coverRenderer.endCreating(controller, creatingCover);
  5924. updateZ(creatingCover, creatingCover.__brushOption);
  5925. }
  5926. return creatingCover;
  5927. }
  5928. function updateCoverShape(controller, cover) {
  5929. var brushOption = cover.__brushOption;
  5930. getCoverRenderer(cover).updateCoverShape(controller, cover, brushOption.range, brushOption);
  5931. }
  5932. function updateZ(cover, brushOption) {
  5933. var z = brushOption.z;
  5934. z == null && (z = COVER_Z);
  5935. cover.traverse(function(el) {
  5936. el.z = z;
  5937. el.z2 = z;
  5938. });
  5939. }
  5940. function updateCoverAfterCreation(controller, cover) {
  5941. getCoverRenderer(cover).updateCommon(controller, cover);
  5942. updateCoverShape(controller, cover);
  5943. }
  5944. function getCoverRenderer(cover) {
  5945. return coverRenderers[cover.__brushOption.brushType];
  5946. }
  5947. function getPanelByPoint(controller, e, localCursorPoint) {
  5948. var panels = controller._panels;
  5949. if (!panels) {
  5950. return BRUSH_PANEL_GLOBAL;
  5951. }
  5952. var panel;
  5953. var transform = controller._transform;
  5954. each(panels, function(pn) {
  5955. pn.isTargetByCursor(e, localCursorPoint, transform) && (panel = pn);
  5956. });
  5957. return panel;
  5958. }
  5959. function getPanelByCover(controller, cover) {
  5960. var panels = controller._panels;
  5961. if (!panels) {
  5962. return BRUSH_PANEL_GLOBAL;
  5963. }
  5964. var panelId = cover.__brushOption.panelId;
  5965. return panelId != null ? panels[panelId] : BRUSH_PANEL_GLOBAL;
  5966. }
  5967. function clearCovers(controller) {
  5968. var covers = controller._covers;
  5969. var originalLength = covers.length;
  5970. each(covers, function(cover) {
  5971. controller.group.remove(cover);
  5972. }, controller);
  5973. covers.length = 0;
  5974. return !!originalLength;
  5975. }
  5976. function trigger2(controller, opt) {
  5977. var areas = map(controller._covers, function(cover) {
  5978. var brushOption = cover.__brushOption;
  5979. var range = clone(brushOption.range);
  5980. return {
  5981. brushType: brushOption.brushType,
  5982. panelId: brushOption.panelId,
  5983. range
  5984. };
  5985. });
  5986. controller.trigger("brush", {
  5987. areas,
  5988. isEnd: !!opt.isEnd,
  5989. removeOnClick: !!opt.removeOnClick
  5990. });
  5991. }
  5992. function shouldShowCover(controller) {
  5993. var track = controller._track;
  5994. if (!track.length) {
  5995. return false;
  5996. }
  5997. var p2 = track[track.length - 1];
  5998. var p1 = track[0];
  5999. var dx = p2[0] - p1[0];
  6000. var dy = p2[1] - p1[1];
  6001. var dist = mathPow(dx * dx + dy * dy, 0.5);
  6002. return dist > UNSELECT_THRESHOLD;
  6003. }
  6004. function getTrackEnds(track) {
  6005. var tail = track.length - 1;
  6006. tail < 0 && (tail = 0);
  6007. return [track[0], track[tail]];
  6008. }
  6009. function createBaseRectCover(rectRangeConverter, controller, brushOption, edgeNameSequences) {
  6010. var cover = new Group_default();
  6011. cover.add(new Rect_default({
  6012. name: "main",
  6013. style: makeStyle(brushOption),
  6014. silent: true,
  6015. draggable: true,
  6016. cursor: "move",
  6017. drift: curry(driftRect, rectRangeConverter, controller, cover, ["n", "s", "w", "e"]),
  6018. ondragend: curry(trigger2, controller, {
  6019. isEnd: true
  6020. })
  6021. }));
  6022. each(edgeNameSequences, function(nameSequence) {
  6023. cover.add(new Rect_default({
  6024. name: nameSequence.join(""),
  6025. style: {
  6026. opacity: 0
  6027. },
  6028. draggable: true,
  6029. silent: true,
  6030. invisible: true,
  6031. drift: curry(driftRect, rectRangeConverter, controller, cover, nameSequence),
  6032. ondragend: curry(trigger2, controller, {
  6033. isEnd: true
  6034. })
  6035. }));
  6036. });
  6037. return cover;
  6038. }
  6039. function updateBaseRect(controller, cover, localRange, brushOption) {
  6040. var lineWidth = brushOption.brushStyle.lineWidth || 0;
  6041. var handleSize = mathMax2(lineWidth, MIN_RESIZE_LINE_WIDTH);
  6042. var x = localRange[0][0];
  6043. var y = localRange[1][0];
  6044. var xa = x - lineWidth / 2;
  6045. var ya = y - lineWidth / 2;
  6046. var x2 = localRange[0][1];
  6047. var y2 = localRange[1][1];
  6048. var x2a = x2 - handleSize + lineWidth / 2;
  6049. var y2a = y2 - handleSize + lineWidth / 2;
  6050. var width = x2 - x;
  6051. var height = y2 - y;
  6052. var widtha = width + lineWidth;
  6053. var heighta = height + lineWidth;
  6054. updateRectShape(controller, cover, "main", x, y, width, height);
  6055. if (brushOption.transformable) {
  6056. updateRectShape(controller, cover, "w", xa, ya, handleSize, heighta);
  6057. updateRectShape(controller, cover, "e", x2a, ya, handleSize, heighta);
  6058. updateRectShape(controller, cover, "n", xa, ya, widtha, handleSize);
  6059. updateRectShape(controller, cover, "s", xa, y2a, widtha, handleSize);
  6060. updateRectShape(controller, cover, "nw", xa, ya, handleSize, handleSize);
  6061. updateRectShape(controller, cover, "ne", x2a, ya, handleSize, handleSize);
  6062. updateRectShape(controller, cover, "sw", xa, y2a, handleSize, handleSize);
  6063. updateRectShape(controller, cover, "se", x2a, y2a, handleSize, handleSize);
  6064. }
  6065. }
  6066. function updateCommon(controller, cover) {
  6067. var brushOption = cover.__brushOption;
  6068. var transformable = brushOption.transformable;
  6069. var mainEl = cover.childAt(0);
  6070. mainEl.useStyle(makeStyle(brushOption));
  6071. mainEl.attr({
  6072. silent: !transformable,
  6073. cursor: transformable ? "move" : "default"
  6074. });
  6075. each([["w"], ["e"], ["n"], ["s"], ["s", "e"], ["s", "w"], ["n", "e"], ["n", "w"]], function(nameSequence) {
  6076. var el = cover.childOfName(nameSequence.join(""));
  6077. var globalDir = nameSequence.length === 1 ? getGlobalDirection1(controller, nameSequence[0]) : getGlobalDirection2(controller, nameSequence);
  6078. el && el.attr({
  6079. silent: !transformable,
  6080. invisible: !transformable,
  6081. cursor: transformable ? CURSOR_MAP[globalDir] + "-resize" : null
  6082. });
  6083. });
  6084. }
  6085. function updateRectShape(controller, cover, name, x, y, w, h) {
  6086. var el = cover.childOfName(name);
  6087. el && el.setShape(pointsToRect(clipByPanel(controller, cover, [[x, y], [x + w, y + h]])));
  6088. }
  6089. function makeStyle(brushOption) {
  6090. return defaults({
  6091. strokeNoScale: true
  6092. }, brushOption.brushStyle);
  6093. }
  6094. function formatRectRange(x, y, x2, y2) {
  6095. var min2 = [mathMin2(x, x2), mathMin2(y, y2)];
  6096. var max2 = [mathMax2(x, x2), mathMax2(y, y2)];
  6097. return [
  6098. [min2[0], max2[0]],
  6099. [min2[1], max2[1]]
  6100. // y range
  6101. ];
  6102. }
  6103. function getTransform2(controller) {
  6104. return getTransform(controller.group);
  6105. }
  6106. function getGlobalDirection1(controller, localDirName) {
  6107. var map2 = {
  6108. w: "left",
  6109. e: "right",
  6110. n: "top",
  6111. s: "bottom"
  6112. };
  6113. var inverseMap = {
  6114. left: "w",
  6115. right: "e",
  6116. top: "n",
  6117. bottom: "s"
  6118. };
  6119. var dir = transformDirection(map2[localDirName], getTransform2(controller));
  6120. return inverseMap[dir];
  6121. }
  6122. function getGlobalDirection2(controller, localDirNameSeq) {
  6123. var globalDir = [getGlobalDirection1(controller, localDirNameSeq[0]), getGlobalDirection1(controller, localDirNameSeq[1])];
  6124. (globalDir[0] === "e" || globalDir[0] === "w") && globalDir.reverse();
  6125. return globalDir.join("");
  6126. }
  6127. function driftRect(rectRangeConverter, controller, cover, dirNameSequence, dx, dy) {
  6128. var brushOption = cover.__brushOption;
  6129. var rectRange = rectRangeConverter.toRectRange(brushOption.range);
  6130. var localDelta = toLocalDelta(controller, dx, dy);
  6131. each(dirNameSequence, function(dirName) {
  6132. var ind = DIRECTION_MAP[dirName];
  6133. rectRange[ind[0]][ind[1]] += localDelta[ind[0]];
  6134. });
  6135. brushOption.range = rectRangeConverter.fromRectRange(formatRectRange(rectRange[0][0], rectRange[1][0], rectRange[0][1], rectRange[1][1]));
  6136. updateCoverAfterCreation(controller, cover);
  6137. trigger2(controller, {
  6138. isEnd: false
  6139. });
  6140. }
  6141. function driftPolygon(controller, cover, dx, dy) {
  6142. var range = cover.__brushOption.range;
  6143. var localDelta = toLocalDelta(controller, dx, dy);
  6144. each(range, function(point) {
  6145. point[0] += localDelta[0];
  6146. point[1] += localDelta[1];
  6147. });
  6148. updateCoverAfterCreation(controller, cover);
  6149. trigger2(controller, {
  6150. isEnd: false
  6151. });
  6152. }
  6153. function toLocalDelta(controller, dx, dy) {
  6154. var thisGroup = controller.group;
  6155. var localD = thisGroup.transformCoordToLocal(dx, dy);
  6156. var localZero = thisGroup.transformCoordToLocal(0, 0);
  6157. return [localD[0] - localZero[0], localD[1] - localZero[1]];
  6158. }
  6159. function clipByPanel(controller, cover, data) {
  6160. var panel = getPanelByCover(controller, cover);
  6161. return panel && panel !== BRUSH_PANEL_GLOBAL ? panel.clipPath(data, controller._transform) : clone(data);
  6162. }
  6163. function pointsToRect(points3) {
  6164. var xmin = mathMin2(points3[0][0], points3[1][0]);
  6165. var ymin = mathMin2(points3[0][1], points3[1][1]);
  6166. var xmax = mathMax2(points3[0][0], points3[1][0]);
  6167. var ymax = mathMax2(points3[0][1], points3[1][1]);
  6168. return {
  6169. x: xmin,
  6170. y: ymin,
  6171. width: xmax - xmin,
  6172. height: ymax - ymin
  6173. };
  6174. }
  6175. function resetCursor(controller, e, localCursorPoint) {
  6176. if (
  6177. // Check active
  6178. !controller._brushType || isOutsideZrArea(controller, e.offsetX, e.offsetY)
  6179. ) {
  6180. return;
  6181. }
  6182. var zr = controller._zr;
  6183. var covers = controller._covers;
  6184. var currPanel = getPanelByPoint(controller, e, localCursorPoint);
  6185. if (!controller._dragging) {
  6186. for (var i = 0; i < covers.length; i++) {
  6187. var brushOption = covers[i].__brushOption;
  6188. if (currPanel && (currPanel === BRUSH_PANEL_GLOBAL || brushOption.panelId === currPanel.panelId) && coverRenderers[brushOption.brushType].contain(covers[i], localCursorPoint[0], localCursorPoint[1])) {
  6189. return;
  6190. }
  6191. }
  6192. }
  6193. currPanel && zr.setCursorStyle("crosshair");
  6194. }
  6195. function preventDefault(e) {
  6196. var rawE = e.event;
  6197. rawE.preventDefault && rawE.preventDefault();
  6198. }
  6199. function mainShapeContain(cover, x, y) {
  6200. return cover.childOfName("main").contain(x, y);
  6201. }
  6202. function updateCoverByMouse(controller, e, localCursorPoint, isEnd) {
  6203. var creatingCover = controller._creatingCover;
  6204. var panel = controller._creatingPanel;
  6205. var thisBrushOption = controller._brushOption;
  6206. var eventParams;
  6207. controller._track.push(localCursorPoint.slice());
  6208. if (shouldShowCover(controller) || creatingCover) {
  6209. if (panel && !creatingCover) {
  6210. thisBrushOption.brushMode === "single" && clearCovers(controller);
  6211. var brushOption = clone(thisBrushOption);
  6212. brushOption.brushType = determineBrushType(brushOption.brushType, panel);
  6213. brushOption.panelId = panel === BRUSH_PANEL_GLOBAL ? null : panel.panelId;
  6214. creatingCover = controller._creatingCover = createCover(controller, brushOption);
  6215. controller._covers.push(creatingCover);
  6216. }
  6217. if (creatingCover) {
  6218. var coverRenderer = coverRenderers[determineBrushType(controller._brushType, panel)];
  6219. var coverBrushOption = creatingCover.__brushOption;
  6220. coverBrushOption.range = coverRenderer.getCreatingRange(clipByPanel(controller, creatingCover, controller._track));
  6221. if (isEnd) {
  6222. endCreating(controller, creatingCover);
  6223. coverRenderer.updateCommon(controller, creatingCover);
  6224. }
  6225. updateCoverShape(controller, creatingCover);
  6226. eventParams = {
  6227. isEnd
  6228. };
  6229. }
  6230. } else if (isEnd && thisBrushOption.brushMode === "single" && thisBrushOption.removeOnClick) {
  6231. if (getPanelByPoint(controller, e, localCursorPoint) && clearCovers(controller)) {
  6232. eventParams = {
  6233. isEnd,
  6234. removeOnClick: true
  6235. };
  6236. }
  6237. }
  6238. return eventParams;
  6239. }
  6240. function determineBrushType(brushType, panel) {
  6241. if (brushType === "auto") {
  6242. if (true) {
  6243. assert(panel && panel.defaultBrushType, 'MUST have defaultBrushType when brushType is "atuo"');
  6244. }
  6245. return panel.defaultBrushType;
  6246. }
  6247. return brushType;
  6248. }
  6249. var pointerHandlers = {
  6250. mousedown: function(e) {
  6251. if (this._dragging) {
  6252. handleDragEnd(this, e);
  6253. } else if (!e.target || !e.target.draggable) {
  6254. preventDefault(e);
  6255. var localCursorPoint = this.group.transformCoordToLocal(e.offsetX, e.offsetY);
  6256. this._creatingCover = null;
  6257. var panel = this._creatingPanel = getPanelByPoint(this, e, localCursorPoint);
  6258. if (panel) {
  6259. this._dragging = true;
  6260. this._track = [localCursorPoint.slice()];
  6261. }
  6262. }
  6263. },
  6264. mousemove: function(e) {
  6265. var x = e.offsetX;
  6266. var y = e.offsetY;
  6267. var localCursorPoint = this.group.transformCoordToLocal(x, y);
  6268. resetCursor(this, e, localCursorPoint);
  6269. if (this._dragging) {
  6270. preventDefault(e);
  6271. var eventParams = updateCoverByMouse(this, e, localCursorPoint, false);
  6272. eventParams && trigger2(this, eventParams);
  6273. }
  6274. },
  6275. mouseup: function(e) {
  6276. handleDragEnd(this, e);
  6277. }
  6278. };
  6279. function handleDragEnd(controller, e) {
  6280. if (controller._dragging) {
  6281. preventDefault(e);
  6282. var x = e.offsetX;
  6283. var y = e.offsetY;
  6284. var localCursorPoint = controller.group.transformCoordToLocal(x, y);
  6285. var eventParams = updateCoverByMouse(controller, e, localCursorPoint, true);
  6286. controller._dragging = false;
  6287. controller._track = [];
  6288. controller._creatingCover = null;
  6289. eventParams && trigger2(controller, eventParams);
  6290. }
  6291. }
  6292. function isOutsideZrArea(controller, x, y) {
  6293. var zr = controller._zr;
  6294. return x < 0 || x > zr.getWidth() || y < 0 || y > zr.getHeight();
  6295. }
  6296. var coverRenderers = {
  6297. lineX: getLineRenderer(0),
  6298. lineY: getLineRenderer(1),
  6299. rect: {
  6300. createCover: function(controller, brushOption) {
  6301. function returnInput(range) {
  6302. return range;
  6303. }
  6304. return createBaseRectCover({
  6305. toRectRange: returnInput,
  6306. fromRectRange: returnInput
  6307. }, controller, brushOption, [["w"], ["e"], ["n"], ["s"], ["s", "e"], ["s", "w"], ["n", "e"], ["n", "w"]]);
  6308. },
  6309. getCreatingRange: function(localTrack) {
  6310. var ends = getTrackEnds(localTrack);
  6311. return formatRectRange(ends[1][0], ends[1][1], ends[0][0], ends[0][1]);
  6312. },
  6313. updateCoverShape: function(controller, cover, localRange, brushOption) {
  6314. updateBaseRect(controller, cover, localRange, brushOption);
  6315. },
  6316. updateCommon,
  6317. contain: mainShapeContain
  6318. },
  6319. polygon: {
  6320. createCover: function(controller, brushOption) {
  6321. var cover = new Group_default();
  6322. cover.add(new Polyline_default({
  6323. name: "main",
  6324. style: makeStyle(brushOption),
  6325. silent: true
  6326. }));
  6327. return cover;
  6328. },
  6329. getCreatingRange: function(localTrack) {
  6330. return localTrack;
  6331. },
  6332. endCreating: function(controller, cover) {
  6333. cover.remove(cover.childAt(0));
  6334. cover.add(new Polygon_default({
  6335. name: "main",
  6336. draggable: true,
  6337. drift: curry(driftPolygon, controller, cover),
  6338. ondragend: curry(trigger2, controller, {
  6339. isEnd: true
  6340. })
  6341. }));
  6342. },
  6343. updateCoverShape: function(controller, cover, localRange, brushOption) {
  6344. cover.childAt(0).setShape({
  6345. points: clipByPanel(controller, cover, localRange)
  6346. });
  6347. },
  6348. updateCommon,
  6349. contain: mainShapeContain
  6350. }
  6351. };
  6352. function getLineRenderer(xyIndex) {
  6353. return {
  6354. createCover: function(controller, brushOption) {
  6355. return createBaseRectCover({
  6356. toRectRange: function(range) {
  6357. var rectRange = [range, [0, 100]];
  6358. xyIndex && rectRange.reverse();
  6359. return rectRange;
  6360. },
  6361. fromRectRange: function(rectRange) {
  6362. return rectRange[xyIndex];
  6363. }
  6364. }, controller, brushOption, [[["w"], ["e"]], [["n"], ["s"]]][xyIndex]);
  6365. },
  6366. getCreatingRange: function(localTrack) {
  6367. var ends = getTrackEnds(localTrack);
  6368. var min2 = mathMin2(ends[0][xyIndex], ends[1][xyIndex]);
  6369. var max2 = mathMax2(ends[0][xyIndex], ends[1][xyIndex]);
  6370. return [min2, max2];
  6371. },
  6372. updateCoverShape: function(controller, cover, localRange, brushOption) {
  6373. var otherExtent;
  6374. var panel = getPanelByCover(controller, cover);
  6375. if (panel !== BRUSH_PANEL_GLOBAL && panel.getLinearBrushOtherExtent) {
  6376. otherExtent = panel.getLinearBrushOtherExtent(xyIndex);
  6377. } else {
  6378. var zr = controller._zr;
  6379. otherExtent = [0, [zr.getWidth(), zr.getHeight()][1 - xyIndex]];
  6380. }
  6381. var rectRange = [localRange, otherExtent];
  6382. xyIndex && rectRange.reverse();
  6383. updateBaseRect(controller, cover, rectRange, brushOption);
  6384. },
  6385. updateCommon,
  6386. contain: mainShapeContain
  6387. };
  6388. }
  6389. var BrushController_default = BrushController;
  6390. // node_modules/echarts/lib/component/helper/brushHelper.js
  6391. function makeRectPanelClipPath(rect) {
  6392. rect = normalizeRect(rect);
  6393. return function(localPoints) {
  6394. return clipPointsByRect(localPoints, rect);
  6395. };
  6396. }
  6397. function makeLinearBrushOtherExtent(rect, specifiedXYIndex) {
  6398. rect = normalizeRect(rect);
  6399. return function(xyIndex) {
  6400. var idx = specifiedXYIndex != null ? specifiedXYIndex : xyIndex;
  6401. var brushWidth = idx ? rect.width : rect.height;
  6402. var base = idx ? rect.x : rect.y;
  6403. return [base, base + (brushWidth || 0)];
  6404. };
  6405. }
  6406. function makeRectIsTargetByCursor(rect, api, targetModel) {
  6407. var boundingRect = normalizeRect(rect);
  6408. return function(e, localCursorPoint) {
  6409. return boundingRect.contain(localCursorPoint[0], localCursorPoint[1]) && !onIrrelevantElement(e, api, targetModel);
  6410. };
  6411. }
  6412. function normalizeRect(rect) {
  6413. return BoundingRect_default.create(rect);
  6414. }
  6415. // node_modules/echarts/lib/component/axis/ParallelAxisView.js
  6416. var elementList = ["axisLine", "axisTickLabel", "axisName"];
  6417. var ParallelAxisView = (
  6418. /** @class */
  6419. function(_super) {
  6420. __extends(ParallelAxisView2, _super);
  6421. function ParallelAxisView2() {
  6422. var _this = _super !== null && _super.apply(this, arguments) || this;
  6423. _this.type = ParallelAxisView2.type;
  6424. return _this;
  6425. }
  6426. ParallelAxisView2.prototype.init = function(ecModel, api) {
  6427. _super.prototype.init.apply(this, arguments);
  6428. (this._brushController = new BrushController_default(api.getZr())).on("brush", bind(this._onBrush, this));
  6429. };
  6430. ParallelAxisView2.prototype.render = function(axisModel, ecModel, api, payload) {
  6431. if (fromAxisAreaSelect(axisModel, ecModel, payload)) {
  6432. return;
  6433. }
  6434. this.axisModel = axisModel;
  6435. this.api = api;
  6436. this.group.removeAll();
  6437. var oldAxisGroup = this._axisGroup;
  6438. this._axisGroup = new Group_default();
  6439. this.group.add(this._axisGroup);
  6440. if (!axisModel.get("show")) {
  6441. return;
  6442. }
  6443. var coordSysModel = getCoordSysModel(axisModel, ecModel);
  6444. var coordSys = coordSysModel.coordinateSystem;
  6445. var areaSelectStyle = axisModel.getAreaSelectStyle();
  6446. var areaWidth = areaSelectStyle.width;
  6447. var dim = axisModel.axis.dim;
  6448. var axisLayout = coordSys.getAxisLayout(dim);
  6449. var builderOpt = extend({
  6450. strokeContainThreshold: areaWidth
  6451. }, axisLayout);
  6452. var axisBuilder = new AxisBuilder_default(axisModel, builderOpt);
  6453. each(elementList, axisBuilder.add, axisBuilder);
  6454. this._axisGroup.add(axisBuilder.getGroup());
  6455. this._refreshBrushController(builderOpt, areaSelectStyle, axisModel, coordSysModel, areaWidth, api);
  6456. groupTransition(oldAxisGroup, this._axisGroup, axisModel);
  6457. };
  6458. ParallelAxisView2.prototype._refreshBrushController = function(builderOpt, areaSelectStyle, axisModel, coordSysModel, areaWidth, api) {
  6459. var extent = axisModel.axis.getExtent();
  6460. var extentLen = extent[1] - extent[0];
  6461. var extra = Math.min(30, Math.abs(extentLen) * 0.1);
  6462. var rect = BoundingRect_default.create({
  6463. x: extent[0],
  6464. y: -areaWidth / 2,
  6465. width: extentLen,
  6466. height: areaWidth
  6467. });
  6468. rect.x -= extra;
  6469. rect.width += 2 * extra;
  6470. this._brushController.mount({
  6471. enableGlobalPan: true,
  6472. rotation: builderOpt.rotation,
  6473. x: builderOpt.position[0],
  6474. y: builderOpt.position[1]
  6475. }).setPanels([{
  6476. panelId: "pl",
  6477. clipPath: makeRectPanelClipPath(rect),
  6478. isTargetByCursor: makeRectIsTargetByCursor(rect, api, coordSysModel),
  6479. getLinearBrushOtherExtent: makeLinearBrushOtherExtent(rect, 0)
  6480. }]).enableBrush({
  6481. brushType: "lineX",
  6482. brushStyle: areaSelectStyle,
  6483. removeOnClick: true
  6484. }).updateCovers(getCoverInfoList(axisModel));
  6485. };
  6486. ParallelAxisView2.prototype._onBrush = function(eventParam) {
  6487. var coverInfoList = eventParam.areas;
  6488. var axisModel = this.axisModel;
  6489. var axis = axisModel.axis;
  6490. var intervals = map(coverInfoList, function(coverInfo) {
  6491. return [axis.coordToData(coverInfo.range[0], true), axis.coordToData(coverInfo.range[1], true)];
  6492. });
  6493. if (!axisModel.option.realtime === eventParam.isEnd || eventParam.removeOnClick) {
  6494. this.api.dispatchAction({
  6495. type: "axisAreaSelect",
  6496. parallelAxisId: axisModel.id,
  6497. intervals
  6498. });
  6499. }
  6500. };
  6501. ParallelAxisView2.prototype.dispose = function() {
  6502. this._brushController.dispose();
  6503. };
  6504. ParallelAxisView2.type = "parallelAxis";
  6505. return ParallelAxisView2;
  6506. }(Component_default2)
  6507. );
  6508. function fromAxisAreaSelect(axisModel, ecModel, payload) {
  6509. return payload && payload.type === "axisAreaSelect" && ecModel.findComponents({
  6510. mainType: "parallelAxis",
  6511. query: payload
  6512. })[0] === axisModel;
  6513. }
  6514. function getCoverInfoList(axisModel) {
  6515. var axis = axisModel.axis;
  6516. return map(axisModel.activeIntervals, function(interval) {
  6517. return {
  6518. brushType: "lineX",
  6519. panelId: "pl",
  6520. range: [axis.dataToCoord(interval[0], true), axis.dataToCoord(interval[1], true)]
  6521. };
  6522. });
  6523. }
  6524. function getCoordSysModel(axisModel, ecModel) {
  6525. return ecModel.getComponent("parallel", axisModel.get("parallelIndex"));
  6526. }
  6527. var ParallelAxisView_default = ParallelAxisView;
  6528. // node_modules/echarts/lib/component/axis/parallelAxisAction.js
  6529. var actionInfo = {
  6530. type: "axisAreaSelect",
  6531. event: "axisAreaSelected"
  6532. // update: 'updateVisual'
  6533. };
  6534. function installParallelActions(registers) {
  6535. registers.registerAction(actionInfo, function(payload, ecModel) {
  6536. ecModel.eachComponent({
  6537. mainType: "parallelAxis",
  6538. query: payload
  6539. }, function(parallelAxisModel) {
  6540. parallelAxisModel.axis.model.setActiveIntervals(payload.intervals);
  6541. });
  6542. });
  6543. registers.registerAction("parallelAxisExpand", function(payload, ecModel) {
  6544. ecModel.eachComponent({
  6545. mainType: "parallel",
  6546. query: payload
  6547. }, function(parallelModel) {
  6548. parallelModel.setAxisExpand(payload);
  6549. });
  6550. });
  6551. }
  6552. // node_modules/echarts/lib/component/parallel/install.js
  6553. var defaultAxisOption = {
  6554. type: "value",
  6555. areaSelectStyle: {
  6556. width: 20,
  6557. borderWidth: 1,
  6558. borderColor: "rgba(160,197,232)",
  6559. color: "rgba(160,197,232)",
  6560. opacity: 0.3
  6561. },
  6562. realtime: true,
  6563. z: 10
  6564. };
  6565. function install4(registers) {
  6566. registers.registerComponentView(ParallelView_default);
  6567. registers.registerComponentModel(ParallelModel_default);
  6568. registers.registerCoordinateSystem("parallel", parallelCreator_default);
  6569. registers.registerPreprocessor(parallelPreprocessor);
  6570. registers.registerComponentModel(AxisModel_default);
  6571. registers.registerComponentView(ParallelAxisView_default);
  6572. axisModelCreator(registers, "parallel", AxisModel_default, defaultAxisOption);
  6573. installParallelActions(registers);
  6574. }
  6575. // node_modules/echarts/lib/util/styleCompat.js
  6576. var deprecatedLogs = {};
  6577. function isEC4CompatibleStyle(style, elType, hasOwnTextContentOption, hasOwnTextConfig) {
  6578. return style && (style.legacy || style.legacy !== false && !hasOwnTextContentOption && !hasOwnTextConfig && elType !== "tspan" && (elType === "text" || hasOwn(style, "text")));
  6579. }
  6580. function convertFromEC4CompatibleStyle(hostStyle, elType, isNormal) {
  6581. var srcStyle = hostStyle;
  6582. var textConfig;
  6583. var textContent;
  6584. var textContentStyle;
  6585. if (elType === "text") {
  6586. textContentStyle = srcStyle;
  6587. } else {
  6588. textContentStyle = {};
  6589. hasOwn(srcStyle, "text") && (textContentStyle.text = srcStyle.text);
  6590. hasOwn(srcStyle, "rich") && (textContentStyle.rich = srcStyle.rich);
  6591. hasOwn(srcStyle, "textFill") && (textContentStyle.fill = srcStyle.textFill);
  6592. hasOwn(srcStyle, "textStroke") && (textContentStyle.stroke = srcStyle.textStroke);
  6593. hasOwn(srcStyle, "fontFamily") && (textContentStyle.fontFamily = srcStyle.fontFamily);
  6594. hasOwn(srcStyle, "fontSize") && (textContentStyle.fontSize = srcStyle.fontSize);
  6595. hasOwn(srcStyle, "fontStyle") && (textContentStyle.fontStyle = srcStyle.fontStyle);
  6596. hasOwn(srcStyle, "fontWeight") && (textContentStyle.fontWeight = srcStyle.fontWeight);
  6597. textContent = {
  6598. type: "text",
  6599. style: textContentStyle,
  6600. // ec4 does not support rectText trigger.
  6601. // And when text position is different in normal and emphasis
  6602. // => hover text trigger emphasis;
  6603. // => text position changed, leave mouse pointer immediately;
  6604. // That might cause incorrect state.
  6605. silent: true
  6606. };
  6607. textConfig = {};
  6608. var hasOwnPos = hasOwn(srcStyle, "textPosition");
  6609. if (isNormal) {
  6610. textConfig.position = hasOwnPos ? srcStyle.textPosition : "inside";
  6611. } else {
  6612. hasOwnPos && (textConfig.position = srcStyle.textPosition);
  6613. }
  6614. hasOwn(srcStyle, "textPosition") && (textConfig.position = srcStyle.textPosition);
  6615. hasOwn(srcStyle, "textOffset") && (textConfig.offset = srcStyle.textOffset);
  6616. hasOwn(srcStyle, "textRotation") && (textConfig.rotation = srcStyle.textRotation);
  6617. hasOwn(srcStyle, "textDistance") && (textConfig.distance = srcStyle.textDistance);
  6618. }
  6619. convertEC4CompatibleRichItem(textContentStyle, hostStyle);
  6620. each(textContentStyle.rich, function(richItem) {
  6621. convertEC4CompatibleRichItem(richItem, richItem);
  6622. });
  6623. return {
  6624. textConfig,
  6625. textContent
  6626. };
  6627. }
  6628. function convertEC4CompatibleRichItem(out, richItem) {
  6629. if (!richItem) {
  6630. return;
  6631. }
  6632. richItem.font = richItem.textFont || richItem.font;
  6633. hasOwn(richItem, "textStrokeWidth") && (out.lineWidth = richItem.textStrokeWidth);
  6634. hasOwn(richItem, "textAlign") && (out.align = richItem.textAlign);
  6635. hasOwn(richItem, "textVerticalAlign") && (out.verticalAlign = richItem.textVerticalAlign);
  6636. hasOwn(richItem, "textLineHeight") && (out.lineHeight = richItem.textLineHeight);
  6637. hasOwn(richItem, "textWidth") && (out.width = richItem.textWidth);
  6638. hasOwn(richItem, "textHeight") && (out.height = richItem.textHeight);
  6639. hasOwn(richItem, "textBackgroundColor") && (out.backgroundColor = richItem.textBackgroundColor);
  6640. hasOwn(richItem, "textPadding") && (out.padding = richItem.textPadding);
  6641. hasOwn(richItem, "textBorderColor") && (out.borderColor = richItem.textBorderColor);
  6642. hasOwn(richItem, "textBorderWidth") && (out.borderWidth = richItem.textBorderWidth);
  6643. hasOwn(richItem, "textBorderRadius") && (out.borderRadius = richItem.textBorderRadius);
  6644. hasOwn(richItem, "textBoxShadowColor") && (out.shadowColor = richItem.textBoxShadowColor);
  6645. hasOwn(richItem, "textBoxShadowBlur") && (out.shadowBlur = richItem.textBoxShadowBlur);
  6646. hasOwn(richItem, "textBoxShadowOffsetX") && (out.shadowOffsetX = richItem.textBoxShadowOffsetX);
  6647. hasOwn(richItem, "textBoxShadowOffsetY") && (out.shadowOffsetY = richItem.textBoxShadowOffsetY);
  6648. }
  6649. function convertToEC4StyleForCustomSerise(itemStl, txStl, txCfg) {
  6650. var out = itemStl;
  6651. out.textPosition = out.textPosition || txCfg.position || "inside";
  6652. txCfg.offset != null && (out.textOffset = txCfg.offset);
  6653. txCfg.rotation != null && (out.textRotation = txCfg.rotation);
  6654. txCfg.distance != null && (out.textDistance = txCfg.distance);
  6655. var isInside = out.textPosition.indexOf("inside") >= 0;
  6656. var hostFill = itemStl.fill || "#000";
  6657. convertToEC4RichItem(out, txStl);
  6658. var textFillNotSet = out.textFill == null;
  6659. if (isInside) {
  6660. if (textFillNotSet) {
  6661. out.textFill = txCfg.insideFill || "#fff";
  6662. !out.textStroke && txCfg.insideStroke && (out.textStroke = txCfg.insideStroke);
  6663. !out.textStroke && (out.textStroke = hostFill);
  6664. out.textStrokeWidth == null && (out.textStrokeWidth = 2);
  6665. }
  6666. } else {
  6667. if (textFillNotSet) {
  6668. out.textFill = itemStl.fill || txCfg.outsideFill || "#000";
  6669. }
  6670. !out.textStroke && txCfg.outsideStroke && (out.textStroke = txCfg.outsideStroke);
  6671. }
  6672. out.text = txStl.text;
  6673. out.rich = txStl.rich;
  6674. each(txStl.rich, function(richItem) {
  6675. convertToEC4RichItem(richItem, richItem);
  6676. });
  6677. return out;
  6678. }
  6679. function convertToEC4RichItem(out, richItem) {
  6680. if (!richItem) {
  6681. return;
  6682. }
  6683. hasOwn(richItem, "fill") && (out.textFill = richItem.fill);
  6684. hasOwn(richItem, "stroke") && (out.textStroke = richItem.fill);
  6685. hasOwn(richItem, "lineWidth") && (out.textStrokeWidth = richItem.lineWidth);
  6686. hasOwn(richItem, "font") && (out.font = richItem.font);
  6687. hasOwn(richItem, "fontStyle") && (out.fontStyle = richItem.fontStyle);
  6688. hasOwn(richItem, "fontWeight") && (out.fontWeight = richItem.fontWeight);
  6689. hasOwn(richItem, "fontSize") && (out.fontSize = richItem.fontSize);
  6690. hasOwn(richItem, "fontFamily") && (out.fontFamily = richItem.fontFamily);
  6691. hasOwn(richItem, "align") && (out.textAlign = richItem.align);
  6692. hasOwn(richItem, "verticalAlign") && (out.textVerticalAlign = richItem.verticalAlign);
  6693. hasOwn(richItem, "lineHeight") && (out.textLineHeight = richItem.lineHeight);
  6694. hasOwn(richItem, "width") && (out.textWidth = richItem.width);
  6695. hasOwn(richItem, "height") && (out.textHeight = richItem.height);
  6696. hasOwn(richItem, "backgroundColor") && (out.textBackgroundColor = richItem.backgroundColor);
  6697. hasOwn(richItem, "padding") && (out.textPadding = richItem.padding);
  6698. hasOwn(richItem, "borderColor") && (out.textBorderColor = richItem.borderColor);
  6699. hasOwn(richItem, "borderWidth") && (out.textBorderWidth = richItem.borderWidth);
  6700. hasOwn(richItem, "borderRadius") && (out.textBorderRadius = richItem.borderRadius);
  6701. hasOwn(richItem, "shadowColor") && (out.textBoxShadowColor = richItem.shadowColor);
  6702. hasOwn(richItem, "shadowBlur") && (out.textBoxShadowBlur = richItem.shadowBlur);
  6703. hasOwn(richItem, "shadowOffsetX") && (out.textBoxShadowOffsetX = richItem.shadowOffsetX);
  6704. hasOwn(richItem, "shadowOffsetY") && (out.textBoxShadowOffsetY = richItem.shadowOffsetY);
  6705. hasOwn(richItem, "textShadowColor") && (out.textShadowColor = richItem.textShadowColor);
  6706. hasOwn(richItem, "textShadowBlur") && (out.textShadowBlur = richItem.textShadowBlur);
  6707. hasOwn(richItem, "textShadowOffsetX") && (out.textShadowOffsetX = richItem.textShadowOffsetX);
  6708. hasOwn(richItem, "textShadowOffsetY") && (out.textShadowOffsetY = richItem.textShadowOffsetY);
  6709. }
  6710. function warnDeprecated(deprecated, insteadApproach) {
  6711. if (true) {
  6712. var key = deprecated + "^_^" + insteadApproach;
  6713. if (!deprecatedLogs[key]) {
  6714. console.warn('[ECharts] DEPRECATED: "' + deprecated + '" has been deprecated. ' + insteadApproach);
  6715. deprecatedLogs[key] = true;
  6716. }
  6717. }
  6718. }
  6719. // node_modules/echarts/lib/animation/customGraphicTransition.js
  6720. var LEGACY_TRANSFORM_PROPS_MAP = {
  6721. position: ["x", "y"],
  6722. scale: ["scaleX", "scaleY"],
  6723. origin: ["originX", "originY"]
  6724. };
  6725. var LEGACY_TRANSFORM_PROPS = keys(LEGACY_TRANSFORM_PROPS_MAP);
  6726. var TRANSFORM_PROPS_MAP = reduce(TRANSFORMABLE_PROPS, function(obj, key) {
  6727. obj[key] = 1;
  6728. return obj;
  6729. }, {});
  6730. var transformPropNamesStr = TRANSFORMABLE_PROPS.join(", ");
  6731. var ELEMENT_ANIMATABLE_PROPS = ["", "style", "shape", "extra"];
  6732. var transitionInnerStore = makeInner();
  6733. function getElementAnimationConfig(animationType, el, elOption, parentModel, dataIndex) {
  6734. var animationProp = animationType + "Animation";
  6735. var config = getAnimationConfig(animationType, parentModel, dataIndex) || {};
  6736. var userDuring = transitionInnerStore(el).userDuring;
  6737. if (config.duration > 0) {
  6738. config.during = userDuring ? bind(duringCall, {
  6739. el,
  6740. userDuring
  6741. }) : null;
  6742. config.setToFinal = true;
  6743. config.scope = animationType;
  6744. }
  6745. extend(config, elOption[animationProp]);
  6746. return config;
  6747. }
  6748. function applyUpdateTransition(el, elOption, animatableModel, opts) {
  6749. opts = opts || {};
  6750. var dataIndex = opts.dataIndex, isInit = opts.isInit, clearStyle = opts.clearStyle;
  6751. var hasAnimation = animatableModel.isAnimationEnabled();
  6752. var store = transitionInnerStore(el);
  6753. var styleOpt = elOption.style;
  6754. store.userDuring = elOption.during;
  6755. var transFromProps = {};
  6756. var propsToSet = {};
  6757. prepareTransformAllPropsFinal(el, elOption, propsToSet);
  6758. prepareShapeOrExtraAllPropsFinal("shape", elOption, propsToSet);
  6759. prepareShapeOrExtraAllPropsFinal("extra", elOption, propsToSet);
  6760. if (!isInit && hasAnimation) {
  6761. prepareTransformTransitionFrom(el, elOption, transFromProps);
  6762. prepareShapeOrExtraTransitionFrom("shape", el, elOption, transFromProps);
  6763. prepareShapeOrExtraTransitionFrom("extra", el, elOption, transFromProps);
  6764. prepareStyleTransitionFrom(el, elOption, styleOpt, transFromProps);
  6765. }
  6766. propsToSet.style = styleOpt;
  6767. applyPropsDirectly(el, propsToSet, clearStyle);
  6768. applyMiscProps(el, elOption);
  6769. if (hasAnimation) {
  6770. if (isInit) {
  6771. var enterFromProps_1 = {};
  6772. each(ELEMENT_ANIMATABLE_PROPS, function(propName) {
  6773. var prop = propName ? elOption[propName] : elOption;
  6774. if (prop && prop.enterFrom) {
  6775. if (propName) {
  6776. enterFromProps_1[propName] = enterFromProps_1[propName] || {};
  6777. }
  6778. extend(propName ? enterFromProps_1[propName] : enterFromProps_1, prop.enterFrom);
  6779. }
  6780. });
  6781. var config = getElementAnimationConfig("enter", el, elOption, animatableModel, dataIndex);
  6782. if (config.duration > 0) {
  6783. el.animateFrom(enterFromProps_1, config);
  6784. }
  6785. } else {
  6786. applyPropsTransition(el, elOption, dataIndex || 0, animatableModel, transFromProps);
  6787. }
  6788. }
  6789. updateLeaveTo(el, elOption);
  6790. styleOpt ? el.dirty() : el.markRedraw();
  6791. }
  6792. function updateLeaveTo(el, elOption) {
  6793. var leaveToProps = transitionInnerStore(el).leaveToProps;
  6794. for (var i = 0; i < ELEMENT_ANIMATABLE_PROPS.length; i++) {
  6795. var propName = ELEMENT_ANIMATABLE_PROPS[i];
  6796. var prop = propName ? elOption[propName] : elOption;
  6797. if (prop && prop.leaveTo) {
  6798. if (!leaveToProps) {
  6799. leaveToProps = transitionInnerStore(el).leaveToProps = {};
  6800. }
  6801. if (propName) {
  6802. leaveToProps[propName] = leaveToProps[propName] || {};
  6803. }
  6804. extend(propName ? leaveToProps[propName] : leaveToProps, prop.leaveTo);
  6805. }
  6806. }
  6807. }
  6808. function applyLeaveTransition(el, elOption, animatableModel, onRemove) {
  6809. if (el) {
  6810. var parent_1 = el.parent;
  6811. var leaveToProps = transitionInnerStore(el).leaveToProps;
  6812. if (leaveToProps) {
  6813. var config = getElementAnimationConfig("update", el, elOption, animatableModel, 0);
  6814. config.done = function() {
  6815. parent_1.remove(el);
  6816. onRemove && onRemove();
  6817. };
  6818. el.animateTo(leaveToProps, config);
  6819. } else {
  6820. parent_1.remove(el);
  6821. onRemove && onRemove();
  6822. }
  6823. }
  6824. }
  6825. function isTransitionAll(transition) {
  6826. return transition === "all";
  6827. }
  6828. function applyPropsDirectly(el, allPropsFinal, clearStyle) {
  6829. var styleOpt = allPropsFinal.style;
  6830. if (!el.isGroup && styleOpt) {
  6831. if (clearStyle) {
  6832. el.useStyle({});
  6833. var animators = el.animators;
  6834. for (var i = 0; i < animators.length; i++) {
  6835. var animator = animators[i];
  6836. if (animator.targetName === "style") {
  6837. animator.changeTarget(el.style);
  6838. }
  6839. }
  6840. }
  6841. el.setStyle(styleOpt);
  6842. }
  6843. if (allPropsFinal) {
  6844. allPropsFinal.style = null;
  6845. allPropsFinal && el.attr(allPropsFinal);
  6846. allPropsFinal.style = styleOpt;
  6847. }
  6848. }
  6849. function applyPropsTransition(el, elOption, dataIndex, model, transFromProps) {
  6850. if (transFromProps) {
  6851. var config = getElementAnimationConfig("update", el, elOption, model, dataIndex);
  6852. if (config.duration > 0) {
  6853. el.animateFrom(transFromProps, config);
  6854. }
  6855. }
  6856. }
  6857. function applyMiscProps(el, elOption) {
  6858. hasOwn(elOption, "silent") && (el.silent = elOption.silent);
  6859. hasOwn(elOption, "ignore") && (el.ignore = elOption.ignore);
  6860. if (el instanceof Displayable_default) {
  6861. hasOwn(elOption, "invisible") && (el.invisible = elOption.invisible);
  6862. }
  6863. if (el instanceof Path_default) {
  6864. hasOwn(elOption, "autoBatch") && (el.autoBatch = elOption.autoBatch);
  6865. }
  6866. }
  6867. var tmpDuringScope = {};
  6868. var transitionDuringAPI = {
  6869. // Usually other props do not need to be changed in animation during.
  6870. setTransform: function(key, val) {
  6871. if (true) {
  6872. assert(hasOwn(TRANSFORM_PROPS_MAP, key), "Only " + transformPropNamesStr + " available in `setTransform`.");
  6873. }
  6874. tmpDuringScope.el[key] = val;
  6875. return this;
  6876. },
  6877. getTransform: function(key) {
  6878. if (true) {
  6879. assert(hasOwn(TRANSFORM_PROPS_MAP, key), "Only " + transformPropNamesStr + " available in `getTransform`.");
  6880. }
  6881. return tmpDuringScope.el[key];
  6882. },
  6883. setShape: function(key, val) {
  6884. if (true) {
  6885. assertNotReserved(key);
  6886. }
  6887. var el = tmpDuringScope.el;
  6888. var shape = el.shape || (el.shape = {});
  6889. shape[key] = val;
  6890. el.dirtyShape && el.dirtyShape();
  6891. return this;
  6892. },
  6893. getShape: function(key) {
  6894. if (true) {
  6895. assertNotReserved(key);
  6896. }
  6897. var shape = tmpDuringScope.el.shape;
  6898. if (shape) {
  6899. return shape[key];
  6900. }
  6901. },
  6902. setStyle: function(key, val) {
  6903. if (true) {
  6904. assertNotReserved(key);
  6905. }
  6906. var el = tmpDuringScope.el;
  6907. var style = el.style;
  6908. if (style) {
  6909. if (true) {
  6910. if (eqNaN(val)) {
  6911. warn("style." + key + " must not be assigned with NaN.");
  6912. }
  6913. }
  6914. style[key] = val;
  6915. el.dirtyStyle && el.dirtyStyle();
  6916. }
  6917. return this;
  6918. },
  6919. getStyle: function(key) {
  6920. if (true) {
  6921. assertNotReserved(key);
  6922. }
  6923. var style = tmpDuringScope.el.style;
  6924. if (style) {
  6925. return style[key];
  6926. }
  6927. },
  6928. setExtra: function(key, val) {
  6929. if (true) {
  6930. assertNotReserved(key);
  6931. }
  6932. var extra = tmpDuringScope.el.extra || (tmpDuringScope.el.extra = {});
  6933. extra[key] = val;
  6934. return this;
  6935. },
  6936. getExtra: function(key) {
  6937. if (true) {
  6938. assertNotReserved(key);
  6939. }
  6940. var extra = tmpDuringScope.el.extra;
  6941. if (extra) {
  6942. return extra[key];
  6943. }
  6944. }
  6945. };
  6946. function assertNotReserved(key) {
  6947. if (true) {
  6948. if (key === "transition" || key === "enterFrom" || key === "leaveTo") {
  6949. throw new Error('key must not be "' + key + '"');
  6950. }
  6951. }
  6952. }
  6953. function duringCall() {
  6954. var scope = this;
  6955. var el = scope.el;
  6956. if (!el) {
  6957. return;
  6958. }
  6959. var latestUserDuring = transitionInnerStore(el).userDuring;
  6960. var scopeUserDuring = scope.userDuring;
  6961. if (latestUserDuring !== scopeUserDuring) {
  6962. scope.el = scope.userDuring = null;
  6963. return;
  6964. }
  6965. tmpDuringScope.el = el;
  6966. scopeUserDuring(transitionDuringAPI);
  6967. }
  6968. function prepareShapeOrExtraTransitionFrom(mainAttr, fromEl, elOption, transFromProps) {
  6969. var attrOpt = elOption[mainAttr];
  6970. if (!attrOpt) {
  6971. return;
  6972. }
  6973. var elPropsInAttr = fromEl[mainAttr];
  6974. var transFromPropsInAttr;
  6975. if (elPropsInAttr) {
  6976. var transition = elOption.transition;
  6977. var attrTransition = attrOpt.transition;
  6978. if (attrTransition) {
  6979. !transFromPropsInAttr && (transFromPropsInAttr = transFromProps[mainAttr] = {});
  6980. if (isTransitionAll(attrTransition)) {
  6981. extend(transFromPropsInAttr, elPropsInAttr);
  6982. } else {
  6983. var transitionKeys = normalizeToArray(attrTransition);
  6984. for (var i = 0; i < transitionKeys.length; i++) {
  6985. var key = transitionKeys[i];
  6986. var elVal = elPropsInAttr[key];
  6987. transFromPropsInAttr[key] = elVal;
  6988. }
  6989. }
  6990. } else if (isTransitionAll(transition) || indexOf(transition, mainAttr) >= 0) {
  6991. !transFromPropsInAttr && (transFromPropsInAttr = transFromProps[mainAttr] = {});
  6992. var elPropsInAttrKeys = keys(elPropsInAttr);
  6993. for (var i = 0; i < elPropsInAttrKeys.length; i++) {
  6994. var key = elPropsInAttrKeys[i];
  6995. var elVal = elPropsInAttr[key];
  6996. if (isNonStyleTransitionEnabled(attrOpt[key], elVal)) {
  6997. transFromPropsInAttr[key] = elVal;
  6998. }
  6999. }
  7000. }
  7001. }
  7002. }
  7003. function prepareShapeOrExtraAllPropsFinal(mainAttr, elOption, allProps) {
  7004. var attrOpt = elOption[mainAttr];
  7005. if (!attrOpt) {
  7006. return;
  7007. }
  7008. var allPropsInAttr = allProps[mainAttr] = {};
  7009. var keysInAttr = keys(attrOpt);
  7010. for (var i = 0; i < keysInAttr.length; i++) {
  7011. var key = keysInAttr[i];
  7012. allPropsInAttr[key] = cloneValue(attrOpt[key]);
  7013. }
  7014. }
  7015. function prepareTransformTransitionFrom(el, elOption, transFromProps) {
  7016. var transition = elOption.transition;
  7017. var transitionKeys = isTransitionAll(transition) ? TRANSFORMABLE_PROPS : normalizeToArray(transition || []);
  7018. for (var i = 0; i < transitionKeys.length; i++) {
  7019. var key = transitionKeys[i];
  7020. if (key === "style" || key === "shape" || key === "extra") {
  7021. continue;
  7022. }
  7023. var elVal = el[key];
  7024. if (true) {
  7025. checkTransformPropRefer(key, "el.transition");
  7026. }
  7027. transFromProps[key] = elVal;
  7028. }
  7029. }
  7030. function prepareTransformAllPropsFinal(el, elOption, allProps) {
  7031. for (var i = 0; i < LEGACY_TRANSFORM_PROPS.length; i++) {
  7032. var legacyName = LEGACY_TRANSFORM_PROPS[i];
  7033. var xyName = LEGACY_TRANSFORM_PROPS_MAP[legacyName];
  7034. var legacyArr = elOption[legacyName];
  7035. if (legacyArr) {
  7036. allProps[xyName[0]] = legacyArr[0];
  7037. allProps[xyName[1]] = legacyArr[1];
  7038. }
  7039. }
  7040. for (var i = 0; i < TRANSFORMABLE_PROPS.length; i++) {
  7041. var key = TRANSFORMABLE_PROPS[i];
  7042. if (elOption[key] != null) {
  7043. allProps[key] = elOption[key];
  7044. }
  7045. }
  7046. }
  7047. function prepareStyleTransitionFrom(fromEl, elOption, styleOpt, transFromProps) {
  7048. if (!styleOpt) {
  7049. return;
  7050. }
  7051. var fromElStyle = fromEl.style;
  7052. var transFromStyleProps;
  7053. if (fromElStyle) {
  7054. var styleTransition = styleOpt.transition;
  7055. var elTransition = elOption.transition;
  7056. if (styleTransition && !isTransitionAll(styleTransition)) {
  7057. var transitionKeys = normalizeToArray(styleTransition);
  7058. !transFromStyleProps && (transFromStyleProps = transFromProps.style = {});
  7059. for (var i = 0; i < transitionKeys.length; i++) {
  7060. var key = transitionKeys[i];
  7061. var elVal = fromElStyle[key];
  7062. transFromStyleProps[key] = elVal;
  7063. }
  7064. } else if (fromEl.getAnimationStyleProps && (isTransitionAll(elTransition) || isTransitionAll(styleTransition) || indexOf(elTransition, "style") >= 0)) {
  7065. var animationProps = fromEl.getAnimationStyleProps();
  7066. var animationStyleProps = animationProps ? animationProps.style : null;
  7067. if (animationStyleProps) {
  7068. !transFromStyleProps && (transFromStyleProps = transFromProps.style = {});
  7069. var styleKeys = keys(styleOpt);
  7070. for (var i = 0; i < styleKeys.length; i++) {
  7071. var key = styleKeys[i];
  7072. if (animationStyleProps[key]) {
  7073. var elVal = fromElStyle[key];
  7074. transFromStyleProps[key] = elVal;
  7075. }
  7076. }
  7077. }
  7078. }
  7079. }
  7080. }
  7081. function isNonStyleTransitionEnabled(optVal, elVal) {
  7082. return !isArrayLike(optVal) ? optVal != null && isFinite(optVal) : optVal !== elVal;
  7083. }
  7084. var checkTransformPropRefer;
  7085. if (true) {
  7086. checkTransformPropRefer = function(key, usedIn) {
  7087. if (!hasOwn(TRANSFORM_PROPS_MAP, key)) {
  7088. warn("Prop `" + key + "` is not a permitted in `" + usedIn + "`. Only `" + keys(TRANSFORM_PROPS_MAP).join("`, `") + "` are permitted.");
  7089. }
  7090. };
  7091. }
  7092. // node_modules/echarts/lib/animation/customGraphicKeyframeAnimation.js
  7093. var getStateToRestore = makeInner();
  7094. var KEYFRAME_EXCLUDE_KEYS = ["percent", "easing", "shape", "style", "extra"];
  7095. function stopPreviousKeyframeAnimationAndRestore(el) {
  7096. el.stopAnimation("keyframe");
  7097. el.attr(getStateToRestore(el));
  7098. }
  7099. function applyKeyframeAnimation(el, animationOpts, animatableModel) {
  7100. if (!animatableModel.isAnimationEnabled() || !animationOpts) {
  7101. return;
  7102. }
  7103. if (isArray(animationOpts)) {
  7104. each(animationOpts, function(singleAnimationOpts) {
  7105. applyKeyframeAnimation(el, singleAnimationOpts, animatableModel);
  7106. });
  7107. return;
  7108. }
  7109. var keyframes = animationOpts.keyframes;
  7110. var duration = animationOpts.duration;
  7111. if (animatableModel && duration == null) {
  7112. var config = getAnimationConfig("enter", animatableModel, 0);
  7113. duration = config && config.duration;
  7114. }
  7115. if (!keyframes || !duration) {
  7116. return;
  7117. }
  7118. var stateToRestore = getStateToRestore(el);
  7119. each(ELEMENT_ANIMATABLE_PROPS, function(targetPropName) {
  7120. if (targetPropName && !el[targetPropName]) {
  7121. return;
  7122. }
  7123. var animator;
  7124. var endFrameIsSet = false;
  7125. keyframes.sort(function(a, b) {
  7126. return a.percent - b.percent;
  7127. });
  7128. each(keyframes, function(kf) {
  7129. var animators = el.animators;
  7130. var kfValues = targetPropName ? kf[targetPropName] : kf;
  7131. if (true) {
  7132. if (kf.percent >= 1) {
  7133. endFrameIsSet = true;
  7134. }
  7135. }
  7136. if (!kfValues) {
  7137. return;
  7138. }
  7139. var propKeys = keys(kfValues);
  7140. if (!targetPropName) {
  7141. propKeys = filter(propKeys, function(key) {
  7142. return indexOf(KEYFRAME_EXCLUDE_KEYS, key) < 0;
  7143. });
  7144. }
  7145. if (!propKeys.length) {
  7146. return;
  7147. }
  7148. if (!animator) {
  7149. animator = el.animate(targetPropName, animationOpts.loop, true);
  7150. animator.scope = "keyframe";
  7151. }
  7152. for (var i = 0; i < animators.length; i++) {
  7153. if (animators[i] !== animator && animators[i].targetName === animator.targetName) {
  7154. animators[i].stopTracks(propKeys);
  7155. }
  7156. }
  7157. targetPropName && (stateToRestore[targetPropName] = stateToRestore[targetPropName] || {});
  7158. var savedTarget = targetPropName ? stateToRestore[targetPropName] : stateToRestore;
  7159. each(propKeys, function(key) {
  7160. savedTarget[key] = ((targetPropName ? el[targetPropName] : el) || {})[key];
  7161. });
  7162. animator.whenWithKeys(duration * kf.percent, kfValues, propKeys, kf.easing);
  7163. });
  7164. if (!animator) {
  7165. return;
  7166. }
  7167. if (true) {
  7168. if (!endFrameIsSet) {
  7169. warn("End frame with percent: 1 is missing in the keyframeAnimation.", true);
  7170. }
  7171. }
  7172. animator.delay(animationOpts.delay || 0).duration(duration).start(animationOpts.easing);
  7173. });
  7174. }
  7175. // node_modules/echarts/lib/visual/VisualMapping.js
  7176. var each3 = each;
  7177. var isObject2 = isObject;
  7178. var CATEGORY_DEFAULT_VISUAL_INDEX = -1;
  7179. var VisualMapping = (
  7180. /** @class */
  7181. function() {
  7182. function VisualMapping2(option) {
  7183. var mappingMethod = option.mappingMethod;
  7184. var visualType = option.type;
  7185. var thisOption = this.option = clone(option);
  7186. this.type = visualType;
  7187. this.mappingMethod = mappingMethod;
  7188. this._normalizeData = normalizers[mappingMethod];
  7189. var visualHandler = VisualMapping2.visualHandlers[visualType];
  7190. this.applyVisual = visualHandler.applyVisual;
  7191. this.getColorMapper = visualHandler.getColorMapper;
  7192. this._normalizedToVisual = visualHandler._normalizedToVisual[mappingMethod];
  7193. if (mappingMethod === "piecewise") {
  7194. normalizeVisualRange(thisOption);
  7195. preprocessForPiecewise(thisOption);
  7196. } else if (mappingMethod === "category") {
  7197. thisOption.categories ? preprocessForSpecifiedCategory(thisOption) : normalizeVisualRange(thisOption, true);
  7198. } else {
  7199. assert(mappingMethod !== "linear" || thisOption.dataExtent);
  7200. normalizeVisualRange(thisOption);
  7201. }
  7202. }
  7203. VisualMapping2.prototype.mapValueToVisual = function(value) {
  7204. var normalized = this._normalizeData(value);
  7205. return this._normalizedToVisual(normalized, value);
  7206. };
  7207. VisualMapping2.prototype.getNormalizer = function() {
  7208. return bind(this._normalizeData, this);
  7209. };
  7210. VisualMapping2.listVisualTypes = function() {
  7211. return keys(VisualMapping2.visualHandlers);
  7212. };
  7213. VisualMapping2.isValidType = function(visualType) {
  7214. return VisualMapping2.visualHandlers.hasOwnProperty(visualType);
  7215. };
  7216. VisualMapping2.eachVisual = function(visual, callback, context) {
  7217. if (isObject(visual)) {
  7218. each(visual, callback, context);
  7219. } else {
  7220. callback.call(context, visual);
  7221. }
  7222. };
  7223. VisualMapping2.mapVisual = function(visual, callback, context) {
  7224. var isPrimary;
  7225. var newVisual = isArray(visual) ? [] : isObject(visual) ? {} : (isPrimary = true, null);
  7226. VisualMapping2.eachVisual(visual, function(v, key) {
  7227. var newVal = callback.call(context, v, key);
  7228. isPrimary ? newVisual = newVal : newVisual[key] = newVal;
  7229. });
  7230. return newVisual;
  7231. };
  7232. VisualMapping2.retrieveVisuals = function(obj) {
  7233. var ret = {};
  7234. var hasVisual;
  7235. obj && each3(VisualMapping2.visualHandlers, function(h, visualType) {
  7236. if (obj.hasOwnProperty(visualType)) {
  7237. ret[visualType] = obj[visualType];
  7238. hasVisual = true;
  7239. }
  7240. });
  7241. return hasVisual ? ret : null;
  7242. };
  7243. VisualMapping2.prepareVisualTypes = function(visualTypes) {
  7244. if (isArray(visualTypes)) {
  7245. visualTypes = visualTypes.slice();
  7246. } else if (isObject2(visualTypes)) {
  7247. var types_1 = [];
  7248. each3(visualTypes, function(item, type) {
  7249. types_1.push(type);
  7250. });
  7251. visualTypes = types_1;
  7252. } else {
  7253. return [];
  7254. }
  7255. visualTypes.sort(function(type1, type2) {
  7256. return type2 === "color" && type1 !== "color" && type1.indexOf("color") === 0 ? 1 : -1;
  7257. });
  7258. return visualTypes;
  7259. };
  7260. VisualMapping2.dependsOn = function(visualType1, visualType2) {
  7261. return visualType2 === "color" ? !!(visualType1 && visualType1.indexOf(visualType2) === 0) : visualType1 === visualType2;
  7262. };
  7263. VisualMapping2.findPieceIndex = function(value, pieceList, findClosestWhenOutside) {
  7264. var possibleI;
  7265. var abs = Infinity;
  7266. for (var i = 0, len = pieceList.length; i < len; i++) {
  7267. var pieceValue = pieceList[i].value;
  7268. if (pieceValue != null) {
  7269. if (pieceValue === value || isString(pieceValue) && pieceValue === value + "") {
  7270. return i;
  7271. }
  7272. findClosestWhenOutside && updatePossible(pieceValue, i);
  7273. }
  7274. }
  7275. for (var i = 0, len = pieceList.length; i < len; i++) {
  7276. var piece = pieceList[i];
  7277. var interval = piece.interval;
  7278. var close_1 = piece.close;
  7279. if (interval) {
  7280. if (interval[0] === -Infinity) {
  7281. if (littleThan(close_1[1], value, interval[1])) {
  7282. return i;
  7283. }
  7284. } else if (interval[1] === Infinity) {
  7285. if (littleThan(close_1[0], interval[0], value)) {
  7286. return i;
  7287. }
  7288. } else if (littleThan(close_1[0], interval[0], value) && littleThan(close_1[1], value, interval[1])) {
  7289. return i;
  7290. }
  7291. findClosestWhenOutside && updatePossible(interval[0], i);
  7292. findClosestWhenOutside && updatePossible(interval[1], i);
  7293. }
  7294. }
  7295. if (findClosestWhenOutside) {
  7296. return value === Infinity ? pieceList.length - 1 : value === -Infinity ? 0 : possibleI;
  7297. }
  7298. function updatePossible(val, index) {
  7299. var newAbs = Math.abs(val - value);
  7300. if (newAbs < abs) {
  7301. abs = newAbs;
  7302. possibleI = index;
  7303. }
  7304. }
  7305. };
  7306. VisualMapping2.visualHandlers = {
  7307. color: {
  7308. applyVisual: makeApplyVisual("color"),
  7309. getColorMapper: function() {
  7310. var thisOption = this.option;
  7311. return bind(thisOption.mappingMethod === "category" ? function(value, isNormalized) {
  7312. !isNormalized && (value = this._normalizeData(value));
  7313. return doMapCategory.call(this, value);
  7314. } : function(value, isNormalized, out) {
  7315. var returnRGBArray = !!out;
  7316. !isNormalized && (value = this._normalizeData(value));
  7317. out = fastLerp(value, thisOption.parsedVisual, out);
  7318. return returnRGBArray ? out : stringify(out, "rgba");
  7319. }, this);
  7320. },
  7321. _normalizedToVisual: {
  7322. linear: function(normalized) {
  7323. return stringify(fastLerp(normalized, this.option.parsedVisual), "rgba");
  7324. },
  7325. category: doMapCategory,
  7326. piecewise: function(normalized, value) {
  7327. var result = getSpecifiedVisual.call(this, value);
  7328. if (result == null) {
  7329. result = stringify(fastLerp(normalized, this.option.parsedVisual), "rgba");
  7330. }
  7331. return result;
  7332. },
  7333. fixed: doMapFixed
  7334. }
  7335. },
  7336. colorHue: makePartialColorVisualHandler(function(color, value) {
  7337. return modifyHSL(color, value);
  7338. }),
  7339. colorSaturation: makePartialColorVisualHandler(function(color, value) {
  7340. return modifyHSL(color, null, value);
  7341. }),
  7342. colorLightness: makePartialColorVisualHandler(function(color, value) {
  7343. return modifyHSL(color, null, null, value);
  7344. }),
  7345. colorAlpha: makePartialColorVisualHandler(function(color, value) {
  7346. return modifyAlpha(color, value);
  7347. }),
  7348. decal: {
  7349. applyVisual: makeApplyVisual("decal"),
  7350. _normalizedToVisual: {
  7351. linear: null,
  7352. category: doMapCategory,
  7353. piecewise: null,
  7354. fixed: null
  7355. }
  7356. },
  7357. opacity: {
  7358. applyVisual: makeApplyVisual("opacity"),
  7359. _normalizedToVisual: createNormalizedToNumericVisual([0, 1])
  7360. },
  7361. liftZ: {
  7362. applyVisual: makeApplyVisual("liftZ"),
  7363. _normalizedToVisual: {
  7364. linear: doMapFixed,
  7365. category: doMapFixed,
  7366. piecewise: doMapFixed,
  7367. fixed: doMapFixed
  7368. }
  7369. },
  7370. symbol: {
  7371. applyVisual: function(value, getter, setter) {
  7372. var symbolCfg = this.mapValueToVisual(value);
  7373. setter("symbol", symbolCfg);
  7374. },
  7375. _normalizedToVisual: {
  7376. linear: doMapToArray,
  7377. category: doMapCategory,
  7378. piecewise: function(normalized, value) {
  7379. var result = getSpecifiedVisual.call(this, value);
  7380. if (result == null) {
  7381. result = doMapToArray.call(this, normalized);
  7382. }
  7383. return result;
  7384. },
  7385. fixed: doMapFixed
  7386. }
  7387. },
  7388. symbolSize: {
  7389. applyVisual: makeApplyVisual("symbolSize"),
  7390. _normalizedToVisual: createNormalizedToNumericVisual([0, 1])
  7391. }
  7392. };
  7393. return VisualMapping2;
  7394. }()
  7395. );
  7396. function preprocessForPiecewise(thisOption) {
  7397. var pieceList = thisOption.pieceList;
  7398. thisOption.hasSpecialVisual = false;
  7399. each(pieceList, function(piece, index) {
  7400. piece.originIndex = index;
  7401. if (piece.visual != null) {
  7402. thisOption.hasSpecialVisual = true;
  7403. }
  7404. });
  7405. }
  7406. function preprocessForSpecifiedCategory(thisOption) {
  7407. var categories = thisOption.categories;
  7408. var categoryMap = thisOption.categoryMap = {};
  7409. var visual = thisOption.visual;
  7410. each3(categories, function(cate, index) {
  7411. categoryMap[cate] = index;
  7412. });
  7413. if (!isArray(visual)) {
  7414. var visualArr_1 = [];
  7415. if (isObject(visual)) {
  7416. each3(visual, function(v, cate) {
  7417. var index = categoryMap[cate];
  7418. visualArr_1[index != null ? index : CATEGORY_DEFAULT_VISUAL_INDEX] = v;
  7419. });
  7420. } else {
  7421. visualArr_1[CATEGORY_DEFAULT_VISUAL_INDEX] = visual;
  7422. }
  7423. visual = setVisualToOption(thisOption, visualArr_1);
  7424. }
  7425. for (var i = categories.length - 1; i >= 0; i--) {
  7426. if (visual[i] == null) {
  7427. delete categoryMap[categories[i]];
  7428. categories.pop();
  7429. }
  7430. }
  7431. }
  7432. function normalizeVisualRange(thisOption, isCategory) {
  7433. var visual = thisOption.visual;
  7434. var visualArr = [];
  7435. if (isObject(visual)) {
  7436. each3(visual, function(v) {
  7437. visualArr.push(v);
  7438. });
  7439. } else if (visual != null) {
  7440. visualArr.push(visual);
  7441. }
  7442. var doNotNeedPair = {
  7443. color: 1,
  7444. symbol: 1
  7445. };
  7446. if (!isCategory && visualArr.length === 1 && !doNotNeedPair.hasOwnProperty(thisOption.type)) {
  7447. visualArr[1] = visualArr[0];
  7448. }
  7449. setVisualToOption(thisOption, visualArr);
  7450. }
  7451. function makePartialColorVisualHandler(applyValue) {
  7452. return {
  7453. applyVisual: function(value, getter, setter) {
  7454. var colorChannel = this.mapValueToVisual(value);
  7455. setter("color", applyValue(getter("color"), colorChannel));
  7456. },
  7457. _normalizedToVisual: createNormalizedToNumericVisual([0, 1])
  7458. };
  7459. }
  7460. function doMapToArray(normalized) {
  7461. var visual = this.option.visual;
  7462. return visual[Math.round(linearMap(normalized, [0, 1], [0, visual.length - 1], true))] || {};
  7463. }
  7464. function makeApplyVisual(visualType) {
  7465. return function(value, getter, setter) {
  7466. setter(visualType, this.mapValueToVisual(value));
  7467. };
  7468. }
  7469. function doMapCategory(normalized) {
  7470. var visual = this.option.visual;
  7471. return visual[this.option.loop && normalized !== CATEGORY_DEFAULT_VISUAL_INDEX ? normalized % visual.length : normalized];
  7472. }
  7473. function doMapFixed() {
  7474. return this.option.visual[0];
  7475. }
  7476. function createNormalizedToNumericVisual(sourceExtent) {
  7477. return {
  7478. linear: function(normalized) {
  7479. return linearMap(normalized, sourceExtent, this.option.visual, true);
  7480. },
  7481. category: doMapCategory,
  7482. piecewise: function(normalized, value) {
  7483. var result = getSpecifiedVisual.call(this, value);
  7484. if (result == null) {
  7485. result = linearMap(normalized, sourceExtent, this.option.visual, true);
  7486. }
  7487. return result;
  7488. },
  7489. fixed: doMapFixed
  7490. };
  7491. }
  7492. function getSpecifiedVisual(value) {
  7493. var thisOption = this.option;
  7494. var pieceList = thisOption.pieceList;
  7495. if (thisOption.hasSpecialVisual) {
  7496. var pieceIndex = VisualMapping.findPieceIndex(value, pieceList);
  7497. var piece = pieceList[pieceIndex];
  7498. if (piece && piece.visual) {
  7499. return piece.visual[this.type];
  7500. }
  7501. }
  7502. }
  7503. function setVisualToOption(thisOption, visualArr) {
  7504. thisOption.visual = visualArr;
  7505. if (thisOption.type === "color") {
  7506. thisOption.parsedVisual = map(visualArr, function(item) {
  7507. var color = parse(item);
  7508. if (!color && true) {
  7509. warn("'" + item + "' is an illegal color, fallback to '#000000'", true);
  7510. }
  7511. return color || [0, 0, 0, 1];
  7512. });
  7513. }
  7514. return visualArr;
  7515. }
  7516. var normalizers = {
  7517. linear: function(value) {
  7518. return linearMap(value, this.option.dataExtent, [0, 1], true);
  7519. },
  7520. piecewise: function(value) {
  7521. var pieceList = this.option.pieceList;
  7522. var pieceIndex = VisualMapping.findPieceIndex(value, pieceList, true);
  7523. if (pieceIndex != null) {
  7524. return linearMap(pieceIndex, [0, pieceList.length - 1], [0, 1], true);
  7525. }
  7526. },
  7527. category: function(value) {
  7528. var index = this.option.categories ? this.option.categoryMap[value] : value;
  7529. return index == null ? CATEGORY_DEFAULT_VISUAL_INDEX : index;
  7530. },
  7531. fixed: noop
  7532. };
  7533. function littleThan(close, a, b) {
  7534. return close ? a <= b : a < b;
  7535. }
  7536. var VisualMapping_default = VisualMapping;
  7537. // node_modules/echarts/lib/chart/helper/labelHelper.js
  7538. function getDefaultLabel(data, dataIndex) {
  7539. var labelDims = data.mapDimensionsAll("defaultedLabel");
  7540. var len = labelDims.length;
  7541. if (len === 1) {
  7542. var rawVal = retrieveRawValue(data, dataIndex, labelDims[0]);
  7543. return rawVal != null ? rawVal + "" : null;
  7544. } else if (len) {
  7545. var vals = [];
  7546. for (var i = 0; i < labelDims.length; i++) {
  7547. vals.push(retrieveRawValue(data, dataIndex, labelDims[i]));
  7548. }
  7549. return vals.join(" ");
  7550. }
  7551. }
  7552. function getDefaultInterpolatedLabel(data, interpolatedValue) {
  7553. var labelDims = data.mapDimensionsAll("defaultedLabel");
  7554. if (!isArray(interpolatedValue)) {
  7555. return interpolatedValue + "";
  7556. }
  7557. var vals = [];
  7558. for (var i = 0; i < labelDims.length; i++) {
  7559. var dimIndex = data.getDimensionIndex(labelDims[i]);
  7560. if (dimIndex >= 0) {
  7561. vals.push(interpolatedValue[dimIndex]);
  7562. }
  7563. }
  7564. return vals.join(" ");
  7565. }
  7566. // node_modules/echarts/lib/chart/helper/Symbol.js
  7567. var Symbol = (
  7568. /** @class */
  7569. function(_super) {
  7570. __extends(Symbol2, _super);
  7571. function Symbol2(data, idx, seriesScope, opts) {
  7572. var _this = _super.call(this) || this;
  7573. _this.updateData(data, idx, seriesScope, opts);
  7574. return _this;
  7575. }
  7576. Symbol2.prototype._createSymbol = function(symbolType, data, idx, symbolSize, keepAspect) {
  7577. this.removeAll();
  7578. var symbolPath = createSymbol(symbolType, -1, -1, 2, 2, null, keepAspect);
  7579. symbolPath.attr({
  7580. z2: 100,
  7581. culling: true,
  7582. scaleX: symbolSize[0] / 2,
  7583. scaleY: symbolSize[1] / 2
  7584. });
  7585. symbolPath.drift = driftSymbol;
  7586. this._symbolType = symbolType;
  7587. this.add(symbolPath);
  7588. };
  7589. Symbol2.prototype.stopSymbolAnimation = function(toLastFrame) {
  7590. this.childAt(0).stopAnimation(null, toLastFrame);
  7591. };
  7592. Symbol2.prototype.getSymbolType = function() {
  7593. return this._symbolType;
  7594. };
  7595. Symbol2.prototype.getSymbolPath = function() {
  7596. return this.childAt(0);
  7597. };
  7598. Symbol2.prototype.highlight = function() {
  7599. enterEmphasis(this.childAt(0));
  7600. };
  7601. Symbol2.prototype.downplay = function() {
  7602. leaveEmphasis(this.childAt(0));
  7603. };
  7604. Symbol2.prototype.setZ = function(zlevel, z) {
  7605. var symbolPath = this.childAt(0);
  7606. symbolPath.zlevel = zlevel;
  7607. symbolPath.z = z;
  7608. };
  7609. Symbol2.prototype.setDraggable = function(draggable, hasCursorOption) {
  7610. var symbolPath = this.childAt(0);
  7611. symbolPath.draggable = draggable;
  7612. symbolPath.cursor = !hasCursorOption && draggable ? "move" : symbolPath.cursor;
  7613. };
  7614. Symbol2.prototype.updateData = function(data, idx, seriesScope, opts) {
  7615. this.silent = false;
  7616. var symbolType = data.getItemVisual(idx, "symbol") || "circle";
  7617. var seriesModel = data.hostModel;
  7618. var symbolSize = Symbol2.getSymbolSize(data, idx);
  7619. var isInit = symbolType !== this._symbolType;
  7620. var disableAnimation = opts && opts.disableAnimation;
  7621. if (isInit) {
  7622. var keepAspect = data.getItemVisual(idx, "symbolKeepAspect");
  7623. this._createSymbol(symbolType, data, idx, symbolSize, keepAspect);
  7624. } else {
  7625. var symbolPath = this.childAt(0);
  7626. symbolPath.silent = false;
  7627. var target = {
  7628. scaleX: symbolSize[0] / 2,
  7629. scaleY: symbolSize[1] / 2
  7630. };
  7631. disableAnimation ? symbolPath.attr(target) : updateProps(symbolPath, target, seriesModel, idx);
  7632. saveOldStyle(symbolPath);
  7633. }
  7634. this._updateCommon(data, idx, symbolSize, seriesScope, opts);
  7635. if (isInit) {
  7636. var symbolPath = this.childAt(0);
  7637. if (!disableAnimation) {
  7638. var target = {
  7639. scaleX: this._sizeX,
  7640. scaleY: this._sizeY,
  7641. style: {
  7642. // Always fadeIn. Because it has fadeOut animation when symbol is removed..
  7643. opacity: symbolPath.style.opacity
  7644. }
  7645. };
  7646. symbolPath.scaleX = symbolPath.scaleY = 0;
  7647. symbolPath.style.opacity = 0;
  7648. initProps(symbolPath, target, seriesModel, idx);
  7649. }
  7650. }
  7651. if (disableAnimation) {
  7652. this.childAt(0).stopAnimation("leave");
  7653. }
  7654. };
  7655. Symbol2.prototype._updateCommon = function(data, idx, symbolSize, seriesScope, opts) {
  7656. var symbolPath = this.childAt(0);
  7657. var seriesModel = data.hostModel;
  7658. var emphasisItemStyle;
  7659. var blurItemStyle;
  7660. var selectItemStyle;
  7661. var focus;
  7662. var blurScope;
  7663. var emphasisDisabled;
  7664. var labelStatesModels;
  7665. var hoverScale;
  7666. var cursorStyle;
  7667. if (seriesScope) {
  7668. emphasisItemStyle = seriesScope.emphasisItemStyle;
  7669. blurItemStyle = seriesScope.blurItemStyle;
  7670. selectItemStyle = seriesScope.selectItemStyle;
  7671. focus = seriesScope.focus;
  7672. blurScope = seriesScope.blurScope;
  7673. labelStatesModels = seriesScope.labelStatesModels;
  7674. hoverScale = seriesScope.hoverScale;
  7675. cursorStyle = seriesScope.cursorStyle;
  7676. emphasisDisabled = seriesScope.emphasisDisabled;
  7677. }
  7678. if (!seriesScope || data.hasItemOption) {
  7679. var itemModel = seriesScope && seriesScope.itemModel ? seriesScope.itemModel : data.getItemModel(idx);
  7680. var emphasisModel = itemModel.getModel("emphasis");
  7681. emphasisItemStyle = emphasisModel.getModel("itemStyle").getItemStyle();
  7682. selectItemStyle = itemModel.getModel(["select", "itemStyle"]).getItemStyle();
  7683. blurItemStyle = itemModel.getModel(["blur", "itemStyle"]).getItemStyle();
  7684. focus = emphasisModel.get("focus");
  7685. blurScope = emphasisModel.get("blurScope");
  7686. emphasisDisabled = emphasisModel.get("disabled");
  7687. labelStatesModels = getLabelStatesModels(itemModel);
  7688. hoverScale = emphasisModel.getShallow("scale");
  7689. cursorStyle = itemModel.getShallow("cursor");
  7690. }
  7691. var symbolRotate = data.getItemVisual(idx, "symbolRotate");
  7692. symbolPath.attr("rotation", (symbolRotate || 0) * Math.PI / 180 || 0);
  7693. var symbolOffset = normalizeSymbolOffset(data.getItemVisual(idx, "symbolOffset"), symbolSize);
  7694. if (symbolOffset) {
  7695. symbolPath.x = symbolOffset[0];
  7696. symbolPath.y = symbolOffset[1];
  7697. }
  7698. cursorStyle && symbolPath.attr("cursor", cursorStyle);
  7699. var symbolStyle = data.getItemVisual(idx, "style");
  7700. var visualColor = symbolStyle.fill;
  7701. if (symbolPath instanceof Image_default) {
  7702. var pathStyle = symbolPath.style;
  7703. symbolPath.useStyle(extend({
  7704. // TODO other properties like x, y ?
  7705. image: pathStyle.image,
  7706. x: pathStyle.x,
  7707. y: pathStyle.y,
  7708. width: pathStyle.width,
  7709. height: pathStyle.height
  7710. }, symbolStyle));
  7711. } else {
  7712. if (symbolPath.__isEmptyBrush) {
  7713. symbolPath.useStyle(extend({}, symbolStyle));
  7714. } else {
  7715. symbolPath.useStyle(symbolStyle);
  7716. }
  7717. symbolPath.style.decal = null;
  7718. symbolPath.setColor(visualColor, opts && opts.symbolInnerColor);
  7719. symbolPath.style.strokeNoScale = true;
  7720. }
  7721. var liftZ = data.getItemVisual(idx, "liftZ");
  7722. var z2Origin = this._z2;
  7723. if (liftZ != null) {
  7724. if (z2Origin == null) {
  7725. this._z2 = symbolPath.z2;
  7726. symbolPath.z2 += liftZ;
  7727. }
  7728. } else if (z2Origin != null) {
  7729. symbolPath.z2 = z2Origin;
  7730. this._z2 = null;
  7731. }
  7732. var useNameLabel = opts && opts.useNameLabel;
  7733. setLabelStyle(symbolPath, labelStatesModels, {
  7734. labelFetcher: seriesModel,
  7735. labelDataIndex: idx,
  7736. defaultText: getLabelDefaultText,
  7737. inheritColor: visualColor,
  7738. defaultOpacity: symbolStyle.opacity
  7739. });
  7740. function getLabelDefaultText(idx2) {
  7741. return useNameLabel ? data.getName(idx2) : getDefaultLabel(data, idx2);
  7742. }
  7743. this._sizeX = symbolSize[0] / 2;
  7744. this._sizeY = symbolSize[1] / 2;
  7745. var emphasisState = symbolPath.ensureState("emphasis");
  7746. emphasisState.style = emphasisItemStyle;
  7747. symbolPath.ensureState("select").style = selectItemStyle;
  7748. symbolPath.ensureState("blur").style = blurItemStyle;
  7749. var scaleRatio = hoverScale == null || hoverScale === true ? Math.max(1.1, 3 / this._sizeY) : isFinite(hoverScale) && hoverScale > 0 ? +hoverScale : 1;
  7750. emphasisState.scaleX = this._sizeX * scaleRatio;
  7751. emphasisState.scaleY = this._sizeY * scaleRatio;
  7752. this.setSymbolScale(1);
  7753. toggleHoverEmphasis(this, focus, blurScope, emphasisDisabled);
  7754. };
  7755. Symbol2.prototype.setSymbolScale = function(scale2) {
  7756. this.scaleX = this.scaleY = scale2;
  7757. };
  7758. Symbol2.prototype.fadeOut = function(cb, seriesModel, opt) {
  7759. var symbolPath = this.childAt(0);
  7760. var dataIndex = getECData(this).dataIndex;
  7761. var animationOpt = opt && opt.animation;
  7762. this.silent = symbolPath.silent = true;
  7763. if (opt && opt.fadeLabel) {
  7764. var textContent = symbolPath.getTextContent();
  7765. if (textContent) {
  7766. removeElement(textContent, {
  7767. style: {
  7768. opacity: 0
  7769. }
  7770. }, seriesModel, {
  7771. dataIndex,
  7772. removeOpt: animationOpt,
  7773. cb: function() {
  7774. symbolPath.removeTextContent();
  7775. }
  7776. });
  7777. }
  7778. } else {
  7779. symbolPath.removeTextContent();
  7780. }
  7781. removeElement(symbolPath, {
  7782. style: {
  7783. opacity: 0
  7784. },
  7785. scaleX: 0,
  7786. scaleY: 0
  7787. }, seriesModel, {
  7788. dataIndex,
  7789. cb,
  7790. removeOpt: animationOpt
  7791. });
  7792. };
  7793. Symbol2.getSymbolSize = function(data, idx) {
  7794. return normalizeSymbolSize(data.getItemVisual(idx, "symbolSize"));
  7795. };
  7796. return Symbol2;
  7797. }(Group_default)
  7798. );
  7799. function driftSymbol(dx, dy) {
  7800. this.parent.drift(dx, dy);
  7801. }
  7802. var Symbol_default = Symbol;
  7803. // node_modules/echarts/lib/chart/helper/SymbolDraw.js
  7804. function symbolNeedsDraw(data, point, idx, opt) {
  7805. return point && !isNaN(point[0]) && !isNaN(point[1]) && !(opt.isIgnore && opt.isIgnore(idx)) && !(opt.clipShape && !opt.clipShape.contain(point[0], point[1])) && data.getItemVisual(idx, "symbol") !== "none";
  7806. }
  7807. function normalizeUpdateOpt(opt) {
  7808. if (opt != null && !isObject(opt)) {
  7809. opt = {
  7810. isIgnore: opt
  7811. };
  7812. }
  7813. return opt || {};
  7814. }
  7815. function makeSeriesScope(data) {
  7816. var seriesModel = data.hostModel;
  7817. var emphasisModel = seriesModel.getModel("emphasis");
  7818. return {
  7819. emphasisItemStyle: emphasisModel.getModel("itemStyle").getItemStyle(),
  7820. blurItemStyle: seriesModel.getModel(["blur", "itemStyle"]).getItemStyle(),
  7821. selectItemStyle: seriesModel.getModel(["select", "itemStyle"]).getItemStyle(),
  7822. focus: emphasisModel.get("focus"),
  7823. blurScope: emphasisModel.get("blurScope"),
  7824. emphasisDisabled: emphasisModel.get("disabled"),
  7825. hoverScale: emphasisModel.get("scale"),
  7826. labelStatesModels: getLabelStatesModels(seriesModel),
  7827. cursorStyle: seriesModel.get("cursor")
  7828. };
  7829. }
  7830. var SymbolDraw = (
  7831. /** @class */
  7832. function() {
  7833. function SymbolDraw2(SymbolCtor) {
  7834. this.group = new Group_default();
  7835. this._SymbolCtor = SymbolCtor || Symbol_default;
  7836. }
  7837. SymbolDraw2.prototype.updateData = function(data, opt) {
  7838. this._progressiveEls = null;
  7839. opt = normalizeUpdateOpt(opt);
  7840. var group = this.group;
  7841. var seriesModel = data.hostModel;
  7842. var oldData = this._data;
  7843. var SymbolCtor = this._SymbolCtor;
  7844. var disableAnimation = opt.disableAnimation;
  7845. var seriesScope = makeSeriesScope(data);
  7846. var symbolUpdateOpt = {
  7847. disableAnimation
  7848. };
  7849. var getSymbolPoint = opt.getSymbolPoint || function(idx) {
  7850. return data.getItemLayout(idx);
  7851. };
  7852. if (!oldData) {
  7853. group.removeAll();
  7854. }
  7855. data.diff(oldData).add(function(newIdx) {
  7856. var point = getSymbolPoint(newIdx);
  7857. if (symbolNeedsDraw(data, point, newIdx, opt)) {
  7858. var symbolEl = new SymbolCtor(data, newIdx, seriesScope, symbolUpdateOpt);
  7859. symbolEl.setPosition(point);
  7860. data.setItemGraphicEl(newIdx, symbolEl);
  7861. group.add(symbolEl);
  7862. }
  7863. }).update(function(newIdx, oldIdx) {
  7864. var symbolEl = oldData.getItemGraphicEl(oldIdx);
  7865. var point = getSymbolPoint(newIdx);
  7866. if (!symbolNeedsDraw(data, point, newIdx, opt)) {
  7867. group.remove(symbolEl);
  7868. return;
  7869. }
  7870. var newSymbolType = data.getItemVisual(newIdx, "symbol") || "circle";
  7871. var oldSymbolType = symbolEl && symbolEl.getSymbolType && symbolEl.getSymbolType();
  7872. if (!symbolEl || oldSymbolType && oldSymbolType !== newSymbolType) {
  7873. group.remove(symbolEl);
  7874. symbolEl = new SymbolCtor(data, newIdx, seriesScope, symbolUpdateOpt);
  7875. symbolEl.setPosition(point);
  7876. } else {
  7877. symbolEl.updateData(data, newIdx, seriesScope, symbolUpdateOpt);
  7878. var target = {
  7879. x: point[0],
  7880. y: point[1]
  7881. };
  7882. disableAnimation ? symbolEl.attr(target) : updateProps(symbolEl, target, seriesModel);
  7883. }
  7884. group.add(symbolEl);
  7885. data.setItemGraphicEl(newIdx, symbolEl);
  7886. }).remove(function(oldIdx) {
  7887. var el = oldData.getItemGraphicEl(oldIdx);
  7888. el && el.fadeOut(function() {
  7889. group.remove(el);
  7890. }, seriesModel);
  7891. }).execute();
  7892. this._getSymbolPoint = getSymbolPoint;
  7893. this._data = data;
  7894. };
  7895. ;
  7896. SymbolDraw2.prototype.updateLayout = function() {
  7897. var _this = this;
  7898. var data = this._data;
  7899. if (data) {
  7900. data.eachItemGraphicEl(function(el, idx) {
  7901. var point = _this._getSymbolPoint(idx);
  7902. el.setPosition(point);
  7903. el.markRedraw();
  7904. });
  7905. }
  7906. };
  7907. ;
  7908. SymbolDraw2.prototype.incrementalPrepareUpdate = function(data) {
  7909. this._seriesScope = makeSeriesScope(data);
  7910. this._data = null;
  7911. this.group.removeAll();
  7912. };
  7913. ;
  7914. SymbolDraw2.prototype.incrementalUpdate = function(taskParams, data, opt) {
  7915. this._progressiveEls = [];
  7916. opt = normalizeUpdateOpt(opt);
  7917. function updateIncrementalAndHover(el2) {
  7918. if (!el2.isGroup) {
  7919. el2.incremental = true;
  7920. el2.ensureState("emphasis").hoverLayer = true;
  7921. }
  7922. }
  7923. for (var idx = taskParams.start; idx < taskParams.end; idx++) {
  7924. var point = data.getItemLayout(idx);
  7925. if (symbolNeedsDraw(data, point, idx, opt)) {
  7926. var el = new this._SymbolCtor(data, idx, this._seriesScope);
  7927. el.traverse(updateIncrementalAndHover);
  7928. el.setPosition(point);
  7929. this.group.add(el);
  7930. data.setItemGraphicEl(idx, el);
  7931. this._progressiveEls.push(el);
  7932. }
  7933. }
  7934. };
  7935. ;
  7936. SymbolDraw2.prototype.eachRendered = function(cb) {
  7937. traverseElements(this._progressiveEls || this.group, cb);
  7938. };
  7939. SymbolDraw2.prototype.remove = function(enableAnimation) {
  7940. var group = this.group;
  7941. var data = this._data;
  7942. if (data && enableAnimation) {
  7943. data.eachItemGraphicEl(function(el) {
  7944. el.fadeOut(function() {
  7945. group.remove(el);
  7946. }, data.hostModel);
  7947. });
  7948. } else {
  7949. group.removeAll();
  7950. }
  7951. };
  7952. ;
  7953. return SymbolDraw2;
  7954. }()
  7955. );
  7956. var SymbolDraw_default = SymbolDraw;
  7957. // node_modules/echarts/lib/chart/helper/LinePath.js
  7958. var straightLineProto = Line_default.prototype;
  7959. var bezierCurveProto = BezierCurve_default.prototype;
  7960. var StraightLineShape = (
  7961. /** @class */
  7962. function() {
  7963. function StraightLineShape2() {
  7964. this.x1 = 0;
  7965. this.y1 = 0;
  7966. this.x2 = 0;
  7967. this.y2 = 0;
  7968. this.percent = 1;
  7969. }
  7970. return StraightLineShape2;
  7971. }()
  7972. );
  7973. var CurveShape = (
  7974. /** @class */
  7975. function(_super) {
  7976. __extends(CurveShape2, _super);
  7977. function CurveShape2() {
  7978. return _super !== null && _super.apply(this, arguments) || this;
  7979. }
  7980. return CurveShape2;
  7981. }(StraightLineShape)
  7982. );
  7983. function isStraightLine(shape) {
  7984. return isNaN(+shape.cpx1) || isNaN(+shape.cpy1);
  7985. }
  7986. var ECLinePath = (
  7987. /** @class */
  7988. function(_super) {
  7989. __extends(ECLinePath2, _super);
  7990. function ECLinePath2(opts) {
  7991. var _this = _super.call(this, opts) || this;
  7992. _this.type = "ec-line";
  7993. return _this;
  7994. }
  7995. ECLinePath2.prototype.getDefaultStyle = function() {
  7996. return {
  7997. stroke: "#000",
  7998. fill: null
  7999. };
  8000. };
  8001. ECLinePath2.prototype.getDefaultShape = function() {
  8002. return new StraightLineShape();
  8003. };
  8004. ECLinePath2.prototype.buildPath = function(ctx, shape) {
  8005. if (isStraightLine(shape)) {
  8006. straightLineProto.buildPath.call(this, ctx, shape);
  8007. } else {
  8008. bezierCurveProto.buildPath.call(this, ctx, shape);
  8009. }
  8010. };
  8011. ECLinePath2.prototype.pointAt = function(t) {
  8012. if (isStraightLine(this.shape)) {
  8013. return straightLineProto.pointAt.call(this, t);
  8014. } else {
  8015. return bezierCurveProto.pointAt.call(this, t);
  8016. }
  8017. };
  8018. ECLinePath2.prototype.tangentAt = function(t) {
  8019. var shape = this.shape;
  8020. var p = isStraightLine(shape) ? [shape.x2 - shape.x1, shape.y2 - shape.y1] : bezierCurveProto.tangentAt.call(this, t);
  8021. return normalize(p, p);
  8022. };
  8023. return ECLinePath2;
  8024. }(Path_default)
  8025. );
  8026. var LinePath_default = ECLinePath;
  8027. // node_modules/echarts/lib/chart/helper/Line.js
  8028. var SYMBOL_CATEGORIES = ["fromSymbol", "toSymbol"];
  8029. function makeSymbolTypeKey(symbolCategory) {
  8030. return "_" + symbolCategory + "Type";
  8031. }
  8032. function makeSymbolTypeValue(name, lineData, idx) {
  8033. var symbolType = lineData.getItemVisual(idx, name);
  8034. if (!symbolType || symbolType === "none") {
  8035. return symbolType;
  8036. }
  8037. var symbolSize = lineData.getItemVisual(idx, name + "Size");
  8038. var symbolRotate = lineData.getItemVisual(idx, name + "Rotate");
  8039. var symbolOffset = lineData.getItemVisual(idx, name + "Offset");
  8040. var symbolKeepAspect = lineData.getItemVisual(idx, name + "KeepAspect");
  8041. var symbolSizeArr = normalizeSymbolSize(symbolSize);
  8042. var symbolOffsetArr = normalizeSymbolOffset(symbolOffset || 0, symbolSizeArr);
  8043. return symbolType + symbolSizeArr + symbolOffsetArr + (symbolRotate || "") + (symbolKeepAspect || "");
  8044. }
  8045. function createSymbol2(name, lineData, idx) {
  8046. var symbolType = lineData.getItemVisual(idx, name);
  8047. if (!symbolType || symbolType === "none") {
  8048. return;
  8049. }
  8050. var symbolSize = lineData.getItemVisual(idx, name + "Size");
  8051. var symbolRotate = lineData.getItemVisual(idx, name + "Rotate");
  8052. var symbolOffset = lineData.getItemVisual(idx, name + "Offset");
  8053. var symbolKeepAspect = lineData.getItemVisual(idx, name + "KeepAspect");
  8054. var symbolSizeArr = normalizeSymbolSize(symbolSize);
  8055. var symbolOffsetArr = normalizeSymbolOffset(symbolOffset || 0, symbolSizeArr);
  8056. var symbolPath = createSymbol(symbolType, -symbolSizeArr[0] / 2 + symbolOffsetArr[0], -symbolSizeArr[1] / 2 + symbolOffsetArr[1], symbolSizeArr[0], symbolSizeArr[1], null, symbolKeepAspect);
  8057. symbolPath.__specifiedRotation = symbolRotate == null || isNaN(symbolRotate) ? void 0 : +symbolRotate * Math.PI / 180 || 0;
  8058. symbolPath.name = name;
  8059. return symbolPath;
  8060. }
  8061. function createLine(points3) {
  8062. var line = new LinePath_default({
  8063. name: "line",
  8064. subPixelOptimize: true
  8065. });
  8066. setLinePoints(line.shape, points3);
  8067. return line;
  8068. }
  8069. function setLinePoints(targetShape, points3) {
  8070. targetShape.x1 = points3[0][0];
  8071. targetShape.y1 = points3[0][1];
  8072. targetShape.x2 = points3[1][0];
  8073. targetShape.y2 = points3[1][1];
  8074. targetShape.percent = 1;
  8075. var cp1 = points3[2];
  8076. if (cp1) {
  8077. targetShape.cpx1 = cp1[0];
  8078. targetShape.cpy1 = cp1[1];
  8079. } else {
  8080. targetShape.cpx1 = NaN;
  8081. targetShape.cpy1 = NaN;
  8082. }
  8083. }
  8084. var Line = (
  8085. /** @class */
  8086. function(_super) {
  8087. __extends(Line2, _super);
  8088. function Line2(lineData, idx, seriesScope) {
  8089. var _this = _super.call(this) || this;
  8090. _this._createLine(lineData, idx, seriesScope);
  8091. return _this;
  8092. }
  8093. Line2.prototype._createLine = function(lineData, idx, seriesScope) {
  8094. var seriesModel = lineData.hostModel;
  8095. var linePoints = lineData.getItemLayout(idx);
  8096. var line = createLine(linePoints);
  8097. line.shape.percent = 0;
  8098. initProps(line, {
  8099. shape: {
  8100. percent: 1
  8101. }
  8102. }, seriesModel, idx);
  8103. this.add(line);
  8104. each(SYMBOL_CATEGORIES, function(symbolCategory) {
  8105. var symbol = createSymbol2(symbolCategory, lineData, idx);
  8106. this.add(symbol);
  8107. this[makeSymbolTypeKey(symbolCategory)] = makeSymbolTypeValue(symbolCategory, lineData, idx);
  8108. }, this);
  8109. this._updateCommonStl(lineData, idx, seriesScope);
  8110. };
  8111. Line2.prototype.updateData = function(lineData, idx, seriesScope) {
  8112. var seriesModel = lineData.hostModel;
  8113. var line = this.childOfName("line");
  8114. var linePoints = lineData.getItemLayout(idx);
  8115. var target = {
  8116. shape: {}
  8117. };
  8118. setLinePoints(target.shape, linePoints);
  8119. updateProps(line, target, seriesModel, idx);
  8120. each(SYMBOL_CATEGORIES, function(symbolCategory) {
  8121. var symbolType = makeSymbolTypeValue(symbolCategory, lineData, idx);
  8122. var key = makeSymbolTypeKey(symbolCategory);
  8123. if (this[key] !== symbolType) {
  8124. this.remove(this.childOfName(symbolCategory));
  8125. var symbol = createSymbol2(symbolCategory, lineData, idx);
  8126. this.add(symbol);
  8127. }
  8128. this[key] = symbolType;
  8129. }, this);
  8130. this._updateCommonStl(lineData, idx, seriesScope);
  8131. };
  8132. ;
  8133. Line2.prototype.getLinePath = function() {
  8134. return this.childAt(0);
  8135. };
  8136. Line2.prototype._updateCommonStl = function(lineData, idx, seriesScope) {
  8137. var seriesModel = lineData.hostModel;
  8138. var line = this.childOfName("line");
  8139. var emphasisLineStyle = seriesScope && seriesScope.emphasisLineStyle;
  8140. var blurLineStyle = seriesScope && seriesScope.blurLineStyle;
  8141. var selectLineStyle = seriesScope && seriesScope.selectLineStyle;
  8142. var labelStatesModels = seriesScope && seriesScope.labelStatesModels;
  8143. var emphasisDisabled = seriesScope && seriesScope.emphasisDisabled;
  8144. var focus = seriesScope && seriesScope.focus;
  8145. var blurScope = seriesScope && seriesScope.blurScope;
  8146. if (!seriesScope || lineData.hasItemOption) {
  8147. var itemModel = lineData.getItemModel(idx);
  8148. var emphasisModel = itemModel.getModel("emphasis");
  8149. emphasisLineStyle = emphasisModel.getModel("lineStyle").getLineStyle();
  8150. blurLineStyle = itemModel.getModel(["blur", "lineStyle"]).getLineStyle();
  8151. selectLineStyle = itemModel.getModel(["select", "lineStyle"]).getLineStyle();
  8152. emphasisDisabled = emphasisModel.get("disabled");
  8153. focus = emphasisModel.get("focus");
  8154. blurScope = emphasisModel.get("blurScope");
  8155. labelStatesModels = getLabelStatesModels(itemModel);
  8156. }
  8157. var lineStyle = lineData.getItemVisual(idx, "style");
  8158. var visualColor = lineStyle.stroke;
  8159. line.useStyle(lineStyle);
  8160. line.style.fill = null;
  8161. line.style.strokeNoScale = true;
  8162. line.ensureState("emphasis").style = emphasisLineStyle;
  8163. line.ensureState("blur").style = blurLineStyle;
  8164. line.ensureState("select").style = selectLineStyle;
  8165. each(SYMBOL_CATEGORIES, function(symbolCategory) {
  8166. var symbol = this.childOfName(symbolCategory);
  8167. if (symbol) {
  8168. symbol.setColor(visualColor);
  8169. symbol.style.opacity = lineStyle.opacity;
  8170. for (var i = 0; i < SPECIAL_STATES.length; i++) {
  8171. var stateName = SPECIAL_STATES[i];
  8172. var lineState = line.getState(stateName);
  8173. if (lineState) {
  8174. var lineStateStyle = lineState.style || {};
  8175. var state = symbol.ensureState(stateName);
  8176. var stateStyle = state.style || (state.style = {});
  8177. if (lineStateStyle.stroke != null) {
  8178. stateStyle[symbol.__isEmptyBrush ? "stroke" : "fill"] = lineStateStyle.stroke;
  8179. }
  8180. if (lineStateStyle.opacity != null) {
  8181. stateStyle.opacity = lineStateStyle.opacity;
  8182. }
  8183. }
  8184. }
  8185. symbol.markRedraw();
  8186. }
  8187. }, this);
  8188. var rawVal = seriesModel.getRawValue(idx);
  8189. setLabelStyle(this, labelStatesModels, {
  8190. labelDataIndex: idx,
  8191. labelFetcher: {
  8192. getFormattedLabel: function(dataIndex, stateName) {
  8193. return seriesModel.getFormattedLabel(dataIndex, stateName, lineData.dataType);
  8194. }
  8195. },
  8196. inheritColor: visualColor || "#000",
  8197. defaultOpacity: lineStyle.opacity,
  8198. defaultText: (rawVal == null ? lineData.getName(idx) : isFinite(rawVal) ? round(rawVal) : rawVal) + ""
  8199. });
  8200. var label = this.getTextContent();
  8201. if (label) {
  8202. var labelNormalModel = labelStatesModels.normal;
  8203. label.__align = label.style.align;
  8204. label.__verticalAlign = label.style.verticalAlign;
  8205. label.__position = labelNormalModel.get("position") || "middle";
  8206. var distance = labelNormalModel.get("distance");
  8207. if (!isArray(distance)) {
  8208. distance = [distance, distance];
  8209. }
  8210. label.__labelDistance = distance;
  8211. }
  8212. this.setTextConfig({
  8213. position: null,
  8214. local: true,
  8215. inside: false
  8216. // Can't be inside for stroke element.
  8217. });
  8218. toggleHoverEmphasis(this, focus, blurScope, emphasisDisabled);
  8219. };
  8220. Line2.prototype.highlight = function() {
  8221. enterEmphasis(this);
  8222. };
  8223. Line2.prototype.downplay = function() {
  8224. leaveEmphasis(this);
  8225. };
  8226. Line2.prototype.updateLayout = function(lineData, idx) {
  8227. this.setLinePoints(lineData.getItemLayout(idx));
  8228. };
  8229. Line2.prototype.setLinePoints = function(points3) {
  8230. var linePath = this.childOfName("line");
  8231. setLinePoints(linePath.shape, points3);
  8232. linePath.dirty();
  8233. };
  8234. Line2.prototype.beforeUpdate = function() {
  8235. var lineGroup = this;
  8236. var symbolFrom = lineGroup.childOfName("fromSymbol");
  8237. var symbolTo = lineGroup.childOfName("toSymbol");
  8238. var label = lineGroup.getTextContent();
  8239. if (!symbolFrom && !symbolTo && (!label || label.ignore)) {
  8240. return;
  8241. }
  8242. var invScale = 1;
  8243. var parentNode = this.parent;
  8244. while (parentNode) {
  8245. if (parentNode.scaleX) {
  8246. invScale /= parentNode.scaleX;
  8247. }
  8248. parentNode = parentNode.parent;
  8249. }
  8250. var line = lineGroup.childOfName("line");
  8251. if (!this.__dirty && !line.__dirty) {
  8252. return;
  8253. }
  8254. var percent = line.shape.percent;
  8255. var fromPos = line.pointAt(0);
  8256. var toPos = line.pointAt(percent);
  8257. var d = sub([], toPos, fromPos);
  8258. normalize(d, d);
  8259. function setSymbolRotation(symbol, percent2) {
  8260. var specifiedRotation = symbol.__specifiedRotation;
  8261. if (specifiedRotation == null) {
  8262. var tangent2 = line.tangentAt(percent2);
  8263. symbol.attr("rotation", (percent2 === 1 ? -1 : 1) * Math.PI / 2 - Math.atan2(tangent2[1], tangent2[0]));
  8264. } else {
  8265. symbol.attr("rotation", specifiedRotation);
  8266. }
  8267. }
  8268. if (symbolFrom) {
  8269. symbolFrom.setPosition(fromPos);
  8270. setSymbolRotation(symbolFrom, 0);
  8271. symbolFrom.scaleX = symbolFrom.scaleY = invScale * percent;
  8272. symbolFrom.markRedraw();
  8273. }
  8274. if (symbolTo) {
  8275. symbolTo.setPosition(toPos);
  8276. setSymbolRotation(symbolTo, 1);
  8277. symbolTo.scaleX = symbolTo.scaleY = invScale * percent;
  8278. symbolTo.markRedraw();
  8279. }
  8280. if (label && !label.ignore) {
  8281. label.x = label.y = 0;
  8282. label.originX = label.originY = 0;
  8283. var textAlign = void 0;
  8284. var textVerticalAlign = void 0;
  8285. var distance = label.__labelDistance;
  8286. var distanceX = distance[0] * invScale;
  8287. var distanceY = distance[1] * invScale;
  8288. var halfPercent = percent / 2;
  8289. var tangent = line.tangentAt(halfPercent);
  8290. var n = [tangent[1], -tangent[0]];
  8291. var cp = line.pointAt(halfPercent);
  8292. if (n[1] > 0) {
  8293. n[0] = -n[0];
  8294. n[1] = -n[1];
  8295. }
  8296. var dir = tangent[0] < 0 ? -1 : 1;
  8297. if (label.__position !== "start" && label.__position !== "end") {
  8298. var rotation = -Math.atan2(tangent[1], tangent[0]);
  8299. if (toPos[0] < fromPos[0]) {
  8300. rotation = Math.PI + rotation;
  8301. }
  8302. label.rotation = rotation;
  8303. }
  8304. var dy = void 0;
  8305. switch (label.__position) {
  8306. case "insideStartTop":
  8307. case "insideMiddleTop":
  8308. case "insideEndTop":
  8309. case "middle":
  8310. dy = -distanceY;
  8311. textVerticalAlign = "bottom";
  8312. break;
  8313. case "insideStartBottom":
  8314. case "insideMiddleBottom":
  8315. case "insideEndBottom":
  8316. dy = distanceY;
  8317. textVerticalAlign = "top";
  8318. break;
  8319. default:
  8320. dy = 0;
  8321. textVerticalAlign = "middle";
  8322. }
  8323. switch (label.__position) {
  8324. case "end":
  8325. label.x = d[0] * distanceX + toPos[0];
  8326. label.y = d[1] * distanceY + toPos[1];
  8327. textAlign = d[0] > 0.8 ? "left" : d[0] < -0.8 ? "right" : "center";
  8328. textVerticalAlign = d[1] > 0.8 ? "top" : d[1] < -0.8 ? "bottom" : "middle";
  8329. break;
  8330. case "start":
  8331. label.x = -d[0] * distanceX + fromPos[0];
  8332. label.y = -d[1] * distanceY + fromPos[1];
  8333. textAlign = d[0] > 0.8 ? "right" : d[0] < -0.8 ? "left" : "center";
  8334. textVerticalAlign = d[1] > 0.8 ? "bottom" : d[1] < -0.8 ? "top" : "middle";
  8335. break;
  8336. case "insideStartTop":
  8337. case "insideStart":
  8338. case "insideStartBottom":
  8339. label.x = distanceX * dir + fromPos[0];
  8340. label.y = fromPos[1] + dy;
  8341. textAlign = tangent[0] < 0 ? "right" : "left";
  8342. label.originX = -distanceX * dir;
  8343. label.originY = -dy;
  8344. break;
  8345. case "insideMiddleTop":
  8346. case "insideMiddle":
  8347. case "insideMiddleBottom":
  8348. case "middle":
  8349. label.x = cp[0];
  8350. label.y = cp[1] + dy;
  8351. textAlign = "center";
  8352. label.originY = -dy;
  8353. break;
  8354. case "insideEndTop":
  8355. case "insideEnd":
  8356. case "insideEndBottom":
  8357. label.x = -distanceX * dir + toPos[0];
  8358. label.y = toPos[1] + dy;
  8359. textAlign = tangent[0] >= 0 ? "right" : "left";
  8360. label.originX = distanceX * dir;
  8361. label.originY = -dy;
  8362. break;
  8363. }
  8364. label.scaleX = label.scaleY = invScale;
  8365. label.setStyle({
  8366. // Use the user specified text align and baseline first
  8367. verticalAlign: label.__verticalAlign || textVerticalAlign,
  8368. align: label.__align || textAlign
  8369. });
  8370. }
  8371. };
  8372. return Line2;
  8373. }(Group_default)
  8374. );
  8375. var Line_default2 = Line;
  8376. // node_modules/echarts/lib/chart/helper/LineDraw.js
  8377. var LineDraw = (
  8378. /** @class */
  8379. function() {
  8380. function LineDraw2(LineCtor) {
  8381. this.group = new Group_default();
  8382. this._LineCtor = LineCtor || Line_default2;
  8383. }
  8384. LineDraw2.prototype.updateData = function(lineData) {
  8385. var _this = this;
  8386. this._progressiveEls = null;
  8387. var lineDraw = this;
  8388. var group = lineDraw.group;
  8389. var oldLineData = lineDraw._lineData;
  8390. lineDraw._lineData = lineData;
  8391. if (!oldLineData) {
  8392. group.removeAll();
  8393. }
  8394. var seriesScope = makeSeriesScope2(lineData);
  8395. lineData.diff(oldLineData).add(function(idx) {
  8396. _this._doAdd(lineData, idx, seriesScope);
  8397. }).update(function(newIdx, oldIdx) {
  8398. _this._doUpdate(oldLineData, lineData, oldIdx, newIdx, seriesScope);
  8399. }).remove(function(idx) {
  8400. group.remove(oldLineData.getItemGraphicEl(idx));
  8401. }).execute();
  8402. };
  8403. ;
  8404. LineDraw2.prototype.updateLayout = function() {
  8405. var lineData = this._lineData;
  8406. if (!lineData) {
  8407. return;
  8408. }
  8409. lineData.eachItemGraphicEl(function(el, idx) {
  8410. el.updateLayout(lineData, idx);
  8411. }, this);
  8412. };
  8413. ;
  8414. LineDraw2.prototype.incrementalPrepareUpdate = function(lineData) {
  8415. this._seriesScope = makeSeriesScope2(lineData);
  8416. this._lineData = null;
  8417. this.group.removeAll();
  8418. };
  8419. ;
  8420. LineDraw2.prototype.incrementalUpdate = function(taskParams, lineData) {
  8421. this._progressiveEls = [];
  8422. function updateIncrementalAndHover(el2) {
  8423. if (!el2.isGroup && !isEffectObject(el2)) {
  8424. el2.incremental = true;
  8425. el2.ensureState("emphasis").hoverLayer = true;
  8426. }
  8427. }
  8428. for (var idx = taskParams.start; idx < taskParams.end; idx++) {
  8429. var itemLayout = lineData.getItemLayout(idx);
  8430. if (lineNeedsDraw(itemLayout)) {
  8431. var el = new this._LineCtor(lineData, idx, this._seriesScope);
  8432. el.traverse(updateIncrementalAndHover);
  8433. this.group.add(el);
  8434. lineData.setItemGraphicEl(idx, el);
  8435. this._progressiveEls.push(el);
  8436. }
  8437. }
  8438. };
  8439. ;
  8440. LineDraw2.prototype.remove = function() {
  8441. this.group.removeAll();
  8442. };
  8443. ;
  8444. LineDraw2.prototype.eachRendered = function(cb) {
  8445. traverseElements(this._progressiveEls || this.group, cb);
  8446. };
  8447. LineDraw2.prototype._doAdd = function(lineData, idx, seriesScope) {
  8448. var itemLayout = lineData.getItemLayout(idx);
  8449. if (!lineNeedsDraw(itemLayout)) {
  8450. return;
  8451. }
  8452. var el = new this._LineCtor(lineData, idx, seriesScope);
  8453. lineData.setItemGraphicEl(idx, el);
  8454. this.group.add(el);
  8455. };
  8456. LineDraw2.prototype._doUpdate = function(oldLineData, newLineData, oldIdx, newIdx, seriesScope) {
  8457. var itemEl = oldLineData.getItemGraphicEl(oldIdx);
  8458. if (!lineNeedsDraw(newLineData.getItemLayout(newIdx))) {
  8459. this.group.remove(itemEl);
  8460. return;
  8461. }
  8462. if (!itemEl) {
  8463. itemEl = new this._LineCtor(newLineData, newIdx, seriesScope);
  8464. } else {
  8465. itemEl.updateData(newLineData, newIdx, seriesScope);
  8466. }
  8467. newLineData.setItemGraphicEl(newIdx, itemEl);
  8468. this.group.add(itemEl);
  8469. };
  8470. return LineDraw2;
  8471. }()
  8472. );
  8473. function isEffectObject(el) {
  8474. return el.animators && el.animators.length > 0;
  8475. }
  8476. function makeSeriesScope2(lineData) {
  8477. var hostModel = lineData.hostModel;
  8478. var emphasisModel = hostModel.getModel("emphasis");
  8479. return {
  8480. lineStyle: hostModel.getModel("lineStyle").getLineStyle(),
  8481. emphasisLineStyle: emphasisModel.getModel(["lineStyle"]).getLineStyle(),
  8482. blurLineStyle: hostModel.getModel(["blur", "lineStyle"]).getLineStyle(),
  8483. selectLineStyle: hostModel.getModel(["select", "lineStyle"]).getLineStyle(),
  8484. emphasisDisabled: emphasisModel.get("disabled"),
  8485. blurScope: emphasisModel.get("blurScope"),
  8486. focus: emphasisModel.get("focus"),
  8487. labelStatesModels: getLabelStatesModels(hostModel)
  8488. };
  8489. }
  8490. function isPointNaN(pt) {
  8491. return isNaN(pt[0]) || isNaN(pt[1]);
  8492. }
  8493. function lineNeedsDraw(pts) {
  8494. return pts && !isPointNaN(pts[0]) && !isPointNaN(pts[1]);
  8495. }
  8496. var LineDraw_default = LineDraw;
  8497. // node_modules/echarts/lib/coord/CoordinateSystem.js
  8498. function isCoordinateSystemType(coordSys, type) {
  8499. return coordSys.type === type;
  8500. }
  8501. export {
  8502. axisModelCreator,
  8503. layout,
  8504. AxisBuilder_default,
  8505. collect,
  8506. getAxisInfo,
  8507. makeKey,
  8508. AxisView_default,
  8509. rectCoordAxisBuildSplitArea,
  8510. rectCoordAxisHandleRemove,
  8511. install,
  8512. install2,
  8513. View_default,
  8514. geoSourceManager_default,
  8515. updateCenterAndZoom,
  8516. RoamController_default,
  8517. updateViewOnPan,
  8518. updateViewOnZoom,
  8519. onIrrelevantElement,
  8520. MapDraw_default,
  8521. install3,
  8522. sliderMove,
  8523. BrushController_default,
  8524. makeRectPanelClipPath,
  8525. makeLinearBrushOtherExtent,
  8526. makeRectIsTargetByCursor,
  8527. install4,
  8528. isEC4CompatibleStyle,
  8529. convertFromEC4CompatibleStyle,
  8530. convertToEC4StyleForCustomSerise,
  8531. warnDeprecated,
  8532. applyUpdateTransition,
  8533. updateLeaveTo,
  8534. applyLeaveTransition,
  8535. isTransitionAll,
  8536. stopPreviousKeyframeAnimationAndRestore,
  8537. applyKeyframeAnimation,
  8538. VisualMapping_default,
  8539. getDefaultLabel,
  8540. getDefaultInterpolatedLabel,
  8541. Symbol_default,
  8542. SymbolDraw_default,
  8543. Line_default2 as Line_default,
  8544. LineDraw_default,
  8545. isCoordinateSystemType
  8546. };
  8547. //# sourceMappingURL=chunk-O6ZB44ZF.js.map