rave-library-wordcloud.js 312 KB

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