rave-library-treemap.js 335 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697
  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.raveLibraryTreemap = 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=[{"previews":{"image":[{"file":"resources\/preview_treemap_small.png","tags":["small","notext"]}],"svg":[{"file":"resources\/preview_treemap_small.svg","tags":["small","notext"]}]},"genericMeta":{"copyright":"IBM 2015, 2016","author":"IBM","description":"treemap.description","id":"rave-library-treemap","label":"treemap.label","version":"1.0.0","tags":["treemap"]}},{"datamodels":[{"description":"datamodel.hierarchial.treemap.description","id":"hierarchical","label":"datamodel.hierarchial.label","datasets":[{"dataslots":[{"icon":{"image":"..\/rave-library\/resources\/children_32.png","svg":"..\/rave-library\/resources\/level_32.svg"},"description":"dataslot.hierarchial.treemap.description","id":"children","label":"dataslot.children.label","cardinality":"1","datatypes":["array","object"]},{"icon":{"image":"..\/rave-library\/resources\/size_32.png","svg":"..\/rave-library\/resources\/size_32.svg"},"description":"dataslot.size.treemap.description","id":"size","label":"dataslot.tabular.size.label","cardinality":"1","datatypes":["numeric"],"tags":[]},{"icon":{"image":"..\/rave-library\/resources\/color_by_32.png","svg":"..\/rave-library\/resources\/region_color_by_32.svg"},"description":"dataslot.color.description","id":"color","label":"dataslot.color.label","cardinality":"0..1","datatypes":["numeric","string"],"tags":[]},{"icon":{"image":"..\/rave-library\/resources\/label_32.png","svg":"..\/rave-library\/resources\/label_32.svg"},"description":"dataslot.label.description","id":"label","label":"dataslot.label.label","cardinality":"0..1","datatypes":["string"]},{"icon":{"image":"..\/rave-library\/resources\/primary_key_32.png","svg":"..\/rave-library\/resources\/primary_key_32.svg"},"description":"dataslot.key.description","id":"key","label":"dataslot.key.label","cardinality":"0..1","datatypes":["numeric","string","date"]}],"description":"dataset.hierarchial.treemap.description","id":"data","label":"dataset.hierarchial.label","type":"hierarchy","cardinality":"1"}],"tags":["treemap"]}]},{"properties":{"border":{"type":"object","properties":{"color":{"default":"#FFFFFF","name":"border.color.name","description":"border.color.description","type":"color"},"width":{"default":"1px","name":"border.width.name","description":"border.width.description","type":"length"}}},"label.shadow":{"default":false,"resetView":"layout","name":"label.shadow.name","description":"label.shadow.description","type":"boolean"},"sizeOrCount":{"default":"size","resetView":"layout","name":"sizeOrCount.name","options":[{"id":"sizeOrCount.options.size","value":"size"},{"id":"sizeOrCount.options.count","value":"count"}],"description":"sizeOrCount.description","type":"string"},"itemColor":{"default":"level1","name":"itemColor.name","options":[{"id":"itemColor.options.level1","value":"level1"},{"id":"itemColor.options.level2","value":"level2"},{"id":"itemColor.options.level3","value":"level3"},{"id":"itemColor.options.level4","value":"level4"},{"id":"itemColor.options.level5","value":"level5"},{"id":"itemColor.options.color","value":"color"}],"description":"itemColor.description","type":"string"},"color":{"type":"object","properties":{"null":{"default":"silver","name":"color.null.name","description":"color.null.description","type":"color"},"palette":{"resetView":"layout","name":"color.palette.name","options":["categorical","continuous"],"description":"color.palette.name","type":"palette"},"dynamicPalette":{"type":"object","properties":{"min":{"default":null,"name":"color.dynamicPalette.min.name","description":"color.dynamicPalette.min.description","type":"color"},"max":{"default":null,"name":"color.dynamicPalette.max.name","description":"color.dynamicPalette.max.description","type":"color"},"mid":{"default":null,"name":"color.dynamicPalette.mid.name","description":"color.dynamicPalette.mid.description","type":"color"}}}}},"sort":{"default":"ascending","resetView":"layout","name":"sort.name","options":[{"id":"sort.options.none","value":"none"},{"id":"sort.options.ascending","value":"ascending"},{"id":"sort.options.descending","value":"descending"}],"description":"sort.description","type":"string"},"breadcrumbDisplay":{"trueLabel":"treemap.trueBreadcrumb.show","default":true,"falseLabel":"treemap.falseBreadcrumb.hide","resetView":"layout","name":"breadcrumb.display.name","description":"breadcrumb.display.description","type":"boolean"},"itemLabel":{"default":"1","name":"itemLabel.name","options":[{"id":"itemLabel.options.level1","value":"1"},{"id":"itemLabel.options.level2","value":"2"},{"id":"itemLabel.options.level3","value":"3"},{"id":"itemLabel.options.level4","value":"4"},{"id":"itemLabel.options.level5","value":"5"}],"description":"itemLabel.description","type":"string"},"mode":{"default":"squarify","resetView":"layout","name":"mode.name","options":[{"id":"mode.options.squarify","value":"squarify"},{"id":"mode.options.slice","value":"slice"},{"id":"mode.options.dice","value":"dice"},{"id":"mode.options.slice-dice","value":"slice-dice"}],"description":"mode.description","type":"string"},"labelstyle.font":{"default":null,"name":"labelstyle.font.name","description":"labelstyle.font.description","type":"string"},"effect":{"type":"object","properties":{"duration":{"default":1000,"min":0,"name":"effect.duration.name","description":"effect.duration.description","type":"numeric"},"name":{"default":"transition","name":"effect.name.name","options":[{"id":"effect.name.options.transition","value":"transition"},{"id":"effect.name.options.none","value":"none"}],"description":"effect.name.description","type":"string"}}},"contrast":{"type":"object","properties":{"label":{"type":"object","properties":{"color":{"default":false,"resetView":"layout","name":"contrast.label.color.name","description":"contrast.label.color.description","type":"boolean"}}}}},"labelDisplay":{"trueLabel":"treemap.trueLabel.show","default":true,"falseLabel":"treemap.falseLabel.hide","name":"label.display.name","description":"label.display.description","type":"boolean"},"leadLabel.display":{"default":false,"resetView":"data","name":"leadLabel.display.name","description":"leadLabel.display.description","type":"boolean"}}},{"configurations":[{"previews":{"image":[{"file":"resources\/treemap_icon_48.png","tags":["small","nocolor"]},{"file":"resources\/treemap_preview_320.png","tags":["medium","color"]},{"file":"resources\/treemap_preview_500.png","tags":["large","nocolor"]}],"svg":[{"file":"resources\/treemap_icon_48.svg","tags":["small","nocolor"]},{"file":"resources\/treemap_preview_320.svg","tags":["medium","color"]},{"file":"resources\/treemap_preview_500.svg","tags":["large","nocolor"]}]},"genericMeta":{"description":"treemap.config.treemap.description","id":"treemap","label":"treemap.config.treemap.label","tags":[]},"properties":[{"id":"effect.duration","value":500},{"hidden":true,"id":"layout.padding"},{"hidden":true,"id":"background.chart.color","value":"transparent"},{"id":"background.elements.color","value":"transparent"},{"hidden":true,"id":"legend.display"}]}]},{"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"}}}}}}}}},{"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":{"legend":{"type":"object","properties":{"display":{"trueLabel":"legend.display.trueLabel","default":true,"falseLabel":"legend.display.falseLabel","resetView":"layout","name":"legend.display.name","description":"legend.display.description","type":"boolean"},"entrystyle":{"type":"object","properties":{"font":{"name":"legend.entrystyle.font.name","description":"legend.entrystyle.font.description","type":"font"}}},"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.right","value":"right"},{"id":"legend.position.options.left","value":"left"}],"description":"legend.position.description","type":"string"},"title":{"default":"","resetView":"layout","name":"legend.title.name","description":"legend.title.description","type":"string"},"titlestyle":{"type":"object","properties":{"fontfamily":{"default":null,"name":"legend.titlestyle.fontfamily.name","description":"legend.titlestyle.fontfamily.description","type":"string"},"fontsize":{"default":null,"resetView":"layout","name":"legend.titlestyle.fontsize.name","description":"legend.titlestyle.fontsize.description","type":"string"},"fill":{"default":null,"name":"legend.titlestyle.fill.name","description":"legend.titlestyle.fill.description","type":"color"},"font":{"resetView":"layout","name":"legend.titlestyle.font.name","description":"legend.titlestyle.font.description","type":"font"}}}}}}},{"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"}],"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"}],"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":"click","target":".element-shape"}],"id":"toggleSelect","label":"actions.toggleSelect.label","tags":[]},{"icon":null,"options":[],"description":"actions.drillDown.description","binding":[{"event":"dblclick","target":".rect"}],"id":"drillDown","label":"actions.drillDown.label","tags":[]},{"icon":null,"options":[],"description":"actions.breadCrumb.description","id":"breadcrumbSelect","label":"actions.breadCrumb.label","tags":[]}]},{"propertyPresentations":[{"presentationItems":[{"propertyID":"background.chart.color"},{"propertyID":"color.palette"},{"propertyID":"legend.display"},{"propertyID":"legend.position"},{"propertyID":"legend.title"}],"icon":"","description":"propertyPresentation.simple.description","id":"simple","label":"propertyPresentation.simple.label","tags":["Treemap","Treemap Properties Presentation","Simple","ca.dashboard"]},{"presentationItems":[{"propertyGroup":{"presentationItems":[{"propertyID":"background.chart.color"},{"propertyID":"background.elements.color"},{"propertyID":"color.palette"},{"propertyID":"color.dynamicPalette.max"},{"propertyID":"color.dynamicPalette.mid"},{"propertyID":"color.dynamicPalette.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":"itemColor"},{"propertyID":"labelDisplay"},{"propertyID":"labelstyle.font"},{"propertyID":"leadLabel.display"},{"propertyID":"mode"},{"propertyID":"sizeOrCount"},{"propertyID":"sort"}],"icon":"","description":"treemap.propertyPresentation.advanced.treemapSpecificProperties.description","id":"treemapSpecificProperties","label":"treemap.propertyPresentation.advanced.treemapSpecificProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"legend.display"},{"propertyID":"legend.position"},{"propertyID":"legend.title"},{"propertyID":"legend.titlestyle.font"},{"propertyID":"legend.entrystyle.font"}],"icon":"","description":"propertyPresentation.advanced.legendProperties.description","id":"legendProperties","label":"propertyPresentation.advanced.legendProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"effect.duration"},{"propertyID":"effect.name"}],"icon":"","description":"propertyPresentation.advanced.clientBehaviorProperties.description","id":"clientBehaviorProperties","label":"propertyPresentation.advanced.clientBehaviorProperties.label","tags":["ca.chart.definition.outputType=interactive"]}}],"icon":"","description":"propertyPresentation.advanced.description","id":"advanced","label":"propertyPresentation.advanced.label","tags":["Treemap","Treemap Properties Presentation","advanced","ca.reporting"]}]},{"build":"development","name":"rave-library-treemap","description":"This is the IBM Rave treemap bundle.","ignore":["bower.json"],"main":"bundle.js","version":"1.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. "automatic.label.color.description": "Adjust the label color to contrast with background.",
  63. "automatic.label.color.name": "Automatically adjust data label font color",
  64. "background.chart.color.description": "The background color of the chart.",
  65. "background.chart.color.name": "Background color",
  66. "background.color.description": "The background color of the chart.",
  67. "background.elements.color.description": "The background color behind the elements of the chart.",
  68. "background.elements.color.name": "Elements background color",
  69. "border.color.description": "The border color of the cells in the chart.",
  70. "border.color.name": "Cell border color",
  71. "border.width.description": "The border width of the cells in the chart.",
  72. "border.width.name": "Cell border width",
  73. "breadcrumb.display.description": "Displays hierarchy breadcrumb.",
  74. "breadcrumb.display.name": "Show breadcrumb",
  75. "color.dynamicPalette.max.description": "The color that is used for the maximum value of a dynamic palette.",
  76. "color.dynamicPalette.max.name": "Maximum value color",
  77. "color.dynamicPalette.mid.description": "The color that is used for the middle value of a dynamic palette.",
  78. "color.dynamicPalette.mid.name": "Middle value color",
  79. "color.dynamicPalette.min.description": "The color that is used for the minimum value of a dynamic palette.",
  80. "color.dynamicPalette.min.name": "Minimum value color",
  81. "color.null.description": "The color that is used for null values.",
  82. "color.null.name": "Null color",
  83. "color.palette.description": "The color palette that controls the colors or patterns that are applied to data elements in the chart.",
  84. "color.palette.name": "Color palette",
  85. "contrast.label.color.description": "Adjust the label color to contrast with background.",
  86. "contrast.label.color.name": "Contrast label color with background",
  87. "data.handling.description": "The configuration that is used to plot the data.",
  88. "data.handling.name": "Configuration",
  89. "datamodel.hierarchial.label": "Hierarchical data model",
  90. "datamodel.hierarchial.treemap.description": "The hierarchical (tree) model with children, size, color, and label.",
  91. "datamodel.tabular.label": "Tabular data model",
  92. "dataset.hierarchial.label": "Hierarchical data set",
  93. "dataset.hierarchial.treemap.description": "The root node of the hierarchical tree. The Children data slot is used to get each node's children.",
  94. "dataset.tabular.description": "The tabular data set of rows and columns.",
  95. "dataset.tabular.label": "Tabular data set",
  96. "dataset.tabular.link.description": "Determines the links between the nodes.",
  97. "dataset.tabular.link.label": "Tabular links data set",
  98. "dataset.tabular.node.description": "The tabular data set that defines the nodes.",
  99. "dataset.tabular.node.label": "Tabular node data set",
  100. "dataslot.categories.label": "Categories",
  101. "dataslot.category.label": "Category",
  102. "dataslot.children.description": "When applied to a tree node, returns the children of that node as an array-list.",
  103. "dataslot.children.label": "Children",
  104. "dataslot.color.description": "Determines the color of the shape.",
  105. "dataslot.color.label": "Color",
  106. "dataslot.hierarchial.treemap.description": "When applied to a tree node, these values return the children of that node as an array-list.",
  107. "dataslot.key.description": "Called for each row to match elements. Primarily used for transitions.",
  108. "dataslot.key.label": "Key",
  109. "dataslot.label.description": "Determines the label of the shape.",
  110. "dataslot.label.label": "Label",
  111. "dataslot.maximumValue.label": "Maximum value",
  112. "dataslot.size.treemap.description": "These values are used as the Value property of each node in the treemap layout.",
  113. "dataslot.source.label": "Source",
  114. "dataslot.sourceValue.label": "Source value",
  115. "dataslot.tabular.id.description": "The identifier for the nodes.",
  116. "dataslot.tabular.id.label": "Identifier",
  117. "dataslot.tabular.size.description": "Determines the size of the shape.",
  118. "dataslot.tabular.size.label": "Size",
  119. "dataslot.target.label": "Target",
  120. "dataslot.targetValue.label": "Target value",
  121. "dataslot.value.label": "Value",
  122. "dataslot.x.label": "X axis",
  123. "dataslot.y.label": "Y axis",
  124. "defaultPalette.description": "Rave2 default description",
  125. "defaultPalette.label": "Rave2 default",
  126. "effect.duration.description": "The animation duration, in ms.",
  127. "effect.duration.name": "Animation duration (ms)",
  128. "effect.name.description": "The effect that is used when the chart is drawn.",
  129. "effect.name.name": "Animation",
  130. "effect.name.options.none": "None",
  131. "effect.name.options.transition": "Transition",
  132. "grid.color.description": "The color of the grid lines.",
  133. "grid.color.name": "Grid lines color",
  134. "grid.display.description": "Shows or hides the grid lines.",
  135. "grid.display.name": "Show grid lines",
  136. "itemColor.description": "The tree level to use to color the squares in the treemap.",
  137. "itemColor.name": "Level to color squares",
  138. "itemColor.options.color": "Color",
  139. "itemColor.options.level1": "Level 1",
  140. "itemColor.options.level2": "Level 2",
  141. "itemColor.options.level3": "Level 3",
  142. "itemColor.options.level4": "Level 4",
  143. "itemColor.options.level5": "Level 5",
  144. "itemLabel.description": "The tree level to use to show labels.",
  145. "itemLabel.name": "Level to show labels",
  146. "itemLabel.options.level1": "Level 1",
  147. "itemLabel.options.level2": "Level 2",
  148. "itemLabel.options.level3": "Level 3",
  149. "itemLabel.options.level4": "Level 4",
  150. "itemLabel.options.level5": "Level 5",
  151. "label.display.description": "Shows or hides the labels.",
  152. "label.display.name": "Show labels",
  153. "label.shadow.description": "Show or hide shadow for labels.",
  154. "label.shadow.name": "Label shadow",
  155. "labelstyle.font.description": "The fonts for labels at the itemlabel level.",
  156. "labelstyle.font.name": "Label font",
  157. "layout.axissize.bottom.max.description": "The maximum size of the bottom axis, as a CSS size or percentage.",
  158. "layout.axissize.bottom.max.name": "Bottom axis maximum size",
  159. "layout.axissize.bottom.min.description": "The minimum size of the bottom axis, as a CSS size or percentage.",
  160. "layout.axissize.bottom.min.name": "Bottom axis minimum size",
  161. "layout.axissize.bottom.preferred.description": "The preferred size of the bottom axis, as a CSS size or percentage.",
  162. "layout.axissize.bottom.preferred.name": "Bottom axis preferred size",
  163. "layout.axissize.left.max.description": "The maximum size of the left axis, as a CSS size or percentage.",
  164. "layout.axissize.left.max.name": "Left axis maximum size",
  165. "layout.axissize.left.min.description": "The minimum size of the left axis, as a CSS size or percentage.",
  166. "layout.axissize.left.min.name": "Left axis minimum size",
  167. "layout.axissize.left.preferred.description": "The preferred size of the left axis, as a CSS size or percentage.",
  168. "layout.axissize.left.preferred.name": "Left axis preferred size",
  169. "layout.axissize.right.max.description": "The maximum size of the right axis, as a CSS size or percentage.",
  170. "layout.axissize.right.max.name": "Right axis maximum size",
  171. "layout.axissize.right.min.description": "The minimum size of the right axis, as a CSS size or percentage.",
  172. "layout.axissize.right.min.name": "Right axis minimum size",
  173. "layout.axissize.right.preferred.description": "The preferred size of the right axis, as a CSS size or percentage.",
  174. "layout.axissize.right.preferred.name": "Right axis preferred size",
  175. "layout.axissize.top.max.description": "The maximum size of the top axis, as a CSS size or percentage.",
  176. "layout.axissize.top.max.name": "Top axis maximum size",
  177. "layout.axissize.top.min.description": "The minimum size of the top axis, as a CSS size or percentage.",
  178. "layout.axissize.top.min.name": "Top axis minimum size",
  179. "layout.axissize.top.preferred.description": "The preferred size of the top axis, as a CSS size or percentage.",
  180. "layout.axissize.top.preferred.name": "Top axis preferred size",
  181. "layout.chart.padding.bottom.description": "The bottom padding for the chart.",
  182. "layout.chart.padding.bottom.name": "Bottom padding",
  183. "layout.chart.padding.left.description": "The left padding for the chart.",
  184. "layout.chart.padding.left.name": "Left padding",
  185. "layout.chart.padding.right.description": "Right padding for the chart.",
  186. "layout.chart.padding.right.name": "Right padding",
  187. "layout.chart.padding.top.description": "The top padding for the chart.",
  188. "layout.chart.padding.top.name": "Top padding",
  189. "layout.legendchart.align.description": "Whether to align the legend to the interior of the chart.",
  190. "layout.legendchart.align.name": "Align legend to chart",
  191. "layout.legendchart.gap.description": "Space between the chart and the legend, as a CSS size or percentage.",
  192. "layout.legendchart.gap.name": "Space between legend and chart",
  193. "layout.legendsize.max.description": "The maximum size of the legend, as a CSS size or percentage.",
  194. "layout.legendsize.max.name": "Maximum size",
  195. "layout.legendsize.min.description": "The minimum size of the legend, as a CSS size or percentage.",
  196. "layout.legendsize.min.name": "Minimum size",
  197. "layout.legendsize.preferred.description": "The preferred size of the legend, as a CSS size or percentage.",
  198. "layout.legendsize.preferred.name": "Preferred size",
  199. "layout.padding.description": "The padding around the chart and legend.",
  200. "layout.padding.name": "Padding",
  201. "leadLabel.display.description": "Show or hide parent labels",
  202. "leadLabel.display.name": "Lead labels",
  203. "legend.display.description": "Shows or hides the legend.",
  204. "legend.display.falseLabel": "Hide",
  205. "legend.display.name": "Show legend",
  206. "legend.display.trueLabel": "Show",
  207. "legend.entrystyle.font.description": "The font properties of the legend entry.",
  208. "legend.entrystyle.font.name": "Entry font",
  209. "legend.position.description": "The position of the legend in the chart.",
  210. "legend.position.name": "Legend position",
  211. "legend.position.options.bottom": "Bottom",
  212. "legend.position.options.left": "Left",
  213. "legend.position.options.right": "Right",
  214. "legend.position.options.top": "Top",
  215. "legend.title.description": "The title of the legend.",
  216. "legend.title.name": "Title",
  217. "legend.titlestyle.fill.description": "The color of the legend title.",
  218. "legend.titlestyle.fill.name": "Title color",
  219. "legend.titlestyle.font.description": "The font properties of the legend title.",
  220. "legend.titlestyle.font.name": "Title font",
  221. "legend.titlestyle.fontfamily.description": "The font family of the legend title.",
  222. "legend.titlestyle.fontfamily.name": "Title font family",
  223. "legend.titlestyle.fontsize.description": "The font size of the legend title.",
  224. "legend.titlestyle.fontsize.name": "Title font size",
  225. "mode.description": "The algorithm that is applied to the treemap layout.",
  226. "mode.name": "Layout mode",
  227. "mode.options.dice": "Dice",
  228. "mode.options.slice": "Slice",
  229. "mode.options.slice-dice": "Slice-dice",
  230. "mode.options.squarify": "Squarify",
  231. "propertyPresentation.advanced.axisSizeProperties.description": "Axis size properties.",
  232. "propertyPresentation.advanced.axisSizeProperties.label": "Axis size",
  233. "propertyPresentation.advanced.clientBehaviorProperties.description": "Client side properties.",
  234. "propertyPresentation.advanced.clientBehaviorProperties.label": "Client behavior",
  235. "propertyPresentation.advanced.commonProperties.description": "Common properties.",
  236. "propertyPresentation.advanced.commonProperties.label": "Common",
  237. "propertyPresentation.advanced.description": "Advanced list of all properties in a grouped structure.",
  238. "propertyPresentation.advanced.label": "Advanced",
  239. "propertyPresentation.advanced.labelProperties.description": "Label properties",
  240. "propertyPresentation.advanced.labelProperties.label": "Label",
  241. "propertyPresentation.advanced.legendProperties.description": "Legend properties.",
  242. "propertyPresentation.advanced.legendProperties.label": "Legend",
  243. "propertyPresentation.advanced.xAxisProperties.description": "X-axis properties.",
  244. "propertyPresentation.advanced.xAxisProperties.label": "X-axis",
  245. "propertyPresentation.advanced.yAxisProperties.description": "Y-axis properties.",
  246. "propertyPresentation.advanced.yAxisProperties.label": "Y-axis",
  247. "propertyPresentation.simple.description": "Simple list of the most common properties.",
  248. "propertyPresentation.simple.label": "Simple",
  249. "rave2.colorpalette.blueContinuousSequential.description": "Blue continuous sequential description",
  250. "rave2.colorpalette.blueContinuousSequential.label": "Blue continuous sequential",
  251. "rave2.colorpalette.blueDiscreteSequential.description": "Blue discrete sequential description",
  252. "rave2.colorpalette.blueDiscreteSequential.label": "Blue discrete sequential",
  253. "rave2.colorpalette.blueGreenContinuousDivergent.description": "Blue green continuous divergent description",
  254. "rave2.colorpalette.blueGreenContinuousDivergent.label": "Blue green continuous divergent",
  255. "rave2.colorpalette.blueGreenDiscreteDivergent.description": "Blue green discrete divergent description",
  256. "rave2.colorpalette.blueGreenDiscreteDivergent.label": "Blue green discrete divergent",
  257. "rave2.colorpalette.dark.description": "Dark description",
  258. "rave2.colorpalette.dark.label": "Dark",
  259. "rave2.colorpalette.financial.description": "Financial description",
  260. "rave2.colorpalette.financial.label": "Financial",
  261. "rave2.colorpalette.greenContinuousSequential.description": "Green continuous sequential description",
  262. "rave2.colorpalette.greenContinuousSequential.label": "Green continuous sequential",
  263. "rave2.colorpalette.greenDiscreteSequential.description": "Green discrete sequential description",
  264. "rave2.colorpalette.greenDiscreteSequential.label": "Green discrete sequential",
  265. "rave2.colorpalette.light.description": "Light description",
  266. "rave2.colorpalette.light.label": "Light",
  267. "rave2.colorpalette.medical.description": "Medical description",
  268. "rave2.colorpalette.medical.label": "Medical",
  269. "rave2.colorpalette.orangeContinuousSequential.description": "Orange continuous sequential description",
  270. "rave2.colorpalette.orangeContinuousSequential.label": "Orange continuous sequential",
  271. "rave2.colorpalette.orangeDiscreteSequential.description": "Orange discrete sequential description",
  272. "rave2.colorpalette.orangeDiscreteSequential.label": " Orange discrete sequential",
  273. "rave2.colorpalette.purpleContinuousSequential.description": "Purple continuous sequential description",
  274. "rave2.colorpalette.purpleContinuousSequential.label": "Purple continuous sequential",
  275. "rave2.colorpalette.purpleDiscreteSequential.description": "Purple discrete sequential description",
  276. "rave2.colorpalette.purpleDiscreteSequential.label": "Purple discrete sequential",
  277. "rave2.colorpalette.redBlueContinuousDivergent.description": "Red blue continuous divergent description",
  278. "rave2.colorpalette.redBlueContinuousDivergent.label": "Red blue continuous divergent",
  279. "rave2.colorpalette.redBlueDiscreteDivergent.description": "Red blue discrete divergent description",
  280. "rave2.colorpalette.redBlueDiscreteDivergent.label": "Red blue discrete divergent",
  281. "rave2.colorpalette.redBlueInverseContinuousDivergent.description": "Red blue inverse continuous divergent description",
  282. "rave2.colorpalette.redBlueInverseContinuousDivergent.label": "Red blue inverse continuous divergent",
  283. "rave2.colorpalette.redBlueInverseDiscreteDivergent.description": "Red blue inverse discrete divergent description",
  284. "rave2.colorpalette.redBlueInverseDiscreteDivergent.label": "Red blue inverse discrete divergent",
  285. "rave2.colorpalette.redContinuousSequential.description": "Red continuous sequential description",
  286. "rave2.colorpalette.redContinuousSequential.label": "Red continuous sequential",
  287. "rave2.colorpalette.redDiscreteSequential.description": "Red discrete sequential description",
  288. "rave2.colorpalette.redDiscreteSequential.label": " Red discrete sequential",
  289. "rave2.colorpalette.redGreenContinuousDivergent.description": "Red green continuous divergent description",
  290. "rave2.colorpalette.redGreenContinuousDivergent.label": "Red green continuous divergent",
  291. "rave2.colorpalette.redGreenDiscreteDivergent.description": "Red green discrete divergent description",
  292. "rave2.colorpalette.redGreenDiscreteDivergent.label": "Red green discrete divergent",
  293. "rave2.colorpalette.redGreenInverseContinuousDivergent.description": "Red green inverse continuous divergent description",
  294. "rave2.colorpalette.redGreenInverseContinuousDivergent.label": "Red green inverse continuous divergent",
  295. "rave2.colorpalette.redGreenInverseDiscreteDivergent.description": "Red green inverse discrete divergent description",
  296. "rave2.colorpalette.redGreenInverseDiscreteDivergent.label": "Red green inverse discrete divergent",
  297. "rave2.colorpalette.tealContinuousSequential.description": "Teal continuous sequential description",
  298. "rave2.colorpalette.tealContinuousSequential.label": "Teal continuous sequential",
  299. "rave2.colorpalette.tealDiscreteSequential.description": "Teal discrete sequential description",
  300. "rave2.colorpalette.tealDiscreteSequential.label": "Teal discrete sequential",
  301. "rave2.colorpalette.tealPurpleContinuousDivergent.description": "Teal purple continuous divergent description",
  302. "rave2.colorpalette.tealPurpleContinuousDivergent.label": "Teal purple continuous divergent",
  303. "rave2.colorpalette.tealPurpleDiscreteDivergent.description": "Teal purple discrete divergent description",
  304. "rave2.colorpalette.tealPurpleDiscreteDivergent.label": "Teal purple discrete divergent",
  305. "rave2.colorpalette.violetContinuousSequential.description": "Violet continuous sequential description",
  306. "rave2.colorpalette.violetContinuousSequential.label": "Violet continuous sequential",
  307. "rave2.colorpalette.violetDiscreteSequential.description": "Violet discrete sequential description",
  308. "rave2.colorpalette.violetDiscreteSequential.label": "Violet discrete sequential",
  309. "rave2.colorpalette.yellowContinuousSequential.description": "Yellow continuous sequential description",
  310. "rave2.colorpalette.yellowContinuousSequential.label": "Yellow continuous sequential",
  311. "rave2.colorpalette.yellowDiscreteSequential.description": "Yellow discrete sequential description",
  312. "rave2.colorpalette.yellowDiscreteSequential.label": "Yellow discrete sequential",
  313. "sizeOrCount.description": "Sizes the treemap cells evenly or by size data slot.",
  314. "sizeOrCount.name": "Square by",
  315. "sizeOrCount.options.count": "Count",
  316. "sizeOrCount.options.size": "Size",
  317. "sort.description": "Sorts the cells.",
  318. "sort.name": "Sort cells",
  319. "sort.options.ascending": "Ascending",
  320. "sort.options.descending": "Descending",
  321. "sort.options.none": "None",
  322. "transpose.description": "When set to Yes, the Y-axis shows the independent scale and the X-axis shows the dependent scale.",
  323. "transpose.falseLabel": "Do not transpose",
  324. "transpose.name": "Switch X and Y axes",
  325. "transpose.trueLabel": "Transpose",
  326. "treemap.config.treemap.description": "Treemaps show relationships among large numbers of components using size and color in a set of nested rectangles. On a treemap by value, the size of each rectangle is driven by one value, and the color by another value. You can use treemaps to identify patterns and exceptions.",
  327. "treemap.config.treemap.label": "Treemap",
  328. "treemap.description": "Treemaps show relationships among large numbers of components using size and color in a set of nested rectangles.",
  329. "treemap.falseBreadcrumb.hide": "Hide breadcrumb",
  330. "treemap.falseLabel.hide": "Hide",
  331. "treemap.label": "Treemap",
  332. "treemap.propertyPresentation.advanced.treemapSpecificProperties.description": "Treemap-specific properties",
  333. "treemap.propertyPresentation.advanced.treemapSpecificProperties.label": "Treemap",
  334. "treemap.trueBreadcrumb.show": "Show breadcrumb",
  335. "treemap.trueLabel.show": "Show"
  336. }
  337. },{}],3:[function(require,module,exports){
  338. (function() {
  339. var $ = {};
  340. // $source: com/ibm/rave/bundles/internal/nativeImpl/BundleModuleHeader
  341. /************************************************************************
  342. ** IBM Confidential
  343. **
  344. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  345. **
  346. ** (C) Copyright IBM Corp. 2015
  347. **
  348. ** The source code for this program is not published or otherwise divested of its trade secrets,
  349. ** irrespective of what has been deposited with the U.S. Copyright Office.
  350. ************************************************************************/
  351. var com_ibm_rave_library_Library = rave["library"];
  352. rave["internal"]["Declare"] = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"];
  353. rave["internal"]["CSSUtil"]= rave["_"]["com_ibm_rave_core_internal_css_CSSUtil"];
  354. // $source: com/ibm/rave/bundles/RaveBundle
  355. /************************************************************************
  356. ** IBM Confidential
  357. **
  358. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  359. **
  360. ** (C) Copyright IBM Corp. 2017
  361. **
  362. ** The source code for this program is not published or otherwise divested of its trade secrets,
  363. ** irrespective of what has been deposited with the U.S. Copyright Office.
  364. ************************************************************************/
  365. // GENERATED
  366. //@import com/ibm/rave/bundles/internal/nativeImpl/RaveBundleResourceLoader (runtime) // new
  367. /**
  368. * A RaveBundle extends the regular Bundle abstract class but includes common functionality for Rave-made bundles that aren't for general use.
  369. */
  370. var com_ibm_rave_bundles_RaveBundle = rave['internal']['Declare'](rave['library']['internal']['Bundle'], {
  371. /** @expose */
  372. loader : null,
  373. /** @expose */
  374. constructor : function() {
  375. ;
  376. ;
  377. ;
  378. ;
  379. ;
  380. ;
  381. this.loader = new com_ibm_rave_bundles_internal_nativeImpl_RaveBundleResourceLoader("/com/ibm/rave/bundles/" + this.getName());
  382. },
  383. /**
  384. * Load extra resources required for this bundle. Currently the compiled configuration.json file. And .css.
  385. */
  386. /** @expose */
  387. loadResources : function() {
  388. this.setMessageCatalog(rave['library']['internal']['Bundle'].DEFAULT_LOCALE, require("./i18n/messages_en.json"));
  389. var array = require("./configuration/configuration.json");
  390. if (array) {
  391. for (var __i_enFor0 = 0, __exp_enFor0 = array, __len_enFor0 = __exp_enFor0.length;
  392. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  393. var artifact = __exp_enFor0[__i_enFor0];
  394. this.initialize(artifact);
  395. }
  396. }
  397. require("./vizlibrary.css");
  398. }
  399. });
  400. //com_ibm_rave_bundles_RaveBundle.CONFIGURATION_FILE = "./configuration/configuration.json";
  401. // $source: com/ibm/rave/bundles/internal/nativeImpl/RaveBundleResourceLoader
  402. // Intentionally empty - everything in this file is inlined
  403. var com_ibm_rave_bundles_internal_nativeImpl_RaveBundleResourceLoader = function(){};
  404. // $source: com/ibm/rave/bundles/views/BundleView
  405. /************************************************************************
  406. ** IBM Confidential
  407. **
  408. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  409. **
  410. ** (C) Copyright IBM Corp. 2017
  411. **
  412. ** The source code for this program is not published or otherwise divested of its trade secrets,
  413. ** irrespective of what has been deposited with the U.S. Copyright Office.
  414. ************************************************************************/
  415. // GENERATED
  416. //@import com/ibm/rave/bundles/components/BackgroundComponentImpl (runtime) // new
  417. //@import com/ibm/rave/bundles/components/ChartLayoutComponentImpl (runtime) // new
  418. //@import com/ibm/rave/bundles/components/ClipPathComponentImpl (runtime) // new
  419. //@import com/ibm/rave/bundles/components/LegendsManager (runtime) // new
  420. //@import com/ibm/rave/bundles/components/AxesManager (runtime) // new
  421. //@import com/ibm/rave/library/Library (runtime) // Library
  422. //@import com/ibm/rave/bundles/components/IntervalDataUtilities (runtime) // IntervalDataUtilities
  423. //@import com/ibm/rave/bundles/data/PointDataUtilities (runtime) // PointDataUtilities
  424. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  425. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor
  426. var com_ibm_rave_bundles_views_BundleView = rave['internal']['Declare'](rave['library']['internal']['AbstractView'], {
  427. /**
  428. * Background component
  429. */
  430. /** @expose */
  431. _backgroundComponent : null,
  432. /**
  433. * Layout component
  434. */
  435. /** @expose */
  436. _layoutComponent : null,
  437. /**
  438. * Clip component
  439. */
  440. /** @expose */
  441. _clip : null,
  442. /**
  443. * Axes manager
  444. */
  445. /** @expose */
  446. _axes : null,
  447. /**
  448. * Legends manager
  449. */
  450. /** @expose */
  451. _legends : null,
  452. //_groupStructure : null,
  453. /** @expose */
  454. _chart : null,
  455. /** @expose */
  456. dataModel : null,
  457. /** @expose */
  458. _zoomP : null,
  459. /** @expose */
  460. _zoomS : null,
  461. /** @expose */
  462. constructor : function(context) {
  463. },
  464. /** @expose */
  465. getGroupStructure : function() {},
  466. /** @expose */
  467. setup : function() {
  468. rave['library']['internal']['AbstractView'].prototype.setup.call(this);
  469. this._backgroundComponent = new com_ibm_rave_bundles_components_BackgroundComponentImpl();
  470. this._layoutComponent = new com_ibm_rave_bundles_components_ChartLayoutComponentImpl();
  471. this._clip = new com_ibm_rave_bundles_components_ClipPathComponentImpl(this.context.instanceId() + "clipViewport");
  472. if (this.isZoomSupported()) {
  473. this.resetZoom();
  474. }
  475. this._legends = new com_ibm_rave_bundles_components_LegendsManager(this.context, this.getLegendCount());
  476. if (this.isAxesManagerRequired()) {
  477. this._axes = new com_ibm_rave_bundles_components_AxesManager(this.context);
  478. }
  479. this._groupStructure = this.getGroupStructure();
  480. },
  481. /** @expose */
  482. preDraw : function(chartId) {
  483. this.cancelTransitions();
  484. rave['library']['internal']['AbstractView'].createGroupStructure(this.context.node, this._groupStructure);
  485. this._chart = this.context.node.selectAll(chartId);
  486. },
  487. /** @expose */
  488. resetZoom : function() {
  489. this._zoomP = [0, 0, 0, 0];
  490. this._zoomS = [1, 1, 1, 1];
  491. },
  492. /** @expose */
  493. validateDataModel : function(elementsToRemove) {
  494. if (elementsToRemove !== null || arguments.length > 1){
  495. elementsToRemove = Array.prototype.slice.call(arguments);
  496. }
  497. {
  498. this.dataModel = this.context.dataModel();
  499. if (!(this.dataValid())) {
  500. for (var __i_enFor0 = 0, __len_enFor0 = elementsToRemove.length;
  501. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  502. var e = elementsToRemove[__i_enFor0];
  503. this._chart.selectAll(e).selectAll("*").remove();
  504. }
  505. this._legends.visible(false).draw();
  506. return false;
  507. }
  508. return true;
  509. }
  510. },
  511. /** @expose */
  512. dataValid : function() {
  513. return this.dataModel.validate();
  514. },
  515. /** @expose */
  516. getLegendCount : function() {
  517. return 1;
  518. },
  519. /** @expose */
  520. isAxesManagerRequired : function() {
  521. return false;
  522. },
  523. /** @expose */
  524. isZoomSupported : function() {
  525. return true;
  526. },
  527. /** @expose */
  528. getProperty : function(s) {
  529. return this.context.getPropertyValue(s);
  530. },
  531. /** @expose */
  532. getPropertyDefault : function(s) {
  533. return this.context.getPropertyDefault(s);
  534. },
  535. /** @expose */
  536. getBooleanProperty : function(s) {
  537. var obj = this.getProperty(s);
  538. return (obj);
  539. },
  540. /** @expose */
  541. getDoubleProperty : function(s) {
  542. var obj = this.getProperty(s);
  543. return + (obj);
  544. },
  545. /** @expose */
  546. getIntProperty : function(s) {
  547. var obj = this.getProperty(s);
  548. return ~~ (obj);
  549. },
  550. /**
  551. * @param (String) id Property ID
  552. * @return (String) Property value as a string
  553. */
  554. /** @expose */
  555. getStringProperty : function(id) {
  556. var obj = this.getProperty(id);
  557. return (obj == null) ? null : ""+(obj);
  558. },
  559. /**
  560. * @param (String) id Property ID
  561. * @return (String) Property value as a string, returning null for the empty string
  562. */
  563. /** @expose */
  564. getStringPropertyEmptyAsNull : function(id) {
  565. var s = this.getStringProperty(id);
  566. return (s == null || s.length == 0) ? null : s;
  567. },
  568. /**
  569. * @param (String) id Property ID
  570. * @return (Number) Property value as a string, containing size as the number of pixels
  571. */
  572. /** @expose */
  573. getCSSSizeToPixelNumber : function(id) {
  574. var cssSize = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(this.context.getPropertyValue(id), 100.0, 10.0);
  575. return (cssSize == null) ? 0.0 : cssSize;
  576. },
  577. /**
  578. * Based on effect duration and effect property, determine the effect duration in ms.
  579. * @param (String) effect Effect name, one of the options available from EFFECT_OPTIONS.
  580. * @return (int) Effect duration in ms.
  581. */
  582. /** @expose */
  583. getEffectDuration : function(effect) {
  584. var duration = this.getIntProperty("effect.duration");
  585. if ((duration < 0) || (effect == null) || "none" == effect) {
  586. duration = 0;
  587. }
  588. return duration;
  589. },
  590. /** @expose */
  591. getTopPadding : function() {
  592. return this.getProperty("layout.chart.padding.top");
  593. },
  594. /** @expose */
  595. getLeftPadding : function() {
  596. return this.getProperty("layout.chart.padding.left");
  597. },
  598. /** @expose */
  599. getBottomPadding : function() {
  600. return this.getProperty("layout.chart.padding.bottom");
  601. },
  602. /** @expose */
  603. getRightPadding : function() {
  604. return this.getProperty("layout.chart.padding.right");
  605. },
  606. /** @expose */
  607. getLayoutPadding : function() {
  608. return this.getProperty("layout.padding");
  609. },
  610. /** @expose */
  611. getLegendChartGap : function() {
  612. return this.getProperty("layout.legendchart.gap");
  613. },
  614. /** @expose */
  615. getLegendChartAlign : function() {
  616. return this.getBooleanProperty("layout.legendchart.align");
  617. },
  618. /** @expose */
  619. getLegendPosition : function() {
  620. return this.getStringProperty("legend.position");
  621. },
  622. getPalette$0 : function() {
  623. return this.getPalette$1("color.palette");
  624. },
  625. getPalette$1 : function(paletteID) {
  626. var id = this.getStringProperty(paletteID);
  627. var colorPalette = com_ibm_rave_library_Library.palettes.getPalette(id);
  628. return (!colorPalette) ? com_ibm_rave_library_Library.palettes.getDefaultPalette() : colorPalette;
  629. },
  630. getDynamicPalette$0 : function() {
  631. return this.getDynamicPalette$1("color.palette", "color.dynamicPalette.min", "color.dynamicPalette.mid", "color.dynamicPalette.max");
  632. },
  633. /**
  634. * 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.
  635. * @param (String) paletteID The palette ID
  636. * @return (rave['library']['internal']['Palette']) Palette
  637. */
  638. getDynamicPalette$1 : function(paletteID, minId, midId, maxId) {
  639. var colorPalette;
  640. var min = this.getStringProperty(minId);
  641. if (min != null) {
  642. var mid = this.getStringProperty(midId);
  643. if (mid != null) {
  644. var max = this.getStringProperty(maxId);
  645. if (max != null) {
  646. var fills = [min, mid, max];
  647. colorPalette = rave['library']['internal']['AbstractView'].getFillPalette(fills);
  648. }
  649. }
  650. }
  651. return (!colorPalette) ? this.getPalette(paletteID) : colorPalette;
  652. },
  653. /** @expose */
  654. prepareLayoutComponent : function() {
  655. 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());
  656. },
  657. /** @expose */
  658. prepareLayoutSizables : function(layoutComponent, useX2, useY1, useX1, useY2, useLegend) {
  659. layoutComponent.removeAxisSizables();
  660. if (useX1) {
  661. layoutComponent.addAxisSizable(this._axes.axisComponent(0));
  662. }
  663. if (useY1) {
  664. layoutComponent.addAxisSizable(this._axes.axisComponent(2));
  665. }
  666. if (useX2) {
  667. layoutComponent.addAxisSizable(this._axes.axisComponent(1));
  668. }
  669. if (useY2) {
  670. layoutComponent.addAxisSizable(this._axes.axisComponent(3));
  671. }
  672. layoutComponent.legendSize(useLegend ? this._legends : null);
  673. },
  674. /** @expose */
  675. resetUpdate : function() {
  676. this.updateType = 4;
  677. },
  678. /** @expose */
  679. isUpdateNothing : function() {
  680. return this.updateType == 4;
  681. },
  682. /** @expose */
  683. isShowLegend : function() {
  684. return this.getBooleanProperty("legend.display");
  685. },
  686. cancelTransitions : function() {
  687. this.context.node.selectAll("*").interrupt();
  688. },
  689. /** @expose */
  690. setBackgroundProperties : function(elementRect, duration) {
  691. this._backgroundComponent.setPreExecute(this.context.getPreExecute()).size(this.context.size).backgroundColor(this.getStringProperty("background.chart.color"));
  692. this.context.node.selectAll("rect.background.chart").transition().duration(duration).call(this._backgroundComponent);
  693. this._backgroundComponent.setPreExecute(this.context.getPreExecute()).rect(elementRect).backgroundColor(this.getStringProperty("background.elements.color"));
  694. this.context.node.selectAll("rect.background.elements").transition().duration(duration).call(this._backgroundComponent);
  695. },
  696. /** @expose */
  697. isShowDataLabels : function() {
  698. return this.getBooleanProperty("data.label.display");
  699. },
  700. /** @expose */
  701. isShowDataLabelsAsPercentageOfColor : function() {
  702. var dataLabel = this.getStringProperty("data.label.type");
  703. return "PercentOfColor" == dataLabel;
  704. },
  705. /** @expose */
  706. isShowDataLabelsAsPercentageOfCategory : function() {
  707. var dataLabel = this.getStringProperty("data.label.type");
  708. return "PercentOfCategory" == dataLabel;
  709. },
  710. /** @expose */
  711. getlDataLabelAccessor : function(dataSet, slot, isInterval) {
  712. var labelAccessor;
  713. var labelEntry = dataSet.slot(slot).entry();
  714. if (!labelEntry) {
  715. if (this.isShowDataLabelsAsPercentageOfCategory()) {
  716. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR;
  717. } else if (this.isShowDataLabelsAsPercentageOfColor()) {
  718. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_COLOR_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_COLOR_ACCESSOR;
  719. } else {
  720. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.VALUE_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR;
  721. }
  722. } else {
  723. labelAccessor = rave['library']['internal']['AbstractView'].originalDatumAccessor(rave['library']['internal']['AbstractView'].accessorOf(labelEntry));
  724. }
  725. return labelAccessor;
  726. },
  727. /** @expose */
  728. getEntryForDataLabelFormatter : function(dataSet, labelSlot, defaultSlot) {
  729. var labelEntry = dataSet.slot(labelSlot).entry();
  730. return labelEntry ? labelEntry : dataSet.slot(defaultSlot).entry();
  731. },
  732. /** @expose */
  733. getBackgroundConstrastLabelStyle : function() {
  734. var labelFontStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(this.getStringProperty("labelstyle.font"));
  735. if (this.getBooleanProperty("contrast.label.color") == false) {
  736. return labelFontStyle;
  737. }
  738. var defaultFillColor;
  739. if (labelFontStyle) {
  740. defaultFillColor = labelFontStyle["fill"];
  741. if (defaultFillColor == null) {
  742. defaultFillColor = labelFontStyle["color"];
  743. }
  744. } else {
  745. labelFontStyle = {};
  746. }
  747. if (defaultFillColor == null) {
  748. defaultFillColor = "#000000";
  749. }
  750. labelFontStyle["fill"] = com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(this.getStringProperty("background.elements.color"), defaultFillColor);
  751. return labelFontStyle;
  752. },
  753. /** @expose */
  754. getPalette : function(a0) {
  755. var args = arguments;
  756. if (args.length == 0) {
  757. return this.getPalette$0();
  758. }
  759. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  760. return this.getPalette$1(a0);
  761. }
  762. return rave['library']['internal']['AbstractView'].prototype.getPalette.apply(this, args);
  763. },
  764. /** @expose */
  765. getDynamicPalette : function(a0, a1, a2, a3) {
  766. var args = arguments;
  767. if (args.length == 0) {
  768. return this.getDynamicPalette$0();
  769. }
  770. return this.getDynamicPalette$1(a0, a1, a2, a3);
  771. }
  772. });
  773. // $source: com/ibm/rave/bundles/components/BundleComponentImpl
  774. /************************************************************************
  775. ** IBM Confidential
  776. **
  777. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  778. **
  779. ** (C) Copyright IBM Corp. 2017
  780. **
  781. ** The source code for this program is not published or otherwise divested of its trade secrets,
  782. ** irrespective of what has been deposited with the U.S. Copyright Office.
  783. ************************************************************************/
  784. // GENERATED
  785. var com_ibm_rave_bundles_components_BundleComponentImpl = rave['internal']['Declare']({
  786. /**
  787. * The pre-execution callback.
  788. */
  789. //_preExecuteCallback : null,
  790. /**
  791. * The render callback.
  792. */
  793. /** @expose */
  794. _renderCallback : null,
  795. _$functionClassMethod : function() {
  796. var _$self = function(args) {
  797. if (args !== null || arguments.length > 1){
  798. args = Array.prototype.slice.call(arguments, 0);
  799. }
  800. {
  801. var self = _$self;
  802. this.each(function(data, index, groupIndex) {
  803. self.execute(rave.select(this));
  804. });
  805. return null;
  806. }
  807. };
  808. return _$self;
  809. },
  810. /**
  811. * 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.
  812. * @param (rave['internal']['Selector']) g <g> node that this component will be applied to.
  813. */
  814. /** @expose */
  815. execute : function(g) {},
  816. /**
  817. * Set the pre-execute callback for this component.
  818. * @param (rave['library']['internal']['ComponentCallback']) callback The callback
  819. */
  820. /** @expose */
  821. setPreExecute : function(callback) {
  822. this._preExecuteCallback = callback;
  823. return this;
  824. },
  825. /**
  826. * If the pre-execute component is non-null, call it with this object. Note that this object must also implement BundleComponent.
  827. */
  828. /** @expose */
  829. preExecute : function() {
  830. if (this._preExecuteCallback) {
  831. this._preExecuteCallback(this);
  832. }
  833. },
  834. /**
  835. * Set the render callback for this component.
  836. * @param (rave['internal']['RunFunction']) callback The callback
  837. */
  838. /** @expose */
  839. setRenderCallback : function(callback) {
  840. this._renderCallback = callback;
  841. return this;
  842. },
  843. /**
  844. * 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.
  845. */
  846. /** @expose */
  847. type : function() {},
  848. /** @expose */
  849. updateBorder : function(s, borderWidth, borderColor) {
  850. if (borderWidth != null) {
  851. s.each(function(data, index, groupIndex) {
  852. if (!((this.rave_getProperty("selected"))) && !((this.rave_getProperty("highlighted")))) {
  853. this.rave_setStyle("stroke-width", borderWidth, "");
  854. }
  855. });
  856. }
  857. if (borderColor != null) {
  858. s.each(function(data, index, groupIndex) {
  859. if (!((this.rave_getProperty("selected"))) && !((this.rave_getProperty("highlighted")))) {
  860. this.rave_setStyle("stroke", borderColor, "");
  861. }
  862. });
  863. }
  864. },
  865. /** @expose */
  866. getDefaultLabelColor : function(_labelStyle) {
  867. if (!_labelStyle) {
  868. return "#000000";
  869. }
  870. var defaultFillColor;
  871. if (_labelStyle) {
  872. defaultFillColor = _labelStyle["fill"];
  873. if (defaultFillColor == null) {
  874. defaultFillColor = _labelStyle["color"];
  875. }
  876. }
  877. if (defaultFillColor == null) {
  878. defaultFillColor = "#000000";
  879. }
  880. return defaultFillColor.toString();
  881. }
  882. });
  883. // $source: com/ibm/rave/bundles/component/BackgroundComponent
  884. /************************************************************************
  885. ** IBM Confidential
  886. **
  887. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  888. **
  889. ** (C) Copyright IBM Corp. 2017
  890. **
  891. ** The source code for this program is not published or otherwise divested of its trade secrets,
  892. ** irrespective of what has been deposited with the U.S. Copyright Office.
  893. ************************************************************************/
  894. // GENERATED
  895. /**
  896. * <p> A component that renders the background to the chart. The {@link #this.type()} method returns "BackgroundComponent". </p>
  897. */
  898. var com_ibm_rave_bundles_component_BackgroundComponent = rave['internal']['Declare'].implement(
  899. /**
  900. * Get the background color.
  901. * @return (String) The background color
  902. */
  903. //backgroundColor : function() {},
  904. /**
  905. * Set the background color. If the color is null, white is used.
  906. * @param (String) backgroundColor The new background color
  907. * @return (com.ibm.rave.bundles.component.BackgroundComponent) This object
  908. */
  909. //backgroundColor : function(backgroundColor) {}
  910. );
  911. /**
  912. * The string returned by {@link #this.type()} is "BackgroundComponent".
  913. */
  914. /** @expose */
  915. com_ibm_rave_bundles_component_BackgroundComponent.COMPONENT_TYPE = "BackgroundComponent";
  916. // $source: com/ibm/rave/bundles/component/ChartLayoutComponent
  917. /************************************************************************
  918. ** IBM Confidential
  919. **
  920. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  921. **
  922. ** (C) Copyright IBM Corp. 2017
  923. **
  924. ** The source code for this program is not published or otherwise divested of its trade secrets,
  925. ** irrespective of what has been deposited with the U.S. Copyright Office.
  926. ************************************************************************/
  927. // GENERATED
  928. /**
  929. * <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>
  930. */
  931. var com_ibm_rave_bundles_component_ChartLayoutComponent = rave['internal']['Declare'].implement(
  932. //padding : function() {},
  933. //topPadding : function() {},
  934. //leftPadding : function() {},
  935. //bottomPadding : function() {},
  936. //rightPadding : function() {},
  937. //legendChartAlign : function() {},
  938. //legendPosition : function() {},
  939. //legendChartGap : function() {},
  940. //legendPosition : function(position) {},
  941. //topPadding : function(value) {},
  942. //leftPadding : function(value) {},
  943. //bottomPadding : function(value) {},
  944. //rightPadding : function(value) {},
  945. /**
  946. * Sets the padding around the outside of the chart/legend.
  947. * @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.
  948. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  949. */
  950. //padding : function(value) {},
  951. /**
  952. * Sets all chart paddings. Null values are treated as 0.
  953. * @param (Object) top New top padding
  954. * @param (Object) left New left padding
  955. * @param (Object) bottom New bottom padding
  956. * @param (Object) right New right padding
  957. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  958. * @deprecated Please use {@link #this.padding(Object)} and {@link #this.legendChartGap(Object)}
  959. */
  960. //chartPadding : function(top, left, bottom, right) {},
  961. /**
  962. * Sets whether the legend should align with the chart "body".
  963. * @param (boolean) legendChartAlign the boolean state
  964. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  965. */
  966. //legendChartAlign : function(legendChartAlign) {},
  967. /**
  968. * Set the space for the gap between chart and legend
  969. * @param (Object) value the gap distance (css length)
  970. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  971. */
  972. //legendChartGap : function(value) {},
  973. /**
  974. * Set the size information for the legend. Null value is treated as no visible legend.
  975. * @param (com.ibm.rave.bundles.component.ChartLayoutSizable) sizable An object that implements the ChartLayoutSizable interface
  976. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  977. */
  978. //legendSize : function(sizable) {},
  979. /**
  980. * Reset list of axis sizables to 0
  981. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  982. */
  983. //removeAxisSizables : function() {},
  984. /**
  985. * Add an axis to be considered in layout operation.
  986. * @param (com.ibm.rave.bundles.component.ChartLayoutSizable) sizable An object that implements the ChartLayoutSizable interface
  987. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  988. */
  989. //addAxisSizable : function(sizable) {}
  990. );
  991. /**
  992. * The string returned by {@link #this.type()} is "ChartLayoutComponent".
  993. */
  994. /** @expose */
  995. com_ibm_rave_bundles_component_ChartLayoutComponent.COMPONENT_TYPE = "ChartLayoutComponent";
  996. // $source: com/ibm/rave/bundles/components/LegendsManager
  997. /************************************************************************
  998. ** IBM Confidential
  999. **
  1000. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1001. **
  1002. ** (C) Copyright IBM Corp. 2017
  1003. **
  1004. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1005. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1006. ************************************************************************/
  1007. // GENERATED
  1008. //@import com/ibm/rave/bundles/components/LegendComponentImpl (runtime) // new, orientationOf
  1009. /**
  1010. * <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>
  1011. */
  1012. var com_ibm_rave_bundles_components_LegendsManager = rave['internal']['Declare']({
  1013. /**
  1014. * Bundle context
  1015. */
  1016. //_context : null,
  1017. /**
  1018. * Component used to draw all legends
  1019. */
  1020. //_comp : null,
  1021. /**
  1022. * Global visibility; if false no legends are drawn
  1023. */
  1024. //_visible : null,
  1025. /**
  1026. * Rectangle containing all legends
  1027. */
  1028. //_rectangle : null,
  1029. /**
  1030. * Legend orientation
  1031. */
  1032. //_orient : null,
  1033. /**
  1034. * Pre-execute component callback
  1035. */
  1036. //_preExecute : null,
  1037. /**
  1038. * Selectors for each legend
  1039. */
  1040. //_selectors : null,
  1041. /**
  1042. * Palettes for each legend
  1043. */
  1044. //_palettes : null,
  1045. /**
  1046. * Scale size functions for each legend
  1047. */
  1048. //_scale : null,
  1049. /**
  1050. * Swatch size functions for each legend
  1051. */
  1052. //_swatchSizes : null,
  1053. /**
  1054. * Shapes for each legend
  1055. */
  1056. //_shapes : null,
  1057. /**
  1058. * Titles for each legend
  1059. */
  1060. //_titles : null,
  1061. /**
  1062. * Title fonts for each legend
  1063. */
  1064. //_titleFonts : null,
  1065. /**
  1066. * Title fills for each legend
  1067. */
  1068. //_titleFills : null,
  1069. /**
  1070. * Title font sizes for each legend
  1071. */
  1072. //_titleFontSizes : null,
  1073. /**
  1074. * Title font families for each legend
  1075. */
  1076. //_titleFontFamilies : null,
  1077. /**
  1078. * Entry fonts for each legend
  1079. */
  1080. //_entryFonts : null,
  1081. /**
  1082. * Custom formatters for each legend, created from the registered custom formatters
  1083. */
  1084. //_formatters : null,
  1085. /**
  1086. * Whether each legend was visible in the last draw
  1087. */
  1088. //_lastVisible : null,
  1089. //_dataSlotEntries : null,
  1090. /**
  1091. * Number of legends
  1092. */
  1093. _numLegends : 0,
  1094. /**
  1095. * Whether to use a transition.
  1096. */
  1097. _doTransition : false,
  1098. /**
  1099. * Duration of the transition.
  1100. */
  1101. _duration : 0,
  1102. _spaceUsed : 0,
  1103. /**
  1104. * Construct the manager.
  1105. * @param (int) numLegends Number of legends, must be positive
  1106. */
  1107. /** @expose */
  1108. constructor : function(context, numLegends) {
  1109. this._context = context;
  1110. this._numLegends = numLegends;
  1111. this._comp = new com_ibm_rave_bundles_components_LegendComponentImpl();
  1112. this._rectangle = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1113. this._orient = "vertical";
  1114. this._preExecute = null;
  1115. this._selectors = [];
  1116. this._palettes = [];
  1117. this._scale = [];
  1118. this._swatchSizes = [];
  1119. this._shapes = [];
  1120. this._titles = [];
  1121. this._titleFonts = [];
  1122. this._titleFills = [];
  1123. this._titleFontSizes = [];
  1124. this._titleFontFamilies = [];
  1125. this._entryFonts = [];
  1126. this._formatters = [];
  1127. this._lastVisible = [];
  1128. this._visible = [];
  1129. this._dataSlotEntries = [];
  1130. for (var i = 0; i < this._numLegends; ++i) {
  1131. this._selectors[i] = null;
  1132. this._palettes[i] = null;
  1133. this._swatchSizes[i] = null;
  1134. this._shapes[i] = null;
  1135. this._titles[i] = null;
  1136. this._formatters[i] = null;
  1137. this._lastVisible[i] = false;
  1138. this._visible[i] = true;
  1139. }
  1140. },
  1141. /**
  1142. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) The legend component used by this manager; for unit tests
  1143. */
  1144. getLegendComponent : function() {
  1145. return this._comp;
  1146. },
  1147. /**
  1148. * Set a specific legend visible
  1149. * @param (int) legendIndex The index of the legend
  1150. * @param (boolean) visible New value of visible flag
  1151. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1152. */
  1153. visible$0 : function(legendIndex, visible) {
  1154. if (legendIndex < this._visible.length) {
  1155. this._visible[legendIndex] = visible;
  1156. }
  1157. return this;
  1158. },
  1159. /**
  1160. * Set all legend visible
  1161. * @param (boolean) visible New value of visible flag
  1162. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1163. */
  1164. visible$1 : function(visible) {
  1165. for (var i = 0; i < this._visible.length; ++i) {
  1166. this._visible[i] = visible;
  1167. }
  1168. return this;
  1169. },
  1170. /**
  1171. * Set the layout rectangle. The rectangle is copied. If it is null, the layout rectangle is unchanged.
  1172. * @param (rave['internal']['RectStruct']) rect New layout rectangle
  1173. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1174. */
  1175. /** @expose */
  1176. rectangle : function(rect) {
  1177. if (rect) {
  1178. this._rectangle = new rave['internal']['RectStruct'](rect.x, rect.y, rect.width, rect.height);
  1179. }
  1180. return this;
  1181. },
  1182. /**
  1183. * Set the orient property. If the argument is not "horizontal" or "vertical", the orient property is not changed.
  1184. * @param (String) orient New orient
  1185. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1186. */
  1187. /** @expose */
  1188. orient : function(orient) {
  1189. if ("horizontal" == orient || "vertical" == orient) {
  1190. this._orient = orient;
  1191. }
  1192. return this;
  1193. },
  1194. /**
  1195. * 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".
  1196. * @param (String) position Legend position
  1197. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1198. */
  1199. /** @expose */
  1200. position : function(position) {
  1201. return this.orient(com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf(position));
  1202. },
  1203. /**
  1204. * Set the transition information. If the duration is negative, 0 is used.
  1205. * @param (boolean) doTransition Whether to do a transition
  1206. * @param (int) duration Duration of the transition when used
  1207. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1208. */
  1209. /** @expose */
  1210. transition : function(doTransition, duration) {
  1211. this._doTransition = doTransition;
  1212. this._duration = (duration >= 0) ? duration : 0;
  1213. return this;
  1214. },
  1215. /**
  1216. * Set the pre-execute callback for all legends. The callback may be null.
  1217. * @param (rave['library']['internal']['ComponentCallback']) callback The callback
  1218. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1219. */
  1220. /** @expose */
  1221. setPreExecute : function(callback) {
  1222. this._preExecute = callback;
  1223. return this;
  1224. },
  1225. /**
  1226. * Set the selector to be used when rendering a legend. If the index is out of range no selectors change.
  1227. * @param (int) index Legend array index
  1228. * @param (rave['internal']['Selector']) selector Selector, may be null (but this is not advisable)
  1229. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1230. */
  1231. /** @expose */
  1232. selector : function(index, selector) {
  1233. if (index >= 0 && index < this._numLegends) {
  1234. this._selectors[index] = selector;
  1235. }
  1236. return this;
  1237. },
  1238. /**
  1239. * Set the palette of a legend. If the index is out of range no information is changed.
  1240. * @param (int) index Legend array index
  1241. * @param (rave['library']['internal']['Palette']) palette Palette, may be null
  1242. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1243. */
  1244. /** @expose */
  1245. palette : function(index, palette) {
  1246. if (index >= 0 && index < this._numLegends) {
  1247. this._palettes[index] = palette;
  1248. }
  1249. return this;
  1250. },
  1251. /**
  1252. * Set the shape of a legend. If the index is out of range no information is changed.
  1253. * @param (int) index Legend array index
  1254. * @param (String) shape Shape, may be null (defaulting to square)
  1255. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1256. */
  1257. /** @expose */
  1258. shape : function(index, shape) {
  1259. if (index >= 0 && index < this._numLegends) {
  1260. this._shapes[index] = shape;
  1261. }
  1262. return this;
  1263. },
  1264. /**
  1265. * Set the title of a legend. If the index is out of range no information is changed.
  1266. * @param (int) index Legend array index
  1267. * @param (String) title Title, may be null
  1268. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1269. */
  1270. /** @expose */
  1271. title : function(index, title) {
  1272. if (index >= 0 && index < this._numLegends) {
  1273. this._titles[index] = title;
  1274. }
  1275. return this;
  1276. },
  1277. /**
  1278. * Set the title font style of a legend. If the index is out of range no information is changed.
  1279. * @param (int) index Legend array index
  1280. * @param (String) titleFont Title font string, may be null
  1281. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1282. */
  1283. /** @expose */
  1284. titleFont : function(index, titleFont) {
  1285. if (index >= 0 && index < this._numLegends) {
  1286. this._titleFonts[index] = titleFont;
  1287. }
  1288. return this;
  1289. },
  1290. /**
  1291. * Set the entry font style of a legend. If the index is out of range no information is changed.
  1292. * @param (int) index Legend array index
  1293. * @param (String) entryFont Entry font string, may be null
  1294. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1295. */
  1296. /** @expose */
  1297. entryFont : function(index, entryFont) {
  1298. if (index >= 0 && index < this._numLegends) {
  1299. this._entryFonts[index] = entryFont;
  1300. }
  1301. return this;
  1302. },
  1303. /**
  1304. * Set the title fill of a legend. If the index is out of range no information is changed.
  1305. * @param (int) index Legend array index
  1306. * @param (String) titleFill Fill color string, may be null
  1307. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1308. */
  1309. /** @expose */
  1310. titleFill : function(index, titleFill) {
  1311. if (index >= 0 && index < this._numLegends) {
  1312. this._titleFills[index] = titleFill;
  1313. }
  1314. return this;
  1315. },
  1316. /**
  1317. * Set the title font size of a legend. If the index is out of range no information is changed.
  1318. * @param (int) index Legend array index
  1319. * @param (String) titleFontSize Font size string, may be null
  1320. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1321. */
  1322. /** @expose */
  1323. titleFontSize : function(index, titleFontSize) {
  1324. if (index >= 0 && index < this._numLegends) {
  1325. this._titleFontSizes[index] = titleFontSize;
  1326. }
  1327. return this;
  1328. },
  1329. /**
  1330. * Set the title font family of a legend. If the index is out of range no information is changed.
  1331. * @param (int) index Legend array index
  1332. * @param (String) titleFontFamily Font family string, may be null
  1333. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1334. */
  1335. /** @expose */
  1336. titleFontFamily : function(index, titleFontFamily) {
  1337. if (index >= 0 && index < this._numLegends) {
  1338. this._titleFontFamilies[index] = titleFontFamily;
  1339. }
  1340. return this;
  1341. },
  1342. /**
  1343. * Set the scale of a legend. If the index is out of range no information is changed.
  1344. * @param (int) index Legend array index
  1345. * @param (rave['internal']['AbstractScale']) scale Scale, may be null
  1346. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1347. */
  1348. /** @expose */
  1349. scale : function(index, scale) {
  1350. if (index >= 0 && index < this._numLegends) {
  1351. this._scale[index] = scale;
  1352. }
  1353. return this;
  1354. },
  1355. /**
  1356. * Set the swatch size function of a legend. If the index is out of range no information is changed.
  1357. * @param (int) index Legend array index
  1358. * @param (rave['internal']['ValueFunction']) swatchSize Swatch size function, may be null
  1359. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1360. */
  1361. /** @expose */
  1362. swatchSize : function(index, swatchSize) {
  1363. if (index >= 0 && index < this._numLegends) {
  1364. this._swatchSizes[index] = swatchSize;
  1365. }
  1366. return this;
  1367. },
  1368. /**
  1369. * 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.
  1370. * @param (int) index Legend array index
  1371. * @param (Array) entries List of data slot entries, if null an empty list is used
  1372. * @param (String) format One of {@link this.CustomFormatInfo#"none"} or {@link this.CustomFormatInfo#"percent"}
  1373. * @param (rave['internal']['ValueFunction']) defaultFunction Default function to use if no custom formatter is defined, may be null
  1374. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1375. */
  1376. /** @expose */
  1377. formatterList : function(index, entries, format, defaultFunction) {
  1378. if (index >= 0 && index < this._numLegends) {
  1379. this._formatters[index] = this._context.getCustomFormatterWithFlag(["legend", "all"], rave['library']['internal']['BundleContext'].makeCustomFormatInfo("legend-label", "ROLE_NONE", format, entries), defaultFunction, false);
  1380. }
  1381. return this;
  1382. },
  1383. /**
  1384. * 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.
  1385. * @param (int) index Legend array index
  1386. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  1387. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1388. */
  1389. /** @expose */
  1390. formatter : function(index, entry) {
  1391. var entries = [];
  1392. if (entry) {
  1393. entries.push(entry);
  1394. }
  1395. return this.formatterList(index, entries, "none", null);
  1396. },
  1397. /**
  1398. * 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.
  1399. * @return (boolean) Whether any legend are visible (will be drawn)
  1400. */
  1401. /** @expose */
  1402. anyVisible : function() {
  1403. for (var i = 0; i < this._numLegends; ++i) {
  1404. if (this._visible[i] == true && (this._palettes[i] || this._swatchSizes[i])) {
  1405. return true;
  1406. }
  1407. }
  1408. return false;
  1409. },
  1410. /**
  1411. * 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'])} .
  1412. * @param (int) index Legend array index
  1413. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  1414. * @return (com.ibm.rave.bundles.components.LegendsManager) This LegendsManager
  1415. */
  1416. /** @expose */
  1417. setDataSlot : function(index, entry) {
  1418. if (index >= 0 && index < this._numLegends) {
  1419. this._dataSlotEntries[index] = entry;
  1420. }
  1421. return this.formatter(index, entry);
  1422. },
  1423. preLayout$0 : function(layoutComponent) {
  1424. this.preLayout$1(layoutComponent, true);
  1425. return this;
  1426. },
  1427. preLayout$1 : function(layoutComponent, axesBeforeLegend) {
  1428. var layoutTransition = this._doTransition;
  1429. var layoutDuration = this._duration;
  1430. this._doTransition = false;
  1431. this._duration = 0;
  1432. var children = [];
  1433. for (var i = 0; i < this._numLegends; ++i) {
  1434. children[i] = "g.layoutLegend-" + i;
  1435. }
  1436. rave['library']['internal']['AbstractView'].createGroupStructure(this._context.node.select("g.legends-layout"), children);
  1437. var layoutSelectors = [];
  1438. var layoutLastVisible = [];
  1439. for (var i = 0; i < this._numLegends; ++i) {
  1440. layoutSelectors[i] = this._selectors[i];
  1441. layoutLastVisible[i] = this._lastVisible[i];
  1442. this._lastVisible[i] = false;
  1443. if (this._selectors[i]) {
  1444. this._selectors[i] = this._context.node.select("g.layoutLegend-" + i);
  1445. }
  1446. }
  1447. layoutComponent.preLayout(true, !axesBeforeLegend);
  1448. this.rectangle(layoutComponent.legendRect());
  1449. this.draw();
  1450. this._doTransition = layoutTransition;
  1451. this._duration = layoutDuration;
  1452. this._context.node.select("g.legends-layout").selectAll("*").remove();
  1453. for (var i = 0; i < this._numLegends; ++i) {
  1454. this._lastVisible[i] = layoutLastVisible[i];
  1455. this._selectors[i] = layoutSelectors[i];
  1456. }
  1457. return this;
  1458. },
  1459. /**
  1460. * Render the legends using the current global and per-legend settings.
  1461. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1462. */
  1463. /** @expose */
  1464. draw : function() {
  1465. var nVisible = 0;
  1466. for (var i = 0; i < this._numLegends; ++i) {
  1467. if ((this._swatchSizes[i] || this._palettes[i]) && this._visible[i]) {
  1468. nVisible++;
  1469. }
  1470. }
  1471. var x = this._rectangle.x;
  1472. var y = this._rectangle.y;
  1473. var dx;
  1474. var dy;
  1475. var size;
  1476. if (nVisible == 0) {
  1477. dx = 0;
  1478. dy = 0;
  1479. size = [this._rectangle.width, this._rectangle.height];
  1480. } else if ("horizontal" == this._orient) {
  1481. dx = this._rectangle.width / nVisible;
  1482. dy = 0;
  1483. size = [dx, this._rectangle.height];
  1484. } else {
  1485. dx = 0;
  1486. dy = this._rectangle.height / nVisible;
  1487. size = [this._rectangle.width, dy];
  1488. }
  1489. this._comp.orient(this._orient).size(size);
  1490. this._spaceUsed = 0;
  1491. for (var i = 0; i < this._numLegends; ++i) {
  1492. if (this._selectors[i]) {
  1493. var visible = this._visible[i] && (this._palettes[i] || this._swatchSizes[i]);
  1494. 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]);
  1495. var fontStyle = this._context.getPropertyValue("legend.titlestyle.font");
  1496. if (this._titleFonts[i] != null && !(this._titleFonts[i] == "")) {
  1497. this._comp.titleFont(this._titleFonts[i]);
  1498. } else if (fontStyle != null && !(fontStyle == "")) {
  1499. this._comp.titleFont(this._context.getPropertyValue("legend.titlestyle.font"));
  1500. }
  1501. fontStyle = this._context.getPropertyValue("legend.entrystyle.font");
  1502. if (this._entryFonts[i] != null) {
  1503. this._comp.entryFont(this._entryFonts[i]);
  1504. } else if (fontStyle != null && !(fontStyle == "")) {
  1505. this._comp.entryFont(this._context.getPropertyValue("legend.entrystyle.font"));
  1506. }
  1507. var s = (this._doTransition && this._lastVisible[i]) ? this._selectors[i].transition("transition").duration(this._duration) : this._selectors[i];
  1508. s.attr("transform", "translate(" + x + "," + y + ")").call(this._comp);
  1509. var dataSlotEntries = [];
  1510. if (this._dataSlotEntries[i]) {
  1511. dataSlotEntries.push(this._dataSlotEntries[i]);
  1512. }
  1513. this._selectors[i].selectAll(".legendTitle").property("dataSlots", dataSlotEntries);
  1514. if (visible) {
  1515. x += dx;
  1516. y += dy;
  1517. if (this._comp.getSpaceUsed() > this._spaceUsed) {
  1518. this._spaceUsed = this._comp.getSpaceUsed();
  1519. }
  1520. }
  1521. this._lastVisible[i] = visible;
  1522. } else {
  1523. this._lastVisible[i] = false;
  1524. }
  1525. }
  1526. return this;
  1527. },
  1528. /** @expose */
  1529. getSizableType : function() {
  1530. return 2;
  1531. },
  1532. /** @expose */
  1533. getSizableOrientation : function() {
  1534. return this._orient;
  1535. },
  1536. /** @expose */
  1537. getPreferredSize : function() {
  1538. return this._spaceUsed;
  1539. },
  1540. /** @expose */
  1541. getSpillOverSize : function() {
  1542. return 0;
  1543. },
  1544. /** @expose */
  1545. visible : function(a0, a1) {
  1546. var args = arguments;
  1547. if (args.length == 1) {
  1548. return this.visible$1(a0);
  1549. }
  1550. return this.visible$0(a0, a1);
  1551. },
  1552. /** @expose */
  1553. preLayout : function(a0, a1) {
  1554. var args = arguments;
  1555. if (args.length == 1) {
  1556. return this.preLayout$0(a0);
  1557. }
  1558. return this.preLayout$1(a0, a1);
  1559. }
  1560. });
  1561. // $source: com/ibm/rave/bundles/utilities/FontPropertyParser
  1562. /************************************************************************
  1563. ** IBM Confidential
  1564. **
  1565. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1566. **
  1567. ** (C) Copyright IBM Corp. 2017
  1568. **
  1569. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1570. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1571. ************************************************************************/
  1572. // GENERATED
  1573. var com_ibm_rave_bundles_utilities_FontPropertyParser = rave['internal']['Declare']({
  1574. });
  1575. /**
  1576. * Method to parse the css font styles and return a style map.
  1577. * @param (String) fontStyle CSS string (eg. "font-family: courier; font-size: 22; fill: red")
  1578. * @return (Object) Font Style Map
  1579. */
  1580. /** @expose */
  1581. com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont = function(fontStyle) {
  1582. if (fontStyle != null && fontStyle.length > 0) {
  1583. var properties = fontStyle.split(new RegExp(";"));
  1584. var fontStyles = {};
  1585. for (var __i_enFor0 = 0, __len_enFor0 = properties.length;
  1586. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1587. var property = properties[__i_enFor0];
  1588. var fontMap = property.split(new RegExp(":"));
  1589. if (fontMap.length == 2) {
  1590. var key = fontMap[0].trim();
  1591. fontStyles[key == "color" ? "fill" : key] = fontMap[1].trim();
  1592. }
  1593. }
  1594. return fontStyles;
  1595. }
  1596. return null;
  1597. };
  1598. // $source: com/ibm/rave/bundles/components/AxesManager
  1599. /************************************************************************
  1600. ** IBM Confidential
  1601. **
  1602. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1603. **
  1604. ** (C) Copyright IBM Corp. 2018
  1605. **
  1606. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1607. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1608. ************************************************************************/
  1609. // GENERATED
  1610. //@import com/ibm/rave/bundles/components/AxisComponentImpl (runtime) // new, getTranslation
  1611. //@import com/ibm/rave/bundles/components/GridComponentImpl (runtime) // new
  1612. //@import com/ibm/rave/bundles/components/ClipPathComponentImpl (runtime) // new
  1613. /**
  1614. * <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>
  1615. */
  1616. var com_ibm_rave_bundles_components_AxesManager = rave['internal']['Declare']({
  1617. /**
  1618. * Bundle context
  1619. */
  1620. //_context : null,
  1621. /**
  1622. * Selector for the bundle defs node. If null, no clip paths will be defined.
  1623. */
  1624. //_defs : null,
  1625. /**
  1626. * Scales for the axes, indexed by X1, X2, Y1, Y2
  1627. */
  1628. //_scales : null,
  1629. /**
  1630. * Whether to suppress labels when panning, indexed by X1, X2, Y1, Y2.
  1631. */
  1632. //_suppressPanLabels : null,
  1633. /**
  1634. * Value of the axis drawAxisLabels, set when axis is drawn, indexed by X1, X2, Y1, Y2.
  1635. */
  1636. //_drawAxisLabels : null,
  1637. /**
  1638. * Axis components created on demand, indexed by X1, X2, Y1, Y2
  1639. */
  1640. //_axisComponents : null,
  1641. /**
  1642. * When last drawn, the selector used for each axis role, indexed by X1, X2, Y1, Y2; used for redraws.
  1643. */
  1644. //_lastAxisDrawSelectors : null,
  1645. /**
  1646. * Grid components created on demand, indexed by X1, X2, Y1, Y2
  1647. */
  1648. //_gridComponents : null,
  1649. /**
  1650. * When last drawn, the selector used for each grid role, indexed by X1, X2, Y1, Y2; used for redraws.
  1651. */
  1652. //_lastGridDrawSelectors : null,
  1653. /**
  1654. * For clearing axis
  1655. */
  1656. //_clearAxis : null,
  1657. /**
  1658. * For clearing grid
  1659. */
  1660. //_clearGrid : null,
  1661. /**
  1662. * Selectors for the axis groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1663. */
  1664. //_axisSelectors : null,
  1665. /**
  1666. * Selectors for the grid groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1667. */
  1668. //_gridSelectors : null,
  1669. /**
  1670. * Bounding rectangles for the axis groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1671. */
  1672. //_axisRects : null,
  1673. /**
  1674. * Center elements bounds, also the grid bounds.
  1675. */
  1676. //_elementRect : null,
  1677. /**
  1678. * Whether anything was drawn into the axis group last time, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1679. */
  1680. //_lastAxisDrew : null,
  1681. /**
  1682. * Whether anything was drawn into the grid group last time, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1683. */
  1684. //_lastGridDrew : null,
  1685. //_dataSlotEntries : null,
  1686. //_layoutAxisOrder : null,
  1687. /**
  1688. * On the first draw, no transitions are used.
  1689. */
  1690. _firstDraw : false,
  1691. /**
  1692. * Whether to draw the axes and grids.
  1693. */
  1694. _visible : true,
  1695. /**
  1696. * Transition duration, ms
  1697. */
  1698. _duration : 0,
  1699. /**
  1700. * Transpose the axes (assign X to left/right and Y to top/bottom)
  1701. */
  1702. _transpose : false,
  1703. /**
  1704. * Switch the independent (X) axes, drawing X1 where X2 normally goes and vice-versa
  1705. */
  1706. _swapX : false,
  1707. /**
  1708. * Switch the dependent (Y) axes, drawing Y1 where Y2 normally goes and vice-versa
  1709. */
  1710. _swapY : false,
  1711. _layoutInProgress : false,
  1712. _layoutMaxWidth : 0,
  1713. _layoutMaxHeight : 0,
  1714. _xPadding : 0, _xOuterPadding : 0, _yPadding : 0, _yOuterPadding : 0,
  1715. _xPixelPad : 0, _yPixelPad : 0,
  1716. /**
  1717. * Hack to allow heatmap in "unit cell" mode to disable stagger because of the post scaling that messes up axis layout
  1718. */
  1719. _preventStaggerRotate45 : false,
  1720. constructor : function(context) {
  1721. this._scales = [];
  1722. this._suppressPanLabels = [];
  1723. this._drawAxisLabels = [];
  1724. this._axisComponents = [];
  1725. this._lastAxisDrawSelectors = [];
  1726. this._gridComponents = [];
  1727. this._lastGridDrawSelectors = [];
  1728. this._clearAxis = new com_ibm_rave_bundles_components_AxisComponentImpl();
  1729. this._clearGrid = new com_ibm_rave_bundles_components_GridComponentImpl();
  1730. this._axisSelectors = [];
  1731. this._gridSelectors = [];
  1732. this._axisRects = [];
  1733. this._elementRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1734. this._lastAxisDrew = [];
  1735. this._lastGridDrew = [];
  1736. this._dataSlotEntries = [];
  1737. this._layoutAxisOrder = [];
  1738. /**
  1739. * Construct and initialize. No axis scales or selector groups are defined.
  1740. * @param (rave['library']['internal']['BundleContext']) context The bundle context
  1741. */
  1742. {
  1743. this._context = context;
  1744. for (var i = 0; i < 4; ++i) {
  1745. this._scales[i] = null;
  1746. this._suppressPanLabels[i] = false;
  1747. this._axisComponents[i] = null;
  1748. this._lastAxisDrawSelectors[i] = null;
  1749. this._gridComponents[i] = null;
  1750. this._lastGridDrawSelectors[i] = null;
  1751. this._axisSelectors[i] = null;
  1752. this._gridSelectors[i] = null;
  1753. this._axisRects[i] = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1754. this._lastAxisDrew[i] = false;
  1755. this._lastGridDrew[i] = false;
  1756. this._dataSlotEntries[i] = [];
  1757. }
  1758. }
  1759. },
  1760. /** @expose */
  1761. preLayout : function(layoutComponent, axesBeforeLegend, xPadding, xOuterPadding, xPixelPad, yPadding, yOuterPadding, yPixelPad) {
  1762. this._xPadding = xPadding;
  1763. this._xOuterPadding = xOuterPadding;
  1764. this._xPixelPad = xPixelPad;
  1765. this._yPadding = yPadding;
  1766. this._yOuterPadding = yOuterPadding;
  1767. this._yPixelPad = yPixelPad;
  1768. this._layoutInProgress = true;
  1769. var layoutDuration = this._duration;
  1770. this._duration = 0;
  1771. 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"];
  1772. rave['library']['internal']['AbstractView'].createGroupStructure(this._context.node.select("g.axes-layout"), children);
  1773. var layoutAxisSelectors = [];
  1774. var layoutGridSelectors = [];
  1775. var layoutLastAxisDrew = [];
  1776. for (var position = 0; position < 4; ++position) {
  1777. if (this._axisComponents[position]) {
  1778. this._axisComponents[position].preLayout();
  1779. }
  1780. layoutAxisSelectors[position] = this._axisSelectors[position];
  1781. layoutGridSelectors[position] = this._gridSelectors[position];
  1782. layoutLastAxisDrew[position] = this._lastAxisDrew[position];
  1783. if (this._axisSelectors[position]) {
  1784. this.axisSelector(position, this._context.node.select("g.layoutAxis-" + com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position]));
  1785. }
  1786. if (this._gridSelectors[position]) {
  1787. this.gridSelector(position, this._context.node.select("g.layoutGrid-" + com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position]));
  1788. }
  1789. }
  1790. layoutComponent.preLayout(axesBeforeLegend, true);
  1791. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, layoutComponent.elementRect());
  1792. var countHorz = 0;
  1793. var countVert = 0;
  1794. var axes = [];
  1795. for (var position = 0; position < 4; ++position) {
  1796. var role = this.positionToRole(position);
  1797. var isHorz = position == 1 || position == 0;
  1798. if (this._axisSelectors[position] && this._scales[role]) {
  1799. if (isHorz) {
  1800. countHorz++;
  1801. } else {
  1802. countVert++;
  1803. }
  1804. if (this._scales[role].isOrdinal() || this._scales[role].isClustered()) {
  1805. var score = isHorz ? 4 : 2;
  1806. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, score));
  1807. } else {
  1808. var score = isHorz ? 3 : 1;
  1809. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, score));
  1810. }
  1811. } else {
  1812. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, 5));
  1813. }
  1814. }
  1815. axes.sort(function(a1, a2) {
  1816. var a1value = a1.score;
  1817. var a2value = a2.score;
  1818. return a1value < a2value ? -1 : a1value > a2value ? 1 : 0;
  1819. });
  1820. this._layoutAxisOrder = [];
  1821. for (var i = 0; i < 4; ++i) {
  1822. this._layoutAxisOrder[i] = axes[i].position;
  1823. }
  1824. this._layoutMaxWidth = this._elementRect.width * (countVert > 1 ? 0.5 : 0.4);
  1825. this._layoutMaxHeight = this._elementRect.height * (countHorz > 1 ? 0.5 : 0.4);
  1826. for (var index = 0; index < 4; ++index) {
  1827. var position = this._layoutAxisOrder[index];
  1828. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[position], this._elementRect);
  1829. }
  1830. this.draw();
  1831. this._duration = layoutDuration;
  1832. this._context.node.select("g.axes-layout").selectAll("*").remove();
  1833. for (var position = 0; position < 4; ++position) {
  1834. this._lastAxisDrew[position] = layoutLastAxisDrew[position];
  1835. this._axisSelectors[position] = layoutAxisSelectors[position];
  1836. this._gridSelectors[position] = layoutGridSelectors[position];
  1837. }
  1838. this._layoutInProgress = false;
  1839. return this;
  1840. },
  1841. getPositionToDraw : function(index) {
  1842. return this._layoutInProgress ? this._layoutAxisOrder[index] : index;
  1843. },
  1844. preDrawAxis : function(index) {
  1845. if (this._layoutInProgress) {
  1846. var position = this._layoutAxisOrder[index];
  1847. var role = this.positionToRole(position);
  1848. if (role == 0 || role == 1) {
  1849. this.setScaleRangePadded(this._scales[role], false, this._xPadding, this._xOuterPadding, this._xPixelPad);
  1850. } else {
  1851. this.setScaleRangePadded(this._scales[role], true, this._yPadding, this._yOuterPadding, this._yPixelPad);
  1852. }
  1853. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(true);
  1854. }
  1855. },
  1856. postDrawAxis : function(index) {
  1857. if (this._layoutInProgress) {
  1858. var position = this._layoutAxisOrder[index];
  1859. var role = this.positionToRole(position);
  1860. var axis = this._axisComponents[role];
  1861. var size = axis.getPreferredSize();
  1862. if (position == 1 || position == 0) {
  1863. if (size > this._layoutMaxHeight) {
  1864. size = this._layoutMaxHeight;
  1865. }
  1866. this._elementRect.height -= size;
  1867. if (position == 1) {
  1868. this._elementRect.y += size;
  1869. }
  1870. } else {
  1871. if (size > this._layoutMaxWidth) {
  1872. size = this._layoutMaxWidth;
  1873. }
  1874. this._elementRect.width -= size;
  1875. if (position == 2) {
  1876. this._elementRect.x += size;
  1877. }
  1878. }
  1879. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(false);
  1880. }
  1881. },
  1882. /**
  1883. * 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.
  1884. */
  1885. /** @expose */
  1886. draw : function() {
  1887. for (var role = 0; role < 4; ++role) {
  1888. this._lastAxisDrawSelectors[role] = null;
  1889. this._lastGridDrawSelectors[role] = null;
  1890. }
  1891. for (var index = 0; index < 4; ++index) {
  1892. var position = this.getPositionToDraw(index);
  1893. var role = this.positionToRole(position);
  1894. if (!this._visible || !this._axisSelectors[position] || !this._scales[role]) {
  1895. this.clearAxis(position);
  1896. this.clearGrid(position);
  1897. } else {
  1898. this.preDrawAxis(index);
  1899. this.drawAxis(position, role);
  1900. this.postDrawAxis(index);
  1901. if (this._gridSelectors[position]) {
  1902. this.drawGrid(position, role);
  1903. }
  1904. }
  1905. }
  1906. this._firstDraw = false;
  1907. },
  1908. /**
  1909. * @return (boolean) true if we are hiding any labels during pan-zoom.
  1910. */
  1911. /** @expose */
  1912. hideAnyPanZoom : function() {
  1913. return (this._suppressPanLabels[0] || this._suppressPanLabels[1] || this._suppressPanLabels[2] || this._suppressPanLabels[3]);
  1914. },
  1915. /**
  1916. * 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.
  1917. * @param (boolean) panning Whether this is a pan in-progress; use false otherwise including when pan-zoom ends.
  1918. */
  1919. /** @expose */
  1920. redraw : function(panning) {
  1921. for (var role = 0; role < 4; ++role) {
  1922. if (this._axisComponents[role] && this._lastAxisDrawSelectors[role]) {
  1923. this._axisComponents[role].displayTickLabels(this._drawAxisLabels[role]);
  1924. this._axisComponents[role].showPanZoomTickLabels(!panning || !this._suppressPanLabels[role]);
  1925. var isAllow = this._axisComponents[role].isAllowAutomaticAxisLayoutToChangeOrientation();
  1926. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(false);
  1927. this._lastAxisDrawSelectors[role].call(this._axisComponents[role]);
  1928. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(isAllow);
  1929. }
  1930. if (this._gridComponents[role] && this._lastGridDrawSelectors[role]) {
  1931. this._lastGridDrawSelectors[role].call(this._gridComponents[role]);
  1932. }
  1933. }
  1934. },
  1935. /** @expose */
  1936. preventStaggerRotate45 : function(preventStaggerRotate45) {
  1937. this._preventStaggerRotate45 = preventStaggerRotate45;
  1938. },
  1939. /**
  1940. * 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.
  1941. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  1942. * @param (int) role The axis role, X1, X2, Y1, or Y2
  1943. */
  1944. drawAxis : function(position, role) {
  1945. var axisGroup = this._axisSelectors[position];
  1946. this._lastAxisDrawSelectors[role] = axisGroup;
  1947. var comp = this.axisComponent(role);
  1948. var layoutModeID = role == 2 ? "axis.y.labels.layoutMode" : role == 3 ? "axis.y2.labels.layoutMode" : "axis.x.labels.layoutMode";
  1949. var allowStaggerID = role == 2 ? "axis.y.labels.allowStagger" : role == 3 ? "axis.y2.labels.allowStagger" : "axis.x.labels.allowStagger";
  1950. var allowRotate45ID = role == 2 ? "axis.y.labels.allowRotate45" : role == 3 ? "axis.y2.labels.allowRotate45" : "axis.x.labels.allowRotate45";
  1951. var allowRotate90ID = role == 2 ? "axis.y.labels.allowRotate90" : role == 3 ? "axis.y2.labels.allowRotate90" : "axis.x.labels.allowRotate90";
  1952. var layoutMode = ""+(this._context.getPropertyValue(layoutModeID));
  1953. var allowStagger = !this._preventStaggerRotate45 && (this._context.getPropertyValue(allowStaggerID));
  1954. var allowRotate45 = !this._preventStaggerRotate45 && (this._context.getPropertyValue(allowRotate45ID));
  1955. var allowRotate90 = (this._context.getPropertyValue(allowRotate90ID));
  1956. var textTruncateIndicator = (this._context.getPropertyValue("axis.labels.truncationText"));
  1957. var axisBounds = this._axisRects[position];
  1958. var orient = com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position];
  1959. var transform = com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation(axisBounds, orient);
  1960. var axisTransform = "translate(" + transform[0] + "," + transform[1] + ")";
  1961. 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);
  1962. this._drawAxisLabels[role] = comp._displayTickLabels;
  1963. var axisGroupUpdate = axisGroup;
  1964. if (this._duration > 0 && !this._firstDraw && this._lastAxisDrew[position]) {
  1965. axisGroupUpdate = axisGroup.transition().duration(this._duration);
  1966. }
  1967. axisGroupUpdate.attr("transform", axisTransform);
  1968. axisGroupUpdate.call(comp);
  1969. var dataSlotEntryList = this._dataSlotEntries[role];
  1970. axisGroup.selectAll(".axis-title").property("dataSlots", dataSlotEntryList);
  1971. this._lastAxisDrew[position] = comp.renderedShapes();
  1972. if (this._defs) {
  1973. var clipAxis = new com_ibm_rave_bundles_components_ClipPathComponentImpl(this._context.instanceId() + "clip" + orient);
  1974. var text = axisGroup.append("text").text("000,000");
  1975. var bbox = text.node().getBBox();
  1976. var w = bbox.width;
  1977. var h = bbox.height;
  1978. text.remove();
  1979. var clipRect;
  1980. if (position == 0 || position == 1) {
  1981. var leftEdge = axisBounds.x + transform[0] * -1;
  1982. var rightEdge = leftEdge + axisBounds.width;
  1983. if (!(this._scales[role].isOrdinal()) && !(this._scales[role].isClustered())) {
  1984. var numericLeftEdge = this._elementRect.x - w + transform[0] * -1;
  1985. var numericRightEdge = numericLeftEdge + this._elementRect.width + w * 2;
  1986. if (numericLeftEdge < leftEdge) {
  1987. leftEdge = numericLeftEdge;
  1988. }
  1989. if (numericRightEdge > rightEdge) {
  1990. rightEdge = numericRightEdge;
  1991. }
  1992. }
  1993. clipRect = new rave['internal']['RectStruct'](leftEdge, axisBounds.y + transform[1] * -1, rightEdge - leftEdge, axisBounds.height);
  1994. } else {
  1995. clipRect = new rave['internal']['RectStruct'](axisBounds.x + transform[0] * -1, this._elementRect.y - h / 2 + transform[1] * -1, axisBounds.width, this._elementRect.height + h);
  1996. }
  1997. clipAxis.clipRect(clipRect).applyTo(axisGroup.select(".axis." + orient)).call(this._defs);
  1998. }
  1999. },
  2000. /**
  2001. * If the axis selector for the position is defined, clear the shapes from the axis group.
  2002. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2003. */
  2004. clearAxis : function(position) {
  2005. if (this._axisSelectors[position]) {
  2006. this._clearAxis.scale(null);
  2007. this._axisSelectors[position].call(this._clearAxis);
  2008. }
  2009. this._lastAxisDrew[position] = false;
  2010. },
  2011. /**
  2012. * 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.
  2013. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2014. * @param (int) role The axis role, X1, X2, Y1, or Y2
  2015. */
  2016. drawGrid : function(position, role) {
  2017. var gridGroup = this._gridSelectors[position];
  2018. this._lastGridDrawSelectors[role] = gridGroup;
  2019. var comp = this.gridComponent(role);
  2020. var axisBounds = this._axisRects[position];
  2021. var orient = com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position];
  2022. var transform = com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation(axisBounds, orient);
  2023. var axisTransform = "translate(" + transform[0] + "," + transform[1] + ")";
  2024. comp.setRole(com_ibm_rave_bundles_components_AxesManager.ROLES[role]).orient(orient).setPreExecute(this._context.getPreExecute()).bounds(this._elementRect).axis(this._axisComponents[role].axis());
  2025. if (this._duration <= 0 || this._firstDraw || !this._lastAxisDrew[position]) {
  2026. gridGroup.attr("transform", axisTransform).call(comp);
  2027. } else {
  2028. gridGroup.transition().duration(this._duration).attr("transform", axisTransform).call(comp);
  2029. }
  2030. this._lastGridDrew[position] = comp.renderedShapes();
  2031. },
  2032. /**
  2033. * If the grid selector for the position is defined, clear the shapes from the grid group.
  2034. * @param (int) position The grid position, BOTTOM, TOP, LEFT, RIGHT
  2035. */
  2036. clearGrid : function(position) {
  2037. if (this._gridSelectors[position]) {
  2038. this._clearGrid.axis(null);
  2039. this._gridSelectors[position].call(this._clearGrid);
  2040. }
  2041. this._lastGridDrew[position] = false;
  2042. },
  2043. /**
  2044. * @param (boolean) visible Whether the manager should draw axes
  2045. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2046. */
  2047. /** @expose */
  2048. visible : function(visible) {
  2049. this._visible = visible;
  2050. return this;
  2051. },
  2052. /**
  2053. * @param (int) duration The transition duration; if <= 0, no transition is used.
  2054. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2055. */
  2056. /** @expose */
  2057. duration : function(duration) {
  2058. this._duration = duration;
  2059. return this;
  2060. },
  2061. /**
  2062. * @param (boolean) transpose Whether to transpose the chart (switch the positions of the X and Y axis)
  2063. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2064. */
  2065. /** @expose */
  2066. transpose : function(transpose) {
  2067. this._transpose = transpose;
  2068. return this;
  2069. },
  2070. /**
  2071. * @param (boolean) swapX Whether to switch the postitions of the X1 and X2 axes
  2072. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2073. */
  2074. /** @expose */
  2075. swapX : function(swapX) {
  2076. this._swapX = swapX;
  2077. return this;
  2078. },
  2079. /**
  2080. * @param (boolean) swapY Whether to switch the postitions of the Y1 and Y2 axes
  2081. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2082. */
  2083. /** @expose */
  2084. swapY : function(swapY) {
  2085. this._swapY = swapY;
  2086. return this;
  2087. },
  2088. /**
  2089. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2090. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale The coordinate scale for that role, may be null
  2091. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2092. */
  2093. /** @expose */
  2094. scale : function(role, scale) {
  2095. this._scales[role] = scale;
  2096. return this;
  2097. },
  2098. /**
  2099. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2100. * @param (boolean) suppressLabels Whether to suppress the labels when panning the axis
  2101. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2102. */
  2103. /** @expose */
  2104. suppressPanLabels : function(role, suppressLabels) {
  2105. this._suppressPanLabels[role] = suppressLabels;
  2106. return this;
  2107. },
  2108. /**
  2109. * 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.
  2110. * @param (int) role The role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2111. * @return (com.ibm.rave.bundles.components.AxisComponentImpl) The component for the role
  2112. */
  2113. /** @expose */
  2114. axisComponent : function(role) {
  2115. if (!this._axisComponents[role]) {
  2116. this._axisComponents[role] = new com_ibm_rave_bundles_components_AxisComponentImpl();
  2117. }
  2118. return this._axisComponents[role];
  2119. },
  2120. /**
  2121. * 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.
  2122. * @param (int) role The role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2123. * @return (com.ibm.rave.bundles.components.GridComponentImpl) The component for the role
  2124. */
  2125. /** @expose */
  2126. gridComponent : function(role) {
  2127. if (!this._gridComponents[role]) {
  2128. this._gridComponents[role] = new com_ibm_rave_bundles_components_GridComponentImpl();
  2129. }
  2130. return this._gridComponents[role];
  2131. },
  2132. /**
  2133. * Set the bundle &lt;defs&gt; node. Clip paths will be defined in this node.
  2134. * @param (rave['internal']['Selector']) defs The defs node
  2135. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2136. */
  2137. /** @expose */
  2138. defsSelector : function(defs) {
  2139. this._defs = com_ibm_rave_bundles_components_AxesManager.checkSelector(defs);
  2140. return this;
  2141. },
  2142. /**
  2143. * Set the selector for an axis group node.
  2144. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2145. * @param (rave['internal']['Selector']) axisGroup The axis group node, may be null
  2146. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2147. */
  2148. /** @expose */
  2149. axisSelector : function(position, axisGroup) {
  2150. this._axisSelectors[position] = com_ibm_rave_bundles_components_AxesManager.checkSelector(axisGroup);
  2151. return this;
  2152. },
  2153. /**
  2154. * Set the selector for a grid group node.
  2155. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2156. * @param (rave['internal']['Selector']) gridGroup The grid group node, may be null
  2157. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2158. */
  2159. /** @expose */
  2160. gridSelector : function(position, gridGroup) {
  2161. this._gridSelectors[position] = com_ibm_rave_bundles_components_AxesManager.checkSelector(gridGroup);
  2162. return this;
  2163. },
  2164. /**
  2165. * Set the element (grid) bounds rectangle to a copy of the given rectangle.
  2166. * @param (rave['internal']['RectStruct']) elementRect The rectangle, if null the bounds are set to 0,0,0,0
  2167. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2168. */
  2169. /** @expose */
  2170. elementRect : function(elementRect) {
  2171. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, elementRect);
  2172. return this;
  2173. },
  2174. /**
  2175. * Set an axis bounds rectangle to a copy of the given rectangle.
  2176. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2177. * @param (rave['internal']['RectStruct']) axisRect The axis bounds, if null the bounds are set to 0,0,0,0
  2178. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2179. */
  2180. /** @expose */
  2181. axisRect : function(position, axisRect) {
  2182. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[position], axisRect);
  2183. return this;
  2184. },
  2185. /**
  2186. * 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.
  2187. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2188. */
  2189. /** @expose */
  2190. useDefaultSelectors : function() {
  2191. this.defsSelector(this._context.node.select("defs"));
  2192. this.axisSelector(0, this._context.node.select("g.axisTransform.bottom"));
  2193. this.axisSelector(1, this._context.node.select("g.axisTransform.top"));
  2194. this.axisSelector(2, this._context.node.select("g.axisTransform.left"));
  2195. this.axisSelector(3, this._context.node.select("g.axisTransform.right"));
  2196. this.gridSelector(0, this._context.node.select("g.grid.bottom"));
  2197. this.gridSelector(1, this._context.node.select("g.grid.top"));
  2198. this.gridSelector(2, this._context.node.select("g.grid.left"));
  2199. this.gridSelector(3, this._context.node.select("g.grid.right"));
  2200. return this;
  2201. },
  2202. /**
  2203. * Convenience method: Set the element rectangle and axis rectangles from the rectangles in the layout.
  2204. * @param (com.ibm.rave.bundles.components.ChartLayoutComponentImpl) layoutInfo Layout information
  2205. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2206. */
  2207. /** @expose */
  2208. useBoundsFromLayout : function(layoutInfo) {
  2209. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, layoutInfo.elementRect());
  2210. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[0], layoutInfo.bottomRect());
  2211. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[1], layoutInfo.topRect());
  2212. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[2], layoutInfo.leftRect());
  2213. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[3], layoutInfo.rightRect());
  2214. return this;
  2215. },
  2216. /**
  2217. * 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.
  2218. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2219. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2220. */
  2221. /** @expose */
  2222. useDefaultX1Properties : function(setGridParameters) {
  2223. 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"))));
  2224. var titleFontStyle = (this._context.getPropertyValue("axis.x.title.style.font"));
  2225. var labelFontStyle = (this._context.getPropertyValue("axis.x.labels.style.font"));
  2226. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2227. this.axisComponent(0).labelStyle(labelFontStyle);
  2228. } else {
  2229. 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")));
  2230. }
  2231. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2232. this.axisComponent(0).titleStyle(titleFontStyle);
  2233. } else {
  2234. 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")));
  2235. }
  2236. if (setGridParameters) {
  2237. 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")));
  2238. }
  2239. this.suppressPanLabels(0, (this._context.getPropertyValue("axis.x.labels.zoomPan")));
  2240. return this;
  2241. },
  2242. /**
  2243. * 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.
  2244. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2245. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2246. */
  2247. /** @expose */
  2248. useDefaultY1Properties : function(setGridParameters) {
  2249. 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")));
  2250. var titleFontStyle = (this._context.getPropertyValue("axis.y.title.style.font"));
  2251. var labelFontStyle = (this._context.getPropertyValue("axis.y.labels.style.font"));
  2252. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2253. this.axisComponent(2).labelStyle(labelFontStyle);
  2254. } else {
  2255. 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")));
  2256. }
  2257. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2258. this.axisComponent(2).titleStyle(titleFontStyle);
  2259. } else {
  2260. 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")));
  2261. }
  2262. if (setGridParameters) {
  2263. 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")));
  2264. }
  2265. this.suppressPanLabels(2, (this._context.getPropertyValue("axis.y.labels.zoomPan")));
  2266. return this;
  2267. },
  2268. /**
  2269. * 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.
  2270. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2271. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2272. */
  2273. /** @expose */
  2274. useDefaultY2Properties : function(setGridParameters) {
  2275. 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")));
  2276. var titleFontStyle = (this._context.getPropertyValue("axis.y2.title.style.font"));
  2277. var labelFontStyle = (this._context.getPropertyValue("axis.y2.labels.style.font"));
  2278. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2279. this.axisComponent(3).labelStyle(labelFontStyle);
  2280. } else {
  2281. 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")));
  2282. }
  2283. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2284. this.axisComponent(3).titleStyle(titleFontStyle);
  2285. } else {
  2286. 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")));
  2287. }
  2288. if (setGridParameters) {
  2289. 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")));
  2290. }
  2291. this.suppressPanLabels(3, (this._context.getPropertyValue("axis.y2.labels.zoomPan")));
  2292. return this;
  2293. },
  2294. /**
  2295. * 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.
  2296. * @param (int) role One of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2297. * @param (Array) entries Non-null list of data slot entries
  2298. * @param (String) format One of {@link this.CustomFormatInfo#"none"} or {@link this.CustomFormatInfo#"percent"}
  2299. * @param (rave['internal']['ValueFunction']) defaultFunction Default function to use if no custom formatter is defined for the axis, may be null
  2300. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2301. */
  2302. /** @expose */
  2303. setTickFormatterList : function(role, entries, format, defaultFunction) {
  2304. var fmtRole;
  2305. switch (role) {
  2306. case 2:
  2307. fmtRole = "ROLE_Y1";
  2308. break;
  2309. case 1:
  2310. fmtRole = "ROLE_X2";
  2311. break;
  2312. case 3:
  2313. fmtRole = "ROLE_Y2";
  2314. break;
  2315. case 0:
  2316. default:
  2317. fmtRole = "ROLE_X1";
  2318. break;
  2319. }
  2320. 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);
  2321. this.axisComponent(role).tickFormat(fmt);
  2322. 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);
  2323. this.axisComponent(role).simplifiedTickFormat(simplefmt);
  2324. return this;
  2325. },
  2326. /**
  2327. * 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.
  2328. * @param (int) role One of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2329. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  2330. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2331. */
  2332. /** @expose */
  2333. setTickFormatter : function(role, entry) {
  2334. var entries = [];
  2335. if (entry) {
  2336. entries.push(entry);
  2337. }
  2338. return this.setTickFormatterList(role, entries, "none", null);
  2339. },
  2340. /**
  2341. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined scale.
  2342. * @param (Number) padding Padding, relevant only for ordinal scales
  2343. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2344. * @param (int) pixelPad Pixel padding at each end
  2345. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2346. */
  2347. /** @expose */
  2348. setScaleRanges : function(padding, outerPadding, pixelPad) {
  2349. this.setIndependentScaleRanges(padding, outerPadding, pixelPad);
  2350. this.setDependentScaleRanges(padding, outerPadding, pixelPad);
  2351. return this;
  2352. },
  2353. /**
  2354. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined independent scale.
  2355. * @param (Number) padding Padding, relevant only for ordinal scales
  2356. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2357. * @param (int) pixelPad Pixel padding at each end
  2358. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2359. */
  2360. /** @expose */
  2361. setIndependentScaleRanges : function(padding, outerPadding, pixelPad) {
  2362. this.setScaleRangePadded(this._scales[0], false, padding, outerPadding, pixelPad);
  2363. this.setScaleRangePadded(this._scales[1], false, padding, outerPadding, pixelPad);
  2364. return this;
  2365. },
  2366. /**
  2367. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined independent scale.
  2368. * @param (Number) padding Padding, relevant only for ordinal scales
  2369. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2370. * @param (int) pixelPad Pixel padding at each end
  2371. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2372. */
  2373. /** @expose */
  2374. setDependentScaleRanges : function(padding, outerPadding, pixelPad) {
  2375. this.setScaleRangePadded(this._scales[2], true, padding, outerPadding, pixelPad);
  2376. this.setScaleRangePadded(this._scales[3], true, padding, outerPadding, pixelPad);
  2377. return this;
  2378. },
  2379. /**
  2380. * 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)} .
  2381. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2382. * @param (rave['library']['internal']['DataSlotEntry']) slot DataSlotEntry to be associated with the axis role.
  2383. */
  2384. setDataSlot$0 : function(role, slot) {
  2385. this.setDataSlot$1(role, [slot]);
  2386. return this;
  2387. },
  2388. /**
  2389. * Set a list of data slot entries that will be associated with the specified axis role.
  2390. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2391. * @param (Array) slots List of DataSlotEntry to be associated with the axis role.
  2392. */
  2393. setDataSlot$1 : function(role, slots) {
  2394. if (role < 4 && role >= 0) {
  2395. this._dataSlotEntries[role].length = 0;
  2396. if (slots) {
  2397. for (var __i_enFor0 = 0, __exp_enFor0 = slots, __len_enFor0 = __exp_enFor0.length;
  2398. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2399. var slot = __exp_enFor0[__i_enFor0];
  2400. this._dataSlotEntries[role].push(slot);
  2401. }
  2402. }
  2403. }
  2404. return this;
  2405. },
  2406. /**
  2407. * </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.
  2408. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale Bundle independent scale
  2409. * @param (boolean) dependent Whether this is the dependent scale
  2410. * @param (Number) padding Padding, relevant only for ordinal scales
  2411. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2412. * @param (int) pixelPad Pixel padding at each end
  2413. */
  2414. setScaleRangePadded : function(scale, dependent, padding, outerPadding, pixelPad) {
  2415. if (scale) {
  2416. var min, max;
  2417. if (dependent == this._transpose) {
  2418. min = this._elementRect.x + pixelPad;
  2419. max = this._elementRect.x + this._elementRect.width - pixelPad;
  2420. } else {
  2421. if (scale.isContinuous()) {
  2422. min = this._elementRect.y + this._elementRect.height - pixelPad;
  2423. max = this._elementRect.y + pixelPad;
  2424. } else {
  2425. min = this._elementRect.y + pixelPad;
  2426. max = this._elementRect.y + this._elementRect.height - pixelPad;
  2427. }
  2428. }
  2429. scale.range(min, max, padding, outerPadding);
  2430. }
  2431. },
  2432. /**
  2433. * Given a geometric position BOTTOM, TOP, LEFT, or RIGHT, return the role X1, X2, Y1, or Y2 used by that role.
  2434. * @param (int) position The position index
  2435. * @return (int) The role index
  2436. */
  2437. positionToRole : function(position) {
  2438. var r = position;
  2439. if (this._transpose) {
  2440. r = (r + 2) % 4;
  2441. }
  2442. if (this._swapX && r < 2) {
  2443. r = 1 - r;
  2444. }
  2445. if (this._swapY && r > 1) {
  2446. r = 5 - r;
  2447. }
  2448. return r;
  2449. },
  2450. /**
  2451. * Given a role X1, X2, Y1, or Y2, return the geometric position BOTTOM, TOP, LEFT, or RIGHT for that role.
  2452. * @param (int) role The role index
  2453. * @return (int) The position index
  2454. */
  2455. roleToPosition : function(role) {
  2456. var p = role;
  2457. if (this._swapX && role < 2) {
  2458. p = 1 - p;
  2459. }
  2460. if (this._swapY && p > 1) {
  2461. p = 5 - p;
  2462. }
  2463. if (this._transpose) {
  2464. p = (p + 2) % 4;
  2465. }
  2466. return p;
  2467. },
  2468. /**
  2469. * Sets the magnitude for the tick interval.
  2470. * @param (int) role role index of the axis
  2471. * @param (Number) tickMagnitude power of 10
  2472. * @return (com.ibm.rave.bundles.components.AxesManager) this
  2473. */
  2474. /** @expose */
  2475. scaleTickMagnitude : function(role, tickMagnitude) {
  2476. this.axisComponent(role).scaleTickMagnitude(tickMagnitude);
  2477. return this;
  2478. },
  2479. /** @expose */
  2480. setDataSlot : function(a0, a1) {
  2481. var args = arguments;
  2482. if (args.length == 2 && typeof a1 === "function") {
  2483. return this.setDataSlot$0(a0, a1);
  2484. }
  2485. return this.setDataSlot$1(a0, a1);
  2486. }
  2487. });
  2488. /**
  2489. * @param (rave['internal']['Selector']) s A selector
  2490. * @return (rave['internal']['Selector']) s if it is non-null and has at least one node, null otherwise
  2491. */
  2492. com_ibm_rave_bundles_components_AxesManager.checkSelector = function(s) {
  2493. return s && !(s.empty()) ? s : null;
  2494. };
  2495. /**
  2496. * Set a rectangle to a copy of another. If the source is null, the target is set to 0,0,0,0
  2497. * @param (rave['internal']['RectStruct']) target A non-null rectangle
  2498. * @param (rave['internal']['RectStruct']) source A possibly-null rectnalge
  2499. */
  2500. com_ibm_rave_bundles_components_AxesManager.setRect = function(target, source) {
  2501. if (source) {
  2502. target.x = source.x;
  2503. target.y = source.y;
  2504. target.width = source.width;
  2505. target.height = source.height;
  2506. } else {
  2507. target.x = 0;
  2508. target.y = 0;
  2509. target.width = 0;
  2510. target.height = 0;
  2511. }
  2512. };
  2513. /**
  2514. * A ValueFunction that appends '%' to the value.
  2515. * @param (int) n Number of digits
  2516. */
  2517. /** @expose */
  2518. com_ibm_rave_bundles_components_AxesManager.percentFormat = function(n) {
  2519. var digits = "." + n + "f";
  2520. var format = rave.format(digits);
  2521. return function(value, ix, gix) {
  2522. return format.call(null, value, 0, 0) + "%";
  2523. };
  2524. };
  2525. /**
  2526. * Called prior to chart layout. Axes are configured with no real bounding constraints to calculate their preferred size.
  2527. */
  2528. com_ibm_rave_bundles_components_AxesManager.AxisLayout = rave['internal']['Declare']({
  2529. /** @expose */
  2530. position : 0,
  2531. /** @expose */
  2532. score : 0,
  2533. constructor : function(position, score) {
  2534. this.position = position;
  2535. this.score = score;
  2536. }
  2537. });
  2538. /**
  2539. * Logical first X (independent) axis, default position bottom
  2540. */
  2541. /** @expose */
  2542. com_ibm_rave_bundles_components_AxesManager.X1 = 0;
  2543. /**
  2544. * Logical second X (independent) axis, default position top
  2545. */
  2546. /** @expose */
  2547. com_ibm_rave_bundles_components_AxesManager.X2 = 1;
  2548. /**
  2549. * Logical first Y (dependent) axis, default position left
  2550. */
  2551. /** @expose */
  2552. com_ibm_rave_bundles_components_AxesManager.Y1 = 2;
  2553. /**
  2554. * Logical first Y (dependent) axis, default position right
  2555. */
  2556. /** @expose */
  2557. com_ibm_rave_bundles_components_AxesManager.Y2 = 3;
  2558. /**
  2559. * Geometric group on bottom
  2560. */
  2561. /** @expose */
  2562. com_ibm_rave_bundles_components_AxesManager.BOTTOM = 0;
  2563. /**
  2564. * Geometric group on top
  2565. */
  2566. /** @expose */
  2567. com_ibm_rave_bundles_components_AxesManager.TOP = 1;
  2568. /**
  2569. * Geometric group on left
  2570. */
  2571. /** @expose */
  2572. com_ibm_rave_bundles_components_AxesManager.LEFT = 2;
  2573. /**
  2574. * Geometric group on right
  2575. */
  2576. /** @expose */
  2577. com_ibm_rave_bundles_components_AxesManager.RIGHT = 3;
  2578. /**
  2579. * Maps the role indexes to the role strings used by the components API
  2580. */
  2581. com_ibm_rave_bundles_components_AxesManager.ROLES = ["ROLE_X1", "ROLE_X2", "ROLE_Y1", "ROLE_Y2"];
  2582. /**
  2583. * Maps the role indexes to the role strings used by the custom formatter API. TODO: Unify the strings
  2584. */
  2585. com_ibm_rave_bundles_components_AxesManager.ROLE_FORMATTERS = ["ROLE_X1", "ROLE_X2", "ROLE_Y1", "ROLE_Y2"];
  2586. /**
  2587. * Maps the position indexes to the orient strings used by D3
  2588. */
  2589. com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS = ["bottom", "top", "left", "right"];
  2590. /**
  2591. * Maps the position indexes to the custom formatter strings
  2592. */
  2593. com_ibm_rave_bundles_components_AxesManager.FORMATTERS = ["bottom", "top", "left", "right"];
  2594. // $source: com/ibm/rave/bundles/component/AxisComponent
  2595. /************************************************************************
  2596. ** IBM Confidential
  2597. **
  2598. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2599. **
  2600. ** (C) Copyright IBM Corp. 2017
  2601. **
  2602. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2603. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2604. ************************************************************************/
  2605. // GENERATED
  2606. /**
  2607. * <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>
  2608. */
  2609. var com_ibm_rave_bundles_component_AxisComponent = rave['internal']['Declare'].implement(
  2610. /**
  2611. * @return (String) The role of the axis in the chart
  2612. */
  2613. //role : function() {},
  2614. /**
  2615. * @return (rave['internal']['Axis']) The capability Axis used by this AxisComponent
  2616. */
  2617. //axis : function() {},
  2618. /**
  2619. * The tickFormat is applied to the values of the ticks to create the string that is displayed.
  2620. * @param (rave['internal']['ValueFunction']) tickFormat The new tickFormat
  2621. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2622. */
  2623. //tickFormat : function(tickFormat) {},
  2624. /**
  2625. * Get the tickFormat function used by this component. May be null.
  2626. * @return (rave['internal']['ValueFunction']) Format function, or null
  2627. */
  2628. //tickFormat : function() {},
  2629. /**
  2630. * Set the indicator to be used for truncated text ex: indicator set to "..." , results in helloworld - > hello...
  2631. * @param (String) indicator the string to be placed to indicated truncated text
  2632. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2633. */
  2634. //textTruncateIndicator : function(indicator) {},
  2635. /**
  2636. * Whether to display the axis title.
  2637. * @param (boolean) displayAxisTitle true to display the axis title, false otherwise
  2638. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2639. */
  2640. //displayAxisTitle : function(displayAxisTitle) {},
  2641. /**
  2642. * Whether to display the axis line.
  2643. * @param (boolean) displayAxisLine true to display the axis line, false otherwise
  2644. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2645. */
  2646. //displayAxisLine : function(displayAxisLine) {},
  2647. /**
  2648. * Whether to display the axis tick marks.
  2649. * @param (boolean) displayTicks true to display the axis ticks, false otherwise
  2650. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2651. */
  2652. //displayTicks : function(displayTicks) {},
  2653. /**
  2654. * Whether to display the axis labels, as set by the show axis labels property
  2655. * @param (boolean) displayTickLabels true to display the axis tick labels, false otherwise
  2656. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2657. */
  2658. //displayTickLabels : function(displayTickLabels) {},
  2659. /**
  2660. * Whether to display the axis labels, as set by the hide pan-zoom labels property
  2661. * @param (boolean) showPanZoomTickLabels true to display the axis tick labels, false otherwise
  2662. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2663. */
  2664. //showPanZoomTickLabels : function(showPanZoomTickLabels) {},
  2665. /**
  2666. * @param (String) axisTitle The new axisTitle
  2667. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2668. */
  2669. //axisTitle : function(axisTitle) {},
  2670. /**
  2671. * 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)} .
  2672. * @param (String) axisColor The new line and tick color
  2673. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2674. */
  2675. //axisColor : function(axisColor) {},
  2676. /**
  2677. * The color used to draw the axis line.
  2678. * @param (String) lineColor The new lineColor
  2679. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2680. */
  2681. //lineColor : function(lineColor) {},
  2682. /**
  2683. * The color used to draw the axis ticks.
  2684. * @param (String) tickColor The new tickColor
  2685. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2686. */
  2687. //tickColor : function(tickColor) {},
  2688. /**
  2689. * The color used to draw the axis labels.
  2690. * @param (String) labelColor The new labelColor
  2691. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2692. */
  2693. //labelColor : function(labelColor) {},
  2694. /**
  2695. * The style for the axis labels.
  2696. * @param (String) fontStyle CSS string of font properties
  2697. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2698. */
  2699. //labelStyle : function(fontStyle) {},
  2700. /**
  2701. * The style for the axis labels.
  2702. * @param (String) fill The color used to draw the labels
  2703. * @param (String) fontSize CSS font size
  2704. * @param (String) fontFamily CSS font-families list
  2705. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2706. */
  2707. //labelStyle : function(fill, fontSize, fontFamily) {},
  2708. /**
  2709. * The color used to draw the axis title.
  2710. * @param (String) titleColor The new titleColor
  2711. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2712. */
  2713. //titleColor : function(titleColor) {},
  2714. /**
  2715. * The style for the axis title.
  2716. * @param (String) fontStyle CSS string of font properties
  2717. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2718. */
  2719. //titleStyle : function(fontStyle) {},
  2720. /**
  2721. * The style for the axis title.
  2722. * @param (String) fill The color used to draw the title
  2723. * @param (String) fontSize CSS font size
  2724. * @param (String) fontFamily CSS font-families list
  2725. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2726. */
  2727. //titleStyle : function(fill, fontSize, fontFamily) {}
  2728. );
  2729. /**
  2730. * The string returned by {@link #this.type()} is "AxisComponent".
  2731. */
  2732. /** @expose */
  2733. com_ibm_rave_bundles_component_AxisComponent.COMPONENT_TYPE = "AxisComponent";
  2734. /**
  2735. * Returned by {@link #this.role()} for the first independent axis.
  2736. */
  2737. /** @expose */
  2738. com_ibm_rave_bundles_component_AxisComponent.ROLE_X1 = "ROLE_X1";
  2739. /**
  2740. * Returned by {@link #this.role()} for the first dependent axis.
  2741. */
  2742. /** @expose */
  2743. com_ibm_rave_bundles_component_AxisComponent.ROLE_Y1 = "ROLE_Y1";
  2744. /**
  2745. * Returned by {@link #this.role()} for the second independent axis.
  2746. */
  2747. /** @expose */
  2748. com_ibm_rave_bundles_component_AxisComponent.ROLE_X2 = "ROLE_X2";
  2749. /**
  2750. * Returned by {@link #this.role()} for the second dependent axis.
  2751. */
  2752. /** @expose */
  2753. com_ibm_rave_bundles_component_AxisComponent.ROLE_Y2 = "ROLE_Y2";
  2754. // $source: com/ibm/rave/bundles/utilities/TextCrossfader
  2755. /************************************************************************
  2756. ** IBM Confidential
  2757. **
  2758. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2759. **
  2760. ** (C) Copyright IBM Corp. 2017
  2761. **
  2762. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2763. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2764. ************************************************************************/
  2765. // GENERATED
  2766. /**
  2767. * <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>
  2768. */
  2769. var com_ibm_rave_bundles_utilities_TextCrossfader = rave['internal']['Declare']({
  2770. });
  2771. /**
  2772. * <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!
  2773. * @param (rave['internal']['Selection']) selection Selection containing the single text node, may be a transition
  2774. * @param (String) oldText Old value of the text string, may be null
  2775. * @param (String) newText New value of the text string, may be null
  2776. * @param (Object) fillOpacity Fill opacity, may be null (in which case 1.0 is assumed)
  2777. * @param (double) delay Number between 0 and 0.5 controlling the timing of the fade
  2778. * @return (rave['internal']['Selection']) The selection, modified by the new text and fill-opacity
  2779. */
  2780. /** @expose */
  2781. com_ibm_rave_bundles_utilities_TextCrossfader.textCrossFade = function(selection, oldText, newText, fillOpacity, delay) {
  2782. if (!(selection.isTransition())) {
  2783. return selection.text(newText);
  2784. }
  2785. var _t = (selection).tween("text", function(data, index, groupIndex) {
  2786. return function(t) {
  2787. this.rave_setText(t < 0.5 ? oldText : newText);
  2788. };
  2789. });
  2790. var t0 = Math.max(0.0, Math.min(0.5, delay));
  2791. if (t0 == 0.5 || (oldText == null && newText == null) || (oldText != null && oldText == newText)) {
  2792. return selection;
  2793. }
  2794. var opacity = fillOpacity == null ? 1.0 : + (fillOpacity);
  2795. var tf = 1.0 / (0.5 - t0);
  2796. return _t.tween("fill-opacity", function(data, index, groupIndex) {
  2797. return function(t) {
  2798. if (t <= t0 || t >= (1.0 - t0)) {
  2799. this.rave_setStyle("fill-opacity", fillOpacity);
  2800. } else {
  2801. this.rave_setStyle("fill-opacity", opacity * Math.abs(t - 0.5) * tf);
  2802. }
  2803. };
  2804. });
  2805. };
  2806. // $source: com/ibm/rave/bundles/utilities/BundleLabelDropper
  2807. /************************************************************************
  2808. ** IBM Confidential
  2809. **
  2810. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2811. **
  2812. ** (C) Copyright IBM Corp. 2017
  2813. **
  2814. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2815. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2816. ************************************************************************/
  2817. // GENERATED
  2818. var com_ibm_rave_bundles_utilities_BundleLabelDropper = rave['internal']['Declare']({
  2819. //_dropOverlap : null,
  2820. labelCount : 0,
  2821. _$functionClassMethod : function() {
  2822. var _$self = function(args) {
  2823. if (args !== null || arguments.length > 1){
  2824. args = Array.prototype.slice.call(arguments, 0);
  2825. }
  2826. {
  2827. _$self.drop(args[0], ((args[1])));
  2828. return null;
  2829. }
  2830. };
  2831. return _$self;
  2832. },
  2833. /** @expose */
  2834. constructor : function() {
  2835. this._dropOverlap = (rave.capabilities.extension("position")).drop().remove(false);
  2836. this._dropOverlap.setOverlapGap(4.0);
  2837. },
  2838. /**
  2839. * Drop the overlapping labels or reset the overlap.
  2840. * @param (rave['internal']['Selection']) labels The selector for the labels
  2841. * @param (boolean) removeOverlap true to remove the overlapping labels, false to reset
  2842. */
  2843. /** @expose */
  2844. drop : function(labels, removeOverlap) {
  2845. if (!(labels.isTransition())) {
  2846. this.applyLabelDrop(labels, removeOverlap);
  2847. } else {
  2848. var steps = [0, 25, 75];
  2849. var self = this;
  2850. (labels).tween("__pointLabelDrop__", function(data, index, groupIndex) {
  2851. if (index == 0) {
  2852. return function(t) {
  2853. var currentStep = Math.floor(t * 100);
  2854. if (steps.length > 0 && currentStep < 100 && currentStep >= steps[0]) {
  2855. steps.splice(0, 1);
  2856. self.applyLabelDrop(labels, removeOverlap);
  2857. }
  2858. };
  2859. }
  2860. return null;
  2861. });
  2862. this.labelCount = 0;
  2863. (labels).each(function(data, index, groupIndex) {
  2864. ++self.labelCount;
  2865. }).each("end", function(args) {
  2866. if (args !== null || arguments.length > 1){
  2867. args = Array.prototype.slice.call(arguments, 0);
  2868. }
  2869. {
  2870. if (--self.labelCount == 0) {
  2871. self.applyLabelDrop(labels, removeOverlap);
  2872. }
  2873. return null;
  2874. }
  2875. });
  2876. }
  2877. },
  2878. applyLabelDrop : function(labels, removeOverlap) {
  2879. if (removeOverlap) {
  2880. labels.call(this._dropOverlap);
  2881. } else {
  2882. this._dropOverlap.reset(labels);
  2883. }
  2884. },
  2885. /** @expose */
  2886. configureForDataLabels : function(rect) {
  2887. if (rect) {
  2888. var ex = [[rect.x, rect.y], [rect.x + rect.width, rect.y + rect.height]];
  2889. this._dropOverlap.extent(ex);
  2890. }
  2891. this._dropOverlap.noClipping();
  2892. }
  2893. });
  2894. /**
  2895. * Drop overlap extension
  2896. */
  2897. //com_ibm_rave_bundles_utilities_BundleLabelDropper.POSITION_EXTENSION = "position";
  2898. /**
  2899. * space between labels during overlap testing
  2900. */
  2901. com_ibm_rave_bundles_utilities_BundleLabelDropper.OVERLAP_GAP = 4;
  2902. // $source: com/ibm/rave/bundles/components/StyleStructs
  2903. /************************************************************************
  2904. ** IBM Confidential
  2905. **
  2906. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2907. **
  2908. ** (C) Copyright IBM Corp. 2017
  2909. **
  2910. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2911. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2912. ************************************************************************/
  2913. // GENERATED
  2914. /**
  2915. * Struct classes to hold style properties.
  2916. */
  2917. var com_ibm_rave_bundles_components_StyleStructs = rave['internal']['Declare']({
  2918. });
  2919. /**
  2920. * Filled shape style properties.
  2921. */
  2922. com_ibm_rave_bundles_components_StyleStructs.ShapeStyle = function() {
  2923. this._fill = null;
  2924. this._stroke = null;
  2925. this._strokeWidth = null;
  2926. };
  2927. /**
  2928. * Line style properties.
  2929. */
  2930. com_ibm_rave_bundles_components_StyleStructs.LineStyle = function() {
  2931. this._stroke = null;
  2932. this._strokeWidth = null;
  2933. this._dashArray = null;
  2934. };
  2935. // $source: com/ibm/rave/bundles/component/GridComponent
  2936. /************************************************************************
  2937. ** IBM Confidential
  2938. **
  2939. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2940. **
  2941. ** (C) Copyright IBM Corp. 2017
  2942. **
  2943. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2944. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2945. ************************************************************************/
  2946. // GENERATED
  2947. /**
  2948. * <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>
  2949. */
  2950. var com_ibm_rave_bundles_component_GridComponent = rave['internal']['Declare'].implement(
  2951. /**
  2952. * @return (String) The role of the grid in the chart
  2953. */
  2954. //role : function() {},
  2955. /**
  2956. * Whether to display the gridlines.
  2957. * @param (boolean) displayGridlines The new displayGridlines
  2958. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  2959. */
  2960. //displayGridlines : function(displayGridlines) {},
  2961. /**
  2962. * Set the line styling. Equivalent to calling {@link #this.gridlineColor(String)} and {@link #this.dashArray(String)} .
  2963. * @param (String) stroke The stroke color
  2964. * @param (String) dashArray The stroke-dasharray
  2965. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  2966. */
  2967. //gridlineStyle : function(stroke, dashArray) {},
  2968. /**
  2969. * The color used to draw the gridlines.
  2970. * @param (String) gridlineColor The new stroke color
  2971. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  2972. */
  2973. //gridlineColor : function(gridlineColor) {},
  2974. /**
  2975. * 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.
  2976. * @param (String) dashArray The new dash array
  2977. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  2978. */
  2979. //dashArray : function(dashArray) {}
  2980. );
  2981. /**
  2982. * The string returned by {@link #this.type()} is "GridComponent".
  2983. */
  2984. /** @expose */
  2985. com_ibm_rave_bundles_component_GridComponent.COMPONENT_TYPE = "GridComponent";
  2986. // $source: com/ibm/rave/bundles/components/IntervalDataUtilities
  2987. /************************************************************************
  2988. ** IBM Confidential
  2989. **
  2990. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2991. **
  2992. ** (C) Copyright IBM Corp. 2017
  2993. **
  2994. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2995. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2996. ************************************************************************/
  2997. // GENERATED
  2998. /**
  2999. * 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.
  3000. */
  3001. var com_ibm_rave_bundles_components_IntervalDataUtilities = rave['internal']['Declare']({
  3002. });
  3003. /**
  3004. * <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>
  3005. * @param (Array) data Data array
  3006. * @param (rave['internal']['SingleValueFunction']) x X accessor, should not be null
  3007. * @param (rave['internal']['SingleValueFunction']) xScale Function to check if the X value is valid
  3008. * @param (rave['internal']['SingleValueFunction']) y Y accessor, should not be null
  3009. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3010. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3011. * @return (Array) Array of intervals for the data
  3012. */
  3013. /** @expose */
  3014. com_ibm_rave_bundles_components_IntervalDataUtilities.simpleBars = function(data, x, xScale, y, yStart, color, label) {
  3015. var result = [];
  3016. if (!data || data.length == 0 || !x || !y) {
  3017. return result;
  3018. }
  3019. data.forEach(function(d, ix, list) {
  3020. var xv = x(d);
  3021. if (xv != null && (!xScale || xScale(xv) != null)) {
  3022. var yv = y(d);
  3023. var yvStart = !yStart ? 0 : yStart(d);
  3024. if (yv != null && yvStart != null) {
  3025. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3026. r.key = ix;
  3027. r.ind1 = xv;
  3028. r.ind2 = r.ind1;
  3029. r.cind = r.ind1;
  3030. r.dep1 = yvStart;
  3031. r.dep2 = yv;
  3032. r.cdep = r.dep2;
  3033. r.color = color ? color(d) : null;
  3034. r.label = label ? label(d) : null;
  3035. r.value = r.dep2;
  3036. r._originalData = d;
  3037. r.valueAsPercentOfCategory = 100;
  3038. result.push(r);
  3039. }
  3040. }
  3041. return null;
  3042. });
  3043. var sum = 0;
  3044. for (var i = 0; i < result.length; ++i) {
  3045. var iData = result[i];
  3046. var value = + (iData.value);
  3047. sum += Math.abs(value);
  3048. }
  3049. if (sum != 0) {
  3050. for (var i = 0; i < result.length; ++i) {
  3051. var iData = result[i];
  3052. var value = + (iData.value);
  3053. iData.valueAsPercentOfColor = value / sum * 100;
  3054. }
  3055. }
  3056. return result;
  3057. };
  3058. /**
  3059. * Create intervals for bars in a clustered chart. This is similar to the simple bars, except the independent values are an array of accessors.
  3060. * @param (Array) data Data array
  3061. * @param (Array) x Independent accessor array, should not be null and no entries should be null
  3062. * @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
  3063. * @param (rave['internal']['SingleValueFunction']) y Dependent accessor, should not be null
  3064. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3065. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3066. * @return (Array) Array of intervals for the data
  3067. */
  3068. /** @expose */
  3069. com_ibm_rave_bundles_components_IntervalDataUtilities.clusteredBars = function(data, x, xScale, y, yStart, color, label) {
  3070. var result = [];
  3071. if (!data || data.length == 0 || !x || x.length == 0 || !y) {
  3072. return result;
  3073. }
  3074. var len = x.length;
  3075. var categories = {};
  3076. var colors = {};
  3077. data.forEach(function(d, ix, list) {
  3078. var OK = true;
  3079. var ind = [];
  3080. for (var i = 0; i < len; ++i) {
  3081. var xv = x[i](d);
  3082. if (xv == null || (xScale[i] && xScale[i](xv) == null)) {
  3083. OK = false;
  3084. break;
  3085. }
  3086. ind.push(xv);
  3087. if (i == 0) {
  3088. if (!(categories.hasOwnProperty(xv))) {
  3089. categories[""+(xv)] = 1;
  3090. }
  3091. } else if (!(colors.hasOwnProperty(xv))) {
  3092. colors[""+(xv)] = 1;
  3093. }
  3094. }
  3095. var dep = y(d);
  3096. var depStart = !yStart ? 0 : yStart(d);
  3097. if (OK && dep != null && depStart != null) {
  3098. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3099. r.key = ix;
  3100. r.ind1 = ind;
  3101. r.ind2 = ind;
  3102. r.cind = ind;
  3103. r.dep1 = depStart;
  3104. r.dep2 = dep;
  3105. r.cdep = r.dep2;
  3106. r.color = color ? color(d) : null;
  3107. r.label = label ? label(d) : null;
  3108. r.value = r.dep2;
  3109. r._originalData = d;
  3110. result.push(r);
  3111. }
  3112. return null;
  3113. });
  3114. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(categories), __len_enFor0 = __exp_enFor0.length;
  3115. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3116. var o = __exp_enFor0[__i_enFor0];
  3117. var s = ""+(o);
  3118. var sum = 0;
  3119. for (var i = 0; i < result.length; ++i) {
  3120. var iData = result[i];
  3121. if (s == (iData.ind1)[0]) {
  3122. var value = + (iData.value);
  3123. sum += Math.abs(value);
  3124. }
  3125. }
  3126. if (sum == 0) {
  3127. continue;
  3128. }
  3129. for (var i = 0; i < result.length; ++i) {
  3130. var iData = result[i];
  3131. if (s == (iData.ind1)[0]) {
  3132. var value = + (iData.value);
  3133. iData.valueAsPercentOfCategory = value / sum * 100;
  3134. }
  3135. }
  3136. }
  3137. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(colors), __len_enFor1 = __exp_enFor1.length;
  3138. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3139. var o = __exp_enFor1[__i_enFor1];
  3140. var s = ""+(o);
  3141. var sum = 0;
  3142. for (var i = 0; i < result.length; ++i) {
  3143. var iData = result[i];
  3144. if (s == iData.color) {
  3145. var value = + (iData.value);
  3146. sum += Math.abs(value);
  3147. }
  3148. }
  3149. if (sum == 0) {
  3150. continue;
  3151. }
  3152. for (var i = 0; i < result.length; ++i) {
  3153. var iData = result[i];
  3154. if (s == iData.color) {
  3155. var value = + (iData.value);
  3156. iData.valueAsPercentOfColor = value / sum * 100;
  3157. }
  3158. }
  3159. }
  3160. return result;
  3161. };
  3162. /**
  3163. * 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.
  3164. * @param (Array) data Data array
  3165. * @param (rave['internal']['SingleValueFunction']) x Independent accessor, should not be null
  3166. * @param (rave['internal']['SingleValueFunction']) xScale Possibly-null function to check if X values are in domain
  3167. * @param (rave['internal']['SingleValueFunction']) y Dependent accessor, should not be null
  3168. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3169. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3170. * @param (boolean) percent If true, create percent bars
  3171. * @return (Array) Array of intervals for the data
  3172. */
  3173. /** @expose */
  3174. com_ibm_rave_bundles_components_IntervalDataUtilities.stackedBars = function(data, x, xScale, y, color, label, percent) {
  3175. var result = [];
  3176. if (!data || data.length == 0 || !x || !y) {
  3177. return result;
  3178. }
  3179. var stacks = {};
  3180. var categories = {};
  3181. var colors = {};
  3182. data.forEach(function(d, ix, list) {
  3183. var xv = x(d);
  3184. if (xv != null && (!xScale || xScale(xv) != null)) {
  3185. var yv = y(d);
  3186. if (yv != null) {
  3187. var stack = stacks[xv];
  3188. if (!stack) {
  3189. stack = new com_ibm_rave_bundles_components_IntervalDataUtilities.Stack();
  3190. stacks[xv] = stack;
  3191. }
  3192. var dVal = + (yv);
  3193. if (!percent) {
  3194. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3195. r.key = ix;
  3196. r.ind1 = xv;
  3197. r.ind2 = xv;
  3198. r.cind = xv;
  3199. var sum = dVal < 0.0 ? stack.negativeSum : stack.positiveSum;
  3200. r.dep1 = sum;
  3201. r.dep2 = sum + dVal;
  3202. r.cdep = r.dep2;
  3203. r.color = color ? color(d) : null;
  3204. r.label = label ? label(d) : null;
  3205. r.value = dVal;
  3206. r._originalData = d;
  3207. result.push(r);
  3208. }
  3209. if (dVal < 0.0) {
  3210. stack.negativeSum += dVal;
  3211. } else {
  3212. stack.positiveCount++;
  3213. stack.positiveSum += dVal;
  3214. }
  3215. if (!(categories.hasOwnProperty(xv))) {
  3216. categories[""+(xv)] = 1;
  3217. }
  3218. if (color) {
  3219. var o = color(d);
  3220. if ((o != null) && !(colors.hasOwnProperty(o))) {
  3221. colors[""+(o)] = 1;
  3222. }
  3223. }
  3224. }
  3225. }
  3226. return null;
  3227. });
  3228. if (percent) {
  3229. data.forEach(function(d, ix, list) {
  3230. var xv = x(d);
  3231. if (xv != null && (!xScale || xScale(xv) != null)) {
  3232. var yv = y(d);
  3233. if (yv != null) {
  3234. var stack = stacks[xv];
  3235. var dVal = + (yv);
  3236. var percent;
  3237. if (dVal < 0.0) {
  3238. percent = -100.0 * dVal / stack.negativeSum;
  3239. } else if (stack.positiveSum > 0) {
  3240. percent = 100.0 * dVal / stack.positiveSum;
  3241. } else {
  3242. percent = 100.0 / stack.positiveCount;
  3243. }
  3244. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3245. r.key = ix;
  3246. r.ind1 = xv;
  3247. r.ind2 = xv;
  3248. r.cind = xv;
  3249. var sum = dVal < 0.0 ? stack.negativePercent : stack.positivePercent;
  3250. r.dep1 = sum;
  3251. r.dep2 = sum + percent;
  3252. r.cdep = r.dep2;
  3253. r.color = color ? color(d) : null;
  3254. r.label = label ? label(d) : null;
  3255. r.value = dVal;
  3256. r.valueAsPercentOfCategory = percent;
  3257. r._originalData = d;
  3258. result.push(r);
  3259. if (dVal < 0.0) {
  3260. stack.negativePercent += percent;
  3261. } else {
  3262. stack.positivePercent += percent;
  3263. }
  3264. }
  3265. }
  3266. return null;
  3267. });
  3268. } else {
  3269. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(categories), __len_enFor0 = __exp_enFor0.length;
  3270. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3271. var o = __exp_enFor0[__i_enFor0];
  3272. var s = ""+(o);
  3273. var sum = 0;
  3274. for (var i = 0; i < result.length; ++i) {
  3275. var iData = result[i];
  3276. if (s == iData.ind1) {
  3277. var value = + (iData.value);
  3278. sum += Math.abs(value);
  3279. }
  3280. }
  3281. if (sum == 0) {
  3282. continue;
  3283. }
  3284. for (var i = 0; i < result.length; ++i) {
  3285. var iData = result[i];
  3286. if (s == iData.ind1) {
  3287. var value = + (iData.value);
  3288. iData.valueAsPercentOfCategory = value / sum * 100;
  3289. }
  3290. }
  3291. }
  3292. }
  3293. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(colors), __len_enFor1 = __exp_enFor1.length;
  3294. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3295. var o = __exp_enFor1[__i_enFor1];
  3296. var s = ""+(o);
  3297. var sum = 0;
  3298. for (var i = 0; i < result.length; ++i) {
  3299. var iData = result[i];
  3300. if (s == iData.color) {
  3301. var value = + (iData.value);
  3302. sum += Math.abs(value);
  3303. }
  3304. }
  3305. if (sum == 0) {
  3306. continue;
  3307. }
  3308. for (var i = 0; i < result.length; ++i) {
  3309. var iData = result[i];
  3310. if (s == iData.color) {
  3311. var value = + (iData.value);
  3312. iData.valueAsPercentOfColor = value / sum * 100;
  3313. }
  3314. }
  3315. }
  3316. return result;
  3317. };
  3318. /**
  3319. * Structure class holding interval information.
  3320. */
  3321. com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData = rave['internal']['Declare']({
  3322. /**
  3323. * Key value; for now this is the data index
  3324. */
  3325. /** @expose */
  3326. key : null,
  3327. /**
  3328. * First independent value
  3329. */
  3330. /** @expose */
  3331. ind1 : null,
  3332. /**
  3333. * Second independent value (in all current uses, same as ind1)
  3334. */
  3335. /** @expose */
  3336. ind2 : null,
  3337. /**
  3338. * First dependent value
  3339. */
  3340. /** @expose */
  3341. dep1 : null,
  3342. /**
  3343. * Second dependent value
  3344. */
  3345. /** @expose */
  3346. dep2 : null,
  3347. /**
  3348. * The data value that the interval represents. Not the pixel value. Used in stacked chart
  3349. */
  3350. /** @expose */
  3351. value : null,
  3352. /**
  3353. * Color value
  3354. */
  3355. /** @expose */
  3356. color : null,
  3357. /**
  3358. * Label value
  3359. */
  3360. /** @expose */
  3361. label : null,
  3362. /**
  3363. * Callout independent value (in all current uses, same as ind1)
  3364. */
  3365. /** @expose */
  3366. cind : null,
  3367. /**
  3368. * Callout dependent value (dependent extent)
  3369. */
  3370. /** @expose */
  3371. cdep : null,
  3372. /** @expose */
  3373. _originalData : null,
  3374. /**
  3375. * The data value (in percentage) for specific category
  3376. */
  3377. /** @expose */
  3378. valueAsPercentOfCategory : NaN,
  3379. /**
  3380. * The data value (in percentage) across all categories
  3381. */
  3382. /** @expose */
  3383. valueAsPercentOfColor : NaN,
  3384. /** @expose */
  3385. originalData : function() {
  3386. return this._originalData;
  3387. },
  3388. /** @expose */
  3389. originalDataList : function() {
  3390. var list = [];
  3391. list.push(this._originalData);
  3392. return list;
  3393. }
  3394. });
  3395. com_ibm_rave_bundles_components_IntervalDataUtilities.Stack = function() {
  3396. this.positiveCount = 0;
  3397. this.positiveSum = 0;
  3398. this.negativeSum = 0;
  3399. this.positivePercent = 0;
  3400. this.negativePercent = 0;
  3401. };
  3402. /**
  3403. * Accessor for the callout dependent value
  3404. */
  3405. /** @expose */
  3406. com_ibm_rave_bundles_components_IntervalDataUtilities.CALLOUT_DEPENDENT_ACCESSOR = function(data) {
  3407. return (data).cdep;
  3408. };
  3409. /**
  3410. * Accessor for the callout independent value
  3411. */
  3412. /** @expose */
  3413. com_ibm_rave_bundles_components_IntervalDataUtilities.CALLOUT_INDEPENDENT_ACCESSOR = function(data) {
  3414. return (data).cind;
  3415. };
  3416. /**
  3417. * Accessor for the data value
  3418. */
  3419. /** @expose */
  3420. com_ibm_rave_bundles_components_IntervalDataUtilities.VALUE_ACCESSOR = function(data) {
  3421. return (data).value;
  3422. };
  3423. /**
  3424. * Accessor for data value as percent of category
  3425. */
  3426. /** @expose */
  3427. com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR = function(data) {
  3428. var percent = (data).valueAsPercentOfCategory;
  3429. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3430. };
  3431. /**
  3432. * Accessor for data value as percent of color (series)
  3433. */
  3434. /** @expose */
  3435. com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_COLOR_ACCESSOR = function(data) {
  3436. var percent = (data).valueAsPercentOfColor;
  3437. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3438. };
  3439. // $source: com/ibm/rave/bundles/data/PointDataUtilities
  3440. /************************************************************************
  3441. ** IBM Confidential
  3442. **
  3443. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3444. **
  3445. ** (C) Copyright IBM Corp. 2017
  3446. **
  3447. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3448. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3449. ************************************************************************/
  3450. // GENERATED
  3451. /**
  3452. * Utility class for building arrays of point datum objects from tabular data.
  3453. */
  3454. var com_ibm_rave_bundles_data_PointDataUtilities = rave['internal']['Declare']({
  3455. });
  3456. /**
  3457. * <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>
  3458. * @param (Array) data Input data, list of arbitrary objects
  3459. * @param (rave['internal']['SingleValueFunction']) xAccessor X accessor function, may be null
  3460. * @param (rave['internal']['SingleValueFunction']) xScale Scale to test if the X value should be included, may be null
  3461. * @param (rave['internal']['SingleValueFunction']) yAccessor Y accessor function, may be null
  3462. * @param (rave['internal']['SingleValueFunction']) yScale Scale to test if the Y value should be included, may be null
  3463. * @return (Array) List of PointData objects
  3464. */
  3465. /** @expose */
  3466. com_ibm_rave_bundles_data_PointDataUtilities.buildPoints = function(data, xAccessor, xScale, yAccessor, yScale) {
  3467. var result = [];
  3468. if (data) {
  3469. for (var __i_enFor0 = 0, __exp_enFor0 = data, __len_enFor0 = __exp_enFor0.length;
  3470. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3471. var o = __exp_enFor0[__i_enFor0];
  3472. if (o != null) {
  3473. var xv = null;
  3474. if (xAccessor) {
  3475. xv = xAccessor(o);
  3476. if (xv == null || (xScale && xScale(xv) == null)) {
  3477. continue;
  3478. }
  3479. }
  3480. var yv = null;
  3481. if (yAccessor) {
  3482. yv = yAccessor(o);
  3483. if (yv == null || (yScale && yScale(yv) == null)) {
  3484. continue;
  3485. }
  3486. }
  3487. var datum = new com_ibm_rave_bundles_data_PointDataUtilities.PointDatum();
  3488. datum._x = xv;
  3489. datum._y = yv;
  3490. datum._originalData = o;
  3491. result.push(datum);
  3492. }
  3493. }
  3494. }
  3495. return result;
  3496. };
  3497. /**
  3498. * 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.
  3499. */
  3500. com_ibm_rave_bundles_data_PointDataUtilities.PointDatum = rave['internal']['Declare']({
  3501. /**
  3502. * The X value
  3503. */
  3504. /** @expose */
  3505. _x : null,
  3506. /**
  3507. * The Y value
  3508. */
  3509. /** @expose */
  3510. _y : null,
  3511. /**
  3512. * The data value (in percentage) that the point represents
  3513. */
  3514. /** @expose */
  3515. _yAsPercentOfCategory : null,
  3516. /**
  3517. * The data value (in percentage) that the point represents
  3518. */
  3519. /** @expose */
  3520. _yAsPercentOfColor : null,
  3521. /**
  3522. * The original data
  3523. */
  3524. /** @expose */
  3525. _originalData : null,
  3526. /** @expose */
  3527. originalData : function() {
  3528. return this._originalData;
  3529. },
  3530. /** @expose */
  3531. originalDataList : function() {
  3532. var list = [];
  3533. list.push(this._originalData);
  3534. return list;
  3535. }
  3536. });
  3537. /**
  3538. * Accessor returning the _x property of a PointDatum.
  3539. */
  3540. /** @expose */
  3541. com_ibm_rave_bundles_data_PointDataUtilities.X_ACCESSOR = function(d) {
  3542. return (d)._x;
  3543. };
  3544. /**
  3545. * Accessor returning the _y property of a PointDatum.
  3546. */
  3547. /** @expose */
  3548. com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR = function(d) {
  3549. return (d)._y;
  3550. };
  3551. /**
  3552. * Accessor returning the _yAsPercentOfCategory property of a PointDatum.
  3553. */
  3554. /** @expose */
  3555. com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR = function(d) {
  3556. var percent = + ((d)._yAsPercentOfCategory);
  3557. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3558. };
  3559. /**
  3560. * Accessor returning the _yAsPercentOfColor property of a PointDatum.
  3561. */
  3562. /** @expose */
  3563. com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_COLOR_ACCESSOR = function(d) {
  3564. var percent = + ((d)._yAsPercentOfColor);
  3565. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3566. };
  3567. // $source: com/ibm/rave/bundles/utilities/ColorUtil
  3568. /************************************************************************
  3569. ** IBM Confidential
  3570. **
  3571. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3572. **
  3573. ** (C) Copyright IBM Corp. 2017
  3574. **
  3575. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3576. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3577. ************************************************************************/
  3578. // GENERATED
  3579. var com_ibm_rave_bundles_utilities_ColorUtil = rave['internal']['Declare']({
  3580. });
  3581. /**
  3582. * It is used to get a foreground color which has atleast a 4.5 contrast ratio with the background color.
  3583. * @param (Object) bg bakground color
  3584. * @param (Object) fg foreground color
  3585. * @return (Object) a color ( darker/ligher/same fg color ) which contrast with background.
  3586. */
  3587. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$0 = function(bg, fg) {
  3588. var contrastRatio = com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio(bg, fg);
  3589. if (contrastRatio < 4.5) {
  3590. var bgHSL = rave.hsl(bg);
  3591. var fgHSL = rave.hsl(fg);
  3592. 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);
  3593. if (brightness > 0.5) {
  3594. if (bgHSL.getL() > 0.5) {
  3595. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.min(fgHSL.getL(), bgHSL.getL() - 0.4));
  3596. } else {
  3597. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.min(fgHSL.getL(), 0.1));
  3598. }
  3599. } else {
  3600. if (bgHSL.getL() < 0.5) {
  3601. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.max(fgHSL.getL(), bgHSL.getL() + 0.4));
  3602. } else {
  3603. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.max(fgHSL.getL(), 0.9));
  3604. }
  3605. }
  3606. }
  3607. return fg;
  3608. };
  3609. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$1 = function(labelColor) {
  3610. var labelRGB = rave.rgb(labelColor);
  3611. return labelRGB.contrastShift(21);
  3612. };
  3613. /** @expose */
  3614. com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio = function(colorA, colorB) {
  3615. var foregroundLuminance = rave.rgb(colorA).getLuminance();
  3616. var backgroundLuminance = rave.rgb(colorB).getLuminance();
  3617. var contrastRatio = (foregroundLuminance >= backgroundLuminance) ? (foregroundLuminance + 0.05) / (backgroundLuminance + 0.05) : (backgroundLuminance + 0.05) / (foregroundLuminance + 0.05);
  3618. return contrastRatio;
  3619. };
  3620. /** @expose */
  3621. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor = function(a0, a1) {
  3622. var args = arguments;
  3623. if (args.length == 1) {
  3624. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$1(a0);
  3625. }
  3626. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$0(a0, a1);
  3627. };
  3628. // $source: com/ibm/rave/bundles/component/TreemapComponent
  3629. /************************************************************************
  3630. ** IBM Confidential
  3631. **
  3632. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3633. **
  3634. ** (C) Copyright IBM Corp. 2017
  3635. **
  3636. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3637. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3638. ************************************************************************/
  3639. // GENERATED
  3640. /**
  3641. * <p> A component that renders treemap charts. The {@link #this.type()} method returns "TreemapComponent". </p>
  3642. */
  3643. var com_ibm_rave_bundles_component_TreemapComponent = rave['internal']['Declare'].implement(
  3644. /**
  3645. * @param (boolean) itemLabel Whether to use labels
  3646. * @return (com.ibm.rave.bundles.component.TreemapComponent) This object
  3647. */
  3648. //itemLabel : function(itemLabel) {},
  3649. /**
  3650. * @param (boolean) leadLabel Whether to show parent level labels
  3651. * @return (com.ibm.rave.bundles.component.TreemapComponent) This object
  3652. */
  3653. //leadLabel : function(leadLabel) {},
  3654. /**
  3655. * @param (int) itemLabelLevel which level to show labels
  3656. * @return (com.ibm.rave.bundles.component.TreemapComponent) This object
  3657. */
  3658. //itemLabelLevel : function(itemLabelLevel) {},
  3659. /**
  3660. * @param (String) labelStyle style for the labels.
  3661. * @return (com.ibm.rave.bundles.component.TreemapComponent) This object
  3662. */
  3663. //labelFont : function(labelStyle) {}
  3664. );
  3665. /**
  3666. * The string returned by {@link #this.type()} is "TreemapComponent".
  3667. */
  3668. /** @expose */
  3669. com_ibm_rave_bundles_component_TreemapComponent.COMPONENT_TYPE = "TreemapComponent";
  3670. // $source: com/ibm/rave/bundles/utilities/LabelStyleUtil
  3671. /************************************************************************
  3672. ** IBM Confidential
  3673. **
  3674. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3675. **
  3676. ** (C) Copyright IBM Corp. 2017
  3677. **
  3678. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3679. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3680. ************************************************************************/
  3681. // GENERATED
  3682. //@import com/ibm/rave/bundles/components/FilterComponentImpl (runtime) // new
  3683. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor, getContrastRatio
  3684. /**
  3685. * This class can be used to apply styles on labels. Eg: when we need to overrule the given label style properties.
  3686. */
  3687. var com_ibm_rave_bundles_utilities_LabelStyleUtil = rave['internal']['Declare']({
  3688. //_labelFontStyle : null,
  3689. //_contrastLabelColorfilter : null,
  3690. //_sameLabelColorfilter : null,
  3691. /**
  3692. * eg: apply contrast label color with background. apply different font size for each level label. apply a contrast shadow for a label.
  3693. */
  3694. //_labelFillColor : null,
  3695. //_labelFontSize : null,
  3696. _labelShadow : false,
  3697. _$functionClassMethod : function() {
  3698. var _$self = function(args) {
  3699. if (args !== null || arguments.length > 1){
  3700. args = Array.prototype.slice.call(arguments, 0);
  3701. }
  3702. {
  3703. if (_$self._labelFontStyle) {
  3704. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(_$self._labelFontStyle), __len_enFor0 = __exp_enFor0.length;
  3705. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3706. var stylenName = __exp_enFor0[__i_enFor0];
  3707. if ((stylenName == "fill" || stylenName == "color" && _$self._labelFillColor) || (stylenName == "font-size" && _$self._labelFontSize) || (stylenName == "text-shadow" && _$self._labelShadow == true)) {
  3708. continue;
  3709. }
  3710. this.style(stylenName, _$self._labelFontStyle[stylenName]);
  3711. }
  3712. }
  3713. if (_$self._labelFillColor) {
  3714. this.style("fill", _$self._labelFillColor);
  3715. }
  3716. if (_$self._labelFontSize) {
  3717. this.style("font-size", _$self._labelFontSize);
  3718. }
  3719. var labels = this.selectAll("*");
  3720. if (labels.length == 0) {
  3721. labels = this;
  3722. }
  3723. if (_$self._labelShadow) {
  3724. var self = _$self;
  3725. var defaultLabelFill = _$self.getDefaultLabelColor(_$self._labelFontStyle);
  3726. _$self._contrastLabelColorfilter = new com_ibm_rave_bundles_components_FilterComponentImpl("contrast_label_drop_shadow");
  3727. _$self._contrastLabelColorfilter.setDropshadow("1px", "1px", "0px", rave.rgb(com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(defaultLabelFill)));
  3728. _$self._sameLabelColorfilter = new com_ibm_rave_bundles_components_FilterComponentImpl("same_label_drop_shadow");
  3729. _$self._sameLabelColorfilter.setDropshadow("1px", "1px", "0px", rave.rgb(defaultLabelFill));
  3730. var owner = this.node().rave_getOwner();
  3731. rave.select(owner).select("defs").call(_$self._contrastLabelColorfilter);
  3732. rave.select(owner).select("defs").call(_$self._sameLabelColorfilter);
  3733. this.each(function(data, index, groupIndex) {
  3734. if (self._labelFillColor) {
  3735. var contrastRatio = com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio(rave.rgb(self._labelFillColor.call(this, data, index, groupIndex)), defaultLabelFill);
  3736. if (contrastRatio < 4.5) {
  3737. this.setAttribute("filter", "url(#" + self._contrastLabelColorfilter.getId() + ")");
  3738. } else {
  3739. this.setAttribute("filter", "url(#" + self._sameLabelColorfilter.getId() + ")");
  3740. }
  3741. } else {
  3742. this.setAttribute("filter", "url(#" + self._contrastLabelColorfilter.getId() + ")");
  3743. }
  3744. });
  3745. labels.each(function(data, index, groupIndex) {
  3746. if (self._labelFillColor) {
  3747. this.rave_setProperty("_rave_drop_shadow", "1px 1px 0px " + com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(self._labelFillColor.call(this, data, index, groupIndex)).toString());
  3748. } else {
  3749. this.rave_setProperty("_rave_drop_shadow", "1px 1px 0px " + com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(defaultLabelFill).toString());
  3750. }
  3751. });
  3752. } else {
  3753. labels.each(function(data, index, groupIndex) {
  3754. this.rave_setProperty("_rave_drop_shadow", null);
  3755. });
  3756. this.attr("filter", null);
  3757. }
  3758. return null;
  3759. }
  3760. };
  3761. return _$self;
  3762. },
  3763. /** @expose */
  3764. labelFont : function(labelFontStyle) {
  3765. this._labelFontStyle = labelFontStyle;
  3766. return this;
  3767. },
  3768. /** @expose */
  3769. labelFillColor : function(_labelFillColor) {
  3770. this._labelFillColor = _labelFillColor;
  3771. return this;
  3772. },
  3773. /** @expose */
  3774. labelFontSize : function(_labelFontSize) {
  3775. this._labelFontSize = _labelFontSize;
  3776. return this;
  3777. },
  3778. /** @expose */
  3779. labelShadow : function(labelShadow) {
  3780. this._labelShadow = labelShadow;
  3781. return this;
  3782. },
  3783. /** @expose */
  3784. getDefaultLabelColor : function(_labelStyle) {
  3785. if (!_labelStyle) {
  3786. return "#000000";
  3787. }
  3788. var defaultFillColor;
  3789. if (_labelStyle) {
  3790. defaultFillColor = _labelStyle["fill"];
  3791. if (defaultFillColor == null) {
  3792. defaultFillColor = _labelStyle["color"];
  3793. }
  3794. }
  3795. if (defaultFillColor == null) {
  3796. defaultFillColor = "#000000";
  3797. }
  3798. return defaultFillColor.toString();
  3799. }
  3800. });
  3801. // $source: com/ibm/rave/bundles/component/BreadcrumbComponent
  3802. /************************************************************************
  3803. ** IBM Confidential
  3804. **
  3805. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3806. **
  3807. ** (C) Copyright IBM Corp. 2017
  3808. **
  3809. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3810. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3811. ************************************************************************/
  3812. // GENERATED
  3813. /**
  3814. * <p> A component that renders the breadcrumb to the chart. The {@link #this.type()} method returns "BreadcrumbComponent". </p>
  3815. */
  3816. var com_ibm_rave_bundles_component_BreadcrumbComponent = rave['internal']['Declare'].implement(
  3817. );
  3818. /**
  3819. * The string returned by {@link #this.type()} is "BreadcrumbComponent".
  3820. */
  3821. /** @expose */
  3822. com_ibm_rave_bundles_component_BreadcrumbComponent.COMPONENT_TYPE = "BreadcrumbComponent";
  3823. // $source: com/ibm/rave/bundles/data/HierarchyBundleDatum
  3824. /************************************************************************
  3825. ** IBM Confidential
  3826. **
  3827. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3828. **
  3829. ** (C) Copyright IBM Corp. 2017
  3830. **
  3831. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3832. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3833. ************************************************************************/
  3834. // GENERATED
  3835. /**
  3836. * Bundle datum wrapper for Core hierarchical data types.
  3837. */
  3838. var com_ibm_rave_bundles_data_HierarchyBundleDatum = rave['internal']['Declare']({
  3839. /** @expose */
  3840. _hierarchyNode : null,
  3841. /** @expose */
  3842. originalData : function() {
  3843. return this._hierarchyNode["data"];
  3844. },
  3845. /** @expose */
  3846. originalDataList : function() {
  3847. var list = [];
  3848. list.push(this._hierarchyNode["data"]);
  3849. return list;
  3850. }
  3851. });
  3852. // $source: com/ibm/rave/bundles/internal/nativeImpl/BundleModule
  3853. /************************************************************************
  3854. ** IBM Confidential
  3855. **
  3856. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3857. **
  3858. ** (C) Copyright IBM Corp. 2015
  3859. **
  3860. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3861. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3862. ************************************************************************/
  3863. // Must be the first import
  3864. // @import ./BundleModuleHeader
  3865. // expose DataFormatter to the global variable rave
  3866. //rave["library"]["CustomFormatter"]=com_ibm_rave_library_framework_CustomFormatter;
  3867. // $source: com/ibm/rave/bundles/treemapBundle/TreemapBundle
  3868. /************************************************************************
  3869. ** IBM Confidential
  3870. **
  3871. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3872. **
  3873. ** (C) Copyright IBM Corp. 2017
  3874. **
  3875. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3876. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3877. ************************************************************************/
  3878. // GENERATED
  3879. //@import com/ibm/rave/library/Library (static) // Library
  3880. //@import com/ibm/rave/bundles/RaveBundle (loadtime) // superclass
  3881. //@import com/ibm/rave/bundles/treemapBundle/TreemapView (runtime) // new
  3882. var com_ibm_rave_bundles_treemapBundle_TreemapBundle = rave['internal']['Declare'](com_ibm_rave_bundles_RaveBundle, {
  3883. /** @expose */
  3884. getName : function() {
  3885. return com_ibm_rave_bundles_treemapBundle_TreemapBundle.BUNDLE_NAME;
  3886. },
  3887. /** @expose */
  3888. createView : function(ctx) {
  3889. return new com_ibm_rave_bundles_treemapBundle_TreemapView(ctx);
  3890. }
  3891. //constructor : function() {}
  3892. });
  3893. /**
  3894. * Register the bundle factory with the library. The bundle will not be made available if this method is not called.
  3895. */
  3896. /** @expose */
  3897. com_ibm_rave_bundles_treemapBundle_TreemapBundle.init = function() {
  3898. if (!(com_ibm_rave_library_Library.bundle.isRegistered(com_ibm_rave_bundles_treemapBundle_TreemapBundle.BUNDLE_NAME))) {
  3899. var bundle;
  3900. com_ibm_rave_library_Library.bundle.extension(com_ibm_rave_bundles_treemapBundle_TreemapBundle.BUNDLE_NAME, function() {
  3901. if (!bundle) {
  3902. bundle = new com_ibm_rave_bundles_treemapBundle_TreemapBundle();
  3903. bundle.loadResources();
  3904. require("./vizlibrary-treemap.css");
  3905. }
  3906. return bundle;
  3907. });
  3908. }
  3909. return com_ibm_rave_bundles_treemapBundle_TreemapBundle.BUNDLE_NAME;
  3910. };
  3911. com_ibm_rave_bundles_treemapBundle_TreemapBundle.BUNDLE_NAME = "treemapBundle";
  3912. com_ibm_rave_bundles_treemapBundle_TreemapBundle.registered = false;
  3913. //com_ibm_rave_bundles_treemapBundle_TreemapBundle.INSTANCE = null;
  3914. // Auto initialization
  3915. com_ibm_rave_bundles_treemapBundle_TreemapBundle.init();
  3916. if (!com_ibm_rave_library_Library.bundle[com_ibm_rave_bundles_treemapBundle_TreemapBundle.BUNDLE_NAME]) {
  3917. com_ibm_rave_library_Library.bundle[com_ibm_rave_bundles_treemapBundle_TreemapBundle.BUNDLE_NAME] = function() {
  3918. if (!bundle) {
  3919. bundle = new com_ibm_rave_bundles_treemapBundle_TreemapBundle();
  3920. bundle.loadResources();
  3921. require("./vizlibrary-treemap.css");
  3922. }
  3923. return bundle;
  3924. };
  3925. } else {
  3926. console.log("Could not register extension: TreemapBundle");
  3927. }
  3928. // $source: com/ibm/rave/bundles/treemapBundle/TreemapView
  3929. /************************************************************************
  3930. ** IBM Confidential
  3931. **
  3932. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3933. **
  3934. ** (C) Copyright IBM Corp. 2017
  3935. **
  3936. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3937. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3938. ************************************************************************/
  3939. // GENERATED
  3940. //@import com/ibm/rave/bundles/views/BundleView (loadtime) // superclass
  3941. //@import com/ibm/rave/bundles/components/ChartLayoutComponentImpl (runtime) // new
  3942. //@import com/ibm/rave/bundles/components/TreemapComponentImpl (runtime) // new
  3943. //@import com/ibm/rave/bundles/components/BreadcrumbComponentImpl (runtime) // new
  3944. //@import com/ibm/rave/bundles/data/HierarchyBundleDatum (runtime) // new
  3945. /**
  3946. * Draws a line chart with axes, grid, and legend, using the components.
  3947. */
  3948. var com_ibm_rave_bundles_treemapBundle_TreemapView = rave['internal']['Declare'](com_ibm_rave_bundles_views_BundleView, {
  3949. /**
  3950. * Treemap component, created in setup
  3951. */
  3952. //_treemapComponent : null,
  3953. //_breadcrumbComponent : null,
  3954. /**
  3955. * Layout information from last display
  3956. */
  3957. //chartRect : null, //legendRect : null, //breadcrumbRect : null,
  3958. /**
  3959. * Hierarchical data from last display: result of converting the integrator-supplied data to a tree
  3960. */
  3961. //_hierarchyData : null,
  3962. /**
  3963. * Data mapped to original data from last display.
  3964. */
  3965. //_mappedNodes : null,
  3966. //_labelNodes : null,
  3967. //drillTargetNode : null,
  3968. //handle : null,
  3969. //_breadcrumbData : null,
  3970. _previousLabelLevel : 0,
  3971. _index : 0,
  3972. _maxLevel : 0,
  3973. currentDrillLevel : 0,
  3974. clicked : false,
  3975. _borderWidth : 0,
  3976. /**
  3977. * Construct the view
  3978. * @param (rave['library']['internal']['BundleContext']) context Bundle context
  3979. */
  3980. /** @expose */
  3981. constructor : function(context) {
  3982. this._layoutComponent = new com_ibm_rave_bundles_components_ChartLayoutComponentImpl();
  3983. },
  3984. /** @expose */
  3985. isZoomSupported : function() {
  3986. return false;
  3987. },
  3988. /** @expose */
  3989. setup : function() {
  3990. com_ibm_rave_bundles_views_BundleView.prototype.setup.call(this);
  3991. this._treemapComponent = new com_ibm_rave_bundles_components_TreemapComponentImpl();
  3992. this._breadcrumbComponent = new com_ibm_rave_bundles_components_BreadcrumbComponentImpl();
  3993. this._breadcrumbData = [];
  3994. this.currentDrillLevel = 0;
  3995. rave['library']['internal']['BundleUtils'].setupDefaultActions(this.context, ".rect", null);
  3996. this.context.actions.action("toggleSelect").setOperation(rave['library']['internal']['OperationsUtil'].toggleSelection(null));
  3997. var self = this;
  3998. var toggleSelectionAction = this.context.actions.action("toggleSelect");
  3999. var toggleSelectionListener = function(data, index, groupIndex, event) {
  4000. var primaryStyle = self.getNodeStyle((data));
  4001. primaryStyle["opacity"] = 1.0;
  4002. var selected = this;
  4003. if (self.clicked) {
  4004. self.clicked = false;
  4005. clearTimeout(self.handle);
  4006. } else {
  4007. self.clicked = true;
  4008. self.handle = setTimeout(function() {
  4009. self.clicked = false;
  4010. toggleSelectionAction(rave.select(selected), self.context.node.selectAll(".rect"), primaryStyle, null);
  4011. }, 300);
  4012. }
  4013. };
  4014. toggleSelectionAction.setBindFn(function() {
  4015. self.context.node.selectAll(".rect").on("click.default", toggleSelectionListener).on("touchstart.default", toggleSelectionListener);
  4016. });
  4017. var drillDownAction = self.context.actions.action("drillDown").setOperation(new (rave['internal']['Declare']([rave['library']['internal']['ActionOperation']], {
  4018. _$functionClassMethod : function() {
  4019. var _$self = function(args) {
  4020. if (args !== null || arguments.length > 1){
  4021. args = Array.prototype.slice.call(arguments);
  4022. }
  4023. {
  4024. self.drillIntoChildren(args[0]);
  4025. }
  4026. };
  4027. return _$self;
  4028. }
  4029. }))());
  4030. drillDownAction.setBindFn(function() {
  4031. self.context.node.selectAll(".rect").on("dblclick.default", function(data, index, groupIndex, event) {
  4032. drillDownAction(data);
  4033. });
  4034. });
  4035. drillDownAction.setUnbindFn(function() {
  4036. self.context.node.selectAll(".rect").on("dbclick.default", null);
  4037. });
  4038. rave['library']['internal']['BundleUtils'].setupBreadcrumbDefaultActions(this.context, ".indicator");
  4039. var breadcrumbSelectAction = self.context.actions.action("breadcrumbSelect");
  4040. breadcrumbSelectAction.setOperation(new (rave['internal']['Declare']([rave['library']['internal']['ActionOperation']], {
  4041. _$functionClassMethod : function() {
  4042. var _$self = function(args) {
  4043. if (args !== null || arguments.length > 1){
  4044. args = Array.prototype.slice.call(arguments);
  4045. }
  4046. {
  4047. self.breadcrumbSelect(args[0]);
  4048. }
  4049. };
  4050. return _$self;
  4051. }
  4052. }))());
  4053. },
  4054. breadcrumbSelect : function(data) {
  4055. var title = (data);
  4056. var index = 0;
  4057. for (var i = 0; i < this._breadcrumbData.length; ++i) {
  4058. if (title == this._breadcrumbData[i]) {
  4059. index = i;
  4060. break;
  4061. }
  4062. }
  4063. if (this.currentDrillLevel != index / 2) {
  4064. this.currentDrillLevel = index / 2;
  4065. this.drillTargetNode = this.getParentAtLevel(this.drillTargetNode, this.currentDrillLevel);
  4066. if (this.drillTargetNode) {
  4067. this.drawDrilledTreemap();
  4068. this._breadcrumbData.length =Math.max(1, index + 1);
  4069. this.context.node.selectAll("g.breadcrumb").call(this._breadcrumbComponent);
  4070. this.context.actions.applyBindings();
  4071. }
  4072. }
  4073. },
  4074. drillIntoChildren : function(data) {
  4075. this.drillTargetNode = this.getParentAtLevel((data)._hierarchyNode, this.currentDrillLevel + 1);
  4076. if (this.drillTargetNode && this.drillTargetNode["children"]) {
  4077. this.currentDrillLevel++;
  4078. this.drawDrilledTreemap();
  4079. this._breadcrumbData.push(">");
  4080. this._breadcrumbData.push(this.getBreadscrumLabel(this.drillTargetNode));
  4081. this.context.node.selectAll("g.breadcrumb").call(this._breadcrumbComponent);
  4082. this.context.actions.applyBindings();
  4083. }
  4084. },
  4085. drawDrilledTreemap : function() {
  4086. var drillScales = [];
  4087. var drillTranslate = [];
  4088. drillScales[0] = this.chartRect.width / this.drillTargetNode["dx"];
  4089. drillScales[1] = this.chartRect.height / this.drillTargetNode["dy"];
  4090. drillTranslate[0] = this.drillTargetNode["x"];
  4091. drillTranslate[1] = this.drillTargetNode["y"];
  4092. for (var __i_enFor0 = 0, __exp_enFor0 = this._mappedNodes, __len_enFor0 = __exp_enFor0.length;
  4093. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4094. var o = __exp_enFor0[__i_enFor0];
  4095. var d = (o)._hierarchyNode;
  4096. d["x"] = (d["x"] - drillTranslate[0]) * drillScales[0];
  4097. d["y"] = (d["y"] - drillTranslate[1]) * drillScales[1];
  4098. d["dx"] = d["dx"] * drillScales[0];
  4099. d["dy"] = d["dy"] * drillScales[1];
  4100. }
  4101. var labelLevel = this.getIntProperty("itemLabel");
  4102. this._labelNodes = this.getLabelData(Math.max(labelLevel, this.currentDrillLevel + 1));
  4103. this._treemapComponent.labelData(this._labelNodes);
  4104. var effect = this.getStringProperty("effect.name");
  4105. var duration = this.getEffectDuration(effect);
  4106. this.context.node.selectAll("g.element-group").transition().duration(duration).call(this._treemapComponent);
  4107. },
  4108. getBreadscrumLabel : function(node) {
  4109. var dataSet = this.dataModel.dataset("data");
  4110. var labelAccessor = rave['library']['internal']['AbstractView'].accessorOf(dataSet.slot("label").entry());
  4111. var result = !labelAccessor ? null : (labelAccessor(node["data"]));
  4112. return result != null ? result : "Level" + (node["depth"] + 1);
  4113. },
  4114. getParentAtLevel : function(node, level) {
  4115. if (node["depth"] == level) {
  4116. return node;
  4117. }
  4118. if (node["depth"] < level) {
  4119. return null;
  4120. }
  4121. return this.getParentAtLevel(node["parent"], level);
  4122. },
  4123. /** @expose */
  4124. draw : function() {
  4125. if (this.isUpdateNothing()) {
  4126. return;
  4127. }
  4128. this.preDraw("g.vizlibrary-treemap");
  4129. if (!(this.validateDataModel("g.element-group"))) {
  4130. return;
  4131. }
  4132. var effect = this.getStringProperty("effect.name");
  4133. var duration = this.getEffectDuration(effect);
  4134. var doTransition = (duration != 0);
  4135. var legendPosition = this.getLegendPosition();
  4136. var showLegend = this.isShowLegend();
  4137. var colorPalette = this.getDynamicPalette();
  4138. var dataSet = this.dataModel.dataset("data");
  4139. var sizeDataSlotEntry = dataSet.slot("size").entry();
  4140. if (this.updateType == 0) {
  4141. this.context.actions.action("deselectAll")(this.context.node.selectAll(".rect"));
  4142. var builder = new rave['library']['internal']['HierarchyUtility'](new (rave['internal']['Declare']([rave['library']['internal']['HUFactory']], {
  4143. _$functionClassMethod : function() {
  4144. var _$self = function() {
  4145. return {};
  4146. };
  4147. return _$self;
  4148. }
  4149. }))());
  4150. this._hierarchyData = builder.buildHierarchy(dataSet.data(), rave['library']['internal']['AbstractView'].accessorOf(dataSet.slot("children").entry()), rave['library']['internal']['AbstractView'].accessorOf(sizeDataSlotEntry), 0.0);
  4151. this._index = 0;
  4152. this.setIndex(this._hierarchyData._root["children"]);
  4153. this.currentDrillLevel = 0;
  4154. this.drillTargetNode = null;
  4155. this._breadcrumbData.length = 0;
  4156. if (this._hierarchyData._root["children"]) {
  4157. this._breadcrumbData.push(this.getBreadscrumLabel(this._hierarchyData._nodes[0]));
  4158. }
  4159. }
  4160. var colorField = this.getStringProperty("itemColor");
  4161. var colorSlot = "color" == colorField ? "color" : "label";
  4162. var colorDataAccessor = dataSet.slot(colorSlot).entry();
  4163. colorPalette.setNullColor((this.context.getPropertyValue("color.null")));
  4164. var legendVisibilityChanged = this._legends.anyVisible() != showLegend;
  4165. if (legendVisibilityChanged) {
  4166. this.updateType = 1;
  4167. }
  4168. this._legends.visible(showLegend).position(legendPosition).transition(doTransition, duration).setPreExecute(this.context.getPreExecute()).selector(0, this.context.node.selectAll("g.legend")).palette(0, colorPalette).shape(0, "square").title(0, this.context.getDataSlotLabel("legend.title", colorDataAccessor)).titleFill(0, (this.context.getPropertyValue("legend.titlestyle.fill"))).titleFontSize(0, (this.context.getPropertyValue("legend.titlestyle.fontsize"))).titleFontFamily(0, (this.context.getPropertyValue("legend.titlestyle.fontfamily"))).setDataSlot(0, colorDataAccessor);
  4169. var domain;
  4170. if (colorDataAccessor) {
  4171. domain = colorDataAccessor.domain();
  4172. if (!domain) {
  4173. var dataType = colorDataAccessor.type();
  4174. if ("numeric" == dataType) {
  4175. domain = rave['library']['internal']['ScaleManager'].ordinalDomainWithValueFunction(this._hierarchyData._nodes, "numeric", this.colorAccessor(colorField, colorDataAccessor, false), true);
  4176. } else {
  4177. domain = rave['library']['internal']['ScaleManager'].ordinalDomainWithValueFunction(this._hierarchyData._nodes, "string", this.colorAccessor(colorField, colorDataAccessor, false), false);
  4178. }
  4179. }
  4180. }
  4181. colorPalette.setData(domain, dataSet, colorSlot);
  4182. colorPalette.setAccessor(this.colorAccessor(colorField, colorDataAccessor, true));
  4183. if (this.updateType <= 1) {
  4184. this.prepareLayoutComponent();
  4185. this.prepareLayoutSizables(this._layoutComponent, false, false, false, false, this._legends.anyVisible());
  4186. this._legends.preLayout(this._layoutComponent);
  4187. this._layoutComponent.layout();
  4188. legendPosition = this._layoutComponent.legendPosition();
  4189. this._legends.position(legendPosition);
  4190. this.chartRect = this._layoutComponent.elementRect();
  4191. this.legendRect = this._layoutComponent.legendRect();
  4192. var showBreadCrumb = (this.context.getPropertyValue(com_ibm_rave_bundles_treemapBundle_TreemapView.SHOW_BREADCRUMB));
  4193. this.breadcrumbRect = new rave['internal']['RectStruct'](this.chartRect.x, this.chartRect.y, this.chartRect.width, 15);
  4194. if (showBreadCrumb) {
  4195. this.chartRect.y += this.breadcrumbRect.height + 16;
  4196. this.chartRect.height -= this.breadcrumbRect.height + 16;
  4197. this.context.node.select(".indicator").attr("visibility", "visible");
  4198. } else {
  4199. this.context.node.select(".indicator").attr("visibility", "hidden");
  4200. }
  4201. if (legendPosition == "left" || legendPosition == "right") {
  4202. this.legendRect.y = this.chartRect.y;
  4203. this.legendRect.height = this.chartRect.height;
  4204. }
  4205. this._legends.rectangle(this.legendRect);
  4206. }
  4207. this._clip.clipRect(this.chartRect).applyTo(this._chart.select(".content")).call(this.context.node.select("defs").transition().duration(duration));
  4208. var labelAccessor = rave['library']['internal']['AbstractView'].accessorOf(dataSet.slot("label").entry());
  4209. var key = rave['library']['internal']['AbstractView'].originalDatumAccessor(rave['library']['internal']['AbstractView'].accessorOf(dataSet.slot("key").entry()));
  4210. this._treemapComponent.key(key ? key : this.keyAccessor(labelAccessor)).bounds(this.chartRect).sort(this.getStringProperty("sort")).squareSizeBy(this.getStringProperty("sizeOrCount")).mode(this.getStringProperty("mode")).colorPalette(colorPalette).labelAccessor(this.labelAccessor(labelAccessor)).labelFormatter(this.context.getCustomFormatterForElementLabels(dataSet.slot("label").entry())).labelContrast(this.getBooleanProperty("contrast.label.color")).labelShadow(this.getBooleanProperty("label.shadow")).titleAccessor(this.titleAccessor(labelAccessor, rave['library']['internal']['AbstractView'].accessorOf(dataSet.slot("color").entry()))).treemapNodeAccessor(function(data) {
  4211. return (data)._hierarchyNode;
  4212. }).setPreExecute(this.context.getPreExecute()).sizeAccessor(rave['library']['internal']['AbstractView'].accessorOf(sizeDataSlotEntry)).borderWidth(this._borderWidth).borderColor((this.context.getPropertyValue("border.color"))).itemLabel(this.getBooleanProperty("labelDisplay")).itemLabelLevel(this.getIntProperty("itemLabel")).labelFont((this.context.getPropertyValue("labelstyle.font"))).leadLabel(this.getBooleanProperty("leadLabel.display"));
  4213. if (this.updateType <= 1) {
  4214. var treemap = this._treemapComponent.buildLayout();
  4215. this._mappedNodes = !this._hierarchyData._root["children"] ? null : treemap.create(this._hierarchyData._root).map(function(currentValue, index, array) {
  4216. var d = new com_ibm_rave_bundles_data_HierarchyBundleDatum();
  4217. d._hierarchyNode = currentValue;
  4218. return d;
  4219. });
  4220. }
  4221. var totalLevels = 0;
  4222. if (this._mappedNodes) {
  4223. for (var __i_enFor0 = 0, __exp_enFor0 = this._mappedNodes, __len_enFor0 = __exp_enFor0.length;
  4224. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4225. var o = __exp_enFor0[__i_enFor0];
  4226. totalLevels = Math.max(totalLevels, (o)._hierarchyNode["depth"]);
  4227. }
  4228. }
  4229. this._maxLevel = totalLevels;
  4230. var self = this;
  4231. var unhighlightAction = this.context.actions.action("unhighlight");
  4232. unhighlightAction.setBindFn(function() {
  4233. self.context.node.selectAll(".rect").on("mouseout.default", function(data, index, groupIndex, event) {
  4234. var attributes = self.getNodeStyle((data));
  4235. unhighlightAction(rave.select(this), attributes);
  4236. });
  4237. });
  4238. var deselectAllAction = this.context.actions.action("deselectAll");
  4239. this._borderWidth = ~~(rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(this.context.getPropertyValue("border.width"), 100.0, 10.0));
  4240. var deselectAllEventListener = function(data, index, groupIndex, event) {
  4241. self.context.node.selectAll(".rect").style("stroke-width", function(data, index, groupIndex) {
  4242. return ((self._maxLevel - (data)._hierarchyNode["depth"]) * 2 + self._borderWidth) + "px";
  4243. }).style("stroke", (self.context.getPropertyValue("border.color"))).style("opacity", 1.0).property("selected", null);
  4244. };
  4245. deselectAllAction.setBindFn(rave['library']['internal']['BundleUtils'].bindOrUnbindActionFunctionCreater(this.context, ".background", ["click.default", "touchstart.default"], deselectAllEventListener));
  4246. var labelLevel = this.getIntProperty("itemLabel");
  4247. if (labelLevel > this._maxLevel) {
  4248. labelLevel = this._maxLevel;
  4249. }
  4250. if (this.updateType >= 1 && this.drillTargetNode) {
  4251. labelLevel = Math.max(labelLevel, this.currentDrillLevel + 1);
  4252. }
  4253. if (this.updateType == 0 || labelLevel != this._previousLabelLevel) {
  4254. this._labelNodes = this.getLabelData(labelLevel);
  4255. }
  4256. this._previousLabelLevel = labelLevel;
  4257. this._treemapComponent.data(this._mappedNodes).labelData(this._labelNodes);
  4258. this._treemapComponent.itemLabelLevel(labelLevel);
  4259. this._breadcrumbComponent.setPreExecute(this.context.getPreExecute()).data(this._breadcrumbData).bounds(this.breadcrumbRect);
  4260. this.setBackgroundProperties(this.chartRect, duration);
  4261. if (this.updateType == 1 && this.drillTargetNode) {
  4262. this.drawDrilledTreemap();
  4263. } else {
  4264. this._chart.selectAll("g.element-group").transition().duration(duration).call(this._treemapComponent);
  4265. }
  4266. this.context.node.selectAll("g.breadcrumb").transition().duration(duration).call(this._breadcrumbComponent);
  4267. this._legends.draw();
  4268. this.resetUpdate();
  4269. this._chart.selectAll(".element-shape").classed("bundle-shape", true);
  4270. this._chart.selectAll(".legendShape").classed("bundle-shape", true);
  4271. },
  4272. setIndex : function(nodes) {
  4273. if (nodes) {
  4274. for (var __i_enFor0 = 0, __exp_enFor0 = nodes, __len_enFor0 = __exp_enFor0.length;
  4275. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4276. var n = __exp_enFor0[__i_enFor0];
  4277. var o = n;
  4278. o["_index"] = this._index++;
  4279. this.setIndex(o["children"]);
  4280. }
  4281. }
  4282. },
  4283. /**
  4284. * Returns a value function that gives the title (tooltip) of the object. This is a string built from the label accessor applied to the tree up to the root.
  4285. * @param (rave['internal']['SingleValueFunction']) labelAccessor Label accessor, may be null
  4286. * @return (rave['internal']['ValueFunction']) Value function, or null if the accessor is null
  4287. */
  4288. titleAccessor : function(labelAccessor, colorAccessor) {
  4289. if (!labelAccessor) {
  4290. return null;
  4291. }
  4292. return function(data, index, groupIndex) {
  4293. var d = (data)._hierarchyNode;
  4294. var title = "size : " + d["value"];
  4295. var color = (colorAccessor(d["data"]));
  4296. if (color != null) {
  4297. title = title + "\ncolor : " + color;
  4298. }
  4299. while (d["parent"]) {
  4300. var label = (labelAccessor(d["data"]));
  4301. if (label == null) {
  4302. label = "(no label)";
  4303. }
  4304. title = label + "\n" + title;
  4305. d = d["parent"];
  4306. }
  4307. return title;
  4308. };
  4309. },
  4310. keyAccessor : function(labelAccessor) {
  4311. if (!labelAccessor) {
  4312. return null;
  4313. }
  4314. return function(data) {
  4315. var d = (data)._hierarchyNode;
  4316. var key = "";
  4317. while (d["parent"]) {
  4318. var label = (labelAccessor(d["data"]));
  4319. if (label != null) {
  4320. key += label;
  4321. }
  4322. d = d["parent"];
  4323. }
  4324. return key;
  4325. };
  4326. },
  4327. /**
  4328. * Returns a value function that gives the label for a tree node, with special rules to handle the label level.
  4329. * @param labelLevel Label level property
  4330. * @param (rave['internal']['SingleValueFunction']) labelAccessor Label accessor, may be null
  4331. * @return (rave['internal']['ValueFunction']) Value function, or null if the accessor is null
  4332. */
  4333. labelAccessor : function(labelAccessor) {
  4334. if (!labelAccessor) {
  4335. return null;
  4336. }
  4337. return function(data, index, groupIndex) {
  4338. var d = (data)._hierarchyNode;
  4339. return labelAccessor(d["data"]);
  4340. };
  4341. },
  4342. getLabelData : function(labelLevel) {
  4343. if (this._mappedNodes) {
  4344. var result = [];
  4345. for (var __i_enFor0 = 0, __exp_enFor0 = this._mappedNodes, __len_enFor0 = __exp_enFor0.length;
  4346. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4347. var o = __exp_enFor0[__i_enFor0];
  4348. var d = (o)._hierarchyNode;
  4349. if (d["data"] != null && (d["depth"] == labelLevel || (d["depth"] < labelLevel && !d["children"]) || (this.getBooleanProperty("leadLabel.display") && (d["depth"] == 1 || (d["depth"] == labelLevel - 1 && labelLevel > 1)))) && !(this.outsideBounds(d))) {
  4350. result.push(o);
  4351. }
  4352. }
  4353. return result;
  4354. }
  4355. return null;
  4356. },
  4357. outsideBounds : function(node) {
  4358. var precision = 1;
  4359. var vertex = node["x"] + this.chartRect.x < -precision || node["x"] > this.chartRect.width + precision || node["y"] + this.chartRect.y < -precision || node["y"] > this.chartRect.height + precision;
  4360. if (vertex) {
  4361. return true;
  4362. }
  4363. return node["x"] + this.chartRect.x + node["dx"] < -precision || node["x"] + node["dx"] > this.chartRect.width + precision || node["y"] + this.chartRect.y + node["dy"] < -precision || node["y"] + node["dy"] > this.chartRect.height + precision;
  4364. },
  4365. /**
  4366. * Returns a value function that uses the color accessor on the datum of the tree node, with special rules to handle the color slot.
  4367. * @param (String) colorSlot Color slot property
  4368. * @param (rave['internal']['SingleValueFunction']) colorAccessor Color data accessor, may be null
  4369. * @param (boolean) sortedData if data is sorted
  4370. * @return (rave['internal']['SingleValueFunction']) Value function, or null if the accessor is null
  4371. */
  4372. colorAccessor : function(colorSlot, colorAccessor, sortedData) {
  4373. if (!colorAccessor) {
  4374. return null;
  4375. }
  4376. if (!("color" == colorSlot)) {
  4377. var level = parseInt(colorSlot.substring(5));
  4378. return new (rave['internal']['Declare']({
  4379. _$functionClassMethod : function() {
  4380. var _$self = function(data) {
  4381. var d = sortedData ? (data)._hierarchyNode : data;
  4382. if (d["data"] == null) {
  4383. return null;
  4384. }
  4385. if (d["depth"] == level || (d["depth"] < level && !d["children"])) {
  4386. return colorAccessor(d["data"]);
  4387. }
  4388. if (d["depth"] > level) {
  4389. var p = _$self.findParent(d, level);
  4390. return colorAccessor(p["data"]);
  4391. }
  4392. return null;
  4393. };
  4394. return _$self;
  4395. },
  4396. findParent : function(d, level) {
  4397. if (d["depth"] == level) {
  4398. return d;
  4399. }
  4400. return this.findParent(d["parent"], level);
  4401. }
  4402. }))();
  4403. }
  4404. return function(data) {
  4405. var d = sortedData ? (data)._hierarchyNode : data;
  4406. return (d["data"] != null && !d["children"]) ? colorAccessor(d["data"]) : null;
  4407. };
  4408. },
  4409. /** @expose */
  4410. requireUpdate : function(property) {
  4411. if ((property == "itemLabel" || property == "leadLabel.display") && !(this.getBooleanProperty("labelDisplay"))) {
  4412. return 4;
  4413. }
  4414. return rave['library']['internal']['AbstractView'].prototype.requireUpdate.call(this, property);
  4415. },
  4416. getNodeStyle : function(data) {
  4417. var borderColor = (this.context.getPropertyValue("border.color"));
  4418. var width = ((this._maxLevel - (data)._hierarchyNode["depth"]) * 2 + this._borderWidth) + "px";
  4419. var attributes = {};
  4420. attributes["stroke-width"] = width;
  4421. attributes["stroke"] = borderColor;
  4422. return attributes;
  4423. },
  4424. /** @expose */
  4425. getGroupStructure : function() {
  4426. return ["defs", "g.vizlibrary vizlibrary-treemap", "(", "rect.background chart", "g.breadcrumb", "g.chart", "(", "g.content", "(", "rect.background elements", "g.elements", "(", "g.element-group", ")", ")", ")", "g.legends", "(", "g.legends-layout", "g.legend", ")", ")"];
  4427. }
  4428. });
  4429. com_ibm_rave_bundles_treemapBundle_TreemapView.SHOW_BREADCRUMB = "breadcrumbDisplay";
  4430. //com_ibm_rave_bundles_treemapBundle_TreemapView.DATASET_DATA = "data";
  4431. //com_ibm_rave_bundles_treemapBundle_TreemapView.DATASLOT_SIZE = "size";
  4432. //com_ibm_rave_bundles_treemapBundle_TreemapView.DATASLOT_COLOR = "color";
  4433. //com_ibm_rave_bundles_treemapBundle_TreemapView.DATASLOT_LABEL = "label";
  4434. //com_ibm_rave_bundles_treemapBundle_TreemapView.DATASLOT_CHILDREN = "children";
  4435. //com_ibm_rave_bundles_treemapBundle_TreemapView.DATASLOT_KEY = "key";
  4436. //com_ibm_rave_bundles_treemapBundle_TreemapView.ITEM_LABEL_PROPERTY_ID = "itemLabel";
  4437. //com_ibm_rave_bundles_treemapBundle_TreemapView.LEAD_LABEL_DISPLAY = "leadLabel.display";
  4438. //com_ibm_rave_bundles_treemapBundle_TreemapView.LABELSTYLE_FONT = "labelstyle.font";
  4439. //com_ibm_rave_bundles_treemapBundle_TreemapView.SIZE_OR_COUNT_PROPERTY_ID = "sizeOrCount";
  4440. //com_ibm_rave_bundles_treemapBundle_TreemapView.MODE_ID = "mode";
  4441. //com_ibm_rave_bundles_treemapBundle_TreemapView.ITEM_COLOR_ID = "itemColor";
  4442. com_ibm_rave_bundles_treemapBundle_TreemapView.COLOR = "color";
  4443. // $source: com/ibm/rave/bundles/components/BackgroundComponentImpl
  4444. /************************************************************************
  4445. ** IBM Confidential
  4446. **
  4447. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4448. **
  4449. ** (C) Copyright IBM Corp. 2017
  4450. **
  4451. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4452. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4453. ************************************************************************/
  4454. // GENERATED
  4455. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  4456. //@import com/ibm/rave/bundles/component/BackgroundComponent (runtime) // BackgroundComponent
  4457. /**
  4458. * <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>
  4459. */
  4460. var com_ibm_rave_bundles_components_BackgroundComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  4461. //_backgroundColor : null,
  4462. //_rect : null,
  4463. /** @expose */
  4464. constructor : function() {
  4465. this._rect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4466. },
  4467. /** @expose */
  4468. execute : function(g) {
  4469. this.preExecute();
  4470. g.style("fill", this._backgroundColor != null ? this._backgroundColor : "#FFFFFF").style("fill-opacity", 1.0);
  4471. g.attr("x", this._rect.x).attr("y", this._rect.y).attr("width", this._rect.width).attr("height", this._rect.height);
  4472. },
  4473. /** @expose */
  4474. type : function() {
  4475. return com_ibm_rave_bundles_component_BackgroundComponent.COMPONENT_TYPE;
  4476. },
  4477. backgroundColor$0 : function() {
  4478. return this._backgroundColor;
  4479. },
  4480. backgroundColor$1 : function(backgroundColor) {
  4481. this._backgroundColor = backgroundColor;
  4482. return this;
  4483. },
  4484. /**
  4485. * @param (rave['library']['internal']['ContextSize']) size New value of size property
  4486. * @return (com.ibm.rave.bundles.components.BackgroundComponentImpl) This component
  4487. */
  4488. /** @expose */
  4489. size : function(size) {
  4490. this._rect.x = 0;
  4491. this._rect.y = 0;
  4492. this._rect.width = size.w;
  4493. this._rect.height = size.h;
  4494. return this;
  4495. },
  4496. /** @expose */
  4497. rect : function(rect) {
  4498. var r = new rave['internal']['RectStruct'](rect.x, rect.y, rect.width, rect.height);
  4499. this._rect = r;
  4500. return this;
  4501. },
  4502. /** @expose */
  4503. backgroundColor : function(a0) {
  4504. var args = arguments;
  4505. if (args.length == 0) {
  4506. return this.backgroundColor$0();
  4507. }
  4508. return this.backgroundColor$1(a0);
  4509. }
  4510. });
  4511. // $source: com/ibm/rave/bundles/components/ChartLayoutComponentImpl
  4512. /************************************************************************
  4513. ** IBM Confidential
  4514. **
  4515. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4516. **
  4517. ** (C) Copyright IBM Corp. 2017
  4518. **
  4519. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4520. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4521. ************************************************************************/
  4522. // GENERATED
  4523. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  4524. //@import com/ibm/rave/bundles/component/ChartLayoutComponent (runtime) // ChartLayoutComponent
  4525. /**
  4526. * <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>
  4527. */
  4528. var com_ibm_rave_bundles_components_ChartLayoutComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  4529. //_padding : null,
  4530. //_legendChartGap : null,
  4531. //_topChartPadding : null,
  4532. //_leftChartPadding : null,
  4533. //_bottomChartPadding : null,
  4534. //_rightChartPadding : null,
  4535. //_legendPosition : null,
  4536. //_legendSizable : null,
  4537. //_axisSizables : null,
  4538. //_overallRect : null,
  4539. //_legendRect : null,
  4540. //_chartRect : null,
  4541. //_topRect : null,
  4542. //_leftRect : null,
  4543. //_bottomRect : null,
  4544. //_rightRect : null,
  4545. //_elementRect : null,
  4546. _leftPadding : 0, _topPadding : 0, _rightPadding : 0, _bottomPadding : 0,
  4547. _legendChartAlign : false,
  4548. _preLegendAtMax : false,
  4549. _preAxesAtZero : false,
  4550. constructor : function() {
  4551. this._axisSizables = [];
  4552. /**
  4553. * Construct. All padding is 0, legendPosition is "right", all slices have a size of 0 (value of null).
  4554. */
  4555. {
  4556. this._padding = 0.0;
  4557. this._topPadding = 0;
  4558. this._leftPadding = 0;
  4559. this._bottomPadding = 0;
  4560. this._rightPadding = 0;
  4561. this._topChartPadding = 0.0;
  4562. this._leftChartPadding = 0.0;
  4563. this._bottomChartPadding = 0.0;
  4564. this._rightChartPadding = 0.0;
  4565. this._legendChartGap = 0.0;
  4566. this._legendPosition = "right";
  4567. this._overallRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4568. this._legendRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4569. this._chartRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4570. this._topRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4571. this._leftRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4572. this._bottomRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4573. this._rightRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4574. this._elementRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4575. this._legendChartAlign = true;
  4576. }
  4577. },
  4578. /** @expose */
  4579. execute : function(g) {
  4580. this.layout();
  4581. },
  4582. /**
  4583. * Calculates rectangles during preliminary layout
  4584. * @param (boolean) legendAtMax true if legend is given max size; false if legend is asked for its preferred size
  4585. * @param (boolean) axesAtZero true if axes are given a size of 0; false if axes are asked for their preferred size
  4586. */
  4587. /** @expose */
  4588. preLayout : function(legendAtMax, axesAtZero) {
  4589. this._preLegendAtMax = legendAtMax;
  4590. this._preAxesAtZero = axesAtZero;
  4591. this.layout();
  4592. this._preLegendAtMax = false;
  4593. this._preAxesAtZero = false;
  4594. },
  4595. /**
  4596. * Calls preExecute, then does the layout with the property values, updating the chart, legend, axis, and elements rectangles.
  4597. */
  4598. /** @expose */
  4599. layout : function() {
  4600. this.preExecute();
  4601. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._chartRect, this._overallRect);
  4602. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._legendRect, this._overallRect);
  4603. var x = this._overallRect.x;
  4604. var y = this._overallRect.y;
  4605. var w = this._overallRect.width;
  4606. var h = this._overallRect.height;
  4607. var maxWH = Math.max(w, h);
  4608. var tbLegend = "top" == this._legendPosition || "bottom" == this._legendPosition;
  4609. var legendPercent = this._axisSizables.length == 0 ? 0.5 : 0.3;
  4610. var legendMaxSize = (tbLegend ? this._legendRect.height : this._legendRect.width) * legendPercent;
  4611. var legendDynamicSize = this._legendSizable ? (this._preLegendAtMax ? maxWH : this._legendSizable.getPreferredSize()) : 0;
  4612. if (legendDynamicSize > legendMaxSize) {
  4613. legendDynamicSize = legendMaxSize;
  4614. }
  4615. var isLegendTop = false;
  4616. var isLegendBottom = false;
  4617. var isLegendLeft = false;
  4618. var isLegendRight = false;
  4619. if ("top" == this._legendPosition) {
  4620. this._legendRect.height = legendDynamicSize;
  4621. this._chartRect.height -= this._legendRect.height;
  4622. this._chartRect.y += this._legendRect.height;
  4623. isLegendTop = true;
  4624. } else if ("bottom" == this._legendPosition) {
  4625. this._legendRect.height = legendDynamicSize;
  4626. this._chartRect.height -= this._legendRect.height;
  4627. this._legendRect.y = y + h - this._legendRect.height;
  4628. isLegendBottom = true;
  4629. } else if ("left" == this._legendPosition) {
  4630. this._legendRect.width = legendDynamicSize;
  4631. this._chartRect.width -= this._legendRect.width;
  4632. this._chartRect.x += this._legendRect.width;
  4633. isLegendLeft = true;
  4634. } else {
  4635. this._legendRect.width = legendDynamicSize;
  4636. this._chartRect.width -= this._legendRect.width;
  4637. this._legendRect.x = x + w - this._legendRect.width;
  4638. isLegendRight = true;
  4639. }
  4640. if (this.evaluatePadding(this._padding, w, h)) {
  4641. var lrgap = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._legendChartGap, w);
  4642. var tbgap = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._legendChartGap, h);
  4643. var chartTop = isLegendTop && this._legendSizable ? tbgap : this._topPadding;
  4644. var chartLeft = isLegendLeft && this._legendSizable ? lrgap : this._leftPadding;
  4645. var chartBottom = isLegendBottom && this._legendSizable ? tbgap : this._bottomPadding;
  4646. var chartRight = isLegendRight && this._legendSizable ? lrgap : this._rightPadding;
  4647. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset(this._chartRect, chartTop, chartLeft, chartBottom, chartRight);
  4648. } else {
  4649. var lrpadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._padding, w);
  4650. var tbpadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._padding, h);
  4651. var chartTop = tbpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._topChartPadding, h);
  4652. var chartLeft = lrpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._leftChartPadding, w);
  4653. var chartBottom = tbpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._bottomChartPadding, h);
  4654. var chartRight = lrpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._rightChartPadding, w);
  4655. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset(this._chartRect, chartTop, chartLeft, chartBottom, chartRight);
  4656. this._topPadding = tbpadding;
  4657. this._leftPadding = lrpadding;
  4658. this._bottomPadding = tbpadding;
  4659. this._rightPadding = lrpadding;
  4660. }
  4661. if (this._legendSizable) {
  4662. if (isLegendRight) {
  4663. this._legendRect.x -= this._rightPadding;
  4664. this._chartRect.width -= this._rightPadding;
  4665. this._legendRect.y += this._topPadding;
  4666. this._legendRect.height -= (this._topPadding + this._bottomPadding);
  4667. } else if (isLegendLeft) {
  4668. this._legendRect.x += this._leftPadding;
  4669. this._chartRect.x += this._leftPadding;
  4670. this._chartRect.width -= this._leftPadding;
  4671. this._legendRect.y += this._topPadding;
  4672. this._legendRect.height -= (this._topPadding + this._bottomPadding);
  4673. } else if (isLegendTop) {
  4674. this._legendRect.y += this._topPadding;
  4675. this._chartRect.y += this._topPadding;
  4676. this._chartRect.height -= this._topPadding;
  4677. this._legendRect.x += this._leftPadding;
  4678. this._legendRect.width -= (this._leftPadding + this._rightPadding);
  4679. } else {
  4680. this._legendRect.y -= this._bottomPadding;
  4681. this._chartRect.height -= this._bottomPadding;
  4682. this._legendRect.x += this._leftPadding;
  4683. this._legendRect.width -= (this._leftPadding + this._rightPadding);
  4684. }
  4685. }
  4686. x = this._chartRect.x;
  4687. y = this._chartRect.y;
  4688. w = this._chartRect.width;
  4689. h = this._chartRect.height;
  4690. var bottomH = 0;
  4691. var topH = 0;
  4692. var leftW = 0;
  4693. var rightW = 0;
  4694. var tbSO = 0;
  4695. var lrSO = 0;
  4696. if (!this._preAxesAtZero) {
  4697. var countHorz = 0;
  4698. var countVert = 0;
  4699. for (var i = 0; i < this._axisSizables.length; ++i) {
  4700. var sizable = this._axisSizables[i];
  4701. if (sizable) {
  4702. var orientation = sizable.getSizableOrientation();
  4703. if ("top" == orientation || "bottom" == orientation) {
  4704. countHorz++;
  4705. } else {
  4706. countVert++;
  4707. }
  4708. }
  4709. }
  4710. for (var i = 0; i < this._axisSizables.length; ++i) {
  4711. var sizable = this._axisSizables[i];
  4712. if (sizable) {
  4713. var orientation = sizable.getSizableOrientation();
  4714. var tbAxis = "top" == orientation || "bottom" == orientation;
  4715. var axisDynamicSize = sizable.getPreferredSize();
  4716. var spillOver = sizable.getSpillOverSize();
  4717. if (tbAxis) {
  4718. var axisPercent = countHorz > 1 ? 0.4 : 0.5;
  4719. if (axisDynamicSize > this._chartRect.height * axisPercent) {
  4720. axisDynamicSize = this._chartRect.height * axisPercent;
  4721. }
  4722. if ("top" == orientation) {
  4723. topH = axisDynamicSize;
  4724. } else {
  4725. bottomH = axisDynamicSize;
  4726. }
  4727. if (spillOver > lrSO) {
  4728. lrSO = spillOver;
  4729. }
  4730. } else {
  4731. var axisPercent = countVert > 1 ? 0.4 : 0.5;
  4732. if (axisDynamicSize > this._chartRect.width * axisPercent) {
  4733. axisDynamicSize = this._chartRect.width * axisPercent;
  4734. }
  4735. if ("left" == orientation) {
  4736. leftW = axisDynamicSize;
  4737. } else {
  4738. rightW = axisDynamicSize;
  4739. }
  4740. if (spillOver > tbSO) {
  4741. tbSO = spillOver;
  4742. }
  4743. }
  4744. }
  4745. }
  4746. }
  4747. if (lrSO > leftW) {
  4748. leftW = lrSO;
  4749. }
  4750. if (lrSO > rightW) {
  4751. rightW = lrSO;
  4752. }
  4753. if (tbSO > topH) {
  4754. topH = tbSO;
  4755. }
  4756. if (tbSO > bottomH) {
  4757. bottomH = tbSO;
  4758. }
  4759. this._leftRect.x = x;
  4760. this._leftRect.width = leftW;
  4761. this._leftRect.y = y;
  4762. this._leftRect.height = h;
  4763. this._rightRect.x = x + w - rightW;
  4764. this._rightRect.width = rightW;
  4765. this._rightRect.y = y;
  4766. this._rightRect.height = h;
  4767. this._topRect.y = y;
  4768. this._topRect.height = topH;
  4769. this._topRect.x = x;
  4770. this._topRect.width = w;
  4771. this._bottomRect.y = y + h - bottomH;
  4772. this._bottomRect.height = bottomH;
  4773. this._bottomRect.x = x;
  4774. this._bottomRect.width = w;
  4775. this._elementRect.x = x + leftW;
  4776. this._elementRect.y = y + topH;
  4777. this._elementRect.width = w - (leftW + rightW);
  4778. this._elementRect.height = h - (topH + bottomH);
  4779. if (this._legendSizable && this._legendChartAlign) {
  4780. if (tbLegend) {
  4781. this._legendRect.x = this._elementRect.x;
  4782. this._legendRect.width = this._elementRect.width;
  4783. } else {
  4784. this._legendRect.y = this._elementRect.y;
  4785. this._legendRect.height = this._elementRect.height;
  4786. }
  4787. }
  4788. },
  4789. evaluatePadding : function(padding, horizontalExtent, verticalExtent) {
  4790. if (padding == null) {
  4791. return false;
  4792. }
  4793. var paddingString = (padding) + "";
  4794. if (paddingString.length == 0) {
  4795. return false;
  4796. }
  4797. this._topPadding = 0;
  4798. this._leftPadding = 0;
  4799. this._bottomPadding = 0;
  4800. this._rightPadding = 0;
  4801. var items = paddingString.split(new RegExp(";"));
  4802. for (var __i_enFor0 = 0, __len_enFor0 = items.length;
  4803. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4804. var item = items[__i_enFor0];
  4805. var parts = item.split(new RegExp(":"));
  4806. if (items.length == 1 && parts.length != 2) {
  4807. return false;
  4808. }
  4809. if (parts.length == 2) {
  4810. if (0 <= parts[0].indexOf("top")) {
  4811. this._topPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], verticalExtent);
  4812. } else if (0 <= parts[0].indexOf("left")) {
  4813. this._leftPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], horizontalExtent);
  4814. } else if (0 <= parts[0].indexOf("bottom")) {
  4815. this._bottomPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], verticalExtent);
  4816. } else if (0 <= parts[0].indexOf("right")) {
  4817. this._rightPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], horizontalExtent);
  4818. }
  4819. }
  4820. }
  4821. return true;
  4822. },
  4823. /**
  4824. * @return (rave['internal']['RectStruct']) Legend rectangle
  4825. */
  4826. /** @expose */
  4827. legendRect : function() {
  4828. return this._legendRect;
  4829. },
  4830. /**
  4831. * @return (rave['internal']['RectStruct']) Chart (elements plus axes) rectangle
  4832. */
  4833. /** @expose */
  4834. chartRect : function() {
  4835. return this._chartRect;
  4836. },
  4837. /**
  4838. * @return (rave['internal']['RectStruct']) Top axis rectangle
  4839. */
  4840. /** @expose */
  4841. topRect : function() {
  4842. return this._topRect;
  4843. },
  4844. /**
  4845. * @return (rave['internal']['RectStruct']) Left axis rectangle
  4846. */
  4847. /** @expose */
  4848. leftRect : function() {
  4849. return this._leftRect;
  4850. },
  4851. /**
  4852. * @return (rave['internal']['RectStruct']) Bottom axis rectangle
  4853. */
  4854. /** @expose */
  4855. bottomRect : function() {
  4856. return this._bottomRect;
  4857. },
  4858. /**
  4859. * @return (rave['internal']['RectStruct']) Right axis rectangle
  4860. */
  4861. /** @expose */
  4862. rightRect : function() {
  4863. return this._rightRect;
  4864. },
  4865. /**
  4866. * @return (rave['internal']['RectStruct']) Legend rectangle
  4867. */
  4868. /** @expose */
  4869. elementRect : function() {
  4870. return this._elementRect;
  4871. },
  4872. /**
  4873. * Set the overall rectangle. This should be called before doing the layout.
  4874. * @param (rave['internal']['RectStruct']) overall The overall rectangle
  4875. */
  4876. /** @expose */
  4877. overall : function(overall) {
  4878. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._overallRect, overall);
  4879. return this;
  4880. },
  4881. padding$0 : function() {
  4882. return this._padding;
  4883. },
  4884. legendChartAlign$0 : function() {
  4885. return this._legendChartAlign;
  4886. },
  4887. legendChartGap$0 : function() {
  4888. return this._legendChartGap;
  4889. },
  4890. topPadding$0 : function() {
  4891. return this._topChartPadding;
  4892. },
  4893. leftPadding$0 : function() {
  4894. return this._leftChartPadding;
  4895. },
  4896. bottomPadding$0 : function() {
  4897. return this._bottomChartPadding;
  4898. },
  4899. rightPadding$0 : function() {
  4900. return this._rightChartPadding;
  4901. },
  4902. legendPosition$0 : function() {
  4903. return this._legendPosition;
  4904. },
  4905. topPadding$1 : function(padding) {
  4906. this._topChartPadding = padding;
  4907. return this;
  4908. },
  4909. leftPadding$1 : function(padding) {
  4910. this._leftChartPadding = padding;
  4911. return this;
  4912. },
  4913. bottomPadding$1 : function(padding) {
  4914. this._bottomChartPadding = padding;
  4915. return this;
  4916. },
  4917. rightPadding$1 : function(padding) {
  4918. this._rightChartPadding = padding;
  4919. return this;
  4920. },
  4921. /** @expose */
  4922. type : function() {
  4923. return com_ibm_rave_bundles_component_ChartLayoutComponent.COMPONENT_TYPE;
  4924. },
  4925. padding$1 : function(value) {
  4926. this._padding = value;
  4927. return this;
  4928. },
  4929. /** @expose */
  4930. chartPadding : function(top, left, bottom, right) {
  4931. this._topChartPadding = top;
  4932. this._leftChartPadding = left;
  4933. this._bottomChartPadding = bottom;
  4934. this._rightChartPadding = right;
  4935. return this;
  4936. },
  4937. legendChartAlign$1 : function(legendChartAlign) {
  4938. this._legendChartAlign = legendChartAlign;
  4939. return this;
  4940. },
  4941. legendChartGap$1 : function(value) {
  4942. this._legendChartGap = value;
  4943. return this;
  4944. },
  4945. legendPosition$1 : function(position) {
  4946. if ("top" == position || "bottom" == position || "left" == position || "right" == position) {
  4947. this._legendPosition = position;
  4948. }
  4949. return this;
  4950. },
  4951. /** @expose */
  4952. legendSize : function(sizable) {
  4953. this._legendSizable = sizable;
  4954. return this;
  4955. },
  4956. /** @expose */
  4957. removeAxisSizables : function() {
  4958. this._axisSizables.length = 0;
  4959. return this;
  4960. },
  4961. /** @expose */
  4962. addAxisSizable : function(sizable) {
  4963. this._axisSizables.push(sizable);
  4964. return this;
  4965. },
  4966. /** @expose */
  4967. padding : function(a0) {
  4968. var args = arguments;
  4969. if (args.length == 0) {
  4970. return this.padding$0();
  4971. }
  4972. return this.padding$1(a0);
  4973. },
  4974. /** @expose */
  4975. legendChartAlign : function(a0) {
  4976. var args = arguments;
  4977. if (args.length == 0) {
  4978. return this.legendChartAlign$0();
  4979. }
  4980. return this.legendChartAlign$1(a0);
  4981. },
  4982. /** @expose */
  4983. legendChartGap : function(a0) {
  4984. var args = arguments;
  4985. if (args.length == 0) {
  4986. return this.legendChartGap$0();
  4987. }
  4988. return this.legendChartGap$1(a0);
  4989. },
  4990. /** @expose */
  4991. topPadding : function(a0) {
  4992. var args = arguments;
  4993. if (args.length == 0) {
  4994. return this.topPadding$0();
  4995. }
  4996. return this.topPadding$1(a0);
  4997. },
  4998. /** @expose */
  4999. leftPadding : function(a0) {
  5000. var args = arguments;
  5001. if (args.length == 0) {
  5002. return this.leftPadding$0();
  5003. }
  5004. return this.leftPadding$1(a0);
  5005. },
  5006. /** @expose */
  5007. bottomPadding : function(a0) {
  5008. var args = arguments;
  5009. if (args.length == 0) {
  5010. return this.bottomPadding$0();
  5011. }
  5012. return this.bottomPadding$1(a0);
  5013. },
  5014. /** @expose */
  5015. rightPadding : function(a0) {
  5016. var args = arguments;
  5017. if (args.length == 0) {
  5018. return this.rightPadding$0();
  5019. }
  5020. return this.rightPadding$1(a0);
  5021. },
  5022. /** @expose */
  5023. legendPosition : function(a0) {
  5024. var args = arguments;
  5025. if (args.length == 0) {
  5026. return this.legendPosition$0();
  5027. }
  5028. return this.legendPosition$1(a0);
  5029. }
  5030. });
  5031. /**
  5032. * Set preferred rectangle to the same position and size as the source rectangle.
  5033. * @param (rave['internal']['RectStruct']) t preferred rectangle
  5034. * @param (rave['internal']['RectStruct']) s Source rectangle
  5035. * @return (rave['internal']['RectStruct']) preferred rectangle
  5036. */
  5037. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect = function(t, s) {
  5038. t.x = s.x;
  5039. t.y = s.y;
  5040. t.width = s.width;
  5041. t.height = s.height;
  5042. return t;
  5043. };
  5044. /**
  5045. * 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.
  5046. * @param (rave['internal']['RectStruct']) r Rectangle
  5047. * @param (double) top Top inset in pixels
  5048. * @param (double) left Left inset in pixels
  5049. * @param (double) bottom Bottom inset in pixels
  5050. * @param (double) right Right inset in pixels
  5051. * @return (rave['internal']['RectStruct']) The rectangle
  5052. */
  5053. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset = function(r, top, left, bottom, right) {
  5054. var ileft = Math.max(0.0, left);
  5055. var iright = Math.max(0.0, right);
  5056. if (ileft + iright <= r.width) {
  5057. r.x += ileft;
  5058. r.width -= ileft + iright;
  5059. }
  5060. var itop = Math.max(0.0, top);
  5061. var ibottom = Math.max(0.0, bottom);
  5062. if (itop + ibottom <= r.height) {
  5063. r.y += itop;
  5064. r.height -= itop + ibottom;
  5065. }
  5066. return r;
  5067. };
  5068. /**
  5069. * 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.
  5070. * @param (Object) value The size
  5071. * @param (double) extent The extent in the dimension
  5072. * @param defValue The default to use if not parsable
  5073. * @return (double) Size in pixels
  5074. */
  5075. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize = function(value, extent) {
  5076. var v = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(value, extent, 10.0);
  5077. var d = v != null ? v : 0;
  5078. return Math.max(0.0, Math.min(d, extent));
  5079. };
  5080. /** @expose */
  5081. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_AXIS_PERCENT = 0.4;
  5082. /** @expose */
  5083. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_AXIS_PERCENT_SINGLE_PER_ORIENTATION = 0.5;
  5084. /** @expose */
  5085. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_LEGEND_PERCENT = 0.3;
  5086. /** @expose */
  5087. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_LEGEND_PERCENT_NO_AXIS = 0.5;
  5088. // $source: com/ibm/rave/bundles/components/ClipPathComponentImpl
  5089. /************************************************************************
  5090. ** IBM Confidential
  5091. **
  5092. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5093. **
  5094. ** (C) Copyright IBM Corp. 2017
  5095. **
  5096. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5097. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5098. ************************************************************************/
  5099. // GENERATED
  5100. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5101. /**
  5102. * 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>
  5103. */
  5104. var com_ibm_rave_bundles_components_ClipPathComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5105. //_id : null,
  5106. //_clipRect : null,
  5107. constructor : function(id) {
  5108. this._clipRect = new rave['internal']['RectStruct'](0, 0, 100, 100);
  5109. /**
  5110. * 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.
  5111. * @param (String) id String ID that is unique <em>across the document</em>.
  5112. */
  5113. {
  5114. this._id = id;
  5115. }
  5116. },
  5117. /** @expose */
  5118. type : function() {
  5119. return "ClipPathComponent";
  5120. },
  5121. /**
  5122. * Set the rectangular clipping area. Make the _clipRect one pixel larger than requested to avoid the cut-off at bounds. TODO: why?!?
  5123. * @param (rave['internal']['RectStruct']) rect The rectangular bounds of the clipping area.
  5124. * @return (com.ibm.rave.bundles.components.ClipPathComponentImpl) This ClipPathComponent.
  5125. */
  5126. /** @expose */
  5127. clipRect : function(rect) {
  5128. this._clipRect = new rave['internal']['RectStruct'](rect.x - 1, rect.y - 1, rect.width + 2, rect.height + 2);
  5129. return this;
  5130. },
  5131. /**
  5132. * Set the clip-path attribute on the provided selection.
  5133. * @return (com.ibm.rave.bundles.components.ClipPathComponentImpl) This ClipPathComponent.
  5134. */
  5135. /** @expose */
  5136. applyTo : function(s) {
  5137. s.attr("clip-path", "url(" + this.url() + ")");
  5138. return this;
  5139. },
  5140. /**
  5141. * Retrieve the id assigned to this clip path.
  5142. */
  5143. /** @expose */
  5144. id : function() {
  5145. return this._id;
  5146. },
  5147. /**
  5148. * Retrieve the URL that can be used to reference this clip path.
  5149. */
  5150. /** @expose */
  5151. url : function() {
  5152. return "#" + this._id;
  5153. },
  5154. /** @expose */
  5155. execute : function(g) {
  5156. var clipPath = g.selectAll("#" + this._id).data([0]);
  5157. clipPath.enter().append("clipPath").attr("id", this._id).append("rect");
  5158. 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);
  5159. }
  5160. });
  5161. // $source: com/ibm/rave/bundles/components/LegendComponentImpl
  5162. /************************************************************************
  5163. ** IBM Confidential
  5164. **
  5165. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5166. **
  5167. ** (C) Copyright IBM Corp. 2017
  5168. **
  5169. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5170. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5171. ************************************************************************/
  5172. // GENERATED
  5173. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5174. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  5175. /**
  5176. * <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>
  5177. */
  5178. var com_ibm_rave_bundles_components_LegendComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5179. /**
  5180. * Legend size property
  5181. */
  5182. //_size : null,
  5183. /**
  5184. * Color scale
  5185. */
  5186. //_colorPalette : null,
  5187. /**
  5188. * Orient, "horizontal" or "vertical"
  5189. */
  5190. //_orient : null,
  5191. /**
  5192. * Swatch size function
  5193. */
  5194. //_swatchSizeFunc : null,
  5195. /**
  5196. * Scale
  5197. */
  5198. //_scale : null,
  5199. /**
  5200. * Swatch symbol
  5201. */
  5202. //_shape : null,
  5203. /**
  5204. * Legend title
  5205. */
  5206. //_title : null,
  5207. /**
  5208. * Legend title styling
  5209. */
  5210. //_titleStyle : null,
  5211. /**
  5212. * Legend entry styling
  5213. */
  5214. //_entryStyle : null,
  5215. /**
  5216. * Custom formatter
  5217. */
  5218. //_labelFormat : null,
  5219. /**
  5220. * The swatch legend, created on demand
  5221. */
  5222. //_swatchLegend : null,
  5223. /**
  5224. * The continuous legend, created on demand
  5225. */
  5226. //_continuousLegend : null,
  5227. /**
  5228. * The legend type, either "SwatchLegend" or "ContinuousLegend"
  5229. */
  5230. //_legendType : null,
  5231. /**
  5232. * Is the legend visible
  5233. */
  5234. _visible : false,
  5235. /**
  5236. * Swatch size in square pixels
  5237. */
  5238. _swatchSize : 0,
  5239. /**
  5240. * Constructor; sets bound and, colorScale to null, all other properties to their default values.
  5241. */
  5242. /** @expose */
  5243. constructor : function() {
  5244. this._visible = true;
  5245. this._size = null;
  5246. this._colorPalette = null;
  5247. this._orient = "horizontal";
  5248. this._swatchSize = 16.0 * 16.0;
  5249. this._swatchSizeFunc = null;
  5250. this._scale = null;
  5251. this._shape = "square";
  5252. this._title = null;
  5253. this._titleStyle = {};
  5254. this._entryStyle = {};
  5255. this._labelFormat = null;
  5256. this._swatchLegend = null;
  5257. this._continuousLegend = null;
  5258. this._legendType = null;
  5259. },
  5260. /** @expose */
  5261. type : function() {
  5262. return "LegendComponent";
  5263. },
  5264. /** @expose */
  5265. execute : function(g) {
  5266. if (this._colorPalette) {
  5267. if ("continuous" == this._colorPalette.getType()) {
  5268. if (!this._continuousLegend) {
  5269. this._continuousLegend = (rave.capabilities.extension("legend")).continuous();
  5270. }
  5271. this._legendType = "ContinuousLegend";
  5272. } else {
  5273. if (!this._swatchLegend) {
  5274. this._swatchLegend = (rave.capabilities.extension("legend")).swatch();
  5275. }
  5276. this._legendType = "SwatchLegend";
  5277. }
  5278. } else if (this._swatchSizeFunc) {
  5279. if (!this._swatchLegend) {
  5280. this._swatchLegend = (rave.capabilities.extension("legend")).swatch();
  5281. }
  5282. this._legendType = "SwatchLegend";
  5283. } else {
  5284. this._legendType = null;
  5285. }
  5286. this.preExecute();
  5287. if (!this._visible || (!this._colorPalette && !this._swatchSizeFunc) || !this._size || this._size[0] <= 0 || this._size[1] <= 0) {
  5288. g.selectAll("*").remove();
  5289. return;
  5290. }
  5291. var fontChecker = rave.capabilities.extension("fontchecker");
  5292. if (this._colorPalette && "continuous" == this._colorPalette.getType()) {
  5293. 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);
  5294. var legend = g.call(this._continuousLegend);
  5295. if (this._entryStyle) {
  5296. legend.selectAll(".legendLabel").style(this._entryStyle);
  5297. }
  5298. if (this._titleStyle) {
  5299. legend.selectAll(".legendTitle").style(this._titleStyle);
  5300. }
  5301. if (fontChecker) {
  5302. legend.selectAll(".legendLabel").call(fontChecker);
  5303. legend.selectAll(".legendTitle").call(fontChecker);
  5304. }
  5305. } else {
  5306. var insets = {};
  5307. insets["bottom"] = 5;
  5308. var swatchSize = this._swatchSize;
  5309. var scale = null;
  5310. var labelFormatter = this._labelFormat;
  5311. if (this._swatchSizeFunc && this._scale) {
  5312. swatchSize = this._swatchSizeFunc;
  5313. scale = this._scale;
  5314. }
  5315. if (this._colorPalette) {
  5316. scale = this._colorPalette.getScale();
  5317. var originalDomain = this._colorPalette.originalDomain();
  5318. if (originalDomain) {
  5319. scale.domain(originalDomain);
  5320. var f = this._colorPalette.originalDomainLabelAccessor();
  5321. if (this._labelFormat) {
  5322. var self = this;
  5323. labelFormatter = function(data, index, groupIndex) {
  5324. return self._labelFormat.call(this, f.call(this, data, index, groupIndex), index, groupIndex);
  5325. };
  5326. } else {
  5327. labelFormatter = f;
  5328. }
  5329. }
  5330. }
  5331. 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);
  5332. var legend = g.call(this._swatchLegend);
  5333. if (this._entryStyle) {
  5334. legend.selectAll(".legendLabel").style(this._entryStyle);
  5335. }
  5336. if (this._titleStyle) {
  5337. legend.selectAll(".legendTitle").style(this._titleStyle);
  5338. }
  5339. if (fontChecker) {
  5340. legend.selectAll(".legendLabel").call(fontChecker);
  5341. legend.selectAll(".legendTitle").call(fontChecker);
  5342. }
  5343. }
  5344. },
  5345. /** @expose */
  5346. legend : function() {
  5347. if ("ContinuousLegend" == this._legendType) {
  5348. return this._continuousLegend;
  5349. }
  5350. if ("SwatchLegend" == this._legendType) {
  5351. return this._swatchLegend;
  5352. }
  5353. return null;
  5354. },
  5355. /** @expose */
  5356. legendType : function() {
  5357. return this._legendType;
  5358. },
  5359. /**
  5360. * Set the visible property.
  5361. * @param (boolean) visible New visible
  5362. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5363. */
  5364. /** @expose */
  5365. visible : function(visible) {
  5366. this._visible = visible;
  5367. return this;
  5368. },
  5369. /**
  5370. * see if the legend is visible
  5371. * @return (boolean) if its visible
  5372. */
  5373. /** @expose */
  5374. isVisible : function() {
  5375. return this._visible;
  5376. },
  5377. /**
  5378. * Set the size property.
  5379. * @param (Array) size New size
  5380. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5381. */
  5382. /** @expose */
  5383. size : function(size) {
  5384. this._size = size;
  5385. return this;
  5386. },
  5387. /**
  5388. * Set the color scale property.
  5389. * @param (rave['library']['internal']['Palette']) colorPalette New color scale
  5390. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5391. */
  5392. /** @expose */
  5393. colorPalette : function(colorPalette) {
  5394. this._colorPalette = colorPalette;
  5395. return this;
  5396. },
  5397. /**
  5398. * Set the orient property. If the argument is not "horizontal" or "vertical", it is ignored and the orient property is not changed.
  5399. * @param (String) orient New orient
  5400. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5401. */
  5402. /** @expose */
  5403. orient : function(orient) {
  5404. if ("horizontal" == orient || "vertical" == orient) {
  5405. this._orient = orient;
  5406. }
  5407. return this;
  5408. },
  5409. /**
  5410. * 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".
  5411. * @param (String) position Legend position
  5412. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5413. */
  5414. /** @expose */
  5415. position : function(position) {
  5416. return this.orient(com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf(position));
  5417. },
  5418. swatchSize$0 : function(swatchSize) {
  5419. if (swatchSize >= 0.0 && swatchSize != null) {
  5420. this._swatchSize = swatchSize;
  5421. }
  5422. return this;
  5423. },
  5424. /** @expose */
  5425. scale : function(scale) {
  5426. this._scale = scale;
  5427. return this;
  5428. },
  5429. swatchSize$1 : function(swatchSize) {
  5430. if (swatchSize) {
  5431. this._swatchSizeFunc = swatchSize;
  5432. }
  5433. return this;
  5434. },
  5435. /** @expose */
  5436. shape : function(shape) {
  5437. this._shape = shape;
  5438. return this;
  5439. },
  5440. /** @expose */
  5441. title : function(title) {
  5442. this._title = (title != null && title.length > 0) ? title : null;
  5443. return this;
  5444. },
  5445. /** @expose */
  5446. titleFill : function(titleFill) {
  5447. this._titleStyle["fill"] = titleFill;
  5448. return this;
  5449. },
  5450. /** @expose */
  5451. titleFontSize : function(titleFontSize) {
  5452. this._titleStyle["font-size"] = titleFontSize;
  5453. return this;
  5454. },
  5455. /** @expose */
  5456. titleFontFamily : function(titleFontFamily) {
  5457. this._titleStyle["font-family"] = titleFontFamily;
  5458. return this;
  5459. },
  5460. /** @expose */
  5461. labelFormat : function(labelFormat) {
  5462. this._labelFormat = labelFormat;
  5463. return this;
  5464. },
  5465. /** @expose */
  5466. titleFont : function(titleFontStyle) {
  5467. this._titleStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(titleFontStyle);
  5468. return this;
  5469. },
  5470. /** @expose */
  5471. entryFont : function(entryFontStyle) {
  5472. this._entryStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(entryFontStyle);
  5473. return this;
  5474. },
  5475. /** @expose */
  5476. getSpaceUsed : function() {
  5477. if (this._colorPalette && "continuous" == this._colorPalette.getType()) {
  5478. return this._continuousLegend.getUsedSize() + 2;
  5479. } else {
  5480. return this._swatchLegend.getUsedSize() + 2;
  5481. }
  5482. },
  5483. /** @expose */
  5484. swatchSize : function(a0) {
  5485. var args = arguments;
  5486. if (args.length == 1 && typeof a0 === "function") {
  5487. return this.swatchSize$1(a0);
  5488. }
  5489. return this.swatchSize$0(a0);
  5490. }
  5491. });
  5492. /**
  5493. * Get the orient for a position. "top" and "bottom" return "horizontal", anything else ("left", "right", or unknown/null) is "vertical".
  5494. * @param (String) position A position
  5495. * @return (String) "horizontal" or "vertical"
  5496. */
  5497. /** @expose */
  5498. com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf = function(position) {
  5499. if ("top" == position || "bottom" == position) {
  5500. return "horizontal";
  5501. }
  5502. return "vertical";
  5503. };
  5504. //com_ibm_rave_bundles_components_LegendComponentImpl.HORIZONTAL = "horizontal";
  5505. //com_ibm_rave_bundles_components_LegendComponentImpl.VERTICAL = "vertical";
  5506. com_ibm_rave_bundles_components_LegendComponentImpl.BAR_THINKNESS = 16;
  5507. com_ibm_rave_bundles_components_LegendComponentImpl.SWATCH_SIZE = 16;
  5508. /** @expose */
  5509. com_ibm_rave_bundles_components_LegendComponentImpl.TOP = "top";
  5510. /** @expose */
  5511. com_ibm_rave_bundles_components_LegendComponentImpl.BOTTOM = "bottom";
  5512. /** @expose */
  5513. com_ibm_rave_bundles_components_LegendComponentImpl.LEFT = "left";
  5514. /** @expose */
  5515. com_ibm_rave_bundles_components_LegendComponentImpl.RIGHT = "right";
  5516. /** @expose */
  5517. com_ibm_rave_bundles_components_LegendComponentImpl.ADJUSTABLE = -1;
  5518. // $source: com/ibm/rave/bundles/components/AxisComponentImpl
  5519. /************************************************************************
  5520. ** IBM Confidential
  5521. **
  5522. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5523. **
  5524. ** (C) Copyright IBM Corp. 2018
  5525. **
  5526. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5527. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5528. ************************************************************************/
  5529. // GENERATED
  5530. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5531. //@import com/ibm/rave/bundles/component/AxisComponent (runtime) // AxisComponent
  5532. //@import com/ibm/rave/bundles/utilities/TextCrossfader (runtime) // textCrossFade
  5533. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  5534. //@import com/ibm/rave/bundles/utilities/BundleLabelDropper (runtime) // new
  5535. /**
  5536. * <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>
  5537. */
  5538. var com_ibm_rave_bundles_components_AxisComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5539. /**
  5540. * Axis - created on demand
  5541. */
  5542. //_axis : null,
  5543. /**
  5544. * Role, from the AxisComponent API
  5545. */
  5546. //_role : null,
  5547. /**
  5548. * CoordinateScale
  5549. */
  5550. //_scale : null,
  5551. /**
  5552. * Orient, always one of the four legal values
  5553. */
  5554. //_orient : null,
  5555. /**
  5556. * Size
  5557. */
  5558. //_bounds : null,
  5559. //_elementRect : null,
  5560. /**
  5561. * The title text; default null (nothing visible)
  5562. */
  5563. /** @expose */
  5564. _axisTitle : null,
  5565. /**
  5566. * The title style; defaults null (use the CSS styling)
  5567. */
  5568. /** @expose */
  5569. _titleStyle : null,
  5570. /**
  5571. * Axis line color; default null (use the CSS styling)
  5572. */
  5573. /** @expose */
  5574. _lineColor : null,
  5575. /**
  5576. * Axis tick color; default null (use the CSS styling)
  5577. */
  5578. /** @expose */
  5579. _tickColor : null,
  5580. /**
  5581. * Axis tick label style; defaults null (use the CSS styling)
  5582. */
  5583. /** @expose */
  5584. _labelStyle : null,
  5585. //_staggerRotate45Nodes : null,
  5586. //_staggerFirstNode : null,
  5587. //_staggerLastNode : null,
  5588. /**
  5589. * Axis tick label formatting
  5590. */
  5591. //_tickFormat : null,
  5592. //_dropOverlap : null,
  5593. /**
  5594. * Used to get the extension to enable axis label wrapping
  5595. */
  5596. //_textFlow : null,
  5597. /**
  5598. * Used to check the fonts on each label to make sure all characters are covered
  5599. */
  5600. //_fontChecker : null,
  5601. /**
  5602. * Run function that applies the properties to the axis line
  5603. */
  5604. //_axisLineProperties : null,
  5605. /**
  5606. * Run function that applies the properties to the axis ticks
  5607. */
  5608. //_axisTickProperties : null,
  5609. /**
  5610. * Run function that applies the properties to the axis tick labels
  5611. */
  5612. //_axisTickLabelProperties : null,
  5613. /**
  5614. * Run function that hides or displays the axis tick labels
  5615. */
  5616. //_displayHideLabels : null,
  5617. /**
  5618. * Run function that hides or displays the axis tick labels
  5619. */
  5620. //_panZoomLabels : null,
  5621. /**
  5622. * The tick handler registered with the axis; will get called during axis transition
  5623. */
  5624. //_tickHandler : null,
  5625. //_textTruncationIndicator : null,
  5626. /**
  5627. * Used when dealing with numeric scale on the vertical axis and the numbers don't fit
  5628. */
  5629. //_simplifiedTickFormat : null,
  5630. //_tickMagnitude : null,
  5631. /**
  5632. * Whether to display the axis title; default true
  5633. */
  5634. /** @expose */
  5635. _displayAxisTitle : false,
  5636. /**
  5637. * Whether to display the axis line; default true
  5638. */
  5639. /** @expose */
  5640. _displayAxisLine : false,
  5641. /**
  5642. * Whether to display the axis ticks; default true
  5643. */
  5644. /** @expose */
  5645. _displayTicks : false,
  5646. /**
  5647. * Whether to display the axis tick labels (conditional on show labels property); default true
  5648. */
  5649. /** @expose */
  5650. _displayTickLabels : false,
  5651. /**
  5652. * Whether to display the axis tick labels (conditional on pan-zoom hide property); default true
  5653. */
  5654. /** @expose */
  5655. _showPanZoomTickLabels : false,
  5656. /**
  5657. * Whether to rotate the axis tick labels; default false
  5658. */
  5659. _rotateLabels : false,
  5660. _staggerCellWidth : 0,
  5661. _staggerAlignFirstAtStart : false,
  5662. _staggerAlignLastAtEnd : false,
  5663. _layoutTimerId : 0,
  5664. _layoutTitleSize : 0,
  5665. _layoutLabelSize : 0,
  5666. _layoutLabelHeight : 0,
  5667. _layoutAverageDigitWidth : 0,
  5668. _layoutSpillOver : 0,
  5669. /**
  5670. * Whether to hide overlapping labels; default true
  5671. */
  5672. /** @expose */
  5673. _hideOverlappingLabels : false,
  5674. /**
  5675. * When true, don't start a new timer
  5676. */
  5677. _pendingLabelTimer : false,
  5678. /**
  5679. * The padding in px between tick axis line and tick label, and also between tick label and title. Default 16px.
  5680. */
  5681. _padding : 0,
  5682. /**
  5683. * After calling the component, this is true if shapes were rendered, false if they were cleared.
  5684. */
  5685. _renderedShapes : false,
  5686. _layoutMode : -1,
  5687. _allowAutoAxisLayoutToChangeOrientaiton : true,
  5688. _lastAutomaticAxisLayoutOrientation : -1,
  5689. _allowStagger : false,
  5690. _allowRotate45 : false,
  5691. _allowRotate90 : false,
  5692. constructor : function() {
  5693. {
  5694. var self = this;
  5695. this._axisLineProperties = function(args) {
  5696. if (args !== null || arguments.length > 1){
  5697. args = Array.prototype.slice.call(arguments, 0);
  5698. }
  5699. {
  5700. var line = this.selectAll("path.domain");
  5701. if (self._lineColor != null) {
  5702. line.style("stroke", self._lineColor);
  5703. }
  5704. if (self._displayAxisLine) {
  5705. line.attr("visibility", null);
  5706. } else {
  5707. line.attr("visibility", "hidden");
  5708. }
  5709. return null;
  5710. }
  5711. };
  5712. this._axisTickProperties = function(args) {
  5713. if (args !== null || arguments.length > 1){
  5714. args = Array.prototype.slice.call(arguments, 0);
  5715. }
  5716. {
  5717. var tickLines = this.selectAll("line");
  5718. if (self._displayTicks) {
  5719. tickLines.attr("visibility", null);
  5720. } else {
  5721. tickLines.attr("visibility", "hidden");
  5722. }
  5723. if (self._lineColor != null) {
  5724. tickLines.style("stroke", self._tickColor);
  5725. }
  5726. return null;
  5727. }
  5728. };
  5729. this._axisTickLabelProperties = function(args) {
  5730. if (args !== null || arguments.length > 1){
  5731. args = Array.prototype.slice.call(arguments, 0);
  5732. }
  5733. {
  5734. var labels = this.selectAll("text");
  5735. labels.each(self._displayHideLabels);
  5736. labels.each(self._panZoomLabels);
  5737. labels.style(self._labelStyle);
  5738. self._axis.ticksHandler(null);
  5739. return null;
  5740. }
  5741. };
  5742. this._displayHideLabels = function(obj, group, index) {
  5743. if (self._displayTickLabels) {
  5744. if (this.rave_hasProperty("__tickLabelHidden__")) {
  5745. this.rave_removeProperty("__tickLabelHidden__");
  5746. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5747. if (count <= 1) {
  5748. this.rave_removeProperty("__hiddenCount__");
  5749. this.removeAttribute("visibility");
  5750. } else {
  5751. this.rave_setProperty("__hiddenCount__", count - 1);
  5752. }
  5753. }
  5754. } else {
  5755. if (!(this.rave_hasProperty("__tickLabelHidden__"))) {
  5756. this.setAttribute("visibility", "hidden");
  5757. this.rave_setProperty("__tickLabelHidden__", "hidden");
  5758. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5759. this.rave_setProperty("__hiddenCount__", count + 1);
  5760. }
  5761. }
  5762. };
  5763. this._panZoomLabels = function(obj, group, index) {
  5764. if (self._showPanZoomTickLabels) {
  5765. if (this.rave_hasProperty("__panZoomHidden__")) {
  5766. this.rave_removeProperty("__panZoomHidden__");
  5767. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5768. if (count <= 1) {
  5769. this.rave_removeProperty("__hiddenCount__");
  5770. this.removeAttribute("visibility");
  5771. } else {
  5772. this.rave_setProperty("__hiddenCount__", count - 1);
  5773. }
  5774. }
  5775. } else {
  5776. if (!(this.rave_hasProperty("__panZoomHidden__"))) {
  5777. this.setAttribute("visibility", "hidden");
  5778. this.rave_setProperty("__panZoomHidden__", "hidden");
  5779. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5780. this.rave_setProperty("__hiddenCount__", count + 1);
  5781. }
  5782. }
  5783. };
  5784. }
  5785. this._tickHandler = new com_ibm_rave_bundles_components_AxisComponentImpl.AxisTickHandler(this._axisTickLabelProperties, this._axisTickProperties);
  5786. /**
  5787. * Initialize properties to defaults
  5788. */
  5789. {
  5790. this._axis = null;
  5791. this._role = null;
  5792. this._scale = null;
  5793. this._orient = "bottom";
  5794. this._bounds = null;
  5795. this._displayAxisTitle = true;
  5796. this._axisTitle = null;
  5797. this._titleStyle = {};
  5798. this._displayAxisLine = true;
  5799. this._lineColor = null;
  5800. this._displayTicks = true;
  5801. this._tickColor = null;
  5802. this._displayTickLabels = true;
  5803. this._labelStyle = {};
  5804. this._rotateLabels = false;
  5805. this._hideOverlappingLabels = true;
  5806. this._dropOverlap = new com_ibm_rave_bundles_utilities_BundleLabelDropper();
  5807. this._tickFormat = null;
  5808. this._showPanZoomTickLabels = true;
  5809. this._pendingLabelTimer = false;
  5810. this._padding = 16;
  5811. this._textFlow = rave.capabilities.extension("textflow");
  5812. this._fontChecker = rave.capabilities.extension("fontchecker");
  5813. this._renderedShapes = false;
  5814. }
  5815. },
  5816. /** @expose */
  5817. type : function() {
  5818. return com_ibm_rave_bundles_component_AxisComponent.COMPONENT_TYPE;
  5819. },
  5820. /** @expose */
  5821. role : function() {
  5822. return this._role;
  5823. },
  5824. /** @expose */
  5825. execute : function(g) {
  5826. this.preExecute();
  5827. if (!this._scale) {
  5828. g.selectAll("*").remove();
  5829. this._renderedShapes = false;
  5830. return;
  5831. }
  5832. this._renderedShapes = true;
  5833. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  5834. this._hideOverlappingLabels = false;
  5835. this._rotateLabels = true;
  5836. } else {
  5837. this._hideOverlappingLabels = true;
  5838. this._rotateLabels = true;
  5839. }
  5840. this.drawTitle(g);
  5841. this.drawAxis(g);
  5842. this.handleAxisText(g);
  5843. this.drawTitle(g);
  5844. },
  5845. /**
  5846. * This is one place where all the calls that affect the axis text happen in case of allowAutomaticAxisLayout the new behavior applies here
  5847. * @param (rave['internal']['Selector']) g
  5848. */
  5849. handleAxisText : function(g) {
  5850. this.stopLabelDroppingUpdate();
  5851. var duration = 0, delay = 0;
  5852. var g2 = rave.transition(g);
  5853. if (g2.isTransition()) {
  5854. var t2 = (g2);
  5855. duration = t2.duration();
  5856. delay = t2.delay();
  5857. }
  5858. var axisSelector = g.selectAll("g.axis");
  5859. var labels = axisSelector.selectAll("g.tick").filter(rave['library']['internal']['BundleUtils'].notExit).selectAll("text");
  5860. var fontChecker = rave.capabilities.extension("fontchecker");
  5861. labels.style(this._labelStyle);
  5862. if (fontChecker) {
  5863. labels.call(fontChecker);
  5864. }
  5865. var mode = this._allowAutoAxisLayoutToChangeOrientaiton ? this.determineWhichAutoMode(g) : this._lastAutomaticAxisLayoutOrientation;
  5866. this.configureStaggerData(g, mode);
  5867. this.handleLabelsRotationAndPosition(g, labels, mode);
  5868. this.hashingNumericScales(labels, this.labelExtent(g), mode);
  5869. if (duration == 0) {
  5870. this.doLabelWrapping(g, mode);
  5871. this.handleLabelsRotationAndPosition(g, labels, mode);
  5872. }
  5873. this._lastAutomaticAxisLayoutOrientation = mode;
  5874. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  5875. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  5876. var tick = axisSelector.append("g").classed("tick", true);
  5877. var tickText = tick.append("text");
  5878. if (labels.size() == 0) {
  5879. var singleValue = this._scale.scale().domain()[0];
  5880. var formatter = this._tickFormat;
  5881. if (!formatter) {
  5882. var tickFunc = this._scale.scale().tickFormat;
  5883. if (tickFunc) {
  5884. formatter = tickFunc.apply(tickFunc, [singleValue]);
  5885. }
  5886. }
  5887. var node = tickText[0][0];
  5888. var stringValue = formatter ? formatter.call(node, singleValue, 0, 0) : ""+(singleValue);
  5889. tickText.text(stringValue);
  5890. var dim = node.getBBox();
  5891. this._layoutLabelSize = isHorizontal ? dim.height : dim.width;
  5892. if (!isHorizontal || mode != 0) {
  5893. tickText.text(".0");
  5894. this._layoutLabelSize += node.getBBox().width;
  5895. }
  5896. }
  5897. if (!isHorizontal || mode != 0) {
  5898. tickText.text(".0");
  5899. var node = tickText[0][0];
  5900. var dim = node.getBBox();
  5901. this._layoutAverageDigitWidth = dim.width;
  5902. }
  5903. tick.remove();
  5904. }
  5905. if (this._hideOverlappingLabels && duration > 0) {
  5906. this.updateLabelDropping(labels, duration, delay);
  5907. }
  5908. if (duration > 0) {
  5909. this.doLabelWrappingAfterAnimation(g, labels, mode, duration, delay);
  5910. }
  5911. if (!this._displayTickLabels) {
  5912. this._layoutLabelSize = 0;
  5913. this._layoutAverageDigitWidth = 0;
  5914. }
  5915. },
  5916. /**
  5917. * 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
  5918. * @param (rave['internal']['Selector']) g selector
  5919. * @param (rave['internal']['Selector']) labels labels selector
  5920. * @param (int) mode one of HORIZONTAL, STAGGER, ROTATE90
  5921. */
  5922. handleLabelsRotationAndPosition : function(g, labels, mode) {
  5923. if (mode == 2 || mode == 1) {
  5924. if (this._orient == "bottom") {
  5925. this.rotateLabels(g, labels, "end", mode);
  5926. } else if (this._orient == "top") {
  5927. this.rotateLabels(g, labels, "start", mode);
  5928. } else {
  5929. this.rotateLabels(g, labels, "middle", mode);
  5930. }
  5931. } else {
  5932. if (this._orient == "bottom" || this._orient == "top") {
  5933. this.rotateLabels(g, labels, "middle", mode);
  5934. } else if (this._orient == "right") {
  5935. this.rotateLabels(g, labels, "start", mode);
  5936. } else {
  5937. this.rotateLabels(g, labels, "end", mode);
  5938. }
  5939. }
  5940. },
  5941. /**
  5942. * <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>
  5943. * @param (rave['internal']['Selector']) labels
  5944. */
  5945. hashingNumericScales : function(labels, extent, mode) {
  5946. if (!labels || !extent) {
  5947. return;
  5948. }
  5949. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  5950. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  5951. var tickSpace = mode == 1 ? extent[1] : extent[0];
  5952. this._textTruncationIndicator = "";
  5953. this._layoutLabelSize = 0;
  5954. for (var i = 0; i < labels.size(); ++i) {
  5955. var node = labels[i][0];
  5956. var dim = node.getBBox();
  5957. var width = dim.width;
  5958. var height = dim.height;
  5959. var size = !isHorizontal || mode == 1 ? width : height;
  5960. if (size > this._layoutLabelSize) {
  5961. this._layoutLabelSize = size;
  5962. }
  5963. if (width >= tickSpace) {
  5964. if (this._simplifiedTickFormat) {
  5965. var newText = this._simplifiedTickFormat.call(null, node.rave_getData(), 0, 0);
  5966. if (newText != null) {
  5967. node.rave_setText(newText);
  5968. }
  5969. if (node.getBBox().width >= tickSpace) {
  5970. node.rave_setText(this.stringOfSize(node.rave_getText().length, "#"));
  5971. }
  5972. } else {
  5973. node.rave_setText(this.stringOfSize(node.rave_getText().length, "#"));
  5974. }
  5975. }
  5976. }
  5977. }
  5978. },
  5979. /**
  5980. * @param (int) size The desired size of the string
  5981. * @param (String) ch The character to be repeated in the string
  5982. * @return (String) A string of the specified size containing repetition of the specified character
  5983. */
  5984. stringOfSize : function(size, ch) {
  5985. var returnString = "";
  5986. for (var i = 0; i < size; ++i) {
  5987. returnString += ch;
  5988. }
  5989. return returnString;
  5990. },
  5991. configureStaggerData : function(g, mode) {
  5992. if (mode == 3 || mode == 2) {
  5993. var horizontalDimensions = this.labelExtent(g);
  5994. var cellWidth = horizontalDimensions[0];
  5995. var axisSelector = g.selectAll("g.axis");
  5996. var labels = axisSelector.selectAll("text");
  5997. var domain = this._scale.scale().domain();
  5998. var originalDataLabelAccessor = (this._scale).originalDomainLabelAccessor();
  5999. this._staggerRotate45Nodes = [];
  6000. this._staggerFirstNode = null;
  6001. this._staggerLastNode = null;
  6002. for (var i = 0; i < labels.size(); ++i) {
  6003. var node = labels[0][i];
  6004. if (this.isValid(node.rave_getData())) {
  6005. var domainIndex = -1;
  6006. if (mode == 3) {
  6007. var domainLabel = !this._tickFormat ? node.rave_getText() : originalDataLabelAccessor.call(node, node.rave_getData(), 0, 0);
  6008. for (var index = 0; index < domain.length; ++index) {
  6009. if (domain[index].toString() == domainLabel) {
  6010. domainIndex = index;
  6011. break;
  6012. }
  6013. }
  6014. }
  6015. this._staggerRotate45Nodes.push(new com_ibm_rave_bundles_components_AxisComponentImpl.NodeIndex(node, domainIndex));
  6016. if (domainIndex == 0) {
  6017. this._staggerFirstNode = node;
  6018. }
  6019. if (domainIndex == domain.length - 1) {
  6020. this._staggerLastNode = node;
  6021. }
  6022. }
  6023. }
  6024. this._staggerCellWidth = cellWidth * 2;
  6025. this._staggerAlignFirstAtStart = this._staggerFirstNode ? this._staggerFirstNode.getBBox().width > cellWidth : false;
  6026. this._staggerAlignLastAtEnd = this._staggerLastNode ? this._staggerLastNode.getBBox().width > cellWidth : false;
  6027. }
  6028. },
  6029. getStaggerIndex : function(node) {
  6030. for (var index = 0; index < this._staggerRotate45Nodes.length; ++index) {
  6031. if (this._staggerRotate45Nodes[index].contains(node)) {
  6032. var domainIndex = this._staggerRotate45Nodes[index].getIndex();
  6033. return domainIndex == -1 ? 0 : domainIndex;
  6034. }
  6035. }
  6036. return -1;
  6037. },
  6038. getStaggerCount : function() {
  6039. var domain = this._scale.scale().domain();
  6040. return domain.length;
  6041. },
  6042. /**
  6043. * <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>
  6044. * @param (rave['internal']['Selector']) g
  6045. */
  6046. determineWhichAutoMode : function(g) {
  6047. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6048. var axisSelector = g.selectAll("g.axis");
  6049. var labels = axisSelector.selectAll("text");
  6050. var dim = this.labelExtent(g);
  6051. var cellWidth = dim[0];
  6052. var cellWidth90 = dim[1];
  6053. var layoutLabelHeight = 0;
  6054. var layoutLabelWidth = 0;
  6055. var horizontalScore = 0;
  6056. var staggerScore = 0;
  6057. var rotate45Score = 0;
  6058. var rotate90Score = 0;
  6059. var validNodes = [];
  6060. for (var i = 0; i < labels.size(); ++i) {
  6061. var node = labels[0][i];
  6062. if (this.isValid(node.rave_getData())) {
  6063. validNodes.push(node);
  6064. }
  6065. }
  6066. var labelCount = validNodes.length;
  6067. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  6068. var mode = 0;
  6069. if (isHorizontal) {
  6070. mode = this._layoutMode == 1 ? 1 : 0;
  6071. var tick = axisSelector.append("g").classed("tick", true);
  6072. var tickText = tick.append("text");
  6073. tickText.style(this._labelStyle);
  6074. tickText.text(",0");
  6075. var node = tickText[0][0];
  6076. var zeroWidth = node.getBBox().width;
  6077. tick.remove();
  6078. var widestLabel = 0;
  6079. for (var i = 0; i < labelCount; ++i) {
  6080. node = validNodes[i];
  6081. var nodeRect = node.getBBox();
  6082. if (nodeRect.width > widestLabel) {
  6083. widestLabel = nodeRect.width;
  6084. }
  6085. if (nodeRect.height > this._layoutLabelHeight) {
  6086. this._layoutLabelHeight = nodeRect.height;
  6087. }
  6088. }
  6089. widestLabel += zeroWidth;
  6090. this._layoutSpillOver = mode == 1 ? this._layoutLabelHeight / 2 : widestLabel / 2 + 2;
  6091. } else {
  6092. for (var i = 0; i < labelCount; ++i) {
  6093. var node = validNodes[i];
  6094. var nodeRect = node.getBBox();
  6095. if (nodeRect.height > this._layoutLabelHeight) {
  6096. this._layoutLabelHeight = nodeRect.height;
  6097. }
  6098. }
  6099. this._layoutSpillOver = this._layoutLabelHeight / 2;
  6100. }
  6101. return mode;
  6102. }
  6103. var originalDataLabelAccessor = (this._scale).originalDomainLabelAccessor();
  6104. var staggerStringsWontMatch = this._tickFormat && !originalDataLabelAccessor;
  6105. var calcStagger = ((this._allowStagger && this._layoutMode == -1) || this._layoutMode == 3) && !staggerStringsWontMatch;
  6106. var calcRotate45 = (this._allowRotate45 && this._layoutMode == -1) || this._layoutMode == 2;
  6107. var calcRotate90 = (this._allowRotate90 && this._layoutMode == -1) || this._layoutMode == 1;
  6108. var spaceFor45Label = 0;
  6109. for (var i = 0; i < labelCount; ++i) {
  6110. var node = validNodes[i];
  6111. var nodeRect = node.getBBox();
  6112. layoutLabelHeight = nodeRect.height;
  6113. var labelWidth = nodeRect.width;
  6114. if (labelWidth > layoutLabelWidth) {
  6115. layoutLabelWidth = labelWidth;
  6116. }
  6117. horizontalScore += (labelWidth <= cellWidth ? 1 : cellWidth / labelWidth);
  6118. if (isHorizontal) {
  6119. if (calcStagger) {
  6120. var spaceForLabel = cellWidth * 2;
  6121. if (i == 0 && i == labelCount - 1) {
  6122. spaceForLabel *= 0.5;
  6123. } else if (i == 0 || i == labelCount - 1) {
  6124. spaceForLabel *= 0.75;
  6125. }
  6126. staggerScore += (labelWidth <= spaceForLabel ? 1 : spaceForLabel / labelWidth);
  6127. }
  6128. if (calcRotate45) {
  6129. if (spaceFor45Label == 0) {
  6130. spaceFor45Label = cellWidth90 / 0.7071 - layoutLabelHeight;
  6131. }
  6132. var space = this.calculate45DegreeSpace(node, spaceFor45Label);
  6133. rotate45Score += (labelWidth <= space ? 1 : space / labelWidth);
  6134. }
  6135. if (calcRotate90) {
  6136. rotate90Score += (labelWidth <= cellWidth90 ? 1 : cellWidth90 / labelWidth);
  6137. }
  6138. }
  6139. }
  6140. var mode = 0;
  6141. if (this._layoutMode == -1) {
  6142. if (isHorizontal && this._allowStagger) {
  6143. horizontalScore *= 1.1;
  6144. staggerScore *= 1.1;
  6145. }
  6146. if ((staggerScore > horizontalScore) && (staggerScore >= rotate45Score) && (staggerScore >= rotate90Score)) {
  6147. mode = 3;
  6148. } else if ((rotate45Score > horizontalScore) && (rotate45Score >= rotate90Score)) {
  6149. mode = 2;
  6150. } else if (rotate90Score > horizontalScore) {
  6151. mode = 1;
  6152. }
  6153. } else {
  6154. if ((this._layoutMode == 3 && staggerStringsWontMatch) || !isHorizontal) {
  6155. mode = 0;
  6156. } else {
  6157. mode = this._layoutMode;
  6158. }
  6159. }
  6160. if (isHorizontal) {
  6161. switch (mode) {
  6162. case 3:
  6163. this._layoutLabelSize = layoutLabelHeight * 2;
  6164. break;
  6165. case 2:
  6166. this._layoutLabelSize = (layoutLabelWidth + layoutLabelHeight) * 0.7071;
  6167. break;
  6168. case 1:
  6169. this._layoutLabelSize = layoutLabelWidth;
  6170. break;
  6171. case 0:
  6172. default:
  6173. this._layoutLabelSize = layoutLabelHeight;
  6174. break;
  6175. }
  6176. } else {
  6177. this._layoutLabelSize = layoutLabelWidth;
  6178. }
  6179. this._layoutLabelHeight = layoutLabelHeight;
  6180. return mode;
  6181. },
  6182. calculate45DegreeSpace : function(node, maxWidth) {
  6183. var width = maxWidth;
  6184. var tfm = node.rave_getParentNode().getAttribute("transform");
  6185. if (tfm != null) {
  6186. var tfmString = tfm.toString();
  6187. var indexOfTrans = tfmString.indexOf("translate(");
  6188. if (indexOfTrans != -1) {
  6189. indexOfTrans += 10;
  6190. var indexOfComma = tfmString.indexOf(",", indexOfTrans);
  6191. if (indexOfComma != -1) {
  6192. var xAmount = tfmString.substring(indexOfTrans, indexOfComma);
  6193. var xLabelPos = + (xAmount);
  6194. var width45Degrees = node.getBBox().width;
  6195. var xLabelWidth = width45Degrees * 0.7071;
  6196. var isBottom = this._orient == "bottom";
  6197. if (isBottom) {
  6198. xLabelPos -= node.getBBox().height / 4;
  6199. if (xLabelPos - xLabelWidth < this._bounds.x) {
  6200. xLabelWidth = xLabelPos - this._bounds.x;
  6201. width = xLabelWidth / 0.7071;
  6202. }
  6203. } else {
  6204. if (xLabelPos + xLabelWidth > this._bounds.x + this._bounds.width) {
  6205. xLabelWidth = (this._bounds.x + this._bounds.width) - xLabelPos;
  6206. width = xLabelWidth / 0.7071;
  6207. }
  6208. }
  6209. if (width > maxWidth) {
  6210. width = maxWidth;
  6211. }
  6212. }
  6213. }
  6214. }
  6215. return width;
  6216. },
  6217. /**
  6218. * @param (rave['internal']['Selector']) labels selector with all labels to be rotated
  6219. * @param (rave['internal']['Selector']) g The parent selector of labels
  6220. * @param (String) textAnchor The position of the anchor
  6221. * @param alignmentMode One of HORIZONTAL, STAGGER, ROTATE45, ROTATE90
  6222. */
  6223. rotateLabels : function(g, labels, textAnchor, mode) {
  6224. if (this._rotateLabels) {
  6225. var self = this;
  6226. var positioning = function(data, index, groupIndex) {
  6227. var x = 0;
  6228. var y = 0;
  6229. var rotation_cy = 0;
  6230. var isBottom = self._orient == "bottom";
  6231. if (mode == 3) {
  6232. var cellIndex = self.getStaggerIndex(this);
  6233. if (cellIndex != -1) {
  6234. if (cellIndex % 2 == 1) {
  6235. var staggerDirection = isBottom ? 1 : -1;
  6236. y += (self._layoutLabelHeight * staggerDirection);
  6237. }
  6238. if (cellIndex == 0 && self._staggerAlignFirstAtStart) {
  6239. x -= self._staggerCellWidth / 4;
  6240. } else if (cellIndex == self.getStaggerCount() - 1 && self._staggerAlignLastAtEnd) {
  6241. x += self._staggerCellWidth / 4;
  6242. }
  6243. }
  6244. } else if (mode == 2) {
  6245. if (isBottom) {
  6246. x -= self._layoutLabelHeight;
  6247. } else {
  6248. x += self._layoutLabelHeight / 2;
  6249. }
  6250. } else if (mode == 1) {
  6251. if (isBottom) {
  6252. x -= (this.getBBox().height / 2 + self._layoutLabelHeight / 4);
  6253. rotation_cy = ~~(self._padding / 4 + self._axis.tickSize());
  6254. } else {
  6255. x -= (this.getBBox().height / 2 - self._layoutLabelHeight);
  6256. rotation_cy = ~~-(self._padding / 4 + self._axis.tickSize());
  6257. }
  6258. }
  6259. var rotationDegrees = mode == 1 ? -90 : mode == 2 ? -45 : 0;
  6260. return "translate(" + x + "," + y + ") rotate(" + rotationDegrees + ",0," + rotation_cy + ")";
  6261. };
  6262. labels.attr("transform", positioning).style("text-anchor", textAnchor);
  6263. if (mode == 3) {
  6264. if (this._staggerAlignFirstAtStart) {
  6265. this._staggerFirstNode.rave_setStyle("text-anchor", "start");
  6266. }
  6267. if (this._staggerAlignLastAtEnd) {
  6268. this._staggerLastNode.rave_setStyle("text-anchor", "end");
  6269. }
  6270. }
  6271. }
  6272. },
  6273. /** @expose */
  6274. axis : function() {
  6275. return this._axis;
  6276. },
  6277. /**
  6278. * Draw the axis. The scale is non-null.
  6279. * @param (rave['internal']['Selector']) g Selector group into which the axis is drawn.
  6280. */
  6281. drawAxis : function(g) {
  6282. var axisSelector = g.selectAll("g.axis").data([0]);
  6283. axisSelector.enter().append("g").classed("axis", true).classed(this._orient, true);
  6284. if (!this._axis) {
  6285. this._axis = new rave['internal']['Axis']();
  6286. }
  6287. if (this._hideOverlappingLabels) {
  6288. this._textFlow.valignment("top").dropTextOnFail(false);
  6289. }
  6290. this._axis.ticksHandler(this._tickHandler);
  6291. this._axis.orient(this._orient);
  6292. this._axis.tickFormat(this._tickFormat);
  6293. this._axis.tickPadding(10.0);
  6294. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  6295. var labelHeight = 20.0;
  6296. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6297. if (isHorizontal) {
  6298. labelHeight /= 0.7071;
  6299. }
  6300. var range = this._scale.scale().rangeExtent();
  6301. var extent = + (range[1]) - + (range[0]);
  6302. this._axis.ticks(extent / labelHeight);
  6303. } else {
  6304. if (this._tickMagnitude == null) {
  6305. this._axis.ticks(10.0);
  6306. } else {
  6307. this._axis.ticks.apply(this._axis, [10.0, this._scale.scale().getTickFormat(), this._tickMagnitude]);
  6308. }
  6309. }
  6310. var s = this._scale.scale();
  6311. if (this._scale.originalDomain()) {
  6312. var sOrdinal = s.copy();
  6313. sOrdinal.domain(this._scale.originalDomain());
  6314. s = sOrdinal;
  6315. var self = this;
  6316. var originalDataLabelAccessor = (self._scale).originalDomainLabelAccessor();
  6317. var tickFormatter;
  6318. if (originalDataLabelAccessor) {
  6319. if (this._tickFormat) {
  6320. tickFormatter = function(data, index, groupIndex) {
  6321. return self._tickFormat.call(this, originalDataLabelAccessor.call(this, data, index, groupIndex), index, groupIndex);
  6322. };
  6323. } else {
  6324. tickFormatter = originalDataLabelAccessor;
  6325. }
  6326. } else {
  6327. tickFormatter = this._tickFormat;
  6328. }
  6329. this._axis.tickFormat(tickFormatter);
  6330. }
  6331. this._axis.scale(s);
  6332. axisSelector.call(this._axis);
  6333. var g2 = rave.transition(axisSelector);
  6334. if (!(g2.isTransition())) {
  6335. axisSelector.selectAll("text").call(this._dropOverlap, this._hideOverlappingLabels);
  6336. }
  6337. axisSelector.selectAll("path.domain").classed("axis-line", true);
  6338. axisSelector.selectAll("g.tick line").classed("axis-tick", true);
  6339. if (this._fontChecker) {
  6340. axisSelector.selectAll("g.tick text").classed("axis-label", true).call(this._fontChecker);
  6341. } else {
  6342. axisSelector.selectAll("g.tick text").classed("axis-label", true);
  6343. }
  6344. axisSelector.call(this._axisLineProperties);
  6345. },
  6346. /**
  6347. * Draw the axis title.
  6348. * @param (rave['internal']['Selector']) g Selector group into which the title is drawn.
  6349. */
  6350. drawTitle : function(g) {
  6351. if (!this._displayAxisTitle || this._axisTitle == null || this._axisTitle.trim().length == 0 || !this._bounds) {
  6352. g.selectAll("text.axis-title." + this._orient).remove();
  6353. return;
  6354. }
  6355. var x = 0;
  6356. var y = 0;
  6357. var dy = "";
  6358. var transform;
  6359. if ("top" == this._orient) {
  6360. x = this._elementRect.x + this._elementRect.width / 2;
  6361. y = -this._bounds.height + this._padding / 4;
  6362. dy = "0.75em";
  6363. } else if ("bottom" == this._orient) {
  6364. x = this._elementRect.x + this._elementRect.width / 2;
  6365. y = this._bounds.height - this._padding / 4;
  6366. dy = "-0.25em";
  6367. } else if ("left" == this._orient) {
  6368. x = -this._elementRect.y - this._elementRect.height / 2;
  6369. y = -this._bounds.width + this._padding / 4;
  6370. dy = "0.75em";
  6371. transform = "rotate(-90)";
  6372. } else {
  6373. x = this._elementRect.y + this._elementRect.height / 2;
  6374. y = -this._bounds.width + this._padding / 4;
  6375. dy = "0.75em";
  6376. transform = "rotate(90)";
  6377. }
  6378. var fillOpacity;
  6379. {
  6380. var tmp = g.append("text").attr("class", "axis-title " + this._orient);
  6381. fillOpacity = tmp.style("fill-opacity");
  6382. tmp.remove();
  6383. } var label = g.selectAll("text.axis-title." + this._orient);
  6384. if (label.size() == 0) {
  6385. 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);
  6386. if (this._fontChecker) {
  6387. g.selectAll("text.axis-title." + this._orient).call(this._fontChecker);
  6388. }
  6389. }
  6390. 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);
  6391. },
  6392. getUnZoomedScale : function(scale) {
  6393. var s = scale.copy();
  6394. if (s.getZoomTransform()) {
  6395. s.getZoomTransform()(1, 0);
  6396. }
  6397. return s;
  6398. },
  6399. isValid : function(data) {
  6400. var s = this.getUnZoomedScale(this._axis.scale());
  6401. var v = + (s.call(null, data, 0, 0));
  6402. var range = this._axis.scale().range();
  6403. if (this._axis.scale().range().indexOf(v)> -1) {
  6404. return true;
  6405. }
  6406. if (range[0] < v && v < range[1]) {
  6407. return true;
  6408. }
  6409. if (range[0] > v && v > range[1]) {
  6410. return true;
  6411. }
  6412. return false;
  6413. },
  6414. /**
  6415. * Apply label wrapping if requested.
  6416. * @param (rave['internal']['Selector']) g
  6417. * @param (int) mode One of HORIZONTAL, STAGGER, ROTATE45, ROTATE90
  6418. */
  6419. doLabelWrapping : function(g, mode) {
  6420. if (this._displayTickLabels) {
  6421. this._textFlow.valignment("top");
  6422. if (!this._hideOverlappingLabels) {
  6423. this._textFlow.dropTextOnFail(true);
  6424. }
  6425. var d = this.labelExtent(g);
  6426. if (!d || d[0] < 0 || d[1] < 0) {
  6427. return;
  6428. }
  6429. var w = ~~ (d[0]);
  6430. var h = ~~ (d[1]);
  6431. if (mode == 2) {
  6432. w = ~~(d[1] / 0.7071 - this._layoutLabelHeight);
  6433. h = ~~(this._layoutLabelHeight / 0.7071);
  6434. } else if (mode == 1) {
  6435. var tmp = w;
  6436. w = h;
  6437. h = tmp;
  6438. }
  6439. var allowWrap = mode == 1;
  6440. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  6441. var hActual = ~~ (this._layoutLabelHeight * 1.2);
  6442. if (hActual > h) {
  6443. h = hActual;
  6444. }
  6445. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6446. if (mode == 0 && !isHorizontal) {
  6447. allowWrap = true;
  6448. }
  6449. }
  6450. var self = this;
  6451. var cellWidth = w;
  6452. var cellHeight = h;
  6453. this._textFlow.wrap(allowWrap).truncate(true).textTruncateIndicator(this._textTruncationIndicator != null ? this._textTruncationIndicator : "...").spacing(1.2).extent(function(data, index, groupIndex) {
  6454. var width = cellWidth;
  6455. var height = cellHeight;
  6456. if (mode == 2) {
  6457. var cellIndex = self.getStaggerIndex(this);
  6458. if (cellIndex != -1) {
  6459. width = ~~self.calculate45DegreeSpace(this, cellWidth);
  6460. }
  6461. } else if (mode == 3) {
  6462. var cellIndex = self.getStaggerIndex(this);
  6463. if (cellIndex != -1) {
  6464. if (cellIndex == 0 && cellIndex == self.getStaggerCount() - 1) {
  6465. width = cellWidth;
  6466. } else if (cellIndex == 0 || cellIndex == self.getStaggerCount() - 1) {
  6467. width = cellWidth * 3 / 2;
  6468. } else {
  6469. width = cellWidth * 2;
  6470. }
  6471. height = cellHeight / 2;
  6472. }
  6473. }
  6474. return [width, height];
  6475. });
  6476. g.selectAll("g.tick > text").call(this._textFlow);
  6477. }
  6478. },
  6479. /**
  6480. * <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>
  6481. * @param (rave['internal']['Selector']) g Selector group for axis
  6482. * @return (Array) The extent of the axis label bounds
  6483. */
  6484. /** @expose */
  6485. labelExtent : function(g) {
  6486. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6487. var w = this._bounds.width;
  6488. var h = this._bounds.height;
  6489. if (this._scale.scale().rangeBand) {
  6490. var rangeBandValue = + (this._scale.scale().rangeBand());
  6491. if (isHorizontal) {
  6492. w = rangeBandValue;
  6493. } else {
  6494. h = rangeBandValue;
  6495. }
  6496. }
  6497. this.calcTitleExtent(g);
  6498. if (isHorizontal) {
  6499. h -= this._axis.tickSize();
  6500. h -= this._padding / 2;
  6501. if (this._layoutTitleSize != 0) {
  6502. h -= this._layoutTitleSize;
  6503. h -= this._padding / 2;
  6504. }
  6505. } else {
  6506. w -= this._axis.tickSize();
  6507. w -= this._padding / 2;
  6508. if (this._layoutTitleSize != 0) {
  6509. w -= this._layoutTitleSize;
  6510. w -= this._padding / 2;
  6511. }
  6512. }
  6513. return [w, h];
  6514. },
  6515. calcTitleExtent : function(g) {
  6516. this._layoutTitleSize = 0;
  6517. var title = g.selectAll("text.axis-title");
  6518. if (title.size() > 0) {
  6519. var textHeight = title[0][0].getBBox().height;
  6520. this._layoutTitleSize = textHeight;
  6521. }
  6522. },
  6523. /**
  6524. * Set the role to one of the constants ROLE_X1 etc. defined in AxisComponent.
  6525. * @param (String) role The new role
  6526. * @return (com.ibm.rave.bundles.components.AxisComponentImpl) This object
  6527. */
  6528. /** @expose */
  6529. setRole : function(role) {
  6530. this._role = role;
  6531. return this;
  6532. },
  6533. /**
  6534. * Set the ticks interval on the scale based on the magnitude. tickMagnitude represents power of 10. null value gives the default scale ticks.
  6535. * @param (Number) tickMagnitude
  6536. * @return (com.ibm.rave.bundles.component.AxisComponent) this
  6537. */
  6538. /** @expose */
  6539. scaleTickMagnitude : function(tickMagnitude) {
  6540. this._tickMagnitude = tickMagnitude;
  6541. return this;
  6542. },
  6543. /**
  6544. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale The new scale
  6545. */
  6546. /** @expose */
  6547. scale : function(scale) {
  6548. this._scale = scale ? scale : null;
  6549. return this;
  6550. },
  6551. /**
  6552. * Only legal values are accepted, otherwise the orient is unchanged.
  6553. * @param (String) orient The new orient
  6554. */
  6555. orient$0 : function(orient) {
  6556. if ("left" == orient || "bottom" == orient || "right" == orient || "top" == orient) {
  6557. this._orient = orient;
  6558. if (this._role == null) {
  6559. if ("left" == orient) {
  6560. this._role = "ROLE_Y1";
  6561. } else if ("bottom" == orient) {
  6562. this._role = "ROLE_X1";
  6563. } else if ("right" == orient) {
  6564. this._role = "ROLE_Y2";
  6565. } else {
  6566. this._role = "ROLE_X2";
  6567. }
  6568. }
  6569. }
  6570. return this;
  6571. },
  6572. /**
  6573. * Returns the current orientation string return The current orient
  6574. */
  6575. orient$1 : function() {
  6576. return this._orient;
  6577. },
  6578. /**
  6579. * @param (rave['internal']['RectStruct']) bounds The new bounds
  6580. */
  6581. /** @expose */
  6582. bounds : function(bounds) {
  6583. this._bounds = bounds;
  6584. return this;
  6585. },
  6586. /** @expose */
  6587. elementRect : function(elementRect) {
  6588. this._elementRect = elementRect;
  6589. return this;
  6590. },
  6591. tickFormat$0 : function(tickFormat) {
  6592. this._tickFormat = tickFormat;
  6593. return this;
  6594. },
  6595. tickFormat$1 : function() {
  6596. return this._tickFormat;
  6597. },
  6598. simplifiedTickFormat$0 : function(tickFormat) {
  6599. this._simplifiedTickFormat = tickFormat;
  6600. return this;
  6601. },
  6602. simplifiedTickFormat$1 : function() {
  6603. return this._simplifiedTickFormat;
  6604. },
  6605. /** @expose */
  6606. displayAxisTitle : function(displayAxisTitle) {
  6607. this._displayAxisTitle = displayAxisTitle;
  6608. return this;
  6609. },
  6610. /** @expose */
  6611. displayAxisLine : function(displayAxisLine) {
  6612. this._displayAxisLine = displayAxisLine;
  6613. return this;
  6614. },
  6615. /** @expose */
  6616. displayTicks : function(displayTicks) {
  6617. this._displayTicks = displayTicks;
  6618. return this;
  6619. },
  6620. /** @expose */
  6621. displayTickLabels : function(displayTickLabels) {
  6622. this._displayTickLabels = displayTickLabels;
  6623. return this;
  6624. },
  6625. /** @expose */
  6626. allowAutomaticAxisLayoutToChangeOrientation : function(state) {
  6627. this._allowAutoAxisLayoutToChangeOrientaiton = state;
  6628. return this;
  6629. },
  6630. /** @expose */
  6631. isAllowAutomaticAxisLayoutToChangeOrientation : function() {
  6632. return this._allowAutoAxisLayoutToChangeOrientaiton;
  6633. },
  6634. /** @expose */
  6635. showPanZoomTickLabels : function(showPanZoomTickLabels) {
  6636. this._showPanZoomTickLabels = showPanZoomTickLabels;
  6637. return this;
  6638. },
  6639. /** @expose */
  6640. axisTitle : function(axisTitle) {
  6641. this._axisTitle = axisTitle;
  6642. return this;
  6643. },
  6644. /** @expose */
  6645. axisColor : function(axisColor) {
  6646. this._lineColor = axisColor;
  6647. this._tickColor = axisColor;
  6648. return this;
  6649. },
  6650. /** @expose */
  6651. lineColor : function(lineColor) {
  6652. this._lineColor = lineColor;
  6653. return this;
  6654. },
  6655. /** @expose */
  6656. tickColor : function(tickColor) {
  6657. this._tickColor = tickColor;
  6658. return this;
  6659. },
  6660. /** @expose */
  6661. labelColor : function(labelColor) {
  6662. this._labelStyle["fill"] = labelColor;
  6663. return this;
  6664. },
  6665. labelStyle$0 : function(fill, fontSize, fontFamily) {
  6666. this._labelStyle["fill"] = fill;
  6667. this._labelStyle["font-size"] = fontSize;
  6668. this._labelStyle["font-family"] = fontFamily;
  6669. return this;
  6670. },
  6671. /** @expose */
  6672. titleColor : function(titleColor) {
  6673. this._titleStyle["fill"] = titleColor;
  6674. return this;
  6675. },
  6676. titleStyle$0 : function(fill, fontSize, fontFamily) {
  6677. this._titleStyle["fill"] = fill;
  6678. this._titleStyle["font-size"] = fontSize;
  6679. this._titleStyle["font-family"] = fontFamily;
  6680. return this;
  6681. },
  6682. /**
  6683. * @param (int) padding The new padding
  6684. */
  6685. /** @expose */
  6686. padding : function(padding) {
  6687. this._padding = padding;
  6688. return this;
  6689. },
  6690. /**
  6691. * @param mode LayoutMode for axis, one of: null (numeric axis), automatic, horizontal, stagger, rotate45, rotate90
  6692. */
  6693. /** @expose */
  6694. layoutMode : function(layoutMode) {
  6695. this._layoutMode = -1;
  6696. if (layoutMode != null) {
  6697. if (layoutMode == "horizontal") {
  6698. this._layoutMode = 0;
  6699. } else if (layoutMode == "stagger") {
  6700. this._layoutMode = 3;
  6701. } else if (layoutMode == "rotate45") {
  6702. this._layoutMode = 2;
  6703. } else if (layoutMode == "rotate90") {
  6704. this._layoutMode = 1;
  6705. }
  6706. }
  6707. return this;
  6708. },
  6709. /**
  6710. * @param (boolean) allow Enable Stagger to be considered in the automatic layout algorithm
  6711. */
  6712. /** @expose */
  6713. allowStagger : function(allow) {
  6714. this._allowStagger = allow;
  6715. return this;
  6716. },
  6717. /**
  6718. * @param (boolean) allow Enable Rotate 45 to be considered in the automatic layout algorithm
  6719. */
  6720. /** @expose */
  6721. allowRotate45 : function(allow) {
  6722. this._allowRotate45 = allow;
  6723. return this;
  6724. },
  6725. /**
  6726. * @param (boolean) allow Enable Rotate 90 to be considered in the automatic layout algorithm
  6727. */
  6728. /** @expose */
  6729. allowRotate90 : function(allow) {
  6730. this._allowRotate90 = allow;
  6731. return this;
  6732. },
  6733. /**
  6734. * @return (boolean) True if on the last call the axis rendered shapes, false otherwise
  6735. */
  6736. renderedShapes : function() {
  6737. return this._renderedShapes;
  6738. },
  6739. labelStyle$1 : function(fontStyle) {
  6740. this._labelStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  6741. return this;
  6742. },
  6743. titleStyle$1 : function(fontStyle) {
  6744. this._titleStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  6745. return this;
  6746. },
  6747. /**
  6748. * Determines whether the axis is swapped.
  6749. * @return (boolean) True if axis is swapped
  6750. */
  6751. isAxisSwapped : function() {
  6752. 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")));
  6753. },
  6754. /**
  6755. * <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>
  6756. * @param (String) indicator the string to be placed to indicated truncated text
  6757. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  6758. */
  6759. /** @expose */
  6760. textTruncateIndicator : function(indicator) {
  6761. this._textTruncationIndicator = indicator;
  6762. return this;
  6763. },
  6764. /**
  6765. * If at least one label collision request is pending we stop the label collision component, and shut down the label collision timer event.
  6766. */
  6767. stopLabelDroppingUpdate : function() {
  6768. this._pendingLabelTimer = false;
  6769. },
  6770. /**
  6771. * 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.
  6772. * @param (rave['internal']['Selector']) labels the selection of valid labels for the end of the transition
  6773. * @param (double) duration of the transition. If 0, we don't do anything.
  6774. * @param (double) delay of the transition. Added to the duration to delay the updates.
  6775. */
  6776. updateLabelDropping : function(labels, duration, delay) {
  6777. var self = this;
  6778. var start = delay + duration;
  6779. var labelCollideCallback = function(elapsed) {
  6780. if (!self._pendingLabelTimer) {
  6781. return true;
  6782. }
  6783. labels.call(self._dropOverlap, self._hideOverlappingLabels);
  6784. if (elapsed >= start) {
  6785. self._pendingLabelTimer = false;
  6786. return true;
  6787. }
  6788. return false;
  6789. };
  6790. if (duration > 0) {
  6791. this._pendingLabelTimer = true;
  6792. rave.timer(labelCollideCallback, start);
  6793. }
  6794. },
  6795. doLabelWrappingAfterAnimation : function(g, labels, mode, duration, delay) {
  6796. this._layoutTimerId++;
  6797. var timerId = this._layoutTimerId;
  6798. var self = this;
  6799. var wrapCallback = function(elapsed) {
  6800. if (self._layoutTimerId == timerId) {
  6801. self.doLabelWrapping(g, mode);
  6802. self.handleLabelsRotationAndPosition(g, labels, mode);
  6803. }
  6804. return true;
  6805. };
  6806. rave.timer(wrapCallback, delay + duration);
  6807. },
  6808. /** @expose */
  6809. preLayout : function() {
  6810. this._layoutTitleSize = 0;
  6811. this._layoutLabelSize = 0;
  6812. this._layoutLabelHeight = 0;
  6813. this._layoutAverageDigitWidth = 0;
  6814. this._layoutSpillOver = 0;
  6815. },
  6816. /** @expose */
  6817. getSizableType : function() {
  6818. return this._scale.isOrdinal() || this._scale.isClustered() ? 1 : 0;
  6819. },
  6820. /** @expose */
  6821. getSizableOrientation : function() {
  6822. return this._orient;
  6823. },
  6824. /** @expose */
  6825. getPreferredSize : function() {
  6826. var layoutPaddingSize = 0;
  6827. if (this._axis) {
  6828. layoutPaddingSize = this._axis.tickSize();
  6829. if (this._layoutLabelSize != 0) {
  6830. layoutPaddingSize += this._padding / 2;
  6831. }
  6832. if (this._layoutTitleSize != 0) {
  6833. layoutPaddingSize += this._padding / 2;
  6834. }
  6835. }
  6836. return this._layoutLabelSize + this._layoutAverageDigitWidth + this._layoutTitleSize + layoutPaddingSize + 2;
  6837. },
  6838. /** @expose */
  6839. getSpillOverSize : function() {
  6840. return this._layoutSpillOver;
  6841. },
  6842. /** @expose */
  6843. orient : function(a0) {
  6844. var args = arguments;
  6845. if (args.length == 0) {
  6846. return this.orient$1();
  6847. }
  6848. return this.orient$0(a0);
  6849. },
  6850. /** @expose */
  6851. tickFormat : function(a0) {
  6852. var args = arguments;
  6853. if (args.length == 0) {
  6854. return this.tickFormat$1();
  6855. }
  6856. return this.tickFormat$0(a0);
  6857. },
  6858. /** @expose */
  6859. simplifiedTickFormat : function(a0) {
  6860. var args = arguments;
  6861. if (args.length == 0) {
  6862. return this.simplifiedTickFormat$1();
  6863. }
  6864. return this.simplifiedTickFormat$0(a0);
  6865. },
  6866. /** @expose */
  6867. labelStyle : function(a0, a1, a2) {
  6868. var args = arguments;
  6869. if (args.length == 1) {
  6870. return this.labelStyle$1(a0);
  6871. }
  6872. return this.labelStyle$0(a0, a1, a2);
  6873. },
  6874. /** @expose */
  6875. titleStyle : function(a0, a1, a2) {
  6876. var args = arguments;
  6877. if (args.length == 1) {
  6878. return this.titleStyle$1(a0);
  6879. }
  6880. return this.titleStyle$0(a0, a1, a2);
  6881. }
  6882. });
  6883. /**
  6884. * 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.
  6885. * @param (rave['internal']['RectStruct']) bounds Rectangle of the axis bounds
  6886. * @param (String) orient Orient, "top", "bottom", "left", "right"; if not valid, "bottom" used
  6887. * @return (double[]) Translation [x,y]
  6888. */
  6889. /** @expose */
  6890. com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation = function(bounds, orient) {
  6891. if ("left" == orient) {
  6892. return [bounds.x + bounds.width, 0.0];
  6893. }
  6894. if ("right" == orient) {
  6895. return [bounds.x, 0.0];
  6896. }
  6897. if ("top" == orient) {
  6898. return [0.0, bounds.y + bounds.height];
  6899. }
  6900. return [0.0, bounds.y];
  6901. };
  6902. com_ibm_rave_bundles_components_AxisComponentImpl.NodeIndex = rave['internal']['Declare']({
  6903. //_node : null,
  6904. _domainIndex : 0,
  6905. /** @expose */
  6906. constructor : function(node, domainIndex) {
  6907. this._node = node;
  6908. this._domainIndex = domainIndex;
  6909. },
  6910. /** @expose */
  6911. contains : function(node) {
  6912. return node == this._node;
  6913. },
  6914. /** @expose */
  6915. getIndex : function() {
  6916. return this._domainIndex;
  6917. }
  6918. });
  6919. /**
  6920. * Tick Handler for the axis. This will get called as the core axis is transitioned.
  6921. */
  6922. com_ibm_rave_bundles_components_AxisComponentImpl.AxisTickHandler = rave['internal']['Declare'](rave['internal']['AbstractTickHandler'], {
  6923. //_label : null,
  6924. //_tick : null,
  6925. _$functionClassMethod : function() {
  6926. var _$self = function(args) {
  6927. if (args !== null || arguments.length > 1){
  6928. args = Array.prototype.slice.call(arguments, 0);
  6929. }
  6930. {
  6931. _$self.handle(args[0]);
  6932. return null;
  6933. }
  6934. };
  6935. return _$self;
  6936. },
  6937. constructor : function(label, tick) {
  6938. this._label = label;
  6939. this._tick = tick;
  6940. },
  6941. /** @expose */
  6942. handle : function(ticks) {
  6943. ticks.call(this._tick);
  6944. ticks.call(this._label);
  6945. }
  6946. });
  6947. //com_ibm_rave_bundles_components_AxisComponentImpl.VISIBILITY = "visibility";
  6948. //com_ibm_rave_bundles_components_AxisComponentImpl.HIDDEN = "hidden";
  6949. /** @expose */
  6950. com_ibm_rave_bundles_components_AxisComponentImpl.LABEL_HIDDEN_FLAG = "__tickLabelHidden__";
  6951. /** @expose */
  6952. com_ibm_rave_bundles_components_AxisComponentImpl.PANZOOM_HIDDEN_FLAG = "__panZoomHidden__";
  6953. /** @expose */
  6954. com_ibm_rave_bundles_components_AxisComponentImpl.HIDDEN_COUNT = "__hiddenCount__";
  6955. /** @expose */
  6956. com_ibm_rave_bundles_components_AxisComponentImpl.PREFERRED_SPACE_PER_TICK = 20;
  6957. /** @expose */
  6958. com_ibm_rave_bundles_components_AxisComponentImpl.PREFERRED_TICK_COUNT = 10;
  6959. /** @expose */
  6960. com_ibm_rave_bundles_components_AxisComponentImpl.TICK_PADDING = 10;
  6961. //com_ibm_rave_bundles_components_AxisComponentImpl.HORIZONTAL_WEIGHT = 1.1;
  6962. com_ibm_rave_bundles_components_AxisComponentImpl.HORIZONTAL = 0;
  6963. com_ibm_rave_bundles_components_AxisComponentImpl.ROTATE90 = 1;
  6964. com_ibm_rave_bundles_components_AxisComponentImpl.ROTATE45 = 2;
  6965. com_ibm_rave_bundles_components_AxisComponentImpl.STAGGER = 3;
  6966. /**
  6967. * Constant used for text flow spacing
  6968. */
  6969. com_ibm_rave_bundles_components_AxisComponentImpl.TEXTFLOW_SPACING = 1.2;
  6970. /**
  6971. * Bottom axis orientation string.
  6972. */
  6973. /** @expose */
  6974. com_ibm_rave_bundles_components_AxisComponentImpl.BOTTOM_ORIENTATION = "bottom";
  6975. /**
  6976. * Top axis orientation string.
  6977. */
  6978. /** @expose */
  6979. com_ibm_rave_bundles_components_AxisComponentImpl.TOP_ORIENTATION = "top";
  6980. /**
  6981. * Left axis orientation string.
  6982. */
  6983. /** @expose */
  6984. com_ibm_rave_bundles_components_AxisComponentImpl.LEFT_ORIENTATION = "left";
  6985. /**
  6986. * Right axis orientation string.
  6987. */
  6988. /** @expose */
  6989. com_ibm_rave_bundles_components_AxisComponentImpl.RIGHT_ORIENTATION = "right";
  6990. com_ibm_rave_bundles_components_AxisComponentImpl.AUTOMODE = -1;
  6991. // $source: com/ibm/rave/bundles/components/GridComponentImpl
  6992. /************************************************************************
  6993. ** IBM Confidential
  6994. **
  6995. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6996. **
  6997. ** (C) Copyright IBM Corp. 2017
  6998. **
  6999. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7000. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7001. ************************************************************************/
  7002. // GENERATED
  7003. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  7004. //@import com/ibm/rave/bundles/components/StyleStructs (runtime) // new
  7005. //@import com/ibm/rave/bundles/component/GridComponent (runtime) // GridComponent
  7006. /**
  7007. * <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>
  7008. */
  7009. var com_ibm_rave_bundles_components_GridComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  7010. /**
  7011. * The axis property
  7012. */
  7013. //_axis : null,
  7014. /**
  7015. * Role, from the AxisComponent API
  7016. */
  7017. //_role : null,
  7018. /**
  7019. * The orientation
  7020. */
  7021. //_orient : null,
  7022. /**
  7023. * The bounds
  7024. */
  7025. //_bounds : null,
  7026. /**
  7027. * Style of gridlines
  7028. */
  7029. //_gridlineStyle : null,
  7030. /**
  7031. * Whether to display gridlines
  7032. */
  7033. _displayGridlines : false,
  7034. /**
  7035. * After calling the component, this is true if shapes were rendered, false if they were cleared.
  7036. */
  7037. _renderedShapes : false,
  7038. /**
  7039. * Construct, with all properties the defaults.
  7040. */
  7041. /** @expose */
  7042. constructor : function() {
  7043. this._axis = null;
  7044. this._role = null;
  7045. this._orient = "bottom";
  7046. this._bounds = null;
  7047. this._displayGridlines = true;
  7048. this._gridlineStyle = new com_ibm_rave_bundles_components_StyleStructs.LineStyle();
  7049. this._renderedShapes = false;
  7050. },
  7051. /** @expose */
  7052. type : function() {
  7053. return com_ibm_rave_bundles_component_GridComponent.COMPONENT_TYPE;
  7054. },
  7055. /** @expose */
  7056. role : function() {
  7057. return this._role;
  7058. },
  7059. /** @expose */
  7060. execute : function(g) {
  7061. this.preExecute();
  7062. if (!this._displayGridlines || !this._axis || !this._bounds) {
  7063. g.selectAll("*").remove();
  7064. this._renderedShapes = false;
  7065. return;
  7066. }
  7067. this._renderedShapes = true;
  7068. var size = ("bottom" == this._orient || "top" == this._orient) ? this._bounds.height : this._bounds.width;
  7069. var ticksHandler = this._axis.ticksHandler();
  7070. var tickSize = this._axis.tickSize();
  7071. var outerTickSize = this._axis.outerTickSize();
  7072. var tickFormat = this._axis.tickFormat();
  7073. var ax = this._axis.tickSize(-size, 0).tickFormat("").ticksHandler(null);
  7074. g.call(ax);
  7075. this._axis.tickSize(tickSize, outerTickSize).tickFormat(tickFormat).ticksHandler(ticksHandler);
  7076. g.selectAll("g.tick line").classed("grid-tick", true);
  7077. g.selectAll(".grid-tick").style("stroke", this._gridlineStyle._stroke).style("stroke-dasharray", (this._gridlineStyle._dashArray));
  7078. g.selectAll("path.domain").remove();
  7079. },
  7080. /**
  7081. * @param (rave['internal']['Axis']) axis The new axis
  7082. */
  7083. /** @expose */
  7084. axis : function(axis) {
  7085. this._axis = axis;
  7086. return this;
  7087. },
  7088. /**
  7089. * Set the role to one of the constants ROLE_X1 etc. defined in AxisComponent.
  7090. * @param (String) role The new role
  7091. * @return (com.ibm.rave.bundles.components.GridComponentImpl) This object
  7092. */
  7093. /** @expose */
  7094. setRole : function(role) {
  7095. this._role = role;
  7096. return this;
  7097. },
  7098. /**
  7099. * Only legal values are accepted, otherwise the orient is unchanged.
  7100. * @param (String) orient The new orient
  7101. */
  7102. orient$0 : function(orient) {
  7103. if ("left" == orient || "right" == orient || "bottom" == orient || "top" == orient) {
  7104. this._orient = orient;
  7105. }
  7106. return this;
  7107. },
  7108. /**
  7109. * @param (rave['internal']['RectStruct']) bounds The new bounds
  7110. */
  7111. /** @expose */
  7112. bounds : function(bounds) {
  7113. this._bounds = bounds;
  7114. return this;
  7115. },
  7116. displayGridlines$0 : function(displayGridlines) {
  7117. this._displayGridlines = displayGridlines;
  7118. return this;
  7119. },
  7120. /** @expose */
  7121. gridlineStyle : function(gridlineColor, dashArray) {
  7122. this.gridlineColor(gridlineColor);
  7123. this.dashArray(dashArray);
  7124. return this;
  7125. },
  7126. gridlineColor$0 : function(gridlineColor) {
  7127. this._gridlineStyle._stroke = (gridlineColor != null && gridlineColor.length > 0) ? gridlineColor : null;
  7128. return this;
  7129. },
  7130. dashArray$0 : function(dashArray) {
  7131. this._gridlineStyle._dashArray = (dashArray != null && dashArray.length > 0) ? dashArray : null;
  7132. return this;
  7133. },
  7134. /**
  7135. * @return (String) The orientation of the gridline.
  7136. */
  7137. orient$1 : function() {
  7138. return this._orient;
  7139. },
  7140. displayGridlines$1 : function() {
  7141. return this._displayGridlines;
  7142. },
  7143. gridlineColor$1 : function() {
  7144. return this._gridlineStyle._stroke;
  7145. },
  7146. dashArray$1 : function() {
  7147. return this._gridlineStyle._dashArray;
  7148. },
  7149. /**
  7150. * @return (boolean) True if on the last call the axis rendered shapes, false otherwise
  7151. */
  7152. renderedShapes : function() {
  7153. return this._renderedShapes;
  7154. },
  7155. /** @expose */
  7156. orient : function(a0) {
  7157. var args = arguments;
  7158. if (args.length == 0) {
  7159. return this.orient$1();
  7160. }
  7161. return this.orient$0(a0);
  7162. },
  7163. /** @expose */
  7164. displayGridlines : function(a0) {
  7165. var args = arguments;
  7166. if (args.length == 0) {
  7167. return this.displayGridlines$1();
  7168. }
  7169. return this.displayGridlines$0(a0);
  7170. },
  7171. /** @expose */
  7172. gridlineColor : function(a0) {
  7173. var args = arguments;
  7174. if (args.length == 0) {
  7175. return this.gridlineColor$1();
  7176. }
  7177. return this.gridlineColor$0(a0);
  7178. },
  7179. /** @expose */
  7180. dashArray : function(a0) {
  7181. var args = arguments;
  7182. if (args.length == 0) {
  7183. return this.dashArray$1();
  7184. }
  7185. return this.dashArray$0(a0);
  7186. }
  7187. });
  7188. // $source: com/ibm/rave/bundles/components/KeyedBundleComponentImpl
  7189. /************************************************************************
  7190. ** IBM Confidential
  7191. **
  7192. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7193. **
  7194. ** (C) Copyright IBM Corp. 2017
  7195. **
  7196. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7197. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7198. ************************************************************************/
  7199. // GENERATED
  7200. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  7201. /**
  7202. * 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.
  7203. * @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>
  7204. */
  7205. var com_ibm_rave_bundles_components_KeyedBundleComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  7206. //keyFunction : null,
  7207. /**
  7208. * Set the key function this component should use when joining data to scene nodes.
  7209. * @param (rave['internal']['SingleValueFunction']) keyFunction This function will be passed each datum individually and must return a unique value (a key).
  7210. * @return (com.ibm.rave.bundles.components.KeyedBundleComponentImpl) This.
  7211. */
  7212. /** @expose */
  7213. key : function(keyFunction) {
  7214. this.keyFunction = keyFunction;
  7215. return this;
  7216. },
  7217. /**
  7218. * Returns a {@link (rave['internal']['ValueFunction']) ValueFunction} that wraps the provided key function.
  7219. */
  7220. /** @expose */
  7221. getKey : function() {
  7222. if (!this.keyFunction) {
  7223. return null;
  7224. }
  7225. var self = this;
  7226. return function(datum, index, groupIndex) {
  7227. return self.keyFunction(datum);
  7228. };
  7229. }
  7230. });
  7231. // $source: com/ibm/rave/bundles/components/TreemapComponentImpl
  7232. /************************************************************************
  7233. ** IBM Confidential
  7234. **
  7235. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7236. **
  7237. ** (C) Copyright IBM Corp. 2017
  7238. **
  7239. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7240. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7241. ************************************************************************/
  7242. // GENERATED
  7243. //@import com/ibm/rave/bundles/components/KeyedBundleComponentImpl (loadtime) // superclass
  7244. //@import com/ibm/rave/bundles/component/TreemapComponent (runtime) // TreemapComponent
  7245. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor
  7246. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  7247. //@import com/ibm/rave/bundles/utilities/LabelStyleUtil (runtime) // new
  7248. var com_ibm_rave_bundles_components_TreemapComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_KeyedBundleComponentImpl, {
  7249. /**
  7250. * Data
  7251. */
  7252. //_data : null,
  7253. /**
  7254. * Color scale
  7255. */
  7256. //_colorPalette : null,
  7257. //_labelAccessor : null,
  7258. //_labelFormatter : null,
  7259. //_sizeBy : null,
  7260. //_bounds : null,
  7261. //_mode : null,
  7262. //_titleAccessor : null,
  7263. //_sort : null,
  7264. //_borderColor : null,
  7265. //_labelStyle : null,
  7266. //_treemapNodeAccessor : null,
  7267. //_labelData : null,
  7268. //_sizeAccessor : null,
  7269. //_labelStyleUtil : null,
  7270. _itemLabel : false,
  7271. _leadLabel : false,
  7272. _borderWidth : 0,
  7273. _maxLevel : 0,
  7274. _previousDataSize : 0,
  7275. _itemLabelLevel : 0,
  7276. _labelContrast : false,
  7277. _labelShadow : false,
  7278. constructor : function() {
  7279. this._treemapNodeAccessor = com_ibm_rave_bundles_components_TreemapComponentImpl.DEFAULT_TREEMAPNODE_ACCESSOR;
  7280. /**
  7281. * Initialize all properties to default values.
  7282. */
  7283. {
  7284. this._colorPalette = null;
  7285. this._sizeBy = "count";
  7286. this._labelAccessor = null;
  7287. this._labelFormatter = null;
  7288. this._labelContrast = false;
  7289. this._labelShadow = false;
  7290. this._bounds = null;
  7291. this._mode = "squarify";
  7292. this._itemLabel = true;
  7293. this._itemLabelLevel = 1;
  7294. this._leadLabel = false;
  7295. this._labelStyle = {};
  7296. this._sort = "none";
  7297. this._previousDataSize = 1;
  7298. this._borderWidth = 1;
  7299. this._borderColor = null;
  7300. this._labelStyleUtil = new com_ibm_rave_bundles_utilities_LabelStyleUtil();
  7301. }
  7302. },
  7303. /** @expose */
  7304. type : function() {
  7305. return com_ibm_rave_bundles_component_TreemapComponent.COMPONENT_TYPE;
  7306. },
  7307. /** @expose */
  7308. buildLayout : function() {
  7309. var self = this;
  7310. var treemap = rave.layout.treemap().size([~~ (this._bounds.width), ~~ (this._bounds.height)]).sticky(true).mode(this._mode).padding(0);
  7311. treemap.value(function(node, depth) {
  7312. return "size" == self._sizeBy ? self._sizeAccessor(node["data"]) : 1;
  7313. });
  7314. treemap.sort(this._sort == "none" ? function(a, b) {
  7315. var val = (a)["_index"] - (b)["_index"];
  7316. return val == 0 ? 0 : val < 0 ? 1 : -1;
  7317. } : function(a, b) {
  7318. var val = (a["value"] - b["value"]);
  7319. if (self._sort == "descending") {
  7320. return val == 0 ? 0 : val > 0 ? 1 : -1;
  7321. } else {
  7322. return val == 0 ? 0 : val < 0 ? 1 : -1;
  7323. }
  7324. });
  7325. return treemap;
  7326. },
  7327. /** @expose */
  7328. execute : function(g) {
  7329. this.preExecute();
  7330. if (!this._data || this._data.length == 0) {
  7331. g.selectAll("*").remove();
  7332. return;
  7333. }
  7334. var cleared = this.preprocessForLargeData(g);
  7335. var initialTranslate = "translate(0," + this._bounds.height / 2 + ")";
  7336. var node = g.selectAll(".nodes").data([0]);
  7337. node.enter().append("g").attr("class", "nodes");
  7338. var cell = node.selectAll(".cell").data(this._data, this.getKey() ? this.getKey() : com_ibm_rave_bundles_components_TreemapComponentImpl.defaultKeyFunction);
  7339. var cellEnter = cell.enter().insert("g").attr("class", "cell").classed("element-shape", true);
  7340. cellEnter.append("rect").attr("transform", initialTranslate).attr("width", 0).attr("height", 0);
  7341. if (!cleared) {
  7342. cell.order();
  7343. }
  7344. this._maxLevel = 1;
  7345. for (var __i_enFor0 = 0, __exp_enFor0 = this._data, __len_enFor0 = __exp_enFor0.length;
  7346. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7347. var o = __exp_enFor0[__i_enFor0];
  7348. this._maxLevel = Math.max(this._maxLevel, this._treemapNodeAccessor(o)["depth"]);
  7349. }
  7350. var self = this;
  7351. cell.select("rect").attr("class", this.nodeClass());
  7352. cell.select(".empty").attr("width", 0).attr("height", 0);
  7353. rave.transition(cell.select(".valid")).style("fill", this.nodeColor()).style("stroke", this._borderColor).style("stroke-width", function(data, index, groupIndex) {
  7354. return ((self._maxLevel - self._treemapNodeAccessor(data)["depth"]) * 2 + self._borderWidth) + "px";
  7355. }).attr("transform", this.translate()).attr("width", function(data, index, groupIndex) {
  7356. return self._treemapNodeAccessor(data)["dx"];
  7357. }).attr("height", function(data, index, groupIndex) {
  7358. return self._treemapNodeAccessor(data)["dy"];
  7359. });
  7360. rave.transition(cell.exit().select(".rect")).attr("width", 0).attr("height", 0).remove();
  7361. rave.transition(cell.exit()).remove();
  7362. var labels = g.selectAll(".labels").data([1]);
  7363. labels.enter().append("g").attr("class", "labels");
  7364. if (!this._itemLabel) {
  7365. labels.selectAll("*").remove();
  7366. } else {
  7367. this.drawLabels(labels);
  7368. }
  7369. },
  7370. drawLabels : function(labels) {
  7371. var self = this;
  7372. var label = labels.selectAll("g").data(this._labelData ? this._labelData : this._data, this.getKey() ? this.getKey() : com_ibm_rave_bundles_components_TreemapComponentImpl.defaultKeyFunction);
  7373. var initialTranslate = "translate(0," + this._bounds.height / 2 + ")";
  7374. if (this._itemLabelLevel > this._maxLevel) {
  7375. this._itemLabelLevel = this._maxLevel;
  7376. }
  7377. var labelEnter = label.enter().append("g").attr("transform", initialTranslate);
  7378. labelEnter.append("text").style("font-size", "1px");
  7379. label.attr("class", this.labelClass());
  7380. var emptyLabels = labels.selectAll(".empty");
  7381. emptyLabels.select("text").text("");
  7382. var labelText = !this._labelFormatter ? this._labelAccessor : function(data, index, groupIndex) {
  7383. var v = !self._labelAccessor ? null : self._labelAccessor.call(this, data, index, groupIndex);
  7384. return v == null ? null : self._labelFormatter.call(this, v, index, groupIndex);
  7385. };
  7386. var fontChecker = rave.capabilities.extension("fontchecker");
  7387. var validLabel = labels.selectAll(".label");
  7388. rave.transition(validLabel).attr("transform", this.translate());
  7389. var text = validLabel.select("text");
  7390. var labelColor = this.getDefaultLabelColor(this._labelStyle);
  7391. text.text(labelText).attr("width", function(data, index, groupIndex) {
  7392. return Math.max(0, self._treemapNodeAccessor(data)["dx"] - (com_ibm_rave_bundles_components_TreemapComponentImpl.TEXT_PADDING["left"] + com_ibm_rave_bundles_components_TreemapComponentImpl.TEXT_PADDING["right"]));
  7393. }).attr("height", function(data, index, groupIndex) {
  7394. return Math.max(0, self._treemapNodeAccessor(data)["dy"] - (com_ibm_rave_bundles_components_TreemapComponentImpl.TEXT_PADDING["top"] + com_ibm_rave_bundles_components_TreemapComponentImpl.TEXT_PADDING["bottom"]));
  7395. }).attr("y", function(data, index, groupIndex) {
  7396. var node = self._treemapNodeAccessor(data);
  7397. if (self._leadLabel == true) {
  7398. if (node["depth"] == 1) {
  7399. return ((self._maxLevel - node["depth"]) * 2 + self._borderWidth) + 14 + "px";
  7400. } else if (node["depth"] == 2 || node["depth"] == self._itemLabelLevel - 1) {
  7401. return Math.round(node["dy"] - 10) + "px";
  7402. } else if (node["depth"] == self._itemLabelLevel) {
  7403. return Math.round(node["dy"] / 2) + "px";
  7404. }
  7405. }
  7406. return ((self._maxLevel - node["depth"]) * 2 + self._borderWidth) + 14 + "px";
  7407. }).attr("x", function(data, index, groupIndex) {
  7408. var node = self._treemapNodeAccessor(data);
  7409. var borderwidth = ((self._maxLevel - node["depth"]) * 2 + self._borderWidth);
  7410. if (self._leadLabel == true) {
  7411. if (node["depth"] == self._itemLabelLevel && self._itemLabelLevel > 2 && self._leadLabel) {
  7412. return Math.round(node["dx"] - borderwidth - 2) + "px";
  7413. }
  7414. return borderwidth + 2 + "px";
  7415. }
  7416. return borderwidth + 2 + "px";
  7417. }).attr("text-anchor", function(data, index, groupIndex) {
  7418. if (self._leadLabel == true) {
  7419. var node = self._treemapNodeAccessor(data);
  7420. if (node["depth"] == self._itemLabelLevel && self._itemLabelLevel > 2 && self._leadLabel) {
  7421. return "end";
  7422. }
  7423. }
  7424. return "start";
  7425. });
  7426. text.call(fontChecker);
  7427. var textflow = rave.capabilities.extension("textflow");
  7428. textflow.wrap(false).fit(false).padding(0, 0, 0, 0).truncate(true).alignment("left");
  7429. text.call(textflow);
  7430. this._labelStyleUtil.labelFont(this._labelStyle).labelFontSize(function(data, index, groupIndex) {
  7431. var fontPixel = (self._labelStyle && self._labelStyle["font-size"] != null) ? (self._labelStyle["font-size"]) : "14px";
  7432. if (self._leadLabel == true && self._itemLabelLevel > 1) {
  7433. var fontsize = ~~(rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(fontPixel, 100.0, 10.0));
  7434. var node = self._treemapNodeAccessor(data);
  7435. if (node["depth"] == self._itemLabelLevel && self._itemLabelLevel > 2) {
  7436. return (fontsize - 4 <= 0) ? fontPixel : fontsize - 4 + "px";
  7437. } else if (node["depth"] == 1) {
  7438. return fontPixel;
  7439. }
  7440. return (fontsize - 2 <= 0) ? fontPixel : fontsize - 2 + "px";
  7441. }
  7442. return fontPixel;
  7443. }).labelFillColor(this._labelContrast ? function(data, index, groupIndex) {
  7444. if (!self._colorPalette) {
  7445. return labelColor;
  7446. }
  7447. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(self._colorPalette.call(null, data, index, groupIndex), labelColor).toString();
  7448. } : function(data, index, groupIndex) {
  7449. return labelColor;
  7450. }).labelShadow(this._labelShadow);
  7451. text.call(this._labelStyleUtil);
  7452. rave.transition(label.exit().select("text")).style("fill-opacity", 1e-6).remove();
  7453. rave.transition(label.exit()).remove();
  7454. },
  7455. preprocessForLargeData : function(g) {
  7456. var cleared = false;
  7457. if (Math.min(this._previousDataSize, this._data.length) >= 3000) {
  7458. if (Math.max(this._previousDataSize, this._data.length) / Math.min(this._previousDataSize, this._data.length) >= 2) {
  7459. g.selectAll("*").remove();
  7460. cleared = true;
  7461. }
  7462. } else if (Math.max(this._previousDataSize, this._data.length) >= 10000) {
  7463. if (Math.max(this._previousDataSize, this._data.length) / Math.min(this._previousDataSize, this._data.length) >= 5) {
  7464. g.selectAll("*").remove();
  7465. cleared = true;
  7466. }
  7467. }
  7468. this._previousDataSize = this._data.length;
  7469. return cleared;
  7470. },
  7471. labelClass : function() {
  7472. var self = this;
  7473. return function(d, index, groupIndex) {
  7474. if (!self._labelAccessor) {
  7475. return "empty";
  7476. }
  7477. var v = (self._labelAccessor.call(null, d, 0, 0));
  7478. if (v == null || v.trim().length == 0) {
  7479. return "empty";
  7480. }
  7481. if (self._treemapNodeAccessor(d)["dx"] < 5 + com_ibm_rave_bundles_components_TreemapComponentImpl.TEXT_PADDING["left"] + com_ibm_rave_bundles_components_TreemapComponentImpl.TEXT_PADDING["right"]) {
  7482. return "empty";
  7483. }
  7484. if (self._treemapNodeAccessor(d)["dy"] < 5 + com_ibm_rave_bundles_components_TreemapComponentImpl.TEXT_PADDING["top"] + com_ibm_rave_bundles_components_TreemapComponentImpl.TEXT_PADDING["bottom"]) {
  7485. return "empty";
  7486. }
  7487. return "label";
  7488. };
  7489. },
  7490. nodeClass : function() {
  7491. var self = this;
  7492. return function(d, index, groupIndex) {
  7493. if (self.outsideBounds(d)) {
  7494. return "empty rect";
  7495. }
  7496. return self._mode == "squarify" ? "valid rect squarify" : "valid rect";
  7497. };
  7498. },
  7499. nodeColor : function() {
  7500. var self = this;
  7501. return function(d, index, groupIndex) {
  7502. var v = self._colorPalette.call(null, d, 0, 0);
  7503. if (self._treemapNodeAccessor(d)["children"]) {
  7504. return "transparent";
  7505. }
  7506. return v != null ? v : "transparent";
  7507. };
  7508. },
  7509. outsideBounds : function(d) {
  7510. var node = this._treemapNodeAccessor(d);
  7511. return node["x"] + this._bounds.x < 0 || node["x"] > this._bounds.width || node["y"] + this._bounds.y < 0 || node["y"] > this._bounds.height;
  7512. },
  7513. translate : function() {
  7514. var self = this;
  7515. return function(data, index, groupIndex) {
  7516. var node = self._treemapNodeAccessor(data);
  7517. return "translate(" + (node["x"] + self._bounds.x) + "," + (node["y"] + self._bounds.y) + ")";
  7518. };
  7519. },
  7520. /** @expose */
  7521. data : function(data) {
  7522. this._data = data;
  7523. return this;
  7524. },
  7525. /** @expose */
  7526. colorPalette : function(colorPalette) {
  7527. this._colorPalette = colorPalette;
  7528. return this;
  7529. },
  7530. /** @expose */
  7531. squareSizeBy : function(sizeBy) {
  7532. this._sizeBy = sizeBy;
  7533. return this;
  7534. },
  7535. /** @expose */
  7536. labelAccessor : function(labelAccessor) {
  7537. this._labelAccessor = labelAccessor;
  7538. return this;
  7539. },
  7540. /** @expose */
  7541. labelFormatter : function(labelFormatter) {
  7542. this._labelFormatter = labelFormatter;
  7543. return this;
  7544. },
  7545. /** @expose */
  7546. bounds : function(bounds) {
  7547. this._bounds = bounds;
  7548. return this;
  7549. },
  7550. /** @expose */
  7551. mode : function(mode) {
  7552. this._mode = mode;
  7553. return this;
  7554. },
  7555. /**
  7556. * set whether to show labels or not..
  7557. */
  7558. /** @expose */
  7559. itemLabel : function(itemLabel) {
  7560. this._itemLabel = itemLabel;
  7561. return this;
  7562. },
  7563. /**
  7564. * set the level which need to show labels.
  7565. */
  7566. /** @expose */
  7567. itemLabelLevel : function(labelLevel) {
  7568. this._itemLabelLevel = labelLevel;
  7569. return this;
  7570. },
  7571. /**
  7572. * set whether to show parent level labels or not.
  7573. */
  7574. /** @expose */
  7575. leadLabel : function(leadLabel) {
  7576. this._leadLabel = leadLabel;
  7577. return this;
  7578. },
  7579. /**
  7580. * Sets the font for the itemlabel.
  7581. */
  7582. /** @expose */
  7583. labelFont : function(fontStyle) {
  7584. this._labelStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  7585. return this;
  7586. },
  7587. /** @expose */
  7588. titleAccessor : function(titleAccessor) {
  7589. this._titleAccessor = titleAccessor;
  7590. return this;
  7591. },
  7592. /** @expose */
  7593. sort : function(order) {
  7594. this._sort = order;
  7595. return this;
  7596. },
  7597. /**
  7598. * Set the accessor function to retrieve a TreemapNode from the data object provided to {@link #this.data(Array)} . The defaults to the identity function: <pre> function(d) { return d; }; </pre>
  7599. */
  7600. /** @expose */
  7601. treemapNodeAccessor : function(accessor) {
  7602. this._treemapNodeAccessor = accessor;
  7603. return this;
  7604. },
  7605. /** @expose */
  7606. labelData : function(labelData) {
  7607. this._labelData = labelData;
  7608. return this;
  7609. },
  7610. /** @expose */
  7611. sizeAccessor : function(sizeAccessor) {
  7612. this._sizeAccessor = sizeAccessor;
  7613. return this;
  7614. },
  7615. /** @expose */
  7616. borderWidth : function(_borderWidth) {
  7617. this._borderWidth = _borderWidth;
  7618. return this;
  7619. },
  7620. /** @expose */
  7621. borderColor : function(borderColor) {
  7622. this._borderColor = borderColor;
  7623. return this;
  7624. },
  7625. /** @expose */
  7626. labelContrast : function(labelContrast) {
  7627. this._labelContrast = labelContrast;
  7628. return this;
  7629. },
  7630. /** @expose */
  7631. labelShadow : function(labelShadow) {
  7632. this._labelShadow = labelShadow;
  7633. return this;
  7634. }
  7635. });
  7636. com_ibm_rave_bundles_components_TreemapComponentImpl.getPadding = function() {
  7637. var p = {};
  7638. p["left"] = 3;
  7639. p["top"] = 5;
  7640. p["bottom"] = 1;
  7641. p["right"] = 0;
  7642. return p;
  7643. };
  7644. /** @expose */
  7645. com_ibm_rave_bundles_components_TreemapComponentImpl.SIZEBY_SIZE = "size";
  7646. /** @expose */
  7647. com_ibm_rave_bundles_components_TreemapComponentImpl.SIZEBY_COUNT = "count";
  7648. /** @expose */
  7649. com_ibm_rave_bundles_components_TreemapComponentImpl.MODE_SQUARIFY = "squarify";
  7650. /** @expose */
  7651. com_ibm_rave_bundles_components_TreemapComponentImpl.MODE_SLICE = "slice";
  7652. /** @expose */
  7653. com_ibm_rave_bundles_components_TreemapComponentImpl.MODE_DICE = "dice";
  7654. /** @expose */
  7655. com_ibm_rave_bundles_components_TreemapComponentImpl.MODE_SLICE_DICE = "slice-dice";
  7656. /** @expose */
  7657. com_ibm_rave_bundles_components_TreemapComponentImpl.SORT_NONE = "none";
  7658. /** @expose */
  7659. com_ibm_rave_bundles_components_TreemapComponentImpl.SORT_ASCENDING = "ascending";
  7660. /** @expose */
  7661. com_ibm_rave_bundles_components_TreemapComponentImpl.SORT_DESCENDING = "descending";
  7662. /** @expose */
  7663. com_ibm_rave_bundles_components_TreemapComponentImpl.TEXT_PADDING = com_ibm_rave_bundles_components_TreemapComponentImpl.getPadding();
  7664. com_ibm_rave_bundles_components_TreemapComponentImpl.defaultKeyFunction = function(data, index, groupIndex) {
  7665. return index;
  7666. };
  7667. com_ibm_rave_bundles_components_TreemapComponentImpl.DEFAULT_TREEMAPNODE_ACCESSOR = function(data) {
  7668. return data;
  7669. };
  7670. // $source: com/ibm/rave/bundles/components/FilterComponentImpl
  7671. /************************************************************************
  7672. ** IBM Confidential
  7673. **
  7674. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7675. **
  7676. ** (C) Copyright IBM Corp. 2017
  7677. **
  7678. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7679. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7680. ************************************************************************/
  7681. // GENERATED
  7682. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  7683. var com_ibm_rave_bundles_components_FilterComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  7684. //_id : null,
  7685. //color : null,
  7686. offset_x : 0,
  7687. offset_y : 0,
  7688. blur_radius : 0,
  7689. /** @expose */
  7690. constructor : function(id) {
  7691. this._id = id;
  7692. },
  7693. /** @expose */
  7694. setDropshadow : function(offset_x, offset_y, radius, rgb) {
  7695. this.offset_x = this.getValue(offset_x);
  7696. this.offset_y = this.getValue(offset_y);
  7697. this.blur_radius = this.getValue(radius);
  7698. this.color = rgb;
  7699. },
  7700. getValue : function(s) {
  7701. if (s == null) {
  7702. return 0;
  7703. }
  7704. return + (s.substring(0, s.length - 2));
  7705. },
  7706. /** @expose */
  7707. execute : function(g) {
  7708. var s = g.selectAll("#" + this._id).data([0]);
  7709. var filter = s.enter().append("filter").attr("id", this._id).attr("height", "500%").attr("width", "500%");
  7710. filter.append("feGaussianBlur").attr("in", "SourceAlpha");
  7711. filter.append("feOffset").attr("result", "offsetBlur");
  7712. filter.append("feFlood");
  7713. filter.append("feComposite").attr("in2", "offsetBlur").attr("operator", "in");
  7714. var merge = filter.append("feMerge");
  7715. merge.append("feMergeNode");
  7716. merge.append("feMergeNode").attr("in", "SourceGraphic");
  7717. s.select("feGaussianBlur").attr("stdDeviation", this.blur_radius);
  7718. s.select("feOffset").attr("dx", this.offset_x).attr("dy", this.offset_y);
  7719. s.select("feFlood").attr("flood-color", !this.color ? "black" : this.color);
  7720. },
  7721. /** @expose */
  7722. type : function() {
  7723. return "FilterComponent";
  7724. },
  7725. /** @expose */
  7726. getId : function() {
  7727. return this._id;
  7728. }
  7729. });
  7730. // $source: com/ibm/rave/bundles/components/BreadcrumbComponentImpl
  7731. /************************************************************************
  7732. ** IBM Confidential
  7733. **
  7734. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7735. **
  7736. ** (C) Copyright IBM Corp. 2017
  7737. **
  7738. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7739. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7740. ************************************************************************/
  7741. // GENERATED
  7742. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  7743. //@import com/ibm/rave/bundles/component/BreadcrumbComponent (runtime) // BreadcrumbComponent
  7744. var com_ibm_rave_bundles_components_BreadcrumbComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  7745. //_bounds : null,
  7746. //_data : null,
  7747. //_cacheWidth : null,
  7748. _xPos : 0,
  7749. /** @expose */
  7750. constructor : function() {
  7751. this._bounds = null;
  7752. this._data = null;
  7753. this._xPos = 0;
  7754. this._cacheWidth = null;
  7755. },
  7756. /** @expose */
  7757. execute : function(g) {
  7758. this.preExecute();
  7759. if (!this._data || this._data.length == 0) {
  7760. g.selectAll("*").remove();
  7761. return;
  7762. }
  7763. var self = this;
  7764. var indicator = g.selectAll("text").data(this._data);
  7765. indicator.enter().append("text").attr("class", function(data, index, groupIndex) {
  7766. return (""+(data)) == ">" ? "direction" : "indicator";
  7767. });
  7768. indicator.attr("y", this._bounds.y + this._bounds.height).text(function(data, index, groupIndex) {
  7769. return data;
  7770. });
  7771. this._cacheWidth = [];
  7772. indicator.each(function(data, index, groupIndex) {
  7773. self._cacheWidth[index] = this.getBBox().width;
  7774. });
  7775. this._xPos = this._bounds.x;
  7776. indicator.attr("x", function(data, index, groupIndex) {
  7777. var result = self._xPos;
  7778. self._xPos += self._cacheWidth[index] + 13;
  7779. return result;
  7780. });
  7781. rave.transition(indicator.exit()).style("fill-opacity", 1e-6).remove();
  7782. },
  7783. /** @expose */
  7784. type : function() {
  7785. return com_ibm_rave_bundles_component_BreadcrumbComponent.COMPONENT_TYPE;
  7786. },
  7787. /** @expose */
  7788. bounds : function(bounds) {
  7789. this._bounds = bounds;
  7790. return this;
  7791. },
  7792. /** @expose */
  7793. data : function(data) {
  7794. this._data = data;
  7795. return this;
  7796. }
  7797. });
  7798. /** @expose */
  7799. com_ibm_rave_bundles_components_BreadcrumbComponentImpl.DIRECTION = ">";
  7800. })();
  7801. },{"./configuration/configuration.json":1,"./i18n/messages_en.json":2,"./vizlibrary-treemap.css":4,"./vizlibrary.css":5}],4:[function(require,module,exports){
  7802. var css = "/************************************************************************\n ** IBM Confidential\n ** \n ** OCO Source Materials\n **\n ** IBM Business Analytics: Rapidly Adaptive Visualization Engine\n **\n ** (C) Copyright IBM Corp. 2017\n **\n ** The source code for this program is not published or otherwise divested of its trade secrets, \n ** irrespective of what has been deposited with the U.S. Copyright Office.\n ************************************************************************/\n.vizlibrary-treemap .rect.squarify {\n stroke: white;\n}\n.vizlibrary-treemap .rect {\n stroke: white;\n}\n.vizlibrary-treemap .labels text {\n font-weight: 400;\n fill: black;\n}\n.vizlibrary-treemap g.label {\n pointer-events: none;\n}\n.vizlibrary-treemap .indicator {\n font-weight: 500;\n font-size: 14px;\n fill: #3c4646;\n text-anchor: start;\n cursor: pointer;\n}\n.vizlibrary-treemap .direction {\n font-weight: 500;\n font-size: 14px;\n fill: #3c4646;\n text-anchor: start;\n cursor: pointer;\n}\n"; (require("browserify-css").createStyle(css, { "href": "dist/bundles/rave-library-treemap/node/rave-library-treemap/vizlibrary-treemap.css"})); module.exports = css;
  7803. },{"browserify-css":6}],5:[function(require,module,exports){
  7804. 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-treemap/node/rave-library-treemap/vizlibrary.css"})); module.exports = css;
  7805. },{"browserify-css":6}],6:[function(require,module,exports){
  7806. 'use strict';
  7807. // For more information about browser field, check out the browser field at https://github.com/substack/browserify-handbook#browser-field.
  7808. module.exports = {
  7809. // Create a <link> tag with optional data attributes
  7810. createLink: function(href, attributes) {
  7811. var head = document.head || document.getElementsByTagName('head')[0];
  7812. var link = document.createElement('link');
  7813. link.href = href;
  7814. link.rel = 'stylesheet';
  7815. for (var key in attributes) {
  7816. if ( ! attributes.hasOwnProperty(key)) {
  7817. continue;
  7818. }
  7819. var value = attributes[key];
  7820. link.setAttribute('data-' + key, value);
  7821. }
  7822. head.appendChild(link);
  7823. },
  7824. // Create a <style> tag with optional data attributes
  7825. createStyle: function(cssText, attributes) {
  7826. var head = document.head || document.getElementsByTagName('head')[0],
  7827. style = document.createElement('style');
  7828. style.type = 'text/css';
  7829. for (var key in attributes) {
  7830. if ( ! attributes.hasOwnProperty(key)) {
  7831. continue;
  7832. }
  7833. var value = attributes[key];
  7834. style.setAttribute('data-' + key, value);
  7835. }
  7836. if (style.sheet) { // for jsdom and IE9+
  7837. style.innerHTML = cssText;
  7838. style.sheet.cssText = cssText;
  7839. head.appendChild(style);
  7840. } else if (style.styleSheet) { // for IE8 and below
  7841. head.appendChild(style);
  7842. style.styleSheet.cssText = cssText;
  7843. } else { // for Chrome, Firefox, and Safari
  7844. style.appendChild(document.createTextNode(cssText));
  7845. head.appendChild(style);
  7846. }
  7847. }
  7848. };
  7849. },{}]},{},[3]);
  7850. return rave.library.bundle.extension('treemapBundle');
  7851. }));