rave-library-dial.js 345 KB

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