rave-library-heatmap.js 360 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799
  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.raveLibraryHeatmap = 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_heatmap_small.png","tags":["small","notext"]}],"svg":[{"file":"resources\/preview_heatmap_small.svg","tags":["small","notext"]}]},"genericMeta":{"copyright":"IBM 2015, 2016","author":"IBM (TM)","description":"heatmap.description","id":"rave-library-heatmap","label":"heatmap.label","version":"1.0.0","tags":["heatmap"]}},{"datamodels":[{"description":"datamodel.tabular.heatmap.description","id":"tabular","label":"datamodel.tabular.label","datasets":[{"dataslots":[{"icon":{"image":"..\/rave-library\/resources\/x_axis_32.png","svg":"..\/rave-library\/resources\/x_axis_32.svg"},"description":"dataslot.x.heatmap.description","id":"x","label":"dataslot.x.label","cardinality":"1","datatypes":["string"],"tags":["ca.dashboard.defaultSort=ascending"]},{"icon":{"image":"..\/rave-library\/resources\/y_axis_32.png","svg":"..\/rave-library\/resources\/y_axis_32.svg"},"description":"dataslot.y.heatmap.description","id":"y","label":"dataslot.y.label","cardinality":"1","datatypes":["string"],"tags":["ca.dashboard.defaultSort=ascending"]},{"icon":{"image":"..\/rave-library\/resources\/color_by_32.png","svg":"..\/rave-library\/resources\/region_color_by_32.svg"},"description":"dataslot.color.heatmap.description","id":"color","label":"dataslot.color.label","cardinality":"1","datatypes":["numeric","string"],"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":["heatmap","simple"]}]},{"actions":[{"args":[{"icon":null,"description":"actions.args.selector.description","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.applyHighlight.description","binding":[{"event":"mouseover","target":".element-shape"}],"id":"highlight","label":"actions.applyHighlight.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.selector.description","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.removeHighlight.description","binding":[{"event":"mouseout","target":".element-shape"}],"id":"unhighlight","label":"actions.removeHighlight.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.selector.label","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.applySelection.description","binding":[{"event":"mouseover","target":".element-shape"}],"id":"select","label":"actions.applySelection.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.selector.description","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.removeSelection.description","binding":[{"event":"mouseout","target":".element-shape"}],"id":"deselect","label":"actions.removeSelection.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.selector.description","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.removeAllSelect.description","binding":[{"event":"click","target":".background"}],"id":"deselectAll","label":"actions.removeAllSelect.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.primarySelector.description","id":"PrimarySelector","label":"actions.args.primarySelector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.secondarySelector.description","id":"secondarySelector","label":"actions.args.secondarySelector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.primaryAttributes.description","id":"PrimaryStyles","label":"actions.args.primaryAttributes.label","type":"attributeMap","tags":[]},{"icon":null,"description":"actions.args.secondaryAttributes.description","id":"SecondarySyles","label":"actions.args.secondaryAttributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.toggleSelect.description","binding":[{"event":"click","target":".element-shape"}],"id":"toggleSelect","label":"actions.toggleSelect.label","tags":[]},{"icon":null,"options":[],"description":"actions.zoom.description","binding":[],"id":"zoom","label":"actions.zoom.label","tags":[]}]},{"configurations":[{"dataSlots":[{"dataTypes":["string"],"dataModelId":"tabular","dataSetId":"data","dataSlotId":"x","tags":["ca.chart.definition.categoryValues=indexedFull"]},{"dataTypes":["string"],"dataModelId":"tabular","dataSetId":"data","dataSlotId":"y","tags":["ca.chart.definition.categoryValues=indexedFull"]},{"dataTypes":["numeric"],"dataModelId":"tabular","dataSetId":"data","hidden":false,"dataSlotId":"color","tags":["ca.chart.definition.supportsRange=true"]},{"dataModelId":"tabular","dataSetId":"data","hidden":true,"dataSlotId":"key"}],"previews":{"image":[{"file":"resources\/heat_icon_48.png","tags":["small","nocolor"]},{"file":"resources\/heat_preview_320.png","tags":["medium","color"]},{"file":"resources\/heat_preview_500.png","tags":["large","nocolor"]}],"svg":[{"file":"resources\/heat_icon_48.svg","tags":["small","nocolor"]},{"file":"resources\/heat_preview_320.svg","tags":["medium","color"]},{"file":"resources\/heat_preview_500.svg","tags":["large","nocolor"]}]},"genericMeta":{"description":"heatmap.config.heatmap.description","id":"heatmap","label":"heatmap.config.heatmap.label","tags":["ca.reporting","ca.dashboard"]},"properties":[{"id":"effect.duration","value":500},{"id":"background.chart.color","value":"transparent"},{"id":"background.elements.color","value":"transparent"},{"id":"cell.uniform","value":false},{"id":"layout.padding","value":"padding-top:10;padding-left:10;padding-bottom:10;padding-right:10"},{"id":"layout.axissize.bottom.min","value":"5"},{"id":"layout.axissize.bottom.preferred","value":"15%"},{"id":"layout.axissize.bottom.max","value":"200"},{"id":"layout.axissize.left.min","value":"5"},{"id":"layout.axissize.left.preferred","value":"15%"},{"id":"layout.axissize.left.max","value":"200"},{"hidden":true,"id":"layout.legendsize.preferred"}]}]},{"properties":{"label.shadow":{"default":false,"resetView":"layout","name":"label.shadow.name","description":"label.shadow.description","type":"boolean"},"color":{"type":"object","properties":{"null":{"default":"silver","name":"color.null.name","description":"color.null.description","type":"color"},"palette":{"default":"rave2.colorpalette.blueContinuousSequential","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"}}}}},"labelstyle":{"type":"object","properties":{"font":{"default":null,"name":"labelstyle.font.name","description":"labelstyle.font.description","type":"string"}}},"maxCellSize":{"default":"140px","resetView":"layout","name":"max.cell.size.name","description":"max.cell.size.description","type":"length"},"effect":{"type":"object","properties":{"duration":{"default":1000,"min":0,"name":"effect.duration.name","description":"effect.duration.description","type":"numeric"},"name":{"default":"transition","name":"effect.name.name","options":[{"id":"effect.name.options.transition","value":"transition"},{"id":"effect.name.options.none","value":"none"}],"description":"effect.name.description","type":"string"}}},"contrast":{"type":"object","properties":{"label":{"type":"object","properties":{"color":{"default":false,"resetView":"layout","name":"contrast.label.color.name","description":"contrast.label.color.description","type":"boolean"}}}}},"minCellSize":{"default":"14px","resetView":"layout","name":"min.cell.size.name","description":"min.cell.size.description","type":"length"},"zoom":{"default":"all","resetView":"zoom","name":"zoom.name","options":[{"id":"zoom.options.both","value":"all"},{"id":"zoom.options.x","value":"x"},{"id":"zoom.options.y","value":"y"},{"id":"zoom.options.none","value":"none"}],"description":"zoom.description","type":"string"},"cell":{"type":"object","properties":{"uniform":{"default":"true","resetView":"layout","name":"cell.uniform.name","description":"cell.uniform.description","type":"boolean"},"borderColor":{"default":"white","name":"cell.borderColor.name","description":"cell.borderColor.description","type":"color"},"borderWidth":{"default":"1px","name":"cell.borderWidth.name","description":"cell.borderWidth.description","type":"length"}}},"itemLabel":{"trueLabel":"heatmap.trueLabel.itemLabel","default":false,"falseLabel":"heatmap.falseLabel.itemLabel","name":"item.label.name","description":"item.label.description","type":"boolean"}}},{"properties":{"axis":{"type":"object","properties":{"labels":{"type":"object","properties":{"truncationText":{"default":"...","name":"axis.labels.truncationText.name","description":"axis.labels.truncationText.description","type":"string"}}}}}}},{"properties":{"axis":{"type":"object","properties":{"x":{"type":"object","properties":{"ticks":{"type":"object","properties":{"display":{"trueLabel":"axis.x.ticks.display.trueLabel","default":false,"falseLabel":"axis.x.ticks.display.falseLabel","name":"axis.x.ticks.display.name","description":"axis.x.ticks.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#eeeeee","name":"axis.x.ticks.style.stroke.name","description":"axis.x.ticks.style.stroke.description","type":"color"}}}}},"line":{"type":"object","properties":{"display":{"trueLabel":"axis.x.line.display.trueLabel","default":false,"falseLabel":"axis.x.line.display.falseLabel","name":"axis.x.line.display.name","description":"axis.x.line.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#eeeeee","name":"axis.x.line.style.stroke.name","description":"axis.x.line.style.stroke.description","type":"color"}}}}},"labels":{"type":"object","properties":{"display":{"trueLabel":"axis.x.labels.display.trueLabel","default":true,"falseLabel":"axis.x.labels.display.falseLabel","resetView":"layout","name":"axis.x.labels.display.name","description":"axis.x.labels.display.description","type":"boolean"},"style":{"type":"object","properties":{"font-size":{"default":null,"resetView":"layout","name":"axis.x.labels.style.font-size.name","description":"axis.x.labels.style.font-size.description","type":"string"},"font-family":{"default":null,"name":"axis.x.labels.style.font-family.name","description":"axis.x.labels.style.font-family.description","type":"string"},"fill":{"default":"#3c4646","name":"axis.x.labels.style.fill.name","description":"axis.x.labels.style.fill.description","type":"color"},"font":{"resetView":"layout","name":"axis.x.labels.style.font.name","description":"axis.x.labels.style.font.description","type":"font"}}},"zoomPan":{"trueLabel":"axis.x.labels.zoomPan.trueLabel","default":false,"falseLabel":"axis.x.labels.zoomPan.falseLabel","name":"axis.x.labels.zoomPan.name","description":"axis.x.labels.zoomPan.description","type":"boolean"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"x":{"type":"object","properties":{"title":{"type":"object","properties":{"display":{"trueLabel":"axis.x.title.display.trueLabel","default":true,"falseLabel":"axis.x.title.display.falseLabel","resetView":"layout","name":"axis.x.title.display.name","description":"axis.x.title.display.description","type":"boolean"},"style":{"type":"object","properties":{"font-size":{"default":null,"resetView":"layout","name":"axis.x.title.style.font-size.name","description":"axis.x.title.style.font-size.description","type":"string"},"font-family":{"default":null,"name":"axis.x.title.style.font-family.name","description":"axis.x.title.style.font-family.description","type":"string"},"fill":{"default":"#323c3c","name":"axis.x.title.style.fill.name","description":"axis.x.title.style.fill.description","type":"color"},"font":{"resetView":"layout","name":"axis.x.title.style.font.name","description":"axis.x.title.style.font.description","type":"font"}}},"text":{"default":"","resetView":"layout","name":"axis.x.title.text.name","description":"axis.x.title.text.description","type":"string"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"x":{"type":"object","properties":{"labels":{"type":"object","properties":{"allowRotate90":{"trueLabel":"axis.x.labels.allowRotate90.trueLabel","default":true,"falseLabel":"axis.x.labels.allowRotate90.falseLabel","resetView":"layout","name":"axis.x.labels.allowRotate90.name","description":"axis.x.labels.allowRotate90.description","type":"boolean"},"layoutMode":{"default":"automatic","resetView":"layout","name":"axis.x.labels.layoutMode.name","options":[{"id":"axis.x.labels.layoutMode.options.automatic","value":"automatic"},{"id":"axis.x.labels.layoutMode.options.horizontal","value":"horizontal"},{"id":"axis.x.labels.layoutMode.options.stagger","value":"stagger"},{"id":"axis.x.labels.layoutMode.options.rotate45","value":"rotate45"},{"id":"axis.x.labels.layoutMode.options.rotate90","value":"rotate90"}],"description":"axis.x.labels.layoutMode.description","type":"string"},"allowRotate45":{"trueLabel":"axis.x.labels.allowRotate45.trueLabel","default":true,"falseLabel":"axis.x.labels.allowRotate45.falseLabel","resetView":"layout","name":"axis.x.labels.allowRotate45.name","description":"axis.x.labels.allowRotate45.description","type":"boolean"},"allowStagger":{"trueLabel":"axis.x.labels.allowStagger.trueLabel","default":true,"falseLabel":"axis.x.labels.allowStagger.falseLabel","resetView":"layout","name":"axis.x.labels.allowStagger.name","description":"axis.x.labels.allowStagger.description","type":"boolean"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"y":{"type":"object","properties":{"ticks":{"type":"object","properties":{"display":{"trueLabel":"axis.y.ticks.display.trueLabel","default":false,"falseLabel":"axis.y.ticks.display.falseLabel","name":"axis.y.ticks.display.name","description":"axis.y.ticks.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#eeeeee","name":"axis.y.ticks.style.stroke.name","description":"axis.y.ticks.style.stroke.description","type":"color"}}}}},"line":{"type":"object","properties":{"display":{"trueLabel":"axis.y.line.display.trueLabel","default":false,"falseLabel":"axis.y.line.display.falseLabel","name":"axis.y.line.display.name","description":"axis.y.line.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#eeeeee","name":"axis.y.line.style.stroke.name","description":"axis.y.line.style.stroke.description","type":"color"}}}}},"labels":{"type":"object","properties":{"display":{"trueLabel":"axis.y.labels.display.trueLabel","default":true,"falseLabel":"axis.y.labels.display.falseLabel","resetView":"layout","name":"axis.y.labels.display.name","description":"axis.y.labels.display.description","type":"boolean"},"style":{"type":"object","properties":{"font-size":{"default":null,"resetView":"layout","name":"axis.y.labels.style.font-size.name","description":"axis.y.labels.style.font-size.description","type":"string"},"font-family":{"default":null,"name":"axis.y.labels.style.font-family.name","description":"axis.y.labels.style.font-family.description","type":"string"},"fill":{"default":"#3c4646","name":"axis.y.labels.style.fill.name","description":"axis.y.labels.style.fill.description","type":"color"},"font":{"resetView":"layout","name":"axis.y.labels.style.font.name","description":"axis.y.labels.style.font.description","type":"font"}}},"zoomPan":{"trueLabel":"axis.y.labels.zoomPan.trueLabel","default":false,"falseLabel":"axis.y.labels.zoomPan.falseLabel","name":"axis.y.labels.zoomPan.name","description":"axis.y.labels.zoomPan.description","type":"boolean"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"y":{"type":"object","properties":{"title":{"type":"object","properties":{"display":{"trueLabel":"axis.y.title.display.trueLabel","default":true,"falseLabel":"axis.y.title.display.falseLabel","resetView":"layout","name":"axis.y.title.display.name","description":"axis.y.title.display.description","type":"boolean"},"style":{"type":"object","properties":{"font-size":{"default":null,"resetView":"layout","name":"axis.y.title.style.font-size.name","description":"axis.y.title.style.font-size.description","type":"string"},"font-family":{"default":null,"name":"axis.y.title.style.font-family.name","description":"axis.y.title.style.font-family.description","type":"string"},"fill":{"default":"#323c3c","name":"axis.y.title.style.fill.name","description":"axis.y.title.style.fill.description","type":"color"},"font":{"resetView":"layout","name":"axis.y.title.style.font.name","description":"axis.y.title.style.font.description","type":"font"}}},"text":{"default":"","resetView":"layout","name":"axis.y.title.text.name","description":"axis.y.title.text.description","type":"string"}}}}}}}}},{"properties":{"layout":{"type":"object","properties":{"axissize":{"type":"object","properties":{"top":{"type":"object","properties":{"min":{"default":"55","resetView":"layout","name":"layout.axissize.top.min.name","description":"layout.axissize.top.min.description","type":"length"},"max":{"default":"55","resetView":"layout","name":"layout.axissize.top.max.name","description":"layout.axissize.top.max.description","type":"length"},"preferred":{"default":"55","resetView":"layout","name":"layout.axissize.top.preferred.name","description":"layout.axissize.top.preferred.description","type":"length"}}}}}}}}},{"properties":{"layout":{"type":"object","properties":{"axissize":{"type":"object","properties":{"left":{"type":"object","properties":{"min":{"default":"65","resetView":"layout","name":"layout.axissize.left.min.name","description":"layout.axissize.left.min.description","type":"length"},"max":{"default":"65","resetView":"layout","name":"layout.axissize.left.max.name","description":"layout.axissize.left.max.description","type":"length"},"preferred":{"default":"65","resetView":"layout","name":"layout.axissize.left.preferred.name","description":"layout.axissize.left.preferred.description","type":"length"}}}}}}}}},{"properties":{"layout":{"type":"object","properties":{"axissize":{"type":"object","properties":{"bottom":{"type":"object","properties":{"min":{"default":"55","resetView":"layout","name":"layout.axissize.bottom.min.name","description":"layout.axissize.bottom.min.description","type":"length"},"max":{"default":"55","resetView":"layout","name":"layout.axissize.bottom.max.name","description":"layout.axissize.bottom.max.description","type":"length"},"preferred":{"default":"55","resetView":"layout","name":"layout.axissize.bottom.preferred.name","description":"layout.axissize.bottom.preferred.description","type":"length"}}}}}}}}},{"properties":{"layout":{"type":"object","properties":{"axissize":{"type":"object","properties":{"right":{"type":"object","properties":{"min":{"default":"65","resetView":"layout","name":"layout.axissize.right.min.name","description":"layout.axissize.right.min.description","type":"length"},"max":{"default":"65","resetView":"layout","name":"layout.axissize.right.max.name","description":"layout.axissize.right.max.description","type":"length"},"preferred":{"default":"65","resetView":"layout","name":"layout.axissize.right.preferred.name","description":"layout.axissize.right.preferred.description","type":"length"}}}}}}}}},{"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"}}}}}}},{"properties":{"axis":{"type":"object","properties":{"x":{"type":"object","properties":{"alignment":{"default":"top","resetView":"layout","name":"axis.x.alignment.name","options":[{"id":"axis.x.alignment.options.top","value":"top"},{"id":"axis.x.alignment.options.bottom","value":"bottom"}],"description":"axis.x.alignment.description","type":"string"}}},"y":{"type":"object","properties":{"alignment":{"default":"left","resetView":"layout","name":"axis.y.alignment.name","options":[{"id":"axis.y.alignment.options.left","value":"left"},{"id":"axis.y.alignment.options.right","value":"right"}],"description":"axis.y.alignment.description","type":"string"}}}}}}},{"propertyPresentations":[{"presentationItems":[{"propertyID":"color.palette"},{"propertyID":"axis.x.title.display"},{"propertyID":"axis.y.title.display"},{"propertyID":"legend.display"},{"propertyID":"legend.position"}],"icon":"","description":"propertyPresentation.simple.description","id":"simple","label":"propertyPresentation.simple.label","tags":["Heatmap","Heatmap Properties Presentation","Simple","ca.dashboard"]},{"presentationItems":[{"propertyGroup":{"presentationItems":[{"propertyID":"background.chart.color"},{"propertyID":"background.elements.color"},{"propertyID":"color.dynamicPalette.max"},{"propertyID":"color.dynamicPalette.mid"},{"propertyID":"color.dynamicPalette.min"},{"propertyID":"color.null"},{"propertyID":"layout.padding"}],"icon":"","description":"propertyPresentation.advanced.commonProperties.description","id":"commonProperties","label":"propertyPresentation.advanced.commonProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"cell.borderColor"},{"propertyID":"cell.borderWidth"}],"icon":"","description":"heatmap.propertyPresentation.advanced.heatmapSpecificProperties.description","id":"heatmapSpecificProperties","label":"heatmap.propertyPresentation.advanced.heatmapSpecificProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"axis.x.alignment"},{"propertyID":"axis.x.labels.display"},{"propertyID":"axis.x.labels.style.font"},{"propertyID":"axis.x.line.display"},{"propertyID":"axis.x.line.style.stroke"},{"propertyID":"axis.x.ticks.display"},{"propertyID":"axis.x.ticks.style.stroke"},{"propertyID":"axis.x.title.display"},{"propertyID":"axis.x.title.style.font"},{"propertyID":"axis.x.title.text"}],"icon":"","description":"propertyPresentation.advanced.xAxisProperties.description","id":"xAxisProperties","label":"propertyPresentation.advanced.xAxisProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"axis.y.alignment"},{"propertyID":"axis.y.labels.display"},{"propertyID":"axis.y.labels.style.font"},{"propertyID":"axis.y.line.display"},{"propertyID":"axis.y.line.style.stroke"},{"propertyID":"axis.y.ticks.display"},{"propertyID":"axis.y.ticks.style.stroke"},{"propertyID":"axis.y.title.display"},{"propertyID":"axis.y.title.style.font"},{"propertyID":"axis.y.title.text"}],"icon":"","description":"propertyPresentation.advanced.yAxisProperties.description","id":"yAxisProperties","label":"propertyPresentation.advanced.yAxisProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"legend.display"},{"propertyID":"legend.position"},{"propertyID":"layout.legendchart.gap"},{"propertyID":"layout.legendchart.align"},{"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":["Heatmap","Heatmap Properties Presentation","advanced","ca.reporting"]}]},{"build":"development","name":"rave-library-heatmap","description":"This is the IBM Rave heatmap 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. "axis.labels.truncationText.description": "The text that is placed at the end of labels to indicate truncation.",
  63. "axis.labels.truncationText.name": "Axis truncation text",
  64. "axis.x.alignment.description": "The location of the X-axis in the chart.",
  65. "axis.x.alignment.name": "X-axis location",
  66. "axis.x.alignment.options.bottom": "Bottom",
  67. "axis.x.alignment.options.top": "Top",
  68. "axis.x.labels.allowRotate45.description": "Enables or disables the rotate45 option for labels automatic layout.",
  69. "axis.x.labels.allowRotate45.falseLabel": "Disable rotate45 option",
  70. "axis.x.labels.allowRotate45.name": "Allow rotate 45",
  71. "axis.x.labels.allowRotate45.trueLabel": "Enable rotate45 option",
  72. "axis.x.labels.allowRotate90.description": "Enables or disables the rotate90 option for labels automatic layout.",
  73. "axis.x.labels.allowRotate90.falseLabel": "Disable rotate90 option",
  74. "axis.x.labels.allowRotate90.name": "Allow rotate 90",
  75. "axis.x.labels.allowRotate90.trueLabel": "Enable rotate90 option",
  76. "axis.x.labels.allowStagger.description": "Allows the stagger option for labels automatic layout.",
  77. "axis.x.labels.allowStagger.falseLabel": "X-axis do not allow stagger",
  78. "axis.x.labels.allowStagger.name": "Allow stagger",
  79. "axis.x.labels.allowStagger.trueLabel": "X-axis allow stagger",
  80. "axis.x.labels.display.description": "Shows or hides the X-axis labels.",
  81. "axis.x.labels.display.falseLabel": "Hide",
  82. "axis.x.labels.display.name": "Show labels",
  83. "axis.x.labels.display.trueLabel": "Show",
  84. "axis.x.labels.layoutMode.description": "Configure the layout mode for the X-axis labels.",
  85. "axis.x.labels.layoutMode.name": "Layout Mode",
  86. "axis.x.labels.layoutMode.options.automatic": "Automatic",
  87. "axis.x.labels.layoutMode.options.horizontal": "Horizontal",
  88. "axis.x.labels.layoutMode.options.rotate45": "Rotated 45 degrees",
  89. "axis.x.labels.layoutMode.options.rotate90": "Rotated 90 degrees",
  90. "axis.x.labels.layoutMode.options.stagger": "Stagger",
  91. "axis.x.labels.style.fill.description": "The color of X-axis labels.",
  92. "axis.x.labels.style.fill.name": "Label color",
  93. "axis.x.labels.style.font-family.description": "The font families of the X-axis labels.",
  94. "axis.x.labels.style.font-family.name": "Label font families",
  95. "axis.x.labels.style.font-size.description": "The size of X-axis labels (CSS size).",
  96. "axis.x.labels.style.font-size.name": "Label font size",
  97. "axis.x.labels.style.font.description": "The font properties of X-axis labels (CSS styles).",
  98. "axis.x.labels.style.font.name": "Label font",
  99. "axis.x.labels.zoomPan.description": "Shows or hides X-axis labels when panning and zooming.",
  100. "axis.x.labels.zoomPan.falseLabel": "Show",
  101. "axis.x.labels.zoomPan.name": "Label pan-zoom",
  102. "axis.x.labels.zoomPan.trueLabel": "Hide",
  103. "axis.x.line.display.description": "Shows or hides the X-axis line.",
  104. "axis.x.line.display.falseLabel": "Hide",
  105. "axis.x.line.display.name": "Show line",
  106. "axis.x.line.display.trueLabel": "Show",
  107. "axis.x.line.style.stroke.description": "The color of the X-axis line.",
  108. "axis.x.line.style.stroke.name": "Line color",
  109. "axis.x.scale.includeZero.description": "When set to Yes, includes 0 on the X-axis.",
  110. "axis.x.scale.includeZero.falseLabel": "Do not include",
  111. "axis.x.scale.includeZero.name": "Includes zero",
  112. "axis.x.scale.includeZero.trueLabel": "Include",
  113. "axis.x.scale.max.description": "The maximum value that appears on the X-axis.",
  114. "axis.x.scale.max.name": "Maximum value",
  115. "axis.x.scale.min.description": "The minimum value that appears on the X-axis.",
  116. "axis.x.scale.min.name": "Minimum value",
  117. "axis.x.scale.nice.description": "When set to Yes, uses nice endpoint values on the X-axis.",
  118. "axis.x.scale.nice.falseLabel": "Do not nice",
  119. "axis.x.scale.nice.name": "Nicing",
  120. "axis.x.scale.nice.trueLabel": "Apply nicing",
  121. "axis.x.ticks.display.description": "Shows or hides the X-axis tick marks.",
  122. "axis.x.ticks.display.falseLabel": "Hide",
  123. "axis.x.ticks.display.name": "Show ticks",
  124. "axis.x.ticks.display.trueLabel": "Show",
  125. "axis.x.ticks.style.stroke.description": "The color of the X-axis ticks.",
  126. "axis.x.ticks.style.stroke.name": "Tick color",
  127. "axis.x.title.display.description": "Shows or hides the X-axis title.",
  128. "axis.x.title.display.falseLabel": "Hide",
  129. "axis.x.title.display.name": "Show title",
  130. "axis.x.title.display.trueLabel": "Show",
  131. "axis.x.title.style.fill.description": "The color of the X-axis title.",
  132. "axis.x.title.style.fill.name": "Title color",
  133. "axis.x.title.style.font-family.description": "The font family names of the X-axis title.",
  134. "axis.x.title.style.font-family.name": "Title font families",
  135. "axis.x.title.style.font-size.description": "The X-axis title font size (CSS size).",
  136. "axis.x.title.style.font-size.name": "Title font size",
  137. "axis.x.title.style.font.description": "The X-axis title font properties (CSS style).",
  138. "axis.x.title.style.font.name": "Title font",
  139. "axis.x.title.text.description": "The title of the X-axis.",
  140. "axis.x.title.text.name": "Title",
  141. "axis.y.alignment.description": "The location of the Y-axis in the chart.",
  142. "axis.y.alignment.name": "Y-axis location",
  143. "axis.y.alignment.options.left": "Left",
  144. "axis.y.alignment.options.right": "Right",
  145. "axis.y.labels.display.description": "Shows or hides the Y-axis labels.",
  146. "axis.y.labels.display.falseLabel": "Hide",
  147. "axis.y.labels.display.name": "Show labels",
  148. "axis.y.labels.display.trueLabel": "Show",
  149. "axis.y.labels.layoutMode.description": "Configure the layout mode for the Y-axis labels.",
  150. "axis.y.labels.layoutMode.name": "Layout Mode",
  151. "axis.y.labels.layoutMode.options.horizontal": "Horizontal",
  152. "axis.y.labels.layoutMode.options.rotate90": "Rotated 90 degrees",
  153. "axis.y.labels.style.fill.description": "The color of Y-axis labels.",
  154. "axis.y.labels.style.fill.name": "Label color",
  155. "axis.y.labels.style.font-family.description": "The font families of the Y-axis labels.",
  156. "axis.y.labels.style.font-family.name": "Label font families",
  157. "axis.y.labels.style.font-size.description": "The size of Y-axis labels (CSS size).",
  158. "axis.y.labels.style.font-size.name": "Label font size",
  159. "axis.y.labels.style.font.description": "The font properties of Y-axis labels (CSS styles).",
  160. "axis.y.labels.style.font.name": "Label font",
  161. "axis.y.labels.zoomPan.description": "Shows or hides Y-axis labels when panning and zooming.",
  162. "axis.y.labels.zoomPan.falseLabel": "Show",
  163. "axis.y.labels.zoomPan.name": "Label pan-zoom",
  164. "axis.y.labels.zoomPan.trueLabel": "Hide",
  165. "axis.y.line.display.description": "Shows or hides the Y-axis line.",
  166. "axis.y.line.display.falseLabel": "Hide",
  167. "axis.y.line.display.name": "Show line",
  168. "axis.y.line.display.trueLabel": "Show",
  169. "axis.y.line.style.stroke.description": "The color of the Y-axis line.",
  170. "axis.y.line.style.stroke.name": "Line color",
  171. "axis.y.scale.includeZero.description": "When set to Yes, includes 0 on the Y-axis.",
  172. "axis.y.scale.includeZero.falseLabel": "Do not include",
  173. "axis.y.scale.includeZero.name": "Includes zero",
  174. "axis.y.scale.includeZero.trueLabel": "Include",
  175. "axis.y.scale.max.description": "The maximum value that appears on the Y-axis.",
  176. "axis.y.scale.max.name": "Maximum value",
  177. "axis.y.scale.min.description": "The minimum value tha appears on the Y-axis.",
  178. "axis.y.scale.min.name": "Minimum value",
  179. "axis.y.scale.nice.description": "When set to Yes, uses nice endpoint values on the Y-axis.",
  180. "axis.y.scale.nice.falseLabel": "Do not nice",
  181. "axis.y.scale.nice.name": "Nicing",
  182. "axis.y.scale.nice.trueLabel": "Apply nicing",
  183. "axis.y.ticks.display.description": "Shows or hides the Y-axis tick marks.",
  184. "axis.y.ticks.display.falseLabel": "Hide",
  185. "axis.y.ticks.display.name": "Show ticks",
  186. "axis.y.ticks.display.trueLabel": "Show",
  187. "axis.y.ticks.style.stroke.description": "The color of the Y-axis ticks.",
  188. "axis.y.ticks.style.stroke.name": "Tick color",
  189. "axis.y.title.display.description": "Shows or hides the Y-axis title.",
  190. "axis.y.title.display.falseLabel": "Hide",
  191. "axis.y.title.display.name": "Show title",
  192. "axis.y.title.display.trueLabel": "Show",
  193. "axis.y.title.style.fill.description": "The color of the Y-axis title.",
  194. "axis.y.title.style.fill.name": "Title color",
  195. "axis.y.title.style.font-family.description": "The font family names of the Y-axis title.",
  196. "axis.y.title.style.font-family.name": "Title font families",
  197. "axis.y.title.style.font-size.description": "The size of the Y-axis title font (CSS size).",
  198. "axis.y.title.style.font-size.name": "Title font size",
  199. "axis.y.title.style.font.description": "The Y-axis title font properties (CSS styles).",
  200. "axis.y.title.style.font.name": "Title font",
  201. "axis.y.title.text.description": "The title of the Y-axis.",
  202. "axis.y.title.text.name": "Title",
  203. "background.chart.color.description": "The background color of the chart.",
  204. "background.chart.color.name": "Background color",
  205. "background.color.description": "The background color of the chart.",
  206. "background.elements.color.description": "The background color behind the elements of the chart.",
  207. "background.elements.color.name": "Elements background color",
  208. "cell.borderColor.description": "The color of cell borders.",
  209. "cell.borderColor.name": "Cell border color",
  210. "cell.borderWidth.description": "The width of cell borders.",
  211. "cell.borderWidth.name": "Cell border width",
  212. "cell.uniform.description": "When enabled, this option forces all cells to be perfect squares, and will not stretch to fill the provided space.",
  213. "cell.uniform.name": "Uniform Cell Dimensions",
  214. "color.dynamicPalette.max.description": "The color that is applied to the maximum value of a dynamic palette.",
  215. "color.dynamicPalette.max.name": "Maximum value color",
  216. "color.dynamicPalette.mid.description": "The color that is applied to the middle value of a dynamic palette.",
  217. "color.dynamicPalette.mid.name": "Middle value color",
  218. "color.dynamicPalette.min.description": "The color that is applied to the minimum value of a dynamic palette.",
  219. "color.dynamicPalette.min.name": "Minimum value color",
  220. "color.null.description": "The color that is applied to null values.",
  221. "color.null.name": "Null value color",
  222. "color.palette.description": "The color palette that controls the colors or patterns that are applied to data elements in the chart.",
  223. "color.palette.name": "Color palette",
  224. "contrast.label.color.description": "Adjust the label color to contrast with background.",
  225. "contrast.label.color.name": "Contrast label color with background",
  226. "data.handling.description": "The configuration that is used to plot the data.",
  227. "data.handling.name": "Configuration",
  228. "datamodel.hierarchial.label": "Hierarchical data model",
  229. "datamodel.tabular.heatmap.description": "The model plots categorical x and y values with one color at each coordinate. The data has exactly one row for each combination of x and y.",
  230. "datamodel.tabular.label": "Tabular data model",
  231. "dataset.hierarchial.label": "Hierarchical data set",
  232. "dataset.tabular.description": "The tabular data set of rows and columns.",
  233. "dataset.tabular.label": "Tabular data set",
  234. "dataset.tabular.link.description": "Determines the links between the nodes.",
  235. "dataset.tabular.link.label": "Tabular links data set",
  236. "dataset.tabular.node.description": "The tabular data set that defines the nodes.",
  237. "dataset.tabular.node.label": "Tabular node data set",
  238. "dataslot.categories.label": "Categories",
  239. "dataslot.category.label": "Category",
  240. "dataslot.children.description": "When applied to a tree node, returns the children of that node as an array-list.",
  241. "dataslot.children.label": "Children",
  242. "dataslot.color.description": "Determines the color of the shape.",
  243. "dataslot.color.heatmap.description": "The value at the intersection of x and y.",
  244. "dataslot.color.label": "Color",
  245. "dataslot.key.description": "Called for each row to match elements. Primarily used for transitions.",
  246. "dataslot.key.label": "Key",
  247. "dataslot.label.description": "Determines the label of the shape.",
  248. "dataslot.label.label": "Label",
  249. "dataslot.maximumValue.label": "Maximum value",
  250. "dataslot.source.label": "Source",
  251. "dataslot.sourceValue.label": "Source value",
  252. "dataslot.tabular.id.description": "The identifier for the nodes.",
  253. "dataslot.tabular.id.label": "Identifier",
  254. "dataslot.tabular.size.description": "Determines the size of the shape.",
  255. "dataslot.tabular.size.label": "Size",
  256. "dataslot.target.label": "Target",
  257. "dataslot.targetValue.label": "Target value",
  258. "dataslot.value.label": "Value",
  259. "dataslot.x.heatmap.description": "The x position value.",
  260. "dataslot.x.label": "X axis",
  261. "dataslot.y.heatmap.description": "The y position value.",
  262. "dataslot.y.label": "Y axis",
  263. "defaultPalette.description": "Rave2 default description",
  264. "defaultPalette.label": "Rave2 default",
  265. "effect.duration.description": "The animation duration, in ms.",
  266. "effect.duration.name": "Animation duration (ms)",
  267. "effect.name.description": "The effect that is used when the chart is drawn.",
  268. "effect.name.name": "Animation",
  269. "effect.name.options.none": "None",
  270. "effect.name.options.transition": "Transition",
  271. "grid.color.description": "The color of the grid lines.",
  272. "grid.color.name": "Grid lines color",
  273. "grid.display.description": "Shows or hides the grid lines.",
  274. "grid.display.name": "Show grid lines",
  275. "heatmap.config.heatmap.description": "Heatmaps represent the individual values contained in a matrix as colors. Similar to treemaps, you can use heatmaps to identify patterns and exceptions.",
  276. "heatmap.config.heatmap.label": "Heatmap",
  277. "heatmap.description": "Heatmaps represent the individual values contained in a matrix as colors. Similar to treemaps, you can use heatmaps to identify patterns and exceptions.",
  278. "heatmap.falseLabel.itemLabel": "Hide",
  279. "heatmap.label": "Heatmap",
  280. "heatmap.propertyPresentation.advanced.heatmapSpecificProperties.description": "Heatmap-specific properties",
  281. "heatmap.propertyPresentation.advanced.heatmapSpecificProperties.label": "Heatmap",
  282. "heatmap.trueLabel.itemLabel": "Show",
  283. "item.label.description": "Shows or hides item labels.",
  284. "item.label.name": "Item labels",
  285. "label.shadow.description": "Show or hide shadow for labels.",
  286. "label.shadow.name": "Label shadow",
  287. "labelstyle.font.description": "Font styles for the item labels",
  288. "labelstyle.font.name": "Item label font",
  289. "layout.axissize.bottom.max.description": "The maximum size of the bottom axis, as a CSS size or percentage.",
  290. "layout.axissize.bottom.max.name": "Bottom axis maximum size",
  291. "layout.axissize.bottom.min.description": "The minimum size of the bottom axis, as a CSS size or percentage.",
  292. "layout.axissize.bottom.min.name": "Bottom axis minimum size",
  293. "layout.axissize.bottom.preferred.description": "The preferred size of the bottom axis, as a CSS size or percentage.",
  294. "layout.axissize.bottom.preferred.name": "Bottom axis preferred size",
  295. "layout.axissize.left.max.description": "The maximum size of the left axis, as a CSS size or percentage.",
  296. "layout.axissize.left.max.name": "Left axis maximum size",
  297. "layout.axissize.left.min.description": "The minimum size of the left axis, as a CSS size or percentage.",
  298. "layout.axissize.left.min.name": "Left axis minimum size",
  299. "layout.axissize.left.preferred.description": "The preferred size of the left axis, as a CSS size or percentage.",
  300. "layout.axissize.left.preferred.name": "Left axis preferred size",
  301. "layout.axissize.right.max.description": "The maximum size of the right axis, as a CSS size or percentage.",
  302. "layout.axissize.right.max.name": "Right axis maximum size",
  303. "layout.axissize.right.min.description": "The minimum size of the right axis, as a CSS size or percentage.",
  304. "layout.axissize.right.min.name": "Right axis minimum size",
  305. "layout.axissize.right.preferred.description": "The preferred size of the right axis, as a CSS size or percentage.",
  306. "layout.axissize.right.preferred.name": "Right axis preferred size",
  307. "layout.axissize.top.max.description": "The maximum size of the top axis, as a CSS size or percentage.",
  308. "layout.axissize.top.max.name": "Top axis maximum size",
  309. "layout.axissize.top.min.description": "The minimum size of the top axis, as a CSS size or percentage.",
  310. "layout.axissize.top.min.name": "Top axis minimum size",
  311. "layout.axissize.top.preferred.description": "The preferred size of the top axis, as a CSS size or percentage.",
  312. "layout.axissize.top.preferred.name": "Top axis preferred size",
  313. "layout.chart.padding.bottom.description": "The bottom padding for the chart.",
  314. "layout.chart.padding.bottom.name": "Bottom padding",
  315. "layout.chart.padding.left.description": "The left padding for the chart.",
  316. "layout.chart.padding.left.name": "Left padding",
  317. "layout.chart.padding.right.description": "Right padding for the chart.",
  318. "layout.chart.padding.right.name": "Right padding",
  319. "layout.chart.padding.top.description": "The top padding for the chart.",
  320. "layout.chart.padding.top.name": "Top padding",
  321. "layout.legendchart.align.description": "Whether to align the legend to the interior of the chart.",
  322. "layout.legendchart.align.name": "Align legend to chart",
  323. "layout.legendchart.gap.description": "Space between the chart and the legend, as a CSS size or percentage.",
  324. "layout.legendchart.gap.name": "Space between legend and chart",
  325. "layout.legendsize.max.description": "The maximum size of the legend, as a CSS size or percentage.",
  326. "layout.legendsize.max.name": "Maximum size",
  327. "layout.legendsize.min.description": "The minimum size of the legend, as a CSS size or percentage.",
  328. "layout.legendsize.min.name": "Minimum size",
  329. "layout.legendsize.preferred.description": "The preferred size of the legend, as a CSS size or percentage.",
  330. "layout.legendsize.preferred.name": "Preferred size",
  331. "layout.padding.description": "The padding around the chart and legend.",
  332. "layout.padding.name": "Padding",
  333. "legend.display.description": "Shows or hides the legend.",
  334. "legend.display.falseLabel": "Hide",
  335. "legend.display.name": "Show legend",
  336. "legend.display.trueLabel": "Show",
  337. "legend.entrystyle.font.description": "The font properties of the legend entry.",
  338. "legend.entrystyle.font.name": "Entry font",
  339. "legend.position.description": "The position of the legend in the chart.",
  340. "legend.position.name": "Legend position",
  341. "legend.position.options.bottom": "Bottom",
  342. "legend.position.options.left": "Left",
  343. "legend.position.options.right": "Right",
  344. "legend.position.options.top": "Top",
  345. "legend.title.description": "The title of the legend.",
  346. "legend.title.name": "Title",
  347. "legend.titlestyle.fill.description": "The color of the legend title.",
  348. "legend.titlestyle.fill.name": "Title color",
  349. "legend.titlestyle.font.description": "The font properties of the legend title.",
  350. "legend.titlestyle.font.name": "Title font",
  351. "legend.titlestyle.fontfamily.description": "The font family of the legend title.",
  352. "legend.titlestyle.fontfamily.name": "Title font family",
  353. "legend.titlestyle.fontsize.description": "The font size of the legend title.",
  354. "legend.titlestyle.fontsize.name": "Title font size",
  355. "max.cell.size.description": "The maximum size of cells in the chart.",
  356. "max.cell.size.name": "Maximum cell size",
  357. "min.cell.size.description": "The minimum size of cells in the chart.",
  358. "min.cell.size.name": "Minimum cell size",
  359. "propertyPresentation.advanced.axisSizeProperties.description": "Axis size properties.",
  360. "propertyPresentation.advanced.axisSizeProperties.label": "Axis size",
  361. "propertyPresentation.advanced.clientBehaviorProperties.description": "Client side properties.",
  362. "propertyPresentation.advanced.clientBehaviorProperties.label": "Client behavior",
  363. "propertyPresentation.advanced.commonProperties.description": "Common properties.",
  364. "propertyPresentation.advanced.commonProperties.label": "Common",
  365. "propertyPresentation.advanced.description": "Advanced list of all properties in a grouped structure.",
  366. "propertyPresentation.advanced.label": "Advanced",
  367. "propertyPresentation.advanced.labelProperties.description": "Label properties",
  368. "propertyPresentation.advanced.labelProperties.label": "Label",
  369. "propertyPresentation.advanced.legendProperties.description": "Legend properties.",
  370. "propertyPresentation.advanced.legendProperties.label": "Legend",
  371. "propertyPresentation.advanced.xAxisProperties.description": "X-axis properties.",
  372. "propertyPresentation.advanced.xAxisProperties.label": "X-axis",
  373. "propertyPresentation.advanced.yAxisProperties.description": "Y-axis properties.",
  374. "propertyPresentation.advanced.yAxisProperties.label": "Y-axis",
  375. "propertyPresentation.simple.description": "Simple list of the most common properties.",
  376. "propertyPresentation.simple.label": "Simple",
  377. "rave2.colorpalette.blueContinuousSequential.description": "Blue continuous sequential description",
  378. "rave2.colorpalette.blueContinuousSequential.label": "Blue continuous sequential",
  379. "rave2.colorpalette.blueDiscreteSequential.description": "Blue discrete sequential description",
  380. "rave2.colorpalette.blueDiscreteSequential.label": "Blue discrete sequential",
  381. "rave2.colorpalette.blueGreenContinuousDivergent.description": "Blue green continuous divergent description",
  382. "rave2.colorpalette.blueGreenContinuousDivergent.label": "Blue green continuous divergent",
  383. "rave2.colorpalette.blueGreenDiscreteDivergent.description": "Blue green discrete divergent description",
  384. "rave2.colorpalette.blueGreenDiscreteDivergent.label": "Blue green discrete divergent",
  385. "rave2.colorpalette.dark.description": "Dark description",
  386. "rave2.colorpalette.dark.label": "Dark",
  387. "rave2.colorpalette.financial.description": "Financial description",
  388. "rave2.colorpalette.financial.label": "Financial",
  389. "rave2.colorpalette.greenContinuousSequential.description": "Green continuous sequential description",
  390. "rave2.colorpalette.greenContinuousSequential.label": "Green continuous sequential",
  391. "rave2.colorpalette.greenDiscreteSequential.description": "Green discrete sequential description",
  392. "rave2.colorpalette.greenDiscreteSequential.label": "Green discrete sequential",
  393. "rave2.colorpalette.light.description": "Light description",
  394. "rave2.colorpalette.light.label": "Light",
  395. "rave2.colorpalette.medical.description": "Medical description",
  396. "rave2.colorpalette.medical.label": "Medical",
  397. "rave2.colorpalette.orangeContinuousSequential.description": "Orange continuous sequential description",
  398. "rave2.colorpalette.orangeContinuousSequential.label": "Orange continuous sequential",
  399. "rave2.colorpalette.orangeDiscreteSequential.description": "Orange discrete sequential description",
  400. "rave2.colorpalette.orangeDiscreteSequential.label": " Orange discrete sequential",
  401. "rave2.colorpalette.purpleContinuousSequential.description": "Purple continuous sequential description",
  402. "rave2.colorpalette.purpleContinuousSequential.label": "Purple continuous sequential",
  403. "rave2.colorpalette.purpleDiscreteSequential.description": "Purple discrete sequential description",
  404. "rave2.colorpalette.purpleDiscreteSequential.label": "Purple discrete sequential",
  405. "rave2.colorpalette.redBlueContinuousDivergent.description": "Red blue continuous divergent description",
  406. "rave2.colorpalette.redBlueContinuousDivergent.label": "Red blue continuous divergent",
  407. "rave2.colorpalette.redBlueDiscreteDivergent.description": "Red blue discrete divergent description",
  408. "rave2.colorpalette.redBlueDiscreteDivergent.label": "Red blue discrete divergent",
  409. "rave2.colorpalette.redBlueInverseContinuousDivergent.description": "Red blue inverse continuous divergent description",
  410. "rave2.colorpalette.redBlueInverseContinuousDivergent.label": "Red blue inverse continuous divergent",
  411. "rave2.colorpalette.redBlueInverseDiscreteDivergent.description": "Red blue inverse discrete divergent description",
  412. "rave2.colorpalette.redBlueInverseDiscreteDivergent.label": "Red blue inverse discrete divergent",
  413. "rave2.colorpalette.redContinuousSequential.description": "Red continuous sequential description",
  414. "rave2.colorpalette.redContinuousSequential.label": "Red continuous sequential",
  415. "rave2.colorpalette.redDiscreteSequential.description": "Red discrete sequential description",
  416. "rave2.colorpalette.redDiscreteSequential.label": " Red discrete sequential",
  417. "rave2.colorpalette.redGreenContinuousDivergent.description": "Red green continuous divergent description",
  418. "rave2.colorpalette.redGreenContinuousDivergent.label": "Red green continuous divergent",
  419. "rave2.colorpalette.redGreenDiscreteDivergent.description": "Red green discrete divergent description",
  420. "rave2.colorpalette.redGreenDiscreteDivergent.label": "Red green discrete divergent",
  421. "rave2.colorpalette.redGreenInverseContinuousDivergent.description": "Red green inverse continuous divergent description",
  422. "rave2.colorpalette.redGreenInverseContinuousDivergent.label": "Red green inverse continuous divergent",
  423. "rave2.colorpalette.redGreenInverseDiscreteDivergent.description": "Red green inverse discrete divergent description",
  424. "rave2.colorpalette.redGreenInverseDiscreteDivergent.label": "Red green inverse discrete divergent",
  425. "rave2.colorpalette.tealContinuousSequential.description": "Teal continuous sequential description",
  426. "rave2.colorpalette.tealContinuousSequential.label": "Teal continuous sequential",
  427. "rave2.colorpalette.tealDiscreteSequential.description": "Teal discrete sequential description",
  428. "rave2.colorpalette.tealDiscreteSequential.label": "Teal discrete sequential",
  429. "rave2.colorpalette.tealPurpleContinuousDivergent.description": "Teal purple continuous divergent description",
  430. "rave2.colorpalette.tealPurpleContinuousDivergent.label": "Teal purple continuous divergent",
  431. "rave2.colorpalette.tealPurpleDiscreteDivergent.description": "Teal purple discrete divergent description",
  432. "rave2.colorpalette.tealPurpleDiscreteDivergent.label": "Teal purple discrete divergent",
  433. "rave2.colorpalette.violetContinuousSequential.description": "Violet continuous sequential description",
  434. "rave2.colorpalette.violetContinuousSequential.label": "Violet continuous sequential",
  435. "rave2.colorpalette.violetDiscreteSequential.description": "Violet discrete sequential description",
  436. "rave2.colorpalette.violetDiscreteSequential.label": "Violet discrete sequential",
  437. "rave2.colorpalette.yellowContinuousSequential.description": "Yellow continuous sequential description",
  438. "rave2.colorpalette.yellowContinuousSequential.label": "Yellow continuous sequential",
  439. "rave2.colorpalette.yellowDiscreteSequential.description": "Yellow discrete sequential description",
  440. "rave2.colorpalette.yellowDiscreteSequential.label": "Yellow discrete sequential",
  441. "transpose.description": "When set to Yes, the Y-axis shows the independent scale and the X-axis shows the dependent scale.",
  442. "transpose.falseLabel": "Do not transpose",
  443. "transpose.name": "Switch X and Y axes",
  444. "transpose.trueLabel": "Transpose",
  445. "zoom.description": "Zooms the chart in the X, Y, or both directions.",
  446. "zoom.name": "Zoom",
  447. "zoom.options.both": "Both",
  448. "zoom.options.none": "None",
  449. "zoom.options.x": "X",
  450. "zoom.options.y": "Y"
  451. }
  452. },{}],3:[function(require,module,exports){
  453. (function() {
  454. var $ = {};
  455. // $source: com/ibm/rave/bundles/internal/nativeImpl/BundleModuleHeader
  456. /************************************************************************
  457. ** IBM Confidential
  458. **
  459. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  460. **
  461. ** (C) Copyright IBM Corp. 2015
  462. **
  463. ** The source code for this program is not published or otherwise divested of its trade secrets,
  464. ** irrespective of what has been deposited with the U.S. Copyright Office.
  465. ************************************************************************/
  466. var com_ibm_rave_library_Library = rave["library"];
  467. rave["internal"]["Declare"] = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"];
  468. rave["internal"]["CSSUtil"]= rave["_"]["com_ibm_rave_core_internal_css_CSSUtil"];
  469. // $source: com/ibm/rave/bundles/RaveBundle
  470. /************************************************************************
  471. ** IBM Confidential
  472. **
  473. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  474. **
  475. ** (C) Copyright IBM Corp. 2017
  476. **
  477. ** The source code for this program is not published or otherwise divested of its trade secrets,
  478. ** irrespective of what has been deposited with the U.S. Copyright Office.
  479. ************************************************************************/
  480. // GENERATED
  481. //@import com/ibm/rave/bundles/internal/nativeImpl/RaveBundleResourceLoader (runtime) // new
  482. /**
  483. * A RaveBundle extends the regular Bundle abstract class but includes common functionality for Rave-made bundles that aren't for general use.
  484. */
  485. var com_ibm_rave_bundles_RaveBundle = rave['internal']['Declare'](rave['library']['internal']['Bundle'], {
  486. /** @expose */
  487. loader : null,
  488. /** @expose */
  489. constructor : function() {
  490. ;
  491. ;
  492. ;
  493. ;
  494. ;
  495. ;
  496. this.loader = new com_ibm_rave_bundles_internal_nativeImpl_RaveBundleResourceLoader("/com/ibm/rave/bundles/" + this.getName());
  497. },
  498. /**
  499. * Load extra resources required for this bundle. Currently the compiled configuration.json file. And .css.
  500. */
  501. /** @expose */
  502. loadResources : function() {
  503. this.setMessageCatalog(rave['library']['internal']['Bundle'].DEFAULT_LOCALE, require("./i18n/messages_en.json"));
  504. var array = require("./configuration/configuration.json");
  505. if (array) {
  506. for (var __i_enFor0 = 0, __exp_enFor0 = array, __len_enFor0 = __exp_enFor0.length;
  507. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  508. var artifact = __exp_enFor0[__i_enFor0];
  509. this.initialize(artifact);
  510. }
  511. }
  512. require("./vizlibrary.css");
  513. }
  514. });
  515. //com_ibm_rave_bundles_RaveBundle.CONFIGURATION_FILE = "./configuration/configuration.json";
  516. // $source: com/ibm/rave/bundles/internal/nativeImpl/RaveBundleResourceLoader
  517. // Intentionally empty - everything in this file is inlined
  518. var com_ibm_rave_bundles_internal_nativeImpl_RaveBundleResourceLoader = function(){};
  519. // $source: com/ibm/rave/bundles/views/BundleView
  520. /************************************************************************
  521. ** IBM Confidential
  522. **
  523. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  524. **
  525. ** (C) Copyright IBM Corp. 2017
  526. **
  527. ** The source code for this program is not published or otherwise divested of its trade secrets,
  528. ** irrespective of what has been deposited with the U.S. Copyright Office.
  529. ************************************************************************/
  530. // GENERATED
  531. //@import com/ibm/rave/bundles/components/BackgroundComponentImpl (runtime) // new
  532. //@import com/ibm/rave/bundles/components/ChartLayoutComponentImpl (runtime) // new
  533. //@import com/ibm/rave/bundles/components/ClipPathComponentImpl (runtime) // new
  534. //@import com/ibm/rave/bundles/components/LegendsManager (runtime) // new
  535. //@import com/ibm/rave/bundles/components/AxesManager (runtime) // new
  536. //@import com/ibm/rave/library/Library (runtime) // Library
  537. //@import com/ibm/rave/bundles/components/IntervalDataUtilities (runtime) // IntervalDataUtilities
  538. //@import com/ibm/rave/bundles/data/PointDataUtilities (runtime) // PointDataUtilities
  539. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  540. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor
  541. var com_ibm_rave_bundles_views_BundleView = rave['internal']['Declare'](rave['library']['internal']['AbstractView'], {
  542. /**
  543. * Background component
  544. */
  545. /** @expose */
  546. _backgroundComponent : null,
  547. /**
  548. * Layout component
  549. */
  550. /** @expose */
  551. _layoutComponent : null,
  552. /**
  553. * Clip component
  554. */
  555. /** @expose */
  556. _clip : null,
  557. /**
  558. * Axes manager
  559. */
  560. /** @expose */
  561. _axes : null,
  562. /**
  563. * Legends manager
  564. */
  565. /** @expose */
  566. _legends : null,
  567. //_groupStructure : null,
  568. /** @expose */
  569. _chart : null,
  570. /** @expose */
  571. dataModel : null,
  572. /** @expose */
  573. _zoomP : null,
  574. /** @expose */
  575. _zoomS : null,
  576. /** @expose */
  577. constructor : function(context) {
  578. },
  579. /** @expose */
  580. getGroupStructure : function() {},
  581. /** @expose */
  582. setup : function() {
  583. rave['library']['internal']['AbstractView'].prototype.setup.call(this);
  584. this._backgroundComponent = new com_ibm_rave_bundles_components_BackgroundComponentImpl();
  585. this._layoutComponent = new com_ibm_rave_bundles_components_ChartLayoutComponentImpl();
  586. this._clip = new com_ibm_rave_bundles_components_ClipPathComponentImpl(this.context.instanceId() + "clipViewport");
  587. if (this.isZoomSupported()) {
  588. this.resetZoom();
  589. }
  590. this._legends = new com_ibm_rave_bundles_components_LegendsManager(this.context, this.getLegendCount());
  591. if (this.isAxesManagerRequired()) {
  592. this._axes = new com_ibm_rave_bundles_components_AxesManager(this.context);
  593. }
  594. this._groupStructure = this.getGroupStructure();
  595. },
  596. /** @expose */
  597. preDraw : function(chartId) {
  598. this.cancelTransitions();
  599. rave['library']['internal']['AbstractView'].createGroupStructure(this.context.node, this._groupStructure);
  600. this._chart = this.context.node.selectAll(chartId);
  601. },
  602. /** @expose */
  603. resetZoom : function() {
  604. this._zoomP = [0, 0, 0, 0];
  605. this._zoomS = [1, 1, 1, 1];
  606. },
  607. /** @expose */
  608. validateDataModel : function(elementsToRemove) {
  609. if (elementsToRemove !== null || arguments.length > 1){
  610. elementsToRemove = Array.prototype.slice.call(arguments);
  611. }
  612. {
  613. this.dataModel = this.context.dataModel();
  614. if (!(this.dataValid())) {
  615. for (var __i_enFor0 = 0, __len_enFor0 = elementsToRemove.length;
  616. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  617. var e = elementsToRemove[__i_enFor0];
  618. this._chart.selectAll(e).selectAll("*").remove();
  619. }
  620. this._legends.visible(false).draw();
  621. return false;
  622. }
  623. return true;
  624. }
  625. },
  626. /** @expose */
  627. dataValid : function() {
  628. return this.dataModel.validate();
  629. },
  630. /** @expose */
  631. getLegendCount : function() {
  632. return 1;
  633. },
  634. /** @expose */
  635. isAxesManagerRequired : function() {
  636. return false;
  637. },
  638. /** @expose */
  639. isZoomSupported : function() {
  640. return true;
  641. },
  642. /** @expose */
  643. getProperty : function(s) {
  644. return this.context.getPropertyValue(s);
  645. },
  646. /** @expose */
  647. getPropertyDefault : function(s) {
  648. return this.context.getPropertyDefault(s);
  649. },
  650. /** @expose */
  651. getBooleanProperty : function(s) {
  652. var obj = this.getProperty(s);
  653. return (obj);
  654. },
  655. /** @expose */
  656. getDoubleProperty : function(s) {
  657. var obj = this.getProperty(s);
  658. return + (obj);
  659. },
  660. /** @expose */
  661. getIntProperty : function(s) {
  662. var obj = this.getProperty(s);
  663. return ~~ (obj);
  664. },
  665. /**
  666. * @param (String) id Property ID
  667. * @return (String) Property value as a string
  668. */
  669. /** @expose */
  670. getStringProperty : function(id) {
  671. var obj = this.getProperty(id);
  672. return (obj == null) ? null : ""+(obj);
  673. },
  674. /**
  675. * @param (String) id Property ID
  676. * @return (String) Property value as a string, returning null for the empty string
  677. */
  678. /** @expose */
  679. getStringPropertyEmptyAsNull : function(id) {
  680. var s = this.getStringProperty(id);
  681. return (s == null || s.length == 0) ? null : s;
  682. },
  683. /**
  684. * @param (String) id Property ID
  685. * @return (Number) Property value as a string, containing size as the number of pixels
  686. */
  687. /** @expose */
  688. getCSSSizeToPixelNumber : function(id) {
  689. var cssSize = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(this.context.getPropertyValue(id), 100.0, 10.0);
  690. return (cssSize == null) ? 0.0 : cssSize;
  691. },
  692. /**
  693. * Based on effect duration and effect property, determine the effect duration in ms.
  694. * @param (String) effect Effect name, one of the options available from EFFECT_OPTIONS.
  695. * @return (int) Effect duration in ms.
  696. */
  697. /** @expose */
  698. getEffectDuration : function(effect) {
  699. var duration = this.getIntProperty("effect.duration");
  700. if ((duration < 0) || (effect == null) || "none" == effect) {
  701. duration = 0;
  702. }
  703. return duration;
  704. },
  705. /** @expose */
  706. getTopPadding : function() {
  707. return this.getProperty("layout.chart.padding.top");
  708. },
  709. /** @expose */
  710. getLeftPadding : function() {
  711. return this.getProperty("layout.chart.padding.left");
  712. },
  713. /** @expose */
  714. getBottomPadding : function() {
  715. return this.getProperty("layout.chart.padding.bottom");
  716. },
  717. /** @expose */
  718. getRightPadding : function() {
  719. return this.getProperty("layout.chart.padding.right");
  720. },
  721. /** @expose */
  722. getLayoutPadding : function() {
  723. return this.getProperty("layout.padding");
  724. },
  725. /** @expose */
  726. getLegendChartGap : function() {
  727. return this.getProperty("layout.legendchart.gap");
  728. },
  729. /** @expose */
  730. getLegendChartAlign : function() {
  731. return this.getBooleanProperty("layout.legendchart.align");
  732. },
  733. /** @expose */
  734. getLegendPosition : function() {
  735. return this.getStringProperty("legend.position");
  736. },
  737. getPalette$0 : function() {
  738. return this.getPalette$1("color.palette");
  739. },
  740. getPalette$1 : function(paletteID) {
  741. var id = this.getStringProperty(paletteID);
  742. var colorPalette = com_ibm_rave_library_Library.palettes.getPalette(id);
  743. return (!colorPalette) ? com_ibm_rave_library_Library.palettes.getDefaultPalette() : colorPalette;
  744. },
  745. getDynamicPalette$0 : function() {
  746. return this.getDynamicPalette$1("color.palette", "color.dynamicPalette.min", "color.dynamicPalette.mid", "color.dynamicPalette.max");
  747. },
  748. /**
  749. * 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.
  750. * @param (String) paletteID The palette ID
  751. * @return (rave['library']['internal']['Palette']) Palette
  752. */
  753. getDynamicPalette$1 : function(paletteID, minId, midId, maxId) {
  754. var colorPalette;
  755. var min = this.getStringProperty(minId);
  756. if (min != null) {
  757. var mid = this.getStringProperty(midId);
  758. if (mid != null) {
  759. var max = this.getStringProperty(maxId);
  760. if (max != null) {
  761. var fills = [min, mid, max];
  762. colorPalette = rave['library']['internal']['AbstractView'].getFillPalette(fills);
  763. }
  764. }
  765. }
  766. return (!colorPalette) ? this.getPalette(paletteID) : colorPalette;
  767. },
  768. /** @expose */
  769. prepareLayoutComponent : function() {
  770. 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());
  771. },
  772. /** @expose */
  773. prepareLayoutSizables : function(layoutComponent, useX2, useY1, useX1, useY2, useLegend) {
  774. layoutComponent.removeAxisSizables();
  775. if (useX1) {
  776. layoutComponent.addAxisSizable(this._axes.axisComponent(0));
  777. }
  778. if (useY1) {
  779. layoutComponent.addAxisSizable(this._axes.axisComponent(2));
  780. }
  781. if (useX2) {
  782. layoutComponent.addAxisSizable(this._axes.axisComponent(1));
  783. }
  784. if (useY2) {
  785. layoutComponent.addAxisSizable(this._axes.axisComponent(3));
  786. }
  787. layoutComponent.legendSize(useLegend ? this._legends : null);
  788. },
  789. /** @expose */
  790. resetUpdate : function() {
  791. this.updateType = 4;
  792. },
  793. /** @expose */
  794. isUpdateNothing : function() {
  795. return this.updateType == 4;
  796. },
  797. /** @expose */
  798. isShowLegend : function() {
  799. return this.getBooleanProperty("legend.display");
  800. },
  801. cancelTransitions : function() {
  802. this.context.node.selectAll("*").interrupt();
  803. },
  804. /** @expose */
  805. setBackgroundProperties : function(elementRect, duration) {
  806. this._backgroundComponent.setPreExecute(this.context.getPreExecute()).size(this.context.size).backgroundColor(this.getStringProperty("background.chart.color"));
  807. this.context.node.selectAll("rect.background.chart").transition().duration(duration).call(this._backgroundComponent);
  808. this._backgroundComponent.setPreExecute(this.context.getPreExecute()).rect(elementRect).backgroundColor(this.getStringProperty("background.elements.color"));
  809. this.context.node.selectAll("rect.background.elements").transition().duration(duration).call(this._backgroundComponent);
  810. },
  811. /** @expose */
  812. isShowDataLabels : function() {
  813. return this.getBooleanProperty("data.label.display");
  814. },
  815. /** @expose */
  816. isShowDataLabelsAsPercentageOfColor : function() {
  817. var dataLabel = this.getStringProperty("data.label.type");
  818. return "PercentOfColor" == dataLabel;
  819. },
  820. /** @expose */
  821. isShowDataLabelsAsPercentageOfCategory : function() {
  822. var dataLabel = this.getStringProperty("data.label.type");
  823. return "PercentOfCategory" == dataLabel;
  824. },
  825. /** @expose */
  826. getlDataLabelAccessor : function(dataSet, slot, isInterval) {
  827. var labelAccessor;
  828. var labelEntry = dataSet.slot(slot).entry();
  829. if (!labelEntry) {
  830. if (this.isShowDataLabelsAsPercentageOfCategory()) {
  831. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR;
  832. } else if (this.isShowDataLabelsAsPercentageOfColor()) {
  833. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_COLOR_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_COLOR_ACCESSOR;
  834. } else {
  835. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.VALUE_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR;
  836. }
  837. } else {
  838. labelAccessor = rave['library']['internal']['AbstractView'].originalDatumAccessor(rave['library']['internal']['AbstractView'].accessorOf(labelEntry));
  839. }
  840. return labelAccessor;
  841. },
  842. /** @expose */
  843. getEntryForDataLabelFormatter : function(dataSet, labelSlot, defaultSlot) {
  844. var labelEntry = dataSet.slot(labelSlot).entry();
  845. return labelEntry ? labelEntry : dataSet.slot(defaultSlot).entry();
  846. },
  847. /** @expose */
  848. getBackgroundConstrastLabelStyle : function() {
  849. var labelFontStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(this.getStringProperty("labelstyle.font"));
  850. if (this.getBooleanProperty("contrast.label.color") == false) {
  851. return labelFontStyle;
  852. }
  853. var defaultFillColor;
  854. if (labelFontStyle) {
  855. defaultFillColor = labelFontStyle["fill"];
  856. if (defaultFillColor == null) {
  857. defaultFillColor = labelFontStyle["color"];
  858. }
  859. } else {
  860. labelFontStyle = {};
  861. }
  862. if (defaultFillColor == null) {
  863. defaultFillColor = "#000000";
  864. }
  865. labelFontStyle["fill"] = com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(this.getStringProperty("background.elements.color"), defaultFillColor);
  866. return labelFontStyle;
  867. },
  868. /** @expose */
  869. getPalette : function(a0) {
  870. var args = arguments;
  871. if (args.length == 0) {
  872. return this.getPalette$0();
  873. }
  874. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  875. return this.getPalette$1(a0);
  876. }
  877. return rave['library']['internal']['AbstractView'].prototype.getPalette.apply(this, args);
  878. },
  879. /** @expose */
  880. getDynamicPalette : function(a0, a1, a2, a3) {
  881. var args = arguments;
  882. if (args.length == 0) {
  883. return this.getDynamicPalette$0();
  884. }
  885. return this.getDynamicPalette$1(a0, a1, a2, a3);
  886. }
  887. });
  888. // $source: com/ibm/rave/bundles/components/BundleComponentImpl
  889. /************************************************************************
  890. ** IBM Confidential
  891. **
  892. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  893. **
  894. ** (C) Copyright IBM Corp. 2017
  895. **
  896. ** The source code for this program is not published or otherwise divested of its trade secrets,
  897. ** irrespective of what has been deposited with the U.S. Copyright Office.
  898. ************************************************************************/
  899. // GENERATED
  900. var com_ibm_rave_bundles_components_BundleComponentImpl = rave['internal']['Declare']({
  901. /**
  902. * The pre-execution callback.
  903. */
  904. //_preExecuteCallback : null,
  905. /**
  906. * The render callback.
  907. */
  908. /** @expose */
  909. _renderCallback : null,
  910. _$functionClassMethod : function() {
  911. var _$self = function(args) {
  912. if (args !== null || arguments.length > 1){
  913. args = Array.prototype.slice.call(arguments, 0);
  914. }
  915. {
  916. var self = _$self;
  917. this.each(function(data, index, groupIndex) {
  918. self.execute(rave.select(this));
  919. });
  920. return null;
  921. }
  922. };
  923. return _$self;
  924. },
  925. /**
  926. * 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.
  927. * @param (rave['internal']['Selector']) g <g> node that this component will be applied to.
  928. */
  929. /** @expose */
  930. execute : function(g) {},
  931. /**
  932. * Set the pre-execute callback for this component.
  933. * @param (rave['library']['internal']['ComponentCallback']) callback The callback
  934. */
  935. /** @expose */
  936. setPreExecute : function(callback) {
  937. this._preExecuteCallback = callback;
  938. return this;
  939. },
  940. /**
  941. * If the pre-execute component is non-null, call it with this object. Note that this object must also implement BundleComponent.
  942. */
  943. /** @expose */
  944. preExecute : function() {
  945. if (this._preExecuteCallback) {
  946. this._preExecuteCallback(this);
  947. }
  948. },
  949. /**
  950. * Set the render callback for this component.
  951. * @param (rave['internal']['RunFunction']) callback The callback
  952. */
  953. /** @expose */
  954. setRenderCallback : function(callback) {
  955. this._renderCallback = callback;
  956. return this;
  957. },
  958. /**
  959. * 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.
  960. */
  961. /** @expose */
  962. type : function() {},
  963. /** @expose */
  964. updateBorder : function(s, borderWidth, borderColor) {
  965. if (borderWidth != null) {
  966. s.each(function(data, index, groupIndex) {
  967. if (!((this.rave_getProperty("selected"))) && !((this.rave_getProperty("highlighted")))) {
  968. this.rave_setStyle("stroke-width", borderWidth, "");
  969. }
  970. });
  971. }
  972. if (borderColor != null) {
  973. s.each(function(data, index, groupIndex) {
  974. if (!((this.rave_getProperty("selected"))) && !((this.rave_getProperty("highlighted")))) {
  975. this.rave_setStyle("stroke", borderColor, "");
  976. }
  977. });
  978. }
  979. },
  980. /** @expose */
  981. getDefaultLabelColor : function(_labelStyle) {
  982. if (!_labelStyle) {
  983. return "#000000";
  984. }
  985. var defaultFillColor;
  986. if (_labelStyle) {
  987. defaultFillColor = _labelStyle["fill"];
  988. if (defaultFillColor == null) {
  989. defaultFillColor = _labelStyle["color"];
  990. }
  991. }
  992. if (defaultFillColor == null) {
  993. defaultFillColor = "#000000";
  994. }
  995. return defaultFillColor.toString();
  996. }
  997. });
  998. // $source: com/ibm/rave/bundles/component/BackgroundComponent
  999. /************************************************************************
  1000. ** IBM Confidential
  1001. **
  1002. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1003. **
  1004. ** (C) Copyright IBM Corp. 2017
  1005. **
  1006. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1007. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1008. ************************************************************************/
  1009. // GENERATED
  1010. /**
  1011. * <p> A component that renders the background to the chart. The {@link #this.type()} method returns "BackgroundComponent". </p>
  1012. */
  1013. var com_ibm_rave_bundles_component_BackgroundComponent = rave['internal']['Declare'].implement(
  1014. /**
  1015. * Get the background color.
  1016. * @return (String) The background color
  1017. */
  1018. //backgroundColor : function() {},
  1019. /**
  1020. * Set the background color. If the color is null, white is used.
  1021. * @param (String) backgroundColor The new background color
  1022. * @return (com.ibm.rave.bundles.component.BackgroundComponent) This object
  1023. */
  1024. //backgroundColor : function(backgroundColor) {}
  1025. );
  1026. /**
  1027. * The string returned by {@link #this.type()} is "BackgroundComponent".
  1028. */
  1029. /** @expose */
  1030. com_ibm_rave_bundles_component_BackgroundComponent.COMPONENT_TYPE = "BackgroundComponent";
  1031. // $source: com/ibm/rave/bundles/component/ChartLayoutComponent
  1032. /************************************************************************
  1033. ** IBM Confidential
  1034. **
  1035. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1036. **
  1037. ** (C) Copyright IBM Corp. 2017
  1038. **
  1039. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1040. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1041. ************************************************************************/
  1042. // GENERATED
  1043. /**
  1044. * <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>
  1045. */
  1046. var com_ibm_rave_bundles_component_ChartLayoutComponent = rave['internal']['Declare'].implement(
  1047. //padding : function() {},
  1048. //topPadding : function() {},
  1049. //leftPadding : function() {},
  1050. //bottomPadding : function() {},
  1051. //rightPadding : function() {},
  1052. //legendChartAlign : function() {},
  1053. //legendPosition : function() {},
  1054. //legendChartGap : function() {},
  1055. //legendPosition : function(position) {},
  1056. //topPadding : function(value) {},
  1057. //leftPadding : function(value) {},
  1058. //bottomPadding : function(value) {},
  1059. //rightPadding : function(value) {},
  1060. /**
  1061. * Sets the padding around the outside of the chart/legend.
  1062. * @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.
  1063. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1064. */
  1065. //padding : function(value) {},
  1066. /**
  1067. * Sets all chart paddings. Null values are treated as 0.
  1068. * @param (Object) top New top padding
  1069. * @param (Object) left New left padding
  1070. * @param (Object) bottom New bottom padding
  1071. * @param (Object) right New right padding
  1072. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1073. * @deprecated Please use {@link #this.padding(Object)} and {@link #this.legendChartGap(Object)}
  1074. */
  1075. //chartPadding : function(top, left, bottom, right) {},
  1076. /**
  1077. * Sets whether the legend should align with the chart "body".
  1078. * @param (boolean) legendChartAlign the boolean state
  1079. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1080. */
  1081. //legendChartAlign : function(legendChartAlign) {},
  1082. /**
  1083. * Set the space for the gap between chart and legend
  1084. * @param (Object) value the gap distance (css length)
  1085. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1086. */
  1087. //legendChartGap : function(value) {},
  1088. /**
  1089. * Set the size information for the legend. Null value is treated as no visible legend.
  1090. * @param (com.ibm.rave.bundles.component.ChartLayoutSizable) sizable An object that implements the ChartLayoutSizable interface
  1091. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1092. */
  1093. //legendSize : function(sizable) {},
  1094. /**
  1095. * Reset list of axis sizables to 0
  1096. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1097. */
  1098. //removeAxisSizables : function() {},
  1099. /**
  1100. * Add an axis to be considered in layout operation.
  1101. * @param (com.ibm.rave.bundles.component.ChartLayoutSizable) sizable An object that implements the ChartLayoutSizable interface
  1102. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1103. */
  1104. //addAxisSizable : function(sizable) {}
  1105. );
  1106. /**
  1107. * The string returned by {@link #this.type()} is "ChartLayoutComponent".
  1108. */
  1109. /** @expose */
  1110. com_ibm_rave_bundles_component_ChartLayoutComponent.COMPONENT_TYPE = "ChartLayoutComponent";
  1111. // $source: com/ibm/rave/bundles/components/LegendsManager
  1112. /************************************************************************
  1113. ** IBM Confidential
  1114. **
  1115. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1116. **
  1117. ** (C) Copyright IBM Corp. 2017
  1118. **
  1119. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1120. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1121. ************************************************************************/
  1122. // GENERATED
  1123. //@import com/ibm/rave/bundles/components/LegendComponentImpl (runtime) // new, orientationOf
  1124. /**
  1125. * <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>
  1126. */
  1127. var com_ibm_rave_bundles_components_LegendsManager = rave['internal']['Declare']({
  1128. /**
  1129. * Bundle context
  1130. */
  1131. //_context : null,
  1132. /**
  1133. * Component used to draw all legends
  1134. */
  1135. //_comp : null,
  1136. /**
  1137. * Global visibility; if false no legends are drawn
  1138. */
  1139. //_visible : null,
  1140. /**
  1141. * Rectangle containing all legends
  1142. */
  1143. //_rectangle : null,
  1144. /**
  1145. * Legend orientation
  1146. */
  1147. //_orient : null,
  1148. /**
  1149. * Pre-execute component callback
  1150. */
  1151. //_preExecute : null,
  1152. /**
  1153. * Selectors for each legend
  1154. */
  1155. //_selectors : null,
  1156. /**
  1157. * Palettes for each legend
  1158. */
  1159. //_palettes : null,
  1160. /**
  1161. * Scale size functions for each legend
  1162. */
  1163. //_scale : null,
  1164. /**
  1165. * Swatch size functions for each legend
  1166. */
  1167. //_swatchSizes : null,
  1168. /**
  1169. * Shapes for each legend
  1170. */
  1171. //_shapes : null,
  1172. /**
  1173. * Titles for each legend
  1174. */
  1175. //_titles : null,
  1176. /**
  1177. * Title fonts for each legend
  1178. */
  1179. //_titleFonts : null,
  1180. /**
  1181. * Title fills for each legend
  1182. */
  1183. //_titleFills : null,
  1184. /**
  1185. * Title font sizes for each legend
  1186. */
  1187. //_titleFontSizes : null,
  1188. /**
  1189. * Title font families for each legend
  1190. */
  1191. //_titleFontFamilies : null,
  1192. /**
  1193. * Entry fonts for each legend
  1194. */
  1195. //_entryFonts : null,
  1196. /**
  1197. * Custom formatters for each legend, created from the registered custom formatters
  1198. */
  1199. //_formatters : null,
  1200. /**
  1201. * Whether each legend was visible in the last draw
  1202. */
  1203. //_lastVisible : null,
  1204. //_dataSlotEntries : null,
  1205. /**
  1206. * Number of legends
  1207. */
  1208. _numLegends : 0,
  1209. /**
  1210. * Whether to use a transition.
  1211. */
  1212. _doTransition : false,
  1213. /**
  1214. * Duration of the transition.
  1215. */
  1216. _duration : 0,
  1217. _spaceUsed : 0,
  1218. /**
  1219. * Construct the manager.
  1220. * @param (int) numLegends Number of legends, must be positive
  1221. */
  1222. /** @expose */
  1223. constructor : function(context, numLegends) {
  1224. this._context = context;
  1225. this._numLegends = numLegends;
  1226. this._comp = new com_ibm_rave_bundles_components_LegendComponentImpl();
  1227. this._rectangle = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1228. this._orient = "vertical";
  1229. this._preExecute = null;
  1230. this._selectors = [];
  1231. this._palettes = [];
  1232. this._scale = [];
  1233. this._swatchSizes = [];
  1234. this._shapes = [];
  1235. this._titles = [];
  1236. this._titleFonts = [];
  1237. this._titleFills = [];
  1238. this._titleFontSizes = [];
  1239. this._titleFontFamilies = [];
  1240. this._entryFonts = [];
  1241. this._formatters = [];
  1242. this._lastVisible = [];
  1243. this._visible = [];
  1244. this._dataSlotEntries = [];
  1245. for (var i = 0; i < this._numLegends; ++i) {
  1246. this._selectors[i] = null;
  1247. this._palettes[i] = null;
  1248. this._swatchSizes[i] = null;
  1249. this._shapes[i] = null;
  1250. this._titles[i] = null;
  1251. this._formatters[i] = null;
  1252. this._lastVisible[i] = false;
  1253. this._visible[i] = true;
  1254. }
  1255. },
  1256. /**
  1257. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) The legend component used by this manager; for unit tests
  1258. */
  1259. getLegendComponent : function() {
  1260. return this._comp;
  1261. },
  1262. /**
  1263. * Set a specific legend visible
  1264. * @param (int) legendIndex The index of the legend
  1265. * @param (boolean) visible New value of visible flag
  1266. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1267. */
  1268. visible$0 : function(legendIndex, visible) {
  1269. if (legendIndex < this._visible.length) {
  1270. this._visible[legendIndex] = visible;
  1271. }
  1272. return this;
  1273. },
  1274. /**
  1275. * Set all legend visible
  1276. * @param (boolean) visible New value of visible flag
  1277. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1278. */
  1279. visible$1 : function(visible) {
  1280. for (var i = 0; i < this._visible.length; ++i) {
  1281. this._visible[i] = visible;
  1282. }
  1283. return this;
  1284. },
  1285. /**
  1286. * Set the layout rectangle. The rectangle is copied. If it is null, the layout rectangle is unchanged.
  1287. * @param (rave['internal']['RectStruct']) rect New layout rectangle
  1288. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1289. */
  1290. /** @expose */
  1291. rectangle : function(rect) {
  1292. if (rect) {
  1293. this._rectangle = new rave['internal']['RectStruct'](rect.x, rect.y, rect.width, rect.height);
  1294. }
  1295. return this;
  1296. },
  1297. /**
  1298. * Set the orient property. If the argument is not "horizontal" or "vertical", the orient property is not changed.
  1299. * @param (String) orient New orient
  1300. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1301. */
  1302. /** @expose */
  1303. orient : function(orient) {
  1304. if ("horizontal" == orient || "vertical" == orient) {
  1305. this._orient = orient;
  1306. }
  1307. return this;
  1308. },
  1309. /**
  1310. * 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".
  1311. * @param (String) position Legend position
  1312. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1313. */
  1314. /** @expose */
  1315. position : function(position) {
  1316. return this.orient(com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf(position));
  1317. },
  1318. /**
  1319. * Set the transition information. If the duration is negative, 0 is used.
  1320. * @param (boolean) doTransition Whether to do a transition
  1321. * @param (int) duration Duration of the transition when used
  1322. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1323. */
  1324. /** @expose */
  1325. transition : function(doTransition, duration) {
  1326. this._doTransition = doTransition;
  1327. this._duration = (duration >= 0) ? duration : 0;
  1328. return this;
  1329. },
  1330. /**
  1331. * Set the pre-execute callback for all legends. The callback may be null.
  1332. * @param (rave['library']['internal']['ComponentCallback']) callback The callback
  1333. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1334. */
  1335. /** @expose */
  1336. setPreExecute : function(callback) {
  1337. this._preExecute = callback;
  1338. return this;
  1339. },
  1340. /**
  1341. * Set the selector to be used when rendering a legend. If the index is out of range no selectors change.
  1342. * @param (int) index Legend array index
  1343. * @param (rave['internal']['Selector']) selector Selector, may be null (but this is not advisable)
  1344. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1345. */
  1346. /** @expose */
  1347. selector : function(index, selector) {
  1348. if (index >= 0 && index < this._numLegends) {
  1349. this._selectors[index] = selector;
  1350. }
  1351. return this;
  1352. },
  1353. /**
  1354. * Set the palette of a legend. If the index is out of range no information is changed.
  1355. * @param (int) index Legend array index
  1356. * @param (rave['library']['internal']['Palette']) palette Palette, may be null
  1357. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1358. */
  1359. /** @expose */
  1360. palette : function(index, palette) {
  1361. if (index >= 0 && index < this._numLegends) {
  1362. this._palettes[index] = palette;
  1363. }
  1364. return this;
  1365. },
  1366. /**
  1367. * Set the shape of a legend. If the index is out of range no information is changed.
  1368. * @param (int) index Legend array index
  1369. * @param (String) shape Shape, may be null (defaulting to square)
  1370. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1371. */
  1372. /** @expose */
  1373. shape : function(index, shape) {
  1374. if (index >= 0 && index < this._numLegends) {
  1375. this._shapes[index] = shape;
  1376. }
  1377. return this;
  1378. },
  1379. /**
  1380. * Set the title of a legend. If the index is out of range no information is changed.
  1381. * @param (int) index Legend array index
  1382. * @param (String) title Title, may be null
  1383. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1384. */
  1385. /** @expose */
  1386. title : function(index, title) {
  1387. if (index >= 0 && index < this._numLegends) {
  1388. this._titles[index] = title;
  1389. }
  1390. return this;
  1391. },
  1392. /**
  1393. * Set the title font style of a legend. If the index is out of range no information is changed.
  1394. * @param (int) index Legend array index
  1395. * @param (String) titleFont Title font string, may be null
  1396. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1397. */
  1398. /** @expose */
  1399. titleFont : function(index, titleFont) {
  1400. if (index >= 0 && index < this._numLegends) {
  1401. this._titleFonts[index] = titleFont;
  1402. }
  1403. return this;
  1404. },
  1405. /**
  1406. * Set the entry font style of a legend. If the index is out of range no information is changed.
  1407. * @param (int) index Legend array index
  1408. * @param (String) entryFont Entry font string, may be null
  1409. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1410. */
  1411. /** @expose */
  1412. entryFont : function(index, entryFont) {
  1413. if (index >= 0 && index < this._numLegends) {
  1414. this._entryFonts[index] = entryFont;
  1415. }
  1416. return this;
  1417. },
  1418. /**
  1419. * Set the title fill of a legend. If the index is out of range no information is changed.
  1420. * @param (int) index Legend array index
  1421. * @param (String) titleFill Fill color string, may be null
  1422. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1423. */
  1424. /** @expose */
  1425. titleFill : function(index, titleFill) {
  1426. if (index >= 0 && index < this._numLegends) {
  1427. this._titleFills[index] = titleFill;
  1428. }
  1429. return this;
  1430. },
  1431. /**
  1432. * Set the title font size of a legend. If the index is out of range no information is changed.
  1433. * @param (int) index Legend array index
  1434. * @param (String) titleFontSize Font size string, may be null
  1435. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1436. */
  1437. /** @expose */
  1438. titleFontSize : function(index, titleFontSize) {
  1439. if (index >= 0 && index < this._numLegends) {
  1440. this._titleFontSizes[index] = titleFontSize;
  1441. }
  1442. return this;
  1443. },
  1444. /**
  1445. * Set the title font family of a legend. If the index is out of range no information is changed.
  1446. * @param (int) index Legend array index
  1447. * @param (String) titleFontFamily Font family string, may be null
  1448. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1449. */
  1450. /** @expose */
  1451. titleFontFamily : function(index, titleFontFamily) {
  1452. if (index >= 0 && index < this._numLegends) {
  1453. this._titleFontFamilies[index] = titleFontFamily;
  1454. }
  1455. return this;
  1456. },
  1457. /**
  1458. * Set the scale of a legend. If the index is out of range no information is changed.
  1459. * @param (int) index Legend array index
  1460. * @param (rave['internal']['AbstractScale']) scale Scale, may be null
  1461. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1462. */
  1463. /** @expose */
  1464. scale : function(index, scale) {
  1465. if (index >= 0 && index < this._numLegends) {
  1466. this._scale[index] = scale;
  1467. }
  1468. return this;
  1469. },
  1470. /**
  1471. * Set the swatch size function of a legend. If the index is out of range no information is changed.
  1472. * @param (int) index Legend array index
  1473. * @param (rave['internal']['ValueFunction']) swatchSize Swatch size function, may be null
  1474. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1475. */
  1476. /** @expose */
  1477. swatchSize : function(index, swatchSize) {
  1478. if (index >= 0 && index < this._numLegends) {
  1479. this._swatchSizes[index] = swatchSize;
  1480. }
  1481. return this;
  1482. },
  1483. /**
  1484. * 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.
  1485. * @param (int) index Legend array index
  1486. * @param (Array) entries List of data slot entries, if null an empty list is used
  1487. * @param (String) format One of {@link this.CustomFormatInfo#"none"} or {@link this.CustomFormatInfo#"percent"}
  1488. * @param (rave['internal']['ValueFunction']) defaultFunction Default function to use if no custom formatter is defined, may be null
  1489. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1490. */
  1491. /** @expose */
  1492. formatterList : function(index, entries, format, defaultFunction) {
  1493. if (index >= 0 && index < this._numLegends) {
  1494. this._formatters[index] = this._context.getCustomFormatterWithFlag(["legend", "all"], rave['library']['internal']['BundleContext'].makeCustomFormatInfo("legend-label", "ROLE_NONE", format, entries), defaultFunction, false);
  1495. }
  1496. return this;
  1497. },
  1498. /**
  1499. * 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.
  1500. * @param (int) index Legend array index
  1501. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  1502. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1503. */
  1504. /** @expose */
  1505. formatter : function(index, entry) {
  1506. var entries = [];
  1507. if (entry) {
  1508. entries.push(entry);
  1509. }
  1510. return this.formatterList(index, entries, "none", null);
  1511. },
  1512. /**
  1513. * 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.
  1514. * @return (boolean) Whether any legend are visible (will be drawn)
  1515. */
  1516. /** @expose */
  1517. anyVisible : function() {
  1518. for (var i = 0; i < this._numLegends; ++i) {
  1519. if (this._visible[i] == true && (this._palettes[i] || this._swatchSizes[i])) {
  1520. return true;
  1521. }
  1522. }
  1523. return false;
  1524. },
  1525. /**
  1526. * 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'])} .
  1527. * @param (int) index Legend array index
  1528. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  1529. * @return (com.ibm.rave.bundles.components.LegendsManager) This LegendsManager
  1530. */
  1531. /** @expose */
  1532. setDataSlot : function(index, entry) {
  1533. if (index >= 0 && index < this._numLegends) {
  1534. this._dataSlotEntries[index] = entry;
  1535. }
  1536. return this.formatter(index, entry);
  1537. },
  1538. preLayout$0 : function(layoutComponent) {
  1539. this.preLayout$1(layoutComponent, true);
  1540. return this;
  1541. },
  1542. preLayout$1 : function(layoutComponent, axesBeforeLegend) {
  1543. var layoutTransition = this._doTransition;
  1544. var layoutDuration = this._duration;
  1545. this._doTransition = false;
  1546. this._duration = 0;
  1547. var children = [];
  1548. for (var i = 0; i < this._numLegends; ++i) {
  1549. children[i] = "g.layoutLegend-" + i;
  1550. }
  1551. rave['library']['internal']['AbstractView'].createGroupStructure(this._context.node.select("g.legends-layout"), children);
  1552. var layoutSelectors = [];
  1553. var layoutLastVisible = [];
  1554. for (var i = 0; i < this._numLegends; ++i) {
  1555. layoutSelectors[i] = this._selectors[i];
  1556. layoutLastVisible[i] = this._lastVisible[i];
  1557. this._lastVisible[i] = false;
  1558. if (this._selectors[i]) {
  1559. this._selectors[i] = this._context.node.select("g.layoutLegend-" + i);
  1560. }
  1561. }
  1562. layoutComponent.preLayout(true, !axesBeforeLegend);
  1563. this.rectangle(layoutComponent.legendRect());
  1564. this.draw();
  1565. this._doTransition = layoutTransition;
  1566. this._duration = layoutDuration;
  1567. this._context.node.select("g.legends-layout").selectAll("*").remove();
  1568. for (var i = 0; i < this._numLegends; ++i) {
  1569. this._lastVisible[i] = layoutLastVisible[i];
  1570. this._selectors[i] = layoutSelectors[i];
  1571. }
  1572. return this;
  1573. },
  1574. /**
  1575. * Render the legends using the current global and per-legend settings.
  1576. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1577. */
  1578. /** @expose */
  1579. draw : function() {
  1580. var nVisible = 0;
  1581. for (var i = 0; i < this._numLegends; ++i) {
  1582. if ((this._swatchSizes[i] || this._palettes[i]) && this._visible[i]) {
  1583. nVisible++;
  1584. }
  1585. }
  1586. var x = this._rectangle.x;
  1587. var y = this._rectangle.y;
  1588. var dx;
  1589. var dy;
  1590. var size;
  1591. if (nVisible == 0) {
  1592. dx = 0;
  1593. dy = 0;
  1594. size = [this._rectangle.width, this._rectangle.height];
  1595. } else if ("horizontal" == this._orient) {
  1596. dx = this._rectangle.width / nVisible;
  1597. dy = 0;
  1598. size = [dx, this._rectangle.height];
  1599. } else {
  1600. dx = 0;
  1601. dy = this._rectangle.height / nVisible;
  1602. size = [this._rectangle.width, dy];
  1603. }
  1604. this._comp.orient(this._orient).size(size);
  1605. this._spaceUsed = 0;
  1606. for (var i = 0; i < this._numLegends; ++i) {
  1607. if (this._selectors[i]) {
  1608. var visible = this._visible[i] && (this._palettes[i] || this._swatchSizes[i]);
  1609. 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]);
  1610. var fontStyle = this._context.getPropertyValue("legend.titlestyle.font");
  1611. if (this._titleFonts[i] != null && !(this._titleFonts[i] == "")) {
  1612. this._comp.titleFont(this._titleFonts[i]);
  1613. } else if (fontStyle != null && !(fontStyle == "")) {
  1614. this._comp.titleFont(this._context.getPropertyValue("legend.titlestyle.font"));
  1615. }
  1616. fontStyle = this._context.getPropertyValue("legend.entrystyle.font");
  1617. if (this._entryFonts[i] != null) {
  1618. this._comp.entryFont(this._entryFonts[i]);
  1619. } else if (fontStyle != null && !(fontStyle == "")) {
  1620. this._comp.entryFont(this._context.getPropertyValue("legend.entrystyle.font"));
  1621. }
  1622. var s = (this._doTransition && this._lastVisible[i]) ? this._selectors[i].transition("transition").duration(this._duration) : this._selectors[i];
  1623. s.attr("transform", "translate(" + x + "," + y + ")").call(this._comp);
  1624. var dataSlotEntries = [];
  1625. if (this._dataSlotEntries[i]) {
  1626. dataSlotEntries.push(this._dataSlotEntries[i]);
  1627. }
  1628. this._selectors[i].selectAll(".legendTitle").property("dataSlots", dataSlotEntries);
  1629. if (visible) {
  1630. x += dx;
  1631. y += dy;
  1632. if (this._comp.getSpaceUsed() > this._spaceUsed) {
  1633. this._spaceUsed = this._comp.getSpaceUsed();
  1634. }
  1635. }
  1636. this._lastVisible[i] = visible;
  1637. } else {
  1638. this._lastVisible[i] = false;
  1639. }
  1640. }
  1641. return this;
  1642. },
  1643. /** @expose */
  1644. getSizableType : function() {
  1645. return 2;
  1646. },
  1647. /** @expose */
  1648. getSizableOrientation : function() {
  1649. return this._orient;
  1650. },
  1651. /** @expose */
  1652. getPreferredSize : function() {
  1653. return this._spaceUsed;
  1654. },
  1655. /** @expose */
  1656. getSpillOverSize : function() {
  1657. return 0;
  1658. },
  1659. /** @expose */
  1660. visible : function(a0, a1) {
  1661. var args = arguments;
  1662. if (args.length == 1) {
  1663. return this.visible$1(a0);
  1664. }
  1665. return this.visible$0(a0, a1);
  1666. },
  1667. /** @expose */
  1668. preLayout : function(a0, a1) {
  1669. var args = arguments;
  1670. if (args.length == 1) {
  1671. return this.preLayout$0(a0);
  1672. }
  1673. return this.preLayout$1(a0, a1);
  1674. }
  1675. });
  1676. // $source: com/ibm/rave/bundles/utilities/FontPropertyParser
  1677. /************************************************************************
  1678. ** IBM Confidential
  1679. **
  1680. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1681. **
  1682. ** (C) Copyright IBM Corp. 2017
  1683. **
  1684. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1685. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1686. ************************************************************************/
  1687. // GENERATED
  1688. var com_ibm_rave_bundles_utilities_FontPropertyParser = rave['internal']['Declare']({
  1689. });
  1690. /**
  1691. * Method to parse the css font styles and return a style map.
  1692. * @param (String) fontStyle CSS string (eg. "font-family: courier; font-size: 22; fill: red")
  1693. * @return (Object) Font Style Map
  1694. */
  1695. /** @expose */
  1696. com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont = function(fontStyle) {
  1697. if (fontStyle != null && fontStyle.length > 0) {
  1698. var properties = fontStyle.split(new RegExp(";"));
  1699. var fontStyles = {};
  1700. for (var __i_enFor0 = 0, __len_enFor0 = properties.length;
  1701. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1702. var property = properties[__i_enFor0];
  1703. var fontMap = property.split(new RegExp(":"));
  1704. if (fontMap.length == 2) {
  1705. var key = fontMap[0].trim();
  1706. fontStyles[key == "color" ? "fill" : key] = fontMap[1].trim();
  1707. }
  1708. }
  1709. return fontStyles;
  1710. }
  1711. return null;
  1712. };
  1713. // $source: com/ibm/rave/bundles/components/AxesManager
  1714. /************************************************************************
  1715. ** IBM Confidential
  1716. **
  1717. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1718. **
  1719. ** (C) Copyright IBM Corp. 2018
  1720. **
  1721. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1722. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1723. ************************************************************************/
  1724. // GENERATED
  1725. //@import com/ibm/rave/bundles/components/AxisComponentImpl (runtime) // new, getTranslation
  1726. //@import com/ibm/rave/bundles/components/GridComponentImpl (runtime) // new
  1727. //@import com/ibm/rave/bundles/components/ClipPathComponentImpl (runtime) // new
  1728. /**
  1729. * <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>
  1730. */
  1731. var com_ibm_rave_bundles_components_AxesManager = rave['internal']['Declare']({
  1732. /**
  1733. * Bundle context
  1734. */
  1735. //_context : null,
  1736. /**
  1737. * Selector for the bundle defs node. If null, no clip paths will be defined.
  1738. */
  1739. //_defs : null,
  1740. /**
  1741. * Scales for the axes, indexed by X1, X2, Y1, Y2
  1742. */
  1743. //_scales : null,
  1744. /**
  1745. * Whether to suppress labels when panning, indexed by X1, X2, Y1, Y2.
  1746. */
  1747. //_suppressPanLabels : null,
  1748. /**
  1749. * Value of the axis drawAxisLabels, set when axis is drawn, indexed by X1, X2, Y1, Y2.
  1750. */
  1751. //_drawAxisLabels : null,
  1752. /**
  1753. * Axis components created on demand, indexed by X1, X2, Y1, Y2
  1754. */
  1755. //_axisComponents : null,
  1756. /**
  1757. * When last drawn, the selector used for each axis role, indexed by X1, X2, Y1, Y2; used for redraws.
  1758. */
  1759. //_lastAxisDrawSelectors : null,
  1760. /**
  1761. * Grid components created on demand, indexed by X1, X2, Y1, Y2
  1762. */
  1763. //_gridComponents : null,
  1764. /**
  1765. * When last drawn, the selector used for each grid role, indexed by X1, X2, Y1, Y2; used for redraws.
  1766. */
  1767. //_lastGridDrawSelectors : null,
  1768. /**
  1769. * For clearing axis
  1770. */
  1771. //_clearAxis : null,
  1772. /**
  1773. * For clearing grid
  1774. */
  1775. //_clearGrid : null,
  1776. /**
  1777. * Selectors for the axis groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1778. */
  1779. //_axisSelectors : null,
  1780. /**
  1781. * Selectors for the grid groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1782. */
  1783. //_gridSelectors : null,
  1784. /**
  1785. * Bounding rectangles for the axis groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1786. */
  1787. //_axisRects : null,
  1788. /**
  1789. * Center elements bounds, also the grid bounds.
  1790. */
  1791. //_elementRect : null,
  1792. /**
  1793. * Whether anything was drawn into the axis group last time, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1794. */
  1795. //_lastAxisDrew : null,
  1796. /**
  1797. * Whether anything was drawn into the grid group last time, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1798. */
  1799. //_lastGridDrew : null,
  1800. //_dataSlotEntries : null,
  1801. //_layoutAxisOrder : null,
  1802. /**
  1803. * On the first draw, no transitions are used.
  1804. */
  1805. _firstDraw : false,
  1806. /**
  1807. * Whether to draw the axes and grids.
  1808. */
  1809. _visible : true,
  1810. /**
  1811. * Transition duration, ms
  1812. */
  1813. _duration : 0,
  1814. /**
  1815. * Transpose the axes (assign X to left/right and Y to top/bottom)
  1816. */
  1817. _transpose : false,
  1818. /**
  1819. * Switch the independent (X) axes, drawing X1 where X2 normally goes and vice-versa
  1820. */
  1821. _swapX : false,
  1822. /**
  1823. * Switch the dependent (Y) axes, drawing Y1 where Y2 normally goes and vice-versa
  1824. */
  1825. _swapY : false,
  1826. _layoutInProgress : false,
  1827. _layoutMaxWidth : 0,
  1828. _layoutMaxHeight : 0,
  1829. _xPadding : 0, _xOuterPadding : 0, _yPadding : 0, _yOuterPadding : 0,
  1830. _xPixelPad : 0, _yPixelPad : 0,
  1831. /**
  1832. * Hack to allow heatmap in "unit cell" mode to disable stagger because of the post scaling that messes up axis layout
  1833. */
  1834. _preventStaggerRotate45 : false,
  1835. constructor : function(context) {
  1836. this._scales = [];
  1837. this._suppressPanLabels = [];
  1838. this._drawAxisLabels = [];
  1839. this._axisComponents = [];
  1840. this._lastAxisDrawSelectors = [];
  1841. this._gridComponents = [];
  1842. this._lastGridDrawSelectors = [];
  1843. this._clearAxis = new com_ibm_rave_bundles_components_AxisComponentImpl();
  1844. this._clearGrid = new com_ibm_rave_bundles_components_GridComponentImpl();
  1845. this._axisSelectors = [];
  1846. this._gridSelectors = [];
  1847. this._axisRects = [];
  1848. this._elementRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1849. this._lastAxisDrew = [];
  1850. this._lastGridDrew = [];
  1851. this._dataSlotEntries = [];
  1852. this._layoutAxisOrder = [];
  1853. /**
  1854. * Construct and initialize. No axis scales or selector groups are defined.
  1855. * @param (rave['library']['internal']['BundleContext']) context The bundle context
  1856. */
  1857. {
  1858. this._context = context;
  1859. for (var i = 0; i < 4; ++i) {
  1860. this._scales[i] = null;
  1861. this._suppressPanLabels[i] = false;
  1862. this._axisComponents[i] = null;
  1863. this._lastAxisDrawSelectors[i] = null;
  1864. this._gridComponents[i] = null;
  1865. this._lastGridDrawSelectors[i] = null;
  1866. this._axisSelectors[i] = null;
  1867. this._gridSelectors[i] = null;
  1868. this._axisRects[i] = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1869. this._lastAxisDrew[i] = false;
  1870. this._lastGridDrew[i] = false;
  1871. this._dataSlotEntries[i] = [];
  1872. }
  1873. }
  1874. },
  1875. /** @expose */
  1876. preLayout : function(layoutComponent, axesBeforeLegend, xPadding, xOuterPadding, xPixelPad, yPadding, yOuterPadding, yPixelPad) {
  1877. this._xPadding = xPadding;
  1878. this._xOuterPadding = xOuterPadding;
  1879. this._xPixelPad = xPixelPad;
  1880. this._yPadding = yPadding;
  1881. this._yOuterPadding = yOuterPadding;
  1882. this._yPixelPad = yPixelPad;
  1883. this._layoutInProgress = true;
  1884. var layoutDuration = this._duration;
  1885. this._duration = 0;
  1886. 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"];
  1887. rave['library']['internal']['AbstractView'].createGroupStructure(this._context.node.select("g.axes-layout"), children);
  1888. var layoutAxisSelectors = [];
  1889. var layoutGridSelectors = [];
  1890. var layoutLastAxisDrew = [];
  1891. for (var position = 0; position < 4; ++position) {
  1892. if (this._axisComponents[position]) {
  1893. this._axisComponents[position].preLayout();
  1894. }
  1895. layoutAxisSelectors[position] = this._axisSelectors[position];
  1896. layoutGridSelectors[position] = this._gridSelectors[position];
  1897. layoutLastAxisDrew[position] = this._lastAxisDrew[position];
  1898. if (this._axisSelectors[position]) {
  1899. this.axisSelector(position, this._context.node.select("g.layoutAxis-" + com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position]));
  1900. }
  1901. if (this._gridSelectors[position]) {
  1902. this.gridSelector(position, this._context.node.select("g.layoutGrid-" + com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position]));
  1903. }
  1904. }
  1905. layoutComponent.preLayout(axesBeforeLegend, true);
  1906. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, layoutComponent.elementRect());
  1907. var countHorz = 0;
  1908. var countVert = 0;
  1909. var axes = [];
  1910. for (var position = 0; position < 4; ++position) {
  1911. var role = this.positionToRole(position);
  1912. var isHorz = position == 1 || position == 0;
  1913. if (this._axisSelectors[position] && this._scales[role]) {
  1914. if (isHorz) {
  1915. countHorz++;
  1916. } else {
  1917. countVert++;
  1918. }
  1919. if (this._scales[role].isOrdinal() || this._scales[role].isClustered()) {
  1920. var score = isHorz ? 4 : 2;
  1921. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, score));
  1922. } else {
  1923. var score = isHorz ? 3 : 1;
  1924. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, score));
  1925. }
  1926. } else {
  1927. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, 5));
  1928. }
  1929. }
  1930. axes.sort(function(a1, a2) {
  1931. var a1value = a1.score;
  1932. var a2value = a2.score;
  1933. return a1value < a2value ? -1 : a1value > a2value ? 1 : 0;
  1934. });
  1935. this._layoutAxisOrder = [];
  1936. for (var i = 0; i < 4; ++i) {
  1937. this._layoutAxisOrder[i] = axes[i].position;
  1938. }
  1939. this._layoutMaxWidth = this._elementRect.width * (countVert > 1 ? 0.5 : 0.4);
  1940. this._layoutMaxHeight = this._elementRect.height * (countHorz > 1 ? 0.5 : 0.4);
  1941. for (var index = 0; index < 4; ++index) {
  1942. var position = this._layoutAxisOrder[index];
  1943. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[position], this._elementRect);
  1944. }
  1945. this.draw();
  1946. this._duration = layoutDuration;
  1947. this._context.node.select("g.axes-layout").selectAll("*").remove();
  1948. for (var position = 0; position < 4; ++position) {
  1949. this._lastAxisDrew[position] = layoutLastAxisDrew[position];
  1950. this._axisSelectors[position] = layoutAxisSelectors[position];
  1951. this._gridSelectors[position] = layoutGridSelectors[position];
  1952. }
  1953. this._layoutInProgress = false;
  1954. return this;
  1955. },
  1956. getPositionToDraw : function(index) {
  1957. return this._layoutInProgress ? this._layoutAxisOrder[index] : index;
  1958. },
  1959. preDrawAxis : function(index) {
  1960. if (this._layoutInProgress) {
  1961. var position = this._layoutAxisOrder[index];
  1962. var role = this.positionToRole(position);
  1963. if (role == 0 || role == 1) {
  1964. this.setScaleRangePadded(this._scales[role], false, this._xPadding, this._xOuterPadding, this._xPixelPad);
  1965. } else {
  1966. this.setScaleRangePadded(this._scales[role], true, this._yPadding, this._yOuterPadding, this._yPixelPad);
  1967. }
  1968. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(true);
  1969. }
  1970. },
  1971. postDrawAxis : function(index) {
  1972. if (this._layoutInProgress) {
  1973. var position = this._layoutAxisOrder[index];
  1974. var role = this.positionToRole(position);
  1975. var axis = this._axisComponents[role];
  1976. var size = axis.getPreferredSize();
  1977. if (position == 1 || position == 0) {
  1978. if (size > this._layoutMaxHeight) {
  1979. size = this._layoutMaxHeight;
  1980. }
  1981. this._elementRect.height -= size;
  1982. if (position == 1) {
  1983. this._elementRect.y += size;
  1984. }
  1985. } else {
  1986. if (size > this._layoutMaxWidth) {
  1987. size = this._layoutMaxWidth;
  1988. }
  1989. this._elementRect.width -= size;
  1990. if (position == 2) {
  1991. this._elementRect.x += size;
  1992. }
  1993. }
  1994. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(false);
  1995. }
  1996. },
  1997. /**
  1998. * 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.
  1999. */
  2000. /** @expose */
  2001. draw : function() {
  2002. for (var role = 0; role < 4; ++role) {
  2003. this._lastAxisDrawSelectors[role] = null;
  2004. this._lastGridDrawSelectors[role] = null;
  2005. }
  2006. for (var index = 0; index < 4; ++index) {
  2007. var position = this.getPositionToDraw(index);
  2008. var role = this.positionToRole(position);
  2009. if (!this._visible || !this._axisSelectors[position] || !this._scales[role]) {
  2010. this.clearAxis(position);
  2011. this.clearGrid(position);
  2012. } else {
  2013. this.preDrawAxis(index);
  2014. this.drawAxis(position, role);
  2015. this.postDrawAxis(index);
  2016. if (this._gridSelectors[position]) {
  2017. this.drawGrid(position, role);
  2018. }
  2019. }
  2020. }
  2021. this._firstDraw = false;
  2022. },
  2023. /**
  2024. * @return (boolean) true if we are hiding any labels during pan-zoom.
  2025. */
  2026. /** @expose */
  2027. hideAnyPanZoom : function() {
  2028. return (this._suppressPanLabels[0] || this._suppressPanLabels[1] || this._suppressPanLabels[2] || this._suppressPanLabels[3]);
  2029. },
  2030. /**
  2031. * 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.
  2032. * @param (boolean) panning Whether this is a pan in-progress; use false otherwise including when pan-zoom ends.
  2033. */
  2034. /** @expose */
  2035. redraw : function(panning) {
  2036. for (var role = 0; role < 4; ++role) {
  2037. if (this._axisComponents[role] && this._lastAxisDrawSelectors[role]) {
  2038. this._axisComponents[role].displayTickLabels(this._drawAxisLabels[role]);
  2039. this._axisComponents[role].showPanZoomTickLabels(!panning || !this._suppressPanLabels[role]);
  2040. var isAllow = this._axisComponents[role].isAllowAutomaticAxisLayoutToChangeOrientation();
  2041. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(false);
  2042. this._lastAxisDrawSelectors[role].call(this._axisComponents[role]);
  2043. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(isAllow);
  2044. }
  2045. if (this._gridComponents[role] && this._lastGridDrawSelectors[role]) {
  2046. this._lastGridDrawSelectors[role].call(this._gridComponents[role]);
  2047. }
  2048. }
  2049. },
  2050. /** @expose */
  2051. preventStaggerRotate45 : function(preventStaggerRotate45) {
  2052. this._preventStaggerRotate45 = preventStaggerRotate45;
  2053. },
  2054. /**
  2055. * 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.
  2056. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2057. * @param (int) role The axis role, X1, X2, Y1, or Y2
  2058. */
  2059. drawAxis : function(position, role) {
  2060. var axisGroup = this._axisSelectors[position];
  2061. this._lastAxisDrawSelectors[role] = axisGroup;
  2062. var comp = this.axisComponent(role);
  2063. var layoutModeID = role == 2 ? "axis.y.labels.layoutMode" : role == 3 ? "axis.y2.labels.layoutMode" : "axis.x.labels.layoutMode";
  2064. var allowStaggerID = role == 2 ? "axis.y.labels.allowStagger" : role == 3 ? "axis.y2.labels.allowStagger" : "axis.x.labels.allowStagger";
  2065. var allowRotate45ID = role == 2 ? "axis.y.labels.allowRotate45" : role == 3 ? "axis.y2.labels.allowRotate45" : "axis.x.labels.allowRotate45";
  2066. var allowRotate90ID = role == 2 ? "axis.y.labels.allowRotate90" : role == 3 ? "axis.y2.labels.allowRotate90" : "axis.x.labels.allowRotate90";
  2067. var layoutMode = ""+(this._context.getPropertyValue(layoutModeID));
  2068. var allowStagger = !this._preventStaggerRotate45 && (this._context.getPropertyValue(allowStaggerID));
  2069. var allowRotate45 = !this._preventStaggerRotate45 && (this._context.getPropertyValue(allowRotate45ID));
  2070. var allowRotate90 = (this._context.getPropertyValue(allowRotate90ID));
  2071. var textTruncateIndicator = (this._context.getPropertyValue("axis.labels.truncationText"));
  2072. var axisBounds = this._axisRects[position];
  2073. var orient = com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position];
  2074. var transform = com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation(axisBounds, orient);
  2075. var axisTransform = "translate(" + transform[0] + "," + transform[1] + ")";
  2076. 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);
  2077. this._drawAxisLabels[role] = comp._displayTickLabels;
  2078. var axisGroupUpdate = axisGroup;
  2079. if (this._duration > 0 && !this._firstDraw && this._lastAxisDrew[position]) {
  2080. axisGroupUpdate = axisGroup.transition().duration(this._duration);
  2081. }
  2082. axisGroupUpdate.attr("transform", axisTransform);
  2083. axisGroupUpdate.call(comp);
  2084. var dataSlotEntryList = this._dataSlotEntries[role];
  2085. axisGroup.selectAll(".axis-title").property("dataSlots", dataSlotEntryList);
  2086. this._lastAxisDrew[position] = comp.renderedShapes();
  2087. if (this._defs) {
  2088. var clipAxis = new com_ibm_rave_bundles_components_ClipPathComponentImpl(this._context.instanceId() + "clip" + orient);
  2089. var text = axisGroup.append("text").text("000,000");
  2090. var bbox = text.node().getBBox();
  2091. var w = bbox.width;
  2092. var h = bbox.height;
  2093. text.remove();
  2094. var clipRect;
  2095. if (position == 0 || position == 1) {
  2096. var leftEdge = axisBounds.x + transform[0] * -1;
  2097. var rightEdge = leftEdge + axisBounds.width;
  2098. if (!(this._scales[role].isOrdinal()) && !(this._scales[role].isClustered())) {
  2099. var numericLeftEdge = this._elementRect.x - w + transform[0] * -1;
  2100. var numericRightEdge = numericLeftEdge + this._elementRect.width + w * 2;
  2101. if (numericLeftEdge < leftEdge) {
  2102. leftEdge = numericLeftEdge;
  2103. }
  2104. if (numericRightEdge > rightEdge) {
  2105. rightEdge = numericRightEdge;
  2106. }
  2107. }
  2108. clipRect = new rave['internal']['RectStruct'](leftEdge, axisBounds.y + transform[1] * -1, rightEdge - leftEdge, axisBounds.height);
  2109. } else {
  2110. clipRect = new rave['internal']['RectStruct'](axisBounds.x + transform[0] * -1, this._elementRect.y - h / 2 + transform[1] * -1, axisBounds.width, this._elementRect.height + h);
  2111. }
  2112. clipAxis.clipRect(clipRect).applyTo(axisGroup.select(".axis." + orient)).call(this._defs);
  2113. }
  2114. },
  2115. /**
  2116. * If the axis selector for the position is defined, clear the shapes from the axis group.
  2117. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2118. */
  2119. clearAxis : function(position) {
  2120. if (this._axisSelectors[position]) {
  2121. this._clearAxis.scale(null);
  2122. this._axisSelectors[position].call(this._clearAxis);
  2123. }
  2124. this._lastAxisDrew[position] = false;
  2125. },
  2126. /**
  2127. * 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.
  2128. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2129. * @param (int) role The axis role, X1, X2, Y1, or Y2
  2130. */
  2131. drawGrid : function(position, role) {
  2132. var gridGroup = this._gridSelectors[position];
  2133. this._lastGridDrawSelectors[role] = gridGroup;
  2134. var comp = this.gridComponent(role);
  2135. var axisBounds = this._axisRects[position];
  2136. var orient = com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position];
  2137. var transform = com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation(axisBounds, orient);
  2138. var axisTransform = "translate(" + transform[0] + "," + transform[1] + ")";
  2139. comp.setRole(com_ibm_rave_bundles_components_AxesManager.ROLES[role]).orient(orient).setPreExecute(this._context.getPreExecute()).bounds(this._elementRect).axis(this._axisComponents[role].axis());
  2140. if (this._duration <= 0 || this._firstDraw || !this._lastAxisDrew[position]) {
  2141. gridGroup.attr("transform", axisTransform).call(comp);
  2142. } else {
  2143. gridGroup.transition().duration(this._duration).attr("transform", axisTransform).call(comp);
  2144. }
  2145. this._lastGridDrew[position] = comp.renderedShapes();
  2146. },
  2147. /**
  2148. * If the grid selector for the position is defined, clear the shapes from the grid group.
  2149. * @param (int) position The grid position, BOTTOM, TOP, LEFT, RIGHT
  2150. */
  2151. clearGrid : function(position) {
  2152. if (this._gridSelectors[position]) {
  2153. this._clearGrid.axis(null);
  2154. this._gridSelectors[position].call(this._clearGrid);
  2155. }
  2156. this._lastGridDrew[position] = false;
  2157. },
  2158. /**
  2159. * @param (boolean) visible Whether the manager should draw axes
  2160. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2161. */
  2162. /** @expose */
  2163. visible : function(visible) {
  2164. this._visible = visible;
  2165. return this;
  2166. },
  2167. /**
  2168. * @param (int) duration The transition duration; if <= 0, no transition is used.
  2169. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2170. */
  2171. /** @expose */
  2172. duration : function(duration) {
  2173. this._duration = duration;
  2174. return this;
  2175. },
  2176. /**
  2177. * @param (boolean) transpose Whether to transpose the chart (switch the positions of the X and Y axis)
  2178. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2179. */
  2180. /** @expose */
  2181. transpose : function(transpose) {
  2182. this._transpose = transpose;
  2183. return this;
  2184. },
  2185. /**
  2186. * @param (boolean) swapX Whether to switch the postitions of the X1 and X2 axes
  2187. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2188. */
  2189. /** @expose */
  2190. swapX : function(swapX) {
  2191. this._swapX = swapX;
  2192. return this;
  2193. },
  2194. /**
  2195. * @param (boolean) swapY Whether to switch the postitions of the Y1 and Y2 axes
  2196. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2197. */
  2198. /** @expose */
  2199. swapY : function(swapY) {
  2200. this._swapY = swapY;
  2201. return this;
  2202. },
  2203. /**
  2204. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2205. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale The coordinate scale for that role, may be null
  2206. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2207. */
  2208. /** @expose */
  2209. scale : function(role, scale) {
  2210. this._scales[role] = scale;
  2211. return this;
  2212. },
  2213. /**
  2214. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2215. * @param (boolean) suppressLabels Whether to suppress the labels when panning the axis
  2216. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2217. */
  2218. /** @expose */
  2219. suppressPanLabels : function(role, suppressLabels) {
  2220. this._suppressPanLabels[role] = suppressLabels;
  2221. return this;
  2222. },
  2223. /**
  2224. * 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.
  2225. * @param (int) role The role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2226. * @return (com.ibm.rave.bundles.components.AxisComponentImpl) The component for the role
  2227. */
  2228. /** @expose */
  2229. axisComponent : function(role) {
  2230. if (!this._axisComponents[role]) {
  2231. this._axisComponents[role] = new com_ibm_rave_bundles_components_AxisComponentImpl();
  2232. }
  2233. return this._axisComponents[role];
  2234. },
  2235. /**
  2236. * 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.
  2237. * @param (int) role The role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2238. * @return (com.ibm.rave.bundles.components.GridComponentImpl) The component for the role
  2239. */
  2240. /** @expose */
  2241. gridComponent : function(role) {
  2242. if (!this._gridComponents[role]) {
  2243. this._gridComponents[role] = new com_ibm_rave_bundles_components_GridComponentImpl();
  2244. }
  2245. return this._gridComponents[role];
  2246. },
  2247. /**
  2248. * Set the bundle &lt;defs&gt; node. Clip paths will be defined in this node.
  2249. * @param (rave['internal']['Selector']) defs The defs node
  2250. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2251. */
  2252. /** @expose */
  2253. defsSelector : function(defs) {
  2254. this._defs = com_ibm_rave_bundles_components_AxesManager.checkSelector(defs);
  2255. return this;
  2256. },
  2257. /**
  2258. * Set the selector for an axis group node.
  2259. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2260. * @param (rave['internal']['Selector']) axisGroup The axis group node, may be null
  2261. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2262. */
  2263. /** @expose */
  2264. axisSelector : function(position, axisGroup) {
  2265. this._axisSelectors[position] = com_ibm_rave_bundles_components_AxesManager.checkSelector(axisGroup);
  2266. return this;
  2267. },
  2268. /**
  2269. * Set the selector for a grid group node.
  2270. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2271. * @param (rave['internal']['Selector']) gridGroup The grid group node, may be null
  2272. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2273. */
  2274. /** @expose */
  2275. gridSelector : function(position, gridGroup) {
  2276. this._gridSelectors[position] = com_ibm_rave_bundles_components_AxesManager.checkSelector(gridGroup);
  2277. return this;
  2278. },
  2279. /**
  2280. * Set the element (grid) bounds rectangle to a copy of the given rectangle.
  2281. * @param (rave['internal']['RectStruct']) elementRect The rectangle, if null the bounds are set to 0,0,0,0
  2282. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2283. */
  2284. /** @expose */
  2285. elementRect : function(elementRect) {
  2286. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, elementRect);
  2287. return this;
  2288. },
  2289. /**
  2290. * Set an axis bounds rectangle to a copy of the given rectangle.
  2291. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2292. * @param (rave['internal']['RectStruct']) axisRect The axis bounds, if null the bounds are set to 0,0,0,0
  2293. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2294. */
  2295. /** @expose */
  2296. axisRect : function(position, axisRect) {
  2297. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[position], axisRect);
  2298. return this;
  2299. },
  2300. /**
  2301. * 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.
  2302. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2303. */
  2304. /** @expose */
  2305. useDefaultSelectors : function() {
  2306. this.defsSelector(this._context.node.select("defs"));
  2307. this.axisSelector(0, this._context.node.select("g.axisTransform.bottom"));
  2308. this.axisSelector(1, this._context.node.select("g.axisTransform.top"));
  2309. this.axisSelector(2, this._context.node.select("g.axisTransform.left"));
  2310. this.axisSelector(3, this._context.node.select("g.axisTransform.right"));
  2311. this.gridSelector(0, this._context.node.select("g.grid.bottom"));
  2312. this.gridSelector(1, this._context.node.select("g.grid.top"));
  2313. this.gridSelector(2, this._context.node.select("g.grid.left"));
  2314. this.gridSelector(3, this._context.node.select("g.grid.right"));
  2315. return this;
  2316. },
  2317. /**
  2318. * Convenience method: Set the element rectangle and axis rectangles from the rectangles in the layout.
  2319. * @param (com.ibm.rave.bundles.components.ChartLayoutComponentImpl) layoutInfo Layout information
  2320. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2321. */
  2322. /** @expose */
  2323. useBoundsFromLayout : function(layoutInfo) {
  2324. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, layoutInfo.elementRect());
  2325. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[0], layoutInfo.bottomRect());
  2326. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[1], layoutInfo.topRect());
  2327. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[2], layoutInfo.leftRect());
  2328. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[3], layoutInfo.rightRect());
  2329. return this;
  2330. },
  2331. /**
  2332. * 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.
  2333. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2334. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2335. */
  2336. /** @expose */
  2337. useDefaultX1Properties : function(setGridParameters) {
  2338. 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"))));
  2339. var titleFontStyle = (this._context.getPropertyValue("axis.x.title.style.font"));
  2340. var labelFontStyle = (this._context.getPropertyValue("axis.x.labels.style.font"));
  2341. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2342. this.axisComponent(0).labelStyle(labelFontStyle);
  2343. } else {
  2344. 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")));
  2345. }
  2346. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2347. this.axisComponent(0).titleStyle(titleFontStyle);
  2348. } else {
  2349. 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")));
  2350. }
  2351. if (setGridParameters) {
  2352. 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")));
  2353. }
  2354. this.suppressPanLabels(0, (this._context.getPropertyValue("axis.x.labels.zoomPan")));
  2355. return this;
  2356. },
  2357. /**
  2358. * 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.
  2359. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2360. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2361. */
  2362. /** @expose */
  2363. useDefaultY1Properties : function(setGridParameters) {
  2364. 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")));
  2365. var titleFontStyle = (this._context.getPropertyValue("axis.y.title.style.font"));
  2366. var labelFontStyle = (this._context.getPropertyValue("axis.y.labels.style.font"));
  2367. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2368. this.axisComponent(2).labelStyle(labelFontStyle);
  2369. } else {
  2370. 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")));
  2371. }
  2372. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2373. this.axisComponent(2).titleStyle(titleFontStyle);
  2374. } else {
  2375. 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")));
  2376. }
  2377. if (setGridParameters) {
  2378. 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")));
  2379. }
  2380. this.suppressPanLabels(2, (this._context.getPropertyValue("axis.y.labels.zoomPan")));
  2381. return this;
  2382. },
  2383. /**
  2384. * 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.
  2385. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2386. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2387. */
  2388. /** @expose */
  2389. useDefaultY2Properties : function(setGridParameters) {
  2390. 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")));
  2391. var titleFontStyle = (this._context.getPropertyValue("axis.y2.title.style.font"));
  2392. var labelFontStyle = (this._context.getPropertyValue("axis.y2.labels.style.font"));
  2393. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2394. this.axisComponent(3).labelStyle(labelFontStyle);
  2395. } else {
  2396. 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")));
  2397. }
  2398. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2399. this.axisComponent(3).titleStyle(titleFontStyle);
  2400. } else {
  2401. 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")));
  2402. }
  2403. if (setGridParameters) {
  2404. 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")));
  2405. }
  2406. this.suppressPanLabels(3, (this._context.getPropertyValue("axis.y2.labels.zoomPan")));
  2407. return this;
  2408. },
  2409. /**
  2410. * 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.
  2411. * @param (int) role One of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2412. * @param (Array) entries Non-null list of data slot entries
  2413. * @param (String) format One of {@link this.CustomFormatInfo#"none"} or {@link this.CustomFormatInfo#"percent"}
  2414. * @param (rave['internal']['ValueFunction']) defaultFunction Default function to use if no custom formatter is defined for the axis, may be null
  2415. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2416. */
  2417. /** @expose */
  2418. setTickFormatterList : function(role, entries, format, defaultFunction) {
  2419. var fmtRole;
  2420. switch (role) {
  2421. case 2:
  2422. fmtRole = "ROLE_Y1";
  2423. break;
  2424. case 1:
  2425. fmtRole = "ROLE_X2";
  2426. break;
  2427. case 3:
  2428. fmtRole = "ROLE_Y2";
  2429. break;
  2430. case 0:
  2431. default:
  2432. fmtRole = "ROLE_X1";
  2433. break;
  2434. }
  2435. 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);
  2436. this.axisComponent(role).tickFormat(fmt);
  2437. 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);
  2438. this.axisComponent(role).simplifiedTickFormat(simplefmt);
  2439. return this;
  2440. },
  2441. /**
  2442. * 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.
  2443. * @param (int) role One of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2444. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  2445. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2446. */
  2447. /** @expose */
  2448. setTickFormatter : function(role, entry) {
  2449. var entries = [];
  2450. if (entry) {
  2451. entries.push(entry);
  2452. }
  2453. return this.setTickFormatterList(role, entries, "none", null);
  2454. },
  2455. /**
  2456. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined scale.
  2457. * @param (Number) padding Padding, relevant only for ordinal scales
  2458. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2459. * @param (int) pixelPad Pixel padding at each end
  2460. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2461. */
  2462. /** @expose */
  2463. setScaleRanges : function(padding, outerPadding, pixelPad) {
  2464. this.setIndependentScaleRanges(padding, outerPadding, pixelPad);
  2465. this.setDependentScaleRanges(padding, outerPadding, pixelPad);
  2466. return this;
  2467. },
  2468. /**
  2469. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined independent scale.
  2470. * @param (Number) padding Padding, relevant only for ordinal scales
  2471. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2472. * @param (int) pixelPad Pixel padding at each end
  2473. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2474. */
  2475. /** @expose */
  2476. setIndependentScaleRanges : function(padding, outerPadding, pixelPad) {
  2477. this.setScaleRangePadded(this._scales[0], false, padding, outerPadding, pixelPad);
  2478. this.setScaleRangePadded(this._scales[1], false, padding, outerPadding, pixelPad);
  2479. return this;
  2480. },
  2481. /**
  2482. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined independent scale.
  2483. * @param (Number) padding Padding, relevant only for ordinal scales
  2484. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2485. * @param (int) pixelPad Pixel padding at each end
  2486. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2487. */
  2488. /** @expose */
  2489. setDependentScaleRanges : function(padding, outerPadding, pixelPad) {
  2490. this.setScaleRangePadded(this._scales[2], true, padding, outerPadding, pixelPad);
  2491. this.setScaleRangePadded(this._scales[3], true, padding, outerPadding, pixelPad);
  2492. return this;
  2493. },
  2494. /**
  2495. * 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)} .
  2496. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2497. * @param (rave['library']['internal']['DataSlotEntry']) slot DataSlotEntry to be associated with the axis role.
  2498. */
  2499. setDataSlot$0 : function(role, slot) {
  2500. this.setDataSlot$1(role, [slot]);
  2501. return this;
  2502. },
  2503. /**
  2504. * Set a list of data slot entries that will be associated with the specified axis role.
  2505. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2506. * @param (Array) slots List of DataSlotEntry to be associated with the axis role.
  2507. */
  2508. setDataSlot$1 : function(role, slots) {
  2509. if (role < 4 && role >= 0) {
  2510. this._dataSlotEntries[role].length = 0;
  2511. if (slots) {
  2512. for (var __i_enFor0 = 0, __exp_enFor0 = slots, __len_enFor0 = __exp_enFor0.length;
  2513. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2514. var slot = __exp_enFor0[__i_enFor0];
  2515. this._dataSlotEntries[role].push(slot);
  2516. }
  2517. }
  2518. }
  2519. return this;
  2520. },
  2521. /**
  2522. * </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.
  2523. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale Bundle independent scale
  2524. * @param (boolean) dependent Whether this is the dependent scale
  2525. * @param (Number) padding Padding, relevant only for ordinal scales
  2526. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2527. * @param (int) pixelPad Pixel padding at each end
  2528. */
  2529. setScaleRangePadded : function(scale, dependent, padding, outerPadding, pixelPad) {
  2530. if (scale) {
  2531. var min, max;
  2532. if (dependent == this._transpose) {
  2533. min = this._elementRect.x + pixelPad;
  2534. max = this._elementRect.x + this._elementRect.width - pixelPad;
  2535. } else {
  2536. if (scale.isContinuous()) {
  2537. min = this._elementRect.y + this._elementRect.height - pixelPad;
  2538. max = this._elementRect.y + pixelPad;
  2539. } else {
  2540. min = this._elementRect.y + pixelPad;
  2541. max = this._elementRect.y + this._elementRect.height - pixelPad;
  2542. }
  2543. }
  2544. scale.range(min, max, padding, outerPadding);
  2545. }
  2546. },
  2547. /**
  2548. * Given a geometric position BOTTOM, TOP, LEFT, or RIGHT, return the role X1, X2, Y1, or Y2 used by that role.
  2549. * @param (int) position The position index
  2550. * @return (int) The role index
  2551. */
  2552. positionToRole : function(position) {
  2553. var r = position;
  2554. if (this._transpose) {
  2555. r = (r + 2) % 4;
  2556. }
  2557. if (this._swapX && r < 2) {
  2558. r = 1 - r;
  2559. }
  2560. if (this._swapY && r > 1) {
  2561. r = 5 - r;
  2562. }
  2563. return r;
  2564. },
  2565. /**
  2566. * Given a role X1, X2, Y1, or Y2, return the geometric position BOTTOM, TOP, LEFT, or RIGHT for that role.
  2567. * @param (int) role The role index
  2568. * @return (int) The position index
  2569. */
  2570. roleToPosition : function(role) {
  2571. var p = role;
  2572. if (this._swapX && role < 2) {
  2573. p = 1 - p;
  2574. }
  2575. if (this._swapY && p > 1) {
  2576. p = 5 - p;
  2577. }
  2578. if (this._transpose) {
  2579. p = (p + 2) % 4;
  2580. }
  2581. return p;
  2582. },
  2583. /**
  2584. * Sets the magnitude for the tick interval.
  2585. * @param (int) role role index of the axis
  2586. * @param (Number) tickMagnitude power of 10
  2587. * @return (com.ibm.rave.bundles.components.AxesManager) this
  2588. */
  2589. /** @expose */
  2590. scaleTickMagnitude : function(role, tickMagnitude) {
  2591. this.axisComponent(role).scaleTickMagnitude(tickMagnitude);
  2592. return this;
  2593. },
  2594. /** @expose */
  2595. setDataSlot : function(a0, a1) {
  2596. var args = arguments;
  2597. if (args.length == 2 && typeof a1 === "function") {
  2598. return this.setDataSlot$0(a0, a1);
  2599. }
  2600. return this.setDataSlot$1(a0, a1);
  2601. }
  2602. });
  2603. /**
  2604. * @param (rave['internal']['Selector']) s A selector
  2605. * @return (rave['internal']['Selector']) s if it is non-null and has at least one node, null otherwise
  2606. */
  2607. com_ibm_rave_bundles_components_AxesManager.checkSelector = function(s) {
  2608. return s && !(s.empty()) ? s : null;
  2609. };
  2610. /**
  2611. * Set a rectangle to a copy of another. If the source is null, the target is set to 0,0,0,0
  2612. * @param (rave['internal']['RectStruct']) target A non-null rectangle
  2613. * @param (rave['internal']['RectStruct']) source A possibly-null rectnalge
  2614. */
  2615. com_ibm_rave_bundles_components_AxesManager.setRect = function(target, source) {
  2616. if (source) {
  2617. target.x = source.x;
  2618. target.y = source.y;
  2619. target.width = source.width;
  2620. target.height = source.height;
  2621. } else {
  2622. target.x = 0;
  2623. target.y = 0;
  2624. target.width = 0;
  2625. target.height = 0;
  2626. }
  2627. };
  2628. /**
  2629. * A ValueFunction that appends '%' to the value.
  2630. * @param (int) n Number of digits
  2631. */
  2632. /** @expose */
  2633. com_ibm_rave_bundles_components_AxesManager.percentFormat = function(n) {
  2634. var digits = "." + n + "f";
  2635. var format = rave.format(digits);
  2636. return function(value, ix, gix) {
  2637. return format.call(null, value, 0, 0) + "%";
  2638. };
  2639. };
  2640. /**
  2641. * Called prior to chart layout. Axes are configured with no real bounding constraints to calculate their preferred size.
  2642. */
  2643. com_ibm_rave_bundles_components_AxesManager.AxisLayout = rave['internal']['Declare']({
  2644. /** @expose */
  2645. position : 0,
  2646. /** @expose */
  2647. score : 0,
  2648. constructor : function(position, score) {
  2649. this.position = position;
  2650. this.score = score;
  2651. }
  2652. });
  2653. /**
  2654. * Logical first X (independent) axis, default position bottom
  2655. */
  2656. /** @expose */
  2657. com_ibm_rave_bundles_components_AxesManager.X1 = 0;
  2658. /**
  2659. * Logical second X (independent) axis, default position top
  2660. */
  2661. /** @expose */
  2662. com_ibm_rave_bundles_components_AxesManager.X2 = 1;
  2663. /**
  2664. * Logical first Y (dependent) axis, default position left
  2665. */
  2666. /** @expose */
  2667. com_ibm_rave_bundles_components_AxesManager.Y1 = 2;
  2668. /**
  2669. * Logical first Y (dependent) axis, default position right
  2670. */
  2671. /** @expose */
  2672. com_ibm_rave_bundles_components_AxesManager.Y2 = 3;
  2673. /**
  2674. * Geometric group on bottom
  2675. */
  2676. /** @expose */
  2677. com_ibm_rave_bundles_components_AxesManager.BOTTOM = 0;
  2678. /**
  2679. * Geometric group on top
  2680. */
  2681. /** @expose */
  2682. com_ibm_rave_bundles_components_AxesManager.TOP = 1;
  2683. /**
  2684. * Geometric group on left
  2685. */
  2686. /** @expose */
  2687. com_ibm_rave_bundles_components_AxesManager.LEFT = 2;
  2688. /**
  2689. * Geometric group on right
  2690. */
  2691. /** @expose */
  2692. com_ibm_rave_bundles_components_AxesManager.RIGHT = 3;
  2693. /**
  2694. * Maps the role indexes to the role strings used by the components API
  2695. */
  2696. com_ibm_rave_bundles_components_AxesManager.ROLES = ["ROLE_X1", "ROLE_X2", "ROLE_Y1", "ROLE_Y2"];
  2697. /**
  2698. * Maps the role indexes to the role strings used by the custom formatter API. TODO: Unify the strings
  2699. */
  2700. com_ibm_rave_bundles_components_AxesManager.ROLE_FORMATTERS = ["ROLE_X1", "ROLE_X2", "ROLE_Y1", "ROLE_Y2"];
  2701. /**
  2702. * Maps the position indexes to the orient strings used by D3
  2703. */
  2704. com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS = ["bottom", "top", "left", "right"];
  2705. /**
  2706. * Maps the position indexes to the custom formatter strings
  2707. */
  2708. com_ibm_rave_bundles_components_AxesManager.FORMATTERS = ["bottom", "top", "left", "right"];
  2709. // $source: com/ibm/rave/bundles/component/AxisComponent
  2710. /************************************************************************
  2711. ** IBM Confidential
  2712. **
  2713. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2714. **
  2715. ** (C) Copyright IBM Corp. 2017
  2716. **
  2717. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2718. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2719. ************************************************************************/
  2720. // GENERATED
  2721. /**
  2722. * <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>
  2723. */
  2724. var com_ibm_rave_bundles_component_AxisComponent = rave['internal']['Declare'].implement(
  2725. /**
  2726. * @return (String) The role of the axis in the chart
  2727. */
  2728. //role : function() {},
  2729. /**
  2730. * @return (rave['internal']['Axis']) The capability Axis used by this AxisComponent
  2731. */
  2732. //axis : function() {},
  2733. /**
  2734. * The tickFormat is applied to the values of the ticks to create the string that is displayed.
  2735. * @param (rave['internal']['ValueFunction']) tickFormat The new tickFormat
  2736. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2737. */
  2738. //tickFormat : function(tickFormat) {},
  2739. /**
  2740. * Get the tickFormat function used by this component. May be null.
  2741. * @return (rave['internal']['ValueFunction']) Format function, or null
  2742. */
  2743. //tickFormat : function() {},
  2744. /**
  2745. * Set the indicator to be used for truncated text ex: indicator set to "..." , results in helloworld - > hello...
  2746. * @param (String) indicator the string to be placed to indicated truncated text
  2747. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2748. */
  2749. //textTruncateIndicator : function(indicator) {},
  2750. /**
  2751. * Whether to display the axis title.
  2752. * @param (boolean) displayAxisTitle true to display the axis title, false otherwise
  2753. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2754. */
  2755. //displayAxisTitle : function(displayAxisTitle) {},
  2756. /**
  2757. * Whether to display the axis line.
  2758. * @param (boolean) displayAxisLine true to display the axis line, false otherwise
  2759. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2760. */
  2761. //displayAxisLine : function(displayAxisLine) {},
  2762. /**
  2763. * Whether to display the axis tick marks.
  2764. * @param (boolean) displayTicks true to display the axis ticks, false otherwise
  2765. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2766. */
  2767. //displayTicks : function(displayTicks) {},
  2768. /**
  2769. * Whether to display the axis labels, as set by the show axis labels property
  2770. * @param (boolean) displayTickLabels true to display the axis tick labels, false otherwise
  2771. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2772. */
  2773. //displayTickLabels : function(displayTickLabels) {},
  2774. /**
  2775. * Whether to display the axis labels, as set by the hide pan-zoom labels property
  2776. * @param (boolean) showPanZoomTickLabels true to display the axis tick labels, false otherwise
  2777. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2778. */
  2779. //showPanZoomTickLabels : function(showPanZoomTickLabels) {},
  2780. /**
  2781. * @param (String) axisTitle The new axisTitle
  2782. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2783. */
  2784. //axisTitle : function(axisTitle) {},
  2785. /**
  2786. * 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)} .
  2787. * @param (String) axisColor The new line and tick color
  2788. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2789. */
  2790. //axisColor : function(axisColor) {},
  2791. /**
  2792. * The color used to draw the axis line.
  2793. * @param (String) lineColor The new lineColor
  2794. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2795. */
  2796. //lineColor : function(lineColor) {},
  2797. /**
  2798. * The color used to draw the axis ticks.
  2799. * @param (String) tickColor The new tickColor
  2800. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2801. */
  2802. //tickColor : function(tickColor) {},
  2803. /**
  2804. * The color used to draw the axis labels.
  2805. * @param (String) labelColor The new labelColor
  2806. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2807. */
  2808. //labelColor : function(labelColor) {},
  2809. /**
  2810. * The style for the axis labels.
  2811. * @param (String) fontStyle CSS string of font properties
  2812. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2813. */
  2814. //labelStyle : function(fontStyle) {},
  2815. /**
  2816. * The style for the axis labels.
  2817. * @param (String) fill The color used to draw the labels
  2818. * @param (String) fontSize CSS font size
  2819. * @param (String) fontFamily CSS font-families list
  2820. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2821. */
  2822. //labelStyle : function(fill, fontSize, fontFamily) {},
  2823. /**
  2824. * The color used to draw the axis title.
  2825. * @param (String) titleColor The new titleColor
  2826. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2827. */
  2828. //titleColor : function(titleColor) {},
  2829. /**
  2830. * The style for the axis title.
  2831. * @param (String) fontStyle CSS string of font properties
  2832. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2833. */
  2834. //titleStyle : function(fontStyle) {},
  2835. /**
  2836. * The style for the axis title.
  2837. * @param (String) fill The color used to draw the title
  2838. * @param (String) fontSize CSS font size
  2839. * @param (String) fontFamily CSS font-families list
  2840. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2841. */
  2842. //titleStyle : function(fill, fontSize, fontFamily) {}
  2843. );
  2844. /**
  2845. * The string returned by {@link #this.type()} is "AxisComponent".
  2846. */
  2847. /** @expose */
  2848. com_ibm_rave_bundles_component_AxisComponent.COMPONENT_TYPE = "AxisComponent";
  2849. /**
  2850. * Returned by {@link #this.role()} for the first independent axis.
  2851. */
  2852. /** @expose */
  2853. com_ibm_rave_bundles_component_AxisComponent.ROLE_X1 = "ROLE_X1";
  2854. /**
  2855. * Returned by {@link #this.role()} for the first dependent axis.
  2856. */
  2857. /** @expose */
  2858. com_ibm_rave_bundles_component_AxisComponent.ROLE_Y1 = "ROLE_Y1";
  2859. /**
  2860. * Returned by {@link #this.role()} for the second independent axis.
  2861. */
  2862. /** @expose */
  2863. com_ibm_rave_bundles_component_AxisComponent.ROLE_X2 = "ROLE_X2";
  2864. /**
  2865. * Returned by {@link #this.role()} for the second dependent axis.
  2866. */
  2867. /** @expose */
  2868. com_ibm_rave_bundles_component_AxisComponent.ROLE_Y2 = "ROLE_Y2";
  2869. // $source: com/ibm/rave/bundles/utilities/TextCrossfader
  2870. /************************************************************************
  2871. ** IBM Confidential
  2872. **
  2873. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2874. **
  2875. ** (C) Copyright IBM Corp. 2017
  2876. **
  2877. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2878. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2879. ************************************************************************/
  2880. // GENERATED
  2881. /**
  2882. * <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>
  2883. */
  2884. var com_ibm_rave_bundles_utilities_TextCrossfader = rave['internal']['Declare']({
  2885. });
  2886. /**
  2887. * <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!
  2888. * @param (rave['internal']['Selection']) selection Selection containing the single text node, may be a transition
  2889. * @param (String) oldText Old value of the text string, may be null
  2890. * @param (String) newText New value of the text string, may be null
  2891. * @param (Object) fillOpacity Fill opacity, may be null (in which case 1.0 is assumed)
  2892. * @param (double) delay Number between 0 and 0.5 controlling the timing of the fade
  2893. * @return (rave['internal']['Selection']) The selection, modified by the new text and fill-opacity
  2894. */
  2895. /** @expose */
  2896. com_ibm_rave_bundles_utilities_TextCrossfader.textCrossFade = function(selection, oldText, newText, fillOpacity, delay) {
  2897. if (!(selection.isTransition())) {
  2898. return selection.text(newText);
  2899. }
  2900. var _t = (selection).tween("text", function(data, index, groupIndex) {
  2901. return function(t) {
  2902. this.rave_setText(t < 0.5 ? oldText : newText);
  2903. };
  2904. });
  2905. var t0 = Math.max(0.0, Math.min(0.5, delay));
  2906. if (t0 == 0.5 || (oldText == null && newText == null) || (oldText != null && oldText == newText)) {
  2907. return selection;
  2908. }
  2909. var opacity = fillOpacity == null ? 1.0 : + (fillOpacity);
  2910. var tf = 1.0 / (0.5 - t0);
  2911. return _t.tween("fill-opacity", function(data, index, groupIndex) {
  2912. return function(t) {
  2913. if (t <= t0 || t >= (1.0 - t0)) {
  2914. this.rave_setStyle("fill-opacity", fillOpacity);
  2915. } else {
  2916. this.rave_setStyle("fill-opacity", opacity * Math.abs(t - 0.5) * tf);
  2917. }
  2918. };
  2919. });
  2920. };
  2921. // $source: com/ibm/rave/bundles/utilities/BundleLabelDropper
  2922. /************************************************************************
  2923. ** IBM Confidential
  2924. **
  2925. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2926. **
  2927. ** (C) Copyright IBM Corp. 2017
  2928. **
  2929. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2930. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2931. ************************************************************************/
  2932. // GENERATED
  2933. var com_ibm_rave_bundles_utilities_BundleLabelDropper = rave['internal']['Declare']({
  2934. //_dropOverlap : null,
  2935. labelCount : 0,
  2936. _$functionClassMethod : function() {
  2937. var _$self = function(args) {
  2938. if (args !== null || arguments.length > 1){
  2939. args = Array.prototype.slice.call(arguments, 0);
  2940. }
  2941. {
  2942. _$self.drop(args[0], ((args[1])));
  2943. return null;
  2944. }
  2945. };
  2946. return _$self;
  2947. },
  2948. /** @expose */
  2949. constructor : function() {
  2950. this._dropOverlap = (rave.capabilities.extension("position")).drop().remove(false);
  2951. this._dropOverlap.setOverlapGap(4.0);
  2952. },
  2953. /**
  2954. * Drop the overlapping labels or reset the overlap.
  2955. * @param (rave['internal']['Selection']) labels The selector for the labels
  2956. * @param (boolean) removeOverlap true to remove the overlapping labels, false to reset
  2957. */
  2958. /** @expose */
  2959. drop : function(labels, removeOverlap) {
  2960. if (!(labels.isTransition())) {
  2961. this.applyLabelDrop(labels, removeOverlap);
  2962. } else {
  2963. var steps = [0, 25, 75];
  2964. var self = this;
  2965. (labels).tween("__pointLabelDrop__", function(data, index, groupIndex) {
  2966. if (index == 0) {
  2967. return function(t) {
  2968. var currentStep = Math.floor(t * 100);
  2969. if (steps.length > 0 && currentStep < 100 && currentStep >= steps[0]) {
  2970. steps.splice(0, 1);
  2971. self.applyLabelDrop(labels, removeOverlap);
  2972. }
  2973. };
  2974. }
  2975. return null;
  2976. });
  2977. this.labelCount = 0;
  2978. (labels).each(function(data, index, groupIndex) {
  2979. ++self.labelCount;
  2980. }).each("end", function(args) {
  2981. if (args !== null || arguments.length > 1){
  2982. args = Array.prototype.slice.call(arguments, 0);
  2983. }
  2984. {
  2985. if (--self.labelCount == 0) {
  2986. self.applyLabelDrop(labels, removeOverlap);
  2987. }
  2988. return null;
  2989. }
  2990. });
  2991. }
  2992. },
  2993. applyLabelDrop : function(labels, removeOverlap) {
  2994. if (removeOverlap) {
  2995. labels.call(this._dropOverlap);
  2996. } else {
  2997. this._dropOverlap.reset(labels);
  2998. }
  2999. },
  3000. /** @expose */
  3001. configureForDataLabels : function(rect) {
  3002. if (rect) {
  3003. var ex = [[rect.x, rect.y], [rect.x + rect.width, rect.y + rect.height]];
  3004. this._dropOverlap.extent(ex);
  3005. }
  3006. this._dropOverlap.noClipping();
  3007. }
  3008. });
  3009. /**
  3010. * Drop overlap extension
  3011. */
  3012. //com_ibm_rave_bundles_utilities_BundleLabelDropper.POSITION_EXTENSION = "position";
  3013. /**
  3014. * space between labels during overlap testing
  3015. */
  3016. com_ibm_rave_bundles_utilities_BundleLabelDropper.OVERLAP_GAP = 4;
  3017. // $source: com/ibm/rave/bundles/components/StyleStructs
  3018. /************************************************************************
  3019. ** IBM Confidential
  3020. **
  3021. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3022. **
  3023. ** (C) Copyright IBM Corp. 2017
  3024. **
  3025. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3026. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3027. ************************************************************************/
  3028. // GENERATED
  3029. /**
  3030. * Struct classes to hold style properties.
  3031. */
  3032. var com_ibm_rave_bundles_components_StyleStructs = rave['internal']['Declare']({
  3033. });
  3034. /**
  3035. * Filled shape style properties.
  3036. */
  3037. com_ibm_rave_bundles_components_StyleStructs.ShapeStyle = function() {
  3038. this._fill = null;
  3039. this._stroke = null;
  3040. this._strokeWidth = null;
  3041. };
  3042. /**
  3043. * Line style properties.
  3044. */
  3045. com_ibm_rave_bundles_components_StyleStructs.LineStyle = function() {
  3046. this._stroke = null;
  3047. this._strokeWidth = null;
  3048. this._dashArray = null;
  3049. };
  3050. // $source: com/ibm/rave/bundles/component/GridComponent
  3051. /************************************************************************
  3052. ** IBM Confidential
  3053. **
  3054. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3055. **
  3056. ** (C) Copyright IBM Corp. 2017
  3057. **
  3058. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3059. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3060. ************************************************************************/
  3061. // GENERATED
  3062. /**
  3063. * <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>
  3064. */
  3065. var com_ibm_rave_bundles_component_GridComponent = rave['internal']['Declare'].implement(
  3066. /**
  3067. * @return (String) The role of the grid in the chart
  3068. */
  3069. //role : function() {},
  3070. /**
  3071. * Whether to display the gridlines.
  3072. * @param (boolean) displayGridlines The new displayGridlines
  3073. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3074. */
  3075. //displayGridlines : function(displayGridlines) {},
  3076. /**
  3077. * Set the line styling. Equivalent to calling {@link #this.gridlineColor(String)} and {@link #this.dashArray(String)} .
  3078. * @param (String) stroke The stroke color
  3079. * @param (String) dashArray The stroke-dasharray
  3080. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3081. */
  3082. //gridlineStyle : function(stroke, dashArray) {},
  3083. /**
  3084. * The color used to draw the gridlines.
  3085. * @param (String) gridlineColor The new stroke color
  3086. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3087. */
  3088. //gridlineColor : function(gridlineColor) {},
  3089. /**
  3090. * 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.
  3091. * @param (String) dashArray The new dash array
  3092. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3093. */
  3094. //dashArray : function(dashArray) {}
  3095. );
  3096. /**
  3097. * The string returned by {@link #this.type()} is "GridComponent".
  3098. */
  3099. /** @expose */
  3100. com_ibm_rave_bundles_component_GridComponent.COMPONENT_TYPE = "GridComponent";
  3101. // $source: com/ibm/rave/bundles/components/IntervalDataUtilities
  3102. /************************************************************************
  3103. ** IBM Confidential
  3104. **
  3105. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3106. **
  3107. ** (C) Copyright IBM Corp. 2017
  3108. **
  3109. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3110. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3111. ************************************************************************/
  3112. // GENERATED
  3113. /**
  3114. * 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.
  3115. */
  3116. var com_ibm_rave_bundles_components_IntervalDataUtilities = rave['internal']['Declare']({
  3117. });
  3118. /**
  3119. * <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>
  3120. * @param (Array) data Data array
  3121. * @param (rave['internal']['SingleValueFunction']) x X accessor, should not be null
  3122. * @param (rave['internal']['SingleValueFunction']) xScale Function to check if the X value is valid
  3123. * @param (rave['internal']['SingleValueFunction']) y Y accessor, should not be null
  3124. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3125. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3126. * @return (Array) Array of intervals for the data
  3127. */
  3128. /** @expose */
  3129. com_ibm_rave_bundles_components_IntervalDataUtilities.simpleBars = function(data, x, xScale, y, yStart, color, label) {
  3130. var result = [];
  3131. if (!data || data.length == 0 || !x || !y) {
  3132. return result;
  3133. }
  3134. data.forEach(function(d, ix, list) {
  3135. var xv = x(d);
  3136. if (xv != null && (!xScale || xScale(xv) != null)) {
  3137. var yv = y(d);
  3138. var yvStart = !yStart ? 0 : yStart(d);
  3139. if (yv != null && yvStart != null) {
  3140. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3141. r.key = ix;
  3142. r.ind1 = xv;
  3143. r.ind2 = r.ind1;
  3144. r.cind = r.ind1;
  3145. r.dep1 = yvStart;
  3146. r.dep2 = yv;
  3147. r.cdep = r.dep2;
  3148. r.color = color ? color(d) : null;
  3149. r.label = label ? label(d) : null;
  3150. r.value = r.dep2;
  3151. r._originalData = d;
  3152. r.valueAsPercentOfCategory = 100;
  3153. result.push(r);
  3154. }
  3155. }
  3156. return null;
  3157. });
  3158. var sum = 0;
  3159. for (var i = 0; i < result.length; ++i) {
  3160. var iData = result[i];
  3161. var value = + (iData.value);
  3162. sum += Math.abs(value);
  3163. }
  3164. if (sum != 0) {
  3165. for (var i = 0; i < result.length; ++i) {
  3166. var iData = result[i];
  3167. var value = + (iData.value);
  3168. iData.valueAsPercentOfColor = value / sum * 100;
  3169. }
  3170. }
  3171. return result;
  3172. };
  3173. /**
  3174. * Create intervals for bars in a clustered chart. This is similar to the simple bars, except the independent values are an array of accessors.
  3175. * @param (Array) data Data array
  3176. * @param (Array) x Independent accessor array, should not be null and no entries should be null
  3177. * @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
  3178. * @param (rave['internal']['SingleValueFunction']) y Dependent accessor, should not be null
  3179. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3180. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3181. * @return (Array) Array of intervals for the data
  3182. */
  3183. /** @expose */
  3184. com_ibm_rave_bundles_components_IntervalDataUtilities.clusteredBars = function(data, x, xScale, y, yStart, color, label) {
  3185. var result = [];
  3186. if (!data || data.length == 0 || !x || x.length == 0 || !y) {
  3187. return result;
  3188. }
  3189. var len = x.length;
  3190. var categories = {};
  3191. var colors = {};
  3192. data.forEach(function(d, ix, list) {
  3193. var OK = true;
  3194. var ind = [];
  3195. for (var i = 0; i < len; ++i) {
  3196. var xv = x[i](d);
  3197. if (xv == null || (xScale[i] && xScale[i](xv) == null)) {
  3198. OK = false;
  3199. break;
  3200. }
  3201. ind.push(xv);
  3202. if (i == 0) {
  3203. if (!(categories.hasOwnProperty(xv))) {
  3204. categories[""+(xv)] = 1;
  3205. }
  3206. } else if (!(colors.hasOwnProperty(xv))) {
  3207. colors[""+(xv)] = 1;
  3208. }
  3209. }
  3210. var dep = y(d);
  3211. var depStart = !yStart ? 0 : yStart(d);
  3212. if (OK && dep != null && depStart != null) {
  3213. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3214. r.key = ix;
  3215. r.ind1 = ind;
  3216. r.ind2 = ind;
  3217. r.cind = ind;
  3218. r.dep1 = depStart;
  3219. r.dep2 = dep;
  3220. r.cdep = r.dep2;
  3221. r.color = color ? color(d) : null;
  3222. r.label = label ? label(d) : null;
  3223. r.value = r.dep2;
  3224. r._originalData = d;
  3225. result.push(r);
  3226. }
  3227. return null;
  3228. });
  3229. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(categories), __len_enFor0 = __exp_enFor0.length;
  3230. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3231. var o = __exp_enFor0[__i_enFor0];
  3232. var s = ""+(o);
  3233. var sum = 0;
  3234. for (var i = 0; i < result.length; ++i) {
  3235. var iData = result[i];
  3236. if (s == (iData.ind1)[0]) {
  3237. var value = + (iData.value);
  3238. sum += Math.abs(value);
  3239. }
  3240. }
  3241. if (sum == 0) {
  3242. continue;
  3243. }
  3244. for (var i = 0; i < result.length; ++i) {
  3245. var iData = result[i];
  3246. if (s == (iData.ind1)[0]) {
  3247. var value = + (iData.value);
  3248. iData.valueAsPercentOfCategory = value / sum * 100;
  3249. }
  3250. }
  3251. }
  3252. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(colors), __len_enFor1 = __exp_enFor1.length;
  3253. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3254. var o = __exp_enFor1[__i_enFor1];
  3255. var s = ""+(o);
  3256. var sum = 0;
  3257. for (var i = 0; i < result.length; ++i) {
  3258. var iData = result[i];
  3259. if (s == iData.color) {
  3260. var value = + (iData.value);
  3261. sum += Math.abs(value);
  3262. }
  3263. }
  3264. if (sum == 0) {
  3265. continue;
  3266. }
  3267. for (var i = 0; i < result.length; ++i) {
  3268. var iData = result[i];
  3269. if (s == iData.color) {
  3270. var value = + (iData.value);
  3271. iData.valueAsPercentOfColor = value / sum * 100;
  3272. }
  3273. }
  3274. }
  3275. return result;
  3276. };
  3277. /**
  3278. * 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.
  3279. * @param (Array) data Data array
  3280. * @param (rave['internal']['SingleValueFunction']) x Independent accessor, should not be null
  3281. * @param (rave['internal']['SingleValueFunction']) xScale Possibly-null function to check if X values are in domain
  3282. * @param (rave['internal']['SingleValueFunction']) y Dependent accessor, should not be null
  3283. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3284. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3285. * @param (boolean) percent If true, create percent bars
  3286. * @return (Array) Array of intervals for the data
  3287. */
  3288. /** @expose */
  3289. com_ibm_rave_bundles_components_IntervalDataUtilities.stackedBars = function(data, x, xScale, y, color, label, percent) {
  3290. var result = [];
  3291. if (!data || data.length == 0 || !x || !y) {
  3292. return result;
  3293. }
  3294. var stacks = {};
  3295. var categories = {};
  3296. var colors = {};
  3297. data.forEach(function(d, ix, list) {
  3298. var xv = x(d);
  3299. if (xv != null && (!xScale || xScale(xv) != null)) {
  3300. var yv = y(d);
  3301. if (yv != null) {
  3302. var stack = stacks[xv];
  3303. if (!stack) {
  3304. stack = new com_ibm_rave_bundles_components_IntervalDataUtilities.Stack();
  3305. stacks[xv] = stack;
  3306. }
  3307. var dVal = + (yv);
  3308. if (!percent) {
  3309. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3310. r.key = ix;
  3311. r.ind1 = xv;
  3312. r.ind2 = xv;
  3313. r.cind = xv;
  3314. var sum = dVal < 0.0 ? stack.negativeSum : stack.positiveSum;
  3315. r.dep1 = sum;
  3316. r.dep2 = sum + dVal;
  3317. r.cdep = r.dep2;
  3318. r.color = color ? color(d) : null;
  3319. r.label = label ? label(d) : null;
  3320. r.value = dVal;
  3321. r._originalData = d;
  3322. result.push(r);
  3323. }
  3324. if (dVal < 0.0) {
  3325. stack.negativeSum += dVal;
  3326. } else {
  3327. stack.positiveCount++;
  3328. stack.positiveSum += dVal;
  3329. }
  3330. if (!(categories.hasOwnProperty(xv))) {
  3331. categories[""+(xv)] = 1;
  3332. }
  3333. if (color) {
  3334. var o = color(d);
  3335. if ((o != null) && !(colors.hasOwnProperty(o))) {
  3336. colors[""+(o)] = 1;
  3337. }
  3338. }
  3339. }
  3340. }
  3341. return null;
  3342. });
  3343. if (percent) {
  3344. data.forEach(function(d, ix, list) {
  3345. var xv = x(d);
  3346. if (xv != null && (!xScale || xScale(xv) != null)) {
  3347. var yv = y(d);
  3348. if (yv != null) {
  3349. var stack = stacks[xv];
  3350. var dVal = + (yv);
  3351. var percent;
  3352. if (dVal < 0.0) {
  3353. percent = -100.0 * dVal / stack.negativeSum;
  3354. } else if (stack.positiveSum > 0) {
  3355. percent = 100.0 * dVal / stack.positiveSum;
  3356. } else {
  3357. percent = 100.0 / stack.positiveCount;
  3358. }
  3359. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3360. r.key = ix;
  3361. r.ind1 = xv;
  3362. r.ind2 = xv;
  3363. r.cind = xv;
  3364. var sum = dVal < 0.0 ? stack.negativePercent : stack.positivePercent;
  3365. r.dep1 = sum;
  3366. r.dep2 = sum + percent;
  3367. r.cdep = r.dep2;
  3368. r.color = color ? color(d) : null;
  3369. r.label = label ? label(d) : null;
  3370. r.value = dVal;
  3371. r.valueAsPercentOfCategory = percent;
  3372. r._originalData = d;
  3373. result.push(r);
  3374. if (dVal < 0.0) {
  3375. stack.negativePercent += percent;
  3376. } else {
  3377. stack.positivePercent += percent;
  3378. }
  3379. }
  3380. }
  3381. return null;
  3382. });
  3383. } else {
  3384. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(categories), __len_enFor0 = __exp_enFor0.length;
  3385. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3386. var o = __exp_enFor0[__i_enFor0];
  3387. var s = ""+(o);
  3388. var sum = 0;
  3389. for (var i = 0; i < result.length; ++i) {
  3390. var iData = result[i];
  3391. if (s == iData.ind1) {
  3392. var value = + (iData.value);
  3393. sum += Math.abs(value);
  3394. }
  3395. }
  3396. if (sum == 0) {
  3397. continue;
  3398. }
  3399. for (var i = 0; i < result.length; ++i) {
  3400. var iData = result[i];
  3401. if (s == iData.ind1) {
  3402. var value = + (iData.value);
  3403. iData.valueAsPercentOfCategory = value / sum * 100;
  3404. }
  3405. }
  3406. }
  3407. }
  3408. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(colors), __len_enFor1 = __exp_enFor1.length;
  3409. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3410. var o = __exp_enFor1[__i_enFor1];
  3411. var s = ""+(o);
  3412. var sum = 0;
  3413. for (var i = 0; i < result.length; ++i) {
  3414. var iData = result[i];
  3415. if (s == iData.color) {
  3416. var value = + (iData.value);
  3417. sum += Math.abs(value);
  3418. }
  3419. }
  3420. if (sum == 0) {
  3421. continue;
  3422. }
  3423. for (var i = 0; i < result.length; ++i) {
  3424. var iData = result[i];
  3425. if (s == iData.color) {
  3426. var value = + (iData.value);
  3427. iData.valueAsPercentOfColor = value / sum * 100;
  3428. }
  3429. }
  3430. }
  3431. return result;
  3432. };
  3433. /**
  3434. * Structure class holding interval information.
  3435. */
  3436. com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData = rave['internal']['Declare']({
  3437. /**
  3438. * Key value; for now this is the data index
  3439. */
  3440. /** @expose */
  3441. key : null,
  3442. /**
  3443. * First independent value
  3444. */
  3445. /** @expose */
  3446. ind1 : null,
  3447. /**
  3448. * Second independent value (in all current uses, same as ind1)
  3449. */
  3450. /** @expose */
  3451. ind2 : null,
  3452. /**
  3453. * First dependent value
  3454. */
  3455. /** @expose */
  3456. dep1 : null,
  3457. /**
  3458. * Second dependent value
  3459. */
  3460. /** @expose */
  3461. dep2 : null,
  3462. /**
  3463. * The data value that the interval represents. Not the pixel value. Used in stacked chart
  3464. */
  3465. /** @expose */
  3466. value : null,
  3467. /**
  3468. * Color value
  3469. */
  3470. /** @expose */
  3471. color : null,
  3472. /**
  3473. * Label value
  3474. */
  3475. /** @expose */
  3476. label : null,
  3477. /**
  3478. * Callout independent value (in all current uses, same as ind1)
  3479. */
  3480. /** @expose */
  3481. cind : null,
  3482. /**
  3483. * Callout dependent value (dependent extent)
  3484. */
  3485. /** @expose */
  3486. cdep : null,
  3487. /** @expose */
  3488. _originalData : null,
  3489. /**
  3490. * The data value (in percentage) for specific category
  3491. */
  3492. /** @expose */
  3493. valueAsPercentOfCategory : NaN,
  3494. /**
  3495. * The data value (in percentage) across all categories
  3496. */
  3497. /** @expose */
  3498. valueAsPercentOfColor : NaN,
  3499. /** @expose */
  3500. originalData : function() {
  3501. return this._originalData;
  3502. },
  3503. /** @expose */
  3504. originalDataList : function() {
  3505. var list = [];
  3506. list.push(this._originalData);
  3507. return list;
  3508. }
  3509. });
  3510. com_ibm_rave_bundles_components_IntervalDataUtilities.Stack = function() {
  3511. this.positiveCount = 0;
  3512. this.positiveSum = 0;
  3513. this.negativeSum = 0;
  3514. this.positivePercent = 0;
  3515. this.negativePercent = 0;
  3516. };
  3517. /**
  3518. * Accessor for the callout dependent value
  3519. */
  3520. /** @expose */
  3521. com_ibm_rave_bundles_components_IntervalDataUtilities.CALLOUT_DEPENDENT_ACCESSOR = function(data) {
  3522. return (data).cdep;
  3523. };
  3524. /**
  3525. * Accessor for the callout independent value
  3526. */
  3527. /** @expose */
  3528. com_ibm_rave_bundles_components_IntervalDataUtilities.CALLOUT_INDEPENDENT_ACCESSOR = function(data) {
  3529. return (data).cind;
  3530. };
  3531. /**
  3532. * Accessor for the data value
  3533. */
  3534. /** @expose */
  3535. com_ibm_rave_bundles_components_IntervalDataUtilities.VALUE_ACCESSOR = function(data) {
  3536. return (data).value;
  3537. };
  3538. /**
  3539. * Accessor for data value as percent of category
  3540. */
  3541. /** @expose */
  3542. com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR = function(data) {
  3543. var percent = (data).valueAsPercentOfCategory;
  3544. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3545. };
  3546. /**
  3547. * Accessor for data value as percent of color (series)
  3548. */
  3549. /** @expose */
  3550. com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_COLOR_ACCESSOR = function(data) {
  3551. var percent = (data).valueAsPercentOfColor;
  3552. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3553. };
  3554. // $source: com/ibm/rave/bundles/data/PointDataUtilities
  3555. /************************************************************************
  3556. ** IBM Confidential
  3557. **
  3558. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3559. **
  3560. ** (C) Copyright IBM Corp. 2017
  3561. **
  3562. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3563. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3564. ************************************************************************/
  3565. // GENERATED
  3566. /**
  3567. * Utility class for building arrays of point datum objects from tabular data.
  3568. */
  3569. var com_ibm_rave_bundles_data_PointDataUtilities = rave['internal']['Declare']({
  3570. });
  3571. /**
  3572. * <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>
  3573. * @param (Array) data Input data, list of arbitrary objects
  3574. * @param (rave['internal']['SingleValueFunction']) xAccessor X accessor function, may be null
  3575. * @param (rave['internal']['SingleValueFunction']) xScale Scale to test if the X value should be included, may be null
  3576. * @param (rave['internal']['SingleValueFunction']) yAccessor Y accessor function, may be null
  3577. * @param (rave['internal']['SingleValueFunction']) yScale Scale to test if the Y value should be included, may be null
  3578. * @return (Array) List of PointData objects
  3579. */
  3580. /** @expose */
  3581. com_ibm_rave_bundles_data_PointDataUtilities.buildPoints = function(data, xAccessor, xScale, yAccessor, yScale) {
  3582. var result = [];
  3583. if (data) {
  3584. for (var __i_enFor0 = 0, __exp_enFor0 = data, __len_enFor0 = __exp_enFor0.length;
  3585. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3586. var o = __exp_enFor0[__i_enFor0];
  3587. if (o != null) {
  3588. var xv = null;
  3589. if (xAccessor) {
  3590. xv = xAccessor(o);
  3591. if (xv == null || (xScale && xScale(xv) == null)) {
  3592. continue;
  3593. }
  3594. }
  3595. var yv = null;
  3596. if (yAccessor) {
  3597. yv = yAccessor(o);
  3598. if (yv == null || (yScale && yScale(yv) == null)) {
  3599. continue;
  3600. }
  3601. }
  3602. var datum = new com_ibm_rave_bundles_data_PointDataUtilities.PointDatum();
  3603. datum._x = xv;
  3604. datum._y = yv;
  3605. datum._originalData = o;
  3606. result.push(datum);
  3607. }
  3608. }
  3609. }
  3610. return result;
  3611. };
  3612. /**
  3613. * 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.
  3614. */
  3615. com_ibm_rave_bundles_data_PointDataUtilities.PointDatum = rave['internal']['Declare']({
  3616. /**
  3617. * The X value
  3618. */
  3619. /** @expose */
  3620. _x : null,
  3621. /**
  3622. * The Y value
  3623. */
  3624. /** @expose */
  3625. _y : null,
  3626. /**
  3627. * The data value (in percentage) that the point represents
  3628. */
  3629. /** @expose */
  3630. _yAsPercentOfCategory : null,
  3631. /**
  3632. * The data value (in percentage) that the point represents
  3633. */
  3634. /** @expose */
  3635. _yAsPercentOfColor : null,
  3636. /**
  3637. * The original data
  3638. */
  3639. /** @expose */
  3640. _originalData : null,
  3641. /** @expose */
  3642. originalData : function() {
  3643. return this._originalData;
  3644. },
  3645. /** @expose */
  3646. originalDataList : function() {
  3647. var list = [];
  3648. list.push(this._originalData);
  3649. return list;
  3650. }
  3651. });
  3652. /**
  3653. * Accessor returning the _x property of a PointDatum.
  3654. */
  3655. /** @expose */
  3656. com_ibm_rave_bundles_data_PointDataUtilities.X_ACCESSOR = function(d) {
  3657. return (d)._x;
  3658. };
  3659. /**
  3660. * Accessor returning the _y property of a PointDatum.
  3661. */
  3662. /** @expose */
  3663. com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR = function(d) {
  3664. return (d)._y;
  3665. };
  3666. /**
  3667. * Accessor returning the _yAsPercentOfCategory property of a PointDatum.
  3668. */
  3669. /** @expose */
  3670. com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR = function(d) {
  3671. var percent = + ((d)._yAsPercentOfCategory);
  3672. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3673. };
  3674. /**
  3675. * Accessor returning the _yAsPercentOfColor property of a PointDatum.
  3676. */
  3677. /** @expose */
  3678. com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_COLOR_ACCESSOR = function(d) {
  3679. var percent = + ((d)._yAsPercentOfColor);
  3680. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3681. };
  3682. // $source: com/ibm/rave/bundles/utilities/ColorUtil
  3683. /************************************************************************
  3684. ** IBM Confidential
  3685. **
  3686. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3687. **
  3688. ** (C) Copyright IBM Corp. 2017
  3689. **
  3690. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3691. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3692. ************************************************************************/
  3693. // GENERATED
  3694. var com_ibm_rave_bundles_utilities_ColorUtil = rave['internal']['Declare']({
  3695. });
  3696. /**
  3697. * It is used to get a foreground color which has atleast a 4.5 contrast ratio with the background color.
  3698. * @param (Object) bg bakground color
  3699. * @param (Object) fg foreground color
  3700. * @return (Object) a color ( darker/ligher/same fg color ) which contrast with background.
  3701. */
  3702. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$0 = function(bg, fg) {
  3703. var contrastRatio = com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio(bg, fg);
  3704. if (contrastRatio < 4.5) {
  3705. var bgHSL = rave.hsl(bg);
  3706. var fgHSL = rave.hsl(fg);
  3707. 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);
  3708. if (brightness > 0.5) {
  3709. if (bgHSL.getL() > 0.5) {
  3710. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.min(fgHSL.getL(), bgHSL.getL() - 0.4));
  3711. } else {
  3712. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.min(fgHSL.getL(), 0.1));
  3713. }
  3714. } else {
  3715. if (bgHSL.getL() < 0.5) {
  3716. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.max(fgHSL.getL(), bgHSL.getL() + 0.4));
  3717. } else {
  3718. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.max(fgHSL.getL(), 0.9));
  3719. }
  3720. }
  3721. }
  3722. return fg;
  3723. };
  3724. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$1 = function(labelColor) {
  3725. var labelRGB = rave.rgb(labelColor);
  3726. return labelRGB.contrastShift(21);
  3727. };
  3728. /** @expose */
  3729. com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio = function(colorA, colorB) {
  3730. var foregroundLuminance = rave.rgb(colorA).getLuminance();
  3731. var backgroundLuminance = rave.rgb(colorB).getLuminance();
  3732. var contrastRatio = (foregroundLuminance >= backgroundLuminance) ? (foregroundLuminance + 0.05) / (backgroundLuminance + 0.05) : (backgroundLuminance + 0.05) / (foregroundLuminance + 0.05);
  3733. return contrastRatio;
  3734. };
  3735. /** @expose */
  3736. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor = function(a0, a1) {
  3737. var args = arguments;
  3738. if (args.length == 1) {
  3739. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$1(a0);
  3740. }
  3741. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$0(a0, a1);
  3742. };
  3743. // $source: com/ibm/rave/bundles/component/IntervalComponent
  3744. /************************************************************************
  3745. ** IBM Confidential
  3746. **
  3747. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3748. **
  3749. ** (C) Copyright IBM Corp. 2017
  3750. **
  3751. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3752. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3753. ************************************************************************/
  3754. // GENERATED
  3755. /**
  3756. * <p> A component that renders interval elements (rectangles based on data, showing an extent in both X and Y dimensions, as in a bar chart). The {@link #this.type()} method returns "IntervalComponent". </p>
  3757. */
  3758. var com_ibm_rave_bundles_component_IntervalComponent = rave['internal']['Declare'].implement(
  3759. /**
  3760. * Turn labels on or off. If labels are on but there is no label data, empty text nodes will be created.
  3761. * @param (boolean) itemLabel Whether to use labels
  3762. * @return (com.ibm.rave.bundles.component.IntervalComponent) This object
  3763. */
  3764. //itemLabel : function(itemLabel) {},
  3765. /**
  3766. * @param (boolean) _itemOverlap Whether to show/hide overlap labels
  3767. * @return (com.ibm.rave.bundles.component.IntervalComponent) This object
  3768. */
  3769. //itemOverlap : function(_itemOverlap) {},
  3770. /**
  3771. * Sets function that will specify position of item label for given chart element.
  3772. * @param (rave['internal']['ValueFunction']) labelPosition Function to be used to determine label position
  3773. * @return (com.ibm.rave.bundles.component.IntervalComponent) This object
  3774. */
  3775. //itemLabelPosition : function(labelPosition) {},
  3776. /**
  3777. * Set the border width, which is also the stroke width.
  3778. * @param (String) width
  3779. * @return (com.ibm.rave.bundles.component.IntervalComponent) This object
  3780. */
  3781. //borderWidth : function(width) {},
  3782. /**
  3783. * Set the border color.
  3784. * @param (String) borderColor
  3785. * @return (com.ibm.rave.bundles.component.IntervalComponent) This object
  3786. */
  3787. //borderColor : function(borderColor) {},
  3788. /**
  3789. * Set the classname of the labellayer
  3790. * @param (String) string
  3791. * @return (com.ibm.rave.bundles.component.IntervalComponent) This object
  3792. */
  3793. //labelLayerClassName : function(string) {},
  3794. /**
  3795. * Set the classname of the elementlayer
  3796. * @param (String) string
  3797. * @return (com.ibm.rave.bundles.component.IntervalComponent) This object
  3798. */
  3799. //elementLayerClassName : function(string) {},
  3800. /**
  3801. * @param bounds The bounds of the chart area.
  3802. */
  3803. //bounds : function(chartRect) {}
  3804. );
  3805. /**
  3806. * The string returned by {@link #this.type()} is "IntervalComponent".
  3807. */
  3808. /** @expose */
  3809. com_ibm_rave_bundles_component_IntervalComponent.COMPONENT_TYPE = "IntervalComponent";
  3810. // $source: com/ibm/rave/bundles/utilities/LabelStyleUtil
  3811. /************************************************************************
  3812. ** IBM Confidential
  3813. **
  3814. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3815. **
  3816. ** (C) Copyright IBM Corp. 2017
  3817. **
  3818. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3819. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3820. ************************************************************************/
  3821. // GENERATED
  3822. //@import com/ibm/rave/bundles/components/FilterComponentImpl (runtime) // new
  3823. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor, getContrastRatio
  3824. /**
  3825. * This class can be used to apply styles on labels. Eg: when we need to overrule the given label style properties.
  3826. */
  3827. var com_ibm_rave_bundles_utilities_LabelStyleUtil = rave['internal']['Declare']({
  3828. //_labelFontStyle : null,
  3829. //_contrastLabelColorfilter : null,
  3830. //_sameLabelColorfilter : null,
  3831. /**
  3832. * eg: apply contrast label color with background. apply different font size for each level label. apply a contrast shadow for a label.
  3833. */
  3834. //_labelFillColor : null,
  3835. //_labelFontSize : null,
  3836. _labelShadow : false,
  3837. _$functionClassMethod : function() {
  3838. var _$self = function(args) {
  3839. if (args !== null || arguments.length > 1){
  3840. args = Array.prototype.slice.call(arguments, 0);
  3841. }
  3842. {
  3843. if (_$self._labelFontStyle) {
  3844. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(_$self._labelFontStyle), __len_enFor0 = __exp_enFor0.length;
  3845. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3846. var stylenName = __exp_enFor0[__i_enFor0];
  3847. if ((stylenName == "fill" || stylenName == "color" && _$self._labelFillColor) || (stylenName == "font-size" && _$self._labelFontSize) || (stylenName == "text-shadow" && _$self._labelShadow == true)) {
  3848. continue;
  3849. }
  3850. this.style(stylenName, _$self._labelFontStyle[stylenName]);
  3851. }
  3852. }
  3853. if (_$self._labelFillColor) {
  3854. this.style("fill", _$self._labelFillColor);
  3855. }
  3856. if (_$self._labelFontSize) {
  3857. this.style("font-size", _$self._labelFontSize);
  3858. }
  3859. var labels = this.selectAll("*");
  3860. if (labels.length == 0) {
  3861. labels = this;
  3862. }
  3863. if (_$self._labelShadow) {
  3864. var self = _$self;
  3865. var defaultLabelFill = _$self.getDefaultLabelColor(_$self._labelFontStyle);
  3866. _$self._contrastLabelColorfilter = new com_ibm_rave_bundles_components_FilterComponentImpl("contrast_label_drop_shadow");
  3867. _$self._contrastLabelColorfilter.setDropshadow("1px", "1px", "0px", rave.rgb(com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(defaultLabelFill)));
  3868. _$self._sameLabelColorfilter = new com_ibm_rave_bundles_components_FilterComponentImpl("same_label_drop_shadow");
  3869. _$self._sameLabelColorfilter.setDropshadow("1px", "1px", "0px", rave.rgb(defaultLabelFill));
  3870. var owner = this.node().rave_getOwner();
  3871. rave.select(owner).select("defs").call(_$self._contrastLabelColorfilter);
  3872. rave.select(owner).select("defs").call(_$self._sameLabelColorfilter);
  3873. this.each(function(data, index, groupIndex) {
  3874. if (self._labelFillColor) {
  3875. var contrastRatio = com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio(rave.rgb(self._labelFillColor.call(this, data, index, groupIndex)), defaultLabelFill);
  3876. if (contrastRatio < 4.5) {
  3877. this.setAttribute("filter", "url(#" + self._contrastLabelColorfilter.getId() + ")");
  3878. } else {
  3879. this.setAttribute("filter", "url(#" + self._sameLabelColorfilter.getId() + ")");
  3880. }
  3881. } else {
  3882. this.setAttribute("filter", "url(#" + self._contrastLabelColorfilter.getId() + ")");
  3883. }
  3884. });
  3885. labels.each(function(data, index, groupIndex) {
  3886. if (self._labelFillColor) {
  3887. this.rave_setProperty("_rave_drop_shadow", "1px 1px 0px " + com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(self._labelFillColor.call(this, data, index, groupIndex)).toString());
  3888. } else {
  3889. this.rave_setProperty("_rave_drop_shadow", "1px 1px 0px " + com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(defaultLabelFill).toString());
  3890. }
  3891. });
  3892. } else {
  3893. labels.each(function(data, index, groupIndex) {
  3894. this.rave_setProperty("_rave_drop_shadow", null);
  3895. });
  3896. this.attr("filter", null);
  3897. }
  3898. return null;
  3899. }
  3900. };
  3901. return _$self;
  3902. },
  3903. /** @expose */
  3904. labelFont : function(labelFontStyle) {
  3905. this._labelFontStyle = labelFontStyle;
  3906. return this;
  3907. },
  3908. /** @expose */
  3909. labelFillColor : function(_labelFillColor) {
  3910. this._labelFillColor = _labelFillColor;
  3911. return this;
  3912. },
  3913. /** @expose */
  3914. labelFontSize : function(_labelFontSize) {
  3915. this._labelFontSize = _labelFontSize;
  3916. return this;
  3917. },
  3918. /** @expose */
  3919. labelShadow : function(labelShadow) {
  3920. this._labelShadow = labelShadow;
  3921. return this;
  3922. },
  3923. /** @expose */
  3924. getDefaultLabelColor : function(_labelStyle) {
  3925. if (!_labelStyle) {
  3926. return "#000000";
  3927. }
  3928. var defaultFillColor;
  3929. if (_labelStyle) {
  3930. defaultFillColor = _labelStyle["fill"];
  3931. if (defaultFillColor == null) {
  3932. defaultFillColor = _labelStyle["color"];
  3933. }
  3934. }
  3935. if (defaultFillColor == null) {
  3936. defaultFillColor = "#000000";
  3937. }
  3938. return defaultFillColor.toString();
  3939. }
  3940. });
  3941. // $source: com/ibm/rave/bundles/components/ComponentConfiguration
  3942. /************************************************************************
  3943. ** IBM Confidential
  3944. **
  3945. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3946. **
  3947. ** (C) Copyright IBM Corp. 2017
  3948. **
  3949. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3950. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3951. ************************************************************************/
  3952. // GENERATED
  3953. /**
  3954. * Utility class that does configuration for components, optionally drawing them into selections. Some of the configuration information is taken from a bundle context, and uses standard property IDs as defined in the shared property files and {@link (rave['library']['internal']['CommonPropertyIDs']) CommonPropertyIDs} . If a bundle does not use define the expected properties, an error will occur. In this documentation the property ID is referred to by the CommonPropertyIDs constant, for example property LEGEND_DISPLAY means the property with the ID {@link this.CommonPropertyIDs#"legend.display"} .
  3955. */
  3956. var com_ibm_rave_bundles_components_ComponentConfiguration = rave['internal']['Declare']({
  3957. //constructor : function() {}
  3958. });
  3959. /**
  3960. * <p> Do "standard" configuration of a Zoom and optionally run it on a selection. If the provided Zoom is null a new one is created. Component properties are set as follows: </p> <ul> <li>zoom#x is the xScale if that is non-null, and is not set if it is null</li> <li>zoom#y is the yScale if that is non-null, and is not set if it is null</li> <li>zoom#scaleExtent is the scaleExtent if that is non-null, or (0.2,5.0) otherwise</li> <li>zoom#on binds the "zoom" events to the callback</li> </ul> <p> Note that it is not possible to remove a scale from an existing zoom, since the core Zoom does not allow null scales in the x() and y() methods. To do that, first disable any existing zoom (with Selector#on("zoom",null)) then call this method with a null Zoom. </p> <p> The scales are ordered x, y, x2, y2 in the parameters and in the p and s arrays, since most charts will only have the x and y scales. </p>
  3961. * @param (rave['internal']['Selection']) chart Selection on which to run the zoom, may be null
  3962. * @param (rave['internal']['Zoom']) zoom The Zoom; if null one is created and returned
  3963. * @param (rave['library']['internal']['CoordinateScaleImpl']) xScale X dimension scale, may be null
  3964. * @param (rave['library']['internal']['CoordinateScaleImpl']) yScale Y dimension scale, may be null
  3965. * @param (rave['library']['internal']['CoordinateScaleImpl']) x2Scale X2 dimension scale, may be null
  3966. * @param (rave['library']['internal']['CoordinateScaleImpl']) y2Scale Y2 dimension scale, may be null
  3967. * @param (Array) scaleExtent Scale extent, may be null; if null the range 0.2 to 5.0 is used
  3968. * @param (rave['internal']['RectStruct']) chartRect The rectangle of the chart
  3969. * @param (double[]) p the zoom translate position (x, y, x2, y2)
  3970. * @param (double[]) s the zoom scale (x, y, x2, y2)
  3971. * @param (String) zoomOps The zoom operation (x|y|x2|y2|all)
  3972. * @param (rave['internal']['RunFunction']) callback Callback on each zoom event, must not be null
  3973. * @return (rave['internal']['Zoom']) The zoom
  3974. */
  3975. /** @expose */
  3976. com_ibm_rave_bundles_components_ComponentConfiguration.configureZoom = function(chart, zoom, xScale, yScale, x2Scale, y2Scale, scaleExtent, chartRect, p, s, zoomOps, callback) {
  3977. var z = zoom ? zoom : rave.behavior.zoom();
  3978. var z1 = (x2Scale || y2Scale) && zoomOps == "all" ? rave.behavior.zoom() : null;
  3979. var dummyScale = (rave.scale.linear());
  3980. z.x(dummyScale);
  3981. z.y(dummyScale);
  3982. if (xScale && zoomOps == "x") {
  3983. z.x(xScale.scale());
  3984. z.scale(s[0]);
  3985. z.translate([p[0], 0]);
  3986. }
  3987. if (yScale && zoomOps == "y") {
  3988. z.y(yScale.scale());
  3989. z.scale(s[1]);
  3990. z.translate([0, p[1]]);
  3991. }
  3992. if (x2Scale && zoomOps == "x2") {
  3993. z.x(x2Scale.scale());
  3994. z.scale(s[2]);
  3995. z.translate([p[2], 0]);
  3996. }
  3997. if (y2Scale && zoomOps == "y2") {
  3998. z.y(y2Scale.scale());
  3999. z.scale(s[3]);
  4000. z.translate([0, p[3]]);
  4001. }
  4002. if (zoomOps == "all") {
  4003. if (xScale) {
  4004. z.x(xScale.scale());
  4005. }
  4006. if (yScale) {
  4007. z.y(yScale.scale());
  4008. }
  4009. z.scale(1);
  4010. z.translate([0, 0]);
  4011. if (z1) {
  4012. if (x2Scale) {
  4013. z1.x(x2Scale.scale());
  4014. }
  4015. if (y2Scale) {
  4016. z1.y(y2Scale.scale());
  4017. }
  4018. z1.scale(1);
  4019. z1.translate([0, 0]);
  4020. }
  4021. }
  4022. z.scaleExtent(scaleExtent ? scaleExtent : [1, Infinity]).on("zoom.default", function(args) {
  4023. if (args !== null || arguments.length > 1){
  4024. args = Array.prototype.slice.call(arguments, 0);
  4025. }
  4026. {
  4027. var event = args[3];
  4028. var scale = event.scale;
  4029. var translate = event.translate;
  4030. var scaledX = chartRect.x * (scale - 1);
  4031. var scaledXExtent = (chartRect.width * (1 - scale)) - scaledX;
  4032. translate[0] = Math.min(-scaledX, Math.max(scaledXExtent, translate[0]));
  4033. var scaledY = chartRect.y * (scale - 1);
  4034. var scaledYExtent = (chartRect.height * (1 - scale)) - scaledY;
  4035. translate[1] = Math.min(-scaledY, Math.max(scaledYExtent, translate[1]));
  4036. z.translate([translate[0], translate[1]]);
  4037. if (z1) {
  4038. z1.translate([translate[0], translate[1]]);
  4039. z1.scale(scale);
  4040. }
  4041. if (zoomOps == "x") {
  4042. p[0] = translate[0];
  4043. s[0] = scale;
  4044. } else if (zoomOps == "y") {
  4045. p[1] = translate[1];
  4046. s[1] = scale;
  4047. } else if (zoomOps == "x2") {
  4048. p[2] = translate[0];
  4049. s[2] = scale;
  4050. } else if (zoomOps == "y2") {
  4051. p[3] = translate[1];
  4052. s[3] = scale;
  4053. } else if (zoomOps == "all") {
  4054. p[0] = translate[0];
  4055. p[1] = translate[1];
  4056. p[2] = translate[0];
  4057. p[3] = translate[1];
  4058. s[0] = scale;
  4059. s[1] = scale;
  4060. s[2] = scale;
  4061. s[3] = scale;
  4062. }
  4063. return callback.apply(this, args);
  4064. }
  4065. });
  4066. return z;
  4067. };
  4068. // $source: com/ibm/rave/bundles/internal/nativeImpl/BundleModule
  4069. /************************************************************************
  4070. ** IBM Confidential
  4071. **
  4072. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4073. **
  4074. ** (C) Copyright IBM Corp. 2015
  4075. **
  4076. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4077. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4078. ************************************************************************/
  4079. // Must be the first import
  4080. // @import ./BundleModuleHeader
  4081. // expose DataFormatter to the global variable rave
  4082. //rave["library"]["CustomFormatter"]=com_ibm_rave_library_framework_CustomFormatter;
  4083. // $source: com/ibm/rave/bundles/heatmapBundle/HeatmapBundle
  4084. /************************************************************************
  4085. ** IBM Confidential
  4086. **
  4087. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4088. **
  4089. ** (C) Copyright IBM Corp. 2017
  4090. **
  4091. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4092. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4093. ************************************************************************/
  4094. // GENERATED
  4095. //@import com/ibm/rave/library/Library (static) // Library
  4096. //@import com/ibm/rave/bundles/RaveBundle (loadtime) // superclass
  4097. //@import com/ibm/rave/bundles/heatmapBundle/HeatmapView (runtime) // new
  4098. var com_ibm_rave_bundles_heatmapBundle_HeatmapBundle = rave['internal']['Declare'](com_ibm_rave_bundles_RaveBundle, {
  4099. /** @expose */
  4100. getName : function() {
  4101. return com_ibm_rave_bundles_heatmapBundle_HeatmapBundle.BUNDLE_NAME;
  4102. },
  4103. /** @expose */
  4104. createView : function(ctx) {
  4105. return new com_ibm_rave_bundles_heatmapBundle_HeatmapView(ctx);
  4106. }
  4107. //constructor : function() {}
  4108. });
  4109. /**
  4110. * Register the bundle factory with the library. The bundle will not be made available if this method is not called.
  4111. */
  4112. /** @expose */
  4113. com_ibm_rave_bundles_heatmapBundle_HeatmapBundle.init = function() {
  4114. if (!(com_ibm_rave_library_Library.bundle.isRegistered(com_ibm_rave_bundles_heatmapBundle_HeatmapBundle.BUNDLE_NAME))) {
  4115. var bundle;
  4116. com_ibm_rave_library_Library.bundle.extension(com_ibm_rave_bundles_heatmapBundle_HeatmapBundle.BUNDLE_NAME, function() {
  4117. if (!bundle) {
  4118. bundle = new com_ibm_rave_bundles_heatmapBundle_HeatmapBundle();
  4119. bundle.loadResources();
  4120. require("./vizlibrary-heatmapBundle.css");
  4121. }
  4122. return bundle;
  4123. });
  4124. }
  4125. return com_ibm_rave_bundles_heatmapBundle_HeatmapBundle.BUNDLE_NAME;
  4126. };
  4127. com_ibm_rave_bundles_heatmapBundle_HeatmapBundle.BUNDLE_NAME = "heatmapBundle";
  4128. // Auto initialization
  4129. com_ibm_rave_bundles_heatmapBundle_HeatmapBundle.init();
  4130. if (!com_ibm_rave_library_Library.bundle[com_ibm_rave_bundles_heatmapBundle_HeatmapBundle.BUNDLE_NAME]) {
  4131. com_ibm_rave_library_Library.bundle[com_ibm_rave_bundles_heatmapBundle_HeatmapBundle.BUNDLE_NAME] = function() {
  4132. if (!bundle) {
  4133. bundle = new com_ibm_rave_bundles_heatmapBundle_HeatmapBundle();
  4134. bundle.loadResources();
  4135. require("./vizlibrary-heatmapBundle.css");
  4136. }
  4137. return bundle;
  4138. };
  4139. } else {
  4140. console.log("Could not register extension: HeatmapBundle");
  4141. }
  4142. // $source: com/ibm/rave/bundles/heatmapBundle/HeatmapView
  4143. /************************************************************************
  4144. ** IBM Confidential
  4145. **
  4146. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4147. **
  4148. ** (C) Copyright IBM Corp. 2017
  4149. **
  4150. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4151. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4152. ************************************************************************/
  4153. // GENERATED
  4154. //@import com/ibm/rave/bundles/views/BundleView (loadtime) // superclass
  4155. //@import com/ibm/rave/bundles/components/IntervalComponentImpl (runtime) // new
  4156. //@import com/ibm/rave/bundles/data/PointDataUtilities (runtime) // PointDataUtilities, buildPoints
  4157. //@import com/ibm/rave/bundles/components/ComponentConfiguration (runtime) // configureZoom
  4158. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  4159. /**
  4160. * Componentized heatmap view. The data model is tabular with X, Y, and color accessors. The X and Y values are used to build two ordinal axes, and a rectangle is plotted for each XY combination. The color value is used for the color and label of the rectangle. Any missing XY combination is shown as a rectangle in the default CSS style.
  4161. */
  4162. var com_ibm_rave_bundles_heatmapBundle_HeatmapView = rave['internal']['Declare'](com_ibm_rave_bundles_views_BundleView, {
  4163. //MAX_CELL_SIZE : 0, //MIN_CELL_SIZE : 0,
  4164. //_intervalComponent : null,
  4165. //_independentScale : null, //_dependentScale : null,
  4166. //xDataAccessor : null, //yDataAccessor : null, //colorDataAccessor : null,
  4167. //key : null,
  4168. //_data : null,
  4169. //zoomXScale : null, //zoomYScale : null,
  4170. //zoomendedTimer : null,
  4171. minCellDim : 0,
  4172. /** @expose */
  4173. isAxesManagerRequired : function() {
  4174. return true;
  4175. },
  4176. /** @expose */
  4177. setup : function() {
  4178. com_ibm_rave_bundles_views_BundleView.prototype.setup.call(this);
  4179. this._intervalComponent = new com_ibm_rave_bundles_components_IntervalComponentImpl();
  4180. this._intervalComponent.independent1Accessor(com_ibm_rave_bundles_data_PointDataUtilities.X_ACCESSOR).independent2Accessor(com_ibm_rave_bundles_data_PointDataUtilities.X_ACCESSOR).dependent1Accessor(com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR).dependent2Accessor(com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR);
  4181. var style = {};
  4182. style["stroke-width"] = "1px";
  4183. style["stroke"] = "white";
  4184. rave['library']['internal']['BundleUtils'].setupDefaultActions(this.context, ".chart .element-shape", style);
  4185. },
  4186. /** @expose */
  4187. draw : function() {
  4188. if (this.isUpdateNothing()) {
  4189. return;
  4190. }
  4191. this.preDraw("g.vizlibrary-heatmap");
  4192. if (!(this.validateDataModel("g.element-group", "g.axis"))) {
  4193. return;
  4194. }
  4195. this.setBorder("cell.borderWidth", "cell.borderColor");
  4196. var effect = this.getStringProperty("effect.name");
  4197. var duration = this.getEffectDuration(effect);
  4198. var dataSet = this.dataModel.dataset("data");
  4199. var originalData = dataSet.data();
  4200. if (this.updateType == 0) {
  4201. this.xDataAccessor = dataSet.slot("x").entry();
  4202. this.yDataAccessor = dataSet.slot("y").entry();
  4203. this.key = dataSet.slot("key").entry();
  4204. this.colorDataAccessor = dataSet.slot("color").entry();
  4205. this._data = com_ibm_rave_bundles_data_PointDataUtilities.buildPoints(originalData, this.xDataAccessor.accessor(), rave['library']['internal']['AbstractView'].domainCheckerOf(originalData, this.xDataAccessor), this.yDataAccessor.accessor(), rave['library']['internal']['AbstractView'].domainCheckerOf(originalData, this.yDataAccessor));
  4206. this.context.actions.action("deselectAll")(this.context.node.selectAll("." + "element-shape"));
  4207. }
  4208. var colorPalette = this.getDynamicPalette();
  4209. colorPalette.setData(dataSet, "color");
  4210. colorPalette.setAccessor(rave['library']['internal']['AbstractView'].originalDatumAccessor(this.colorDataAccessor));
  4211. colorPalette.setNullColor(this.getStringProperty("color.null"));
  4212. var showLegend = this.isShowLegend();
  4213. var legendVisibilityChanged = this._legends.anyVisible() != showLegend;
  4214. if (legendVisibilityChanged) {
  4215. this.updateType = 1;
  4216. }
  4217. var legendPosition = this.getLegendPosition();
  4218. 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());
  4219. this.MAX_CELL_SIZE = Math.max(10, this.getCSSSizeToPixelNumber("maxCellSize"));
  4220. this.MIN_CELL_SIZE = Math.max(10, Math.min(this.MAX_CELL_SIZE, this.getCSSSizeToPixelNumber("minCellSize")));
  4221. if (this.updateType <= 1) {
  4222. this._independentScale = rave['library']['internal']['ScaleManager'].makeCoordinateScale(originalData, this.xDataAccessor);
  4223. this._dependentScale = rave['library']['internal']['ScaleManager'].makeCoordinateScale(originalData, this.yDataAccessor);
  4224. var useLeftAxis = "left" == this.getStringProperty(com_ibm_rave_bundles_heatmapBundle_HeatmapView.Y_AXIS_PROPERTIES);
  4225. var useBottomAxis = "bottom" == this.getStringProperty(com_ibm_rave_bundles_heatmapBundle_HeatmapView.X_AXIS_PROPERTIES);
  4226. this._axes.visible(true).duration(duration).swapX(!useBottomAxis).swapY(!useLeftAxis).scale(0, this._independentScale).scale(2, this._dependentScale).setDataSlot(0, this.xDataAccessor).setDataSlot(2, this.yDataAccessor).useDefaultSelectors().useDefaultX1Properties(false).useDefaultY1Properties(false).setTickFormatter(0, this.xDataAccessor).setTickFormatter(2, this.yDataAccessor);
  4227. this.prepareLayoutComponent();
  4228. this.prepareLayoutSizables(this._layoutComponent, false, true, true, false, this._legends.anyVisible());
  4229. var isLegendLeftOrRight = "left" == legendPosition || "right" == legendPosition;
  4230. var isUniform = (this.context.getPropertyValue("cell.uniform"));
  4231. this._axes.preventStaggerRotate45(isUniform);
  4232. if (!isUniform && isLegendLeftOrRight) {
  4233. this._legends.preLayout(this._layoutComponent, false);
  4234. this._axes.preLayout(this._layoutComponent, false, 0.1, 0.05, 0, 0.1, 0.05, 0);
  4235. } else {
  4236. this._axes.preLayout(this._layoutComponent, true, 0.1, 0.05, 0, 0.1, 0.05, 0);
  4237. this._legends.preLayout(this._layoutComponent, true);
  4238. }
  4239. this._layoutComponent.layout();
  4240. legendPosition = this._layoutComponent.legendPosition();
  4241. this._legends.position(legendPosition);
  4242. var elementRect = this._layoutComponent.elementRect();
  4243. var hCount = this._independentScale.scale().domain().length;
  4244. var vCount = this._dependentScale.scale().domain().length;
  4245. var cellWidth = elementRect.width / hCount;
  4246. var cellHeight = elementRect.height / vCount;
  4247. this.minCellDim = Math.min(cellWidth, cellHeight);
  4248. if ((this.context.getPropertyValue("cell.uniform"))) {
  4249. if (this.minCellDim > this.MAX_CELL_SIZE) {
  4250. var dxNeeded = this.MAX_CELL_SIZE * hCount;
  4251. var dyNeeded = this.MAX_CELL_SIZE * vCount;
  4252. this.cutCenterWidth(elementRect.width - dxNeeded);
  4253. this.cutCenterHeight(elementRect.height - dyNeeded);
  4254. } else if (this.minCellDim < this.MIN_CELL_SIZE) {
  4255. var dxNeeded = this.MIN_CELL_SIZE * hCount;
  4256. var dyNeeded = this.MIN_CELL_SIZE * vCount;
  4257. this.growCenterWidth(dxNeeded - elementRect.width);
  4258. this.growCenterHeight(dyNeeded - elementRect.height);
  4259. } else if (cellWidth > cellHeight) {
  4260. var dxNeeded = this.minCellDim * hCount;
  4261. this.cutCenterWidth(elementRect.width - dxNeeded);
  4262. } else if (cellHeight > cellWidth) {
  4263. var dyNeeded = this.minCellDim * vCount;
  4264. this.cutCenterHeight(elementRect.height - dyNeeded);
  4265. }
  4266. } else {
  4267. if (cellWidth > this.MAX_CELL_SIZE) {
  4268. var dxNeeded = this.MAX_CELL_SIZE * hCount;
  4269. this.cutCenterWidth(elementRect.width - dxNeeded);
  4270. }
  4271. if (cellWidth < this.MIN_CELL_SIZE) {
  4272. var dxNeeded = this.MIN_CELL_SIZE * hCount;
  4273. this.growCenterWidth(dxNeeded - elementRect.width);
  4274. }
  4275. if (cellHeight > this.MAX_CELL_SIZE) {
  4276. var dyNeeded = this.MAX_CELL_SIZE * vCount;
  4277. this.cutCenterHeight(elementRect.height - dyNeeded);
  4278. }
  4279. if (cellHeight < this.MIN_CELL_SIZE) {
  4280. var dyNeeded = this.MIN_CELL_SIZE * vCount;
  4281. this.growCenterHeight(dyNeeded - elementRect.height);
  4282. }
  4283. }
  4284. this._axes.useBoundsFromLayout(this._layoutComponent).setScaleRanges(0.0, 0.0, 1);
  4285. this.zoomXScale = this._independentScale.scale().copy();
  4286. this.zoomYScale = this._dependentScale.scale().copy();
  4287. this.resetZoom();
  4288. }
  4289. var elementRect = this._layoutComponent.elementRect();
  4290. this._legends.rectangle(this._layoutComponent.legendRect());
  4291. this.setBackgroundProperties(elementRect, duration);
  4292. var z;
  4293. var ops = this.getStringProperty("zoom");
  4294. if (this.updateType <= 2) {
  4295. if (ops == "all" || ops == "x") {
  4296. (this._independentScale.scale()).domain(this.zoomXScale.domain());
  4297. }
  4298. if (ops == "all" || ops == "y") {
  4299. (this._dependentScale.scale()).domain(this.zoomYScale.domain());
  4300. }
  4301. var scaleExtent = null;
  4302. if (this.minCellDim < this.MIN_CELL_SIZE) {
  4303. scaleExtent = [this.MIN_CELL_SIZE / this.minCellDim, Math.max(5, 2 * this.MIN_CELL_SIZE / this.minCellDim)];
  4304. }
  4305. var self = this;
  4306. var zoom = this.context.actions.action("zoom").get("zoom");
  4307. com_ibm_rave_bundles_components_ComponentConfiguration.configureZoom(this._chart, zoom, this._independentScale, this._dependentScale, null, null, scaleExtent, elementRect, this._zoomP, this._zoomS, ops, function(args) {
  4308. if (args !== null || arguments.length > 1){
  4309. args = Array.prototype.slice.call(arguments, 0);
  4310. }
  4311. {
  4312. self._chart.selectAll("g.elements").call(self._intervalComponent);
  4313. self._axes.redraw(true);
  4314. zoom.on("zoomend.hideLabels", function(args) {
  4315. if (args !== null || arguments.length > 1){
  4316. args = Array.prototype.slice.call(arguments, 0);
  4317. }
  4318. {
  4319. if (self._axes.hideAnyPanZoom()) {
  4320. if (self.zoomendedTimer != null) {
  4321. clearTimeout(self.zoomendedTimer);
  4322. }
  4323. self.zoomendedTimer = setTimeout(function() {
  4324. self.zoomendedTimer = null;
  4325. self._axes.redraw(false);
  4326. }, 300);
  4327. }
  4328. return null;
  4329. }
  4330. });
  4331. return self._chart;
  4332. }
  4333. });
  4334. }
  4335. if (this.minCellDim < this.MIN_CELL_SIZE && z && ops == "all") {
  4336. var r = this.MIN_CELL_SIZE / this.minCellDim;
  4337. z.scale(r);
  4338. z.translate([elementRect.x * (1 - r), elementRect.y * (1 - r)]);
  4339. this._zoomP[0] = elementRect.x * (1 - r);
  4340. this._zoomP[1] = elementRect.y * (1 - r);
  4341. this._zoomS[0] = r;
  4342. this._zoomS[1] = r;
  4343. }
  4344. this._intervalComponent.data(this._data).key(rave['library']['internal']['AbstractView'].originalDatumAccessor(this.key ? this.key.accessor() : null)).independentScale(this._independentScale).dependentScale(this._dependentScale).colorPalette(colorPalette).labelAccessor(rave['library']['internal']['AbstractView'].originalDatumAccessor(this.colorDataAccessor.accessor())).labelFont(com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(this.getStringProperty("labelstyle.font"))).labelContrast(this.getBooleanProperty("contrast.label.color")).labelShadow(this.getBooleanProperty("label.shadow")).valueAccessor(rave['library']['internal']['AbstractView'].originalDatumAccessor(this.valueAccessor())).setPreExecute(this.context.getPreExecute()).labelFormatter(this.context.getCustomFormatterForElementLabels(this.colorDataAccessor)).itemLabel(this.getBooleanProperty("itemLabel")).borderWidth(this.context.convertCSSSizeToPixels(this.context.getPropertyValue("cell.borderWidth"))).borderColor((this.context.getPropertyValue("cell.borderColor"))).bounds(this._layoutComponent.elementRect());
  4345. this._chart.selectAll("g.elements").transition().duration(duration).call(this._intervalComponent);
  4346. this._clip.clipRect(elementRect).applyTo(this._chart.select(".content")).call(this.context.node.select("defs").transition().duration(duration));
  4347. this._axes.visible(true).duration(duration).useDefaultSelectors().useDefaultX1Properties(false).useDefaultY1Properties(false).setTickFormatter(0, this.xDataAccessor).setTickFormatter(2, this.yDataAccessor);
  4348. this._axes.draw();
  4349. this._legends.draw();
  4350. this.resetUpdate();
  4351. this._chart.selectAll(".element-shape").classed("bundle-shape", true);
  4352. this._chart.selectAll(".legendShape").classed("bundle-shape", true);
  4353. },
  4354. /** @expose */
  4355. getCoordinateScale : function(role) {
  4356. if ("ROLE_X1" == role) {
  4357. return this._independentScale;
  4358. }
  4359. if ("ROLE_Y1" == role) {
  4360. return this._dependentScale;
  4361. }
  4362. return null;
  4363. },
  4364. valueAccessor : function() {
  4365. var self = this;
  4366. return function(d) {
  4367. return self.xDataAccessor(d) + ", " + self.yDataAccessor(d);
  4368. };
  4369. },
  4370. /**
  4371. * Cut the width of the elements rectangle by dx from the right side, and move or cut the legend accordingly. Adjust chart and axis rectangles to match.
  4372. * @param (double) dx Amount to adjust, if non-positive no change is made
  4373. */
  4374. cutCenterWidth : function(dx) {
  4375. if (dx <= 0) {
  4376. return;
  4377. }
  4378. this._layoutComponent.chartRect().width -= dx;
  4379. this._layoutComponent.elementRect().width -= dx;
  4380. this._layoutComponent.topRect().width -= dx;
  4381. this._layoutComponent.bottomRect().width -= dx;
  4382. this._layoutComponent.rightRect().x -= dx;
  4383. if (this._legends.anyVisible()) {
  4384. var lp = this._layoutComponent.legendPosition();
  4385. if (lp == "top" || lp == "bottom") {
  4386. this._layoutComponent.legendRect().width -= dx;
  4387. } else if (lp == "right") {
  4388. this._layoutComponent.legendRect().x -= dx;
  4389. }
  4390. }
  4391. },
  4392. /**
  4393. * Cut the height of the elements rectangle by dy from the bottom side, and move or cut the legend accordingly. Adjust chart and axis rectangles to match.
  4394. * @param (double) dy Amount to adjust, if non-positive no change is made
  4395. */
  4396. cutCenterHeight : function(dy) {
  4397. if (dy <= 0) {
  4398. return;
  4399. }
  4400. this._layoutComponent.chartRect().height -= dy;
  4401. this._layoutComponent.elementRect().height -= dy;
  4402. this._layoutComponent.leftRect().height -= dy;
  4403. this._layoutComponent.rightRect().height -= dy;
  4404. this._layoutComponent.bottomRect().y -= dy;
  4405. if (this._legends.anyVisible()) {
  4406. var lp = this._layoutComponent.legendPosition();
  4407. if (lp == "left" || lp == "right") {
  4408. this._layoutComponent.legendRect().height -= dy;
  4409. } else if (lp == "bottom") {
  4410. this._layoutComponent.legendRect().y -= dy;
  4411. }
  4412. }
  4413. },
  4414. /**
  4415. * Grow the width of the elements rectangle by dx from the right side, and move or cut the legend accordingly. Adjust chart and axis rectangles to match.
  4416. * @param (double) dx Amount to adjust, if non-positive no change is made
  4417. */
  4418. growCenterWidth : function(dx) {
  4419. if (dx <= 0) {
  4420. return;
  4421. }
  4422. this._layoutComponent.chartRect().width += dx;
  4423. this._layoutComponent.elementRect().width += dx;
  4424. this._layoutComponent.topRect().width += dx;
  4425. this._layoutComponent.bottomRect().width += dx;
  4426. this._layoutComponent.rightRect().x += dx;
  4427. if (this._legends.anyVisible()) {
  4428. var lp = this._layoutComponent.legendPosition();
  4429. if (lp == "top" || lp == "bottom") {
  4430. this._layoutComponent.legendRect().width += dx;
  4431. } else if (lp == "right") {
  4432. this._layoutComponent.legendRect().x += dx;
  4433. }
  4434. }
  4435. },
  4436. /**
  4437. * Grow the height of the elements rectangle by dy from the bottom side, and move or cut the legend accordingly. Adjust chart and axis rectangles to match.
  4438. * @param (double) dy Amount to adjust, if non-positive no change is made
  4439. */
  4440. growCenterHeight : function(dy) {
  4441. if (dy <= 0) {
  4442. return;
  4443. }
  4444. this._layoutComponent.chartRect().height += dy;
  4445. this._layoutComponent.elementRect().height += dy;
  4446. this._layoutComponent.leftRect().height += dy;
  4447. this._layoutComponent.rightRect().height += dy;
  4448. this._layoutComponent.bottomRect().y += dy;
  4449. if (this._legends.anyVisible()) {
  4450. var lp = this._layoutComponent.legendPosition();
  4451. if (lp == "left" || lp == "right") {
  4452. this._layoutComponent.legendRect().height += dy;
  4453. } else if (lp == "bottom") {
  4454. this._layoutComponent.legendRect().y += dy;
  4455. }
  4456. }
  4457. },
  4458. /** @expose */
  4459. getGroupStructure : function() {
  4460. return ["defs", "g.vizlibrary vizlibrary-heatmap", "(", "rect.background chart", "g.chart", "(", "g.content", "(", "rect.background elements", "g.elements", "(", "g.element-group", "g.element-label-group", ")", ")", "g.axes", "(", "g.axes-layout", "g.axisTransform top", "g.axisTransform right", "g.axisTransform bottom", "g.axisTransform left", ")", ")", "g.legends", "(", "g.legends-layout", "g.legend", ")", ")"];
  4461. }
  4462. //constructor : function(context) {}
  4463. });
  4464. com_ibm_rave_bundles_heatmapBundle_HeatmapView.DATASLOT_COLOR = "color";
  4465. com_ibm_rave_bundles_heatmapBundle_HeatmapView.Y_AXIS_PROPERTIES = "axis.y.alignment";
  4466. com_ibm_rave_bundles_heatmapBundle_HeatmapView.X_AXIS_PROPERTIES = "axis.x.alignment";
  4467. //com_ibm_rave_bundles_heatmapBundle_HeatmapView.LABEL_FONTSTYLE = "labelstyle.font";
  4468. // $source: com/ibm/rave/bundles/components/BackgroundComponentImpl
  4469. /************************************************************************
  4470. ** IBM Confidential
  4471. **
  4472. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4473. **
  4474. ** (C) Copyright IBM Corp. 2017
  4475. **
  4476. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4477. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4478. ************************************************************************/
  4479. // GENERATED
  4480. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  4481. //@import com/ibm/rave/bundles/component/BackgroundComponent (runtime) // BackgroundComponent
  4482. /**
  4483. * <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>
  4484. */
  4485. var com_ibm_rave_bundles_components_BackgroundComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  4486. //_backgroundColor : null,
  4487. //_rect : null,
  4488. /** @expose */
  4489. constructor : function() {
  4490. this._rect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4491. },
  4492. /** @expose */
  4493. execute : function(g) {
  4494. this.preExecute();
  4495. g.style("fill", this._backgroundColor != null ? this._backgroundColor : "#FFFFFF").style("fill-opacity", 1.0);
  4496. g.attr("x", this._rect.x).attr("y", this._rect.y).attr("width", this._rect.width).attr("height", this._rect.height);
  4497. },
  4498. /** @expose */
  4499. type : function() {
  4500. return com_ibm_rave_bundles_component_BackgroundComponent.COMPONENT_TYPE;
  4501. },
  4502. backgroundColor$0 : function() {
  4503. return this._backgroundColor;
  4504. },
  4505. backgroundColor$1 : function(backgroundColor) {
  4506. this._backgroundColor = backgroundColor;
  4507. return this;
  4508. },
  4509. /**
  4510. * @param (rave['library']['internal']['ContextSize']) size New value of size property
  4511. * @return (com.ibm.rave.bundles.components.BackgroundComponentImpl) This component
  4512. */
  4513. /** @expose */
  4514. size : function(size) {
  4515. this._rect.x = 0;
  4516. this._rect.y = 0;
  4517. this._rect.width = size.w;
  4518. this._rect.height = size.h;
  4519. return this;
  4520. },
  4521. /** @expose */
  4522. rect : function(rect) {
  4523. var r = new rave['internal']['RectStruct'](rect.x, rect.y, rect.width, rect.height);
  4524. this._rect = r;
  4525. return this;
  4526. },
  4527. /** @expose */
  4528. backgroundColor : function(a0) {
  4529. var args = arguments;
  4530. if (args.length == 0) {
  4531. return this.backgroundColor$0();
  4532. }
  4533. return this.backgroundColor$1(a0);
  4534. }
  4535. });
  4536. // $source: com/ibm/rave/bundles/components/ChartLayoutComponentImpl
  4537. /************************************************************************
  4538. ** IBM Confidential
  4539. **
  4540. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4541. **
  4542. ** (C) Copyright IBM Corp. 2017
  4543. **
  4544. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4545. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4546. ************************************************************************/
  4547. // GENERATED
  4548. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  4549. //@import com/ibm/rave/bundles/component/ChartLayoutComponent (runtime) // ChartLayoutComponent
  4550. /**
  4551. * <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>
  4552. */
  4553. var com_ibm_rave_bundles_components_ChartLayoutComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  4554. //_padding : null,
  4555. //_legendChartGap : null,
  4556. //_topChartPadding : null,
  4557. //_leftChartPadding : null,
  4558. //_bottomChartPadding : null,
  4559. //_rightChartPadding : null,
  4560. //_legendPosition : null,
  4561. //_legendSizable : null,
  4562. //_axisSizables : null,
  4563. //_overallRect : null,
  4564. //_legendRect : null,
  4565. //_chartRect : null,
  4566. //_topRect : null,
  4567. //_leftRect : null,
  4568. //_bottomRect : null,
  4569. //_rightRect : null,
  4570. //_elementRect : null,
  4571. _leftPadding : 0, _topPadding : 0, _rightPadding : 0, _bottomPadding : 0,
  4572. _legendChartAlign : false,
  4573. _preLegendAtMax : false,
  4574. _preAxesAtZero : false,
  4575. constructor : function() {
  4576. this._axisSizables = [];
  4577. /**
  4578. * Construct. All padding is 0, legendPosition is "right", all slices have a size of 0 (value of null).
  4579. */
  4580. {
  4581. this._padding = 0.0;
  4582. this._topPadding = 0;
  4583. this._leftPadding = 0;
  4584. this._bottomPadding = 0;
  4585. this._rightPadding = 0;
  4586. this._topChartPadding = 0.0;
  4587. this._leftChartPadding = 0.0;
  4588. this._bottomChartPadding = 0.0;
  4589. this._rightChartPadding = 0.0;
  4590. this._legendChartGap = 0.0;
  4591. this._legendPosition = "right";
  4592. this._overallRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4593. this._legendRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4594. this._chartRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4595. this._topRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4596. this._leftRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4597. this._bottomRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4598. this._rightRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4599. this._elementRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4600. this._legendChartAlign = true;
  4601. }
  4602. },
  4603. /** @expose */
  4604. execute : function(g) {
  4605. this.layout();
  4606. },
  4607. /**
  4608. * Calculates rectangles during preliminary layout
  4609. * @param (boolean) legendAtMax true if legend is given max size; false if legend is asked for its preferred size
  4610. * @param (boolean) axesAtZero true if axes are given a size of 0; false if axes are asked for their preferred size
  4611. */
  4612. /** @expose */
  4613. preLayout : function(legendAtMax, axesAtZero) {
  4614. this._preLegendAtMax = legendAtMax;
  4615. this._preAxesAtZero = axesAtZero;
  4616. this.layout();
  4617. this._preLegendAtMax = false;
  4618. this._preAxesAtZero = false;
  4619. },
  4620. /**
  4621. * Calls preExecute, then does the layout with the property values, updating the chart, legend, axis, and elements rectangles.
  4622. */
  4623. /** @expose */
  4624. layout : function() {
  4625. this.preExecute();
  4626. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._chartRect, this._overallRect);
  4627. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._legendRect, this._overallRect);
  4628. var x = this._overallRect.x;
  4629. var y = this._overallRect.y;
  4630. var w = this._overallRect.width;
  4631. var h = this._overallRect.height;
  4632. var maxWH = Math.max(w, h);
  4633. var tbLegend = "top" == this._legendPosition || "bottom" == this._legendPosition;
  4634. var legendPercent = this._axisSizables.length == 0 ? 0.5 : 0.3;
  4635. var legendMaxSize = (tbLegend ? this._legendRect.height : this._legendRect.width) * legendPercent;
  4636. var legendDynamicSize = this._legendSizable ? (this._preLegendAtMax ? maxWH : this._legendSizable.getPreferredSize()) : 0;
  4637. if (legendDynamicSize > legendMaxSize) {
  4638. legendDynamicSize = legendMaxSize;
  4639. }
  4640. var isLegendTop = false;
  4641. var isLegendBottom = false;
  4642. var isLegendLeft = false;
  4643. var isLegendRight = false;
  4644. if ("top" == this._legendPosition) {
  4645. this._legendRect.height = legendDynamicSize;
  4646. this._chartRect.height -= this._legendRect.height;
  4647. this._chartRect.y += this._legendRect.height;
  4648. isLegendTop = true;
  4649. } else if ("bottom" == this._legendPosition) {
  4650. this._legendRect.height = legendDynamicSize;
  4651. this._chartRect.height -= this._legendRect.height;
  4652. this._legendRect.y = y + h - this._legendRect.height;
  4653. isLegendBottom = true;
  4654. } else if ("left" == this._legendPosition) {
  4655. this._legendRect.width = legendDynamicSize;
  4656. this._chartRect.width -= this._legendRect.width;
  4657. this._chartRect.x += this._legendRect.width;
  4658. isLegendLeft = true;
  4659. } else {
  4660. this._legendRect.width = legendDynamicSize;
  4661. this._chartRect.width -= this._legendRect.width;
  4662. this._legendRect.x = x + w - this._legendRect.width;
  4663. isLegendRight = true;
  4664. }
  4665. if (this.evaluatePadding(this._padding, w, h)) {
  4666. var lrgap = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._legendChartGap, w);
  4667. var tbgap = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._legendChartGap, h);
  4668. var chartTop = isLegendTop && this._legendSizable ? tbgap : this._topPadding;
  4669. var chartLeft = isLegendLeft && this._legendSizable ? lrgap : this._leftPadding;
  4670. var chartBottom = isLegendBottom && this._legendSizable ? tbgap : this._bottomPadding;
  4671. var chartRight = isLegendRight && this._legendSizable ? lrgap : this._rightPadding;
  4672. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset(this._chartRect, chartTop, chartLeft, chartBottom, chartRight);
  4673. } else {
  4674. var lrpadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._padding, w);
  4675. var tbpadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._padding, h);
  4676. var chartTop = tbpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._topChartPadding, h);
  4677. var chartLeft = lrpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._leftChartPadding, w);
  4678. var chartBottom = tbpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._bottomChartPadding, h);
  4679. var chartRight = lrpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._rightChartPadding, w);
  4680. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset(this._chartRect, chartTop, chartLeft, chartBottom, chartRight);
  4681. this._topPadding = tbpadding;
  4682. this._leftPadding = lrpadding;
  4683. this._bottomPadding = tbpadding;
  4684. this._rightPadding = lrpadding;
  4685. }
  4686. if (this._legendSizable) {
  4687. if (isLegendRight) {
  4688. this._legendRect.x -= this._rightPadding;
  4689. this._chartRect.width -= this._rightPadding;
  4690. this._legendRect.y += this._topPadding;
  4691. this._legendRect.height -= (this._topPadding + this._bottomPadding);
  4692. } else if (isLegendLeft) {
  4693. this._legendRect.x += this._leftPadding;
  4694. this._chartRect.x += this._leftPadding;
  4695. this._chartRect.width -= this._leftPadding;
  4696. this._legendRect.y += this._topPadding;
  4697. this._legendRect.height -= (this._topPadding + this._bottomPadding);
  4698. } else if (isLegendTop) {
  4699. this._legendRect.y += this._topPadding;
  4700. this._chartRect.y += this._topPadding;
  4701. this._chartRect.height -= this._topPadding;
  4702. this._legendRect.x += this._leftPadding;
  4703. this._legendRect.width -= (this._leftPadding + this._rightPadding);
  4704. } else {
  4705. this._legendRect.y -= this._bottomPadding;
  4706. this._chartRect.height -= this._bottomPadding;
  4707. this._legendRect.x += this._leftPadding;
  4708. this._legendRect.width -= (this._leftPadding + this._rightPadding);
  4709. }
  4710. }
  4711. x = this._chartRect.x;
  4712. y = this._chartRect.y;
  4713. w = this._chartRect.width;
  4714. h = this._chartRect.height;
  4715. var bottomH = 0;
  4716. var topH = 0;
  4717. var leftW = 0;
  4718. var rightW = 0;
  4719. var tbSO = 0;
  4720. var lrSO = 0;
  4721. if (!this._preAxesAtZero) {
  4722. var countHorz = 0;
  4723. var countVert = 0;
  4724. for (var i = 0; i < this._axisSizables.length; ++i) {
  4725. var sizable = this._axisSizables[i];
  4726. if (sizable) {
  4727. var orientation = sizable.getSizableOrientation();
  4728. if ("top" == orientation || "bottom" == orientation) {
  4729. countHorz++;
  4730. } else {
  4731. countVert++;
  4732. }
  4733. }
  4734. }
  4735. for (var i = 0; i < this._axisSizables.length; ++i) {
  4736. var sizable = this._axisSizables[i];
  4737. if (sizable) {
  4738. var orientation = sizable.getSizableOrientation();
  4739. var tbAxis = "top" == orientation || "bottom" == orientation;
  4740. var axisDynamicSize = sizable.getPreferredSize();
  4741. var spillOver = sizable.getSpillOverSize();
  4742. if (tbAxis) {
  4743. var axisPercent = countHorz > 1 ? 0.4 : 0.5;
  4744. if (axisDynamicSize > this._chartRect.height * axisPercent) {
  4745. axisDynamicSize = this._chartRect.height * axisPercent;
  4746. }
  4747. if ("top" == orientation) {
  4748. topH = axisDynamicSize;
  4749. } else {
  4750. bottomH = axisDynamicSize;
  4751. }
  4752. if (spillOver > lrSO) {
  4753. lrSO = spillOver;
  4754. }
  4755. } else {
  4756. var axisPercent = countVert > 1 ? 0.4 : 0.5;
  4757. if (axisDynamicSize > this._chartRect.width * axisPercent) {
  4758. axisDynamicSize = this._chartRect.width * axisPercent;
  4759. }
  4760. if ("left" == orientation) {
  4761. leftW = axisDynamicSize;
  4762. } else {
  4763. rightW = axisDynamicSize;
  4764. }
  4765. if (spillOver > tbSO) {
  4766. tbSO = spillOver;
  4767. }
  4768. }
  4769. }
  4770. }
  4771. }
  4772. if (lrSO > leftW) {
  4773. leftW = lrSO;
  4774. }
  4775. if (lrSO > rightW) {
  4776. rightW = lrSO;
  4777. }
  4778. if (tbSO > topH) {
  4779. topH = tbSO;
  4780. }
  4781. if (tbSO > bottomH) {
  4782. bottomH = tbSO;
  4783. }
  4784. this._leftRect.x = x;
  4785. this._leftRect.width = leftW;
  4786. this._leftRect.y = y;
  4787. this._leftRect.height = h;
  4788. this._rightRect.x = x + w - rightW;
  4789. this._rightRect.width = rightW;
  4790. this._rightRect.y = y;
  4791. this._rightRect.height = h;
  4792. this._topRect.y = y;
  4793. this._topRect.height = topH;
  4794. this._topRect.x = x;
  4795. this._topRect.width = w;
  4796. this._bottomRect.y = y + h - bottomH;
  4797. this._bottomRect.height = bottomH;
  4798. this._bottomRect.x = x;
  4799. this._bottomRect.width = w;
  4800. this._elementRect.x = x + leftW;
  4801. this._elementRect.y = y + topH;
  4802. this._elementRect.width = w - (leftW + rightW);
  4803. this._elementRect.height = h - (topH + bottomH);
  4804. if (this._legendSizable && this._legendChartAlign) {
  4805. if (tbLegend) {
  4806. this._legendRect.x = this._elementRect.x;
  4807. this._legendRect.width = this._elementRect.width;
  4808. } else {
  4809. this._legendRect.y = this._elementRect.y;
  4810. this._legendRect.height = this._elementRect.height;
  4811. }
  4812. }
  4813. },
  4814. evaluatePadding : function(padding, horizontalExtent, verticalExtent) {
  4815. if (padding == null) {
  4816. return false;
  4817. }
  4818. var paddingString = (padding) + "";
  4819. if (paddingString.length == 0) {
  4820. return false;
  4821. }
  4822. this._topPadding = 0;
  4823. this._leftPadding = 0;
  4824. this._bottomPadding = 0;
  4825. this._rightPadding = 0;
  4826. var items = paddingString.split(new RegExp(";"));
  4827. for (var __i_enFor0 = 0, __len_enFor0 = items.length;
  4828. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4829. var item = items[__i_enFor0];
  4830. var parts = item.split(new RegExp(":"));
  4831. if (items.length == 1 && parts.length != 2) {
  4832. return false;
  4833. }
  4834. if (parts.length == 2) {
  4835. if (0 <= parts[0].indexOf("top")) {
  4836. this._topPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], verticalExtent);
  4837. } else if (0 <= parts[0].indexOf("left")) {
  4838. this._leftPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], horizontalExtent);
  4839. } else if (0 <= parts[0].indexOf("bottom")) {
  4840. this._bottomPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], verticalExtent);
  4841. } else if (0 <= parts[0].indexOf("right")) {
  4842. this._rightPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], horizontalExtent);
  4843. }
  4844. }
  4845. }
  4846. return true;
  4847. },
  4848. /**
  4849. * @return (rave['internal']['RectStruct']) Legend rectangle
  4850. */
  4851. /** @expose */
  4852. legendRect : function() {
  4853. return this._legendRect;
  4854. },
  4855. /**
  4856. * @return (rave['internal']['RectStruct']) Chart (elements plus axes) rectangle
  4857. */
  4858. /** @expose */
  4859. chartRect : function() {
  4860. return this._chartRect;
  4861. },
  4862. /**
  4863. * @return (rave['internal']['RectStruct']) Top axis rectangle
  4864. */
  4865. /** @expose */
  4866. topRect : function() {
  4867. return this._topRect;
  4868. },
  4869. /**
  4870. * @return (rave['internal']['RectStruct']) Left axis rectangle
  4871. */
  4872. /** @expose */
  4873. leftRect : function() {
  4874. return this._leftRect;
  4875. },
  4876. /**
  4877. * @return (rave['internal']['RectStruct']) Bottom axis rectangle
  4878. */
  4879. /** @expose */
  4880. bottomRect : function() {
  4881. return this._bottomRect;
  4882. },
  4883. /**
  4884. * @return (rave['internal']['RectStruct']) Right axis rectangle
  4885. */
  4886. /** @expose */
  4887. rightRect : function() {
  4888. return this._rightRect;
  4889. },
  4890. /**
  4891. * @return (rave['internal']['RectStruct']) Legend rectangle
  4892. */
  4893. /** @expose */
  4894. elementRect : function() {
  4895. return this._elementRect;
  4896. },
  4897. /**
  4898. * Set the overall rectangle. This should be called before doing the layout.
  4899. * @param (rave['internal']['RectStruct']) overall The overall rectangle
  4900. */
  4901. /** @expose */
  4902. overall : function(overall) {
  4903. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._overallRect, overall);
  4904. return this;
  4905. },
  4906. padding$0 : function() {
  4907. return this._padding;
  4908. },
  4909. legendChartAlign$0 : function() {
  4910. return this._legendChartAlign;
  4911. },
  4912. legendChartGap$0 : function() {
  4913. return this._legendChartGap;
  4914. },
  4915. topPadding$0 : function() {
  4916. return this._topChartPadding;
  4917. },
  4918. leftPadding$0 : function() {
  4919. return this._leftChartPadding;
  4920. },
  4921. bottomPadding$0 : function() {
  4922. return this._bottomChartPadding;
  4923. },
  4924. rightPadding$0 : function() {
  4925. return this._rightChartPadding;
  4926. },
  4927. legendPosition$0 : function() {
  4928. return this._legendPosition;
  4929. },
  4930. topPadding$1 : function(padding) {
  4931. this._topChartPadding = padding;
  4932. return this;
  4933. },
  4934. leftPadding$1 : function(padding) {
  4935. this._leftChartPadding = padding;
  4936. return this;
  4937. },
  4938. bottomPadding$1 : function(padding) {
  4939. this._bottomChartPadding = padding;
  4940. return this;
  4941. },
  4942. rightPadding$1 : function(padding) {
  4943. this._rightChartPadding = padding;
  4944. return this;
  4945. },
  4946. /** @expose */
  4947. type : function() {
  4948. return com_ibm_rave_bundles_component_ChartLayoutComponent.COMPONENT_TYPE;
  4949. },
  4950. padding$1 : function(value) {
  4951. this._padding = value;
  4952. return this;
  4953. },
  4954. /** @expose */
  4955. chartPadding : function(top, left, bottom, right) {
  4956. this._topChartPadding = top;
  4957. this._leftChartPadding = left;
  4958. this._bottomChartPadding = bottom;
  4959. this._rightChartPadding = right;
  4960. return this;
  4961. },
  4962. legendChartAlign$1 : function(legendChartAlign) {
  4963. this._legendChartAlign = legendChartAlign;
  4964. return this;
  4965. },
  4966. legendChartGap$1 : function(value) {
  4967. this._legendChartGap = value;
  4968. return this;
  4969. },
  4970. legendPosition$1 : function(position) {
  4971. if ("top" == position || "bottom" == position || "left" == position || "right" == position) {
  4972. this._legendPosition = position;
  4973. }
  4974. return this;
  4975. },
  4976. /** @expose */
  4977. legendSize : function(sizable) {
  4978. this._legendSizable = sizable;
  4979. return this;
  4980. },
  4981. /** @expose */
  4982. removeAxisSizables : function() {
  4983. this._axisSizables.length = 0;
  4984. return this;
  4985. },
  4986. /** @expose */
  4987. addAxisSizable : function(sizable) {
  4988. this._axisSizables.push(sizable);
  4989. return this;
  4990. },
  4991. /** @expose */
  4992. padding : function(a0) {
  4993. var args = arguments;
  4994. if (args.length == 0) {
  4995. return this.padding$0();
  4996. }
  4997. return this.padding$1(a0);
  4998. },
  4999. /** @expose */
  5000. legendChartAlign : function(a0) {
  5001. var args = arguments;
  5002. if (args.length == 0) {
  5003. return this.legendChartAlign$0();
  5004. }
  5005. return this.legendChartAlign$1(a0);
  5006. },
  5007. /** @expose */
  5008. legendChartGap : function(a0) {
  5009. var args = arguments;
  5010. if (args.length == 0) {
  5011. return this.legendChartGap$0();
  5012. }
  5013. return this.legendChartGap$1(a0);
  5014. },
  5015. /** @expose */
  5016. topPadding : function(a0) {
  5017. var args = arguments;
  5018. if (args.length == 0) {
  5019. return this.topPadding$0();
  5020. }
  5021. return this.topPadding$1(a0);
  5022. },
  5023. /** @expose */
  5024. leftPadding : function(a0) {
  5025. var args = arguments;
  5026. if (args.length == 0) {
  5027. return this.leftPadding$0();
  5028. }
  5029. return this.leftPadding$1(a0);
  5030. },
  5031. /** @expose */
  5032. bottomPadding : function(a0) {
  5033. var args = arguments;
  5034. if (args.length == 0) {
  5035. return this.bottomPadding$0();
  5036. }
  5037. return this.bottomPadding$1(a0);
  5038. },
  5039. /** @expose */
  5040. rightPadding : function(a0) {
  5041. var args = arguments;
  5042. if (args.length == 0) {
  5043. return this.rightPadding$0();
  5044. }
  5045. return this.rightPadding$1(a0);
  5046. },
  5047. /** @expose */
  5048. legendPosition : function(a0) {
  5049. var args = arguments;
  5050. if (args.length == 0) {
  5051. return this.legendPosition$0();
  5052. }
  5053. return this.legendPosition$1(a0);
  5054. }
  5055. });
  5056. /**
  5057. * Set preferred rectangle to the same position and size as the source rectangle.
  5058. * @param (rave['internal']['RectStruct']) t preferred rectangle
  5059. * @param (rave['internal']['RectStruct']) s Source rectangle
  5060. * @return (rave['internal']['RectStruct']) preferred rectangle
  5061. */
  5062. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect = function(t, s) {
  5063. t.x = s.x;
  5064. t.y = s.y;
  5065. t.width = s.width;
  5066. t.height = s.height;
  5067. return t;
  5068. };
  5069. /**
  5070. * 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.
  5071. * @param (rave['internal']['RectStruct']) r Rectangle
  5072. * @param (double) top Top inset in pixels
  5073. * @param (double) left Left inset in pixels
  5074. * @param (double) bottom Bottom inset in pixels
  5075. * @param (double) right Right inset in pixels
  5076. * @return (rave['internal']['RectStruct']) The rectangle
  5077. */
  5078. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset = function(r, top, left, bottom, right) {
  5079. var ileft = Math.max(0.0, left);
  5080. var iright = Math.max(0.0, right);
  5081. if (ileft + iright <= r.width) {
  5082. r.x += ileft;
  5083. r.width -= ileft + iright;
  5084. }
  5085. var itop = Math.max(0.0, top);
  5086. var ibottom = Math.max(0.0, bottom);
  5087. if (itop + ibottom <= r.height) {
  5088. r.y += itop;
  5089. r.height -= itop + ibottom;
  5090. }
  5091. return r;
  5092. };
  5093. /**
  5094. * 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.
  5095. * @param (Object) value The size
  5096. * @param (double) extent The extent in the dimension
  5097. * @param defValue The default to use if not parsable
  5098. * @return (double) Size in pixels
  5099. */
  5100. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize = function(value, extent) {
  5101. var v = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(value, extent, 10.0);
  5102. var d = v != null ? v : 0;
  5103. return Math.max(0.0, Math.min(d, extent));
  5104. };
  5105. /** @expose */
  5106. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_AXIS_PERCENT = 0.4;
  5107. /** @expose */
  5108. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_AXIS_PERCENT_SINGLE_PER_ORIENTATION = 0.5;
  5109. /** @expose */
  5110. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_LEGEND_PERCENT = 0.3;
  5111. /** @expose */
  5112. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_LEGEND_PERCENT_NO_AXIS = 0.5;
  5113. // $source: com/ibm/rave/bundles/components/ClipPathComponentImpl
  5114. /************************************************************************
  5115. ** IBM Confidential
  5116. **
  5117. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5118. **
  5119. ** (C) Copyright IBM Corp. 2017
  5120. **
  5121. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5122. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5123. ************************************************************************/
  5124. // GENERATED
  5125. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5126. /**
  5127. * 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>
  5128. */
  5129. var com_ibm_rave_bundles_components_ClipPathComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5130. //_id : null,
  5131. //_clipRect : null,
  5132. constructor : function(id) {
  5133. this._clipRect = new rave['internal']['RectStruct'](0, 0, 100, 100);
  5134. /**
  5135. * 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.
  5136. * @param (String) id String ID that is unique <em>across the document</em>.
  5137. */
  5138. {
  5139. this._id = id;
  5140. }
  5141. },
  5142. /** @expose */
  5143. type : function() {
  5144. return "ClipPathComponent";
  5145. },
  5146. /**
  5147. * Set the rectangular clipping area. Make the _clipRect one pixel larger than requested to avoid the cut-off at bounds. TODO: why?!?
  5148. * @param (rave['internal']['RectStruct']) rect The rectangular bounds of the clipping area.
  5149. * @return (com.ibm.rave.bundles.components.ClipPathComponentImpl) This ClipPathComponent.
  5150. */
  5151. /** @expose */
  5152. clipRect : function(rect) {
  5153. this._clipRect = new rave['internal']['RectStruct'](rect.x - 1, rect.y - 1, rect.width + 2, rect.height + 2);
  5154. return this;
  5155. },
  5156. /**
  5157. * Set the clip-path attribute on the provided selection.
  5158. * @return (com.ibm.rave.bundles.components.ClipPathComponentImpl) This ClipPathComponent.
  5159. */
  5160. /** @expose */
  5161. applyTo : function(s) {
  5162. s.attr("clip-path", "url(" + this.url() + ")");
  5163. return this;
  5164. },
  5165. /**
  5166. * Retrieve the id assigned to this clip path.
  5167. */
  5168. /** @expose */
  5169. id : function() {
  5170. return this._id;
  5171. },
  5172. /**
  5173. * Retrieve the URL that can be used to reference this clip path.
  5174. */
  5175. /** @expose */
  5176. url : function() {
  5177. return "#" + this._id;
  5178. },
  5179. /** @expose */
  5180. execute : function(g) {
  5181. var clipPath = g.selectAll("#" + this._id).data([0]);
  5182. clipPath.enter().append("clipPath").attr("id", this._id).append("rect");
  5183. 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);
  5184. }
  5185. });
  5186. // $source: com/ibm/rave/bundles/components/LegendComponentImpl
  5187. /************************************************************************
  5188. ** IBM Confidential
  5189. **
  5190. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5191. **
  5192. ** (C) Copyright IBM Corp. 2017
  5193. **
  5194. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5195. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5196. ************************************************************************/
  5197. // GENERATED
  5198. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5199. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  5200. /**
  5201. * <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>
  5202. */
  5203. var com_ibm_rave_bundles_components_LegendComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5204. /**
  5205. * Legend size property
  5206. */
  5207. //_size : null,
  5208. /**
  5209. * Color scale
  5210. */
  5211. //_colorPalette : null,
  5212. /**
  5213. * Orient, "horizontal" or "vertical"
  5214. */
  5215. //_orient : null,
  5216. /**
  5217. * Swatch size function
  5218. */
  5219. //_swatchSizeFunc : null,
  5220. /**
  5221. * Scale
  5222. */
  5223. //_scale : null,
  5224. /**
  5225. * Swatch symbol
  5226. */
  5227. //_shape : null,
  5228. /**
  5229. * Legend title
  5230. */
  5231. //_title : null,
  5232. /**
  5233. * Legend title styling
  5234. */
  5235. //_titleStyle : null,
  5236. /**
  5237. * Legend entry styling
  5238. */
  5239. //_entryStyle : null,
  5240. /**
  5241. * Custom formatter
  5242. */
  5243. //_labelFormat : null,
  5244. /**
  5245. * The swatch legend, created on demand
  5246. */
  5247. //_swatchLegend : null,
  5248. /**
  5249. * The continuous legend, created on demand
  5250. */
  5251. //_continuousLegend : null,
  5252. /**
  5253. * The legend type, either "SwatchLegend" or "ContinuousLegend"
  5254. */
  5255. //_legendType : null,
  5256. /**
  5257. * Is the legend visible
  5258. */
  5259. _visible : false,
  5260. /**
  5261. * Swatch size in square pixels
  5262. */
  5263. _swatchSize : 0,
  5264. /**
  5265. * Constructor; sets bound and, colorScale to null, all other properties to their default values.
  5266. */
  5267. /** @expose */
  5268. constructor : function() {
  5269. this._visible = true;
  5270. this._size = null;
  5271. this._colorPalette = null;
  5272. this._orient = "horizontal";
  5273. this._swatchSize = 16.0 * 16.0;
  5274. this._swatchSizeFunc = null;
  5275. this._scale = null;
  5276. this._shape = "square";
  5277. this._title = null;
  5278. this._titleStyle = {};
  5279. this._entryStyle = {};
  5280. this._labelFormat = null;
  5281. this._swatchLegend = null;
  5282. this._continuousLegend = null;
  5283. this._legendType = null;
  5284. },
  5285. /** @expose */
  5286. type : function() {
  5287. return "LegendComponent";
  5288. },
  5289. /** @expose */
  5290. execute : function(g) {
  5291. if (this._colorPalette) {
  5292. if ("continuous" == this._colorPalette.getType()) {
  5293. if (!this._continuousLegend) {
  5294. this._continuousLegend = (rave.capabilities.extension("legend")).continuous();
  5295. }
  5296. this._legendType = "ContinuousLegend";
  5297. } else {
  5298. if (!this._swatchLegend) {
  5299. this._swatchLegend = (rave.capabilities.extension("legend")).swatch();
  5300. }
  5301. this._legendType = "SwatchLegend";
  5302. }
  5303. } else if (this._swatchSizeFunc) {
  5304. if (!this._swatchLegend) {
  5305. this._swatchLegend = (rave.capabilities.extension("legend")).swatch();
  5306. }
  5307. this._legendType = "SwatchLegend";
  5308. } else {
  5309. this._legendType = null;
  5310. }
  5311. this.preExecute();
  5312. if (!this._visible || (!this._colorPalette && !this._swatchSizeFunc) || !this._size || this._size[0] <= 0 || this._size[1] <= 0) {
  5313. g.selectAll("*").remove();
  5314. return;
  5315. }
  5316. var fontChecker = rave.capabilities.extension("fontchecker");
  5317. if (this._colorPalette && "continuous" == this._colorPalette.getType()) {
  5318. 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);
  5319. var legend = g.call(this._continuousLegend);
  5320. if (this._entryStyle) {
  5321. legend.selectAll(".legendLabel").style(this._entryStyle);
  5322. }
  5323. if (this._titleStyle) {
  5324. legend.selectAll(".legendTitle").style(this._titleStyle);
  5325. }
  5326. if (fontChecker) {
  5327. legend.selectAll(".legendLabel").call(fontChecker);
  5328. legend.selectAll(".legendTitle").call(fontChecker);
  5329. }
  5330. } else {
  5331. var insets = {};
  5332. insets["bottom"] = 5;
  5333. var swatchSize = this._swatchSize;
  5334. var scale = null;
  5335. var labelFormatter = this._labelFormat;
  5336. if (this._swatchSizeFunc && this._scale) {
  5337. swatchSize = this._swatchSizeFunc;
  5338. scale = this._scale;
  5339. }
  5340. if (this._colorPalette) {
  5341. scale = this._colorPalette.getScale();
  5342. var originalDomain = this._colorPalette.originalDomain();
  5343. if (originalDomain) {
  5344. scale.domain(originalDomain);
  5345. var f = this._colorPalette.originalDomainLabelAccessor();
  5346. if (this._labelFormat) {
  5347. var self = this;
  5348. labelFormatter = function(data, index, groupIndex) {
  5349. return self._labelFormat.call(this, f.call(this, data, index, groupIndex), index, groupIndex);
  5350. };
  5351. } else {
  5352. labelFormatter = f;
  5353. }
  5354. }
  5355. }
  5356. 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);
  5357. var legend = g.call(this._swatchLegend);
  5358. if (this._entryStyle) {
  5359. legend.selectAll(".legendLabel").style(this._entryStyle);
  5360. }
  5361. if (this._titleStyle) {
  5362. legend.selectAll(".legendTitle").style(this._titleStyle);
  5363. }
  5364. if (fontChecker) {
  5365. legend.selectAll(".legendLabel").call(fontChecker);
  5366. legend.selectAll(".legendTitle").call(fontChecker);
  5367. }
  5368. }
  5369. },
  5370. /** @expose */
  5371. legend : function() {
  5372. if ("ContinuousLegend" == this._legendType) {
  5373. return this._continuousLegend;
  5374. }
  5375. if ("SwatchLegend" == this._legendType) {
  5376. return this._swatchLegend;
  5377. }
  5378. return null;
  5379. },
  5380. /** @expose */
  5381. legendType : function() {
  5382. return this._legendType;
  5383. },
  5384. /**
  5385. * Set the visible property.
  5386. * @param (boolean) visible New visible
  5387. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5388. */
  5389. /** @expose */
  5390. visible : function(visible) {
  5391. this._visible = visible;
  5392. return this;
  5393. },
  5394. /**
  5395. * see if the legend is visible
  5396. * @return (boolean) if its visible
  5397. */
  5398. /** @expose */
  5399. isVisible : function() {
  5400. return this._visible;
  5401. },
  5402. /**
  5403. * Set the size property.
  5404. * @param (Array) size New size
  5405. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5406. */
  5407. /** @expose */
  5408. size : function(size) {
  5409. this._size = size;
  5410. return this;
  5411. },
  5412. /**
  5413. * Set the color scale property.
  5414. * @param (rave['library']['internal']['Palette']) colorPalette New color scale
  5415. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5416. */
  5417. /** @expose */
  5418. colorPalette : function(colorPalette) {
  5419. this._colorPalette = colorPalette;
  5420. return this;
  5421. },
  5422. /**
  5423. * Set the orient property. If the argument is not "horizontal" or "vertical", it is ignored and the orient property is not changed.
  5424. * @param (String) orient New orient
  5425. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5426. */
  5427. /** @expose */
  5428. orient : function(orient) {
  5429. if ("horizontal" == orient || "vertical" == orient) {
  5430. this._orient = orient;
  5431. }
  5432. return this;
  5433. },
  5434. /**
  5435. * 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".
  5436. * @param (String) position Legend position
  5437. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5438. */
  5439. /** @expose */
  5440. position : function(position) {
  5441. return this.orient(com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf(position));
  5442. },
  5443. swatchSize$0 : function(swatchSize) {
  5444. if (swatchSize >= 0.0 && swatchSize != null) {
  5445. this._swatchSize = swatchSize;
  5446. }
  5447. return this;
  5448. },
  5449. /** @expose */
  5450. scale : function(scale) {
  5451. this._scale = scale;
  5452. return this;
  5453. },
  5454. swatchSize$1 : function(swatchSize) {
  5455. if (swatchSize) {
  5456. this._swatchSizeFunc = swatchSize;
  5457. }
  5458. return this;
  5459. },
  5460. /** @expose */
  5461. shape : function(shape) {
  5462. this._shape = shape;
  5463. return this;
  5464. },
  5465. /** @expose */
  5466. title : function(title) {
  5467. this._title = (title != null && title.length > 0) ? title : null;
  5468. return this;
  5469. },
  5470. /** @expose */
  5471. titleFill : function(titleFill) {
  5472. this._titleStyle["fill"] = titleFill;
  5473. return this;
  5474. },
  5475. /** @expose */
  5476. titleFontSize : function(titleFontSize) {
  5477. this._titleStyle["font-size"] = titleFontSize;
  5478. return this;
  5479. },
  5480. /** @expose */
  5481. titleFontFamily : function(titleFontFamily) {
  5482. this._titleStyle["font-family"] = titleFontFamily;
  5483. return this;
  5484. },
  5485. /** @expose */
  5486. labelFormat : function(labelFormat) {
  5487. this._labelFormat = labelFormat;
  5488. return this;
  5489. },
  5490. /** @expose */
  5491. titleFont : function(titleFontStyle) {
  5492. this._titleStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(titleFontStyle);
  5493. return this;
  5494. },
  5495. /** @expose */
  5496. entryFont : function(entryFontStyle) {
  5497. this._entryStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(entryFontStyle);
  5498. return this;
  5499. },
  5500. /** @expose */
  5501. getSpaceUsed : function() {
  5502. if (this._colorPalette && "continuous" == this._colorPalette.getType()) {
  5503. return this._continuousLegend.getUsedSize() + 2;
  5504. } else {
  5505. return this._swatchLegend.getUsedSize() + 2;
  5506. }
  5507. },
  5508. /** @expose */
  5509. swatchSize : function(a0) {
  5510. var args = arguments;
  5511. if (args.length == 1 && typeof a0 === "function") {
  5512. return this.swatchSize$1(a0);
  5513. }
  5514. return this.swatchSize$0(a0);
  5515. }
  5516. });
  5517. /**
  5518. * Get the orient for a position. "top" and "bottom" return "horizontal", anything else ("left", "right", or unknown/null) is "vertical".
  5519. * @param (String) position A position
  5520. * @return (String) "horizontal" or "vertical"
  5521. */
  5522. /** @expose */
  5523. com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf = function(position) {
  5524. if ("top" == position || "bottom" == position) {
  5525. return "horizontal";
  5526. }
  5527. return "vertical";
  5528. };
  5529. //com_ibm_rave_bundles_components_LegendComponentImpl.HORIZONTAL = "horizontal";
  5530. //com_ibm_rave_bundles_components_LegendComponentImpl.VERTICAL = "vertical";
  5531. com_ibm_rave_bundles_components_LegendComponentImpl.BAR_THINKNESS = 16;
  5532. com_ibm_rave_bundles_components_LegendComponentImpl.SWATCH_SIZE = 16;
  5533. /** @expose */
  5534. com_ibm_rave_bundles_components_LegendComponentImpl.TOP = "top";
  5535. /** @expose */
  5536. com_ibm_rave_bundles_components_LegendComponentImpl.BOTTOM = "bottom";
  5537. /** @expose */
  5538. com_ibm_rave_bundles_components_LegendComponentImpl.LEFT = "left";
  5539. /** @expose */
  5540. com_ibm_rave_bundles_components_LegendComponentImpl.RIGHT = "right";
  5541. /** @expose */
  5542. com_ibm_rave_bundles_components_LegendComponentImpl.ADJUSTABLE = -1;
  5543. // $source: com/ibm/rave/bundles/components/AxisComponentImpl
  5544. /************************************************************************
  5545. ** IBM Confidential
  5546. **
  5547. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5548. **
  5549. ** (C) Copyright IBM Corp. 2018
  5550. **
  5551. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5552. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5553. ************************************************************************/
  5554. // GENERATED
  5555. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5556. //@import com/ibm/rave/bundles/component/AxisComponent (runtime) // AxisComponent
  5557. //@import com/ibm/rave/bundles/utilities/TextCrossfader (runtime) // textCrossFade
  5558. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  5559. //@import com/ibm/rave/bundles/utilities/BundleLabelDropper (runtime) // new
  5560. /**
  5561. * <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>
  5562. */
  5563. var com_ibm_rave_bundles_components_AxisComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5564. /**
  5565. * Axis - created on demand
  5566. */
  5567. //_axis : null,
  5568. /**
  5569. * Role, from the AxisComponent API
  5570. */
  5571. //_role : null,
  5572. /**
  5573. * CoordinateScale
  5574. */
  5575. //_scale : null,
  5576. /**
  5577. * Orient, always one of the four legal values
  5578. */
  5579. //_orient : null,
  5580. /**
  5581. * Size
  5582. */
  5583. //_bounds : null,
  5584. //_elementRect : null,
  5585. /**
  5586. * The title text; default null (nothing visible)
  5587. */
  5588. /** @expose */
  5589. _axisTitle : null,
  5590. /**
  5591. * The title style; defaults null (use the CSS styling)
  5592. */
  5593. /** @expose */
  5594. _titleStyle : null,
  5595. /**
  5596. * Axis line color; default null (use the CSS styling)
  5597. */
  5598. /** @expose */
  5599. _lineColor : null,
  5600. /**
  5601. * Axis tick color; default null (use the CSS styling)
  5602. */
  5603. /** @expose */
  5604. _tickColor : null,
  5605. /**
  5606. * Axis tick label style; defaults null (use the CSS styling)
  5607. */
  5608. /** @expose */
  5609. _labelStyle : null,
  5610. //_staggerRotate45Nodes : null,
  5611. //_staggerFirstNode : null,
  5612. //_staggerLastNode : null,
  5613. /**
  5614. * Axis tick label formatting
  5615. */
  5616. //_tickFormat : null,
  5617. //_dropOverlap : null,
  5618. /**
  5619. * Used to get the extension to enable axis label wrapping
  5620. */
  5621. //_textFlow : null,
  5622. /**
  5623. * Used to check the fonts on each label to make sure all characters are covered
  5624. */
  5625. //_fontChecker : null,
  5626. /**
  5627. * Run function that applies the properties to the axis line
  5628. */
  5629. //_axisLineProperties : null,
  5630. /**
  5631. * Run function that applies the properties to the axis ticks
  5632. */
  5633. //_axisTickProperties : null,
  5634. /**
  5635. * Run function that applies the properties to the axis tick labels
  5636. */
  5637. //_axisTickLabelProperties : null,
  5638. /**
  5639. * Run function that hides or displays the axis tick labels
  5640. */
  5641. //_displayHideLabels : null,
  5642. /**
  5643. * Run function that hides or displays the axis tick labels
  5644. */
  5645. //_panZoomLabels : null,
  5646. /**
  5647. * The tick handler registered with the axis; will get called during axis transition
  5648. */
  5649. //_tickHandler : null,
  5650. //_textTruncationIndicator : null,
  5651. /**
  5652. * Used when dealing with numeric scale on the vertical axis and the numbers don't fit
  5653. */
  5654. //_simplifiedTickFormat : null,
  5655. //_tickMagnitude : null,
  5656. /**
  5657. * Whether to display the axis title; default true
  5658. */
  5659. /** @expose */
  5660. _displayAxisTitle : false,
  5661. /**
  5662. * Whether to display the axis line; default true
  5663. */
  5664. /** @expose */
  5665. _displayAxisLine : false,
  5666. /**
  5667. * Whether to display the axis ticks; default true
  5668. */
  5669. /** @expose */
  5670. _displayTicks : false,
  5671. /**
  5672. * Whether to display the axis tick labels (conditional on show labels property); default true
  5673. */
  5674. /** @expose */
  5675. _displayTickLabels : false,
  5676. /**
  5677. * Whether to display the axis tick labels (conditional on pan-zoom hide property); default true
  5678. */
  5679. /** @expose */
  5680. _showPanZoomTickLabels : false,
  5681. /**
  5682. * Whether to rotate the axis tick labels; default false
  5683. */
  5684. _rotateLabels : false,
  5685. _staggerCellWidth : 0,
  5686. _staggerAlignFirstAtStart : false,
  5687. _staggerAlignLastAtEnd : false,
  5688. _layoutTimerId : 0,
  5689. _layoutTitleSize : 0,
  5690. _layoutLabelSize : 0,
  5691. _layoutLabelHeight : 0,
  5692. _layoutAverageDigitWidth : 0,
  5693. _layoutSpillOver : 0,
  5694. /**
  5695. * Whether to hide overlapping labels; default true
  5696. */
  5697. /** @expose */
  5698. _hideOverlappingLabels : false,
  5699. /**
  5700. * When true, don't start a new timer
  5701. */
  5702. _pendingLabelTimer : false,
  5703. /**
  5704. * The padding in px between tick axis line and tick label, and also between tick label and title. Default 16px.
  5705. */
  5706. _padding : 0,
  5707. /**
  5708. * After calling the component, this is true if shapes were rendered, false if they were cleared.
  5709. */
  5710. _renderedShapes : false,
  5711. _layoutMode : -1,
  5712. _allowAutoAxisLayoutToChangeOrientaiton : true,
  5713. _lastAutomaticAxisLayoutOrientation : -1,
  5714. _allowStagger : false,
  5715. _allowRotate45 : false,
  5716. _allowRotate90 : false,
  5717. constructor : function() {
  5718. {
  5719. var self = this;
  5720. this._axisLineProperties = function(args) {
  5721. if (args !== null || arguments.length > 1){
  5722. args = Array.prototype.slice.call(arguments, 0);
  5723. }
  5724. {
  5725. var line = this.selectAll("path.domain");
  5726. if (self._lineColor != null) {
  5727. line.style("stroke", self._lineColor);
  5728. }
  5729. if (self._displayAxisLine) {
  5730. line.attr("visibility", null);
  5731. } else {
  5732. line.attr("visibility", "hidden");
  5733. }
  5734. return null;
  5735. }
  5736. };
  5737. this._axisTickProperties = function(args) {
  5738. if (args !== null || arguments.length > 1){
  5739. args = Array.prototype.slice.call(arguments, 0);
  5740. }
  5741. {
  5742. var tickLines = this.selectAll("line");
  5743. if (self._displayTicks) {
  5744. tickLines.attr("visibility", null);
  5745. } else {
  5746. tickLines.attr("visibility", "hidden");
  5747. }
  5748. if (self._lineColor != null) {
  5749. tickLines.style("stroke", self._tickColor);
  5750. }
  5751. return null;
  5752. }
  5753. };
  5754. this._axisTickLabelProperties = function(args) {
  5755. if (args !== null || arguments.length > 1){
  5756. args = Array.prototype.slice.call(arguments, 0);
  5757. }
  5758. {
  5759. var labels = this.selectAll("text");
  5760. labels.each(self._displayHideLabels);
  5761. labels.each(self._panZoomLabels);
  5762. labels.style(self._labelStyle);
  5763. self._axis.ticksHandler(null);
  5764. return null;
  5765. }
  5766. };
  5767. this._displayHideLabels = function(obj, group, index) {
  5768. if (self._displayTickLabels) {
  5769. if (this.rave_hasProperty("__tickLabelHidden__")) {
  5770. this.rave_removeProperty("__tickLabelHidden__");
  5771. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5772. if (count <= 1) {
  5773. this.rave_removeProperty("__hiddenCount__");
  5774. this.removeAttribute("visibility");
  5775. } else {
  5776. this.rave_setProperty("__hiddenCount__", count - 1);
  5777. }
  5778. }
  5779. } else {
  5780. if (!(this.rave_hasProperty("__tickLabelHidden__"))) {
  5781. this.setAttribute("visibility", "hidden");
  5782. this.rave_setProperty("__tickLabelHidden__", "hidden");
  5783. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5784. this.rave_setProperty("__hiddenCount__", count + 1);
  5785. }
  5786. }
  5787. };
  5788. this._panZoomLabels = function(obj, group, index) {
  5789. if (self._showPanZoomTickLabels) {
  5790. if (this.rave_hasProperty("__panZoomHidden__")) {
  5791. this.rave_removeProperty("__panZoomHidden__");
  5792. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5793. if (count <= 1) {
  5794. this.rave_removeProperty("__hiddenCount__");
  5795. this.removeAttribute("visibility");
  5796. } else {
  5797. this.rave_setProperty("__hiddenCount__", count - 1);
  5798. }
  5799. }
  5800. } else {
  5801. if (!(this.rave_hasProperty("__panZoomHidden__"))) {
  5802. this.setAttribute("visibility", "hidden");
  5803. this.rave_setProperty("__panZoomHidden__", "hidden");
  5804. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5805. this.rave_setProperty("__hiddenCount__", count + 1);
  5806. }
  5807. }
  5808. };
  5809. }
  5810. this._tickHandler = new com_ibm_rave_bundles_components_AxisComponentImpl.AxisTickHandler(this._axisTickLabelProperties, this._axisTickProperties);
  5811. /**
  5812. * Initialize properties to defaults
  5813. */
  5814. {
  5815. this._axis = null;
  5816. this._role = null;
  5817. this._scale = null;
  5818. this._orient = "bottom";
  5819. this._bounds = null;
  5820. this._displayAxisTitle = true;
  5821. this._axisTitle = null;
  5822. this._titleStyle = {};
  5823. this._displayAxisLine = true;
  5824. this._lineColor = null;
  5825. this._displayTicks = true;
  5826. this._tickColor = null;
  5827. this._displayTickLabels = true;
  5828. this._labelStyle = {};
  5829. this._rotateLabels = false;
  5830. this._hideOverlappingLabels = true;
  5831. this._dropOverlap = new com_ibm_rave_bundles_utilities_BundleLabelDropper();
  5832. this._tickFormat = null;
  5833. this._showPanZoomTickLabels = true;
  5834. this._pendingLabelTimer = false;
  5835. this._padding = 16;
  5836. this._textFlow = rave.capabilities.extension("textflow");
  5837. this._fontChecker = rave.capabilities.extension("fontchecker");
  5838. this._renderedShapes = false;
  5839. }
  5840. },
  5841. /** @expose */
  5842. type : function() {
  5843. return com_ibm_rave_bundles_component_AxisComponent.COMPONENT_TYPE;
  5844. },
  5845. /** @expose */
  5846. role : function() {
  5847. return this._role;
  5848. },
  5849. /** @expose */
  5850. execute : function(g) {
  5851. this.preExecute();
  5852. if (!this._scale) {
  5853. g.selectAll("*").remove();
  5854. this._renderedShapes = false;
  5855. return;
  5856. }
  5857. this._renderedShapes = true;
  5858. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  5859. this._hideOverlappingLabels = false;
  5860. this._rotateLabels = true;
  5861. } else {
  5862. this._hideOverlappingLabels = true;
  5863. this._rotateLabels = true;
  5864. }
  5865. this.drawTitle(g);
  5866. this.drawAxis(g);
  5867. this.handleAxisText(g);
  5868. this.drawTitle(g);
  5869. },
  5870. /**
  5871. * This is one place where all the calls that affect the axis text happen in case of allowAutomaticAxisLayout the new behavior applies here
  5872. * @param (rave['internal']['Selector']) g
  5873. */
  5874. handleAxisText : function(g) {
  5875. this.stopLabelDroppingUpdate();
  5876. var duration = 0, delay = 0;
  5877. var g2 = rave.transition(g);
  5878. if (g2.isTransition()) {
  5879. var t2 = (g2);
  5880. duration = t2.duration();
  5881. delay = t2.delay();
  5882. }
  5883. var axisSelector = g.selectAll("g.axis");
  5884. var labels = axisSelector.selectAll("g.tick").filter(rave['library']['internal']['BundleUtils'].notExit).selectAll("text");
  5885. var fontChecker = rave.capabilities.extension("fontchecker");
  5886. labels.style(this._labelStyle);
  5887. if (fontChecker) {
  5888. labels.call(fontChecker);
  5889. }
  5890. var mode = this._allowAutoAxisLayoutToChangeOrientaiton ? this.determineWhichAutoMode(g) : this._lastAutomaticAxisLayoutOrientation;
  5891. this.configureStaggerData(g, mode);
  5892. this.handleLabelsRotationAndPosition(g, labels, mode);
  5893. this.hashingNumericScales(labels, this.labelExtent(g), mode);
  5894. if (duration == 0) {
  5895. this.doLabelWrapping(g, mode);
  5896. this.handleLabelsRotationAndPosition(g, labels, mode);
  5897. }
  5898. this._lastAutomaticAxisLayoutOrientation = mode;
  5899. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  5900. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  5901. var tick = axisSelector.append("g").classed("tick", true);
  5902. var tickText = tick.append("text");
  5903. if (labels.size() == 0) {
  5904. var singleValue = this._scale.scale().domain()[0];
  5905. var formatter = this._tickFormat;
  5906. if (!formatter) {
  5907. var tickFunc = this._scale.scale().tickFormat;
  5908. if (tickFunc) {
  5909. formatter = tickFunc.apply(tickFunc, [singleValue]);
  5910. }
  5911. }
  5912. var node = tickText[0][0];
  5913. var stringValue = formatter ? formatter.call(node, singleValue, 0, 0) : ""+(singleValue);
  5914. tickText.text(stringValue);
  5915. var dim = node.getBBox();
  5916. this._layoutLabelSize = isHorizontal ? dim.height : dim.width;
  5917. if (!isHorizontal || mode != 0) {
  5918. tickText.text(".0");
  5919. this._layoutLabelSize += node.getBBox().width;
  5920. }
  5921. }
  5922. if (!isHorizontal || mode != 0) {
  5923. tickText.text(".0");
  5924. var node = tickText[0][0];
  5925. var dim = node.getBBox();
  5926. this._layoutAverageDigitWidth = dim.width;
  5927. }
  5928. tick.remove();
  5929. }
  5930. if (this._hideOverlappingLabels && duration > 0) {
  5931. this.updateLabelDropping(labels, duration, delay);
  5932. }
  5933. if (duration > 0) {
  5934. this.doLabelWrappingAfterAnimation(g, labels, mode, duration, delay);
  5935. }
  5936. if (!this._displayTickLabels) {
  5937. this._layoutLabelSize = 0;
  5938. this._layoutAverageDigitWidth = 0;
  5939. }
  5940. },
  5941. /**
  5942. * 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
  5943. * @param (rave['internal']['Selector']) g selector
  5944. * @param (rave['internal']['Selector']) labels labels selector
  5945. * @param (int) mode one of HORIZONTAL, STAGGER, ROTATE90
  5946. */
  5947. handleLabelsRotationAndPosition : function(g, labels, mode) {
  5948. if (mode == 2 || mode == 1) {
  5949. if (this._orient == "bottom") {
  5950. this.rotateLabels(g, labels, "end", mode);
  5951. } else if (this._orient == "top") {
  5952. this.rotateLabels(g, labels, "start", mode);
  5953. } else {
  5954. this.rotateLabels(g, labels, "middle", mode);
  5955. }
  5956. } else {
  5957. if (this._orient == "bottom" || this._orient == "top") {
  5958. this.rotateLabels(g, labels, "middle", mode);
  5959. } else if (this._orient == "right") {
  5960. this.rotateLabels(g, labels, "start", mode);
  5961. } else {
  5962. this.rotateLabels(g, labels, "end", mode);
  5963. }
  5964. }
  5965. },
  5966. /**
  5967. * <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>
  5968. * @param (rave['internal']['Selector']) labels
  5969. */
  5970. hashingNumericScales : function(labels, extent, mode) {
  5971. if (!labels || !extent) {
  5972. return;
  5973. }
  5974. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  5975. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  5976. var tickSpace = mode == 1 ? extent[1] : extent[0];
  5977. this._textTruncationIndicator = "";
  5978. this._layoutLabelSize = 0;
  5979. for (var i = 0; i < labels.size(); ++i) {
  5980. var node = labels[i][0];
  5981. var dim = node.getBBox();
  5982. var width = dim.width;
  5983. var height = dim.height;
  5984. var size = !isHorizontal || mode == 1 ? width : height;
  5985. if (size > this._layoutLabelSize) {
  5986. this._layoutLabelSize = size;
  5987. }
  5988. if (width >= tickSpace) {
  5989. if (this._simplifiedTickFormat) {
  5990. var newText = this._simplifiedTickFormat.call(null, node.rave_getData(), 0, 0);
  5991. if (newText != null) {
  5992. node.rave_setText(newText);
  5993. }
  5994. if (node.getBBox().width >= tickSpace) {
  5995. node.rave_setText(this.stringOfSize(node.rave_getText().length, "#"));
  5996. }
  5997. } else {
  5998. node.rave_setText(this.stringOfSize(node.rave_getText().length, "#"));
  5999. }
  6000. }
  6001. }
  6002. }
  6003. },
  6004. /**
  6005. * @param (int) size The desired size of the string
  6006. * @param (String) ch The character to be repeated in the string
  6007. * @return (String) A string of the specified size containing repetition of the specified character
  6008. */
  6009. stringOfSize : function(size, ch) {
  6010. var returnString = "";
  6011. for (var i = 0; i < size; ++i) {
  6012. returnString += ch;
  6013. }
  6014. return returnString;
  6015. },
  6016. configureStaggerData : function(g, mode) {
  6017. if (mode == 3 || mode == 2) {
  6018. var horizontalDimensions = this.labelExtent(g);
  6019. var cellWidth = horizontalDimensions[0];
  6020. var axisSelector = g.selectAll("g.axis");
  6021. var labels = axisSelector.selectAll("text");
  6022. var domain = this._scale.scale().domain();
  6023. var originalDataLabelAccessor = (this._scale).originalDomainLabelAccessor();
  6024. this._staggerRotate45Nodes = [];
  6025. this._staggerFirstNode = null;
  6026. this._staggerLastNode = null;
  6027. for (var i = 0; i < labels.size(); ++i) {
  6028. var node = labels[0][i];
  6029. if (this.isValid(node.rave_getData())) {
  6030. var domainIndex = -1;
  6031. if (mode == 3) {
  6032. var domainLabel = !this._tickFormat ? node.rave_getText() : originalDataLabelAccessor.call(node, node.rave_getData(), 0, 0);
  6033. for (var index = 0; index < domain.length; ++index) {
  6034. if (domain[index].toString() == domainLabel) {
  6035. domainIndex = index;
  6036. break;
  6037. }
  6038. }
  6039. }
  6040. this._staggerRotate45Nodes.push(new com_ibm_rave_bundles_components_AxisComponentImpl.NodeIndex(node, domainIndex));
  6041. if (domainIndex == 0) {
  6042. this._staggerFirstNode = node;
  6043. }
  6044. if (domainIndex == domain.length - 1) {
  6045. this._staggerLastNode = node;
  6046. }
  6047. }
  6048. }
  6049. this._staggerCellWidth = cellWidth * 2;
  6050. this._staggerAlignFirstAtStart = this._staggerFirstNode ? this._staggerFirstNode.getBBox().width > cellWidth : false;
  6051. this._staggerAlignLastAtEnd = this._staggerLastNode ? this._staggerLastNode.getBBox().width > cellWidth : false;
  6052. }
  6053. },
  6054. getStaggerIndex : function(node) {
  6055. for (var index = 0; index < this._staggerRotate45Nodes.length; ++index) {
  6056. if (this._staggerRotate45Nodes[index].contains(node)) {
  6057. var domainIndex = this._staggerRotate45Nodes[index].getIndex();
  6058. return domainIndex == -1 ? 0 : domainIndex;
  6059. }
  6060. }
  6061. return -1;
  6062. },
  6063. getStaggerCount : function() {
  6064. var domain = this._scale.scale().domain();
  6065. return domain.length;
  6066. },
  6067. /**
  6068. * <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>
  6069. * @param (rave['internal']['Selector']) g
  6070. */
  6071. determineWhichAutoMode : function(g) {
  6072. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6073. var axisSelector = g.selectAll("g.axis");
  6074. var labels = axisSelector.selectAll("text");
  6075. var dim = this.labelExtent(g);
  6076. var cellWidth = dim[0];
  6077. var cellWidth90 = dim[1];
  6078. var layoutLabelHeight = 0;
  6079. var layoutLabelWidth = 0;
  6080. var horizontalScore = 0;
  6081. var staggerScore = 0;
  6082. var rotate45Score = 0;
  6083. var rotate90Score = 0;
  6084. var validNodes = [];
  6085. for (var i = 0; i < labels.size(); ++i) {
  6086. var node = labels[0][i];
  6087. if (this.isValid(node.rave_getData())) {
  6088. validNodes.push(node);
  6089. }
  6090. }
  6091. var labelCount = validNodes.length;
  6092. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  6093. var mode = 0;
  6094. if (isHorizontal) {
  6095. mode = this._layoutMode == 1 ? 1 : 0;
  6096. var tick = axisSelector.append("g").classed("tick", true);
  6097. var tickText = tick.append("text");
  6098. tickText.style(this._labelStyle);
  6099. tickText.text(",0");
  6100. var node = tickText[0][0];
  6101. var zeroWidth = node.getBBox().width;
  6102. tick.remove();
  6103. var widestLabel = 0;
  6104. for (var i = 0; i < labelCount; ++i) {
  6105. node = validNodes[i];
  6106. var nodeRect = node.getBBox();
  6107. if (nodeRect.width > widestLabel) {
  6108. widestLabel = nodeRect.width;
  6109. }
  6110. if (nodeRect.height > this._layoutLabelHeight) {
  6111. this._layoutLabelHeight = nodeRect.height;
  6112. }
  6113. }
  6114. widestLabel += zeroWidth;
  6115. this._layoutSpillOver = mode == 1 ? this._layoutLabelHeight / 2 : widestLabel / 2 + 2;
  6116. } else {
  6117. for (var i = 0; i < labelCount; ++i) {
  6118. var node = validNodes[i];
  6119. var nodeRect = node.getBBox();
  6120. if (nodeRect.height > this._layoutLabelHeight) {
  6121. this._layoutLabelHeight = nodeRect.height;
  6122. }
  6123. }
  6124. this._layoutSpillOver = this._layoutLabelHeight / 2;
  6125. }
  6126. return mode;
  6127. }
  6128. var originalDataLabelAccessor = (this._scale).originalDomainLabelAccessor();
  6129. var staggerStringsWontMatch = this._tickFormat && !originalDataLabelAccessor;
  6130. var calcStagger = ((this._allowStagger && this._layoutMode == -1) || this._layoutMode == 3) && !staggerStringsWontMatch;
  6131. var calcRotate45 = (this._allowRotate45 && this._layoutMode == -1) || this._layoutMode == 2;
  6132. var calcRotate90 = (this._allowRotate90 && this._layoutMode == -1) || this._layoutMode == 1;
  6133. var spaceFor45Label = 0;
  6134. for (var i = 0; i < labelCount; ++i) {
  6135. var node = validNodes[i];
  6136. var nodeRect = node.getBBox();
  6137. layoutLabelHeight = nodeRect.height;
  6138. var labelWidth = nodeRect.width;
  6139. if (labelWidth > layoutLabelWidth) {
  6140. layoutLabelWidth = labelWidth;
  6141. }
  6142. horizontalScore += (labelWidth <= cellWidth ? 1 : cellWidth / labelWidth);
  6143. if (isHorizontal) {
  6144. if (calcStagger) {
  6145. var spaceForLabel = cellWidth * 2;
  6146. if (i == 0 && i == labelCount - 1) {
  6147. spaceForLabel *= 0.5;
  6148. } else if (i == 0 || i == labelCount - 1) {
  6149. spaceForLabel *= 0.75;
  6150. }
  6151. staggerScore += (labelWidth <= spaceForLabel ? 1 : spaceForLabel / labelWidth);
  6152. }
  6153. if (calcRotate45) {
  6154. if (spaceFor45Label == 0) {
  6155. spaceFor45Label = cellWidth90 / 0.7071 - layoutLabelHeight;
  6156. }
  6157. var space = this.calculate45DegreeSpace(node, spaceFor45Label);
  6158. rotate45Score += (labelWidth <= space ? 1 : space / labelWidth);
  6159. }
  6160. if (calcRotate90) {
  6161. rotate90Score += (labelWidth <= cellWidth90 ? 1 : cellWidth90 / labelWidth);
  6162. }
  6163. }
  6164. }
  6165. var mode = 0;
  6166. if (this._layoutMode == -1) {
  6167. if (isHorizontal && this._allowStagger) {
  6168. horizontalScore *= 1.1;
  6169. staggerScore *= 1.1;
  6170. }
  6171. if ((staggerScore > horizontalScore) && (staggerScore >= rotate45Score) && (staggerScore >= rotate90Score)) {
  6172. mode = 3;
  6173. } else if ((rotate45Score > horizontalScore) && (rotate45Score >= rotate90Score)) {
  6174. mode = 2;
  6175. } else if (rotate90Score > horizontalScore) {
  6176. mode = 1;
  6177. }
  6178. } else {
  6179. if ((this._layoutMode == 3 && staggerStringsWontMatch) || !isHorizontal) {
  6180. mode = 0;
  6181. } else {
  6182. mode = this._layoutMode;
  6183. }
  6184. }
  6185. if (isHorizontal) {
  6186. switch (mode) {
  6187. case 3:
  6188. this._layoutLabelSize = layoutLabelHeight * 2;
  6189. break;
  6190. case 2:
  6191. this._layoutLabelSize = (layoutLabelWidth + layoutLabelHeight) * 0.7071;
  6192. break;
  6193. case 1:
  6194. this._layoutLabelSize = layoutLabelWidth;
  6195. break;
  6196. case 0:
  6197. default:
  6198. this._layoutLabelSize = layoutLabelHeight;
  6199. break;
  6200. }
  6201. } else {
  6202. this._layoutLabelSize = layoutLabelWidth;
  6203. }
  6204. this._layoutLabelHeight = layoutLabelHeight;
  6205. return mode;
  6206. },
  6207. calculate45DegreeSpace : function(node, maxWidth) {
  6208. var width = maxWidth;
  6209. var tfm = node.rave_getParentNode().getAttribute("transform");
  6210. if (tfm != null) {
  6211. var tfmString = tfm.toString();
  6212. var indexOfTrans = tfmString.indexOf("translate(");
  6213. if (indexOfTrans != -1) {
  6214. indexOfTrans += 10;
  6215. var indexOfComma = tfmString.indexOf(",", indexOfTrans);
  6216. if (indexOfComma != -1) {
  6217. var xAmount = tfmString.substring(indexOfTrans, indexOfComma);
  6218. var xLabelPos = + (xAmount);
  6219. var width45Degrees = node.getBBox().width;
  6220. var xLabelWidth = width45Degrees * 0.7071;
  6221. var isBottom = this._orient == "bottom";
  6222. if (isBottom) {
  6223. xLabelPos -= node.getBBox().height / 4;
  6224. if (xLabelPos - xLabelWidth < this._bounds.x) {
  6225. xLabelWidth = xLabelPos - this._bounds.x;
  6226. width = xLabelWidth / 0.7071;
  6227. }
  6228. } else {
  6229. if (xLabelPos + xLabelWidth > this._bounds.x + this._bounds.width) {
  6230. xLabelWidth = (this._bounds.x + this._bounds.width) - xLabelPos;
  6231. width = xLabelWidth / 0.7071;
  6232. }
  6233. }
  6234. if (width > maxWidth) {
  6235. width = maxWidth;
  6236. }
  6237. }
  6238. }
  6239. }
  6240. return width;
  6241. },
  6242. /**
  6243. * @param (rave['internal']['Selector']) labels selector with all labels to be rotated
  6244. * @param (rave['internal']['Selector']) g The parent selector of labels
  6245. * @param (String) textAnchor The position of the anchor
  6246. * @param alignmentMode One of HORIZONTAL, STAGGER, ROTATE45, ROTATE90
  6247. */
  6248. rotateLabels : function(g, labels, textAnchor, mode) {
  6249. if (this._rotateLabels) {
  6250. var self = this;
  6251. var positioning = function(data, index, groupIndex) {
  6252. var x = 0;
  6253. var y = 0;
  6254. var rotation_cy = 0;
  6255. var isBottom = self._orient == "bottom";
  6256. if (mode == 3) {
  6257. var cellIndex = self.getStaggerIndex(this);
  6258. if (cellIndex != -1) {
  6259. if (cellIndex % 2 == 1) {
  6260. var staggerDirection = isBottom ? 1 : -1;
  6261. y += (self._layoutLabelHeight * staggerDirection);
  6262. }
  6263. if (cellIndex == 0 && self._staggerAlignFirstAtStart) {
  6264. x -= self._staggerCellWidth / 4;
  6265. } else if (cellIndex == self.getStaggerCount() - 1 && self._staggerAlignLastAtEnd) {
  6266. x += self._staggerCellWidth / 4;
  6267. }
  6268. }
  6269. } else if (mode == 2) {
  6270. if (isBottom) {
  6271. x -= self._layoutLabelHeight;
  6272. } else {
  6273. x += self._layoutLabelHeight / 2;
  6274. }
  6275. } else if (mode == 1) {
  6276. if (isBottom) {
  6277. x -= (this.getBBox().height / 2 + self._layoutLabelHeight / 4);
  6278. rotation_cy = ~~(self._padding / 4 + self._axis.tickSize());
  6279. } else {
  6280. x -= (this.getBBox().height / 2 - self._layoutLabelHeight);
  6281. rotation_cy = ~~-(self._padding / 4 + self._axis.tickSize());
  6282. }
  6283. }
  6284. var rotationDegrees = mode == 1 ? -90 : mode == 2 ? -45 : 0;
  6285. return "translate(" + x + "," + y + ") rotate(" + rotationDegrees + ",0," + rotation_cy + ")";
  6286. };
  6287. labels.attr("transform", positioning).style("text-anchor", textAnchor);
  6288. if (mode == 3) {
  6289. if (this._staggerAlignFirstAtStart) {
  6290. this._staggerFirstNode.rave_setStyle("text-anchor", "start");
  6291. }
  6292. if (this._staggerAlignLastAtEnd) {
  6293. this._staggerLastNode.rave_setStyle("text-anchor", "end");
  6294. }
  6295. }
  6296. }
  6297. },
  6298. /** @expose */
  6299. axis : function() {
  6300. return this._axis;
  6301. },
  6302. /**
  6303. * Draw the axis. The scale is non-null.
  6304. * @param (rave['internal']['Selector']) g Selector group into which the axis is drawn.
  6305. */
  6306. drawAxis : function(g) {
  6307. var axisSelector = g.selectAll("g.axis").data([0]);
  6308. axisSelector.enter().append("g").classed("axis", true).classed(this._orient, true);
  6309. if (!this._axis) {
  6310. this._axis = new rave['internal']['Axis']();
  6311. }
  6312. if (this._hideOverlappingLabels) {
  6313. this._textFlow.valignment("top").dropTextOnFail(false);
  6314. }
  6315. this._axis.ticksHandler(this._tickHandler);
  6316. this._axis.orient(this._orient);
  6317. this._axis.tickFormat(this._tickFormat);
  6318. this._axis.tickPadding(10.0);
  6319. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  6320. var labelHeight = 20.0;
  6321. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6322. if (isHorizontal) {
  6323. labelHeight /= 0.7071;
  6324. }
  6325. var range = this._scale.scale().rangeExtent();
  6326. var extent = + (range[1]) - + (range[0]);
  6327. this._axis.ticks(extent / labelHeight);
  6328. } else {
  6329. if (this._tickMagnitude == null) {
  6330. this._axis.ticks(10.0);
  6331. } else {
  6332. this._axis.ticks.apply(this._axis, [10.0, this._scale.scale().getTickFormat(), this._tickMagnitude]);
  6333. }
  6334. }
  6335. var s = this._scale.scale();
  6336. if (this._scale.originalDomain()) {
  6337. var sOrdinal = s.copy();
  6338. sOrdinal.domain(this._scale.originalDomain());
  6339. s = sOrdinal;
  6340. var self = this;
  6341. var originalDataLabelAccessor = (self._scale).originalDomainLabelAccessor();
  6342. var tickFormatter;
  6343. if (originalDataLabelAccessor) {
  6344. if (this._tickFormat) {
  6345. tickFormatter = function(data, index, groupIndex) {
  6346. return self._tickFormat.call(this, originalDataLabelAccessor.call(this, data, index, groupIndex), index, groupIndex);
  6347. };
  6348. } else {
  6349. tickFormatter = originalDataLabelAccessor;
  6350. }
  6351. } else {
  6352. tickFormatter = this._tickFormat;
  6353. }
  6354. this._axis.tickFormat(tickFormatter);
  6355. }
  6356. this._axis.scale(s);
  6357. axisSelector.call(this._axis);
  6358. var g2 = rave.transition(axisSelector);
  6359. if (!(g2.isTransition())) {
  6360. axisSelector.selectAll("text").call(this._dropOverlap, this._hideOverlappingLabels);
  6361. }
  6362. axisSelector.selectAll("path.domain").classed("axis-line", true);
  6363. axisSelector.selectAll("g.tick line").classed("axis-tick", true);
  6364. if (this._fontChecker) {
  6365. axisSelector.selectAll("g.tick text").classed("axis-label", true).call(this._fontChecker);
  6366. } else {
  6367. axisSelector.selectAll("g.tick text").classed("axis-label", true);
  6368. }
  6369. axisSelector.call(this._axisLineProperties);
  6370. },
  6371. /**
  6372. * Draw the axis title.
  6373. * @param (rave['internal']['Selector']) g Selector group into which the title is drawn.
  6374. */
  6375. drawTitle : function(g) {
  6376. if (!this._displayAxisTitle || this._axisTitle == null || this._axisTitle.trim().length == 0 || !this._bounds) {
  6377. g.selectAll("text.axis-title." + this._orient).remove();
  6378. return;
  6379. }
  6380. var x = 0;
  6381. var y = 0;
  6382. var dy = "";
  6383. var transform;
  6384. if ("top" == this._orient) {
  6385. x = this._elementRect.x + this._elementRect.width / 2;
  6386. y = -this._bounds.height + this._padding / 4;
  6387. dy = "0.75em";
  6388. } else if ("bottom" == this._orient) {
  6389. x = this._elementRect.x + this._elementRect.width / 2;
  6390. y = this._bounds.height - this._padding / 4;
  6391. dy = "-0.25em";
  6392. } else if ("left" == this._orient) {
  6393. x = -this._elementRect.y - this._elementRect.height / 2;
  6394. y = -this._bounds.width + this._padding / 4;
  6395. dy = "0.75em";
  6396. transform = "rotate(-90)";
  6397. } else {
  6398. x = this._elementRect.y + this._elementRect.height / 2;
  6399. y = -this._bounds.width + this._padding / 4;
  6400. dy = "0.75em";
  6401. transform = "rotate(90)";
  6402. }
  6403. var fillOpacity;
  6404. {
  6405. var tmp = g.append("text").attr("class", "axis-title " + this._orient);
  6406. fillOpacity = tmp.style("fill-opacity");
  6407. tmp.remove();
  6408. } var label = g.selectAll("text.axis-title." + this._orient);
  6409. if (label.size() == 0) {
  6410. 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);
  6411. if (this._fontChecker) {
  6412. g.selectAll("text.axis-title." + this._orient).call(this._fontChecker);
  6413. }
  6414. }
  6415. 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);
  6416. },
  6417. getUnZoomedScale : function(scale) {
  6418. var s = scale.copy();
  6419. if (s.getZoomTransform()) {
  6420. s.getZoomTransform()(1, 0);
  6421. }
  6422. return s;
  6423. },
  6424. isValid : function(data) {
  6425. var s = this.getUnZoomedScale(this._axis.scale());
  6426. var v = + (s.call(null, data, 0, 0));
  6427. var range = this._axis.scale().range();
  6428. if (this._axis.scale().range().indexOf(v)> -1) {
  6429. return true;
  6430. }
  6431. if (range[0] < v && v < range[1]) {
  6432. return true;
  6433. }
  6434. if (range[0] > v && v > range[1]) {
  6435. return true;
  6436. }
  6437. return false;
  6438. },
  6439. /**
  6440. * Apply label wrapping if requested.
  6441. * @param (rave['internal']['Selector']) g
  6442. * @param (int) mode One of HORIZONTAL, STAGGER, ROTATE45, ROTATE90
  6443. */
  6444. doLabelWrapping : function(g, mode) {
  6445. if (this._displayTickLabels) {
  6446. this._textFlow.valignment("top");
  6447. if (!this._hideOverlappingLabels) {
  6448. this._textFlow.dropTextOnFail(true);
  6449. }
  6450. var d = this.labelExtent(g);
  6451. if (!d || d[0] < 0 || d[1] < 0) {
  6452. return;
  6453. }
  6454. var w = ~~ (d[0]);
  6455. var h = ~~ (d[1]);
  6456. if (mode == 2) {
  6457. w = ~~(d[1] / 0.7071 - this._layoutLabelHeight);
  6458. h = ~~(this._layoutLabelHeight / 0.7071);
  6459. } else if (mode == 1) {
  6460. var tmp = w;
  6461. w = h;
  6462. h = tmp;
  6463. }
  6464. var allowWrap = mode == 1;
  6465. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  6466. var hActual = ~~ (this._layoutLabelHeight * 1.2);
  6467. if (hActual > h) {
  6468. h = hActual;
  6469. }
  6470. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6471. if (mode == 0 && !isHorizontal) {
  6472. allowWrap = true;
  6473. }
  6474. }
  6475. var self = this;
  6476. var cellWidth = w;
  6477. var cellHeight = h;
  6478. this._textFlow.wrap(allowWrap).truncate(true).textTruncateIndicator(this._textTruncationIndicator != null ? this._textTruncationIndicator : "...").spacing(1.2).extent(function(data, index, groupIndex) {
  6479. var width = cellWidth;
  6480. var height = cellHeight;
  6481. if (mode == 2) {
  6482. var cellIndex = self.getStaggerIndex(this);
  6483. if (cellIndex != -1) {
  6484. width = ~~self.calculate45DegreeSpace(this, cellWidth);
  6485. }
  6486. } else if (mode == 3) {
  6487. var cellIndex = self.getStaggerIndex(this);
  6488. if (cellIndex != -1) {
  6489. if (cellIndex == 0 && cellIndex == self.getStaggerCount() - 1) {
  6490. width = cellWidth;
  6491. } else if (cellIndex == 0 || cellIndex == self.getStaggerCount() - 1) {
  6492. width = cellWidth * 3 / 2;
  6493. } else {
  6494. width = cellWidth * 2;
  6495. }
  6496. height = cellHeight / 2;
  6497. }
  6498. }
  6499. return [width, height];
  6500. });
  6501. g.selectAll("g.tick > text").call(this._textFlow);
  6502. }
  6503. },
  6504. /**
  6505. * <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>
  6506. * @param (rave['internal']['Selector']) g Selector group for axis
  6507. * @return (Array) The extent of the axis label bounds
  6508. */
  6509. /** @expose */
  6510. labelExtent : function(g) {
  6511. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6512. var w = this._bounds.width;
  6513. var h = this._bounds.height;
  6514. if (this._scale.scale().rangeBand) {
  6515. var rangeBandValue = + (this._scale.scale().rangeBand());
  6516. if (isHorizontal) {
  6517. w = rangeBandValue;
  6518. } else {
  6519. h = rangeBandValue;
  6520. }
  6521. }
  6522. this.calcTitleExtent(g);
  6523. if (isHorizontal) {
  6524. h -= this._axis.tickSize();
  6525. h -= this._padding / 2;
  6526. if (this._layoutTitleSize != 0) {
  6527. h -= this._layoutTitleSize;
  6528. h -= this._padding / 2;
  6529. }
  6530. } else {
  6531. w -= this._axis.tickSize();
  6532. w -= this._padding / 2;
  6533. if (this._layoutTitleSize != 0) {
  6534. w -= this._layoutTitleSize;
  6535. w -= this._padding / 2;
  6536. }
  6537. }
  6538. return [w, h];
  6539. },
  6540. calcTitleExtent : function(g) {
  6541. this._layoutTitleSize = 0;
  6542. var title = g.selectAll("text.axis-title");
  6543. if (title.size() > 0) {
  6544. var textHeight = title[0][0].getBBox().height;
  6545. this._layoutTitleSize = textHeight;
  6546. }
  6547. },
  6548. /**
  6549. * Set the role to one of the constants ROLE_X1 etc. defined in AxisComponent.
  6550. * @param (String) role The new role
  6551. * @return (com.ibm.rave.bundles.components.AxisComponentImpl) This object
  6552. */
  6553. /** @expose */
  6554. setRole : function(role) {
  6555. this._role = role;
  6556. return this;
  6557. },
  6558. /**
  6559. * Set the ticks interval on the scale based on the magnitude. tickMagnitude represents power of 10. null value gives the default scale ticks.
  6560. * @param (Number) tickMagnitude
  6561. * @return (com.ibm.rave.bundles.component.AxisComponent) this
  6562. */
  6563. /** @expose */
  6564. scaleTickMagnitude : function(tickMagnitude) {
  6565. this._tickMagnitude = tickMagnitude;
  6566. return this;
  6567. },
  6568. /**
  6569. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale The new scale
  6570. */
  6571. /** @expose */
  6572. scale : function(scale) {
  6573. this._scale = scale ? scale : null;
  6574. return this;
  6575. },
  6576. /**
  6577. * Only legal values are accepted, otherwise the orient is unchanged.
  6578. * @param (String) orient The new orient
  6579. */
  6580. orient$0 : function(orient) {
  6581. if ("left" == orient || "bottom" == orient || "right" == orient || "top" == orient) {
  6582. this._orient = orient;
  6583. if (this._role == null) {
  6584. if ("left" == orient) {
  6585. this._role = "ROLE_Y1";
  6586. } else if ("bottom" == orient) {
  6587. this._role = "ROLE_X1";
  6588. } else if ("right" == orient) {
  6589. this._role = "ROLE_Y2";
  6590. } else {
  6591. this._role = "ROLE_X2";
  6592. }
  6593. }
  6594. }
  6595. return this;
  6596. },
  6597. /**
  6598. * Returns the current orientation string return The current orient
  6599. */
  6600. orient$1 : function() {
  6601. return this._orient;
  6602. },
  6603. /**
  6604. * @param (rave['internal']['RectStruct']) bounds The new bounds
  6605. */
  6606. /** @expose */
  6607. bounds : function(bounds) {
  6608. this._bounds = bounds;
  6609. return this;
  6610. },
  6611. /** @expose */
  6612. elementRect : function(elementRect) {
  6613. this._elementRect = elementRect;
  6614. return this;
  6615. },
  6616. tickFormat$0 : function(tickFormat) {
  6617. this._tickFormat = tickFormat;
  6618. return this;
  6619. },
  6620. tickFormat$1 : function() {
  6621. return this._tickFormat;
  6622. },
  6623. simplifiedTickFormat$0 : function(tickFormat) {
  6624. this._simplifiedTickFormat = tickFormat;
  6625. return this;
  6626. },
  6627. simplifiedTickFormat$1 : function() {
  6628. return this._simplifiedTickFormat;
  6629. },
  6630. /** @expose */
  6631. displayAxisTitle : function(displayAxisTitle) {
  6632. this._displayAxisTitle = displayAxisTitle;
  6633. return this;
  6634. },
  6635. /** @expose */
  6636. displayAxisLine : function(displayAxisLine) {
  6637. this._displayAxisLine = displayAxisLine;
  6638. return this;
  6639. },
  6640. /** @expose */
  6641. displayTicks : function(displayTicks) {
  6642. this._displayTicks = displayTicks;
  6643. return this;
  6644. },
  6645. /** @expose */
  6646. displayTickLabels : function(displayTickLabels) {
  6647. this._displayTickLabels = displayTickLabels;
  6648. return this;
  6649. },
  6650. /** @expose */
  6651. allowAutomaticAxisLayoutToChangeOrientation : function(state) {
  6652. this._allowAutoAxisLayoutToChangeOrientaiton = state;
  6653. return this;
  6654. },
  6655. /** @expose */
  6656. isAllowAutomaticAxisLayoutToChangeOrientation : function() {
  6657. return this._allowAutoAxisLayoutToChangeOrientaiton;
  6658. },
  6659. /** @expose */
  6660. showPanZoomTickLabels : function(showPanZoomTickLabels) {
  6661. this._showPanZoomTickLabels = showPanZoomTickLabels;
  6662. return this;
  6663. },
  6664. /** @expose */
  6665. axisTitle : function(axisTitle) {
  6666. this._axisTitle = axisTitle;
  6667. return this;
  6668. },
  6669. /** @expose */
  6670. axisColor : function(axisColor) {
  6671. this._lineColor = axisColor;
  6672. this._tickColor = axisColor;
  6673. return this;
  6674. },
  6675. /** @expose */
  6676. lineColor : function(lineColor) {
  6677. this._lineColor = lineColor;
  6678. return this;
  6679. },
  6680. /** @expose */
  6681. tickColor : function(tickColor) {
  6682. this._tickColor = tickColor;
  6683. return this;
  6684. },
  6685. /** @expose */
  6686. labelColor : function(labelColor) {
  6687. this._labelStyle["fill"] = labelColor;
  6688. return this;
  6689. },
  6690. labelStyle$0 : function(fill, fontSize, fontFamily) {
  6691. this._labelStyle["fill"] = fill;
  6692. this._labelStyle["font-size"] = fontSize;
  6693. this._labelStyle["font-family"] = fontFamily;
  6694. return this;
  6695. },
  6696. /** @expose */
  6697. titleColor : function(titleColor) {
  6698. this._titleStyle["fill"] = titleColor;
  6699. return this;
  6700. },
  6701. titleStyle$0 : function(fill, fontSize, fontFamily) {
  6702. this._titleStyle["fill"] = fill;
  6703. this._titleStyle["font-size"] = fontSize;
  6704. this._titleStyle["font-family"] = fontFamily;
  6705. return this;
  6706. },
  6707. /**
  6708. * @param (int) padding The new padding
  6709. */
  6710. /** @expose */
  6711. padding : function(padding) {
  6712. this._padding = padding;
  6713. return this;
  6714. },
  6715. /**
  6716. * @param mode LayoutMode for axis, one of: null (numeric axis), automatic, horizontal, stagger, rotate45, rotate90
  6717. */
  6718. /** @expose */
  6719. layoutMode : function(layoutMode) {
  6720. this._layoutMode = -1;
  6721. if (layoutMode != null) {
  6722. if (layoutMode == "horizontal") {
  6723. this._layoutMode = 0;
  6724. } else if (layoutMode == "stagger") {
  6725. this._layoutMode = 3;
  6726. } else if (layoutMode == "rotate45") {
  6727. this._layoutMode = 2;
  6728. } else if (layoutMode == "rotate90") {
  6729. this._layoutMode = 1;
  6730. }
  6731. }
  6732. return this;
  6733. },
  6734. /**
  6735. * @param (boolean) allow Enable Stagger to be considered in the automatic layout algorithm
  6736. */
  6737. /** @expose */
  6738. allowStagger : function(allow) {
  6739. this._allowStagger = allow;
  6740. return this;
  6741. },
  6742. /**
  6743. * @param (boolean) allow Enable Rotate 45 to be considered in the automatic layout algorithm
  6744. */
  6745. /** @expose */
  6746. allowRotate45 : function(allow) {
  6747. this._allowRotate45 = allow;
  6748. return this;
  6749. },
  6750. /**
  6751. * @param (boolean) allow Enable Rotate 90 to be considered in the automatic layout algorithm
  6752. */
  6753. /** @expose */
  6754. allowRotate90 : function(allow) {
  6755. this._allowRotate90 = allow;
  6756. return this;
  6757. },
  6758. /**
  6759. * @return (boolean) True if on the last call the axis rendered shapes, false otherwise
  6760. */
  6761. renderedShapes : function() {
  6762. return this._renderedShapes;
  6763. },
  6764. labelStyle$1 : function(fontStyle) {
  6765. this._labelStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  6766. return this;
  6767. },
  6768. titleStyle$1 : function(fontStyle) {
  6769. this._titleStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  6770. return this;
  6771. },
  6772. /**
  6773. * Determines whether the axis is swapped.
  6774. * @return (boolean) True if axis is swapped
  6775. */
  6776. isAxisSwapped : function() {
  6777. 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")));
  6778. },
  6779. /**
  6780. * <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>
  6781. * @param (String) indicator the string to be placed to indicated truncated text
  6782. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  6783. */
  6784. /** @expose */
  6785. textTruncateIndicator : function(indicator) {
  6786. this._textTruncationIndicator = indicator;
  6787. return this;
  6788. },
  6789. /**
  6790. * If at least one label collision request is pending we stop the label collision component, and shut down the label collision timer event.
  6791. */
  6792. stopLabelDroppingUpdate : function() {
  6793. this._pendingLabelTimer = false;
  6794. },
  6795. /**
  6796. * 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.
  6797. * @param (rave['internal']['Selector']) labels the selection of valid labels for the end of the transition
  6798. * @param (double) duration of the transition. If 0, we don't do anything.
  6799. * @param (double) delay of the transition. Added to the duration to delay the updates.
  6800. */
  6801. updateLabelDropping : function(labels, duration, delay) {
  6802. var self = this;
  6803. var start = delay + duration;
  6804. var labelCollideCallback = function(elapsed) {
  6805. if (!self._pendingLabelTimer) {
  6806. return true;
  6807. }
  6808. labels.call(self._dropOverlap, self._hideOverlappingLabels);
  6809. if (elapsed >= start) {
  6810. self._pendingLabelTimer = false;
  6811. return true;
  6812. }
  6813. return false;
  6814. };
  6815. if (duration > 0) {
  6816. this._pendingLabelTimer = true;
  6817. rave.timer(labelCollideCallback, start);
  6818. }
  6819. },
  6820. doLabelWrappingAfterAnimation : function(g, labels, mode, duration, delay) {
  6821. this._layoutTimerId++;
  6822. var timerId = this._layoutTimerId;
  6823. var self = this;
  6824. var wrapCallback = function(elapsed) {
  6825. if (self._layoutTimerId == timerId) {
  6826. self.doLabelWrapping(g, mode);
  6827. self.handleLabelsRotationAndPosition(g, labels, mode);
  6828. }
  6829. return true;
  6830. };
  6831. rave.timer(wrapCallback, delay + duration);
  6832. },
  6833. /** @expose */
  6834. preLayout : function() {
  6835. this._layoutTitleSize = 0;
  6836. this._layoutLabelSize = 0;
  6837. this._layoutLabelHeight = 0;
  6838. this._layoutAverageDigitWidth = 0;
  6839. this._layoutSpillOver = 0;
  6840. },
  6841. /** @expose */
  6842. getSizableType : function() {
  6843. return this._scale.isOrdinal() || this._scale.isClustered() ? 1 : 0;
  6844. },
  6845. /** @expose */
  6846. getSizableOrientation : function() {
  6847. return this._orient;
  6848. },
  6849. /** @expose */
  6850. getPreferredSize : function() {
  6851. var layoutPaddingSize = 0;
  6852. if (this._axis) {
  6853. layoutPaddingSize = this._axis.tickSize();
  6854. if (this._layoutLabelSize != 0) {
  6855. layoutPaddingSize += this._padding / 2;
  6856. }
  6857. if (this._layoutTitleSize != 0) {
  6858. layoutPaddingSize += this._padding / 2;
  6859. }
  6860. }
  6861. return this._layoutLabelSize + this._layoutAverageDigitWidth + this._layoutTitleSize + layoutPaddingSize + 2;
  6862. },
  6863. /** @expose */
  6864. getSpillOverSize : function() {
  6865. return this._layoutSpillOver;
  6866. },
  6867. /** @expose */
  6868. orient : function(a0) {
  6869. var args = arguments;
  6870. if (args.length == 0) {
  6871. return this.orient$1();
  6872. }
  6873. return this.orient$0(a0);
  6874. },
  6875. /** @expose */
  6876. tickFormat : function(a0) {
  6877. var args = arguments;
  6878. if (args.length == 0) {
  6879. return this.tickFormat$1();
  6880. }
  6881. return this.tickFormat$0(a0);
  6882. },
  6883. /** @expose */
  6884. simplifiedTickFormat : function(a0) {
  6885. var args = arguments;
  6886. if (args.length == 0) {
  6887. return this.simplifiedTickFormat$1();
  6888. }
  6889. return this.simplifiedTickFormat$0(a0);
  6890. },
  6891. /** @expose */
  6892. labelStyle : function(a0, a1, a2) {
  6893. var args = arguments;
  6894. if (args.length == 1) {
  6895. return this.labelStyle$1(a0);
  6896. }
  6897. return this.labelStyle$0(a0, a1, a2);
  6898. },
  6899. /** @expose */
  6900. titleStyle : function(a0, a1, a2) {
  6901. var args = arguments;
  6902. if (args.length == 1) {
  6903. return this.titleStyle$1(a0);
  6904. }
  6905. return this.titleStyle$0(a0, a1, a2);
  6906. }
  6907. });
  6908. /**
  6909. * 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.
  6910. * @param (rave['internal']['RectStruct']) bounds Rectangle of the axis bounds
  6911. * @param (String) orient Orient, "top", "bottom", "left", "right"; if not valid, "bottom" used
  6912. * @return (double[]) Translation [x,y]
  6913. */
  6914. /** @expose */
  6915. com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation = function(bounds, orient) {
  6916. if ("left" == orient) {
  6917. return [bounds.x + bounds.width, 0.0];
  6918. }
  6919. if ("right" == orient) {
  6920. return [bounds.x, 0.0];
  6921. }
  6922. if ("top" == orient) {
  6923. return [0.0, bounds.y + bounds.height];
  6924. }
  6925. return [0.0, bounds.y];
  6926. };
  6927. com_ibm_rave_bundles_components_AxisComponentImpl.NodeIndex = rave['internal']['Declare']({
  6928. //_node : null,
  6929. _domainIndex : 0,
  6930. /** @expose */
  6931. constructor : function(node, domainIndex) {
  6932. this._node = node;
  6933. this._domainIndex = domainIndex;
  6934. },
  6935. /** @expose */
  6936. contains : function(node) {
  6937. return node == this._node;
  6938. },
  6939. /** @expose */
  6940. getIndex : function() {
  6941. return this._domainIndex;
  6942. }
  6943. });
  6944. /**
  6945. * Tick Handler for the axis. This will get called as the core axis is transitioned.
  6946. */
  6947. com_ibm_rave_bundles_components_AxisComponentImpl.AxisTickHandler = rave['internal']['Declare'](rave['internal']['AbstractTickHandler'], {
  6948. //_label : null,
  6949. //_tick : null,
  6950. _$functionClassMethod : function() {
  6951. var _$self = function(args) {
  6952. if (args !== null || arguments.length > 1){
  6953. args = Array.prototype.slice.call(arguments, 0);
  6954. }
  6955. {
  6956. _$self.handle(args[0]);
  6957. return null;
  6958. }
  6959. };
  6960. return _$self;
  6961. },
  6962. constructor : function(label, tick) {
  6963. this._label = label;
  6964. this._tick = tick;
  6965. },
  6966. /** @expose */
  6967. handle : function(ticks) {
  6968. ticks.call(this._tick);
  6969. ticks.call(this._label);
  6970. }
  6971. });
  6972. //com_ibm_rave_bundles_components_AxisComponentImpl.VISIBILITY = "visibility";
  6973. //com_ibm_rave_bundles_components_AxisComponentImpl.HIDDEN = "hidden";
  6974. /** @expose */
  6975. com_ibm_rave_bundles_components_AxisComponentImpl.LABEL_HIDDEN_FLAG = "__tickLabelHidden__";
  6976. /** @expose */
  6977. com_ibm_rave_bundles_components_AxisComponentImpl.PANZOOM_HIDDEN_FLAG = "__panZoomHidden__";
  6978. /** @expose */
  6979. com_ibm_rave_bundles_components_AxisComponentImpl.HIDDEN_COUNT = "__hiddenCount__";
  6980. /** @expose */
  6981. com_ibm_rave_bundles_components_AxisComponentImpl.PREFERRED_SPACE_PER_TICK = 20;
  6982. /** @expose */
  6983. com_ibm_rave_bundles_components_AxisComponentImpl.PREFERRED_TICK_COUNT = 10;
  6984. /** @expose */
  6985. com_ibm_rave_bundles_components_AxisComponentImpl.TICK_PADDING = 10;
  6986. //com_ibm_rave_bundles_components_AxisComponentImpl.HORIZONTAL_WEIGHT = 1.1;
  6987. com_ibm_rave_bundles_components_AxisComponentImpl.HORIZONTAL = 0;
  6988. com_ibm_rave_bundles_components_AxisComponentImpl.ROTATE90 = 1;
  6989. com_ibm_rave_bundles_components_AxisComponentImpl.ROTATE45 = 2;
  6990. com_ibm_rave_bundles_components_AxisComponentImpl.STAGGER = 3;
  6991. /**
  6992. * Constant used for text flow spacing
  6993. */
  6994. com_ibm_rave_bundles_components_AxisComponentImpl.TEXTFLOW_SPACING = 1.2;
  6995. /**
  6996. * Bottom axis orientation string.
  6997. */
  6998. /** @expose */
  6999. com_ibm_rave_bundles_components_AxisComponentImpl.BOTTOM_ORIENTATION = "bottom";
  7000. /**
  7001. * Top axis orientation string.
  7002. */
  7003. /** @expose */
  7004. com_ibm_rave_bundles_components_AxisComponentImpl.TOP_ORIENTATION = "top";
  7005. /**
  7006. * Left axis orientation string.
  7007. */
  7008. /** @expose */
  7009. com_ibm_rave_bundles_components_AxisComponentImpl.LEFT_ORIENTATION = "left";
  7010. /**
  7011. * Right axis orientation string.
  7012. */
  7013. /** @expose */
  7014. com_ibm_rave_bundles_components_AxisComponentImpl.RIGHT_ORIENTATION = "right";
  7015. com_ibm_rave_bundles_components_AxisComponentImpl.AUTOMODE = -1;
  7016. // $source: com/ibm/rave/bundles/components/GridComponentImpl
  7017. /************************************************************************
  7018. ** IBM Confidential
  7019. **
  7020. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7021. **
  7022. ** (C) Copyright IBM Corp. 2017
  7023. **
  7024. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7025. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7026. ************************************************************************/
  7027. // GENERATED
  7028. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  7029. //@import com/ibm/rave/bundles/components/StyleStructs (runtime) // new
  7030. //@import com/ibm/rave/bundles/component/GridComponent (runtime) // GridComponent
  7031. /**
  7032. * <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>
  7033. */
  7034. var com_ibm_rave_bundles_components_GridComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  7035. /**
  7036. * The axis property
  7037. */
  7038. //_axis : null,
  7039. /**
  7040. * Role, from the AxisComponent API
  7041. */
  7042. //_role : null,
  7043. /**
  7044. * The orientation
  7045. */
  7046. //_orient : null,
  7047. /**
  7048. * The bounds
  7049. */
  7050. //_bounds : null,
  7051. /**
  7052. * Style of gridlines
  7053. */
  7054. //_gridlineStyle : null,
  7055. /**
  7056. * Whether to display gridlines
  7057. */
  7058. _displayGridlines : false,
  7059. /**
  7060. * After calling the component, this is true if shapes were rendered, false if they were cleared.
  7061. */
  7062. _renderedShapes : false,
  7063. /**
  7064. * Construct, with all properties the defaults.
  7065. */
  7066. /** @expose */
  7067. constructor : function() {
  7068. this._axis = null;
  7069. this._role = null;
  7070. this._orient = "bottom";
  7071. this._bounds = null;
  7072. this._displayGridlines = true;
  7073. this._gridlineStyle = new com_ibm_rave_bundles_components_StyleStructs.LineStyle();
  7074. this._renderedShapes = false;
  7075. },
  7076. /** @expose */
  7077. type : function() {
  7078. return com_ibm_rave_bundles_component_GridComponent.COMPONENT_TYPE;
  7079. },
  7080. /** @expose */
  7081. role : function() {
  7082. return this._role;
  7083. },
  7084. /** @expose */
  7085. execute : function(g) {
  7086. this.preExecute();
  7087. if (!this._displayGridlines || !this._axis || !this._bounds) {
  7088. g.selectAll("*").remove();
  7089. this._renderedShapes = false;
  7090. return;
  7091. }
  7092. this._renderedShapes = true;
  7093. var size = ("bottom" == this._orient || "top" == this._orient) ? this._bounds.height : this._bounds.width;
  7094. var ticksHandler = this._axis.ticksHandler();
  7095. var tickSize = this._axis.tickSize();
  7096. var outerTickSize = this._axis.outerTickSize();
  7097. var tickFormat = this._axis.tickFormat();
  7098. var ax = this._axis.tickSize(-size, 0).tickFormat("").ticksHandler(null);
  7099. g.call(ax);
  7100. this._axis.tickSize(tickSize, outerTickSize).tickFormat(tickFormat).ticksHandler(ticksHandler);
  7101. g.selectAll("g.tick line").classed("grid-tick", true);
  7102. g.selectAll(".grid-tick").style("stroke", this._gridlineStyle._stroke).style("stroke-dasharray", (this._gridlineStyle._dashArray));
  7103. g.selectAll("path.domain").remove();
  7104. },
  7105. /**
  7106. * @param (rave['internal']['Axis']) axis The new axis
  7107. */
  7108. /** @expose */
  7109. axis : function(axis) {
  7110. this._axis = axis;
  7111. return this;
  7112. },
  7113. /**
  7114. * Set the role to one of the constants ROLE_X1 etc. defined in AxisComponent.
  7115. * @param (String) role The new role
  7116. * @return (com.ibm.rave.bundles.components.GridComponentImpl) This object
  7117. */
  7118. /** @expose */
  7119. setRole : function(role) {
  7120. this._role = role;
  7121. return this;
  7122. },
  7123. /**
  7124. * Only legal values are accepted, otherwise the orient is unchanged.
  7125. * @param (String) orient The new orient
  7126. */
  7127. orient$0 : function(orient) {
  7128. if ("left" == orient || "right" == orient || "bottom" == orient || "top" == orient) {
  7129. this._orient = orient;
  7130. }
  7131. return this;
  7132. },
  7133. /**
  7134. * @param (rave['internal']['RectStruct']) bounds The new bounds
  7135. */
  7136. /** @expose */
  7137. bounds : function(bounds) {
  7138. this._bounds = bounds;
  7139. return this;
  7140. },
  7141. displayGridlines$0 : function(displayGridlines) {
  7142. this._displayGridlines = displayGridlines;
  7143. return this;
  7144. },
  7145. /** @expose */
  7146. gridlineStyle : function(gridlineColor, dashArray) {
  7147. this.gridlineColor(gridlineColor);
  7148. this.dashArray(dashArray);
  7149. return this;
  7150. },
  7151. gridlineColor$0 : function(gridlineColor) {
  7152. this._gridlineStyle._stroke = (gridlineColor != null && gridlineColor.length > 0) ? gridlineColor : null;
  7153. return this;
  7154. },
  7155. dashArray$0 : function(dashArray) {
  7156. this._gridlineStyle._dashArray = (dashArray != null && dashArray.length > 0) ? dashArray : null;
  7157. return this;
  7158. },
  7159. /**
  7160. * @return (String) The orientation of the gridline.
  7161. */
  7162. orient$1 : function() {
  7163. return this._orient;
  7164. },
  7165. displayGridlines$1 : function() {
  7166. return this._displayGridlines;
  7167. },
  7168. gridlineColor$1 : function() {
  7169. return this._gridlineStyle._stroke;
  7170. },
  7171. dashArray$1 : function() {
  7172. return this._gridlineStyle._dashArray;
  7173. },
  7174. /**
  7175. * @return (boolean) True if on the last call the axis rendered shapes, false otherwise
  7176. */
  7177. renderedShapes : function() {
  7178. return this._renderedShapes;
  7179. },
  7180. /** @expose */
  7181. orient : function(a0) {
  7182. var args = arguments;
  7183. if (args.length == 0) {
  7184. return this.orient$1();
  7185. }
  7186. return this.orient$0(a0);
  7187. },
  7188. /** @expose */
  7189. displayGridlines : function(a0) {
  7190. var args = arguments;
  7191. if (args.length == 0) {
  7192. return this.displayGridlines$1();
  7193. }
  7194. return this.displayGridlines$0(a0);
  7195. },
  7196. /** @expose */
  7197. gridlineColor : function(a0) {
  7198. var args = arguments;
  7199. if (args.length == 0) {
  7200. return this.gridlineColor$1();
  7201. }
  7202. return this.gridlineColor$0(a0);
  7203. },
  7204. /** @expose */
  7205. dashArray : function(a0) {
  7206. var args = arguments;
  7207. if (args.length == 0) {
  7208. return this.dashArray$1();
  7209. }
  7210. return this.dashArray$0(a0);
  7211. }
  7212. });
  7213. // $source: com/ibm/rave/bundles/components/KeyedBundleComponentImpl
  7214. /************************************************************************
  7215. ** IBM Confidential
  7216. **
  7217. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7218. **
  7219. ** (C) Copyright IBM Corp. 2017
  7220. **
  7221. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7222. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7223. ************************************************************************/
  7224. // GENERATED
  7225. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  7226. /**
  7227. * 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.
  7228. * @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>
  7229. */
  7230. var com_ibm_rave_bundles_components_KeyedBundleComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  7231. //keyFunction : null,
  7232. /**
  7233. * Set the key function this component should use when joining data to scene nodes.
  7234. * @param (rave['internal']['SingleValueFunction']) keyFunction This function will be passed each datum individually and must return a unique value (a key).
  7235. * @return (com.ibm.rave.bundles.components.KeyedBundleComponentImpl) This.
  7236. */
  7237. /** @expose */
  7238. key : function(keyFunction) {
  7239. this.keyFunction = keyFunction;
  7240. return this;
  7241. },
  7242. /**
  7243. * Returns a {@link (rave['internal']['ValueFunction']) ValueFunction} that wraps the provided key function.
  7244. */
  7245. /** @expose */
  7246. getKey : function() {
  7247. if (!this.keyFunction) {
  7248. return null;
  7249. }
  7250. var self = this;
  7251. return function(datum, index, groupIndex) {
  7252. return self.keyFunction(datum);
  7253. };
  7254. }
  7255. });
  7256. // $source: com/ibm/rave/bundles/components/IntervalComponentImpl
  7257. /************************************************************************
  7258. ** IBM Confidential
  7259. **
  7260. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7261. **
  7262. ** (C) Copyright IBM Corp. 2017
  7263. **
  7264. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7265. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7266. ************************************************************************/
  7267. // GENERATED
  7268. //@import com/ibm/rave/bundles/components/KeyedBundleComponentImpl (loadtime) // superclass
  7269. //@import com/ibm/rave/bundles/utilities/BundleLabelDropper (runtime) // new
  7270. //@import com/ibm/rave/bundles/component/IntervalComponent (runtime) // IntervalComponent
  7271. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor
  7272. //@import com/ibm/rave/bundles/utilities/LabelStyleUtil (runtime) // new
  7273. /**
  7274. * <p> A component to draw interval charts. The component puts its shapes into the selector passed to its execute method. Intervals are rectangular regions bounded by ranges in the dependent and independent dimensions. </p> <p> The data array passed to the component has one entry per interval to be drawn. Each entry has six properties. Accessors are used to get these properties from the object, and scales to convert them to a graphical property. If a property is not defined (either no accessor or no scale), a default value is used for the property. The six properties are: </p> <ul> <li> <b>dependent1</b>: The first endpoint of the dependent coordinate interval. If not defined the interval is not drawn.</li> <li> <b>dependent2</b>: The second endpoint of the dependent coordinate interval. If not defined the interval is not drawn.</li> <li> <b>independent1</b>: The first endpoint of the independent coordinate interval. If not defined the interval is not drawn.</li> <li> <b>independent2</b>: The second endpoint of the independent coordinate interval. If not defined the interval is not drawn.</li> <li> <b>color</b>: Used for the fill color of the intervals. If not defined the fill is a default value set with a property.</li> <li> <b>label</b>: Label for the interval. If not defined the interval is not labeled. The interval component does not do internationalization, and this string is the value displayed.</li> </ul> <p> Intervals in general do not distinguish between the dependent and independent variables, although in bar charts they do. The names are used here for compatibility with other two-axis plots such as the line and point. </p> <p> The component properties are: </p> <p> <b>data</b>: An array with one entry per point. If null, no points are drawn. </p> <p> <b>independent1Accessor</b>: A value function applied to a data object to get the independent1 value. If null, the interval is not drawn. The default is null. </p> <p> <b>independent2Accessor</b>:A value function applied to a data object to get the independent2 value. If null, the interval is not drawn. The default is null. </p> <p> <b>independentScale</b>: A scale applied to the independent values to get the pixel coordinate for drawing the line. If null, the midpoint of the coordinate range is used. The default is null. </p> <p> <b>dependentAccessor1</b>: A value function applied to a data object to get the dependent1 value. If null, the interval is not drawn. The default is null. </p> <p> <b>dependentAccessor2</b>: A value function applied to a data object to get the dependent2 value. If null, the interval is not drawn. The default is null. </p> <p> <b>dependentScale</b>: A scale applied to the dependent value to get the pixel coordinate for drawing the line. If null, the midpoint of the coordinate range is used. The default is null. </p> <p> <b>colorAccessor</b>: A value function applied to a data object to get the color value. If null, the point is drawn in the primary color. The default is null. </p> <p> <b>colorPalette</b>: A palette applied to the color value to get a color value for drawing the point. If null or if it returns null, the point is drawn in the primary color. </p> <p> <b>labelAccessor</b>: A value function applied to a data object to get the label. If null, the point is not labeled. The default is null. </p> <p> <b>labelFormatter</b>: A value function applied to the data label (as returned by the labelAccessor) to get the formatted text string used in the chart. If null, the data label is coerced to a string and used as the formatted text string. The default is null. The method is not called when the data label is null. </p> <p> <b>valueAccessor</b>: A value function applied to a data object to get the data value that the interval represents. If null, the interval is not drawn. </p> <p> <b>transpose</b>: A boolean. If false the independent data is shown on the X axis and the dependent data on the Y; if true they are swapped. Default false. </p> <p> <b>primaryColor</b>: The color used to fill the interval when the interval has no color value or there is no color scale. If null, the point is drawn but not colored, and the CSS style will be used. </p> <p> <b>itemLabel</b>: A boolean. If true and if the label accessor is defined, the label is shown on each item. Default true. </p> <p> <b>itemLabelPosition</b>: A value function applied to a data object to get the item label position. If null, the label is centered. </p>
  7275. */
  7276. var com_ibm_rave_bundles_components_IntervalComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_KeyedBundleComponentImpl, {
  7277. /**
  7278. * Data
  7279. */
  7280. //_data : null,
  7281. /**
  7282. * Accessor for key variable
  7283. */
  7284. //_keyAccessor : null,
  7285. /**
  7286. * Accessor for independent1 variable
  7287. */
  7288. //_independent1Accessor : null,
  7289. /**
  7290. * Accessor for independent2 variable
  7291. */
  7292. //_independent2Accessor : null,
  7293. /**
  7294. * Independent variable scale
  7295. */
  7296. //_independentScale : null,
  7297. /**
  7298. * Accessor for dependent1 variable
  7299. */
  7300. //_dependent1Accessor : null,
  7301. /**
  7302. * Accessor for dependent2 variable
  7303. */
  7304. //_dependent2Accessor : null,
  7305. /**
  7306. * Dependent scale
  7307. */
  7308. //_dependentScale : null,
  7309. /**
  7310. * Color scale
  7311. */
  7312. //_colorPalette : null,
  7313. /**
  7314. * Accessor for label role
  7315. */
  7316. //_labelAccessor : null,
  7317. /**
  7318. * Accessor for data values
  7319. */
  7320. //_valueAccessor : null,
  7321. /**
  7322. * Label formatter, may be null
  7323. */
  7324. //_labelFormatter : null,
  7325. //_dropOverlap : null,
  7326. /**
  7327. * Show label
  7328. */
  7329. //_itemLabelPosition : null,
  7330. /**
  7331. * border width
  7332. */
  7333. //_borderWidth : null,
  7334. //_borderColor : null,
  7335. /**
  7336. * Effect
  7337. */
  7338. //_specialTransition : null,
  7339. //_delay : null,
  7340. //_labelFontStyle : null,
  7341. //_bounds : null,
  7342. //_labelStyleUtil : null,
  7343. /**
  7344. * Transpose
  7345. */
  7346. _transpose : false,
  7347. /**
  7348. * Show label
  7349. */
  7350. _itemLabel : false,
  7351. /**
  7352. * Drop overlapping labels
  7353. */
  7354. _itemOverlap : true,
  7355. _labelLayerClass : ".element-label-group",
  7356. _elementLayerClass : ".element-group",
  7357. _labelContrast : false,
  7358. _labelShadow : false,
  7359. constructor : function() {
  7360. this._dropOverlap = new com_ibm_rave_bundles_utilities_BundleLabelDropper();
  7361. this._delay = function(data, index, groupIndex) {
  7362. return 0;
  7363. };
  7364. this._labelFontStyle = {};
  7365. {
  7366. this._labelStyleUtil = new com_ibm_rave_bundles_utilities_LabelStyleUtil();
  7367. }
  7368. },
  7369. /** @expose */
  7370. type : function() {
  7371. return com_ibm_rave_bundles_component_IntervalComponent.COMPONENT_TYPE;
  7372. },
  7373. /** @expose */
  7374. execute : function(g) {
  7375. this.preExecute();
  7376. var elementGroupSelector = g.selectAll(this._elementLayerClass);
  7377. var elementLabelGroupSelector = g.selectAll(this._labelLayerClass);
  7378. if (g.classed(this._elementLayerClass) || elementGroupSelector.size() == 0 || elementLabelGroupSelector.size() == 0) {
  7379. elementGroupSelector = g;
  7380. elementLabelGroupSelector = g;
  7381. }
  7382. if (!this._data || !this._independent1Accessor || !this._independent2Accessor || !this._independentScale || !this._dependent1Accessor || !this._dependent2Accessor || !this._dependentScale) {
  7383. elementGroupSelector.selectAll("*").remove();
  7384. elementLabelGroupSelector.selectAll("*").remove();
  7385. return;
  7386. }
  7387. var self = this;
  7388. var labelText = !this._labelFormatter ? function(data, index, groupIndex) {
  7389. if (Math.max(+ (self._dependentScale.upper(self._dependent1Accessor(data))), + (self._dependentScale.upper(self._dependent2Accessor(data)))) - Math.min(+ (self._dependentScale.lower(self._dependent1Accessor(data))), + (self._dependentScale.lower(self._dependent2Accessor(data)))) < 0.001) {
  7390. return null;
  7391. }
  7392. return self._labelAccessor(data);
  7393. } : function(data, index, groupIndex) {
  7394. var v = self._labelAccessor(data);
  7395. return v == null ? null : self._labelFormatter.call(this, v, index, groupIndex);
  7396. };
  7397. var keyFunction = !this._keyAccessor ? null : function(datum, ix, gix) {
  7398. return self._keyAccessor(datum);
  7399. };
  7400. var labelsOn = this._itemLabel && this._labelAccessor;
  7401. if (!labelsOn) {
  7402. g.selectAll("text.element-label").remove();
  7403. }
  7404. var elementSelector = elementGroupSelector.selectAll(".element").data(this._data, this.getKey() ? this.getKey() : keyFunction);
  7405. elementSelector.exit().remove();
  7406. var elementEnter = elementSelector.enter().append("g").attr("class", "element");
  7407. elementEnter.append("rect").attr("class", "element-shape").attr("x", this._specialTransition == null ? this.rectangleCoord$0(true, true, true) : this.rectangleCoord$0(true, false, true)).attr("width", this._specialTransition == null ? this.rectangleSize(true, true, true) : this.rectangleSize(true, false, true)).attr("y", this.rectangleCoord$0(false, true, true)).attr("height", 0).style("fill", this._colorPalette);
  7408. if (labelsOn) {
  7409. var elementLabelSelector = elementLabelGroupSelector.selectAll(".element-label").data(this._data, this.getKey() ? this.getKey() : keyFunction);
  7410. elementLabelSelector.exit().remove();
  7411. elementLabelSelector.enter().append("text").attr("class", "element-label");
  7412. this.addLabels(elementLabelSelector).text(labelText);
  7413. }
  7414. var shapes = elementSelector.select(".element-shape");
  7415. var t = rave.transition(shapes);
  7416. if (t != shapes && this._delay) {
  7417. (t).delay(this._delay);
  7418. }
  7419. t.style("fill", this._colorPalette);
  7420. this.updateBorder(t, this._borderWidth, this._borderColor);
  7421. var fontChecker = rave.capabilities.extension("fontchecker");
  7422. if (this._specialTransition == null) {
  7423. t.attr("x", this.rectangleCoord$0(true, false, false)).attr("width", this.rectangleSize(true, false, false)).attr("y", this.rectangleCoord$0(false, false, false)).attr("height", this.rectangleSize(false, false, false));
  7424. } else if (this.isXYanimation()) {
  7425. t.attr("y", this.rectangleCoord$0(false, false, false)).attr("height", this.rectangleSize(false, false, false)).transition().attr("x", this.rectangleCoord$0(true, false, false)).attr("width", this.rectangleSize(true, false, false));
  7426. } else {
  7427. t.attr("x", this.rectangleCoord$0(true, false, false)).attr("width", this.rectangleSize(true, false, false)).transition().attr("y", this.rectangleCoord$0(false, false, false)).attr("height", this.rectangleSize(false, false, false));
  7428. }
  7429. if (this._renderCallback) {
  7430. t.call(this._renderCallback, "elements");
  7431. }
  7432. if (labelsOn) {
  7433. var labels = g.selectAll(".element-label");
  7434. var t2 = rave.transition(labels);
  7435. if (fontChecker) {
  7436. labels.call(fontChecker);
  7437. }
  7438. if (t2 != labels && this._delay) {
  7439. (t2).delay(this._delay);
  7440. }
  7441. t2.attr("x", this.getXPosition()).attr("dx", this.getXOffset()).attr("y", this.getYPosition()).attr("dy", this.getYOffset()).style("text-anchor", this.getAnchor());
  7442. var labelColor = this.getDefaultLabelColor(this._labelFontStyle);
  7443. this._labelStyleUtil.labelFont(this._labelFontStyle).labelFillColor(this._labelContrast ? this.getLabelFill() : function(data, index, groupIndex) {
  7444. return labelColor;
  7445. }).labelShadow(this._labelShadow);
  7446. labels.call(this._labelStyleUtil);
  7447. t2.text(labelText);
  7448. this._dropOverlap.configureForDataLabels(this._bounds);
  7449. t2.call(this._dropOverlap, this._itemOverlap);
  7450. }
  7451. },
  7452. /**
  7453. * Add a &lt;text g=element-label"&gt; to each node in the selection s, setting the text properties to the usual defaults.
  7454. * @param (rave['internal']['Selector']) s Selector
  7455. * @return (rave['internal']['Selector']) Selector for the added labels
  7456. */
  7457. addLabels : function(s) {
  7458. return s.selectAll("element-label").attr("x", this.rectangleCenter(true, true, true)).attr("y", this.rectangleCenter(false, true, true)).attr("dy", ".3em").style("text-anchor", "middle");
  7459. },
  7460. getAnchor : function() {
  7461. var self = this;
  7462. return function(data, index, groupIndex) {
  7463. if (!self._transpose || (!self._itemLabelPosition)) {
  7464. return "middle";
  7465. }
  7466. var labelPosition = self._itemLabelPosition.call(this, data, index, groupIndex);
  7467. if (0 == labelPosition) {
  7468. return "start";
  7469. } else if (1 == labelPosition) {
  7470. return "middle";
  7471. } else {
  7472. return "end";
  7473. }
  7474. };
  7475. },
  7476. getLabelFill : function() {
  7477. var self = this;
  7478. var labelColor = this.getDefaultLabelColor(this._labelFontStyle);
  7479. return function(data, index, groupIndex) {
  7480. if (!self._itemLabelPosition) {
  7481. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(self._colorPalette.call(this, data, index, groupIndex), labelColor).toString();
  7482. }
  7483. var labelPosition = self._itemLabelPosition.call(this, data, index, groupIndex);
  7484. if (1 == labelPosition) {
  7485. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(self._colorPalette.call(this, data, index, groupIndex), labelColor).toString();
  7486. }
  7487. return labelColor;
  7488. };
  7489. },
  7490. getXOffset : function() {
  7491. var self = this;
  7492. return function(data, index, groupIndex) {
  7493. if (!self._transpose || (!self._itemLabelPosition)) {
  7494. return "0em";
  7495. }
  7496. var labelPosition = self._itemLabelPosition.call(this, data, index, groupIndex);
  7497. if (0 == labelPosition) {
  7498. return ".3em";
  7499. } else if (1 == labelPosition) {
  7500. return "0em";
  7501. } else {
  7502. return "-.3em";
  7503. }
  7504. };
  7505. },
  7506. getYOffset : function() {
  7507. var self = this;
  7508. return function(data, index, groupIndex) {
  7509. if (self._transpose || (!self._itemLabelPosition)) {
  7510. return ".3em";
  7511. }
  7512. var labelPosition = self._itemLabelPosition.call(this, data, index, groupIndex);
  7513. if (0 == labelPosition) {
  7514. return "-.3em";
  7515. } else if (1 == labelPosition) {
  7516. return ".3em";
  7517. } else {
  7518. return "1.1em";
  7519. }
  7520. };
  7521. },
  7522. getXPosition : function() {
  7523. var self = this;
  7524. return function(data, index, groupIndex) {
  7525. if (!self._transpose || (!self._itemLabelPosition)) {
  7526. return self.rectangleCenter(true, false, false).call(this, data, index, groupIndex);
  7527. }
  7528. var labelPosition = self._itemLabelPosition.call(this, data, index, groupIndex);
  7529. if (0 == labelPosition) {
  7530. return self.rectangleCoord$1(true, false, false, true).call(this, data, index, groupIndex);
  7531. } else if (1 == labelPosition) {
  7532. return self.rectangleCenter(true, false, false).call(this, data, index, groupIndex);
  7533. } else {
  7534. return self.rectangleCoord$1(true, false, false, false).call(this, data, index, groupIndex);
  7535. }
  7536. };
  7537. },
  7538. getYPosition : function() {
  7539. var self = this;
  7540. return function(data, index, groupIndex) {
  7541. if (self._transpose || (!self._itemLabelPosition)) {
  7542. return self.rectangleCenter(false, false, false).call(this, data, index, groupIndex);
  7543. }
  7544. var labelPosition = self._itemLabelPosition.call(this, data, index, groupIndex);
  7545. if (0 == labelPosition) {
  7546. return self.rectangleCoord$1(false, false, false, false).call(this, data, index, groupIndex);
  7547. } else if (1 == labelPosition) {
  7548. return self.rectangleCenter(false, false, false).call(this, data, index, groupIndex);
  7549. } else {
  7550. return self.rectangleCoord$1(false, false, false, true).call(this, data, index, groupIndex);
  7551. }
  7552. };
  7553. },
  7554. /**
  7555. * Return a value function that gives the "x" or "y" coordinate of a rectangle.
  7556. * @param (boolean) xdim Whether "x" (true) or "y" (false) is requested
  7557. * @param (boolean) fromBase If true and the scale is non-ordinal, the function returns the coordinate for value 0.0
  7558. * @param (boolean) enter Whether the coordinate is for an enter transition
  7559. * @return (rave['internal']['ValueFunction']) Value function for that coordinate
  7560. */
  7561. rectangleCoord$0 : function(xdim, fromBase, enter) {
  7562. return this.rectangleCoord$1(xdim, fromBase, enter, false);
  7563. },
  7564. rectangleCoord$1 : function(xdim, fromBase, enter, useMax) {
  7565. var useDependent = xdim == this._transpose;
  7566. var scale = useDependent ? this._dependentScale : this._independentScale;
  7567. if (fromBase && useDependent && this._dependentScale.isLinear()) {
  7568. var value = scale.lower(0.0);
  7569. return function(data, index, groupIndex) {
  7570. return value;
  7571. };
  7572. }
  7573. var a1 = useDependent ? this._dependent1Accessor : this._independent1Accessor;
  7574. var a2 = useDependent ? this._dependent2Accessor : this._independent2Accessor;
  7575. if (enter && this.isCTShandling()) {
  7576. return function(data, index, groupIndex) {
  7577. return scale.center(a1(data));
  7578. };
  7579. }
  7580. return function(data, index, groupIndex) {
  7581. if (useMax) {
  7582. return Math.max(+ (scale.upper(a1(data))), + (scale.upper(a2(data))));
  7583. } else {
  7584. return Math.min(+ (scale.lower(a1(data))), + (scale.lower(a2(data))));
  7585. }
  7586. };
  7587. },
  7588. /**
  7589. * Return a value function that gives the "height" or "width" coordinate of a rectangle.
  7590. * @param (boolean) xdim Whether "width" (true) or "height" (false) is requested
  7591. * @param (boolean) fromBase If true and the scale is non-ordinal, the function returns 0.001
  7592. * @param (boolean) enter Whether the size is for an enter transition
  7593. * @return (rave['internal']['ValueFunction']) Value function for that coordinate
  7594. */
  7595. rectangleSize : function(xdim, fromBase, enter) {
  7596. var useDependent = xdim == this._transpose;
  7597. var scale = useDependent ? this._dependentScale : this._independentScale;
  7598. if ((fromBase && useDependent && this._dependentScale.isLinear()) || (enter && this.isCTShandling())) {
  7599. return function(data, index, groupIndex) {
  7600. return 0.001;
  7601. };
  7602. }
  7603. var a1 = useDependent ? this._dependent1Accessor : this._independent1Accessor;
  7604. var a2 = useDependent ? this._dependent2Accessor : this._independent2Accessor;
  7605. return function(data, index, groupIndex) {
  7606. return Math.max(0.001, Math.max(+ (scale.upper(a1(data))), + (scale.upper(a2(data)))) - Math.min(+ (scale.lower(a1(data))), + (scale.lower(a2(data)))));
  7607. };
  7608. },
  7609. /**
  7610. * @return (boolean) Whether the XY animation (shift X, then Y) should be used
  7611. */
  7612. isXYanimation : function() {
  7613. return "XY_CTS" == this._specialTransition || "XY_STC" == this._specialTransition;
  7614. },
  7615. /**
  7616. * @return (boolean) Whether the data handling changed from clustered to stacked
  7617. */
  7618. isCTShandling : function() {
  7619. return "XY_CTS" == this._specialTransition || "YX_CTS" == this._specialTransition;
  7620. },
  7621. /**
  7622. * Return a value function that gives the x or y center coordinate of a rectangle.
  7623. * @param (boolean) xdim Whether the x (true) or y (false) is requested
  7624. * @param (boolean) fromBase If true and the scale is non-ordinal, the function returns the scaled 0.0
  7625. * @param (boolean) enter Whether the center is for an enter transition
  7626. * @return (rave['internal']['ValueFunction']) Value function for that coordinate
  7627. */
  7628. rectangleCenter : function(xdim, fromBase, enter) {
  7629. var useDependent = xdim == this._transpose;
  7630. var scale = useDependent ? this._dependentScale : this._independentScale;
  7631. if (fromBase && useDependent && this._dependentScale.isLinear()) {
  7632. var value = scale.lower(0.0);
  7633. return function(data, index, groupIndex) {
  7634. return value;
  7635. };
  7636. }
  7637. var a1 = useDependent ? this._dependent1Accessor : this._independent1Accessor;
  7638. var a2 = useDependent ? this._dependent2Accessor : this._independent2Accessor;
  7639. if (enter && this.isCTShandling()) {
  7640. return function(data, index, groupIndex) {
  7641. return + (scale.center(a1(data)));
  7642. };
  7643. }
  7644. return function(data, index, groupIndex) {
  7645. var val = (Math.max(+ (scale.upper(a1(data))), + (scale.upper(a2(data)))) + Math.min(+ (scale.lower(a1(data))), + (scale.lower(a2(data))))) / 2.0;
  7646. if (isNaN(val)) {
  7647. val = 0;
  7648. }
  7649. return val;
  7650. };
  7651. },
  7652. /**
  7653. * @param (java.lang.Object[]) data The new data
  7654. */
  7655. /** @expose */
  7656. data : function(data) {
  7657. this._data = data;
  7658. return this;
  7659. },
  7660. /**
  7661. * @param (rave['internal']['SingleValueFunction']) keyAccessor The new key accessor
  7662. */
  7663. /** @expose */
  7664. keyAccessor : function(keyAccessor) {
  7665. this._keyAccessor = keyAccessor;
  7666. return this;
  7667. },
  7668. /**
  7669. * @param (rave['internal']['SingleValueFunction']) independent1Accessor The new independent1 accessor
  7670. */
  7671. /** @expose */
  7672. independent1Accessor : function(independent1Accessor) {
  7673. this._independent1Accessor = independent1Accessor;
  7674. return this;
  7675. },
  7676. /**
  7677. * @param (rave['internal']['SingleValueFunction']) independent2Accessor The new independent1 accessor
  7678. */
  7679. /** @expose */
  7680. independent2Accessor : function(independent2Accessor) {
  7681. this._independent2Accessor = independent2Accessor;
  7682. return this;
  7683. },
  7684. /**
  7685. * @param (rave['library']['internal']['CoordinateScaleImpl']) independentScale The new independent scale
  7686. */
  7687. /** @expose */
  7688. independentScale : function(independentScale) {
  7689. this._independentScale = independentScale;
  7690. return this;
  7691. },
  7692. /**
  7693. * @param (rave['internal']['SingleValueFunction']) dependent1Accessor The new dependent1 accessor
  7694. */
  7695. /** @expose */
  7696. dependent1Accessor : function(dependent1Accessor) {
  7697. this._dependent1Accessor = dependent1Accessor;
  7698. return this;
  7699. },
  7700. /**
  7701. * @param (rave['internal']['SingleValueFunction']) dependent2Accessor The new dependent2 accessor
  7702. */
  7703. /** @expose */
  7704. dependent2Accessor : function(dependent2Accessor) {
  7705. this._dependent2Accessor = dependent2Accessor;
  7706. return this;
  7707. },
  7708. /**
  7709. * @param (rave['library']['internal']['CoordinateScaleImpl']) dependentScale The new dependent scale
  7710. */
  7711. /** @expose */
  7712. dependentScale : function(dependentScale) {
  7713. this._dependentScale = dependentScale;
  7714. return this;
  7715. },
  7716. /**
  7717. * @param (rave['library']['internal']['Palette']) colorPalette The new colorPalette
  7718. */
  7719. /** @expose */
  7720. colorPalette : function(colorPalette) {
  7721. this._colorPalette = colorPalette;
  7722. return this;
  7723. },
  7724. /**
  7725. * @param (rave['internal']['SingleValueFunction']) labelAccessor The new labelAccessor
  7726. */
  7727. /** @expose */
  7728. labelAccessor : function(labelAccessor) {
  7729. this._labelAccessor = labelAccessor;
  7730. return this;
  7731. },
  7732. /**
  7733. * @param (rave['internal']['ValueFunction']) labelFormatter The new labelFormatter
  7734. */
  7735. /** @expose */
  7736. labelFormatter : function(labelFormatter) {
  7737. this._labelFormatter = labelFormatter;
  7738. return this;
  7739. },
  7740. /**
  7741. * @param (boolean) transpose The new transpose
  7742. */
  7743. /** @expose */
  7744. transpose : function(transpose) {
  7745. this._transpose = transpose;
  7746. return this;
  7747. },
  7748. /**
  7749. * @param (boolean) itemLabel The new itemLabel
  7750. */
  7751. /** @expose */
  7752. itemLabel : function(itemLabel) {
  7753. this._itemLabel = itemLabel;
  7754. return this;
  7755. },
  7756. /**
  7757. * @param (rave['internal']['ValueFunction']) labelPosition Function to be used to determine label position
  7758. */
  7759. /** @expose */
  7760. itemLabelPosition : function(labelPosition) {
  7761. this._itemLabelPosition = labelPosition;
  7762. return this;
  7763. },
  7764. /**
  7765. * @param itemOverlap drop or show overlap labels
  7766. */
  7767. /** @expose */
  7768. itemOverlap : function(_itemOverlap) {
  7769. this._itemOverlap = _itemOverlap;
  7770. return this;
  7771. },
  7772. /** @expose */
  7773. valueAccessor : function(valueAccessor) {
  7774. this._valueAccessor = valueAccessor;
  7775. return this;
  7776. },
  7777. /**
  7778. * Set the special transition used for clustered-to-stacked. Allowed values are: <ul> <li> "YX_CTS": The data handling changed from clustered to stacked, and the animation is to change the Y values then the X values </li> <li> "XY_CTS": The data handling changed from clustered to stacked, and the animation is to change the X values then the Y values </li> <li> "YX_STC": The data handling changed from stacked to clustered, and the animation is to change the Y values then the X values </li> <li> "XY_STC": The data handling changed from stacked to clustered, and the animation is to change the X values then the Y values </li> <li> null: No special transition </li> </ul>
  7779. * @param (String) specialTransition Transition
  7780. * @return (com.ibm.rave.bundles.components.IntervalComponentImpl) This object
  7781. */
  7782. /** @expose */
  7783. specialTransition : function(specialTransition) {
  7784. this._specialTransition = specialTransition;
  7785. return this;
  7786. },
  7787. /** @expose */
  7788. delay : function(delayFunction) {
  7789. this._delay = delayFunction;
  7790. return this;
  7791. },
  7792. /** @expose */
  7793. borderWidth : function(width) {
  7794. this._borderWidth = width;
  7795. return this;
  7796. },
  7797. /** @expose */
  7798. borderColor : function(color) {
  7799. this._borderColor = color;
  7800. return this;
  7801. },
  7802. /** @expose */
  7803. labelFont : function(labelFontStyle) {
  7804. this._labelFontStyle = labelFontStyle;
  7805. return this;
  7806. },
  7807. /**
  7808. * @param (rave['internal']['RectStruct']) bounds The bounds of the chart area, used for label collision.
  7809. */
  7810. /** @expose */
  7811. bounds : function(bounds) {
  7812. this._bounds = bounds;
  7813. return this;
  7814. },
  7815. /**
  7816. * @param (String) className - the class name for labelslayer. If not set, the default is ".element-label-group" return this
  7817. */
  7818. /** @expose */
  7819. labelLayerClassName : function(className) {
  7820. this._labelLayerClass = className;
  7821. return this;
  7822. },
  7823. /**
  7824. * @param (String) className - the class name for elementslayer. If not set, the default is ".element-group" return this
  7825. */
  7826. /** @expose */
  7827. elementLayerClassName : function(className) {
  7828. this._elementLayerClass = className;
  7829. return this;
  7830. },
  7831. /**
  7832. * @param (boolean) labelContrast {boolean} whether to contrast the label color with background/background element color.
  7833. * @return (com.ibm.rave.bundles.components.IntervalComponentImpl) this
  7834. */
  7835. /** @expose */
  7836. labelContrast : function(labelContrast) {
  7837. this._labelContrast = labelContrast;
  7838. return this;
  7839. },
  7840. /**
  7841. * @param (boolean) labelShadow {boolean} whether to show a label shadow with a contrast label color.
  7842. * @return (com.ibm.rave.bundles.components.IntervalComponentImpl) this
  7843. */
  7844. /** @expose */
  7845. labelShadow : function(labelShadow) {
  7846. this._labelShadow = labelShadow;
  7847. return this;
  7848. },
  7849. rectangleCoord : function(a0, a1, a2, a3) {
  7850. var args = arguments;
  7851. if (args.length == 3) {
  7852. return this.rectangleCoord$0(a0, a1, a2);
  7853. }
  7854. return this.rectangleCoord$1(a0, a1, a2, a3);
  7855. }
  7856. });
  7857. /** @expose */
  7858. com_ibm_rave_bundles_components_IntervalComponentImpl.LABEL_POSITION_TOP = 0;
  7859. /** @expose */
  7860. com_ibm_rave_bundles_components_IntervalComponentImpl.LABEL_POSITION_CENTER = 1;
  7861. /** @expose */
  7862. com_ibm_rave_bundles_components_IntervalComponentImpl.LABEL_POSITION_BOTTOM = 2;
  7863. // $source: com/ibm/rave/bundles/components/FilterComponentImpl
  7864. /************************************************************************
  7865. ** IBM Confidential
  7866. **
  7867. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7868. **
  7869. ** (C) Copyright IBM Corp. 2017
  7870. **
  7871. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7872. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7873. ************************************************************************/
  7874. // GENERATED
  7875. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  7876. var com_ibm_rave_bundles_components_FilterComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  7877. //_id : null,
  7878. //color : null,
  7879. offset_x : 0,
  7880. offset_y : 0,
  7881. blur_radius : 0,
  7882. /** @expose */
  7883. constructor : function(id) {
  7884. this._id = id;
  7885. },
  7886. /** @expose */
  7887. setDropshadow : function(offset_x, offset_y, radius, rgb) {
  7888. this.offset_x = this.getValue(offset_x);
  7889. this.offset_y = this.getValue(offset_y);
  7890. this.blur_radius = this.getValue(radius);
  7891. this.color = rgb;
  7892. },
  7893. getValue : function(s) {
  7894. if (s == null) {
  7895. return 0;
  7896. }
  7897. return + (s.substring(0, s.length - 2));
  7898. },
  7899. /** @expose */
  7900. execute : function(g) {
  7901. var s = g.selectAll("#" + this._id).data([0]);
  7902. var filter = s.enter().append("filter").attr("id", this._id).attr("height", "500%").attr("width", "500%");
  7903. filter.append("feGaussianBlur").attr("in", "SourceAlpha");
  7904. filter.append("feOffset").attr("result", "offsetBlur");
  7905. filter.append("feFlood");
  7906. filter.append("feComposite").attr("in2", "offsetBlur").attr("operator", "in");
  7907. var merge = filter.append("feMerge");
  7908. merge.append("feMergeNode");
  7909. merge.append("feMergeNode").attr("in", "SourceGraphic");
  7910. s.select("feGaussianBlur").attr("stdDeviation", this.blur_radius);
  7911. s.select("feOffset").attr("dx", this.offset_x).attr("dy", this.offset_y);
  7912. s.select("feFlood").attr("flood-color", !this.color ? "black" : this.color);
  7913. },
  7914. /** @expose */
  7915. type : function() {
  7916. return "FilterComponent";
  7917. },
  7918. /** @expose */
  7919. getId : function() {
  7920. return this._id;
  7921. }
  7922. });
  7923. })();
  7924. },{"./configuration/configuration.json":1,"./i18n/messages_en.json":2,"./vizlibrary-heatmapBundle.css":4,"./vizlibrary.css":5}],4:[function(require,module,exports){
  7925. var css = "/*\n *\tOverride the axis stroke colour from vizlibrary css.\n */\n\n.vizlibrary-heatmap .element-shape {\n fill: silver;\n stroke: #dfe9e9;\n}\n.vizlibrary-heatmap .element-group text {\n fill: white;\n text-shadow: black 0 0 0.2em,black 0 0 0.2em;\n font-weight: 400;\n font-size: 12px;\n}\n.vizlibrary-heatmap .element-group .element-label {\n pointer-events: none;\n}\n.vizlibrary-heatmap .element-shape.selected {\n opacity: 1.0;\n}\n.vizlibrary-heatmap .element-shape.dim {\n opacity: 0.3;\n}\n"; (require("browserify-css").createStyle(css, { "href": "dist/bundles/rave-library-heatmap/node/rave-library-heatmap/vizlibrary-heatmapBundle.css"})); module.exports = css;
  7926. },{"browserify-css":6}],5:[function(require,module,exports){
  7927. 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-heatmap/node/rave-library-heatmap/vizlibrary.css"})); module.exports = css;
  7928. },{"browserify-css":6}],6:[function(require,module,exports){
  7929. 'use strict';
  7930. // For more information about browser field, check out the browser field at https://github.com/substack/browserify-handbook#browser-field.
  7931. module.exports = {
  7932. // Create a <link> tag with optional data attributes
  7933. createLink: function(href, attributes) {
  7934. var head = document.head || document.getElementsByTagName('head')[0];
  7935. var link = document.createElement('link');
  7936. link.href = href;
  7937. link.rel = 'stylesheet';
  7938. for (var key in attributes) {
  7939. if ( ! attributes.hasOwnProperty(key)) {
  7940. continue;
  7941. }
  7942. var value = attributes[key];
  7943. link.setAttribute('data-' + key, value);
  7944. }
  7945. head.appendChild(link);
  7946. },
  7947. // Create a <style> tag with optional data attributes
  7948. createStyle: function(cssText, attributes) {
  7949. var head = document.head || document.getElementsByTagName('head')[0],
  7950. style = document.createElement('style');
  7951. style.type = 'text/css';
  7952. for (var key in attributes) {
  7953. if ( ! attributes.hasOwnProperty(key)) {
  7954. continue;
  7955. }
  7956. var value = attributes[key];
  7957. style.setAttribute('data-' + key, value);
  7958. }
  7959. if (style.sheet) { // for jsdom and IE9+
  7960. style.innerHTML = cssText;
  7961. style.sheet.cssText = cssText;
  7962. head.appendChild(style);
  7963. } else if (style.styleSheet) { // for IE8 and below
  7964. head.appendChild(style);
  7965. style.styleSheet.cssText = cssText;
  7966. } else { // for Chrome, Firefox, and Safari
  7967. style.appendChild(document.createTextNode(cssText));
  7968. head.appendChild(style);
  7969. }
  7970. }
  7971. };
  7972. },{}]},{},[3]);
  7973. return rave.library.bundle.extension('heatmapBundle');
  7974. }));