rave-library-waterfall.js 360 KB

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