rave-library-bullet.js 325 KB

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