rave-library-radar.js 394 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722
  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.raveLibraryRadar = factory(root.rave, root.raveLibrary, root.raveUtilities, root.raveLayouts, root.raveLegends);
  8. }
  9. }(this, function(rave, raveLibrary, raveUtilities, raveLayouts, raveLegends) {
  10. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  11. module.exports=[{"previews":{"image":[{"file":"resources\/preview_radar_small.png","tags":["small","notext"]}],"svg":[{"file":"resources\/preview_radar_small.svg","tags":["small","notext"]}]},"genericMeta":{"copyright":"IBM 2015, 2016","author":"IBM","description":"radar.description","id":"rave-library-radar","label":"radar.label","version":"1.0.0","tags":["radar"]}},{"datamodels":[{"description":"datamodel.tabular.radar.description","id":"tabular","label":"datamodel.tabular.label","datasets":[{"dataslots":[{"icon":{"image":"..\/rave-library\/resources\/x_axis_32.png","svg":"..\/rave-library\/resources\/x_axis_32.svg"},"description":"dataslot.x.radar.description","id":"x","label":"dataslot.x.label","cardinality":"1","datatypes":["string"],"tags":[]},{"icon":{"image":"..\/rave-library\/resources\/y_axis_32.png","svg":"..\/rave-library\/resources\/y_axis_32.svg"},"description":"dataslot.y.radar.description","id":"y","label":"dataslot.y.label","cardinality":"1","datatypes":["numeric"]},{"icon":{"image":"..\/rave-library\/resources\/color_by_32.png","svg":"..\/rave-library\/resources\/color_by_32.svg"},"description":"dataslot.color.radar.description","id":"color","label":"dataslot.color.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.description","id":"data","label":"dataset.tabular.label","type":"tabular","cardinality":"1"}],"tags":["radar","spoke","simple","basic"]}]},{"properties":{"color":{"type":"object","properties":{"palette":{"resetView":"layout","name":"color.palette.name","options":["categorical"],"description":"color.palette.description","type":"palette"}}},"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"}}},"lineWithPoints":{"type":"object","properties":{"symbol":{"default":"donutPlus","resetView":"layout","name":"lineWithPoints.symbol.name","options":[{"id":"lineWithPoints.symbol.options.circle","value":"circle"},{"id":"lineWithPoints.symbol.options.cross","value":"cross"},{"id":"lineWithPoints.symbol.options.diamond","value":"diamond"},{"id":"lineWithPoints.symbol.options.square","value":"square"},{"id":"lineWithPoints.symbol.options.triangle-down","value":"triangle-down"},{"id":"lineWithPoints.symbol.options.triangle-up","value":"triangle-up"},{"id":"lineWithPoints.symbol.options.horizontal-rectangle","value":"horizontal-rectangle"},{"id":"lineWithPoints.symbol.options.vertical-rectangle","value":"vertical-rectangle"},{"id":"lineWithPoints.symbol.options.triangle-left","value":"triangle-left"},{"id":"lineWithPoints.symbol.options.triangle-right","value":"triangle-right"},{"id":"lineWithPoints.symbol.options.star","value":"star"},{"id":"lineWithPoints.symbol.options.donut","value":"donut"},{"id":"lineWithPoints.symbol.options.donut-plus","value":"donutPlus"}],"description":"lineWithPoints.symbol.description","type":"string"},"fillradar":{"trueLabel":"radar.trueLabel.fillArea","default":true,"falseLabel":"radar.falseLabel.fillArea","resetView":"layout","name":"lineWithPoints.fillradar.name","description":"lineWithPoints.fillradar.description","type":"boolean"},"size":{"default":100,"min":0,"resetView":"layout","name":"lineWithPoints.size.name","description":"lineWithPoints.size.description","type":"numeric"},"display":{"default":"line_points","resetView":"layout","name":"lineWithPoints.display.name","options":[{"id":"lineWithPoints.display.options.linePoints","value":"line_points"},{"id":"lineWithPoints.display.options.line","value":"line"},{"id":"lineWithPoints.display.options.points","value":"points"}],"description":"lineWithPoints.display.description","type":"string"},"interpolate":{"default":"linear-closed","resetView":"layout","name":"lineWithPoints.interpolate.name","options":[{"id":"lineWithPoints.interpolate.options.linear-closed","value":"linear-closed"},{"id":"lineWithPoints.interpolate.options.basis-closed","value":"basis-closed"},{"id":"lineWithPoints.interpolate.options.cardinal-closed","value":"cardinal-closed"}],"description":"lineWithPoints.interpolate.description","type":"string"}}}}},{"properties":{"axis":{"type":"object","properties":{"x":{"type":"object","properties":{"ticks":{"type":"object","properties":{"display":{"trueLabel":"axis.x.ticks.display.trueLabel","default":false,"falseLabel":"axis.x.ticks.display.falseLabel","name":"axis.x.ticks.display.name","description":"axis.x.ticks.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#eeeeee","name":"axis.x.ticks.style.stroke.name","description":"axis.x.ticks.style.stroke.description","type":"color"}}}}},"line":{"type":"object","properties":{"display":{"trueLabel":"axis.x.line.display.trueLabel","default":false,"falseLabel":"axis.x.line.display.falseLabel","name":"axis.x.line.display.name","description":"axis.x.line.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#eeeeee","name":"axis.x.line.style.stroke.name","description":"axis.x.line.style.stroke.description","type":"color"}}}}},"labels":{"type":"object","properties":{"display":{"trueLabel":"axis.x.labels.display.trueLabel","default":true,"falseLabel":"axis.x.labels.display.falseLabel","resetView":"layout","name":"axis.x.labels.display.name","description":"axis.x.labels.display.description","type":"boolean"},"style":{"type":"object","properties":{"font-size":{"default":null,"resetView":"layout","name":"axis.x.labels.style.font-size.name","description":"axis.x.labels.style.font-size.description","type":"string"},"font-family":{"default":null,"name":"axis.x.labels.style.font-family.name","description":"axis.x.labels.style.font-family.description","type":"string"},"fill":{"default":"#3c4646","name":"axis.x.labels.style.fill.name","description":"axis.x.labels.style.fill.description","type":"color"},"font":{"resetView":"layout","name":"axis.x.labels.style.font.name","description":"axis.x.labels.style.font.description","type":"font"}}},"zoomPan":{"trueLabel":"axis.x.labels.zoomPan.trueLabel","default":false,"falseLabel":"axis.x.labels.zoomPan.falseLabel","name":"axis.x.labels.zoomPan.name","description":"axis.x.labels.zoomPan.description","type":"boolean"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"x":{"type":"object","properties":{"scale":{"type":"object","properties":{"includeZero":{"trueLabel":"axis.x.scale.includeZero.trueLabel","default":false,"falseLabel":"axis.x.scale.includeZero.falseLabel","resetView":"layout","name":"axis.x.scale.includeZero.name","description":"axis.x.scale.includeZero.description","type":"boolean"},"nice":{"trueLabel":"axis.x.scale.nice.trueLabel","default":false,"falseLabel":"axis.x.scale.nice.falseLabel","resetView":"layout","name":"axis.x.scale.nice.name","description":"axis.x.scale.nice.description","type":"boolean"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"x":{"type":"object","properties":{"gridlines":{"type":"object","properties":{"display":{"trueLabel":"axis.x.gridlines.display.trueLabel","default":false,"falseLabel":"axis.x.gridlines.display.falseLabel","name":"axis.x.gridlines.display.name","description":"axis.x.gridlines.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke-dasharray":{"default":null,"name":"axis.x.gridlines.style.stroke-dasharray.name","description":"axis.x.gridlines.style.stroke-dasharray.description","type":"dasharray"},"stroke":{"default":"#dfe9e9","name":"axis.x.gridlines.style.stroke.name","description":"axis.x.gridlines.style.stroke.description","type":"color"}}}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"y":{"type":"object","properties":{"ticks":{"type":"object","properties":{"display":{"trueLabel":"axis.y.ticks.display.trueLabel","default":false,"falseLabel":"axis.y.ticks.display.falseLabel","name":"axis.y.ticks.display.name","description":"axis.y.ticks.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#eeeeee","name":"axis.y.ticks.style.stroke.name","description":"axis.y.ticks.style.stroke.description","type":"color"}}}}},"line":{"type":"object","properties":{"display":{"trueLabel":"axis.y.line.display.trueLabel","default":false,"falseLabel":"axis.y.line.display.falseLabel","name":"axis.y.line.display.name","description":"axis.y.line.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#eeeeee","name":"axis.y.line.style.stroke.name","description":"axis.y.line.style.stroke.description","type":"color"}}}}},"labels":{"type":"object","properties":{"display":{"trueLabel":"axis.y.labels.display.trueLabel","default":true,"falseLabel":"axis.y.labels.display.falseLabel","resetView":"layout","name":"axis.y.labels.display.name","description":"axis.y.labels.display.description","type":"boolean"},"style":{"type":"object","properties":{"font-size":{"default":null,"resetView":"layout","name":"axis.y.labels.style.font-size.name","description":"axis.y.labels.style.font-size.description","type":"string"},"font-family":{"default":null,"name":"axis.y.labels.style.font-family.name","description":"axis.y.labels.style.font-family.description","type":"string"},"fill":{"default":"#3c4646","name":"axis.y.labels.style.fill.name","description":"axis.y.labels.style.fill.description","type":"color"},"font":{"resetView":"layout","name":"axis.y.labels.style.font.name","description":"axis.y.labels.style.font.description","type":"font"}}},"zoomPan":{"trueLabel":"axis.y.labels.zoomPan.trueLabel","default":false,"falseLabel":"axis.y.labels.zoomPan.falseLabel","name":"axis.y.labels.zoomPan.name","description":"axis.y.labels.zoomPan.description","type":"boolean"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"y":{"type":"object","properties":{"scale":{"type":"object","properties":{"includeZero":{"trueLabel":"axis.y.scale.includeZero.trueLabel","default":false,"falseLabel":"axis.y.scale.includeZero.falseLabel","resetView":"layout","name":"axis.y.scale.includeZero.name","description":"axis.y.scale.includeZero.description","type":"boolean"},"nice":{"trueLabel":"axis.y.scale.nice.trueLabel","default":false,"falseLabel":"axis.y.scale.nice.falseLabel","resetView":"layout","name":"axis.y.scale.nice.name","description":"axis.y.scale.nice.description","type":"boolean"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"y":{"type":"object","properties":{"gridlines":{"type":"object","properties":{"display":{"trueLabel":"axis.y.gridlines.display.trueLabel","default":true,"falseLabel":"axis.y.gridlines.display.falseLabel","name":"axis.y.gridlines.display.name","description":"axis.y.gridlines.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke-dasharray":{"default":null,"name":"axis.y.gridlines.style.stroke-dasharray.name","description":"axis.y.gridlines.style.stroke-dasharray.description","type":"dasharray"},"stroke":{"default":"#dfe9e9","name":"axis.y.gridlines.style.stroke.name","description":"axis.y.gridlines.style.stroke.description","type":"color"}}}}}}}}}}},{"properties":{"layout":{"type":"object","properties":{"padding":{"default":"10","resetView":"layout","name":"layout.padding.name","description":"layout.padding.description","type":"padding"},"legendsize":{"type":"object","properties":{"min":{"default":"0","resetView":"layout","name":"layout.legendsize.min.name","description":"layout.legendsize.min.description","type":"length"},"max":{"default":"20%","resetView":"layout","name":"layout.legendsize.max.name","description":"layout.legendsize.max.description","type":"length"},"preferred":{"default":"20%","resetView":"layout","name":"layout.legendsize.preferred.name","description":"layout.legendsize.preferred.description","type":"length"}}},"legendchart":{"type":"object","properties":{"gap":{"default":"10","resetView":"layout","name":"layout.legendchart.gap.name","description":"layout.legendchart.gap.description","type":"length"},"align":{"default":false,"resetView":"layout","name":"layout.legendchart.align.name","description":"layout.legendchart.align.description","type":"boolean"}}},"chart":{"type":"object","properties":{"padding":{"type":"object","properties":{"top":{"default":"0","resetView":"layout","name":"layout.chart.padding.top.name","description":"layout.chart.padding.top.description","type":"length"},"left":{"default":"0","resetView":"layout","name":"layout.chart.padding.left.name","description":"layout.chart.padding.left.description","type":"length"},"bottom":{"default":"0","resetView":"layout","name":"layout.chart.padding.bottom.name","description":"layout.chart.padding.bottom.description","type":"length"},"right":{"default":"0","resetView":"layout","name":"layout.chart.padding.right.name","description":"layout.chart.padding.right.description","type":"length"}}}}}}}}},{"properties":{"background":{"type":"object","properties":{"elements":{"type":"object","properties":{"color":{"default":"#FFFFFF","name":"background.elements.color.name","description":"background.elements.color.description","type":"color"}}},"chart":{"type":"object","properties":{"color":{"default":"#FFFFFF","name":"background.chart.color.name","description":"background.chart.color.description","type":"color"}}}}}}},{"properties":{"legend":{"type":"object","properties":{"display":{"trueLabel":"legend.display.trueLabel","default":true,"falseLabel":"legend.display.falseLabel","resetView":"layout","name":"legend.display.name","description":"legend.display.description","type":"boolean"},"entrystyle":{"type":"object","properties":{"font":{"name":"legend.entrystyle.font.name","description":"legend.entrystyle.font.description","type":"font"}}},"position":{"default":"right","resetView":"layout","name":"legend.position.name","options":[{"id":"legend.position.options.top","value":"top"},{"id":"legend.position.options.bottom","value":"bottom"},{"id":"legend.position.options.right","value":"right"},{"id":"legend.position.options.left","value":"left"}],"description":"legend.position.description","type":"string"},"title":{"default":"","resetView":"layout","name":"legend.title.name","description":"legend.title.description","type":"string"},"titlestyle":{"type":"object","properties":{"fontfamily":{"default":null,"name":"legend.titlestyle.fontfamily.name","description":"legend.titlestyle.fontfamily.description","type":"string"},"fontsize":{"default":null,"resetView":"layout","name":"legend.titlestyle.fontsize.name","description":"legend.titlestyle.fontsize.description","type":"string"},"fill":{"default":null,"name":"legend.titlestyle.fill.name","description":"legend.titlestyle.fill.description","type":"color"},"font":{"resetView":"layout","name":"legend.titlestyle.font.name","description":"legend.titlestyle.font.description","type":"font"}}}}}}},{"comment":"All the x1 (independent) axis properties except for the gridlines","properties":{"axis":{"type":"object","properties":{"x":{"type":"object","properties":{"ticks":{"type":"object","properties":{"display":{"trueLabel":"axis.x.ticks.display.trueLabel","default":true,"falseLabel":"axis.x.ticks.display.falseLabel","resetView":"layout","name":"axis.x.ticks.display.name","description":"axis.x.ticks.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#777777","resetView":"layout","name":"axis.x.ticks.style.stroke.name","description":"axis.x.ticks.style.stroke.description","type":"color"}}}}},"line":{"type":"object","properties":{"display":{"trueLabel":"axis.x.line.display.trueLabel","default":true,"falseLabel":"axis.x.line.display.falseLabel","resetView":"layout","name":"axis.x.line.display.name","description":"axis.x.line.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#777777","resetView":"layout","name":"axis.x.line.style.stroke.name","description":"axis.x.line.style.stroke.description","type":"color"}}}}},"scale":{"type":"object","properties":{"nice":{"trueLabel":"axis.x.scale.nice.trueLabel","default":true,"falseLabel":"axis.x.scale.nice.falseLabel","resetView":"layout","name":"axis.x.scale.nice.name","description":"axis.x.scale.nice.description","type":"boolean"}}},"gridlines":{"type":"object","properties":{"display":{"trueLabel":"axis.x.gridlines.display.trueLabel","default":true,"falseLabel":"axis.x.gridlines.display.falseLabel","resetView":"layout","name":"axis.x.gridlines.display.name","description":"axis.x.gridlines.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#777777","resetView":"layout","name":"axis.x.gridlines.style.stroke.name","description":"axis.x.gridlines.style.stroke.description","type":"color"}}}}}}},"y":{"type":"object","properties":{"ticks":{"type":"object","properties":{"display":{"trueLabel":"axis.y.ticks.display.trueLabel","default":true,"falseLabel":"axis.y.ticks.display.falseLabel","resetView":"layout","name":"axis.y.ticks.display.name","description":"axis.y.ticks.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#777777","resetView":"layout","name":"axis.y.ticks.style.stroke.name","description":"axis.y.ticks.style.stroke.description","type":"color"}}}}},"line":{"type":"object","properties":{"display":{"trueLabel":"axis.y.line.display.trueLabel","default":true,"falseLabel":"axis.y.line.display.falseLabel","resetView":"layout","name":"axis.y.line.display.name","description":"axis.y.line.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#777777","resetView":"layout","name":"axis.y.line.style.stroke.name","description":"axis.y.line.style.stroke.description","type":"color"}}}}},"scale":{"type":"object","properties":{"nice":{"trueLabel":"axis.y.scale.nice.trueLabel","default":true,"falseLabel":"axis.y.scale.nice.falseLabel","resetView":"layout","name":"axis.y.scale.nice.name","description":"axis.y.scale.nice.description","type":"boolean"}}},"gridlines":{"type":"object","properties":{"display":{"trueLabel":"axis.y.gridlines.display.trueLabel","default":true,"falseLabel":"axis.y.gridlines.display.falseLabel","resetView":"layout","name":"axis.y.gridlines.display.name","description":"axis.y.gridlines.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#777777","resetView":"layout","name":"axis.y.gridlines.style.stroke.name","description":"axis.y.gridlines.style.stroke.description","type":"color"}}}}}}}}}}},{"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":"background.chart.color"},{"propertyID":"color.palette"},{"propertyID":"legend.display"},{"propertyID":"legend.position"},{"propertyID":"legend.title"}],"icon":"","description":"propertyPresentation.simple.description","id":"simple","label":"propertyPresentation.simple.label","tags":["Radar","Radar 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":"lineWithPoints.display"},{"propertyID":"lineWithPoints.fillradar"},{"propertyID":"lineWithPoints.size"},{"propertyID":"lineWithPoints.symbol"}],"icon":"","description":"radar.propertyPresentation.advanced.radarSpecificProperties.description","id":"radarSpecificProperties","label":"radar.propertyPresentation.advanced.radarSpecificProperties.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":["Radar","Radar Properties Presentation","advanced","ca.reporting"]}]},{"configurations":[{"dataSlots":[{"dataTypes":["string"],"dataModelId":"tabular","dataSetId":"data","dataSlotId":"x","tags":["ca.chart.definition.categoryValues=indexedFull"]},{"dataTypes":["string"],"dataModelId":"tabular","dataSetId":"data","dataSlotId":"color","tags":["ca.chart.definition.categoryValues=indexedFull"]},{"dataTypes":["numeric"],"dataModelId":"tabular","dataSetId":"data","dataSlotId":"y","tags":["ca.chart.definition.supportsRange=true"]},{"dataModelId":"tabular","dataSetId":"data","hidden":true,"dataSlotId":"key"}],"previews":{"image":[{"file":"resources\/radar_icon_48.png","tags":["small","nocolor"]},{"file":"resources\/radar_preview_320.png","tags":["medium","color"]},{"file":"resources\/radar_preview_500.png","tags":["large","nocolor"]}],"svg":[{"file":"resources\/radar_icon_48.svg","tags":["small","nocolor"]},{"file":"resources\/radar_preview_320.svg","tags":["medium","color"]},{"file":"resources\/radar_preview_500.svg","tags":["large","nocolor"]}]},"genericMeta":{"description":"radar.config.radar.description","id":"radar","label":"radar.config.radar.label","tags":["ca.reporting"]},"properties":[{"id":"layout.padding","value":"padding-top:10;padding-left:10;padding-bottom:10;padding-right:10"}]}]},{"build":"development","name":"rave-library-radar","description":"This is the IBM Rave radar bundle.","ignore":["bower.json"],"main":"bundle.js","version":"1.0.0","dependencies":{"rave-legends":"<2.0.0","rave-library":"<2.0.0","rave":"<3.0.0","rave-layouts":"<2.0.0","rave-utilities":"<2.0.0"}}]
  12. },{}],2:[function(require,module,exports){
  13. module.exports={
  14. "actions.applyHighlight.description": "Highlights a node.",
  15. "actions.applyHighlight.label": "Apply highlight action",
  16. "actions.applySelection.description": "Selects a node.",
  17. "actions.applySelection.label": "Apply selection action",
  18. "actions.args.attributes.description": "Optional map of attribute to value that is applied during the action.",
  19. "actions.args.attributes.label": "Optional attributes function argument",
  20. "actions.args.primaryAttributes.description": "Optional map of primary attributes that are applied during the action.",
  21. "actions.args.primaryAttributes.label": "Optional primary attributes function argument",
  22. "actions.args.primarySelector.description": "Primary selector for the nodes that the action is to apply to.",
  23. "actions.args.primarySelector.label": "Primary selector function argument",
  24. "actions.args.secondaryAttributes.description": "Optional map of secondary attributes that are applied during the action.",
  25. "actions.args.secondaryAttributes.label": "Optional secondary attributes function argument",
  26. "actions.args.secondarySelector.description": "Secondary selector for the nodes that the action is to apply to.",
  27. "actions.args.secondarySelector.label": "Secondary selector function argument",
  28. "actions.args.selector.description": "Selector of the node that the action will apply to.",
  29. "actions.args.selector.label": "Selector function argument",
  30. "actions.breadCrumb.description": "Navigates up and down in detail through a bread crumb.",
  31. "actions.breadCrumb.label": "Bread crumb navigation action",
  32. "actions.chord.selector.description": "Selector for the chords that the action will apply to.",
  33. "actions.chord.selector.label": "Selector function argument for chords",
  34. "actions.chord.toggleSelect.description": "Toggles selection on a chord.",
  35. "actions.chord.toggleSelect.label": "Toggle select on chord action",
  36. "actions.chordGroup.highlight.description": "Highlights a chord group and everything that is connected to it.",
  37. "actions.chordGroup.highlight.label": "Chord group highlight action",
  38. "actions.chordGroup.removeHighlight.description": "Removes highlights from a chord group and everything connected to it.",
  39. "actions.chordGroup.removeHighlight.label": "Chord group remove highlight action",
  40. "actions.chordGroup.selector.description": "Selector for the chord groups that the action will apply to.",
  41. "actions.chordGroup.selector.label": "Selector function argument for chord groups",
  42. "actions.drillDown.description": "Drills down to the next level of detail.",
  43. "actions.drillDown.label": "Drill down action",
  44. "actions.removeAllSelect.description": "Removes all selections from all nodes.",
  45. "actions.removeAllSelect.label": "Remove all selections action",
  46. "actions.removeHighlight.description": "Removes a highlight from a node.",
  47. "actions.removeHighlight.label": "Remove highlight action",
  48. "actions.removeSelection.description": "Removes a selection from a node.",
  49. "actions.removeSelection.label": "Remove selection action",
  50. "actions.toggleSelect.description": "Toggles the selection on a node.",
  51. "actions.toggleSelect.label": "Toggle selection action",
  52. "actions.zoom.args.panX.description": "The amount to pan in the x direction.",
  53. "actions.zoom.args.panX.label": "Zoom x pan amount function argument",
  54. "actions.zoom.args.panY.description": "The amount to pan in the y direction.",
  55. "actions.zoom.args.panY.label": "Zoom y pan amount function argument",
  56. "actions.zoom.args.scale.description": "The scale amount for the zoom action.",
  57. "actions.zoom.args.scale.label": "Zoom scale function argument",
  58. "actions.zoom.description": "Zoom action",
  59. "actions.zoom.label": "Zoom action",
  60. "actions.zoomPackedBubble.description": "Zoom for a packed bubble.",
  61. "actions.zoomPackedBubble.label": "Zoom packed bubble action",
  62. "axis.x.gridlines.display.description": "Shows or hides the X-axis gridlines.",
  63. "axis.x.gridlines.display.falseLabel": "Hide",
  64. "axis.x.gridlines.display.name": "Show gridlines",
  65. "axis.x.gridlines.display.trueLabel": "Show",
  66. "axis.x.gridlines.style.stroke-dasharray.description": "The dash pattern that is applied to the X-axis gridlines.",
  67. "axis.x.gridlines.style.stroke-dasharray.name": "Gridline dash pattern",
  68. "axis.x.gridlines.style.stroke.description": "The color of the X-axis gridline.",
  69. "axis.x.gridlines.style.stroke.name": "Gridline color",
  70. "axis.x.labels.allowRotate45.description": "Enables or disables the rotate45 option for labels automatic layout.",
  71. "axis.x.labels.allowRotate45.falseLabel": "Disable rotate45 option",
  72. "axis.x.labels.allowRotate45.name": "Allow rotate 45",
  73. "axis.x.labels.allowRotate45.trueLabel": "Enable rotate45 option",
  74. "axis.x.labels.allowRotate90.description": "Enables or disables the rotate90 option for labels automatic layout.",
  75. "axis.x.labels.allowRotate90.falseLabel": "Disable rotate90 option",
  76. "axis.x.labels.allowRotate90.name": "Allow rotate 90",
  77. "axis.x.labels.allowRotate90.trueLabel": "Enable rotate90 option",
  78. "axis.x.labels.allowStagger.description": "Allows the stagger option for labels automatic layout.",
  79. "axis.x.labels.allowStagger.falseLabel": "X-axis do not allow stagger",
  80. "axis.x.labels.allowStagger.name": "Allow stagger",
  81. "axis.x.labels.allowStagger.trueLabel": "X-axis allow stagger",
  82. "axis.x.labels.display.description": "Shows or hides the X-axis labels.",
  83. "axis.x.labels.display.falseLabel": "Hide",
  84. "axis.x.labels.display.name": "Show labels",
  85. "axis.x.labels.display.trueLabel": "Show",
  86. "axis.x.labels.layoutMode.description": "Configure the layout mode for the X-axis labels.",
  87. "axis.x.labels.layoutMode.name": "Layout Mode",
  88. "axis.x.labels.layoutMode.options.automatic": "Automatic",
  89. "axis.x.labels.layoutMode.options.horizontal": "Horizontal",
  90. "axis.x.labels.layoutMode.options.rotate45": "Rotated 45 degrees",
  91. "axis.x.labels.layoutMode.options.rotate90": "Rotated 90 degrees",
  92. "axis.x.labels.layoutMode.options.stagger": "Stagger",
  93. "axis.x.labels.style.fill.description": "The color of X-axis labels.",
  94. "axis.x.labels.style.fill.name": "Label color",
  95. "axis.x.labels.style.font-family.description": "The font families of the X-axis labels.",
  96. "axis.x.labels.style.font-family.name": "Label font families",
  97. "axis.x.labels.style.font-size.description": "The size of X-axis labels (CSS size).",
  98. "axis.x.labels.style.font-size.name": "Label font size",
  99. "axis.x.labels.style.font.description": "The font properties of X-axis labels (CSS styles).",
  100. "axis.x.labels.style.font.name": "Label font",
  101. "axis.x.labels.zoomPan.description": "Shows or hides X-axis labels when panning and zooming.",
  102. "axis.x.labels.zoomPan.falseLabel": "Show",
  103. "axis.x.labels.zoomPan.name": "Label pan-zoom",
  104. "axis.x.labels.zoomPan.trueLabel": "Hide",
  105. "axis.x.line.display.description": "Shows or hides the X-axis line.",
  106. "axis.x.line.display.falseLabel": "Hide",
  107. "axis.x.line.display.name": "Show line",
  108. "axis.x.line.display.trueLabel": "Show",
  109. "axis.x.line.style.stroke.description": "The color of the X-axis line.",
  110. "axis.x.line.style.stroke.name": "Line color",
  111. "axis.x.scale.includeZero.description": "When set to Yes, includes 0 on the X-axis.",
  112. "axis.x.scale.includeZero.falseLabel": "Do not include",
  113. "axis.x.scale.includeZero.name": "Includes zero",
  114. "axis.x.scale.includeZero.trueLabel": "Include",
  115. "axis.x.scale.max.description": "The maximum value that appears on the X-axis.",
  116. "axis.x.scale.max.name": "Maximum value",
  117. "axis.x.scale.min.description": "The minimum value that appears on the X-axis.",
  118. "axis.x.scale.min.name": "Minimum value",
  119. "axis.x.scale.nice.description": "When set to Yes, uses nice endpoint values on the X-axis.",
  120. "axis.x.scale.nice.falseLabel": "Do not nice",
  121. "axis.x.scale.nice.name": "Nicing",
  122. "axis.x.scale.nice.trueLabel": "Apply nicing",
  123. "axis.x.ticks.display.description": "Shows or hides the X-axis tick marks.",
  124. "axis.x.ticks.display.falseLabel": "Hide",
  125. "axis.x.ticks.display.name": "Show ticks",
  126. "axis.x.ticks.display.trueLabel": "Show",
  127. "axis.x.ticks.style.stroke.description": "The color of the X-axis ticks.",
  128. "axis.x.ticks.style.stroke.name": "Tick color",
  129. "axis.x.title.display.description": "Shows or hides the X-axis title.",
  130. "axis.x.title.display.falseLabel": "Hide",
  131. "axis.x.title.display.name": "Show title",
  132. "axis.x.title.display.trueLabel": "Show",
  133. "axis.x.title.style.fill.description": "The color of the X-axis title.",
  134. "axis.x.title.style.fill.name": "Title color",
  135. "axis.x.title.style.font-family.description": "The font family names of the X-axis title.",
  136. "axis.x.title.style.font-family.name": "Title font families",
  137. "axis.x.title.style.font-size.description": "The X-axis title font size (CSS size).",
  138. "axis.x.title.style.font-size.name": "Title font size",
  139. "axis.x.title.style.font.description": "The X-axis title font properties (CSS style).",
  140. "axis.x.title.style.font.name": "Title font",
  141. "axis.x.title.text.description": "The title of the X-axis.",
  142. "axis.x.title.text.name": "Title",
  143. "axis.y.gridlines.display.description": "Shows or hides the Y-axis gridlines.",
  144. "axis.y.gridlines.display.falseLabel": "Hide",
  145. "axis.y.gridlines.display.name": "Show gridlines",
  146. "axis.y.gridlines.display.trueLabel": "Show",
  147. "axis.y.gridlines.style.stroke-dasharray.description": "The dash pattern that is applied to the Y-axis gridlines.",
  148. "axis.y.gridlines.style.stroke-dasharray.name": "Gridline dash pattern",
  149. "axis.y.gridlines.style.stroke.description": "The color of the Y-axis gridline.",
  150. "axis.y.gridlines.style.stroke.name": "Gridline color",
  151. "axis.y.labels.display.description": "Shows or hides the Y-axis labels.",
  152. "axis.y.labels.display.falseLabel": "Hide",
  153. "axis.y.labels.display.name": "Show labels",
  154. "axis.y.labels.display.trueLabel": "Show",
  155. "axis.y.labels.layoutMode.description": "Configure the layout mode for the Y-axis labels.",
  156. "axis.y.labels.layoutMode.name": "Layout Mode",
  157. "axis.y.labels.layoutMode.options.horizontal": "Horizontal",
  158. "axis.y.labels.layoutMode.options.rotate90": "Rotated 90 degrees",
  159. "axis.y.labels.style.fill.description": "The color of Y-axis labels.",
  160. "axis.y.labels.style.fill.name": "Label color",
  161. "axis.y.labels.style.font-family.description": "The font families of the Y-axis labels.",
  162. "axis.y.labels.style.font-family.name": "Label font families",
  163. "axis.y.labels.style.font-size.description": "The size of Y-axis labels (CSS size).",
  164. "axis.y.labels.style.font-size.name": "Label font size",
  165. "axis.y.labels.style.font.description": "The font properties of Y-axis labels (CSS styles).",
  166. "axis.y.labels.style.font.name": "Label font",
  167. "axis.y.labels.zoomPan.description": "Shows or hides Y-axis labels when panning and zooming.",
  168. "axis.y.labels.zoomPan.falseLabel": "Show",
  169. "axis.y.labels.zoomPan.name": "Label pan-zoom",
  170. "axis.y.labels.zoomPan.trueLabel": "Hide",
  171. "axis.y.line.display.description": "Shows or hides the Y-axis line.",
  172. "axis.y.line.display.falseLabel": "Hide",
  173. "axis.y.line.display.name": "Show line",
  174. "axis.y.line.display.trueLabel": "Show",
  175. "axis.y.line.style.stroke.description": "The color of the Y-axis line.",
  176. "axis.y.line.style.stroke.name": "Line color",
  177. "axis.y.scale.includeZero.description": "When set to Yes, includes 0 on the Y-axis.",
  178. "axis.y.scale.includeZero.falseLabel": "Do not include",
  179. "axis.y.scale.includeZero.name": "Includes zero",
  180. "axis.y.scale.includeZero.trueLabel": "Include",
  181. "axis.y.scale.max.description": "The maximum value that appears on the Y-axis.",
  182. "axis.y.scale.max.name": "Maximum value",
  183. "axis.y.scale.min.description": "The minimum value tha appears on the Y-axis.",
  184. "axis.y.scale.min.name": "Minimum value",
  185. "axis.y.scale.nice.description": "When set to Yes, uses nice endpoint values on the Y-axis.",
  186. "axis.y.scale.nice.falseLabel": "Do not nice",
  187. "axis.y.scale.nice.name": "Nicing",
  188. "axis.y.scale.nice.trueLabel": "Apply nicing",
  189. "axis.y.ticks.display.description": "Shows or hides the Y-axis tick marks.",
  190. "axis.y.ticks.display.falseLabel": "Hide",
  191. "axis.y.ticks.display.name": "Show ticks",
  192. "axis.y.ticks.display.trueLabel": "Show",
  193. "axis.y.ticks.style.stroke.description": "The color of the Y-axis ticks.",
  194. "axis.y.ticks.style.stroke.name": "Tick color",
  195. "axis.y.title.display.description": "Shows or hides the Y-axis title.",
  196. "axis.y.title.display.falseLabel": "Hide",
  197. "axis.y.title.display.name": "Show title",
  198. "axis.y.title.display.trueLabel": "Show",
  199. "axis.y.title.style.fill.description": "The color of the Y-axis title.",
  200. "axis.y.title.style.fill.name": "Title color",
  201. "axis.y.title.style.font-family.description": "The font family names of the Y-axis title.",
  202. "axis.y.title.style.font-family.name": "Title font families",
  203. "axis.y.title.style.font-size.description": "The size of the Y-axis title font (CSS size).",
  204. "axis.y.title.style.font-size.name": "Title font size",
  205. "axis.y.title.style.font.description": "The Y-axis title font properties (CSS styles).",
  206. "axis.y.title.style.font.name": "Title font",
  207. "axis.y.title.text.description": "The title of the Y-axis.",
  208. "axis.y.title.text.name": "Title",
  209. "background.chart.color.description": "The background color of the chart.",
  210. "background.chart.color.name": "Background color",
  211. "background.color.description": "The background color behind the elements of the chart.",
  212. "background.elements.color.description": "The background color behind the elements of the chart.",
  213. "background.elements.color.name": "Elements background color",
  214. "color.palette.description": "The color palette that controls the colors or patterns that are applied to data elements in the chart.",
  215. "color.palette.name": "Color palette",
  216. "data.handling.description": "The configuration that is used to plot the data.",
  217. "data.handling.name": "Configuration",
  218. "data.handling.options.None": "None",
  219. "data.handling.options.Stacked": "Stacked",
  220. "data.handling.options.Stacked100": "Stacked 100%",
  221. "datamodel.hierarchial.label": "Hierarchical data model",
  222. "datamodel.tabular.label": "Tabular data model",
  223. "datamodel.tabular.radar.description": "The tabular radar model, where each entry is a point on the radar chart with x, y, and optional group. The group value is used to group the points into lines.",
  224. "dataset.hierarchial.label": "Hierarchical data set",
  225. "dataset.tabular.description": "The tabular data set of rows and columns.",
  226. "dataset.tabular.label": "Tabular data set",
  227. "dataset.tabular.link.description": "Determines the links between the nodes.",
  228. "dataset.tabular.link.label": "Tabular links data set",
  229. "dataset.tabular.node.description": "The tabular data set that defines the nodes.",
  230. "dataset.tabular.node.label": "Tabular node data set",
  231. "dataslot.categories.label": "Categories",
  232. "dataslot.category.label": "Category",
  233. "dataslot.children.description": "When applied to a tree node, returns the children of that node as an array-list.",
  234. "dataslot.children.label": "Children",
  235. "dataslot.color.description": "Determines the color of the shape.",
  236. "dataslot.color.label": "Color",
  237. "dataslot.color.radar.description": "A group that is used to combine points into polygons. If a group is not specified, all points are connected in one polygon. Groups are also used for the polygon stroke color.",
  238. "dataslot.key.description": "Called for each row to match elements. Primarily used for transitions.",
  239. "dataslot.key.label": "Key",
  240. "dataslot.label.description": "Determines the label of the shape.",
  241. "dataslot.label.label": "Label",
  242. "dataslot.maximumValue.label": "Maximum value",
  243. "dataslot.source.label": "Source",
  244. "dataslot.sourceValue.label": "Source value",
  245. "dataslot.tabular.id.description": "The identifier for the nodes.",
  246. "dataslot.tabular.id.label": "Identifier",
  247. "dataslot.tabular.size.description": "Determines the size of the shape.",
  248. "dataslot.tabular.size.label": "Size",
  249. "dataslot.target.label": "Target",
  250. "dataslot.targetValue.label": "Target value",
  251. "dataslot.value.label": "Value",
  252. "dataslot.x.label": "X axis",
  253. "dataslot.x.radar.description": "The x coordinate of the point (spoke). The value must be a string.",
  254. "dataslot.y.label": "Y axis",
  255. "dataslot.y.radar.description": "The y coordinate of the point (data length of spoke). The value must be a number.",
  256. "defaultPalette.description": "Rave2 default description",
  257. "defaultPalette.label": "Rave2 default",
  258. "effect.duration.description": "The animation duration, in ms.",
  259. "effect.duration.name": "Animation duration (ms)",
  260. "effect.name.description": "The effect that is used when the chart is drawn.",
  261. "effect.name.name": "Animation",
  262. "effect.name.options.none": "None",
  263. "effect.name.options.transition": "Transition",
  264. "layout.axissize.bottom.max.description": "The maximum size of the bottom axis, as a CSS size or percentage.",
  265. "layout.axissize.bottom.max.name": "Bottom axis maximum size",
  266. "layout.axissize.bottom.min.description": "The minimum size of the bottom axis, as a CSS size or percentage.",
  267. "layout.axissize.bottom.min.name": "Bottom axis minimum size",
  268. "layout.axissize.bottom.preferred.description": "The preferred size of the bottom axis, as a CSS size or percentage.",
  269. "layout.axissize.bottom.preferred.name": "Bottom axis preferred size",
  270. "layout.axissize.left.max.description": "The maximum size of the left axis, as a CSS size or percentage.",
  271. "layout.axissize.left.max.name": "Left axis maximum size",
  272. "layout.axissize.left.min.description": "The minimum size of the left axis, as a CSS size or percentage.",
  273. "layout.axissize.left.min.name": "Left axis minimum size",
  274. "layout.axissize.left.preferred.description": "The preferred size of the left axis, as a CSS size or percentage.",
  275. "layout.axissize.left.preferred.name": "Left axis preferred size",
  276. "layout.axissize.right.max.description": "The maximum size of the right axis, as a CSS size or percentage.",
  277. "layout.axissize.right.max.name": "Right axis maximum size",
  278. "layout.axissize.right.min.description": "The minimum size of the right axis, as a CSS size or percentage.",
  279. "layout.axissize.right.min.name": "Right axis minimum size",
  280. "layout.axissize.right.preferred.description": "The preferred size of the right axis, as a CSS size or percentage.",
  281. "layout.axissize.right.preferred.name": "Right axis preferred size",
  282. "layout.axissize.top.max.description": "The maximum size of the top axis, as a CSS size or percentage.",
  283. "layout.axissize.top.max.name": "Top axis maximum size",
  284. "layout.axissize.top.min.description": "The minimum size of the top axis, as a CSS size or percentage.",
  285. "layout.axissize.top.min.name": "Top axis minimum size",
  286. "layout.axissize.top.preferred.description": "The preferred size of the top axis, as a CSS size or percentage.",
  287. "layout.axissize.top.preferred.name": "Top axis preferred size",
  288. "layout.chart.padding.bottom.description": "The bottom padding for the chart.",
  289. "layout.chart.padding.bottom.name": "Bottom padding",
  290. "layout.chart.padding.left.description": "The left padding for the chart.",
  291. "layout.chart.padding.left.name": "Left padding",
  292. "layout.chart.padding.right.description": "Right padding for the chart.",
  293. "layout.chart.padding.right.name": "Right padding",
  294. "layout.chart.padding.top.description": "The top padding for the chart.",
  295. "layout.chart.padding.top.name": "Top padding",
  296. "layout.legendchart.align.description": "Whether to align the legend to the interior of the chart.",
  297. "layout.legendchart.align.name": "Align legend to chart",
  298. "layout.legendchart.gap.description": "Space between the chart and the legend, as a CSS size or percentage.",
  299. "layout.legendchart.gap.name": "Space between legend and chart",
  300. "layout.legendsize.max.description": "The maximum size of the legend, as a CSS size or percentage.",
  301. "layout.legendsize.max.name": "Maximum size",
  302. "layout.legendsize.min.description": "The minimum size of the legend, as a CSS size or percentage.",
  303. "layout.legendsize.min.name": "Minimum size",
  304. "layout.legendsize.preferred.description": "The preferred size of the legend, as a CSS size or percentage.",
  305. "layout.legendsize.preferred.name": "Preferred size",
  306. "layout.padding.description": "The padding around the chart and legend.",
  307. "layout.padding.name": "Padding",
  308. "legend.display.description": "Shows or hides the legend.",
  309. "legend.display.falseLabel": "Hide",
  310. "legend.display.name": "Show legend",
  311. "legend.display.trueLabel": "Show",
  312. "legend.entrystyle.font.description": "The font properties of the legend entry.",
  313. "legend.entrystyle.font.name": "Entry font",
  314. "legend.position.description": "The position of the legend in the chart.",
  315. "legend.position.name": "Legend position",
  316. "legend.position.options.bottom": "Bottom",
  317. "legend.position.options.left": "Left",
  318. "legend.position.options.right": "Right",
  319. "legend.position.options.top": "Top",
  320. "legend.title.description": "The title of the legend.",
  321. "legend.title.name": "Title",
  322. "legend.titlestyle.fill.description": "The color of the legend title.",
  323. "legend.titlestyle.fill.name": "Title color",
  324. "legend.titlestyle.font.description": "The font properties of the legend title.",
  325. "legend.titlestyle.font.name": "Title font",
  326. "legend.titlestyle.fontfamily.description": "The font family of the legend title.",
  327. "legend.titlestyle.fontfamily.name": "Title font family",
  328. "legend.titlestyle.fontsize.description": "The font size of the legend title.",
  329. "legend.titlestyle.fontsize.name": "Title font size",
  330. "lineWithPoints.display.description": "Shows line and points, line only, or points only.",
  331. "lineWithPoints.display.name": "Chart display mode",
  332. "lineWithPoints.display.options.line": "Line(s) only",
  333. "lineWithPoints.display.options.linePoints": "Line and points",
  334. "lineWithPoints.display.options.points": "Points only",
  335. "lineWithPoints.fillradar.description": "Fills the radar, making it an area representation instead of a line representation.",
  336. "lineWithPoints.fillradar.name": "Show chart as area chart",
  337. "lineWithPoints.interpolate.description": "Controls how the lines are drawn.",
  338. "lineWithPoints.interpolate.name": "Interpolation mode",
  339. "lineWithPoints.interpolate.options.basis-closed": "Basis-closed",
  340. "lineWithPoints.interpolate.options.cardinal-closed": "Cardinal-closed",
  341. "lineWithPoints.interpolate.options.linear-closed": "Linear-closed",
  342. "lineWithPoints.size.description": "The size, in square pixels, of the line-with-points symbol.",
  343. "lineWithPoints.size.name": "Line-with-points size",
  344. "lineWithPoints.symbol.description": "The shape that is used for the line-with-points symbol.",
  345. "lineWithPoints.symbol.name": "Line-with-points symbol",
  346. "lineWithPoints.symbol.options.circle": "Circle",
  347. "lineWithPoints.symbol.options.cross": "Cross",
  348. "lineWithPoints.symbol.options.diamond": "Diamond",
  349. "lineWithPoints.symbol.options.donut": "Donut",
  350. "lineWithPoints.symbol.options.donut-plus": "Donut-plus",
  351. "lineWithPoints.symbol.options.horizontal-rectangle": "Horizontal-rectangle",
  352. "lineWithPoints.symbol.options.rectangle": "Rectangle",
  353. "lineWithPoints.symbol.options.square": "Square",
  354. "lineWithPoints.symbol.options.star": "Star",
  355. "lineWithPoints.symbol.options.triangle-down": "Triangle-down",
  356. "lineWithPoints.symbol.options.triangle-left": "Triangle-left",
  357. "lineWithPoints.symbol.options.triangle-right": "Triangle-right",
  358. "lineWithPoints.symbol.options.triangle-up": "Triangle-up",
  359. "lineWithPoints.symbol.options.vertical-rectangle": "Vertical-rectangle",
  360. "propertyPresentation.advanced.axisSizeProperties.description": "Axis size properties.",
  361. "propertyPresentation.advanced.axisSizeProperties.label": "Axis size",
  362. "propertyPresentation.advanced.clientBehaviorProperties.description": "Client side properties.",
  363. "propertyPresentation.advanced.clientBehaviorProperties.label": "Client behavior",
  364. "propertyPresentation.advanced.commonProperties.description": "Common properties.",
  365. "propertyPresentation.advanced.commonProperties.label": "Common",
  366. "propertyPresentation.advanced.description": "Advanced list of all properties in a grouped structure.",
  367. "propertyPresentation.advanced.label": "Advanced",
  368. "propertyPresentation.advanced.labelProperties.description": "Label properties",
  369. "propertyPresentation.advanced.labelProperties.label": "Label",
  370. "propertyPresentation.advanced.legendProperties.description": "Legend properties.",
  371. "propertyPresentation.advanced.legendProperties.label": "Legend",
  372. "propertyPresentation.advanced.xAxisProperties.description": "X-axis properties.",
  373. "propertyPresentation.advanced.xAxisProperties.label": "X-axis",
  374. "propertyPresentation.advanced.yAxisProperties.description": "Y-axis properties.",
  375. "propertyPresentation.advanced.yAxisProperties.label": "Y-axis",
  376. "propertyPresentation.simple.description": "Simple list of the most common properties.",
  377. "propertyPresentation.simple.label": "Simple",
  378. "radar.config.radar.description": "Radar charts integrate multiple axes into a single radial figure. For each figure, data is plotted along a separate axis that starts at the center of the chart.",
  379. "radar.config.radar.label": "Radar",
  380. "radar.description": "Radar charts integrate multiple axes into a single radial figure. For each figure, data is plotted along a separate axis that starts at the center of the chart.",
  381. "radar.falseLabel.fillArea": "Show area",
  382. "radar.falseLabel.nullpointnull": "Line only",
  383. "radar.label": "Radar",
  384. "radar.propertyPresentation.advanced.radarSpecificProperties.description": "Radar-specific properties",
  385. "radar.propertyPresentation.advanced.radarSpecificProperties.label": "Radar",
  386. "radar.trueLabel.fillArea": "Show line",
  387. "radar.trueLabel.nullpointnull": "Line with points",
  388. "rave2.colorpalette.blueContinuousSequential.description": "Blue continuous sequential description",
  389. "rave2.colorpalette.blueContinuousSequential.label": "Blue continuous sequential",
  390. "rave2.colorpalette.blueDiscreteSequential.description": "Blue discrete sequential description",
  391. "rave2.colorpalette.blueDiscreteSequential.label": "Blue discrete sequential",
  392. "rave2.colorpalette.blueGreenContinuousDivergent.description": "Blue green continuous divergent description",
  393. "rave2.colorpalette.blueGreenContinuousDivergent.label": "Blue green continuous divergent",
  394. "rave2.colorpalette.blueGreenDiscreteDivergent.description": "Blue green discrete divergent description",
  395. "rave2.colorpalette.blueGreenDiscreteDivergent.label": "Blue green discrete divergent",
  396. "rave2.colorpalette.dark.description": "Dark description",
  397. "rave2.colorpalette.dark.label": "Dark",
  398. "rave2.colorpalette.financial.description": "Financial description",
  399. "rave2.colorpalette.financial.label": "Financial",
  400. "rave2.colorpalette.greenContinuousSequential.description": "Green continuous sequential description",
  401. "rave2.colorpalette.greenContinuousSequential.label": "Green continuous sequential",
  402. "rave2.colorpalette.greenDiscreteSequential.description": "Green discrete sequential description",
  403. "rave2.colorpalette.greenDiscreteSequential.label": "Green discrete sequential",
  404. "rave2.colorpalette.light.description": "Light description",
  405. "rave2.colorpalette.light.label": "Light",
  406. "rave2.colorpalette.medical.description": "Medical description",
  407. "rave2.colorpalette.medical.label": "Medical",
  408. "rave2.colorpalette.orangeContinuousSequential.description": "Orange continuous sequential description",
  409. "rave2.colorpalette.orangeContinuousSequential.label": "Orange continuous sequential",
  410. "rave2.colorpalette.orangeDiscreteSequential.description": "Orange discrete sequential description",
  411. "rave2.colorpalette.orangeDiscreteSequential.label": " Orange discrete sequential",
  412. "rave2.colorpalette.purpleContinuousSequential.description": "Purple continuous sequential description",
  413. "rave2.colorpalette.purpleContinuousSequential.label": "Purple continuous sequential",
  414. "rave2.colorpalette.purpleDiscreteSequential.description": "Purple discrete sequential description",
  415. "rave2.colorpalette.purpleDiscreteSequential.label": "Purple discrete sequential",
  416. "rave2.colorpalette.redBlueContinuousDivergent.description": "Red blue continuous divergent description",
  417. "rave2.colorpalette.redBlueContinuousDivergent.label": "Red blue continuous divergent",
  418. "rave2.colorpalette.redBlueDiscreteDivergent.description": "Red blue discrete divergent description",
  419. "rave2.colorpalette.redBlueDiscreteDivergent.label": "Red blue discrete divergent",
  420. "rave2.colorpalette.redBlueInverseContinuousDivergent.description": "Red blue inverse continuous divergent description",
  421. "rave2.colorpalette.redBlueInverseContinuousDivergent.label": "Red blue inverse continuous divergent",
  422. "rave2.colorpalette.redBlueInverseDiscreteDivergent.description": "Red blue inverse discrete divergent description",
  423. "rave2.colorpalette.redBlueInverseDiscreteDivergent.label": "Red blue inverse discrete divergent",
  424. "rave2.colorpalette.redContinuousSequential.description": "Red continuous sequential description",
  425. "rave2.colorpalette.redContinuousSequential.label": "Red continuous sequential",
  426. "rave2.colorpalette.redDiscreteSequential.description": "Red discrete sequential description",
  427. "rave2.colorpalette.redDiscreteSequential.label": " Red discrete sequential",
  428. "rave2.colorpalette.redGreenContinuousDivergent.description": "Red green continuous divergent description",
  429. "rave2.colorpalette.redGreenContinuousDivergent.label": "Red green continuous divergent",
  430. "rave2.colorpalette.redGreenDiscreteDivergent.description": "Red green discrete divergent description",
  431. "rave2.colorpalette.redGreenDiscreteDivergent.label": "Red green discrete divergent",
  432. "rave2.colorpalette.redGreenInverseContinuousDivergent.description": "Red green inverse continuous divergent description",
  433. "rave2.colorpalette.redGreenInverseContinuousDivergent.label": "Red green inverse continuous divergent",
  434. "rave2.colorpalette.redGreenInverseDiscreteDivergent.description": "Red green inverse discrete divergent description",
  435. "rave2.colorpalette.redGreenInverseDiscreteDivergent.label": "Red green inverse discrete divergent",
  436. "rave2.colorpalette.tealContinuousSequential.description": "Teal continuous sequential description",
  437. "rave2.colorpalette.tealContinuousSequential.label": "Teal continuous sequential",
  438. "rave2.colorpalette.tealDiscreteSequential.description": "Teal discrete sequential description",
  439. "rave2.colorpalette.tealDiscreteSequential.label": "Teal discrete sequential",
  440. "rave2.colorpalette.tealPurpleContinuousDivergent.description": "Teal purple continuous divergent description",
  441. "rave2.colorpalette.tealPurpleContinuousDivergent.label": "Teal purple continuous divergent",
  442. "rave2.colorpalette.tealPurpleDiscreteDivergent.description": "Teal purple discrete divergent description",
  443. "rave2.colorpalette.tealPurpleDiscreteDivergent.label": "Teal purple discrete divergent",
  444. "rave2.colorpalette.violetContinuousSequential.description": "Violet continuous sequential description",
  445. "rave2.colorpalette.violetContinuousSequential.label": "Violet continuous sequential",
  446. "rave2.colorpalette.violetDiscreteSequential.description": "Violet discrete sequential description",
  447. "rave2.colorpalette.violetDiscreteSequential.label": "Violet discrete sequential",
  448. "rave2.colorpalette.yellowContinuousSequential.description": "Yellow continuous sequential description",
  449. "rave2.colorpalette.yellowContinuousSequential.label": "Yellow continuous sequential",
  450. "rave2.colorpalette.yellowDiscreteSequential.description": "Yellow discrete sequential description",
  451. "rave2.colorpalette.yellowDiscreteSequential.label": "Yellow discrete sequential",
  452. "transpose.description": "When set to Yes, the Y-axis shows the independent scale and the X-axis shows the dependent scale.",
  453. "transpose.falseLabel": "Do not transpose",
  454. "transpose.name": "Switch X and Y axes",
  455. "transpose.trueLabel": "Transpose",
  456. "zoom.description": "Zooms the chart in the Y direction",
  457. "zoom.name": "Zoom",
  458. "zoom.options.none": "None",
  459. "zoom.options.y": "Y"
  460. }
  461. },{}],3:[function(require,module,exports){
  462. (function() {
  463. var $ = {};
  464. // $source: com/ibm/rave/bundles/internal/nativeImpl/BundleModuleHeader
  465. /************************************************************************
  466. ** IBM Confidential
  467. **
  468. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  469. **
  470. ** (C) Copyright IBM Corp. 2015
  471. **
  472. ** The source code for this program is not published or otherwise divested of its trade secrets,
  473. ** irrespective of what has been deposited with the U.S. Copyright Office.
  474. ************************************************************************/
  475. var com_ibm_rave_library_Library = rave["library"];
  476. rave["internal"]["Declare"] = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"];
  477. rave["internal"]["CSSUtil"]= rave["_"]["com_ibm_rave_core_internal_css_CSSUtil"];
  478. // $source: com/ibm/rave/bundles/RaveBundle
  479. /************************************************************************
  480. ** IBM Confidential
  481. **
  482. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  483. **
  484. ** (C) Copyright IBM Corp. 2017
  485. **
  486. ** The source code for this program is not published or otherwise divested of its trade secrets,
  487. ** irrespective of what has been deposited with the U.S. Copyright Office.
  488. ************************************************************************/
  489. // GENERATED
  490. //@import com/ibm/rave/bundles/internal/nativeImpl/RaveBundleResourceLoader (runtime) // new
  491. /**
  492. * A RaveBundle extends the regular Bundle abstract class but includes common functionality for Rave-made bundles that aren't for general use.
  493. */
  494. var com_ibm_rave_bundles_RaveBundle = rave['internal']['Declare'](rave['library']['internal']['Bundle'], {
  495. /** @expose */
  496. loader : null,
  497. /** @expose */
  498. constructor : function() {
  499. ;
  500. ;
  501. ;
  502. ;
  503. ;
  504. ;
  505. this.loader = new com_ibm_rave_bundles_internal_nativeImpl_RaveBundleResourceLoader("/com/ibm/rave/bundles/" + this.getName());
  506. },
  507. /**
  508. * Load extra resources required for this bundle. Currently the compiled configuration.json file. And .css.
  509. */
  510. /** @expose */
  511. loadResources : function() {
  512. this.setMessageCatalog(rave['library']['internal']['Bundle'].DEFAULT_LOCALE, require("./i18n/messages_en.json"));
  513. var array = require("./configuration/configuration.json");
  514. if (array) {
  515. for (var __i_enFor0 = 0, __exp_enFor0 = array, __len_enFor0 = __exp_enFor0.length;
  516. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  517. var artifact = __exp_enFor0[__i_enFor0];
  518. this.initialize(artifact);
  519. }
  520. }
  521. require("./vizlibrary.css");
  522. }
  523. });
  524. //com_ibm_rave_bundles_RaveBundle.CONFIGURATION_FILE = "./configuration/configuration.json";
  525. // $source: com/ibm/rave/bundles/internal/nativeImpl/RaveBundleResourceLoader
  526. // Intentionally empty - everything in this file is inlined
  527. var com_ibm_rave_bundles_internal_nativeImpl_RaveBundleResourceLoader = function(){};
  528. // $source: com/ibm/rave/bundles/views/BundleView
  529. /************************************************************************
  530. ** IBM Confidential
  531. **
  532. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  533. **
  534. ** (C) Copyright IBM Corp. 2017
  535. **
  536. ** The source code for this program is not published or otherwise divested of its trade secrets,
  537. ** irrespective of what has been deposited with the U.S. Copyright Office.
  538. ************************************************************************/
  539. // GENERATED
  540. //@import com/ibm/rave/bundles/components/BackgroundComponentImpl (runtime) // new
  541. //@import com/ibm/rave/bundles/components/ChartLayoutComponentImpl (runtime) // new
  542. //@import com/ibm/rave/bundles/components/ClipPathComponentImpl (runtime) // new
  543. //@import com/ibm/rave/bundles/components/LegendsManager (runtime) // new
  544. //@import com/ibm/rave/bundles/components/AxesManager (runtime) // new
  545. //@import com/ibm/rave/library/Library (runtime) // Library
  546. //@import com/ibm/rave/bundles/components/IntervalDataUtilities (runtime) // IntervalDataUtilities
  547. //@import com/ibm/rave/bundles/data/PointDataUtilities (runtime) // PointDataUtilities
  548. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  549. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor
  550. var com_ibm_rave_bundles_views_BundleView = rave['internal']['Declare'](rave['library']['internal']['AbstractView'], {
  551. /**
  552. * Background component
  553. */
  554. /** @expose */
  555. _backgroundComponent : null,
  556. /**
  557. * Layout component
  558. */
  559. /** @expose */
  560. _layoutComponent : null,
  561. /**
  562. * Clip component
  563. */
  564. /** @expose */
  565. _clip : null,
  566. /**
  567. * Axes manager
  568. */
  569. /** @expose */
  570. _axes : null,
  571. /**
  572. * Legends manager
  573. */
  574. /** @expose */
  575. _legends : null,
  576. //_groupStructure : null,
  577. /** @expose */
  578. _chart : null,
  579. /** @expose */
  580. dataModel : null,
  581. /** @expose */
  582. _zoomP : null,
  583. /** @expose */
  584. _zoomS : null,
  585. /** @expose */
  586. constructor : function(context) {
  587. },
  588. /** @expose */
  589. getGroupStructure : function() {},
  590. /** @expose */
  591. setup : function() {
  592. rave['library']['internal']['AbstractView'].prototype.setup.call(this);
  593. this._backgroundComponent = new com_ibm_rave_bundles_components_BackgroundComponentImpl();
  594. this._layoutComponent = new com_ibm_rave_bundles_components_ChartLayoutComponentImpl();
  595. this._clip = new com_ibm_rave_bundles_components_ClipPathComponentImpl(this.context.instanceId() + "clipViewport");
  596. if (this.isZoomSupported()) {
  597. this.resetZoom();
  598. }
  599. this._legends = new com_ibm_rave_bundles_components_LegendsManager(this.context, this.getLegendCount());
  600. if (this.isAxesManagerRequired()) {
  601. this._axes = new com_ibm_rave_bundles_components_AxesManager(this.context);
  602. }
  603. this._groupStructure = this.getGroupStructure();
  604. },
  605. /** @expose */
  606. preDraw : function(chartId) {
  607. this.cancelTransitions();
  608. rave['library']['internal']['AbstractView'].createGroupStructure(this.context.node, this._groupStructure);
  609. this._chart = this.context.node.selectAll(chartId);
  610. },
  611. /** @expose */
  612. resetZoom : function() {
  613. this._zoomP = [0, 0, 0, 0];
  614. this._zoomS = [1, 1, 1, 1];
  615. },
  616. /** @expose */
  617. validateDataModel : function(elementsToRemove) {
  618. if (elementsToRemove !== null || arguments.length > 1){
  619. elementsToRemove = Array.prototype.slice.call(arguments);
  620. }
  621. {
  622. this.dataModel = this.context.dataModel();
  623. if (!(this.dataValid())) {
  624. for (var __i_enFor0 = 0, __len_enFor0 = elementsToRemove.length;
  625. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  626. var e = elementsToRemove[__i_enFor0];
  627. this._chart.selectAll(e).selectAll("*").remove();
  628. }
  629. this._legends.visible(false).draw();
  630. return false;
  631. }
  632. return true;
  633. }
  634. },
  635. /** @expose */
  636. dataValid : function() {
  637. return this.dataModel.validate();
  638. },
  639. /** @expose */
  640. getLegendCount : function() {
  641. return 1;
  642. },
  643. /** @expose */
  644. isAxesManagerRequired : function() {
  645. return false;
  646. },
  647. /** @expose */
  648. isZoomSupported : function() {
  649. return true;
  650. },
  651. /** @expose */
  652. getProperty : function(s) {
  653. return this.context.getPropertyValue(s);
  654. },
  655. /** @expose */
  656. getPropertyDefault : function(s) {
  657. return this.context.getPropertyDefault(s);
  658. },
  659. /** @expose */
  660. getBooleanProperty : function(s) {
  661. var obj = this.getProperty(s);
  662. return (obj);
  663. },
  664. /** @expose */
  665. getDoubleProperty : function(s) {
  666. var obj = this.getProperty(s);
  667. return + (obj);
  668. },
  669. /** @expose */
  670. getIntProperty : function(s) {
  671. var obj = this.getProperty(s);
  672. return ~~ (obj);
  673. },
  674. /**
  675. * @param (String) id Property ID
  676. * @return (String) Property value as a string
  677. */
  678. /** @expose */
  679. getStringProperty : function(id) {
  680. var obj = this.getProperty(id);
  681. return (obj == null) ? null : ""+(obj);
  682. },
  683. /**
  684. * @param (String) id Property ID
  685. * @return (String) Property value as a string, returning null for the empty string
  686. */
  687. /** @expose */
  688. getStringPropertyEmptyAsNull : function(id) {
  689. var s = this.getStringProperty(id);
  690. return (s == null || s.length == 0) ? null : s;
  691. },
  692. /**
  693. * @param (String) id Property ID
  694. * @return (Number) Property value as a string, containing size as the number of pixels
  695. */
  696. /** @expose */
  697. getCSSSizeToPixelNumber : function(id) {
  698. var cssSize = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(this.context.getPropertyValue(id), 100.0, 10.0);
  699. return (cssSize == null) ? 0.0 : cssSize;
  700. },
  701. /**
  702. * Based on effect duration and effect property, determine the effect duration in ms.
  703. * @param (String) effect Effect name, one of the options available from EFFECT_OPTIONS.
  704. * @return (int) Effect duration in ms.
  705. */
  706. /** @expose */
  707. getEffectDuration : function(effect) {
  708. var duration = this.getIntProperty("effect.duration");
  709. if ((duration < 0) || (effect == null) || "none" == effect) {
  710. duration = 0;
  711. }
  712. return duration;
  713. },
  714. /** @expose */
  715. getTopPadding : function() {
  716. return this.getProperty("layout.chart.padding.top");
  717. },
  718. /** @expose */
  719. getLeftPadding : function() {
  720. return this.getProperty("layout.chart.padding.left");
  721. },
  722. /** @expose */
  723. getBottomPadding : function() {
  724. return this.getProperty("layout.chart.padding.bottom");
  725. },
  726. /** @expose */
  727. getRightPadding : function() {
  728. return this.getProperty("layout.chart.padding.right");
  729. },
  730. /** @expose */
  731. getLayoutPadding : function() {
  732. return this.getProperty("layout.padding");
  733. },
  734. /** @expose */
  735. getLegendChartGap : function() {
  736. return this.getProperty("layout.legendchart.gap");
  737. },
  738. /** @expose */
  739. getLegendChartAlign : function() {
  740. return this.getBooleanProperty("layout.legendchart.align");
  741. },
  742. /** @expose */
  743. getLegendPosition : function() {
  744. return this.getStringProperty("legend.position");
  745. },
  746. getPalette$0 : function() {
  747. return this.getPalette$1("color.palette");
  748. },
  749. getPalette$1 : function(paletteID) {
  750. var id = this.getStringProperty(paletteID);
  751. var colorPalette = com_ibm_rave_library_Library.palettes.getPalette(id);
  752. return (!colorPalette) ? com_ibm_rave_library_Library.palettes.getDefaultPalette() : colorPalette;
  753. },
  754. getDynamicPalette$0 : function() {
  755. return this.getDynamicPalette$1("color.palette", "color.dynamicPalette.min", "color.dynamicPalette.mid", "color.dynamicPalette.max");
  756. },
  757. /**
  758. * 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.
  759. * @param (String) paletteID The palette ID
  760. * @return (rave['library']['internal']['Palette']) Palette
  761. */
  762. getDynamicPalette$1 : function(paletteID, minId, midId, maxId) {
  763. var colorPalette;
  764. var min = this.getStringProperty(minId);
  765. if (min != null) {
  766. var mid = this.getStringProperty(midId);
  767. if (mid != null) {
  768. var max = this.getStringProperty(maxId);
  769. if (max != null) {
  770. var fills = [min, mid, max];
  771. colorPalette = rave['library']['internal']['AbstractView'].getFillPalette(fills);
  772. }
  773. }
  774. }
  775. return (!colorPalette) ? this.getPalette(paletteID) : colorPalette;
  776. },
  777. /** @expose */
  778. prepareLayoutComponent : function() {
  779. 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());
  780. },
  781. /** @expose */
  782. prepareLayoutSizables : function(layoutComponent, useX2, useY1, useX1, useY2, useLegend) {
  783. layoutComponent.removeAxisSizables();
  784. if (useX1) {
  785. layoutComponent.addAxisSizable(this._axes.axisComponent(0));
  786. }
  787. if (useY1) {
  788. layoutComponent.addAxisSizable(this._axes.axisComponent(2));
  789. }
  790. if (useX2) {
  791. layoutComponent.addAxisSizable(this._axes.axisComponent(1));
  792. }
  793. if (useY2) {
  794. layoutComponent.addAxisSizable(this._axes.axisComponent(3));
  795. }
  796. layoutComponent.legendSize(useLegend ? this._legends : null);
  797. },
  798. /** @expose */
  799. resetUpdate : function() {
  800. this.updateType = 4;
  801. },
  802. /** @expose */
  803. isUpdateNothing : function() {
  804. return this.updateType == 4;
  805. },
  806. /** @expose */
  807. isShowLegend : function() {
  808. return this.getBooleanProperty("legend.display");
  809. },
  810. cancelTransitions : function() {
  811. this.context.node.selectAll("*").interrupt();
  812. },
  813. /** @expose */
  814. setBackgroundProperties : function(elementRect, duration) {
  815. this._backgroundComponent.setPreExecute(this.context.getPreExecute()).size(this.context.size).backgroundColor(this.getStringProperty("background.chart.color"));
  816. this.context.node.selectAll("rect.background.chart").transition().duration(duration).call(this._backgroundComponent);
  817. this._backgroundComponent.setPreExecute(this.context.getPreExecute()).rect(elementRect).backgroundColor(this.getStringProperty("background.elements.color"));
  818. this.context.node.selectAll("rect.background.elements").transition().duration(duration).call(this._backgroundComponent);
  819. },
  820. /** @expose */
  821. isShowDataLabels : function() {
  822. return this.getBooleanProperty("data.label.display");
  823. },
  824. /** @expose */
  825. isShowDataLabelsAsPercentageOfColor : function() {
  826. var dataLabel = this.getStringProperty("data.label.type");
  827. return "PercentOfColor" == dataLabel;
  828. },
  829. /** @expose */
  830. isShowDataLabelsAsPercentageOfCategory : function() {
  831. var dataLabel = this.getStringProperty("data.label.type");
  832. return "PercentOfCategory" == dataLabel;
  833. },
  834. /** @expose */
  835. getlDataLabelAccessor : function(dataSet, slot, isInterval) {
  836. var labelAccessor;
  837. var labelEntry = dataSet.slot(slot).entry();
  838. if (!labelEntry) {
  839. if (this.isShowDataLabelsAsPercentageOfCategory()) {
  840. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR;
  841. } else if (this.isShowDataLabelsAsPercentageOfColor()) {
  842. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_COLOR_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_COLOR_ACCESSOR;
  843. } else {
  844. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.VALUE_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR;
  845. }
  846. } else {
  847. labelAccessor = rave['library']['internal']['AbstractView'].originalDatumAccessor(rave['library']['internal']['AbstractView'].accessorOf(labelEntry));
  848. }
  849. return labelAccessor;
  850. },
  851. /** @expose */
  852. getEntryForDataLabelFormatter : function(dataSet, labelSlot, defaultSlot) {
  853. var labelEntry = dataSet.slot(labelSlot).entry();
  854. return labelEntry ? labelEntry : dataSet.slot(defaultSlot).entry();
  855. },
  856. /** @expose */
  857. getBackgroundConstrastLabelStyle : function() {
  858. var labelFontStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(this.getStringProperty("labelstyle.font"));
  859. if (this.getBooleanProperty("contrast.label.color") == false) {
  860. return labelFontStyle;
  861. }
  862. var defaultFillColor;
  863. if (labelFontStyle) {
  864. defaultFillColor = labelFontStyle["fill"];
  865. if (defaultFillColor == null) {
  866. defaultFillColor = labelFontStyle["color"];
  867. }
  868. } else {
  869. labelFontStyle = {};
  870. }
  871. if (defaultFillColor == null) {
  872. defaultFillColor = "#000000";
  873. }
  874. labelFontStyle["fill"] = com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(this.getStringProperty("background.elements.color"), defaultFillColor);
  875. return labelFontStyle;
  876. },
  877. /** @expose */
  878. getPalette : function(a0) {
  879. var args = arguments;
  880. if (args.length == 0) {
  881. return this.getPalette$0();
  882. }
  883. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  884. return this.getPalette$1(a0);
  885. }
  886. return rave['library']['internal']['AbstractView'].prototype.getPalette.apply(this, args);
  887. },
  888. /** @expose */
  889. getDynamicPalette : function(a0, a1, a2, a3) {
  890. var args = arguments;
  891. if (args.length == 0) {
  892. return this.getDynamicPalette$0();
  893. }
  894. return this.getDynamicPalette$1(a0, a1, a2, a3);
  895. }
  896. });
  897. // $source: com/ibm/rave/bundles/components/BundleComponentImpl
  898. /************************************************************************
  899. ** IBM Confidential
  900. **
  901. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  902. **
  903. ** (C) Copyright IBM Corp. 2017
  904. **
  905. ** The source code for this program is not published or otherwise divested of its trade secrets,
  906. ** irrespective of what has been deposited with the U.S. Copyright Office.
  907. ************************************************************************/
  908. // GENERATED
  909. var com_ibm_rave_bundles_components_BundleComponentImpl = rave['internal']['Declare']({
  910. /**
  911. * The pre-execution callback.
  912. */
  913. //_preExecuteCallback : null,
  914. /**
  915. * The render callback.
  916. */
  917. /** @expose */
  918. _renderCallback : null,
  919. _$functionClassMethod : function() {
  920. var _$self = function(args) {
  921. if (args !== null || arguments.length > 1){
  922. args = Array.prototype.slice.call(arguments, 0);
  923. }
  924. {
  925. var self = _$self;
  926. this.each(function(data, index, groupIndex) {
  927. self.execute(rave.select(this));
  928. });
  929. return null;
  930. }
  931. };
  932. return _$self;
  933. },
  934. /**
  935. * 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.
  936. * @param (rave['internal']['Selector']) g <g> node that this component will be applied to.
  937. */
  938. /** @expose */
  939. execute : function(g) {},
  940. /**
  941. * Set the pre-execute callback for this component.
  942. * @param (rave['library']['internal']['ComponentCallback']) callback The callback
  943. */
  944. /** @expose */
  945. setPreExecute : function(callback) {
  946. this._preExecuteCallback = callback;
  947. return this;
  948. },
  949. /**
  950. * If the pre-execute component is non-null, call it with this object. Note that this object must also implement BundleComponent.
  951. */
  952. /** @expose */
  953. preExecute : function() {
  954. if (this._preExecuteCallback) {
  955. this._preExecuteCallback(this);
  956. }
  957. },
  958. /**
  959. * Set the render callback for this component.
  960. * @param (rave['internal']['RunFunction']) callback The callback
  961. */
  962. /** @expose */
  963. setRenderCallback : function(callback) {
  964. this._renderCallback = callback;
  965. return this;
  966. },
  967. /**
  968. * 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.
  969. */
  970. /** @expose */
  971. type : function() {},
  972. /** @expose */
  973. updateBorder : function(s, borderWidth, borderColor) {
  974. if (borderWidth != null) {
  975. s.each(function(data, index, groupIndex) {
  976. if (!((this.rave_getProperty("selected"))) && !((this.rave_getProperty("highlighted")))) {
  977. this.rave_setStyle("stroke-width", borderWidth, "");
  978. }
  979. });
  980. }
  981. if (borderColor != null) {
  982. s.each(function(data, index, groupIndex) {
  983. if (!((this.rave_getProperty("selected"))) && !((this.rave_getProperty("highlighted")))) {
  984. this.rave_setStyle("stroke", borderColor, "");
  985. }
  986. });
  987. }
  988. },
  989. /** @expose */
  990. getDefaultLabelColor : function(_labelStyle) {
  991. if (!_labelStyle) {
  992. return "#000000";
  993. }
  994. var defaultFillColor;
  995. if (_labelStyle) {
  996. defaultFillColor = _labelStyle["fill"];
  997. if (defaultFillColor == null) {
  998. defaultFillColor = _labelStyle["color"];
  999. }
  1000. }
  1001. if (defaultFillColor == null) {
  1002. defaultFillColor = "#000000";
  1003. }
  1004. return defaultFillColor.toString();
  1005. }
  1006. });
  1007. // $source: com/ibm/rave/bundles/component/BackgroundComponent
  1008. /************************************************************************
  1009. ** IBM Confidential
  1010. **
  1011. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1012. **
  1013. ** (C) Copyright IBM Corp. 2017
  1014. **
  1015. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1016. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1017. ************************************************************************/
  1018. // GENERATED
  1019. /**
  1020. * <p> A component that renders the background to the chart. The {@link #this.type()} method returns "BackgroundComponent". </p>
  1021. */
  1022. var com_ibm_rave_bundles_component_BackgroundComponent = rave['internal']['Declare'].implement(
  1023. /**
  1024. * Get the background color.
  1025. * @return (String) The background color
  1026. */
  1027. //backgroundColor : function() {},
  1028. /**
  1029. * Set the background color. If the color is null, white is used.
  1030. * @param (String) backgroundColor The new background color
  1031. * @return (com.ibm.rave.bundles.component.BackgroundComponent) This object
  1032. */
  1033. //backgroundColor : function(backgroundColor) {}
  1034. );
  1035. /**
  1036. * The string returned by {@link #this.type()} is "BackgroundComponent".
  1037. */
  1038. /** @expose */
  1039. com_ibm_rave_bundles_component_BackgroundComponent.COMPONENT_TYPE = "BackgroundComponent";
  1040. // $source: com/ibm/rave/bundles/component/ChartLayoutComponent
  1041. /************************************************************************
  1042. ** IBM Confidential
  1043. **
  1044. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1045. **
  1046. ** (C) Copyright IBM Corp. 2017
  1047. **
  1048. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1049. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1050. ************************************************************************/
  1051. // GENERATED
  1052. /**
  1053. * <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>
  1054. */
  1055. var com_ibm_rave_bundles_component_ChartLayoutComponent = rave['internal']['Declare'].implement(
  1056. //padding : function() {},
  1057. //topPadding : function() {},
  1058. //leftPadding : function() {},
  1059. //bottomPadding : function() {},
  1060. //rightPadding : function() {},
  1061. //legendChartAlign : function() {},
  1062. //legendPosition : function() {},
  1063. //legendChartGap : function() {},
  1064. //legendPosition : function(position) {},
  1065. //topPadding : function(value) {},
  1066. //leftPadding : function(value) {},
  1067. //bottomPadding : function(value) {},
  1068. //rightPadding : function(value) {},
  1069. /**
  1070. * Sets the padding around the outside of the chart/legend.
  1071. * @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.
  1072. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1073. */
  1074. //padding : function(value) {},
  1075. /**
  1076. * Sets all chart paddings. Null values are treated as 0.
  1077. * @param (Object) top New top padding
  1078. * @param (Object) left New left padding
  1079. * @param (Object) bottom New bottom padding
  1080. * @param (Object) right New right padding
  1081. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1082. * @deprecated Please use {@link #this.padding(Object)} and {@link #this.legendChartGap(Object)}
  1083. */
  1084. //chartPadding : function(top, left, bottom, right) {},
  1085. /**
  1086. * Sets whether the legend should align with the chart "body".
  1087. * @param (boolean) legendChartAlign the boolean state
  1088. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1089. */
  1090. //legendChartAlign : function(legendChartAlign) {},
  1091. /**
  1092. * Set the space for the gap between chart and legend
  1093. * @param (Object) value the gap distance (css length)
  1094. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1095. */
  1096. //legendChartGap : function(value) {},
  1097. /**
  1098. * Set the size information for the legend. Null value is treated as no visible legend.
  1099. * @param (com.ibm.rave.bundles.component.ChartLayoutSizable) sizable An object that implements the ChartLayoutSizable interface
  1100. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1101. */
  1102. //legendSize : function(sizable) {},
  1103. /**
  1104. * Reset list of axis sizables to 0
  1105. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1106. */
  1107. //removeAxisSizables : function() {},
  1108. /**
  1109. * Add an axis to be considered in layout operation.
  1110. * @param (com.ibm.rave.bundles.component.ChartLayoutSizable) sizable An object that implements the ChartLayoutSizable interface
  1111. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1112. */
  1113. //addAxisSizable : function(sizable) {}
  1114. );
  1115. /**
  1116. * The string returned by {@link #this.type()} is "ChartLayoutComponent".
  1117. */
  1118. /** @expose */
  1119. com_ibm_rave_bundles_component_ChartLayoutComponent.COMPONENT_TYPE = "ChartLayoutComponent";
  1120. // $source: com/ibm/rave/bundles/components/LegendsManager
  1121. /************************************************************************
  1122. ** IBM Confidential
  1123. **
  1124. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1125. **
  1126. ** (C) Copyright IBM Corp. 2017
  1127. **
  1128. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1129. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1130. ************************************************************************/
  1131. // GENERATED
  1132. //@import com/ibm/rave/bundles/components/LegendComponentImpl (runtime) // new, orientationOf
  1133. /**
  1134. * <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>
  1135. */
  1136. var com_ibm_rave_bundles_components_LegendsManager = rave['internal']['Declare']({
  1137. /**
  1138. * Bundle context
  1139. */
  1140. //_context : null,
  1141. /**
  1142. * Component used to draw all legends
  1143. */
  1144. //_comp : null,
  1145. /**
  1146. * Global visibility; if false no legends are drawn
  1147. */
  1148. //_visible : null,
  1149. /**
  1150. * Rectangle containing all legends
  1151. */
  1152. //_rectangle : null,
  1153. /**
  1154. * Legend orientation
  1155. */
  1156. //_orient : null,
  1157. /**
  1158. * Pre-execute component callback
  1159. */
  1160. //_preExecute : null,
  1161. /**
  1162. * Selectors for each legend
  1163. */
  1164. //_selectors : null,
  1165. /**
  1166. * Palettes for each legend
  1167. */
  1168. //_palettes : null,
  1169. /**
  1170. * Scale size functions for each legend
  1171. */
  1172. //_scale : null,
  1173. /**
  1174. * Swatch size functions for each legend
  1175. */
  1176. //_swatchSizes : null,
  1177. /**
  1178. * Shapes for each legend
  1179. */
  1180. //_shapes : null,
  1181. /**
  1182. * Titles for each legend
  1183. */
  1184. //_titles : null,
  1185. /**
  1186. * Title fonts for each legend
  1187. */
  1188. //_titleFonts : null,
  1189. /**
  1190. * Title fills for each legend
  1191. */
  1192. //_titleFills : null,
  1193. /**
  1194. * Title font sizes for each legend
  1195. */
  1196. //_titleFontSizes : null,
  1197. /**
  1198. * Title font families for each legend
  1199. */
  1200. //_titleFontFamilies : null,
  1201. /**
  1202. * Entry fonts for each legend
  1203. */
  1204. //_entryFonts : null,
  1205. /**
  1206. * Custom formatters for each legend, created from the registered custom formatters
  1207. */
  1208. //_formatters : null,
  1209. /**
  1210. * Whether each legend was visible in the last draw
  1211. */
  1212. //_lastVisible : null,
  1213. //_dataSlotEntries : null,
  1214. /**
  1215. * Number of legends
  1216. */
  1217. _numLegends : 0,
  1218. /**
  1219. * Whether to use a transition.
  1220. */
  1221. _doTransition : false,
  1222. /**
  1223. * Duration of the transition.
  1224. */
  1225. _duration : 0,
  1226. _spaceUsed : 0,
  1227. /**
  1228. * Construct the manager.
  1229. * @param (int) numLegends Number of legends, must be positive
  1230. */
  1231. /** @expose */
  1232. constructor : function(context, numLegends) {
  1233. this._context = context;
  1234. this._numLegends = numLegends;
  1235. this._comp = new com_ibm_rave_bundles_components_LegendComponentImpl();
  1236. this._rectangle = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1237. this._orient = "vertical";
  1238. this._preExecute = null;
  1239. this._selectors = [];
  1240. this._palettes = [];
  1241. this._scale = [];
  1242. this._swatchSizes = [];
  1243. this._shapes = [];
  1244. this._titles = [];
  1245. this._titleFonts = [];
  1246. this._titleFills = [];
  1247. this._titleFontSizes = [];
  1248. this._titleFontFamilies = [];
  1249. this._entryFonts = [];
  1250. this._formatters = [];
  1251. this._lastVisible = [];
  1252. this._visible = [];
  1253. this._dataSlotEntries = [];
  1254. for (var i = 0; i < this._numLegends; ++i) {
  1255. this._selectors[i] = null;
  1256. this._palettes[i] = null;
  1257. this._swatchSizes[i] = null;
  1258. this._shapes[i] = null;
  1259. this._titles[i] = null;
  1260. this._formatters[i] = null;
  1261. this._lastVisible[i] = false;
  1262. this._visible[i] = true;
  1263. }
  1264. },
  1265. /**
  1266. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) The legend component used by this manager; for unit tests
  1267. */
  1268. getLegendComponent : function() {
  1269. return this._comp;
  1270. },
  1271. /**
  1272. * Set a specific legend visible
  1273. * @param (int) legendIndex The index of the legend
  1274. * @param (boolean) visible New value of visible flag
  1275. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1276. */
  1277. visible$0 : function(legendIndex, visible) {
  1278. if (legendIndex < this._visible.length) {
  1279. this._visible[legendIndex] = visible;
  1280. }
  1281. return this;
  1282. },
  1283. /**
  1284. * Set all legend visible
  1285. * @param (boolean) visible New value of visible flag
  1286. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1287. */
  1288. visible$1 : function(visible) {
  1289. for (var i = 0; i < this._visible.length; ++i) {
  1290. this._visible[i] = visible;
  1291. }
  1292. return this;
  1293. },
  1294. /**
  1295. * Set the layout rectangle. The rectangle is copied. If it is null, the layout rectangle is unchanged.
  1296. * @param (rave['internal']['RectStruct']) rect New layout rectangle
  1297. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1298. */
  1299. /** @expose */
  1300. rectangle : function(rect) {
  1301. if (rect) {
  1302. this._rectangle = new rave['internal']['RectStruct'](rect.x, rect.y, rect.width, rect.height);
  1303. }
  1304. return this;
  1305. },
  1306. /**
  1307. * Set the orient property. If the argument is not "horizontal" or "vertical", the orient property is not changed.
  1308. * @param (String) orient New orient
  1309. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1310. */
  1311. /** @expose */
  1312. orient : function(orient) {
  1313. if ("horizontal" == orient || "vertical" == orient) {
  1314. this._orient = orient;
  1315. }
  1316. return this;
  1317. },
  1318. /**
  1319. * 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".
  1320. * @param (String) position Legend position
  1321. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1322. */
  1323. /** @expose */
  1324. position : function(position) {
  1325. return this.orient(com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf(position));
  1326. },
  1327. /**
  1328. * Set the transition information. If the duration is negative, 0 is used.
  1329. * @param (boolean) doTransition Whether to do a transition
  1330. * @param (int) duration Duration of the transition when used
  1331. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1332. */
  1333. /** @expose */
  1334. transition : function(doTransition, duration) {
  1335. this._doTransition = doTransition;
  1336. this._duration = (duration >= 0) ? duration : 0;
  1337. return this;
  1338. },
  1339. /**
  1340. * Set the pre-execute callback for all legends. The callback may be null.
  1341. * @param (rave['library']['internal']['ComponentCallback']) callback The callback
  1342. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1343. */
  1344. /** @expose */
  1345. setPreExecute : function(callback) {
  1346. this._preExecute = callback;
  1347. return this;
  1348. },
  1349. /**
  1350. * Set the selector to be used when rendering a legend. If the index is out of range no selectors change.
  1351. * @param (int) index Legend array index
  1352. * @param (rave['internal']['Selector']) selector Selector, may be null (but this is not advisable)
  1353. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1354. */
  1355. /** @expose */
  1356. selector : function(index, selector) {
  1357. if (index >= 0 && index < this._numLegends) {
  1358. this._selectors[index] = selector;
  1359. }
  1360. return this;
  1361. },
  1362. /**
  1363. * Set the palette of a legend. If the index is out of range no information is changed.
  1364. * @param (int) index Legend array index
  1365. * @param (rave['library']['internal']['Palette']) palette Palette, may be null
  1366. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1367. */
  1368. /** @expose */
  1369. palette : function(index, palette) {
  1370. if (index >= 0 && index < this._numLegends) {
  1371. this._palettes[index] = palette;
  1372. }
  1373. return this;
  1374. },
  1375. /**
  1376. * Set the shape of a legend. If the index is out of range no information is changed.
  1377. * @param (int) index Legend array index
  1378. * @param (String) shape Shape, may be null (defaulting to square)
  1379. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1380. */
  1381. /** @expose */
  1382. shape : function(index, shape) {
  1383. if (index >= 0 && index < this._numLegends) {
  1384. this._shapes[index] = shape;
  1385. }
  1386. return this;
  1387. },
  1388. /**
  1389. * Set the title of a legend. If the index is out of range no information is changed.
  1390. * @param (int) index Legend array index
  1391. * @param (String) title Title, may be null
  1392. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1393. */
  1394. /** @expose */
  1395. title : function(index, title) {
  1396. if (index >= 0 && index < this._numLegends) {
  1397. this._titles[index] = title;
  1398. }
  1399. return this;
  1400. },
  1401. /**
  1402. * Set the title font style of a legend. If the index is out of range no information is changed.
  1403. * @param (int) index Legend array index
  1404. * @param (String) titleFont Title font string, may be null
  1405. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1406. */
  1407. /** @expose */
  1408. titleFont : function(index, titleFont) {
  1409. if (index >= 0 && index < this._numLegends) {
  1410. this._titleFonts[index] = titleFont;
  1411. }
  1412. return this;
  1413. },
  1414. /**
  1415. * Set the entry font style of a legend. If the index is out of range no information is changed.
  1416. * @param (int) index Legend array index
  1417. * @param (String) entryFont Entry font string, may be null
  1418. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1419. */
  1420. /** @expose */
  1421. entryFont : function(index, entryFont) {
  1422. if (index >= 0 && index < this._numLegends) {
  1423. this._entryFonts[index] = entryFont;
  1424. }
  1425. return this;
  1426. },
  1427. /**
  1428. * Set the title fill of a legend. If the index is out of range no information is changed.
  1429. * @param (int) index Legend array index
  1430. * @param (String) titleFill Fill color string, may be null
  1431. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1432. */
  1433. /** @expose */
  1434. titleFill : function(index, titleFill) {
  1435. if (index >= 0 && index < this._numLegends) {
  1436. this._titleFills[index] = titleFill;
  1437. }
  1438. return this;
  1439. },
  1440. /**
  1441. * Set the title font size of a legend. If the index is out of range no information is changed.
  1442. * @param (int) index Legend array index
  1443. * @param (String) titleFontSize Font size string, may be null
  1444. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1445. */
  1446. /** @expose */
  1447. titleFontSize : function(index, titleFontSize) {
  1448. if (index >= 0 && index < this._numLegends) {
  1449. this._titleFontSizes[index] = titleFontSize;
  1450. }
  1451. return this;
  1452. },
  1453. /**
  1454. * Set the title font family of a legend. If the index is out of range no information is changed.
  1455. * @param (int) index Legend array index
  1456. * @param (String) titleFontFamily Font family string, may be null
  1457. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1458. */
  1459. /** @expose */
  1460. titleFontFamily : function(index, titleFontFamily) {
  1461. if (index >= 0 && index < this._numLegends) {
  1462. this._titleFontFamilies[index] = titleFontFamily;
  1463. }
  1464. return this;
  1465. },
  1466. /**
  1467. * Set the scale of a legend. If the index is out of range no information is changed.
  1468. * @param (int) index Legend array index
  1469. * @param (rave['internal']['AbstractScale']) scale Scale, may be null
  1470. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1471. */
  1472. /** @expose */
  1473. scale : function(index, scale) {
  1474. if (index >= 0 && index < this._numLegends) {
  1475. this._scale[index] = scale;
  1476. }
  1477. return this;
  1478. },
  1479. /**
  1480. * Set the swatch size function of a legend. If the index is out of range no information is changed.
  1481. * @param (int) index Legend array index
  1482. * @param (rave['internal']['ValueFunction']) swatchSize Swatch size function, may be null
  1483. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1484. */
  1485. /** @expose */
  1486. swatchSize : function(index, swatchSize) {
  1487. if (index >= 0 && index < this._numLegends) {
  1488. this._swatchSizes[index] = swatchSize;
  1489. }
  1490. return this;
  1491. },
  1492. /**
  1493. * 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.
  1494. * @param (int) index Legend array index
  1495. * @param (Array) entries List of data slot entries, if null an empty list is used
  1496. * @param (String) format One of {@link this.CustomFormatInfo#"none"} or {@link this.CustomFormatInfo#"percent"}
  1497. * @param (rave['internal']['ValueFunction']) defaultFunction Default function to use if no custom formatter is defined, may be null
  1498. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1499. */
  1500. /** @expose */
  1501. formatterList : function(index, entries, format, defaultFunction) {
  1502. if (index >= 0 && index < this._numLegends) {
  1503. this._formatters[index] = this._context.getCustomFormatterWithFlag(["legend", "all"], rave['library']['internal']['BundleContext'].makeCustomFormatInfo("legend-label", "ROLE_NONE", format, entries), defaultFunction, false);
  1504. }
  1505. return this;
  1506. },
  1507. /**
  1508. * 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.
  1509. * @param (int) index Legend array index
  1510. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  1511. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1512. */
  1513. /** @expose */
  1514. formatter : function(index, entry) {
  1515. var entries = [];
  1516. if (entry) {
  1517. entries.push(entry);
  1518. }
  1519. return this.formatterList(index, entries, "none", null);
  1520. },
  1521. /**
  1522. * 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.
  1523. * @return (boolean) Whether any legend are visible (will be drawn)
  1524. */
  1525. /** @expose */
  1526. anyVisible : function() {
  1527. for (var i = 0; i < this._numLegends; ++i) {
  1528. if (this._visible[i] == true && (this._palettes[i] || this._swatchSizes[i])) {
  1529. return true;
  1530. }
  1531. }
  1532. return false;
  1533. },
  1534. /**
  1535. * 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'])} .
  1536. * @param (int) index Legend array index
  1537. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  1538. * @return (com.ibm.rave.bundles.components.LegendsManager) This LegendsManager
  1539. */
  1540. /** @expose */
  1541. setDataSlot : function(index, entry) {
  1542. if (index >= 0 && index < this._numLegends) {
  1543. this._dataSlotEntries[index] = entry;
  1544. }
  1545. return this.formatter(index, entry);
  1546. },
  1547. preLayout$0 : function(layoutComponent) {
  1548. this.preLayout$1(layoutComponent, true);
  1549. return this;
  1550. },
  1551. preLayout$1 : function(layoutComponent, axesBeforeLegend) {
  1552. var layoutTransition = this._doTransition;
  1553. var layoutDuration = this._duration;
  1554. this._doTransition = false;
  1555. this._duration = 0;
  1556. var children = [];
  1557. for (var i = 0; i < this._numLegends; ++i) {
  1558. children[i] = "g.layoutLegend-" + i;
  1559. }
  1560. rave['library']['internal']['AbstractView'].createGroupStructure(this._context.node.select("g.legends-layout"), children);
  1561. var layoutSelectors = [];
  1562. var layoutLastVisible = [];
  1563. for (var i = 0; i < this._numLegends; ++i) {
  1564. layoutSelectors[i] = this._selectors[i];
  1565. layoutLastVisible[i] = this._lastVisible[i];
  1566. this._lastVisible[i] = false;
  1567. if (this._selectors[i]) {
  1568. this._selectors[i] = this._context.node.select("g.layoutLegend-" + i);
  1569. }
  1570. }
  1571. layoutComponent.preLayout(true, !axesBeforeLegend);
  1572. this.rectangle(layoutComponent.legendRect());
  1573. this.draw();
  1574. this._doTransition = layoutTransition;
  1575. this._duration = layoutDuration;
  1576. this._context.node.select("g.legends-layout").selectAll("*").remove();
  1577. for (var i = 0; i < this._numLegends; ++i) {
  1578. this._lastVisible[i] = layoutLastVisible[i];
  1579. this._selectors[i] = layoutSelectors[i];
  1580. }
  1581. return this;
  1582. },
  1583. /**
  1584. * Render the legends using the current global and per-legend settings.
  1585. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1586. */
  1587. /** @expose */
  1588. draw : function() {
  1589. var nVisible = 0;
  1590. for (var i = 0; i < this._numLegends; ++i) {
  1591. if ((this._swatchSizes[i] || this._palettes[i]) && this._visible[i]) {
  1592. nVisible++;
  1593. }
  1594. }
  1595. var x = this._rectangle.x;
  1596. var y = this._rectangle.y;
  1597. var dx;
  1598. var dy;
  1599. var size;
  1600. if (nVisible == 0) {
  1601. dx = 0;
  1602. dy = 0;
  1603. size = [this._rectangle.width, this._rectangle.height];
  1604. } else if ("horizontal" == this._orient) {
  1605. dx = this._rectangle.width / nVisible;
  1606. dy = 0;
  1607. size = [dx, this._rectangle.height];
  1608. } else {
  1609. dx = 0;
  1610. dy = this._rectangle.height / nVisible;
  1611. size = [this._rectangle.width, dy];
  1612. }
  1613. this._comp.orient(this._orient).size(size);
  1614. this._spaceUsed = 0;
  1615. for (var i = 0; i < this._numLegends; ++i) {
  1616. if (this._selectors[i]) {
  1617. var visible = this._visible[i] && (this._palettes[i] || this._swatchSizes[i]);
  1618. 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]);
  1619. var fontStyle = this._context.getPropertyValue("legend.titlestyle.font");
  1620. if (this._titleFonts[i] != null && !(this._titleFonts[i] == "")) {
  1621. this._comp.titleFont(this._titleFonts[i]);
  1622. } else if (fontStyle != null && !(fontStyle == "")) {
  1623. this._comp.titleFont(this._context.getPropertyValue("legend.titlestyle.font"));
  1624. }
  1625. fontStyle = this._context.getPropertyValue("legend.entrystyle.font");
  1626. if (this._entryFonts[i] != null) {
  1627. this._comp.entryFont(this._entryFonts[i]);
  1628. } else if (fontStyle != null && !(fontStyle == "")) {
  1629. this._comp.entryFont(this._context.getPropertyValue("legend.entrystyle.font"));
  1630. }
  1631. var s = (this._doTransition && this._lastVisible[i]) ? this._selectors[i].transition("transition").duration(this._duration) : this._selectors[i];
  1632. s.attr("transform", "translate(" + x + "," + y + ")").call(this._comp);
  1633. var dataSlotEntries = [];
  1634. if (this._dataSlotEntries[i]) {
  1635. dataSlotEntries.push(this._dataSlotEntries[i]);
  1636. }
  1637. this._selectors[i].selectAll(".legendTitle").property("dataSlots", dataSlotEntries);
  1638. if (visible) {
  1639. x += dx;
  1640. y += dy;
  1641. if (this._comp.getSpaceUsed() > this._spaceUsed) {
  1642. this._spaceUsed = this._comp.getSpaceUsed();
  1643. }
  1644. }
  1645. this._lastVisible[i] = visible;
  1646. } else {
  1647. this._lastVisible[i] = false;
  1648. }
  1649. }
  1650. return this;
  1651. },
  1652. /** @expose */
  1653. getSizableType : function() {
  1654. return 2;
  1655. },
  1656. /** @expose */
  1657. getSizableOrientation : function() {
  1658. return this._orient;
  1659. },
  1660. /** @expose */
  1661. getPreferredSize : function() {
  1662. return this._spaceUsed;
  1663. },
  1664. /** @expose */
  1665. getSpillOverSize : function() {
  1666. return 0;
  1667. },
  1668. /** @expose */
  1669. visible : function(a0, a1) {
  1670. var args = arguments;
  1671. if (args.length == 1) {
  1672. return this.visible$1(a0);
  1673. }
  1674. return this.visible$0(a0, a1);
  1675. },
  1676. /** @expose */
  1677. preLayout : function(a0, a1) {
  1678. var args = arguments;
  1679. if (args.length == 1) {
  1680. return this.preLayout$0(a0);
  1681. }
  1682. return this.preLayout$1(a0, a1);
  1683. }
  1684. });
  1685. // $source: com/ibm/rave/bundles/utilities/FontPropertyParser
  1686. /************************************************************************
  1687. ** IBM Confidential
  1688. **
  1689. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1690. **
  1691. ** (C) Copyright IBM Corp. 2017
  1692. **
  1693. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1694. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1695. ************************************************************************/
  1696. // GENERATED
  1697. var com_ibm_rave_bundles_utilities_FontPropertyParser = rave['internal']['Declare']({
  1698. });
  1699. /**
  1700. * Method to parse the css font styles and return a style map.
  1701. * @param (String) fontStyle CSS string (eg. "font-family: courier; font-size: 22; fill: red")
  1702. * @return (Object) Font Style Map
  1703. */
  1704. /** @expose */
  1705. com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont = function(fontStyle) {
  1706. if (fontStyle != null && fontStyle.length > 0) {
  1707. var properties = fontStyle.split(new RegExp(";"));
  1708. var fontStyles = {};
  1709. for (var __i_enFor0 = 0, __len_enFor0 = properties.length;
  1710. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1711. var property = properties[__i_enFor0];
  1712. var fontMap = property.split(new RegExp(":"));
  1713. if (fontMap.length == 2) {
  1714. var key = fontMap[0].trim();
  1715. fontStyles[key == "color" ? "fill" : key] = fontMap[1].trim();
  1716. }
  1717. }
  1718. return fontStyles;
  1719. }
  1720. return null;
  1721. };
  1722. // $source: com/ibm/rave/bundles/components/AxesManager
  1723. /************************************************************************
  1724. ** IBM Confidential
  1725. **
  1726. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1727. **
  1728. ** (C) Copyright IBM Corp. 2018
  1729. **
  1730. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1731. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1732. ************************************************************************/
  1733. // GENERATED
  1734. //@import com/ibm/rave/bundles/components/AxisComponentImpl (runtime) // new, getTranslation
  1735. //@import com/ibm/rave/bundles/components/GridComponentImpl (runtime) // new
  1736. //@import com/ibm/rave/bundles/components/ClipPathComponentImpl (runtime) // new
  1737. /**
  1738. * <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>
  1739. */
  1740. var com_ibm_rave_bundles_components_AxesManager = rave['internal']['Declare']({
  1741. /**
  1742. * Bundle context
  1743. */
  1744. //_context : null,
  1745. /**
  1746. * Selector for the bundle defs node. If null, no clip paths will be defined.
  1747. */
  1748. //_defs : null,
  1749. /**
  1750. * Scales for the axes, indexed by X1, X2, Y1, Y2
  1751. */
  1752. //_scales : null,
  1753. /**
  1754. * Whether to suppress labels when panning, indexed by X1, X2, Y1, Y2.
  1755. */
  1756. //_suppressPanLabels : null,
  1757. /**
  1758. * Value of the axis drawAxisLabels, set when axis is drawn, indexed by X1, X2, Y1, Y2.
  1759. */
  1760. //_drawAxisLabels : null,
  1761. /**
  1762. * Axis components created on demand, indexed by X1, X2, Y1, Y2
  1763. */
  1764. //_axisComponents : null,
  1765. /**
  1766. * When last drawn, the selector used for each axis role, indexed by X1, X2, Y1, Y2; used for redraws.
  1767. */
  1768. //_lastAxisDrawSelectors : null,
  1769. /**
  1770. * Grid components created on demand, indexed by X1, X2, Y1, Y2
  1771. */
  1772. //_gridComponents : null,
  1773. /**
  1774. * When last drawn, the selector used for each grid role, indexed by X1, X2, Y1, Y2; used for redraws.
  1775. */
  1776. //_lastGridDrawSelectors : null,
  1777. /**
  1778. * For clearing axis
  1779. */
  1780. //_clearAxis : null,
  1781. /**
  1782. * For clearing grid
  1783. */
  1784. //_clearGrid : null,
  1785. /**
  1786. * Selectors for the axis groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1787. */
  1788. //_axisSelectors : null,
  1789. /**
  1790. * Selectors for the grid groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1791. */
  1792. //_gridSelectors : null,
  1793. /**
  1794. * Bounding rectangles for the axis groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1795. */
  1796. //_axisRects : null,
  1797. /**
  1798. * Center elements bounds, also the grid bounds.
  1799. */
  1800. //_elementRect : null,
  1801. /**
  1802. * Whether anything was drawn into the axis group last time, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1803. */
  1804. //_lastAxisDrew : null,
  1805. /**
  1806. * Whether anything was drawn into the grid group last time, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1807. */
  1808. //_lastGridDrew : null,
  1809. //_dataSlotEntries : null,
  1810. //_layoutAxisOrder : null,
  1811. /**
  1812. * On the first draw, no transitions are used.
  1813. */
  1814. _firstDraw : false,
  1815. /**
  1816. * Whether to draw the axes and grids.
  1817. */
  1818. _visible : true,
  1819. /**
  1820. * Transition duration, ms
  1821. */
  1822. _duration : 0,
  1823. /**
  1824. * Transpose the axes (assign X to left/right and Y to top/bottom)
  1825. */
  1826. _transpose : false,
  1827. /**
  1828. * Switch the independent (X) axes, drawing X1 where X2 normally goes and vice-versa
  1829. */
  1830. _swapX : false,
  1831. /**
  1832. * Switch the dependent (Y) axes, drawing Y1 where Y2 normally goes and vice-versa
  1833. */
  1834. _swapY : false,
  1835. _layoutInProgress : false,
  1836. _layoutMaxWidth : 0,
  1837. _layoutMaxHeight : 0,
  1838. _xPadding : 0, _xOuterPadding : 0, _yPadding : 0, _yOuterPadding : 0,
  1839. _xPixelPad : 0, _yPixelPad : 0,
  1840. /**
  1841. * Hack to allow heatmap in "unit cell" mode to disable stagger because of the post scaling that messes up axis layout
  1842. */
  1843. _preventStaggerRotate45 : false,
  1844. constructor : function(context) {
  1845. this._scales = [];
  1846. this._suppressPanLabels = [];
  1847. this._drawAxisLabels = [];
  1848. this._axisComponents = [];
  1849. this._lastAxisDrawSelectors = [];
  1850. this._gridComponents = [];
  1851. this._lastGridDrawSelectors = [];
  1852. this._clearAxis = new com_ibm_rave_bundles_components_AxisComponentImpl();
  1853. this._clearGrid = new com_ibm_rave_bundles_components_GridComponentImpl();
  1854. this._axisSelectors = [];
  1855. this._gridSelectors = [];
  1856. this._axisRects = [];
  1857. this._elementRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1858. this._lastAxisDrew = [];
  1859. this._lastGridDrew = [];
  1860. this._dataSlotEntries = [];
  1861. this._layoutAxisOrder = [];
  1862. /**
  1863. * Construct and initialize. No axis scales or selector groups are defined.
  1864. * @param (rave['library']['internal']['BundleContext']) context The bundle context
  1865. */
  1866. {
  1867. this._context = context;
  1868. for (var i = 0; i < 4; ++i) {
  1869. this._scales[i] = null;
  1870. this._suppressPanLabels[i] = false;
  1871. this._axisComponents[i] = null;
  1872. this._lastAxisDrawSelectors[i] = null;
  1873. this._gridComponents[i] = null;
  1874. this._lastGridDrawSelectors[i] = null;
  1875. this._axisSelectors[i] = null;
  1876. this._gridSelectors[i] = null;
  1877. this._axisRects[i] = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1878. this._lastAxisDrew[i] = false;
  1879. this._lastGridDrew[i] = false;
  1880. this._dataSlotEntries[i] = [];
  1881. }
  1882. }
  1883. },
  1884. /** @expose */
  1885. preLayout : function(layoutComponent, axesBeforeLegend, xPadding, xOuterPadding, xPixelPad, yPadding, yOuterPadding, yPixelPad) {
  1886. this._xPadding = xPadding;
  1887. this._xOuterPadding = xOuterPadding;
  1888. this._xPixelPad = xPixelPad;
  1889. this._yPadding = yPadding;
  1890. this._yOuterPadding = yOuterPadding;
  1891. this._yPixelPad = yPixelPad;
  1892. this._layoutInProgress = true;
  1893. var layoutDuration = this._duration;
  1894. this._duration = 0;
  1895. 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"];
  1896. rave['library']['internal']['AbstractView'].createGroupStructure(this._context.node.select("g.axes-layout"), children);
  1897. var layoutAxisSelectors = [];
  1898. var layoutGridSelectors = [];
  1899. var layoutLastAxisDrew = [];
  1900. for (var position = 0; position < 4; ++position) {
  1901. if (this._axisComponents[position]) {
  1902. this._axisComponents[position].preLayout();
  1903. }
  1904. layoutAxisSelectors[position] = this._axisSelectors[position];
  1905. layoutGridSelectors[position] = this._gridSelectors[position];
  1906. layoutLastAxisDrew[position] = this._lastAxisDrew[position];
  1907. if (this._axisSelectors[position]) {
  1908. this.axisSelector(position, this._context.node.select("g.layoutAxis-" + com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position]));
  1909. }
  1910. if (this._gridSelectors[position]) {
  1911. this.gridSelector(position, this._context.node.select("g.layoutGrid-" + com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position]));
  1912. }
  1913. }
  1914. layoutComponent.preLayout(axesBeforeLegend, true);
  1915. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, layoutComponent.elementRect());
  1916. var countHorz = 0;
  1917. var countVert = 0;
  1918. var axes = [];
  1919. for (var position = 0; position < 4; ++position) {
  1920. var role = this.positionToRole(position);
  1921. var isHorz = position == 1 || position == 0;
  1922. if (this._axisSelectors[position] && this._scales[role]) {
  1923. if (isHorz) {
  1924. countHorz++;
  1925. } else {
  1926. countVert++;
  1927. }
  1928. if (this._scales[role].isOrdinal() || this._scales[role].isClustered()) {
  1929. var score = isHorz ? 4 : 2;
  1930. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, score));
  1931. } else {
  1932. var score = isHorz ? 3 : 1;
  1933. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, score));
  1934. }
  1935. } else {
  1936. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, 5));
  1937. }
  1938. }
  1939. axes.sort(function(a1, a2) {
  1940. var a1value = a1.score;
  1941. var a2value = a2.score;
  1942. return a1value < a2value ? -1 : a1value > a2value ? 1 : 0;
  1943. });
  1944. this._layoutAxisOrder = [];
  1945. for (var i = 0; i < 4; ++i) {
  1946. this._layoutAxisOrder[i] = axes[i].position;
  1947. }
  1948. this._layoutMaxWidth = this._elementRect.width * (countVert > 1 ? 0.5 : 0.4);
  1949. this._layoutMaxHeight = this._elementRect.height * (countHorz > 1 ? 0.5 : 0.4);
  1950. for (var index = 0; index < 4; ++index) {
  1951. var position = this._layoutAxisOrder[index];
  1952. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[position], this._elementRect);
  1953. }
  1954. this.draw();
  1955. this._duration = layoutDuration;
  1956. this._context.node.select("g.axes-layout").selectAll("*").remove();
  1957. for (var position = 0; position < 4; ++position) {
  1958. this._lastAxisDrew[position] = layoutLastAxisDrew[position];
  1959. this._axisSelectors[position] = layoutAxisSelectors[position];
  1960. this._gridSelectors[position] = layoutGridSelectors[position];
  1961. }
  1962. this._layoutInProgress = false;
  1963. return this;
  1964. },
  1965. getPositionToDraw : function(index) {
  1966. return this._layoutInProgress ? this._layoutAxisOrder[index] : index;
  1967. },
  1968. preDrawAxis : function(index) {
  1969. if (this._layoutInProgress) {
  1970. var position = this._layoutAxisOrder[index];
  1971. var role = this.positionToRole(position);
  1972. if (role == 0 || role == 1) {
  1973. this.setScaleRangePadded(this._scales[role], false, this._xPadding, this._xOuterPadding, this._xPixelPad);
  1974. } else {
  1975. this.setScaleRangePadded(this._scales[role], true, this._yPadding, this._yOuterPadding, this._yPixelPad);
  1976. }
  1977. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(true);
  1978. }
  1979. },
  1980. postDrawAxis : function(index) {
  1981. if (this._layoutInProgress) {
  1982. var position = this._layoutAxisOrder[index];
  1983. var role = this.positionToRole(position);
  1984. var axis = this._axisComponents[role];
  1985. var size = axis.getPreferredSize();
  1986. if (position == 1 || position == 0) {
  1987. if (size > this._layoutMaxHeight) {
  1988. size = this._layoutMaxHeight;
  1989. }
  1990. this._elementRect.height -= size;
  1991. if (position == 1) {
  1992. this._elementRect.y += size;
  1993. }
  1994. } else {
  1995. if (size > this._layoutMaxWidth) {
  1996. size = this._layoutMaxWidth;
  1997. }
  1998. this._elementRect.width -= size;
  1999. if (position == 2) {
  2000. this._elementRect.x += size;
  2001. }
  2002. }
  2003. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(false);
  2004. }
  2005. },
  2006. /**
  2007. * 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.
  2008. */
  2009. /** @expose */
  2010. draw : function() {
  2011. for (var role = 0; role < 4; ++role) {
  2012. this._lastAxisDrawSelectors[role] = null;
  2013. this._lastGridDrawSelectors[role] = null;
  2014. }
  2015. for (var index = 0; index < 4; ++index) {
  2016. var position = this.getPositionToDraw(index);
  2017. var role = this.positionToRole(position);
  2018. if (!this._visible || !this._axisSelectors[position] || !this._scales[role]) {
  2019. this.clearAxis(position);
  2020. this.clearGrid(position);
  2021. } else {
  2022. this.preDrawAxis(index);
  2023. this.drawAxis(position, role);
  2024. this.postDrawAxis(index);
  2025. if (this._gridSelectors[position]) {
  2026. this.drawGrid(position, role);
  2027. }
  2028. }
  2029. }
  2030. this._firstDraw = false;
  2031. },
  2032. /**
  2033. * @return (boolean) true if we are hiding any labels during pan-zoom.
  2034. */
  2035. /** @expose */
  2036. hideAnyPanZoom : function() {
  2037. return (this._suppressPanLabels[0] || this._suppressPanLabels[1] || this._suppressPanLabels[2] || this._suppressPanLabels[3]);
  2038. },
  2039. /**
  2040. * 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.
  2041. * @param (boolean) panning Whether this is a pan in-progress; use false otherwise including when pan-zoom ends.
  2042. */
  2043. /** @expose */
  2044. redraw : function(panning) {
  2045. for (var role = 0; role < 4; ++role) {
  2046. if (this._axisComponents[role] && this._lastAxisDrawSelectors[role]) {
  2047. this._axisComponents[role].displayTickLabels(this._drawAxisLabels[role]);
  2048. this._axisComponents[role].showPanZoomTickLabels(!panning || !this._suppressPanLabels[role]);
  2049. var isAllow = this._axisComponents[role].isAllowAutomaticAxisLayoutToChangeOrientation();
  2050. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(false);
  2051. this._lastAxisDrawSelectors[role].call(this._axisComponents[role]);
  2052. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(isAllow);
  2053. }
  2054. if (this._gridComponents[role] && this._lastGridDrawSelectors[role]) {
  2055. this._lastGridDrawSelectors[role].call(this._gridComponents[role]);
  2056. }
  2057. }
  2058. },
  2059. /** @expose */
  2060. preventStaggerRotate45 : function(preventStaggerRotate45) {
  2061. this._preventStaggerRotate45 = preventStaggerRotate45;
  2062. },
  2063. /**
  2064. * 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.
  2065. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2066. * @param (int) role The axis role, X1, X2, Y1, or Y2
  2067. */
  2068. drawAxis : function(position, role) {
  2069. var axisGroup = this._axisSelectors[position];
  2070. this._lastAxisDrawSelectors[role] = axisGroup;
  2071. var comp = this.axisComponent(role);
  2072. var layoutModeID = role == 2 ? "axis.y.labels.layoutMode" : role == 3 ? "axis.y2.labels.layoutMode" : "axis.x.labels.layoutMode";
  2073. var allowStaggerID = role == 2 ? "axis.y.labels.allowStagger" : role == 3 ? "axis.y2.labels.allowStagger" : "axis.x.labels.allowStagger";
  2074. var allowRotate45ID = role == 2 ? "axis.y.labels.allowRotate45" : role == 3 ? "axis.y2.labels.allowRotate45" : "axis.x.labels.allowRotate45";
  2075. var allowRotate90ID = role == 2 ? "axis.y.labels.allowRotate90" : role == 3 ? "axis.y2.labels.allowRotate90" : "axis.x.labels.allowRotate90";
  2076. var layoutMode = ""+(this._context.getPropertyValue(layoutModeID));
  2077. var allowStagger = !this._preventStaggerRotate45 && (this._context.getPropertyValue(allowStaggerID));
  2078. var allowRotate45 = !this._preventStaggerRotate45 && (this._context.getPropertyValue(allowRotate45ID));
  2079. var allowRotate90 = (this._context.getPropertyValue(allowRotate90ID));
  2080. var textTruncateIndicator = (this._context.getPropertyValue("axis.labels.truncationText"));
  2081. var axisBounds = this._axisRects[position];
  2082. var orient = com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position];
  2083. var transform = com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation(axisBounds, orient);
  2084. var axisTransform = "translate(" + transform[0] + "," + transform[1] + ")";
  2085. 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);
  2086. this._drawAxisLabels[role] = comp._displayTickLabels;
  2087. var axisGroupUpdate = axisGroup;
  2088. if (this._duration > 0 && !this._firstDraw && this._lastAxisDrew[position]) {
  2089. axisGroupUpdate = axisGroup.transition().duration(this._duration);
  2090. }
  2091. axisGroupUpdate.attr("transform", axisTransform);
  2092. axisGroupUpdate.call(comp);
  2093. var dataSlotEntryList = this._dataSlotEntries[role];
  2094. axisGroup.selectAll(".axis-title").property("dataSlots", dataSlotEntryList);
  2095. this._lastAxisDrew[position] = comp.renderedShapes();
  2096. if (this._defs) {
  2097. var clipAxis = new com_ibm_rave_bundles_components_ClipPathComponentImpl(this._context.instanceId() + "clip" + orient);
  2098. var text = axisGroup.append("text").text("000,000");
  2099. var bbox = text.node().getBBox();
  2100. var w = bbox.width;
  2101. var h = bbox.height;
  2102. text.remove();
  2103. var clipRect;
  2104. if (position == 0 || position == 1) {
  2105. var leftEdge = axisBounds.x + transform[0] * -1;
  2106. var rightEdge = leftEdge + axisBounds.width;
  2107. if (!(this._scales[role].isOrdinal()) && !(this._scales[role].isClustered())) {
  2108. var numericLeftEdge = this._elementRect.x - w + transform[0] * -1;
  2109. var numericRightEdge = numericLeftEdge + this._elementRect.width + w * 2;
  2110. if (numericLeftEdge < leftEdge) {
  2111. leftEdge = numericLeftEdge;
  2112. }
  2113. if (numericRightEdge > rightEdge) {
  2114. rightEdge = numericRightEdge;
  2115. }
  2116. }
  2117. clipRect = new rave['internal']['RectStruct'](leftEdge, axisBounds.y + transform[1] * -1, rightEdge - leftEdge, axisBounds.height);
  2118. } else {
  2119. clipRect = new rave['internal']['RectStruct'](axisBounds.x + transform[0] * -1, this._elementRect.y - h / 2 + transform[1] * -1, axisBounds.width, this._elementRect.height + h);
  2120. }
  2121. clipAxis.clipRect(clipRect).applyTo(axisGroup.select(".axis." + orient)).call(this._defs);
  2122. }
  2123. },
  2124. /**
  2125. * If the axis selector for the position is defined, clear the shapes from the axis group.
  2126. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2127. */
  2128. clearAxis : function(position) {
  2129. if (this._axisSelectors[position]) {
  2130. this._clearAxis.scale(null);
  2131. this._axisSelectors[position].call(this._clearAxis);
  2132. }
  2133. this._lastAxisDrew[position] = false;
  2134. },
  2135. /**
  2136. * 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.
  2137. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2138. * @param (int) role The axis role, X1, X2, Y1, or Y2
  2139. */
  2140. drawGrid : function(position, role) {
  2141. var gridGroup = this._gridSelectors[position];
  2142. this._lastGridDrawSelectors[role] = gridGroup;
  2143. var comp = this.gridComponent(role);
  2144. var axisBounds = this._axisRects[position];
  2145. var orient = com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position];
  2146. var transform = com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation(axisBounds, orient);
  2147. var axisTransform = "translate(" + transform[0] + "," + transform[1] + ")";
  2148. comp.setRole(com_ibm_rave_bundles_components_AxesManager.ROLES[role]).orient(orient).setPreExecute(this._context.getPreExecute()).bounds(this._elementRect).axis(this._axisComponents[role].axis());
  2149. if (this._duration <= 0 || this._firstDraw || !this._lastAxisDrew[position]) {
  2150. gridGroup.attr("transform", axisTransform).call(comp);
  2151. } else {
  2152. gridGroup.transition().duration(this._duration).attr("transform", axisTransform).call(comp);
  2153. }
  2154. this._lastGridDrew[position] = comp.renderedShapes();
  2155. },
  2156. /**
  2157. * If the grid selector for the position is defined, clear the shapes from the grid group.
  2158. * @param (int) position The grid position, BOTTOM, TOP, LEFT, RIGHT
  2159. */
  2160. clearGrid : function(position) {
  2161. if (this._gridSelectors[position]) {
  2162. this._clearGrid.axis(null);
  2163. this._gridSelectors[position].call(this._clearGrid);
  2164. }
  2165. this._lastGridDrew[position] = false;
  2166. },
  2167. /**
  2168. * @param (boolean) visible Whether the manager should draw axes
  2169. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2170. */
  2171. /** @expose */
  2172. visible : function(visible) {
  2173. this._visible = visible;
  2174. return this;
  2175. },
  2176. /**
  2177. * @param (int) duration The transition duration; if <= 0, no transition is used.
  2178. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2179. */
  2180. /** @expose */
  2181. duration : function(duration) {
  2182. this._duration = duration;
  2183. return this;
  2184. },
  2185. /**
  2186. * @param (boolean) transpose Whether to transpose the chart (switch the positions of the X and Y axis)
  2187. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2188. */
  2189. /** @expose */
  2190. transpose : function(transpose) {
  2191. this._transpose = transpose;
  2192. return this;
  2193. },
  2194. /**
  2195. * @param (boolean) swapX Whether to switch the postitions of the X1 and X2 axes
  2196. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2197. */
  2198. /** @expose */
  2199. swapX : function(swapX) {
  2200. this._swapX = swapX;
  2201. return this;
  2202. },
  2203. /**
  2204. * @param (boolean) swapY Whether to switch the postitions of the Y1 and Y2 axes
  2205. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2206. */
  2207. /** @expose */
  2208. swapY : function(swapY) {
  2209. this._swapY = swapY;
  2210. return this;
  2211. },
  2212. /**
  2213. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2214. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale The coordinate scale for that role, may be null
  2215. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2216. */
  2217. /** @expose */
  2218. scale : function(role, scale) {
  2219. this._scales[role] = scale;
  2220. return this;
  2221. },
  2222. /**
  2223. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2224. * @param (boolean) suppressLabels Whether to suppress the labels when panning the axis
  2225. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2226. */
  2227. /** @expose */
  2228. suppressPanLabels : function(role, suppressLabels) {
  2229. this._suppressPanLabels[role] = suppressLabels;
  2230. return this;
  2231. },
  2232. /**
  2233. * 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.
  2234. * @param (int) role The role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2235. * @return (com.ibm.rave.bundles.components.AxisComponentImpl) The component for the role
  2236. */
  2237. /** @expose */
  2238. axisComponent : function(role) {
  2239. if (!this._axisComponents[role]) {
  2240. this._axisComponents[role] = new com_ibm_rave_bundles_components_AxisComponentImpl();
  2241. }
  2242. return this._axisComponents[role];
  2243. },
  2244. /**
  2245. * 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.
  2246. * @param (int) role The role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2247. * @return (com.ibm.rave.bundles.components.GridComponentImpl) The component for the role
  2248. */
  2249. /** @expose */
  2250. gridComponent : function(role) {
  2251. if (!this._gridComponents[role]) {
  2252. this._gridComponents[role] = new com_ibm_rave_bundles_components_GridComponentImpl();
  2253. }
  2254. return this._gridComponents[role];
  2255. },
  2256. /**
  2257. * Set the bundle &lt;defs&gt; node. Clip paths will be defined in this node.
  2258. * @param (rave['internal']['Selector']) defs The defs node
  2259. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2260. */
  2261. /** @expose */
  2262. defsSelector : function(defs) {
  2263. this._defs = com_ibm_rave_bundles_components_AxesManager.checkSelector(defs);
  2264. return this;
  2265. },
  2266. /**
  2267. * Set the selector for an axis group node.
  2268. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2269. * @param (rave['internal']['Selector']) axisGroup The axis group node, may be null
  2270. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2271. */
  2272. /** @expose */
  2273. axisSelector : function(position, axisGroup) {
  2274. this._axisSelectors[position] = com_ibm_rave_bundles_components_AxesManager.checkSelector(axisGroup);
  2275. return this;
  2276. },
  2277. /**
  2278. * Set the selector for a grid group node.
  2279. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2280. * @param (rave['internal']['Selector']) gridGroup The grid group node, may be null
  2281. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2282. */
  2283. /** @expose */
  2284. gridSelector : function(position, gridGroup) {
  2285. this._gridSelectors[position] = com_ibm_rave_bundles_components_AxesManager.checkSelector(gridGroup);
  2286. return this;
  2287. },
  2288. /**
  2289. * Set the element (grid) bounds rectangle to a copy of the given rectangle.
  2290. * @param (rave['internal']['RectStruct']) elementRect The rectangle, if null the bounds are set to 0,0,0,0
  2291. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2292. */
  2293. /** @expose */
  2294. elementRect : function(elementRect) {
  2295. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, elementRect);
  2296. return this;
  2297. },
  2298. /**
  2299. * Set an axis bounds rectangle to a copy of the given rectangle.
  2300. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2301. * @param (rave['internal']['RectStruct']) axisRect The axis bounds, if null the bounds are set to 0,0,0,0
  2302. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2303. */
  2304. /** @expose */
  2305. axisRect : function(position, axisRect) {
  2306. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[position], axisRect);
  2307. return this;
  2308. },
  2309. /**
  2310. * 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.
  2311. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2312. */
  2313. /** @expose */
  2314. useDefaultSelectors : function() {
  2315. this.defsSelector(this._context.node.select("defs"));
  2316. this.axisSelector(0, this._context.node.select("g.axisTransform.bottom"));
  2317. this.axisSelector(1, this._context.node.select("g.axisTransform.top"));
  2318. this.axisSelector(2, this._context.node.select("g.axisTransform.left"));
  2319. this.axisSelector(3, this._context.node.select("g.axisTransform.right"));
  2320. this.gridSelector(0, this._context.node.select("g.grid.bottom"));
  2321. this.gridSelector(1, this._context.node.select("g.grid.top"));
  2322. this.gridSelector(2, this._context.node.select("g.grid.left"));
  2323. this.gridSelector(3, this._context.node.select("g.grid.right"));
  2324. return this;
  2325. },
  2326. /**
  2327. * Convenience method: Set the element rectangle and axis rectangles from the rectangles in the layout.
  2328. * @param (com.ibm.rave.bundles.components.ChartLayoutComponentImpl) layoutInfo Layout information
  2329. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2330. */
  2331. /** @expose */
  2332. useBoundsFromLayout : function(layoutInfo) {
  2333. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, layoutInfo.elementRect());
  2334. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[0], layoutInfo.bottomRect());
  2335. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[1], layoutInfo.topRect());
  2336. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[2], layoutInfo.leftRect());
  2337. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[3], layoutInfo.rightRect());
  2338. return this;
  2339. },
  2340. /**
  2341. * 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.
  2342. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2343. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2344. */
  2345. /** @expose */
  2346. useDefaultX1Properties : function(setGridParameters) {
  2347. 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"))));
  2348. var titleFontStyle = (this._context.getPropertyValue("axis.x.title.style.font"));
  2349. var labelFontStyle = (this._context.getPropertyValue("axis.x.labels.style.font"));
  2350. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2351. this.axisComponent(0).labelStyle(labelFontStyle);
  2352. } else {
  2353. 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")));
  2354. }
  2355. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2356. this.axisComponent(0).titleStyle(titleFontStyle);
  2357. } else {
  2358. 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")));
  2359. }
  2360. if (setGridParameters) {
  2361. 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")));
  2362. }
  2363. this.suppressPanLabels(0, (this._context.getPropertyValue("axis.x.labels.zoomPan")));
  2364. return this;
  2365. },
  2366. /**
  2367. * 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.
  2368. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2369. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2370. */
  2371. /** @expose */
  2372. useDefaultY1Properties : function(setGridParameters) {
  2373. 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")));
  2374. var titleFontStyle = (this._context.getPropertyValue("axis.y.title.style.font"));
  2375. var labelFontStyle = (this._context.getPropertyValue("axis.y.labels.style.font"));
  2376. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2377. this.axisComponent(2).labelStyle(labelFontStyle);
  2378. } else {
  2379. 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")));
  2380. }
  2381. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2382. this.axisComponent(2).titleStyle(titleFontStyle);
  2383. } else {
  2384. 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")));
  2385. }
  2386. if (setGridParameters) {
  2387. 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")));
  2388. }
  2389. this.suppressPanLabels(2, (this._context.getPropertyValue("axis.y.labels.zoomPan")));
  2390. return this;
  2391. },
  2392. /**
  2393. * 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.
  2394. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2395. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2396. */
  2397. /** @expose */
  2398. useDefaultY2Properties : function(setGridParameters) {
  2399. 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")));
  2400. var titleFontStyle = (this._context.getPropertyValue("axis.y2.title.style.font"));
  2401. var labelFontStyle = (this._context.getPropertyValue("axis.y2.labels.style.font"));
  2402. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2403. this.axisComponent(3).labelStyle(labelFontStyle);
  2404. } else {
  2405. 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")));
  2406. }
  2407. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2408. this.axisComponent(3).titleStyle(titleFontStyle);
  2409. } else {
  2410. 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")));
  2411. }
  2412. if (setGridParameters) {
  2413. 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")));
  2414. }
  2415. this.suppressPanLabels(3, (this._context.getPropertyValue("axis.y2.labels.zoomPan")));
  2416. return this;
  2417. },
  2418. /**
  2419. * 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.
  2420. * @param (int) role One of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2421. * @param (Array) entries Non-null list of data slot entries
  2422. * @param (String) format One of {@link this.CustomFormatInfo#"none"} or {@link this.CustomFormatInfo#"percent"}
  2423. * @param (rave['internal']['ValueFunction']) defaultFunction Default function to use if no custom formatter is defined for the axis, may be null
  2424. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2425. */
  2426. /** @expose */
  2427. setTickFormatterList : function(role, entries, format, defaultFunction) {
  2428. var fmtRole;
  2429. switch (role) {
  2430. case 2:
  2431. fmtRole = "ROLE_Y1";
  2432. break;
  2433. case 1:
  2434. fmtRole = "ROLE_X2";
  2435. break;
  2436. case 3:
  2437. fmtRole = "ROLE_Y2";
  2438. break;
  2439. case 0:
  2440. default:
  2441. fmtRole = "ROLE_X1";
  2442. break;
  2443. }
  2444. 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);
  2445. this.axisComponent(role).tickFormat(fmt);
  2446. 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);
  2447. this.axisComponent(role).simplifiedTickFormat(simplefmt);
  2448. return this;
  2449. },
  2450. /**
  2451. * 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.
  2452. * @param (int) role One of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2453. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  2454. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2455. */
  2456. /** @expose */
  2457. setTickFormatter : function(role, entry) {
  2458. var entries = [];
  2459. if (entry) {
  2460. entries.push(entry);
  2461. }
  2462. return this.setTickFormatterList(role, entries, "none", null);
  2463. },
  2464. /**
  2465. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined scale.
  2466. * @param (Number) padding Padding, relevant only for ordinal scales
  2467. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2468. * @param (int) pixelPad Pixel padding at each end
  2469. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2470. */
  2471. /** @expose */
  2472. setScaleRanges : function(padding, outerPadding, pixelPad) {
  2473. this.setIndependentScaleRanges(padding, outerPadding, pixelPad);
  2474. this.setDependentScaleRanges(padding, outerPadding, pixelPad);
  2475. return this;
  2476. },
  2477. /**
  2478. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined independent scale.
  2479. * @param (Number) padding Padding, relevant only for ordinal scales
  2480. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2481. * @param (int) pixelPad Pixel padding at each end
  2482. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2483. */
  2484. /** @expose */
  2485. setIndependentScaleRanges : function(padding, outerPadding, pixelPad) {
  2486. this.setScaleRangePadded(this._scales[0], false, padding, outerPadding, pixelPad);
  2487. this.setScaleRangePadded(this._scales[1], false, padding, outerPadding, pixelPad);
  2488. return this;
  2489. },
  2490. /**
  2491. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined independent scale.
  2492. * @param (Number) padding Padding, relevant only for ordinal scales
  2493. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2494. * @param (int) pixelPad Pixel padding at each end
  2495. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2496. */
  2497. /** @expose */
  2498. setDependentScaleRanges : function(padding, outerPadding, pixelPad) {
  2499. this.setScaleRangePadded(this._scales[2], true, padding, outerPadding, pixelPad);
  2500. this.setScaleRangePadded(this._scales[3], true, padding, outerPadding, pixelPad);
  2501. return this;
  2502. },
  2503. /**
  2504. * 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)} .
  2505. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2506. * @param (rave['library']['internal']['DataSlotEntry']) slot DataSlotEntry to be associated with the axis role.
  2507. */
  2508. setDataSlot$0 : function(role, slot) {
  2509. this.setDataSlot$1(role, [slot]);
  2510. return this;
  2511. },
  2512. /**
  2513. * Set a list of data slot entries that will be associated with the specified axis role.
  2514. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2515. * @param (Array) slots List of DataSlotEntry to be associated with the axis role.
  2516. */
  2517. setDataSlot$1 : function(role, slots) {
  2518. if (role < 4 && role >= 0) {
  2519. this._dataSlotEntries[role].length = 0;
  2520. if (slots) {
  2521. for (var __i_enFor0 = 0, __exp_enFor0 = slots, __len_enFor0 = __exp_enFor0.length;
  2522. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2523. var slot = __exp_enFor0[__i_enFor0];
  2524. this._dataSlotEntries[role].push(slot);
  2525. }
  2526. }
  2527. }
  2528. return this;
  2529. },
  2530. /**
  2531. * </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.
  2532. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale Bundle independent scale
  2533. * @param (boolean) dependent Whether this is the dependent scale
  2534. * @param (Number) padding Padding, relevant only for ordinal scales
  2535. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2536. * @param (int) pixelPad Pixel padding at each end
  2537. */
  2538. setScaleRangePadded : function(scale, dependent, padding, outerPadding, pixelPad) {
  2539. if (scale) {
  2540. var min, max;
  2541. if (dependent == this._transpose) {
  2542. min = this._elementRect.x + pixelPad;
  2543. max = this._elementRect.x + this._elementRect.width - pixelPad;
  2544. } else {
  2545. if (scale.isContinuous()) {
  2546. min = this._elementRect.y + this._elementRect.height - pixelPad;
  2547. max = this._elementRect.y + pixelPad;
  2548. } else {
  2549. min = this._elementRect.y + pixelPad;
  2550. max = this._elementRect.y + this._elementRect.height - pixelPad;
  2551. }
  2552. }
  2553. scale.range(min, max, padding, outerPadding);
  2554. }
  2555. },
  2556. /**
  2557. * Given a geometric position BOTTOM, TOP, LEFT, or RIGHT, return the role X1, X2, Y1, or Y2 used by that role.
  2558. * @param (int) position The position index
  2559. * @return (int) The role index
  2560. */
  2561. positionToRole : function(position) {
  2562. var r = position;
  2563. if (this._transpose) {
  2564. r = (r + 2) % 4;
  2565. }
  2566. if (this._swapX && r < 2) {
  2567. r = 1 - r;
  2568. }
  2569. if (this._swapY && r > 1) {
  2570. r = 5 - r;
  2571. }
  2572. return r;
  2573. },
  2574. /**
  2575. * Given a role X1, X2, Y1, or Y2, return the geometric position BOTTOM, TOP, LEFT, or RIGHT for that role.
  2576. * @param (int) role The role index
  2577. * @return (int) The position index
  2578. */
  2579. roleToPosition : function(role) {
  2580. var p = role;
  2581. if (this._swapX && role < 2) {
  2582. p = 1 - p;
  2583. }
  2584. if (this._swapY && p > 1) {
  2585. p = 5 - p;
  2586. }
  2587. if (this._transpose) {
  2588. p = (p + 2) % 4;
  2589. }
  2590. return p;
  2591. },
  2592. /**
  2593. * Sets the magnitude for the tick interval.
  2594. * @param (int) role role index of the axis
  2595. * @param (Number) tickMagnitude power of 10
  2596. * @return (com.ibm.rave.bundles.components.AxesManager) this
  2597. */
  2598. /** @expose */
  2599. scaleTickMagnitude : function(role, tickMagnitude) {
  2600. this.axisComponent(role).scaleTickMagnitude(tickMagnitude);
  2601. return this;
  2602. },
  2603. /** @expose */
  2604. setDataSlot : function(a0, a1) {
  2605. var args = arguments;
  2606. if (args.length == 2 && typeof a1 === "function") {
  2607. return this.setDataSlot$0(a0, a1);
  2608. }
  2609. return this.setDataSlot$1(a0, a1);
  2610. }
  2611. });
  2612. /**
  2613. * @param (rave['internal']['Selector']) s A selector
  2614. * @return (rave['internal']['Selector']) s if it is non-null and has at least one node, null otherwise
  2615. */
  2616. com_ibm_rave_bundles_components_AxesManager.checkSelector = function(s) {
  2617. return s && !(s.empty()) ? s : null;
  2618. };
  2619. /**
  2620. * Set a rectangle to a copy of another. If the source is null, the target is set to 0,0,0,0
  2621. * @param (rave['internal']['RectStruct']) target A non-null rectangle
  2622. * @param (rave['internal']['RectStruct']) source A possibly-null rectnalge
  2623. */
  2624. com_ibm_rave_bundles_components_AxesManager.setRect = function(target, source) {
  2625. if (source) {
  2626. target.x = source.x;
  2627. target.y = source.y;
  2628. target.width = source.width;
  2629. target.height = source.height;
  2630. } else {
  2631. target.x = 0;
  2632. target.y = 0;
  2633. target.width = 0;
  2634. target.height = 0;
  2635. }
  2636. };
  2637. /**
  2638. * A ValueFunction that appends '%' to the value.
  2639. * @param (int) n Number of digits
  2640. */
  2641. /** @expose */
  2642. com_ibm_rave_bundles_components_AxesManager.percentFormat = function(n) {
  2643. var digits = "." + n + "f";
  2644. var format = rave.format(digits);
  2645. return function(value, ix, gix) {
  2646. return format.call(null, value, 0, 0) + "%";
  2647. };
  2648. };
  2649. /**
  2650. * Called prior to chart layout. Axes are configured with no real bounding constraints to calculate their preferred size.
  2651. */
  2652. com_ibm_rave_bundles_components_AxesManager.AxisLayout = rave['internal']['Declare']({
  2653. /** @expose */
  2654. position : 0,
  2655. /** @expose */
  2656. score : 0,
  2657. constructor : function(position, score) {
  2658. this.position = position;
  2659. this.score = score;
  2660. }
  2661. });
  2662. /**
  2663. * Logical first X (independent) axis, default position bottom
  2664. */
  2665. /** @expose */
  2666. com_ibm_rave_bundles_components_AxesManager.X1 = 0;
  2667. /**
  2668. * Logical second X (independent) axis, default position top
  2669. */
  2670. /** @expose */
  2671. com_ibm_rave_bundles_components_AxesManager.X2 = 1;
  2672. /**
  2673. * Logical first Y (dependent) axis, default position left
  2674. */
  2675. /** @expose */
  2676. com_ibm_rave_bundles_components_AxesManager.Y1 = 2;
  2677. /**
  2678. * Logical first Y (dependent) axis, default position right
  2679. */
  2680. /** @expose */
  2681. com_ibm_rave_bundles_components_AxesManager.Y2 = 3;
  2682. /**
  2683. * Geometric group on bottom
  2684. */
  2685. /** @expose */
  2686. com_ibm_rave_bundles_components_AxesManager.BOTTOM = 0;
  2687. /**
  2688. * Geometric group on top
  2689. */
  2690. /** @expose */
  2691. com_ibm_rave_bundles_components_AxesManager.TOP = 1;
  2692. /**
  2693. * Geometric group on left
  2694. */
  2695. /** @expose */
  2696. com_ibm_rave_bundles_components_AxesManager.LEFT = 2;
  2697. /**
  2698. * Geometric group on right
  2699. */
  2700. /** @expose */
  2701. com_ibm_rave_bundles_components_AxesManager.RIGHT = 3;
  2702. /**
  2703. * Maps the role indexes to the role strings used by the components API
  2704. */
  2705. com_ibm_rave_bundles_components_AxesManager.ROLES = ["ROLE_X1", "ROLE_X2", "ROLE_Y1", "ROLE_Y2"];
  2706. /**
  2707. * Maps the role indexes to the role strings used by the custom formatter API. TODO: Unify the strings
  2708. */
  2709. com_ibm_rave_bundles_components_AxesManager.ROLE_FORMATTERS = ["ROLE_X1", "ROLE_X2", "ROLE_Y1", "ROLE_Y2"];
  2710. /**
  2711. * Maps the position indexes to the orient strings used by D3
  2712. */
  2713. com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS = ["bottom", "top", "left", "right"];
  2714. /**
  2715. * Maps the position indexes to the custom formatter strings
  2716. */
  2717. com_ibm_rave_bundles_components_AxesManager.FORMATTERS = ["bottom", "top", "left", "right"];
  2718. // $source: com/ibm/rave/bundles/component/AxisComponent
  2719. /************************************************************************
  2720. ** IBM Confidential
  2721. **
  2722. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2723. **
  2724. ** (C) Copyright IBM Corp. 2017
  2725. **
  2726. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2727. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2728. ************************************************************************/
  2729. // GENERATED
  2730. /**
  2731. * <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>
  2732. */
  2733. var com_ibm_rave_bundles_component_AxisComponent = rave['internal']['Declare'].implement(
  2734. /**
  2735. * @return (String) The role of the axis in the chart
  2736. */
  2737. //role : function() {},
  2738. /**
  2739. * @return (rave['internal']['Axis']) The capability Axis used by this AxisComponent
  2740. */
  2741. //axis : function() {},
  2742. /**
  2743. * The tickFormat is applied to the values of the ticks to create the string that is displayed.
  2744. * @param (rave['internal']['ValueFunction']) tickFormat The new tickFormat
  2745. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2746. */
  2747. //tickFormat : function(tickFormat) {},
  2748. /**
  2749. * Get the tickFormat function used by this component. May be null.
  2750. * @return (rave['internal']['ValueFunction']) Format function, or null
  2751. */
  2752. //tickFormat : function() {},
  2753. /**
  2754. * Set the indicator to be used for truncated text ex: indicator set to "..." , results in helloworld - > hello...
  2755. * @param (String) indicator the string to be placed to indicated truncated text
  2756. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2757. */
  2758. //textTruncateIndicator : function(indicator) {},
  2759. /**
  2760. * Whether to display the axis title.
  2761. * @param (boolean) displayAxisTitle true to display the axis title, false otherwise
  2762. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2763. */
  2764. //displayAxisTitle : function(displayAxisTitle) {},
  2765. /**
  2766. * Whether to display the axis line.
  2767. * @param (boolean) displayAxisLine true to display the axis line, false otherwise
  2768. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2769. */
  2770. //displayAxisLine : function(displayAxisLine) {},
  2771. /**
  2772. * Whether to display the axis tick marks.
  2773. * @param (boolean) displayTicks true to display the axis ticks, false otherwise
  2774. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2775. */
  2776. //displayTicks : function(displayTicks) {},
  2777. /**
  2778. * Whether to display the axis labels, as set by the show axis labels property
  2779. * @param (boolean) displayTickLabels true to display the axis tick labels, false otherwise
  2780. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2781. */
  2782. //displayTickLabels : function(displayTickLabels) {},
  2783. /**
  2784. * Whether to display the axis labels, as set by the hide pan-zoom labels property
  2785. * @param (boolean) showPanZoomTickLabels true to display the axis tick labels, false otherwise
  2786. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2787. */
  2788. //showPanZoomTickLabels : function(showPanZoomTickLabels) {},
  2789. /**
  2790. * @param (String) axisTitle The new axisTitle
  2791. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2792. */
  2793. //axisTitle : function(axisTitle) {},
  2794. /**
  2795. * 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)} .
  2796. * @param (String) axisColor The new line and tick color
  2797. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2798. */
  2799. //axisColor : function(axisColor) {},
  2800. /**
  2801. * The color used to draw the axis line.
  2802. * @param (String) lineColor The new lineColor
  2803. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2804. */
  2805. //lineColor : function(lineColor) {},
  2806. /**
  2807. * The color used to draw the axis ticks.
  2808. * @param (String) tickColor The new tickColor
  2809. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2810. */
  2811. //tickColor : function(tickColor) {},
  2812. /**
  2813. * The color used to draw the axis labels.
  2814. * @param (String) labelColor The new labelColor
  2815. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2816. */
  2817. //labelColor : function(labelColor) {},
  2818. /**
  2819. * The style for the axis labels.
  2820. * @param (String) fontStyle CSS string of font properties
  2821. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2822. */
  2823. //labelStyle : function(fontStyle) {},
  2824. /**
  2825. * The style for the axis labels.
  2826. * @param (String) fill The color used to draw the labels
  2827. * @param (String) fontSize CSS font size
  2828. * @param (String) fontFamily CSS font-families list
  2829. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2830. */
  2831. //labelStyle : function(fill, fontSize, fontFamily) {},
  2832. /**
  2833. * The color used to draw the axis title.
  2834. * @param (String) titleColor The new titleColor
  2835. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2836. */
  2837. //titleColor : function(titleColor) {},
  2838. /**
  2839. * The style for the axis title.
  2840. * @param (String) fontStyle CSS string of font properties
  2841. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2842. */
  2843. //titleStyle : function(fontStyle) {},
  2844. /**
  2845. * The style for the axis title.
  2846. * @param (String) fill The color used to draw the title
  2847. * @param (String) fontSize CSS font size
  2848. * @param (String) fontFamily CSS font-families list
  2849. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2850. */
  2851. //titleStyle : function(fill, fontSize, fontFamily) {}
  2852. );
  2853. /**
  2854. * The string returned by {@link #this.type()} is "AxisComponent".
  2855. */
  2856. /** @expose */
  2857. com_ibm_rave_bundles_component_AxisComponent.COMPONENT_TYPE = "AxisComponent";
  2858. /**
  2859. * Returned by {@link #this.role()} for the first independent axis.
  2860. */
  2861. /** @expose */
  2862. com_ibm_rave_bundles_component_AxisComponent.ROLE_X1 = "ROLE_X1";
  2863. /**
  2864. * Returned by {@link #this.role()} for the first dependent axis.
  2865. */
  2866. /** @expose */
  2867. com_ibm_rave_bundles_component_AxisComponent.ROLE_Y1 = "ROLE_Y1";
  2868. /**
  2869. * Returned by {@link #this.role()} for the second independent axis.
  2870. */
  2871. /** @expose */
  2872. com_ibm_rave_bundles_component_AxisComponent.ROLE_X2 = "ROLE_X2";
  2873. /**
  2874. * Returned by {@link #this.role()} for the second dependent axis.
  2875. */
  2876. /** @expose */
  2877. com_ibm_rave_bundles_component_AxisComponent.ROLE_Y2 = "ROLE_Y2";
  2878. // $source: com/ibm/rave/bundles/utilities/TextCrossfader
  2879. /************************************************************************
  2880. ** IBM Confidential
  2881. **
  2882. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2883. **
  2884. ** (C) Copyright IBM Corp. 2017
  2885. **
  2886. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2887. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2888. ************************************************************************/
  2889. // GENERATED
  2890. /**
  2891. * <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>
  2892. */
  2893. var com_ibm_rave_bundles_utilities_TextCrossfader = rave['internal']['Declare']({
  2894. });
  2895. /**
  2896. * <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!
  2897. * @param (rave['internal']['Selection']) selection Selection containing the single text node, may be a transition
  2898. * @param (String) oldText Old value of the text string, may be null
  2899. * @param (String) newText New value of the text string, may be null
  2900. * @param (Object) fillOpacity Fill opacity, may be null (in which case 1.0 is assumed)
  2901. * @param (double) delay Number between 0 and 0.5 controlling the timing of the fade
  2902. * @return (rave['internal']['Selection']) The selection, modified by the new text and fill-opacity
  2903. */
  2904. /** @expose */
  2905. com_ibm_rave_bundles_utilities_TextCrossfader.textCrossFade = function(selection, oldText, newText, fillOpacity, delay) {
  2906. if (!(selection.isTransition())) {
  2907. return selection.text(newText);
  2908. }
  2909. var _t = (selection).tween("text", function(data, index, groupIndex) {
  2910. return function(t) {
  2911. this.rave_setText(t < 0.5 ? oldText : newText);
  2912. };
  2913. });
  2914. var t0 = Math.max(0.0, Math.min(0.5, delay));
  2915. if (t0 == 0.5 || (oldText == null && newText == null) || (oldText != null && oldText == newText)) {
  2916. return selection;
  2917. }
  2918. var opacity = fillOpacity == null ? 1.0 : + (fillOpacity);
  2919. var tf = 1.0 / (0.5 - t0);
  2920. return _t.tween("fill-opacity", function(data, index, groupIndex) {
  2921. return function(t) {
  2922. if (t <= t0 || t >= (1.0 - t0)) {
  2923. this.rave_setStyle("fill-opacity", fillOpacity);
  2924. } else {
  2925. this.rave_setStyle("fill-opacity", opacity * Math.abs(t - 0.5) * tf);
  2926. }
  2927. };
  2928. });
  2929. };
  2930. // $source: com/ibm/rave/bundles/utilities/BundleLabelDropper
  2931. /************************************************************************
  2932. ** IBM Confidential
  2933. **
  2934. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2935. **
  2936. ** (C) Copyright IBM Corp. 2017
  2937. **
  2938. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2939. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2940. ************************************************************************/
  2941. // GENERATED
  2942. var com_ibm_rave_bundles_utilities_BundleLabelDropper = rave['internal']['Declare']({
  2943. //_dropOverlap : null,
  2944. labelCount : 0,
  2945. _$functionClassMethod : function() {
  2946. var _$self = function(args) {
  2947. if (args !== null || arguments.length > 1){
  2948. args = Array.prototype.slice.call(arguments, 0);
  2949. }
  2950. {
  2951. _$self.drop(args[0], ((args[1])));
  2952. return null;
  2953. }
  2954. };
  2955. return _$self;
  2956. },
  2957. /** @expose */
  2958. constructor : function() {
  2959. this._dropOverlap = (rave.capabilities.extension("position")).drop().remove(false);
  2960. this._dropOverlap.setOverlapGap(4.0);
  2961. },
  2962. /**
  2963. * Drop the overlapping labels or reset the overlap.
  2964. * @param (rave['internal']['Selection']) labels The selector for the labels
  2965. * @param (boolean) removeOverlap true to remove the overlapping labels, false to reset
  2966. */
  2967. /** @expose */
  2968. drop : function(labels, removeOverlap) {
  2969. if (!(labels.isTransition())) {
  2970. this.applyLabelDrop(labels, removeOverlap);
  2971. } else {
  2972. var steps = [0, 25, 75];
  2973. var self = this;
  2974. (labels).tween("__pointLabelDrop__", function(data, index, groupIndex) {
  2975. if (index == 0) {
  2976. return function(t) {
  2977. var currentStep = Math.floor(t * 100);
  2978. if (steps.length > 0 && currentStep < 100 && currentStep >= steps[0]) {
  2979. steps.splice(0, 1);
  2980. self.applyLabelDrop(labels, removeOverlap);
  2981. }
  2982. };
  2983. }
  2984. return null;
  2985. });
  2986. this.labelCount = 0;
  2987. (labels).each(function(data, index, groupIndex) {
  2988. ++self.labelCount;
  2989. }).each("end", function(args) {
  2990. if (args !== null || arguments.length > 1){
  2991. args = Array.prototype.slice.call(arguments, 0);
  2992. }
  2993. {
  2994. if (--self.labelCount == 0) {
  2995. self.applyLabelDrop(labels, removeOverlap);
  2996. }
  2997. return null;
  2998. }
  2999. });
  3000. }
  3001. },
  3002. applyLabelDrop : function(labels, removeOverlap) {
  3003. if (removeOverlap) {
  3004. labels.call(this._dropOverlap);
  3005. } else {
  3006. this._dropOverlap.reset(labels);
  3007. }
  3008. },
  3009. /** @expose */
  3010. configureForDataLabels : function(rect) {
  3011. if (rect) {
  3012. var ex = [[rect.x, rect.y], [rect.x + rect.width, rect.y + rect.height]];
  3013. this._dropOverlap.extent(ex);
  3014. }
  3015. this._dropOverlap.noClipping();
  3016. }
  3017. });
  3018. /**
  3019. * Drop overlap extension
  3020. */
  3021. //com_ibm_rave_bundles_utilities_BundleLabelDropper.POSITION_EXTENSION = "position";
  3022. /**
  3023. * space between labels during overlap testing
  3024. */
  3025. com_ibm_rave_bundles_utilities_BundleLabelDropper.OVERLAP_GAP = 4;
  3026. // $source: com/ibm/rave/bundles/components/StyleStructs
  3027. /************************************************************************
  3028. ** IBM Confidential
  3029. **
  3030. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3031. **
  3032. ** (C) Copyright IBM Corp. 2017
  3033. **
  3034. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3035. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3036. ************************************************************************/
  3037. // GENERATED
  3038. /**
  3039. * Struct classes to hold style properties.
  3040. */
  3041. var com_ibm_rave_bundles_components_StyleStructs = rave['internal']['Declare']({
  3042. });
  3043. /**
  3044. * Filled shape style properties.
  3045. */
  3046. com_ibm_rave_bundles_components_StyleStructs.ShapeStyle = function() {
  3047. this._fill = null;
  3048. this._stroke = null;
  3049. this._strokeWidth = null;
  3050. };
  3051. /**
  3052. * Line style properties.
  3053. */
  3054. com_ibm_rave_bundles_components_StyleStructs.LineStyle = function() {
  3055. this._stroke = null;
  3056. this._strokeWidth = null;
  3057. this._dashArray = null;
  3058. };
  3059. // $source: com/ibm/rave/bundles/component/GridComponent
  3060. /************************************************************************
  3061. ** IBM Confidential
  3062. **
  3063. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3064. **
  3065. ** (C) Copyright IBM Corp. 2017
  3066. **
  3067. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3068. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3069. ************************************************************************/
  3070. // GENERATED
  3071. /**
  3072. * <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>
  3073. */
  3074. var com_ibm_rave_bundles_component_GridComponent = rave['internal']['Declare'].implement(
  3075. /**
  3076. * @return (String) The role of the grid in the chart
  3077. */
  3078. //role : function() {},
  3079. /**
  3080. * Whether to display the gridlines.
  3081. * @param (boolean) displayGridlines The new displayGridlines
  3082. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3083. */
  3084. //displayGridlines : function(displayGridlines) {},
  3085. /**
  3086. * Set the line styling. Equivalent to calling {@link #this.gridlineColor(String)} and {@link #this.dashArray(String)} .
  3087. * @param (String) stroke The stroke color
  3088. * @param (String) dashArray The stroke-dasharray
  3089. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3090. */
  3091. //gridlineStyle : function(stroke, dashArray) {},
  3092. /**
  3093. * The color used to draw the gridlines.
  3094. * @param (String) gridlineColor The new stroke color
  3095. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3096. */
  3097. //gridlineColor : function(gridlineColor) {},
  3098. /**
  3099. * 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.
  3100. * @param (String) dashArray The new dash array
  3101. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3102. */
  3103. //dashArray : function(dashArray) {}
  3104. );
  3105. /**
  3106. * The string returned by {@link #this.type()} is "GridComponent".
  3107. */
  3108. /** @expose */
  3109. com_ibm_rave_bundles_component_GridComponent.COMPONENT_TYPE = "GridComponent";
  3110. // $source: com/ibm/rave/bundles/components/IntervalDataUtilities
  3111. /************************************************************************
  3112. ** IBM Confidential
  3113. **
  3114. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3115. **
  3116. ** (C) Copyright IBM Corp. 2017
  3117. **
  3118. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3119. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3120. ************************************************************************/
  3121. // GENERATED
  3122. /**
  3123. * 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.
  3124. */
  3125. var com_ibm_rave_bundles_components_IntervalDataUtilities = rave['internal']['Declare']({
  3126. });
  3127. /**
  3128. * <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>
  3129. * @param (Array) data Data array
  3130. * @param (rave['internal']['SingleValueFunction']) x X accessor, should not be null
  3131. * @param (rave['internal']['SingleValueFunction']) xScale Function to check if the X value is valid
  3132. * @param (rave['internal']['SingleValueFunction']) y Y accessor, should not be null
  3133. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3134. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3135. * @return (Array) Array of intervals for the data
  3136. */
  3137. /** @expose */
  3138. com_ibm_rave_bundles_components_IntervalDataUtilities.simpleBars = function(data, x, xScale, y, yStart, color, label) {
  3139. var result = [];
  3140. if (!data || data.length == 0 || !x || !y) {
  3141. return result;
  3142. }
  3143. data.forEach(function(d, ix, list) {
  3144. var xv = x(d);
  3145. if (xv != null && (!xScale || xScale(xv) != null)) {
  3146. var yv = y(d);
  3147. var yvStart = !yStart ? 0 : yStart(d);
  3148. if (yv != null && yvStart != null) {
  3149. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3150. r.key = ix;
  3151. r.ind1 = xv;
  3152. r.ind2 = r.ind1;
  3153. r.cind = r.ind1;
  3154. r.dep1 = yvStart;
  3155. r.dep2 = yv;
  3156. r.cdep = r.dep2;
  3157. r.color = color ? color(d) : null;
  3158. r.label = label ? label(d) : null;
  3159. r.value = r.dep2;
  3160. r._originalData = d;
  3161. r.valueAsPercentOfCategory = 100;
  3162. result.push(r);
  3163. }
  3164. }
  3165. return null;
  3166. });
  3167. var sum = 0;
  3168. for (var i = 0; i < result.length; ++i) {
  3169. var iData = result[i];
  3170. var value = + (iData.value);
  3171. sum += Math.abs(value);
  3172. }
  3173. if (sum != 0) {
  3174. for (var i = 0; i < result.length; ++i) {
  3175. var iData = result[i];
  3176. var value = + (iData.value);
  3177. iData.valueAsPercentOfColor = value / sum * 100;
  3178. }
  3179. }
  3180. return result;
  3181. };
  3182. /**
  3183. * Create intervals for bars in a clustered chart. This is similar to the simple bars, except the independent values are an array of accessors.
  3184. * @param (Array) data Data array
  3185. * @param (Array) x Independent accessor array, should not be null and no entries should be null
  3186. * @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
  3187. * @param (rave['internal']['SingleValueFunction']) y Dependent accessor, should not be null
  3188. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3189. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3190. * @return (Array) Array of intervals for the data
  3191. */
  3192. /** @expose */
  3193. com_ibm_rave_bundles_components_IntervalDataUtilities.clusteredBars = function(data, x, xScale, y, yStart, color, label) {
  3194. var result = [];
  3195. if (!data || data.length == 0 || !x || x.length == 0 || !y) {
  3196. return result;
  3197. }
  3198. var len = x.length;
  3199. var categories = {};
  3200. var colors = {};
  3201. data.forEach(function(d, ix, list) {
  3202. var OK = true;
  3203. var ind = [];
  3204. for (var i = 0; i < len; ++i) {
  3205. var xv = x[i](d);
  3206. if (xv == null || (xScale[i] && xScale[i](xv) == null)) {
  3207. OK = false;
  3208. break;
  3209. }
  3210. ind.push(xv);
  3211. if (i == 0) {
  3212. if (!(categories.hasOwnProperty(xv))) {
  3213. categories[""+(xv)] = 1;
  3214. }
  3215. } else if (!(colors.hasOwnProperty(xv))) {
  3216. colors[""+(xv)] = 1;
  3217. }
  3218. }
  3219. var dep = y(d);
  3220. var depStart = !yStart ? 0 : yStart(d);
  3221. if (OK && dep != null && depStart != null) {
  3222. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3223. r.key = ix;
  3224. r.ind1 = ind;
  3225. r.ind2 = ind;
  3226. r.cind = ind;
  3227. r.dep1 = depStart;
  3228. r.dep2 = dep;
  3229. r.cdep = r.dep2;
  3230. r.color = color ? color(d) : null;
  3231. r.label = label ? label(d) : null;
  3232. r.value = r.dep2;
  3233. r._originalData = d;
  3234. result.push(r);
  3235. }
  3236. return null;
  3237. });
  3238. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(categories), __len_enFor0 = __exp_enFor0.length;
  3239. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3240. var o = __exp_enFor0[__i_enFor0];
  3241. var s = ""+(o);
  3242. var sum = 0;
  3243. for (var i = 0; i < result.length; ++i) {
  3244. var iData = result[i];
  3245. if (s == (iData.ind1)[0]) {
  3246. var value = + (iData.value);
  3247. sum += Math.abs(value);
  3248. }
  3249. }
  3250. if (sum == 0) {
  3251. continue;
  3252. }
  3253. for (var i = 0; i < result.length; ++i) {
  3254. var iData = result[i];
  3255. if (s == (iData.ind1)[0]) {
  3256. var value = + (iData.value);
  3257. iData.valueAsPercentOfCategory = value / sum * 100;
  3258. }
  3259. }
  3260. }
  3261. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(colors), __len_enFor1 = __exp_enFor1.length;
  3262. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3263. var o = __exp_enFor1[__i_enFor1];
  3264. var s = ""+(o);
  3265. var sum = 0;
  3266. for (var i = 0; i < result.length; ++i) {
  3267. var iData = result[i];
  3268. if (s == iData.color) {
  3269. var value = + (iData.value);
  3270. sum += Math.abs(value);
  3271. }
  3272. }
  3273. if (sum == 0) {
  3274. continue;
  3275. }
  3276. for (var i = 0; i < result.length; ++i) {
  3277. var iData = result[i];
  3278. if (s == iData.color) {
  3279. var value = + (iData.value);
  3280. iData.valueAsPercentOfColor = value / sum * 100;
  3281. }
  3282. }
  3283. }
  3284. return result;
  3285. };
  3286. /**
  3287. * 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.
  3288. * @param (Array) data Data array
  3289. * @param (rave['internal']['SingleValueFunction']) x Independent accessor, should not be null
  3290. * @param (rave['internal']['SingleValueFunction']) xScale Possibly-null function to check if X values are in domain
  3291. * @param (rave['internal']['SingleValueFunction']) y Dependent accessor, should not be null
  3292. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3293. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3294. * @param (boolean) percent If true, create percent bars
  3295. * @return (Array) Array of intervals for the data
  3296. */
  3297. /** @expose */
  3298. com_ibm_rave_bundles_components_IntervalDataUtilities.stackedBars = function(data, x, xScale, y, color, label, percent) {
  3299. var result = [];
  3300. if (!data || data.length == 0 || !x || !y) {
  3301. return result;
  3302. }
  3303. var stacks = {};
  3304. var categories = {};
  3305. var colors = {};
  3306. data.forEach(function(d, ix, list) {
  3307. var xv = x(d);
  3308. if (xv != null && (!xScale || xScale(xv) != null)) {
  3309. var yv = y(d);
  3310. if (yv != null) {
  3311. var stack = stacks[xv];
  3312. if (!stack) {
  3313. stack = new com_ibm_rave_bundles_components_IntervalDataUtilities.Stack();
  3314. stacks[xv] = stack;
  3315. }
  3316. var dVal = + (yv);
  3317. if (!percent) {
  3318. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3319. r.key = ix;
  3320. r.ind1 = xv;
  3321. r.ind2 = xv;
  3322. r.cind = xv;
  3323. var sum = dVal < 0.0 ? stack.negativeSum : stack.positiveSum;
  3324. r.dep1 = sum;
  3325. r.dep2 = sum + dVal;
  3326. r.cdep = r.dep2;
  3327. r.color = color ? color(d) : null;
  3328. r.label = label ? label(d) : null;
  3329. r.value = dVal;
  3330. r._originalData = d;
  3331. result.push(r);
  3332. }
  3333. if (dVal < 0.0) {
  3334. stack.negativeSum += dVal;
  3335. } else {
  3336. stack.positiveCount++;
  3337. stack.positiveSum += dVal;
  3338. }
  3339. if (!(categories.hasOwnProperty(xv))) {
  3340. categories[""+(xv)] = 1;
  3341. }
  3342. if (color) {
  3343. var o = color(d);
  3344. if ((o != null) && !(colors.hasOwnProperty(o))) {
  3345. colors[""+(o)] = 1;
  3346. }
  3347. }
  3348. }
  3349. }
  3350. return null;
  3351. });
  3352. if (percent) {
  3353. data.forEach(function(d, ix, list) {
  3354. var xv = x(d);
  3355. if (xv != null && (!xScale || xScale(xv) != null)) {
  3356. var yv = y(d);
  3357. if (yv != null) {
  3358. var stack = stacks[xv];
  3359. var dVal = + (yv);
  3360. var percent;
  3361. if (dVal < 0.0) {
  3362. percent = -100.0 * dVal / stack.negativeSum;
  3363. } else if (stack.positiveSum > 0) {
  3364. percent = 100.0 * dVal / stack.positiveSum;
  3365. } else {
  3366. percent = 100.0 / stack.positiveCount;
  3367. }
  3368. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3369. r.key = ix;
  3370. r.ind1 = xv;
  3371. r.ind2 = xv;
  3372. r.cind = xv;
  3373. var sum = dVal < 0.0 ? stack.negativePercent : stack.positivePercent;
  3374. r.dep1 = sum;
  3375. r.dep2 = sum + percent;
  3376. r.cdep = r.dep2;
  3377. r.color = color ? color(d) : null;
  3378. r.label = label ? label(d) : null;
  3379. r.value = dVal;
  3380. r.valueAsPercentOfCategory = percent;
  3381. r._originalData = d;
  3382. result.push(r);
  3383. if (dVal < 0.0) {
  3384. stack.negativePercent += percent;
  3385. } else {
  3386. stack.positivePercent += percent;
  3387. }
  3388. }
  3389. }
  3390. return null;
  3391. });
  3392. } else {
  3393. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(categories), __len_enFor0 = __exp_enFor0.length;
  3394. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3395. var o = __exp_enFor0[__i_enFor0];
  3396. var s = ""+(o);
  3397. var sum = 0;
  3398. for (var i = 0; i < result.length; ++i) {
  3399. var iData = result[i];
  3400. if (s == iData.ind1) {
  3401. var value = + (iData.value);
  3402. sum += Math.abs(value);
  3403. }
  3404. }
  3405. if (sum == 0) {
  3406. continue;
  3407. }
  3408. for (var i = 0; i < result.length; ++i) {
  3409. var iData = result[i];
  3410. if (s == iData.ind1) {
  3411. var value = + (iData.value);
  3412. iData.valueAsPercentOfCategory = value / sum * 100;
  3413. }
  3414. }
  3415. }
  3416. }
  3417. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(colors), __len_enFor1 = __exp_enFor1.length;
  3418. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3419. var o = __exp_enFor1[__i_enFor1];
  3420. var s = ""+(o);
  3421. var sum = 0;
  3422. for (var i = 0; i < result.length; ++i) {
  3423. var iData = result[i];
  3424. if (s == iData.color) {
  3425. var value = + (iData.value);
  3426. sum += Math.abs(value);
  3427. }
  3428. }
  3429. if (sum == 0) {
  3430. continue;
  3431. }
  3432. for (var i = 0; i < result.length; ++i) {
  3433. var iData = result[i];
  3434. if (s == iData.color) {
  3435. var value = + (iData.value);
  3436. iData.valueAsPercentOfColor = value / sum * 100;
  3437. }
  3438. }
  3439. }
  3440. return result;
  3441. };
  3442. /**
  3443. * Structure class holding interval information.
  3444. */
  3445. com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData = rave['internal']['Declare']({
  3446. /**
  3447. * Key value; for now this is the data index
  3448. */
  3449. /** @expose */
  3450. key : null,
  3451. /**
  3452. * First independent value
  3453. */
  3454. /** @expose */
  3455. ind1 : null,
  3456. /**
  3457. * Second independent value (in all current uses, same as ind1)
  3458. */
  3459. /** @expose */
  3460. ind2 : null,
  3461. /**
  3462. * First dependent value
  3463. */
  3464. /** @expose */
  3465. dep1 : null,
  3466. /**
  3467. * Second dependent value
  3468. */
  3469. /** @expose */
  3470. dep2 : null,
  3471. /**
  3472. * The data value that the interval represents. Not the pixel value. Used in stacked chart
  3473. */
  3474. /** @expose */
  3475. value : null,
  3476. /**
  3477. * Color value
  3478. */
  3479. /** @expose */
  3480. color : null,
  3481. /**
  3482. * Label value
  3483. */
  3484. /** @expose */
  3485. label : null,
  3486. /**
  3487. * Callout independent value (in all current uses, same as ind1)
  3488. */
  3489. /** @expose */
  3490. cind : null,
  3491. /**
  3492. * Callout dependent value (dependent extent)
  3493. */
  3494. /** @expose */
  3495. cdep : null,
  3496. /** @expose */
  3497. _originalData : null,
  3498. /**
  3499. * The data value (in percentage) for specific category
  3500. */
  3501. /** @expose */
  3502. valueAsPercentOfCategory : NaN,
  3503. /**
  3504. * The data value (in percentage) across all categories
  3505. */
  3506. /** @expose */
  3507. valueAsPercentOfColor : NaN,
  3508. /** @expose */
  3509. originalData : function() {
  3510. return this._originalData;
  3511. },
  3512. /** @expose */
  3513. originalDataList : function() {
  3514. var list = [];
  3515. list.push(this._originalData);
  3516. return list;
  3517. }
  3518. });
  3519. com_ibm_rave_bundles_components_IntervalDataUtilities.Stack = function() {
  3520. this.positiveCount = 0;
  3521. this.positiveSum = 0;
  3522. this.negativeSum = 0;
  3523. this.positivePercent = 0;
  3524. this.negativePercent = 0;
  3525. };
  3526. /**
  3527. * Accessor for the callout dependent value
  3528. */
  3529. /** @expose */
  3530. com_ibm_rave_bundles_components_IntervalDataUtilities.CALLOUT_DEPENDENT_ACCESSOR = function(data) {
  3531. return (data).cdep;
  3532. };
  3533. /**
  3534. * Accessor for the callout independent value
  3535. */
  3536. /** @expose */
  3537. com_ibm_rave_bundles_components_IntervalDataUtilities.CALLOUT_INDEPENDENT_ACCESSOR = function(data) {
  3538. return (data).cind;
  3539. };
  3540. /**
  3541. * Accessor for the data value
  3542. */
  3543. /** @expose */
  3544. com_ibm_rave_bundles_components_IntervalDataUtilities.VALUE_ACCESSOR = function(data) {
  3545. return (data).value;
  3546. };
  3547. /**
  3548. * Accessor for data value as percent of category
  3549. */
  3550. /** @expose */
  3551. com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR = function(data) {
  3552. var percent = (data).valueAsPercentOfCategory;
  3553. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3554. };
  3555. /**
  3556. * Accessor for data value as percent of color (series)
  3557. */
  3558. /** @expose */
  3559. com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_COLOR_ACCESSOR = function(data) {
  3560. var percent = (data).valueAsPercentOfColor;
  3561. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3562. };
  3563. // $source: com/ibm/rave/bundles/data/PointDataUtilities
  3564. /************************************************************************
  3565. ** IBM Confidential
  3566. **
  3567. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3568. **
  3569. ** (C) Copyright IBM Corp. 2017
  3570. **
  3571. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3572. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3573. ************************************************************************/
  3574. // GENERATED
  3575. /**
  3576. * Utility class for building arrays of point datum objects from tabular data.
  3577. */
  3578. var com_ibm_rave_bundles_data_PointDataUtilities = rave['internal']['Declare']({
  3579. });
  3580. /**
  3581. * <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>
  3582. * @param (Array) data Input data, list of arbitrary objects
  3583. * @param (rave['internal']['SingleValueFunction']) xAccessor X accessor function, may be null
  3584. * @param (rave['internal']['SingleValueFunction']) xScale Scale to test if the X value should be included, may be null
  3585. * @param (rave['internal']['SingleValueFunction']) yAccessor Y accessor function, may be null
  3586. * @param (rave['internal']['SingleValueFunction']) yScale Scale to test if the Y value should be included, may be null
  3587. * @return (Array) List of PointData objects
  3588. */
  3589. /** @expose */
  3590. com_ibm_rave_bundles_data_PointDataUtilities.buildPoints = function(data, xAccessor, xScale, yAccessor, yScale) {
  3591. var result = [];
  3592. if (data) {
  3593. for (var __i_enFor0 = 0, __exp_enFor0 = data, __len_enFor0 = __exp_enFor0.length;
  3594. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3595. var o = __exp_enFor0[__i_enFor0];
  3596. if (o != null) {
  3597. var xv = null;
  3598. if (xAccessor) {
  3599. xv = xAccessor(o);
  3600. if (xv == null || (xScale && xScale(xv) == null)) {
  3601. continue;
  3602. }
  3603. }
  3604. var yv = null;
  3605. if (yAccessor) {
  3606. yv = yAccessor(o);
  3607. if (yv == null || (yScale && yScale(yv) == null)) {
  3608. continue;
  3609. }
  3610. }
  3611. var datum = new com_ibm_rave_bundles_data_PointDataUtilities.PointDatum();
  3612. datum._x = xv;
  3613. datum._y = yv;
  3614. datum._originalData = o;
  3615. result.push(datum);
  3616. }
  3617. }
  3618. }
  3619. return result;
  3620. };
  3621. /**
  3622. * 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.
  3623. */
  3624. com_ibm_rave_bundles_data_PointDataUtilities.PointDatum = rave['internal']['Declare']({
  3625. /**
  3626. * The X value
  3627. */
  3628. /** @expose */
  3629. _x : null,
  3630. /**
  3631. * The Y value
  3632. */
  3633. /** @expose */
  3634. _y : null,
  3635. /**
  3636. * The data value (in percentage) that the point represents
  3637. */
  3638. /** @expose */
  3639. _yAsPercentOfCategory : null,
  3640. /**
  3641. * The data value (in percentage) that the point represents
  3642. */
  3643. /** @expose */
  3644. _yAsPercentOfColor : null,
  3645. /**
  3646. * The original data
  3647. */
  3648. /** @expose */
  3649. _originalData : null,
  3650. /** @expose */
  3651. originalData : function() {
  3652. return this._originalData;
  3653. },
  3654. /** @expose */
  3655. originalDataList : function() {
  3656. var list = [];
  3657. list.push(this._originalData);
  3658. return list;
  3659. }
  3660. });
  3661. /**
  3662. * Accessor returning the _x property of a PointDatum.
  3663. */
  3664. /** @expose */
  3665. com_ibm_rave_bundles_data_PointDataUtilities.X_ACCESSOR = function(d) {
  3666. return (d)._x;
  3667. };
  3668. /**
  3669. * Accessor returning the _y property of a PointDatum.
  3670. */
  3671. /** @expose */
  3672. com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR = function(d) {
  3673. return (d)._y;
  3674. };
  3675. /**
  3676. * Accessor returning the _yAsPercentOfCategory property of a PointDatum.
  3677. */
  3678. /** @expose */
  3679. com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR = function(d) {
  3680. var percent = + ((d)._yAsPercentOfCategory);
  3681. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3682. };
  3683. /**
  3684. * Accessor returning the _yAsPercentOfColor property of a PointDatum.
  3685. */
  3686. /** @expose */
  3687. com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_COLOR_ACCESSOR = function(d) {
  3688. var percent = + ((d)._yAsPercentOfColor);
  3689. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3690. };
  3691. // $source: com/ibm/rave/bundles/utilities/ColorUtil
  3692. /************************************************************************
  3693. ** IBM Confidential
  3694. **
  3695. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3696. **
  3697. ** (C) Copyright IBM Corp. 2017
  3698. **
  3699. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3700. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3701. ************************************************************************/
  3702. // GENERATED
  3703. var com_ibm_rave_bundles_utilities_ColorUtil = rave['internal']['Declare']({
  3704. });
  3705. /**
  3706. * It is used to get a foreground color which has atleast a 4.5 contrast ratio with the background color.
  3707. * @param (Object) bg bakground color
  3708. * @param (Object) fg foreground color
  3709. * @return (Object) a color ( darker/ligher/same fg color ) which contrast with background.
  3710. */
  3711. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$0 = function(bg, fg) {
  3712. var contrastRatio = com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio(bg, fg);
  3713. if (contrastRatio < 4.5) {
  3714. var bgHSL = rave.hsl(bg);
  3715. var fgHSL = rave.hsl(fg);
  3716. 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);
  3717. if (brightness > 0.5) {
  3718. if (bgHSL.getL() > 0.5) {
  3719. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.min(fgHSL.getL(), bgHSL.getL() - 0.4));
  3720. } else {
  3721. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.min(fgHSL.getL(), 0.1));
  3722. }
  3723. } else {
  3724. if (bgHSL.getL() < 0.5) {
  3725. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.max(fgHSL.getL(), bgHSL.getL() + 0.4));
  3726. } else {
  3727. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.max(fgHSL.getL(), 0.9));
  3728. }
  3729. }
  3730. }
  3731. return fg;
  3732. };
  3733. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$1 = function(labelColor) {
  3734. var labelRGB = rave.rgb(labelColor);
  3735. return labelRGB.contrastShift(21);
  3736. };
  3737. /** @expose */
  3738. com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio = function(colorA, colorB) {
  3739. var foregroundLuminance = rave.rgb(colorA).getLuminance();
  3740. var backgroundLuminance = rave.rgb(colorB).getLuminance();
  3741. var contrastRatio = (foregroundLuminance >= backgroundLuminance) ? (foregroundLuminance + 0.05) / (backgroundLuminance + 0.05) : (backgroundLuminance + 0.05) / (foregroundLuminance + 0.05);
  3742. return contrastRatio;
  3743. };
  3744. /** @expose */
  3745. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor = function(a0, a1) {
  3746. var args = arguments;
  3747. if (args.length == 1) {
  3748. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$1(a0);
  3749. }
  3750. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$0(a0, a1);
  3751. };
  3752. // $source: com/ibm/rave/bundles/component/PointComponent
  3753. /************************************************************************
  3754. ** IBM Confidential
  3755. **
  3756. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3757. **
  3758. ** (C) Copyright IBM Corp. 2017
  3759. **
  3760. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3761. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3762. ************************************************************************/
  3763. // GENERATED
  3764. /**
  3765. * <p> A component that renders point elements (glyphs based on data, showing a point with X and Y dimensions, as in a scatterplot chart). The {@link #this.type()} method returns "PointComponent". </p>
  3766. */
  3767. var com_ibm_rave_bundles_component_PointComponent = rave['internal']['Declare'].implement(
  3768. /**
  3769. * The default size used for a point, when no size scale is used or when the size data for the element is null.
  3770. * @param (double) defaultSize The new defaultSize
  3771. * @return (com.ibm.rave.bundles.component.PointComponent) This component
  3772. */
  3773. //defaultSize : function(defaultSize) {},
  3774. /**
  3775. * Turn labels on or off. If labels are on but there is no label data, empty text nodes will be created.
  3776. * @param (boolean) itemLabel Whether to use labels
  3777. * @return (com.ibm.rave.bundles.component.PointComponent) This component
  3778. */
  3779. //itemLabel : function(itemLabel) {},
  3780. /**
  3781. * Whether to drop overlapping labels.
  3782. * @param (boolean) itemOverlap The new itemOverlap
  3783. * @return (com.ibm.rave.bundles.component.PointComponent) This component
  3784. */
  3785. //itemOverlap : function(itemOverlap) {},
  3786. /**
  3787. * The symbol to be used for the points.
  3788. * @param (String) symbol The new symbol
  3789. * @return (com.ibm.rave.bundles.component.PointComponent) This component
  3790. */
  3791. //symbol : function(symbol) {},
  3792. /**
  3793. * Set the width of border
  3794. * @param (String) borderWidth CSS value
  3795. * @return (com.ibm.rave.bundles.component.PointComponent) This component
  3796. */
  3797. //borderWidth : function(borderWidth) {},
  3798. /**
  3799. * Set the color of border
  3800. * @param (String) borderColor
  3801. * @return (com.ibm.rave.bundles.component.PointComponent) This component
  3802. */
  3803. //borderColor : function(borderColor) {},
  3804. /**
  3805. * Set the classname of the labellayer
  3806. * @param string
  3807. * @return (com.ibm.rave.bundles.component.PointComponent) This object
  3808. */
  3809. //labelLayerClassName : function(className) {},
  3810. /**
  3811. * Set the classname of the elementlayer
  3812. * @param string
  3813. * @return (com.ibm.rave.bundles.component.PointComponent) This object
  3814. */
  3815. //elementLayerClassName : function(className) {},
  3816. /**
  3817. * Sets function that will specify position of item label for given chart element.
  3818. * @param (rave['internal']['ValueFunction']) labelPosition Function to be used to determine label position
  3819. * @return (com.ibm.rave.bundles.component.PointComponent) This object
  3820. */
  3821. //itemLabelPosition : function(labelPosition) {}
  3822. );
  3823. /**
  3824. * The string returned by {@link #this.type()} is "PointComponent".
  3825. */
  3826. /** @expose */
  3827. com_ibm_rave_bundles_component_PointComponent.COMPONENT_TYPE = "PointComponent";
  3828. // $source: com/ibm/rave/bundles/utilities/PathUtils
  3829. /************************************************************************
  3830. ** IBM Confidential
  3831. **
  3832. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3833. **
  3834. ** (C) Copyright IBM Corp. 2017
  3835. **
  3836. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3837. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3838. ************************************************************************/
  3839. // GENERATED
  3840. var com_ibm_rave_bundles_utilities_PathUtils = rave['internal']['Declare']({
  3841. });
  3842. /**
  3843. * Transition a path element selection with a fade-out-fade-in effect. In many cases, transitioning between two unrelated path strings will result in an undesirable morphing effect. This method allows the path to first fade out (to opacity 0), update the path string without morphing, then fade back in.
  3844. * @param (rave['internal']['Selection']) selection A selection (either Selector or Transition) containing "path" elements.
  3845. * @param (rave['internal']['ValueFunction']) pathFunction The path string generator function, e.g. Rave.svg.line().
  3846. */
  3847. /** @expose */
  3848. com_ibm_rave_bundles_utilities_PathUtils.fadeOutIn = function(selection, pathFunction) {
  3849. if (selection.isTransition()) {
  3850. var transition = selection;
  3851. transition.ease("linear").styleTween("opacity", function(data, index, value) {
  3852. var path = rave.select(this);
  3853. if (!(this.rave_hasProperty("__rave_originalOpacity__"))) {
  3854. this.rave_setProperty("__rave_originalOpacity__", path.style("opacity"));
  3855. }
  3856. var styleOpacity = this.rave_getProperty("__rave_originalOpacity__");
  3857. var opacity = styleOpacity != null ? parseFloat(""+(styleOpacity)) : 1.0;
  3858. var mid1 = 0.45, mid2 = 0.55;
  3859. var s = rave.scale.linear().domain([0.0, mid1, mid2, 1.0]).range([opacity, 0.0, 0.0, opacity]);
  3860. var setPath = [];
  3861. setPath[0] = false;
  3862. return function(t) {
  3863. if (t > mid1 && !setPath[0]) {
  3864. path.attr("d", pathFunction);
  3865. setPath[0] = true;
  3866. }
  3867. return + (s.call(null, t, 0, 0));
  3868. };
  3869. });
  3870. transition.each("end", function(args) {
  3871. if (args !== null || arguments.length > 1){
  3872. args = Array.prototype.slice.call(arguments, 0);
  3873. }
  3874. {
  3875. this.rave_removeProperty("__rave_originalOpacity__");
  3876. return null;
  3877. }
  3878. });
  3879. } else {
  3880. selection.attr("d", pathFunction);
  3881. }
  3882. };
  3883. //com_ibm_rave_bundles_utilities_PathUtils.OPACITY = "opacity";
  3884. //com_ibm_rave_bundles_utilities_PathUtils.ORIGINAL_OPACITY = "__rave_originalOpacity__";
  3885. //com_ibm_rave_bundles_utilities_PathUtils.PATH_DATA = "d";
  3886. //com_ibm_rave_bundles_utilities_PathUtils.EASE_LINEAR = "linear";
  3887. // $source: com/ibm/rave/bundles/utilities/LabelStyleUtil
  3888. /************************************************************************
  3889. ** IBM Confidential
  3890. **
  3891. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3892. **
  3893. ** (C) Copyright IBM Corp. 2017
  3894. **
  3895. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3896. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3897. ************************************************************************/
  3898. // GENERATED
  3899. //@import com/ibm/rave/bundles/components/FilterComponentImpl (runtime) // new
  3900. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor, getContrastRatio
  3901. /**
  3902. * This class can be used to apply styles on labels. Eg: when we need to overrule the given label style properties.
  3903. */
  3904. var com_ibm_rave_bundles_utilities_LabelStyleUtil = rave['internal']['Declare']({
  3905. //_labelFontStyle : null,
  3906. //_contrastLabelColorfilter : null,
  3907. //_sameLabelColorfilter : null,
  3908. /**
  3909. * eg: apply contrast label color with background. apply different font size for each level label. apply a contrast shadow for a label.
  3910. */
  3911. //_labelFillColor : null,
  3912. //_labelFontSize : null,
  3913. _labelShadow : false,
  3914. _$functionClassMethod : function() {
  3915. var _$self = function(args) {
  3916. if (args !== null || arguments.length > 1){
  3917. args = Array.prototype.slice.call(arguments, 0);
  3918. }
  3919. {
  3920. if (_$self._labelFontStyle) {
  3921. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(_$self._labelFontStyle), __len_enFor0 = __exp_enFor0.length;
  3922. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3923. var stylenName = __exp_enFor0[__i_enFor0];
  3924. if ((stylenName == "fill" || stylenName == "color" && _$self._labelFillColor) || (stylenName == "font-size" && _$self._labelFontSize) || (stylenName == "text-shadow" && _$self._labelShadow == true)) {
  3925. continue;
  3926. }
  3927. this.style(stylenName, _$self._labelFontStyle[stylenName]);
  3928. }
  3929. }
  3930. if (_$self._labelFillColor) {
  3931. this.style("fill", _$self._labelFillColor);
  3932. }
  3933. if (_$self._labelFontSize) {
  3934. this.style("font-size", _$self._labelFontSize);
  3935. }
  3936. var labels = this.selectAll("*");
  3937. if (labels.length == 0) {
  3938. labels = this;
  3939. }
  3940. if (_$self._labelShadow) {
  3941. var self = _$self;
  3942. var defaultLabelFill = _$self.getDefaultLabelColor(_$self._labelFontStyle);
  3943. _$self._contrastLabelColorfilter = new com_ibm_rave_bundles_components_FilterComponentImpl("contrast_label_drop_shadow");
  3944. _$self._contrastLabelColorfilter.setDropshadow("1px", "1px", "0px", rave.rgb(com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(defaultLabelFill)));
  3945. _$self._sameLabelColorfilter = new com_ibm_rave_bundles_components_FilterComponentImpl("same_label_drop_shadow");
  3946. _$self._sameLabelColorfilter.setDropshadow("1px", "1px", "0px", rave.rgb(defaultLabelFill));
  3947. var owner = this.node().rave_getOwner();
  3948. rave.select(owner).select("defs").call(_$self._contrastLabelColorfilter);
  3949. rave.select(owner).select("defs").call(_$self._sameLabelColorfilter);
  3950. this.each(function(data, index, groupIndex) {
  3951. if (self._labelFillColor) {
  3952. var contrastRatio = com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio(rave.rgb(self._labelFillColor.call(this, data, index, groupIndex)), defaultLabelFill);
  3953. if (contrastRatio < 4.5) {
  3954. this.setAttribute("filter", "url(#" + self._contrastLabelColorfilter.getId() + ")");
  3955. } else {
  3956. this.setAttribute("filter", "url(#" + self._sameLabelColorfilter.getId() + ")");
  3957. }
  3958. } else {
  3959. this.setAttribute("filter", "url(#" + self._contrastLabelColorfilter.getId() + ")");
  3960. }
  3961. });
  3962. labels.each(function(data, index, groupIndex) {
  3963. if (self._labelFillColor) {
  3964. this.rave_setProperty("_rave_drop_shadow", "1px 1px 0px " + com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(self._labelFillColor.call(this, data, index, groupIndex)).toString());
  3965. } else {
  3966. this.rave_setProperty("_rave_drop_shadow", "1px 1px 0px " + com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(defaultLabelFill).toString());
  3967. }
  3968. });
  3969. } else {
  3970. labels.each(function(data, index, groupIndex) {
  3971. this.rave_setProperty("_rave_drop_shadow", null);
  3972. });
  3973. this.attr("filter", null);
  3974. }
  3975. return null;
  3976. }
  3977. };
  3978. return _$self;
  3979. },
  3980. /** @expose */
  3981. labelFont : function(labelFontStyle) {
  3982. this._labelFontStyle = labelFontStyle;
  3983. return this;
  3984. },
  3985. /** @expose */
  3986. labelFillColor : function(_labelFillColor) {
  3987. this._labelFillColor = _labelFillColor;
  3988. return this;
  3989. },
  3990. /** @expose */
  3991. labelFontSize : function(_labelFontSize) {
  3992. this._labelFontSize = _labelFontSize;
  3993. return this;
  3994. },
  3995. /** @expose */
  3996. labelShadow : function(labelShadow) {
  3997. this._labelShadow = labelShadow;
  3998. return this;
  3999. },
  4000. /** @expose */
  4001. getDefaultLabelColor : function(_labelStyle) {
  4002. if (!_labelStyle) {
  4003. return "#000000";
  4004. }
  4005. var defaultFillColor;
  4006. if (_labelStyle) {
  4007. defaultFillColor = _labelStyle["fill"];
  4008. if (defaultFillColor == null) {
  4009. defaultFillColor = _labelStyle["color"];
  4010. }
  4011. }
  4012. if (defaultFillColor == null) {
  4013. defaultFillColor = "#000000";
  4014. }
  4015. return defaultFillColor.toString();
  4016. }
  4017. });
  4018. // $source: com/ibm/rave/bundles/component/LineComponent
  4019. /************************************************************************
  4020. ** IBM Confidential
  4021. **
  4022. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4023. **
  4024. ** (C) Copyright IBM Corp. 2017
  4025. **
  4026. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4027. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4028. ************************************************************************/
  4029. // GENERATED
  4030. /**
  4031. * <p> A component that renders line elements (polylines, each with a series of points in X and Y dimensions, as in a line chart). The {@link #this.type()} method returns "LineComponent". </p>
  4032. */
  4033. var com_ibm_rave_bundles_component_LineComponent = rave['internal']['Declare'].implement(
  4034. /**
  4035. * The interpolation modes are from the RAVE core line path generator, for example "linear", "cardinal".
  4036. * @param (String) interpolate The interpolation mode
  4037. * @return (com.ibm.rave.bundles.component.LineComponent) This component
  4038. */
  4039. //interpolate : function(interpolate) {}
  4040. );
  4041. /**
  4042. * The string returned by {@link #this.type()} is "LineComponent".
  4043. */
  4044. /** @expose */
  4045. com_ibm_rave_bundles_component_LineComponent.COMPONENT_TYPE = "LineComponent";
  4046. // $source: com/ibm/rave/bundles/data/LineDataUtilities
  4047. /************************************************************************
  4048. ** IBM Confidential
  4049. **
  4050. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4051. **
  4052. ** (C) Copyright IBM Corp. 2017
  4053. **
  4054. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4055. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4056. ************************************************************************/
  4057. // GENERATED
  4058. //@import com/ibm/rave/bundles/data/PointDataUtilities (runtime) // new
  4059. /**
  4060. * <p> Utility class for working with line and area features, as used in the line, area, and composite bundles. A line or area is represented by a LineDatum, which has a group (line ID) and a points array. The points are two-element arrays as used in the RAVE core line and area path generators. </p> <p> The buildLines method takes tabular data and accessors as used in all three bundles' data models, where the table is of <I>point</I> data with X, Y, and group slots. Points with null X are ignored; other points are formed into lines using the group values. Note that line points may have null Y values; this causes a gap in the line or area. Points are added in data order. </p> <p> The other static methods work with an array of LineDatum as returned by buildLines: </p> <ul> <li> Sort each line by the X value of its points, using a CoordinateScale to define X-ordering. </li> <li> Get all points from the lines that have non-null X and Y values. These points are the ones that would be shown in a line-with-points chart. </li> <li> Get all points from the lines that match the "null-point-null" pattern. This means that the point has a non-null Y, and the points before and after it (using the current line sorting) have null Y. The first point in the line is considered to have a null Y before it, and the last point a null Y after it. </li> </ul> <p> Points are returned as an array of PointDatum so may be used in components exactly as the points returned by PointDataUtilities. </p>
  4061. */
  4062. var com_ibm_rave_bundles_data_LineDataUtilities = rave['internal']['Declare']({
  4063. });
  4064. /**
  4065. * <p> Process tabular data as used in the tabular data models of the line, area, and composite bundles, returning an array-list of LineData objects. Each row of data in the table is a single point with X, Y, and optional group values. The group accessor returns strings, as in all three bundles. The points are grouped by the accessor values (null is treated as a distinct value) and each group forms a LineData. If the group accessor is null, all points are in one group. </p> <p> If the xScale is non-null and returns null for an X value, the point is ignored. </p> <p> The LineData group value is the unique group value (possibly null). The LineData points are the [X,Y] coordinates as an ArrayEx, suitable for use with the line and area path generators. The points in each line are in row (input array) order. This wil be the single place where we need to fix the sorting problem, defect 23553. </p>
  4066. * @param (Array) data Array of data objects
  4067. * @param (rave['internal']['SingleValueFunction']) xAccessor Non-null X accessor function
  4068. * @param (rave['internal']['SingleValueFunction']) xScale Value function used to check if X value is in domain
  4069. * @param (rave['internal']['SingleValueFunction']) yAccessor Non-null Y accessor function
  4070. * @param (rave['internal']['SingleValueFunction']) groupAccessor Possibly-null group accessor function
  4071. * @return (Array) Non-null but possibly empty array of LineData items, one per distinct group value
  4072. */
  4073. /** @expose */
  4074. com_ibm_rave_bundles_data_LineDataUtilities.buildLines = function(data, xAccessor, xScale, yAccessor, groupAccessor) {
  4075. var result = [];
  4076. if (!data || data.length == 0) {
  4077. return result;
  4078. }
  4079. var categories = {};
  4080. var noGroup;
  4081. var lines = {};
  4082. for (var __i_enFor0 = 0, __exp_enFor0 = data, __len_enFor0 = __exp_enFor0.length;
  4083. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4084. var datum = __exp_enFor0[__i_enFor0];
  4085. if (datum == null) {
  4086. continue;
  4087. }
  4088. var xValue = xAccessor(datum);
  4089. if (xValue != null && (!xScale || xScale(xValue) != null)) {
  4090. if (!(categories.hasOwnProperty(xValue))) {
  4091. categories[""+(xValue)] = 1;
  4092. }
  4093. var group = groupAccessor ? (groupAccessor(datum)) : null;
  4094. var line;
  4095. if (group == null) {
  4096. if (!noGroup) {
  4097. noGroup = new com_ibm_rave_bundles_data_LineDataUtilities.LineDatum(null);
  4098. result.push(noGroup);
  4099. }
  4100. line = noGroup;
  4101. } else {
  4102. line = lines[group];
  4103. if (!line) {
  4104. line = new com_ibm_rave_bundles_data_LineDataUtilities.LineDatum(group);
  4105. lines[group] = line;
  4106. result.push(line);
  4107. }
  4108. }
  4109. line.addPoint(datum, xValue, yAccessor(datum));
  4110. }
  4111. }
  4112. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(categories), __len_enFor1 = __exp_enFor1.length;
  4113. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  4114. var o = __exp_enFor1[__i_enFor1];
  4115. var s = ""+(o);
  4116. var sum = 0;
  4117. for (var i = 0; i < result.length; ++i) {
  4118. var lineDatum = result[i];
  4119. for (var j = 0; j < lineDatum._pointData.length; ++j) {
  4120. var pointDatum = lineDatum._pointData[j];
  4121. if (s == pointDatum._x) {
  4122. pointDatum._yAsPercentOfCategory = NaN;
  4123. var value = + (pointDatum._y);
  4124. sum += Math.abs(value);
  4125. }
  4126. }
  4127. }
  4128. if (sum == 0) {
  4129. continue;
  4130. }
  4131. for (var i = 0; i < result.length; ++i) {
  4132. var lineDatum = result[i];
  4133. for (var j = 0; j < lineDatum._pointData.length; ++j) {
  4134. var pointDatum = lineDatum._pointData[j];
  4135. if (s == pointDatum._x) {
  4136. var value = + (pointDatum._y);
  4137. pointDatum._yAsPercentOfCategory = value / sum * 100;
  4138. }
  4139. }
  4140. }
  4141. }
  4142. for (var i = 0; i < result.length; ++i) {
  4143. var sum = 0;
  4144. var lineDatum = result[i];
  4145. for (var j = 0; j < lineDatum._pointData.length; ++j) {
  4146. var pointDatum = lineDatum._pointData[j];
  4147. pointDatum._yAsPercentOfColor = NaN;
  4148. var value = + (pointDatum._y);
  4149. sum += Math.abs(value);
  4150. }
  4151. if (sum != 0) {
  4152. for (var j = 0; j < lineDatum._pointData.length; ++j) {
  4153. var pointDatum = lineDatum._pointData[j];
  4154. var value = + (pointDatum._y);
  4155. pointDatum._yAsPercentOfColor = value / sum * 100;
  4156. }
  4157. }
  4158. }
  4159. return result;
  4160. };
  4161. com_ibm_rave_bundles_data_LineDataUtilities.get = function(val, data) {
  4162. for (var i = 0; i < data.length; ++i) {
  4163. var entry = data[i];
  4164. if (entry.key===val) {
  4165. return entry;
  4166. }
  4167. }
  4168. return null;
  4169. };
  4170. /** @expose */
  4171. com_ibm_rave_bundles_data_LineDataUtilities.buildLinesForStacking = function(data, xAccessor, yAccessor, groupAccessor) {
  4172. if (!data || data.length == 0) {
  4173. return [];
  4174. }
  4175. var keyToOriginalValue = {};
  4176. var stacks = [];
  4177. var nest = rave.nest();
  4178. nest.key(function(d) {
  4179. var keyValue = xAccessor(d);
  4180. var strKeyValue = (keyValue);
  4181. keyToOriginalValue[strKeyValue] = keyValue;
  4182. return strKeyValue;
  4183. });
  4184. nest.key(function(d) {
  4185. var stack = groupAccessor(d).toString();
  4186. if (!(stacks.indexOf(stack)> -1)) {
  4187. stacks.push(stack);
  4188. }
  4189. return stack;
  4190. });
  4191. var result = nest.entries(data);
  4192. var missingValue = new Number(0);
  4193. var stackData = stacks.map(function(name, index, array) {
  4194. var line = new com_ibm_rave_bundles_data_LineDataUtilities.LineDatum(array[index].valueOf());
  4195. result.forEach(function(currentValue, index, array) {
  4196. var values = currentValue.values;
  4197. var currentElement = com_ibm_rave_bundles_data_LineDataUtilities.get(line.group, values);
  4198. var datum = null;
  4199. var yValue = null;
  4200. if (!currentElement) {
  4201. yValue = missingValue;
  4202. } else {
  4203. datum = (currentElement.values)[0];
  4204. yValue = yAccessor(datum);
  4205. if (yValue == null) {
  4206. yValue = missingValue;
  4207. }
  4208. }
  4209. line.addPoint(datum, keyToOriginalValue[currentValue.key], yValue);
  4210. return null;
  4211. });
  4212. return line;
  4213. });
  4214. return stackData;
  4215. };
  4216. /**
  4217. * <p> Sort an array of LineData by the X-coordinate. The CoordinateScale must be initialized with the domain of the line data, and its range must be set. The points of each line are sorted in increasing order of the scaled X-value. </p> <p> For efficiency this method assumes the lines are as created by buildLines, so each point is non-null, and has two values of which the first is non-null. </p>
  4218. * @param (Array) lines A non-null array of LineDatum objects, such as produced by buildLines
  4219. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale A non-null scale
  4220. */
  4221. /** @expose */
  4222. com_ibm_rave_bundles_data_LineDataUtilities.sortLines = function(lines, scale) {
  4223. var comp = function(a, b) {
  4224. var av = scale.center(a._x);
  4225. if (av == null) {
  4226. return 1;
  4227. }
  4228. var bv = scale.center(b._x);
  4229. if (bv == null) {
  4230. return -1;
  4231. }
  4232. var v = av - bv;
  4233. return v < 0 ? -1 : v > 0 ? 1 : 0;
  4234. };
  4235. for (var __i_enFor0 = 0, __exp_enFor0 = lines, __len_enFor0 = __exp_enFor0.length;
  4236. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4237. var line = __exp_enFor0[__i_enFor0];
  4238. line.sort(comp);
  4239. }
  4240. };
  4241. /**
  4242. * Get one PointDatum object for every point in the lines, omitting any points where the X or Y value is null. The returned array may be empty.
  4243. * @param (Array) lines A non-null array of LineDatum objects, such as produced by buildLines
  4244. * @return (Array) Array of PointDatum for points where X and Y are both non-null
  4245. */
  4246. /** @expose */
  4247. com_ibm_rave_bundles_data_LineDataUtilities.getLineWithPoints = function(lines) {
  4248. var result = [];
  4249. for (var __i_enFor0 = 0, __exp_enFor0 = lines, __len_enFor0 = __exp_enFor0.length;
  4250. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4251. var line = __exp_enFor0[__i_enFor0];
  4252. line.getLineWithPoints(result);
  4253. }
  4254. return result;
  4255. };
  4256. /**
  4257. * Get one PointDatum object for every point in the lines that meets the "null-point-null" criterion: The point has non-null X and Y, and the points before/after it have null Y.
  4258. * @param (Array) lines A non-null array of LineDatum objects, such as produced by buildLines
  4259. * @return (Array) Array of PointDatum for points meeting the null-point-null criterion
  4260. */
  4261. /** @expose */
  4262. com_ibm_rave_bundles_data_LineDataUtilities.getNPNPoints = function(lines) {
  4263. var result = [];
  4264. for (var __i_enFor0 = 0, __exp_enFor0 = lines, __len_enFor0 = __exp_enFor0.length;
  4265. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4266. var line = __exp_enFor0[__i_enFor0];
  4267. line.getNPNPoints(result);
  4268. }
  4269. return result;
  4270. };
  4271. /**
  4272. * <p> Representation of a line. Assumes that the line will be built from data objects representing points, and grouped into lines by a group key. Contains: </p> <p> Group key, for the line identifier. May be null. </p> <p> Array of PointDatum objects. This is used when sorting the point data. </p> <p> Array of points for line or area generator. Each point is a two-element [x,y] array in the unscaled data space. </p> <p> Original data. This is an array of objects from the original point data. </p>
  4273. */
  4274. com_ibm_rave_bundles_data_LineDataUtilities.LineDatum = rave['internal']['Declare']({
  4275. /**
  4276. * Group key, may be null
  4277. */
  4278. /** @expose */
  4279. group : null,
  4280. /**
  4281. * Array of line-generator points in data space, non-null but may be empty
  4282. */
  4283. /** @expose */
  4284. points : null,
  4285. /**
  4286. * Array of point datum objects, non-null but may be empty.
  4287. */
  4288. //_pointData : null,
  4289. /**
  4290. * Original data, non-null but may be empty.
  4291. */
  4292. //_originalData : null,
  4293. /**
  4294. * Construct.
  4295. * @param (String) group The line's group.
  4296. */
  4297. constructor : function(group) {
  4298. this.group = group;
  4299. this.points = [];
  4300. this._pointData = [];
  4301. this._originalData = [];
  4302. },
  4303. /** @expose */
  4304. originalData : function() {
  4305. return this._originalData;
  4306. },
  4307. /** @expose */
  4308. originalDataList : function() {
  4309. return this._originalData;
  4310. },
  4311. /**
  4312. * Add a point to the line.
  4313. * @param (Object) originalData Original data for this point
  4314. * @param (Object) x X value, must not be null
  4315. * @param (Object) y Y value, may be null (for line/non-stacking area charts with gaps for null Y)
  4316. */
  4317. addPoint : function(originalData, x, y) {
  4318. var point = new com_ibm_rave_bundles_data_PointDataUtilities.PointDatum();
  4319. point._x = x;
  4320. point._y = y;
  4321. point._originalData = originalData;
  4322. this.points.push([x, y]);
  4323. this._pointData.push(point);
  4324. this._originalData.push(originalData);
  4325. },
  4326. /**
  4327. * Sort the points by X value (data values) using the comparator, which must compare the X values of two PointDatum objects. The PointDatum array is sorted first, then the line generator and original data arrays are sorted to match.
  4328. * @param (rave['internal']['Comparator']) comp Comparator that takes PointDatum arguments and sorts by X value
  4329. */
  4330. sort : function(comp) {
  4331. this._pointData.sort(comp);
  4332. var N = this._pointData.length;
  4333. for (var i = 0; i < N; ++i) {
  4334. var d = this._pointData[i];
  4335. var p = this.points[i];
  4336. p[0] = d._x;
  4337. p[1] = d._y;
  4338. this._originalData[i] = d._originalData;
  4339. }
  4340. },
  4341. /**
  4342. * Add all PointDatum objects where X and Y are non-null to the array. For efficiency this assumes the X values are non-null.
  4343. * @param (Array) result Array collecting points
  4344. */
  4345. getLineWithPoints : function(result) {
  4346. for (var __i_enFor0 = 0, __exp_enFor0 = this._pointData, __len_enFor0 = __exp_enFor0.length;
  4347. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4348. var point = __exp_enFor0[__i_enFor0];
  4349. if (point._y != null) {
  4350. result.push(point);
  4351. }
  4352. }
  4353. },
  4354. /**
  4355. * Add all PointDatum objects that meet the "null-point-null" criterion to the array. For efficiency this assumes the X values are non-null.
  4356. * @param (Array) result Array collecting points
  4357. */
  4358. getNPNPoints : function(result) {
  4359. var N = this._pointData.length;
  4360. var lastY;
  4361. for (var i = 0; i < N; ++i) {
  4362. var point = this._pointData[i];
  4363. if (point._y != null) {
  4364. var nextY = (i < N - 1) ? this._pointData[i + 1]._y : null;
  4365. if (lastY == null && nextY == null) {
  4366. result.push(point);
  4367. }
  4368. }
  4369. lastY = point._y;
  4370. }
  4371. }
  4372. });
  4373. /**
  4374. * A value function that takes a LineData as argument and returns the group.
  4375. */
  4376. /** @expose */
  4377. com_ibm_rave_bundles_data_LineDataUtilities.GROUP_ACCESSOR = function(d) {
  4378. return (d).group;
  4379. };
  4380. /**
  4381. * A value function that takes a LineData as argument and returns theoints.
  4382. */
  4383. /** @expose */
  4384. com_ibm_rave_bundles_data_LineDataUtilities.POINTS_ACCESSOR = function(d) {
  4385. return (d).points;
  4386. };
  4387. // $source: com/ibm/rave/bundles/internal/nativeImpl/BundleModule
  4388. /************************************************************************
  4389. ** IBM Confidential
  4390. **
  4391. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4392. **
  4393. ** (C) Copyright IBM Corp. 2015
  4394. **
  4395. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4396. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4397. ************************************************************************/
  4398. // Must be the first import
  4399. // @import ./BundleModuleHeader
  4400. // expose DataFormatter to the global variable rave
  4401. //rave["library"]["CustomFormatter"]=com_ibm_rave_library_framework_CustomFormatter;
  4402. // $source: com/ibm/rave/bundles/radarBundle/RadarBundle
  4403. /************************************************************************
  4404. ** IBM Confidential
  4405. **
  4406. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4407. **
  4408. ** (C) Copyright IBM Corp. 2017
  4409. **
  4410. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4411. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4412. ************************************************************************/
  4413. // GENERATED
  4414. //@import com/ibm/rave/library/Library (static) // Library
  4415. //@import com/ibm/rave/bundles/RaveBundle (loadtime) // superclass
  4416. //@import com/ibm/rave/bundles/radarBundle/RadarView (runtime) // new
  4417. var com_ibm_rave_bundles_radarBundle_RadarBundle = rave['internal']['Declare'](com_ibm_rave_bundles_RaveBundle, {
  4418. /** @expose */
  4419. getName : function() {
  4420. return com_ibm_rave_bundles_radarBundle_RadarBundle.BUNDLE_NAME;
  4421. },
  4422. /** @expose */
  4423. createView : function(ctx) {
  4424. return new com_ibm_rave_bundles_radarBundle_RadarView(ctx);
  4425. }
  4426. //constructor : function() {}
  4427. });
  4428. /**
  4429. * Register the bundle factory with the library. The bundle will not be made available if this method is not called.
  4430. */
  4431. /** @expose */
  4432. com_ibm_rave_bundles_radarBundle_RadarBundle.init = function() {
  4433. if (!(com_ibm_rave_library_Library.bundle.isRegistered(com_ibm_rave_bundles_radarBundle_RadarBundle.BUNDLE_NAME))) {
  4434. var bundle;
  4435. com_ibm_rave_library_Library.bundle.extension(com_ibm_rave_bundles_radarBundle_RadarBundle.BUNDLE_NAME, function() {
  4436. if (!bundle) {
  4437. bundle = new com_ibm_rave_bundles_radarBundle_RadarBundle();
  4438. bundle.loadResources();
  4439. require("./vizlibrary-radar.css");
  4440. }
  4441. return bundle;
  4442. });
  4443. }
  4444. return com_ibm_rave_bundles_radarBundle_RadarBundle.BUNDLE_NAME;
  4445. };
  4446. com_ibm_rave_bundles_radarBundle_RadarBundle.BUNDLE_NAME = "radarBundle";
  4447. // Auto initialization
  4448. com_ibm_rave_bundles_radarBundle_RadarBundle.init();
  4449. if (!com_ibm_rave_library_Library.bundle[com_ibm_rave_bundles_radarBundle_RadarBundle.BUNDLE_NAME]) {
  4450. com_ibm_rave_library_Library.bundle[com_ibm_rave_bundles_radarBundle_RadarBundle.BUNDLE_NAME] = function() {
  4451. if (!bundle) {
  4452. bundle = new com_ibm_rave_bundles_radarBundle_RadarBundle();
  4453. bundle.loadResources();
  4454. require("./vizlibrary-radar.css");
  4455. }
  4456. return bundle;
  4457. };
  4458. } else {
  4459. console.log("Could not register extension: RadarBundle");
  4460. }
  4461. // $source: com/ibm/rave/bundles/radarBundle/RadarView
  4462. /************************************************************************
  4463. ** IBM Confidential
  4464. **
  4465. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4466. **
  4467. ** (C) Copyright IBM Corp. 2017
  4468. **
  4469. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4470. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4471. ************************************************************************/
  4472. // GENERATED
  4473. //@import com/ibm/rave/bundles/views/BundleView (loadtime) // superclass
  4474. //@import com/ibm/rave/bundles/components/PointComponentImpl (runtime) // new
  4475. //@import com/ibm/rave/bundles/data/PointDataUtilities (runtime) // PointDataUtilities, buildPoints
  4476. //@import com/ibm/rave/bundles/components/LineComponentImpl (runtime) // new
  4477. //@import com/ibm/rave/bundles/data/LineDataUtilities (runtime) // getNPNPoints, buildLines, sortLines, LineDataUtilities
  4478. //@import com/ibm/rave/bundles/components/RadarBackgroundComponentImpl (runtime) // new
  4479. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  4480. /**
  4481. * Draws a radar chart with spoke and legend, using the components.
  4482. */
  4483. var com_ibm_rave_bundles_radarBundle_RadarView = rave['internal']['Declare'](com_ibm_rave_bundles_views_BundleView, {
  4484. /**
  4485. * Background component, created in setup
  4486. */
  4487. //_radarBackgroundComponent : null,
  4488. //_categoryScale : null,
  4489. //_valueScale : null,
  4490. //ticks : null,
  4491. //chartRect : null, //legendRect : null,
  4492. //_pointComponent : null,
  4493. //xAccessor : null,
  4494. //yAccessor : null,
  4495. /**
  4496. * Line component, created in setup
  4497. */
  4498. //_lineComponent : null,
  4499. //_pointData : null,
  4500. /**
  4501. * Null-point data; the line points which have non-null X and Y, and are flanked by points with null Y
  4502. */
  4503. //_pointNPNData : null,
  4504. zoomScale : 1,
  4505. _radius : 0,
  4506. /**
  4507. * Construct the view
  4508. * @param (rave['library']['internal']['BundleContext']) context Bundle context
  4509. */
  4510. /** @expose */
  4511. constructor : function(context) {
  4512. },
  4513. /** @expose */
  4514. isZoomSupported : function() {
  4515. return false;
  4516. },
  4517. /** @expose */
  4518. setup : function() {
  4519. com_ibm_rave_bundles_views_BundleView.prototype.setup.call(this);
  4520. rave['library']['internal']['BundleUtils'].setupDefaultActions(this.context, ".chart ." + "element-shape", null);
  4521. var highlightAction = this.context.actions.action("highlight");
  4522. var unhighlightAction = this.context.actions.action("unhighlight");
  4523. var self = this;
  4524. highlightAction.setBindFn(function() {
  4525. self.context.node.selectAll(".element-path .element-shape").on("mouseenter.default", function(data, index, groupIndex, event) {
  4526. var attributes = {};
  4527. attributes["stroke-width"] = "4px";
  4528. highlightAction(rave.select(this), attributes);
  4529. });
  4530. self.context.node.selectAll(".element-group .element-shape").on("mouseenter.default", function(data, index, groupIndex, event) {
  4531. highlightAction(rave.select(this));
  4532. });
  4533. });
  4534. highlightAction.setUnbindFn(function() {
  4535. self.context.node.selectAll(".element-shape").on("mouseenter.default", null);
  4536. });
  4537. unhighlightAction.setBindFn(function() {
  4538. self.context.node.selectAll(".element-path .element-shape").on("mouseout.default", function(data, index, groupIndex, event) {
  4539. var attributes = {};
  4540. attributes["stroke-width"] = "2px";
  4541. unhighlightAction(rave.select(this), attributes);
  4542. });
  4543. self.context.node.selectAll(".element-group .element-shape").on("mouseout.default", function(data, index, groupIndex, event) {
  4544. var attributes = {};
  4545. attributes["stroke-width"] = "0px";
  4546. unhighlightAction(rave.select(this), attributes);
  4547. });
  4548. });
  4549. unhighlightAction.setUnbindFn(function() {
  4550. self.context.node.selectAll(".element-shape").on("mouseout.default", null);
  4551. });
  4552. var deselectAllAction = this.context.actions.action("deselectAll");
  4553. var deselectAllEventListener = function(data, index, groupIndex, event) {
  4554. self.context.node.selectAll(".element-shape").style("stroke-width", 0).style("opacity", 1).property("selected", null);
  4555. self.context.node.selectAll(".element-path .element-shape").style("stroke-width", 2);
  4556. };
  4557. deselectAllAction.setBindFn(rave['library']['internal']['BundleUtils'].bindOrUnbindActionFunctionCreater(this.context, ".background", ["click.default", "touchstart.default"], deselectAllEventListener));
  4558. this._pointComponent = new com_ibm_rave_bundles_components_PointComponentImpl();
  4559. this._pointComponent.independentAccessor(com_ibm_rave_bundles_data_PointDataUtilities.X_ACCESSOR).dependentAccessor(com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR);
  4560. this._lineComponent = new com_ibm_rave_bundles_components_LineComponentImpl();
  4561. this._lineComponent.pointsAccessor(com_ibm_rave_bundles_data_LineDataUtilities.POINTS_ACCESSOR).groupAccessor(com_ibm_rave_bundles_data_LineDataUtilities.GROUP_ACCESSOR);
  4562. this._radarBackgroundComponent = new com_ibm_rave_bundles_components_RadarBackgroundComponentImpl();
  4563. },
  4564. /** @expose */
  4565. draw : function() {
  4566. if (this.isUpdateNothing()) {
  4567. return;
  4568. }
  4569. this.preDraw("g.vizlibrary-radar");
  4570. if (!(this.validateDataModel("g.radarbackground", "g.element-group"))) {
  4571. return;
  4572. }
  4573. var effect = this.getStringProperty("effect.name");
  4574. var duration = this.getEffectDuration(effect);
  4575. var doTransition = (duration != 0);
  4576. var dataSet = this.dataModel.dataset("data");
  4577. var yDataSlotEntry = dataSet.slot("y").entry();
  4578. var colorDataSlotEntry = dataSet.slot("color").entry();
  4579. if (!colorDataSlotEntry && yDataSlotEntry) {
  4580. dataSet.slot("color").overrideLabel(yDataSlotEntry.label());
  4581. }
  4582. var data = (dataSet.data());
  4583. var xEntry = dataSet.slot("x").entry();
  4584. this.xAccessor = rave['library']['internal']['AbstractView'].accessorOf(xEntry);
  4585. this.yAccessor = rave['library']['internal']['AbstractView'].accessorOf(dataSet.slot("y").entry());
  4586. this._pointData = com_ibm_rave_bundles_data_PointDataUtilities.buildPoints(data, this.xAccessor, rave['library']['internal']['AbstractView'].domainCheckerOf(data, xEntry), this.yAccessor, rave['library']['internal']['AbstractView'].domainCheckerOf(data, dataSet.slot("y").entry()));
  4587. var groupAccessor = rave['library']['internal']['AbstractView'].accessorOf(dataSet.slot("color").entry());
  4588. var pointColorPalette = this.getPalette();
  4589. pointColorPalette.setData(dataSet, "color");
  4590. pointColorPalette.setAccessor(rave['library']['internal']['AbstractView'].originalDatumAccessor(groupAccessor));
  4591. var pathColorPalette = this.getPalette();
  4592. pathColorPalette.setData(dataSet, "color");
  4593. pathColorPalette.setAccessor(com_ibm_rave_bundles_data_LineDataUtilities.GROUP_ACCESSOR);
  4594. var useLegend = this.isShowLegend();
  4595. var legendPosition = this.getLegendPosition();
  4596. this._legends.visible(useLegend).position(legendPosition).transition(doTransition, duration).setPreExecute(this.context.getPreExecute()).selector(0, this.context.node.selectAll("g.legend")).palette(0, pointColorPalette).shape(0, "square").title(0, this.context.getDataSlotLabel("legend.title", dataSet.slot("color").entry())).titleFill(0, (this.context.getPropertyValue("legend.titlestyle.fill"))).titleFontSize(0, (this.context.getPropertyValue("legend.titlestyle.fontsize"))).titleFontFamily(0, (this.context.getPropertyValue("legend.titlestyle.fontfamily"))).setDataSlot(0, dataSet.slot("color").entry());
  4597. if (this.updateType <= 1) {
  4598. this.prepareLayoutComponent();
  4599. this.prepareLayoutSizables(this._layoutComponent, false, false, false, false, useLegend);
  4600. this._legends.preLayout(this._layoutComponent);
  4601. this._layoutComponent.layout();
  4602. legendPosition = this._layoutComponent.legendPosition();
  4603. this.chartRect = this._layoutComponent.elementRect();
  4604. this.legendRect = this._layoutComponent.legendRect();
  4605. this._clip.clipRect(this.chartRect).applyTo(this._chart.select(".content")).call(this.context.node.select("defs"));
  4606. this._valueScale = rave['library']['internal']['ScaleManager'].makeCoordinateScale(data, dataSet.slot("y").entry());
  4607. if (this._valueScale) {
  4608. if (this.getBooleanProperty("axis.y.scale.includeZero")) {
  4609. this._valueScale.includeZero();
  4610. }
  4611. this._valueScale.range(0, 1, 0.0, 0.0);
  4612. var scale = (this._valueScale.scale()).nice(5);
  4613. if (scale.getTicksInRange()) {
  4614. this.ticks = scale.getTicksInRange()();
  4615. } else if (scale.getTicks()) {
  4616. this.ticks = scale.getTicks()(null);
  4617. } else {
  4618. this.ticks = scale.domain();
  4619. }
  4620. if (this.ticks.length > 0) {
  4621. this.ticks.splice(0, 1);
  4622. }
  4623. }
  4624. this._categoryScale = rave['library']['internal']['ScaleManager'].makeCoordinateScale(data, dataSet.slot("x").entry());
  4625. if (this._categoryScale) {
  4626. this._categoryScale.range(0, 2 * Math.PI, 0.0, 0.0);
  4627. }
  4628. var drawOptions = this.getStringProperty("lineWithPoints.display");
  4629. if (drawOptions == "line_points" || drawOptions == "points") {
  4630. this._pointComponent.data(this._pointData);
  4631. }
  4632. var self = this;
  4633. this._radius = Math.min(this.chartRect.width / 2, this.chartRect.height / 2) * 0.85;
  4634. var identityScale = rave['library']['internal']['LinearCoordinateScale'].create([0, 1]).range(0, 1, 0.0, 0.0);
  4635. this._pointComponent.bounds(this.chartRect).independentScale(identityScale).dependentScale(identityScale).colorPalette(pointColorPalette).independentAccessor(function(data) {
  4636. var d = (data).originalData();
  4637. var v1 = + (self._categoryScale.scale().call(null, self.xAccessor(d), 0, 0));
  4638. var v2 = + (self._valueScale.scale().call(null, self.yAccessor(d), 0, 0));
  4639. var value = -1 * self._radius * v2 * Math.sin(v1);
  4640. return value;
  4641. }).dependentAccessor(function(data) {
  4642. var d = (data).originalData();
  4643. var v1 = + (self._categoryScale.scale().call(null, self.xAccessor(d), 0, 0));
  4644. var v2 = + (self._valueScale.scale().call(null, self.yAccessor(d), 0, 0));
  4645. var value = -1 * self._radius * v2 * Math.cos(v1);
  4646. return value;
  4647. }).setPreExecute(this.context.getPreExecute()).defaultSize((+ (this.context.getPropertyValue("lineWithPoints.size")))).symbol(this.getStringProperty("lineWithPoints.symbol"));
  4648. this._chart.select("g.element-group").transition("transition").duration(duration).call(this._pointComponent).attr("transform", "translate(" + (this.chartRect.x + this.chartRect.width / 2) + "," + (this.chartRect.y + this.chartRect.height / 2) + ")");
  4649. var _lineData;
  4650. _lineData = com_ibm_rave_bundles_data_LineDataUtilities.buildLines(data, this.xAccessor, rave['library']['internal']['AbstractView'].domainCheckerOf(data, xEntry), this.yAccessor, rave['library']['internal']['AbstractView'].accessorOf(dataSet.slot("color").entry()));
  4651. com_ibm_rave_bundles_data_LineDataUtilities.sortLines(_lineData, self._categoryScale);
  4652. if (drawOptions == "line_points" || drawOptions == "line") {
  4653. this._lineComponent.data(_lineData);
  4654. } else {
  4655. this._lineComponent.data(null);
  4656. }
  4657. this._pointNPNData = com_ibm_rave_bundles_data_LineDataUtilities.getNPNPoints(_lineData);
  4658. this._pointComponent.data(this._pointNPNData);
  4659. this._lineComponent.pointsAccessor(com_ibm_rave_bundles_data_LineDataUtilities.POINTS_ACCESSOR).groupAccessor(com_ibm_rave_bundles_data_LineDataUtilities.GROUP_ACCESSOR);
  4660. this._lineComponent.independentScale(identityScale).dependentScale(identityScale).colorPalette(pathColorPalette).independentAccessor(function(data) {
  4661. var d = data;
  4662. var v1 = + (self._categoryScale.scale().call(null, d[0], 0, 0));
  4663. var obj = d[1];
  4664. var v2 = (obj == null) ? 0.0 : + (self._valueScale.scale().call(null, obj, 0, 0));
  4665. return -1 * self._radius * v2 * Math.sin(v1);
  4666. }).dependentAccessor(function(data) {
  4667. var d = data;
  4668. var v1 = + (self._categoryScale.scale().call(null, d[0], 0, 0));
  4669. var obj = d[1];
  4670. var v2 = (obj == null) ? 0.0 : + (self._valueScale.scale().call(null, obj, 0, 0));
  4671. return -1 * self._radius * v2 * Math.cos(v1);
  4672. }).setPreExecute(this.context.getPreExecute()).effect(effect).interpolate(this.getStringProperty("lineWithPoints.interpolate"));
  4673. this._chart.selectAll("g.element-path").transition().duration(duration).call(this._lineComponent).attr("transform", "translate(" + (this.chartRect.x + this.chartRect.width / 2) + "," + (this.chartRect.y + this.chartRect.height / 2) + ")");
  4674. var lines = this._chart.select("g.element-path").selectAll("path");
  4675. if (this.getBooleanProperty("lineWithPoints.fillradar")) {
  4676. lines.style("fill", pathColorPalette).style("fill-opacity", 0.5);
  4677. } else {
  4678. lines.style("fill", "transparent");
  4679. }
  4680. }
  4681. this._chart.select("rect.background.elements").attr("x", this.chartRect.x).attr("y", this.chartRect.y).attr("width", this.chartRect.width).attr("height", this.chartRect.height);
  4682. this.setBackgroundProperties(this.chartRect, duration);
  4683. var spokeDomain;
  4684. if (this._categoryScale) {
  4685. spokeDomain = this._categoryScale.originalDomain();
  4686. if (!spokeDomain) {
  4687. this._categoryScale.scale().domain();
  4688. }
  4689. }
  4690. this._radarBackgroundComponent.ticks(this.ticks).bounds(this.chartRect).zoomScale(this.zoomScale).spokeData((!spokeDomain) ? null : spokeDomain);
  4691. this._chart.select("g.radarbackground").transition("transition").duration(duration).call(this._radarBackgroundComponent);
  4692. this.styleAxis();
  4693. this._legends.rectangle(this.legendRect).draw();
  4694. this.resetUpdate();
  4695. this._chart.selectAll(".element-shape").classed("bundle-shape", true);
  4696. this._chart.selectAll(".legendShape").classed("bundle-shape", true);
  4697. },
  4698. /** @expose */
  4699. getCoordinateScale : function(role) {
  4700. if ("ROLE_X1" == role) {
  4701. return this._categoryScale;
  4702. }
  4703. if ("ROLE_Y1" == role) {
  4704. return this._valueScale;
  4705. }
  4706. return null;
  4707. },
  4708. /**
  4709. * Method to style the Axis Spoke, and the Radial axis.
  4710. */
  4711. styleAxis : function() {
  4712. if (this.getBooleanProperty("axis.y.line.display")) {
  4713. this._chart.selectAll(".spoke.axis").select("line").style("stroke", this.context.getPropertyValue("axis.y.line.style.stroke")).style("visibility", "visible");
  4714. } else {
  4715. this._chart.selectAll(".spoke.axis").select("line").style("visibility", "hidden");
  4716. }
  4717. var fontChecker = rave.capabilities.extension("fontchecker");
  4718. if (this.getBooleanProperty("axis.y.labels.display")) {
  4719. var labelString = (this.context.getPropertyValue("axis.y.labels.style.font"));
  4720. var _labelStyle = null;
  4721. if (labelString != null && labelString.length > 0) {
  4722. _labelStyle = (com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(labelString));
  4723. }
  4724. var yLabels = this._chart.selectAll(".gridline").select("text").style("visibility", "visible");
  4725. if (_labelStyle) {
  4726. yLabels.style(_labelStyle);
  4727. } else {
  4728. yLabels.style("fill", this.context.getPropertyValue("axis.y.labels.style.fill")).style("font-family", this.context.getPropertyValue("axis.y.labels.style.font-family")).style("font-size", this.context.getPropertyValue("axis.y.labels.style.font-size")).call(fontChecker);
  4729. }
  4730. } else {
  4731. this._chart.selectAll(".gridline").select("text").style("visibility", "hidden");
  4732. }
  4733. if (this.getBooleanProperty("axis.y.ticks.display")) {
  4734. this._chart.selectAll(".grid-tick-line").style("stroke", this.context.getPropertyValue("axis.y.ticks.style.stroke")).style("visibility", "visible");
  4735. } else {
  4736. this._chart.selectAll(".grid-tick-line").style("visibility", "hidden");
  4737. }
  4738. if (this.getBooleanProperty("axis.y.gridlines.display")) {
  4739. this._chart.selectAll(".spoke.grid").select("line").style("stroke", this.context.getPropertyValue("axis.y.gridlines.style.stroke")).style("stroke-dasharray", this.context.getPropertyValue("axis.y.gridlines.style.stroke-dasharray")).style("visibility", "visible");
  4740. } else {
  4741. this._chart.selectAll(".spoke.grid").select("line").style("visibility", "hidden");
  4742. }
  4743. if (this.getBooleanProperty("axis.x.line.display")) {
  4744. this._chart.selectAll(".gridline.axis").select("path").style("stroke", this.context.getPropertyValue("axis.x.line.style.stroke")).style("visibility", "visible");
  4745. } else {
  4746. this._chart.selectAll(".gridline.axis").select("path").style("stroke", this.context.getPropertyValue("axis.x.line.style.stroke")).style("visibility", "hidden");
  4747. }
  4748. if (this.getBooleanProperty("axis.x.labels.display")) {
  4749. var labelString = (this.context.getPropertyValue("axis.x.labels.style.font"));
  4750. var _labelStyle = null;
  4751. if (labelString != null && labelString.length > 0) {
  4752. _labelStyle = (com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(labelString));
  4753. }
  4754. var xLabels = this._chart.selectAll(".spoke").select("text").style("visibility", "visible");
  4755. if (_labelStyle) {
  4756. xLabels.style(_labelStyle);
  4757. } else {
  4758. xLabels.style("fill", this.context.getPropertyValue("axis.x.labels.style.fill")).style("font-family", this.context.getPropertyValue("axis.x.labels.style.font-family")).style("font-size", this.context.getPropertyValue("axis.x.labels.style.font-size")).call(fontChecker);
  4759. }
  4760. } else {
  4761. this._chart.selectAll(".spoke").select("text").style("visibility", "hidden");
  4762. }
  4763. if (this.getBooleanProperty("axis.x.ticks.display")) {
  4764. this._chart.selectAll(".spoke-tick-line").style("stroke", this.context.getPropertyValue("axis.x.ticks.style.stroke")).style("visibility", "visible");
  4765. } else {
  4766. this._chart.selectAll(".spoke-tick-line").style("visibility", "hidden");
  4767. }
  4768. if (this.getBooleanProperty("axis.x.gridlines.display")) {
  4769. this._chart.selectAll(".gridline.grid").select("path").style("stroke", this.context.getPropertyValue("axis.x.gridlines.style.stroke")).style("stroke-dasharray", this.context.getPropertyValue("axis.x.gridlines.style.stroke-dasharray")).style("visibility", "visible");
  4770. } else {
  4771. this._chart.selectAll(".gridline.grid").select("path").style("visibility", "hidden");
  4772. }
  4773. var dataSet = this.dataModel.dataset("data");
  4774. var yEntry = dataSet.slot("y").entry();
  4775. var entries = [];
  4776. if (yEntry) {
  4777. entries.push(yEntry);
  4778. }
  4779. var fmt = this.context.getCustomFormatterWithFlag(["ROLE_Y1", "left", "axis", "all"], rave['library']['internal']['BundleContext'].makeCustomFormatInfo("axis-label", "ROLE_Y1", "none", entries), null, false);
  4780. if (fmt) {
  4781. this._chart.selectAll(".gridline").select("text").text(function(data, index, groupIndex) {
  4782. return fmt.call(this, data, index, groupIndex);
  4783. });
  4784. }
  4785. },
  4786. /** @expose */
  4787. getGroupStructure : function() {
  4788. return ["defs", "g.vizlibrary vizlibrary-radar", "(", "rect.background chart", "g.chart", "(", "g.content", "(", "rect.background elements", "g.radarbackground", "g.elements", "(", "g.element-group", "g.element-path", ")", ")", ")", "g.legends", "(", "g.legends-layout", "g.legend", ")", ")"];
  4789. }
  4790. });
  4791. //com_ibm_rave_bundles_radarBundle_RadarView.DATASET_DATA = "data";
  4792. //com_ibm_rave_bundles_radarBundle_RadarView.DATASLOT_X = "x";
  4793. //com_ibm_rave_bundles_radarBundle_RadarView.DATASLOT_Y = "y";
  4794. //com_ibm_rave_bundles_radarBundle_RadarView.DATASLOT_GROUP = "color";
  4795. //com_ibm_rave_bundles_radarBundle_RadarView.DATASLOT_KEY = "key";
  4796. //com_ibm_rave_bundles_radarBundle_RadarView.LINE_WITH_POINTS_SYMBOL = "lineWithPoints.symbol";
  4797. //com_ibm_rave_bundles_radarBundle_RadarView.LINE_OR_POINTS_DISPLAY = "lineWithPoints.display";
  4798. //com_ibm_rave_bundles_radarBundle_RadarView.LINE_DISPLAY = "line";
  4799. //com_ibm_rave_bundles_radarBundle_RadarView.POINTS_DISPLAY = "points";
  4800. //com_ibm_rave_bundles_radarBundle_RadarView.LINE_WITH_POINTS_DISPLAY = "lineWithPoints.display";
  4801. //com_ibm_rave_bundles_radarBundle_RadarView.LINE_WITH_POINTS_SIZE = "lineWithPoints.size";
  4802. //com_ibm_rave_bundles_radarBundle_RadarView.COLOR_PALLETTE_LINE = "color.palette.line";
  4803. //com_ibm_rave_bundles_radarBundle_RadarView.LINE_INTERPOLATE_PROPERTY = "lineWithPoints.interpolate";
  4804. //com_ibm_rave_bundles_radarBundle_RadarView.FILL_RADAR = "lineWithPoints.fillradar";
  4805. // $source: com/ibm/rave/bundles/components/BackgroundComponentImpl
  4806. /************************************************************************
  4807. ** IBM Confidential
  4808. **
  4809. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4810. **
  4811. ** (C) Copyright IBM Corp. 2017
  4812. **
  4813. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4814. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4815. ************************************************************************/
  4816. // GENERATED
  4817. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  4818. //@import com/ibm/rave/bundles/component/BackgroundComponent (runtime) // BackgroundComponent
  4819. /**
  4820. * <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>
  4821. */
  4822. var com_ibm_rave_bundles_components_BackgroundComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  4823. //_backgroundColor : null,
  4824. //_rect : null,
  4825. /** @expose */
  4826. constructor : function() {
  4827. this._rect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4828. },
  4829. /** @expose */
  4830. execute : function(g) {
  4831. this.preExecute();
  4832. g.style("fill", this._backgroundColor != null ? this._backgroundColor : "#FFFFFF").style("fill-opacity", 1.0);
  4833. g.attr("x", this._rect.x).attr("y", this._rect.y).attr("width", this._rect.width).attr("height", this._rect.height);
  4834. },
  4835. /** @expose */
  4836. type : function() {
  4837. return com_ibm_rave_bundles_component_BackgroundComponent.COMPONENT_TYPE;
  4838. },
  4839. backgroundColor$0 : function() {
  4840. return this._backgroundColor;
  4841. },
  4842. backgroundColor$1 : function(backgroundColor) {
  4843. this._backgroundColor = backgroundColor;
  4844. return this;
  4845. },
  4846. /**
  4847. * @param (rave['library']['internal']['ContextSize']) size New value of size property
  4848. * @return (com.ibm.rave.bundles.components.BackgroundComponentImpl) This component
  4849. */
  4850. /** @expose */
  4851. size : function(size) {
  4852. this._rect.x = 0;
  4853. this._rect.y = 0;
  4854. this._rect.width = size.w;
  4855. this._rect.height = size.h;
  4856. return this;
  4857. },
  4858. /** @expose */
  4859. rect : function(rect) {
  4860. var r = new rave['internal']['RectStruct'](rect.x, rect.y, rect.width, rect.height);
  4861. this._rect = r;
  4862. return this;
  4863. },
  4864. /** @expose */
  4865. backgroundColor : function(a0) {
  4866. var args = arguments;
  4867. if (args.length == 0) {
  4868. return this.backgroundColor$0();
  4869. }
  4870. return this.backgroundColor$1(a0);
  4871. }
  4872. });
  4873. // $source: com/ibm/rave/bundles/components/ChartLayoutComponentImpl
  4874. /************************************************************************
  4875. ** IBM Confidential
  4876. **
  4877. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4878. **
  4879. ** (C) Copyright IBM Corp. 2017
  4880. **
  4881. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4882. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4883. ************************************************************************/
  4884. // GENERATED
  4885. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  4886. //@import com/ibm/rave/bundles/component/ChartLayoutComponent (runtime) // ChartLayoutComponent
  4887. /**
  4888. * <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>
  4889. */
  4890. var com_ibm_rave_bundles_components_ChartLayoutComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  4891. //_padding : null,
  4892. //_legendChartGap : null,
  4893. //_topChartPadding : null,
  4894. //_leftChartPadding : null,
  4895. //_bottomChartPadding : null,
  4896. //_rightChartPadding : null,
  4897. //_legendPosition : null,
  4898. //_legendSizable : null,
  4899. //_axisSizables : null,
  4900. //_overallRect : null,
  4901. //_legendRect : null,
  4902. //_chartRect : null,
  4903. //_topRect : null,
  4904. //_leftRect : null,
  4905. //_bottomRect : null,
  4906. //_rightRect : null,
  4907. //_elementRect : null,
  4908. _leftPadding : 0, _topPadding : 0, _rightPadding : 0, _bottomPadding : 0,
  4909. _legendChartAlign : false,
  4910. _preLegendAtMax : false,
  4911. _preAxesAtZero : false,
  4912. constructor : function() {
  4913. this._axisSizables = [];
  4914. /**
  4915. * Construct. All padding is 0, legendPosition is "right", all slices have a size of 0 (value of null).
  4916. */
  4917. {
  4918. this._padding = 0.0;
  4919. this._topPadding = 0;
  4920. this._leftPadding = 0;
  4921. this._bottomPadding = 0;
  4922. this._rightPadding = 0;
  4923. this._topChartPadding = 0.0;
  4924. this._leftChartPadding = 0.0;
  4925. this._bottomChartPadding = 0.0;
  4926. this._rightChartPadding = 0.0;
  4927. this._legendChartGap = 0.0;
  4928. this._legendPosition = "right";
  4929. this._overallRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4930. this._legendRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4931. this._chartRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4932. this._topRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4933. this._leftRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4934. this._bottomRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4935. this._rightRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4936. this._elementRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4937. this._legendChartAlign = true;
  4938. }
  4939. },
  4940. /** @expose */
  4941. execute : function(g) {
  4942. this.layout();
  4943. },
  4944. /**
  4945. * Calculates rectangles during preliminary layout
  4946. * @param (boolean) legendAtMax true if legend is given max size; false if legend is asked for its preferred size
  4947. * @param (boolean) axesAtZero true if axes are given a size of 0; false if axes are asked for their preferred size
  4948. */
  4949. /** @expose */
  4950. preLayout : function(legendAtMax, axesAtZero) {
  4951. this._preLegendAtMax = legendAtMax;
  4952. this._preAxesAtZero = axesAtZero;
  4953. this.layout();
  4954. this._preLegendAtMax = false;
  4955. this._preAxesAtZero = false;
  4956. },
  4957. /**
  4958. * Calls preExecute, then does the layout with the property values, updating the chart, legend, axis, and elements rectangles.
  4959. */
  4960. /** @expose */
  4961. layout : function() {
  4962. this.preExecute();
  4963. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._chartRect, this._overallRect);
  4964. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._legendRect, this._overallRect);
  4965. var x = this._overallRect.x;
  4966. var y = this._overallRect.y;
  4967. var w = this._overallRect.width;
  4968. var h = this._overallRect.height;
  4969. var maxWH = Math.max(w, h);
  4970. var tbLegend = "top" == this._legendPosition || "bottom" == this._legendPosition;
  4971. var legendPercent = this._axisSizables.length == 0 ? 0.5 : 0.3;
  4972. var legendMaxSize = (tbLegend ? this._legendRect.height : this._legendRect.width) * legendPercent;
  4973. var legendDynamicSize = this._legendSizable ? (this._preLegendAtMax ? maxWH : this._legendSizable.getPreferredSize()) : 0;
  4974. if (legendDynamicSize > legendMaxSize) {
  4975. legendDynamicSize = legendMaxSize;
  4976. }
  4977. var isLegendTop = false;
  4978. var isLegendBottom = false;
  4979. var isLegendLeft = false;
  4980. var isLegendRight = false;
  4981. if ("top" == this._legendPosition) {
  4982. this._legendRect.height = legendDynamicSize;
  4983. this._chartRect.height -= this._legendRect.height;
  4984. this._chartRect.y += this._legendRect.height;
  4985. isLegendTop = true;
  4986. } else if ("bottom" == this._legendPosition) {
  4987. this._legendRect.height = legendDynamicSize;
  4988. this._chartRect.height -= this._legendRect.height;
  4989. this._legendRect.y = y + h - this._legendRect.height;
  4990. isLegendBottom = true;
  4991. } else if ("left" == this._legendPosition) {
  4992. this._legendRect.width = legendDynamicSize;
  4993. this._chartRect.width -= this._legendRect.width;
  4994. this._chartRect.x += this._legendRect.width;
  4995. isLegendLeft = true;
  4996. } else {
  4997. this._legendRect.width = legendDynamicSize;
  4998. this._chartRect.width -= this._legendRect.width;
  4999. this._legendRect.x = x + w - this._legendRect.width;
  5000. isLegendRight = true;
  5001. }
  5002. if (this.evaluatePadding(this._padding, w, h)) {
  5003. var lrgap = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._legendChartGap, w);
  5004. var tbgap = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._legendChartGap, h);
  5005. var chartTop = isLegendTop && this._legendSizable ? tbgap : this._topPadding;
  5006. var chartLeft = isLegendLeft && this._legendSizable ? lrgap : this._leftPadding;
  5007. var chartBottom = isLegendBottom && this._legendSizable ? tbgap : this._bottomPadding;
  5008. var chartRight = isLegendRight && this._legendSizable ? lrgap : this._rightPadding;
  5009. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset(this._chartRect, chartTop, chartLeft, chartBottom, chartRight);
  5010. } else {
  5011. var lrpadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._padding, w);
  5012. var tbpadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._padding, h);
  5013. var chartTop = tbpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._topChartPadding, h);
  5014. var chartLeft = lrpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._leftChartPadding, w);
  5015. var chartBottom = tbpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._bottomChartPadding, h);
  5016. var chartRight = lrpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._rightChartPadding, w);
  5017. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset(this._chartRect, chartTop, chartLeft, chartBottom, chartRight);
  5018. this._topPadding = tbpadding;
  5019. this._leftPadding = lrpadding;
  5020. this._bottomPadding = tbpadding;
  5021. this._rightPadding = lrpadding;
  5022. }
  5023. if (this._legendSizable) {
  5024. if (isLegendRight) {
  5025. this._legendRect.x -= this._rightPadding;
  5026. this._chartRect.width -= this._rightPadding;
  5027. this._legendRect.y += this._topPadding;
  5028. this._legendRect.height -= (this._topPadding + this._bottomPadding);
  5029. } else if (isLegendLeft) {
  5030. this._legendRect.x += this._leftPadding;
  5031. this._chartRect.x += this._leftPadding;
  5032. this._chartRect.width -= this._leftPadding;
  5033. this._legendRect.y += this._topPadding;
  5034. this._legendRect.height -= (this._topPadding + this._bottomPadding);
  5035. } else if (isLegendTop) {
  5036. this._legendRect.y += this._topPadding;
  5037. this._chartRect.y += this._topPadding;
  5038. this._chartRect.height -= this._topPadding;
  5039. this._legendRect.x += this._leftPadding;
  5040. this._legendRect.width -= (this._leftPadding + this._rightPadding);
  5041. } else {
  5042. this._legendRect.y -= this._bottomPadding;
  5043. this._chartRect.height -= this._bottomPadding;
  5044. this._legendRect.x += this._leftPadding;
  5045. this._legendRect.width -= (this._leftPadding + this._rightPadding);
  5046. }
  5047. }
  5048. x = this._chartRect.x;
  5049. y = this._chartRect.y;
  5050. w = this._chartRect.width;
  5051. h = this._chartRect.height;
  5052. var bottomH = 0;
  5053. var topH = 0;
  5054. var leftW = 0;
  5055. var rightW = 0;
  5056. var tbSO = 0;
  5057. var lrSO = 0;
  5058. if (!this._preAxesAtZero) {
  5059. var countHorz = 0;
  5060. var countVert = 0;
  5061. for (var i = 0; i < this._axisSizables.length; ++i) {
  5062. var sizable = this._axisSizables[i];
  5063. if (sizable) {
  5064. var orientation = sizable.getSizableOrientation();
  5065. if ("top" == orientation || "bottom" == orientation) {
  5066. countHorz++;
  5067. } else {
  5068. countVert++;
  5069. }
  5070. }
  5071. }
  5072. for (var i = 0; i < this._axisSizables.length; ++i) {
  5073. var sizable = this._axisSizables[i];
  5074. if (sizable) {
  5075. var orientation = sizable.getSizableOrientation();
  5076. var tbAxis = "top" == orientation || "bottom" == orientation;
  5077. var axisDynamicSize = sizable.getPreferredSize();
  5078. var spillOver = sizable.getSpillOverSize();
  5079. if (tbAxis) {
  5080. var axisPercent = countHorz > 1 ? 0.4 : 0.5;
  5081. if (axisDynamicSize > this._chartRect.height * axisPercent) {
  5082. axisDynamicSize = this._chartRect.height * axisPercent;
  5083. }
  5084. if ("top" == orientation) {
  5085. topH = axisDynamicSize;
  5086. } else {
  5087. bottomH = axisDynamicSize;
  5088. }
  5089. if (spillOver > lrSO) {
  5090. lrSO = spillOver;
  5091. }
  5092. } else {
  5093. var axisPercent = countVert > 1 ? 0.4 : 0.5;
  5094. if (axisDynamicSize > this._chartRect.width * axisPercent) {
  5095. axisDynamicSize = this._chartRect.width * axisPercent;
  5096. }
  5097. if ("left" == orientation) {
  5098. leftW = axisDynamicSize;
  5099. } else {
  5100. rightW = axisDynamicSize;
  5101. }
  5102. if (spillOver > tbSO) {
  5103. tbSO = spillOver;
  5104. }
  5105. }
  5106. }
  5107. }
  5108. }
  5109. if (lrSO > leftW) {
  5110. leftW = lrSO;
  5111. }
  5112. if (lrSO > rightW) {
  5113. rightW = lrSO;
  5114. }
  5115. if (tbSO > topH) {
  5116. topH = tbSO;
  5117. }
  5118. if (tbSO > bottomH) {
  5119. bottomH = tbSO;
  5120. }
  5121. this._leftRect.x = x;
  5122. this._leftRect.width = leftW;
  5123. this._leftRect.y = y;
  5124. this._leftRect.height = h;
  5125. this._rightRect.x = x + w - rightW;
  5126. this._rightRect.width = rightW;
  5127. this._rightRect.y = y;
  5128. this._rightRect.height = h;
  5129. this._topRect.y = y;
  5130. this._topRect.height = topH;
  5131. this._topRect.x = x;
  5132. this._topRect.width = w;
  5133. this._bottomRect.y = y + h - bottomH;
  5134. this._bottomRect.height = bottomH;
  5135. this._bottomRect.x = x;
  5136. this._bottomRect.width = w;
  5137. this._elementRect.x = x + leftW;
  5138. this._elementRect.y = y + topH;
  5139. this._elementRect.width = w - (leftW + rightW);
  5140. this._elementRect.height = h - (topH + bottomH);
  5141. if (this._legendSizable && this._legendChartAlign) {
  5142. if (tbLegend) {
  5143. this._legendRect.x = this._elementRect.x;
  5144. this._legendRect.width = this._elementRect.width;
  5145. } else {
  5146. this._legendRect.y = this._elementRect.y;
  5147. this._legendRect.height = this._elementRect.height;
  5148. }
  5149. }
  5150. },
  5151. evaluatePadding : function(padding, horizontalExtent, verticalExtent) {
  5152. if (padding == null) {
  5153. return false;
  5154. }
  5155. var paddingString = (padding) + "";
  5156. if (paddingString.length == 0) {
  5157. return false;
  5158. }
  5159. this._topPadding = 0;
  5160. this._leftPadding = 0;
  5161. this._bottomPadding = 0;
  5162. this._rightPadding = 0;
  5163. var items = paddingString.split(new RegExp(";"));
  5164. for (var __i_enFor0 = 0, __len_enFor0 = items.length;
  5165. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5166. var item = items[__i_enFor0];
  5167. var parts = item.split(new RegExp(":"));
  5168. if (items.length == 1 && parts.length != 2) {
  5169. return false;
  5170. }
  5171. if (parts.length == 2) {
  5172. if (0 <= parts[0].indexOf("top")) {
  5173. this._topPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], verticalExtent);
  5174. } else if (0 <= parts[0].indexOf("left")) {
  5175. this._leftPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], horizontalExtent);
  5176. } else if (0 <= parts[0].indexOf("bottom")) {
  5177. this._bottomPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], verticalExtent);
  5178. } else if (0 <= parts[0].indexOf("right")) {
  5179. this._rightPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], horizontalExtent);
  5180. }
  5181. }
  5182. }
  5183. return true;
  5184. },
  5185. /**
  5186. * @return (rave['internal']['RectStruct']) Legend rectangle
  5187. */
  5188. /** @expose */
  5189. legendRect : function() {
  5190. return this._legendRect;
  5191. },
  5192. /**
  5193. * @return (rave['internal']['RectStruct']) Chart (elements plus axes) rectangle
  5194. */
  5195. /** @expose */
  5196. chartRect : function() {
  5197. return this._chartRect;
  5198. },
  5199. /**
  5200. * @return (rave['internal']['RectStruct']) Top axis rectangle
  5201. */
  5202. /** @expose */
  5203. topRect : function() {
  5204. return this._topRect;
  5205. },
  5206. /**
  5207. * @return (rave['internal']['RectStruct']) Left axis rectangle
  5208. */
  5209. /** @expose */
  5210. leftRect : function() {
  5211. return this._leftRect;
  5212. },
  5213. /**
  5214. * @return (rave['internal']['RectStruct']) Bottom axis rectangle
  5215. */
  5216. /** @expose */
  5217. bottomRect : function() {
  5218. return this._bottomRect;
  5219. },
  5220. /**
  5221. * @return (rave['internal']['RectStruct']) Right axis rectangle
  5222. */
  5223. /** @expose */
  5224. rightRect : function() {
  5225. return this._rightRect;
  5226. },
  5227. /**
  5228. * @return (rave['internal']['RectStruct']) Legend rectangle
  5229. */
  5230. /** @expose */
  5231. elementRect : function() {
  5232. return this._elementRect;
  5233. },
  5234. /**
  5235. * Set the overall rectangle. This should be called before doing the layout.
  5236. * @param (rave['internal']['RectStruct']) overall The overall rectangle
  5237. */
  5238. /** @expose */
  5239. overall : function(overall) {
  5240. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._overallRect, overall);
  5241. return this;
  5242. },
  5243. padding$0 : function() {
  5244. return this._padding;
  5245. },
  5246. legendChartAlign$0 : function() {
  5247. return this._legendChartAlign;
  5248. },
  5249. legendChartGap$0 : function() {
  5250. return this._legendChartGap;
  5251. },
  5252. topPadding$0 : function() {
  5253. return this._topChartPadding;
  5254. },
  5255. leftPadding$0 : function() {
  5256. return this._leftChartPadding;
  5257. },
  5258. bottomPadding$0 : function() {
  5259. return this._bottomChartPadding;
  5260. },
  5261. rightPadding$0 : function() {
  5262. return this._rightChartPadding;
  5263. },
  5264. legendPosition$0 : function() {
  5265. return this._legendPosition;
  5266. },
  5267. topPadding$1 : function(padding) {
  5268. this._topChartPadding = padding;
  5269. return this;
  5270. },
  5271. leftPadding$1 : function(padding) {
  5272. this._leftChartPadding = padding;
  5273. return this;
  5274. },
  5275. bottomPadding$1 : function(padding) {
  5276. this._bottomChartPadding = padding;
  5277. return this;
  5278. },
  5279. rightPadding$1 : function(padding) {
  5280. this._rightChartPadding = padding;
  5281. return this;
  5282. },
  5283. /** @expose */
  5284. type : function() {
  5285. return com_ibm_rave_bundles_component_ChartLayoutComponent.COMPONENT_TYPE;
  5286. },
  5287. padding$1 : function(value) {
  5288. this._padding = value;
  5289. return this;
  5290. },
  5291. /** @expose */
  5292. chartPadding : function(top, left, bottom, right) {
  5293. this._topChartPadding = top;
  5294. this._leftChartPadding = left;
  5295. this._bottomChartPadding = bottom;
  5296. this._rightChartPadding = right;
  5297. return this;
  5298. },
  5299. legendChartAlign$1 : function(legendChartAlign) {
  5300. this._legendChartAlign = legendChartAlign;
  5301. return this;
  5302. },
  5303. legendChartGap$1 : function(value) {
  5304. this._legendChartGap = value;
  5305. return this;
  5306. },
  5307. legendPosition$1 : function(position) {
  5308. if ("top" == position || "bottom" == position || "left" == position || "right" == position) {
  5309. this._legendPosition = position;
  5310. }
  5311. return this;
  5312. },
  5313. /** @expose */
  5314. legendSize : function(sizable) {
  5315. this._legendSizable = sizable;
  5316. return this;
  5317. },
  5318. /** @expose */
  5319. removeAxisSizables : function() {
  5320. this._axisSizables.length = 0;
  5321. return this;
  5322. },
  5323. /** @expose */
  5324. addAxisSizable : function(sizable) {
  5325. this._axisSizables.push(sizable);
  5326. return this;
  5327. },
  5328. /** @expose */
  5329. padding : function(a0) {
  5330. var args = arguments;
  5331. if (args.length == 0) {
  5332. return this.padding$0();
  5333. }
  5334. return this.padding$1(a0);
  5335. },
  5336. /** @expose */
  5337. legendChartAlign : function(a0) {
  5338. var args = arguments;
  5339. if (args.length == 0) {
  5340. return this.legendChartAlign$0();
  5341. }
  5342. return this.legendChartAlign$1(a0);
  5343. },
  5344. /** @expose */
  5345. legendChartGap : function(a0) {
  5346. var args = arguments;
  5347. if (args.length == 0) {
  5348. return this.legendChartGap$0();
  5349. }
  5350. return this.legendChartGap$1(a0);
  5351. },
  5352. /** @expose */
  5353. topPadding : function(a0) {
  5354. var args = arguments;
  5355. if (args.length == 0) {
  5356. return this.topPadding$0();
  5357. }
  5358. return this.topPadding$1(a0);
  5359. },
  5360. /** @expose */
  5361. leftPadding : function(a0) {
  5362. var args = arguments;
  5363. if (args.length == 0) {
  5364. return this.leftPadding$0();
  5365. }
  5366. return this.leftPadding$1(a0);
  5367. },
  5368. /** @expose */
  5369. bottomPadding : function(a0) {
  5370. var args = arguments;
  5371. if (args.length == 0) {
  5372. return this.bottomPadding$0();
  5373. }
  5374. return this.bottomPadding$1(a0);
  5375. },
  5376. /** @expose */
  5377. rightPadding : function(a0) {
  5378. var args = arguments;
  5379. if (args.length == 0) {
  5380. return this.rightPadding$0();
  5381. }
  5382. return this.rightPadding$1(a0);
  5383. },
  5384. /** @expose */
  5385. legendPosition : function(a0) {
  5386. var args = arguments;
  5387. if (args.length == 0) {
  5388. return this.legendPosition$0();
  5389. }
  5390. return this.legendPosition$1(a0);
  5391. }
  5392. });
  5393. /**
  5394. * Set preferred rectangle to the same position and size as the source rectangle.
  5395. * @param (rave['internal']['RectStruct']) t preferred rectangle
  5396. * @param (rave['internal']['RectStruct']) s Source rectangle
  5397. * @return (rave['internal']['RectStruct']) preferred rectangle
  5398. */
  5399. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect = function(t, s) {
  5400. t.x = s.x;
  5401. t.y = s.y;
  5402. t.width = s.width;
  5403. t.height = s.height;
  5404. return t;
  5405. };
  5406. /**
  5407. * 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.
  5408. * @param (rave['internal']['RectStruct']) r Rectangle
  5409. * @param (double) top Top inset in pixels
  5410. * @param (double) left Left inset in pixels
  5411. * @param (double) bottom Bottom inset in pixels
  5412. * @param (double) right Right inset in pixels
  5413. * @return (rave['internal']['RectStruct']) The rectangle
  5414. */
  5415. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset = function(r, top, left, bottom, right) {
  5416. var ileft = Math.max(0.0, left);
  5417. var iright = Math.max(0.0, right);
  5418. if (ileft + iright <= r.width) {
  5419. r.x += ileft;
  5420. r.width -= ileft + iright;
  5421. }
  5422. var itop = Math.max(0.0, top);
  5423. var ibottom = Math.max(0.0, bottom);
  5424. if (itop + ibottom <= r.height) {
  5425. r.y += itop;
  5426. r.height -= itop + ibottom;
  5427. }
  5428. return r;
  5429. };
  5430. /**
  5431. * 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.
  5432. * @param (Object) value The size
  5433. * @param (double) extent The extent in the dimension
  5434. * @param defValue The default to use if not parsable
  5435. * @return (double) Size in pixels
  5436. */
  5437. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize = function(value, extent) {
  5438. var v = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(value, extent, 10.0);
  5439. var d = v != null ? v : 0;
  5440. return Math.max(0.0, Math.min(d, extent));
  5441. };
  5442. /** @expose */
  5443. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_AXIS_PERCENT = 0.4;
  5444. /** @expose */
  5445. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_AXIS_PERCENT_SINGLE_PER_ORIENTATION = 0.5;
  5446. /** @expose */
  5447. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_LEGEND_PERCENT = 0.3;
  5448. /** @expose */
  5449. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_LEGEND_PERCENT_NO_AXIS = 0.5;
  5450. // $source: com/ibm/rave/bundles/components/ClipPathComponentImpl
  5451. /************************************************************************
  5452. ** IBM Confidential
  5453. **
  5454. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5455. **
  5456. ** (C) Copyright IBM Corp. 2017
  5457. **
  5458. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5459. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5460. ************************************************************************/
  5461. // GENERATED
  5462. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5463. /**
  5464. * 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>
  5465. */
  5466. var com_ibm_rave_bundles_components_ClipPathComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5467. //_id : null,
  5468. //_clipRect : null,
  5469. constructor : function(id) {
  5470. this._clipRect = new rave['internal']['RectStruct'](0, 0, 100, 100);
  5471. /**
  5472. * 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.
  5473. * @param (String) id String ID that is unique <em>across the document</em>.
  5474. */
  5475. {
  5476. this._id = id;
  5477. }
  5478. },
  5479. /** @expose */
  5480. type : function() {
  5481. return "ClipPathComponent";
  5482. },
  5483. /**
  5484. * Set the rectangular clipping area. Make the _clipRect one pixel larger than requested to avoid the cut-off at bounds. TODO: why?!?
  5485. * @param (rave['internal']['RectStruct']) rect The rectangular bounds of the clipping area.
  5486. * @return (com.ibm.rave.bundles.components.ClipPathComponentImpl) This ClipPathComponent.
  5487. */
  5488. /** @expose */
  5489. clipRect : function(rect) {
  5490. this._clipRect = new rave['internal']['RectStruct'](rect.x - 1, rect.y - 1, rect.width + 2, rect.height + 2);
  5491. return this;
  5492. },
  5493. /**
  5494. * Set the clip-path attribute on the provided selection.
  5495. * @return (com.ibm.rave.bundles.components.ClipPathComponentImpl) This ClipPathComponent.
  5496. */
  5497. /** @expose */
  5498. applyTo : function(s) {
  5499. s.attr("clip-path", "url(" + this.url() + ")");
  5500. return this;
  5501. },
  5502. /**
  5503. * Retrieve the id assigned to this clip path.
  5504. */
  5505. /** @expose */
  5506. id : function() {
  5507. return this._id;
  5508. },
  5509. /**
  5510. * Retrieve the URL that can be used to reference this clip path.
  5511. */
  5512. /** @expose */
  5513. url : function() {
  5514. return "#" + this._id;
  5515. },
  5516. /** @expose */
  5517. execute : function(g) {
  5518. var clipPath = g.selectAll("#" + this._id).data([0]);
  5519. clipPath.enter().append("clipPath").attr("id", this._id).append("rect");
  5520. 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);
  5521. }
  5522. });
  5523. // $source: com/ibm/rave/bundles/components/LegendComponentImpl
  5524. /************************************************************************
  5525. ** IBM Confidential
  5526. **
  5527. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5528. **
  5529. ** (C) Copyright IBM Corp. 2017
  5530. **
  5531. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5532. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5533. ************************************************************************/
  5534. // GENERATED
  5535. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5536. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  5537. /**
  5538. * <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>
  5539. */
  5540. var com_ibm_rave_bundles_components_LegendComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5541. /**
  5542. * Legend size property
  5543. */
  5544. //_size : null,
  5545. /**
  5546. * Color scale
  5547. */
  5548. //_colorPalette : null,
  5549. /**
  5550. * Orient, "horizontal" or "vertical"
  5551. */
  5552. //_orient : null,
  5553. /**
  5554. * Swatch size function
  5555. */
  5556. //_swatchSizeFunc : null,
  5557. /**
  5558. * Scale
  5559. */
  5560. //_scale : null,
  5561. /**
  5562. * Swatch symbol
  5563. */
  5564. //_shape : null,
  5565. /**
  5566. * Legend title
  5567. */
  5568. //_title : null,
  5569. /**
  5570. * Legend title styling
  5571. */
  5572. //_titleStyle : null,
  5573. /**
  5574. * Legend entry styling
  5575. */
  5576. //_entryStyle : null,
  5577. /**
  5578. * Custom formatter
  5579. */
  5580. //_labelFormat : null,
  5581. /**
  5582. * The swatch legend, created on demand
  5583. */
  5584. //_swatchLegend : null,
  5585. /**
  5586. * The continuous legend, created on demand
  5587. */
  5588. //_continuousLegend : null,
  5589. /**
  5590. * The legend type, either "SwatchLegend" or "ContinuousLegend"
  5591. */
  5592. //_legendType : null,
  5593. /**
  5594. * Is the legend visible
  5595. */
  5596. _visible : false,
  5597. /**
  5598. * Swatch size in square pixels
  5599. */
  5600. _swatchSize : 0,
  5601. /**
  5602. * Constructor; sets bound and, colorScale to null, all other properties to their default values.
  5603. */
  5604. /** @expose */
  5605. constructor : function() {
  5606. this._visible = true;
  5607. this._size = null;
  5608. this._colorPalette = null;
  5609. this._orient = "horizontal";
  5610. this._swatchSize = 16.0 * 16.0;
  5611. this._swatchSizeFunc = null;
  5612. this._scale = null;
  5613. this._shape = "square";
  5614. this._title = null;
  5615. this._titleStyle = {};
  5616. this._entryStyle = {};
  5617. this._labelFormat = null;
  5618. this._swatchLegend = null;
  5619. this._continuousLegend = null;
  5620. this._legendType = null;
  5621. },
  5622. /** @expose */
  5623. type : function() {
  5624. return "LegendComponent";
  5625. },
  5626. /** @expose */
  5627. execute : function(g) {
  5628. if (this._colorPalette) {
  5629. if ("continuous" == this._colorPalette.getType()) {
  5630. if (!this._continuousLegend) {
  5631. this._continuousLegend = (rave.capabilities.extension("legend")).continuous();
  5632. }
  5633. this._legendType = "ContinuousLegend";
  5634. } else {
  5635. if (!this._swatchLegend) {
  5636. this._swatchLegend = (rave.capabilities.extension("legend")).swatch();
  5637. }
  5638. this._legendType = "SwatchLegend";
  5639. }
  5640. } else if (this._swatchSizeFunc) {
  5641. if (!this._swatchLegend) {
  5642. this._swatchLegend = (rave.capabilities.extension("legend")).swatch();
  5643. }
  5644. this._legendType = "SwatchLegend";
  5645. } else {
  5646. this._legendType = null;
  5647. }
  5648. this.preExecute();
  5649. if (!this._visible || (!this._colorPalette && !this._swatchSizeFunc) || !this._size || this._size[0] <= 0 || this._size[1] <= 0) {
  5650. g.selectAll("*").remove();
  5651. return;
  5652. }
  5653. var fontChecker = rave.capabilities.extension("fontchecker");
  5654. if (this._colorPalette && "continuous" == this._colorPalette.getType()) {
  5655. 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);
  5656. var legend = g.call(this._continuousLegend);
  5657. if (this._entryStyle) {
  5658. legend.selectAll(".legendLabel").style(this._entryStyle);
  5659. }
  5660. if (this._titleStyle) {
  5661. legend.selectAll(".legendTitle").style(this._titleStyle);
  5662. }
  5663. if (fontChecker) {
  5664. legend.selectAll(".legendLabel").call(fontChecker);
  5665. legend.selectAll(".legendTitle").call(fontChecker);
  5666. }
  5667. } else {
  5668. var insets = {};
  5669. insets["bottom"] = 5;
  5670. var swatchSize = this._swatchSize;
  5671. var scale = null;
  5672. var labelFormatter = this._labelFormat;
  5673. if (this._swatchSizeFunc && this._scale) {
  5674. swatchSize = this._swatchSizeFunc;
  5675. scale = this._scale;
  5676. }
  5677. if (this._colorPalette) {
  5678. scale = this._colorPalette.getScale();
  5679. var originalDomain = this._colorPalette.originalDomain();
  5680. if (originalDomain) {
  5681. scale.domain(originalDomain);
  5682. var f = this._colorPalette.originalDomainLabelAccessor();
  5683. if (this._labelFormat) {
  5684. var self = this;
  5685. labelFormatter = function(data, index, groupIndex) {
  5686. return self._labelFormat.call(this, f.call(this, data, index, groupIndex), index, groupIndex);
  5687. };
  5688. } else {
  5689. labelFormatter = f;
  5690. }
  5691. }
  5692. }
  5693. 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);
  5694. var legend = g.call(this._swatchLegend);
  5695. if (this._entryStyle) {
  5696. legend.selectAll(".legendLabel").style(this._entryStyle);
  5697. }
  5698. if (this._titleStyle) {
  5699. legend.selectAll(".legendTitle").style(this._titleStyle);
  5700. }
  5701. if (fontChecker) {
  5702. legend.selectAll(".legendLabel").call(fontChecker);
  5703. legend.selectAll(".legendTitle").call(fontChecker);
  5704. }
  5705. }
  5706. },
  5707. /** @expose */
  5708. legend : function() {
  5709. if ("ContinuousLegend" == this._legendType) {
  5710. return this._continuousLegend;
  5711. }
  5712. if ("SwatchLegend" == this._legendType) {
  5713. return this._swatchLegend;
  5714. }
  5715. return null;
  5716. },
  5717. /** @expose */
  5718. legendType : function() {
  5719. return this._legendType;
  5720. },
  5721. /**
  5722. * Set the visible property.
  5723. * @param (boolean) visible New visible
  5724. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5725. */
  5726. /** @expose */
  5727. visible : function(visible) {
  5728. this._visible = visible;
  5729. return this;
  5730. },
  5731. /**
  5732. * see if the legend is visible
  5733. * @return (boolean) if its visible
  5734. */
  5735. /** @expose */
  5736. isVisible : function() {
  5737. return this._visible;
  5738. },
  5739. /**
  5740. * Set the size property.
  5741. * @param (Array) size New size
  5742. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5743. */
  5744. /** @expose */
  5745. size : function(size) {
  5746. this._size = size;
  5747. return this;
  5748. },
  5749. /**
  5750. * Set the color scale property.
  5751. * @param (rave['library']['internal']['Palette']) colorPalette New color scale
  5752. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5753. */
  5754. /** @expose */
  5755. colorPalette : function(colorPalette) {
  5756. this._colorPalette = colorPalette;
  5757. return this;
  5758. },
  5759. /**
  5760. * Set the orient property. If the argument is not "horizontal" or "vertical", it is ignored and the orient property is not changed.
  5761. * @param (String) orient New orient
  5762. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5763. */
  5764. /** @expose */
  5765. orient : function(orient) {
  5766. if ("horizontal" == orient || "vertical" == orient) {
  5767. this._orient = orient;
  5768. }
  5769. return this;
  5770. },
  5771. /**
  5772. * 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".
  5773. * @param (String) position Legend position
  5774. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5775. */
  5776. /** @expose */
  5777. position : function(position) {
  5778. return this.orient(com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf(position));
  5779. },
  5780. swatchSize$0 : function(swatchSize) {
  5781. if (swatchSize >= 0.0 && swatchSize != null) {
  5782. this._swatchSize = swatchSize;
  5783. }
  5784. return this;
  5785. },
  5786. /** @expose */
  5787. scale : function(scale) {
  5788. this._scale = scale;
  5789. return this;
  5790. },
  5791. swatchSize$1 : function(swatchSize) {
  5792. if (swatchSize) {
  5793. this._swatchSizeFunc = swatchSize;
  5794. }
  5795. return this;
  5796. },
  5797. /** @expose */
  5798. shape : function(shape) {
  5799. this._shape = shape;
  5800. return this;
  5801. },
  5802. /** @expose */
  5803. title : function(title) {
  5804. this._title = (title != null && title.length > 0) ? title : null;
  5805. return this;
  5806. },
  5807. /** @expose */
  5808. titleFill : function(titleFill) {
  5809. this._titleStyle["fill"] = titleFill;
  5810. return this;
  5811. },
  5812. /** @expose */
  5813. titleFontSize : function(titleFontSize) {
  5814. this._titleStyle["font-size"] = titleFontSize;
  5815. return this;
  5816. },
  5817. /** @expose */
  5818. titleFontFamily : function(titleFontFamily) {
  5819. this._titleStyle["font-family"] = titleFontFamily;
  5820. return this;
  5821. },
  5822. /** @expose */
  5823. labelFormat : function(labelFormat) {
  5824. this._labelFormat = labelFormat;
  5825. return this;
  5826. },
  5827. /** @expose */
  5828. titleFont : function(titleFontStyle) {
  5829. this._titleStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(titleFontStyle);
  5830. return this;
  5831. },
  5832. /** @expose */
  5833. entryFont : function(entryFontStyle) {
  5834. this._entryStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(entryFontStyle);
  5835. return this;
  5836. },
  5837. /** @expose */
  5838. getSpaceUsed : function() {
  5839. if (this._colorPalette && "continuous" == this._colorPalette.getType()) {
  5840. return this._continuousLegend.getUsedSize() + 2;
  5841. } else {
  5842. return this._swatchLegend.getUsedSize() + 2;
  5843. }
  5844. },
  5845. /** @expose */
  5846. swatchSize : function(a0) {
  5847. var args = arguments;
  5848. if (args.length == 1 && typeof a0 === "function") {
  5849. return this.swatchSize$1(a0);
  5850. }
  5851. return this.swatchSize$0(a0);
  5852. }
  5853. });
  5854. /**
  5855. * Get the orient for a position. "top" and "bottom" return "horizontal", anything else ("left", "right", or unknown/null) is "vertical".
  5856. * @param (String) position A position
  5857. * @return (String) "horizontal" or "vertical"
  5858. */
  5859. /** @expose */
  5860. com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf = function(position) {
  5861. if ("top" == position || "bottom" == position) {
  5862. return "horizontal";
  5863. }
  5864. return "vertical";
  5865. };
  5866. //com_ibm_rave_bundles_components_LegendComponentImpl.HORIZONTAL = "horizontal";
  5867. //com_ibm_rave_bundles_components_LegendComponentImpl.VERTICAL = "vertical";
  5868. com_ibm_rave_bundles_components_LegendComponentImpl.BAR_THINKNESS = 16;
  5869. com_ibm_rave_bundles_components_LegendComponentImpl.SWATCH_SIZE = 16;
  5870. /** @expose */
  5871. com_ibm_rave_bundles_components_LegendComponentImpl.TOP = "top";
  5872. /** @expose */
  5873. com_ibm_rave_bundles_components_LegendComponentImpl.BOTTOM = "bottom";
  5874. /** @expose */
  5875. com_ibm_rave_bundles_components_LegendComponentImpl.LEFT = "left";
  5876. /** @expose */
  5877. com_ibm_rave_bundles_components_LegendComponentImpl.RIGHT = "right";
  5878. /** @expose */
  5879. com_ibm_rave_bundles_components_LegendComponentImpl.ADJUSTABLE = -1;
  5880. // $source: com/ibm/rave/bundles/components/AxisComponentImpl
  5881. /************************************************************************
  5882. ** IBM Confidential
  5883. **
  5884. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5885. **
  5886. ** (C) Copyright IBM Corp. 2018
  5887. **
  5888. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5889. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5890. ************************************************************************/
  5891. // GENERATED
  5892. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5893. //@import com/ibm/rave/bundles/component/AxisComponent (runtime) // AxisComponent
  5894. //@import com/ibm/rave/bundles/utilities/TextCrossfader (runtime) // textCrossFade
  5895. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  5896. //@import com/ibm/rave/bundles/utilities/BundleLabelDropper (runtime) // new
  5897. /**
  5898. * <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>
  5899. */
  5900. var com_ibm_rave_bundles_components_AxisComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5901. /**
  5902. * Axis - created on demand
  5903. */
  5904. //_axis : null,
  5905. /**
  5906. * Role, from the AxisComponent API
  5907. */
  5908. //_role : null,
  5909. /**
  5910. * CoordinateScale
  5911. */
  5912. //_scale : null,
  5913. /**
  5914. * Orient, always one of the four legal values
  5915. */
  5916. //_orient : null,
  5917. /**
  5918. * Size
  5919. */
  5920. //_bounds : null,
  5921. //_elementRect : null,
  5922. /**
  5923. * The title text; default null (nothing visible)
  5924. */
  5925. /** @expose */
  5926. _axisTitle : null,
  5927. /**
  5928. * The title style; defaults null (use the CSS styling)
  5929. */
  5930. /** @expose */
  5931. _titleStyle : null,
  5932. /**
  5933. * Axis line color; default null (use the CSS styling)
  5934. */
  5935. /** @expose */
  5936. _lineColor : null,
  5937. /**
  5938. * Axis tick color; default null (use the CSS styling)
  5939. */
  5940. /** @expose */
  5941. _tickColor : null,
  5942. /**
  5943. * Axis tick label style; defaults null (use the CSS styling)
  5944. */
  5945. /** @expose */
  5946. _labelStyle : null,
  5947. //_staggerRotate45Nodes : null,
  5948. //_staggerFirstNode : null,
  5949. //_staggerLastNode : null,
  5950. /**
  5951. * Axis tick label formatting
  5952. */
  5953. //_tickFormat : null,
  5954. //_dropOverlap : null,
  5955. /**
  5956. * Used to get the extension to enable axis label wrapping
  5957. */
  5958. //_textFlow : null,
  5959. /**
  5960. * Used to check the fonts on each label to make sure all characters are covered
  5961. */
  5962. //_fontChecker : null,
  5963. /**
  5964. * Run function that applies the properties to the axis line
  5965. */
  5966. //_axisLineProperties : null,
  5967. /**
  5968. * Run function that applies the properties to the axis ticks
  5969. */
  5970. //_axisTickProperties : null,
  5971. /**
  5972. * Run function that applies the properties to the axis tick labels
  5973. */
  5974. //_axisTickLabelProperties : null,
  5975. /**
  5976. * Run function that hides or displays the axis tick labels
  5977. */
  5978. //_displayHideLabels : null,
  5979. /**
  5980. * Run function that hides or displays the axis tick labels
  5981. */
  5982. //_panZoomLabels : null,
  5983. /**
  5984. * The tick handler registered with the axis; will get called during axis transition
  5985. */
  5986. //_tickHandler : null,
  5987. //_textTruncationIndicator : null,
  5988. /**
  5989. * Used when dealing with numeric scale on the vertical axis and the numbers don't fit
  5990. */
  5991. //_simplifiedTickFormat : null,
  5992. //_tickMagnitude : null,
  5993. /**
  5994. * Whether to display the axis title; default true
  5995. */
  5996. /** @expose */
  5997. _displayAxisTitle : false,
  5998. /**
  5999. * Whether to display the axis line; default true
  6000. */
  6001. /** @expose */
  6002. _displayAxisLine : false,
  6003. /**
  6004. * Whether to display the axis ticks; default true
  6005. */
  6006. /** @expose */
  6007. _displayTicks : false,
  6008. /**
  6009. * Whether to display the axis tick labels (conditional on show labels property); default true
  6010. */
  6011. /** @expose */
  6012. _displayTickLabels : false,
  6013. /**
  6014. * Whether to display the axis tick labels (conditional on pan-zoom hide property); default true
  6015. */
  6016. /** @expose */
  6017. _showPanZoomTickLabels : false,
  6018. /**
  6019. * Whether to rotate the axis tick labels; default false
  6020. */
  6021. _rotateLabels : false,
  6022. _staggerCellWidth : 0,
  6023. _staggerAlignFirstAtStart : false,
  6024. _staggerAlignLastAtEnd : false,
  6025. _layoutTimerId : 0,
  6026. _layoutTitleSize : 0,
  6027. _layoutLabelSize : 0,
  6028. _layoutLabelHeight : 0,
  6029. _layoutAverageDigitWidth : 0,
  6030. _layoutSpillOver : 0,
  6031. /**
  6032. * Whether to hide overlapping labels; default true
  6033. */
  6034. /** @expose */
  6035. _hideOverlappingLabels : false,
  6036. /**
  6037. * When true, don't start a new timer
  6038. */
  6039. _pendingLabelTimer : false,
  6040. /**
  6041. * The padding in px between tick axis line and tick label, and also between tick label and title. Default 16px.
  6042. */
  6043. _padding : 0,
  6044. /**
  6045. * After calling the component, this is true if shapes were rendered, false if they were cleared.
  6046. */
  6047. _renderedShapes : false,
  6048. _layoutMode : -1,
  6049. _allowAutoAxisLayoutToChangeOrientaiton : true,
  6050. _lastAutomaticAxisLayoutOrientation : -1,
  6051. _allowStagger : false,
  6052. _allowRotate45 : false,
  6053. _allowRotate90 : false,
  6054. constructor : function() {
  6055. {
  6056. var self = this;
  6057. this._axisLineProperties = function(args) {
  6058. if (args !== null || arguments.length > 1){
  6059. args = Array.prototype.slice.call(arguments, 0);
  6060. }
  6061. {
  6062. var line = this.selectAll("path.domain");
  6063. if (self._lineColor != null) {
  6064. line.style("stroke", self._lineColor);
  6065. }
  6066. if (self._displayAxisLine) {
  6067. line.attr("visibility", null);
  6068. } else {
  6069. line.attr("visibility", "hidden");
  6070. }
  6071. return null;
  6072. }
  6073. };
  6074. this._axisTickProperties = function(args) {
  6075. if (args !== null || arguments.length > 1){
  6076. args = Array.prototype.slice.call(arguments, 0);
  6077. }
  6078. {
  6079. var tickLines = this.selectAll("line");
  6080. if (self._displayTicks) {
  6081. tickLines.attr("visibility", null);
  6082. } else {
  6083. tickLines.attr("visibility", "hidden");
  6084. }
  6085. if (self._lineColor != null) {
  6086. tickLines.style("stroke", self._tickColor);
  6087. }
  6088. return null;
  6089. }
  6090. };
  6091. this._axisTickLabelProperties = function(args) {
  6092. if (args !== null || arguments.length > 1){
  6093. args = Array.prototype.slice.call(arguments, 0);
  6094. }
  6095. {
  6096. var labels = this.selectAll("text");
  6097. labels.each(self._displayHideLabels);
  6098. labels.each(self._panZoomLabels);
  6099. labels.style(self._labelStyle);
  6100. self._axis.ticksHandler(null);
  6101. return null;
  6102. }
  6103. };
  6104. this._displayHideLabels = function(obj, group, index) {
  6105. if (self._displayTickLabels) {
  6106. if (this.rave_hasProperty("__tickLabelHidden__")) {
  6107. this.rave_removeProperty("__tickLabelHidden__");
  6108. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  6109. if (count <= 1) {
  6110. this.rave_removeProperty("__hiddenCount__");
  6111. this.removeAttribute("visibility");
  6112. } else {
  6113. this.rave_setProperty("__hiddenCount__", count - 1);
  6114. }
  6115. }
  6116. } else {
  6117. if (!(this.rave_hasProperty("__tickLabelHidden__"))) {
  6118. this.setAttribute("visibility", "hidden");
  6119. this.rave_setProperty("__tickLabelHidden__", "hidden");
  6120. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  6121. this.rave_setProperty("__hiddenCount__", count + 1);
  6122. }
  6123. }
  6124. };
  6125. this._panZoomLabels = function(obj, group, index) {
  6126. if (self._showPanZoomTickLabels) {
  6127. if (this.rave_hasProperty("__panZoomHidden__")) {
  6128. this.rave_removeProperty("__panZoomHidden__");
  6129. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  6130. if (count <= 1) {
  6131. this.rave_removeProperty("__hiddenCount__");
  6132. this.removeAttribute("visibility");
  6133. } else {
  6134. this.rave_setProperty("__hiddenCount__", count - 1);
  6135. }
  6136. }
  6137. } else {
  6138. if (!(this.rave_hasProperty("__panZoomHidden__"))) {
  6139. this.setAttribute("visibility", "hidden");
  6140. this.rave_setProperty("__panZoomHidden__", "hidden");
  6141. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  6142. this.rave_setProperty("__hiddenCount__", count + 1);
  6143. }
  6144. }
  6145. };
  6146. }
  6147. this._tickHandler = new com_ibm_rave_bundles_components_AxisComponentImpl.AxisTickHandler(this._axisTickLabelProperties, this._axisTickProperties);
  6148. /**
  6149. * Initialize properties to defaults
  6150. */
  6151. {
  6152. this._axis = null;
  6153. this._role = null;
  6154. this._scale = null;
  6155. this._orient = "bottom";
  6156. this._bounds = null;
  6157. this._displayAxisTitle = true;
  6158. this._axisTitle = null;
  6159. this._titleStyle = {};
  6160. this._displayAxisLine = true;
  6161. this._lineColor = null;
  6162. this._displayTicks = true;
  6163. this._tickColor = null;
  6164. this._displayTickLabels = true;
  6165. this._labelStyle = {};
  6166. this._rotateLabels = false;
  6167. this._hideOverlappingLabels = true;
  6168. this._dropOverlap = new com_ibm_rave_bundles_utilities_BundleLabelDropper();
  6169. this._tickFormat = null;
  6170. this._showPanZoomTickLabels = true;
  6171. this._pendingLabelTimer = false;
  6172. this._padding = 16;
  6173. this._textFlow = rave.capabilities.extension("textflow");
  6174. this._fontChecker = rave.capabilities.extension("fontchecker");
  6175. this._renderedShapes = false;
  6176. }
  6177. },
  6178. /** @expose */
  6179. type : function() {
  6180. return com_ibm_rave_bundles_component_AxisComponent.COMPONENT_TYPE;
  6181. },
  6182. /** @expose */
  6183. role : function() {
  6184. return this._role;
  6185. },
  6186. /** @expose */
  6187. execute : function(g) {
  6188. this.preExecute();
  6189. if (!this._scale) {
  6190. g.selectAll("*").remove();
  6191. this._renderedShapes = false;
  6192. return;
  6193. }
  6194. this._renderedShapes = true;
  6195. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  6196. this._hideOverlappingLabels = false;
  6197. this._rotateLabels = true;
  6198. } else {
  6199. this._hideOverlappingLabels = true;
  6200. this._rotateLabels = true;
  6201. }
  6202. this.drawTitle(g);
  6203. this.drawAxis(g);
  6204. this.handleAxisText(g);
  6205. this.drawTitle(g);
  6206. },
  6207. /**
  6208. * This is one place where all the calls that affect the axis text happen in case of allowAutomaticAxisLayout the new behavior applies here
  6209. * @param (rave['internal']['Selector']) g
  6210. */
  6211. handleAxisText : function(g) {
  6212. this.stopLabelDroppingUpdate();
  6213. var duration = 0, delay = 0;
  6214. var g2 = rave.transition(g);
  6215. if (g2.isTransition()) {
  6216. var t2 = (g2);
  6217. duration = t2.duration();
  6218. delay = t2.delay();
  6219. }
  6220. var axisSelector = g.selectAll("g.axis");
  6221. var labels = axisSelector.selectAll("g.tick").filter(rave['library']['internal']['BundleUtils'].notExit).selectAll("text");
  6222. var fontChecker = rave.capabilities.extension("fontchecker");
  6223. labels.style(this._labelStyle);
  6224. if (fontChecker) {
  6225. labels.call(fontChecker);
  6226. }
  6227. var mode = this._allowAutoAxisLayoutToChangeOrientaiton ? this.determineWhichAutoMode(g) : this._lastAutomaticAxisLayoutOrientation;
  6228. this.configureStaggerData(g, mode);
  6229. this.handleLabelsRotationAndPosition(g, labels, mode);
  6230. this.hashingNumericScales(labels, this.labelExtent(g), mode);
  6231. if (duration == 0) {
  6232. this.doLabelWrapping(g, mode);
  6233. this.handleLabelsRotationAndPosition(g, labels, mode);
  6234. }
  6235. this._lastAutomaticAxisLayoutOrientation = mode;
  6236. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  6237. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6238. var tick = axisSelector.append("g").classed("tick", true);
  6239. var tickText = tick.append("text");
  6240. if (labels.size() == 0) {
  6241. var singleValue = this._scale.scale().domain()[0];
  6242. var formatter = this._tickFormat;
  6243. if (!formatter) {
  6244. var tickFunc = this._scale.scale().tickFormat;
  6245. if (tickFunc) {
  6246. formatter = tickFunc.apply(tickFunc, [singleValue]);
  6247. }
  6248. }
  6249. var node = tickText[0][0];
  6250. var stringValue = formatter ? formatter.call(node, singleValue, 0, 0) : ""+(singleValue);
  6251. tickText.text(stringValue);
  6252. var dim = node.getBBox();
  6253. this._layoutLabelSize = isHorizontal ? dim.height : dim.width;
  6254. if (!isHorizontal || mode != 0) {
  6255. tickText.text(".0");
  6256. this._layoutLabelSize += node.getBBox().width;
  6257. }
  6258. }
  6259. if (!isHorizontal || mode != 0) {
  6260. tickText.text(".0");
  6261. var node = tickText[0][0];
  6262. var dim = node.getBBox();
  6263. this._layoutAverageDigitWidth = dim.width;
  6264. }
  6265. tick.remove();
  6266. }
  6267. if (this._hideOverlappingLabels && duration > 0) {
  6268. this.updateLabelDropping(labels, duration, delay);
  6269. }
  6270. if (duration > 0) {
  6271. this.doLabelWrappingAfterAnimation(g, labels, mode, duration, delay);
  6272. }
  6273. if (!this._displayTickLabels) {
  6274. this._layoutLabelSize = 0;
  6275. this._layoutAverageDigitWidth = 0;
  6276. }
  6277. },
  6278. /**
  6279. * 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
  6280. * @param (rave['internal']['Selector']) g selector
  6281. * @param (rave['internal']['Selector']) labels labels selector
  6282. * @param (int) mode one of HORIZONTAL, STAGGER, ROTATE90
  6283. */
  6284. handleLabelsRotationAndPosition : function(g, labels, mode) {
  6285. if (mode == 2 || mode == 1) {
  6286. if (this._orient == "bottom") {
  6287. this.rotateLabels(g, labels, "end", mode);
  6288. } else if (this._orient == "top") {
  6289. this.rotateLabels(g, labels, "start", mode);
  6290. } else {
  6291. this.rotateLabels(g, labels, "middle", mode);
  6292. }
  6293. } else {
  6294. if (this._orient == "bottom" || this._orient == "top") {
  6295. this.rotateLabels(g, labels, "middle", mode);
  6296. } else if (this._orient == "right") {
  6297. this.rotateLabels(g, labels, "start", mode);
  6298. } else {
  6299. this.rotateLabels(g, labels, "end", mode);
  6300. }
  6301. }
  6302. },
  6303. /**
  6304. * <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>
  6305. * @param (rave['internal']['Selector']) labels
  6306. */
  6307. hashingNumericScales : function(labels, extent, mode) {
  6308. if (!labels || !extent) {
  6309. return;
  6310. }
  6311. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  6312. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6313. var tickSpace = mode == 1 ? extent[1] : extent[0];
  6314. this._textTruncationIndicator = "";
  6315. this._layoutLabelSize = 0;
  6316. for (var i = 0; i < labels.size(); ++i) {
  6317. var node = labels[i][0];
  6318. var dim = node.getBBox();
  6319. var width = dim.width;
  6320. var height = dim.height;
  6321. var size = !isHorizontal || mode == 1 ? width : height;
  6322. if (size > this._layoutLabelSize) {
  6323. this._layoutLabelSize = size;
  6324. }
  6325. if (width >= tickSpace) {
  6326. if (this._simplifiedTickFormat) {
  6327. var newText = this._simplifiedTickFormat.call(null, node.rave_getData(), 0, 0);
  6328. if (newText != null) {
  6329. node.rave_setText(newText);
  6330. }
  6331. if (node.getBBox().width >= tickSpace) {
  6332. node.rave_setText(this.stringOfSize(node.rave_getText().length, "#"));
  6333. }
  6334. } else {
  6335. node.rave_setText(this.stringOfSize(node.rave_getText().length, "#"));
  6336. }
  6337. }
  6338. }
  6339. }
  6340. },
  6341. /**
  6342. * @param (int) size The desired size of the string
  6343. * @param (String) ch The character to be repeated in the string
  6344. * @return (String) A string of the specified size containing repetition of the specified character
  6345. */
  6346. stringOfSize : function(size, ch) {
  6347. var returnString = "";
  6348. for (var i = 0; i < size; ++i) {
  6349. returnString += ch;
  6350. }
  6351. return returnString;
  6352. },
  6353. configureStaggerData : function(g, mode) {
  6354. if (mode == 3 || mode == 2) {
  6355. var horizontalDimensions = this.labelExtent(g);
  6356. var cellWidth = horizontalDimensions[0];
  6357. var axisSelector = g.selectAll("g.axis");
  6358. var labels = axisSelector.selectAll("text");
  6359. var domain = this._scale.scale().domain();
  6360. var originalDataLabelAccessor = (this._scale).originalDomainLabelAccessor();
  6361. this._staggerRotate45Nodes = [];
  6362. this._staggerFirstNode = null;
  6363. this._staggerLastNode = null;
  6364. for (var i = 0; i < labels.size(); ++i) {
  6365. var node = labels[0][i];
  6366. if (this.isValid(node.rave_getData())) {
  6367. var domainIndex = -1;
  6368. if (mode == 3) {
  6369. var domainLabel = !this._tickFormat ? node.rave_getText() : originalDataLabelAccessor.call(node, node.rave_getData(), 0, 0);
  6370. for (var index = 0; index < domain.length; ++index) {
  6371. if (domain[index].toString() == domainLabel) {
  6372. domainIndex = index;
  6373. break;
  6374. }
  6375. }
  6376. }
  6377. this._staggerRotate45Nodes.push(new com_ibm_rave_bundles_components_AxisComponentImpl.NodeIndex(node, domainIndex));
  6378. if (domainIndex == 0) {
  6379. this._staggerFirstNode = node;
  6380. }
  6381. if (domainIndex == domain.length - 1) {
  6382. this._staggerLastNode = node;
  6383. }
  6384. }
  6385. }
  6386. this._staggerCellWidth = cellWidth * 2;
  6387. this._staggerAlignFirstAtStart = this._staggerFirstNode ? this._staggerFirstNode.getBBox().width > cellWidth : false;
  6388. this._staggerAlignLastAtEnd = this._staggerLastNode ? this._staggerLastNode.getBBox().width > cellWidth : false;
  6389. }
  6390. },
  6391. getStaggerIndex : function(node) {
  6392. for (var index = 0; index < this._staggerRotate45Nodes.length; ++index) {
  6393. if (this._staggerRotate45Nodes[index].contains(node)) {
  6394. var domainIndex = this._staggerRotate45Nodes[index].getIndex();
  6395. return domainIndex == -1 ? 0 : domainIndex;
  6396. }
  6397. }
  6398. return -1;
  6399. },
  6400. getStaggerCount : function() {
  6401. var domain = this._scale.scale().domain();
  6402. return domain.length;
  6403. },
  6404. /**
  6405. * <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>
  6406. * @param (rave['internal']['Selector']) g
  6407. */
  6408. determineWhichAutoMode : function(g) {
  6409. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6410. var axisSelector = g.selectAll("g.axis");
  6411. var labels = axisSelector.selectAll("text");
  6412. var dim = this.labelExtent(g);
  6413. var cellWidth = dim[0];
  6414. var cellWidth90 = dim[1];
  6415. var layoutLabelHeight = 0;
  6416. var layoutLabelWidth = 0;
  6417. var horizontalScore = 0;
  6418. var staggerScore = 0;
  6419. var rotate45Score = 0;
  6420. var rotate90Score = 0;
  6421. var validNodes = [];
  6422. for (var i = 0; i < labels.size(); ++i) {
  6423. var node = labels[0][i];
  6424. if (this.isValid(node.rave_getData())) {
  6425. validNodes.push(node);
  6426. }
  6427. }
  6428. var labelCount = validNodes.length;
  6429. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  6430. var mode = 0;
  6431. if (isHorizontal) {
  6432. mode = this._layoutMode == 1 ? 1 : 0;
  6433. var tick = axisSelector.append("g").classed("tick", true);
  6434. var tickText = tick.append("text");
  6435. tickText.style(this._labelStyle);
  6436. tickText.text(",0");
  6437. var node = tickText[0][0];
  6438. var zeroWidth = node.getBBox().width;
  6439. tick.remove();
  6440. var widestLabel = 0;
  6441. for (var i = 0; i < labelCount; ++i) {
  6442. node = validNodes[i];
  6443. var nodeRect = node.getBBox();
  6444. if (nodeRect.width > widestLabel) {
  6445. widestLabel = nodeRect.width;
  6446. }
  6447. if (nodeRect.height > this._layoutLabelHeight) {
  6448. this._layoutLabelHeight = nodeRect.height;
  6449. }
  6450. }
  6451. widestLabel += zeroWidth;
  6452. this._layoutSpillOver = mode == 1 ? this._layoutLabelHeight / 2 : widestLabel / 2 + 2;
  6453. } else {
  6454. for (var i = 0; i < labelCount; ++i) {
  6455. var node = validNodes[i];
  6456. var nodeRect = node.getBBox();
  6457. if (nodeRect.height > this._layoutLabelHeight) {
  6458. this._layoutLabelHeight = nodeRect.height;
  6459. }
  6460. }
  6461. this._layoutSpillOver = this._layoutLabelHeight / 2;
  6462. }
  6463. return mode;
  6464. }
  6465. var originalDataLabelAccessor = (this._scale).originalDomainLabelAccessor();
  6466. var staggerStringsWontMatch = this._tickFormat && !originalDataLabelAccessor;
  6467. var calcStagger = ((this._allowStagger && this._layoutMode == -1) || this._layoutMode == 3) && !staggerStringsWontMatch;
  6468. var calcRotate45 = (this._allowRotate45 && this._layoutMode == -1) || this._layoutMode == 2;
  6469. var calcRotate90 = (this._allowRotate90 && this._layoutMode == -1) || this._layoutMode == 1;
  6470. var spaceFor45Label = 0;
  6471. for (var i = 0; i < labelCount; ++i) {
  6472. var node = validNodes[i];
  6473. var nodeRect = node.getBBox();
  6474. layoutLabelHeight = nodeRect.height;
  6475. var labelWidth = nodeRect.width;
  6476. if (labelWidth > layoutLabelWidth) {
  6477. layoutLabelWidth = labelWidth;
  6478. }
  6479. horizontalScore += (labelWidth <= cellWidth ? 1 : cellWidth / labelWidth);
  6480. if (isHorizontal) {
  6481. if (calcStagger) {
  6482. var spaceForLabel = cellWidth * 2;
  6483. if (i == 0 && i == labelCount - 1) {
  6484. spaceForLabel *= 0.5;
  6485. } else if (i == 0 || i == labelCount - 1) {
  6486. spaceForLabel *= 0.75;
  6487. }
  6488. staggerScore += (labelWidth <= spaceForLabel ? 1 : spaceForLabel / labelWidth);
  6489. }
  6490. if (calcRotate45) {
  6491. if (spaceFor45Label == 0) {
  6492. spaceFor45Label = cellWidth90 / 0.7071 - layoutLabelHeight;
  6493. }
  6494. var space = this.calculate45DegreeSpace(node, spaceFor45Label);
  6495. rotate45Score += (labelWidth <= space ? 1 : space / labelWidth);
  6496. }
  6497. if (calcRotate90) {
  6498. rotate90Score += (labelWidth <= cellWidth90 ? 1 : cellWidth90 / labelWidth);
  6499. }
  6500. }
  6501. }
  6502. var mode = 0;
  6503. if (this._layoutMode == -1) {
  6504. if (isHorizontal && this._allowStagger) {
  6505. horizontalScore *= 1.1;
  6506. staggerScore *= 1.1;
  6507. }
  6508. if ((staggerScore > horizontalScore) && (staggerScore >= rotate45Score) && (staggerScore >= rotate90Score)) {
  6509. mode = 3;
  6510. } else if ((rotate45Score > horizontalScore) && (rotate45Score >= rotate90Score)) {
  6511. mode = 2;
  6512. } else if (rotate90Score > horizontalScore) {
  6513. mode = 1;
  6514. }
  6515. } else {
  6516. if ((this._layoutMode == 3 && staggerStringsWontMatch) || !isHorizontal) {
  6517. mode = 0;
  6518. } else {
  6519. mode = this._layoutMode;
  6520. }
  6521. }
  6522. if (isHorizontal) {
  6523. switch (mode) {
  6524. case 3:
  6525. this._layoutLabelSize = layoutLabelHeight * 2;
  6526. break;
  6527. case 2:
  6528. this._layoutLabelSize = (layoutLabelWidth + layoutLabelHeight) * 0.7071;
  6529. break;
  6530. case 1:
  6531. this._layoutLabelSize = layoutLabelWidth;
  6532. break;
  6533. case 0:
  6534. default:
  6535. this._layoutLabelSize = layoutLabelHeight;
  6536. break;
  6537. }
  6538. } else {
  6539. this._layoutLabelSize = layoutLabelWidth;
  6540. }
  6541. this._layoutLabelHeight = layoutLabelHeight;
  6542. return mode;
  6543. },
  6544. calculate45DegreeSpace : function(node, maxWidth) {
  6545. var width = maxWidth;
  6546. var tfm = node.rave_getParentNode().getAttribute("transform");
  6547. if (tfm != null) {
  6548. var tfmString = tfm.toString();
  6549. var indexOfTrans = tfmString.indexOf("translate(");
  6550. if (indexOfTrans != -1) {
  6551. indexOfTrans += 10;
  6552. var indexOfComma = tfmString.indexOf(",", indexOfTrans);
  6553. if (indexOfComma != -1) {
  6554. var xAmount = tfmString.substring(indexOfTrans, indexOfComma);
  6555. var xLabelPos = + (xAmount);
  6556. var width45Degrees = node.getBBox().width;
  6557. var xLabelWidth = width45Degrees * 0.7071;
  6558. var isBottom = this._orient == "bottom";
  6559. if (isBottom) {
  6560. xLabelPos -= node.getBBox().height / 4;
  6561. if (xLabelPos - xLabelWidth < this._bounds.x) {
  6562. xLabelWidth = xLabelPos - this._bounds.x;
  6563. width = xLabelWidth / 0.7071;
  6564. }
  6565. } else {
  6566. if (xLabelPos + xLabelWidth > this._bounds.x + this._bounds.width) {
  6567. xLabelWidth = (this._bounds.x + this._bounds.width) - xLabelPos;
  6568. width = xLabelWidth / 0.7071;
  6569. }
  6570. }
  6571. if (width > maxWidth) {
  6572. width = maxWidth;
  6573. }
  6574. }
  6575. }
  6576. }
  6577. return width;
  6578. },
  6579. /**
  6580. * @param (rave['internal']['Selector']) labels selector with all labels to be rotated
  6581. * @param (rave['internal']['Selector']) g The parent selector of labels
  6582. * @param (String) textAnchor The position of the anchor
  6583. * @param alignmentMode One of HORIZONTAL, STAGGER, ROTATE45, ROTATE90
  6584. */
  6585. rotateLabels : function(g, labels, textAnchor, mode) {
  6586. if (this._rotateLabels) {
  6587. var self = this;
  6588. var positioning = function(data, index, groupIndex) {
  6589. var x = 0;
  6590. var y = 0;
  6591. var rotation_cy = 0;
  6592. var isBottom = self._orient == "bottom";
  6593. if (mode == 3) {
  6594. var cellIndex = self.getStaggerIndex(this);
  6595. if (cellIndex != -1) {
  6596. if (cellIndex % 2 == 1) {
  6597. var staggerDirection = isBottom ? 1 : -1;
  6598. y += (self._layoutLabelHeight * staggerDirection);
  6599. }
  6600. if (cellIndex == 0 && self._staggerAlignFirstAtStart) {
  6601. x -= self._staggerCellWidth / 4;
  6602. } else if (cellIndex == self.getStaggerCount() - 1 && self._staggerAlignLastAtEnd) {
  6603. x += self._staggerCellWidth / 4;
  6604. }
  6605. }
  6606. } else if (mode == 2) {
  6607. if (isBottom) {
  6608. x -= self._layoutLabelHeight;
  6609. } else {
  6610. x += self._layoutLabelHeight / 2;
  6611. }
  6612. } else if (mode == 1) {
  6613. if (isBottom) {
  6614. x -= (this.getBBox().height / 2 + self._layoutLabelHeight / 4);
  6615. rotation_cy = ~~(self._padding / 4 + self._axis.tickSize());
  6616. } else {
  6617. x -= (this.getBBox().height / 2 - self._layoutLabelHeight);
  6618. rotation_cy = ~~-(self._padding / 4 + self._axis.tickSize());
  6619. }
  6620. }
  6621. var rotationDegrees = mode == 1 ? -90 : mode == 2 ? -45 : 0;
  6622. return "translate(" + x + "," + y + ") rotate(" + rotationDegrees + ",0," + rotation_cy + ")";
  6623. };
  6624. labels.attr("transform", positioning).style("text-anchor", textAnchor);
  6625. if (mode == 3) {
  6626. if (this._staggerAlignFirstAtStart) {
  6627. this._staggerFirstNode.rave_setStyle("text-anchor", "start");
  6628. }
  6629. if (this._staggerAlignLastAtEnd) {
  6630. this._staggerLastNode.rave_setStyle("text-anchor", "end");
  6631. }
  6632. }
  6633. }
  6634. },
  6635. /** @expose */
  6636. axis : function() {
  6637. return this._axis;
  6638. },
  6639. /**
  6640. * Draw the axis. The scale is non-null.
  6641. * @param (rave['internal']['Selector']) g Selector group into which the axis is drawn.
  6642. */
  6643. drawAxis : function(g) {
  6644. var axisSelector = g.selectAll("g.axis").data([0]);
  6645. axisSelector.enter().append("g").classed("axis", true).classed(this._orient, true);
  6646. if (!this._axis) {
  6647. this._axis = new rave['internal']['Axis']();
  6648. }
  6649. if (this._hideOverlappingLabels) {
  6650. this._textFlow.valignment("top").dropTextOnFail(false);
  6651. }
  6652. this._axis.ticksHandler(this._tickHandler);
  6653. this._axis.orient(this._orient);
  6654. this._axis.tickFormat(this._tickFormat);
  6655. this._axis.tickPadding(10.0);
  6656. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  6657. var labelHeight = 20.0;
  6658. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6659. if (isHorizontal) {
  6660. labelHeight /= 0.7071;
  6661. }
  6662. var range = this._scale.scale().rangeExtent();
  6663. var extent = + (range[1]) - + (range[0]);
  6664. this._axis.ticks(extent / labelHeight);
  6665. } else {
  6666. if (this._tickMagnitude == null) {
  6667. this._axis.ticks(10.0);
  6668. } else {
  6669. this._axis.ticks.apply(this._axis, [10.0, this._scale.scale().getTickFormat(), this._tickMagnitude]);
  6670. }
  6671. }
  6672. var s = this._scale.scale();
  6673. if (this._scale.originalDomain()) {
  6674. var sOrdinal = s.copy();
  6675. sOrdinal.domain(this._scale.originalDomain());
  6676. s = sOrdinal;
  6677. var self = this;
  6678. var originalDataLabelAccessor = (self._scale).originalDomainLabelAccessor();
  6679. var tickFormatter;
  6680. if (originalDataLabelAccessor) {
  6681. if (this._tickFormat) {
  6682. tickFormatter = function(data, index, groupIndex) {
  6683. return self._tickFormat.call(this, originalDataLabelAccessor.call(this, data, index, groupIndex), index, groupIndex);
  6684. };
  6685. } else {
  6686. tickFormatter = originalDataLabelAccessor;
  6687. }
  6688. } else {
  6689. tickFormatter = this._tickFormat;
  6690. }
  6691. this._axis.tickFormat(tickFormatter);
  6692. }
  6693. this._axis.scale(s);
  6694. axisSelector.call(this._axis);
  6695. var g2 = rave.transition(axisSelector);
  6696. if (!(g2.isTransition())) {
  6697. axisSelector.selectAll("text").call(this._dropOverlap, this._hideOverlappingLabels);
  6698. }
  6699. axisSelector.selectAll("path.domain").classed("axis-line", true);
  6700. axisSelector.selectAll("g.tick line").classed("axis-tick", true);
  6701. if (this._fontChecker) {
  6702. axisSelector.selectAll("g.tick text").classed("axis-label", true).call(this._fontChecker);
  6703. } else {
  6704. axisSelector.selectAll("g.tick text").classed("axis-label", true);
  6705. }
  6706. axisSelector.call(this._axisLineProperties);
  6707. },
  6708. /**
  6709. * Draw the axis title.
  6710. * @param (rave['internal']['Selector']) g Selector group into which the title is drawn.
  6711. */
  6712. drawTitle : function(g) {
  6713. if (!this._displayAxisTitle || this._axisTitle == null || this._axisTitle.trim().length == 0 || !this._bounds) {
  6714. g.selectAll("text.axis-title." + this._orient).remove();
  6715. return;
  6716. }
  6717. var x = 0;
  6718. var y = 0;
  6719. var dy = "";
  6720. var transform;
  6721. if ("top" == this._orient) {
  6722. x = this._elementRect.x + this._elementRect.width / 2;
  6723. y = -this._bounds.height + this._padding / 4;
  6724. dy = "0.75em";
  6725. } else if ("bottom" == this._orient) {
  6726. x = this._elementRect.x + this._elementRect.width / 2;
  6727. y = this._bounds.height - this._padding / 4;
  6728. dy = "-0.25em";
  6729. } else if ("left" == this._orient) {
  6730. x = -this._elementRect.y - this._elementRect.height / 2;
  6731. y = -this._bounds.width + this._padding / 4;
  6732. dy = "0.75em";
  6733. transform = "rotate(-90)";
  6734. } else {
  6735. x = this._elementRect.y + this._elementRect.height / 2;
  6736. y = -this._bounds.width + this._padding / 4;
  6737. dy = "0.75em";
  6738. transform = "rotate(90)";
  6739. }
  6740. var fillOpacity;
  6741. {
  6742. var tmp = g.append("text").attr("class", "axis-title " + this._orient);
  6743. fillOpacity = tmp.style("fill-opacity");
  6744. tmp.remove();
  6745. } var label = g.selectAll("text.axis-title." + this._orient);
  6746. if (label.size() == 0) {
  6747. 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);
  6748. if (this._fontChecker) {
  6749. g.selectAll("text.axis-title." + this._orient).call(this._fontChecker);
  6750. }
  6751. }
  6752. 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);
  6753. },
  6754. getUnZoomedScale : function(scale) {
  6755. var s = scale.copy();
  6756. if (s.getZoomTransform()) {
  6757. s.getZoomTransform()(1, 0);
  6758. }
  6759. return s;
  6760. },
  6761. isValid : function(data) {
  6762. var s = this.getUnZoomedScale(this._axis.scale());
  6763. var v = + (s.call(null, data, 0, 0));
  6764. var range = this._axis.scale().range();
  6765. if (this._axis.scale().range().indexOf(v)> -1) {
  6766. return true;
  6767. }
  6768. if (range[0] < v && v < range[1]) {
  6769. return true;
  6770. }
  6771. if (range[0] > v && v > range[1]) {
  6772. return true;
  6773. }
  6774. return false;
  6775. },
  6776. /**
  6777. * Apply label wrapping if requested.
  6778. * @param (rave['internal']['Selector']) g
  6779. * @param (int) mode One of HORIZONTAL, STAGGER, ROTATE45, ROTATE90
  6780. */
  6781. doLabelWrapping : function(g, mode) {
  6782. if (this._displayTickLabels) {
  6783. this._textFlow.valignment("top");
  6784. if (!this._hideOverlappingLabels) {
  6785. this._textFlow.dropTextOnFail(true);
  6786. }
  6787. var d = this.labelExtent(g);
  6788. if (!d || d[0] < 0 || d[1] < 0) {
  6789. return;
  6790. }
  6791. var w = ~~ (d[0]);
  6792. var h = ~~ (d[1]);
  6793. if (mode == 2) {
  6794. w = ~~(d[1] / 0.7071 - this._layoutLabelHeight);
  6795. h = ~~(this._layoutLabelHeight / 0.7071);
  6796. } else if (mode == 1) {
  6797. var tmp = w;
  6798. w = h;
  6799. h = tmp;
  6800. }
  6801. var allowWrap = mode == 1;
  6802. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  6803. var hActual = ~~ (this._layoutLabelHeight * 1.2);
  6804. if (hActual > h) {
  6805. h = hActual;
  6806. }
  6807. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6808. if (mode == 0 && !isHorizontal) {
  6809. allowWrap = true;
  6810. }
  6811. }
  6812. var self = this;
  6813. var cellWidth = w;
  6814. var cellHeight = h;
  6815. this._textFlow.wrap(allowWrap).truncate(true).textTruncateIndicator(this._textTruncationIndicator != null ? this._textTruncationIndicator : "...").spacing(1.2).extent(function(data, index, groupIndex) {
  6816. var width = cellWidth;
  6817. var height = cellHeight;
  6818. if (mode == 2) {
  6819. var cellIndex = self.getStaggerIndex(this);
  6820. if (cellIndex != -1) {
  6821. width = ~~self.calculate45DegreeSpace(this, cellWidth);
  6822. }
  6823. } else if (mode == 3) {
  6824. var cellIndex = self.getStaggerIndex(this);
  6825. if (cellIndex != -1) {
  6826. if (cellIndex == 0 && cellIndex == self.getStaggerCount() - 1) {
  6827. width = cellWidth;
  6828. } else if (cellIndex == 0 || cellIndex == self.getStaggerCount() - 1) {
  6829. width = cellWidth * 3 / 2;
  6830. } else {
  6831. width = cellWidth * 2;
  6832. }
  6833. height = cellHeight / 2;
  6834. }
  6835. }
  6836. return [width, height];
  6837. });
  6838. g.selectAll("g.tick > text").call(this._textFlow);
  6839. }
  6840. },
  6841. /**
  6842. * <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>
  6843. * @param (rave['internal']['Selector']) g Selector group for axis
  6844. * @return (Array) The extent of the axis label bounds
  6845. */
  6846. /** @expose */
  6847. labelExtent : function(g) {
  6848. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6849. var w = this._bounds.width;
  6850. var h = this._bounds.height;
  6851. if (this._scale.scale().rangeBand) {
  6852. var rangeBandValue = + (this._scale.scale().rangeBand());
  6853. if (isHorizontal) {
  6854. w = rangeBandValue;
  6855. } else {
  6856. h = rangeBandValue;
  6857. }
  6858. }
  6859. this.calcTitleExtent(g);
  6860. if (isHorizontal) {
  6861. h -= this._axis.tickSize();
  6862. h -= this._padding / 2;
  6863. if (this._layoutTitleSize != 0) {
  6864. h -= this._layoutTitleSize;
  6865. h -= this._padding / 2;
  6866. }
  6867. } else {
  6868. w -= this._axis.tickSize();
  6869. w -= this._padding / 2;
  6870. if (this._layoutTitleSize != 0) {
  6871. w -= this._layoutTitleSize;
  6872. w -= this._padding / 2;
  6873. }
  6874. }
  6875. return [w, h];
  6876. },
  6877. calcTitleExtent : function(g) {
  6878. this._layoutTitleSize = 0;
  6879. var title = g.selectAll("text.axis-title");
  6880. if (title.size() > 0) {
  6881. var textHeight = title[0][0].getBBox().height;
  6882. this._layoutTitleSize = textHeight;
  6883. }
  6884. },
  6885. /**
  6886. * Set the role to one of the constants ROLE_X1 etc. defined in AxisComponent.
  6887. * @param (String) role The new role
  6888. * @return (com.ibm.rave.bundles.components.AxisComponentImpl) This object
  6889. */
  6890. /** @expose */
  6891. setRole : function(role) {
  6892. this._role = role;
  6893. return this;
  6894. },
  6895. /**
  6896. * Set the ticks interval on the scale based on the magnitude. tickMagnitude represents power of 10. null value gives the default scale ticks.
  6897. * @param (Number) tickMagnitude
  6898. * @return (com.ibm.rave.bundles.component.AxisComponent) this
  6899. */
  6900. /** @expose */
  6901. scaleTickMagnitude : function(tickMagnitude) {
  6902. this._tickMagnitude = tickMagnitude;
  6903. return this;
  6904. },
  6905. /**
  6906. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale The new scale
  6907. */
  6908. /** @expose */
  6909. scale : function(scale) {
  6910. this._scale = scale ? scale : null;
  6911. return this;
  6912. },
  6913. /**
  6914. * Only legal values are accepted, otherwise the orient is unchanged.
  6915. * @param (String) orient The new orient
  6916. */
  6917. orient$0 : function(orient) {
  6918. if ("left" == orient || "bottom" == orient || "right" == orient || "top" == orient) {
  6919. this._orient = orient;
  6920. if (this._role == null) {
  6921. if ("left" == orient) {
  6922. this._role = "ROLE_Y1";
  6923. } else if ("bottom" == orient) {
  6924. this._role = "ROLE_X1";
  6925. } else if ("right" == orient) {
  6926. this._role = "ROLE_Y2";
  6927. } else {
  6928. this._role = "ROLE_X2";
  6929. }
  6930. }
  6931. }
  6932. return this;
  6933. },
  6934. /**
  6935. * Returns the current orientation string return The current orient
  6936. */
  6937. orient$1 : function() {
  6938. return this._orient;
  6939. },
  6940. /**
  6941. * @param (rave['internal']['RectStruct']) bounds The new bounds
  6942. */
  6943. /** @expose */
  6944. bounds : function(bounds) {
  6945. this._bounds = bounds;
  6946. return this;
  6947. },
  6948. /** @expose */
  6949. elementRect : function(elementRect) {
  6950. this._elementRect = elementRect;
  6951. return this;
  6952. },
  6953. tickFormat$0 : function(tickFormat) {
  6954. this._tickFormat = tickFormat;
  6955. return this;
  6956. },
  6957. tickFormat$1 : function() {
  6958. return this._tickFormat;
  6959. },
  6960. simplifiedTickFormat$0 : function(tickFormat) {
  6961. this._simplifiedTickFormat = tickFormat;
  6962. return this;
  6963. },
  6964. simplifiedTickFormat$1 : function() {
  6965. return this._simplifiedTickFormat;
  6966. },
  6967. /** @expose */
  6968. displayAxisTitle : function(displayAxisTitle) {
  6969. this._displayAxisTitle = displayAxisTitle;
  6970. return this;
  6971. },
  6972. /** @expose */
  6973. displayAxisLine : function(displayAxisLine) {
  6974. this._displayAxisLine = displayAxisLine;
  6975. return this;
  6976. },
  6977. /** @expose */
  6978. displayTicks : function(displayTicks) {
  6979. this._displayTicks = displayTicks;
  6980. return this;
  6981. },
  6982. /** @expose */
  6983. displayTickLabels : function(displayTickLabels) {
  6984. this._displayTickLabels = displayTickLabels;
  6985. return this;
  6986. },
  6987. /** @expose */
  6988. allowAutomaticAxisLayoutToChangeOrientation : function(state) {
  6989. this._allowAutoAxisLayoutToChangeOrientaiton = state;
  6990. return this;
  6991. },
  6992. /** @expose */
  6993. isAllowAutomaticAxisLayoutToChangeOrientation : function() {
  6994. return this._allowAutoAxisLayoutToChangeOrientaiton;
  6995. },
  6996. /** @expose */
  6997. showPanZoomTickLabels : function(showPanZoomTickLabels) {
  6998. this._showPanZoomTickLabels = showPanZoomTickLabels;
  6999. return this;
  7000. },
  7001. /** @expose */
  7002. axisTitle : function(axisTitle) {
  7003. this._axisTitle = axisTitle;
  7004. return this;
  7005. },
  7006. /** @expose */
  7007. axisColor : function(axisColor) {
  7008. this._lineColor = axisColor;
  7009. this._tickColor = axisColor;
  7010. return this;
  7011. },
  7012. /** @expose */
  7013. lineColor : function(lineColor) {
  7014. this._lineColor = lineColor;
  7015. return this;
  7016. },
  7017. /** @expose */
  7018. tickColor : function(tickColor) {
  7019. this._tickColor = tickColor;
  7020. return this;
  7021. },
  7022. /** @expose */
  7023. labelColor : function(labelColor) {
  7024. this._labelStyle["fill"] = labelColor;
  7025. return this;
  7026. },
  7027. labelStyle$0 : function(fill, fontSize, fontFamily) {
  7028. this._labelStyle["fill"] = fill;
  7029. this._labelStyle["font-size"] = fontSize;
  7030. this._labelStyle["font-family"] = fontFamily;
  7031. return this;
  7032. },
  7033. /** @expose */
  7034. titleColor : function(titleColor) {
  7035. this._titleStyle["fill"] = titleColor;
  7036. return this;
  7037. },
  7038. titleStyle$0 : function(fill, fontSize, fontFamily) {
  7039. this._titleStyle["fill"] = fill;
  7040. this._titleStyle["font-size"] = fontSize;
  7041. this._titleStyle["font-family"] = fontFamily;
  7042. return this;
  7043. },
  7044. /**
  7045. * @param (int) padding The new padding
  7046. */
  7047. /** @expose */
  7048. padding : function(padding) {
  7049. this._padding = padding;
  7050. return this;
  7051. },
  7052. /**
  7053. * @param mode LayoutMode for axis, one of: null (numeric axis), automatic, horizontal, stagger, rotate45, rotate90
  7054. */
  7055. /** @expose */
  7056. layoutMode : function(layoutMode) {
  7057. this._layoutMode = -1;
  7058. if (layoutMode != null) {
  7059. if (layoutMode == "horizontal") {
  7060. this._layoutMode = 0;
  7061. } else if (layoutMode == "stagger") {
  7062. this._layoutMode = 3;
  7063. } else if (layoutMode == "rotate45") {
  7064. this._layoutMode = 2;
  7065. } else if (layoutMode == "rotate90") {
  7066. this._layoutMode = 1;
  7067. }
  7068. }
  7069. return this;
  7070. },
  7071. /**
  7072. * @param (boolean) allow Enable Stagger to be considered in the automatic layout algorithm
  7073. */
  7074. /** @expose */
  7075. allowStagger : function(allow) {
  7076. this._allowStagger = allow;
  7077. return this;
  7078. },
  7079. /**
  7080. * @param (boolean) allow Enable Rotate 45 to be considered in the automatic layout algorithm
  7081. */
  7082. /** @expose */
  7083. allowRotate45 : function(allow) {
  7084. this._allowRotate45 = allow;
  7085. return this;
  7086. },
  7087. /**
  7088. * @param (boolean) allow Enable Rotate 90 to be considered in the automatic layout algorithm
  7089. */
  7090. /** @expose */
  7091. allowRotate90 : function(allow) {
  7092. this._allowRotate90 = allow;
  7093. return this;
  7094. },
  7095. /**
  7096. * @return (boolean) True if on the last call the axis rendered shapes, false otherwise
  7097. */
  7098. renderedShapes : function() {
  7099. return this._renderedShapes;
  7100. },
  7101. labelStyle$1 : function(fontStyle) {
  7102. this._labelStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  7103. return this;
  7104. },
  7105. titleStyle$1 : function(fontStyle) {
  7106. this._titleStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  7107. return this;
  7108. },
  7109. /**
  7110. * Determines whether the axis is swapped.
  7111. * @return (boolean) True if axis is swapped
  7112. */
  7113. isAxisSwapped : function() {
  7114. 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")));
  7115. },
  7116. /**
  7117. * <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>
  7118. * @param (String) indicator the string to be placed to indicated truncated text
  7119. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  7120. */
  7121. /** @expose */
  7122. textTruncateIndicator : function(indicator) {
  7123. this._textTruncationIndicator = indicator;
  7124. return this;
  7125. },
  7126. /**
  7127. * If at least one label collision request is pending we stop the label collision component, and shut down the label collision timer event.
  7128. */
  7129. stopLabelDroppingUpdate : function() {
  7130. this._pendingLabelTimer = false;
  7131. },
  7132. /**
  7133. * 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.
  7134. * @param (rave['internal']['Selector']) labels the selection of valid labels for the end of the transition
  7135. * @param (double) duration of the transition. If 0, we don't do anything.
  7136. * @param (double) delay of the transition. Added to the duration to delay the updates.
  7137. */
  7138. updateLabelDropping : function(labels, duration, delay) {
  7139. var self = this;
  7140. var start = delay + duration;
  7141. var labelCollideCallback = function(elapsed) {
  7142. if (!self._pendingLabelTimer) {
  7143. return true;
  7144. }
  7145. labels.call(self._dropOverlap, self._hideOverlappingLabels);
  7146. if (elapsed >= start) {
  7147. self._pendingLabelTimer = false;
  7148. return true;
  7149. }
  7150. return false;
  7151. };
  7152. if (duration > 0) {
  7153. this._pendingLabelTimer = true;
  7154. rave.timer(labelCollideCallback, start);
  7155. }
  7156. },
  7157. doLabelWrappingAfterAnimation : function(g, labels, mode, duration, delay) {
  7158. this._layoutTimerId++;
  7159. var timerId = this._layoutTimerId;
  7160. var self = this;
  7161. var wrapCallback = function(elapsed) {
  7162. if (self._layoutTimerId == timerId) {
  7163. self.doLabelWrapping(g, mode);
  7164. self.handleLabelsRotationAndPosition(g, labels, mode);
  7165. }
  7166. return true;
  7167. };
  7168. rave.timer(wrapCallback, delay + duration);
  7169. },
  7170. /** @expose */
  7171. preLayout : function() {
  7172. this._layoutTitleSize = 0;
  7173. this._layoutLabelSize = 0;
  7174. this._layoutLabelHeight = 0;
  7175. this._layoutAverageDigitWidth = 0;
  7176. this._layoutSpillOver = 0;
  7177. },
  7178. /** @expose */
  7179. getSizableType : function() {
  7180. return this._scale.isOrdinal() || this._scale.isClustered() ? 1 : 0;
  7181. },
  7182. /** @expose */
  7183. getSizableOrientation : function() {
  7184. return this._orient;
  7185. },
  7186. /** @expose */
  7187. getPreferredSize : function() {
  7188. var layoutPaddingSize = 0;
  7189. if (this._axis) {
  7190. layoutPaddingSize = this._axis.tickSize();
  7191. if (this._layoutLabelSize != 0) {
  7192. layoutPaddingSize += this._padding / 2;
  7193. }
  7194. if (this._layoutTitleSize != 0) {
  7195. layoutPaddingSize += this._padding / 2;
  7196. }
  7197. }
  7198. return this._layoutLabelSize + this._layoutAverageDigitWidth + this._layoutTitleSize + layoutPaddingSize + 2;
  7199. },
  7200. /** @expose */
  7201. getSpillOverSize : function() {
  7202. return this._layoutSpillOver;
  7203. },
  7204. /** @expose */
  7205. orient : function(a0) {
  7206. var args = arguments;
  7207. if (args.length == 0) {
  7208. return this.orient$1();
  7209. }
  7210. return this.orient$0(a0);
  7211. },
  7212. /** @expose */
  7213. tickFormat : function(a0) {
  7214. var args = arguments;
  7215. if (args.length == 0) {
  7216. return this.tickFormat$1();
  7217. }
  7218. return this.tickFormat$0(a0);
  7219. },
  7220. /** @expose */
  7221. simplifiedTickFormat : function(a0) {
  7222. var args = arguments;
  7223. if (args.length == 0) {
  7224. return this.simplifiedTickFormat$1();
  7225. }
  7226. return this.simplifiedTickFormat$0(a0);
  7227. },
  7228. /** @expose */
  7229. labelStyle : function(a0, a1, a2) {
  7230. var args = arguments;
  7231. if (args.length == 1) {
  7232. return this.labelStyle$1(a0);
  7233. }
  7234. return this.labelStyle$0(a0, a1, a2);
  7235. },
  7236. /** @expose */
  7237. titleStyle : function(a0, a1, a2) {
  7238. var args = arguments;
  7239. if (args.length == 1) {
  7240. return this.titleStyle$1(a0);
  7241. }
  7242. return this.titleStyle$0(a0, a1, a2);
  7243. }
  7244. });
  7245. /**
  7246. * 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.
  7247. * @param (rave['internal']['RectStruct']) bounds Rectangle of the axis bounds
  7248. * @param (String) orient Orient, "top", "bottom", "left", "right"; if not valid, "bottom" used
  7249. * @return (double[]) Translation [x,y]
  7250. */
  7251. /** @expose */
  7252. com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation = function(bounds, orient) {
  7253. if ("left" == orient) {
  7254. return [bounds.x + bounds.width, 0.0];
  7255. }
  7256. if ("right" == orient) {
  7257. return [bounds.x, 0.0];
  7258. }
  7259. if ("top" == orient) {
  7260. return [0.0, bounds.y + bounds.height];
  7261. }
  7262. return [0.0, bounds.y];
  7263. };
  7264. com_ibm_rave_bundles_components_AxisComponentImpl.NodeIndex = rave['internal']['Declare']({
  7265. //_node : null,
  7266. _domainIndex : 0,
  7267. /** @expose */
  7268. constructor : function(node, domainIndex) {
  7269. this._node = node;
  7270. this._domainIndex = domainIndex;
  7271. },
  7272. /** @expose */
  7273. contains : function(node) {
  7274. return node == this._node;
  7275. },
  7276. /** @expose */
  7277. getIndex : function() {
  7278. return this._domainIndex;
  7279. }
  7280. });
  7281. /**
  7282. * Tick Handler for the axis. This will get called as the core axis is transitioned.
  7283. */
  7284. com_ibm_rave_bundles_components_AxisComponentImpl.AxisTickHandler = rave['internal']['Declare'](rave['internal']['AbstractTickHandler'], {
  7285. //_label : null,
  7286. //_tick : null,
  7287. _$functionClassMethod : function() {
  7288. var _$self = function(args) {
  7289. if (args !== null || arguments.length > 1){
  7290. args = Array.prototype.slice.call(arguments, 0);
  7291. }
  7292. {
  7293. _$self.handle(args[0]);
  7294. return null;
  7295. }
  7296. };
  7297. return _$self;
  7298. },
  7299. constructor : function(label, tick) {
  7300. this._label = label;
  7301. this._tick = tick;
  7302. },
  7303. /** @expose */
  7304. handle : function(ticks) {
  7305. ticks.call(this._tick);
  7306. ticks.call(this._label);
  7307. }
  7308. });
  7309. //com_ibm_rave_bundles_components_AxisComponentImpl.VISIBILITY = "visibility";
  7310. //com_ibm_rave_bundles_components_AxisComponentImpl.HIDDEN = "hidden";
  7311. /** @expose */
  7312. com_ibm_rave_bundles_components_AxisComponentImpl.LABEL_HIDDEN_FLAG = "__tickLabelHidden__";
  7313. /** @expose */
  7314. com_ibm_rave_bundles_components_AxisComponentImpl.PANZOOM_HIDDEN_FLAG = "__panZoomHidden__";
  7315. /** @expose */
  7316. com_ibm_rave_bundles_components_AxisComponentImpl.HIDDEN_COUNT = "__hiddenCount__";
  7317. /** @expose */
  7318. com_ibm_rave_bundles_components_AxisComponentImpl.PREFERRED_SPACE_PER_TICK = 20;
  7319. /** @expose */
  7320. com_ibm_rave_bundles_components_AxisComponentImpl.PREFERRED_TICK_COUNT = 10;
  7321. /** @expose */
  7322. com_ibm_rave_bundles_components_AxisComponentImpl.TICK_PADDING = 10;
  7323. //com_ibm_rave_bundles_components_AxisComponentImpl.HORIZONTAL_WEIGHT = 1.1;
  7324. com_ibm_rave_bundles_components_AxisComponentImpl.HORIZONTAL = 0;
  7325. com_ibm_rave_bundles_components_AxisComponentImpl.ROTATE90 = 1;
  7326. com_ibm_rave_bundles_components_AxisComponentImpl.ROTATE45 = 2;
  7327. com_ibm_rave_bundles_components_AxisComponentImpl.STAGGER = 3;
  7328. /**
  7329. * Constant used for text flow spacing
  7330. */
  7331. com_ibm_rave_bundles_components_AxisComponentImpl.TEXTFLOW_SPACING = 1.2;
  7332. /**
  7333. * Bottom axis orientation string.
  7334. */
  7335. /** @expose */
  7336. com_ibm_rave_bundles_components_AxisComponentImpl.BOTTOM_ORIENTATION = "bottom";
  7337. /**
  7338. * Top axis orientation string.
  7339. */
  7340. /** @expose */
  7341. com_ibm_rave_bundles_components_AxisComponentImpl.TOP_ORIENTATION = "top";
  7342. /**
  7343. * Left axis orientation string.
  7344. */
  7345. /** @expose */
  7346. com_ibm_rave_bundles_components_AxisComponentImpl.LEFT_ORIENTATION = "left";
  7347. /**
  7348. * Right axis orientation string.
  7349. */
  7350. /** @expose */
  7351. com_ibm_rave_bundles_components_AxisComponentImpl.RIGHT_ORIENTATION = "right";
  7352. com_ibm_rave_bundles_components_AxisComponentImpl.AUTOMODE = -1;
  7353. // $source: com/ibm/rave/bundles/components/GridComponentImpl
  7354. /************************************************************************
  7355. ** IBM Confidential
  7356. **
  7357. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7358. **
  7359. ** (C) Copyright IBM Corp. 2017
  7360. **
  7361. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7362. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7363. ************************************************************************/
  7364. // GENERATED
  7365. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  7366. //@import com/ibm/rave/bundles/components/StyleStructs (runtime) // new
  7367. //@import com/ibm/rave/bundles/component/GridComponent (runtime) // GridComponent
  7368. /**
  7369. * <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>
  7370. */
  7371. var com_ibm_rave_bundles_components_GridComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  7372. /**
  7373. * The axis property
  7374. */
  7375. //_axis : null,
  7376. /**
  7377. * Role, from the AxisComponent API
  7378. */
  7379. //_role : null,
  7380. /**
  7381. * The orientation
  7382. */
  7383. //_orient : null,
  7384. /**
  7385. * The bounds
  7386. */
  7387. //_bounds : null,
  7388. /**
  7389. * Style of gridlines
  7390. */
  7391. //_gridlineStyle : null,
  7392. /**
  7393. * Whether to display gridlines
  7394. */
  7395. _displayGridlines : false,
  7396. /**
  7397. * After calling the component, this is true if shapes were rendered, false if they were cleared.
  7398. */
  7399. _renderedShapes : false,
  7400. /**
  7401. * Construct, with all properties the defaults.
  7402. */
  7403. /** @expose */
  7404. constructor : function() {
  7405. this._axis = null;
  7406. this._role = null;
  7407. this._orient = "bottom";
  7408. this._bounds = null;
  7409. this._displayGridlines = true;
  7410. this._gridlineStyle = new com_ibm_rave_bundles_components_StyleStructs.LineStyle();
  7411. this._renderedShapes = false;
  7412. },
  7413. /** @expose */
  7414. type : function() {
  7415. return com_ibm_rave_bundles_component_GridComponent.COMPONENT_TYPE;
  7416. },
  7417. /** @expose */
  7418. role : function() {
  7419. return this._role;
  7420. },
  7421. /** @expose */
  7422. execute : function(g) {
  7423. this.preExecute();
  7424. if (!this._displayGridlines || !this._axis || !this._bounds) {
  7425. g.selectAll("*").remove();
  7426. this._renderedShapes = false;
  7427. return;
  7428. }
  7429. this._renderedShapes = true;
  7430. var size = ("bottom" == this._orient || "top" == this._orient) ? this._bounds.height : this._bounds.width;
  7431. var ticksHandler = this._axis.ticksHandler();
  7432. var tickSize = this._axis.tickSize();
  7433. var outerTickSize = this._axis.outerTickSize();
  7434. var tickFormat = this._axis.tickFormat();
  7435. var ax = this._axis.tickSize(-size, 0).tickFormat("").ticksHandler(null);
  7436. g.call(ax);
  7437. this._axis.tickSize(tickSize, outerTickSize).tickFormat(tickFormat).ticksHandler(ticksHandler);
  7438. g.selectAll("g.tick line").classed("grid-tick", true);
  7439. g.selectAll(".grid-tick").style("stroke", this._gridlineStyle._stroke).style("stroke-dasharray", (this._gridlineStyle._dashArray));
  7440. g.selectAll("path.domain").remove();
  7441. },
  7442. /**
  7443. * @param (rave['internal']['Axis']) axis The new axis
  7444. */
  7445. /** @expose */
  7446. axis : function(axis) {
  7447. this._axis = axis;
  7448. return this;
  7449. },
  7450. /**
  7451. * Set the role to one of the constants ROLE_X1 etc. defined in AxisComponent.
  7452. * @param (String) role The new role
  7453. * @return (com.ibm.rave.bundles.components.GridComponentImpl) This object
  7454. */
  7455. /** @expose */
  7456. setRole : function(role) {
  7457. this._role = role;
  7458. return this;
  7459. },
  7460. /**
  7461. * Only legal values are accepted, otherwise the orient is unchanged.
  7462. * @param (String) orient The new orient
  7463. */
  7464. orient$0 : function(orient) {
  7465. if ("left" == orient || "right" == orient || "bottom" == orient || "top" == orient) {
  7466. this._orient = orient;
  7467. }
  7468. return this;
  7469. },
  7470. /**
  7471. * @param (rave['internal']['RectStruct']) bounds The new bounds
  7472. */
  7473. /** @expose */
  7474. bounds : function(bounds) {
  7475. this._bounds = bounds;
  7476. return this;
  7477. },
  7478. displayGridlines$0 : function(displayGridlines) {
  7479. this._displayGridlines = displayGridlines;
  7480. return this;
  7481. },
  7482. /** @expose */
  7483. gridlineStyle : function(gridlineColor, dashArray) {
  7484. this.gridlineColor(gridlineColor);
  7485. this.dashArray(dashArray);
  7486. return this;
  7487. },
  7488. gridlineColor$0 : function(gridlineColor) {
  7489. this._gridlineStyle._stroke = (gridlineColor != null && gridlineColor.length > 0) ? gridlineColor : null;
  7490. return this;
  7491. },
  7492. dashArray$0 : function(dashArray) {
  7493. this._gridlineStyle._dashArray = (dashArray != null && dashArray.length > 0) ? dashArray : null;
  7494. return this;
  7495. },
  7496. /**
  7497. * @return (String) The orientation of the gridline.
  7498. */
  7499. orient$1 : function() {
  7500. return this._orient;
  7501. },
  7502. displayGridlines$1 : function() {
  7503. return this._displayGridlines;
  7504. },
  7505. gridlineColor$1 : function() {
  7506. return this._gridlineStyle._stroke;
  7507. },
  7508. dashArray$1 : function() {
  7509. return this._gridlineStyle._dashArray;
  7510. },
  7511. /**
  7512. * @return (boolean) True if on the last call the axis rendered shapes, false otherwise
  7513. */
  7514. renderedShapes : function() {
  7515. return this._renderedShapes;
  7516. },
  7517. /** @expose */
  7518. orient : function(a0) {
  7519. var args = arguments;
  7520. if (args.length == 0) {
  7521. return this.orient$1();
  7522. }
  7523. return this.orient$0(a0);
  7524. },
  7525. /** @expose */
  7526. displayGridlines : function(a0) {
  7527. var args = arguments;
  7528. if (args.length == 0) {
  7529. return this.displayGridlines$1();
  7530. }
  7531. return this.displayGridlines$0(a0);
  7532. },
  7533. /** @expose */
  7534. gridlineColor : function(a0) {
  7535. var args = arguments;
  7536. if (args.length == 0) {
  7537. return this.gridlineColor$1();
  7538. }
  7539. return this.gridlineColor$0(a0);
  7540. },
  7541. /** @expose */
  7542. dashArray : function(a0) {
  7543. var args = arguments;
  7544. if (args.length == 0) {
  7545. return this.dashArray$1();
  7546. }
  7547. return this.dashArray$0(a0);
  7548. }
  7549. });
  7550. // $source: com/ibm/rave/bundles/components/KeyedBundleComponentImpl
  7551. /************************************************************************
  7552. ** IBM Confidential
  7553. **
  7554. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7555. **
  7556. ** (C) Copyright IBM Corp. 2017
  7557. **
  7558. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7559. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7560. ************************************************************************/
  7561. // GENERATED
  7562. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  7563. /**
  7564. * 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.
  7565. * @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>
  7566. */
  7567. var com_ibm_rave_bundles_components_KeyedBundleComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  7568. //keyFunction : null,
  7569. /**
  7570. * Set the key function this component should use when joining data to scene nodes.
  7571. * @param (rave['internal']['SingleValueFunction']) keyFunction This function will be passed each datum individually and must return a unique value (a key).
  7572. * @return (com.ibm.rave.bundles.components.KeyedBundleComponentImpl) This.
  7573. */
  7574. /** @expose */
  7575. key : function(keyFunction) {
  7576. this.keyFunction = keyFunction;
  7577. return this;
  7578. },
  7579. /**
  7580. * Returns a {@link (rave['internal']['ValueFunction']) ValueFunction} that wraps the provided key function.
  7581. */
  7582. /** @expose */
  7583. getKey : function() {
  7584. if (!this.keyFunction) {
  7585. return null;
  7586. }
  7587. var self = this;
  7588. return function(datum, index, groupIndex) {
  7589. return self.keyFunction(datum);
  7590. };
  7591. }
  7592. });
  7593. // $source: com/ibm/rave/bundles/components/PointComponentImpl
  7594. /************************************************************************
  7595. ** IBM Confidential
  7596. **
  7597. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7598. **
  7599. ** (C) Copyright IBM Corp. 2017
  7600. **
  7601. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7602. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7603. ************************************************************************/
  7604. // GENERATED
  7605. //@import com/ibm/rave/bundles/components/KeyedBundleComponentImpl (loadtime) // superclass
  7606. //@import com/ibm/rave/bundles/component/PointComponent (runtime) // PointComponent
  7607. //@import com/ibm/rave/bundles/utilities/PathUtils (runtime) // fadeOutIn
  7608. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor
  7609. //@import com/ibm/rave/bundles/utilities/BundleLabelDropper (runtime) // new
  7610. //@import com/ibm/rave/bundles/utilities/LabelStyleUtil (runtime) // new
  7611. /**
  7612. * <p> A component to draw point charts. The component puts its shapes into the selector passed to its execute method. </p> <p> The data array passed to the component has one entry per point to be drawn. Each entry has five properties. Accessors are used to get these properties from the object, and scales to convert them to a graphical property. If a property is not defined (either no accessor or no scale), a default value is used for the property. The five properties are: </p> <ul> <li> <b>dependent</b>: One of the two coordinate variables for the points. If not defined the coordinate is the midpoint of the chart dimension. </li> <li> <b>independent</b>: One of the two coordinate variables for the points. If not defined the coordinate is the midpoint of the chart dimension. </li> <li> <b>color</b>: Used for the fill color of the points. If not defined the fill is a default value set with a property. </li> <li> <b>size</b>: Used to size the points. If not defined the point is sized to a default value set with a property. </li> <li> <b>label</b>: Label for the point. If not defined the point is not labeled. The point component does not do internationalization, and this string is the value displayed. </li> </ul> <p> Scatterplots in general do not distinguish between the dependent and independent variables. The names are used here for compatibility with other two-axis plots such as the line and column. </p> <p> The component properties are: </p> <p> <b>data</b>: An array with one entry per point. If null, no points are drawn. </p> <p> <b>independentAccessor</b>: A value function applied to a data object to get the independent value. If null, the midpoint of the coordinate range is used. The default is null. </p> <p> <b>independentScale</b>: A scale applied to the independent value to get the pixel coordinate for drawing the line. If null, the midpoint of the coordinate range is used. The default is null. </p> <p> <b>dependentAccessor</b>: A value function applied to a data object to get the dependent value. If null, the midpoint of the coordinate range is used. The default is null. </p> <p> <b>dependentScale</b>: A scale applied to the dependent value to get the pixel coordinate for drawing the line. If null, the midpoint of the coordinate range is used. The default is null. </p> <p> <b>colorAccessor</b>: A value function applied to a data object to get the color value. If null, the point is drawn in the primary color. The default is null. </p> <p> <b>colorPalette</b>: A palette applied to the color value to get a color value for drawing the point. If null or if it returns null, the point is drawn in the primary color. </p> <p> <b>sizeAccessor</b>: A value function applied to a data object to get the size value used for the point size. If null, the point is drawn with the default size. The default is null. </p> <p> <b>sizeScale</b>: A scale applied to the size value to get the size for drawing for drawing the line. If null or if it returns null, the point is drawn with the default size. The default is null. </p> <p> <b>labelAccessor</b>: A value function applied to a data object to get the label. If null, the point is not labeled. The default is null. </p> <p> <b>labelFormatter</b>: A value function applied to the data label (as returned by the labelAccessor) to get the formatted text string used in the chart. If null, the data label is coerced to a string and used as the formatted text string. The default is null. The method is not called when the data label is null. </p> <p> <b>bounds</b>: The bounding rectangle of the component, used to find the midpoints of the coordinates when the independent or dependent variables are not defined. If either of those variables is not defined and the bounds is null, no points are drawn. The default is null. </p> <p> <b>transpose</b>: A boolean. If false the independent data is shown on the X axis and the dependent data on the Y; if true they are swapped. Default false. </p> <p> <b>primaryColor</b>: The color used to draw the point when the point has no color value or there is no color scale. If null, the point is drawn but not colored, and the CSS style will be used. </p> <p> <b>symbol</b>: The symbol used to draw the shape, which must be one of the RAVE/D3 symbol generator names or "rectangle". If null, the point is drawn as a circle. </p> <p> <b>defaultSize</b>: The size used to draw the point when the point has no size value or there is no size scale. The default is 100 and the value cannot be set to less than 0. Note that this uses the RAVE/D3 convention, where the size is in square pixels. </p> <p> <b>itemLabel</b>: A boolean. If true and if the label accessor is defined, the label is shown on each item. Default true. </p> <p> <b>itemOverlap</b>: A boolean. If true, overlapping labels are removed. Default is true. </p> <p> <b>effect</b>: A string. Requests an entrance effect; if null or not a supported effect, no entrance effect is used. Default null. The supported effects are: </p> <ul> <li> "grow": Shapes start at size zero and grow to full size. </li> <li> "fromBase": Shapes start at dependent coordinate 0 and move to final position. Only used when the dependent scale is non-ordinal. </li> <li> "grow+fromBase": Combines the grow and fromBase effects. </li> </ul>
  7613. */
  7614. var com_ibm_rave_bundles_components_PointComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_KeyedBundleComponentImpl, {
  7615. /**
  7616. * Data
  7617. */
  7618. //_data : null,
  7619. /**
  7620. * Accessor for independent variable
  7621. */
  7622. //_independentAccessor : null,
  7623. /**
  7624. * Independent variable scale
  7625. */
  7626. //_independentScale : null,
  7627. /**
  7628. * Accessor for dependent variable
  7629. */
  7630. //_dependentAccessor : null,
  7631. /**
  7632. * Dependent scale
  7633. */
  7634. //_dependentScale : null,
  7635. /**
  7636. * Color scale
  7637. */
  7638. //_colorPalette : null,
  7639. /**
  7640. * Accessor for size role
  7641. */
  7642. //_sizeAccessor : null,
  7643. /**
  7644. * Size scale
  7645. */
  7646. //_sizeScale : null,
  7647. /**
  7648. * Accessor for label role
  7649. */
  7650. //_labelAccessor : null,
  7651. /**
  7652. * Label formatter, may be null
  7653. */
  7654. //_labelFormatter : null,
  7655. //_labelFontStyle : null,
  7656. /**
  7657. * Bounds
  7658. */
  7659. //_bounds : null,
  7660. /**
  7661. * Symbol
  7662. */
  7663. //_symbol : null,
  7664. /**
  7665. * Previous symbol: allows better transitions between symbols
  7666. */
  7667. //_prevSymbol : null,
  7668. //_dropOverlap : null,
  7669. /**
  7670. * Effect
  7671. */
  7672. //_effect : null,
  7673. //_borderWidth : null,
  7674. //_borderColor : null,
  7675. //_itemLabelPosition : null,
  7676. //_labelStyleUtil : null,
  7677. /**
  7678. * Transpose
  7679. */
  7680. _transpose : false,
  7681. /**
  7682. * Default size
  7683. */
  7684. _defaultSize : 0,
  7685. /**
  7686. * Show label
  7687. */
  7688. _itemLabel : false,
  7689. /**
  7690. * Drop overlapping labels
  7691. */
  7692. _itemOverlap : false,
  7693. _labelLayerClass : ".element-label-group",
  7694. _elementLayerClass : ".element-group",
  7695. _labelContrast : false,
  7696. _labelShadow : false,
  7697. constructor : function() {
  7698. this._labelFontStyle = {};
  7699. {
  7700. this._data = null;
  7701. this._independentAccessor = null;
  7702. this._independentScale = null;
  7703. this._dependentAccessor = null;
  7704. this._dependentScale = null;
  7705. this._colorPalette = null;
  7706. this._sizeAccessor = null;
  7707. this._sizeScale = null;
  7708. this._labelAccessor = null;
  7709. this._labelFormatter = null;
  7710. this._bounds = null;
  7711. this._transpose = false;
  7712. this._defaultSize = 400.0;
  7713. this._symbol = null;
  7714. this._prevSymbol = null;
  7715. this._itemLabel = true;
  7716. this._itemOverlap = true;
  7717. this._effect = null;
  7718. this._dropOverlap = new com_ibm_rave_bundles_utilities_BundleLabelDropper();
  7719. this._borderWidth = null;
  7720. this._borderColor = null;
  7721. this._labelStyleUtil = new com_ibm_rave_bundles_utilities_LabelStyleUtil();
  7722. if (!(rave.svg.symbolTypes.indexOf("donutPlus")> -1)) {
  7723. rave.svg.symbolCreator("donutPlus", rave['library']['internal']['CommonPropertyConstants'].DONUT_PLUS);
  7724. }
  7725. if (!(rave.svg.symbolTypes.indexOf("donut-thin")> -1)) {
  7726. rave.svg.symbolCreator("donut-thin", rave['library']['internal']['CommonPropertyConstants'].DONUT_THIN);
  7727. }
  7728. }
  7729. },
  7730. /** @expose */
  7731. type : function() {
  7732. return com_ibm_rave_bundles_component_PointComponent.COMPONENT_TYPE;
  7733. },
  7734. /** @expose */
  7735. execute : function(g) {
  7736. this.preExecute();
  7737. var elementGroupSelector = g.selectAll(this._elementLayerClass);
  7738. var labelGroupSelector = g.selectAll(this._labelLayerClass);
  7739. if (g.classed(this._elementLayerClass) || elementGroupSelector.size() == 0 || labelGroupSelector.size() == 0) {
  7740. elementGroupSelector = g;
  7741. labelGroupSelector = g;
  7742. }
  7743. if (!this._data || (!this._bounds && (!this._independentAccessor || !this._independentScale || !this._dependentAccessor || !this._dependentScale))) {
  7744. elementGroupSelector.selectAll("*").remove();
  7745. labelGroupSelector.selectAll("*").remove();
  7746. return;
  7747. }
  7748. elementGroupSelector.selectAll("*").remove();
  7749. labelGroupSelector.selectAll("*").remove();
  7750. var self = this;
  7751. var enterTransform = this.pointTransform(true);
  7752. var finalTransform = this.pointTransform(false);
  7753. var symbols = [];
  7754. if (this._symbol == null) {
  7755. elementGroupSelector.selectAll("*").remove();
  7756. } else if (this._symbol == "donutPlus") {
  7757. var s = new rave['internal']['Symbol']().type("circle");
  7758. symbols.push(s);
  7759. s = new rave['internal']['Symbol']().type("donut-thin");
  7760. symbols.push(s);
  7761. } else {
  7762. var s = new rave['internal']['Symbol']().type(this._symbol);
  7763. symbols.push(s);
  7764. elementGroupSelector.selectAll("." + com_ibm_rave_bundles_components_PointComponentImpl.SECONDARY_ELEMENT).remove();
  7765. }
  7766. for (var i = 0; i < symbols.length; ++i) {
  7767. var type = i == 0 ? "element-shape" : com_ibm_rave_bundles_components_PointComponentImpl.SECONDARY_ELEMENT;
  7768. var shapes = elementGroupSelector.selectAll("." + type).data(this._data, this.getKey());
  7769. shapes.exit().remove();
  7770. var symbol = symbols[i];
  7771. var fillStyle = this.symbolFill(type);
  7772. shapes.enter().append("path").attr("class", type).attr("transform", enterTransform).attr("d", symbol.size(this.enterSize(this._defaultSize, type))).style("fill", fillStyle).style("stroke", fillStyle).style("stroke-width", "0px");
  7773. var s = rave.transition(shapes).attr("transform", finalTransform).style("fill", fillStyle);
  7774. this.updateBorder(s, this._borderWidth, this._borderColor);
  7775. symbol.size(this.finalSize(this._defaultSize, type));
  7776. if (this._prevSymbol != null && !(this._prevSymbol == this._symbol)) {
  7777. com_ibm_rave_bundles_utilities_PathUtils.fadeOutIn(s, symbol);
  7778. } else {
  7779. s.attr("d", symbol);
  7780. }
  7781. }
  7782. if (this._itemLabel && this._labelAccessor) {
  7783. var elementLabelGroupSelector = g.selectAll(this._labelLayerClass);
  7784. if (elementLabelGroupSelector.size() == 0) {
  7785. elementLabelGroupSelector = g;
  7786. }
  7787. var labels = elementLabelGroupSelector.selectAll("element-label").data(this._data, this.getKey());
  7788. labels.exit().remove();
  7789. var labelText = !this._labelFormatter ? function(data, index, groupIndex) {
  7790. return self._labelAccessor(data);
  7791. } : function(data, index, groupIndex) {
  7792. var v = self._labelAccessor(data);
  7793. return v == null ? null : self._labelFormatter.call(this, v, index, groupIndex);
  7794. };
  7795. var fontChecker = rave.capabilities.extension("fontchecker");
  7796. labels.enter().append("text").attr("class", "element-label").attr("x", this.positionX(true)).attr("y", this.positionY(true)).attr("dx", this.getXOffset()).attr("dy", this.getYOffset()).style("text-anchor", this.getAnchor()).text(labelText);
  7797. var labelColor = this.getDefaultLabelColor(this._labelFontStyle);
  7798. this._labelStyleUtil.labelFont(this._labelFontStyle).labelFillColor(this._labelContrast ? this.getLabelFill() : function(data, index, groupIndex) {
  7799. return labelColor;
  7800. }).labelShadow(this._labelShadow);
  7801. labels.call(this._labelStyleUtil);
  7802. if (fontChecker) {
  7803. labels.call(fontChecker);
  7804. }
  7805. var labelTransition = rave.transition(labels).attr("x", this.positionX(false)).attr("y", this.positionY(false)).attr("dx", this.getXOffset()).attr("dy", this.getYOffset()).style("text-anchor", this.getAnchor()).text(labelText);
  7806. this._dropOverlap.configureForDataLabels(this._bounds);
  7807. labelTransition.call(this._dropOverlap, this._itemOverlap);
  7808. } else {
  7809. var elementLabelGroupSelector = g.selectAll(this._labelLayerClass);
  7810. if (elementLabelGroupSelector.size() == 0) {
  7811. elementLabelGroupSelector = g;
  7812. }
  7813. elementLabelGroupSelector.selectAll("text.element-label").remove();
  7814. }
  7815. },
  7816. symbolFill : function(type) {
  7817. var self = this;
  7818. return function(d, index, groupIndex) {
  7819. if (self._symbol == "donutPlus" && type == com_ibm_rave_bundles_components_PointComponentImpl.SECONDARY_ELEMENT) {
  7820. return "white";
  7821. }
  7822. return !self._colorPalette ? null : self._colorPalette.call(null, d, 0, 0);
  7823. };
  7824. },
  7825. /**
  7826. * Get the enter transform of a shape, for the argument to attr("transform",v). If the effect requires from-base movement, this is a translate where the independent coordinate starts at the scale zero. Otherwise it is the same as finalTransform(). This should only be called if either bounds is non-null, or the dependent and independent accessors and scales are all non-null. The result depends on the transpose, on which accessors and scales are defined, on the bounds, and on the effect.
  7827. * @return (rave['internal']['ValueFunction']) Transform value function
  7828. */
  7829. pointTransform : function(enter) {
  7830. var useDependentZero = enter && ("fromBase" == this._effect || "growfromBase" == this._effect);
  7831. var dependent = useDependentZero ? this.dependentZero() : this.dependent();
  7832. var independent = this.independent();
  7833. if (this._transpose) {
  7834. return function(data, index, groupIndex) {
  7835. return "translate(" + dependent.call(this, data, index, groupIndex) + "," + independent.call(this, data, index, groupIndex) + ")";
  7836. };
  7837. }
  7838. return function(data, index, groupIndex) {
  7839. return "translate(" + independent.call(this, data, index, groupIndex) + "," + dependent.call(this, data, index, groupIndex) + ")";
  7840. };
  7841. },
  7842. /**
  7843. * Get the enter x of a label, for the argument to attr("x",v). If the effect requires from-base movement, this is a translate where the independent coordinate starts at the scale zero. Otherwise it is the same as finalTransform(). This should only be called if either bounds is non-null, or the dependent and independent accessors and scales are all non-null. The result depends on the transpose, on which accessors and scales are defined, on the bounds, and on the effect.
  7844. * @return (rave['internal']['ValueFunction']) X value function
  7845. */
  7846. positionX : function(enter) {
  7847. var useDependentZero = enter && ("fromBase" == this._effect || "growfromBase" == this._effect);
  7848. var dependent = useDependentZero ? this.dependentZero() : this.dependent();
  7849. var independent = this.independent();
  7850. if (this._transpose) {
  7851. return function(data, index, groupIndex) {
  7852. return dependent.call(this, data, index, groupIndex);
  7853. };
  7854. }
  7855. return function(data, index, groupIndex) {
  7856. return independent.call(this, data, index, groupIndex);
  7857. };
  7858. },
  7859. /**
  7860. * Get the enter y of a label, for the argument to attr("y",v). If the effect requires from-base movement, this is a translate where the independent coordinate starts at the scale zero. Otherwise it is the same as finalTransform(). This should only be called if either bounds is non-null, or the dependent and independent accessors and scales are all non-null. The result depends on the transpose, on which accessors and scales are defined, on the bounds, and on the effect.
  7861. * @return (rave['internal']['ValueFunction']) Y value function
  7862. */
  7863. positionY : function(enter) {
  7864. var useDependentZero = enter && ("fromBase" == this._effect || "growfromBase" == this._effect);
  7865. var dependent = useDependentZero ? this.dependentZero() : this.dependent();
  7866. var independent = this.independent();
  7867. if (this._transpose) {
  7868. return function(data, index, groupIndex) {
  7869. return independent.call(this, data, index, groupIndex);
  7870. };
  7871. }
  7872. return function(data, index, groupIndex) {
  7873. return dependent.call(this, data, index, groupIndex);
  7874. };
  7875. },
  7876. /**
  7877. * Get a value function that returns the scaled independent coordinate. It should be called only if bounds is defined, or if the independent accessor and scale are both defined.
  7878. * @return (rave['internal']['ValueFunction']) Value function for scaled independent coordinate
  7879. */
  7880. independent : function() {
  7881. if (this._independentAccessor && this._independentScale) {
  7882. var self = this;
  7883. return function(data, index, groupIndex) {
  7884. return self._independentScale.center(self._independentAccessor(data));
  7885. };
  7886. }
  7887. var midpoint = this._transpose ? this._bounds.y + this._bounds.height / 2.0 : this._bounds.x + this._bounds.width / 2.0;
  7888. return function(data, index, groupIndex) {
  7889. return midpoint;
  7890. };
  7891. },
  7892. /**
  7893. * Get a value function that returns the scaled independent coordinate. It should be called only if bounds is defined, or if the dependent accessor and scale are both defined.
  7894. * @return (rave['internal']['ValueFunction']) Value function for scaled independent coordinate
  7895. */
  7896. dependent : function() {
  7897. if (this._dependentAccessor && this._dependentScale) {
  7898. var self = this;
  7899. return function(data, index, groupIndex) {
  7900. return self._dependentScale.center(self._dependentAccessor(data));
  7901. };
  7902. }
  7903. var midpoint = this._transpose ? this._bounds.x + this._bounds.width / 2.0 : this._bounds.y + this._bounds.height / 2.0;
  7904. return function(data, index, groupIndex) {
  7905. return midpoint;
  7906. };
  7907. },
  7908. /**
  7909. * Get a value function that returns the scaled independent zero. If the independent scale is ordinal, this returns the same thing as dependent(); otherwise it returns the scaled zero of the dependent scale.
  7910. * @return (rave['internal']['ValueFunction']) Value function for scaled independent coordinate
  7911. */
  7912. dependentZero : function() {
  7913. if (!this._dependentScale || !(this._dependentScale.isLinear())) {
  7914. return this.dependent();
  7915. }
  7916. var self = this;
  7917. return function(data, index, groupIndex) {
  7918. return self._dependentScale.center(0.0);
  7919. };
  7920. },
  7921. /**
  7922. * Get the initial size of a shape, for the argument to BundleSymbol#size(). If the effect requires shape-grow, this is 0.0. Otherwise it is the final size.
  7923. * @return (rave['internal']['ValueFunction']) Size value function
  7924. */
  7925. enterSize : function(size, type) {
  7926. if ("grow" == this._effect || "growfromBase" == this._effect) {
  7927. return function(data, index, groupIndex) {
  7928. return 0.0;
  7929. };
  7930. }
  7931. return this.finalSize(size, type);
  7932. },
  7933. /**
  7934. * Get the final size of a shape, for the argument to BundleSymbol#size(). If the size accessor and size scale are both defined, the size comes from the scale applied to the accessor value (using the default size for a null accessor value); otherwise it is the default size.
  7935. * @return (rave['internal']['ValueFunction']) Size value function
  7936. */
  7937. finalSize : function(size, type) {
  7938. var self = this;
  7939. var ratio = self._symbol == "donutPlus" && type == com_ibm_rave_bundles_components_PointComponentImpl.SECONDARY_ELEMENT ? 0.6 : 1;
  7940. if (this._sizeAccessor && this._sizeScale) {
  7941. return function(d, index, groupIndex) {
  7942. var v = self._sizeAccessor(d);
  7943. return v != null ? + (self._sizeScale.call(null, v, 0, 0)) * ratio : size * ratio;
  7944. };
  7945. }
  7946. return function(d, index, groupIndex) {
  7947. return size * ratio;
  7948. };
  7949. },
  7950. getAnchor : function() {
  7951. var self = this;
  7952. return function(data, index, groupIndex) {
  7953. if (!self._itemLabelPosition) {
  7954. return "middle";
  7955. }
  7956. var labelPosition = self._itemLabelPosition.call(this, data, index, groupIndex);
  7957. if (0 == labelPosition || 2 == labelPosition || 1 == labelPosition) {
  7958. return "middle";
  7959. } else if (3 == labelPosition) {
  7960. return "end";
  7961. } else if (4 == labelPosition || 5 == labelPosition) {
  7962. return "start";
  7963. }
  7964. return "middle";
  7965. };
  7966. },
  7967. getLabelFill : function() {
  7968. var self = this;
  7969. var labelColor = this.getDefaultLabelColor(this._labelFontStyle);
  7970. return function(data, index, groupIndex) {
  7971. if (!self._colorPalette || !self._itemLabelPosition) {
  7972. return labelColor;
  7973. }
  7974. var labelPosition = self._itemLabelPosition.call(this, data, index, groupIndex);
  7975. if (1 == labelPosition) {
  7976. var elementColor = self._colorPalette.call(this, data, index, groupIndex);
  7977. if (elementColor != null) {
  7978. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(elementColor, labelColor).toString();
  7979. }
  7980. }
  7981. return labelColor;
  7982. };
  7983. },
  7984. getXOffset : function() {
  7985. var self = this;
  7986. return function(data, index, groupIndex) {
  7987. var padding = 5;
  7988. if ((!self._itemLabelPosition)) {
  7989. return "0em";
  7990. }
  7991. var labelPosition = self._itemLabelPosition.call(this, data, index, groupIndex);
  7992. if (3 == labelPosition) {
  7993. return "-" + (Math.sqrt(self.finalSize(self._defaultSize, self._symbol).call(this, data, index, groupIndex)) / 2 + padding) + "px";
  7994. }
  7995. if (4 == labelPosition) {
  7996. return "" + (Math.sqrt(self.finalSize(self._defaultSize, self._symbol).call(this, data, index, groupIndex)) / 2 + padding) + "px";
  7997. }
  7998. if (5 == labelPosition) {
  7999. return "" + (Math.sqrt(self.finalSize(self._defaultSize, self._symbol).call(this, data, index, groupIndex)) / 2) + "px";
  8000. }
  8001. return "0em";
  8002. };
  8003. },
  8004. getYOffset : function() {
  8005. var self = this;
  8006. return function(data, index, groupIndex) {
  8007. var padding = 5;
  8008. if ((!self._itemLabelPosition)) {
  8009. return "0.3em";
  8010. }
  8011. var labelPosition = self._itemLabelPosition.call(this, data, index, groupIndex);
  8012. if (0 == labelPosition) {
  8013. return "-" + (Math.sqrt(self.finalSize(self._defaultSize, self._symbol).call(this, data, index, groupIndex)) / 2 + padding) + "px";
  8014. }
  8015. if (2 == labelPosition) {
  8016. var fontHeight = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber("1em", 100.0, 10.0);
  8017. return "" + (Math.sqrt(self.finalSize(self._defaultSize, self._symbol).call(this, data, index, groupIndex)) / 2 + fontHeight + padding) + "px";
  8018. }
  8019. if (5 == labelPosition) {
  8020. return "-" + (Math.sqrt(self.finalSize(self._defaultSize, self._symbol).call(this, data, index, groupIndex)) / 2) + "px";
  8021. }
  8022. return "0.3em";
  8023. };
  8024. },
  8025. /**
  8026. * @param (java.lang.Object[]) data The new data
  8027. */
  8028. /** @expose */
  8029. data : function(data) {
  8030. this._data = data;
  8031. return this;
  8032. },
  8033. /**
  8034. * @param (rave['internal']['SingleValueFunction']) independentAccessor The new independent accessor
  8035. */
  8036. /** @expose */
  8037. independentAccessor : function(independentAccessor) {
  8038. this._independentAccessor = independentAccessor;
  8039. return this;
  8040. },
  8041. /**
  8042. * @param (rave['library']['internal']['CoordinateScaleImpl']) independentScale The new independent scale
  8043. */
  8044. /** @expose */
  8045. independentScale : function(independentScale) {
  8046. this._independentScale = independentScale;
  8047. return this;
  8048. },
  8049. /**
  8050. * @param (rave['internal']['SingleValueFunction']) dependentAccessor The new dependent accessor
  8051. */
  8052. /** @expose */
  8053. dependentAccessor : function(dependentAccessor) {
  8054. this._dependentAccessor = dependentAccessor;
  8055. return this;
  8056. },
  8057. /**
  8058. * @param (rave['library']['internal']['CoordinateScaleImpl']) dependentScale The new dependent scale
  8059. */
  8060. /** @expose */
  8061. dependentScale : function(dependentScale) {
  8062. this._dependentScale = dependentScale;
  8063. return this;
  8064. },
  8065. /**
  8066. * @param (rave['library']['internal']['Palette']) colorPalette The new colorPalette
  8067. */
  8068. /** @expose */
  8069. colorPalette : function(colorPalette) {
  8070. this._colorPalette = colorPalette;
  8071. return this;
  8072. },
  8073. /**
  8074. * @param (rave['internal']['SingleValueFunction']) sizeAccessor The new sizeAccessor
  8075. */
  8076. /** @expose */
  8077. sizeAccessor : function(sizeAccessor) {
  8078. this._sizeAccessor = sizeAccessor;
  8079. return this;
  8080. },
  8081. /**
  8082. * @param (rave['internal']['AbstractScale']) sizeScale The new sizeScale
  8083. */
  8084. /** @expose */
  8085. sizeScale : function(sizeScale) {
  8086. this._sizeScale = sizeScale;
  8087. return this;
  8088. },
  8089. /**
  8090. * @param (rave['internal']['SingleValueFunction']) labelAccessor The new labelAccessor
  8091. */
  8092. /** @expose */
  8093. labelAccessor : function(labelAccessor) {
  8094. this._labelAccessor = labelAccessor;
  8095. return this;
  8096. },
  8097. /**
  8098. * @param (rave['internal']['ValueFunction']) labelFormatter The new labelFormatter
  8099. */
  8100. /** @expose */
  8101. labelFormatter : function(labelFormatter) {
  8102. this._labelFormatter = labelFormatter;
  8103. return this;
  8104. },
  8105. /**
  8106. * @param (rave['internal']['ValueFunction']) labelPosition Function to be used to determine label position
  8107. */
  8108. /** @expose */
  8109. itemLabelPosition : function(labelPosition) {
  8110. this._itemLabelPosition = labelPosition;
  8111. return this;
  8112. },
  8113. /**
  8114. * @param (rave['internal']['RectStruct']) bounds The new bounds
  8115. */
  8116. /** @expose */
  8117. bounds : function(bounds) {
  8118. this._bounds = bounds;
  8119. return this;
  8120. },
  8121. /**
  8122. * @param (boolean) transpose The new transpose
  8123. */
  8124. /** @expose */
  8125. transpose : function(transpose) {
  8126. this._transpose = transpose;
  8127. return this;
  8128. },
  8129. /**
  8130. * @param (double) defaultSize The new defaultSize
  8131. */
  8132. /** @expose */
  8133. defaultSize : function(defaultSize) {
  8134. this._defaultSize = defaultSize;
  8135. return this;
  8136. },
  8137. /** @expose */
  8138. itemLabel : function(itemLabel) {
  8139. this._itemLabel = itemLabel;
  8140. return this;
  8141. },
  8142. /** @expose */
  8143. labelFont : function(labelFont) {
  8144. this._labelFontStyle = labelFont;
  8145. return this;
  8146. },
  8147. /**
  8148. * @param (boolean) itemOverlap The new itemOverlap
  8149. */
  8150. /** @expose */
  8151. itemOverlap : function(itemOverlap) {
  8152. this._itemOverlap = itemOverlap;
  8153. return this;
  8154. },
  8155. /**
  8156. * @param (String) symbol The new symbol
  8157. */
  8158. /** @expose */
  8159. symbol : function(symbol) {
  8160. this._prevSymbol = this._symbol;
  8161. this._symbol = symbol;
  8162. return this;
  8163. },
  8164. /**
  8165. * @param (String) effect The new effect
  8166. */
  8167. /** @expose */
  8168. effect : function(effect) {
  8169. this._effect = effect;
  8170. return this;
  8171. },
  8172. /** @expose */
  8173. borderWidth : function(borderWidth) {
  8174. this._borderWidth = borderWidth;
  8175. return this;
  8176. },
  8177. /** @expose */
  8178. borderColor : function(borderColor) {
  8179. this._borderColor = borderColor;
  8180. return this;
  8181. },
  8182. /**
  8183. * @param (String) className - the class name for labelslayer. If not set, the default is ".element-label-group" return this
  8184. */
  8185. /** @expose */
  8186. labelLayerClassName : function(className) {
  8187. this._labelLayerClass = className;
  8188. return this;
  8189. },
  8190. /**
  8191. * @param (String) className - the class name for elementslayer. If not set, the default is ".element-group" return this
  8192. */
  8193. /** @expose */
  8194. elementLayerClassName : function(className) {
  8195. this._elementLayerClass = className;
  8196. return this;
  8197. },
  8198. /**
  8199. * @param (boolean) labelContrast {boolean} whether to contrast the label color with background/background element color.
  8200. * @return (com.ibm.rave.bundles.components.PointComponentImpl) this
  8201. */
  8202. /** @expose */
  8203. labelContrast : function(labelContrast) {
  8204. this._labelContrast = labelContrast;
  8205. return this;
  8206. },
  8207. /**
  8208. * @param (boolean) labelShadow {boolean} whether to show a label shadow with a contrast label color.
  8209. * @return (com.ibm.rave.bundles.components.PointComponentImpl) this
  8210. */
  8211. /** @expose */
  8212. labelShadow : function(labelShadow) {
  8213. this._labelShadow = labelShadow;
  8214. return this;
  8215. }
  8216. });
  8217. /** @expose */
  8218. com_ibm_rave_bundles_components_PointComponentImpl.SECONDARY_ELEMENT = "element-shape-secondary";
  8219. /** @expose */
  8220. com_ibm_rave_bundles_components_PointComponentImpl.LABEL_POSITION_TOP = 0;
  8221. /** @expose */
  8222. com_ibm_rave_bundles_components_PointComponentImpl.LABEL_POSITION_CENTER = 1;
  8223. /** @expose */
  8224. com_ibm_rave_bundles_components_PointComponentImpl.LABEL_POSITION_BOTTOM = 2;
  8225. /** @expose */
  8226. com_ibm_rave_bundles_components_PointComponentImpl.LABEL_POSITION_LEFT = 3;
  8227. /** @expose */
  8228. com_ibm_rave_bundles_components_PointComponentImpl.LABEL_POSITION_RIGHT = 4;
  8229. /** @expose */
  8230. com_ibm_rave_bundles_components_PointComponentImpl.LABEL_POSITION_TOP_RIGHT = 5;
  8231. // $source: com/ibm/rave/bundles/components/FilterComponentImpl
  8232. /************************************************************************
  8233. ** IBM Confidential
  8234. **
  8235. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8236. **
  8237. ** (C) Copyright IBM Corp. 2017
  8238. **
  8239. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8240. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8241. ************************************************************************/
  8242. // GENERATED
  8243. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  8244. var com_ibm_rave_bundles_components_FilterComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  8245. //_id : null,
  8246. //color : null,
  8247. offset_x : 0,
  8248. offset_y : 0,
  8249. blur_radius : 0,
  8250. /** @expose */
  8251. constructor : function(id) {
  8252. this._id = id;
  8253. },
  8254. /** @expose */
  8255. setDropshadow : function(offset_x, offset_y, radius, rgb) {
  8256. this.offset_x = this.getValue(offset_x);
  8257. this.offset_y = this.getValue(offset_y);
  8258. this.blur_radius = this.getValue(radius);
  8259. this.color = rgb;
  8260. },
  8261. getValue : function(s) {
  8262. if (s == null) {
  8263. return 0;
  8264. }
  8265. return + (s.substring(0, s.length - 2));
  8266. },
  8267. /** @expose */
  8268. execute : function(g) {
  8269. var s = g.selectAll("#" + this._id).data([0]);
  8270. var filter = s.enter().append("filter").attr("id", this._id).attr("height", "500%").attr("width", "500%");
  8271. filter.append("feGaussianBlur").attr("in", "SourceAlpha");
  8272. filter.append("feOffset").attr("result", "offsetBlur");
  8273. filter.append("feFlood");
  8274. filter.append("feComposite").attr("in2", "offsetBlur").attr("operator", "in");
  8275. var merge = filter.append("feMerge");
  8276. merge.append("feMergeNode");
  8277. merge.append("feMergeNode").attr("in", "SourceGraphic");
  8278. s.select("feGaussianBlur").attr("stdDeviation", this.blur_radius);
  8279. s.select("feOffset").attr("dx", this.offset_x).attr("dy", this.offset_y);
  8280. s.select("feFlood").attr("flood-color", !this.color ? "black" : this.color);
  8281. },
  8282. /** @expose */
  8283. type : function() {
  8284. return "FilterComponent";
  8285. },
  8286. /** @expose */
  8287. getId : function() {
  8288. return this._id;
  8289. }
  8290. });
  8291. // $source: com/ibm/rave/bundles/components/AbstractPathComponent
  8292. /************************************************************************
  8293. ** IBM Confidential
  8294. **
  8295. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8296. **
  8297. ** (C) Copyright IBM Corp. 2017
  8298. **
  8299. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8300. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8301. ************************************************************************/
  8302. // GENERATED
  8303. //@import com/ibm/rave/bundles/components/KeyedBundleComponentImpl (loadtime) // superclass
  8304. //@import com/ibm/rave/bundles/utilities/PathUtils (runtime) // fadeOutIn
  8305. /**
  8306. * Base class for Line and Area components, both of which create similar path-based elements.
  8307. */
  8308. var com_ibm_rave_bundles_components_AbstractPathComponent = rave['internal']['Declare'](com_ibm_rave_bundles_components_KeyedBundleComponentImpl, {
  8309. /**
  8310. * Interpolation Mode (Smoothness of the line)
  8311. */
  8312. /** @expose */
  8313. _interpolateMode : null,
  8314. /**
  8315. * Keep track of the previous Interpolation Mode
  8316. */
  8317. /** @expose */
  8318. _previousInterpolateMode : null,
  8319. constructor : function() {
  8320. this._interpolateMode = rave['internal']['SVGLine'].r2_svg_lineLinear.getKey();
  8321. this._previousInterpolateMode = this._interpolateMode;
  8322. },
  8323. /** @expose */
  8324. updatePath : function(updateSelection, pathFunction) {
  8325. if (this._interpolateMode != null && !(this._interpolateMode == this._previousInterpolateMode)) {
  8326. com_ibm_rave_bundles_utilities_PathUtils.fadeOutIn(updateSelection, pathFunction);
  8327. } else {
  8328. updateSelection.attr("d", pathFunction);
  8329. }
  8330. this._previousInterpolateMode = this._interpolateMode;
  8331. }
  8332. });
  8333. // $source: com/ibm/rave/bundles/components/LineComponentImpl
  8334. /************************************************************************
  8335. ** IBM Confidential
  8336. **
  8337. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8338. **
  8339. ** (C) Copyright IBM Corp. 2017
  8340. **
  8341. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8342. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8343. ************************************************************************/
  8344. // GENERATED
  8345. //@import com/ibm/rave/bundles/components/AbstractPathComponent (loadtime) // superclass
  8346. //@import com/ibm/rave/bundles/component/LineComponent (runtime) // LineComponent
  8347. /**
  8348. * <p> A component to draw line charts. The component puts its shapes into the selector passed to its execute method. </p> <p> The data array passed to the component has one entry per line to be drawn. Each entry has two properties. Accessors are used to get these properties from the object. Their roles are: </p> <ul> <li> <b>points</b>: Required, an array (ArrayEx). This array is passed to a line path generator, so each entry is a point in the line. The default line path accessors may be used (each entry is an array of x,y); the line component has optional accessors for these two properties. </li> <li> <b>color</b>: A color value. Optional, a single value which if defined is used with the color scale to color the lines. </li> </ul> <p> The component properties are: </p> <p> <b>data</b>: An array with one entry per line, structured as described above. If null, no lines are drawn. </p> <p> <b>pointsAccessor</b>: A value function applied to an entry in the data array, returning the value of the <b>points</b> role (the array of points). If null, no lines are drawn. The default implementation assumes the entry is an object (OMap) and gets and gets the "points" property of the object. </p> <p> <b>colorAccessor</b>: A value function applied to an entry in the data array, returning the value for the <b>color</b> role. If null, the line is drawn but not colored. The default implementation assumes the entry is an object (OMap) and gets the "color" property of the object. </p> <p> <b>independentAccessor</b>: A value function applied to a point object to get the independent value. If null, no lines are drawn. The default implementation assumes each point is an array and returns the first object (as in the default line generator). </p> <p> <b>independentScale</b>: A scale applied to the independent value of the point to get the pixel coordinate for drawing the line. If null, no lines are drawn. The default is null. </p> <p> <b>dependentAccessor</b>: A value function applied to a point object to get the dependent value. If null, no lines are drawn. The default implementation assumes each point is an array and returns the second object (as in the default line generator). </p> <p> <b>dependentScale</b>: A scale applied to the dependent value of the point to get the pixel coordinate for drawing the line. If null, no lines are drawn. The default is null. </p> <p> <b>colorScale</b>: A scale applied to the value in the <b>color</b> role to get a color value for drawing the line. If null or if it returns null, the line is drawn in the primary color. </p> <p> <b>primaryColor</b>: The color used to draw the line when the line has no color or there is no color scale. If null, the line is drawn but not colored, and the CSS style will be used. </p> <p> <b>transpose</b>: A boolean. If false the categorical data is shown on the X axis and the linear data on the Y; if true they are swapped. Default false. </p> <p> <b>effect</b>: A string. If non-null, requests an entrance effect. The only supported entrance effect is "fromBase", where the line grows up from the dependent axis zero; any other value is treated as null. This property is cleared to null on each render, for convenience in setting up zooming. Default null. </p>
  8349. */
  8350. var com_ibm_rave_bundles_components_LineComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_AbstractPathComponent, {
  8351. /**
  8352. * Data
  8353. */
  8354. //_data : null,
  8355. /**
  8356. * Accessor for points role
  8357. */
  8358. //_pointsAccessor : null,
  8359. /**
  8360. * Accessor for color role
  8361. */
  8362. //_groupAccessor : null,
  8363. /**
  8364. * Accessor for independent variable from a point
  8365. */
  8366. //_independentAccessor : null,
  8367. /**
  8368. * Independent variable scale
  8369. */
  8370. //_independentScale : null,
  8371. /**
  8372. * Accessor for dependent variable from a point
  8373. */
  8374. //_dependentAccessor : null,
  8375. /**
  8376. * Dependent scale
  8377. */
  8378. //_dependentScale : null,
  8379. /**
  8380. * Color scale
  8381. */
  8382. //_colorPalette : null,
  8383. /**
  8384. * Effect, only "fromBase" supported
  8385. */
  8386. //_effect : null,
  8387. /**
  8388. * Accessor for checking to see if Y value is null
  8389. */
  8390. //_definedAccessor : null,
  8391. /**
  8392. * Transpose
  8393. */
  8394. _transpose : false,
  8395. /**
  8396. * Show gaps for missing data
  8397. */
  8398. _showMissingAsGap : false,
  8399. /**
  8400. * Initialize all properties to default values.
  8401. */
  8402. /** @expose */
  8403. constructor : function() {
  8404. this._data = null;
  8405. this._interpolateMode = null;
  8406. this._pointsAccessor = function(data) {
  8407. return (data)["points"];
  8408. };
  8409. this._groupAccessor = null;
  8410. this._independentAccessor = function(data) {
  8411. return (data)[0];
  8412. };
  8413. this._independentScale = null;
  8414. this._dependentAccessor = function(data) {
  8415. return (data)[1];
  8416. };
  8417. var self = this;
  8418. this._definedAccessor = function(data) {
  8419. return (self._dependentAccessor(data) != null) && (self._independentAccessor(data) != null);
  8420. };
  8421. this._dependentScale = null;
  8422. this._colorPalette = null;
  8423. this._transpose = false;
  8424. this._effect = null;
  8425. this._showMissingAsGap = true;
  8426. },
  8427. /** @expose */
  8428. type : function() {
  8429. return com_ibm_rave_bundles_component_LineComponent.COMPONENT_TYPE;
  8430. },
  8431. /** @expose */
  8432. execute : function(g) {
  8433. this.preExecute();
  8434. if (!this._data || !this._pointsAccessor || !this._independentAccessor || !this._independentScale || !this._dependentAccessor || !this._dependentScale) {
  8435. g.selectAll("*").remove();
  8436. return;
  8437. }
  8438. var self = this;
  8439. var independent = function(data, index, groupIndex) {
  8440. return self._independentScale.center(self._independentAccessor(data));
  8441. };
  8442. var dependent = function(data, index, groupIndex) {
  8443. return self._dependentScale.center(self._dependentAccessor(data));
  8444. };
  8445. var definedAccessorY = function(data, index, groupIndex) {
  8446. return (self._definedAccessor(data));
  8447. };
  8448. var line = rave.svg.line().x(this._transpose ? dependent : independent).y(this._transpose ? independent : dependent).showMissingAsGap(this._showMissingAsGap);
  8449. var lineFunction = function(d, index, groupIndex) {
  8450. return line.call(this, self._pointsAccessor(d), index, groupIndex);
  8451. };
  8452. line.defined(definedAccessorY);
  8453. line.interpolate(this._interpolateMode);
  8454. var lines = g.selectAll("path.element-shape").data(this._data, this._groupAccessor ? function(data, index, groupIndex) {
  8455. return self._groupAccessor(data);
  8456. } : null);
  8457. lines.exit().remove();
  8458. var enter = lines.enter();
  8459. if (enter.size() > 0) {
  8460. enter = enter.append("path").attr("class", "element-shape").style("stroke", this._colorPalette);
  8461. if ("fromBase" == this._effect) {
  8462. var dependentZero = function(data, index, groupIndex) {
  8463. return self._dependentScale.center(0.0);
  8464. };
  8465. var zeroLine = rave.svg.line().x(this._transpose ? dependentZero : independent).y(this._transpose ? independent : dependentZero);
  8466. zeroLine.defined(definedAccessorY);
  8467. enter.attr("d", function(d, index, groupIndex) {
  8468. return zeroLine.call(this, self._pointsAccessor(d), index, groupIndex);
  8469. });
  8470. } else {
  8471. enter.attr("d", lineFunction);
  8472. }
  8473. }
  8474. var linesUpdate = rave.transition(lines).style("stroke", this._colorPalette);
  8475. this.updatePath(linesUpdate, lineFunction);
  8476. this._effect = null;
  8477. },
  8478. /**
  8479. * @param (java.lang.Object[]) data The new data
  8480. */
  8481. /** @expose */
  8482. data : function(data) {
  8483. this._data = data;
  8484. return this;
  8485. },
  8486. /**
  8487. * @param (rave['internal']['SingleValueFunction']) pointsAccessor The new pointsAccessor
  8488. */
  8489. /** @expose */
  8490. pointsAccessor : function(pointsAccessor) {
  8491. this._pointsAccessor = pointsAccessor;
  8492. return this;
  8493. },
  8494. /**
  8495. * @param (rave['internal']['SingleValueFunction']) groupAccessor The new groupAccessor
  8496. */
  8497. /** @expose */
  8498. groupAccessor : function(groupAccessor) {
  8499. this._groupAccessor = groupAccessor;
  8500. return this;
  8501. },
  8502. /**
  8503. * @param (rave['internal']['SingleValueFunction']) independentAccessor The new independent accessor
  8504. */
  8505. /** @expose */
  8506. independentAccessor : function(independentAccessor) {
  8507. this._independentAccessor = independentAccessor;
  8508. return this;
  8509. },
  8510. /**
  8511. * @param (rave['library']['internal']['CoordinateScaleImpl']) independentScale The new independent scale
  8512. */
  8513. /** @expose */
  8514. independentScale : function(independentScale) {
  8515. this._independentScale = independentScale;
  8516. return this;
  8517. },
  8518. /**
  8519. * @param (rave['internal']['SingleValueFunction']) dependentAccessor The new dependent accessor
  8520. */
  8521. /** @expose */
  8522. dependentAccessor : function(dependentAccessor) {
  8523. this._dependentAccessor = dependentAccessor;
  8524. return this;
  8525. },
  8526. /**
  8527. * @param (rave['internal']['SingleValueFunction']) definedAccessor The new defined accessor
  8528. */
  8529. /** @expose */
  8530. definedAccessor : function(definedAccessor) {
  8531. this._definedAccessor = definedAccessor;
  8532. return this;
  8533. },
  8534. /**
  8535. * @param (rave['library']['internal']['CoordinateScaleImpl']) dependentScale The new dependent scale
  8536. */
  8537. /** @expose */
  8538. dependentScale : function(dependentScale) {
  8539. this._dependentScale = dependentScale;
  8540. return this;
  8541. },
  8542. /**
  8543. * @param (rave['library']['internal']['Palette']) colorPalette The new color palette
  8544. */
  8545. /** @expose */
  8546. colorPalette : function(colorPalette) {
  8547. this._colorPalette = colorPalette ? colorPalette : null;
  8548. return this;
  8549. },
  8550. /**
  8551. * @param (boolean) transpose The new transpose
  8552. */
  8553. /** @expose */
  8554. transpose : function(transpose) {
  8555. this._transpose = transpose;
  8556. return this;
  8557. },
  8558. /**
  8559. * @param (String) effect The new effect
  8560. */
  8561. /** @expose */
  8562. effect : function(effect) {
  8563. this._effect = effect;
  8564. return this;
  8565. },
  8566. /**
  8567. * Configure whether lines generated should show a gap (line break) if a value is missing
  8568. * @param (boolean) state true (default) for a gap, false for a line across missing values
  8569. */
  8570. /** @expose */
  8571. showMissingAsGap : function(state) {
  8572. this._showMissingAsGap = state;
  8573. return this;
  8574. },
  8575. /**
  8576. * @param (String) mode sets the interpolation mode that makes the line of the area chart smooth or jagged.
  8577. */
  8578. /** @expose */
  8579. interpolate : function(mode) {
  8580. this._interpolateMode = mode;
  8581. return this;
  8582. }
  8583. });
  8584. // $source: com/ibm/rave/bundles/components/RadarBackgroundComponentImpl
  8585. /************************************************************************
  8586. ** IBM Confidential
  8587. **
  8588. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8589. **
  8590. ** (C) Copyright IBM Corp. 2017
  8591. **
  8592. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8593. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8594. ************************************************************************/
  8595. // GENERATED
  8596. //@import com/ibm/rave/bundles/components/BackgroundComponentImpl (loadtime) // superclass
  8597. var com_ibm_rave_bundles_components_RadarBackgroundComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BackgroundComponentImpl, {
  8598. //_ticks : null,
  8599. //_bounds : null,
  8600. //_spokeData : null,
  8601. _radius : 0,
  8602. _zoomScale : 1,
  8603. /** @expose */
  8604. execute : function(g) {
  8605. if (!this._spokeData || this._spokeData.length == 0) {
  8606. g.selectAll("*").remove();
  8607. return;
  8608. }
  8609. g.attr("transform", "translate(" + (this._bounds.x + this._bounds.width / 2) + "," + (this._bounds.y + this._bounds.height / 2) + ")");
  8610. this._radius = Math.min(this._bounds.width / 2, this._bounds.height / 2) * 0.85 * this._zoomScale;
  8611. var gridline = g.selectAll(".gridline").data(this._ticks);
  8612. var tickSize = this._ticks.length;
  8613. var enter = gridline.enter().append("g").attr("class", "gridline").classed("axis", function(data, index, groupIndex) {
  8614. return index == tickSize - 1;
  8615. }).classed("grid", function(data, index, groupIndex) {
  8616. return index != tickSize - 1;
  8617. });
  8618. enter.append("path").attr("class", "grid").attr("d", this.getGridlinePos(true));
  8619. enter.append("text").attr("class", "tick").attr("x", 0).attr("y", 0);
  8620. enter.append("line").attr("class", "grid-tick-line").attr("x1", 0).attr("y1", 0).attr("x2", 0).attr("y2", 0);
  8621. var fontChecker = rave.capabilities.extension("fontchecker");
  8622. rave.transition(gridline.select(".grid")).attr("d", this.getGridlinePos(false));
  8623. var tickLabels = gridline.select(".tick").text(this.getLabel());
  8624. if (fontChecker) {
  8625. tickLabels.call(fontChecker);
  8626. }
  8627. rave.transition(tickLabels).attr("x", this.getTickPos("x", true)).attr("y", this.getTickPos("y", false));
  8628. rave.transition(gridline.select(".grid-tick-line")).attr("x1", this.getTickPos("x", false)).attr("y1", this.getTickPos("y", false)).attr("x2", this.getTickPos("x", true)).attr("y2", this.getTickPos("y", false));
  8629. gridline.exit().remove();
  8630. var spoke = g.selectAll(".spoke").data(this._spokeData);
  8631. var spokeEnter = spoke.enter().append("g").attr("class", "spoke").classed("axis", function(data, index, groupIndex) {
  8632. return index == 0;
  8633. }).classed("grid", function(data, index, groupIndex) {
  8634. return index != 0;
  8635. });
  8636. spokeEnter.append("line").attr("class", "spoke-line").attr("x1", 0).attr("y1", 0).attr("x2", 0).attr("y2", 0);
  8637. spokeEnter.append("line").attr("class", "spoke-tick-line").attr("x1", 0).attr("y1", 0).attr("x2", 0).attr("y2", 0);
  8638. spokeEnter.append("text").attr("class", "spoke-label").attr("x", 0).attr("y", 0);
  8639. rave.transition(spoke.select(".spoke-line")).attr("x2", this.getSpokePos("x2", false)).attr("y2", this.getSpokePos("y2", false));
  8640. rave.transition(spoke.select(".spoke-tick-line")).attr("x1", this.getSpokePos("x2", false)).attr("y1", this.getSpokePos("y2", false)).attr("x2", this.getSpokePos("x2", true)).attr("y2", this.getSpokePos("y2", true));
  8641. var spokeLabels = spoke.select(".spoke-label").text(this.getLabel());
  8642. if (fontChecker) {
  8643. spokeLabels.call(fontChecker);
  8644. }
  8645. var self = this;
  8646. spokeLabels.attr("width", function(data, index, groupIndex) {
  8647. var theta = ((2 * Math.PI) * index) / self._spokeData.length;
  8648. var sinValue = Math.sin(theta) * (theta < Math.PI ? 1 : -1);
  8649. var maxWidth = (self._bounds.width / 2) - (self._radius * sinValue);
  8650. maxWidth = maxWidth / 1.1;
  8651. return maxWidth + "px";
  8652. });
  8653. var textflow = rave.capabilities.extension("textflow");
  8654. textflow.wrap(false).fit(false).truncate(true);
  8655. spokeLabels.call(textflow);
  8656. rave.transition(spokeLabels).attr("transform", this.getSpokeLabelPosAsTranslate()).style("text-anchor", this.getSpokeLabelAnchor());
  8657. spoke.exit().remove();
  8658. },
  8659. getGridlinePos : function(entrance) {
  8660. var factor = this._radius / this._ticks.length;
  8661. var count = this._spokeData.length;
  8662. return function(d, index, groupIndex) {
  8663. var result = "M";
  8664. for (var j = 0; j <= count; ++j) {
  8665. if (j > 0) {
  8666. result = result + "L";
  8667. }
  8668. if (entrance) {
  8669. result = result + "0 , 0";
  8670. } else {
  8671. result = result + (-1 * factor * (index + 1) * Math.sin(2 * j * Math.PI / count)) + "," + (-1 * factor * (index + 1) * Math.cos(2 * j * Math.PI / count));
  8672. }
  8673. }
  8674. return result + "Z";
  8675. };
  8676. },
  8677. getSpokePos : function(type, ticks) {
  8678. var self = this;
  8679. var factor = 2 * Math.PI / self._spokeData.length;
  8680. return function(d, index, groupIndex) {
  8681. if (type == "x2") {
  8682. if (ticks) {
  8683. var value = -1 * (self._radius + com_ibm_rave_bundles_components_RadarBackgroundComponentImpl._tickSize) * Math.sin(index * factor);
  8684. return value;
  8685. }
  8686. var value = -1 * self._radius * Math.sin(index * factor);
  8687. return value;
  8688. }
  8689. if (ticks) {
  8690. var value = -1 * (self._radius + com_ibm_rave_bundles_components_RadarBackgroundComponentImpl._tickSize) * Math.cos(index * factor);
  8691. return value;
  8692. }
  8693. var value = -1 * self._radius * Math.cos(index * factor);
  8694. return value;
  8695. };
  8696. },
  8697. getSpokeLabelPosAsTranslate : function() {
  8698. var self = this;
  8699. var factor = 2 * Math.PI / this._spokeData.length;
  8700. return function(d, index, groupIndex) {
  8701. var x = -1.1 * self._radius * Math.sin(index * factor);
  8702. var y = -1.1 * self._radius * Math.cos(index * factor);
  8703. return "translate(" + x + "," + y + ")";
  8704. };
  8705. },
  8706. getSpokeLabelAnchor : function() {
  8707. var factor = 2 * Math.PI / this._spokeData.length;
  8708. return function(d, index, groupIndex) {
  8709. var angle = index * factor;
  8710. if (angle == 0 || angle == Math.PI) {
  8711. return "middle";
  8712. }
  8713. return angle < Math.PI ? "end" : "start";
  8714. };
  8715. },
  8716. getTickPos : function(type, ticks) {
  8717. var factor = this._radius / this._ticks.length;
  8718. return function(d, index, groupIndex) {
  8719. if (type == "x") {
  8720. if (ticks) {
  8721. return com_ibm_rave_bundles_components_RadarBackgroundComponentImpl._tickSize;
  8722. }
  8723. return 0;
  8724. }
  8725. var value = -1 * factor * (index + 1) * Math.cos(0);
  8726. if (ticks) {
  8727. return value + com_ibm_rave_bundles_components_RadarBackgroundComponentImpl._tickSize;
  8728. }
  8729. return value;
  8730. };
  8731. },
  8732. getLabel : function() {
  8733. return function(d, index, groupIndex) {
  8734. return d;
  8735. };
  8736. },
  8737. /** @expose */
  8738. type : function() {
  8739. return "RadarBackgroundComponent";
  8740. },
  8741. /** @expose */
  8742. ticks : function(ticks) {
  8743. this._ticks = ticks;
  8744. return this;
  8745. },
  8746. /** @expose */
  8747. bounds : function(bounds) {
  8748. this._bounds = bounds;
  8749. return this;
  8750. },
  8751. /** @expose */
  8752. spokeData : function(data) {
  8753. this._spokeData = data;
  8754. return this;
  8755. },
  8756. /** @expose */
  8757. zoomScale : function(scale) {
  8758. this._zoomScale = scale;
  8759. return this;
  8760. }
  8761. });
  8762. com_ibm_rave_bundles_components_RadarBackgroundComponentImpl._tickSize = 10;
  8763. })();
  8764. },{"./configuration/configuration.json":1,"./i18n/messages_en.json":2,"./vizlibrary-radar.css":4,"./vizlibrary.css":5}],4:[function(require,module,exports){
  8765. var css = ".vizlibrary-radar .element-path {\n fill: none;\n stroke-width: 2;\n stroke-opacity: 1;\n}\n.vizlibrary-radar .grid {\n stroke-width: 0.5px;\n stroke-opacity: 0.75;\n fill: none;\n}\n.vizlibrary-radar .tick {\n fill: #737373;\n font-size: 10px;\n}\n.vizlibrary-radar .spoke-line {\n stroke: grey;\n stroke-width: 0.5px;\n stroke-opacity: 0.75;\n}\n.vizlibrary-radar .spoke-label {\n font-size: 11px;\n}\n.vizlibrary-radar .spoke-tick-line,\n.vizlibrary-radar .grid-tick-line {\n stroke-width: 0.5px;\n}\n"; (require("browserify-css").createStyle(css, { "href": "dist/bundles/rave-library-radar/node/rave-library-radar/vizlibrary-radar.css"})); module.exports = css;
  8766. },{"browserify-css":6}],5:[function(require,module,exports){
  8767. 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-radar/node/rave-library-radar/vizlibrary.css"})); module.exports = css;
  8768. },{"browserify-css":6}],6:[function(require,module,exports){
  8769. 'use strict';
  8770. // For more information about browser field, check out the browser field at https://github.com/substack/browserify-handbook#browser-field.
  8771. module.exports = {
  8772. // Create a <link> tag with optional data attributes
  8773. createLink: function(href, attributes) {
  8774. var head = document.head || document.getElementsByTagName('head')[0];
  8775. var link = document.createElement('link');
  8776. link.href = href;
  8777. link.rel = 'stylesheet';
  8778. for (var key in attributes) {
  8779. if ( ! attributes.hasOwnProperty(key)) {
  8780. continue;
  8781. }
  8782. var value = attributes[key];
  8783. link.setAttribute('data-' + key, value);
  8784. }
  8785. head.appendChild(link);
  8786. },
  8787. // Create a <style> tag with optional data attributes
  8788. createStyle: function(cssText, attributes) {
  8789. var head = document.head || document.getElementsByTagName('head')[0],
  8790. style = document.createElement('style');
  8791. style.type = 'text/css';
  8792. for (var key in attributes) {
  8793. if ( ! attributes.hasOwnProperty(key)) {
  8794. continue;
  8795. }
  8796. var value = attributes[key];
  8797. style.setAttribute('data-' + key, value);
  8798. }
  8799. if (style.sheet) { // for jsdom and IE9+
  8800. style.innerHTML = cssText;
  8801. style.sheet.cssText = cssText;
  8802. head.appendChild(style);
  8803. } else if (style.styleSheet) { // for IE8 and below
  8804. head.appendChild(style);
  8805. style.styleSheet.cssText = cssText;
  8806. } else { // for Chrome, Firefox, and Safari
  8807. style.appendChild(document.createTextNode(cssText));
  8808. head.appendChild(style);
  8809. }
  8810. }
  8811. };
  8812. },{}]},{},[3]);
  8813. return rave.library.bundle.extension('radarBundle');
  8814. }));