rave-library-map.js 345 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763
  1. ;(function(root, factory) {
  2. if (typeof define === 'function' && define.amd) {
  3. define(['rave', 'rave-library', 'rave-utilities', 'rave-layouts', 'rave-legends'], factory);
  4. } else if (typeof exports === 'object') {
  5. module.exports = factory(require('rave'), require('rave-library'), require('rave-utilities'), require('rave-layouts'), require('rave-legends'));
  6. } else {
  7. root.raveLibraryMap = factory(root.rave, root.raveLibrary, root.raveUtilities, root.raveLayouts, root.raveLegends);
  8. }
  9. }(this, function(rave, raveLibrary, raveUtilities, raveLayouts, raveLegends) {
  10. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  11. module.exports=[{"datamodels":[{"description":"datamodel.tabular.map.new.description","id":"tabular","label":"datamodel.tabular.map.new.label","datasets":[{"dataslots":[{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/map_32.svg"},"description":"dataslot.map.featureIdentifier.description","id":"featureId","label":"dataslot.map.featureIdentifier.label","cardinality":"1","datatypes":["numeric","string"]},{"icon":{"image":"..\/rave-library\/resources\/color_by_32.png","svg":"..\/rave-library\/resources\/region_color_by_32.svg"},"description":"dataslot.map.featureColor.description","id":"featureColor","label":"dataslot.map.featureColor.label","cardinality":"0..1","datatypes":["numeric","string"]},{"icon":{"image":"..\/rave-library\/resources\/color_by_32.png","svg":"..\/rave-library\/resources\/point_color_by_32.svg"},"description":"dataslot.map.bubbleColor.description","id":"bubbleColor","label":"dataslot.map.bubbleColor.label","cardinality":"0..1","datatypes":["numeric","string"]},{"icon":{"image":"..\/rave-library\/resources\/size_32.png","svg":"..\/rave-library\/resources\/size_32.svg"},"description":"dataslot.map.bubbleSize.description","id":"bubbleSize","label":"dataslot.map.bubbleSize.label","cardinality":"0..1","datatypes":["numeric"]},{"icon":{"image":"..\/rave-library\/resources\/label_32.png","svg":"..\/rave-library\/resources\/label_32.svg"},"description":"dataslot.map.featureLabel.description","id":"featureLabel","label":"dataslot.map.featureLabel.label","cardinality":"0..1","datatypes":["string"]}],"description":"dataset.tabular.map.new.description","id":"data","label":"dataset.tabular.label","type":"tabular","cardinality":"1"}],"tags":["bubble","region","tabular"]}]},{"properties":{"border":{"type":"object","properties":{"color":{"default":"white","name":"border.color.name","description":"border.color.description","type":"color"},"width":{"default":"1px","name":"border.width.name","description":"border.width.description","type":"string"}}},"regionAnimationDuration":{"default":1000,"name":"region.animation.duration.name","description":"region.animation.duration.description","type":"numeric"},"color":{"type":"object","properties":{"pointPalette":{"default":"rave2","name":"color.point.palette.name","options":["categorical","continuous"],"description":"color.point.palette.description","type":"palette"},"featureDynamicPalette":{"type":"object","properties":{"min":{"default":null,"name":"color.featureDynamicPalette.min.name","description":"color.featureDynamicPalette.min.description","type":"color"},"max":{"default":null,"name":"color.featureDynamicPalette.max.name","description":"color.featureDynamicPalette.max.description","type":"color"},"mid":{"default":null,"name":"color.featureDynamicPalette.mid.name","description":"color.featureDynamicPalette.mid.description","type":"color"}}},"null":{"default":"silver","name":"color.null.name","description":"color.null.description","type":"color"},"pointDynamicPalette":{"type":"object","properties":{"min":{"default":null,"name":"color.pointDynamicPalette.min.name","description":"color.pointDynamicPalette.min.description","type":"color"},"max":{"default":null,"name":"color.pointDynamicPalette.max.name","description":"color.pointDynamicPalette.max.description","type":"color"},"mid":{"default":null,"name":"color.pointDynamicPalette.mid.name","description":"color.pointDynamicPalette.mid.description","type":"color"}}},"featurePalette":{"default":"ChoroplethPalette","name":"color.feature.palette.name","options":["categorical","continuous"],"description":"color.feature.palette.description","type":"palette"}}},"bubbleBorder":{"type":"object","properties":{"color":{"default":"white","name":"bubbleBorder.color.name","description":"bubbleBorder.color.description","type":"color"},"width":{"default":"1px","name":"bubbleBorder.width.name","description":"bubbleBorder.width.description","type":"string"}}},"maxZoom":{"default":15,"name":"max.zoom.name","description":"max.zoom.description","type":"numeric"},"mapProjection":{"default":"mercator","name":"map.projection.name","options":[{"id":"map.projection.options.albersUsa","value":"albersUsa"},{"id":"map.projection.options.albers","value":"albers"},{"id":"map.projection.options.equirectangular","value":"equirectangular"},{"id":"map.projection.options.mercator","value":"mercator"},{"id":"map.projection.options.stereoGraphic","value":"stereoGraphic"},{"id":"map.projection.options.winkelTriple","value":"winkelTriple"}],"description":"map.projection.description","type":"string"},"legendAnimation":{"default":"transition","name":"legend.animation.name","options":[{"id":"legend.animation.options.transition","value":"transition"},{"id":"legend.animation.options.none","value":"none"}],"description":"legend.animation.description","type":"string"},"minBubbleSize":{"default":"10","name":"min.bubble.size.name","description":"min.bubble.size.description","type":"string"},"legend":{"type":"object","properties":{"size":{"type":"object","properties":{"display":{"trueLabel":"map.trueLabel.sizeLegend","default":true,"falseLabel":"map.falseLabel.sizeLegend","resetView":"layout","name":"legend.size.display.name","description":"legend.size.display.name","type":"boolean"},"title":{"default":"","name":"legend.size.title.name","description":"legend.size.title.description","type":"string"},"titlestyle":{"type":"object","properties":{"fontfamily":{"default":null,"name":"legend.size.titlestyle.fontfamily.name","description":"legend.size.titlestyle.fontfamily.description","type":"string"},"fontsize":{"default":null,"name":"legend.size.titlestyle.fontsize.name","description":"legend.size.titlestyle.fontsize.description","type":"string"},"fill":{"default":null,"name":"legend.size.titlestyle.fill.name","description":"legend.size.titlestyle.fill.description","type":"color"}}}}},"bubble":{"type":"object","properties":{"display":{"trueLabel":"map.trueLabel.bubbleLegend","default":true,"falseLabel":"map.falseLabel.bubbleLegend","resetView":"layout","name":"legend.bubble.display.name","description":"legend.bubble.display.name","type":"boolean"},"title":{"default":"","name":"legend.bubble.title.name","description":"legend.bubble.title.description","type":"string"},"titlestyle":{"type":"object","properties":{"fontfamily":{"default":null,"name":"legend.bubble.titlestyle.fontfamily.name","description":"legend.bubble.titlestyle.fontfamily.description","type":"string"},"fontsize":{"default":null,"name":"legend.bubble.titlestyle.fontsize.name","description":"legend.bubble.titlestyle.fontsize.description","type":"string"},"fill":{"default":null,"name":"legend.bubble.titlestyle.fill.name","description":"legend.bubble.titlestyle.fill.description","type":"color"}}}}},"position":{"default":"right","resetView":"layout","name":"legend.position.name","options":[{"id":"legend.position.options.top","value":"top"},{"id":"legend.position.options.bottom","value":"bottom"},{"id":"legend.position.options.left","value":"left"},{"id":"legend.position.options.right","value":"right"}],"description":"legend.position.description","type":"string"},"map":{"type":"object","properties":{"display":{"trueLabel":"map.trueLabel.display","default":true,"falseLabel":"map.falseLabel.display","resetView":"layout","name":"legend.map.display.name","description":"legend.map.display.name","type":"boolean"},"title":{"default":"","name":"legend.map.title.name","description":"legend.map.title.description","type":"string"},"titlestyle":{"type":"object","properties":{"fontfamily":{"default":null,"name":"legend.map.titlestyle.fontfamily.name","description":"legend.map.titlestyle.fontfamily.description","type":"string"},"fontsize":{"default":null,"name":"legend.map.titlestyle.fontsize.name","description":"legend.map.titlestyle.fontsize.description","type":"string"},"fill":{"default":null,"name":"legend.map.titlestyle.fill.name","description":"legend.map.titlestyle.fill.description","type":"color"}}}}}}},"maxBubbleSize":{"default":"50","name":"max.bubble.size.name","description":"max.bubble.size.description","type":"string"},"mapRotationLongitude":{"default":0,"name":"map.rotation.longitude.name","description":"map.rotation.longitude.description","type":"numeric"},"regionAnimation":{"default":"transition","name":"region.animation.name","options":[{"id":"region.animation.options.transition","value":"transition"},{"id":"region.animation.options.none","value":"none"}],"description":"region.animation.description","type":"string"},"bubbleAnimation":{"default":"transition","name":"bubble.animation.name","options":[{"id":"bubble.animation.options.transition","value":"transition"},{"id":"bubble.animation.options.none","value":"none"}],"description":"bubble.animation.description","type":"string"},"mapRotationLatitude":{"default":0,"name":"map.rotation.latitude.name","description":"map.rotation.latitude.description","type":"numeric"},"geoJSONObject":{"name":"geojson.object.name","description":"geojson.object.description","type":"jsonobject"},"flashDuration":{"default":800,"name":"flash.duration.name","description":"flash.duration.description","type":"numeric"},"bubbleAnimationDuration":{"default":1000,"name":"bubble.animation.duration.name","description":"bubble.animation.duration.description","type":"numeric"},"showLabels":{"trueLabel":"map.trueLabel.labels","default":true,"falseLabel":"map.falseLabel.labels","name":"show.labels.name","description":"show.labels.description","type":"boolean"},"dropLabels":{"trueLabel":"map.trueLabel.dropLabels","default":false,"falseLabel":"map.falseLabe.dropLabels","name":"drop.labels.name","description":"drop.labels.description","type":"boolean"},"bubbleSize":{"default":"2","name":"bubble.size.name","description":"bubble.size.description","type":"string"},"legendAnimationDuration":{"default":1000,"name":"legend.animation.duration.name","description":"legend.animation.duration.description","type":"numeric"},"idLookup":{"default":"id","name":"id.lookup.name","description":"id.lookup.description","type":"string"},"flash":{"trueLabel":"map.trueLabel.flash","default":true,"falseLabel":"map.falseLabel.flash","name":"flash.name","description":"flash.description","type":"boolean"}}},{"properties":{"background":{"type":"object","properties":{"elements":{"type":"object","properties":{"color":{"default":"#FFFFFF","name":"background.elements.color.name","description":"background.elements.color.description","type":"color"}}},"chart":{"type":"object","properties":{"color":{"default":"#FFFFFF","name":"background.chart.color.name","description":"background.chart.color.description","type":"color"}}}}}}},{"properties":{"layout":{"type":"object","properties":{"padding":{"default":"10","resetView":"layout","name":"layout.padding.name","description":"layout.padding.description","type":"padding"},"legendsize":{"type":"object","properties":{"min":{"default":"0","resetView":"layout","name":"layout.legendsize.min.name","description":"layout.legendsize.min.description","type":"length"},"max":{"default":"20%","resetView":"layout","name":"layout.legendsize.max.name","description":"layout.legendsize.max.description","type":"length"},"preferred":{"default":"20%","resetView":"layout","name":"layout.legendsize.preferred.name","description":"layout.legendsize.preferred.description","type":"length"}}},"legendchart":{"type":"object","properties":{"gap":{"default":"10","resetView":"layout","name":"layout.legendchart.gap.name","description":"layout.legendchart.gap.description","type":"length"},"align":{"default":false,"resetView":"layout","name":"layout.legendchart.align.name","description":"layout.legendchart.align.description","type":"boolean"}}},"chart":{"type":"object","properties":{"padding":{"type":"object","properties":{"top":{"default":"0","resetView":"layout","name":"layout.chart.padding.top.name","description":"layout.chart.padding.top.description","type":"length"},"left":{"default":"0","resetView":"layout","name":"layout.chart.padding.left.name","description":"layout.chart.padding.left.description","type":"length"},"bottom":{"default":"0","resetView":"layout","name":"layout.chart.padding.bottom.name","description":"layout.chart.padding.bottom.description","type":"length"},"right":{"default":"0","resetView":"layout","name":"layout.chart.padding.right.name","description":"layout.chart.padding.right.description","type":"length"}}}}}}}}},{"previews":{"image":[{"file":"resources\/preview_map_small.png","tags":["small","notext"]}],"svg":[{"file":"resources\/preview_map_small.svg","tags":["small","notext"]}]},"genericMeta":{"copyright":"IBM 2015, 2016","author":"IBM","description":"map.description","id":"rave-library-map","label":"map.label","version":"1.0.0","tags":["map"]}},{"actions":[{"args":[{"icon":null,"description":"actions.args.selector.description","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.applyHighlight.description","binding":[{"event":"mouseover","target":".element-shape-path"},{"event":"mouseover","target":".element-shape-path"}],"id":"highlight","label":"actions.applyHighlight.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.selector.description","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.removeHighlight.description","binding":[{"event":"mouseout","target":".element-shape-path"},{"event":"mouseout","target":".element-shape-path"}],"id":"unhighlight","label":"actions.removeHighlight.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.selector.label","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.applySelection.description","binding":[{"event":"mouseover","target":".element-shape"}],"id":"select","label":"actions.applySelection.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.selector.description","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.removeSelection.description","binding":[{"event":"mouseout","target":".element-shape"}],"id":"deselect","label":"actions.removeSelection.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.selector.description","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.removeAllSelect.description","binding":[{"event":"click","target":".background"}],"id":"deselectAll","label":"actions.removeAllSelect.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.primarySelector.description","id":"PrimarySelector","label":"actions.args.primarySelector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.secondarySelector.description","id":"secondarySelector","label":"actions.args.secondarySelector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.primaryAttributes.description","id":"PrimaryStyles","label":"actions.args.primaryAttributes.label","type":"attributeMap","tags":[]},{"icon":null,"description":"actions.args.secondaryAttributes.description","id":"SecondarySyles","label":"actions.args.secondaryAttributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.toggleSelect.description","binding":[{"event":"mouseout","target":".element-shape-path"},{"event":"mouseout","target":".element-shape-path"}],"id":"toggleSelect","label":"actions.toggleSelect.label","tags":[]},{"icon":null,"options":[],"description":"actions.zoom.description","binding":[{"event":"dblclick","target":".element"}],"id":"zoomMap","label":"actions.zoom.label","tags":[]}]},{"colorpalettes":[{"fillType":"continuous","valueType":"normalized","icon":"someicon","description":"A palette for the Choropleth Map.","id":"ChoroplethPalette","label":"Choropleth Palette","fills":[{"at":"lower","fill":"rgb(255, 255, 255)"},{"at":0.0,"fill":"rgb(255, 255, 255)"},{"at":0.5,"fill":"rgb(50, 50, 180)"},{"at":1.0,"fill":"rgb(0, 0, 100)"},{"at":"upper","fill":"rgb(0, 0, 100)"}]},{"default":"white","fillType":"conditional","icon":"someicon","description":"A Conditional Palette.","id":"ConditionalPalette","label":"Conditional Palette","fills":[{"values":["Fred","Coke","Canada"],"fill":"red"},{"values":["Sweden","Moscow","Molson"],"fill":"blue"},{"values":["Ireland","Boston","Ginger Ale"],"fill":"green"},{"values":["Australia","Miami","Corona"],"fill":"brown"}]}]},{"propertyPresentations":[{"presentationItems":[{"propertyID":"legend.bubble.display"},{"propertyID":"legend.bubble.title"},{"propertyID":"legend.map.display"},{"propertyID":"legend.map.title"},{"propertyID":"legend.size.display"},{"propertyID":"legend.size.title"}],"icon":"","description":"propertyPresentation.simple.description","id":"simple","label":"propertyPresentation.simple.label","tags":["Map","Map Properties Presentation","Simple","ca.dashboard"]},{"presentationItems":[{"propertyGroup":{"presentationItems":[{"propertyID":"background.chart.color"},{"propertyID":"background.elements.color"},{"propertyID":"color.featureDynamicPalette.max"},{"propertyID":"color.featureDynamicPalette.mid"},{"propertyID":"color.featureDynamicPalette.min"},{"propertyID":"color.featurePalette"},{"propertyID":"color.pointPalette"},{"propertyID":"color.pointDynamicPalette.max"},{"propertyID":"color.pointDynamicPalette.mid"},{"propertyID":"color.pointDynamicPalette.min"},{"propertyID":"layout.padding"}],"icon":"","description":"propertyPresentation.advanced.commonProperties.description","id":"commonProperties","label":"propertyPresentation.advanced.commonProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"border.color"},{"propertyID":"border.width"},{"propertyID":"bubbleAnimationDuration"},{"propertyID":"legendAnimationDuration"},{"propertyID":"regionAnimationDuration"},{"propertyID":"flash"},{"propertyID":"flashDuration"},{"propertyID":"bubbleBorder.color"},{"propertyID":"bubbleBorder.width"},{"propertyID":"bubbleSize"},{"propertyID":"dropLabels"},{"propertyID":"geoJSONObject"},{"propertyID":"idLookup"},{"propertyID":"maxBubbleSize"},{"propertyID":"maxZoom"},{"propertyID":"minBubbleSize"},{"propertyID":"showLabels"},{"propertyID":"mapProjection"},{"propertyID":"mapRotationLongitude"},{"propertyID":"mapRotationLatitude"}],"icon":"","description":"map.propertyPresentation.advanced.mapSpecificProperties.description","id":"mapSpecificProperties","label":"map.propertyPresentation.advanced.mapSpecificProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"legend.position"},{"propertyID":"legend.bubble.display"},{"propertyID":"legend.bubble.title"},{"propertyID":"legend.bubble.titlestyle.fontsize"},{"propertyID":"legend.bubble.titlestyle.fill"},{"propertyID":"legend.bubble.titlestyle.fontfamily"},{"propertyID":"legend.map.display"},{"propertyID":"legend.map.title"},{"propertyID":"legend.map.titlestyle.fontsize"},{"propertyID":"legend.map.titlestyle.fill"},{"propertyID":"legend.map.titlestyle.fontfamily"},{"propertyID":"legend.size.display"},{"propertyID":"legend.size.title"},{"propertyID":"legend.size.titlestyle.fontsize"},{"propertyID":"legend.size.titlestyle.fill"},{"propertyID":"legend.size.titlestyle.fontfamily"}],"icon":"","description":"propertyPresentation.advanced.legendProperties.description","id":"legendProperties","label":"propertyPresentation.advanced.legendProperties.label","tags":[]}}],"icon":"","description":"propertyPresentation.advanced.description","id":"advanced","label":"propertyPresentation.advanced.label","tags":["Map","Map Properties Presentation","advanced","ca.reporting"]}]},{"configurations":[{"previews":{"image":[{"file":"resources\/preview_map_small.png","tags":["small","notext"]}],"svg":[{"file":"resources\/preview_map_small.svg","tags":["small","notext"]}]},"genericMeta":{"description":"map.config.map.description","id":"map","label":"map.config.map.label","tags":[]},"properties":[{"id":"background.chart.color","value":"transparent"},{"id":"background.elements.color","value":"transparent"}]}]},{"build":"development","name":"rave-library-map","description":"This is the IBM Rave map bundle.","ignore":["bower.json"],"main":"bundle.js","version":"0.0.0","dependencies":{"rave-legends":"<2.0.0","rave-library":"<2.0.0","rave":"<3.0.0","rave-layouts":"<2.0.0","rave-utilities":"<2.0.0"}}]
  12. },{}],2:[function(require,module,exports){
  13. module.exports={
  14. "actions.applyHighlight.description": "Highlights a node.",
  15. "actions.applyHighlight.label": "Apply highlight action",
  16. "actions.applySelection.description": "Selects a node.",
  17. "actions.applySelection.label": "Apply selection action",
  18. "actions.args.attributes.description": "Optional map of attribute to value that is applied during the action.",
  19. "actions.args.attributes.label": "Optional attributes function argument",
  20. "actions.args.primaryAttributes.description": "Optional map of primary attributes that are applied during the action.",
  21. "actions.args.primaryAttributes.label": "Optional primary attributes function argument",
  22. "actions.args.primarySelector.description": "Primary selector for the nodes that the action is to apply to.",
  23. "actions.args.primarySelector.label": "Primary selector function argument",
  24. "actions.args.secondaryAttributes.description": "Optional map of secondary attributes that are applied during the action.",
  25. "actions.args.secondaryAttributes.label": "Optional secondary attributes function argument",
  26. "actions.args.secondarySelector.description": "Secondary selector for the nodes that the action is to apply to.",
  27. "actions.args.secondarySelector.label": "Secondary selector function argument",
  28. "actions.args.selector.description": "Selector of the node that the action will apply to.",
  29. "actions.args.selector.label": "Selector function argument",
  30. "actions.breadCrumb.description": "Navigates up and down in detail through a bread crumb.",
  31. "actions.breadCrumb.label": "Bread crumb navigation action",
  32. "actions.chord.selector.description": "Selector for the chords that the action will apply to.",
  33. "actions.chord.selector.label": "Selector function argument for chords",
  34. "actions.chord.toggleSelect.description": "Toggles selection on a chord.",
  35. "actions.chord.toggleSelect.label": "Toggle select on chord action",
  36. "actions.chordGroup.highlight.description": "Highlights a chord group and everything that is connected to it.",
  37. "actions.chordGroup.highlight.label": "Chord group highlight action",
  38. "actions.chordGroup.removeHighlight.description": "Removes highlights from a chord group and everything connected to it.",
  39. "actions.chordGroup.removeHighlight.label": "Chord group remove highlight action",
  40. "actions.chordGroup.selector.description": "Selector for the chord groups that the action will apply to.",
  41. "actions.chordGroup.selector.label": "Selector function argument for chord groups",
  42. "actions.drillDown.description": "Drills down to the next level of detail.",
  43. "actions.drillDown.label": "Drill down action",
  44. "actions.removeAllSelect.description": "Removes all selections from all nodes.",
  45. "actions.removeAllSelect.label": "Remove all selections action",
  46. "actions.removeHighlight.description": "Removes a highlight from a node.",
  47. "actions.removeHighlight.label": "Remove highlight action",
  48. "actions.removeSelection.description": "Removes a selection from a node.",
  49. "actions.removeSelection.label": "Remove selection action",
  50. "actions.toggleSelect.description": "Toggles the selection on a node.",
  51. "actions.toggleSelect.label": "Toggle selection action",
  52. "actions.zoom.args.panX.description": "The amount to pan in the x direction.",
  53. "actions.zoom.args.panX.label": "Zoom x pan amount function argument",
  54. "actions.zoom.args.panY.description": "The amount to pan in the y direction.",
  55. "actions.zoom.args.panY.label": "Zoom y pan amount function argument",
  56. "actions.zoom.args.scale.description": "The scale amount for the zoom action.",
  57. "actions.zoom.args.scale.label": "Zoom scale function argument",
  58. "actions.zoom.description": "Zoom action",
  59. "actions.zoom.label": "Zoom action",
  60. "actions.zoomPackedBubble.description": "Zoom for a packed bubble.",
  61. "actions.zoomPackedBubble.label": "Zoom packed bubble action",
  62. "background.chart.color.description": "The background color of the chart.",
  63. "background.chart.color.name": "Background color",
  64. "background.color.description": "The background color behind the elements of the chart.",
  65. "background.elements.color.description": "The background color behind the elements of the chart.",
  66. "background.elements.color.name": "Elements background color",
  67. "border.color.description": "The color of the borders between features.",
  68. "border.color.name": "Border color",
  69. "border.width.description": "The width of the border.",
  70. "border.width.name": "Border width",
  71. "bubble.animation.description": "The effect that is used to animate the initial bubble.",
  72. "bubble.animation.duration.description": "The duration of the initial bubble animation in ms.",
  73. "bubble.animation.duration.name": "Bubble animation duration",
  74. "bubble.animation.name": "Bubble animation",
  75. "bubble.animation.options.none": "None",
  76. "bubble.animation.options.transition": "Transition",
  77. "bubble.size.description": "The radius of bubbles, in pixels, when bubbles are not sized by data.",
  78. "bubble.size.name": "Bubble size",
  79. "bubbleBorder.color.description": "The color of the bubble borders.",
  80. "bubbleBorder.color.name": "Bubble border color",
  81. "bubbleBorder.width.description": "The width of the bubble borders.",
  82. "bubbleBorder.width.name": "Bubble border width",
  83. "color.feature.palette.description": "The color palette that is used to color features in the map.",
  84. "color.feature.palette.name": "Feature color palette",
  85. "color.featureDynamicPalette.max.description": "The color that is used for the maximum value of a feature dynamic palette.",
  86. "color.featureDynamicPalette.max.name": "Feature maximum value color",
  87. "color.featureDynamicPalette.mid.description": "The color that is used for the middle value of a feature dynamic palette.",
  88. "color.featureDynamicPalette.mid.name": "Feature middle value color",
  89. "color.featureDynamicPalette.min.description": "The color that is used for the minimum value of a feature dynamic palette.",
  90. "color.featureDynamicPalette.min.name": "Feature minimum value color",
  91. "color.null.description": "The color that is applied to null values.",
  92. "color.null.name": "Null value color",
  93. "color.point.palette.description": "The color palette that is used to color points in the map.",
  94. "color.point.palette.name": "Point color palette",
  95. "color.pointDynamicPalette.max.description": "The color that is used for the maximum value of a point dynamic palette.",
  96. "color.pointDynamicPalette.max.name": "Point maximum value color",
  97. "color.pointDynamicPalette.mid.description": "The color that is used for the middle value of a point dynamic palette.",
  98. "color.pointDynamicPalette.mid.name": "Point middle value color",
  99. "color.pointDynamicPalette.min.description": "The color that is used for the minimum value of a point dynamic palette.",
  100. "color.pointDynamicPalette.min.name": "Point minimum value color",
  101. "data.handling.description": "The configuration that is used to plot the data.",
  102. "data.handling.name": "Configuration",
  103. "datamodel.hierarchial.label": "Hierarchical data model",
  104. "datamodel.tabular.label": "Tabular data model",
  105. "datamodel.tabular.map.description": "The simple map model, providing feature name, color, label, and point data with x and y, size, and label.",
  106. "datamodel.tabular.map.new.description": "The data model that uses feature matching to color each region and overlay a bubble.",
  107. "datamodel.tabular.map.new.label": "Tabular regions and bubbles",
  108. "dataset.hierarchial.label": "Hierarchical data set",
  109. "dataset.tabular.description": "The tabular data set of rows and columns.",
  110. "dataset.tabular.label": "Tabular data set",
  111. "dataset.tabular.link.description": "Determines the links between the nodes.",
  112. "dataset.tabular.link.label": "Tabular links data set",
  113. "dataset.tabular.map.description": "The tabular map data that is used with the GeoJSON features (feature ID data to GeoJSON ID lookup property).",
  114. "dataset.tabular.map.new.description": "The data set that uses feature matching to color each region and overlay a bubble.",
  115. "dataset.tabular.map.point.description": "The tabular data for points plotted on top of the map data.",
  116. "dataset.tabular.node.description": "The tabular data set that defines the nodes.",
  117. "dataset.tabular.node.label": "Tabular node data set",
  118. "dataslot.categories.label": "Categories",
  119. "dataslot.category.label": "Category",
  120. "dataslot.children.description": "When applied to a tree node, returns the children of that node as an array-list.",
  121. "dataslot.children.label": "Children",
  122. "dataslot.color.description": "Determines the color of the shape.",
  123. "dataslot.color.label": "Color",
  124. "dataslot.key.description": "Called for each row to match elements. Primarily used for transitions.",
  125. "dataslot.key.label": "Key",
  126. "dataslot.label.description": "Determines the label of the shape.",
  127. "dataslot.label.label": "Label",
  128. "dataslot.label.map.description": "The label of the map feature. This value is optional. If the value is not provided, the feature name is used.",
  129. "dataslot.map.bubbleColor.description": "If set, bubbles will be drawn for each feature. Numeric values are used to determine the color of each bubble.",
  130. "dataslot.map.bubbleColor.label": "Bubble color",
  131. "dataslot.map.bubbleSize.description": "If set, bubbles will be drawn for each feature. Numeric values are used to determine the size of each bubble.",
  132. "dataslot.map.bubbleSize.label": "Bubble size",
  133. "dataslot.map.featureColor.description": "The color of the map feature.",
  134. "dataslot.map.featureColor.label": "Feature value",
  135. "dataslot.map.featureIdentifier.description": "The identifier that is matched to the GeoJSON using the ID lookup property.",
  136. "dataslot.map.featureIdentifier.label": "Feature identifier",
  137. "dataslot.map.featureLabel.description": "The label to associate with each feature. If not specified, the feature ID is used.",
  138. "dataslot.map.featureLabel.label": "Feature label",
  139. "dataslot.maximumValue.label": "Maximum value",
  140. "dataslot.source.label": "Source",
  141. "dataslot.sourceValue.label": "Source value",
  142. "dataslot.tabular.id.description": "The identifier for the nodes.",
  143. "dataslot.tabular.id.label": "Identifier",
  144. "dataslot.tabular.size.description": "Determines the size of the shape.",
  145. "dataslot.tabular.size.label": "Size",
  146. "dataslot.target.label": "Target",
  147. "dataslot.targetValue.label": "Target value",
  148. "dataslot.value.label": "Value",
  149. "dataslot.x.label": "X axis",
  150. "dataslot.x.map.point.description": "The numeric x (longitude) position, in the same coordinates as the GeoJSON.",
  151. "dataslot.y.label": "Y axis",
  152. "dataslot.y.map.point.description": "The numeric y (latitude) position, in the same coordinates as the GeoJSON.",
  153. "default.pan.zoom.description": "When set to Yes, the visualization uses the built-in pan-zoom behavior. Set to No to allow for custom pan and zoom actions.",
  154. "default.pan.zoom.name": "Default pan-zoom behavior",
  155. "defaultPalette.description": "Rave2 default description",
  156. "defaultPalette.label": "Rave2 default",
  157. "display.graticule.description": "Shows or hides the graticule.",
  158. "display.graticule.name": "Show graticule",
  159. "drop.labels.description": "Keeps or drops overlapping labels.",
  160. "drop.labels.name": "Drop overlapping labels",
  161. "effect.duration.description": "The animation duration, in ms.",
  162. "effect.duration.name": "Animation duration (ms)",
  163. "effect.name.description": "The effect that is used when the chart is drawn.",
  164. "effect.name.name": "Animation",
  165. "feature.label.color.description": "The color of the feature labels.",
  166. "feature.label.color.name": "Feature label color",
  167. "feature.label.font.description": "The font of the feature labels.",
  168. "feature.label.font.name": "Feature label font",
  169. "feature.label.size.description": "The size of the feature labels.",
  170. "feature.label.size.name": "Feature label size",
  171. "flash.description": "Specifies whether to flash regions.",
  172. "flash.duration.description": "The duration of flashing regions and bubbles in ms.",
  173. "flash.duration.name": "Flash duration",
  174. "flash.name": "Flash",
  175. "geodata.index.description": "The index of the GeoJSON that the data corresponds to.",
  176. "geodata.index.name": "GeoJSON data index",
  177. "geojson.object.description": "The JSONObject that is loaded for the GeoJSON.",
  178. "geojson.object.name": "GeoJSON JSONObject",
  179. "geojson.url.description": "The URL of the GeoJSON file.",
  180. "geojson.url.name": "GeoJSON URL",
  181. "graticule.color.description": "The color of the graticule.",
  182. "graticule.color.name": "Graticule color",
  183. "graticule.stroke.thickness.description": "The stroke thickness for the graticule.",
  184. "graticule.stroke.thickness.name": "Graticule stroke thickness",
  185. "grid.color.description": "The color of the grid lines.",
  186. "grid.color.name": "Grid lines color",
  187. "grid.display.description": "Show or hide the grid lines.",
  188. "grid.display.name": "Show grid lines",
  189. "id.lookup.description": "The dot separated field names for feature ids.",
  190. "id.lookup.name": "ID lookup",
  191. "labelResolution.description": "The method that is used to resolve labels.",
  192. "labelResolution.name": "Label resolution",
  193. "labelResolution.options.DropLabels": "Drop labels",
  194. "labelResolution.options.MoveLabels": "Move labels",
  195. "labelResolution.options.none": "None",
  196. "layout.axissize.bottom.max.description": "The maximum size of the bottom axis, as a CSS size or percentage.",
  197. "layout.axissize.bottom.max.name": "Bottom axis maximum size",
  198. "layout.axissize.bottom.min.description": "The minimum size of the bottom axis, as a CSS size or percentage.",
  199. "layout.axissize.bottom.min.name": "Bottom axis minimum size",
  200. "layout.axissize.bottom.preferred.description": "The preferred size of the bottom axis, as a CSS size or percentage.",
  201. "layout.axissize.bottom.preferred.name": "Bottom axis preferred size",
  202. "layout.axissize.left.max.description": "The maximum size of the left axis, as a CSS size or percentage.",
  203. "layout.axissize.left.max.name": "Left axis maximum size",
  204. "layout.axissize.left.min.description": "The minimum size of the left axis, as a CSS size or percentage.",
  205. "layout.axissize.left.min.name": "Left axis minimum size",
  206. "layout.axissize.left.preferred.description": "The preferred size of the left axis, as a CSS size or percentage.",
  207. "layout.axissize.left.preferred.name": "Left axis preferred size",
  208. "layout.axissize.right.max.description": "The maximum size of the right axis, as a CSS size or percentage.",
  209. "layout.axissize.right.max.name": "Right axis maximum size",
  210. "layout.axissize.right.min.description": "The minimum size of the right axis, as a CSS size or percentage.",
  211. "layout.axissize.right.min.name": "Right axis minimum size",
  212. "layout.axissize.right.preferred.description": "The preferred size of the right axis, as a CSS size or percentage.",
  213. "layout.axissize.right.preferred.name": "Right axis preferred size",
  214. "layout.axissize.top.max.description": "The maximum size of the top axis, as a CSS size or percentage.",
  215. "layout.axissize.top.max.name": "Top axis maximum size",
  216. "layout.axissize.top.min.description": "The minimum size of the top axis, as a CSS size or percentage.",
  217. "layout.axissize.top.min.name": "Top axis minimum size",
  218. "layout.axissize.top.preferred.description": "The preferred size of the top axis, as a CSS size or percentage.",
  219. "layout.axissize.top.preferred.name": "Top axis preferred size",
  220. "layout.chart.padding.bottom.description": "The bottom padding for the chart.",
  221. "layout.chart.padding.bottom.name": "Bottom padding",
  222. "layout.chart.padding.left.description": "The left padding for the chart.",
  223. "layout.chart.padding.left.name": "Left padding",
  224. "layout.chart.padding.right.description": "Right padding for the chart.",
  225. "layout.chart.padding.right.name": "Right padding",
  226. "layout.chart.padding.top.description": "The top padding for the chart.",
  227. "layout.chart.padding.top.name": "Top padding",
  228. "layout.legendchart.align.description": "Whether to align the legend to the interior of the chart.",
  229. "layout.legendchart.align.name": "Align legend to chart",
  230. "layout.legendchart.gap.description": "Space between the chart and the legend, as a CSS size or percentage.",
  231. "layout.legendchart.gap.name": "Space between legend and chart",
  232. "layout.legendsize.max.description": "The maximum size of the legend, as a CSS size or percentage.",
  233. "layout.legendsize.max.name": "Maximum size",
  234. "layout.legendsize.min.description": "The minimum size of the legend, as a CSS size or percentage.",
  235. "layout.legendsize.min.name": "Minimum size",
  236. "layout.legendsize.preferred.description": "The preferred size of the legend, as a CSS size or percentage.",
  237. "layout.legendsize.preferred.name": "Preferred size",
  238. "layout.padding.description": "The padding around the chart and legend.",
  239. "layout.padding.name": "Padding",
  240. "legend.animation.description": "The effect that is used to animate the legend.",
  241. "legend.animation.duration.description": "The duration of the legend animation in ms.",
  242. "legend.animation.duration.name": "Legend animation duration",
  243. "legend.animation.name": "Legend animation",
  244. "legend.animation.options.none": "None",
  245. "legend.animation.options.transition": "Transition",
  246. "legend.bubble.display.description": "Shows or hides the bubble color legend.",
  247. "legend.bubble.display.name": "Show bubble color legend",
  248. "legend.bubble.title.description": "The title of the bubble color legend.",
  249. "legend.bubble.title.name": "Bubble color legend title",
  250. "legend.bubble.titlestyle.fill.description": "The color of the bubble color legend title.",
  251. "legend.bubble.titlestyle.fill.name": "Bubble color legend title color",
  252. "legend.bubble.titlestyle.fontfamily.description": "The font family of the bubble color legend title.",
  253. "legend.bubble.titlestyle.fontfamily.name": "Bubble color legend title font family",
  254. "legend.bubble.titlestyle.fontsize.description": "The font size of the bubble color legend title.",
  255. "legend.bubble.titlestyle.fontsize.name": "Bubble color legend title font size",
  256. "legend.display.description": "Shows or hides the legend.",
  257. "legend.display.falseLabel": "Hide",
  258. "legend.display.name": "Show legend",
  259. "legend.display.trueLabel": "Show",
  260. "legend.entrystyle.font.description": "The font properties of the legend entry.",
  261. "legend.entrystyle.font.name": "Entry font",
  262. "legend.map.display.description": "Shows or hides the map legend.",
  263. "legend.map.display.name": "Show map legend",
  264. "legend.map.title.description": "The title of the map legend.",
  265. "legend.map.title.name": "Map legend title",
  266. "legend.map.titlestyle.fill.description": "The color of the map legend title.",
  267. "legend.map.titlestyle.fill.name": "Map legend title color",
  268. "legend.map.titlestyle.fontfamily.description": "The font family of the map legend title.",
  269. "legend.map.titlestyle.fontfamily.name": "Map legend title font family",
  270. "legend.map.titlestyle.fontsize.description": "The font size of the map legend title.",
  271. "legend.map.titlestyle.fontsize.name": "Map legend title font size",
  272. "legend.position.description": "The position of the legend in the chart.",
  273. "legend.position.name": "Legend position",
  274. "legend.position.options.bottom": "Bottom",
  275. "legend.position.options.left": "Left",
  276. "legend.position.options.right": "Right",
  277. "legend.position.options.top": "Top",
  278. "legend.size.display.description": "Shows or hides the bubble size legend.",
  279. "legend.size.display.name": "Show bubble size legend",
  280. "legend.size.title.description": "The title of the bubble size legend.",
  281. "legend.size.title.name": "Bubble size legend title",
  282. "legend.size.titlestyle.fill.description": "The color of the bubble size legend title.",
  283. "legend.size.titlestyle.fill.name": "Bubble size legend title color",
  284. "legend.size.titlestyle.fontfamily.description": "The font family of the bubble size legend title.",
  285. "legend.size.titlestyle.fontfamily.name": "Bubble size legend title font family",
  286. "legend.size.titlestyle.fontsize.description": "The font size of the bubble size legend title.",
  287. "legend.size.titlestyle.fontsize.name": "Bubble size legend title font size",
  288. "legend.title.description": "The title of the legend.",
  289. "legend.title.name": "Title",
  290. "legend.titlestyle.fill.description": "The color of the legend title.",
  291. "legend.titlestyle.fill.name": "Title color",
  292. "legend.titlestyle.font.description": "The font properties of the legend title.",
  293. "legend.titlestyle.font.name": "Title font",
  294. "legend.titlestyle.fontfamily.description": "The font family of the legend title.",
  295. "legend.titlestyle.fontfamily.name": "Title font family",
  296. "legend.titlestyle.fontsize.description": "The font size of the legend title.",
  297. "legend.titlestyle.fontsize.name": "Title font size",
  298. "map.config.map.description": "Map charts use a map to show data.",
  299. "map.config.map.label": "Legacy map",
  300. "map.description": "Map charts use a map to show data.",
  301. "map.falseLabe.dropLabels": "Keep",
  302. "map.falseLabel.bubbleLegend": "Hide",
  303. "map.falseLabel.display": "Hide",
  304. "map.falseLabel.flash": "No flash",
  305. "map.falseLabel.labels": "Hide",
  306. "map.falseLabel.sizeLegend": "Hide",
  307. "map.label": "Legacy map",
  308. "map.projection.description": "The Map projection type.",
  309. "map.projection.name": "Map projection",
  310. "map.projection.options.albers": "Albers",
  311. "map.projection.options.albersUsa": "Albers Usa",
  312. "map.projection.options.equirectangular": "Equirectangular",
  313. "map.projection.options.mercator": "Mercator",
  314. "map.projection.options.stereoGraphic": "stereoGraphic",
  315. "map.projection.options.winkelTriple": "winkelTriple",
  316. "map.propertyPresentation.advanced.mapSpecificProperties.description": "Map-specific properties",
  317. "map.propertyPresentation.advanced.mapSpecificProperties.label": "Map",
  318. "map.rotation.latitude.description": "The Map latitude rotation value in degrees.",
  319. "map.rotation.latitude.name": "Map latitude rotation",
  320. "map.rotation.longitude.description": "The Map longitude rotation value in degrees.",
  321. "map.rotation.longitude.name": "Map longitude rotation",
  322. "map.trueLabel.bubbleLegend": "Show",
  323. "map.trueLabel.display": "Show",
  324. "map.trueLabel.dropLabels": "Drop",
  325. "map.trueLabel.flash": "Flash",
  326. "map.trueLabel.labels": "Show",
  327. "map.trueLabel.sizeLegend": "Show",
  328. "max.bubble.size.descirption": "The maximum radius of a bubble, in pixels.",
  329. "max.bubble.size.description": "The maximum size of the bubble.",
  330. "max.bubble.size.name": "Maximum bubble size",
  331. "max.zoom.description": "The maximum level of zoom that is allowed.",
  332. "max.zoom.name": "Maximum zoom level",
  333. "min.bubble.size.descirption": "The minimum radius of a bubble, in pixels.",
  334. "min.bubble.size.description": "The minimum size of the bubble.",
  335. "min.bubble.size.name": "Minimum bubble size",
  336. "pan.x.description": "When set to Yes, pans along the X-axis. When set to No, a Euler rotation is performed along the X-axis.",
  337. "pan.x.name": "Pan along the X-axis",
  338. "pan.y.description": "When set to Yes, pans along the Y-axis. When set to No, a Euler rotation is performed along the Y-axis.",
  339. "pan.y.name": "Pan along the Y-axis",
  340. "point.label.color.description": "The color of the point labels.",
  341. "point.label.color.name": "Point label color",
  342. "point.label.font.description": "The font of the point labels.",
  343. "point.label.font.name": "Point label font",
  344. "point.label.size.description": "The size of the point labels.",
  345. "point.label.size.name": "Point label size",
  346. "propertyPresentation.advanced.axisSizeProperties.description": "Axis size properties.",
  347. "propertyPresentation.advanced.axisSizeProperties.label": "Axis size",
  348. "propertyPresentation.advanced.clientBehaviorProperties.description": "Client side properties.",
  349. "propertyPresentation.advanced.clientBehaviorProperties.label": "Client behavior",
  350. "propertyPresentation.advanced.commonProperties.description": "Common properties.",
  351. "propertyPresentation.advanced.commonProperties.label": "Common",
  352. "propertyPresentation.advanced.description": "Advanced list of all properties in a grouped structure.",
  353. "propertyPresentation.advanced.label": "Advanced",
  354. "propertyPresentation.advanced.labelProperties.description": "Label properties",
  355. "propertyPresentation.advanced.labelProperties.label": "Label",
  356. "propertyPresentation.advanced.legendProperties.description": "Legend properties.",
  357. "propertyPresentation.advanced.legendProperties.label": "Legend",
  358. "propertyPresentation.advanced.xAxisProperties.description": "X-axis properties.",
  359. "propertyPresentation.advanced.xAxisProperties.label": "X-axis",
  360. "propertyPresentation.advanced.yAxisProperties.description": "Y-axis properties.",
  361. "propertyPresentation.advanced.yAxisProperties.label": "Y-axis",
  362. "propertyPresentation.simple.description": "Simple list of the most common properties.",
  363. "propertyPresentation.simple.label": "Simple",
  364. "rave2.colorpalette.blueContinuousSequential.description": "Blue continuous sequential description",
  365. "rave2.colorpalette.blueContinuousSequential.label": "Blue continuous sequential",
  366. "rave2.colorpalette.blueDiscreteSequential.description": "Blue discrete sequential description",
  367. "rave2.colorpalette.blueDiscreteSequential.label": "Blue discrete sequential",
  368. "rave2.colorpalette.blueGreenContinuousDivergent.description": "Blue green continuous divergent description",
  369. "rave2.colorpalette.blueGreenContinuousDivergent.label": "Blue green continuous divergent",
  370. "rave2.colorpalette.blueGreenDiscreteDivergent.description": "Blue green discrete divergent description",
  371. "rave2.colorpalette.blueGreenDiscreteDivergent.label": "Blue green discrete divergent",
  372. "rave2.colorpalette.dark.description": "Dark description",
  373. "rave2.colorpalette.dark.label": "Dark",
  374. "rave2.colorpalette.financial.description": "Financial description",
  375. "rave2.colorpalette.financial.label": "Financial",
  376. "rave2.colorpalette.greenContinuousSequential.description": "Green continuous sequential description",
  377. "rave2.colorpalette.greenContinuousSequential.label": "Green continuous sequential",
  378. "rave2.colorpalette.greenDiscreteSequential.description": "Green discrete sequential description",
  379. "rave2.colorpalette.greenDiscreteSequential.label": "Green discrete sequential",
  380. "rave2.colorpalette.light.description": "Light description",
  381. "rave2.colorpalette.light.label": "Light",
  382. "rave2.colorpalette.medical.description": "Medical description",
  383. "rave2.colorpalette.medical.label": "Medical",
  384. "rave2.colorpalette.orangeContinuousSequential.description": "Orange continuous sequential description",
  385. "rave2.colorpalette.orangeContinuousSequential.label": "Orange continuous sequential",
  386. "rave2.colorpalette.orangeDiscreteSequential.description": "Orange discrete sequential description",
  387. "rave2.colorpalette.orangeDiscreteSequential.label": " Orange discrete sequential",
  388. "rave2.colorpalette.purpleContinuousSequential.description": "Purple continuous sequential description",
  389. "rave2.colorpalette.purpleContinuousSequential.label": "Purple continuous sequential",
  390. "rave2.colorpalette.purpleDiscreteSequential.description": "Purple discrete sequential description",
  391. "rave2.colorpalette.purpleDiscreteSequential.label": "Purple discrete sequential",
  392. "rave2.colorpalette.redBlueContinuousDivergent.description": "Red blue continuous divergent description",
  393. "rave2.colorpalette.redBlueContinuousDivergent.label": "Red blue continuous divergent",
  394. "rave2.colorpalette.redBlueDiscreteDivergent.description": "Red blue discrete divergent description",
  395. "rave2.colorpalette.redBlueDiscreteDivergent.label": "Red blue discrete divergent",
  396. "rave2.colorpalette.redBlueInverseContinuousDivergent.description": "Red blue inverse continuous divergent description",
  397. "rave2.colorpalette.redBlueInverseContinuousDivergent.label": "Red blue inverse continuous divergent",
  398. "rave2.colorpalette.redBlueInverseDiscreteDivergent.description": "Red blue inverse discrete divergent description",
  399. "rave2.colorpalette.redBlueInverseDiscreteDivergent.label": "Red blue inverse discrete divergent",
  400. "rave2.colorpalette.redContinuousSequential.description": "Red continuous sequential description",
  401. "rave2.colorpalette.redContinuousSequential.label": "Red continuous sequential",
  402. "rave2.colorpalette.redDiscreteSequential.description": "Red discrete sequential description",
  403. "rave2.colorpalette.redDiscreteSequential.label": " Red discrete sequential",
  404. "rave2.colorpalette.redGreenContinuousDivergent.description": "Red green continuous divergent description",
  405. "rave2.colorpalette.redGreenContinuousDivergent.label": "Red green continuous divergent",
  406. "rave2.colorpalette.redGreenDiscreteDivergent.description": "Red green discrete divergent description",
  407. "rave2.colorpalette.redGreenDiscreteDivergent.label": "Red green discrete divergent",
  408. "rave2.colorpalette.redGreenInverseContinuousDivergent.description": "Red green inverse continuous divergent description",
  409. "rave2.colorpalette.redGreenInverseContinuousDivergent.label": "Red green inverse continuous divergent",
  410. "rave2.colorpalette.redGreenInverseDiscreteDivergent.description": "Red green inverse discrete divergent description",
  411. "rave2.colorpalette.redGreenInverseDiscreteDivergent.label": "Red green inverse discrete divergent",
  412. "rave2.colorpalette.tealContinuousSequential.description": "Teal continuous sequential description",
  413. "rave2.colorpalette.tealContinuousSequential.label": "Teal continuous sequential",
  414. "rave2.colorpalette.tealDiscreteSequential.description": "Teal discrete sequential description",
  415. "rave2.colorpalette.tealDiscreteSequential.label": "Teal discrete sequential",
  416. "rave2.colorpalette.tealPurpleContinuousDivergent.description": "Teal purple continuous divergent description",
  417. "rave2.colorpalette.tealPurpleContinuousDivergent.label": "Teal purple continuous divergent",
  418. "rave2.colorpalette.tealPurpleDiscreteDivergent.description": "Teal purple discrete divergent description",
  419. "rave2.colorpalette.tealPurpleDiscreteDivergent.label": "Teal purple discrete divergent",
  420. "rave2.colorpalette.violetContinuousSequential.description": "Violet continuous sequential description",
  421. "rave2.colorpalette.violetContinuousSequential.label": "Violet continuous sequential",
  422. "rave2.colorpalette.violetDiscreteSequential.description": "Violet discrete sequential description",
  423. "rave2.colorpalette.violetDiscreteSequential.label": "Violet discrete sequential",
  424. "rave2.colorpalette.yellowContinuousSequential.description": "Yellow continuous sequential description",
  425. "rave2.colorpalette.yellowContinuousSequential.label": "Yellow continuous sequential",
  426. "rave2.colorpalette.yellowDiscreteSequential.description": "Yellow discrete sequential description",
  427. "rave2.colorpalette.yellowDiscreteSequential.label": "Yellow discrete sequential",
  428. "region.animation.description": "The effect that is used to animate the initial region.",
  429. "region.animation.duration.description": "The duration of the initial region animation in ms.",
  430. "region.animation.duration.name": "Region animation duration",
  431. "region.animation.name": "Region animation",
  432. "region.animation.options.none": "None",
  433. "region.animation.options.transition": "Transition",
  434. "scale.description": "The default scale that is applied to the projection. The scale can have a null value. If null, the map automatically scales.",
  435. "scale.name": "Map base scale",
  436. "show.labels.description": "Shows or hides labels.",
  437. "show.labels.name": "Show labels",
  438. "transpose.description": "When set to Yes, the Y-axis shows the independent scale and the X-axis shows the dependent scale.",
  439. "transpose.falseLabel": "Do not transpose",
  440. "transpose.name": "Switch X and Y axes",
  441. "transpose.trueLabel": "Transpose"
  442. }
  443. },{}],3:[function(require,module,exports){
  444. (function() {
  445. var $ = {};
  446. // $source: com/ibm/rave/bundles/internal/nativeImpl/BundleModuleHeader
  447. /************************************************************************
  448. ** IBM Confidential
  449. **
  450. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  451. **
  452. ** (C) Copyright IBM Corp. 2015
  453. **
  454. ** The source code for this program is not published or otherwise divested of its trade secrets,
  455. ** irrespective of what has been deposited with the U.S. Copyright Office.
  456. ************************************************************************/
  457. var com_ibm_rave_library_Library = rave["library"];
  458. rave["internal"]["Declare"] = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"];
  459. rave["internal"]["CSSUtil"]= rave["_"]["com_ibm_rave_core_internal_css_CSSUtil"];
  460. // $source: com/ibm/rave/bundles/RaveBundle
  461. /************************************************************************
  462. ** IBM Confidential
  463. **
  464. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  465. **
  466. ** (C) Copyright IBM Corp. 2017
  467. **
  468. ** The source code for this program is not published or otherwise divested of its trade secrets,
  469. ** irrespective of what has been deposited with the U.S. Copyright Office.
  470. ************************************************************************/
  471. // GENERATED
  472. //@import com/ibm/rave/bundles/internal/nativeImpl/RaveBundleResourceLoader (runtime) // new
  473. /**
  474. * A RaveBundle extends the regular Bundle abstract class but includes common functionality for Rave-made bundles that aren't for general use.
  475. */
  476. var com_ibm_rave_bundles_RaveBundle = rave['internal']['Declare'](rave['library']['internal']['Bundle'], {
  477. /** @expose */
  478. loader : null,
  479. /** @expose */
  480. constructor : function() {
  481. ;
  482. ;
  483. ;
  484. ;
  485. ;
  486. ;
  487. this.loader = new com_ibm_rave_bundles_internal_nativeImpl_RaveBundleResourceLoader("/com/ibm/rave/bundles/" + this.getName());
  488. },
  489. /**
  490. * Load extra resources required for this bundle. Currently the compiled configuration.json file. And .css.
  491. */
  492. /** @expose */
  493. loadResources : function() {
  494. this.setMessageCatalog(rave['library']['internal']['Bundle'].DEFAULT_LOCALE, require("./i18n/messages_en.json"));
  495. var array = require("./configuration/configuration.json");
  496. if (array) {
  497. for (var __i_enFor0 = 0, __exp_enFor0 = array, __len_enFor0 = __exp_enFor0.length;
  498. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  499. var artifact = __exp_enFor0[__i_enFor0];
  500. this.initialize(artifact);
  501. }
  502. }
  503. require("./vizlibrary.css");
  504. }
  505. });
  506. //com_ibm_rave_bundles_RaveBundle.CONFIGURATION_FILE = "./configuration/configuration.json";
  507. // $source: com/ibm/rave/bundles/internal/nativeImpl/RaveBundleResourceLoader
  508. // Intentionally empty - everything in this file is inlined
  509. var com_ibm_rave_bundles_internal_nativeImpl_RaveBundleResourceLoader = function(){};
  510. // $source: com/ibm/rave/bundles/views/BundleView
  511. /************************************************************************
  512. ** IBM Confidential
  513. **
  514. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  515. **
  516. ** (C) Copyright IBM Corp. 2017
  517. **
  518. ** The source code for this program is not published or otherwise divested of its trade secrets,
  519. ** irrespective of what has been deposited with the U.S. Copyright Office.
  520. ************************************************************************/
  521. // GENERATED
  522. //@import com/ibm/rave/bundles/components/BackgroundComponentImpl (runtime) // new
  523. //@import com/ibm/rave/bundles/components/ChartLayoutComponentImpl (runtime) // new
  524. //@import com/ibm/rave/bundles/components/ClipPathComponentImpl (runtime) // new
  525. //@import com/ibm/rave/bundles/components/LegendsManager (runtime) // new
  526. //@import com/ibm/rave/bundles/components/AxesManager (runtime) // new
  527. //@import com/ibm/rave/library/Library (runtime) // Library
  528. //@import com/ibm/rave/bundles/components/IntervalDataUtilities (runtime) // IntervalDataUtilities
  529. //@import com/ibm/rave/bundles/data/PointDataUtilities (runtime) // PointDataUtilities
  530. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  531. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor
  532. var com_ibm_rave_bundles_views_BundleView = rave['internal']['Declare'](rave['library']['internal']['AbstractView'], {
  533. /**
  534. * Background component
  535. */
  536. /** @expose */
  537. _backgroundComponent : null,
  538. /**
  539. * Layout component
  540. */
  541. /** @expose */
  542. _layoutComponent : null,
  543. /**
  544. * Clip component
  545. */
  546. /** @expose */
  547. _clip : null,
  548. /**
  549. * Axes manager
  550. */
  551. /** @expose */
  552. _axes : null,
  553. /**
  554. * Legends manager
  555. */
  556. /** @expose */
  557. _legends : null,
  558. //_groupStructure : null,
  559. /** @expose */
  560. _chart : null,
  561. /** @expose */
  562. dataModel : null,
  563. /** @expose */
  564. _zoomP : null,
  565. /** @expose */
  566. _zoomS : null,
  567. /** @expose */
  568. constructor : function(context) {
  569. },
  570. /** @expose */
  571. getGroupStructure : function() {},
  572. /** @expose */
  573. setup : function() {
  574. rave['library']['internal']['AbstractView'].prototype.setup.call(this);
  575. this._backgroundComponent = new com_ibm_rave_bundles_components_BackgroundComponentImpl();
  576. this._layoutComponent = new com_ibm_rave_bundles_components_ChartLayoutComponentImpl();
  577. this._clip = new com_ibm_rave_bundles_components_ClipPathComponentImpl(this.context.instanceId() + "clipViewport");
  578. if (this.isZoomSupported()) {
  579. this.resetZoom();
  580. }
  581. this._legends = new com_ibm_rave_bundles_components_LegendsManager(this.context, this.getLegendCount());
  582. if (this.isAxesManagerRequired()) {
  583. this._axes = new com_ibm_rave_bundles_components_AxesManager(this.context);
  584. }
  585. this._groupStructure = this.getGroupStructure();
  586. },
  587. /** @expose */
  588. preDraw : function(chartId) {
  589. this.cancelTransitions();
  590. rave['library']['internal']['AbstractView'].createGroupStructure(this.context.node, this._groupStructure);
  591. this._chart = this.context.node.selectAll(chartId);
  592. },
  593. /** @expose */
  594. resetZoom : function() {
  595. this._zoomP = [0, 0, 0, 0];
  596. this._zoomS = [1, 1, 1, 1];
  597. },
  598. /** @expose */
  599. validateDataModel : function(elementsToRemove) {
  600. if (elementsToRemove !== null || arguments.length > 1){
  601. elementsToRemove = Array.prototype.slice.call(arguments);
  602. }
  603. {
  604. this.dataModel = this.context.dataModel();
  605. if (!(this.dataValid())) {
  606. for (var __i_enFor0 = 0, __len_enFor0 = elementsToRemove.length;
  607. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  608. var e = elementsToRemove[__i_enFor0];
  609. this._chart.selectAll(e).selectAll("*").remove();
  610. }
  611. this._legends.visible(false).draw();
  612. return false;
  613. }
  614. return true;
  615. }
  616. },
  617. /** @expose */
  618. dataValid : function() {
  619. return this.dataModel.validate();
  620. },
  621. /** @expose */
  622. getLegendCount : function() {
  623. return 1;
  624. },
  625. /** @expose */
  626. isAxesManagerRequired : function() {
  627. return false;
  628. },
  629. /** @expose */
  630. isZoomSupported : function() {
  631. return true;
  632. },
  633. /** @expose */
  634. getProperty : function(s) {
  635. return this.context.getPropertyValue(s);
  636. },
  637. /** @expose */
  638. getPropertyDefault : function(s) {
  639. return this.context.getPropertyDefault(s);
  640. },
  641. /** @expose */
  642. getBooleanProperty : function(s) {
  643. var obj = this.getProperty(s);
  644. return (obj);
  645. },
  646. /** @expose */
  647. getDoubleProperty : function(s) {
  648. var obj = this.getProperty(s);
  649. return + (obj);
  650. },
  651. /** @expose */
  652. getIntProperty : function(s) {
  653. var obj = this.getProperty(s);
  654. return ~~ (obj);
  655. },
  656. /**
  657. * @param (String) id Property ID
  658. * @return (String) Property value as a string
  659. */
  660. /** @expose */
  661. getStringProperty : function(id) {
  662. var obj = this.getProperty(id);
  663. return (obj == null) ? null : ""+(obj);
  664. },
  665. /**
  666. * @param (String) id Property ID
  667. * @return (String) Property value as a string, returning null for the empty string
  668. */
  669. /** @expose */
  670. getStringPropertyEmptyAsNull : function(id) {
  671. var s = this.getStringProperty(id);
  672. return (s == null || s.length == 0) ? null : s;
  673. },
  674. /**
  675. * @param (String) id Property ID
  676. * @return (Number) Property value as a string, containing size as the number of pixels
  677. */
  678. /** @expose */
  679. getCSSSizeToPixelNumber : function(id) {
  680. var cssSize = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(this.context.getPropertyValue(id), 100.0, 10.0);
  681. return (cssSize == null) ? 0.0 : cssSize;
  682. },
  683. /**
  684. * Based on effect duration and effect property, determine the effect duration in ms.
  685. * @param (String) effect Effect name, one of the options available from EFFECT_OPTIONS.
  686. * @return (int) Effect duration in ms.
  687. */
  688. /** @expose */
  689. getEffectDuration : function(effect) {
  690. var duration = this.getIntProperty("effect.duration");
  691. if ((duration < 0) || (effect == null) || "none" == effect) {
  692. duration = 0;
  693. }
  694. return duration;
  695. },
  696. /** @expose */
  697. getTopPadding : function() {
  698. return this.getProperty("layout.chart.padding.top");
  699. },
  700. /** @expose */
  701. getLeftPadding : function() {
  702. return this.getProperty("layout.chart.padding.left");
  703. },
  704. /** @expose */
  705. getBottomPadding : function() {
  706. return this.getProperty("layout.chart.padding.bottom");
  707. },
  708. /** @expose */
  709. getRightPadding : function() {
  710. return this.getProperty("layout.chart.padding.right");
  711. },
  712. /** @expose */
  713. getLayoutPadding : function() {
  714. return this.getProperty("layout.padding");
  715. },
  716. /** @expose */
  717. getLegendChartGap : function() {
  718. return this.getProperty("layout.legendchart.gap");
  719. },
  720. /** @expose */
  721. getLegendChartAlign : function() {
  722. return this.getBooleanProperty("layout.legendchart.align");
  723. },
  724. /** @expose */
  725. getLegendPosition : function() {
  726. return this.getStringProperty("legend.position");
  727. },
  728. getPalette$0 : function() {
  729. return this.getPalette$1("color.palette");
  730. },
  731. getPalette$1 : function(paletteID) {
  732. var id = this.getStringProperty(paletteID);
  733. var colorPalette = com_ibm_rave_library_Library.palettes.getPalette(id);
  734. return (!colorPalette) ? com_ibm_rave_library_Library.palettes.getDefaultPalette() : colorPalette;
  735. },
  736. getDynamicPalette$0 : function() {
  737. return this.getDynamicPalette$1("color.palette", "color.dynamicPalette.min", "color.dynamicPalette.mid", "color.dynamicPalette.max");
  738. },
  739. /**
  740. * Get a palette. If the fills array is non-null, has at least two entries, and all entries are non-null and non-"", a continuous normalized palette will be created using the fill values as stops. For example if the fills array is ["red","white","green"], the palette will have stops at 0.0 red, 0.5 white, 1.0 green. Otherwise the paletteID is looked up in Library.palettes and returned. If the paletteID is not found, the default palette is returned.
  741. * @param (String) paletteID The palette ID
  742. * @return (rave['library']['internal']['Palette']) Palette
  743. */
  744. getDynamicPalette$1 : function(paletteID, minId, midId, maxId) {
  745. var colorPalette;
  746. var min = this.getStringProperty(minId);
  747. if (min != null) {
  748. var mid = this.getStringProperty(midId);
  749. if (mid != null) {
  750. var max = this.getStringProperty(maxId);
  751. if (max != null) {
  752. var fills = [min, mid, max];
  753. colorPalette = rave['library']['internal']['AbstractView'].getFillPalette(fills);
  754. }
  755. }
  756. }
  757. return (!colorPalette) ? this.getPalette(paletteID) : colorPalette;
  758. },
  759. /** @expose */
  760. prepareLayoutComponent : function() {
  761. this._layoutComponent.setPreExecute(this.context.getPreExecute()).overall(new rave['internal']['RectStruct'](0, 0, this.context.size.w, this.context.size.h)).legendPosition(this.getLegendPosition()).padding(this.getLayoutPadding()).chartPadding(this.getTopPadding(), this.getLeftPadding(), this.getBottomPadding(), this.getRightPadding()).legendChartGap(this.getLegendChartGap()).legendChartAlign(this.getLegendChartAlign());
  762. },
  763. /** @expose */
  764. prepareLayoutSizables : function(layoutComponent, useX2, useY1, useX1, useY2, useLegend) {
  765. layoutComponent.removeAxisSizables();
  766. if (useX1) {
  767. layoutComponent.addAxisSizable(this._axes.axisComponent(0));
  768. }
  769. if (useY1) {
  770. layoutComponent.addAxisSizable(this._axes.axisComponent(2));
  771. }
  772. if (useX2) {
  773. layoutComponent.addAxisSizable(this._axes.axisComponent(1));
  774. }
  775. if (useY2) {
  776. layoutComponent.addAxisSizable(this._axes.axisComponent(3));
  777. }
  778. layoutComponent.legendSize(useLegend ? this._legends : null);
  779. },
  780. /** @expose */
  781. resetUpdate : function() {
  782. this.updateType = 4;
  783. },
  784. /** @expose */
  785. isUpdateNothing : function() {
  786. return this.updateType == 4;
  787. },
  788. /** @expose */
  789. isShowLegend : function() {
  790. return this.getBooleanProperty("legend.display");
  791. },
  792. cancelTransitions : function() {
  793. this.context.node.selectAll("*").interrupt();
  794. },
  795. /** @expose */
  796. setBackgroundProperties : function(elementRect, duration) {
  797. this._backgroundComponent.setPreExecute(this.context.getPreExecute()).size(this.context.size).backgroundColor(this.getStringProperty("background.chart.color"));
  798. this.context.node.selectAll("rect.background.chart").transition().duration(duration).call(this._backgroundComponent);
  799. this._backgroundComponent.setPreExecute(this.context.getPreExecute()).rect(elementRect).backgroundColor(this.getStringProperty("background.elements.color"));
  800. this.context.node.selectAll("rect.background.elements").transition().duration(duration).call(this._backgroundComponent);
  801. },
  802. /** @expose */
  803. isShowDataLabels : function() {
  804. return this.getBooleanProperty("data.label.display");
  805. },
  806. /** @expose */
  807. isShowDataLabelsAsPercentageOfColor : function() {
  808. var dataLabel = this.getStringProperty("data.label.type");
  809. return "PercentOfColor" == dataLabel;
  810. },
  811. /** @expose */
  812. isShowDataLabelsAsPercentageOfCategory : function() {
  813. var dataLabel = this.getStringProperty("data.label.type");
  814. return "PercentOfCategory" == dataLabel;
  815. },
  816. /** @expose */
  817. getlDataLabelAccessor : function(dataSet, slot, isInterval) {
  818. var labelAccessor;
  819. var labelEntry = dataSet.slot(slot).entry();
  820. if (!labelEntry) {
  821. if (this.isShowDataLabelsAsPercentageOfCategory()) {
  822. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR;
  823. } else if (this.isShowDataLabelsAsPercentageOfColor()) {
  824. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_COLOR_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_COLOR_ACCESSOR;
  825. } else {
  826. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.VALUE_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR;
  827. }
  828. } else {
  829. labelAccessor = rave['library']['internal']['AbstractView'].originalDatumAccessor(rave['library']['internal']['AbstractView'].accessorOf(labelEntry));
  830. }
  831. return labelAccessor;
  832. },
  833. /** @expose */
  834. getEntryForDataLabelFormatter : function(dataSet, labelSlot, defaultSlot) {
  835. var labelEntry = dataSet.slot(labelSlot).entry();
  836. return labelEntry ? labelEntry : dataSet.slot(defaultSlot).entry();
  837. },
  838. /** @expose */
  839. getBackgroundConstrastLabelStyle : function() {
  840. var labelFontStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(this.getStringProperty("labelstyle.font"));
  841. if (this.getBooleanProperty("contrast.label.color") == false) {
  842. return labelFontStyle;
  843. }
  844. var defaultFillColor;
  845. if (labelFontStyle) {
  846. defaultFillColor = labelFontStyle["fill"];
  847. if (defaultFillColor == null) {
  848. defaultFillColor = labelFontStyle["color"];
  849. }
  850. } else {
  851. labelFontStyle = {};
  852. }
  853. if (defaultFillColor == null) {
  854. defaultFillColor = "#000000";
  855. }
  856. labelFontStyle["fill"] = com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(this.getStringProperty("background.elements.color"), defaultFillColor);
  857. return labelFontStyle;
  858. },
  859. /** @expose */
  860. getPalette : function(a0) {
  861. var args = arguments;
  862. if (args.length == 0) {
  863. return this.getPalette$0();
  864. }
  865. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  866. return this.getPalette$1(a0);
  867. }
  868. return rave['library']['internal']['AbstractView'].prototype.getPalette.apply(this, args);
  869. },
  870. /** @expose */
  871. getDynamicPalette : function(a0, a1, a2, a3) {
  872. var args = arguments;
  873. if (args.length == 0) {
  874. return this.getDynamicPalette$0();
  875. }
  876. return this.getDynamicPalette$1(a0, a1, a2, a3);
  877. }
  878. });
  879. // $source: com/ibm/rave/bundles/components/BundleComponentImpl
  880. /************************************************************************
  881. ** IBM Confidential
  882. **
  883. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  884. **
  885. ** (C) Copyright IBM Corp. 2017
  886. **
  887. ** The source code for this program is not published or otherwise divested of its trade secrets,
  888. ** irrespective of what has been deposited with the U.S. Copyright Office.
  889. ************************************************************************/
  890. // GENERATED
  891. var com_ibm_rave_bundles_components_BundleComponentImpl = rave['internal']['Declare']({
  892. /**
  893. * The pre-execution callback.
  894. */
  895. //_preExecuteCallback : null,
  896. /**
  897. * The render callback.
  898. */
  899. /** @expose */
  900. _renderCallback : null,
  901. _$functionClassMethod : function() {
  902. var _$self = function(args) {
  903. if (args !== null || arguments.length > 1){
  904. args = Array.prototype.slice.call(arguments, 0);
  905. }
  906. {
  907. var self = _$self;
  908. this.each(function(data, index, groupIndex) {
  909. self.execute(rave.select(this));
  910. });
  911. return null;
  912. }
  913. };
  914. return _$self;
  915. },
  916. /**
  917. * Execute the component logic. In general, the execute function will append, modify, and/or remove items contained in the provided selector (g). There are no set rules regarding what the execute function can or can not do. However, it is extremely bad form if a component modifies and/or removes items created by another component.
  918. * @param (rave['internal']['Selector']) g <g> node that this component will be applied to.
  919. */
  920. /** @expose */
  921. execute : function(g) {},
  922. /**
  923. * Set the pre-execute callback for this component.
  924. * @param (rave['library']['internal']['ComponentCallback']) callback The callback
  925. */
  926. /** @expose */
  927. setPreExecute : function(callback) {
  928. this._preExecuteCallback = callback;
  929. return this;
  930. },
  931. /**
  932. * If the pre-execute component is non-null, call it with this object. Note that this object must also implement BundleComponent.
  933. */
  934. /** @expose */
  935. preExecute : function() {
  936. if (this._preExecuteCallback) {
  937. this._preExecuteCallback(this);
  938. }
  939. },
  940. /**
  941. * Set the render callback for this component.
  942. * @param (rave['internal']['RunFunction']) callback The callback
  943. */
  944. /** @expose */
  945. setRenderCallback : function(callback) {
  946. this._renderCallback = callback;
  947. return this;
  948. },
  949. /**
  950. * Abstract method for Swift translation purposes. Swift does not support abstract classes, so translator generates a non-abstract class. By adding the following 'abstract' method, Swift class will satisfy interface requirements.
  951. */
  952. /** @expose */
  953. type : function() {},
  954. /** @expose */
  955. updateBorder : function(s, borderWidth, borderColor) {
  956. if (borderWidth != null) {
  957. s.each(function(data, index, groupIndex) {
  958. if (!((this.rave_getProperty("selected"))) && !((this.rave_getProperty("highlighted")))) {
  959. this.rave_setStyle("stroke-width", borderWidth, "");
  960. }
  961. });
  962. }
  963. if (borderColor != null) {
  964. s.each(function(data, index, groupIndex) {
  965. if (!((this.rave_getProperty("selected"))) && !((this.rave_getProperty("highlighted")))) {
  966. this.rave_setStyle("stroke", borderColor, "");
  967. }
  968. });
  969. }
  970. },
  971. /** @expose */
  972. getDefaultLabelColor : function(_labelStyle) {
  973. if (!_labelStyle) {
  974. return "#000000";
  975. }
  976. var defaultFillColor;
  977. if (_labelStyle) {
  978. defaultFillColor = _labelStyle["fill"];
  979. if (defaultFillColor == null) {
  980. defaultFillColor = _labelStyle["color"];
  981. }
  982. }
  983. if (defaultFillColor == null) {
  984. defaultFillColor = "#000000";
  985. }
  986. return defaultFillColor.toString();
  987. }
  988. });
  989. // $source: com/ibm/rave/bundles/component/BackgroundComponent
  990. /************************************************************************
  991. ** IBM Confidential
  992. **
  993. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  994. **
  995. ** (C) Copyright IBM Corp. 2017
  996. **
  997. ** The source code for this program is not published or otherwise divested of its trade secrets,
  998. ** irrespective of what has been deposited with the U.S. Copyright Office.
  999. ************************************************************************/
  1000. // GENERATED
  1001. /**
  1002. * <p> A component that renders the background to the chart. The {@link #this.type()} method returns "BackgroundComponent". </p>
  1003. */
  1004. var com_ibm_rave_bundles_component_BackgroundComponent = rave['internal']['Declare'].implement(
  1005. /**
  1006. * Get the background color.
  1007. * @return (String) The background color
  1008. */
  1009. //backgroundColor : function() {},
  1010. /**
  1011. * Set the background color. If the color is null, white is used.
  1012. * @param (String) backgroundColor The new background color
  1013. * @return (com.ibm.rave.bundles.component.BackgroundComponent) This object
  1014. */
  1015. //backgroundColor : function(backgroundColor) {}
  1016. );
  1017. /**
  1018. * The string returned by {@link #this.type()} is "BackgroundComponent".
  1019. */
  1020. /** @expose */
  1021. com_ibm_rave_bundles_component_BackgroundComponent.COMPONENT_TYPE = "BackgroundComponent";
  1022. // $source: com/ibm/rave/bundles/component/ChartLayoutComponent
  1023. /************************************************************************
  1024. ** IBM Confidential
  1025. **
  1026. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1027. **
  1028. ** (C) Copyright IBM Corp. 2017
  1029. **
  1030. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1031. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1032. ************************************************************************/
  1033. // GENERATED
  1034. /**
  1035. * <p> A component that does the layout for a bundle chart. The {@link #this.type()} method returned "ChartLayoutComponent". </p> <h3>Layout Properties</h3> <p> Chart layout is controlled by the following properties: </p> <ul> <li>The padding: a string containing up to 4 CSS sizes for left, top, right, bottom padding (eg. "padding-left:10px;padding-top:10%").</li> <li>The legend chart gap: a single CSS size.</li> <li>The legends position: a string, one of "top", "bottom", "left", or "right".</li> <li>The legends size: a {@link (com.ibm.rave.bundles.component.ChartLayoutSizable) ChartLayoutSizable} .</li> <li>The four axis sizes for top, bottom, left, and right: each a {@link (com.ibm.rave.bundles.component.ChartLayoutSizable) ChartLayoutSizable} .</li> </ul>
  1036. */
  1037. var com_ibm_rave_bundles_component_ChartLayoutComponent = rave['internal']['Declare'].implement(
  1038. //padding : function() {},
  1039. //topPadding : function() {},
  1040. //leftPadding : function() {},
  1041. //bottomPadding : function() {},
  1042. //rightPadding : function() {},
  1043. //legendChartAlign : function() {},
  1044. //legendPosition : function() {},
  1045. //legendChartGap : function() {},
  1046. //legendPosition : function(position) {},
  1047. //topPadding : function(value) {},
  1048. //leftPadding : function(value) {},
  1049. //bottomPadding : function(value) {},
  1050. //rightPadding : function(value) {},
  1051. /**
  1052. * Sets the padding around the outside of the chart/legend.
  1053. * @param (Object) value a string containing up to 4 CSS sizes for left, top, right, bottom padding (eg. "padding-left:10px;padding-top:10%"). Null is treated as 0.
  1054. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1055. */
  1056. //padding : function(value) {},
  1057. /**
  1058. * Sets all chart paddings. Null values are treated as 0.
  1059. * @param (Object) top New top padding
  1060. * @param (Object) left New left padding
  1061. * @param (Object) bottom New bottom padding
  1062. * @param (Object) right New right padding
  1063. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1064. * @deprecated Please use {@link #this.padding(Object)} and {@link #this.legendChartGap(Object)}
  1065. */
  1066. //chartPadding : function(top, left, bottom, right) {},
  1067. /**
  1068. * Sets whether the legend should align with the chart "body".
  1069. * @param (boolean) legendChartAlign the boolean state
  1070. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1071. */
  1072. //legendChartAlign : function(legendChartAlign) {},
  1073. /**
  1074. * Set the space for the gap between chart and legend
  1075. * @param (Object) value the gap distance (css length)
  1076. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1077. */
  1078. //legendChartGap : function(value) {},
  1079. /**
  1080. * Set the size information for the legend. Null value is treated as no visible legend.
  1081. * @param (com.ibm.rave.bundles.component.ChartLayoutSizable) sizable An object that implements the ChartLayoutSizable interface
  1082. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1083. */
  1084. //legendSize : function(sizable) {},
  1085. /**
  1086. * Reset list of axis sizables to 0
  1087. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1088. */
  1089. //removeAxisSizables : function() {},
  1090. /**
  1091. * Add an axis to be considered in layout operation.
  1092. * @param (com.ibm.rave.bundles.component.ChartLayoutSizable) sizable An object that implements the ChartLayoutSizable interface
  1093. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1094. */
  1095. //addAxisSizable : function(sizable) {}
  1096. );
  1097. /**
  1098. * The string returned by {@link #this.type()} is "ChartLayoutComponent".
  1099. */
  1100. /** @expose */
  1101. com_ibm_rave_bundles_component_ChartLayoutComponent.COMPONENT_TYPE = "ChartLayoutComponent";
  1102. // $source: com/ibm/rave/bundles/components/LegendsManager
  1103. /************************************************************************
  1104. ** IBM Confidential
  1105. **
  1106. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1107. **
  1108. ** (C) Copyright IBM Corp. 2017
  1109. **
  1110. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1111. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1112. ************************************************************************/
  1113. // GENERATED
  1114. //@import com/ibm/rave/bundles/components/LegendComponentImpl (runtime) // new, orientationOf
  1115. /**
  1116. * <p> Manages one or more legend components for a bundle. The number of legends N is fixed and declared in the constructor, and legends are identified by an array index number between 0 and N-1. (For now we don't need a dynamic collection, especially since we're generating the chart structure statically and each legend gets its own &lt;g&;gt; node. If a chart sometimes needs one legend and sometimes two, it will create two nodes and construct the manager for two legends.) </p> <p> The manager has the following properties: </p> <ul> <li> A global visibility flag. If false, the legends are not drawn (all shapes are cleared from the groups). </li> <li> A rectangle in which the legends are positioned. If a bundle wants (for example) some legends on the left and some on the right of a chart, it should create two LegendsManagers. </li> <li> An orientation, either "horizontal" or "vertical" (the default). </li> <li> Whether to use a transition, and if so the transition duration. </li> <li> The pre-execute component callback. </li> </ul> <p> Each legend has the following properties: </p> <ul> <li> A group (&lt;g&gt; node) selector into which it draws. For correct behavior this should always be non-null and select the same chart group, since the legend is responsible for removing shapes when it is not shown. This should be an ordinary selector, not a transition. </li> <li> A color palette. If the palette is null the legend is not visible. </li> <li> A swatch shape. If null, square is used. This only applies to swatch legends. </li> <li> A title. If null the legend has no title. </li> <li> A custom formatter for the labels. If null the default format is used. </li> </ul> <p> The general pattern of use is to create the LegendsManager in the view's constructor or setup method, allocating the maximum number of legends that will ever be needed. The chart structure will have corresponding &lt;g&gt; nodes, and in the view's draw method all the legend selectors are set to the corresponding group. The legend palettes, titles, and formatters will usually be set next, making sure to set the palettes of any unused legends to null, and {@link #this.anyVisible()} used to find if any rectangles need to be drawn so the overall chart may be laid out. The rectangle, orientation, and transition information can then be set and {@link #this.draw()} called. </p> <p> The visible legends (those with palettes) divide the rectangle equally along the orientation. For example if there are three legends in horizontal orientation and two are visible, they will split the rectangle vertically in half. Legends are drawn left-to-right for horizontal orientation, and top-to-bottom for vertical orientation, in index order. </p> <p> If a transition is requested and the duration is non-negative, a transition is created from the legend's selector; otherwise the selector is used. However, in order to give a somewhat better appearance, a transition is <I>not</I> used if the legend was not visible (no shapes rendered) the last time it was drawn. </p>
  1117. */
  1118. var com_ibm_rave_bundles_components_LegendsManager = rave['internal']['Declare']({
  1119. /**
  1120. * Bundle context
  1121. */
  1122. //_context : null,
  1123. /**
  1124. * Component used to draw all legends
  1125. */
  1126. //_comp : null,
  1127. /**
  1128. * Global visibility; if false no legends are drawn
  1129. */
  1130. //_visible : null,
  1131. /**
  1132. * Rectangle containing all legends
  1133. */
  1134. //_rectangle : null,
  1135. /**
  1136. * Legend orientation
  1137. */
  1138. //_orient : null,
  1139. /**
  1140. * Pre-execute component callback
  1141. */
  1142. //_preExecute : null,
  1143. /**
  1144. * Selectors for each legend
  1145. */
  1146. //_selectors : null,
  1147. /**
  1148. * Palettes for each legend
  1149. */
  1150. //_palettes : null,
  1151. /**
  1152. * Scale size functions for each legend
  1153. */
  1154. //_scale : null,
  1155. /**
  1156. * Swatch size functions for each legend
  1157. */
  1158. //_swatchSizes : null,
  1159. /**
  1160. * Shapes for each legend
  1161. */
  1162. //_shapes : null,
  1163. /**
  1164. * Titles for each legend
  1165. */
  1166. //_titles : null,
  1167. /**
  1168. * Title fonts for each legend
  1169. */
  1170. //_titleFonts : null,
  1171. /**
  1172. * Title fills for each legend
  1173. */
  1174. //_titleFills : null,
  1175. /**
  1176. * Title font sizes for each legend
  1177. */
  1178. //_titleFontSizes : null,
  1179. /**
  1180. * Title font families for each legend
  1181. */
  1182. //_titleFontFamilies : null,
  1183. /**
  1184. * Entry fonts for each legend
  1185. */
  1186. //_entryFonts : null,
  1187. /**
  1188. * Custom formatters for each legend, created from the registered custom formatters
  1189. */
  1190. //_formatters : null,
  1191. /**
  1192. * Whether each legend was visible in the last draw
  1193. */
  1194. //_lastVisible : null,
  1195. //_dataSlotEntries : null,
  1196. /**
  1197. * Number of legends
  1198. */
  1199. _numLegends : 0,
  1200. /**
  1201. * Whether to use a transition.
  1202. */
  1203. _doTransition : false,
  1204. /**
  1205. * Duration of the transition.
  1206. */
  1207. _duration : 0,
  1208. _spaceUsed : 0,
  1209. /**
  1210. * Construct the manager.
  1211. * @param (int) numLegends Number of legends, must be positive
  1212. */
  1213. /** @expose */
  1214. constructor : function(context, numLegends) {
  1215. this._context = context;
  1216. this._numLegends = numLegends;
  1217. this._comp = new com_ibm_rave_bundles_components_LegendComponentImpl();
  1218. this._rectangle = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1219. this._orient = "vertical";
  1220. this._preExecute = null;
  1221. this._selectors = [];
  1222. this._palettes = [];
  1223. this._scale = [];
  1224. this._swatchSizes = [];
  1225. this._shapes = [];
  1226. this._titles = [];
  1227. this._titleFonts = [];
  1228. this._titleFills = [];
  1229. this._titleFontSizes = [];
  1230. this._titleFontFamilies = [];
  1231. this._entryFonts = [];
  1232. this._formatters = [];
  1233. this._lastVisible = [];
  1234. this._visible = [];
  1235. this._dataSlotEntries = [];
  1236. for (var i = 0; i < this._numLegends; ++i) {
  1237. this._selectors[i] = null;
  1238. this._palettes[i] = null;
  1239. this._swatchSizes[i] = null;
  1240. this._shapes[i] = null;
  1241. this._titles[i] = null;
  1242. this._formatters[i] = null;
  1243. this._lastVisible[i] = false;
  1244. this._visible[i] = true;
  1245. }
  1246. },
  1247. /**
  1248. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) The legend component used by this manager; for unit tests
  1249. */
  1250. getLegendComponent : function() {
  1251. return this._comp;
  1252. },
  1253. /**
  1254. * Set a specific legend visible
  1255. * @param (int) legendIndex The index of the legend
  1256. * @param (boolean) visible New value of visible flag
  1257. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1258. */
  1259. visible$0 : function(legendIndex, visible) {
  1260. if (legendIndex < this._visible.length) {
  1261. this._visible[legendIndex] = visible;
  1262. }
  1263. return this;
  1264. },
  1265. /**
  1266. * Set all legend visible
  1267. * @param (boolean) visible New value of visible flag
  1268. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1269. */
  1270. visible$1 : function(visible) {
  1271. for (var i = 0; i < this._visible.length; ++i) {
  1272. this._visible[i] = visible;
  1273. }
  1274. return this;
  1275. },
  1276. /**
  1277. * Set the layout rectangle. The rectangle is copied. If it is null, the layout rectangle is unchanged.
  1278. * @param (rave['internal']['RectStruct']) rect New layout rectangle
  1279. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1280. */
  1281. /** @expose */
  1282. rectangle : function(rect) {
  1283. if (rect) {
  1284. this._rectangle = new rave['internal']['RectStruct'](rect.x, rect.y, rect.width, rect.height);
  1285. }
  1286. return this;
  1287. },
  1288. /**
  1289. * Set the orient property. If the argument is not "horizontal" or "vertical", the orient property is not changed.
  1290. * @param (String) orient New orient
  1291. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1292. */
  1293. /** @expose */
  1294. orient : function(orient) {
  1295. if ("horizontal" == orient || "vertical" == orient) {
  1296. this._orient = orient;
  1297. }
  1298. return this;
  1299. },
  1300. /**
  1301. * Set the orient property from a legend position. If the argument is "top" or "bottom", the orient is set to "horizontal". Otherwise it is set to "vertical".
  1302. * @param (String) position Legend position
  1303. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1304. */
  1305. /** @expose */
  1306. position : function(position) {
  1307. return this.orient(com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf(position));
  1308. },
  1309. /**
  1310. * Set the transition information. If the duration is negative, 0 is used.
  1311. * @param (boolean) doTransition Whether to do a transition
  1312. * @param (int) duration Duration of the transition when used
  1313. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1314. */
  1315. /** @expose */
  1316. transition : function(doTransition, duration) {
  1317. this._doTransition = doTransition;
  1318. this._duration = (duration >= 0) ? duration : 0;
  1319. return this;
  1320. },
  1321. /**
  1322. * Set the pre-execute callback for all legends. The callback may be null.
  1323. * @param (rave['library']['internal']['ComponentCallback']) callback The callback
  1324. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1325. */
  1326. /** @expose */
  1327. setPreExecute : function(callback) {
  1328. this._preExecute = callback;
  1329. return this;
  1330. },
  1331. /**
  1332. * Set the selector to be used when rendering a legend. If the index is out of range no selectors change.
  1333. * @param (int) index Legend array index
  1334. * @param (rave['internal']['Selector']) selector Selector, may be null (but this is not advisable)
  1335. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1336. */
  1337. /** @expose */
  1338. selector : function(index, selector) {
  1339. if (index >= 0 && index < this._numLegends) {
  1340. this._selectors[index] = selector;
  1341. }
  1342. return this;
  1343. },
  1344. /**
  1345. * Set the palette of a legend. If the index is out of range no information is changed.
  1346. * @param (int) index Legend array index
  1347. * @param (rave['library']['internal']['Palette']) palette Palette, may be null
  1348. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1349. */
  1350. /** @expose */
  1351. palette : function(index, palette) {
  1352. if (index >= 0 && index < this._numLegends) {
  1353. this._palettes[index] = palette;
  1354. }
  1355. return this;
  1356. },
  1357. /**
  1358. * Set the shape of a legend. If the index is out of range no information is changed.
  1359. * @param (int) index Legend array index
  1360. * @param (String) shape Shape, may be null (defaulting to square)
  1361. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1362. */
  1363. /** @expose */
  1364. shape : function(index, shape) {
  1365. if (index >= 0 && index < this._numLegends) {
  1366. this._shapes[index] = shape;
  1367. }
  1368. return this;
  1369. },
  1370. /**
  1371. * Set the title of a legend. If the index is out of range no information is changed.
  1372. * @param (int) index Legend array index
  1373. * @param (String) title Title, may be null
  1374. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1375. */
  1376. /** @expose */
  1377. title : function(index, title) {
  1378. if (index >= 0 && index < this._numLegends) {
  1379. this._titles[index] = title;
  1380. }
  1381. return this;
  1382. },
  1383. /**
  1384. * Set the title font style of a legend. If the index is out of range no information is changed.
  1385. * @param (int) index Legend array index
  1386. * @param (String) titleFont Title font string, may be null
  1387. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1388. */
  1389. /** @expose */
  1390. titleFont : function(index, titleFont) {
  1391. if (index >= 0 && index < this._numLegends) {
  1392. this._titleFonts[index] = titleFont;
  1393. }
  1394. return this;
  1395. },
  1396. /**
  1397. * Set the entry font style of a legend. If the index is out of range no information is changed.
  1398. * @param (int) index Legend array index
  1399. * @param (String) entryFont Entry font string, may be null
  1400. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1401. */
  1402. /** @expose */
  1403. entryFont : function(index, entryFont) {
  1404. if (index >= 0 && index < this._numLegends) {
  1405. this._entryFonts[index] = entryFont;
  1406. }
  1407. return this;
  1408. },
  1409. /**
  1410. * Set the title fill of a legend. If the index is out of range no information is changed.
  1411. * @param (int) index Legend array index
  1412. * @param (String) titleFill Fill color string, may be null
  1413. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1414. */
  1415. /** @expose */
  1416. titleFill : function(index, titleFill) {
  1417. if (index >= 0 && index < this._numLegends) {
  1418. this._titleFills[index] = titleFill;
  1419. }
  1420. return this;
  1421. },
  1422. /**
  1423. * Set the title font size of a legend. If the index is out of range no information is changed.
  1424. * @param (int) index Legend array index
  1425. * @param (String) titleFontSize Font size string, may be null
  1426. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1427. */
  1428. /** @expose */
  1429. titleFontSize : function(index, titleFontSize) {
  1430. if (index >= 0 && index < this._numLegends) {
  1431. this._titleFontSizes[index] = titleFontSize;
  1432. }
  1433. return this;
  1434. },
  1435. /**
  1436. * Set the title font family of a legend. If the index is out of range no information is changed.
  1437. * @param (int) index Legend array index
  1438. * @param (String) titleFontFamily Font family string, may be null
  1439. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1440. */
  1441. /** @expose */
  1442. titleFontFamily : function(index, titleFontFamily) {
  1443. if (index >= 0 && index < this._numLegends) {
  1444. this._titleFontFamilies[index] = titleFontFamily;
  1445. }
  1446. return this;
  1447. },
  1448. /**
  1449. * Set the scale of a legend. If the index is out of range no information is changed.
  1450. * @param (int) index Legend array index
  1451. * @param (rave['internal']['AbstractScale']) scale Scale, may be null
  1452. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1453. */
  1454. /** @expose */
  1455. scale : function(index, scale) {
  1456. if (index >= 0 && index < this._numLegends) {
  1457. this._scale[index] = scale;
  1458. }
  1459. return this;
  1460. },
  1461. /**
  1462. * Set the swatch size function of a legend. If the index is out of range no information is changed.
  1463. * @param (int) index Legend array index
  1464. * @param (rave['internal']['ValueFunction']) swatchSize Swatch size function, may be null
  1465. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1466. */
  1467. /** @expose */
  1468. swatchSize : function(index, swatchSize) {
  1469. if (index >= 0 && index < this._numLegends) {
  1470. this._swatchSizes[index] = swatchSize;
  1471. }
  1472. return this;
  1473. },
  1474. /**
  1475. * Set the formatter for a legend. If the index is out of range no information is changed. The custom formatter is found using {@link this.BundleContext#this.getCustomFormatterWithFlag(, rave['library']['internal']['CustomFormatInfo'], rave['internal']['ValueFunction'], )} , searching for formatters in the order LEGEND and ALL, and using the given ValueFunction as the default if none are provided. The returned value function is set as the legend's formatter.
  1476. * @param (int) index Legend array index
  1477. * @param (Array) entries List of data slot entries, if null an empty list is used
  1478. * @param (String) format One of {@link this.CustomFormatInfo#"none"} or {@link this.CustomFormatInfo#"percent"}
  1479. * @param (rave['internal']['ValueFunction']) defaultFunction Default function to use if no custom formatter is defined, may be null
  1480. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1481. */
  1482. /** @expose */
  1483. formatterList : function(index, entries, format, defaultFunction) {
  1484. if (index >= 0 && index < this._numLegends) {
  1485. this._formatters[index] = this._context.getCustomFormatterWithFlag(["legend", "all"], rave['library']['internal']['BundleContext'].makeCustomFormatInfo("legend-label", "ROLE_NONE", format, entries), defaultFunction, false);
  1486. }
  1487. return this;
  1488. },
  1489. /**
  1490. * Utility for the common case where there is only one data slot entry, using no special format or default function. Makes a list with the entry and calls {@link #this.formatterList(, Array, String, rave['internal']['ValueFunction'])} with FORMAT_NONE and a null default function.
  1491. * @param (int) index Legend array index
  1492. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  1493. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1494. */
  1495. /** @expose */
  1496. formatter : function(index, entry) {
  1497. var entries = [];
  1498. if (entry) {
  1499. entries.push(entry);
  1500. }
  1501. return this.formatterList(index, entries, "none", null);
  1502. },
  1503. /**
  1504. * Test if any legends are visible. The global visible flag must be true, and at least one legend must have a palette. This is intended to help with layout of the whole chart; first set all the legend properties, then allocate space if any are visible.
  1505. * @return (boolean) Whether any legend are visible (will be drawn)
  1506. */
  1507. /** @expose */
  1508. anyVisible : function() {
  1509. for (var i = 0; i < this._numLegends; ++i) {
  1510. if (this._visible[i] == true && (this._palettes[i] || this._swatchSizes[i])) {
  1511. return true;
  1512. }
  1513. }
  1514. return false;
  1515. },
  1516. /**
  1517. * Supply a data slot entry to be associated with the specified legend index. Note this method will call {@link #this.formatter(, rave['library']['internal']['DataSlotEntry'])} , which will handle a default formatter. For more info, see {@link #this.formatterList(, Array, String, rave['internal']['ValueFunction'])} .
  1518. * @param (int) index Legend array index
  1519. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  1520. * @return (com.ibm.rave.bundles.components.LegendsManager) This LegendsManager
  1521. */
  1522. /** @expose */
  1523. setDataSlot : function(index, entry) {
  1524. if (index >= 0 && index < this._numLegends) {
  1525. this._dataSlotEntries[index] = entry;
  1526. }
  1527. return this.formatter(index, entry);
  1528. },
  1529. preLayout$0 : function(layoutComponent) {
  1530. this.preLayout$1(layoutComponent, true);
  1531. return this;
  1532. },
  1533. preLayout$1 : function(layoutComponent, axesBeforeLegend) {
  1534. var layoutTransition = this._doTransition;
  1535. var layoutDuration = this._duration;
  1536. this._doTransition = false;
  1537. this._duration = 0;
  1538. var children = [];
  1539. for (var i = 0; i < this._numLegends; ++i) {
  1540. children[i] = "g.layoutLegend-" + i;
  1541. }
  1542. rave['library']['internal']['AbstractView'].createGroupStructure(this._context.node.select("g.legends-layout"), children);
  1543. var layoutSelectors = [];
  1544. var layoutLastVisible = [];
  1545. for (var i = 0; i < this._numLegends; ++i) {
  1546. layoutSelectors[i] = this._selectors[i];
  1547. layoutLastVisible[i] = this._lastVisible[i];
  1548. this._lastVisible[i] = false;
  1549. if (this._selectors[i]) {
  1550. this._selectors[i] = this._context.node.select("g.layoutLegend-" + i);
  1551. }
  1552. }
  1553. layoutComponent.preLayout(true, !axesBeforeLegend);
  1554. this.rectangle(layoutComponent.legendRect());
  1555. this.draw();
  1556. this._doTransition = layoutTransition;
  1557. this._duration = layoutDuration;
  1558. this._context.node.select("g.legends-layout").selectAll("*").remove();
  1559. for (var i = 0; i < this._numLegends; ++i) {
  1560. this._lastVisible[i] = layoutLastVisible[i];
  1561. this._selectors[i] = layoutSelectors[i];
  1562. }
  1563. return this;
  1564. },
  1565. /**
  1566. * Render the legends using the current global and per-legend settings.
  1567. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1568. */
  1569. /** @expose */
  1570. draw : function() {
  1571. var nVisible = 0;
  1572. for (var i = 0; i < this._numLegends; ++i) {
  1573. if ((this._swatchSizes[i] || this._palettes[i]) && this._visible[i]) {
  1574. nVisible++;
  1575. }
  1576. }
  1577. var x = this._rectangle.x;
  1578. var y = this._rectangle.y;
  1579. var dx;
  1580. var dy;
  1581. var size;
  1582. if (nVisible == 0) {
  1583. dx = 0;
  1584. dy = 0;
  1585. size = [this._rectangle.width, this._rectangle.height];
  1586. } else if ("horizontal" == this._orient) {
  1587. dx = this._rectangle.width / nVisible;
  1588. dy = 0;
  1589. size = [dx, this._rectangle.height];
  1590. } else {
  1591. dx = 0;
  1592. dy = this._rectangle.height / nVisible;
  1593. size = [this._rectangle.width, dy];
  1594. }
  1595. this._comp.orient(this._orient).size(size);
  1596. this._spaceUsed = 0;
  1597. for (var i = 0; i < this._numLegends; ++i) {
  1598. if (this._selectors[i]) {
  1599. var visible = this._visible[i] && (this._palettes[i] || this._swatchSizes[i]);
  1600. this._comp.visible(visible).colorPalette(this._palettes[i]).orient(this._orient).setPreExecute(this._preExecute).shape(this._shapes[i] != null ? this._shapes[i] : "square").title(this._titles[i]).titleFill(this._titleFills[i]).titleFontSize(this._titleFontSizes[i]).titleFontFamily(this._titleFontFamilies[i]).labelFormat(this._formatters[i]).swatchSize(this._swatchSizes[i]).scale(this._scale[i]);
  1601. var fontStyle = this._context.getPropertyValue("legend.titlestyle.font");
  1602. if (this._titleFonts[i] != null && !(this._titleFonts[i] == "")) {
  1603. this._comp.titleFont(this._titleFonts[i]);
  1604. } else if (fontStyle != null && !(fontStyle == "")) {
  1605. this._comp.titleFont(this._context.getPropertyValue("legend.titlestyle.font"));
  1606. }
  1607. fontStyle = this._context.getPropertyValue("legend.entrystyle.font");
  1608. if (this._entryFonts[i] != null) {
  1609. this._comp.entryFont(this._entryFonts[i]);
  1610. } else if (fontStyle != null && !(fontStyle == "")) {
  1611. this._comp.entryFont(this._context.getPropertyValue("legend.entrystyle.font"));
  1612. }
  1613. var s = (this._doTransition && this._lastVisible[i]) ? this._selectors[i].transition("transition").duration(this._duration) : this._selectors[i];
  1614. s.attr("transform", "translate(" + x + "," + y + ")").call(this._comp);
  1615. var dataSlotEntries = [];
  1616. if (this._dataSlotEntries[i]) {
  1617. dataSlotEntries.push(this._dataSlotEntries[i]);
  1618. }
  1619. this._selectors[i].selectAll(".legendTitle").property("dataSlots", dataSlotEntries);
  1620. if (visible) {
  1621. x += dx;
  1622. y += dy;
  1623. if (this._comp.getSpaceUsed() > this._spaceUsed) {
  1624. this._spaceUsed = this._comp.getSpaceUsed();
  1625. }
  1626. }
  1627. this._lastVisible[i] = visible;
  1628. } else {
  1629. this._lastVisible[i] = false;
  1630. }
  1631. }
  1632. return this;
  1633. },
  1634. /** @expose */
  1635. getSizableType : function() {
  1636. return 2;
  1637. },
  1638. /** @expose */
  1639. getSizableOrientation : function() {
  1640. return this._orient;
  1641. },
  1642. /** @expose */
  1643. getPreferredSize : function() {
  1644. return this._spaceUsed;
  1645. },
  1646. /** @expose */
  1647. getSpillOverSize : function() {
  1648. return 0;
  1649. },
  1650. /** @expose */
  1651. visible : function(a0, a1) {
  1652. var args = arguments;
  1653. if (args.length == 1) {
  1654. return this.visible$1(a0);
  1655. }
  1656. return this.visible$0(a0, a1);
  1657. },
  1658. /** @expose */
  1659. preLayout : function(a0, a1) {
  1660. var args = arguments;
  1661. if (args.length == 1) {
  1662. return this.preLayout$0(a0);
  1663. }
  1664. return this.preLayout$1(a0, a1);
  1665. }
  1666. });
  1667. // $source: com/ibm/rave/bundles/utilities/FontPropertyParser
  1668. /************************************************************************
  1669. ** IBM Confidential
  1670. **
  1671. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1672. **
  1673. ** (C) Copyright IBM Corp. 2017
  1674. **
  1675. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1676. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1677. ************************************************************************/
  1678. // GENERATED
  1679. var com_ibm_rave_bundles_utilities_FontPropertyParser = rave['internal']['Declare']({
  1680. });
  1681. /**
  1682. * Method to parse the css font styles and return a style map.
  1683. * @param (String) fontStyle CSS string (eg. "font-family: courier; font-size: 22; fill: red")
  1684. * @return (Object) Font Style Map
  1685. */
  1686. /** @expose */
  1687. com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont = function(fontStyle) {
  1688. if (fontStyle != null && fontStyle.length > 0) {
  1689. var properties = fontStyle.split(new RegExp(";"));
  1690. var fontStyles = {};
  1691. for (var __i_enFor0 = 0, __len_enFor0 = properties.length;
  1692. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1693. var property = properties[__i_enFor0];
  1694. var fontMap = property.split(new RegExp(":"));
  1695. if (fontMap.length == 2) {
  1696. var key = fontMap[0].trim();
  1697. fontStyles[key == "color" ? "fill" : key] = fontMap[1].trim();
  1698. }
  1699. }
  1700. return fontStyles;
  1701. }
  1702. return null;
  1703. };
  1704. // $source: com/ibm/rave/bundles/components/AxesManager
  1705. /************************************************************************
  1706. ** IBM Confidential
  1707. **
  1708. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1709. **
  1710. ** (C) Copyright IBM Corp. 2018
  1711. **
  1712. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1713. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1714. ************************************************************************/
  1715. // GENERATED
  1716. //@import com/ibm/rave/bundles/components/AxisComponentImpl (runtime) // new, getTranslation
  1717. //@import com/ibm/rave/bundles/components/GridComponentImpl (runtime) // new
  1718. //@import com/ibm/rave/bundles/components/ClipPathComponentImpl (runtime) // new
  1719. /**
  1720. * <p> Managers the axes and gridlines for a bundle. The manager handles rectangular axes, where the axes are drawn to the top, bottom, left, and/or right of a central chart. The manager does not do the layout of axes or the setup of scales. Bundle views will normally create an instance in the setup method, then set properties in their draw method and call {@link #this.draw()} to render all the axes and gridlines (including setting the transforms and clip paths on the groups). </p> <p> The manager has four axes and four gridlines, identified by the logical roles X1, X2, Y1, Y2. These corresponding to the constants in the {@link (com.ibm.rave.bundles.component.AxisComponent) AxisComponent} API. The X roles are the independent axes and the Y roles are the dependent axes. The manager will create an instance of the {@link (com.ibm.rave.bundles.components.AxisComponentImpl) AxisComponentImpl} or {@link (com.ibm.rave.bundles.components.GridComponentImpl) GridComponentImpl} for each role as it is required. </p> <p> The manager has four group (&lt;g&gt;) selectors for axes and four for gridlines, identified by their geometric positions top, bottom, left, and right. In bundles the group structure is created when the bundle first runs, so these selectors can in theory be set just once. </p> <p> Note that the axes and grids are identified logically, while the groups are identified geometrically. By default X1 is the bottom group, X2 the top, Y1 the left, and Y2 the right. This association is controlled by properties which transpose and/or flip the assignments. This is in part a RAVE/D3 requirement, since the core Axis examines the shapes in the group to generate transitions. </p> <p> The group selectors should be ordinary selectors. If a transition is requested and the transition duration is non-negative, the manager creates transitions from the selectors. However in order to give a somewhat better appearance, the manager keeps track of whether shapes were drawn into the group on the previous execution, and a transition is not used if the group was not used. </p> <h3>Properties</h3> <p> The manager has the following overall properties: </p> <ul> <li> The bundle context, set by the constructor. This is used to get the pre-execution callbacks and the custom formatters. </li> <li> A global visibility flag. If false, the axes and grids are not drawn (all shapes are cleared from all groups). </li> <li> Whether to use a transition and the transition duration. </li> <li> A selector for the definitions node used to create clip paths. </li> <li> The elements rectangle. This is the rectangle for the center area surrounded by the axis rectangles. </li> </ul> <p> The manager has the following per-<I>role</I> (X1, X2, Y1, Y2) properties: </p> <ul> <li> The scale for that role. If null, neither the axis nor the grid can be drawn and any shapes in the groups will be removed. </li> <li> Whether to suppress (not draw) labels for that role when redrawing during a pan. By default this is false for all axes. TODO: change defaults depending on story 24882. </li> <li> An {@link (com.ibm.rave.bundles.components.AxisComponentImpl) AxisComponentImpl} for the role. Views use this component to set the axis drawing properties (see below). This is created on-demand, generally when a view first requests it, and the same component will be reused for that role thereafter. </li> <li> An {@link (com.ibm.rave.bundles.components.GridComponentImpl) GridComponentImpl} for the role. Views use this component to set the grid drawing properties (see below). This is created on-demand, generally when a view first requests it, and the same component will be reused for that role thereafter. </li> </ul> <p> The manager has the following per-<I>position</I> (bottom, top, left, right) properties: </p> <li> A group (&lt;g&gt; node) selector for the axis. If null, neither the axis nor the corresponding grid are drawn. </li> <li> The bounds rectangle for the axis. </li> <li> A group (&lt;g&gt; node) selector for the grid. If null, the corresponding grid is not drawn. </li> </ul> <h3>Components</h3> <p> An {@link (com.ibm.rave.bundles.components.AxisComponentImpl) AxisComponentImpl} and {@link (com.ibm.rave.bundles.components.GridComponentImpl) GridComponentImpl} can be obtained for each role. These instances are created on demand, usually when a view requests the instance, but also if the manager is drawing and detects that the instance is needed. Once created the instance will be used by the manager thereafter. </p> <p> Views should use these instances to configure the appearance properties of the axes and grids. </p> <p> All other properties (such as scale, bounds, orient, role, and pre-execution callback) are set by the AxesManager. Views can set these properties but the manager's {@link #this.draw()} method will change the settings. Values for some of these properties (e.g. scale and bounds) are set in the manager by the view, and the others are found automatically by the manager. </p>
  1721. */
  1722. var com_ibm_rave_bundles_components_AxesManager = rave['internal']['Declare']({
  1723. /**
  1724. * Bundle context
  1725. */
  1726. //_context : null,
  1727. /**
  1728. * Selector for the bundle defs node. If null, no clip paths will be defined.
  1729. */
  1730. //_defs : null,
  1731. /**
  1732. * Scales for the axes, indexed by X1, X2, Y1, Y2
  1733. */
  1734. //_scales : null,
  1735. /**
  1736. * Whether to suppress labels when panning, indexed by X1, X2, Y1, Y2.
  1737. */
  1738. //_suppressPanLabels : null,
  1739. /**
  1740. * Value of the axis drawAxisLabels, set when axis is drawn, indexed by X1, X2, Y1, Y2.
  1741. */
  1742. //_drawAxisLabels : null,
  1743. /**
  1744. * Axis components created on demand, indexed by X1, X2, Y1, Y2
  1745. */
  1746. //_axisComponents : null,
  1747. /**
  1748. * When last drawn, the selector used for each axis role, indexed by X1, X2, Y1, Y2; used for redraws.
  1749. */
  1750. //_lastAxisDrawSelectors : null,
  1751. /**
  1752. * Grid components created on demand, indexed by X1, X2, Y1, Y2
  1753. */
  1754. //_gridComponents : null,
  1755. /**
  1756. * When last drawn, the selector used for each grid role, indexed by X1, X2, Y1, Y2; used for redraws.
  1757. */
  1758. //_lastGridDrawSelectors : null,
  1759. /**
  1760. * For clearing axis
  1761. */
  1762. //_clearAxis : null,
  1763. /**
  1764. * For clearing grid
  1765. */
  1766. //_clearGrid : null,
  1767. /**
  1768. * Selectors for the axis groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1769. */
  1770. //_axisSelectors : null,
  1771. /**
  1772. * Selectors for the grid groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1773. */
  1774. //_gridSelectors : null,
  1775. /**
  1776. * Bounding rectangles for the axis groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1777. */
  1778. //_axisRects : null,
  1779. /**
  1780. * Center elements bounds, also the grid bounds.
  1781. */
  1782. //_elementRect : null,
  1783. /**
  1784. * Whether anything was drawn into the axis group last time, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1785. */
  1786. //_lastAxisDrew : null,
  1787. /**
  1788. * Whether anything was drawn into the grid group last time, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1789. */
  1790. //_lastGridDrew : null,
  1791. //_dataSlotEntries : null,
  1792. //_layoutAxisOrder : null,
  1793. /**
  1794. * On the first draw, no transitions are used.
  1795. */
  1796. _firstDraw : false,
  1797. /**
  1798. * Whether to draw the axes and grids.
  1799. */
  1800. _visible : true,
  1801. /**
  1802. * Transition duration, ms
  1803. */
  1804. _duration : 0,
  1805. /**
  1806. * Transpose the axes (assign X to left/right and Y to top/bottom)
  1807. */
  1808. _transpose : false,
  1809. /**
  1810. * Switch the independent (X) axes, drawing X1 where X2 normally goes and vice-versa
  1811. */
  1812. _swapX : false,
  1813. /**
  1814. * Switch the dependent (Y) axes, drawing Y1 where Y2 normally goes and vice-versa
  1815. */
  1816. _swapY : false,
  1817. _layoutInProgress : false,
  1818. _layoutMaxWidth : 0,
  1819. _layoutMaxHeight : 0,
  1820. _xPadding : 0, _xOuterPadding : 0, _yPadding : 0, _yOuterPadding : 0,
  1821. _xPixelPad : 0, _yPixelPad : 0,
  1822. /**
  1823. * Hack to allow heatmap in "unit cell" mode to disable stagger because of the post scaling that messes up axis layout
  1824. */
  1825. _preventStaggerRotate45 : false,
  1826. constructor : function(context) {
  1827. this._scales = [];
  1828. this._suppressPanLabels = [];
  1829. this._drawAxisLabels = [];
  1830. this._axisComponents = [];
  1831. this._lastAxisDrawSelectors = [];
  1832. this._gridComponents = [];
  1833. this._lastGridDrawSelectors = [];
  1834. this._clearAxis = new com_ibm_rave_bundles_components_AxisComponentImpl();
  1835. this._clearGrid = new com_ibm_rave_bundles_components_GridComponentImpl();
  1836. this._axisSelectors = [];
  1837. this._gridSelectors = [];
  1838. this._axisRects = [];
  1839. this._elementRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1840. this._lastAxisDrew = [];
  1841. this._lastGridDrew = [];
  1842. this._dataSlotEntries = [];
  1843. this._layoutAxisOrder = [];
  1844. /**
  1845. * Construct and initialize. No axis scales or selector groups are defined.
  1846. * @param (rave['library']['internal']['BundleContext']) context The bundle context
  1847. */
  1848. {
  1849. this._context = context;
  1850. for (var i = 0; i < 4; ++i) {
  1851. this._scales[i] = null;
  1852. this._suppressPanLabels[i] = false;
  1853. this._axisComponents[i] = null;
  1854. this._lastAxisDrawSelectors[i] = null;
  1855. this._gridComponents[i] = null;
  1856. this._lastGridDrawSelectors[i] = null;
  1857. this._axisSelectors[i] = null;
  1858. this._gridSelectors[i] = null;
  1859. this._axisRects[i] = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1860. this._lastAxisDrew[i] = false;
  1861. this._lastGridDrew[i] = false;
  1862. this._dataSlotEntries[i] = [];
  1863. }
  1864. }
  1865. },
  1866. /** @expose */
  1867. preLayout : function(layoutComponent, axesBeforeLegend, xPadding, xOuterPadding, xPixelPad, yPadding, yOuterPadding, yPixelPad) {
  1868. this._xPadding = xPadding;
  1869. this._xOuterPadding = xOuterPadding;
  1870. this._xPixelPad = xPixelPad;
  1871. this._yPadding = yPadding;
  1872. this._yOuterPadding = yOuterPadding;
  1873. this._yPixelPad = yPixelPad;
  1874. this._layoutInProgress = true;
  1875. var layoutDuration = this._duration;
  1876. this._duration = 0;
  1877. var children = ["g.layoutAxis-bottom", "g.layoutAxis-top", "g.layoutAxis-left", "g.layoutAxis-right", "g.layoutGrid-bottom", "g.layoutGrid-top", "g.layoutGrid-left", "g.layoutGrid-right"];
  1878. rave['library']['internal']['AbstractView'].createGroupStructure(this._context.node.select("g.axes-layout"), children);
  1879. var layoutAxisSelectors = [];
  1880. var layoutGridSelectors = [];
  1881. var layoutLastAxisDrew = [];
  1882. for (var position = 0; position < 4; ++position) {
  1883. if (this._axisComponents[position]) {
  1884. this._axisComponents[position].preLayout();
  1885. }
  1886. layoutAxisSelectors[position] = this._axisSelectors[position];
  1887. layoutGridSelectors[position] = this._gridSelectors[position];
  1888. layoutLastAxisDrew[position] = this._lastAxisDrew[position];
  1889. if (this._axisSelectors[position]) {
  1890. this.axisSelector(position, this._context.node.select("g.layoutAxis-" + com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position]));
  1891. }
  1892. if (this._gridSelectors[position]) {
  1893. this.gridSelector(position, this._context.node.select("g.layoutGrid-" + com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position]));
  1894. }
  1895. }
  1896. layoutComponent.preLayout(axesBeforeLegend, true);
  1897. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, layoutComponent.elementRect());
  1898. var countHorz = 0;
  1899. var countVert = 0;
  1900. var axes = [];
  1901. for (var position = 0; position < 4; ++position) {
  1902. var role = this.positionToRole(position);
  1903. var isHorz = position == 1 || position == 0;
  1904. if (this._axisSelectors[position] && this._scales[role]) {
  1905. if (isHorz) {
  1906. countHorz++;
  1907. } else {
  1908. countVert++;
  1909. }
  1910. if (this._scales[role].isOrdinal() || this._scales[role].isClustered()) {
  1911. var score = isHorz ? 4 : 2;
  1912. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, score));
  1913. } else {
  1914. var score = isHorz ? 3 : 1;
  1915. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, score));
  1916. }
  1917. } else {
  1918. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, 5));
  1919. }
  1920. }
  1921. axes.sort(function(a1, a2) {
  1922. var a1value = a1.score;
  1923. var a2value = a2.score;
  1924. return a1value < a2value ? -1 : a1value > a2value ? 1 : 0;
  1925. });
  1926. this._layoutAxisOrder = [];
  1927. for (var i = 0; i < 4; ++i) {
  1928. this._layoutAxisOrder[i] = axes[i].position;
  1929. }
  1930. this._layoutMaxWidth = this._elementRect.width * (countVert > 1 ? 0.5 : 0.4);
  1931. this._layoutMaxHeight = this._elementRect.height * (countHorz > 1 ? 0.5 : 0.4);
  1932. for (var index = 0; index < 4; ++index) {
  1933. var position = this._layoutAxisOrder[index];
  1934. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[position], this._elementRect);
  1935. }
  1936. this.draw();
  1937. this._duration = layoutDuration;
  1938. this._context.node.select("g.axes-layout").selectAll("*").remove();
  1939. for (var position = 0; position < 4; ++position) {
  1940. this._lastAxisDrew[position] = layoutLastAxisDrew[position];
  1941. this._axisSelectors[position] = layoutAxisSelectors[position];
  1942. this._gridSelectors[position] = layoutGridSelectors[position];
  1943. }
  1944. this._layoutInProgress = false;
  1945. return this;
  1946. },
  1947. getPositionToDraw : function(index) {
  1948. return this._layoutInProgress ? this._layoutAxisOrder[index] : index;
  1949. },
  1950. preDrawAxis : function(index) {
  1951. if (this._layoutInProgress) {
  1952. var position = this._layoutAxisOrder[index];
  1953. var role = this.positionToRole(position);
  1954. if (role == 0 || role == 1) {
  1955. this.setScaleRangePadded(this._scales[role], false, this._xPadding, this._xOuterPadding, this._xPixelPad);
  1956. } else {
  1957. this.setScaleRangePadded(this._scales[role], true, this._yPadding, this._yOuterPadding, this._yPixelPad);
  1958. }
  1959. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(true);
  1960. }
  1961. },
  1962. postDrawAxis : function(index) {
  1963. if (this._layoutInProgress) {
  1964. var position = this._layoutAxisOrder[index];
  1965. var role = this.positionToRole(position);
  1966. var axis = this._axisComponents[role];
  1967. var size = axis.getPreferredSize();
  1968. if (position == 1 || position == 0) {
  1969. if (size > this._layoutMaxHeight) {
  1970. size = this._layoutMaxHeight;
  1971. }
  1972. this._elementRect.height -= size;
  1973. if (position == 1) {
  1974. this._elementRect.y += size;
  1975. }
  1976. } else {
  1977. if (size > this._layoutMaxWidth) {
  1978. size = this._layoutMaxWidth;
  1979. }
  1980. this._elementRect.width -= size;
  1981. if (position == 2) {
  1982. this._elementRect.x += size;
  1983. }
  1984. }
  1985. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(false);
  1986. }
  1987. },
  1988. /**
  1989. * Draw the axes and grids. This will set all the properties of the axes and grids, including the transforms and clip paths, then draw the shapes using a transition if required. Use {@link #this.redraw()} to simply re-render the shapes, for example when zooming.
  1990. */
  1991. /** @expose */
  1992. draw : function() {
  1993. for (var role = 0; role < 4; ++role) {
  1994. this._lastAxisDrawSelectors[role] = null;
  1995. this._lastGridDrawSelectors[role] = null;
  1996. }
  1997. for (var index = 0; index < 4; ++index) {
  1998. var position = this.getPositionToDraw(index);
  1999. var role = this.positionToRole(position);
  2000. if (!this._visible || !this._axisSelectors[position] || !this._scales[role]) {
  2001. this.clearAxis(position);
  2002. this.clearGrid(position);
  2003. } else {
  2004. this.preDrawAxis(index);
  2005. this.drawAxis(position, role);
  2006. this.postDrawAxis(index);
  2007. if (this._gridSelectors[position]) {
  2008. this.drawGrid(position, role);
  2009. }
  2010. }
  2011. }
  2012. this._firstDraw = false;
  2013. },
  2014. /**
  2015. * @return (boolean) true if we are hiding any labels during pan-zoom.
  2016. */
  2017. /** @expose */
  2018. hideAnyPanZoom : function() {
  2019. return (this._suppressPanLabels[0] || this._suppressPanLabels[1] || this._suppressPanLabels[2] || this._suppressPanLabels[3]);
  2020. },
  2021. /**
  2022. * Redraw all the axes and grids used in the last call to {@link #this.draw()} , rendering the shapes into the same selector groups as used then. The component properties, transforms, and clip paths are not reset, and no transitions are used. This should be used for pan-zoom and may be used for other redraw events.
  2023. * @param (boolean) panning Whether this is a pan in-progress; use false otherwise including when pan-zoom ends.
  2024. */
  2025. /** @expose */
  2026. redraw : function(panning) {
  2027. for (var role = 0; role < 4; ++role) {
  2028. if (this._axisComponents[role] && this._lastAxisDrawSelectors[role]) {
  2029. this._axisComponents[role].displayTickLabels(this._drawAxisLabels[role]);
  2030. this._axisComponents[role].showPanZoomTickLabels(!panning || !this._suppressPanLabels[role]);
  2031. var isAllow = this._axisComponents[role].isAllowAutomaticAxisLayoutToChangeOrientation();
  2032. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(false);
  2033. this._lastAxisDrawSelectors[role].call(this._axisComponents[role]);
  2034. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(isAllow);
  2035. }
  2036. if (this._gridComponents[role] && this._lastGridDrawSelectors[role]) {
  2037. this._lastGridDrawSelectors[role].call(this._gridComponents[role]);
  2038. }
  2039. }
  2040. },
  2041. /** @expose */
  2042. preventStaggerRotate45 : function(preventStaggerRotate45) {
  2043. this._preventStaggerRotate45 = preventStaggerRotate45;
  2044. },
  2045. /**
  2046. * Draw the axis for the given role into the axis group for the given position. When called, the selector for the position and the scale for the role are non-null. This also sets the transform for the group and defines and sets the clip path for the axis.
  2047. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2048. * @param (int) role The axis role, X1, X2, Y1, or Y2
  2049. */
  2050. drawAxis : function(position, role) {
  2051. var axisGroup = this._axisSelectors[position];
  2052. this._lastAxisDrawSelectors[role] = axisGroup;
  2053. var comp = this.axisComponent(role);
  2054. var layoutModeID = role == 2 ? "axis.y.labels.layoutMode" : role == 3 ? "axis.y2.labels.layoutMode" : "axis.x.labels.layoutMode";
  2055. var allowStaggerID = role == 2 ? "axis.y.labels.allowStagger" : role == 3 ? "axis.y2.labels.allowStagger" : "axis.x.labels.allowStagger";
  2056. var allowRotate45ID = role == 2 ? "axis.y.labels.allowRotate45" : role == 3 ? "axis.y2.labels.allowRotate45" : "axis.x.labels.allowRotate45";
  2057. var allowRotate90ID = role == 2 ? "axis.y.labels.allowRotate90" : role == 3 ? "axis.y2.labels.allowRotate90" : "axis.x.labels.allowRotate90";
  2058. var layoutMode = ""+(this._context.getPropertyValue(layoutModeID));
  2059. var allowStagger = !this._preventStaggerRotate45 && (this._context.getPropertyValue(allowStaggerID));
  2060. var allowRotate45 = !this._preventStaggerRotate45 && (this._context.getPropertyValue(allowRotate45ID));
  2061. var allowRotate90 = (this._context.getPropertyValue(allowRotate90ID));
  2062. var textTruncateIndicator = (this._context.getPropertyValue("axis.labels.truncationText"));
  2063. var axisBounds = this._axisRects[position];
  2064. var orient = com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position];
  2065. var transform = com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation(axisBounds, orient);
  2066. var axisTransform = "translate(" + transform[0] + "," + transform[1] + ")";
  2067. comp.scale(this._scales[role]).setRole(com_ibm_rave_bundles_components_AxesManager.ROLES[role]).bounds(axisBounds).elementRect(this._elementRect).orient(orient).layoutMode(layoutMode).allowStagger(allowStagger).allowRotate45(allowRotate45).allowRotate90(allowRotate90).setPreExecute(this._context.getPreExecute()).textTruncateIndicator(textTruncateIndicator);
  2068. this._drawAxisLabels[role] = comp._displayTickLabels;
  2069. var axisGroupUpdate = axisGroup;
  2070. if (this._duration > 0 && !this._firstDraw && this._lastAxisDrew[position]) {
  2071. axisGroupUpdate = axisGroup.transition().duration(this._duration);
  2072. }
  2073. axisGroupUpdate.attr("transform", axisTransform);
  2074. axisGroupUpdate.call(comp);
  2075. var dataSlotEntryList = this._dataSlotEntries[role];
  2076. axisGroup.selectAll(".axis-title").property("dataSlots", dataSlotEntryList);
  2077. this._lastAxisDrew[position] = comp.renderedShapes();
  2078. if (this._defs) {
  2079. var clipAxis = new com_ibm_rave_bundles_components_ClipPathComponentImpl(this._context.instanceId() + "clip" + orient);
  2080. var text = axisGroup.append("text").text("000,000");
  2081. var bbox = text.node().getBBox();
  2082. var w = bbox.width;
  2083. var h = bbox.height;
  2084. text.remove();
  2085. var clipRect;
  2086. if (position == 0 || position == 1) {
  2087. var leftEdge = axisBounds.x + transform[0] * -1;
  2088. var rightEdge = leftEdge + axisBounds.width;
  2089. if (!(this._scales[role].isOrdinal()) && !(this._scales[role].isClustered())) {
  2090. var numericLeftEdge = this._elementRect.x - w + transform[0] * -1;
  2091. var numericRightEdge = numericLeftEdge + this._elementRect.width + w * 2;
  2092. if (numericLeftEdge < leftEdge) {
  2093. leftEdge = numericLeftEdge;
  2094. }
  2095. if (numericRightEdge > rightEdge) {
  2096. rightEdge = numericRightEdge;
  2097. }
  2098. }
  2099. clipRect = new rave['internal']['RectStruct'](leftEdge, axisBounds.y + transform[1] * -1, rightEdge - leftEdge, axisBounds.height);
  2100. } else {
  2101. clipRect = new rave['internal']['RectStruct'](axisBounds.x + transform[0] * -1, this._elementRect.y - h / 2 + transform[1] * -1, axisBounds.width, this._elementRect.height + h);
  2102. }
  2103. clipAxis.clipRect(clipRect).applyTo(axisGroup.select(".axis." + orient)).call(this._defs);
  2104. }
  2105. },
  2106. /**
  2107. * If the axis selector for the position is defined, clear the shapes from the axis group.
  2108. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2109. */
  2110. clearAxis : function(position) {
  2111. if (this._axisSelectors[position]) {
  2112. this._clearAxis.scale(null);
  2113. this._axisSelectors[position].call(this._clearAxis);
  2114. }
  2115. this._lastAxisDrew[position] = false;
  2116. },
  2117. /**
  2118. * Draw the grid for the given role into the axis group for the given position. When called, the selector for the role is non-null, and axis component has just been used to draw the axis shapes. This also sets the transform for the group.
  2119. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2120. * @param (int) role The axis role, X1, X2, Y1, or Y2
  2121. */
  2122. drawGrid : function(position, role) {
  2123. var gridGroup = this._gridSelectors[position];
  2124. this._lastGridDrawSelectors[role] = gridGroup;
  2125. var comp = this.gridComponent(role);
  2126. var axisBounds = this._axisRects[position];
  2127. var orient = com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position];
  2128. var transform = com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation(axisBounds, orient);
  2129. var axisTransform = "translate(" + transform[0] + "," + transform[1] + ")";
  2130. comp.setRole(com_ibm_rave_bundles_components_AxesManager.ROLES[role]).orient(orient).setPreExecute(this._context.getPreExecute()).bounds(this._elementRect).axis(this._axisComponents[role].axis());
  2131. if (this._duration <= 0 || this._firstDraw || !this._lastAxisDrew[position]) {
  2132. gridGroup.attr("transform", axisTransform).call(comp);
  2133. } else {
  2134. gridGroup.transition().duration(this._duration).attr("transform", axisTransform).call(comp);
  2135. }
  2136. this._lastGridDrew[position] = comp.renderedShapes();
  2137. },
  2138. /**
  2139. * If the grid selector for the position is defined, clear the shapes from the grid group.
  2140. * @param (int) position The grid position, BOTTOM, TOP, LEFT, RIGHT
  2141. */
  2142. clearGrid : function(position) {
  2143. if (this._gridSelectors[position]) {
  2144. this._clearGrid.axis(null);
  2145. this._gridSelectors[position].call(this._clearGrid);
  2146. }
  2147. this._lastGridDrew[position] = false;
  2148. },
  2149. /**
  2150. * @param (boolean) visible Whether the manager should draw axes
  2151. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2152. */
  2153. /** @expose */
  2154. visible : function(visible) {
  2155. this._visible = visible;
  2156. return this;
  2157. },
  2158. /**
  2159. * @param (int) duration The transition duration; if <= 0, no transition is used.
  2160. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2161. */
  2162. /** @expose */
  2163. duration : function(duration) {
  2164. this._duration = duration;
  2165. return this;
  2166. },
  2167. /**
  2168. * @param (boolean) transpose Whether to transpose the chart (switch the positions of the X and Y axis)
  2169. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2170. */
  2171. /** @expose */
  2172. transpose : function(transpose) {
  2173. this._transpose = transpose;
  2174. return this;
  2175. },
  2176. /**
  2177. * @param (boolean) swapX Whether to switch the postitions of the X1 and X2 axes
  2178. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2179. */
  2180. /** @expose */
  2181. swapX : function(swapX) {
  2182. this._swapX = swapX;
  2183. return this;
  2184. },
  2185. /**
  2186. * @param (boolean) swapY Whether to switch the postitions of the Y1 and Y2 axes
  2187. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2188. */
  2189. /** @expose */
  2190. swapY : function(swapY) {
  2191. this._swapY = swapY;
  2192. return this;
  2193. },
  2194. /**
  2195. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2196. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale The coordinate scale for that role, may be null
  2197. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2198. */
  2199. /** @expose */
  2200. scale : function(role, scale) {
  2201. this._scales[role] = scale;
  2202. return this;
  2203. },
  2204. /**
  2205. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2206. * @param (boolean) suppressLabels Whether to suppress the labels when panning the axis
  2207. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2208. */
  2209. /** @expose */
  2210. suppressPanLabels : function(role, suppressLabels) {
  2211. this._suppressPanLabels[role] = suppressLabels;
  2212. return this;
  2213. },
  2214. /**
  2215. * Get the AxisComponentImpl used to render a role. Views should use this to set the appearance properties of the axis. Other properties are handled by the manager.
  2216. * @param (int) role The role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2217. * @return (com.ibm.rave.bundles.components.AxisComponentImpl) The component for the role
  2218. */
  2219. /** @expose */
  2220. axisComponent : function(role) {
  2221. if (!this._axisComponents[role]) {
  2222. this._axisComponents[role] = new com_ibm_rave_bundles_components_AxisComponentImpl();
  2223. }
  2224. return this._axisComponents[role];
  2225. },
  2226. /**
  2227. * Get the GridComponentImpl used to render a role. Views should use this to set the appearance properties of the grid. Other properties are handled by the manager.
  2228. * @param (int) role The role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2229. * @return (com.ibm.rave.bundles.components.GridComponentImpl) The component for the role
  2230. */
  2231. /** @expose */
  2232. gridComponent : function(role) {
  2233. if (!this._gridComponents[role]) {
  2234. this._gridComponents[role] = new com_ibm_rave_bundles_components_GridComponentImpl();
  2235. }
  2236. return this._gridComponents[role];
  2237. },
  2238. /**
  2239. * Set the bundle &lt;defs&gt; node. Clip paths will be defined in this node.
  2240. * @param (rave['internal']['Selector']) defs The defs node
  2241. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2242. */
  2243. /** @expose */
  2244. defsSelector : function(defs) {
  2245. this._defs = com_ibm_rave_bundles_components_AxesManager.checkSelector(defs);
  2246. return this;
  2247. },
  2248. /**
  2249. * Set the selector for an axis group node.
  2250. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2251. * @param (rave['internal']['Selector']) axisGroup The axis group node, may be null
  2252. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2253. */
  2254. /** @expose */
  2255. axisSelector : function(position, axisGroup) {
  2256. this._axisSelectors[position] = com_ibm_rave_bundles_components_AxesManager.checkSelector(axisGroup);
  2257. return this;
  2258. },
  2259. /**
  2260. * Set the selector for a grid group node.
  2261. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2262. * @param (rave['internal']['Selector']) gridGroup The grid group node, may be null
  2263. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2264. */
  2265. /** @expose */
  2266. gridSelector : function(position, gridGroup) {
  2267. this._gridSelectors[position] = com_ibm_rave_bundles_components_AxesManager.checkSelector(gridGroup);
  2268. return this;
  2269. },
  2270. /**
  2271. * Set the element (grid) bounds rectangle to a copy of the given rectangle.
  2272. * @param (rave['internal']['RectStruct']) elementRect The rectangle, if null the bounds are set to 0,0,0,0
  2273. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2274. */
  2275. /** @expose */
  2276. elementRect : function(elementRect) {
  2277. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, elementRect);
  2278. return this;
  2279. },
  2280. /**
  2281. * Set an axis bounds rectangle to a copy of the given rectangle.
  2282. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2283. * @param (rave['internal']['RectStruct']) axisRect The axis bounds, if null the bounds are set to 0,0,0,0
  2284. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2285. */
  2286. /** @expose */
  2287. axisRect : function(position, axisRect) {
  2288. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[position], axisRect);
  2289. return this;
  2290. },
  2291. /**
  2292. * Convenience method. Set all the selectors using context.node as the root of a selection, and assuming the default chart structure: the defs node is the "defs" selection, the left axis is "g.axis.left", and so on.
  2293. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2294. */
  2295. /** @expose */
  2296. useDefaultSelectors : function() {
  2297. this.defsSelector(this._context.node.select("defs"));
  2298. this.axisSelector(0, this._context.node.select("g.axisTransform.bottom"));
  2299. this.axisSelector(1, this._context.node.select("g.axisTransform.top"));
  2300. this.axisSelector(2, this._context.node.select("g.axisTransform.left"));
  2301. this.axisSelector(3, this._context.node.select("g.axisTransform.right"));
  2302. this.gridSelector(0, this._context.node.select("g.grid.bottom"));
  2303. this.gridSelector(1, this._context.node.select("g.grid.top"));
  2304. this.gridSelector(2, this._context.node.select("g.grid.left"));
  2305. this.gridSelector(3, this._context.node.select("g.grid.right"));
  2306. return this;
  2307. },
  2308. /**
  2309. * Convenience method: Set the element rectangle and axis rectangles from the rectangles in the layout.
  2310. * @param (com.ibm.rave.bundles.components.ChartLayoutComponentImpl) layoutInfo Layout information
  2311. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2312. */
  2313. /** @expose */
  2314. useBoundsFromLayout : function(layoutInfo) {
  2315. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, layoutInfo.elementRect());
  2316. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[0], layoutInfo.bottomRect());
  2317. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[1], layoutInfo.topRect());
  2318. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[2], layoutInfo.leftRect());
  2319. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[3], layoutInfo.rightRect());
  2320. return this;
  2321. },
  2322. /**
  2323. * Convenience method: Set the X1 axis and grid appearance properties from the context, using the usual {@link (rave['library']['internal']['CommonPropertyIDs']) CommonPropertyIDs} . Sets the the padding to the default 16. This does not set the tick format.
  2324. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2325. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2326. */
  2327. /** @expose */
  2328. useDefaultX1Properties : function(setGridParameters) {
  2329. this.axisComponent(0).padding(16).displayAxisTitle(((this._context.getPropertyValue("axis.x.title.display")))).axisTitle(this._context.getDataSlotLabel("axis.x.title.text", this._dataSlotEntries[0])).displayAxisLine(((this._context.getPropertyValue("axis.x.line.display")))).lineColor((this._context.getPropertyValue("axis.x.line.style.stroke"))).displayTicks(((this._context.getPropertyValue("axis.x.ticks.display")))).tickColor((this._context.getPropertyValue("axis.x.ticks.style.stroke"))).displayTickLabels(((this._context.getPropertyValue("axis.x.labels.display"))));
  2330. var titleFontStyle = (this._context.getPropertyValue("axis.x.title.style.font"));
  2331. var labelFontStyle = (this._context.getPropertyValue("axis.x.labels.style.font"));
  2332. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2333. this.axisComponent(0).labelStyle(labelFontStyle);
  2334. } else {
  2335. this.axisComponent(0).labelStyle((this._context.getPropertyValue("axis.x.labels.style.fill")), (this._context.getPropertyValue("axis.x.labels.style.font-size")), (this._context.getPropertyValue("axis.x.labels.style.font-family")));
  2336. }
  2337. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2338. this.axisComponent(0).titleStyle(titleFontStyle);
  2339. } else {
  2340. this.axisComponent(0).titleStyle((this._context.getPropertyValue("axis.x.title.style.fill")), (this._context.getPropertyValue("axis.x.title.style.font-size")), (this._context.getPropertyValue("axis.x.title.style.font-family")));
  2341. }
  2342. if (setGridParameters) {
  2343. this.gridComponent(0).displayGridlines(((this._context.getPropertyValue("axis.x.gridlines.display")))).gridlineStyle((this._context.getPropertyValue("axis.x.gridlines.style.stroke")), (this._context.getPropertyValue("axis.x.gridlines.style.stroke-dasharray")));
  2344. }
  2345. this.suppressPanLabels(0, (this._context.getPropertyValue("axis.x.labels.zoomPan")));
  2346. return this;
  2347. },
  2348. /**
  2349. * Convenience method: Set the Y1 axis and grid appearance properties from the context, using the usual {@link (rave['library']['internal']['CommonPropertyIDs']) CommonPropertyIDs} . Sets the the padding to the default 16. This does not set the tick format.
  2350. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2351. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2352. */
  2353. /** @expose */
  2354. useDefaultY1Properties : function(setGridParameters) {
  2355. this.axisComponent(2).padding(16).displayAxisTitle((this._context.getPropertyValue("axis.y.title.display"))).axisTitle(this._context.getDataSlotLabel("axis.y.title.text", this._dataSlotEntries[2])).displayAxisLine((this._context.getPropertyValue("axis.y.line.display"))).lineColor((this._context.getPropertyValue("axis.y.line.style.stroke"))).displayTicks((this._context.getPropertyValue("axis.y.ticks.display"))).tickColor((this._context.getPropertyValue("axis.y.ticks.style.stroke"))).displayTickLabels((this._context.getPropertyValue("axis.y.labels.display")));
  2356. var titleFontStyle = (this._context.getPropertyValue("axis.y.title.style.font"));
  2357. var labelFontStyle = (this._context.getPropertyValue("axis.y.labels.style.font"));
  2358. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2359. this.axisComponent(2).labelStyle(labelFontStyle);
  2360. } else {
  2361. this.axisComponent(2).labelStyle((this._context.getPropertyValue("axis.y.labels.style.fill")), (this._context.getPropertyValue("axis.y.labels.style.font-size")), (this._context.getPropertyValue("axis.y.labels.style.font-family")));
  2362. }
  2363. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2364. this.axisComponent(2).titleStyle(titleFontStyle);
  2365. } else {
  2366. this.axisComponent(2).titleStyle((this._context.getPropertyValue("axis.y.title.style.fill")), (this._context.getPropertyValue("axis.y.title.style.font-size")), (this._context.getPropertyValue("axis.y.title.style.font-family")));
  2367. }
  2368. if (setGridParameters) {
  2369. this.gridComponent(2).displayGridlines((this._context.getPropertyValue("axis.y.gridlines.display"))).gridlineStyle((this._context.getPropertyValue("axis.y.gridlines.style.stroke")), (this._context.getPropertyValue("axis.y.gridlines.style.stroke-dasharray")));
  2370. }
  2371. this.suppressPanLabels(2, (this._context.getPropertyValue("axis.y.labels.zoomPan")));
  2372. return this;
  2373. },
  2374. /**
  2375. * Convenience method: Set the Y2 axis and grid appearance properties from the context, using the usual {@link (rave['library']['internal']['CommonPropertyIDs']) CommonPropertyIDs} . Sets the the padding to the default 16. This does not set the tick format.
  2376. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2377. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2378. */
  2379. /** @expose */
  2380. useDefaultY2Properties : function(setGridParameters) {
  2381. this.axisComponent(3).padding(16).displayAxisTitle((this._context.getPropertyValue("axis.y2.title.display"))).axisTitle(this._context.getDataSlotLabel("axis.y2.title.text", this._dataSlotEntries[3])).displayAxisLine((this._context.getPropertyValue("axis.y2.line.display"))).lineColor((this._context.getPropertyValue("axis.y2.line.style.stroke"))).displayTicks((this._context.getPropertyValue("axis.y2.ticks.display"))).tickColor((this._context.getPropertyValue("axis.y2.ticks.style.stroke"))).displayTickLabels((this._context.getPropertyValue("axis.y2.labels.display")));
  2382. var titleFontStyle = (this._context.getPropertyValue("axis.y2.title.style.font"));
  2383. var labelFontStyle = (this._context.getPropertyValue("axis.y2.labels.style.font"));
  2384. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2385. this.axisComponent(3).labelStyle(labelFontStyle);
  2386. } else {
  2387. this.axisComponent(3).labelStyle((this._context.getPropertyValue("axis.y2.labels.style.fill")), (this._context.getPropertyValue("axis.y2.labels.style.font-size")), (this._context.getPropertyValue("axis.y2.labels.style.font-family")));
  2388. }
  2389. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2390. this.axisComponent(3).titleStyle(titleFontStyle);
  2391. } else {
  2392. this.axisComponent(3).titleStyle((this._context.getPropertyValue("axis.y2.title.style.fill")), (this._context.getPropertyValue("axis.y2.title.style.font-size")), (this._context.getPropertyValue("axis.y2.title.style.font-family")));
  2393. }
  2394. if (setGridParameters) {
  2395. this.gridComponent(3).displayGridlines((this._context.getPropertyValue("axis.y2.gridlines.display"))).gridlineStyle((this._context.getPropertyValue("axis.y2.gridlines.style.stroke")), (this._context.getPropertyValue("axis.y2.gridlines.style.stroke-dasharray")));
  2396. }
  2397. this.suppressPanLabels(3, (this._context.getPropertyValue("axis.y2.labels.zoomPan")));
  2398. return this;
  2399. },
  2400. /**
  2401. * Set the tick formatting function for the given axis role. The custom formatter is found using {@link this.BundleContext#this.getCustomFormatterWithFlag(, rave['library']['internal']['CustomFormatInfo'], rave['internal']['ValueFunction'], )} , searching for formatters in the order role, position of role, AXIS, and ALL, and using the given ValueFunction as the default if none are provided. The returned value function is set as the axis component's tick format. This must be called after setting the transpose, swapX, and swapY properties, since the position of the role depends on those properties.
  2402. * @param (int) role One of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2403. * @param (Array) entries Non-null list of data slot entries
  2404. * @param (String) format One of {@link this.CustomFormatInfo#"none"} or {@link this.CustomFormatInfo#"percent"}
  2405. * @param (rave['internal']['ValueFunction']) defaultFunction Default function to use if no custom formatter is defined for the axis, may be null
  2406. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2407. */
  2408. /** @expose */
  2409. setTickFormatterList : function(role, entries, format, defaultFunction) {
  2410. var fmtRole;
  2411. switch (role) {
  2412. case 2:
  2413. fmtRole = "ROLE_Y1";
  2414. break;
  2415. case 1:
  2416. fmtRole = "ROLE_X2";
  2417. break;
  2418. case 3:
  2419. fmtRole = "ROLE_Y2";
  2420. break;
  2421. case 0:
  2422. default:
  2423. fmtRole = "ROLE_X1";
  2424. break;
  2425. }
  2426. var fmt = this._context.getCustomFormatterWithFlag([com_ibm_rave_bundles_components_AxesManager.ROLE_FORMATTERS[role], com_ibm_rave_bundles_components_AxesManager.FORMATTERS[this.roleToPosition(role)], "axis", "all"], rave['library']['internal']['BundleContext'].makeCustomFormatInfo("axis-label", fmtRole, format, entries), defaultFunction, false);
  2427. this.axisComponent(role).tickFormat(fmt);
  2428. var simplefmt = this._context.getCustomFormatterWithFlag([com_ibm_rave_bundles_components_AxesManager.ROLE_FORMATTERS[role], com_ibm_rave_bundles_components_AxesManager.FORMATTERS[this.roleToPosition(role)], "axis", "all"], rave['library']['internal']['BundleContext'].makeCustomFormatInfo("axis-label", fmtRole, format, entries), defaultFunction, true);
  2429. this.axisComponent(role).simplifiedTickFormat(simplefmt);
  2430. return this;
  2431. },
  2432. /**
  2433. * Utility for the common case where there is only one data slot entry and no special formatting or default. Makes a list of the entry and calls {@link #this.setTickFormatterList(, Array, String, rave['internal']['ValueFunction'])} with the "none" format and a null default function.
  2434. * @param (int) role One of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2435. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  2436. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2437. */
  2438. /** @expose */
  2439. setTickFormatter : function(role, entry) {
  2440. var entries = [];
  2441. if (entry) {
  2442. entries.push(entry);
  2443. }
  2444. return this.setTickFormatterList(role, entries, "none", null);
  2445. },
  2446. /**
  2447. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined scale.
  2448. * @param (Number) padding Padding, relevant only for ordinal scales
  2449. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2450. * @param (int) pixelPad Pixel padding at each end
  2451. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2452. */
  2453. /** @expose */
  2454. setScaleRanges : function(padding, outerPadding, pixelPad) {
  2455. this.setIndependentScaleRanges(padding, outerPadding, pixelPad);
  2456. this.setDependentScaleRanges(padding, outerPadding, pixelPad);
  2457. return this;
  2458. },
  2459. /**
  2460. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined independent scale.
  2461. * @param (Number) padding Padding, relevant only for ordinal scales
  2462. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2463. * @param (int) pixelPad Pixel padding at each end
  2464. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2465. */
  2466. /** @expose */
  2467. setIndependentScaleRanges : function(padding, outerPadding, pixelPad) {
  2468. this.setScaleRangePadded(this._scales[0], false, padding, outerPadding, pixelPad);
  2469. this.setScaleRangePadded(this._scales[1], false, padding, outerPadding, pixelPad);
  2470. return this;
  2471. },
  2472. /**
  2473. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined independent scale.
  2474. * @param (Number) padding Padding, relevant only for ordinal scales
  2475. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2476. * @param (int) pixelPad Pixel padding at each end
  2477. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2478. */
  2479. /** @expose */
  2480. setDependentScaleRanges : function(padding, outerPadding, pixelPad) {
  2481. this.setScaleRangePadded(this._scales[2], true, padding, outerPadding, pixelPad);
  2482. this.setScaleRangePadded(this._scales[3], true, padding, outerPadding, pixelPad);
  2483. return this;
  2484. },
  2485. /**
  2486. * Set a data slot entry that will be associated with the specified axis role. <br /><br /> To associate multiple data slots with an axis role, see {@link #this.setDataSlot(, Array)} .
  2487. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2488. * @param (rave['library']['internal']['DataSlotEntry']) slot DataSlotEntry to be associated with the axis role.
  2489. */
  2490. setDataSlot$0 : function(role, slot) {
  2491. this.setDataSlot$1(role, [slot]);
  2492. return this;
  2493. },
  2494. /**
  2495. * Set a list of data slot entries that will be associated with the specified axis role.
  2496. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2497. * @param (Array) slots List of DataSlotEntry to be associated with the axis role.
  2498. */
  2499. setDataSlot$1 : function(role, slots) {
  2500. if (role < 4 && role >= 0) {
  2501. this._dataSlotEntries[role].length = 0;
  2502. if (slots) {
  2503. for (var __i_enFor0 = 0, __exp_enFor0 = slots, __len_enFor0 = __exp_enFor0.length;
  2504. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2505. var slot = __exp_enFor0[__i_enFor0];
  2506. this._dataSlotEntries[role].push(slot);
  2507. }
  2508. }
  2509. }
  2510. return this;
  2511. },
  2512. /**
  2513. * </p> Set the coordinate range of a scale. This should be used only after the transpose and center rectangle have been set. Transpose and dependent are used to choose either the X or Y extent of the center rectangle. The extent is padded by pixelPad pixels at each end, so the smallest value of the domain will map to the extent's start+pixelPadding, and the largest value of the domain to the extent's end-pixelPadding. </p> TODO: This would be a good place for scale reverse.
  2514. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale Bundle independent scale
  2515. * @param (boolean) dependent Whether this is the dependent scale
  2516. * @param (Number) padding Padding, relevant only for ordinal scales
  2517. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2518. * @param (int) pixelPad Pixel padding at each end
  2519. */
  2520. setScaleRangePadded : function(scale, dependent, padding, outerPadding, pixelPad) {
  2521. if (scale) {
  2522. var min, max;
  2523. if (dependent == this._transpose) {
  2524. min = this._elementRect.x + pixelPad;
  2525. max = this._elementRect.x + this._elementRect.width - pixelPad;
  2526. } else {
  2527. if (scale.isContinuous()) {
  2528. min = this._elementRect.y + this._elementRect.height - pixelPad;
  2529. max = this._elementRect.y + pixelPad;
  2530. } else {
  2531. min = this._elementRect.y + pixelPad;
  2532. max = this._elementRect.y + this._elementRect.height - pixelPad;
  2533. }
  2534. }
  2535. scale.range(min, max, padding, outerPadding);
  2536. }
  2537. },
  2538. /**
  2539. * Given a geometric position BOTTOM, TOP, LEFT, or RIGHT, return the role X1, X2, Y1, or Y2 used by that role.
  2540. * @param (int) position The position index
  2541. * @return (int) The role index
  2542. */
  2543. positionToRole : function(position) {
  2544. var r = position;
  2545. if (this._transpose) {
  2546. r = (r + 2) % 4;
  2547. }
  2548. if (this._swapX && r < 2) {
  2549. r = 1 - r;
  2550. }
  2551. if (this._swapY && r > 1) {
  2552. r = 5 - r;
  2553. }
  2554. return r;
  2555. },
  2556. /**
  2557. * Given a role X1, X2, Y1, or Y2, return the geometric position BOTTOM, TOP, LEFT, or RIGHT for that role.
  2558. * @param (int) role The role index
  2559. * @return (int) The position index
  2560. */
  2561. roleToPosition : function(role) {
  2562. var p = role;
  2563. if (this._swapX && role < 2) {
  2564. p = 1 - p;
  2565. }
  2566. if (this._swapY && p > 1) {
  2567. p = 5 - p;
  2568. }
  2569. if (this._transpose) {
  2570. p = (p + 2) % 4;
  2571. }
  2572. return p;
  2573. },
  2574. /**
  2575. * Sets the magnitude for the tick interval.
  2576. * @param (int) role role index of the axis
  2577. * @param (Number) tickMagnitude power of 10
  2578. * @return (com.ibm.rave.bundles.components.AxesManager) this
  2579. */
  2580. /** @expose */
  2581. scaleTickMagnitude : function(role, tickMagnitude) {
  2582. this.axisComponent(role).scaleTickMagnitude(tickMagnitude);
  2583. return this;
  2584. },
  2585. /** @expose */
  2586. setDataSlot : function(a0, a1) {
  2587. var args = arguments;
  2588. if (args.length == 2 && typeof a1 === "function") {
  2589. return this.setDataSlot$0(a0, a1);
  2590. }
  2591. return this.setDataSlot$1(a0, a1);
  2592. }
  2593. });
  2594. /**
  2595. * @param (rave['internal']['Selector']) s A selector
  2596. * @return (rave['internal']['Selector']) s if it is non-null and has at least one node, null otherwise
  2597. */
  2598. com_ibm_rave_bundles_components_AxesManager.checkSelector = function(s) {
  2599. return s && !(s.empty()) ? s : null;
  2600. };
  2601. /**
  2602. * Set a rectangle to a copy of another. If the source is null, the target is set to 0,0,0,0
  2603. * @param (rave['internal']['RectStruct']) target A non-null rectangle
  2604. * @param (rave['internal']['RectStruct']) source A possibly-null rectnalge
  2605. */
  2606. com_ibm_rave_bundles_components_AxesManager.setRect = function(target, source) {
  2607. if (source) {
  2608. target.x = source.x;
  2609. target.y = source.y;
  2610. target.width = source.width;
  2611. target.height = source.height;
  2612. } else {
  2613. target.x = 0;
  2614. target.y = 0;
  2615. target.width = 0;
  2616. target.height = 0;
  2617. }
  2618. };
  2619. /**
  2620. * A ValueFunction that appends '%' to the value.
  2621. * @param (int) n Number of digits
  2622. */
  2623. /** @expose */
  2624. com_ibm_rave_bundles_components_AxesManager.percentFormat = function(n) {
  2625. var digits = "." + n + "f";
  2626. var format = rave.format(digits);
  2627. return function(value, ix, gix) {
  2628. return format.call(null, value, 0, 0) + "%";
  2629. };
  2630. };
  2631. /**
  2632. * Called prior to chart layout. Axes are configured with no real bounding constraints to calculate their preferred size.
  2633. */
  2634. com_ibm_rave_bundles_components_AxesManager.AxisLayout = rave['internal']['Declare']({
  2635. /** @expose */
  2636. position : 0,
  2637. /** @expose */
  2638. score : 0,
  2639. constructor : function(position, score) {
  2640. this.position = position;
  2641. this.score = score;
  2642. }
  2643. });
  2644. /**
  2645. * Logical first X (independent) axis, default position bottom
  2646. */
  2647. /** @expose */
  2648. com_ibm_rave_bundles_components_AxesManager.X1 = 0;
  2649. /**
  2650. * Logical second X (independent) axis, default position top
  2651. */
  2652. /** @expose */
  2653. com_ibm_rave_bundles_components_AxesManager.X2 = 1;
  2654. /**
  2655. * Logical first Y (dependent) axis, default position left
  2656. */
  2657. /** @expose */
  2658. com_ibm_rave_bundles_components_AxesManager.Y1 = 2;
  2659. /**
  2660. * Logical first Y (dependent) axis, default position right
  2661. */
  2662. /** @expose */
  2663. com_ibm_rave_bundles_components_AxesManager.Y2 = 3;
  2664. /**
  2665. * Geometric group on bottom
  2666. */
  2667. /** @expose */
  2668. com_ibm_rave_bundles_components_AxesManager.BOTTOM = 0;
  2669. /**
  2670. * Geometric group on top
  2671. */
  2672. /** @expose */
  2673. com_ibm_rave_bundles_components_AxesManager.TOP = 1;
  2674. /**
  2675. * Geometric group on left
  2676. */
  2677. /** @expose */
  2678. com_ibm_rave_bundles_components_AxesManager.LEFT = 2;
  2679. /**
  2680. * Geometric group on right
  2681. */
  2682. /** @expose */
  2683. com_ibm_rave_bundles_components_AxesManager.RIGHT = 3;
  2684. /**
  2685. * Maps the role indexes to the role strings used by the components API
  2686. */
  2687. com_ibm_rave_bundles_components_AxesManager.ROLES = ["ROLE_X1", "ROLE_X2", "ROLE_Y1", "ROLE_Y2"];
  2688. /**
  2689. * Maps the role indexes to the role strings used by the custom formatter API. TODO: Unify the strings
  2690. */
  2691. com_ibm_rave_bundles_components_AxesManager.ROLE_FORMATTERS = ["ROLE_X1", "ROLE_X2", "ROLE_Y1", "ROLE_Y2"];
  2692. /**
  2693. * Maps the position indexes to the orient strings used by D3
  2694. */
  2695. com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS = ["bottom", "top", "left", "right"];
  2696. /**
  2697. * Maps the position indexes to the custom formatter strings
  2698. */
  2699. com_ibm_rave_bundles_components_AxesManager.FORMATTERS = ["bottom", "top", "left", "right"];
  2700. // $source: com/ibm/rave/bundles/component/AxisComponent
  2701. /************************************************************************
  2702. ** IBM Confidential
  2703. **
  2704. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2705. **
  2706. ** (C) Copyright IBM Corp. 2017
  2707. **
  2708. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2709. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2710. ************************************************************************/
  2711. // GENERATED
  2712. /**
  2713. * <p> A component that renders an axis (RAVE core Axis) with an optional title in an XY axis chart. The {@link #this.type()} method returns "AxisComponent". </p> <p> The {@link #this.role()} method is used to identify the axis. Most charts with axes will use only the {@link #"ROLE_X1"} and {@link #"ROLE_Y1"} roles. The composite bundle also uses {@link #"ROLE_Y2"} . {@link #"ROLE_X2"} is not currently used by any chart. </p> <p> The axis component uses a RAVE capability axis, available with {@link #this.axis()} . When used with a pre-execution callback, the axis is only valid for the duration of the callback (do not use the reference outside the callback). Properties of the capability axis may be set by the pre-execution callback, but note that many properties are set by the AxisComponent after the callback. To change those properties, use the methods of this class to change the AxisComponent, which will then set the capability axis properties. </p>
  2714. */
  2715. var com_ibm_rave_bundles_component_AxisComponent = rave['internal']['Declare'].implement(
  2716. /**
  2717. * @return (String) The role of the axis in the chart
  2718. */
  2719. //role : function() {},
  2720. /**
  2721. * @return (rave['internal']['Axis']) The capability Axis used by this AxisComponent
  2722. */
  2723. //axis : function() {},
  2724. /**
  2725. * The tickFormat is applied to the values of the ticks to create the string that is displayed.
  2726. * @param (rave['internal']['ValueFunction']) tickFormat The new tickFormat
  2727. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2728. */
  2729. //tickFormat : function(tickFormat) {},
  2730. /**
  2731. * Get the tickFormat function used by this component. May be null.
  2732. * @return (rave['internal']['ValueFunction']) Format function, or null
  2733. */
  2734. //tickFormat : function() {},
  2735. /**
  2736. * Set the indicator to be used for truncated text ex: indicator set to "..." , results in helloworld - > hello...
  2737. * @param (String) indicator the string to be placed to indicated truncated text
  2738. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2739. */
  2740. //textTruncateIndicator : function(indicator) {},
  2741. /**
  2742. * Whether to display the axis title.
  2743. * @param (boolean) displayAxisTitle true to display the axis title, false otherwise
  2744. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2745. */
  2746. //displayAxisTitle : function(displayAxisTitle) {},
  2747. /**
  2748. * Whether to display the axis line.
  2749. * @param (boolean) displayAxisLine true to display the axis line, false otherwise
  2750. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2751. */
  2752. //displayAxisLine : function(displayAxisLine) {},
  2753. /**
  2754. * Whether to display the axis tick marks.
  2755. * @param (boolean) displayTicks true to display the axis ticks, false otherwise
  2756. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2757. */
  2758. //displayTicks : function(displayTicks) {},
  2759. /**
  2760. * Whether to display the axis labels, as set by the show axis labels property
  2761. * @param (boolean) displayTickLabels true to display the axis tick labels, false otherwise
  2762. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2763. */
  2764. //displayTickLabels : function(displayTickLabels) {},
  2765. /**
  2766. * Whether to display the axis labels, as set by the hide pan-zoom labels property
  2767. * @param (boolean) showPanZoomTickLabels true to display the axis tick labels, false otherwise
  2768. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2769. */
  2770. //showPanZoomTickLabels : function(showPanZoomTickLabels) {},
  2771. /**
  2772. * @param (String) axisTitle The new axisTitle
  2773. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2774. */
  2775. //axisTitle : function(axisTitle) {},
  2776. /**
  2777. * The color used to draw the axis line and ticks. This is equivalent to calling both {@link #this.lineColor(String)} and {@link #this.tickColor(String)} .
  2778. * @param (String) axisColor The new line and tick color
  2779. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2780. */
  2781. //axisColor : function(axisColor) {},
  2782. /**
  2783. * The color used to draw the axis line.
  2784. * @param (String) lineColor The new lineColor
  2785. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2786. */
  2787. //lineColor : function(lineColor) {},
  2788. /**
  2789. * The color used to draw the axis ticks.
  2790. * @param (String) tickColor The new tickColor
  2791. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2792. */
  2793. //tickColor : function(tickColor) {},
  2794. /**
  2795. * The color used to draw the axis labels.
  2796. * @param (String) labelColor The new labelColor
  2797. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2798. */
  2799. //labelColor : function(labelColor) {},
  2800. /**
  2801. * The style for the axis labels.
  2802. * @param (String) fontStyle CSS string of font properties
  2803. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2804. */
  2805. //labelStyle : function(fontStyle) {},
  2806. /**
  2807. * The style for the axis labels.
  2808. * @param (String) fill The color used to draw the labels
  2809. * @param (String) fontSize CSS font size
  2810. * @param (String) fontFamily CSS font-families list
  2811. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2812. */
  2813. //labelStyle : function(fill, fontSize, fontFamily) {},
  2814. /**
  2815. * The color used to draw the axis title.
  2816. * @param (String) titleColor The new titleColor
  2817. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2818. */
  2819. //titleColor : function(titleColor) {},
  2820. /**
  2821. * The style for the axis title.
  2822. * @param (String) fontStyle CSS string of font properties
  2823. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2824. */
  2825. //titleStyle : function(fontStyle) {},
  2826. /**
  2827. * The style for the axis title.
  2828. * @param (String) fill The color used to draw the title
  2829. * @param (String) fontSize CSS font size
  2830. * @param (String) fontFamily CSS font-families list
  2831. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2832. */
  2833. //titleStyle : function(fill, fontSize, fontFamily) {}
  2834. );
  2835. /**
  2836. * The string returned by {@link #this.type()} is "AxisComponent".
  2837. */
  2838. /** @expose */
  2839. com_ibm_rave_bundles_component_AxisComponent.COMPONENT_TYPE = "AxisComponent";
  2840. /**
  2841. * Returned by {@link #this.role()} for the first independent axis.
  2842. */
  2843. /** @expose */
  2844. com_ibm_rave_bundles_component_AxisComponent.ROLE_X1 = "ROLE_X1";
  2845. /**
  2846. * Returned by {@link #this.role()} for the first dependent axis.
  2847. */
  2848. /** @expose */
  2849. com_ibm_rave_bundles_component_AxisComponent.ROLE_Y1 = "ROLE_Y1";
  2850. /**
  2851. * Returned by {@link #this.role()} for the second independent axis.
  2852. */
  2853. /** @expose */
  2854. com_ibm_rave_bundles_component_AxisComponent.ROLE_X2 = "ROLE_X2";
  2855. /**
  2856. * Returned by {@link #this.role()} for the second dependent axis.
  2857. */
  2858. /** @expose */
  2859. com_ibm_rave_bundles_component_AxisComponent.ROLE_Y2 = "ROLE_Y2";
  2860. // $source: com/ibm/rave/bundles/utilities/TextCrossfader
  2861. /************************************************************************
  2862. ** IBM Confidential
  2863. **
  2864. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2865. **
  2866. ** (C) Copyright IBM Corp. 2017
  2867. **
  2868. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2869. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2870. ************************************************************************/
  2871. // GENERATED
  2872. /**
  2873. * <p> Utility class for setting up a cross-fade of a single text node. This could be extended to a multiple-node selection (e.g. using value functions to return the text strings for each node in the selection), but that is not yet needed in the bundles. However use this with care, since if the transition does select multiple texts, they will all change to the new text string. </p> <p> Any other text properties that are changing, for example the color or position, can be set up in the transition either before or after calling the utility method. </p>
  2874. */
  2875. var com_ibm_rave_bundles_utilities_TextCrossfader = rave['internal']['Declare']({
  2876. });
  2877. /**
  2878. * <p> Perform a text cross fade for a single text node. The selection holds that node. If it is not a transition, the new text is set; otherwise the cross-fade transition is done using tweeners on the "text" and "fill-opacity" attributes. </p> <p> The "text" attribute tweener uses the oldText before transition time 0.5, and the new text thereafter. (Note this assumes that the old text is in fact the node's text; if not, the displayed text will change to the "old" text when the transition begins, then to the new text halfway through the transition.) </p> <p> The text is optionally faded out and back in, disappearing completely at time 0.5, by setting the "fill-opacity" style attribute. The fading is controlled by the delay argument, which is clamped to the range [0.0, 0.5]. If the clamped delay is 0.5, or if the text does not actually change, no crossfade is used. Otherwise the opacity is full for transition times less than the delay or greater than 1-delay, fading to 0.0 at time 0.5. For example if the delay is 0.2, the opacity will be full from transition time 0.0 to 0.2, fade out linearly to 0 at time 0.5, fade in linearly to full at time 0.8, and be full from time 0.8 to 1.0. </p> <p> The old and new texts and the full opacity are all passed as arguments, because it is generally not safe to try to find the values when the method runs. In particular, if we run this method while a transition (such as a previous cross-fade) is already in progress, we may pick up an intermediate fill-opacity value, perhaps even 0.0, and set the text opacity to that value!
  2879. * @param (rave['internal']['Selection']) selection Selection containing the single text node, may be a transition
  2880. * @param (String) oldText Old value of the text string, may be null
  2881. * @param (String) newText New value of the text string, may be null
  2882. * @param (Object) fillOpacity Fill opacity, may be null (in which case 1.0 is assumed)
  2883. * @param (double) delay Number between 0 and 0.5 controlling the timing of the fade
  2884. * @return (rave['internal']['Selection']) The selection, modified by the new text and fill-opacity
  2885. */
  2886. /** @expose */
  2887. com_ibm_rave_bundles_utilities_TextCrossfader.textCrossFade = function(selection, oldText, newText, fillOpacity, delay) {
  2888. if (!(selection.isTransition())) {
  2889. return selection.text(newText);
  2890. }
  2891. var _t = (selection).tween("text", function(data, index, groupIndex) {
  2892. return function(t) {
  2893. this.rave_setText(t < 0.5 ? oldText : newText);
  2894. };
  2895. });
  2896. var t0 = Math.max(0.0, Math.min(0.5, delay));
  2897. if (t0 == 0.5 || (oldText == null && newText == null) || (oldText != null && oldText == newText)) {
  2898. return selection;
  2899. }
  2900. var opacity = fillOpacity == null ? 1.0 : + (fillOpacity);
  2901. var tf = 1.0 / (0.5 - t0);
  2902. return _t.tween("fill-opacity", function(data, index, groupIndex) {
  2903. return function(t) {
  2904. if (t <= t0 || t >= (1.0 - t0)) {
  2905. this.rave_setStyle("fill-opacity", fillOpacity);
  2906. } else {
  2907. this.rave_setStyle("fill-opacity", opacity * Math.abs(t - 0.5) * tf);
  2908. }
  2909. };
  2910. });
  2911. };
  2912. // $source: com/ibm/rave/bundles/utilities/BundleLabelDropper
  2913. /************************************************************************
  2914. ** IBM Confidential
  2915. **
  2916. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2917. **
  2918. ** (C) Copyright IBM Corp. 2017
  2919. **
  2920. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2921. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2922. ************************************************************************/
  2923. // GENERATED
  2924. var com_ibm_rave_bundles_utilities_BundleLabelDropper = rave['internal']['Declare']({
  2925. //_dropOverlap : null,
  2926. labelCount : 0,
  2927. _$functionClassMethod : function() {
  2928. var _$self = function(args) {
  2929. if (args !== null || arguments.length > 1){
  2930. args = Array.prototype.slice.call(arguments, 0);
  2931. }
  2932. {
  2933. _$self.drop(args[0], ((args[1])));
  2934. return null;
  2935. }
  2936. };
  2937. return _$self;
  2938. },
  2939. /** @expose */
  2940. constructor : function() {
  2941. this._dropOverlap = (rave.capabilities.extension("position")).drop().remove(false);
  2942. this._dropOverlap.setOverlapGap(4.0);
  2943. },
  2944. /**
  2945. * Drop the overlapping labels or reset the overlap.
  2946. * @param (rave['internal']['Selection']) labels The selector for the labels
  2947. * @param (boolean) removeOverlap true to remove the overlapping labels, false to reset
  2948. */
  2949. /** @expose */
  2950. drop : function(labels, removeOverlap) {
  2951. if (!(labels.isTransition())) {
  2952. this.applyLabelDrop(labels, removeOverlap);
  2953. } else {
  2954. var steps = [0, 25, 75];
  2955. var self = this;
  2956. (labels).tween("__pointLabelDrop__", function(data, index, groupIndex) {
  2957. if (index == 0) {
  2958. return function(t) {
  2959. var currentStep = Math.floor(t * 100);
  2960. if (steps.length > 0 && currentStep < 100 && currentStep >= steps[0]) {
  2961. steps.splice(0, 1);
  2962. self.applyLabelDrop(labels, removeOverlap);
  2963. }
  2964. };
  2965. }
  2966. return null;
  2967. });
  2968. this.labelCount = 0;
  2969. (labels).each(function(data, index, groupIndex) {
  2970. ++self.labelCount;
  2971. }).each("end", function(args) {
  2972. if (args !== null || arguments.length > 1){
  2973. args = Array.prototype.slice.call(arguments, 0);
  2974. }
  2975. {
  2976. if (--self.labelCount == 0) {
  2977. self.applyLabelDrop(labels, removeOverlap);
  2978. }
  2979. return null;
  2980. }
  2981. });
  2982. }
  2983. },
  2984. applyLabelDrop : function(labels, removeOverlap) {
  2985. if (removeOverlap) {
  2986. labels.call(this._dropOverlap);
  2987. } else {
  2988. this._dropOverlap.reset(labels);
  2989. }
  2990. },
  2991. /** @expose */
  2992. configureForDataLabels : function(rect) {
  2993. if (rect) {
  2994. var ex = [[rect.x, rect.y], [rect.x + rect.width, rect.y + rect.height]];
  2995. this._dropOverlap.extent(ex);
  2996. }
  2997. this._dropOverlap.noClipping();
  2998. }
  2999. });
  3000. /**
  3001. * Drop overlap extension
  3002. */
  3003. //com_ibm_rave_bundles_utilities_BundleLabelDropper.POSITION_EXTENSION = "position";
  3004. /**
  3005. * space between labels during overlap testing
  3006. */
  3007. com_ibm_rave_bundles_utilities_BundleLabelDropper.OVERLAP_GAP = 4;
  3008. // $source: com/ibm/rave/bundles/components/StyleStructs
  3009. /************************************************************************
  3010. ** IBM Confidential
  3011. **
  3012. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3013. **
  3014. ** (C) Copyright IBM Corp. 2017
  3015. **
  3016. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3017. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3018. ************************************************************************/
  3019. // GENERATED
  3020. /**
  3021. * Struct classes to hold style properties.
  3022. */
  3023. var com_ibm_rave_bundles_components_StyleStructs = rave['internal']['Declare']({
  3024. });
  3025. /**
  3026. * Filled shape style properties.
  3027. */
  3028. com_ibm_rave_bundles_components_StyleStructs.ShapeStyle = function() {
  3029. this._fill = null;
  3030. this._stroke = null;
  3031. this._strokeWidth = null;
  3032. };
  3033. /**
  3034. * Line style properties.
  3035. */
  3036. com_ibm_rave_bundles_components_StyleStructs.LineStyle = function() {
  3037. this._stroke = null;
  3038. this._strokeWidth = null;
  3039. this._dashArray = null;
  3040. };
  3041. // $source: com/ibm/rave/bundles/component/GridComponent
  3042. /************************************************************************
  3043. ** IBM Confidential
  3044. **
  3045. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3046. **
  3047. ** (C) Copyright IBM Corp. 2017
  3048. **
  3049. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3050. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3051. ************************************************************************/
  3052. // GENERATED
  3053. /**
  3054. * <p> A component that renders gridlines in an XY axis chart. The {@link #this.type()} method returns "GridComponent". </p> <p> The {@link #this.role()} method is used to identify the grid. The return values are defined in {@link (com.ibm.rave.bundles.component.AxisComponent) AxisComponent} : {@link this.AxisComponent#"ROLE_X1"} , {@link this.AxisComponent#"ROLE_Y1"} , and so on. </p>
  3055. */
  3056. var com_ibm_rave_bundles_component_GridComponent = rave['internal']['Declare'].implement(
  3057. /**
  3058. * @return (String) The role of the grid in the chart
  3059. */
  3060. //role : function() {},
  3061. /**
  3062. * Whether to display the gridlines.
  3063. * @param (boolean) displayGridlines The new displayGridlines
  3064. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3065. */
  3066. //displayGridlines : function(displayGridlines) {},
  3067. /**
  3068. * Set the line styling. Equivalent to calling {@link #this.gridlineColor(String)} and {@link #this.dashArray(String)} .
  3069. * @param (String) stroke The stroke color
  3070. * @param (String) dashArray The stroke-dasharray
  3071. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3072. */
  3073. //gridlineStyle : function(stroke, dashArray) {},
  3074. /**
  3075. * The color used to draw the gridlines.
  3076. * @param (String) gridlineColor The new stroke color
  3077. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3078. */
  3079. //gridlineColor : function(gridlineColor) {},
  3080. /**
  3081. * The dashing used to draw the gridlines. The argument is a string, giving a comma-separated list of numbers as used with the SVG "stroke-dasharray" style.
  3082. * @param (String) dashArray The new dash array
  3083. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3084. */
  3085. //dashArray : function(dashArray) {}
  3086. );
  3087. /**
  3088. * The string returned by {@link #this.type()} is "GridComponent".
  3089. */
  3090. /** @expose */
  3091. com_ibm_rave_bundles_component_GridComponent.COMPONENT_TYPE = "GridComponent";
  3092. // $source: com/ibm/rave/bundles/components/IntervalDataUtilities
  3093. /************************************************************************
  3094. ** IBM Confidential
  3095. **
  3096. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3097. **
  3098. ** (C) Copyright IBM Corp. 2017
  3099. **
  3100. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3101. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3102. ************************************************************************/
  3103. // GENERATED
  3104. /**
  3105. * A structure for holding interval data (IntervalData}, and utilities for building an array of the data from the tabular data and accessors objects. The array has one entry per entry in the tabular data, and the array entries are in the same order as the datum rows for joining by selectors.
  3106. */
  3107. var com_ibm_rave_bundles_components_IntervalDataUtilities = rave['internal']['Declare']({
  3108. });
  3109. /**
  3110. * <p> Create intervals for a simple bar chart. The intervals come directly from the data, with the independent interval the independent value (for both ends) and the dependent interval 0.0 to the dependent value. The group and label are copied from the datum. The callout independent is the independent value, and the callout dependent is the dependent value (the bar extent). </p> <p> If the xScale is non-null and returns null for an independent (X) value, the data is skipped. </p>
  3111. * @param (Array) data Data array
  3112. * @param (rave['internal']['SingleValueFunction']) x X accessor, should not be null
  3113. * @param (rave['internal']['SingleValueFunction']) xScale Function to check if the X value is valid
  3114. * @param (rave['internal']['SingleValueFunction']) y Y accessor, should not be null
  3115. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3116. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3117. * @return (Array) Array of intervals for the data
  3118. */
  3119. /** @expose */
  3120. com_ibm_rave_bundles_components_IntervalDataUtilities.simpleBars = function(data, x, xScale, y, yStart, color, label) {
  3121. var result = [];
  3122. if (!data || data.length == 0 || !x || !y) {
  3123. return result;
  3124. }
  3125. data.forEach(function(d, ix, list) {
  3126. var xv = x(d);
  3127. if (xv != null && (!xScale || xScale(xv) != null)) {
  3128. var yv = y(d);
  3129. var yvStart = !yStart ? 0 : yStart(d);
  3130. if (yv != null && yvStart != null) {
  3131. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3132. r.key = ix;
  3133. r.ind1 = xv;
  3134. r.ind2 = r.ind1;
  3135. r.cind = r.ind1;
  3136. r.dep1 = yvStart;
  3137. r.dep2 = yv;
  3138. r.cdep = r.dep2;
  3139. r.color = color ? color(d) : null;
  3140. r.label = label ? label(d) : null;
  3141. r.value = r.dep2;
  3142. r._originalData = d;
  3143. r.valueAsPercentOfCategory = 100;
  3144. result.push(r);
  3145. }
  3146. }
  3147. return null;
  3148. });
  3149. var sum = 0;
  3150. for (var i = 0; i < result.length; ++i) {
  3151. var iData = result[i];
  3152. var value = + (iData.value);
  3153. sum += Math.abs(value);
  3154. }
  3155. if (sum != 0) {
  3156. for (var i = 0; i < result.length; ++i) {
  3157. var iData = result[i];
  3158. var value = + (iData.value);
  3159. iData.valueAsPercentOfColor = value / sum * 100;
  3160. }
  3161. }
  3162. return result;
  3163. };
  3164. /**
  3165. * Create intervals for bars in a clustered chart. This is similar to the simple bars, except the independent values are an array of accessors.
  3166. * @param (Array) data Data array
  3167. * @param (Array) x Independent accessor array, should not be null and no entries should be null
  3168. * @param (Array) xScale Array of possibly-null functions to check if X values are in domain; array should not be null, and should be same length as x
  3169. * @param (rave['internal']['SingleValueFunction']) y Dependent accessor, should not be null
  3170. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3171. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3172. * @return (Array) Array of intervals for the data
  3173. */
  3174. /** @expose */
  3175. com_ibm_rave_bundles_components_IntervalDataUtilities.clusteredBars = function(data, x, xScale, y, yStart, color, label) {
  3176. var result = [];
  3177. if (!data || data.length == 0 || !x || x.length == 0 || !y) {
  3178. return result;
  3179. }
  3180. var len = x.length;
  3181. var categories = {};
  3182. var colors = {};
  3183. data.forEach(function(d, ix, list) {
  3184. var OK = true;
  3185. var ind = [];
  3186. for (var i = 0; i < len; ++i) {
  3187. var xv = x[i](d);
  3188. if (xv == null || (xScale[i] && xScale[i](xv) == null)) {
  3189. OK = false;
  3190. break;
  3191. }
  3192. ind.push(xv);
  3193. if (i == 0) {
  3194. if (!(categories.hasOwnProperty(xv))) {
  3195. categories[""+(xv)] = 1;
  3196. }
  3197. } else if (!(colors.hasOwnProperty(xv))) {
  3198. colors[""+(xv)] = 1;
  3199. }
  3200. }
  3201. var dep = y(d);
  3202. var depStart = !yStart ? 0 : yStart(d);
  3203. if (OK && dep != null && depStart != null) {
  3204. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3205. r.key = ix;
  3206. r.ind1 = ind;
  3207. r.ind2 = ind;
  3208. r.cind = ind;
  3209. r.dep1 = depStart;
  3210. r.dep2 = dep;
  3211. r.cdep = r.dep2;
  3212. r.color = color ? color(d) : null;
  3213. r.label = label ? label(d) : null;
  3214. r.value = r.dep2;
  3215. r._originalData = d;
  3216. result.push(r);
  3217. }
  3218. return null;
  3219. });
  3220. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(categories), __len_enFor0 = __exp_enFor0.length;
  3221. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3222. var o = __exp_enFor0[__i_enFor0];
  3223. var s = ""+(o);
  3224. var sum = 0;
  3225. for (var i = 0; i < result.length; ++i) {
  3226. var iData = result[i];
  3227. if (s == (iData.ind1)[0]) {
  3228. var value = + (iData.value);
  3229. sum += Math.abs(value);
  3230. }
  3231. }
  3232. if (sum == 0) {
  3233. continue;
  3234. }
  3235. for (var i = 0; i < result.length; ++i) {
  3236. var iData = result[i];
  3237. if (s == (iData.ind1)[0]) {
  3238. var value = + (iData.value);
  3239. iData.valueAsPercentOfCategory = value / sum * 100;
  3240. }
  3241. }
  3242. }
  3243. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(colors), __len_enFor1 = __exp_enFor1.length;
  3244. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3245. var o = __exp_enFor1[__i_enFor1];
  3246. var s = ""+(o);
  3247. var sum = 0;
  3248. for (var i = 0; i < result.length; ++i) {
  3249. var iData = result[i];
  3250. if (s == iData.color) {
  3251. var value = + (iData.value);
  3252. sum += Math.abs(value);
  3253. }
  3254. }
  3255. if (sum == 0) {
  3256. continue;
  3257. }
  3258. for (var i = 0; i < result.length; ++i) {
  3259. var iData = result[i];
  3260. if (s == iData.color) {
  3261. var value = + (iData.value);
  3262. iData.valueAsPercentOfColor = value / sum * 100;
  3263. }
  3264. }
  3265. }
  3266. return result;
  3267. };
  3268. /**
  3269. * Create intervals for an stacked bar chart. The data is formed into stacks by the unique values of the independent data. The independent interval is the independent value (for both ends), and the dependent interval is from the stacking with the extent equal to the dependent value. The callout independent is the independent value, and the callout dependent is the dependent value (the bar extent). If percent is true, the bars are rescaled so the total height of each stack is 1.0. If xScale is non-null and returns null for an x value, that bar is skipped.
  3270. * @param (Array) data Data array
  3271. * @param (rave['internal']['SingleValueFunction']) x Independent accessor, should not be null
  3272. * @param (rave['internal']['SingleValueFunction']) xScale Possibly-null function to check if X values are in domain
  3273. * @param (rave['internal']['SingleValueFunction']) y Dependent accessor, should not be null
  3274. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3275. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3276. * @param (boolean) percent If true, create percent bars
  3277. * @return (Array) Array of intervals for the data
  3278. */
  3279. /** @expose */
  3280. com_ibm_rave_bundles_components_IntervalDataUtilities.stackedBars = function(data, x, xScale, y, color, label, percent) {
  3281. var result = [];
  3282. if (!data || data.length == 0 || !x || !y) {
  3283. return result;
  3284. }
  3285. var stacks = {};
  3286. var categories = {};
  3287. var colors = {};
  3288. data.forEach(function(d, ix, list) {
  3289. var xv = x(d);
  3290. if (xv != null && (!xScale || xScale(xv) != null)) {
  3291. var yv = y(d);
  3292. if (yv != null) {
  3293. var stack = stacks[xv];
  3294. if (!stack) {
  3295. stack = new com_ibm_rave_bundles_components_IntervalDataUtilities.Stack();
  3296. stacks[xv] = stack;
  3297. }
  3298. var dVal = + (yv);
  3299. if (!percent) {
  3300. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3301. r.key = ix;
  3302. r.ind1 = xv;
  3303. r.ind2 = xv;
  3304. r.cind = xv;
  3305. var sum = dVal < 0.0 ? stack.negativeSum : stack.positiveSum;
  3306. r.dep1 = sum;
  3307. r.dep2 = sum + dVal;
  3308. r.cdep = r.dep2;
  3309. r.color = color ? color(d) : null;
  3310. r.label = label ? label(d) : null;
  3311. r.value = dVal;
  3312. r._originalData = d;
  3313. result.push(r);
  3314. }
  3315. if (dVal < 0.0) {
  3316. stack.negativeSum += dVal;
  3317. } else {
  3318. stack.positiveCount++;
  3319. stack.positiveSum += dVal;
  3320. }
  3321. if (!(categories.hasOwnProperty(xv))) {
  3322. categories[""+(xv)] = 1;
  3323. }
  3324. if (color) {
  3325. var o = color(d);
  3326. if ((o != null) && !(colors.hasOwnProperty(o))) {
  3327. colors[""+(o)] = 1;
  3328. }
  3329. }
  3330. }
  3331. }
  3332. return null;
  3333. });
  3334. if (percent) {
  3335. data.forEach(function(d, ix, list) {
  3336. var xv = x(d);
  3337. if (xv != null && (!xScale || xScale(xv) != null)) {
  3338. var yv = y(d);
  3339. if (yv != null) {
  3340. var stack = stacks[xv];
  3341. var dVal = + (yv);
  3342. var percent;
  3343. if (dVal < 0.0) {
  3344. percent = -100.0 * dVal / stack.negativeSum;
  3345. } else if (stack.positiveSum > 0) {
  3346. percent = 100.0 * dVal / stack.positiveSum;
  3347. } else {
  3348. percent = 100.0 / stack.positiveCount;
  3349. }
  3350. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3351. r.key = ix;
  3352. r.ind1 = xv;
  3353. r.ind2 = xv;
  3354. r.cind = xv;
  3355. var sum = dVal < 0.0 ? stack.negativePercent : stack.positivePercent;
  3356. r.dep1 = sum;
  3357. r.dep2 = sum + percent;
  3358. r.cdep = r.dep2;
  3359. r.color = color ? color(d) : null;
  3360. r.label = label ? label(d) : null;
  3361. r.value = dVal;
  3362. r.valueAsPercentOfCategory = percent;
  3363. r._originalData = d;
  3364. result.push(r);
  3365. if (dVal < 0.0) {
  3366. stack.negativePercent += percent;
  3367. } else {
  3368. stack.positivePercent += percent;
  3369. }
  3370. }
  3371. }
  3372. return null;
  3373. });
  3374. } else {
  3375. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(categories), __len_enFor0 = __exp_enFor0.length;
  3376. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3377. var o = __exp_enFor0[__i_enFor0];
  3378. var s = ""+(o);
  3379. var sum = 0;
  3380. for (var i = 0; i < result.length; ++i) {
  3381. var iData = result[i];
  3382. if (s == iData.ind1) {
  3383. var value = + (iData.value);
  3384. sum += Math.abs(value);
  3385. }
  3386. }
  3387. if (sum == 0) {
  3388. continue;
  3389. }
  3390. for (var i = 0; i < result.length; ++i) {
  3391. var iData = result[i];
  3392. if (s == iData.ind1) {
  3393. var value = + (iData.value);
  3394. iData.valueAsPercentOfCategory = value / sum * 100;
  3395. }
  3396. }
  3397. }
  3398. }
  3399. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(colors), __len_enFor1 = __exp_enFor1.length;
  3400. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3401. var o = __exp_enFor1[__i_enFor1];
  3402. var s = ""+(o);
  3403. var sum = 0;
  3404. for (var i = 0; i < result.length; ++i) {
  3405. var iData = result[i];
  3406. if (s == iData.color) {
  3407. var value = + (iData.value);
  3408. sum += Math.abs(value);
  3409. }
  3410. }
  3411. if (sum == 0) {
  3412. continue;
  3413. }
  3414. for (var i = 0; i < result.length; ++i) {
  3415. var iData = result[i];
  3416. if (s == iData.color) {
  3417. var value = + (iData.value);
  3418. iData.valueAsPercentOfColor = value / sum * 100;
  3419. }
  3420. }
  3421. }
  3422. return result;
  3423. };
  3424. /**
  3425. * Structure class holding interval information.
  3426. */
  3427. com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData = rave['internal']['Declare']({
  3428. /**
  3429. * Key value; for now this is the data index
  3430. */
  3431. /** @expose */
  3432. key : null,
  3433. /**
  3434. * First independent value
  3435. */
  3436. /** @expose */
  3437. ind1 : null,
  3438. /**
  3439. * Second independent value (in all current uses, same as ind1)
  3440. */
  3441. /** @expose */
  3442. ind2 : null,
  3443. /**
  3444. * First dependent value
  3445. */
  3446. /** @expose */
  3447. dep1 : null,
  3448. /**
  3449. * Second dependent value
  3450. */
  3451. /** @expose */
  3452. dep2 : null,
  3453. /**
  3454. * The data value that the interval represents. Not the pixel value. Used in stacked chart
  3455. */
  3456. /** @expose */
  3457. value : null,
  3458. /**
  3459. * Color value
  3460. */
  3461. /** @expose */
  3462. color : null,
  3463. /**
  3464. * Label value
  3465. */
  3466. /** @expose */
  3467. label : null,
  3468. /**
  3469. * Callout independent value (in all current uses, same as ind1)
  3470. */
  3471. /** @expose */
  3472. cind : null,
  3473. /**
  3474. * Callout dependent value (dependent extent)
  3475. */
  3476. /** @expose */
  3477. cdep : null,
  3478. /** @expose */
  3479. _originalData : null,
  3480. /**
  3481. * The data value (in percentage) for specific category
  3482. */
  3483. /** @expose */
  3484. valueAsPercentOfCategory : NaN,
  3485. /**
  3486. * The data value (in percentage) across all categories
  3487. */
  3488. /** @expose */
  3489. valueAsPercentOfColor : NaN,
  3490. /** @expose */
  3491. originalData : function() {
  3492. return this._originalData;
  3493. },
  3494. /** @expose */
  3495. originalDataList : function() {
  3496. var list = [];
  3497. list.push(this._originalData);
  3498. return list;
  3499. }
  3500. });
  3501. com_ibm_rave_bundles_components_IntervalDataUtilities.Stack = function() {
  3502. this.positiveCount = 0;
  3503. this.positiveSum = 0;
  3504. this.negativeSum = 0;
  3505. this.positivePercent = 0;
  3506. this.negativePercent = 0;
  3507. };
  3508. /**
  3509. * Accessor for the callout dependent value
  3510. */
  3511. /** @expose */
  3512. com_ibm_rave_bundles_components_IntervalDataUtilities.CALLOUT_DEPENDENT_ACCESSOR = function(data) {
  3513. return (data).cdep;
  3514. };
  3515. /**
  3516. * Accessor for the callout independent value
  3517. */
  3518. /** @expose */
  3519. com_ibm_rave_bundles_components_IntervalDataUtilities.CALLOUT_INDEPENDENT_ACCESSOR = function(data) {
  3520. return (data).cind;
  3521. };
  3522. /**
  3523. * Accessor for the data value
  3524. */
  3525. /** @expose */
  3526. com_ibm_rave_bundles_components_IntervalDataUtilities.VALUE_ACCESSOR = function(data) {
  3527. return (data).value;
  3528. };
  3529. /**
  3530. * Accessor for data value as percent of category
  3531. */
  3532. /** @expose */
  3533. com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR = function(data) {
  3534. var percent = (data).valueAsPercentOfCategory;
  3535. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3536. };
  3537. /**
  3538. * Accessor for data value as percent of color (series)
  3539. */
  3540. /** @expose */
  3541. com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_COLOR_ACCESSOR = function(data) {
  3542. var percent = (data).valueAsPercentOfColor;
  3543. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3544. };
  3545. // $source: com/ibm/rave/bundles/data/PointDataUtilities
  3546. /************************************************************************
  3547. ** IBM Confidential
  3548. **
  3549. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3550. **
  3551. ** (C) Copyright IBM Corp. 2017
  3552. **
  3553. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3554. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3555. ************************************************************************/
  3556. // GENERATED
  3557. /**
  3558. * Utility class for building arrays of point datum objects from tabular data.
  3559. */
  3560. var com_ibm_rave_bundles_data_PointDataUtilities = rave['internal']['Declare']({
  3561. });
  3562. /**
  3563. * <p> Filter the input data list-array and return a list-array of PointData objects in the same order. If the data is null, an empty list is returned. Any null object in the data is skipped. </p> <p> If an accessor is null, the X or Y value in the returned PointData objects is always null. If the accessor is non-null, points for which the accessor returns null are not included in the result; if the scale is also non-null, points for which the scale applied to the value returns null are not included in the result. </p> <p> The returned PointDatum objects have the X accessor and Y accessor values (so may be null), and the original datum set to the object from the data. </p>
  3564. * @param (Array) data Input data, list of arbitrary objects
  3565. * @param (rave['internal']['SingleValueFunction']) xAccessor X accessor function, may be null
  3566. * @param (rave['internal']['SingleValueFunction']) xScale Scale to test if the X value should be included, may be null
  3567. * @param (rave['internal']['SingleValueFunction']) yAccessor Y accessor function, may be null
  3568. * @param (rave['internal']['SingleValueFunction']) yScale Scale to test if the Y value should be included, may be null
  3569. * @return (Array) List of PointData objects
  3570. */
  3571. /** @expose */
  3572. com_ibm_rave_bundles_data_PointDataUtilities.buildPoints = function(data, xAccessor, xScale, yAccessor, yScale) {
  3573. var result = [];
  3574. if (data) {
  3575. for (var __i_enFor0 = 0, __exp_enFor0 = data, __len_enFor0 = __exp_enFor0.length;
  3576. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3577. var o = __exp_enFor0[__i_enFor0];
  3578. if (o != null) {
  3579. var xv = null;
  3580. if (xAccessor) {
  3581. xv = xAccessor(o);
  3582. if (xv == null || (xScale && xScale(xv) == null)) {
  3583. continue;
  3584. }
  3585. }
  3586. var yv = null;
  3587. if (yAccessor) {
  3588. yv = yAccessor(o);
  3589. if (yv == null || (yScale && yScale(yv) == null)) {
  3590. continue;
  3591. }
  3592. }
  3593. var datum = new com_ibm_rave_bundles_data_PointDataUtilities.PointDatum();
  3594. datum._x = xv;
  3595. datum._y = yv;
  3596. datum._originalData = o;
  3597. result.push(datum);
  3598. }
  3599. }
  3600. }
  3601. return result;
  3602. };
  3603. /**
  3604. * Datum object representing a point with X and Y values. Either X or Y may be null, depending on how the point is used, for example in a scatterplot.
  3605. */
  3606. com_ibm_rave_bundles_data_PointDataUtilities.PointDatum = rave['internal']['Declare']({
  3607. /**
  3608. * The X value
  3609. */
  3610. /** @expose */
  3611. _x : null,
  3612. /**
  3613. * The Y value
  3614. */
  3615. /** @expose */
  3616. _y : null,
  3617. /**
  3618. * The data value (in percentage) that the point represents
  3619. */
  3620. /** @expose */
  3621. _yAsPercentOfCategory : null,
  3622. /**
  3623. * The data value (in percentage) that the point represents
  3624. */
  3625. /** @expose */
  3626. _yAsPercentOfColor : null,
  3627. /**
  3628. * The original data
  3629. */
  3630. /** @expose */
  3631. _originalData : null,
  3632. /** @expose */
  3633. originalData : function() {
  3634. return this._originalData;
  3635. },
  3636. /** @expose */
  3637. originalDataList : function() {
  3638. var list = [];
  3639. list.push(this._originalData);
  3640. return list;
  3641. }
  3642. });
  3643. /**
  3644. * Accessor returning the _x property of a PointDatum.
  3645. */
  3646. /** @expose */
  3647. com_ibm_rave_bundles_data_PointDataUtilities.X_ACCESSOR = function(d) {
  3648. return (d)._x;
  3649. };
  3650. /**
  3651. * Accessor returning the _y property of a PointDatum.
  3652. */
  3653. /** @expose */
  3654. com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR = function(d) {
  3655. return (d)._y;
  3656. };
  3657. /**
  3658. * Accessor returning the _yAsPercentOfCategory property of a PointDatum.
  3659. */
  3660. /** @expose */
  3661. com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR = function(d) {
  3662. var percent = + ((d)._yAsPercentOfCategory);
  3663. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3664. };
  3665. /**
  3666. * Accessor returning the _yAsPercentOfColor property of a PointDatum.
  3667. */
  3668. /** @expose */
  3669. com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_COLOR_ACCESSOR = function(d) {
  3670. var percent = + ((d)._yAsPercentOfColor);
  3671. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3672. };
  3673. // $source: com/ibm/rave/bundles/utilities/ColorUtil
  3674. /************************************************************************
  3675. ** IBM Confidential
  3676. **
  3677. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3678. **
  3679. ** (C) Copyright IBM Corp. 2017
  3680. **
  3681. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3682. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3683. ************************************************************************/
  3684. // GENERATED
  3685. var com_ibm_rave_bundles_utilities_ColorUtil = rave['internal']['Declare']({
  3686. });
  3687. /**
  3688. * It is used to get a foreground color which has atleast a 4.5 contrast ratio with the background color.
  3689. * @param (Object) bg bakground color
  3690. * @param (Object) fg foreground color
  3691. * @return (Object) a color ( darker/ligher/same fg color ) which contrast with background.
  3692. */
  3693. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$0 = function(bg, fg) {
  3694. var contrastRatio = com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio(bg, fg);
  3695. if (contrastRatio < 4.5) {
  3696. var bgHSL = rave.hsl(bg);
  3697. var fgHSL = rave.hsl(fg);
  3698. var brightness = 0.33 * (rave.rgb(bg).getR() / 255.0) + 0.5 * (rave.rgb(bg).getG() / 255.0) + 0.16 * (rave.rgb(bg).getB() / 255.0);
  3699. if (brightness > 0.5) {
  3700. if (bgHSL.getL() > 0.5) {
  3701. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.min(fgHSL.getL(), bgHSL.getL() - 0.4));
  3702. } else {
  3703. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.min(fgHSL.getL(), 0.1));
  3704. }
  3705. } else {
  3706. if (bgHSL.getL() < 0.5) {
  3707. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.max(fgHSL.getL(), bgHSL.getL() + 0.4));
  3708. } else {
  3709. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.max(fgHSL.getL(), 0.9));
  3710. }
  3711. }
  3712. }
  3713. return fg;
  3714. };
  3715. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$1 = function(labelColor) {
  3716. var labelRGB = rave.rgb(labelColor);
  3717. return labelRGB.contrastShift(21);
  3718. };
  3719. /** @expose */
  3720. com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio = function(colorA, colorB) {
  3721. var foregroundLuminance = rave.rgb(colorA).getLuminance();
  3722. var backgroundLuminance = rave.rgb(colorB).getLuminance();
  3723. var contrastRatio = (foregroundLuminance >= backgroundLuminance) ? (foregroundLuminance + 0.05) / (backgroundLuminance + 0.05) : (backgroundLuminance + 0.05) / (foregroundLuminance + 0.05);
  3724. return contrastRatio;
  3725. };
  3726. /** @expose */
  3727. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor = function(a0, a1) {
  3728. var args = arguments;
  3729. if (args.length == 1) {
  3730. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$1(a0);
  3731. }
  3732. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$0(a0, a1);
  3733. };
  3734. // $source: com/ibm/rave/bundles/internal/nativeImpl/BundleModule
  3735. /************************************************************************
  3736. ** IBM Confidential
  3737. **
  3738. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3739. **
  3740. ** (C) Copyright IBM Corp. 2015
  3741. **
  3742. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3743. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3744. ************************************************************************/
  3745. // Must be the first import
  3746. // @import ./BundleModuleHeader
  3747. // expose DataFormatter to the global variable rave
  3748. //rave["library"]["CustomFormatter"]=com_ibm_rave_library_framework_CustomFormatter;
  3749. // $source: com/ibm/rave/bundles/mapBundle/MapBundle
  3750. /************************************************************************
  3751. ** IBM Confidential
  3752. **
  3753. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3754. **
  3755. ** (C) Copyright IBM Corp. 2017
  3756. **
  3757. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3758. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3759. ************************************************************************/
  3760. // GENERATED
  3761. //@import com/ibm/rave/library/Library (static) // Library
  3762. //@import com/ibm/rave/bundles/RaveBundle (loadtime) // superclass
  3763. //@import com/ibm/rave/bundles/mapBundle/MapView (runtime) // new
  3764. var com_ibm_rave_bundles_mapBundle_MapBundle = rave['internal']['Declare'](com_ibm_rave_bundles_RaveBundle, {
  3765. /** @expose */
  3766. getName : function() {
  3767. return "mapBundle";
  3768. },
  3769. /** @expose */
  3770. createView : function(ctx) {
  3771. return new com_ibm_rave_bundles_mapBundle_MapView(ctx);
  3772. }
  3773. //constructor : function() {}
  3774. });
  3775. /**
  3776. * Register the bundle factory with the library. The bundle will not be made available if this method is not called.
  3777. */
  3778. /** @expose */
  3779. com_ibm_rave_bundles_mapBundle_MapBundle.init = function() {
  3780. if (!(com_ibm_rave_library_Library.bundle.isRegistered("mapBundle"))) {
  3781. var bundle;
  3782. com_ibm_rave_library_Library.bundle.extension("mapBundle", function() {
  3783. if (!bundle) {
  3784. bundle = new com_ibm_rave_bundles_mapBundle_MapBundle();
  3785. bundle.loadResources();
  3786. require("./vizlibrary-map.css");
  3787. }
  3788. return bundle;
  3789. });
  3790. }
  3791. return "mapBundle";
  3792. };
  3793. com_ibm_rave_bundles_mapBundle_MapBundle.BUNDLE_NAME = "mapBundle";
  3794. // Auto initialization
  3795. com_ibm_rave_bundles_mapBundle_MapBundle.init();
  3796. if (!com_ibm_rave_library_Library.bundle["mapBundle"]) {
  3797. com_ibm_rave_library_Library.bundle["mapBundle"] = function() {
  3798. if (!bundle) {
  3799. bundle = new com_ibm_rave_bundles_mapBundle_MapBundle();
  3800. bundle.loadResources();
  3801. require("./vizlibrary-map.css");
  3802. }
  3803. return bundle;
  3804. };
  3805. } else {
  3806. console.log("Could not register extension: MapBundle");
  3807. }
  3808. // $source: com/ibm/rave/bundles/mapBundle/MapView
  3809. /************************************************************************
  3810. ** IBM Confidential
  3811. **
  3812. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3813. **
  3814. ** (C) Copyright IBM Corp. 2017
  3815. **
  3816. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3817. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3818. ************************************************************************/
  3819. // GENERATED
  3820. //@import com/ibm/rave/bundles/views/BundleView (loadtime) // superclass
  3821. //@import com/ibm/rave/bundles/components/MapComponentImpl (runtime) // new
  3822. /**
  3823. * <p> A map chart view. For this example, additional files are required to be loaded in addition to the usual data schema, data file, properties, etc. We must also load at least one GeoJSON file, and a palette file as well. </p> <p> The input data properties are the feature name (which could be used to find features in the GeoJSON, if the features there have some kind of id), Standard Color (a numeric referencing a standard palette), Continuous Color (a numeric referencing a continuous palette), and the label that appears on the feature if the features are to be labelled. </p> <p> Properties required for maps are: GeoJSON: A string for one or more GeoJSON URL's required for this map. scale: A default scale for the map missingFeatureColor: The default color assigned to a feature we do not have a color for. borderColor: Color of the borders between features borderThickness: The border thickness. showLabels: If true, display labels. featureLabelFont: The font of the feature labels. featureLabelColor: The color for the feature labels. featureLabelSize: The size for the feature labels. mapProjection: Map Projection Type-- default is mercator; legendDisplay: boolean, to show or hide the legend. legendPosition: The legend position in the chart. </p>
  3824. */
  3825. var com_ibm_rave_bundles_mapBundle_MapView = rave['internal']['Declare'](com_ibm_rave_bundles_views_BundleView, {
  3826. /**
  3827. * Background component, created in setup
  3828. */
  3829. //_mapComponent : null,
  3830. //_drag : null,
  3831. //_zoom : null,
  3832. //chartRect : null,
  3833. //currentZoomScale : null,
  3834. scale : 0,
  3835. transitionDur : 0,
  3836. constructor : function() {
  3837. this.currentZoomScale = [1.0];
  3838. },
  3839. /** @expose */
  3840. setup : function() {
  3841. com_ibm_rave_bundles_views_BundleView.prototype.setup.call(this);
  3842. this._mapComponent = new com_ibm_rave_bundles_components_MapComponentImpl();
  3843. this.setupHighlighting();
  3844. this.setupPanZoom();
  3845. },
  3846. /** @expose */
  3847. getLegendCount : function() {
  3848. return 3;
  3849. },
  3850. /** @expose */
  3851. isZoomSupported : function() {
  3852. return false;
  3853. },
  3854. /**
  3855. * Sets up the initial translation for centering, the scale, and the GeoJSON URL. We then attempt to load the GeoJSON. Note that translation and scale will be used in the future for pan and zoom, so they are only initialized when this is called, not in renderMap when the map is redrawn.
  3856. */
  3857. /** @expose */
  3858. draw : function() {
  3859. if (this.isUpdateNothing()) {
  3860. return;
  3861. }
  3862. this.preDraw("g.vizlibrary-map");
  3863. if (!(this.validateDataModel())) {
  3864. return;
  3865. }
  3866. this.setBorder("border.width", "border.color");
  3867. if (this.updateType == 0) {
  3868. this.context.actions.action("deselectAll")(this.context.node.selectAll(".chart .element-shape-path"));
  3869. }
  3870. this.context.node.selectAll(".mapzoom").attr("transform", null);
  3871. if (this.context.getPropertyValue("scale") != null && !(this.getStringProperty("scale").length === 0)) {
  3872. this.scale = + (this.context.getPropertyValue("scale"));
  3873. this._mapComponent.baseScale(this.scale);
  3874. } else {
  3875. this.scale = NaN;
  3876. }
  3877. this.renderRegionsAndBubbles();
  3878. this.resetUpdate();
  3879. },
  3880. renderRegionsAndBubbles : function() {
  3881. var geoJsonObject = this.context.getPropertyValue("geoJSONObject");
  3882. if (!geoJsonObject) {
  3883. }
  3884. var ds = this.dataModel.dataset("data");
  3885. if (ds.data() == null) {
  3886. ds.data([]);
  3887. }
  3888. var bubbleMinSize = Math.abs(this.getCSSSizeToPixelNumber("minBubbleSize"));
  3889. var bubbleMaxSize = Math.abs(this.getCSSSizeToPixelNumber("maxBubbleSize"));
  3890. var defaultBubbleSize = Math.abs(this.getCSSSizeToPixelNumber("bubbleSize"));
  3891. var useMapColorLegend = this.getBooleanProperty("legend.map.display");
  3892. var useBubbleColorLegend = this.getBooleanProperty("legend.bubble.display");
  3893. var useBubbleSizeLegend = this.getBooleanProperty("legend.size.display");
  3894. var bubbleSizeAccessor = ds.slot("bubbleSize").entry();
  3895. if (bubbleSizeAccessor) {
  3896. var domain = rave['library']['internal']['ScaleManager'].numericDomain(ds.data(), bubbleSizeAccessor);
  3897. if (!domain) {
  3898. useBubbleSizeLegend = false;
  3899. domain = [0.0, 1.0];
  3900. }
  3901. com_ibm_rave_bundles_mapBundle_MapView.bubbleScale = rave.scale.linear().domain(domain).range([bubbleMinSize, bubbleMaxSize]);
  3902. } else {
  3903. useBubbleSizeLegend = false;
  3904. com_ibm_rave_bundles_mapBundle_MapView.bubbleScale = null;
  3905. }
  3906. var bubblePalette;
  3907. var bubbleColorAccessor = ds.slot("bubbleColor").entry();
  3908. if (bubbleColorAccessor) {
  3909. bubblePalette = this.getDynamicPalette("color.pointPalette", "color.pointDynamicPalette.min", "color.pointDynamicPalette.mid", "color.pointDynamicPalette.max");
  3910. bubblePalette.setData(ds, "bubbleColor");
  3911. bubblePalette.setAccessor(bubbleColorAccessor);
  3912. bubblePalette.setNullColor(this.getStringProperty("color.null"));
  3913. } else {
  3914. useBubbleColorLegend = false;
  3915. }
  3916. var regionPalette;
  3917. var regionColorAccessor = ds.slot("featureColor").entry();
  3918. if (regionColorAccessor) {
  3919. regionPalette = this.getDynamicPalette("color.featurePalette", "color.featureDynamicPalette.min", "color.featureDynamicPalette.mid", "color.featureDynamicPalette.max");
  3920. regionPalette.setData(ds, "featureColor");
  3921. regionPalette.setAccessor(regionColorAccessor);
  3922. regionPalette.setNullColor(this.getStringProperty("color.null"));
  3923. } else {
  3924. useMapColorLegend = false;
  3925. }
  3926. var duration = (~~ (this.context.getPropertyValue("legendAnimationDuration")));
  3927. var legendPosition = this.getLegendPosition();
  3928. this._legends.visible(useMapColorLegend || useBubbleColorLegend || useBubbleSizeLegend).position(legendPosition).transition(!("none" == this.context.getPropertyValue("legendAnimation")), duration).setPreExecute(this.context.getPreExecute()).visible(0, useMapColorLegend).selector(0, this.context.node.selectAll("g.legend.feature")).palette(0, regionPalette).shape(0, "circle").title(0, this.context.getDataSlotLabel("legend.map.title", regionColorAccessor)).titleFill(0, (this.context.getPropertyValue("legend.map.titlestyle.fill"))).titleFontSize(0, (this.context.getPropertyValue("legend.map.titlestyle.fontsize"))).titleFontFamily(0, (this.context.getPropertyValue("legend.map.titlestyle.fontfamily"))).setDataSlot(0, regionColorAccessor).visible(1, useBubbleColorLegend).selector(1, this.context.node.selectAll("g.legend.point")).palette(1, bubblePalette).shape(1, "circle").title(1, this.context.getDataSlotLabel("legend.bubble.title", bubbleColorAccessor)).titleFill(1, (this.context.getPropertyValue("legend.bubble.titlestyle.fill"))).titleFontSize(1, (this.context.getPropertyValue("legend.bubble.titlestyle.fontsize"))).titleFontFamily(1, (this.context.getPropertyValue("legend.bubble.titlestyle.fontfamily"))).setDataSlot(1, bubbleColorAccessor).visible(2, useBubbleSizeLegend).selector(2, this.context.node.selectAll("g.legend.size")).scale(2, com_ibm_rave_bundles_mapBundle_MapView.bubbleScale).swatchSize(2, ((!com_ibm_rave_bundles_mapBundle_MapView.bubbleScale) ? null : com_ibm_rave_bundles_mapBundle_MapView.SWATCH_SIZE_FUNC)).shape(2, "circle").title(2, this.context.getDataSlotLabel("legend.size.title", bubbleSizeAccessor)).titleFill(2, (this.context.getPropertyValue("legend.size.titlestyle.fill"))).titleFontSize(2, (this.context.getPropertyValue("legend.size.titlestyle.fontsize"))).titleFontFamily(2, (this.context.getPropertyValue("legend.size.titlestyle.fontfamily"))).setDataSlot(2, bubbleSizeAccessor);
  3929. if (this.updateType <= 1) {
  3930. this.prepareLayoutComponent();
  3931. this.prepareLayoutSizables(this._layoutComponent, false, false, false, false, this._legends.anyVisible());
  3932. this._legends.preLayout(this._layoutComponent);
  3933. this._layoutComponent.layout();
  3934. legendPosition = this._layoutComponent.legendPosition();
  3935. this.chartRect = this._layoutComponent.elementRect();
  3936. var legendRect = this._layoutComponent.legendRect();
  3937. this._legends.position(legendPosition).rectangle(legendRect);
  3938. this._clip.clipRect(this.chartRect).applyTo(this.context.node.select(".content")).call(this.context.node.select("defs").transition().duration(duration));
  3939. this._legends.rectangle(legendRect);
  3940. }
  3941. this._mapComponent.geoJSONObject(geoJsonObject).borderWidth(this.context.convertCSSSizeToPixels(this.context.getPropertyValue("border.width"))).borderColor((this.context.getPropertyValue("border.color"))).bubbleBorderWidth(this.context.convertCSSSizeToPixels(this.context.getPropertyValue("bubbleBorder.width"))).bubbleBorderColor((this.context.getPropertyValue("bubbleBorder.color"))).geoJSONfeatureIdLookup(this.getStringProperty("idLookup")).regionsAndBubblesData((ds.data())).featureId(ds.slot("featureId").entry()).bubbleColor(bubbleColorAccessor).bubbleSize(bubbleSizeAccessor).featureLbl(ds.slot("featureLabel").entry()).labelFormatter(this.context.getCustomFormatterForElementLabels(ds.slot("featureLabel").entry())).bubblePalette(bubblePalette).regionPalette(regionPalette).nullColor(this.getStringProperty("color.null")).bubbleScale(com_ibm_rave_bundles_mapBundle_MapView.bubbleScale).defaultBubbleSize(defaultBubbleSize).bounds(this.chartRect).setZoomExtent(+ (this.context.getPropertyValue("minZoom")) / 100, + (this.context.getPropertyValue("maxZoom")) / 100).featureLabel(this.getBooleanProperty("showLabels")).dropLabels(this.getBooleanProperty("dropLabels")).projectionType(this.getStringProperty("mapProjection")).rotation(this.getDoubleProperty("mapRotationLongitude"), this.getDoubleProperty("mapRotationLatitude")).regionAnimationDuration(+ (this.context.getPropertyValue("regionAnimationDuration"))).regionAnimation(!("none" == this.context.getPropertyValue("regionAnimation"))).bubbleAnimationDuration(+ (this.context.getPropertyValue("bubbleAnimationDuration"))).bubbleAnimation(!("none" == this.context.getPropertyValue("bubbleAnimation"))).flashDuration(+ (this.context.getPropertyValue("flashDuration"))).flash(this.getBooleanProperty("flash"));
  3942. this.setBackgroundProperties(this.chartRect, duration);
  3943. this._legends.draw();
  3944. this.context.node.selectAll("g.element-group").transition().duration(this.transitionDur).call(this._mapComponent);
  3945. this.bindPanZoom();
  3946. },
  3947. /** @expose */
  3948. requireUpdate : function(property) {
  3949. if ((property == "pointLabelFont" || property == "pointLabelColor" || property == "pointLabelSize") && !(this.getBooleanProperty("showLabels"))) {
  3950. return 4;
  3951. }
  3952. if ((property == "featureLabelFont" || property == "featureLabelColor" || property == "featureLabelSize") && !(this.getBooleanProperty("showLabels"))) {
  3953. return 4;
  3954. }
  3955. if ((property == "graticuleColor" || property == "graticuleStrokeThickness") && !(this.getBooleanProperty("displayGraticule"))) {
  3956. return 4;
  3957. }
  3958. return rave['library']['internal']['AbstractView'].prototype.requireUpdate.call(this, property);
  3959. },
  3960. /**
  3961. * Setup the highlighting actions. This sets for default binding, then replaces the highlight action with one that includes a move-to-front.
  3962. */
  3963. setupHighlighting : function() {
  3964. var originalStyle = {};
  3965. originalStyle["stroke-width"] = null;
  3966. originalStyle["stroke"] = null;
  3967. rave['library']['internal']['BundleUtils'].setupDefaultActions(this.context, ".chart .element-shape-path", originalStyle);
  3968. var action = this.context.actions.action("highlight");
  3969. action.setOperation(new com_ibm_rave_bundles_mapBundle_MapView.MapHighlightOperation(action.getOperation()));
  3970. },
  3971. /**
  3972. * Sets up the _drag and _zoom behaviors for the map. This does not bind the behaviors to any nodes yet; see bindPanZoom.
  3973. */
  3974. setupPanZoom : function() {
  3975. var self = this;
  3976. this._drag = rave.behavior.drag().on("drag.mapview", function(args) {
  3977. if (args !== null || arguments.length > 1){
  3978. args = Array.prototype.slice.call(arguments, 0);
  3979. }
  3980. {
  3981. var d = rave.event;
  3982. self._mapComponent.panMap(d.dx, d.dy);
  3983. self.context.node.selectAll("g.element-group").call(self._mapComponent);
  3984. return null;
  3985. }
  3986. });
  3987. this._zoom = rave.behavior.zoom().on("zoom.mapview", function(args) {
  3988. if (args !== null || arguments.length > 1){
  3989. args = Array.prototype.slice.call(arguments, 0);
  3990. }
  3991. {
  3992. var d = rave.event;
  3993. if (self.currentZoomScale[0] != d.scale) {
  3994. if (d.sourceEvent) {
  3995. (d.sourceEvent).stopImmediatePropagation();
  3996. }
  3997. self.currentZoomScale[0] = d.scale;
  3998. self._mapComponent.zoomMap(d.scale);
  3999. self.context.node.selectAll("g.element-group").call(self._mapComponent);
  4000. }
  4001. return null;
  4002. }
  4003. });
  4004. },
  4005. /**
  4006. * Select the shapes in the scene and bind the _drag and _zoom behaviors to them. Also sets the initial zoom and the zoom range to the initial scale to up to 15 times the initial scale.
  4007. */
  4008. bindPanZoom : function() {
  4009. var minScale = this._mapComponent.scaleProjection();
  4010. this._zoom.scale(this._mapComponent.scaleProjection());
  4011. this._zoom.scaleExtent([minScale, minScale * 15]);
  4012. this.context.node.selectAll("rect.background").call(this._drag).call(this._zoom);
  4013. this.context.node.selectAll("g.mapzoom").call(this._drag).call(this._zoom);
  4014. },
  4015. /** @expose */
  4016. getGroupStructure : function() {
  4017. return ["defs", "g.vizlibrary vizlibrary-map", "(", "rect.background chart", "g.chart", "(", "g.content", "(", "rect.background elements", "g.gridlines", "(", "g.grid left", "g.grid bottom", ")", "g.mapzoom", "(", "g.elements", "(", "g.element-group", ")", ")", ")", ")", "g.legends", "(", "g.legends-layout", "g.legend feature", "g.legend point", "g.legend size", ")", ")"];
  4018. }
  4019. //constructor : function(context) {}
  4020. });
  4021. com_ibm_rave_bundles_mapBundle_MapView.MapHighlightOperation = rave['internal']['Declare'](rave['library']['internal']['ActionOperation'], {
  4022. //_defOp : null,
  4023. _$functionClassMethod : function() {
  4024. var _$self = function(args) {
  4025. if (args !== null || arguments.length > 1){
  4026. args = Array.prototype.slice.call(arguments);
  4027. }
  4028. {
  4029. _$self.adjustNodesZOrder(args[0]);
  4030. _$self._defOp.apply(_$self._defOp, args);
  4031. }
  4032. };
  4033. return _$self;
  4034. },
  4035. /** @expose */
  4036. constructor : function(defOp) {
  4037. this._defOp = defOp;
  4038. },
  4039. adjustNodesZOrder : function(selected) {
  4040. var node = selected.node();
  4041. var parentG = node.rave_getParentNode();
  4042. var grandParentG = parentG.rave_getParentNode();
  4043. var childList = grandParentG.rave_getChildNodes();
  4044. var children = [];
  4045. for (var i = 0; i < childList.length; ++i) {
  4046. children[i] = childList[i];
  4047. }
  4048. var regions = rave.select(grandParentG).selectAll("g.region");
  4049. var firstBubbleNode = regions.size() > 0 ? regions[0][0] : null;
  4050. var move = false;
  4051. for (var __i_enFor0 = 0, __len_enFor0 = children.length;
  4052. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4053. var child = children[__i_enFor0];
  4054. if (child == parentG) {
  4055. move = true;
  4056. } else if (child == firstBubbleNode) {
  4057. move = false;
  4058. } else if (move) {
  4059. grandParentG.removeChild(child);
  4060. grandParentG.rave_insertBefore(child, parentG);
  4061. }
  4062. }
  4063. }
  4064. });
  4065. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_MAPCOLOR_DISPLAY = "legend.map.display";
  4066. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_MAPCOLOR_TITLE = "legend.map.title";
  4067. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_MAPCOLOR_TITLESTYLE_FILL = "legend.map.titlestyle.fill";
  4068. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_MAPCOLOR_TITLESTYLE_FONTSIZE = "legend.map.titlestyle.fontsize";
  4069. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_MAPCOLOR_TITLESTYLE_FONTFAMILY = "legend.map.titlestyle.fontfamily";
  4070. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_BUBBLECOLOR_DISPLAY = "legend.bubble.display";
  4071. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_BUBBLECOLOR_TITLE = "legend.bubble.title";
  4072. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_BUBBLECOLOR_TITLESTYLE_FILL = "legend.bubble.titlestyle.fill";
  4073. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_BUBBLECOLOR_TITLESTYLE_FONTSIZE = "legend.bubble.titlestyle.fontsize";
  4074. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_BUBBLECOLOR_TITLESTYLE_FONTFAMILY = "legend.bubble.titlestyle.fontfamily";
  4075. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_BUBBLESIZE_DISPLAY = "legend.size.display";
  4076. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_BUBBLESIZE_TITLE = "legend.size.title";
  4077. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_BUBBLESIZE_TITLESTYLE_FILL = "legend.size.titlestyle.fill";
  4078. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_BUBBLESIZE_TITLESTYLE_FONTSIZE = "legend.size.titlestyle.fontsize";
  4079. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_BUBBLESIZE_TITLESTYLE_FONTFAMILY = "legend.size.titlestyle.fontfamily";
  4080. //com_ibm_rave_bundles_mapBundle_MapView.REGION_ANIMATION = "regionAnimation";
  4081. //com_ibm_rave_bundles_mapBundle_MapView.BUBBLE_ANIMATION = "bubbleAnimation";
  4082. //com_ibm_rave_bundles_mapBundle_MapView.LEGEND_ANIMATION = "legendAnimation";
  4083. //com_ibm_rave_bundles_mapBundle_MapView.bubbleScale = null;
  4084. com_ibm_rave_bundles_mapBundle_MapView.SWATCH_SIZE_FUNC = function(_data, index, groupIndex) {
  4085. return Math.PI * Math.pow(+ (com_ibm_rave_bundles_mapBundle_MapView.bubbleScale.call(null, _data, index, groupIndex)), 2);
  4086. };
  4087. // $source: com/ibm/rave/bundles/components/BackgroundComponentImpl
  4088. /************************************************************************
  4089. ** IBM Confidential
  4090. **
  4091. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4092. **
  4093. ** (C) Copyright IBM Corp. 2017
  4094. **
  4095. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4096. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4097. ************************************************************************/
  4098. // GENERATED
  4099. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  4100. //@import com/ibm/rave/bundles/component/BackgroundComponent (runtime) // BackgroundComponent
  4101. /**
  4102. * <p> Component to set the background color of a bundle. The component properties are: </p> <ul> <li> <b>backgroundColor</b>: The background color, null by default. </li> <li> <b>size</b>: The size of the bundle, from the context node, null by default. </li> </ul> <p> The component assumes that the selector on which it is executed is a "rect" shape which lies below the chart. If the size property is non-null, it sets the geometry of this rectangle to be the given size, with upper-left corner at 0,0. If the size is null, the rectangle is not resized. </p> <p> The rectangle fill is set to the backgroundColor property. If the property is null, white (#FFFFFF) is used. TODO. Should we set it to null, so the CSS style can also be used to set the background? </p>
  4103. */
  4104. var com_ibm_rave_bundles_components_BackgroundComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  4105. //_backgroundColor : null,
  4106. //_rect : null,
  4107. /** @expose */
  4108. constructor : function() {
  4109. this._rect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4110. },
  4111. /** @expose */
  4112. execute : function(g) {
  4113. this.preExecute();
  4114. g.style("fill", this._backgroundColor != null ? this._backgroundColor : "#FFFFFF").style("fill-opacity", 1.0);
  4115. g.attr("x", this._rect.x).attr("y", this._rect.y).attr("width", this._rect.width).attr("height", this._rect.height);
  4116. },
  4117. /** @expose */
  4118. type : function() {
  4119. return com_ibm_rave_bundles_component_BackgroundComponent.COMPONENT_TYPE;
  4120. },
  4121. backgroundColor$0 : function() {
  4122. return this._backgroundColor;
  4123. },
  4124. backgroundColor$1 : function(backgroundColor) {
  4125. this._backgroundColor = backgroundColor;
  4126. return this;
  4127. },
  4128. /**
  4129. * @param (rave['library']['internal']['ContextSize']) size New value of size property
  4130. * @return (com.ibm.rave.bundles.components.BackgroundComponentImpl) This component
  4131. */
  4132. /** @expose */
  4133. size : function(size) {
  4134. this._rect.x = 0;
  4135. this._rect.y = 0;
  4136. this._rect.width = size.w;
  4137. this._rect.height = size.h;
  4138. return this;
  4139. },
  4140. /** @expose */
  4141. rect : function(rect) {
  4142. var r = new rave['internal']['RectStruct'](rect.x, rect.y, rect.width, rect.height);
  4143. this._rect = r;
  4144. return this;
  4145. },
  4146. /** @expose */
  4147. backgroundColor : function(a0) {
  4148. var args = arguments;
  4149. if (args.length == 0) {
  4150. return this.backgroundColor$0();
  4151. }
  4152. return this.backgroundColor$1(a0);
  4153. }
  4154. });
  4155. // $source: com/ibm/rave/bundles/components/ChartLayoutComponentImpl
  4156. /************************************************************************
  4157. ** IBM Confidential
  4158. **
  4159. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4160. **
  4161. ** (C) Copyright IBM Corp. 2017
  4162. **
  4163. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4164. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4165. ************************************************************************/
  4166. // GENERATED
  4167. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  4168. //@import com/ibm/rave/bundles/component/ChartLayoutComponent (runtime) // ChartLayoutComponent
  4169. /**
  4170. * <p> Implementation of the chart layout component API. General sequence in a bundle view: </p> <ul> <li> Configure the layout component by setting component properties from bundle properties and/or using the utility methods. </li> <li> Run the layout either by calling {@link #this.layout()} , or using a selector to call the layout. The selector is irrelevant, and {@link #this.execute(rave['internal']['Selector'])} ignores its argument and simply calls {@link #this.layout()} . Running the layout makes the pre-execute callback, allowing the integrator to change layout properties. </li> <li> On return, use the rectangles to position other components. Note that the integrator can change the properties, so the view should update its values; in particular the legendPosition could be changed, so the legend component should use the position after running the layout. </li> </ul>
  4171. */
  4172. var com_ibm_rave_bundles_components_ChartLayoutComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  4173. //_padding : null,
  4174. //_legendChartGap : null,
  4175. //_topChartPadding : null,
  4176. //_leftChartPadding : null,
  4177. //_bottomChartPadding : null,
  4178. //_rightChartPadding : null,
  4179. //_legendPosition : null,
  4180. //_legendSizable : null,
  4181. //_axisSizables : null,
  4182. //_overallRect : null,
  4183. //_legendRect : null,
  4184. //_chartRect : null,
  4185. //_topRect : null,
  4186. //_leftRect : null,
  4187. //_bottomRect : null,
  4188. //_rightRect : null,
  4189. //_elementRect : null,
  4190. _leftPadding : 0, _topPadding : 0, _rightPadding : 0, _bottomPadding : 0,
  4191. _legendChartAlign : false,
  4192. _preLegendAtMax : false,
  4193. _preAxesAtZero : false,
  4194. constructor : function() {
  4195. this._axisSizables = [];
  4196. /**
  4197. * Construct. All padding is 0, legendPosition is "right", all slices have a size of 0 (value of null).
  4198. */
  4199. {
  4200. this._padding = 0.0;
  4201. this._topPadding = 0;
  4202. this._leftPadding = 0;
  4203. this._bottomPadding = 0;
  4204. this._rightPadding = 0;
  4205. this._topChartPadding = 0.0;
  4206. this._leftChartPadding = 0.0;
  4207. this._bottomChartPadding = 0.0;
  4208. this._rightChartPadding = 0.0;
  4209. this._legendChartGap = 0.0;
  4210. this._legendPosition = "right";
  4211. this._overallRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4212. this._legendRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4213. this._chartRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4214. this._topRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4215. this._leftRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4216. this._bottomRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4217. this._rightRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4218. this._elementRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4219. this._legendChartAlign = true;
  4220. }
  4221. },
  4222. /** @expose */
  4223. execute : function(g) {
  4224. this.layout();
  4225. },
  4226. /**
  4227. * Calculates rectangles during preliminary layout
  4228. * @param (boolean) legendAtMax true if legend is given max size; false if legend is asked for its preferred size
  4229. * @param (boolean) axesAtZero true if axes are given a size of 0; false if axes are asked for their preferred size
  4230. */
  4231. /** @expose */
  4232. preLayout : function(legendAtMax, axesAtZero) {
  4233. this._preLegendAtMax = legendAtMax;
  4234. this._preAxesAtZero = axesAtZero;
  4235. this.layout();
  4236. this._preLegendAtMax = false;
  4237. this._preAxesAtZero = false;
  4238. },
  4239. /**
  4240. * Calls preExecute, then does the layout with the property values, updating the chart, legend, axis, and elements rectangles.
  4241. */
  4242. /** @expose */
  4243. layout : function() {
  4244. this.preExecute();
  4245. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._chartRect, this._overallRect);
  4246. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._legendRect, this._overallRect);
  4247. var x = this._overallRect.x;
  4248. var y = this._overallRect.y;
  4249. var w = this._overallRect.width;
  4250. var h = this._overallRect.height;
  4251. var maxWH = Math.max(w, h);
  4252. var tbLegend = "top" == this._legendPosition || "bottom" == this._legendPosition;
  4253. var legendPercent = this._axisSizables.length == 0 ? 0.5 : 0.3;
  4254. var legendMaxSize = (tbLegend ? this._legendRect.height : this._legendRect.width) * legendPercent;
  4255. var legendDynamicSize = this._legendSizable ? (this._preLegendAtMax ? maxWH : this._legendSizable.getPreferredSize()) : 0;
  4256. if (legendDynamicSize > legendMaxSize) {
  4257. legendDynamicSize = legendMaxSize;
  4258. }
  4259. var isLegendTop = false;
  4260. var isLegendBottom = false;
  4261. var isLegendLeft = false;
  4262. var isLegendRight = false;
  4263. if ("top" == this._legendPosition) {
  4264. this._legendRect.height = legendDynamicSize;
  4265. this._chartRect.height -= this._legendRect.height;
  4266. this._chartRect.y += this._legendRect.height;
  4267. isLegendTop = true;
  4268. } else if ("bottom" == this._legendPosition) {
  4269. this._legendRect.height = legendDynamicSize;
  4270. this._chartRect.height -= this._legendRect.height;
  4271. this._legendRect.y = y + h - this._legendRect.height;
  4272. isLegendBottom = true;
  4273. } else if ("left" == this._legendPosition) {
  4274. this._legendRect.width = legendDynamicSize;
  4275. this._chartRect.width -= this._legendRect.width;
  4276. this._chartRect.x += this._legendRect.width;
  4277. isLegendLeft = true;
  4278. } else {
  4279. this._legendRect.width = legendDynamicSize;
  4280. this._chartRect.width -= this._legendRect.width;
  4281. this._legendRect.x = x + w - this._legendRect.width;
  4282. isLegendRight = true;
  4283. }
  4284. if (this.evaluatePadding(this._padding, w, h)) {
  4285. var lrgap = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._legendChartGap, w);
  4286. var tbgap = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._legendChartGap, h);
  4287. var chartTop = isLegendTop && this._legendSizable ? tbgap : this._topPadding;
  4288. var chartLeft = isLegendLeft && this._legendSizable ? lrgap : this._leftPadding;
  4289. var chartBottom = isLegendBottom && this._legendSizable ? tbgap : this._bottomPadding;
  4290. var chartRight = isLegendRight && this._legendSizable ? lrgap : this._rightPadding;
  4291. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset(this._chartRect, chartTop, chartLeft, chartBottom, chartRight);
  4292. } else {
  4293. var lrpadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._padding, w);
  4294. var tbpadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._padding, h);
  4295. var chartTop = tbpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._topChartPadding, h);
  4296. var chartLeft = lrpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._leftChartPadding, w);
  4297. var chartBottom = tbpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._bottomChartPadding, h);
  4298. var chartRight = lrpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._rightChartPadding, w);
  4299. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset(this._chartRect, chartTop, chartLeft, chartBottom, chartRight);
  4300. this._topPadding = tbpadding;
  4301. this._leftPadding = lrpadding;
  4302. this._bottomPadding = tbpadding;
  4303. this._rightPadding = lrpadding;
  4304. }
  4305. if (this._legendSizable) {
  4306. if (isLegendRight) {
  4307. this._legendRect.x -= this._rightPadding;
  4308. this._chartRect.width -= this._rightPadding;
  4309. this._legendRect.y += this._topPadding;
  4310. this._legendRect.height -= (this._topPadding + this._bottomPadding);
  4311. } else if (isLegendLeft) {
  4312. this._legendRect.x += this._leftPadding;
  4313. this._chartRect.x += this._leftPadding;
  4314. this._chartRect.width -= this._leftPadding;
  4315. this._legendRect.y += this._topPadding;
  4316. this._legendRect.height -= (this._topPadding + this._bottomPadding);
  4317. } else if (isLegendTop) {
  4318. this._legendRect.y += this._topPadding;
  4319. this._chartRect.y += this._topPadding;
  4320. this._chartRect.height -= this._topPadding;
  4321. this._legendRect.x += this._leftPadding;
  4322. this._legendRect.width -= (this._leftPadding + this._rightPadding);
  4323. } else {
  4324. this._legendRect.y -= this._bottomPadding;
  4325. this._chartRect.height -= this._bottomPadding;
  4326. this._legendRect.x += this._leftPadding;
  4327. this._legendRect.width -= (this._leftPadding + this._rightPadding);
  4328. }
  4329. }
  4330. x = this._chartRect.x;
  4331. y = this._chartRect.y;
  4332. w = this._chartRect.width;
  4333. h = this._chartRect.height;
  4334. var bottomH = 0;
  4335. var topH = 0;
  4336. var leftW = 0;
  4337. var rightW = 0;
  4338. var tbSO = 0;
  4339. var lrSO = 0;
  4340. if (!this._preAxesAtZero) {
  4341. var countHorz = 0;
  4342. var countVert = 0;
  4343. for (var i = 0; i < this._axisSizables.length; ++i) {
  4344. var sizable = this._axisSizables[i];
  4345. if (sizable) {
  4346. var orientation = sizable.getSizableOrientation();
  4347. if ("top" == orientation || "bottom" == orientation) {
  4348. countHorz++;
  4349. } else {
  4350. countVert++;
  4351. }
  4352. }
  4353. }
  4354. for (var i = 0; i < this._axisSizables.length; ++i) {
  4355. var sizable = this._axisSizables[i];
  4356. if (sizable) {
  4357. var orientation = sizable.getSizableOrientation();
  4358. var tbAxis = "top" == orientation || "bottom" == orientation;
  4359. var axisDynamicSize = sizable.getPreferredSize();
  4360. var spillOver = sizable.getSpillOverSize();
  4361. if (tbAxis) {
  4362. var axisPercent = countHorz > 1 ? 0.4 : 0.5;
  4363. if (axisDynamicSize > this._chartRect.height * axisPercent) {
  4364. axisDynamicSize = this._chartRect.height * axisPercent;
  4365. }
  4366. if ("top" == orientation) {
  4367. topH = axisDynamicSize;
  4368. } else {
  4369. bottomH = axisDynamicSize;
  4370. }
  4371. if (spillOver > lrSO) {
  4372. lrSO = spillOver;
  4373. }
  4374. } else {
  4375. var axisPercent = countVert > 1 ? 0.4 : 0.5;
  4376. if (axisDynamicSize > this._chartRect.width * axisPercent) {
  4377. axisDynamicSize = this._chartRect.width * axisPercent;
  4378. }
  4379. if ("left" == orientation) {
  4380. leftW = axisDynamicSize;
  4381. } else {
  4382. rightW = axisDynamicSize;
  4383. }
  4384. if (spillOver > tbSO) {
  4385. tbSO = spillOver;
  4386. }
  4387. }
  4388. }
  4389. }
  4390. }
  4391. if (lrSO > leftW) {
  4392. leftW = lrSO;
  4393. }
  4394. if (lrSO > rightW) {
  4395. rightW = lrSO;
  4396. }
  4397. if (tbSO > topH) {
  4398. topH = tbSO;
  4399. }
  4400. if (tbSO > bottomH) {
  4401. bottomH = tbSO;
  4402. }
  4403. this._leftRect.x = x;
  4404. this._leftRect.width = leftW;
  4405. this._leftRect.y = y;
  4406. this._leftRect.height = h;
  4407. this._rightRect.x = x + w - rightW;
  4408. this._rightRect.width = rightW;
  4409. this._rightRect.y = y;
  4410. this._rightRect.height = h;
  4411. this._topRect.y = y;
  4412. this._topRect.height = topH;
  4413. this._topRect.x = x;
  4414. this._topRect.width = w;
  4415. this._bottomRect.y = y + h - bottomH;
  4416. this._bottomRect.height = bottomH;
  4417. this._bottomRect.x = x;
  4418. this._bottomRect.width = w;
  4419. this._elementRect.x = x + leftW;
  4420. this._elementRect.y = y + topH;
  4421. this._elementRect.width = w - (leftW + rightW);
  4422. this._elementRect.height = h - (topH + bottomH);
  4423. if (this._legendSizable && this._legendChartAlign) {
  4424. if (tbLegend) {
  4425. this._legendRect.x = this._elementRect.x;
  4426. this._legendRect.width = this._elementRect.width;
  4427. } else {
  4428. this._legendRect.y = this._elementRect.y;
  4429. this._legendRect.height = this._elementRect.height;
  4430. }
  4431. }
  4432. },
  4433. evaluatePadding : function(padding, horizontalExtent, verticalExtent) {
  4434. if (padding == null) {
  4435. return false;
  4436. }
  4437. var paddingString = (padding) + "";
  4438. if (paddingString.length == 0) {
  4439. return false;
  4440. }
  4441. this._topPadding = 0;
  4442. this._leftPadding = 0;
  4443. this._bottomPadding = 0;
  4444. this._rightPadding = 0;
  4445. var items = paddingString.split(new RegExp(";"));
  4446. for (var __i_enFor0 = 0, __len_enFor0 = items.length;
  4447. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4448. var item = items[__i_enFor0];
  4449. var parts = item.split(new RegExp(":"));
  4450. if (items.length == 1 && parts.length != 2) {
  4451. return false;
  4452. }
  4453. if (parts.length == 2) {
  4454. if (0 <= parts[0].indexOf("top")) {
  4455. this._topPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], verticalExtent);
  4456. } else if (0 <= parts[0].indexOf("left")) {
  4457. this._leftPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], horizontalExtent);
  4458. } else if (0 <= parts[0].indexOf("bottom")) {
  4459. this._bottomPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], verticalExtent);
  4460. } else if (0 <= parts[0].indexOf("right")) {
  4461. this._rightPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], horizontalExtent);
  4462. }
  4463. }
  4464. }
  4465. return true;
  4466. },
  4467. /**
  4468. * @return (rave['internal']['RectStruct']) Legend rectangle
  4469. */
  4470. /** @expose */
  4471. legendRect : function() {
  4472. return this._legendRect;
  4473. },
  4474. /**
  4475. * @return (rave['internal']['RectStruct']) Chart (elements plus axes) rectangle
  4476. */
  4477. /** @expose */
  4478. chartRect : function() {
  4479. return this._chartRect;
  4480. },
  4481. /**
  4482. * @return (rave['internal']['RectStruct']) Top axis rectangle
  4483. */
  4484. /** @expose */
  4485. topRect : function() {
  4486. return this._topRect;
  4487. },
  4488. /**
  4489. * @return (rave['internal']['RectStruct']) Left axis rectangle
  4490. */
  4491. /** @expose */
  4492. leftRect : function() {
  4493. return this._leftRect;
  4494. },
  4495. /**
  4496. * @return (rave['internal']['RectStruct']) Bottom axis rectangle
  4497. */
  4498. /** @expose */
  4499. bottomRect : function() {
  4500. return this._bottomRect;
  4501. },
  4502. /**
  4503. * @return (rave['internal']['RectStruct']) Right axis rectangle
  4504. */
  4505. /** @expose */
  4506. rightRect : function() {
  4507. return this._rightRect;
  4508. },
  4509. /**
  4510. * @return (rave['internal']['RectStruct']) Legend rectangle
  4511. */
  4512. /** @expose */
  4513. elementRect : function() {
  4514. return this._elementRect;
  4515. },
  4516. /**
  4517. * Set the overall rectangle. This should be called before doing the layout.
  4518. * @param (rave['internal']['RectStruct']) overall The overall rectangle
  4519. */
  4520. /** @expose */
  4521. overall : function(overall) {
  4522. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._overallRect, overall);
  4523. return this;
  4524. },
  4525. padding$0 : function() {
  4526. return this._padding;
  4527. },
  4528. legendChartAlign$0 : function() {
  4529. return this._legendChartAlign;
  4530. },
  4531. legendChartGap$0 : function() {
  4532. return this._legendChartGap;
  4533. },
  4534. topPadding$0 : function() {
  4535. return this._topChartPadding;
  4536. },
  4537. leftPadding$0 : function() {
  4538. return this._leftChartPadding;
  4539. },
  4540. bottomPadding$0 : function() {
  4541. return this._bottomChartPadding;
  4542. },
  4543. rightPadding$0 : function() {
  4544. return this._rightChartPadding;
  4545. },
  4546. legendPosition$0 : function() {
  4547. return this._legendPosition;
  4548. },
  4549. topPadding$1 : function(padding) {
  4550. this._topChartPadding = padding;
  4551. return this;
  4552. },
  4553. leftPadding$1 : function(padding) {
  4554. this._leftChartPadding = padding;
  4555. return this;
  4556. },
  4557. bottomPadding$1 : function(padding) {
  4558. this._bottomChartPadding = padding;
  4559. return this;
  4560. },
  4561. rightPadding$1 : function(padding) {
  4562. this._rightChartPadding = padding;
  4563. return this;
  4564. },
  4565. /** @expose */
  4566. type : function() {
  4567. return com_ibm_rave_bundles_component_ChartLayoutComponent.COMPONENT_TYPE;
  4568. },
  4569. padding$1 : function(value) {
  4570. this._padding = value;
  4571. return this;
  4572. },
  4573. /** @expose */
  4574. chartPadding : function(top, left, bottom, right) {
  4575. this._topChartPadding = top;
  4576. this._leftChartPadding = left;
  4577. this._bottomChartPadding = bottom;
  4578. this._rightChartPadding = right;
  4579. return this;
  4580. },
  4581. legendChartAlign$1 : function(legendChartAlign) {
  4582. this._legendChartAlign = legendChartAlign;
  4583. return this;
  4584. },
  4585. legendChartGap$1 : function(value) {
  4586. this._legendChartGap = value;
  4587. return this;
  4588. },
  4589. legendPosition$1 : function(position) {
  4590. if ("top" == position || "bottom" == position || "left" == position || "right" == position) {
  4591. this._legendPosition = position;
  4592. }
  4593. return this;
  4594. },
  4595. /** @expose */
  4596. legendSize : function(sizable) {
  4597. this._legendSizable = sizable;
  4598. return this;
  4599. },
  4600. /** @expose */
  4601. removeAxisSizables : function() {
  4602. this._axisSizables.length = 0;
  4603. return this;
  4604. },
  4605. /** @expose */
  4606. addAxisSizable : function(sizable) {
  4607. this._axisSizables.push(sizable);
  4608. return this;
  4609. },
  4610. /** @expose */
  4611. padding : function(a0) {
  4612. var args = arguments;
  4613. if (args.length == 0) {
  4614. return this.padding$0();
  4615. }
  4616. return this.padding$1(a0);
  4617. },
  4618. /** @expose */
  4619. legendChartAlign : function(a0) {
  4620. var args = arguments;
  4621. if (args.length == 0) {
  4622. return this.legendChartAlign$0();
  4623. }
  4624. return this.legendChartAlign$1(a0);
  4625. },
  4626. /** @expose */
  4627. legendChartGap : function(a0) {
  4628. var args = arguments;
  4629. if (args.length == 0) {
  4630. return this.legendChartGap$0();
  4631. }
  4632. return this.legendChartGap$1(a0);
  4633. },
  4634. /** @expose */
  4635. topPadding : function(a0) {
  4636. var args = arguments;
  4637. if (args.length == 0) {
  4638. return this.topPadding$0();
  4639. }
  4640. return this.topPadding$1(a0);
  4641. },
  4642. /** @expose */
  4643. leftPadding : function(a0) {
  4644. var args = arguments;
  4645. if (args.length == 0) {
  4646. return this.leftPadding$0();
  4647. }
  4648. return this.leftPadding$1(a0);
  4649. },
  4650. /** @expose */
  4651. bottomPadding : function(a0) {
  4652. var args = arguments;
  4653. if (args.length == 0) {
  4654. return this.bottomPadding$0();
  4655. }
  4656. return this.bottomPadding$1(a0);
  4657. },
  4658. /** @expose */
  4659. rightPadding : function(a0) {
  4660. var args = arguments;
  4661. if (args.length == 0) {
  4662. return this.rightPadding$0();
  4663. }
  4664. return this.rightPadding$1(a0);
  4665. },
  4666. /** @expose */
  4667. legendPosition : function(a0) {
  4668. var args = arguments;
  4669. if (args.length == 0) {
  4670. return this.legendPosition$0();
  4671. }
  4672. return this.legendPosition$1(a0);
  4673. }
  4674. });
  4675. /**
  4676. * Set preferred rectangle to the same position and size as the source rectangle.
  4677. * @param (rave['internal']['RectStruct']) t preferred rectangle
  4678. * @param (rave['internal']['RectStruct']) s Source rectangle
  4679. * @return (rave['internal']['RectStruct']) preferred rectangle
  4680. */
  4681. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect = function(t, s) {
  4682. t.x = s.x;
  4683. t.y = s.y;
  4684. t.width = s.width;
  4685. t.height = s.height;
  4686. return t;
  4687. };
  4688. /**
  4689. * Inset a rectangle, modifying its x,y,width,height. If that would reduce the rectangle to less than 0 in a dimension, it is not inset in that dimension. If the requested inset is <= 0, 0 is used.
  4690. * @param (rave['internal']['RectStruct']) r Rectangle
  4691. * @param (double) top Top inset in pixels
  4692. * @param (double) left Left inset in pixels
  4693. * @param (double) bottom Bottom inset in pixels
  4694. * @param (double) right Right inset in pixels
  4695. * @return (rave['internal']['RectStruct']) The rectangle
  4696. */
  4697. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset = function(r, top, left, bottom, right) {
  4698. var ileft = Math.max(0.0, left);
  4699. var iright = Math.max(0.0, right);
  4700. if (ileft + iright <= r.width) {
  4701. r.x += ileft;
  4702. r.width -= ileft + iright;
  4703. }
  4704. var itop = Math.max(0.0, top);
  4705. var ibottom = Math.max(0.0, bottom);
  4706. if (itop + ibottom <= r.height) {
  4707. r.y += itop;
  4708. r.height -= itop + ibottom;
  4709. }
  4710. return r;
  4711. };
  4712. /**
  4713. * Evaluate a size, which may be a number, CSS size, or pecentage, and return the size in pixels. If the size is null or can't be parsed, returns defValue. The value is clamped to the range 0 to extent.
  4714. * @param (Object) value The size
  4715. * @param (double) extent The extent in the dimension
  4716. * @param defValue The default to use if not parsable
  4717. * @return (double) Size in pixels
  4718. */
  4719. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize = function(value, extent) {
  4720. var v = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(value, extent, 10.0);
  4721. var d = v != null ? v : 0;
  4722. return Math.max(0.0, Math.min(d, extent));
  4723. };
  4724. /** @expose */
  4725. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_AXIS_PERCENT = 0.4;
  4726. /** @expose */
  4727. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_AXIS_PERCENT_SINGLE_PER_ORIENTATION = 0.5;
  4728. /** @expose */
  4729. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_LEGEND_PERCENT = 0.3;
  4730. /** @expose */
  4731. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_LEGEND_PERCENT_NO_AXIS = 0.5;
  4732. // $source: com/ibm/rave/bundles/components/ClipPathComponentImpl
  4733. /************************************************************************
  4734. ** IBM Confidential
  4735. **
  4736. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4737. **
  4738. ** (C) Copyright IBM Corp. 2017
  4739. **
  4740. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4741. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4742. ************************************************************************/
  4743. // GENERATED
  4744. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  4745. /**
  4746. * ClipPathComponent This component handles creation of a clipPath element, as well as applying that clip path to a given selection. There is a one-to-one relationship between a ClipPathComponent and a clipPath element that is appended to the document. To create multiple clipPath elements, you must create multiple ClipPathComponent instances. Example usage: <pre> _clip.clipRect(new RectStruct(50, 50, 200, 200)) // Set the clipping rectangle .applyTo(chart.select(".content")) // Apply the clip-path attribute to a graphical element. This can be called repeatedly on different selections. .applyTo(chart.select(".otherContent")) .run(context.node.select("defs")); // ClipPathComponent creates a clipPath element within the provided node. This component should be executed on a single "defs" node, however there is no restriction. </pre>
  4747. */
  4748. var com_ibm_rave_bundles_components_ClipPathComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  4749. //_id : null,
  4750. //_clipRect : null,
  4751. constructor : function(id) {
  4752. this._clipRect = new rave['internal']['RectStruct'](0, 0, 100, 100);
  4753. /**
  4754. * Initializes the component. The provided id will be used as the "id" attribute for the clipPath element created by this component. Recall that an "id" in an SVG/HTML document must be <em>unique across the entire document</em>. If you create multiple clipPath elements with the same id, then all elements referencing one of these clip paths will not be resolved as you expected.
  4755. * @param (String) id String ID that is unique <em>across the document</em>.
  4756. */
  4757. {
  4758. this._id = id;
  4759. }
  4760. },
  4761. /** @expose */
  4762. type : function() {
  4763. return "ClipPathComponent";
  4764. },
  4765. /**
  4766. * Set the rectangular clipping area. Make the _clipRect one pixel larger than requested to avoid the cut-off at bounds. TODO: why?!?
  4767. * @param (rave['internal']['RectStruct']) rect The rectangular bounds of the clipping area.
  4768. * @return (com.ibm.rave.bundles.components.ClipPathComponentImpl) This ClipPathComponent.
  4769. */
  4770. /** @expose */
  4771. clipRect : function(rect) {
  4772. this._clipRect = new rave['internal']['RectStruct'](rect.x - 1, rect.y - 1, rect.width + 2, rect.height + 2);
  4773. return this;
  4774. },
  4775. /**
  4776. * Set the clip-path attribute on the provided selection.
  4777. * @return (com.ibm.rave.bundles.components.ClipPathComponentImpl) This ClipPathComponent.
  4778. */
  4779. /** @expose */
  4780. applyTo : function(s) {
  4781. s.attr("clip-path", "url(" + this.url() + ")");
  4782. return this;
  4783. },
  4784. /**
  4785. * Retrieve the id assigned to this clip path.
  4786. */
  4787. /** @expose */
  4788. id : function() {
  4789. return this._id;
  4790. },
  4791. /**
  4792. * Retrieve the URL that can be used to reference this clip path.
  4793. */
  4794. /** @expose */
  4795. url : function() {
  4796. return "#" + this._id;
  4797. },
  4798. /** @expose */
  4799. execute : function(g) {
  4800. var clipPath = g.selectAll("#" + this._id).data([0]);
  4801. clipPath.enter().append("clipPath").attr("id", this._id).append("rect");
  4802. rave.transition(clipPath.select("rect")).attr("x", this._clipRect.x).attr("y", this._clipRect.y).attr("width", this._clipRect.width).attr("height", this._clipRect.height);
  4803. }
  4804. });
  4805. // $source: com/ibm/rave/bundles/components/LegendComponentImpl
  4806. /************************************************************************
  4807. ** IBM Confidential
  4808. **
  4809. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4810. **
  4811. ** (C) Copyright IBM Corp. 2017
  4812. **
  4813. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4814. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4815. ************************************************************************/
  4816. // GENERATED
  4817. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  4818. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  4819. /**
  4820. * <p> A component to draw a legend, using a RAVE capability swatch legend. In JavaScript the RAVE legend and layout extensions must be loaded. The legend puts its shapes into the selector passed to its execute method, so that selector should choose a group node. </p> <p> Most of the component properties are passed directly to the RAVE legend. The properties are: </p> <p> <b>visible</b>: If true, the legend is drawn; otherwise it is cleared (all shapes are removed from the legend). The default is true. </p> <p> <b>size</b>: A Dim with the size of the legend in the chart coordinate system. If null or zero-sized, the legend is cleared. This is passed to the swatch legend. </p> <p> <b>colorScale</b>: A scale (OrdinalScale) used as the RAVE legend scale. If null, the legend is cleared. The legend currently only supports a single ordinal color scale. </p> <p> <b>orient</b>: The RAVE legend orient, either "horizontal" or "vertical". The default is "vertical". </p> <p> <b>swatchSize</b>: The RAVE legend size. Note that this is in square pixels. The default is 20*20. </p> <p> <b>shape</b>: The RAVE legend shape. The default is "square". </p> <p> <b>title</b>: The RAVE legend title. The default is null. </p> <p> <b>titleFill</b>: The legend title color. The default is null. </p> <p> <b>titleFontSize</b>: The legend title font size. The default is null. </p> <p> <b>titleFontFamily</b>: The legend title font family. The default is null. </p> <p> <b>borderColor</b>: The RAVE legend borderColor. The default is "black". </p> <p> <b>labelFormat</b>: The RAVE legend labelFormat. The default is null. </p>
  4821. */
  4822. var com_ibm_rave_bundles_components_LegendComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  4823. /**
  4824. * Legend size property
  4825. */
  4826. //_size : null,
  4827. /**
  4828. * Color scale
  4829. */
  4830. //_colorPalette : null,
  4831. /**
  4832. * Orient, "horizontal" or "vertical"
  4833. */
  4834. //_orient : null,
  4835. /**
  4836. * Swatch size function
  4837. */
  4838. //_swatchSizeFunc : null,
  4839. /**
  4840. * Scale
  4841. */
  4842. //_scale : null,
  4843. /**
  4844. * Swatch symbol
  4845. */
  4846. //_shape : null,
  4847. /**
  4848. * Legend title
  4849. */
  4850. //_title : null,
  4851. /**
  4852. * Legend title styling
  4853. */
  4854. //_titleStyle : null,
  4855. /**
  4856. * Legend entry styling
  4857. */
  4858. //_entryStyle : null,
  4859. /**
  4860. * Custom formatter
  4861. */
  4862. //_labelFormat : null,
  4863. /**
  4864. * The swatch legend, created on demand
  4865. */
  4866. //_swatchLegend : null,
  4867. /**
  4868. * The continuous legend, created on demand
  4869. */
  4870. //_continuousLegend : null,
  4871. /**
  4872. * The legend type, either "SwatchLegend" or "ContinuousLegend"
  4873. */
  4874. //_legendType : null,
  4875. /**
  4876. * Is the legend visible
  4877. */
  4878. _visible : false,
  4879. /**
  4880. * Swatch size in square pixels
  4881. */
  4882. _swatchSize : 0,
  4883. /**
  4884. * Constructor; sets bound and, colorScale to null, all other properties to their default values.
  4885. */
  4886. /** @expose */
  4887. constructor : function() {
  4888. this._visible = true;
  4889. this._size = null;
  4890. this._colorPalette = null;
  4891. this._orient = "horizontal";
  4892. this._swatchSize = 16.0 * 16.0;
  4893. this._swatchSizeFunc = null;
  4894. this._scale = null;
  4895. this._shape = "square";
  4896. this._title = null;
  4897. this._titleStyle = {};
  4898. this._entryStyle = {};
  4899. this._labelFormat = null;
  4900. this._swatchLegend = null;
  4901. this._continuousLegend = null;
  4902. this._legendType = null;
  4903. },
  4904. /** @expose */
  4905. type : function() {
  4906. return "LegendComponent";
  4907. },
  4908. /** @expose */
  4909. execute : function(g) {
  4910. if (this._colorPalette) {
  4911. if ("continuous" == this._colorPalette.getType()) {
  4912. if (!this._continuousLegend) {
  4913. this._continuousLegend = (rave.capabilities.extension("legend")).continuous();
  4914. }
  4915. this._legendType = "ContinuousLegend";
  4916. } else {
  4917. if (!this._swatchLegend) {
  4918. this._swatchLegend = (rave.capabilities.extension("legend")).swatch();
  4919. }
  4920. this._legendType = "SwatchLegend";
  4921. }
  4922. } else if (this._swatchSizeFunc) {
  4923. if (!this._swatchLegend) {
  4924. this._swatchLegend = (rave.capabilities.extension("legend")).swatch();
  4925. }
  4926. this._legendType = "SwatchLegend";
  4927. } else {
  4928. this._legendType = null;
  4929. }
  4930. this.preExecute();
  4931. if (!this._visible || (!this._colorPalette && !this._swatchSizeFunc) || !this._size || this._size[0] <= 0 || this._size[1] <= 0) {
  4932. g.selectAll("*").remove();
  4933. return;
  4934. }
  4935. var fontChecker = rave.capabilities.extension("fontchecker");
  4936. if (this._colorPalette && "continuous" == this._colorPalette.getType()) {
  4937. this._continuousLegend.shapeRectSize("horizontal" == this._orient ? [-1.0, 16.0] : [16.0, -1.0]).size(this._size).scale(this._colorPalette.getScale()).orient(this._orient).title(this._title).titleFill(this._titleStyle["fill"]).titleFontSize(this._titleStyle["font-size"]).titleFontFamily(this._titleStyle["font-Family"]).titleAlignment("start").labelFormat(this._labelFormat);
  4938. var legend = g.call(this._continuousLegend);
  4939. if (this._entryStyle) {
  4940. legend.selectAll(".legendLabel").style(this._entryStyle);
  4941. }
  4942. if (this._titleStyle) {
  4943. legend.selectAll(".legendTitle").style(this._titleStyle);
  4944. }
  4945. if (fontChecker) {
  4946. legend.selectAll(".legendLabel").call(fontChecker);
  4947. legend.selectAll(".legendTitle").call(fontChecker);
  4948. }
  4949. } else {
  4950. var insets = {};
  4951. insets["bottom"] = 5;
  4952. var swatchSize = this._swatchSize;
  4953. var scale = null;
  4954. var labelFormatter = this._labelFormat;
  4955. if (this._swatchSizeFunc && this._scale) {
  4956. swatchSize = this._swatchSizeFunc;
  4957. scale = this._scale;
  4958. }
  4959. if (this._colorPalette) {
  4960. scale = this._colorPalette.getScale();
  4961. var originalDomain = this._colorPalette.originalDomain();
  4962. if (originalDomain) {
  4963. scale.domain(originalDomain);
  4964. var f = this._colorPalette.originalDomainLabelAccessor();
  4965. if (this._labelFormat) {
  4966. var self = this;
  4967. labelFormatter = function(data, index, groupIndex) {
  4968. return self._labelFormat.call(this, f.call(this, data, index, groupIndex), index, groupIndex);
  4969. };
  4970. } else {
  4971. labelFormatter = f;
  4972. }
  4973. }
  4974. }
  4975. this._swatchLegend.labelPadding(8).size(this._size).scale(scale).orient(this._orient).swatchSize(swatchSize).shape(this._shape).title(this._title).titleFill(this._titleStyle["fill"]).titleFontSize(this._titleStyle["font-size"]).titleFontFamily(this._titleStyle["font-family"]).titleAlignment("start").labelFormat(labelFormatter).titleInsets(insets);
  4976. var legend = g.call(this._swatchLegend);
  4977. if (this._entryStyle) {
  4978. legend.selectAll(".legendLabel").style(this._entryStyle);
  4979. }
  4980. if (this._titleStyle) {
  4981. legend.selectAll(".legendTitle").style(this._titleStyle);
  4982. }
  4983. if (fontChecker) {
  4984. legend.selectAll(".legendLabel").call(fontChecker);
  4985. legend.selectAll(".legendTitle").call(fontChecker);
  4986. }
  4987. }
  4988. },
  4989. /** @expose */
  4990. legend : function() {
  4991. if ("ContinuousLegend" == this._legendType) {
  4992. return this._continuousLegend;
  4993. }
  4994. if ("SwatchLegend" == this._legendType) {
  4995. return this._swatchLegend;
  4996. }
  4997. return null;
  4998. },
  4999. /** @expose */
  5000. legendType : function() {
  5001. return this._legendType;
  5002. },
  5003. /**
  5004. * Set the visible property.
  5005. * @param (boolean) visible New visible
  5006. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5007. */
  5008. /** @expose */
  5009. visible : function(visible) {
  5010. this._visible = visible;
  5011. return this;
  5012. },
  5013. /**
  5014. * see if the legend is visible
  5015. * @return (boolean) if its visible
  5016. */
  5017. /** @expose */
  5018. isVisible : function() {
  5019. return this._visible;
  5020. },
  5021. /**
  5022. * Set the size property.
  5023. * @param (Array) size New size
  5024. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5025. */
  5026. /** @expose */
  5027. size : function(size) {
  5028. this._size = size;
  5029. return this;
  5030. },
  5031. /**
  5032. * Set the color scale property.
  5033. * @param (rave['library']['internal']['Palette']) colorPalette New color scale
  5034. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5035. */
  5036. /** @expose */
  5037. colorPalette : function(colorPalette) {
  5038. this._colorPalette = colorPalette;
  5039. return this;
  5040. },
  5041. /**
  5042. * Set the orient property. If the argument is not "horizontal" or "vertical", it is ignored and the orient property is not changed.
  5043. * @param (String) orient New orient
  5044. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5045. */
  5046. /** @expose */
  5047. orient : function(orient) {
  5048. if ("horizontal" == orient || "vertical" == orient) {
  5049. this._orient = orient;
  5050. }
  5051. return this;
  5052. },
  5053. /**
  5054. * Set the orient property from a legend position. If the argument is "top" or "bottom", the orient is set to "horizontal". Otherwise it is set to "vertical".
  5055. * @param (String) position Legend position
  5056. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5057. */
  5058. /** @expose */
  5059. position : function(position) {
  5060. return this.orient(com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf(position));
  5061. },
  5062. swatchSize$0 : function(swatchSize) {
  5063. if (swatchSize >= 0.0 && swatchSize != null) {
  5064. this._swatchSize = swatchSize;
  5065. }
  5066. return this;
  5067. },
  5068. /** @expose */
  5069. scale : function(scale) {
  5070. this._scale = scale;
  5071. return this;
  5072. },
  5073. swatchSize$1 : function(swatchSize) {
  5074. if (swatchSize) {
  5075. this._swatchSizeFunc = swatchSize;
  5076. }
  5077. return this;
  5078. },
  5079. /** @expose */
  5080. shape : function(shape) {
  5081. this._shape = shape;
  5082. return this;
  5083. },
  5084. /** @expose */
  5085. title : function(title) {
  5086. this._title = (title != null && title.length > 0) ? title : null;
  5087. return this;
  5088. },
  5089. /** @expose */
  5090. titleFill : function(titleFill) {
  5091. this._titleStyle["fill"] = titleFill;
  5092. return this;
  5093. },
  5094. /** @expose */
  5095. titleFontSize : function(titleFontSize) {
  5096. this._titleStyle["font-size"] = titleFontSize;
  5097. return this;
  5098. },
  5099. /** @expose */
  5100. titleFontFamily : function(titleFontFamily) {
  5101. this._titleStyle["font-family"] = titleFontFamily;
  5102. return this;
  5103. },
  5104. /** @expose */
  5105. labelFormat : function(labelFormat) {
  5106. this._labelFormat = labelFormat;
  5107. return this;
  5108. },
  5109. /** @expose */
  5110. titleFont : function(titleFontStyle) {
  5111. this._titleStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(titleFontStyle);
  5112. return this;
  5113. },
  5114. /** @expose */
  5115. entryFont : function(entryFontStyle) {
  5116. this._entryStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(entryFontStyle);
  5117. return this;
  5118. },
  5119. /** @expose */
  5120. getSpaceUsed : function() {
  5121. if (this._colorPalette && "continuous" == this._colorPalette.getType()) {
  5122. return this._continuousLegend.getUsedSize() + 2;
  5123. } else {
  5124. return this._swatchLegend.getUsedSize() + 2;
  5125. }
  5126. },
  5127. /** @expose */
  5128. swatchSize : function(a0) {
  5129. var args = arguments;
  5130. if (args.length == 1 && typeof a0 === "function") {
  5131. return this.swatchSize$1(a0);
  5132. }
  5133. return this.swatchSize$0(a0);
  5134. }
  5135. });
  5136. /**
  5137. * Get the orient for a position. "top" and "bottom" return "horizontal", anything else ("left", "right", or unknown/null) is "vertical".
  5138. * @param (String) position A position
  5139. * @return (String) "horizontal" or "vertical"
  5140. */
  5141. /** @expose */
  5142. com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf = function(position) {
  5143. if ("top" == position || "bottom" == position) {
  5144. return "horizontal";
  5145. }
  5146. return "vertical";
  5147. };
  5148. //com_ibm_rave_bundles_components_LegendComponentImpl.HORIZONTAL = "horizontal";
  5149. //com_ibm_rave_bundles_components_LegendComponentImpl.VERTICAL = "vertical";
  5150. com_ibm_rave_bundles_components_LegendComponentImpl.BAR_THINKNESS = 16;
  5151. com_ibm_rave_bundles_components_LegendComponentImpl.SWATCH_SIZE = 16;
  5152. /** @expose */
  5153. com_ibm_rave_bundles_components_LegendComponentImpl.TOP = "top";
  5154. /** @expose */
  5155. com_ibm_rave_bundles_components_LegendComponentImpl.BOTTOM = "bottom";
  5156. /** @expose */
  5157. com_ibm_rave_bundles_components_LegendComponentImpl.LEFT = "left";
  5158. /** @expose */
  5159. com_ibm_rave_bundles_components_LegendComponentImpl.RIGHT = "right";
  5160. /** @expose */
  5161. com_ibm_rave_bundles_components_LegendComponentImpl.ADJUSTABLE = -1;
  5162. // $source: com/ibm/rave/bundles/components/AxisComponentImpl
  5163. /************************************************************************
  5164. ** IBM Confidential
  5165. **
  5166. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5167. **
  5168. ** (C) Copyright IBM Corp. 2018
  5169. **
  5170. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5171. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5172. ************************************************************************/
  5173. // GENERATED
  5174. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5175. //@import com/ibm/rave/bundles/component/AxisComponent (runtime) // AxisComponent
  5176. //@import com/ibm/rave/bundles/utilities/TextCrossfader (runtime) // textCrossFade
  5177. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  5178. //@import com/ibm/rave/bundles/utilities/BundleLabelDropper (runtime) // new
  5179. /**
  5180. * <p> Component to draw an axis and title. The component is drawn into a Selector group, and the user of the component must translate the group to the axis position and set up the axis scale for the correct number of pixels. </p> <p> The component uses a RAVE core Axis for drawing the axis. Most component properties are passed to the axis. The component properties are: </p> <p> <b>scale</b>: The axis scale. This must be set up with the domain and range (pixels) of the axis. If null the axis does not render, and removes all axis shapes from the selector. Default null. </p> <p> <b>orient</b>: The axis orient, "top", "bottom", "left", or "right". Default "bottom". </p> <p> <b>bounds</b>: The bounding box for the axis, used to position the title and to wrap/truncate axis labels. If null the title is placed 50 pixels from the axis line and text is not wrapped. </p> <p> <b>tickFormat</b>: A value function passed to the axis to format tick labels. Default null, meaning the RAVE default formatting is used. </p> <p> <b>displayAxisTitle</b>: Whether to display the axis title. Default true. </p> <p> <b>axisTitle</b>: The title to display on the axis. It is centered on the axis range, and the size property is used to find the distance from the axis. Default null. </p> <p> <b>axisColor</b>: A color-string for the axis line. If null, no color is applied and the CSS defaults are used. Default null. </p> <p> <b>tickColor</b>: A color-string for the axis ticks. If null, no color is applied and the CSS defaults are used. Default null. </p> <p> <b>labelColor</b>: A color-string for the axis tick labels. If null, no color is applied and the CSS defaults are used. Default null. </p> <p> <b>titleColor</b>: A color-string for the axis title. If null, no color is applied and the CSS defaults are used. Default null. </p> <p> <b>displayAxisLine</b>: Whether to display the axis line. Default true. </p> <p> <b>displayAxisTicks</b>: Whether to display the axis ticks. Default true. </p> <p> <b>displayAxisTickLabels</b>: Whether to display the axis tick labels. Default true. </p>
  5181. */
  5182. var com_ibm_rave_bundles_components_AxisComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5183. /**
  5184. * Axis - created on demand
  5185. */
  5186. //_axis : null,
  5187. /**
  5188. * Role, from the AxisComponent API
  5189. */
  5190. //_role : null,
  5191. /**
  5192. * CoordinateScale
  5193. */
  5194. //_scale : null,
  5195. /**
  5196. * Orient, always one of the four legal values
  5197. */
  5198. //_orient : null,
  5199. /**
  5200. * Size
  5201. */
  5202. //_bounds : null,
  5203. //_elementRect : null,
  5204. /**
  5205. * The title text; default null (nothing visible)
  5206. */
  5207. /** @expose */
  5208. _axisTitle : null,
  5209. /**
  5210. * The title style; defaults null (use the CSS styling)
  5211. */
  5212. /** @expose */
  5213. _titleStyle : null,
  5214. /**
  5215. * Axis line color; default null (use the CSS styling)
  5216. */
  5217. /** @expose */
  5218. _lineColor : null,
  5219. /**
  5220. * Axis tick color; default null (use the CSS styling)
  5221. */
  5222. /** @expose */
  5223. _tickColor : null,
  5224. /**
  5225. * Axis tick label style; defaults null (use the CSS styling)
  5226. */
  5227. /** @expose */
  5228. _labelStyle : null,
  5229. //_staggerRotate45Nodes : null,
  5230. //_staggerFirstNode : null,
  5231. //_staggerLastNode : null,
  5232. /**
  5233. * Axis tick label formatting
  5234. */
  5235. //_tickFormat : null,
  5236. //_dropOverlap : null,
  5237. /**
  5238. * Used to get the extension to enable axis label wrapping
  5239. */
  5240. //_textFlow : null,
  5241. /**
  5242. * Used to check the fonts on each label to make sure all characters are covered
  5243. */
  5244. //_fontChecker : null,
  5245. /**
  5246. * Run function that applies the properties to the axis line
  5247. */
  5248. //_axisLineProperties : null,
  5249. /**
  5250. * Run function that applies the properties to the axis ticks
  5251. */
  5252. //_axisTickProperties : null,
  5253. /**
  5254. * Run function that applies the properties to the axis tick labels
  5255. */
  5256. //_axisTickLabelProperties : null,
  5257. /**
  5258. * Run function that hides or displays the axis tick labels
  5259. */
  5260. //_displayHideLabels : null,
  5261. /**
  5262. * Run function that hides or displays the axis tick labels
  5263. */
  5264. //_panZoomLabels : null,
  5265. /**
  5266. * The tick handler registered with the axis; will get called during axis transition
  5267. */
  5268. //_tickHandler : null,
  5269. //_textTruncationIndicator : null,
  5270. /**
  5271. * Used when dealing with numeric scale on the vertical axis and the numbers don't fit
  5272. */
  5273. //_simplifiedTickFormat : null,
  5274. //_tickMagnitude : null,
  5275. /**
  5276. * Whether to display the axis title; default true
  5277. */
  5278. /** @expose */
  5279. _displayAxisTitle : false,
  5280. /**
  5281. * Whether to display the axis line; default true
  5282. */
  5283. /** @expose */
  5284. _displayAxisLine : false,
  5285. /**
  5286. * Whether to display the axis ticks; default true
  5287. */
  5288. /** @expose */
  5289. _displayTicks : false,
  5290. /**
  5291. * Whether to display the axis tick labels (conditional on show labels property); default true
  5292. */
  5293. /** @expose */
  5294. _displayTickLabels : false,
  5295. /**
  5296. * Whether to display the axis tick labels (conditional on pan-zoom hide property); default true
  5297. */
  5298. /** @expose */
  5299. _showPanZoomTickLabels : false,
  5300. /**
  5301. * Whether to rotate the axis tick labels; default false
  5302. */
  5303. _rotateLabels : false,
  5304. _staggerCellWidth : 0,
  5305. _staggerAlignFirstAtStart : false,
  5306. _staggerAlignLastAtEnd : false,
  5307. _layoutTimerId : 0,
  5308. _layoutTitleSize : 0,
  5309. _layoutLabelSize : 0,
  5310. _layoutLabelHeight : 0,
  5311. _layoutAverageDigitWidth : 0,
  5312. _layoutSpillOver : 0,
  5313. /**
  5314. * Whether to hide overlapping labels; default true
  5315. */
  5316. /** @expose */
  5317. _hideOverlappingLabels : false,
  5318. /**
  5319. * When true, don't start a new timer
  5320. */
  5321. _pendingLabelTimer : false,
  5322. /**
  5323. * The padding in px between tick axis line and tick label, and also between tick label and title. Default 16px.
  5324. */
  5325. _padding : 0,
  5326. /**
  5327. * After calling the component, this is true if shapes were rendered, false if they were cleared.
  5328. */
  5329. _renderedShapes : false,
  5330. _layoutMode : -1,
  5331. _allowAutoAxisLayoutToChangeOrientaiton : true,
  5332. _lastAutomaticAxisLayoutOrientation : -1,
  5333. _allowStagger : false,
  5334. _allowRotate45 : false,
  5335. _allowRotate90 : false,
  5336. constructor : function() {
  5337. {
  5338. var self = this;
  5339. this._axisLineProperties = function(args) {
  5340. if (args !== null || arguments.length > 1){
  5341. args = Array.prototype.slice.call(arguments, 0);
  5342. }
  5343. {
  5344. var line = this.selectAll("path.domain");
  5345. if (self._lineColor != null) {
  5346. line.style("stroke", self._lineColor);
  5347. }
  5348. if (self._displayAxisLine) {
  5349. line.attr("visibility", null);
  5350. } else {
  5351. line.attr("visibility", "hidden");
  5352. }
  5353. return null;
  5354. }
  5355. };
  5356. this._axisTickProperties = function(args) {
  5357. if (args !== null || arguments.length > 1){
  5358. args = Array.prototype.slice.call(arguments, 0);
  5359. }
  5360. {
  5361. var tickLines = this.selectAll("line");
  5362. if (self._displayTicks) {
  5363. tickLines.attr("visibility", null);
  5364. } else {
  5365. tickLines.attr("visibility", "hidden");
  5366. }
  5367. if (self._lineColor != null) {
  5368. tickLines.style("stroke", self._tickColor);
  5369. }
  5370. return null;
  5371. }
  5372. };
  5373. this._axisTickLabelProperties = function(args) {
  5374. if (args !== null || arguments.length > 1){
  5375. args = Array.prototype.slice.call(arguments, 0);
  5376. }
  5377. {
  5378. var labels = this.selectAll("text");
  5379. labels.each(self._displayHideLabels);
  5380. labels.each(self._panZoomLabels);
  5381. labels.style(self._labelStyle);
  5382. self._axis.ticksHandler(null);
  5383. return null;
  5384. }
  5385. };
  5386. this._displayHideLabels = function(obj, group, index) {
  5387. if (self._displayTickLabels) {
  5388. if (this.rave_hasProperty("__tickLabelHidden__")) {
  5389. this.rave_removeProperty("__tickLabelHidden__");
  5390. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5391. if (count <= 1) {
  5392. this.rave_removeProperty("__hiddenCount__");
  5393. this.removeAttribute("visibility");
  5394. } else {
  5395. this.rave_setProperty("__hiddenCount__", count - 1);
  5396. }
  5397. }
  5398. } else {
  5399. if (!(this.rave_hasProperty("__tickLabelHidden__"))) {
  5400. this.setAttribute("visibility", "hidden");
  5401. this.rave_setProperty("__tickLabelHidden__", "hidden");
  5402. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5403. this.rave_setProperty("__hiddenCount__", count + 1);
  5404. }
  5405. }
  5406. };
  5407. this._panZoomLabels = function(obj, group, index) {
  5408. if (self._showPanZoomTickLabels) {
  5409. if (this.rave_hasProperty("__panZoomHidden__")) {
  5410. this.rave_removeProperty("__panZoomHidden__");
  5411. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5412. if (count <= 1) {
  5413. this.rave_removeProperty("__hiddenCount__");
  5414. this.removeAttribute("visibility");
  5415. } else {
  5416. this.rave_setProperty("__hiddenCount__", count - 1);
  5417. }
  5418. }
  5419. } else {
  5420. if (!(this.rave_hasProperty("__panZoomHidden__"))) {
  5421. this.setAttribute("visibility", "hidden");
  5422. this.rave_setProperty("__panZoomHidden__", "hidden");
  5423. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5424. this.rave_setProperty("__hiddenCount__", count + 1);
  5425. }
  5426. }
  5427. };
  5428. }
  5429. this._tickHandler = new com_ibm_rave_bundles_components_AxisComponentImpl.AxisTickHandler(this._axisTickLabelProperties, this._axisTickProperties);
  5430. /**
  5431. * Initialize properties to defaults
  5432. */
  5433. {
  5434. this._axis = null;
  5435. this._role = null;
  5436. this._scale = null;
  5437. this._orient = "bottom";
  5438. this._bounds = null;
  5439. this._displayAxisTitle = true;
  5440. this._axisTitle = null;
  5441. this._titleStyle = {};
  5442. this._displayAxisLine = true;
  5443. this._lineColor = null;
  5444. this._displayTicks = true;
  5445. this._tickColor = null;
  5446. this._displayTickLabels = true;
  5447. this._labelStyle = {};
  5448. this._rotateLabels = false;
  5449. this._hideOverlappingLabels = true;
  5450. this._dropOverlap = new com_ibm_rave_bundles_utilities_BundleLabelDropper();
  5451. this._tickFormat = null;
  5452. this._showPanZoomTickLabels = true;
  5453. this._pendingLabelTimer = false;
  5454. this._padding = 16;
  5455. this._textFlow = rave.capabilities.extension("textflow");
  5456. this._fontChecker = rave.capabilities.extension("fontchecker");
  5457. this._renderedShapes = false;
  5458. }
  5459. },
  5460. /** @expose */
  5461. type : function() {
  5462. return com_ibm_rave_bundles_component_AxisComponent.COMPONENT_TYPE;
  5463. },
  5464. /** @expose */
  5465. role : function() {
  5466. return this._role;
  5467. },
  5468. /** @expose */
  5469. execute : function(g) {
  5470. this.preExecute();
  5471. if (!this._scale) {
  5472. g.selectAll("*").remove();
  5473. this._renderedShapes = false;
  5474. return;
  5475. }
  5476. this._renderedShapes = true;
  5477. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  5478. this._hideOverlappingLabels = false;
  5479. this._rotateLabels = true;
  5480. } else {
  5481. this._hideOverlappingLabels = true;
  5482. this._rotateLabels = true;
  5483. }
  5484. this.drawTitle(g);
  5485. this.drawAxis(g);
  5486. this.handleAxisText(g);
  5487. this.drawTitle(g);
  5488. },
  5489. /**
  5490. * This is one place where all the calls that affect the axis text happen in case of allowAutomaticAxisLayout the new behavior applies here
  5491. * @param (rave['internal']['Selector']) g
  5492. */
  5493. handleAxisText : function(g) {
  5494. this.stopLabelDroppingUpdate();
  5495. var duration = 0, delay = 0;
  5496. var g2 = rave.transition(g);
  5497. if (g2.isTransition()) {
  5498. var t2 = (g2);
  5499. duration = t2.duration();
  5500. delay = t2.delay();
  5501. }
  5502. var axisSelector = g.selectAll("g.axis");
  5503. var labels = axisSelector.selectAll("g.tick").filter(rave['library']['internal']['BundleUtils'].notExit).selectAll("text");
  5504. var fontChecker = rave.capabilities.extension("fontchecker");
  5505. labels.style(this._labelStyle);
  5506. if (fontChecker) {
  5507. labels.call(fontChecker);
  5508. }
  5509. var mode = this._allowAutoAxisLayoutToChangeOrientaiton ? this.determineWhichAutoMode(g) : this._lastAutomaticAxisLayoutOrientation;
  5510. this.configureStaggerData(g, mode);
  5511. this.handleLabelsRotationAndPosition(g, labels, mode);
  5512. this.hashingNumericScales(labels, this.labelExtent(g), mode);
  5513. if (duration == 0) {
  5514. this.doLabelWrapping(g, mode);
  5515. this.handleLabelsRotationAndPosition(g, labels, mode);
  5516. }
  5517. this._lastAutomaticAxisLayoutOrientation = mode;
  5518. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  5519. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  5520. var tick = axisSelector.append("g").classed("tick", true);
  5521. var tickText = tick.append("text");
  5522. if (labels.size() == 0) {
  5523. var singleValue = this._scale.scale().domain()[0];
  5524. var formatter = this._tickFormat;
  5525. if (!formatter) {
  5526. var tickFunc = this._scale.scale().tickFormat;
  5527. if (tickFunc) {
  5528. formatter = tickFunc.apply(tickFunc, [singleValue]);
  5529. }
  5530. }
  5531. var node = tickText[0][0];
  5532. var stringValue = formatter ? formatter.call(node, singleValue, 0, 0) : ""+(singleValue);
  5533. tickText.text(stringValue);
  5534. var dim = node.getBBox();
  5535. this._layoutLabelSize = isHorizontal ? dim.height : dim.width;
  5536. if (!isHorizontal || mode != 0) {
  5537. tickText.text(".0");
  5538. this._layoutLabelSize += node.getBBox().width;
  5539. }
  5540. }
  5541. if (!isHorizontal || mode != 0) {
  5542. tickText.text(".0");
  5543. var node = tickText[0][0];
  5544. var dim = node.getBBox();
  5545. this._layoutAverageDigitWidth = dim.width;
  5546. }
  5547. tick.remove();
  5548. }
  5549. if (this._hideOverlappingLabels && duration > 0) {
  5550. this.updateLabelDropping(labels, duration, delay);
  5551. }
  5552. if (duration > 0) {
  5553. this.doLabelWrappingAfterAnimation(g, labels, mode, duration, delay);
  5554. }
  5555. if (!this._displayTickLabels) {
  5556. this._layoutLabelSize = 0;
  5557. this._layoutAverageDigitWidth = 0;
  5558. }
  5559. },
  5560. /**
  5561. * Rotates the text and shifts it to compensate for the rotation Needs to be called twice once before wrapping in order to have text in correct position for wrap then after to know the correct height of wrapped text in order to shift it correct TODO: find a better way to do this
  5562. * @param (rave['internal']['Selector']) g selector
  5563. * @param (rave['internal']['Selector']) labels labels selector
  5564. * @param (int) mode one of HORIZONTAL, STAGGER, ROTATE90
  5565. */
  5566. handleLabelsRotationAndPosition : function(g, labels, mode) {
  5567. if (mode == 2 || mode == 1) {
  5568. if (this._orient == "bottom") {
  5569. this.rotateLabels(g, labels, "end", mode);
  5570. } else if (this._orient == "top") {
  5571. this.rotateLabels(g, labels, "start", mode);
  5572. } else {
  5573. this.rotateLabels(g, labels, "middle", mode);
  5574. }
  5575. } else {
  5576. if (this._orient == "bottom" || this._orient == "top") {
  5577. this.rotateLabels(g, labels, "middle", mode);
  5578. } else if (this._orient == "right") {
  5579. this.rotateLabels(g, labels, "start", mode);
  5580. } else {
  5581. this.rotateLabels(g, labels, "end", mode);
  5582. }
  5583. }
  5584. },
  5585. /**
  5586. * <p> Numeric scales cannot be truncated or wrapped, if a number doesn't fit the allowed space the number should be hashed</p> <p> ex: 12345 -> ##### </p> <p>This method should be called before {@link #this.doLabelWrapping(rave['internal']['Selector'])} , truncation must be set to off in case of numeric scale</p>
  5587. * @param (rave['internal']['Selector']) labels
  5588. */
  5589. hashingNumericScales : function(labels, extent, mode) {
  5590. if (!labels || !extent) {
  5591. return;
  5592. }
  5593. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  5594. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  5595. var tickSpace = mode == 1 ? extent[1] : extent[0];
  5596. this._textTruncationIndicator = "";
  5597. this._layoutLabelSize = 0;
  5598. for (var i = 0; i < labels.size(); ++i) {
  5599. var node = labels[i][0];
  5600. var dim = node.getBBox();
  5601. var width = dim.width;
  5602. var height = dim.height;
  5603. var size = !isHorizontal || mode == 1 ? width : height;
  5604. if (size > this._layoutLabelSize) {
  5605. this._layoutLabelSize = size;
  5606. }
  5607. if (width >= tickSpace) {
  5608. if (this._simplifiedTickFormat) {
  5609. var newText = this._simplifiedTickFormat.call(null, node.rave_getData(), 0, 0);
  5610. if (newText != null) {
  5611. node.rave_setText(newText);
  5612. }
  5613. if (node.getBBox().width >= tickSpace) {
  5614. node.rave_setText(this.stringOfSize(node.rave_getText().length, "#"));
  5615. }
  5616. } else {
  5617. node.rave_setText(this.stringOfSize(node.rave_getText().length, "#"));
  5618. }
  5619. }
  5620. }
  5621. }
  5622. },
  5623. /**
  5624. * @param (int) size The desired size of the string
  5625. * @param (String) ch The character to be repeated in the string
  5626. * @return (String) A string of the specified size containing repetition of the specified character
  5627. */
  5628. stringOfSize : function(size, ch) {
  5629. var returnString = "";
  5630. for (var i = 0; i < size; ++i) {
  5631. returnString += ch;
  5632. }
  5633. return returnString;
  5634. },
  5635. configureStaggerData : function(g, mode) {
  5636. if (mode == 3 || mode == 2) {
  5637. var horizontalDimensions = this.labelExtent(g);
  5638. var cellWidth = horizontalDimensions[0];
  5639. var axisSelector = g.selectAll("g.axis");
  5640. var labels = axisSelector.selectAll("text");
  5641. var domain = this._scale.scale().domain();
  5642. var originalDataLabelAccessor = (this._scale).originalDomainLabelAccessor();
  5643. this._staggerRotate45Nodes = [];
  5644. this._staggerFirstNode = null;
  5645. this._staggerLastNode = null;
  5646. for (var i = 0; i < labels.size(); ++i) {
  5647. var node = labels[0][i];
  5648. if (this.isValid(node.rave_getData())) {
  5649. var domainIndex = -1;
  5650. if (mode == 3) {
  5651. var domainLabel = !this._tickFormat ? node.rave_getText() : originalDataLabelAccessor.call(node, node.rave_getData(), 0, 0);
  5652. for (var index = 0; index < domain.length; ++index) {
  5653. if (domain[index].toString() == domainLabel) {
  5654. domainIndex = index;
  5655. break;
  5656. }
  5657. }
  5658. }
  5659. this._staggerRotate45Nodes.push(new com_ibm_rave_bundles_components_AxisComponentImpl.NodeIndex(node, domainIndex));
  5660. if (domainIndex == 0) {
  5661. this._staggerFirstNode = node;
  5662. }
  5663. if (domainIndex == domain.length - 1) {
  5664. this._staggerLastNode = node;
  5665. }
  5666. }
  5667. }
  5668. this._staggerCellWidth = cellWidth * 2;
  5669. this._staggerAlignFirstAtStart = this._staggerFirstNode ? this._staggerFirstNode.getBBox().width > cellWidth : false;
  5670. this._staggerAlignLastAtEnd = this._staggerLastNode ? this._staggerLastNode.getBBox().width > cellWidth : false;
  5671. }
  5672. },
  5673. getStaggerIndex : function(node) {
  5674. for (var index = 0; index < this._staggerRotate45Nodes.length; ++index) {
  5675. if (this._staggerRotate45Nodes[index].contains(node)) {
  5676. var domainIndex = this._staggerRotate45Nodes[index].getIndex();
  5677. return domainIndex == -1 ? 0 : domainIndex;
  5678. }
  5679. }
  5680. return -1;
  5681. },
  5682. getStaggerCount : function() {
  5683. var domain = this._scale.scale().domain();
  5684. return domain.length;
  5685. },
  5686. /**
  5687. * <p> The method is responsible for determining which mode to be used with the label positioning if {@link com_ibm_rave_bundles_components_AxisComponentImpl._allowAutomaticLayout} flag is enabled </p>
  5688. * @param (rave['internal']['Selector']) g
  5689. */
  5690. determineWhichAutoMode : function(g) {
  5691. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  5692. var axisSelector = g.selectAll("g.axis");
  5693. var labels = axisSelector.selectAll("text");
  5694. var dim = this.labelExtent(g);
  5695. var cellWidth = dim[0];
  5696. var cellWidth90 = dim[1];
  5697. var layoutLabelHeight = 0;
  5698. var layoutLabelWidth = 0;
  5699. var horizontalScore = 0;
  5700. var staggerScore = 0;
  5701. var rotate45Score = 0;
  5702. var rotate90Score = 0;
  5703. var validNodes = [];
  5704. for (var i = 0; i < labels.size(); ++i) {
  5705. var node = labels[0][i];
  5706. if (this.isValid(node.rave_getData())) {
  5707. validNodes.push(node);
  5708. }
  5709. }
  5710. var labelCount = validNodes.length;
  5711. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  5712. var mode = 0;
  5713. if (isHorizontal) {
  5714. mode = this._layoutMode == 1 ? 1 : 0;
  5715. var tick = axisSelector.append("g").classed("tick", true);
  5716. var tickText = tick.append("text");
  5717. tickText.style(this._labelStyle);
  5718. tickText.text(",0");
  5719. var node = tickText[0][0];
  5720. var zeroWidth = node.getBBox().width;
  5721. tick.remove();
  5722. var widestLabel = 0;
  5723. for (var i = 0; i < labelCount; ++i) {
  5724. node = validNodes[i];
  5725. var nodeRect = node.getBBox();
  5726. if (nodeRect.width > widestLabel) {
  5727. widestLabel = nodeRect.width;
  5728. }
  5729. if (nodeRect.height > this._layoutLabelHeight) {
  5730. this._layoutLabelHeight = nodeRect.height;
  5731. }
  5732. }
  5733. widestLabel += zeroWidth;
  5734. this._layoutSpillOver = mode == 1 ? this._layoutLabelHeight / 2 : widestLabel / 2 + 2;
  5735. } else {
  5736. for (var i = 0; i < labelCount; ++i) {
  5737. var node = validNodes[i];
  5738. var nodeRect = node.getBBox();
  5739. if (nodeRect.height > this._layoutLabelHeight) {
  5740. this._layoutLabelHeight = nodeRect.height;
  5741. }
  5742. }
  5743. this._layoutSpillOver = this._layoutLabelHeight / 2;
  5744. }
  5745. return mode;
  5746. }
  5747. var originalDataLabelAccessor = (this._scale).originalDomainLabelAccessor();
  5748. var staggerStringsWontMatch = this._tickFormat && !originalDataLabelAccessor;
  5749. var calcStagger = ((this._allowStagger && this._layoutMode == -1) || this._layoutMode == 3) && !staggerStringsWontMatch;
  5750. var calcRotate45 = (this._allowRotate45 && this._layoutMode == -1) || this._layoutMode == 2;
  5751. var calcRotate90 = (this._allowRotate90 && this._layoutMode == -1) || this._layoutMode == 1;
  5752. var spaceFor45Label = 0;
  5753. for (var i = 0; i < labelCount; ++i) {
  5754. var node = validNodes[i];
  5755. var nodeRect = node.getBBox();
  5756. layoutLabelHeight = nodeRect.height;
  5757. var labelWidth = nodeRect.width;
  5758. if (labelWidth > layoutLabelWidth) {
  5759. layoutLabelWidth = labelWidth;
  5760. }
  5761. horizontalScore += (labelWidth <= cellWidth ? 1 : cellWidth / labelWidth);
  5762. if (isHorizontal) {
  5763. if (calcStagger) {
  5764. var spaceForLabel = cellWidth * 2;
  5765. if (i == 0 && i == labelCount - 1) {
  5766. spaceForLabel *= 0.5;
  5767. } else if (i == 0 || i == labelCount - 1) {
  5768. spaceForLabel *= 0.75;
  5769. }
  5770. staggerScore += (labelWidth <= spaceForLabel ? 1 : spaceForLabel / labelWidth);
  5771. }
  5772. if (calcRotate45) {
  5773. if (spaceFor45Label == 0) {
  5774. spaceFor45Label = cellWidth90 / 0.7071 - layoutLabelHeight;
  5775. }
  5776. var space = this.calculate45DegreeSpace(node, spaceFor45Label);
  5777. rotate45Score += (labelWidth <= space ? 1 : space / labelWidth);
  5778. }
  5779. if (calcRotate90) {
  5780. rotate90Score += (labelWidth <= cellWidth90 ? 1 : cellWidth90 / labelWidth);
  5781. }
  5782. }
  5783. }
  5784. var mode = 0;
  5785. if (this._layoutMode == -1) {
  5786. if (isHorizontal && this._allowStagger) {
  5787. horizontalScore *= 1.1;
  5788. staggerScore *= 1.1;
  5789. }
  5790. if ((staggerScore > horizontalScore) && (staggerScore >= rotate45Score) && (staggerScore >= rotate90Score)) {
  5791. mode = 3;
  5792. } else if ((rotate45Score > horizontalScore) && (rotate45Score >= rotate90Score)) {
  5793. mode = 2;
  5794. } else if (rotate90Score > horizontalScore) {
  5795. mode = 1;
  5796. }
  5797. } else {
  5798. if ((this._layoutMode == 3 && staggerStringsWontMatch) || !isHorizontal) {
  5799. mode = 0;
  5800. } else {
  5801. mode = this._layoutMode;
  5802. }
  5803. }
  5804. if (isHorizontal) {
  5805. switch (mode) {
  5806. case 3:
  5807. this._layoutLabelSize = layoutLabelHeight * 2;
  5808. break;
  5809. case 2:
  5810. this._layoutLabelSize = (layoutLabelWidth + layoutLabelHeight) * 0.7071;
  5811. break;
  5812. case 1:
  5813. this._layoutLabelSize = layoutLabelWidth;
  5814. break;
  5815. case 0:
  5816. default:
  5817. this._layoutLabelSize = layoutLabelHeight;
  5818. break;
  5819. }
  5820. } else {
  5821. this._layoutLabelSize = layoutLabelWidth;
  5822. }
  5823. this._layoutLabelHeight = layoutLabelHeight;
  5824. return mode;
  5825. },
  5826. calculate45DegreeSpace : function(node, maxWidth) {
  5827. var width = maxWidth;
  5828. var tfm = node.rave_getParentNode().getAttribute("transform");
  5829. if (tfm != null) {
  5830. var tfmString = tfm.toString();
  5831. var indexOfTrans = tfmString.indexOf("translate(");
  5832. if (indexOfTrans != -1) {
  5833. indexOfTrans += 10;
  5834. var indexOfComma = tfmString.indexOf(",", indexOfTrans);
  5835. if (indexOfComma != -1) {
  5836. var xAmount = tfmString.substring(indexOfTrans, indexOfComma);
  5837. var xLabelPos = + (xAmount);
  5838. var width45Degrees = node.getBBox().width;
  5839. var xLabelWidth = width45Degrees * 0.7071;
  5840. var isBottom = this._orient == "bottom";
  5841. if (isBottom) {
  5842. xLabelPos -= node.getBBox().height / 4;
  5843. if (xLabelPos - xLabelWidth < this._bounds.x) {
  5844. xLabelWidth = xLabelPos - this._bounds.x;
  5845. width = xLabelWidth / 0.7071;
  5846. }
  5847. } else {
  5848. if (xLabelPos + xLabelWidth > this._bounds.x + this._bounds.width) {
  5849. xLabelWidth = (this._bounds.x + this._bounds.width) - xLabelPos;
  5850. width = xLabelWidth / 0.7071;
  5851. }
  5852. }
  5853. if (width > maxWidth) {
  5854. width = maxWidth;
  5855. }
  5856. }
  5857. }
  5858. }
  5859. return width;
  5860. },
  5861. /**
  5862. * @param (rave['internal']['Selector']) labels selector with all labels to be rotated
  5863. * @param (rave['internal']['Selector']) g The parent selector of labels
  5864. * @param (String) textAnchor The position of the anchor
  5865. * @param alignmentMode One of HORIZONTAL, STAGGER, ROTATE45, ROTATE90
  5866. */
  5867. rotateLabels : function(g, labels, textAnchor, mode) {
  5868. if (this._rotateLabels) {
  5869. var self = this;
  5870. var positioning = function(data, index, groupIndex) {
  5871. var x = 0;
  5872. var y = 0;
  5873. var rotation_cy = 0;
  5874. var isBottom = self._orient == "bottom";
  5875. if (mode == 3) {
  5876. var cellIndex = self.getStaggerIndex(this);
  5877. if (cellIndex != -1) {
  5878. if (cellIndex % 2 == 1) {
  5879. var staggerDirection = isBottom ? 1 : -1;
  5880. y += (self._layoutLabelHeight * staggerDirection);
  5881. }
  5882. if (cellIndex == 0 && self._staggerAlignFirstAtStart) {
  5883. x -= self._staggerCellWidth / 4;
  5884. } else if (cellIndex == self.getStaggerCount() - 1 && self._staggerAlignLastAtEnd) {
  5885. x += self._staggerCellWidth / 4;
  5886. }
  5887. }
  5888. } else if (mode == 2) {
  5889. if (isBottom) {
  5890. x -= self._layoutLabelHeight;
  5891. } else {
  5892. x += self._layoutLabelHeight / 2;
  5893. }
  5894. } else if (mode == 1) {
  5895. if (isBottom) {
  5896. x -= (this.getBBox().height / 2 + self._layoutLabelHeight / 4);
  5897. rotation_cy = ~~(self._padding / 4 + self._axis.tickSize());
  5898. } else {
  5899. x -= (this.getBBox().height / 2 - self._layoutLabelHeight);
  5900. rotation_cy = ~~-(self._padding / 4 + self._axis.tickSize());
  5901. }
  5902. }
  5903. var rotationDegrees = mode == 1 ? -90 : mode == 2 ? -45 : 0;
  5904. return "translate(" + x + "," + y + ") rotate(" + rotationDegrees + ",0," + rotation_cy + ")";
  5905. };
  5906. labels.attr("transform", positioning).style("text-anchor", textAnchor);
  5907. if (mode == 3) {
  5908. if (this._staggerAlignFirstAtStart) {
  5909. this._staggerFirstNode.rave_setStyle("text-anchor", "start");
  5910. }
  5911. if (this._staggerAlignLastAtEnd) {
  5912. this._staggerLastNode.rave_setStyle("text-anchor", "end");
  5913. }
  5914. }
  5915. }
  5916. },
  5917. /** @expose */
  5918. axis : function() {
  5919. return this._axis;
  5920. },
  5921. /**
  5922. * Draw the axis. The scale is non-null.
  5923. * @param (rave['internal']['Selector']) g Selector group into which the axis is drawn.
  5924. */
  5925. drawAxis : function(g) {
  5926. var axisSelector = g.selectAll("g.axis").data([0]);
  5927. axisSelector.enter().append("g").classed("axis", true).classed(this._orient, true);
  5928. if (!this._axis) {
  5929. this._axis = new rave['internal']['Axis']();
  5930. }
  5931. if (this._hideOverlappingLabels) {
  5932. this._textFlow.valignment("top").dropTextOnFail(false);
  5933. }
  5934. this._axis.ticksHandler(this._tickHandler);
  5935. this._axis.orient(this._orient);
  5936. this._axis.tickFormat(this._tickFormat);
  5937. this._axis.tickPadding(10.0);
  5938. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  5939. var labelHeight = 20.0;
  5940. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  5941. if (isHorizontal) {
  5942. labelHeight /= 0.7071;
  5943. }
  5944. var range = this._scale.scale().rangeExtent();
  5945. var extent = + (range[1]) - + (range[0]);
  5946. this._axis.ticks(extent / labelHeight);
  5947. } else {
  5948. if (this._tickMagnitude == null) {
  5949. this._axis.ticks(10.0);
  5950. } else {
  5951. this._axis.ticks.apply(this._axis, [10.0, this._scale.scale().getTickFormat(), this._tickMagnitude]);
  5952. }
  5953. }
  5954. var s = this._scale.scale();
  5955. if (this._scale.originalDomain()) {
  5956. var sOrdinal = s.copy();
  5957. sOrdinal.domain(this._scale.originalDomain());
  5958. s = sOrdinal;
  5959. var self = this;
  5960. var originalDataLabelAccessor = (self._scale).originalDomainLabelAccessor();
  5961. var tickFormatter;
  5962. if (originalDataLabelAccessor) {
  5963. if (this._tickFormat) {
  5964. tickFormatter = function(data, index, groupIndex) {
  5965. return self._tickFormat.call(this, originalDataLabelAccessor.call(this, data, index, groupIndex), index, groupIndex);
  5966. };
  5967. } else {
  5968. tickFormatter = originalDataLabelAccessor;
  5969. }
  5970. } else {
  5971. tickFormatter = this._tickFormat;
  5972. }
  5973. this._axis.tickFormat(tickFormatter);
  5974. }
  5975. this._axis.scale(s);
  5976. axisSelector.call(this._axis);
  5977. var g2 = rave.transition(axisSelector);
  5978. if (!(g2.isTransition())) {
  5979. axisSelector.selectAll("text").call(this._dropOverlap, this._hideOverlappingLabels);
  5980. }
  5981. axisSelector.selectAll("path.domain").classed("axis-line", true);
  5982. axisSelector.selectAll("g.tick line").classed("axis-tick", true);
  5983. if (this._fontChecker) {
  5984. axisSelector.selectAll("g.tick text").classed("axis-label", true).call(this._fontChecker);
  5985. } else {
  5986. axisSelector.selectAll("g.tick text").classed("axis-label", true);
  5987. }
  5988. axisSelector.call(this._axisLineProperties);
  5989. },
  5990. /**
  5991. * Draw the axis title.
  5992. * @param (rave['internal']['Selector']) g Selector group into which the title is drawn.
  5993. */
  5994. drawTitle : function(g) {
  5995. if (!this._displayAxisTitle || this._axisTitle == null || this._axisTitle.trim().length == 0 || !this._bounds) {
  5996. g.selectAll("text.axis-title." + this._orient).remove();
  5997. return;
  5998. }
  5999. var x = 0;
  6000. var y = 0;
  6001. var dy = "";
  6002. var transform;
  6003. if ("top" == this._orient) {
  6004. x = this._elementRect.x + this._elementRect.width / 2;
  6005. y = -this._bounds.height + this._padding / 4;
  6006. dy = "0.75em";
  6007. } else if ("bottom" == this._orient) {
  6008. x = this._elementRect.x + this._elementRect.width / 2;
  6009. y = this._bounds.height - this._padding / 4;
  6010. dy = "-0.25em";
  6011. } else if ("left" == this._orient) {
  6012. x = -this._elementRect.y - this._elementRect.height / 2;
  6013. y = -this._bounds.width + this._padding / 4;
  6014. dy = "0.75em";
  6015. transform = "rotate(-90)";
  6016. } else {
  6017. x = this._elementRect.y + this._elementRect.height / 2;
  6018. y = -this._bounds.width + this._padding / 4;
  6019. dy = "0.75em";
  6020. transform = "rotate(90)";
  6021. }
  6022. var fillOpacity;
  6023. {
  6024. var tmp = g.append("text").attr("class", "axis-title " + this._orient);
  6025. fillOpacity = tmp.style("fill-opacity");
  6026. tmp.remove();
  6027. } var label = g.selectAll("text.axis-title." + this._orient);
  6028. if (label.size() == 0) {
  6029. label.data([0]).enter().append("text").attr("class", "axis-title " + this._orient).style("text-anchor", "middle").attr("x", x).attr("y", y).attr("transform", transform).attr("dy", dy).style(this._titleStyle).text(this._axisTitle);
  6030. if (this._fontChecker) {
  6031. g.selectAll("text.axis-title." + this._orient).call(this._fontChecker);
  6032. }
  6033. }
  6034. com_ibm_rave_bundles_utilities_TextCrossfader.textCrossFade(rave.transition(label), label.text(), this._axisTitle, fillOpacity, 0.25).style("text-anchor", "middle").attr("x", x).attr("y", y).attr("transform", transform).attr("dy", dy).style(this._titleStyle);
  6035. },
  6036. getUnZoomedScale : function(scale) {
  6037. var s = scale.copy();
  6038. if (s.getZoomTransform()) {
  6039. s.getZoomTransform()(1, 0);
  6040. }
  6041. return s;
  6042. },
  6043. isValid : function(data) {
  6044. var s = this.getUnZoomedScale(this._axis.scale());
  6045. var v = + (s.call(null, data, 0, 0));
  6046. var range = this._axis.scale().range();
  6047. if (this._axis.scale().range().indexOf(v)> -1) {
  6048. return true;
  6049. }
  6050. if (range[0] < v && v < range[1]) {
  6051. return true;
  6052. }
  6053. if (range[0] > v && v > range[1]) {
  6054. return true;
  6055. }
  6056. return false;
  6057. },
  6058. /**
  6059. * Apply label wrapping if requested.
  6060. * @param (rave['internal']['Selector']) g
  6061. * @param (int) mode One of HORIZONTAL, STAGGER, ROTATE45, ROTATE90
  6062. */
  6063. doLabelWrapping : function(g, mode) {
  6064. if (this._displayTickLabels) {
  6065. this._textFlow.valignment("top");
  6066. if (!this._hideOverlappingLabels) {
  6067. this._textFlow.dropTextOnFail(true);
  6068. }
  6069. var d = this.labelExtent(g);
  6070. if (!d || d[0] < 0 || d[1] < 0) {
  6071. return;
  6072. }
  6073. var w = ~~ (d[0]);
  6074. var h = ~~ (d[1]);
  6075. if (mode == 2) {
  6076. w = ~~(d[1] / 0.7071 - this._layoutLabelHeight);
  6077. h = ~~(this._layoutLabelHeight / 0.7071);
  6078. } else if (mode == 1) {
  6079. var tmp = w;
  6080. w = h;
  6081. h = tmp;
  6082. }
  6083. var allowWrap = mode == 1;
  6084. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  6085. var hActual = ~~ (this._layoutLabelHeight * 1.2);
  6086. if (hActual > h) {
  6087. h = hActual;
  6088. }
  6089. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6090. if (mode == 0 && !isHorizontal) {
  6091. allowWrap = true;
  6092. }
  6093. }
  6094. var self = this;
  6095. var cellWidth = w;
  6096. var cellHeight = h;
  6097. this._textFlow.wrap(allowWrap).truncate(true).textTruncateIndicator(this._textTruncationIndicator != null ? this._textTruncationIndicator : "...").spacing(1.2).extent(function(data, index, groupIndex) {
  6098. var width = cellWidth;
  6099. var height = cellHeight;
  6100. if (mode == 2) {
  6101. var cellIndex = self.getStaggerIndex(this);
  6102. if (cellIndex != -1) {
  6103. width = ~~self.calculate45DegreeSpace(this, cellWidth);
  6104. }
  6105. } else if (mode == 3) {
  6106. var cellIndex = self.getStaggerIndex(this);
  6107. if (cellIndex != -1) {
  6108. if (cellIndex == 0 && cellIndex == self.getStaggerCount() - 1) {
  6109. width = cellWidth;
  6110. } else if (cellIndex == 0 || cellIndex == self.getStaggerCount() - 1) {
  6111. width = cellWidth * 3 / 2;
  6112. } else {
  6113. width = cellWidth * 2;
  6114. }
  6115. height = cellHeight / 2;
  6116. }
  6117. }
  6118. return [width, height];
  6119. });
  6120. g.selectAll("g.tick > text").call(this._textFlow);
  6121. }
  6122. },
  6123. /**
  6124. * <p> Get the extent of the axis label bounds. If the axis bounds are non-null they are used as the axis bounds; otherwise the scale range and AXIS_LABEL_EXTENT_CONSTANT are used as the bounds. </p> <p> If the axis scale has range bands, the label bounds are the size of the range bands in the dimension parallel to the axis and the size of the axis bounds in the other dimension. Otherwise the label bounds are the axis bounds. </p> <p> If a title with non-empty text was created, the label bounds are reduced by the title font height in the dimension perpendicular to the axis (since the title is always placed at the edge of the bounds). </p>
  6125. * @param (rave['internal']['Selector']) g Selector group for axis
  6126. * @return (Array) The extent of the axis label bounds
  6127. */
  6128. /** @expose */
  6129. labelExtent : function(g) {
  6130. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6131. var w = this._bounds.width;
  6132. var h = this._bounds.height;
  6133. if (this._scale.scale().rangeBand) {
  6134. var rangeBandValue = + (this._scale.scale().rangeBand());
  6135. if (isHorizontal) {
  6136. w = rangeBandValue;
  6137. } else {
  6138. h = rangeBandValue;
  6139. }
  6140. }
  6141. this.calcTitleExtent(g);
  6142. if (isHorizontal) {
  6143. h -= this._axis.tickSize();
  6144. h -= this._padding / 2;
  6145. if (this._layoutTitleSize != 0) {
  6146. h -= this._layoutTitleSize;
  6147. h -= this._padding / 2;
  6148. }
  6149. } else {
  6150. w -= this._axis.tickSize();
  6151. w -= this._padding / 2;
  6152. if (this._layoutTitleSize != 0) {
  6153. w -= this._layoutTitleSize;
  6154. w -= this._padding / 2;
  6155. }
  6156. }
  6157. return [w, h];
  6158. },
  6159. calcTitleExtent : function(g) {
  6160. this._layoutTitleSize = 0;
  6161. var title = g.selectAll("text.axis-title");
  6162. if (title.size() > 0) {
  6163. var textHeight = title[0][0].getBBox().height;
  6164. this._layoutTitleSize = textHeight;
  6165. }
  6166. },
  6167. /**
  6168. * Set the role to one of the constants ROLE_X1 etc. defined in AxisComponent.
  6169. * @param (String) role The new role
  6170. * @return (com.ibm.rave.bundles.components.AxisComponentImpl) This object
  6171. */
  6172. /** @expose */
  6173. setRole : function(role) {
  6174. this._role = role;
  6175. return this;
  6176. },
  6177. /**
  6178. * Set the ticks interval on the scale based on the magnitude. tickMagnitude represents power of 10. null value gives the default scale ticks.
  6179. * @param (Number) tickMagnitude
  6180. * @return (com.ibm.rave.bundles.component.AxisComponent) this
  6181. */
  6182. /** @expose */
  6183. scaleTickMagnitude : function(tickMagnitude) {
  6184. this._tickMagnitude = tickMagnitude;
  6185. return this;
  6186. },
  6187. /**
  6188. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale The new scale
  6189. */
  6190. /** @expose */
  6191. scale : function(scale) {
  6192. this._scale = scale ? scale : null;
  6193. return this;
  6194. },
  6195. /**
  6196. * Only legal values are accepted, otherwise the orient is unchanged.
  6197. * @param (String) orient The new orient
  6198. */
  6199. orient$0 : function(orient) {
  6200. if ("left" == orient || "bottom" == orient || "right" == orient || "top" == orient) {
  6201. this._orient = orient;
  6202. if (this._role == null) {
  6203. if ("left" == orient) {
  6204. this._role = "ROLE_Y1";
  6205. } else if ("bottom" == orient) {
  6206. this._role = "ROLE_X1";
  6207. } else if ("right" == orient) {
  6208. this._role = "ROLE_Y2";
  6209. } else {
  6210. this._role = "ROLE_X2";
  6211. }
  6212. }
  6213. }
  6214. return this;
  6215. },
  6216. /**
  6217. * Returns the current orientation string return The current orient
  6218. */
  6219. orient$1 : function() {
  6220. return this._orient;
  6221. },
  6222. /**
  6223. * @param (rave['internal']['RectStruct']) bounds The new bounds
  6224. */
  6225. /** @expose */
  6226. bounds : function(bounds) {
  6227. this._bounds = bounds;
  6228. return this;
  6229. },
  6230. /** @expose */
  6231. elementRect : function(elementRect) {
  6232. this._elementRect = elementRect;
  6233. return this;
  6234. },
  6235. tickFormat$0 : function(tickFormat) {
  6236. this._tickFormat = tickFormat;
  6237. return this;
  6238. },
  6239. tickFormat$1 : function() {
  6240. return this._tickFormat;
  6241. },
  6242. simplifiedTickFormat$0 : function(tickFormat) {
  6243. this._simplifiedTickFormat = tickFormat;
  6244. return this;
  6245. },
  6246. simplifiedTickFormat$1 : function() {
  6247. return this._simplifiedTickFormat;
  6248. },
  6249. /** @expose */
  6250. displayAxisTitle : function(displayAxisTitle) {
  6251. this._displayAxisTitle = displayAxisTitle;
  6252. return this;
  6253. },
  6254. /** @expose */
  6255. displayAxisLine : function(displayAxisLine) {
  6256. this._displayAxisLine = displayAxisLine;
  6257. return this;
  6258. },
  6259. /** @expose */
  6260. displayTicks : function(displayTicks) {
  6261. this._displayTicks = displayTicks;
  6262. return this;
  6263. },
  6264. /** @expose */
  6265. displayTickLabels : function(displayTickLabels) {
  6266. this._displayTickLabels = displayTickLabels;
  6267. return this;
  6268. },
  6269. /** @expose */
  6270. allowAutomaticAxisLayoutToChangeOrientation : function(state) {
  6271. this._allowAutoAxisLayoutToChangeOrientaiton = state;
  6272. return this;
  6273. },
  6274. /** @expose */
  6275. isAllowAutomaticAxisLayoutToChangeOrientation : function() {
  6276. return this._allowAutoAxisLayoutToChangeOrientaiton;
  6277. },
  6278. /** @expose */
  6279. showPanZoomTickLabels : function(showPanZoomTickLabels) {
  6280. this._showPanZoomTickLabels = showPanZoomTickLabels;
  6281. return this;
  6282. },
  6283. /** @expose */
  6284. axisTitle : function(axisTitle) {
  6285. this._axisTitle = axisTitle;
  6286. return this;
  6287. },
  6288. /** @expose */
  6289. axisColor : function(axisColor) {
  6290. this._lineColor = axisColor;
  6291. this._tickColor = axisColor;
  6292. return this;
  6293. },
  6294. /** @expose */
  6295. lineColor : function(lineColor) {
  6296. this._lineColor = lineColor;
  6297. return this;
  6298. },
  6299. /** @expose */
  6300. tickColor : function(tickColor) {
  6301. this._tickColor = tickColor;
  6302. return this;
  6303. },
  6304. /** @expose */
  6305. labelColor : function(labelColor) {
  6306. this._labelStyle["fill"] = labelColor;
  6307. return this;
  6308. },
  6309. labelStyle$0 : function(fill, fontSize, fontFamily) {
  6310. this._labelStyle["fill"] = fill;
  6311. this._labelStyle["font-size"] = fontSize;
  6312. this._labelStyle["font-family"] = fontFamily;
  6313. return this;
  6314. },
  6315. /** @expose */
  6316. titleColor : function(titleColor) {
  6317. this._titleStyle["fill"] = titleColor;
  6318. return this;
  6319. },
  6320. titleStyle$0 : function(fill, fontSize, fontFamily) {
  6321. this._titleStyle["fill"] = fill;
  6322. this._titleStyle["font-size"] = fontSize;
  6323. this._titleStyle["font-family"] = fontFamily;
  6324. return this;
  6325. },
  6326. /**
  6327. * @param (int) padding The new padding
  6328. */
  6329. /** @expose */
  6330. padding : function(padding) {
  6331. this._padding = padding;
  6332. return this;
  6333. },
  6334. /**
  6335. * @param mode LayoutMode for axis, one of: null (numeric axis), automatic, horizontal, stagger, rotate45, rotate90
  6336. */
  6337. /** @expose */
  6338. layoutMode : function(layoutMode) {
  6339. this._layoutMode = -1;
  6340. if (layoutMode != null) {
  6341. if (layoutMode == "horizontal") {
  6342. this._layoutMode = 0;
  6343. } else if (layoutMode == "stagger") {
  6344. this._layoutMode = 3;
  6345. } else if (layoutMode == "rotate45") {
  6346. this._layoutMode = 2;
  6347. } else if (layoutMode == "rotate90") {
  6348. this._layoutMode = 1;
  6349. }
  6350. }
  6351. return this;
  6352. },
  6353. /**
  6354. * @param (boolean) allow Enable Stagger to be considered in the automatic layout algorithm
  6355. */
  6356. /** @expose */
  6357. allowStagger : function(allow) {
  6358. this._allowStagger = allow;
  6359. return this;
  6360. },
  6361. /**
  6362. * @param (boolean) allow Enable Rotate 45 to be considered in the automatic layout algorithm
  6363. */
  6364. /** @expose */
  6365. allowRotate45 : function(allow) {
  6366. this._allowRotate45 = allow;
  6367. return this;
  6368. },
  6369. /**
  6370. * @param (boolean) allow Enable Rotate 90 to be considered in the automatic layout algorithm
  6371. */
  6372. /** @expose */
  6373. allowRotate90 : function(allow) {
  6374. this._allowRotate90 = allow;
  6375. return this;
  6376. },
  6377. /**
  6378. * @return (boolean) True if on the last call the axis rendered shapes, false otherwise
  6379. */
  6380. renderedShapes : function() {
  6381. return this._renderedShapes;
  6382. },
  6383. labelStyle$1 : function(fontStyle) {
  6384. this._labelStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  6385. return this;
  6386. },
  6387. titleStyle$1 : function(fontStyle) {
  6388. this._titleStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  6389. return this;
  6390. },
  6391. /**
  6392. * Determines whether the axis is swapped.
  6393. * @return (boolean) True if axis is swapped
  6394. */
  6395. isAxisSwapped : function() {
  6396. return (((this._role == "ROLE_Y1" || this._role == "ROLE_Y2") && (this._orient == "top" || this._orient == "bottom")) || ((this._role == "ROLE_X1" || this._role == "ROLE_X2") && (this._orient == "right" || this._orient == "left")));
  6397. },
  6398. /**
  6399. * <p> Set the indicator to be used for truncated text </p> <p> ex: indicator set to "..." , results in helloworld - > hello... </p> <p> If the indicator is not set the default indicator "..." is used </p>
  6400. * @param (String) indicator the string to be placed to indicated truncated text
  6401. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  6402. */
  6403. /** @expose */
  6404. textTruncateIndicator : function(indicator) {
  6405. this._textTruncationIndicator = indicator;
  6406. return this;
  6407. },
  6408. /**
  6409. * If at least one label collision request is pending we stop the label collision component, and shut down the label collision timer event.
  6410. */
  6411. stopLabelDroppingUpdate : function() {
  6412. this._pendingLabelTimer = false;
  6413. },
  6414. /**
  6415. * Start Rave timers with a delay of half the transition duration and the full transition duration. This will fire the label dropping at the halfway mark and at the end.
  6416. * @param (rave['internal']['Selector']) labels the selection of valid labels for the end of the transition
  6417. * @param (double) duration of the transition. If 0, we don't do anything.
  6418. * @param (double) delay of the transition. Added to the duration to delay the updates.
  6419. */
  6420. updateLabelDropping : function(labels, duration, delay) {
  6421. var self = this;
  6422. var start = delay + duration;
  6423. var labelCollideCallback = function(elapsed) {
  6424. if (!self._pendingLabelTimer) {
  6425. return true;
  6426. }
  6427. labels.call(self._dropOverlap, self._hideOverlappingLabels);
  6428. if (elapsed >= start) {
  6429. self._pendingLabelTimer = false;
  6430. return true;
  6431. }
  6432. return false;
  6433. };
  6434. if (duration > 0) {
  6435. this._pendingLabelTimer = true;
  6436. rave.timer(labelCollideCallback, start);
  6437. }
  6438. },
  6439. doLabelWrappingAfterAnimation : function(g, labels, mode, duration, delay) {
  6440. this._layoutTimerId++;
  6441. var timerId = this._layoutTimerId;
  6442. var self = this;
  6443. var wrapCallback = function(elapsed) {
  6444. if (self._layoutTimerId == timerId) {
  6445. self.doLabelWrapping(g, mode);
  6446. self.handleLabelsRotationAndPosition(g, labels, mode);
  6447. }
  6448. return true;
  6449. };
  6450. rave.timer(wrapCallback, delay + duration);
  6451. },
  6452. /** @expose */
  6453. preLayout : function() {
  6454. this._layoutTitleSize = 0;
  6455. this._layoutLabelSize = 0;
  6456. this._layoutLabelHeight = 0;
  6457. this._layoutAverageDigitWidth = 0;
  6458. this._layoutSpillOver = 0;
  6459. },
  6460. /** @expose */
  6461. getSizableType : function() {
  6462. return this._scale.isOrdinal() || this._scale.isClustered() ? 1 : 0;
  6463. },
  6464. /** @expose */
  6465. getSizableOrientation : function() {
  6466. return this._orient;
  6467. },
  6468. /** @expose */
  6469. getPreferredSize : function() {
  6470. var layoutPaddingSize = 0;
  6471. if (this._axis) {
  6472. layoutPaddingSize = this._axis.tickSize();
  6473. if (this._layoutLabelSize != 0) {
  6474. layoutPaddingSize += this._padding / 2;
  6475. }
  6476. if (this._layoutTitleSize != 0) {
  6477. layoutPaddingSize += this._padding / 2;
  6478. }
  6479. }
  6480. return this._layoutLabelSize + this._layoutAverageDigitWidth + this._layoutTitleSize + layoutPaddingSize + 2;
  6481. },
  6482. /** @expose */
  6483. getSpillOverSize : function() {
  6484. return this._layoutSpillOver;
  6485. },
  6486. /** @expose */
  6487. orient : function(a0) {
  6488. var args = arguments;
  6489. if (args.length == 0) {
  6490. return this.orient$1();
  6491. }
  6492. return this.orient$0(a0);
  6493. },
  6494. /** @expose */
  6495. tickFormat : function(a0) {
  6496. var args = arguments;
  6497. if (args.length == 0) {
  6498. return this.tickFormat$1();
  6499. }
  6500. return this.tickFormat$0(a0);
  6501. },
  6502. /** @expose */
  6503. simplifiedTickFormat : function(a0) {
  6504. var args = arguments;
  6505. if (args.length == 0) {
  6506. return this.simplifiedTickFormat$1();
  6507. }
  6508. return this.simplifiedTickFormat$0(a0);
  6509. },
  6510. /** @expose */
  6511. labelStyle : function(a0, a1, a2) {
  6512. var args = arguments;
  6513. if (args.length == 1) {
  6514. return this.labelStyle$1(a0);
  6515. }
  6516. return this.labelStyle$0(a0, a1, a2);
  6517. },
  6518. /** @expose */
  6519. titleStyle : function(a0, a1, a2) {
  6520. var args = arguments;
  6521. if (args.length == 1) {
  6522. return this.titleStyle$1(a0);
  6523. }
  6524. return this.titleStyle$0(a0, a1, a2);
  6525. }
  6526. });
  6527. /**
  6528. * Given the bounds for the axis and the orientation, return the [x,y] translation for the group containing the axis. These are the usual settings for d3 (RAVE core) axes, where the axis range (pixels) is in the global coordinates, then the axis is moved perpendicular to that to place it next to the chart.
  6529. * @param (rave['internal']['RectStruct']) bounds Rectangle of the axis bounds
  6530. * @param (String) orient Orient, "top", "bottom", "left", "right"; if not valid, "bottom" used
  6531. * @return (double[]) Translation [x,y]
  6532. */
  6533. /** @expose */
  6534. com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation = function(bounds, orient) {
  6535. if ("left" == orient) {
  6536. return [bounds.x + bounds.width, 0.0];
  6537. }
  6538. if ("right" == orient) {
  6539. return [bounds.x, 0.0];
  6540. }
  6541. if ("top" == orient) {
  6542. return [0.0, bounds.y + bounds.height];
  6543. }
  6544. return [0.0, bounds.y];
  6545. };
  6546. com_ibm_rave_bundles_components_AxisComponentImpl.NodeIndex = rave['internal']['Declare']({
  6547. //_node : null,
  6548. _domainIndex : 0,
  6549. /** @expose */
  6550. constructor : function(node, domainIndex) {
  6551. this._node = node;
  6552. this._domainIndex = domainIndex;
  6553. },
  6554. /** @expose */
  6555. contains : function(node) {
  6556. return node == this._node;
  6557. },
  6558. /** @expose */
  6559. getIndex : function() {
  6560. return this._domainIndex;
  6561. }
  6562. });
  6563. /**
  6564. * Tick Handler for the axis. This will get called as the core axis is transitioned.
  6565. */
  6566. com_ibm_rave_bundles_components_AxisComponentImpl.AxisTickHandler = rave['internal']['Declare'](rave['internal']['AbstractTickHandler'], {
  6567. //_label : null,
  6568. //_tick : null,
  6569. _$functionClassMethod : function() {
  6570. var _$self = function(args) {
  6571. if (args !== null || arguments.length > 1){
  6572. args = Array.prototype.slice.call(arguments, 0);
  6573. }
  6574. {
  6575. _$self.handle(args[0]);
  6576. return null;
  6577. }
  6578. };
  6579. return _$self;
  6580. },
  6581. constructor : function(label, tick) {
  6582. this._label = label;
  6583. this._tick = tick;
  6584. },
  6585. /** @expose */
  6586. handle : function(ticks) {
  6587. ticks.call(this._tick);
  6588. ticks.call(this._label);
  6589. }
  6590. });
  6591. //com_ibm_rave_bundles_components_AxisComponentImpl.VISIBILITY = "visibility";
  6592. //com_ibm_rave_bundles_components_AxisComponentImpl.HIDDEN = "hidden";
  6593. /** @expose */
  6594. com_ibm_rave_bundles_components_AxisComponentImpl.LABEL_HIDDEN_FLAG = "__tickLabelHidden__";
  6595. /** @expose */
  6596. com_ibm_rave_bundles_components_AxisComponentImpl.PANZOOM_HIDDEN_FLAG = "__panZoomHidden__";
  6597. /** @expose */
  6598. com_ibm_rave_bundles_components_AxisComponentImpl.HIDDEN_COUNT = "__hiddenCount__";
  6599. /** @expose */
  6600. com_ibm_rave_bundles_components_AxisComponentImpl.PREFERRED_SPACE_PER_TICK = 20;
  6601. /** @expose */
  6602. com_ibm_rave_bundles_components_AxisComponentImpl.PREFERRED_TICK_COUNT = 10;
  6603. /** @expose */
  6604. com_ibm_rave_bundles_components_AxisComponentImpl.TICK_PADDING = 10;
  6605. //com_ibm_rave_bundles_components_AxisComponentImpl.HORIZONTAL_WEIGHT = 1.1;
  6606. com_ibm_rave_bundles_components_AxisComponentImpl.HORIZONTAL = 0;
  6607. com_ibm_rave_bundles_components_AxisComponentImpl.ROTATE90 = 1;
  6608. com_ibm_rave_bundles_components_AxisComponentImpl.ROTATE45 = 2;
  6609. com_ibm_rave_bundles_components_AxisComponentImpl.STAGGER = 3;
  6610. /**
  6611. * Constant used for text flow spacing
  6612. */
  6613. com_ibm_rave_bundles_components_AxisComponentImpl.TEXTFLOW_SPACING = 1.2;
  6614. /**
  6615. * Bottom axis orientation string.
  6616. */
  6617. /** @expose */
  6618. com_ibm_rave_bundles_components_AxisComponentImpl.BOTTOM_ORIENTATION = "bottom";
  6619. /**
  6620. * Top axis orientation string.
  6621. */
  6622. /** @expose */
  6623. com_ibm_rave_bundles_components_AxisComponentImpl.TOP_ORIENTATION = "top";
  6624. /**
  6625. * Left axis orientation string.
  6626. */
  6627. /** @expose */
  6628. com_ibm_rave_bundles_components_AxisComponentImpl.LEFT_ORIENTATION = "left";
  6629. /**
  6630. * Right axis orientation string.
  6631. */
  6632. /** @expose */
  6633. com_ibm_rave_bundles_components_AxisComponentImpl.RIGHT_ORIENTATION = "right";
  6634. com_ibm_rave_bundles_components_AxisComponentImpl.AUTOMODE = -1;
  6635. // $source: com/ibm/rave/bundles/components/GridComponentImpl
  6636. /************************************************************************
  6637. ** IBM Confidential
  6638. **
  6639. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6640. **
  6641. ** (C) Copyright IBM Corp. 2017
  6642. **
  6643. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6644. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6645. ************************************************************************/
  6646. // GENERATED
  6647. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  6648. //@import com/ibm/rave/bundles/components/StyleStructs (runtime) // new
  6649. //@import com/ibm/rave/bundles/component/GridComponent (runtime) // GridComponent
  6650. /**
  6651. * <p> Component to draw gridlines for an axis. The component is drawn into a Selector group, and the user of the component must translate the group to the axis position. Gridlines are created using the axis, setting the tick size to the dimension of the gridline space. For correct behavior the gridline component should be called after the axis has been called. </p> <p> The properties are: </p> <p> <b>axis</b>: The axis to use. If null, no gridlines are drawn. Default null. </p> <p> <b>orient</b>: The axis orientation, one of "top", "bottom", "left", "right". Default "bottom". </p> <p> <b>bounds</b>: A rectangle bounding the gridline area, used to find the line length. If null, no gridlines are drawn. Default null. </p> <p> <b>displayGridlines</b>: Whether to draw the gridlines. Default false. </p> <p> <b>gridlineColor</b>: A color-string for the grid lines. If null, no color is applied and the CSS defaults are used. Default null. </p>
  6652. */
  6653. var com_ibm_rave_bundles_components_GridComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  6654. /**
  6655. * The axis property
  6656. */
  6657. //_axis : null,
  6658. /**
  6659. * Role, from the AxisComponent API
  6660. */
  6661. //_role : null,
  6662. /**
  6663. * The orientation
  6664. */
  6665. //_orient : null,
  6666. /**
  6667. * The bounds
  6668. */
  6669. //_bounds : null,
  6670. /**
  6671. * Style of gridlines
  6672. */
  6673. //_gridlineStyle : null,
  6674. /**
  6675. * Whether to display gridlines
  6676. */
  6677. _displayGridlines : false,
  6678. /**
  6679. * After calling the component, this is true if shapes were rendered, false if they were cleared.
  6680. */
  6681. _renderedShapes : false,
  6682. /**
  6683. * Construct, with all properties the defaults.
  6684. */
  6685. /** @expose */
  6686. constructor : function() {
  6687. this._axis = null;
  6688. this._role = null;
  6689. this._orient = "bottom";
  6690. this._bounds = null;
  6691. this._displayGridlines = true;
  6692. this._gridlineStyle = new com_ibm_rave_bundles_components_StyleStructs.LineStyle();
  6693. this._renderedShapes = false;
  6694. },
  6695. /** @expose */
  6696. type : function() {
  6697. return com_ibm_rave_bundles_component_GridComponent.COMPONENT_TYPE;
  6698. },
  6699. /** @expose */
  6700. role : function() {
  6701. return this._role;
  6702. },
  6703. /** @expose */
  6704. execute : function(g) {
  6705. this.preExecute();
  6706. if (!this._displayGridlines || !this._axis || !this._bounds) {
  6707. g.selectAll("*").remove();
  6708. this._renderedShapes = false;
  6709. return;
  6710. }
  6711. this._renderedShapes = true;
  6712. var size = ("bottom" == this._orient || "top" == this._orient) ? this._bounds.height : this._bounds.width;
  6713. var ticksHandler = this._axis.ticksHandler();
  6714. var tickSize = this._axis.tickSize();
  6715. var outerTickSize = this._axis.outerTickSize();
  6716. var tickFormat = this._axis.tickFormat();
  6717. var ax = this._axis.tickSize(-size, 0).tickFormat("").ticksHandler(null);
  6718. g.call(ax);
  6719. this._axis.tickSize(tickSize, outerTickSize).tickFormat(tickFormat).ticksHandler(ticksHandler);
  6720. g.selectAll("g.tick line").classed("grid-tick", true);
  6721. g.selectAll(".grid-tick").style("stroke", this._gridlineStyle._stroke).style("stroke-dasharray", (this._gridlineStyle._dashArray));
  6722. g.selectAll("path.domain").remove();
  6723. },
  6724. /**
  6725. * @param (rave['internal']['Axis']) axis The new axis
  6726. */
  6727. /** @expose */
  6728. axis : function(axis) {
  6729. this._axis = axis;
  6730. return this;
  6731. },
  6732. /**
  6733. * Set the role to one of the constants ROLE_X1 etc. defined in AxisComponent.
  6734. * @param (String) role The new role
  6735. * @return (com.ibm.rave.bundles.components.GridComponentImpl) This object
  6736. */
  6737. /** @expose */
  6738. setRole : function(role) {
  6739. this._role = role;
  6740. return this;
  6741. },
  6742. /**
  6743. * Only legal values are accepted, otherwise the orient is unchanged.
  6744. * @param (String) orient The new orient
  6745. */
  6746. orient$0 : function(orient) {
  6747. if ("left" == orient || "right" == orient || "bottom" == orient || "top" == orient) {
  6748. this._orient = orient;
  6749. }
  6750. return this;
  6751. },
  6752. /**
  6753. * @param (rave['internal']['RectStruct']) bounds The new bounds
  6754. */
  6755. /** @expose */
  6756. bounds : function(bounds) {
  6757. this._bounds = bounds;
  6758. return this;
  6759. },
  6760. displayGridlines$0 : function(displayGridlines) {
  6761. this._displayGridlines = displayGridlines;
  6762. return this;
  6763. },
  6764. /** @expose */
  6765. gridlineStyle : function(gridlineColor, dashArray) {
  6766. this.gridlineColor(gridlineColor);
  6767. this.dashArray(dashArray);
  6768. return this;
  6769. },
  6770. gridlineColor$0 : function(gridlineColor) {
  6771. this._gridlineStyle._stroke = (gridlineColor != null && gridlineColor.length > 0) ? gridlineColor : null;
  6772. return this;
  6773. },
  6774. dashArray$0 : function(dashArray) {
  6775. this._gridlineStyle._dashArray = (dashArray != null && dashArray.length > 0) ? dashArray : null;
  6776. return this;
  6777. },
  6778. /**
  6779. * @return (String) The orientation of the gridline.
  6780. */
  6781. orient$1 : function() {
  6782. return this._orient;
  6783. },
  6784. displayGridlines$1 : function() {
  6785. return this._displayGridlines;
  6786. },
  6787. gridlineColor$1 : function() {
  6788. return this._gridlineStyle._stroke;
  6789. },
  6790. dashArray$1 : function() {
  6791. return this._gridlineStyle._dashArray;
  6792. },
  6793. /**
  6794. * @return (boolean) True if on the last call the axis rendered shapes, false otherwise
  6795. */
  6796. renderedShapes : function() {
  6797. return this._renderedShapes;
  6798. },
  6799. /** @expose */
  6800. orient : function(a0) {
  6801. var args = arguments;
  6802. if (args.length == 0) {
  6803. return this.orient$1();
  6804. }
  6805. return this.orient$0(a0);
  6806. },
  6807. /** @expose */
  6808. displayGridlines : function(a0) {
  6809. var args = arguments;
  6810. if (args.length == 0) {
  6811. return this.displayGridlines$1();
  6812. }
  6813. return this.displayGridlines$0(a0);
  6814. },
  6815. /** @expose */
  6816. gridlineColor : function(a0) {
  6817. var args = arguments;
  6818. if (args.length == 0) {
  6819. return this.gridlineColor$1();
  6820. }
  6821. return this.gridlineColor$0(a0);
  6822. },
  6823. /** @expose */
  6824. dashArray : function(a0) {
  6825. var args = arguments;
  6826. if (args.length == 0) {
  6827. return this.dashArray$1();
  6828. }
  6829. return this.dashArray$0(a0);
  6830. }
  6831. });
  6832. // $source: com/ibm/rave/bundles/components/KeyedBundleComponentImpl
  6833. /************************************************************************
  6834. ** IBM Confidential
  6835. **
  6836. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6837. **
  6838. ** (C) Copyright IBM Corp. 2017
  6839. **
  6840. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6841. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6842. ************************************************************************/
  6843. // GENERATED
  6844. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  6845. /**
  6846. * This type of component generates scene nodes based on a provided data set. Accordingly, any component deriving from this class can (and should) make use of this class's <em>key function</em>. Typically this key function will be passed to the second argument of {@link this.Selector#this.data(, rave['internal']['ValueFunction'])} method in Rave Core, when joining data to scene nodes. For more information on how key functions are used, see the documentation for {@link this.Selector#this.data(, rave['internal']['ValueFunction'])} in Rave Core.
  6847. * @param < (com.ibm.rave.bundles.components.KeyedBundleComponentImpl) T > Any class that extends this component type must have a self reference in order to support method chaining of the {@link this.KeyedBundleComponentImpl#this.key(rave['internal']['SingleValueFunction'])} method. For example: <pre> public class MyComponent extends DataBasedBundleComponent<MyComponent> { ... ... MyComponent c = new MyComponent(); c.someSetter(arg) .key(keyFunction) // returns the MyComponent instance, rather than a DataBasedBundleComponent instance. .otherSetter(arg2); </pre>
  6848. */
  6849. var com_ibm_rave_bundles_components_KeyedBundleComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  6850. //keyFunction : null,
  6851. /**
  6852. * Set the key function this component should use when joining data to scene nodes.
  6853. * @param (rave['internal']['SingleValueFunction']) keyFunction This function will be passed each datum individually and must return a unique value (a key).
  6854. * @return (com.ibm.rave.bundles.components.KeyedBundleComponentImpl) This.
  6855. */
  6856. /** @expose */
  6857. key : function(keyFunction) {
  6858. this.keyFunction = keyFunction;
  6859. return this;
  6860. },
  6861. /**
  6862. * Returns a {@link (rave['internal']['ValueFunction']) ValueFunction} that wraps the provided key function.
  6863. */
  6864. /** @expose */
  6865. getKey : function() {
  6866. if (!this.keyFunction) {
  6867. return null;
  6868. }
  6869. var self = this;
  6870. return function(datum, index, groupIndex) {
  6871. return self.keyFunction(datum);
  6872. };
  6873. }
  6874. });
  6875. // $source: com/ibm/rave/bundles/components/MapComponentImpl
  6876. /************************************************************************
  6877. ** IBM Confidential
  6878. **
  6879. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6880. **
  6881. ** (C) Copyright IBM Corp. 2017
  6882. **
  6883. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6884. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6885. ************************************************************************/
  6886. // GENERATED
  6887. //@import com/ibm/rave/bundles/components/KeyedBundleComponentImpl (loadtime) // superclass
  6888. /**
  6889. * <p> A component to draw map charts. The component puts its shapes into the selector passed to its execute method. </p>
  6890. */
  6891. var com_ibm_rave_bundles_components_MapComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_KeyedBundleComponentImpl, {
  6892. /**
  6893. * Div that accepts the Map chart
  6894. */
  6895. //_chart : null,
  6896. /**
  6897. * Describes the path of the data field in the GeoJSON used as the feature id, in dot separated values
  6898. */
  6899. //_geoJSONfeatureIdLookup : null,
  6900. /**
  6901. * Array of Strings extracted from the _geoJSONfeatureIdLookup.
  6902. */
  6903. //_featureIdFieldArray : null,
  6904. /**
  6905. * Translation for the map projection
  6906. */
  6907. //_translation : null,
  6908. //_geoJSONObject : null,
  6909. /**
  6910. * Rectangle for the drawing bounds
  6911. */
  6912. //_bounds : null,
  6913. /**
  6914. * Label formatter, may be null
  6915. */
  6916. //_labelFormatter : null,
  6917. /**
  6918. * Projection type from properties
  6919. */
  6920. //_projectionType : null,
  6921. /**
  6922. * Handle label collisions method, move overlapping labels vs drop overlapping
  6923. */
  6924. //_handleLabelCollisions : null,
  6925. //_labelPositioning : null,
  6926. //_labelDropper : null,
  6927. //_projection : null,
  6928. //_zoomExtent : null,
  6929. //_borderWidth : null,
  6930. //_borderColor : null,
  6931. //_bubbleBorderWidth : null,
  6932. //_bubbleBorderColor : null,
  6933. //_regionsAndBubblesData : null,
  6934. //_featureId : null,
  6935. //_bubbleColor : null,
  6936. //_bubbleSize : null,
  6937. //_featureLbl : null,
  6938. //_bubbleScale : null,
  6939. //_bubblePalette : null,
  6940. //_regionPalette : null,
  6941. //_nullColor : null,
  6942. //_centroidCache : null,
  6943. //_coordinateCache : null,
  6944. //_mapPan : null,
  6945. //_regionFillCache : null,
  6946. //_darkCache : null,
  6947. //_cachedPathGenerator : null,
  6948. //_regionAnimationDuration : null,
  6949. //_bubbleAnimationDuration : null,
  6950. //_flashDuration : null,
  6951. //_flash : null,
  6952. //_regionAnimationNeeded : null,
  6953. /**
  6954. * Regions with data change. Not every region in update() has a data change. Only when the its bubbleSize value is different is the region marked as data changed. If the bubble size grows from 0 to a valid value, it mean the bubble enters the map for the first time. According to design, new region doesn't flash. Therefore we decide: if dataChangedRegions(key)==0, it is a new region that doesn't flash; if dataChangedRegions(key) >0, it is a region with data change and will flash.
  6955. */
  6956. //dataChangedRegions : null,
  6957. //_features : null,
  6958. //_dataMap : null,
  6959. //bubbleLabelRegionSelector : null,
  6960. //textBBoxCache : null,
  6961. //_regionAnimationEnabled : null,
  6962. //_bubbleAnimationEnabled : null,
  6963. /**
  6964. * Map scale
  6965. */
  6966. _scale : 0,
  6967. /**
  6968. * the initial scale of the map
  6969. */
  6970. _minScale : 0,
  6971. /**
  6972. * Show labels if true
  6973. */
  6974. _featureLabel : false,
  6975. /**
  6976. * Allows us to check whether this setting has changed
  6977. */
  6978. _prevFeatureLabel : false,
  6979. /**
  6980. * True only for AlbersUSA. If false, we can center the map
  6981. */
  6982. _isAlbersUsa : false,
  6983. _dropLabels : false,
  6984. _rotationLongitude : 0.0,
  6985. _rotationLatitude : 0.0,
  6986. _projectionChanged : true,
  6987. _boundsChanged : true,
  6988. _dataChanged : true,
  6989. _baseScale : 0,
  6990. _panZoom : false,
  6991. _panY : false,
  6992. _panX : false,
  6993. _defaultPanZoom : false,
  6994. _defaultBubbleSize : 0,
  6995. LABEL_PADDING : 2,
  6996. constructor : function() {
  6997. this._centroidCache = {};
  6998. this._coordinateCache = {};
  6999. {
  7000. this._scale = NaN;
  7001. this._prevFeatureLabel = this._featureLabel = true;
  7002. this._isAlbersUsa = false;
  7003. this._regionFillCache = rave['internal']['ES6Map'].create();
  7004. this._darkCache = rave['internal']['ES6Map'].create();
  7005. this._labelDropper = (rave.capabilities.extension("position")).drop();
  7006. this._mapPan = [];
  7007. this._mapPan[0] = this._mapPan[1] = 0;
  7008. this._translation = [0, 0];
  7009. this._regionAnimationNeeded = true;
  7010. this._borderWidth = null;
  7011. this._borderColor = null;
  7012. this._bubbleBorderWidth = null;
  7013. this._bubbleBorderColor = null;
  7014. }
  7015. },
  7016. /** @expose */
  7017. is_defaultPanZoom : function() {
  7018. return this._defaultPanZoom;
  7019. },
  7020. /** @expose */
  7021. is_GraphicalPan : function() {
  7022. return this._panZoom;
  7023. },
  7024. panX$0 : function() {
  7025. return this._panX;
  7026. },
  7027. panY$0 : function() {
  7028. return this._panY;
  7029. },
  7030. baseScale$0 : function() {
  7031. return this._baseScale;
  7032. },
  7033. baseScale$1 : function(bScale) {
  7034. var _bScale = bScale;
  7035. if (_bScale < 0) {
  7036. _bScale = 0;
  7037. }
  7038. this._baseScale = _bScale;
  7039. this.projectionChanged(true);
  7040. },
  7041. /** @expose */
  7042. type : function() {
  7043. return com_ibm_rave_bundles_components_MapComponentImpl.MAP_COMPONENT;
  7044. },
  7045. /** @expose */
  7046. execute : function(g) {
  7047. this._chart = g;
  7048. if (this._dataChanged || this._projectionChanged || this._boundsChanged || isNaN(this._scale)) {
  7049. this._mapPan[0] = this._mapPan[1] = 0;
  7050. this.textBBoxCache = {};
  7051. this._coordinateCache = {};
  7052. this._featureIdFieldArray = this._geoJSONfeatureIdLookup.split(new RegExp("\\."));
  7053. this._dataMap = this.prepareData(((this._geoJSONObject["features"])));
  7054. this.dataChangedRegions = rave['internal']['ES6Map'].create();
  7055. this._bubbleAnimationDuration = this._bubbleAnimationEnabled ? this._bubbleAnimationDuration : 0;
  7056. this._regionAnimationDuration = this._regionAnimationEnabled ? this._regionAnimationDuration : 0;
  7057. this.addFeatures();
  7058. this.removeFeatures();
  7059. this._projection = this.centerProjection();
  7060. this._chart.attr("transform", "translate(0, 0)");
  7061. this.recalculateCentroidsOnAction();
  7062. }
  7063. this.updateFeatures();
  7064. this._regionAnimationNeeded = true;
  7065. this.projectionChanged(false);
  7066. this._boundsChanged = false;
  7067. this._dataChanged = false;
  7068. },
  7069. /**
  7070. * If no scale is set, we automatically center and scale the map so that it fits properly in the view window. Otherwise we use the existing scale and translation (which may be set via properties or by pan/zoom). Note that if we have loaded multiple GeoJSONs, we always focus on the one associated with the data.
  7071. */
  7072. centerProjection : function() {
  7073. var center = rave.geo.centroid(this._geoJSONObject);
  7074. this._projection = this.createProjection();
  7075. if (isNaN(this._scale)) {
  7076. this._projection.scale(1.0).translate([0.0, 0.0]);
  7077. if (!this._isAlbersUsa) {
  7078. this._projection.center([center[0], center[1]]);
  7079. }
  7080. var pathGen = rave.geo.path().projection(this._projection);
  7081. this._cachedPathGenerator = pathGen;
  7082. var geoBounds = pathGen.bounds(this._geoJSONObject);
  7083. var geoWidth = Math.abs(geoBounds[1][0] - geoBounds[0][0]);
  7084. var geoHeight = Math.abs(geoBounds[1][1] - geoBounds[0][1]);
  7085. this._scale = 0.95 / Math.max(geoWidth / this._bounds.width, geoHeight / this._bounds.height);
  7086. this._translation[0] = this._bounds.x + (this._bounds.width - this._scale * (geoBounds[1][0] + geoBounds[0][0])) / 2;
  7087. this._translation[1] = this._bounds.y + (this._bounds.height - this._scale * (geoBounds[1][1] + geoBounds[0][1])) / 2;
  7088. }
  7089. this._projection.scale(this._scale).translate([this._translation[0], this._translation[1]]);
  7090. if (!this._isAlbersUsa) {
  7091. this._projection.center([center[0], center[1]]);
  7092. }
  7093. this._zoomExtent[1] = this._zoomExtent[1] * this._scale;
  7094. this._zoomExtent[0] = this._zoomExtent[0] * this._scale;
  7095. this._minScale = this._baseScale = this._scale;
  7096. return this._projection;
  7097. },
  7098. addFeatures : function() {
  7099. var self = this;
  7100. this._features = this._chart.selectAll("g.element-shape").data(((this._geoJSONObject["features"])));
  7101. this._features.enter().append("g").attr("class", function(data, index, groupIndex) {
  7102. var classes = "element-shape ";
  7103. var featureId = self.findGeoJSONId(data);
  7104. classes += self.classFromFeatureId(featureId);
  7105. return classes;
  7106. }).append("path").attr("class", "element-shape-path").style("opacity", 0);
  7107. this.bubbleLabelRegionSelector = this._chart.selectAll(".region").data(this._dataMap.values(), function(data, index, groupIndex) {
  7108. return self._featureId(data);
  7109. });
  7110. var gEnter = this.bubbleLabelRegionSelector.enter().append("g").attr("class", "region");
  7111. gEnter.append("circle").attr("cx", 0).attr("cy", 0).attr("r", 0).attr("class", function(data, index, groupIndex) {
  7112. var featureId = ""+(self._featureId(data));
  7113. self.dataChangedRegions.set(featureId, 0.0);
  7114. return "bubble " + self.classFromFeatureId(featureId);
  7115. });
  7116. if (this._featureLabel) {
  7117. this.createLabels(gEnter);
  7118. }
  7119. var paths = this._features.select("path");
  7120. var count = [];
  7121. count[0] = paths.size();
  7122. var animationDuration = this._regionAnimationNeeded ? this._regionAnimationDuration : 0;
  7123. paths.transition("Path_Elements").duration(animationDuration).style("opacity", 1).each("end", function(args) {
  7124. if (args !== null || arguments.length > 1){
  7125. args = Array.prototype.slice.call(arguments, 0);
  7126. }
  7127. {
  7128. count[0] = count[0] - 1;
  7129. if (count[0] == 0) {
  7130. if (self._flash && self._flashDuration > 0) {
  7131. self.flashRegionsAndBubble();
  7132. }
  7133. }
  7134. return null;
  7135. }
  7136. });
  7137. this._features.select("path").classed("flash", false).attr("fill", function(data, index, groupIndex) {
  7138. var featureId = self.findGeoJSONId(this.rave_getParentNode().rave_getData());
  7139. var d = self._dataMap.get(featureId);
  7140. if (d != null) {
  7141. return self._regionPalette.call(this, d, index, groupIndex);
  7142. }
  7143. return self._nullColor;
  7144. }).style("stroke", this._borderColor).style("stroke-width", this._borderWidth);
  7145. this.bubbleLabelRegionSelector.select("circle").classed("flash", false).attr("fill", function(data, index, groupIndex) {
  7146. return (!self._bubblePalette) ? null : self._bubblePalette.call(this, data, index, groupIndex);
  7147. }).style("stroke", this._bubbleBorderColor).style("stroke-width", this._bubbleBorderWidth).transition("BUBBLES_TRANSITION").duration(this._bubbleAnimationDuration).ease("bounce").attr("r", function(data, index, groupIndex) {
  7148. var result = self.getFinalRadius(data);
  7149. var featureId = ""+(self._featureId(data));
  7150. if (self.dataChangedRegions.has(featureId) && self.dataChangedRegions.get(featureId) == 0) {
  7151. return result;
  7152. }
  7153. if (+ ((this).getAttribute("r")) != result) {
  7154. if (!(self.dataChangedRegions.has(featureId))) {
  7155. self.dataChangedRegions.set(featureId, result);
  7156. }
  7157. }
  7158. return result;
  7159. });
  7160. },
  7161. createLabels : function(bubbleSelector) {
  7162. var self = this;
  7163. var labelText;
  7164. if (this._featureLbl) {
  7165. labelText = !this._labelFormatter ? function(data, index, groupIndex) {
  7166. return self._featureLbl(data);
  7167. } : function(data, index, groupIndex) {
  7168. var v = self._featureLbl(data);
  7169. return v == null ? null : self._labelFormatter.call(this, v, index, groupIndex);
  7170. };
  7171. }
  7172. bubbleSelector.append("text").attr("x", "0").attr("y", "0").text(labelText).attr("class", function(data, index, groupIndex) {
  7173. var featureId = ""+(self._featureId(data));
  7174. var c = "label " + self.classFromFeatureId(featureId);
  7175. c += self.isDarkBackground(featureId) ? " light-label" : " dark-label";
  7176. return c;
  7177. }).style("opacity", 0);
  7178. },
  7179. updateFeatures : function() {
  7180. var pathGenerator;
  7181. if (this._cachedPathGenerator) {
  7182. pathGenerator = this._cachedPathGenerator;
  7183. } else {
  7184. pathGenerator = rave.geo.path().projection(this._projection);
  7185. }
  7186. var self = this;
  7187. this._features.select("path").attr("d", pathGenerator);
  7188. this.bubbleLabelRegionSelector.select("circle").attr("transform", function(data, index, groupIndex) {
  7189. var center = self.getCentroidLargestPolygon(""+(self._featureId(data)), pathGenerator);
  7190. if (!center) {
  7191. return "translate(-1000,-1000)";
  7192. }
  7193. return "translate(" + + (center[0]) + ", " + + (center[1]) + ")";
  7194. });
  7195. if (this._featureLabel && !this._prevFeatureLabel) {
  7196. this.createLabels(this._chart.selectAll(".region"));
  7197. }
  7198. if (this._featureLabel) {
  7199. this.bubbleLabelRegionSelector.selectAll("text").attr("transform", function(data, index, groupIndex) {
  7200. var featureId = ""+(self._featureId(data));
  7201. var center = self.getTextCenter(featureId, this, pathGenerator, self.getFinalRadius(data));
  7202. if (!center) {
  7203. return "translate(-1000,-1000)";
  7204. }
  7205. return "translate(" + center[0] + ", " + center[1] + ")";
  7206. }).attr("visibility", null).transition().duration(this._bubbleAnimationDuration).style("opacity", 1);
  7207. if (this._dropLabels) {
  7208. this._labelDropper.dropOverlap(this._chart.selectAll("text.label"));
  7209. }
  7210. } else {
  7211. this.bubbleLabelRegionSelector.selectAll("text").remove();
  7212. }
  7213. this._prevFeatureLabel = this._featureLabel;
  7214. },
  7215. removeFeatures : function() {
  7216. var animationDuration = this._regionAnimationNeeded ? this._regionAnimationDuration : 0;
  7217. this._features.exit().select("path").transition().duration(animationDuration).style("opacity", 0);
  7218. this._features.exit().transition().duration(animationDuration).remove();
  7219. this.bubbleLabelRegionSelector.exit().selectAll("circle").transition().duration(this._bubbleAnimationDuration).attr("r", 0);
  7220. this.bubbleLabelRegionSelector.exit().selectAll("text").transition().duration(this._bubbleAnimationDuration).style("opacity", 0);
  7221. this.bubbleLabelRegionSelector.exit().transition().duration(this._bubbleAnimationDuration).remove();
  7222. },
  7223. flashRegionsAndBubble : function() {
  7224. var self = this;
  7225. var valid = [];
  7226. for (var __i_enFor0 = 0, __exp_enFor0 = this.dataChangedRegions.keys(), __len_enFor0 = __exp_enFor0.length;
  7227. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7228. var key = __exp_enFor0[__i_enFor0];
  7229. if (this.dataChangedRegions.get(key) > 0) {
  7230. valid.push(key);
  7231. }
  7232. }
  7233. if (valid.length == 0) {
  7234. return;
  7235. }
  7236. setTimeout(function() {
  7237. self._chart.selectAll("path").classed("flash", function(data, index, groupIndex) {
  7238. var parent = rave.select(this.rave_getParentNode());
  7239. var featureId = self.findGeoJSONId(parent.datum());
  7240. return valid.indexOf(featureId)> -1 ? true : false;
  7241. });
  7242. self._chart.selectAll("circle").classed("flash", function(data, index, groupIndex) {
  7243. var featureId = ""+(self._featureId(data));
  7244. return valid.indexOf(featureId)> -1 ? true : false;
  7245. });
  7246. var selStr = ["path.flash", "circle.flash"];
  7247. var width = [self._borderWidth, self._bubbleBorderWidth];
  7248. var color = [self._borderColor, self._bubbleBorderColor];
  7249. for (var i = 0; i < 2; ++i) {
  7250. var flash = self._chart.selectAll(selStr[i]);
  7251. var strokeWidth = width[i];
  7252. var strokeColor = color[i];
  7253. var count = [];
  7254. count[0] = flash.size();
  7255. flash.style("stroke-width", "2px").style("stroke", null).transition().duration(self._flashDuration).style("stroke-width", strokeWidth).style("stroke", strokeColor).each("end", function(args) {
  7256. if (args !== null || arguments.length > 1){
  7257. args = Array.prototype.slice.call(arguments, 0);
  7258. }
  7259. {
  7260. count[0] = count[0] - 1;
  7261. if (count[0] == 0) {
  7262. flash.style("stroke-width", "2px").style("stroke", null).transition().duration(self._flashDuration).style("stroke-width", strokeWidth).style("stroke", strokeColor);
  7263. }
  7264. return null;
  7265. }
  7266. });
  7267. }
  7268. }, ~~ (this._bubbleAnimationDuration));
  7269. },
  7270. getFinalRadius : function(data) {
  7271. if ((this._bubbleScale) && (this._bubbleSize)) {
  7272. var v = this._bubbleSize(data);
  7273. return v != null ? + (this._bubbleScale.call(null, v, 0, 0)) : 0;
  7274. } else if (this._bubbleColor) {
  7275. return this._defaultBubbleSize;
  7276. } else {
  7277. return 0;
  7278. }
  7279. },
  7280. prepareData : function(geoRegions) {
  7281. var regionIds = [];
  7282. for (var __i_enFor0 = 0, __exp_enFor0 = geoRegions, __len_enFor0 = __exp_enFor0.length;
  7283. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7284. var region = __exp_enFor0[__i_enFor0];
  7285. regionIds.push(this.findGeoJSONId(region));
  7286. }
  7287. var dataMap = rave['internal']['ES6Map'].create();
  7288. for (var i = 0; i < this._regionsAndBubblesData.length; ++i) {
  7289. var d = this._regionsAndBubblesData[i];
  7290. var id = ""+(this._featureId(d));
  7291. if (regionIds.indexOf(id)> -1) {
  7292. dataMap.set(id, d);
  7293. }
  7294. }
  7295. return dataMap;
  7296. },
  7297. isDarkBackground : function(featureId) {
  7298. var color = this._regionFillCache.get(featureId);
  7299. if (color == null) {
  7300. var feature = this._chart.select("." + this.classFromFeatureId(featureId) + " > path");
  7301. color = ""+(feature.attr("fill"));
  7302. this._regionFillCache.set(featureId, color);
  7303. }
  7304. var dark = this._darkCache.get(color);
  7305. if (dark == null) {
  7306. var DARK_THRESHOLD = 127.5;
  7307. var rgb = rave.rgb(color);
  7308. var brightness = rgb.getR() * 0.299 + rgb.getG() * 0.587 + rgb.getB() * 0.114;
  7309. dark = brightness <= DARK_THRESHOLD;
  7310. this._darkCache.set(color, dark);
  7311. }
  7312. return dark;
  7313. },
  7314. getTextCenter : function(featureId, context, pathGenerator, radius) {
  7315. var textBBox = this.textBBoxCache[featureId];
  7316. if (!textBBox) {
  7317. textBBox = context.getBBox();
  7318. this.textBBoxCache[featureId] = textBBox;
  7319. }
  7320. var centroid = this.getCentroidLargestPolygon(featureId, pathGenerator);
  7321. if (!centroid) {
  7322. return null;
  7323. }
  7324. var textCenter = [textBBox.width, textBBox.height];
  7325. var center = [];
  7326. var localRadius = radius;
  7327. if (localRadius > 0) {
  7328. localRadius += this.LABEL_PADDING;
  7329. }
  7330. center.splice(0, 0, centroid[0] - textCenter[0] / 2);
  7331. center.splice(1, 0, centroid[1] + textCenter[1] / 2 + localRadius);
  7332. return center;
  7333. },
  7334. /**
  7335. * Get the projection type as specified in the properties, or the mercator projection by default. Also sets the projSupportsCenter to false if we are using "albersUSA", which does not take a center position.
  7336. * @return (rave['internal']['Projection']) - the projection
  7337. */
  7338. /** @expose */
  7339. createProjection : function() {
  7340. this._isAlbersUsa = false;
  7341. this._cachedPathGenerator = null;
  7342. this._projection = null;
  7343. if (this._projectionType != null) {
  7344. if ("albersUsa" == this._projectionType) {
  7345. this._isAlbersUsa = true;
  7346. this._projection = rave.geo.albersUsa();
  7347. } else if ("albers" == this._projectionType) {
  7348. this._projection = rave.geo.albers();
  7349. } else if (com_ibm_rave_bundles_components_MapComponentImpl.azimuthalEqualArea == this._projectionType) {
  7350. this._projection = rave.geo.azimuthalEqualArea();
  7351. } else if (com_ibm_rave_bundles_components_MapComponentImpl.azimuthalEquidistant == this._projectionType) {
  7352. this._projection = rave.geo.azimuthalEquidistant();
  7353. } else if (com_ibm_rave_bundles_components_MapComponentImpl.conicConformal == this._projectionType) {
  7354. this._projection = rave.geo.conicConformal();
  7355. } else if (com_ibm_rave_bundles_components_MapComponentImpl.conicEqualArea == this._projectionType) {
  7356. this._projection = rave.geo.conicEqualArea();
  7357. } else if (com_ibm_rave_bundles_components_MapComponentImpl.conicEquidistant == this._projectionType) {
  7358. this._projection = rave.geo.conicEquidistant();
  7359. } else if (com_ibm_rave_bundles_components_MapComponentImpl.equirectangular == this._projectionType) {
  7360. this._projection = rave.geo.equirectangular();
  7361. } else if ("gnomonic" == this._projectionType) {
  7362. this._projection = rave.geo.gnomonic();
  7363. } else if ("mercator" == this._projectionType) {
  7364. this._projection = rave.geo.mercator();
  7365. } else if (com_ibm_rave_bundles_components_MapComponentImpl.orthographic == this._projectionType) {
  7366. this._projection = rave.geo.orthographic();
  7367. } else if (com_ibm_rave_bundles_components_MapComponentImpl.stereoGraphic == this._projectionType) {
  7368. this._projection = rave.geo.stereographic().clipAngle(160);
  7369. } else if (com_ibm_rave_bundles_components_MapComponentImpl.transverseMercator == this._projectionType) {
  7370. this._projection = rave.geo.transverseMercator();
  7371. } else if (com_ibm_rave_bundles_components_MapComponentImpl.winkelTriple == this._projectionType) {
  7372. this._projection = rave.geo.winkel3();
  7373. }
  7374. }
  7375. if (!this._projection) {
  7376. this._projection = rave.geo.mercator();
  7377. }
  7378. if (!this._isAlbersUsa) {
  7379. this._projection.rotate([this._rotationLongitude, this._rotationLatitude, 0.0]);
  7380. }
  7381. return this._projection;
  7382. },
  7383. classFromFeatureId : function(featureId) {
  7384. var fid = "id" + featureId;
  7385. fid = fid.replace(new RegExp("\\W+","g"), "");
  7386. return fid;
  7387. },
  7388. /**
  7389. * Search feature data for the identifying field
  7390. * @param (Object) jsonFeature
  7391. * @return (String) the feature id
  7392. */
  7393. findGeoJSONId : function(jsonFeature) {
  7394. var _jsonFeature = jsonFeature;
  7395. var i = 0;
  7396. for (; i < this._featureIdFieldArray.length - 1; ++i) {
  7397. _jsonFeature = _jsonFeature[this._featureIdFieldArray[i]];
  7398. }
  7399. return ""+(_jsonFeature[this._featureIdFieldArray[i]]);
  7400. },
  7401. getCentroidLargestPolygon : function(featureId, pathGenerator) {
  7402. var centroid = this._centroidCache[featureId];
  7403. if (centroid) {
  7404. return centroid;
  7405. }
  7406. var coord = this.getCoordinateForFeature(featureId);
  7407. centroid = this.polygonCentroid(coord, pathGenerator);
  7408. this._centroidCache[featureId] = centroid;
  7409. return centroid;
  7410. },
  7411. getCoordinateForFeature : function(featureId) {
  7412. var coord = this._coordinateCache[featureId];
  7413. if (!coord) {
  7414. var features = this._geoJSONObject["features"];
  7415. var feature = null;
  7416. for (var i = 0; i < features.length; ++i) {
  7417. feature = features[i];
  7418. if (featureId == this.findGeoJSONId(feature)) {
  7419. break;
  7420. }
  7421. }
  7422. if (!feature) {
  7423. return null;
  7424. }
  7425. var geometry = feature["geometry"];
  7426. var coordinates = geometry["coordinates"];
  7427. var type = ""+(geometry["type"]);
  7428. if (type == "Polygon") {
  7429. coord = coordinates[0];
  7430. } else if (type == "MultiPolygon") {
  7431. var largestArea = 0.0;
  7432. for (var i = 0; i < coordinates.length; ++i) {
  7433. var p = coordinates[i];
  7434. var testCoord = p[0];
  7435. var area = this.calculatePolyArea(testCoord);
  7436. if (area > largestArea) {
  7437. largestArea = area;
  7438. coord = testCoord;
  7439. }
  7440. }
  7441. }
  7442. this._coordinateCache[featureId] = coord;
  7443. }
  7444. return coord;
  7445. },
  7446. calculatePolyArea : function(poly) {
  7447. var area = 0;
  7448. for (var i = 0; i < poly.length - 1; ++i) {
  7449. var point_i = poly[i];
  7450. var point_i_1 = poly[i + 1];
  7451. area += + (point_i[0]) * + (point_i_1[1]) - + (point_i_1[0]) * + (point_i[1]);
  7452. }
  7453. return Math.abs(area) / 2;
  7454. },
  7455. polygonCentroid : function(polygon, pathGenerator) {
  7456. var centroid = [];
  7457. var x = 0.0;
  7458. var y = 0.0;
  7459. for (var i = 0; i < polygon.length; ++i) {
  7460. var point = polygon[i];
  7461. x += + (point[0]);
  7462. y += + (point[1]);
  7463. }
  7464. centroid.push(x / polygon.length);
  7465. centroid.push(y / polygon.length);
  7466. centroid = pathGenerator.projection()(centroid);
  7467. return centroid;
  7468. },
  7469. /** @expose */
  7470. featureId : function(accessor) {
  7471. this._featureId = accessor;
  7472. return this;
  7473. },
  7474. /** @expose */
  7475. bubbleColor : function(accessor) {
  7476. this._bubbleColor = accessor;
  7477. return this;
  7478. },
  7479. /** @expose */
  7480. bubbleSize : function(accessor) {
  7481. this._bubbleSize = accessor;
  7482. return this;
  7483. },
  7484. /** @expose */
  7485. featureLbl : function(accessor) {
  7486. this._featureLbl = accessor;
  7487. return this;
  7488. },
  7489. /** @expose */
  7490. labelFormatter : function(labelFormatter) {
  7491. this._labelFormatter = labelFormatter;
  7492. return this;
  7493. },
  7494. /** @expose */
  7495. bubbleScale : function(scale) {
  7496. this._bubbleScale = scale;
  7497. return this;
  7498. },
  7499. /** @expose */
  7500. defaultBubbleSize : function(size) {
  7501. this._defaultBubbleSize = size;
  7502. return this;
  7503. },
  7504. /** @expose */
  7505. regionAnimationDuration : function(duration) {
  7506. this._regionAnimationDuration = duration;
  7507. return this;
  7508. },
  7509. /** @expose */
  7510. regionAnimation : function(doTransition) {
  7511. this._regionAnimationEnabled = doTransition;
  7512. return this;
  7513. },
  7514. /** @expose */
  7515. bubbleAnimationDuration : function(duration) {
  7516. this._bubbleAnimationDuration = duration;
  7517. return this;
  7518. },
  7519. /** @expose */
  7520. bubbleAnimation : function(doTransition) {
  7521. this._bubbleAnimationEnabled = doTransition;
  7522. return this;
  7523. },
  7524. /** @expose */
  7525. flashDuration : function(duration) {
  7526. this._flashDuration = duration;
  7527. return this;
  7528. },
  7529. /** @expose */
  7530. flash : function(flash) {
  7531. this._flash = flash;
  7532. return this;
  7533. },
  7534. /** @expose */
  7535. bubblePalette : function(palette) {
  7536. this._bubblePalette = palette;
  7537. return this;
  7538. },
  7539. /** @expose */
  7540. regionPalette : function(palette) {
  7541. this._regionPalette = palette;
  7542. return this;
  7543. },
  7544. /** @expose */
  7545. nullColor : function(c) {
  7546. this._nullColor = c;
  7547. return this;
  7548. },
  7549. /** @expose */
  7550. geoJSONObject : function(geoJSONObject) {
  7551. if (this._geoJSONObject && this._geoJSONObject != geoJSONObject) {
  7552. this._scale = NaN;
  7553. }
  7554. this._dataChanged = true;
  7555. this._geoJSONObject = geoJSONObject;
  7556. return this;
  7557. },
  7558. /** @expose */
  7559. bounds : function(bounds) {
  7560. this._boundsChanged = !this._bounds || bounds.x != this._bounds.x || bounds.y != this._bounds.y || bounds.width != this._bounds.width || bounds.height != this._bounds.height;
  7561. if (this._boundsChanged) {
  7562. this._bounds = new rave['internal']['RectStruct'](bounds.x, bounds.y, bounds.width, bounds.height);
  7563. this._translation[0] = bounds.x + (bounds.width / 2);
  7564. this._translation[1] = bounds.y + (bounds.height / 2);
  7565. this._scale = NaN;
  7566. }
  7567. return this;
  7568. },
  7569. /**
  7570. * @param (String) geoJSONfeatureIdLookup Dot separated field names for feature id in the GeoJSON
  7571. */
  7572. /** @expose */
  7573. geoJSONfeatureIdLookup : function(geoJSONfeatureIdLookup) {
  7574. this._geoJSONfeatureIdLookup = geoJSONfeatureIdLookup;
  7575. return this;
  7576. },
  7577. /**
  7578. * @param (boolean) featureLabel The new itemLabel
  7579. */
  7580. /** @expose */
  7581. featureLabel : function(featureLabel) {
  7582. this._prevFeatureLabel = this._featureLabel;
  7583. this._featureLabel = featureLabel;
  7584. return this;
  7585. },
  7586. /**
  7587. * @param (String) projectionType The type of map projection
  7588. */
  7589. /** @expose */
  7590. projectionType : function(projectionType) {
  7591. this._projectionChanged = this._projectionType != null && !(this._projectionType == projectionType);
  7592. this._projectionType = projectionType;
  7593. return this;
  7594. },
  7595. /**
  7596. * @param (double) longitude Longitude for rotation
  7597. * @param (double) latitude Latitude for rotation
  7598. */
  7599. /** @expose */
  7600. rotation : function(longitude, latitude) {
  7601. this._rotationLongitude = longitude;
  7602. this._rotationLatitude = latitude;
  7603. this._scale = NaN;
  7604. return this;
  7605. },
  7606. /** @expose */
  7607. regionsAndBubblesData : function(data) {
  7608. this._regionsAndBubblesData = data;
  7609. return this;
  7610. },
  7611. /**
  7612. * If true the projection parameters have been changed, either the original scale, or the projection type, and thus will require a new projection, this is set to false when simply zooming, or dragging
  7613. * @param (boolean) prochange
  7614. */
  7615. /** @expose */
  7616. projectionChanged : function(prochange) {
  7617. this._projectionChanged = prochange;
  7618. },
  7619. /**
  7620. * If true pan along the X axis. Otherwise rotate along the X axis.
  7621. * @param (boolean) panOnX
  7622. * @return (com.ibm.rave.bundles.components.MapComponentImpl) this
  7623. */
  7624. panX$1 : function(panOnX) {
  7625. this._panX = panOnX;
  7626. return this;
  7627. },
  7628. /**
  7629. * If true pan along the Y axis. Otherwise rotate along the Y axis.
  7630. * @param (boolean) panOnY
  7631. * @return (com.ibm.rave.bundles.components.MapComponentImpl) this
  7632. */
  7633. panY$1 : function(panOnY) {
  7634. this._panY = panOnY;
  7635. return this;
  7636. },
  7637. /**
  7638. * @param (String) resolve - if true, we resolve label collisions return this
  7639. */
  7640. /** @expose */
  7641. labelResolution : function(resolve) {
  7642. this._handleLabelCollisions = resolve;
  7643. return this;
  7644. },
  7645. /**
  7646. * Activates and deactivates the default zoom and drag behaviors. If this value is false, bundle actions must be used for zoom and drag.
  7647. * @param (boolean) defaultBehavior
  7648. * @return (com.ibm.rave.bundles.components.MapComponentImpl) this
  7649. */
  7650. /** @expose */
  7651. defaultPanZoom : function(defaultBehavior) {
  7652. this._defaultPanZoom = defaultBehavior;
  7653. return this;
  7654. },
  7655. /**
  7656. * Sets the maximum and minimum allowable zoom level, this affects the scaling on the projections, and since negative scaling is not allowed on projections, if the minimum zoom level is a negative number it will clamp to zero.
  7657. * @param (double) min minimum allowed level of zoom (in cases of zoom out)
  7658. * @param (double) max maximum allowed level of zoom (in cases of zoom in)
  7659. * @return (com.ibm.rave.bundles.components.MapComponentImpl) this
  7660. */
  7661. /** @expose */
  7662. setZoomExtent : function(min, max) {
  7663. var _min = min;
  7664. if (_min < 0) {
  7665. _min = 0;
  7666. }
  7667. this._zoomExtent = [_min, max];
  7668. return this;
  7669. },
  7670. /**
  7671. * Returns the minimum and maximum allow zoom levels.
  7672. * @return (Array) zoomExtent
  7673. */
  7674. /** @expose */
  7675. getZoomExtent : function() {
  7676. return this._zoomExtent;
  7677. },
  7678. /**
  7679. * @param (boolean) dropLabels Whether overlapping labels should be dropped
  7680. * @return (com.ibm.rave.bundles.components.MapComponentImpl) This object
  7681. */
  7682. /** @expose */
  7683. dropLabels : function(dropLabels) {
  7684. this._dropLabels = dropLabels;
  7685. return this;
  7686. },
  7687. /** @expose */
  7688. borderWidth : function(borderWidth) {
  7689. this._borderWidth = borderWidth;
  7690. return this;
  7691. },
  7692. /** @expose */
  7693. borderColor : function(borderColor) {
  7694. this._borderColor = borderColor;
  7695. return this;
  7696. },
  7697. /** @expose */
  7698. bubbleBorderWidth : function(borderWidth) {
  7699. this._bubbleBorderWidth = borderWidth;
  7700. return this;
  7701. },
  7702. /** @expose */
  7703. bubbleBorderColor : function(borderColor) {
  7704. this._bubbleBorderColor = borderColor;
  7705. return this;
  7706. },
  7707. /**
  7708. * Sets the amount that the bubbles must be translated on a drag action
  7709. * @param (double) dx The change in x position that the map has been moved
  7710. * @param (double) dy The change in y position that the map has been moved
  7711. */
  7712. /** @expose */
  7713. panMap : function(dx, dy) {
  7714. var maxTrans = this.maxTranslations();
  7715. this._mapPan[1] += dy;
  7716. this._mapPan[1] = Math.max(-maxTrans[1], Math.min(maxTrans[1], this._mapPan[1]));
  7717. if (this._isAlbersUsa) {
  7718. this._mapPan[0] += dx;
  7719. this._mapPan[0] = Math.max(-maxTrans[0], Math.min(maxTrans[0], this._mapPan[0]));
  7720. }
  7721. this._chart.attr("transform", "translate(" + this._mapPan[0] + "," + this._mapPan[1] + ")");
  7722. if (!this._isAlbersUsa) {
  7723. var rotation = this._projection.rotate();
  7724. rotation[0] = rotation[0] + (dx / 0.017453292519943295) / this.scaleProjection();
  7725. this._projection.rotate(rotation);
  7726. }
  7727. this.recalculateCentroidsOnAction();
  7728. },
  7729. /**
  7730. * Sets the new scale and ensures that the map stays on screen.
  7731. * @param (double) scale The current scale
  7732. */
  7733. /** @expose */
  7734. zoomMap : function(scale) {
  7735. var maxTrans = this.maxTranslations();
  7736. this._mapPan[0] = Math.min(maxTrans[0], Math.max(-maxTrans[0], this._mapPan[0]));
  7737. this._mapPan[1] = Math.min(maxTrans[1], Math.max(-maxTrans[1], this._mapPan[1]));
  7738. this._chart.attr("transform", "translate(" + this._mapPan[0] + "," + this._mapPan[1] + ")");
  7739. this._projection.scale(scale);
  7740. this.recalculateCentroidsOnAction();
  7741. },
  7742. /**
  7743. * @return (double[]) the maximum allowable translations for the current scale
  7744. */
  7745. maxTranslations : function() {
  7746. var zoomLevel = (this._projection.scale() / this._minScale) - 1;
  7747. var maxTrans = [];
  7748. maxTrans[0] = this._bounds.width * 0.5 * zoomLevel;
  7749. maxTrans[1] = this._bounds.height * 0.5 * zoomLevel;
  7750. return maxTrans;
  7751. },
  7752. /**
  7753. * If _regionAnimationNeeded = true, regionAnimationDuration will be set to 0 so bubble and label movement on a zoom action isn't delayed. Centroid cache is cleared so bubbles and labels are redrawn in new positions.
  7754. * @param isZoom
  7755. */
  7756. recalculateCentroidsOnAction : function() {
  7757. this._regionAnimationNeeded = false;
  7758. this._centroidCache = {};
  7759. },
  7760. /**
  7761. * Scale the current projection by a scale value.
  7762. * @param (double) scale Value to scale projection by. Typically used by a zoom function.
  7763. * @return (com.ibm.rave.bundles.components.MapComponentImpl) This map component
  7764. */
  7765. scaleProjection$0 : function(scale) {
  7766. this._projection.scale(scale);
  7767. this.recalculateCentroidsOnAction();
  7768. return this;
  7769. },
  7770. /**
  7771. * Return the current scale used by the map projection.
  7772. * @return (double) Scale of the current projection being drawn.
  7773. */
  7774. scaleProjection$1 : function() {
  7775. return this._projection.scale();
  7776. },
  7777. /**
  7778. * Return the current projection translation as a point.
  7779. * @return (Array) current projection translation as a point
  7780. */
  7781. /** @expose */
  7782. translateProjection : function() {
  7783. var trans = this._projection.translate();
  7784. return [trans[0], trans[1]];
  7785. },
  7786. /**
  7787. * Return the current projection translation as a point.
  7788. * @return (double[]) current projection translation as a point
  7789. */
  7790. /** @expose */
  7791. mapTranslate : function() {
  7792. return this._mapPan;
  7793. },
  7794. /** @expose */
  7795. panX : function(a0) {
  7796. var args = arguments;
  7797. if (args.length == 0) {
  7798. return this.panX$0();
  7799. }
  7800. return this.panX$1(a0);
  7801. },
  7802. /** @expose */
  7803. panY : function(a0) {
  7804. var args = arguments;
  7805. if (args.length == 0) {
  7806. return this.panY$0();
  7807. }
  7808. return this.panY$1(a0);
  7809. },
  7810. /** @expose */
  7811. baseScale : function(a0) {
  7812. var args = arguments;
  7813. if (args.length == 0) {
  7814. return this.baseScale$0();
  7815. }
  7816. return this.baseScale$1(a0);
  7817. },
  7818. /** @expose */
  7819. scaleProjection : function(a0) {
  7820. var args = arguments;
  7821. if (args.length == 0) {
  7822. return this.scaleProjection$1();
  7823. }
  7824. return this.scaleProjection$0(a0);
  7825. }
  7826. });
  7827. /** @expose */
  7828. com_ibm_rave_bundles_components_MapComponentImpl.create = function() {
  7829. return new com_ibm_rave_bundles_components_MapComponentImpl();
  7830. };
  7831. /** @expose */
  7832. com_ibm_rave_bundles_components_MapComponentImpl.albersUsa = "albersUsa";
  7833. /** @expose */
  7834. com_ibm_rave_bundles_components_MapComponentImpl.albers = "albers";
  7835. /** @expose */
  7836. com_ibm_rave_bundles_components_MapComponentImpl.azimuthalEqualArea = "azimuthalEqualArea";
  7837. /** @expose */
  7838. com_ibm_rave_bundles_components_MapComponentImpl.azimuthalEquidistant = "azimuthalEquidistant";
  7839. /** @expose */
  7840. com_ibm_rave_bundles_components_MapComponentImpl.conicConformal = "conicConformal";
  7841. /** @expose */
  7842. com_ibm_rave_bundles_components_MapComponentImpl.conicEqualArea = "conicEqualArea";
  7843. /** @expose */
  7844. com_ibm_rave_bundles_components_MapComponentImpl.conicEquidistant = "conicEquidistant";
  7845. /** @expose */
  7846. com_ibm_rave_bundles_components_MapComponentImpl.equirectangular = "equirectangular";
  7847. /** @expose */
  7848. com_ibm_rave_bundles_components_MapComponentImpl.gnomonic = "gnomonic";
  7849. /** @expose */
  7850. com_ibm_rave_bundles_components_MapComponentImpl.mercator = "mercator";
  7851. /** @expose */
  7852. com_ibm_rave_bundles_components_MapComponentImpl.orthographic = "orthographic";
  7853. /** @expose */
  7854. com_ibm_rave_bundles_components_MapComponentImpl.stereoGraphic = "stereoGraphic";
  7855. /** @expose */
  7856. com_ibm_rave_bundles_components_MapComponentImpl.transverseMercator = "transverseMercator";
  7857. /** @expose */
  7858. com_ibm_rave_bundles_components_MapComponentImpl.winkelTriple = "winkelTriple";
  7859. com_ibm_rave_bundles_components_MapComponentImpl.MAP_COMPONENT = "MapComponent";
  7860. })();
  7861. },{"./configuration/configuration.json":1,"./i18n/messages_en.json":2,"./vizlibrary-map.css":4,"./vizlibrary.css":5}],4:[function(require,module,exports){
  7862. var css = ".vizlibrary-map .element-shape {\n stroke: white;\n stroke-width: 1;\n stroke-linejoin: round;\n fill-opacity: 1.0;\n}\n.vizlibrary-map .bubble {\n fill-opacity: 0.5;\n stroke: white;\n stroke-width: 1;\n pointer-events: none;\n}\n.vizlibrary-map .dark-label {\n fill: black;\n text-shadow: 1px 1px white;\n}\n.vizlibrary-map .light-label {\n fill: white;\n text-shadow: 1px 1px black;\n}\n.vizlibrary-map .label {\n font-size: 10pt;\n pointer-events: none;\n}\n.vizlibrary-map path.flash {\n stroke: orange;\n}\n.vizlibrary-map .bubble.flash {\n stroke: orange;\n}\n"; (require("browserify-css").createStyle(css, { "href": "dist/bundles/rave-library-map/node/rave-library-map/vizlibrary-map.css"})); module.exports = css;
  7863. },{"browserify-css":6}],5:[function(require,module,exports){
  7864. var css = ".vizlibrary {\n font-family: Arial, Tahoma, 'Arial Unicode MS', 'Andale WT', 'MS UI Gothic', Gulim, SimSun, PMingLiU, Raghu8, sans-serif;\n font-style: normal;\n}\n/*\n * Chart background rectangle, transparent\n */\n.vizlibrary rect.background.elements {\n fill-opacity: 0.0;\n}\n/*\n * Axes.\n */\n.vizlibrary .axis .tick text {\n font-weight: 300;\n font-size: 14px;\n fill: #3c4646;\n}\n.vizlibrary .axis .tick line {\n fill: none;\n stroke: #eee;\n}\n.vizlibrary .axis path {\n fill: none;\n stroke: #eee;\n}\n/*Axis title\n*/\n.vizlibrary .axis .axislabel {\n font-weight: 500;\n font-size: 14px;\n fill: #323c3c;\n}\n/*\n * Axis callout.\n */\n.vizlibrary .axis-callout {\n pointer-events: none;\n /* Prevent the callout lines from intercepting mouseover events on the element shapes */\n}\n.vizlibrary .callout line {\n stroke: #3c4646;\n stroke-dasharray: 5,5;\n}\n.vizlibrary .callout .label path {\n fill: #3c4646;\n stroke-width: 0px;\n}\n.vizlibrary .callout .label text {\n font-weight: 300;\n font-size: 14px;\n fill: white;\n}\n/*Grid lines*/\n.vizlibrary g.grid g.tick {\n stroke: #dfe9e9;\n stroke-width: 1px;\n}\n/*Legend title*/\n.vizlibrary .legendTitle {\n font-weight: 500;\n font-size: 18px;\n fill: #323c3c;\n}\n/*Legend label*/\n.vizlibrary .legendLabel {\n font-weight: 300;\n font-size: 14px;\n fill: #3c4646;\n}\n.vizlibrary .legendBBox {\n pointer-events: none;\n}\n"; (require("browserify-css").createStyle(css, { "href": "dist/bundles/rave-library-map/node/rave-library-map/vizlibrary.css"})); module.exports = css;
  7865. },{"browserify-css":6}],6:[function(require,module,exports){
  7866. 'use strict';
  7867. // For more information about browser field, check out the browser field at https://github.com/substack/browserify-handbook#browser-field.
  7868. module.exports = {
  7869. // Create a <link> tag with optional data attributes
  7870. createLink: function(href, attributes) {
  7871. var head = document.head || document.getElementsByTagName('head')[0];
  7872. var link = document.createElement('link');
  7873. link.href = href;
  7874. link.rel = 'stylesheet';
  7875. for (var key in attributes) {
  7876. if ( ! attributes.hasOwnProperty(key)) {
  7877. continue;
  7878. }
  7879. var value = attributes[key];
  7880. link.setAttribute('data-' + key, value);
  7881. }
  7882. head.appendChild(link);
  7883. },
  7884. // Create a <style> tag with optional data attributes
  7885. createStyle: function(cssText, attributes) {
  7886. var head = document.head || document.getElementsByTagName('head')[0],
  7887. style = document.createElement('style');
  7888. style.type = 'text/css';
  7889. for (var key in attributes) {
  7890. if ( ! attributes.hasOwnProperty(key)) {
  7891. continue;
  7892. }
  7893. var value = attributes[key];
  7894. style.setAttribute('data-' + key, value);
  7895. }
  7896. if (style.sheet) { // for jsdom and IE9+
  7897. style.innerHTML = cssText;
  7898. style.sheet.cssText = cssText;
  7899. head.appendChild(style);
  7900. } else if (style.styleSheet) { // for IE8 and below
  7901. head.appendChild(style);
  7902. style.styleSheet.cssText = cssText;
  7903. } else { // for Chrome, Firefox, and Safari
  7904. style.appendChild(document.createTextNode(cssText));
  7905. head.appendChild(style);
  7906. }
  7907. }
  7908. };
  7909. },{}]},{},[3]);
  7910. return rave.library.bundle.extension('mapBundle');
  7911. }));