rave-library-tiledmapV2.js 520 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665
  1. ;(function(root, factory) {
  2. if (typeof define === 'function' && define.amd) {
  3. define(['rave', 'rave-library', 'rave-utilities', 'rave-legends', 'mapboxgl'], factory);
  4. } else if (typeof exports === 'object') {
  5. module.exports = factory(require('rave'), require('rave-library'), require('rave-utilities'), require('rave-legends'), require('mapboxgl'));
  6. } else {
  7. root.raveLibraryTiledmapV2 = factory(root.rave, root.raveLibrary, root.raveUtilities, root.raveLegends, root.mapboxgl);
  8. }
  9. }(this, function(rave, raveLibrary, raveUtilities, raveLegends, mapboxgl) {
  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_map_small.png","tags":["small","notext"]}],"svg":[{"file":"resources\/preview_map_small.svg","tags":["small","notext"]}]},"genericMeta":{"copyright":"IBM 2017","author":"IBM","description":"tiledmap.description","id":"rave-library-tiledmapV2","label":"tiledmap.label","version":"1.0.0","tags":["map"]}},{"datamodels":[{"description":"datamodel.multitable.map.description","id":"multiTable","label":"datamodel.multitable.map.label","datasets":[{"dataslots":[{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/map_32.svg"},"description":"data.region.dataslot.featureLvl1.description","id":"featureLvl1","label":"data.region.dataslot.featureLvl1.label","cardinality":"0..1","datatypes":["numeric","string"],"tags":["subtype:location","useMapbox","refinement:featureLvl3,featureLvl2"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/map_32.svg"},"description":"data.region.dataslot.featureLvl2.description","id":"featureLvl2","label":"data.region.dataslot.featureLvl2.label","cardinality":"0..1","datatypes":["numeric","string"],"tags":["useMapbox"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/map_32.svg"},"description":"data.region.dataslot.featureLvl3.description","id":"featureLvl3","label":"data.region.dataslot.featureLvl3.label","cardinality":"0..1","datatypes":["numeric","string"],"tags":["useMapbox"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/region_color_by_32.svg"},"description":"data.region.dataslot.fill.description","id":"fill","label":"data.region.dataslot.fill.label","cardinality":"0..1","datatypes":["numeric"]}],"description":"dataset.tabular.map.regions.description","id":"data.region","label":"dataset.regions.label","type":"tabular","cardinality":"0..1"},{"dataslots":[{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/map_32.svg"},"description":"data.point.dataslot.featureLvl1.description","id":"featureLvl1","label":"data.point.dataslot.featureLvl1.label","cardinality":"0..1","datatypes":["numeric","string"],"tags":["subtype:location","useMapbox","refinement:featureLvl3,featureLvl2"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/map_32.svg"},"description":"data.point.dataslot.featureLvl2.description","id":"featureLvl2","label":"data.point.dataslot.featureLvl2.label","cardinality":"0..1","datatypes":["numeric","string"],"tags":["useMapbox"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/map_32.svg"},"description":"data.point.dataslot.featureLvl3.description","id":"featureLvl3","label":"data.point.dataslot.featureLvl3.label","cardinality":"0..1","datatypes":["numeric","string"],"tags":["useMapbox"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/size_32.svg"},"description":"data.point.dataslot.pointSize.description","id":"pointSize","label":"data.point.dataslot.pointSize.label","cardinality":"0..1","datatypes":["numeric"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/point_color_by_32.svg"},"description":"data.point.dataslot.pointColor.description","id":"pointColor","label":"data.point.dataslot.pointColor.label","cardinality":"0..1","datatypes":["numeric"]}],"description":"dataset.tabular.map.points.description","id":"data.point","label":"dataset.points.label","type":"tabular","cardinality":"0..1"},{"dataslots":[{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/map_32.svg"},"description":"data.latlong.dataslot.latitude.description","id":"latitude","label":"data.latlong.dataslot.latitude.label","cardinality":"0..1","datatypes":["numeric","object"],"tags":["subtype:latitude","handling:numeric"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/map_32.svg"},"description":"data.latlong.dataslot.longitude.description","id":"longitude","label":"data.latlong.dataslot.longitude.label","cardinality":"0..1","datatypes":["numeric","object"],"tags":["subtype:longitude","handling:numeric"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/map_32.svg"},"description":"data.latlong.dataslot.label.description","id":"label","label":"data.latlong.dataslot.label.label","cardinality":"0..1","datatypes":["string","object"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/size_32.svg"},"description":"data.point.dataslot.pointSize.description","id":"latlongSize","label":"data.point.dataslot.pointSize.label","cardinality":"0..1","datatypes":["numeric"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/point_color_by_32.svg"},"description":"data.point.dataslot.pointColor.description","id":"latlongColor","label":"data.point.dataslot.pointColor.label","cardinality":"0..1","datatypes":["numeric"]}],"description":"dataset.tabular.map.latlong.description","id":"data.latlong","label":"dataset.latlong.label","type":"tabular","cardinality":"0..1"}],"tags":["tiled","map","multitable","ca.reporting"]},{"description":"datamodel.tabular.map.new.description","id":"tabular","label":"datamodel.tabular.map.new.label","datasets":[{"dataslots":[{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/map_32.svg"},"description":"dataslot.map.featureLvl1.description","id":"featureLvl1","label":"dataslot.map.featureLvl1.label","cardinality":"0..1","datatypes":["numeric","string","object"],"tags":["subtype:location","useMapbox","refinement:featureLvl2"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/map_32.svg"},"description":"dataslot.map.featureLvl2.description","id":"featureLvl2","label":"dataslot.map.featureLvl2.label","cardinality":"0..1","datatypes":["numeric","string"],"tags":["subtype:location","useMapbox","refinement:featureLvl3"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/map_32.svg"},"description":"dataslot.map.featureLvl3.description","id":"featureLvl3","label":"dataslot.map.featureLvl3.label","cardinality":"0..1","datatypes":["numeric","string"],"tags":["subtype:location","useMapbox"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/region_color_by_32.svg"},"description":"dataslot.map.value.description","id":"value","label":"dataslot.map.value.label","cardinality":"0..1","datatypes":["numeric"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/size_32.svg"},"description":"dataslot.map.bubbleSize.description","id":"pointSize","label":"dataslot.map.bubbleSize.label","cardinality":"0..1","datatypes":["numeric"]},{"icon":{"image":"..\/rave-library\/resources\/map_32.png","svg":"..\/rave-library\/resources\/point_color_by_32.svg"},"description":"dataslot.map.bubbleColor.description","id":"pointColor","label":"dataslot.map.bubbleColor.label","cardinality":"0..1","datatypes":["numeric"]}],"description":"dataset.tabular.map.new.description","id":"data","label":"dataset.tabular.label","type":"tabular","cardinality":"0..1"}],"tags":["tiled","map","tabular"]}]},{"properties":{"color":{"type":"object","properties":{"null":{"default":"silver","resetView":"layout","name":"color.null.name","description":"color.null.description","type":"color"},"palette":{"default":"rave2.colorpalette.blueContinuousSequential","resetView":"layout","name":"color.palette.name","options":["continuous"],"description":"color.palette.description","type":"palette"},"pointTransparency":{"default":20,"resetView":"layout","name":"color.pointTransparency.name","description":"color.pointTransparency.description","type":"numeric"}}},"tiledmap":{"type":"object","properties":{"geoJson":{"resetView":"data","name":"tiledmap.geoJson.name","description":"tiledmap.geoJson.description","type":"jsonobject"},"maxZoom":{"default":null,"resetView":"layout","name":"tiledmap.maxZoom.name","description":"tiledmap.maxZoom.description","type":"numeric"},"autoZoom":{"default":true,"resetView":"layout","name":"tiledmap.autoZoom.name","description":"tiledmap.autoZoom.description","type":"boolean"},"style":{"default":"mapbox:\/\/style\/mapbox\/light-v9","resetView":"layout","name":"tiledmap.style.name","options":[{"id":"tiledmap.style.options.streets","value":"mapbox:\/\/style\/mapbox\/streets-v9"},{"id":"tiledmap.style.options.basic","value":"mapbox:\/\/style\/mapbox\/basic-v9"},{"id":"tiledmap.style.options.bright","value":"mapbox:\/\/style\/mapbox\/bright-v9"},{"id":"tiledmap.style.options.outdoors","value":"mapbox:\/\/style\/mapbox\/outdoors-v9"},{"id":"tiledmap.style.options.light","value":"mapbox:\/\/style\/mapbox\/light-v9"},{"id":"tiledmap.style.options.dark","value":"mapbox:\/\/style\/mapbox\/dark-v9"},{"id":"tiledmap.style.options.satellite","value":"mapbox:\/\/style\/mapbox\/satellite-v9"}],"description":"tiledmap.style.description","type":"string"},"mapLocale":{"default":null,"resetView":"layout","name":"tiledmap.mapLocale.name","description":"tiledmap.mapLocale.description","type":"string"},"token":{"default":"","name":"tiledmap.token.name","description":"tiledmap.token.description","type":"string"}}},"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"},"latlong":{"type":"object","properties":{"pointcolor":{"type":"object","properties":{"title":{"default":"","resetView":"layout","name":"legend.latlong.pointcolor.title.name","description":"legend.latlong.pointcolor.title.description","type":"string"}}},"pointsize":{"type":"object","properties":{"title":{"default":"","resetView":"layout","name":"legend.latlong.pointsize.title.name","description":"legend.latlong.pointsize.title.description","type":"string"}}}}},"entrystyle":{"type":"object","properties":{"font":{"name":"legend.entrystyle.font.name","description":"legend.entrystyle.font.description","type":"font"}}},"regioncolor":{"type":"object","properties":{"title":{"default":"","resetView":"layout","name":"legend.regioncolor.title.name","description":"legend.regioncolor.title.description","type":"string"}}},"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"},"pointcolor":{"type":"object","properties":{"title":{"default":"","resetView":"layout","name":"legend.pointcolor.title.name","description":"legend.pointcolor.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"}}},"pointsize":{"type":"object","properties":{"title":{"default":"","resetView":"layout","name":"legend.pointsize.title.name","description":"legend.pointsize.title.description","type":"string"}}}}},"maxPointSize":{"default":"20","resetView":"layout","name":"max.point.size.name","description":"max.point.size.description","type":"length"},"latlong":{"type":"object","properties":{"defaultSize":{"resetView":"data","name":"default.latlong.point.size.name","description":"default.latlong.point.size.description","type":"length"},"transparency":{"default":20,"resetView":"layout","name":"color.latlongTransparency.name","description":"color.latlongTransparency.description","type":"numeric"},"palette":{"default":"rave2.colorpalette.blueContinuousSequential","resetView":"layout","name":"color.latlong.palette.name","options":["continuous"],"description":"color.latlong.palette.description","type":"palette"},"minSize":{"default":"5","resetView":"layout","name":"min.latlong.size.name","description":"min.latlong.size.description","type":"length"},"maxSize":{"default":"20","resetView":"layout","name":"max.latlong.size.name","description":"max.latlong.size.description","type":"length"},"staticZeroValueSize":{"default":"5","resetView":"data","name":"static.latlong.zero.value.size.name","description":"static.latlong.zero.value.size.description","type":"length"}}},"staticZeroValuePointSize":{"default":"5","resetView":"data","name":"static.zero.value.size.name","description":"static.zero.value.size.description","type":"length"},"region":{"type":"object","properties":{"mapData":{"resetView":"data","name":"mapData.name","description":"mapData.description","type":"array","items":{"name":"mapData.items","type":"jsonobject","required":false}},"transparency":{"default":20,"resetView":"layout","name":"color.fillTransparency.name","description":"color.fillTransparency.description","type":"numeric"},"custom":{"type":"object","properties":{"propertyName":{"default":"","resetView":"data","name":"custom.region.propertyName.name","description":"custom.region.propertyName.description","type":"string"},"mapId":{"default":"","resetView":"data","name":"custom.region.mapId.name","description":"custom.region.mapId.description","type":"string"},"layerName":{"default":"","resetView":"data","name":"custom.region.layerName.name","description":"custom.region.layerName.description","type":"string"}}},"palette":{"default":"rave2.colorpalette.blueContinuousSequential","resetView":"layout","name":"color.feature.palette.name","options":["continuous"],"description":"color.feature.palette.description","type":"palette"}}},"minPointSize":{"default":"5","resetView":"layout","name":"min.point.size.name","description":"min.point.size.description","type":"length"},"point":{"type":"object","properties":{"mapData":{"resetView":"data","name":"mapData.name","description":"mapData.description","type":"array","items":{"name":"mapData.items","type":"jsonobject","required":false}},"defaultSize":{"resetView":"data","name":"default.point.size.name","description":"default.point.size.description","type":"length"},"transparency":{"default":20,"resetView":"layout","name":"color.pointTransparency.name","description":"color.pointTransparency.description","type":"numeric"},"custom":{"type":"object","properties":{"propertyName":{"default":"","resetView":"data","name":"custom.point.propertyName.name","description":"custom.point.propertyName.description","type":"string"},"mapId":{"default":"","resetView":"data","name":"custom.point.mapId.name","description":"custom.point.mapId.description","type":"string"},"layerName":{"default":"","resetView":"data","name":"custom.point.layerName.name","description":"custom.point.layerName.description","type":"string"}}},"palette":{"default":"rave2.colorpalette.blueContinuousSequential","resetView":"layout","name":"color.point.palette.name","options":["continuous"],"description":"color.point.palette.description","type":"palette"},"minSize":{"default":"5","resetView":"layout","name":"min.point.size.name","description":"min.point.size.description","type":"length"},"maxSize":{"default":"20","resetView":"layout","name":"max.point.size.name","description":"max.point.size.description","type":"length"},"staticZeroValueSize":{"default":"5","resetView":"data","name":"static.zero.value.size.name","description":"static.zero.value.size.description","type":"length"}}}}},{"actions":[{"description":"actions.applyHighlight.description","id":"highlight","label":"actions.applyHighlight.label"},{"description":"actions.removeHighlight.description","id":"unhighlight","label":"actions.removeHighlight.label","tags":[]},{"description":"actions.applySelection.description","id":"select","label":"actions.applySelection.label","tags":[]},{"description":"actions.removeSelection.description","id":"deselect","label":"actions.removeSelection.label","tags":[]},{"description":"actions.removeAllSelect.description","id":"deselectAll","label":"actions.removeAllSelect.label","tags":[]},{"description":"actions.toggleSelect.description","id":"toggleSelect","label":"actions.toggleSelect.label","tags":[]},{"description":"actions.zoom.description","id":"zoom","label":"actions.zoom.label","tags":[]},{"description":"actions.locate.description","id":"locate","label":"actions.locate.label","tags":[]}]},{"properties":{"layout":{"type":"object","properties":{"padding":{"default":"10","resetView":"layout","name":"layout.padding.name","description":"layout.padding.description","type":"padding"},"legendsize":{"type":"object","properties":{"min":{"default":"0","resetView":"layout","name":"layout.legendsize.min.name","description":"layout.legendsize.min.description","type":"length"},"max":{"default":"20%","resetView":"layout","name":"layout.legendsize.max.name","description":"layout.legendsize.max.description","type":"length"},"preferred":{"default":"20%","resetView":"layout","name":"layout.legendsize.preferred.name","description":"layout.legendsize.preferred.description","type":"length"}}},"legendchart":{"type":"object","properties":{"gap":{"default":"10","resetView":"layout","name":"layout.legendchart.gap.name","description":"layout.legendchart.gap.description","type":"length"},"align":{"default":false,"resetView":"layout","name":"layout.legendchart.align.name","description":"layout.legendchart.align.description","type":"boolean"}}},"chart":{"type":"object","properties":{"padding":{"type":"object","properties":{"top":{"default":"0","resetView":"layout","name":"layout.chart.padding.top.name","description":"layout.chart.padding.top.description","type":"length"},"left":{"default":"0","resetView":"layout","name":"layout.chart.padding.left.name","description":"layout.chart.padding.left.description","type":"length"},"bottom":{"default":"0","resetView":"layout","name":"layout.chart.padding.bottom.name","description":"layout.chart.padding.bottom.description","type":"length"},"right":{"default":"0","resetView":"layout","name":"layout.chart.padding.right.name","description":"layout.chart.padding.right.description","type":"length"}}}}}}}}},{"propertyPresentations":[{"presentationItems":[{"propertyID":"tiledmap.token"},{"propertyID":"tiledmap.style"},{"propertyID":"color.palette"},{"propertyID":"legend.display"},{"propertyID":"legend.position"}],"icon":"","description":"propertyPresentation.simple.description","id":"simple","label":"propertyPresentation.simple.label","tags":["Tiledmap","Tiledmap Properties Presentation","Simple","ca.dashboard"]},{"presentationItems":[{"propertyGroup":{"presentationItems":[],"icon":"","description":"propertyPresentation.advanced.commonProperties.description","id":"commonProperties","label":"propertyPresentation.advanced.commonProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"tiledmap.style"},{"propertyID":"tiledmap.token"}],"icon":"","description":"map.propertyPresentation.advanced.mapSpecificProperties.description","id":"mapSpecificProperties","label":"map.propertyPresentation.advanced.mapSpecificProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"region.palette"},{"propertyID":"region.transparency"},{"propertyID":"region.custom.mapId"},{"propertyID":"region.custom.layerName"},{"propertyID":"region.custom.propertyName"}],"icon":"","description":"map.propertyPresentation.advanced.regionProperties.description","id":"regionProperties","label":"map.propertyPresentation.advanced.regionProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"point.palette"},{"propertyID":"point.transparency"},{"propertyID":"point.minSize"},{"propertyID":"point.maxSize"},{"propertyID":"point.defaultSize"},{"propertyID":"point.custom.mapId"},{"propertyID":"point.custom.layerName"},{"propertyID":"point.custom.propertyName"}],"icon":"","description":"map.propertyPresentation.advanced.pointProperties.description","id":"pointProperties","label":"map.propertyPresentation.advanced.pointProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"latlong.palette"},{"propertyID":"latlong.transparency"},{"propertyID":"latlong.minSize"},{"propertyID":"latlong.maxSize"},{"propertyID":"latlong.defaultSize"}],"icon":"","description":"map.propertyPresentation.advanced.latlongProperties.description","id":"latlongProperties","label":"map.propertyPresentation.advanced.latlongProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"legend.display"},{"propertyID":"legend.position"},{"propertyID":"legend.regioncolor.title"},{"propertyID":"legend.pointsize.title"},{"propertyID":"legend.pointcolor.title"},{"propertyID":"legend.latlong.pointsize.title"},{"propertyID":"legend.latlong.pointcolor.title"},{"propertyID":"legend.titlestyle.font"},{"propertyID":"legend.entrystyle.font"}],"icon":"","description":"propertyPresentation.advanced.legendProperties.description","id":"legendProperties","label":"propertyPresentation.advanced.legendProperties.label","tags":[]}}],"icon":"","description":"propertyPresentation.advanced.description","id":"advanced","label":"propertyPresentation.advanced.label","tags":["Tiledmap","Tiledmap Properties Presentation","advanced","ca.reporting"]},{"presentationItems":[{"propertyGroup":{"presentationItems":[{"propertyID":"color.null"},{"propertyID":"tiledmap.style"},{"propertyID":"tiledmap.token"},{"propertyID":"tiledmap.autoZoom"},{"propertyID":"tiledmap.maxZoom"},{"propertyID":"tiledmap.mapLocale"}],"description":"propertyPresentation.sample.global.description","id":"global","label":"propertyPresentation.sample.global.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"region.mapData"},{"propertyID":"region.palette"},{"propertyID":"region.transparency"},{"propertyID":"region.custom.mapId"},{"propertyID":"region.custom.layerName"},{"propertyID":"region.custom.propertyName"}],"description":"propertyPresentation.sample.region.description","id":"region","label":"propertyPresentation.sample.region.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"point.mapData"},{"propertyID":"point.palette"},{"propertyID":"point.transparency"},{"propertyID":"point.minSize"},{"propertyID":"point.maxSize"},{"propertyID":"point.defaultSize"},{"propertyID":"point.staticZeroValueSize"},{"propertyID":"point.custom.mapId"},{"propertyID":"point.custom.layerName"},{"propertyID":"point.custom.propertyName"}],"description":"propertyPresentation.sample.point.description","id":"point","label":"propertyPresentation.sample.point.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"latlong.palette"},{"propertyID":"latlong.transparency"},{"propertyID":"latlong.minSize"},{"propertyID":"latlong.maxSize"},{"propertyID":"latlong.defaultSize"},{"propertyID":"latlong.staticZeroValueSize"}],"description":"propertyPresentation.sample.latlong.description","id":"latlong","label":"propertyPresentation.sample.latlong.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"layout.padding"},{"propertyID":"layout.legendsize.min"},{"propertyID":"layout.legendsize.max"},{"propertyID":"layout.legendsize.preferred"},{"propertyID":"layout.legendchart.gap"},{"propertyID":"layout.legendchart.align"},{"propertyID":"layout.chart.padding.top"},{"propertyID":"layout.chart.padding.left"},{"propertyID":"layout.chart.padding.bottom"},{"propertyID":"layout.chart.padding.right"}],"description":"propertyPresentation.sample.layout.description","id":"layout","label":"propertyPresentation.sample.layout.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"legend.display"},{"propertyID":"legend.entrystyle.font"},{"propertyID":"legend.position"},{"propertyID":"legend.titlestyle.fontfamily"},{"propertyID":"legend.titlestyle.fontsize"},{"propertyID":"legend.titlestyle.fill"},{"propertyID":"legend.titlestyle.font"},{"propertyID":"legend.pointsize.title"},{"propertyID":"legend.pointcolor.title"},{"propertyID":"legend.latlong.pointsize.title"},{"propertyID":"legend.latlong.pointcolor.title"},{"propertyID":"legend.regioncolor.title"}],"description":"propertyPresentation.sample.legend.description","id":"legend","label":"propertyPresentation.sample.legend.label","tags":[]}}],"icon":"","description":"propertyPresentation.sample.description","id":"sample","label":"propertyPresentation.sample.label","tags":["Tiledmap","Tiledmap Properties Presentation"]}]},{"configurations":[{"dataSlots":[{"dataModelId":"multiTable","dataSetId":"data.region","dataSlotId":"featureLvl1","tags":["ca.reporting.edgeId:featureId","ca.reporting.edgePosition:3"]},{"dataModelId":"multiTable","dataSetId":"data.region","dataSlotId":"featureLvl2","tags":["ca.reporting.edgeId:featureId","ca.reporting.edgePosition:2"]},{"dataModelId":"multiTable","dataSetId":"data.region","dataSlotId":"featureLvl3","tags":["ca.reporting.edgeId:featureId","ca.reporting.edgePosition:1"]},{"dataModelId":"multiTable","dataSetId":"data.point","dataSlotId":"featureLvl1","tags":["ca.reporting.edgeId:featureId","ca.reporting.edgePosition:3"]},{"dataModelId":"multiTable","dataSetId":"data.point","dataSlotId":"featureLvl2","tags":["ca.reporting.edgeId:featureId","ca.reporting.edgePosition:2"]},{"dataModelId":"multiTable","dataSetId":"data.point","dataSlotId":"featureLvl3","tags":["ca.reporting.edgeId:featureId","ca.reporting.edgePosition:1"]},{"dataModelId":"multiTable","dataSetId":"data.latlong","dataSlotId":"latitude","tags":["ca.reporting.edgeId:latLong","ca.reporting.edgePosition:1","ca.reporting.categorical"]},{"dataModelId":"multiTable","dataSetId":"data.latlong","dataSlotId":"longitude","tags":["ca.reporting.edgeId:latLong","ca.reporting.edgePosition:2","ca.reporting.categorical"]},{"dataModelId":"multiTable","dataSetId":"data.latlong","dataSlotId":"label","tags":["ca.reporting.edgeId:latLong","ca.reporting.edgePosition:3"]}],"previews":{"image":[{"file":"resources\/preview_map_small.png","tags":["small","notext"]}],"svg":[{"file":"resources\/map_icon_48.svg","tags":["small","nocolor"]},{"file":"resources\/map_preview_320.svg","tags":["medium","color"]},{"file":"resources\/map_preview_500.svg","tags":["large","nocolor"]}]},"genericMeta":{"description":"tiledmap.config.tiledmap.description","id":"tiledmapV2","label":"tiledmap.config.tiledmap.label","tags":["ca.reporting","ca.reporting.palettes=continuous"]},"datamodels":[{"id":"multiTable"},{"hidden":"true","id":"tabular"}]}]},{"build":"development","name":"rave-library-tiledmap","description":"This is the IBM Rave map bundle.","ignore":["bower.json"],"main":"bundle.js","version":"0.0.0","dependencies":{"rave-legends":"<2.0.0","mapboxgl":"<0.32.0","rave-library":"<2.0.0","rave":"<3.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.locate.description": "Locate action",
  45. "actions.locate.label": "Locate action",
  46. "actions.removeAllSelect.description": "Removes all selections from all nodes.",
  47. "actions.removeAllSelect.label": "Remove all selections action",
  48. "actions.removeHighlight.description": "Removes a highlight from a node.",
  49. "actions.removeHighlight.label": "Remove highlight action",
  50. "actions.removeSelection.description": "Removes a selection from a node.",
  51. "actions.removeSelection.label": "Remove selection action",
  52. "actions.toggleSelect.description": "Toggles the selection on a node.",
  53. "actions.toggleSelect.label": "Toggle selection action",
  54. "actions.zoom.args.panX.description": "The amount to pan in the x direction.",
  55. "actions.zoom.args.panX.label": "Zoom x pan amount function argument",
  56. "actions.zoom.args.panY.description": "The amount to pan in the y direction.",
  57. "actions.zoom.args.panY.label": "Zoom y pan amount function argument",
  58. "actions.zoom.args.scale.description": "The scale amount for the zoom action.",
  59. "actions.zoom.args.scale.label": "Zoom scale function argument",
  60. "actions.zoom.description": "Zoom action",
  61. "actions.zoom.label": "Zoom action",
  62. "actions.zoomPackedBubble.description": "Zoom for a packed bubble.",
  63. "actions.zoomPackedBubble.label": "Zoom packed bubble action",
  64. "background.chart.color.description": "The background color of the chart.",
  65. "background.chart.color.name": "Background color",
  66. "background.color.description": "The background color behind the elements of the chart.",
  67. "background.elements.color.description": "The background color behind the elements of the chart.",
  68. "background.elements.color.name": "Elements background color",
  69. "border.color.description": "The color of the borders between features.",
  70. "border.color.name": "Border color",
  71. "border.width.description": "The width of the border.",
  72. "border.width.name": "Border width",
  73. "bubble.animation.description": "The effect that is used to animate the initial bubble.",
  74. "bubble.animation.duration.description": "The duration of the initial bubble animation in ms.",
  75. "bubble.animation.duration.name": "Bubble animation duration",
  76. "bubble.animation.name": "Bubble animation",
  77. "bubble.animation.options.none": "None",
  78. "bubble.animation.options.transition": "Transition",
  79. "bubble.size.description": "The radius of bubbles, in pixels, when bubbles are not sized by data.",
  80. "bubble.size.name": "Bubble size",
  81. "bubbleBorder.color.description": "The color of the bubble borders.",
  82. "bubbleBorder.color.name": "Bubble border color",
  83. "bubbleBorder.width.description": "The width of the bubble borders.",
  84. "bubbleBorder.width.name": "Bubble border width",
  85. "color.feature.palette.description": "The color palette that is used to color regions in the map.",
  86. "color.feature.palette.name": "Color palette",
  87. "color.featureDynamicPalette.max.description": "The color that is used for the maximum value of a region dynamic palette.",
  88. "color.featureDynamicPalette.max.name": "Region maximum value color",
  89. "color.featureDynamicPalette.mid.description": "The color that is used for the middle value of a region dynamic palette.",
  90. "color.featureDynamicPalette.mid.name": "Region middle value color",
  91. "color.featureDynamicPalette.min.description": "The color that is used for the minimum value of a region dynamic palette.",
  92. "color.featureDynamicPalette.min.name": "Region minimum value color",
  93. "color.fillTransparency.description": "Transparency, in percentage, that is added to the palette entry for the region fill color.",
  94. "color.fillTransparency.name": "Fill transparency percentage",
  95. "color.latlong.palette.description": "The color palette that is used to color latitude/longitude points in the map.",
  96. "color.latlong.palette.name": "Color palette",
  97. "color.latlongTransparency.description": "Transparency, in percentage, that is added to the palette entry for the point fill color.",
  98. "color.latlongTransparency.name": "Fill transparency percentage",
  99. "color.null.description": "The color that is applied to null values.",
  100. "color.null.name": "Null value color",
  101. "color.palette.description": "Color palette to use with the tiled map.",
  102. "color.palette.name": "Color palette",
  103. "color.point.palette.description": "The color palette that is used to color points in the map.",
  104. "color.point.palette.name": "Color palette",
  105. "color.pointDynamicPalette.max.description": "The color that is used for the maximum value of a point dynamic palette.",
  106. "color.pointDynamicPalette.max.name": "Point maximum value color",
  107. "color.pointDynamicPalette.mid.description": "The color that is used for the middle value of a point dynamic palette.",
  108. "color.pointDynamicPalette.mid.name": "Point middle value color",
  109. "color.pointDynamicPalette.min.description": "The color that is used for the minimum value of a point dynamic palette.",
  110. "color.pointDynamicPalette.min.name": "Point minimum value color",
  111. "color.pointTransparency.description": "Transparency, in percentage, that is added to the palette entry for the point fill color.",
  112. "color.pointTransparency.name": "Fill transparency percentage",
  113. "custom.point.layerName.description": "The layer name of the custom polygon layer which should be used for the point.",
  114. "custom.point.layerName.name": "Point custom layer name",
  115. "custom.point.mapId.description": "The map ID of the custom polygon layer which should be used for the point.",
  116. "custom.point.mapId.name": "Point custom map ID",
  117. "custom.point.propertyName.description": "The property name of the custom polygon layer which should be used for the point.",
  118. "custom.point.propertyName.name": "Point custom property name",
  119. "custom.region.layerName.description": "The layer name of the custom polygon layer which should be used for the region.",
  120. "custom.region.layerName.name": "Region custom layer name",
  121. "custom.region.mapId.description": "The map ID of the custom polygon layer which should be used for the region.",
  122. "custom.region.mapId.name": "Region custom map ID",
  123. "custom.region.propertyName.description": "The property name of the custom polygon layer which should be used for the region.",
  124. "custom.region.propertyName.name": "Region custom property name",
  125. "customPolygonPropertyConversionFailure": "Converting your custom layer data to the required data type failed. Please use numerical data for this custom layer property.",
  126. "data.handling.description": "The configuration that is used to plot the data.",
  127. "data.handling.name": "Configuration",
  128. "data.latlong.dataslot.label.description": "Specify the label attached to the location to render on a map",
  129. "data.latlong.dataslot.label.label": "Label",
  130. "data.latlong.dataslot.latitude.description": "Specify the latitude of the location to render on a map",
  131. "data.latlong.dataslot.latitude.label": "Latitude",
  132. "data.latlong.dataslot.longitude.description": "Specify the longitude of the location to render on a map",
  133. "data.latlong.dataslot.longitude.label": "Longitude",
  134. "data.point.dataslot.featureLvl1.description": "Specify the location to render on a map; you can clarify it with additional data items, e.g. City, State, Country",
  135. "data.point.dataslot.featureLvl1.label": "Location",
  136. "data.point.dataslot.featureLvl2.description": "First clarification item",
  137. "data.point.dataslot.featureLvl2.label": "Refine location",
  138. "data.point.dataslot.featureLvl3.description": "Second clarification item",
  139. "data.point.dataslot.featureLvl3.label": "Further refine location",
  140. "data.point.dataslot.pointColor.description": "Determines the color of the shape, based it's numeric value and choosen palette",
  141. "data.point.dataslot.pointColor.label": "Color",
  142. "data.point.dataslot.pointSize.description": "Determines the size of the shape, based it's numeric value",
  143. "data.point.dataslot.pointSize.label": "Size",
  144. "data.region.dataslot.featureLvl1.description": "Specify the location to render on a map; you can clarify it with additional data items, e.g. City, State, Country.",
  145. "data.region.dataslot.featureLvl1.label": "Location",
  146. "data.region.dataslot.featureLvl2.description": "Clarification item, e.g. For Postal/Zip Codes, use Country. For Cities, use Province/State. For Province/State, use Country.",
  147. "data.region.dataslot.featureLvl2.label": "Refine location",
  148. "data.region.dataslot.featureLvl3.description": "Further clarification item, e.g. For Cities, use Country.",
  149. "data.region.dataslot.featureLvl3.label": "Further refine location",
  150. "data.region.dataslot.fill.description": "This value determines the fill color of the region based on the choosen palette.",
  151. "data.region.dataslot.fill.label": "Color",
  152. "datamodel.hierarchial.label": "Hierarchical data model",
  153. "datamodel.multitable.map.description": "The data model uses two separate data sets for coloring regions and ovelaying bubbles",
  154. "datamodel.multitable.map.label": "Multi table regions and bubbles",
  155. "datamodel.tabular.label": "Tabular data model",
  156. "datamodel.tabular.map.description": "The simple map model, providing feature name, color, label, and point data with x and y, size, and label.",
  157. "datamodel.tabular.map.new.description": "The data model that uses feature matching to color each region and overlay a bubble.",
  158. "datamodel.tabular.map.new.label": "Tabular regions and bubbles",
  159. "dataset.hierarchial.label": "Hierarchical data set",
  160. "dataset.latlong.label": "Latitude/Longitude",
  161. "dataset.points.label": "Points",
  162. "dataset.regions.label": "Regions",
  163. "dataset.tabular.description": "The tabular data set of rows and columns.",
  164. "dataset.tabular.label": "Tabular data set",
  165. "dataset.tabular.link.description": "Determines the links between the nodes.",
  166. "dataset.tabular.link.label": "Tabular links data set",
  167. "dataset.tabular.map.description": "The tabular map data that is used with the GeoJSON features (feature ID data to GeoJSON ID lookup property).",
  168. "dataset.tabular.map.latlong.description": "Tabular data set for mapping bubbles to latitude/longitude coordinates",
  169. "dataset.tabular.map.new.description": "The data set that uses feature matching to color each region and overlay a bubble.",
  170. "dataset.tabular.map.point.description": "The tabular data for points plotted on top of the map data.",
  171. "dataset.tabular.map.points.description": "Tabular data set for mapping the bubbles to locations",
  172. "dataset.tabular.map.regions.description": "Tabual data set for mapping the color to regions",
  173. "dataset.tabular.node.description": "The tabular data set that defines the nodes.",
  174. "dataset.tabular.node.label": "Tabular node data set",
  175. "dataset.tabular.points.label": "Tabular data set points",
  176. "dataset.tabular.regions.label": "Tabular data set regions",
  177. "dataslot.categories.label": "Categories",
  178. "dataslot.category.label": "Category",
  179. "dataslot.children.description": "When applied to a tree node, returns the children of that node as an array-list.",
  180. "dataslot.children.label": "Children",
  181. "dataslot.color.description": "Determines the color of the shape.",
  182. "dataslot.color.label": "Color",
  183. "dataslot.key.description": "Called for each row to match elements. Primarily used for transitions.",
  184. "dataslot.key.label": "Key",
  185. "dataslot.label.description": "Determines the label of the shape.",
  186. "dataslot.label.label": "Label",
  187. "dataslot.label.map.description": "The label of the map feature. This value is optional. If the value is not provided, the feature name is used.",
  188. "dataslot.map.bubbleColor.description": "If set, bubbles will be drawn for each feature. Numeric values are used to determine the color of each bubble.",
  189. "dataslot.map.bubbleColor.label": "Point color",
  190. "dataslot.map.bubbleSize.description": "If set, bubbles will be drawn for each feature. Numeric values are used to determine the size of each bubble.",
  191. "dataslot.map.bubbleSize.label": "Point size",
  192. "dataslot.map.featureColor.description": "The color of the map feature.",
  193. "dataslot.map.featureColor.label": "Feature value",
  194. "dataslot.map.featureLabel.description": "The label to associate with each feature. If not specified, the feature ID is used.",
  195. "dataslot.map.featureLabel.label": "Feature label",
  196. "dataslot.map.featureLvl1.description": "Specify the location to render on a map; you can clarify it with additional data items, e.g. City, State, Country",
  197. "dataslot.map.featureLvl1.label": "Location",
  198. "dataslot.map.featureLvl2.description": "First clarification item",
  199. "dataslot.map.featureLvl2.label": "Refine location",
  200. "dataslot.map.featureLvl3.description": "Second clarification item",
  201. "dataslot.map.featureLvl3.label": "Further refine location",
  202. "dataslot.map.pointIdentifier.description": "pointIdentifier.description",
  203. "dataslot.map.pointIdentifier.label": "pointIdentifier.label",
  204. "dataslot.map.pointIdentifierRefinement.description": "pointIdentifierRefinement.description",
  205. "dataslot.map.pointIdentifierRefinement.label": "pointIdentifierRefinement.label",
  206. "dataslot.map.value.description": "This is the value to be attached as a property per feature id.",
  207. "dataslot.map.value.label": "Region color",
  208. "dataslot.maximumValue.label": "Maximum value",
  209. "dataslot.source.label": "Source",
  210. "dataslot.sourceValue.label": "Source value",
  211. "dataslot.tabular.id.description": "The identifier for the nodes.",
  212. "dataslot.tabular.id.label": "Identifier",
  213. "dataslot.tabular.size.description": "Determines the size of the shape.",
  214. "dataslot.tabular.size.label": "Size",
  215. "dataslot.target.label": "Target",
  216. "dataslot.targetValue.label": "Target value",
  217. "dataslot.value.label": "Value",
  218. "dataslot.x.label": "X axis",
  219. "dataslot.x.map.point.description": "The numeric x (longitude) position, in the same coordinates as the GeoJSON.",
  220. "dataslot.y.label": "Y axis",
  221. "dataslot.y.map.point.description": "The numeric y (latitude) position, in the same coordinates as the GeoJSON.",
  222. "default.latlong.point.size.description": "Point radius when no size attribute is specified.",
  223. "default.latlong.point.size.name": "Default point size",
  224. "default.pan.zoom.description": "When set to Yes, the visualization uses the built-in pan-zoom behavior. Set to No to allow for custom pan and zoom actions.",
  225. "default.pan.zoom.name": "Default pan-zoom behavior",
  226. "default.point.size.description": "Point radius when no size attribute is specified.",
  227. "default.point.size.name": "Default point size",
  228. "defaultPalette.description": "Rave2 default description",
  229. "defaultPalette.label": "Rave2 default",
  230. "display.graticule.description": "Shows or hides the graticule.",
  231. "display.graticule.name": "Show graticule",
  232. "drop.labels.description": "Keeps or drops overlapping labels.",
  233. "drop.labels.name": "Drop overlapping labels",
  234. "effect.duration.description": "The animation duration, in ms.",
  235. "effect.duration.name": "Animation duration (ms)",
  236. "effect.name.description": "The effect that is used when the chart is drawn.",
  237. "effect.name.name": "Animation",
  238. "feature.label.color.description": "The color of the feature labels.",
  239. "feature.label.color.name": "Feature label color",
  240. "feature.label.font.description": "The font of the feature labels.",
  241. "feature.label.font.name": "Feature label font",
  242. "feature.label.size.description": "The size of the feature labels.",
  243. "feature.label.size.name": "Feature label size",
  244. "flash.description": "Specifies whether to flash regions.",
  245. "flash.duration.description": "The duration of flashing regions and bubbles in ms.",
  246. "flash.duration.name": "Flash duration",
  247. "flash.name": "Flash",
  248. "geodata.index.description": "The index of the GeoJSON that the data corresponds to.",
  249. "geodata.index.name": "GeoJSON data index",
  250. "geojson.object.description": "The JSONObject that is loaded for the GeoJSON.",
  251. "geojson.object.name": "GeoJSON JSONObject",
  252. "geojson.url.description": "The URL of the GeoJSON file.",
  253. "geojson.url.name": "GeoJSON URL",
  254. "graticule.color.description": "The color of the graticule.",
  255. "graticule.color.name": "Graticule color",
  256. "graticule.stroke.thickness.description": "The stroke thickness for the graticule.",
  257. "graticule.stroke.thickness.name": "Graticule stroke thickness",
  258. "grid.color.description": "The color of the grid lines.",
  259. "grid.color.name": "Grid lines color",
  260. "grid.display.description": "Show or hide the grid lines.",
  261. "grid.display.name": "Show grid lines",
  262. "id.lookup.description": "The dot separated field names for feature ids.",
  263. "id.lookup.name": "ID lookup",
  264. "invalidLayerName": "Invalid layer name specified: ",
  265. "invalidMapId": "Invalid map id specified: ",
  266. "invalidPropertyName": "Invalid property name specified: ",
  267. "labelResolution.description": "The method that is used to resolve labels.",
  268. "labelResolution.name": "Label resolution",
  269. "labelResolution.options.DropLabels": "Drop labels",
  270. "labelResolution.options.MoveLabels": "Move labels",
  271. "labelResolution.options.none": "None",
  272. "layout.axissize.bottom.max.description": "The maximum size of the bottom axis, as a CSS size or percentage.",
  273. "layout.axissize.bottom.max.name": "Bottom axis maximum size",
  274. "layout.axissize.bottom.min.description": "The minimum size of the bottom axis, as a CSS size or percentage.",
  275. "layout.axissize.bottom.min.name": "Bottom axis minimum size",
  276. "layout.axissize.bottom.preferred.description": "The preferred size of the bottom axis, as a CSS size or percentage.",
  277. "layout.axissize.bottom.preferred.name": "Bottom axis preferred size",
  278. "layout.axissize.left.max.description": "The maximum size of the left axis, as a CSS size or percentage.",
  279. "layout.axissize.left.max.name": "Left axis maximum size",
  280. "layout.axissize.left.min.description": "The minimum size of the left axis, as a CSS size or percentage.",
  281. "layout.axissize.left.min.name": "Left axis minimum size",
  282. "layout.axissize.left.preferred.description": "The preferred size of the left axis, as a CSS size or percentage.",
  283. "layout.axissize.left.preferred.name": "Left axis preferred size",
  284. "layout.axissize.right.max.description": "The maximum size of the right axis, as a CSS size or percentage.",
  285. "layout.axissize.right.max.name": "Right axis maximum size",
  286. "layout.axissize.right.min.description": "The minimum size of the right axis, as a CSS size or percentage.",
  287. "layout.axissize.right.min.name": "Right axis minimum size",
  288. "layout.axissize.right.preferred.description": "The preferred size of the right axis, as a CSS size or percentage.",
  289. "layout.axissize.right.preferred.name": "Right axis preferred size",
  290. "layout.axissize.top.max.description": "The maximum size of the top axis, as a CSS size or percentage.",
  291. "layout.axissize.top.max.name": "Top axis maximum size",
  292. "layout.axissize.top.min.description": "The minimum size of the top axis, as a CSS size or percentage.",
  293. "layout.axissize.top.min.name": "Top axis minimum size",
  294. "layout.axissize.top.preferred.description": "The preferred size of the top axis, as a CSS size or percentage.",
  295. "layout.axissize.top.preferred.name": "Top axis preferred size",
  296. "layout.chart.padding.bottom.description": "The bottom padding for the chart.",
  297. "layout.chart.padding.bottom.name": "Bottom padding",
  298. "layout.chart.padding.left.description": "The left padding for the chart.",
  299. "layout.chart.padding.left.name": "Left padding",
  300. "layout.chart.padding.right.description": "Right padding for the chart.",
  301. "layout.chart.padding.right.name": "Right padding",
  302. "layout.chart.padding.top.description": "The top padding for the chart.",
  303. "layout.chart.padding.top.name": "Top padding",
  304. "layout.legendchart.align.description": "Whether to align the legend to the interior of the chart.",
  305. "layout.legendchart.align.name": "Align legend to chart",
  306. "layout.legendchart.gap.description": "Space between the chart and the legend, as a CSS size or percentage.",
  307. "layout.legendchart.gap.name": "Space between legend and chart",
  308. "layout.legendsize.max.description": "The maximum size of the legend, as a CSS size or percentage.",
  309. "layout.legendsize.max.name": "Maximum size",
  310. "layout.legendsize.min.description": "The minimum size of the legend, as a CSS size or percentage.",
  311. "layout.legendsize.min.name": "Minimum size",
  312. "layout.legendsize.preferred.description": "The preferred size of the legend, as a CSS size or percentage.",
  313. "layout.legendsize.preferred.name": "Preferred size",
  314. "layout.padding.description": "The padding around the chart and legend.",
  315. "layout.padding.name": "Padding",
  316. "legend.animation.description": "The effect that is used to animate the legend.",
  317. "legend.animation.duration.description": "The duration of the legend animation in ms.",
  318. "legend.animation.duration.name": "Legend animation duration",
  319. "legend.animation.name": "Legend animation",
  320. "legend.animation.options.none": "None",
  321. "legend.animation.options.transition": "Transition",
  322. "legend.display.description": "Shows or hides the legend.",
  323. "legend.display.falseLabel": "Hide",
  324. "legend.display.name": "Show legend",
  325. "legend.display.trueLabel": "Show",
  326. "legend.entrystyle.font.description": "The font properties of the legend entry.",
  327. "legend.entrystyle.font.name": "Entry font",
  328. "legend.latlong.pointcolor.title.description": "The title of the legend for latitude/longitude point color",
  329. "legend.latlong.pointcolor.title.name": "Latitude/Longitude color legend title",
  330. "legend.latlong.pointsize.title.description": "The title of the legend for latitude/longitude point size",
  331. "legend.latlong.pointsize.title.name": "Latitude/Longitude size legend title",
  332. "legend.map.display.description": "Shows or hides the map legend.",
  333. "legend.map.display.name": "Show map legend",
  334. "legend.map.title.description": "The title of the map legend.",
  335. "legend.map.title.name": "Map legend title",
  336. "legend.map.titlestyle.fill.description": "The color of the map legend title.",
  337. "legend.map.titlestyle.fill.name": "Map legend title color",
  338. "legend.map.titlestyle.fontfamily.description": "The font family of the map legend title.",
  339. "legend.map.titlestyle.fontfamily.name": "Map legend title font family",
  340. "legend.map.titlestyle.fontsize.description": "The font size of the map legend title.",
  341. "legend.map.titlestyle.fontsize.name": "Map legend title font size",
  342. "legend.pointcolor.title.description": "The title of the legend for point color",
  343. "legend.pointcolor.title.name": "Point color legend title",
  344. "legend.pointsize.title.description": "The title of the legend for point size",
  345. "legend.pointsize.title.name": "Point size legend title",
  346. "legend.position.description": "The position of the legend in the chart.",
  347. "legend.position.name": "Legend position",
  348. "legend.position.options.bottom": "Bottom",
  349. "legend.position.options.left": "Left",
  350. "legend.position.options.right": "Right",
  351. "legend.position.options.top": "Top",
  352. "legend.regioncolor.title.description": "The title of the legend for region color",
  353. "legend.regioncolor.title.name": "Region color legend title",
  354. "legend.size.display.description": "Shows or hides the bubble size legend.",
  355. "legend.size.display.name": "Show bubble size legend",
  356. "legend.size.title.description": "The title of the bubble size legend.",
  357. "legend.size.title.name": "Bubble size legend title",
  358. "legend.size.titlestyle.fill.description": "The color of the bubble size legend title.",
  359. "legend.size.titlestyle.fill.name": "Bubble size legend title color",
  360. "legend.size.titlestyle.fontfamily.description": "The font family of the bubble size legend title.",
  361. "legend.size.titlestyle.fontfamily.name": "Bubble size legend title font family",
  362. "legend.size.titlestyle.fontsize.description": "The font size of the bubble size legend title.",
  363. "legend.size.titlestyle.fontsize.name": "Bubble size legend title font size",
  364. "legend.title.description": "The title of the legend.",
  365. "legend.title.name": "Title",
  366. "legend.titlestyle.fill.description": "The color of the legend title.",
  367. "legend.titlestyle.fill.name": "Title color",
  368. "legend.titlestyle.font.description": "The font properties of the legend title.",
  369. "legend.titlestyle.font.name": "Title font",
  370. "legend.titlestyle.fontfamily.description": "The font family of the legend title.",
  371. "legend.titlestyle.fontfamily.name": "Title font family",
  372. "legend.titlestyle.fontsize.description": "The font size of the legend title.",
  373. "legend.titlestyle.fontsize.name": "Title font size",
  374. "map.description": "Map charts use a map to show data.",
  375. "map.falseLabe.dropLabels": "Keep",
  376. "map.falseLabel.bubbleLegend": "Hide",
  377. "map.falseLabel.display": "Hide",
  378. "map.falseLabel.flash": "No flash",
  379. "map.falseLabel.labels": "Hide",
  380. "map.falseLabel.sizeLegend": "Hide",
  381. "map.label": "Map",
  382. "map.projection.description": "The Map projection type.",
  383. "map.projection.name": "Map projection",
  384. "map.projection.options.albers": "Albers",
  385. "map.projection.options.albersUsa": "Albers Usa",
  386. "map.projection.options.equirectangular": "Equirectangular",
  387. "map.projection.options.mercator": "Mercator",
  388. "map.projection.options.stereoGraphic": "stereoGraphic",
  389. "map.projection.options.winkelTriple": "winkelTriple",
  390. "map.propertyPresentation.advanced.latlongProperties.description": "Latitude/Longitude layer properties",
  391. "map.propertyPresentation.advanced.latlongProperties.label": "Latitude/Longitude",
  392. "map.propertyPresentation.advanced.mapSpecificProperties.description": "Map-specific properties",
  393. "map.propertyPresentation.advanced.mapSpecificProperties.label": "Map",
  394. "map.propertyPresentation.advanced.pointProperties.description": "Point layer properties",
  395. "map.propertyPresentation.advanced.pointProperties.label": "Points",
  396. "map.propertyPresentation.advanced.regionProperties.description": "Region layer properties",
  397. "map.propertyPresentation.advanced.regionProperties.label": "Regions",
  398. "map.trueLabel.bubbleLegend": "Show",
  399. "map.trueLabel.display": "Show",
  400. "map.trueLabel.dropLabels": "Drop",
  401. "map.trueLabel.flash": "Flash",
  402. "map.trueLabel.labels": "Show",
  403. "map.trueLabel.sizeLegend": "Show",
  404. "mapData.description": "The map data which should be used mapping data to geo",
  405. "mapData.items": "The smartermap items",
  406. "mapData.name": "Map data",
  407. "max.bubble.size.descirption": "The maximum radius of a bubble, in pixels.",
  408. "max.bubble.size.description": "The maximum size of the bubble.",
  409. "max.bubble.size.name": "Maximum bubble size",
  410. "max.latlong.size.description": "Maximum radius for points drawn on the tiled map. CSS length. Percentages based on the chart width.",
  411. "max.latlong.size.name": "Maximum point size",
  412. "max.point.size.description": "Maximum radius for points drawn on the tiled map. CSS length. Percentages based on the chart width.",
  413. "max.point.size.name": "Maximum point size",
  414. "max.zoom.description": "The maximum level of zoom that is allowed.",
  415. "max.zoom.name": "Maximum zoom level",
  416. "min.bubble.size.descirption": "The minimum radius of a bubble, in pixels.",
  417. "min.bubble.size.description": "The minimum size of the bubble.",
  418. "min.bubble.size.name": "Minimum bubble size",
  419. "min.latlong.size.description": "Minimum radius for points drawn on the tiled map. CSS length. Percentages based on the chart width.",
  420. "min.latlong.size.name": "Minimum point size",
  421. "min.point.size.description": "Minimum radius for points drawn on the tiled map. CSS length. Percentages based on the chart width.",
  422. "min.point.size.name": "Minimum point size",
  423. "pan.x.description": "When set to Yes, pans along the X-axis. When set to No, a Euler rotation is performed along the X-axis.",
  424. "pan.x.name": "Pan along the X-axis",
  425. "pan.y.description": "When set to Yes, pans along the Y-axis. When set to No, a Euler rotation is performed along the Y-axis.",
  426. "pan.y.name": "Pan along the Y-axis",
  427. "point.label.color.description": "The color of the point labels.",
  428. "point.label.color.name": "Point label color",
  429. "point.label.font.description": "The font of the point labels.",
  430. "point.label.font.name": "Point label font",
  431. "point.label.size.description": "The size of the point labels.",
  432. "point.label.size.name": "Point label size",
  433. "propertyPresentation.advanced.axisSizeProperties.description": "Axis size properties.",
  434. "propertyPresentation.advanced.axisSizeProperties.label": "Axis size",
  435. "propertyPresentation.advanced.clientBehaviorProperties.description": "Client side properties.",
  436. "propertyPresentation.advanced.clientBehaviorProperties.label": "Client behavior",
  437. "propertyPresentation.advanced.commonProperties.description": "Common properties.",
  438. "propertyPresentation.advanced.commonProperties.label": "Common",
  439. "propertyPresentation.advanced.description": "Advanced list of all properties in a grouped structure.",
  440. "propertyPresentation.advanced.label": "Advanced",
  441. "propertyPresentation.advanced.labelProperties.description": "Label properties",
  442. "propertyPresentation.advanced.labelProperties.label": "Label",
  443. "propertyPresentation.advanced.legendProperties.description": "Legend properties.",
  444. "propertyPresentation.advanced.legendProperties.label": "Legend",
  445. "propertyPresentation.advanced.xAxisProperties.description": "X-axis properties.",
  446. "propertyPresentation.advanced.xAxisProperties.label": "X-axis",
  447. "propertyPresentation.advanced.yAxisProperties.description": "Y-axis properties.",
  448. "propertyPresentation.advanced.yAxisProperties.label": "Y-axis",
  449. "propertyPresentation.sample.description": "Properties, logically organised by their relevance, for use on the sample page.",
  450. "propertyPresentation.sample.global.description": "Global properties.",
  451. "propertyPresentation.sample.global.label": "Global",
  452. "propertyPresentation.sample.label": "Sample properties",
  453. "propertyPresentation.sample.latlong.description": "Latitude/Longitude related properties",
  454. "propertyPresentation.sample.latlong.label": "Latitude/Longitude",
  455. "propertyPresentation.sample.layout.description": "Layout related properties",
  456. "propertyPresentation.sample.layout.label": "Layout",
  457. "propertyPresentation.sample.legend.description": "Layout related properties",
  458. "propertyPresentation.sample.legend.label": "Legend",
  459. "propertyPresentation.sample.point.description": "Point related properties",
  460. "propertyPresentation.sample.point.label": "Point",
  461. "propertyPresentation.sample.region.description": "Region related properties",
  462. "propertyPresentation.sample.region.label": "Region",
  463. "propertyPresentation.simple.description": "Simple list of the most common properties.",
  464. "propertyPresentation.simple.label": "Simple",
  465. "rave2.colorpalette.blueContinuousSequential.description": "Blue continuous sequential description",
  466. "rave2.colorpalette.blueContinuousSequential.label": "Blue continuous sequential",
  467. "rave2.colorpalette.blueDiscreteSequential.description": "Blue discrete sequential description",
  468. "rave2.colorpalette.blueDiscreteSequential.label": "Blue discrete sequential",
  469. "rave2.colorpalette.blueGreenContinuousDivergent.description": "Blue green continuous divergent description",
  470. "rave2.colorpalette.blueGreenContinuousDivergent.label": "Blue green continuous divergent",
  471. "rave2.colorpalette.blueGreenDiscreteDivergent.description": "Blue green discrete divergent description",
  472. "rave2.colorpalette.blueGreenDiscreteDivergent.label": "Blue green discrete divergent",
  473. "rave2.colorpalette.dark.description": "Dark description",
  474. "rave2.colorpalette.dark.label": "Dark",
  475. "rave2.colorpalette.financial.description": "Financial description",
  476. "rave2.colorpalette.financial.label": "Financial",
  477. "rave2.colorpalette.greenContinuousSequential.description": "Green continuous sequential description",
  478. "rave2.colorpalette.greenContinuousSequential.label": "Green continuous sequential",
  479. "rave2.colorpalette.greenDiscreteSequential.description": "Green discrete sequential description",
  480. "rave2.colorpalette.greenDiscreteSequential.label": "Green discrete sequential",
  481. "rave2.colorpalette.light.description": "Light description",
  482. "rave2.colorpalette.light.label": "Light",
  483. "rave2.colorpalette.medical.description": "Medical description",
  484. "rave2.colorpalette.medical.label": "Medical",
  485. "rave2.colorpalette.orangeContinuousSequential.description": "Orange continuous sequential description",
  486. "rave2.colorpalette.orangeContinuousSequential.label": "Orange continuous sequential",
  487. "rave2.colorpalette.orangeDiscreteSequential.description": "Orange discrete sequential description",
  488. "rave2.colorpalette.orangeDiscreteSequential.label": " Orange discrete sequential",
  489. "rave2.colorpalette.purpleContinuousSequential.description": "Purple continuous sequential description",
  490. "rave2.colorpalette.purpleContinuousSequential.label": "Purple continuous sequential",
  491. "rave2.colorpalette.purpleDiscreteSequential.description": "Purple discrete sequential description",
  492. "rave2.colorpalette.purpleDiscreteSequential.label": "Purple discrete sequential",
  493. "rave2.colorpalette.redBlueContinuousDivergent.description": "Red blue continuous divergent description",
  494. "rave2.colorpalette.redBlueContinuousDivergent.label": "Red blue continuous divergent",
  495. "rave2.colorpalette.redBlueDiscreteDivergent.description": "Red blue discrete divergent description",
  496. "rave2.colorpalette.redBlueDiscreteDivergent.label": "Red blue discrete divergent",
  497. "rave2.colorpalette.redBlueInverseContinuousDivergent.description": "Red blue inverse continuous divergent description",
  498. "rave2.colorpalette.redBlueInverseContinuousDivergent.label": "Red blue inverse continuous divergent",
  499. "rave2.colorpalette.redBlueInverseDiscreteDivergent.description": "Red blue inverse discrete divergent description",
  500. "rave2.colorpalette.redBlueInverseDiscreteDivergent.label": "Red blue inverse discrete divergent",
  501. "rave2.colorpalette.redContinuousSequential.description": "Red continuous sequential description",
  502. "rave2.colorpalette.redContinuousSequential.label": "Red continuous sequential",
  503. "rave2.colorpalette.redDiscreteSequential.description": "Red discrete sequential description",
  504. "rave2.colorpalette.redDiscreteSequential.label": " Red discrete sequential",
  505. "rave2.colorpalette.redGreenContinuousDivergent.description": "Red green continuous divergent description",
  506. "rave2.colorpalette.redGreenContinuousDivergent.label": "Red green continuous divergent",
  507. "rave2.colorpalette.redGreenDiscreteDivergent.description": "Red green discrete divergent description",
  508. "rave2.colorpalette.redGreenDiscreteDivergent.label": "Red green discrete divergent",
  509. "rave2.colorpalette.redGreenInverseContinuousDivergent.description": "Red green inverse continuous divergent description",
  510. "rave2.colorpalette.redGreenInverseContinuousDivergent.label": "Red green inverse continuous divergent",
  511. "rave2.colorpalette.redGreenInverseDiscreteDivergent.description": "Red green inverse discrete divergent description",
  512. "rave2.colorpalette.redGreenInverseDiscreteDivergent.label": "Red green inverse discrete divergent",
  513. "rave2.colorpalette.tealContinuousSequential.description": "Teal continuous sequential description",
  514. "rave2.colorpalette.tealContinuousSequential.label": "Teal continuous sequential",
  515. "rave2.colorpalette.tealDiscreteSequential.description": "Teal discrete sequential description",
  516. "rave2.colorpalette.tealDiscreteSequential.label": "Teal discrete sequential",
  517. "rave2.colorpalette.tealPurpleContinuousDivergent.description": "Teal purple continuous divergent description",
  518. "rave2.colorpalette.tealPurpleContinuousDivergent.label": "Teal purple continuous divergent",
  519. "rave2.colorpalette.tealPurpleDiscreteDivergent.description": "Teal purple discrete divergent description",
  520. "rave2.colorpalette.tealPurpleDiscreteDivergent.label": "Teal purple discrete divergent",
  521. "rave2.colorpalette.violetContinuousSequential.description": "Violet continuous sequential description",
  522. "rave2.colorpalette.violetContinuousSequential.label": "Violet continuous sequential",
  523. "rave2.colorpalette.violetDiscreteSequential.description": "Violet discrete sequential description",
  524. "rave2.colorpalette.violetDiscreteSequential.label": "Violet discrete sequential",
  525. "rave2.colorpalette.yellowContinuousSequential.description": "Yellow continuous sequential description",
  526. "rave2.colorpalette.yellowContinuousSequential.label": "Yellow continuous sequential",
  527. "rave2.colorpalette.yellowDiscreteSequential.description": "Yellow discrete sequential description",
  528. "rave2.colorpalette.yellowDiscreteSequential.label": "Yellow discrete sequential",
  529. "region.animation.description": "The effect that is used to animate the initial region.",
  530. "region.animation.duration.description": "The duration of the initial region animation in ms.",
  531. "region.animation.duration.name": "Region animation duration",
  532. "region.animation.name": "Region animation",
  533. "region.animation.options.none": "None",
  534. "region.animation.options.transition": "Transition",
  535. "scale.description": "The default scale that is applied to the projection. The scale can have a null value. If null, the map automatically scales.",
  536. "scale.name": "Map base scale",
  537. "show.labels.description": "Shows or hides labels.",
  538. "show.labels.name": "Show labels",
  539. "static.latlong.zero.value.size.description": "Show zero values as points with a static radius instead of their logical scale.",
  540. "static.latlong.zero.value.size.name": "Static zero values point radius",
  541. "static.zero.value.size.description": "Show zero values as points with a static radius instead of their logical scale.",
  542. "static.zero.value.size.name": "Static zero values point radius",
  543. "tiledmap.autoZoom.description": "Indicates if the map should automatically zoom in to fit the specified data points.",
  544. "tiledmap.autoZoom.name": "Auto zoom",
  545. "tiledmap.config.tiledmap.description": "Interactive map for geospatial analytics. Use this visualization to perform geospatial analysis with fill and point maps.",
  546. "tiledmap.config.tiledmap.label": "Map",
  547. "tiledmap.description": "Interactive map for geospatial analytics. Use this visualization to perform geospatial analysis with fill and point maps.",
  548. "tiledmap.geoJson.description": "This geo json object will be used as the layer to be matched with any incoming location data.",
  549. "tiledmap.geoJson.name": "Geo Json Layer",
  550. "tiledmap.label": "Map",
  551. "tiledmap.mapLocale.description": "The locale used for rendering the labels on the map.",
  552. "tiledmap.mapLocale.name": "Map Locale",
  553. "tiledmap.maxZoom.description": "The maximum depth a map can be zoomed in to.",
  554. "tiledmap.maxZoom.name": "Maximum zoom depth",
  555. "tiledmap.style.description": "The visual appearance of the map",
  556. "tiledmap.style.name": "Style",
  557. "tiledmap.style.options.basic": "Basic",
  558. "tiledmap.style.options.bright": "Bright",
  559. "tiledmap.style.options.dark": "Dark",
  560. "tiledmap.style.options.light": "Light",
  561. "tiledmap.style.options.outdoors": "Outdoors",
  562. "tiledmap.style.options.satellite": "Satellite",
  563. "tiledmap.style.options.streets": "Streets",
  564. "tiledmap.token.description": "Access token to use any of Mapbox's tools, APIs, or SDKs",
  565. "tiledmap.token.name": "Access token",
  566. "transpose.description": "When set to Yes, the Y-axis shows the independent scale and the X-axis shows the dependent scale.",
  567. "transpose.name": "Switch X and Y axes"
  568. }
  569. },{}],3:[function(require,module,exports){
  570. var css = ".mapboxgl-map {\n font: 12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;\n overflow: hidden;\n position: relative;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n}\n.mapboxgl-canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n.mapboxgl-map:-webkit-full-screen {\n width: 100%;\n height: 100%;\n}\n.mapboxgl-canary {\n background-color: salmon;\n}\n.mapboxgl-canvas-container.mapboxgl-interactive,\n.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass {\n cursor: -webkit-grab;\n cursor: -moz-grab;\n cursor: grab;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.mapboxgl-canvas-container.mapboxgl-interactive.mapboxgl-track-pointer {\n cursor: pointer;\n}\n.mapboxgl-canvas-container.mapboxgl-interactive:active,\n.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass:active {\n cursor: -webkit-grabbing;\n cursor: -moz-grabbing;\n cursor: grabbing;\n}\n.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate,\n.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate .mapboxgl-canvas {\n touch-action: pan-x pan-y;\n}\n.mapboxgl-canvas-container.mapboxgl-touch-drag-pan,\n.mapboxgl-canvas-container.mapboxgl-touch-drag-pan .mapboxgl-canvas {\n touch-action: pinch-zoom;\n}\n.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan,\n.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan .mapboxgl-canvas {\n touch-action: none;\n}\n.mapboxgl-ctrl-bottom-left,\n.mapboxgl-ctrl-bottom-right,\n.mapboxgl-ctrl-top-left,\n.mapboxgl-ctrl-top-right {\n position: absolute;\n pointer-events: none;\n z-index: 2;\n}\n.mapboxgl-ctrl-top-left {\n top: 0;\n left: 0;\n}\n.mapboxgl-ctrl-top-right {\n top: 0;\n right: 0;\n}\n.mapboxgl-ctrl-bottom-left {\n bottom: 0;\n left: 0;\n}\n.mapboxgl-ctrl-bottom-right {\n right: 0;\n bottom: 0;\n}\n.mapboxgl-ctrl {\n clear: both;\n pointer-events: auto;\n transform: translate(0);\n}\n.mapboxgl-ctrl-top-left .mapboxgl-ctrl {\n margin: 10px 0 0 10px;\n float: left;\n}\n.mapboxgl-ctrl-top-right .mapboxgl-ctrl {\n margin: 10px 10px 0 0;\n float: right;\n}\n.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl {\n margin: 0 0 10px 10px;\n float: left;\n}\n.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl {\n margin: 0 10px 10px 0;\n float: right;\n}\n.mapboxgl-ctrl-group {\n border-radius: 4px;\n background: #fff;\n}\n.mapboxgl-ctrl-group:not(:empty) {\n -moz-box-shadow: 0 0 2px rgba(0,0,0,.1);\n -webkit-box-shadow: 0 0 2px rgba(0,0,0,.1);\n box-shadow: 0 0 0 2px rgba(0,0,0,.1);\n}\n@media (-ms-high-contrast:active) {\n .mapboxgl-ctrl-group:not(:empty) {\n box-shadow: 0 0 0 2px ButtonText;\n }\n}\n.mapboxgl-ctrl-group button {\n width: 29px;\n height: 29px;\n display: block;\n padding: 0;\n outline: none;\n border: 0;\n box-sizing: border-box;\n background-color: transparent;\n cursor: pointer;\n}\n.mapboxgl-ctrl-group button+button {\n border-top: 1px solid #ddd;\n}\n.mapboxgl-ctrl button .mapboxgl-ctrl-icon {\n display: block;\n width: 100%;\n height: 100%;\n background-repeat: no-repeat;\n background-position: 50%;\n}\n@media (-ms-high-contrast:active) {\n .mapboxgl-ctrl-icon {\n background-color: transparent;\n }\n\n .mapboxgl-ctrl-group button+button {\n border-top: 1px solid ButtonText;\n }\n}\n.mapboxgl-ctrl button::-moz-focus-inner {\n border: 0;\n padding: 0;\n}\n.mapboxgl-ctrl-group button:focus {\n box-shadow: 0 0 2px 2px #0096ff;\n}\n.mapboxgl-ctrl button:disabled {\n cursor: not-allowed;\n}\n.mapboxgl-ctrl button:disabled .mapboxgl-ctrl-icon {\n opacity: .25;\n}\n.mapboxgl-ctrl button:not(:disabled):hover {\n background-color: rgba(0,0,0,.05);\n}\n.mapboxgl-ctrl-group button:focus:focus-visible {\n box-shadow: 0 0 2px 2px #0096ff;\n}\n.mapboxgl-ctrl-group button:focus:not(:focus-visible) {\n box-shadow: none;\n}\n.mapboxgl-ctrl-group button:focus:first-child {\n border-radius: 4px 4px 0 0;\n}\n.mapboxgl-ctrl-group button:focus:last-child {\n border-radius: 0 0 4px 4px;\n}\n.mapboxgl-ctrl-group button:focus:only-child {\n border-radius: inherit;\n}\n.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\");\n}\n.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\");\n}\n@media (-ms-high-contrast:active) {\n .mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\");\n }\n\n .mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\");\n }\n}\n@media (-ms-high-contrast:black-on-white) {\n .mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\");\n }\n\n .mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\");\n }\n}\n.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\");\n}\n.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\");\n}\n@media (-ms-high-contrast:active) {\n .mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\");\n }\n\n .mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\");\n }\n}\n@media (-ms-high-contrast:black-on-white) {\n .mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\");\n }\n\n .mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\");\n }\n}\n.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E\");\n}\n@media (-ms-high-contrast:active) {\n .mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath d='M10.5 16l4 8 4-8h-8z' fill='%23999'/%3E%3C/svg%3E\");\n }\n}\n@media (-ms-high-contrast:black-on-white) {\n .mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E\");\n }\n}\n.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\");\n}\n.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23aaa'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath d='M14 5l1 1-9 9-1-1 9-9z' fill='red'/%3E%3C/svg%3E\");\n}\n.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\");\n}\n.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\");\n}\n.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3C/svg%3E\");\n}\n.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3C/svg%3E\");\n}\n.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-waiting .mapboxgl-ctrl-icon {\n -webkit-animation: mapboxgl-spin 2s linear infinite;\n -moz-animation: mapboxgl-spin 2s infinite linear;\n -o-animation: mapboxgl-spin 2s infinite linear;\n -ms-animation: mapboxgl-spin 2s infinite linear;\n animation: mapboxgl-spin 2s linear infinite;\n}\n@media (-ms-high-contrast:active) {\n .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\");\n }\n\n .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23999'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath d='M14 5l1 1-9 9-1-1 9-9z' fill='red'/%3E%3C/svg%3E\");\n }\n\n .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\");\n }\n\n .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\");\n }\n\n .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3C/svg%3E\");\n }\n\n .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3C/svg%3E\");\n }\n}\n@media (-ms-high-contrast:black-on-white) {\n .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\");\n }\n\n .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23666'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath d='M14 5l1 1-9 9-1-1 9-9z' fill='red'/%3E%3C/svg%3E\");\n }\n}\n@-webkit-keyframes mapboxgl-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n }\n\n to {\n -webkit-transform: rotate(1turn);\n }\n}\n@-moz-keyframes mapboxgl-spin {\n 0% {\n -moz-transform: rotate(0deg);\n }\n\n to {\n -moz-transform: rotate(1turn);\n }\n}\n@-o-keyframes mapboxgl-spin {\n 0% {\n -o-transform: rotate(0deg);\n }\n\n to {\n -o-transform: rotate(1turn);\n }\n}\n@-ms-keyframes mapboxgl-spin {\n 0% {\n -ms-transform: rotate(0deg);\n }\n\n to {\n -ms-transform: rotate(1turn);\n }\n}\n@keyframes mapboxgl-spin {\n 0% {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(1turn);\n }\n}\na.mapboxgl-ctrl-logo {\n width: 88px;\n height: 23px;\n margin: 0 0 -4px -4px;\n display: block;\n background-repeat: no-repeat;\n cursor: pointer;\n overflow: hidden;\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='88' height='23' viewBox='0 0 88 23' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd'%3E%3Cdefs%3E%3Cpath id='a' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='b' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='c'%3E%3Crect width='100%25' height='100%25' fill='%23fff'/%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/mask%3E%3Cg opacity='.3' stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23c)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23b' mask='url(%23c)'/%3E%3C/g%3E%3Cg opacity='.9' fill='%23fff'%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/g%3E%3C/svg%3E\")}a.mapboxgl-ctrl-logo.mapboxgl-compact{width:23px}@media (-ms-high-contrast:active){a.mapboxgl-ctrl-logo{background-color:transparent;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='88' height='23' viewBox='0 0 88 23' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd'%3E%3Cdefs%3E%3Cpath id='a' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='b' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='c'%3E%3Crect width='100%25' height='100%25' fill='%23fff'/%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/mask%3E%3Cg stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23c)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23b' mask='url(%23c)'/%3E%3C/g%3E%3Cg fill='%23fff'%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/g%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){a.mapboxgl-ctrl-logo{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='88' height='23' viewBox='0 0 88 23' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd'%3E%3Cdefs%3E%3Cpath id='a' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='b' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='c'%3E%3Crect width='100%25' height='100%25' fill='%23fff'/%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/mask%3E%3Cg stroke='%23fff' stroke-width='3' fill='%23fff'%3E%3Ccircle mask='url(%23c)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23b' mask='url(%23c)'/%3E%3C/g%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/svg%3E\")}}.mapboxgl-ctrl.mapboxgl-ctrl-attrib{padding:0 5px;background-color:hsla(0,0%,100%,.5);margin:0}@media screen{.mapboxgl-ctrl-attrib.mapboxgl-compact{min-height:20px;padding:0;margin:10px;position:relative;background-color:#fff;border-radius:3px 12px 12px 3px}.mapboxgl-ctrl-attrib.mapboxgl-compact:hover{padding:2px 24px 2px 4px;visibility:visible;margin-top:6px}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:hover,.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:hover{padding:2px 4px 2px 24px;border-radius:12px 3px 3px 12px}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner{display:none}.mapboxgl-ctrl-attrib.mapboxgl-compact:hover .mapboxgl-ctrl-attrib-inner{display:block}.mapboxgl-ctrl-attrib.mapboxgl-compact:after{content:\"\";cursor:pointer;position:absolute;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1012 0 6 6 0 10-12 0m5-3a1 1 0 102 0 1 1 0 10-2 0m0 3a1 1 0 112 0v3a1 1 0 11-2 0'/%3E%3C/svg%3E\");background-color:hsla(0,0%,100%,.5);width:24px;height:24px;box-sizing:border-box;border-radius:12px}.mapboxgl-ctrl-bottom-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;right:0}.mapboxgl-ctrl-top-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{top:0;right:0}.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{top:0;left:0}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' fill='%23fff'%3E%3Cpath d='M4 10a6 6 0 1012 0 6 6 0 10-12 0m5-3a1 1 0 102 0 1 1 0 10-2 0m0 3a1 1 0 112 0v3a1 1 0 11-2 0'/%3E%3C/svg%3E\")}}@media screen and (-ms-high-contrast:black-on-white){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1012 0 6 6 0 10-12 0m5-3a1 1 0 102 0 1 1 0 10-2 0m0 3a1 1 0 112 0v3a1 1 0 11-2 0'/%3E%3C/svg%3E\")}}.mapboxgl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.mapboxgl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.mapboxgl-ctrl-attrib .mapbox-improve-map{font-weight:700;margin-left:2px}.mapboxgl-attrib-empty{display:none}.mapboxgl-ctrl-scale{background-color:hsla(0,0%,100%,.75);font-size:10px;border:2px solid #333;border-top:#333;padding:0 5px;color:#333;box-sizing:border-box}.mapboxgl-popup{position:absolute;top:0;left:0;display:-webkit-flex;display:flex;will-change:transform;pointer-events:none}.mapboxgl-popup-anchor-top,.mapboxgl-popup-anchor-top-left,.mapboxgl-popup-anchor-top-right{-webkit-flex-direction:column;flex-direction:column}.mapboxgl-popup-anchor-bottom,.mapboxgl-popup-anchor-bottom-left,.mapboxgl-popup-anchor-bottom-right{-webkit-flex-direction:column-reverse;flex-direction:column-reverse}.mapboxgl-popup-anchor-left{-webkit-flex-direction:row;flex-direction:row}.mapboxgl-popup-anchor-right{-webkit-flex-direction:row-reverse;flex-direction:row-reverse}.mapboxgl-popup-tip{width:0;height:0;border:10px solid transparent;z-index:1}.mapboxgl-popup-anchor-top .mapboxgl-popup-tip{-webkit-align-self:center;align-self:center;border-top:none;border-bottom-color:#fff}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip{-webkit-align-self:flex-start;align-self:flex-start;border-top:none;border-left:none;border-bottom-color:#fff}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip{-webkit-align-self:flex-end;align-self:flex-end;border-top:none;border-right:none;border-bottom-color:#fff}.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip{-webkit-align-self:center;align-self:center;border-bottom:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip{-webkit-align-self:flex-start;align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip{-webkit-align-self:flex-end;align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.mapboxgl-popup-anchor-left .mapboxgl-popup-tip{-webkit-align-self:center;align-self:center;border-left:none;border-right-color:#fff}.mapboxgl-popup-anchor-right .mapboxgl-popup-tip{-webkit-align-self:center;align-self:center;border-right:none;border-left-color:#fff}.mapboxgl-popup-close-button{position:absolute;right:0;top:0;border:0;border-radius:0 3px 0 0;cursor:pointer;background-color:transparent}.mapboxgl-popup-close-button:hover{background-color:rgba(0,0,0,.05)}.mapboxgl-popup-content{position:relative;background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:10px 10px 15px;pointer-events:auto}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-content{border-top-left-radius:0}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-content{border-top-right-radius:0}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-content{border-bottom-left-radius:0}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-content{border-bottom-right-radius:0}.mapboxgl-popup-track-pointer{display:none}.mapboxgl-popup-track-pointer *{pointer-events:none;user-select:none}.mapboxgl-map:hover .mapboxgl-popup-track-pointer{display:flex}.mapboxgl-map:active .mapboxgl-popup-track-pointer{display:none}.mapboxgl-marker{position:absolute;top:0;left:0;will-change:transform}.mapboxgl-user-location-dot,.mapboxgl-user-location-dot:before{background-color:#1da1f2;width:15px;height:15px;border-radius:50%}.mapboxgl-user-location-dot:before{content:\"\";position:absolute;-webkit-animation:mapboxgl-user-location-dot-pulse 2s infinite;-moz-animation:mapboxgl-user-location-dot-pulse 2s infinite;-ms-animation:mapboxgl-user-location-dot-pulse 2s infinite;animation:mapboxgl-user-location-dot-pulse 2s infinite}.mapboxgl-user-location-dot:after{border-radius:50%;border:2px solid #fff;content:\"\";\n height: 19px;\n left: -2px;\n position: absolute;\n top: -2px;\n width: 19px;\n box-sizing: border-box;\n box-shadow: 0 0 3px rgba(0,0,0,.35);\n}\n@-webkit-keyframes mapboxgl-user-location-dot-pulse {\n 0% {\n -webkit-transform: scale(1);\n opacity: 1;\n }\n\n 70% {\n -webkit-transform: scale(3);\n opacity: 0;\n }\n\n to {\n -webkit-transform: scale(1);\n opacity: 0;\n }\n}\n@-ms-keyframes mapboxgl-user-location-dot-pulse {\n 0% {\n -ms-transform: scale(1);\n opacity: 1;\n }\n\n 70% {\n -ms-transform: scale(3);\n opacity: 0;\n }\n\n to {\n -ms-transform: scale(1);\n opacity: 0;\n }\n}\n@keyframes mapboxgl-user-location-dot-pulse {\n 0% {\n transform: scale(1);\n opacity: 1;\n }\n\n 70% {\n transform: scale(3);\n opacity: 0;\n }\n\n to {\n transform: scale(1);\n opacity: 0;\n }\n}\n.mapboxgl-user-location-dot-stale {\n background-color: #aaa;\n}\n.mapboxgl-user-location-dot-stale:after {\n display: none;\n}\n.mapboxgl-user-location-accuracy-circle {\n background-color: rgba(29,161,242,.2);\n width: 1px;\n height: 1px;\n border-radius: 100%;\n}\n.mapboxgl-crosshair,\n.mapboxgl-crosshair .mapboxgl-interactive,\n.mapboxgl-crosshair .mapboxgl-interactive:active {\n cursor: crosshair;\n}\n.mapboxgl-boxzoom {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n background: #fff;\n border: 2px dotted #202020;\n opacity: .5;\n}\n@media print {\n .mapbox-improve-map {\n display: none;\n }\n}\n"; (require("browserify-css").createStyle(css, { "href": "dist/bundles/rave-library-tiledmapV2/node/rave-library-tiledmapV2/mapbox-gl.css"})); module.exports = css;
  571. },{"browserify-css":7}],4:[function(require,module,exports){
  572. (function() {
  573. var $ = {};
  574. // $source: com/ibm/rave/bundles/internal/nativeImpl/BundleModuleHeader
  575. /************************************************************************
  576. ** IBM Confidential
  577. **
  578. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  579. **
  580. ** (C) Copyright IBM Corp. 2015
  581. **
  582. ** The source code for this program is not published or otherwise divested of its trade secrets,
  583. ** irrespective of what has been deposited with the U.S. Copyright Office.
  584. ************************************************************************/
  585. var com_ibm_rave_library_Library = rave["library"];
  586. rave["internal"]["Declare"] = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"];
  587. rave["internal"]["CSSUtil"]= rave["_"]["com_ibm_rave_core_internal_css_CSSUtil"];
  588. // $source: com/ibm/rave/bundles/RaveBundle
  589. /************************************************************************
  590. ** IBM Confidential
  591. **
  592. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  593. **
  594. ** (C) Copyright IBM Corp. 2017
  595. **
  596. ** The source code for this program is not published or otherwise divested of its trade secrets,
  597. ** irrespective of what has been deposited with the U.S. Copyright Office.
  598. ************************************************************************/
  599. // GENERATED
  600. //@import com/ibm/rave/bundles/internal/nativeImpl/RaveBundleResourceLoader (runtime) // new
  601. /**
  602. * A RaveBundle extends the regular Bundle abstract class but includes common functionality for Rave-made bundles that aren't for general use.
  603. */
  604. var com_ibm_rave_bundles_RaveBundle = rave['internal']['Declare'](rave['library']['internal']['Bundle'], {
  605. /** @expose */
  606. loader : null,
  607. /** @expose */
  608. constructor : function() {
  609. ;
  610. ;
  611. ;
  612. ;
  613. ;
  614. ;
  615. this.loader = new com_ibm_rave_bundles_internal_nativeImpl_RaveBundleResourceLoader("/com/ibm/rave/bundles/" + this.getName());
  616. },
  617. /**
  618. * Load extra resources required for this bundle. Currently the compiled configuration.json file. And .css.
  619. */
  620. /** @expose */
  621. loadResources : function() {
  622. this.setMessageCatalog(rave['library']['internal']['Bundle'].DEFAULT_LOCALE, require("./i18n/messages_en.json"));
  623. var array = require("./configuration/configuration.json");
  624. if (array) {
  625. for (var __i_enFor0 = 0, __exp_enFor0 = array, __len_enFor0 = __exp_enFor0.length;
  626. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  627. var artifact = __exp_enFor0[__i_enFor0];
  628. this.initialize(artifact);
  629. }
  630. }
  631. require("./vizlibrary.css");
  632. }
  633. });
  634. //com_ibm_rave_bundles_RaveBundle.CONFIGURATION_FILE = "./configuration/configuration.json";
  635. // $source: com/ibm/rave/bundles/internal/nativeImpl/RaveBundleResourceLoader
  636. // Intentionally empty - everything in this file is inlined
  637. var com_ibm_rave_bundles_internal_nativeImpl_RaveBundleResourceLoader = function(){};
  638. // $source: com/ibm/rave/bundles/views/BundleView
  639. /************************************************************************
  640. ** IBM Confidential
  641. **
  642. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  643. **
  644. ** (C) Copyright IBM Corp. 2017
  645. **
  646. ** The source code for this program is not published or otherwise divested of its trade secrets,
  647. ** irrespective of what has been deposited with the U.S. Copyright Office.
  648. ************************************************************************/
  649. // GENERATED
  650. //@import com/ibm/rave/bundles/components/BackgroundComponentImpl (runtime) // new
  651. //@import com/ibm/rave/bundles/components/ChartLayoutComponentImpl (runtime) // new
  652. //@import com/ibm/rave/bundles/components/ClipPathComponentImpl (runtime) // new
  653. //@import com/ibm/rave/bundles/components/LegendsManager (runtime) // new
  654. //@import com/ibm/rave/bundles/components/AxesManager (runtime) // new
  655. //@import com/ibm/rave/library/Library (runtime) // Library
  656. //@import com/ibm/rave/bundles/components/IntervalDataUtilities (runtime) // IntervalDataUtilities
  657. //@import com/ibm/rave/bundles/data/PointDataUtilities (runtime) // PointDataUtilities
  658. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  659. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor
  660. var com_ibm_rave_bundles_views_BundleView = rave['internal']['Declare'](rave['library']['internal']['AbstractView'], {
  661. /**
  662. * Background component
  663. */
  664. /** @expose */
  665. _backgroundComponent : null,
  666. /**
  667. * Layout component
  668. */
  669. /** @expose */
  670. _layoutComponent : null,
  671. /**
  672. * Clip component
  673. */
  674. /** @expose */
  675. _clip : null,
  676. /**
  677. * Axes manager
  678. */
  679. /** @expose */
  680. _axes : null,
  681. /**
  682. * Legends manager
  683. */
  684. /** @expose */
  685. _legends : null,
  686. //_groupStructure : null,
  687. /** @expose */
  688. _chart : null,
  689. /** @expose */
  690. dataModel : null,
  691. /** @expose */
  692. _zoomP : null,
  693. /** @expose */
  694. _zoomS : null,
  695. /** @expose */
  696. constructor : function(context) {
  697. },
  698. /** @expose */
  699. getGroupStructure : function() {},
  700. /** @expose */
  701. setup : function() {
  702. rave['library']['internal']['AbstractView'].prototype.setup.call(this);
  703. this._backgroundComponent = new com_ibm_rave_bundles_components_BackgroundComponentImpl();
  704. this._layoutComponent = new com_ibm_rave_bundles_components_ChartLayoutComponentImpl();
  705. this._clip = new com_ibm_rave_bundles_components_ClipPathComponentImpl(this.context.instanceId() + "clipViewport");
  706. if (this.isZoomSupported()) {
  707. this.resetZoom();
  708. }
  709. this._legends = new com_ibm_rave_bundles_components_LegendsManager(this.context, this.getLegendCount());
  710. if (this.isAxesManagerRequired()) {
  711. this._axes = new com_ibm_rave_bundles_components_AxesManager(this.context);
  712. }
  713. this._groupStructure = this.getGroupStructure();
  714. },
  715. /** @expose */
  716. preDraw : function(chartId) {
  717. this.cancelTransitions();
  718. rave['library']['internal']['AbstractView'].createGroupStructure(this.context.node, this._groupStructure);
  719. this._chart = this.context.node.selectAll(chartId);
  720. },
  721. /** @expose */
  722. resetZoom : function() {
  723. this._zoomP = [0, 0, 0, 0];
  724. this._zoomS = [1, 1, 1, 1];
  725. },
  726. /** @expose */
  727. validateDataModel : function(elementsToRemove) {
  728. if (elementsToRemove !== null || arguments.length > 1){
  729. elementsToRemove = Array.prototype.slice.call(arguments);
  730. }
  731. {
  732. this.dataModel = this.context.dataModel();
  733. if (!(this.dataValid())) {
  734. for (var __i_enFor0 = 0, __len_enFor0 = elementsToRemove.length;
  735. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  736. var e = elementsToRemove[__i_enFor0];
  737. this._chart.selectAll(e).selectAll("*").remove();
  738. }
  739. this._legends.visible(false).draw();
  740. return false;
  741. }
  742. return true;
  743. }
  744. },
  745. /** @expose */
  746. dataValid : function() {
  747. return this.dataModel.validate();
  748. },
  749. /** @expose */
  750. getLegendCount : function() {
  751. return 1;
  752. },
  753. /** @expose */
  754. isAxesManagerRequired : function() {
  755. return false;
  756. },
  757. /** @expose */
  758. isZoomSupported : function() {
  759. return true;
  760. },
  761. /** @expose */
  762. getProperty : function(s) {
  763. return this.context.getPropertyValue(s);
  764. },
  765. /** @expose */
  766. getPropertyDefault : function(s) {
  767. return this.context.getPropertyDefault(s);
  768. },
  769. /** @expose */
  770. getBooleanProperty : function(s) {
  771. var obj = this.getProperty(s);
  772. return (obj);
  773. },
  774. /** @expose */
  775. getDoubleProperty : function(s) {
  776. var obj = this.getProperty(s);
  777. return + (obj);
  778. },
  779. /** @expose */
  780. getIntProperty : function(s) {
  781. var obj = this.getProperty(s);
  782. return ~~ (obj);
  783. },
  784. /**
  785. * @param (String) id Property ID
  786. * @return (String) Property value as a string
  787. */
  788. /** @expose */
  789. getStringProperty : function(id) {
  790. var obj = this.getProperty(id);
  791. return (obj == null) ? null : ""+(obj);
  792. },
  793. /**
  794. * @param (String) id Property ID
  795. * @return (String) Property value as a string, returning null for the empty string
  796. */
  797. /** @expose */
  798. getStringPropertyEmptyAsNull : function(id) {
  799. var s = this.getStringProperty(id);
  800. return (s == null || s.length == 0) ? null : s;
  801. },
  802. /**
  803. * @param (String) id Property ID
  804. * @return (Number) Property value as a string, containing size as the number of pixels
  805. */
  806. /** @expose */
  807. getCSSSizeToPixelNumber : function(id) {
  808. var cssSize = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(this.context.getPropertyValue(id), 100.0, 10.0);
  809. return (cssSize == null) ? 0.0 : cssSize;
  810. },
  811. /**
  812. * Based on effect duration and effect property, determine the effect duration in ms.
  813. * @param (String) effect Effect name, one of the options available from EFFECT_OPTIONS.
  814. * @return (int) Effect duration in ms.
  815. */
  816. /** @expose */
  817. getEffectDuration : function(effect) {
  818. var duration = this.getIntProperty("effect.duration");
  819. if ((duration < 0) || (effect == null) || "none" == effect) {
  820. duration = 0;
  821. }
  822. return duration;
  823. },
  824. /** @expose */
  825. getTopPadding : function() {
  826. return this.getProperty("layout.chart.padding.top");
  827. },
  828. /** @expose */
  829. getLeftPadding : function() {
  830. return this.getProperty("layout.chart.padding.left");
  831. },
  832. /** @expose */
  833. getBottomPadding : function() {
  834. return this.getProperty("layout.chart.padding.bottom");
  835. },
  836. /** @expose */
  837. getRightPadding : function() {
  838. return this.getProperty("layout.chart.padding.right");
  839. },
  840. /** @expose */
  841. getLayoutPadding : function() {
  842. return this.getProperty("layout.padding");
  843. },
  844. /** @expose */
  845. getLegendChartGap : function() {
  846. return this.getProperty("layout.legendchart.gap");
  847. },
  848. /** @expose */
  849. getLegendChartAlign : function() {
  850. return this.getBooleanProperty("layout.legendchart.align");
  851. },
  852. /** @expose */
  853. getLegendPosition : function() {
  854. return this.getStringProperty("legend.position");
  855. },
  856. getPalette$0 : function() {
  857. return this.getPalette$1("color.palette");
  858. },
  859. getPalette$1 : function(paletteID) {
  860. var id = this.getStringProperty(paletteID);
  861. var colorPalette = com_ibm_rave_library_Library.palettes.getPalette(id);
  862. return (!colorPalette) ? com_ibm_rave_library_Library.palettes.getDefaultPalette() : colorPalette;
  863. },
  864. getDynamicPalette$0 : function() {
  865. return this.getDynamicPalette$1("color.palette", "color.dynamicPalette.min", "color.dynamicPalette.mid", "color.dynamicPalette.max");
  866. },
  867. /**
  868. * 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.
  869. * @param (String) paletteID The palette ID
  870. * @return (rave['library']['internal']['Palette']) Palette
  871. */
  872. getDynamicPalette$1 : function(paletteID, minId, midId, maxId) {
  873. var colorPalette;
  874. var min = this.getStringProperty(minId);
  875. if (min != null) {
  876. var mid = this.getStringProperty(midId);
  877. if (mid != null) {
  878. var max = this.getStringProperty(maxId);
  879. if (max != null) {
  880. var fills = [min, mid, max];
  881. colorPalette = rave['library']['internal']['AbstractView'].getFillPalette(fills);
  882. }
  883. }
  884. }
  885. return (!colorPalette) ? this.getPalette(paletteID) : colorPalette;
  886. },
  887. /** @expose */
  888. prepareLayoutComponent : function() {
  889. 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());
  890. },
  891. /** @expose */
  892. prepareLayoutSizables : function(layoutComponent, useX2, useY1, useX1, useY2, useLegend) {
  893. layoutComponent.removeAxisSizables();
  894. if (useX1) {
  895. layoutComponent.addAxisSizable(this._axes.axisComponent(0));
  896. }
  897. if (useY1) {
  898. layoutComponent.addAxisSizable(this._axes.axisComponent(2));
  899. }
  900. if (useX2) {
  901. layoutComponent.addAxisSizable(this._axes.axisComponent(1));
  902. }
  903. if (useY2) {
  904. layoutComponent.addAxisSizable(this._axes.axisComponent(3));
  905. }
  906. layoutComponent.legendSize(useLegend ? this._legends : null);
  907. },
  908. /** @expose */
  909. resetUpdate : function() {
  910. this.updateType = 4;
  911. },
  912. /** @expose */
  913. isUpdateNothing : function() {
  914. return this.updateType == 4;
  915. },
  916. /** @expose */
  917. isShowLegend : function() {
  918. return this.getBooleanProperty("legend.display");
  919. },
  920. cancelTransitions : function() {
  921. this.context.node.selectAll("*").interrupt();
  922. },
  923. /** @expose */
  924. setBackgroundProperties : function(elementRect, duration) {
  925. this._backgroundComponent.setPreExecute(this.context.getPreExecute()).size(this.context.size).backgroundColor(this.getStringProperty("background.chart.color"));
  926. this.context.node.selectAll("rect.background.chart").transition().duration(duration).call(this._backgroundComponent);
  927. this._backgroundComponent.setPreExecute(this.context.getPreExecute()).rect(elementRect).backgroundColor(this.getStringProperty("background.elements.color"));
  928. this.context.node.selectAll("rect.background.elements").transition().duration(duration).call(this._backgroundComponent);
  929. },
  930. /** @expose */
  931. isShowDataLabels : function() {
  932. return this.getBooleanProperty("data.label.display");
  933. },
  934. /** @expose */
  935. isShowDataLabelsAsPercentageOfColor : function() {
  936. var dataLabel = this.getStringProperty("data.label.type");
  937. return "PercentOfColor" == dataLabel;
  938. },
  939. /** @expose */
  940. isShowDataLabelsAsPercentageOfCategory : function() {
  941. var dataLabel = this.getStringProperty("data.label.type");
  942. return "PercentOfCategory" == dataLabel;
  943. },
  944. /** @expose */
  945. getlDataLabelAccessor : function(dataSet, slot, isInterval) {
  946. var labelAccessor;
  947. var labelEntry = dataSet.slot(slot).entry();
  948. if (!labelEntry) {
  949. if (this.isShowDataLabelsAsPercentageOfCategory()) {
  950. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR;
  951. } else if (this.isShowDataLabelsAsPercentageOfColor()) {
  952. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_COLOR_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_COLOR_ACCESSOR;
  953. } else {
  954. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.VALUE_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR;
  955. }
  956. } else {
  957. labelAccessor = rave['library']['internal']['AbstractView'].originalDatumAccessor(rave['library']['internal']['AbstractView'].accessorOf(labelEntry));
  958. }
  959. return labelAccessor;
  960. },
  961. /** @expose */
  962. getEntryForDataLabelFormatter : function(dataSet, labelSlot, defaultSlot) {
  963. var labelEntry = dataSet.slot(labelSlot).entry();
  964. return labelEntry ? labelEntry : dataSet.slot(defaultSlot).entry();
  965. },
  966. /** @expose */
  967. getBackgroundConstrastLabelStyle : function() {
  968. var labelFontStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(this.getStringProperty("labelstyle.font"));
  969. if (this.getBooleanProperty("contrast.label.color") == false) {
  970. return labelFontStyle;
  971. }
  972. var defaultFillColor;
  973. if (labelFontStyle) {
  974. defaultFillColor = labelFontStyle["fill"];
  975. if (defaultFillColor == null) {
  976. defaultFillColor = labelFontStyle["color"];
  977. }
  978. } else {
  979. labelFontStyle = {};
  980. }
  981. if (defaultFillColor == null) {
  982. defaultFillColor = "#000000";
  983. }
  984. labelFontStyle["fill"] = com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(this.getStringProperty("background.elements.color"), defaultFillColor);
  985. return labelFontStyle;
  986. },
  987. /** @expose */
  988. getPalette : function(a0) {
  989. var args = arguments;
  990. if (args.length == 0) {
  991. return this.getPalette$0();
  992. }
  993. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  994. return this.getPalette$1(a0);
  995. }
  996. return rave['library']['internal']['AbstractView'].prototype.getPalette.apply(this, args);
  997. },
  998. /** @expose */
  999. getDynamicPalette : function(a0, a1, a2, a3) {
  1000. var args = arguments;
  1001. if (args.length == 0) {
  1002. return this.getDynamicPalette$0();
  1003. }
  1004. return this.getDynamicPalette$1(a0, a1, a2, a3);
  1005. }
  1006. });
  1007. // $source: com/ibm/rave/bundles/components/BundleComponentImpl
  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. var com_ibm_rave_bundles_components_BundleComponentImpl = rave['internal']['Declare']({
  1020. /**
  1021. * The pre-execution callback.
  1022. */
  1023. //_preExecuteCallback : null,
  1024. /**
  1025. * The render callback.
  1026. */
  1027. /** @expose */
  1028. _renderCallback : null,
  1029. _$functionClassMethod : function() {
  1030. var _$self = function(args) {
  1031. if (args !== null || arguments.length > 1){
  1032. args = Array.prototype.slice.call(arguments, 0);
  1033. }
  1034. {
  1035. var self = _$self;
  1036. this.each(function(data, index, groupIndex) {
  1037. self.execute(rave.select(this));
  1038. });
  1039. return null;
  1040. }
  1041. };
  1042. return _$self;
  1043. },
  1044. /**
  1045. * 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.
  1046. * @param (rave['internal']['Selector']) g <g> node that this component will be applied to.
  1047. */
  1048. /** @expose */
  1049. execute : function(g) {},
  1050. /**
  1051. * Set the pre-execute callback for this component.
  1052. * @param (rave['library']['internal']['ComponentCallback']) callback The callback
  1053. */
  1054. /** @expose */
  1055. setPreExecute : function(callback) {
  1056. this._preExecuteCallback = callback;
  1057. return this;
  1058. },
  1059. /**
  1060. * If the pre-execute component is non-null, call it with this object. Note that this object must also implement BundleComponent.
  1061. */
  1062. /** @expose */
  1063. preExecute : function() {
  1064. if (this._preExecuteCallback) {
  1065. this._preExecuteCallback(this);
  1066. }
  1067. },
  1068. /**
  1069. * Set the render callback for this component.
  1070. * @param (rave['internal']['RunFunction']) callback The callback
  1071. */
  1072. /** @expose */
  1073. setRenderCallback : function(callback) {
  1074. this._renderCallback = callback;
  1075. return this;
  1076. },
  1077. /**
  1078. * 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.
  1079. */
  1080. /** @expose */
  1081. type : function() {},
  1082. /** @expose */
  1083. updateBorder : function(s, borderWidth, borderColor) {
  1084. if (borderWidth != null) {
  1085. s.each(function(data, index, groupIndex) {
  1086. if (!((this.rave_getProperty("selected"))) && !((this.rave_getProperty("highlighted")))) {
  1087. this.rave_setStyle("stroke-width", borderWidth, "");
  1088. }
  1089. });
  1090. }
  1091. if (borderColor != null) {
  1092. s.each(function(data, index, groupIndex) {
  1093. if (!((this.rave_getProperty("selected"))) && !((this.rave_getProperty("highlighted")))) {
  1094. this.rave_setStyle("stroke", borderColor, "");
  1095. }
  1096. });
  1097. }
  1098. },
  1099. /** @expose */
  1100. getDefaultLabelColor : function(_labelStyle) {
  1101. if (!_labelStyle) {
  1102. return "#000000";
  1103. }
  1104. var defaultFillColor;
  1105. if (_labelStyle) {
  1106. defaultFillColor = _labelStyle["fill"];
  1107. if (defaultFillColor == null) {
  1108. defaultFillColor = _labelStyle["color"];
  1109. }
  1110. }
  1111. if (defaultFillColor == null) {
  1112. defaultFillColor = "#000000";
  1113. }
  1114. return defaultFillColor.toString();
  1115. }
  1116. });
  1117. // $source: com/ibm/rave/bundles/component/BackgroundComponent
  1118. /************************************************************************
  1119. ** IBM Confidential
  1120. **
  1121. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1122. **
  1123. ** (C) Copyright IBM Corp. 2017
  1124. **
  1125. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1126. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1127. ************************************************************************/
  1128. // GENERATED
  1129. /**
  1130. * <p> A component that renders the background to the chart. The {@link #this.type()} method returns "BackgroundComponent". </p>
  1131. */
  1132. var com_ibm_rave_bundles_component_BackgroundComponent = rave['internal']['Declare'].implement(
  1133. /**
  1134. * Get the background color.
  1135. * @return (String) The background color
  1136. */
  1137. //backgroundColor : function() {},
  1138. /**
  1139. * Set the background color. If the color is null, white is used.
  1140. * @param (String) backgroundColor The new background color
  1141. * @return (com.ibm.rave.bundles.component.BackgroundComponent) This object
  1142. */
  1143. //backgroundColor : function(backgroundColor) {}
  1144. );
  1145. /**
  1146. * The string returned by {@link #this.type()} is "BackgroundComponent".
  1147. */
  1148. /** @expose */
  1149. com_ibm_rave_bundles_component_BackgroundComponent.COMPONENT_TYPE = "BackgroundComponent";
  1150. // $source: com/ibm/rave/bundles/component/ChartLayoutComponent
  1151. /************************************************************************
  1152. ** IBM Confidential
  1153. **
  1154. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1155. **
  1156. ** (C) Copyright IBM Corp. 2017
  1157. **
  1158. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1159. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1160. ************************************************************************/
  1161. // GENERATED
  1162. /**
  1163. * <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>
  1164. */
  1165. var com_ibm_rave_bundles_component_ChartLayoutComponent = rave['internal']['Declare'].implement(
  1166. //padding : function() {},
  1167. //topPadding : function() {},
  1168. //leftPadding : function() {},
  1169. //bottomPadding : function() {},
  1170. //rightPadding : function() {},
  1171. //legendChartAlign : function() {},
  1172. //legendPosition : function() {},
  1173. //legendChartGap : function() {},
  1174. //legendPosition : function(position) {},
  1175. //topPadding : function(value) {},
  1176. //leftPadding : function(value) {},
  1177. //bottomPadding : function(value) {},
  1178. //rightPadding : function(value) {},
  1179. /**
  1180. * Sets the padding around the outside of the chart/legend.
  1181. * @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.
  1182. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1183. */
  1184. //padding : function(value) {},
  1185. /**
  1186. * Sets all chart paddings. Null values are treated as 0.
  1187. * @param (Object) top New top padding
  1188. * @param (Object) left New left padding
  1189. * @param (Object) bottom New bottom padding
  1190. * @param (Object) right New right padding
  1191. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1192. * @deprecated Please use {@link #this.padding(Object)} and {@link #this.legendChartGap(Object)}
  1193. */
  1194. //chartPadding : function(top, left, bottom, right) {},
  1195. /**
  1196. * Sets whether the legend should align with the chart "body".
  1197. * @param (boolean) legendChartAlign the boolean state
  1198. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1199. */
  1200. //legendChartAlign : function(legendChartAlign) {},
  1201. /**
  1202. * Set the space for the gap between chart and legend
  1203. * @param (Object) value the gap distance (css length)
  1204. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1205. */
  1206. //legendChartGap : function(value) {},
  1207. /**
  1208. * Set the size information for the legend. Null value is treated as no visible legend.
  1209. * @param (com.ibm.rave.bundles.component.ChartLayoutSizable) sizable An object that implements the ChartLayoutSizable interface
  1210. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1211. */
  1212. //legendSize : function(sizable) {},
  1213. /**
  1214. * Reset list of axis sizables to 0
  1215. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1216. */
  1217. //removeAxisSizables : function() {},
  1218. /**
  1219. * Add an axis to be considered in layout operation.
  1220. * @param (com.ibm.rave.bundles.component.ChartLayoutSizable) sizable An object that implements the ChartLayoutSizable interface
  1221. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1222. */
  1223. //addAxisSizable : function(sizable) {}
  1224. );
  1225. /**
  1226. * The string returned by {@link #this.type()} is "ChartLayoutComponent".
  1227. */
  1228. /** @expose */
  1229. com_ibm_rave_bundles_component_ChartLayoutComponent.COMPONENT_TYPE = "ChartLayoutComponent";
  1230. // $source: com/ibm/rave/bundles/components/LegendsManager
  1231. /************************************************************************
  1232. ** IBM Confidential
  1233. **
  1234. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1235. **
  1236. ** (C) Copyright IBM Corp. 2017
  1237. **
  1238. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1239. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1240. ************************************************************************/
  1241. // GENERATED
  1242. //@import com/ibm/rave/bundles/components/LegendComponentImpl (runtime) // new, orientationOf
  1243. /**
  1244. * <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>
  1245. */
  1246. var com_ibm_rave_bundles_components_LegendsManager = rave['internal']['Declare']({
  1247. /**
  1248. * Bundle context
  1249. */
  1250. //_context : null,
  1251. /**
  1252. * Component used to draw all legends
  1253. */
  1254. //_comp : null,
  1255. /**
  1256. * Global visibility; if false no legends are drawn
  1257. */
  1258. //_visible : null,
  1259. /**
  1260. * Rectangle containing all legends
  1261. */
  1262. //_rectangle : null,
  1263. /**
  1264. * Legend orientation
  1265. */
  1266. //_orient : null,
  1267. /**
  1268. * Pre-execute component callback
  1269. */
  1270. //_preExecute : null,
  1271. /**
  1272. * Selectors for each legend
  1273. */
  1274. //_selectors : null,
  1275. /**
  1276. * Palettes for each legend
  1277. */
  1278. //_palettes : null,
  1279. /**
  1280. * Scale size functions for each legend
  1281. */
  1282. //_scale : null,
  1283. /**
  1284. * Swatch size functions for each legend
  1285. */
  1286. //_swatchSizes : null,
  1287. /**
  1288. * Shapes for each legend
  1289. */
  1290. //_shapes : null,
  1291. /**
  1292. * Titles for each legend
  1293. */
  1294. //_titles : null,
  1295. /**
  1296. * Title fonts for each legend
  1297. */
  1298. //_titleFonts : null,
  1299. /**
  1300. * Title fills for each legend
  1301. */
  1302. //_titleFills : null,
  1303. /**
  1304. * Title font sizes for each legend
  1305. */
  1306. //_titleFontSizes : null,
  1307. /**
  1308. * Title font families for each legend
  1309. */
  1310. //_titleFontFamilies : null,
  1311. /**
  1312. * Entry fonts for each legend
  1313. */
  1314. //_entryFonts : null,
  1315. /**
  1316. * Custom formatters for each legend, created from the registered custom formatters
  1317. */
  1318. //_formatters : null,
  1319. /**
  1320. * Whether each legend was visible in the last draw
  1321. */
  1322. //_lastVisible : null,
  1323. //_dataSlotEntries : null,
  1324. /**
  1325. * Number of legends
  1326. */
  1327. _numLegends : 0,
  1328. /**
  1329. * Whether to use a transition.
  1330. */
  1331. _doTransition : false,
  1332. /**
  1333. * Duration of the transition.
  1334. */
  1335. _duration : 0,
  1336. _spaceUsed : 0,
  1337. /**
  1338. * Construct the manager.
  1339. * @param (int) numLegends Number of legends, must be positive
  1340. */
  1341. /** @expose */
  1342. constructor : function(context, numLegends) {
  1343. this._context = context;
  1344. this._numLegends = numLegends;
  1345. this._comp = new com_ibm_rave_bundles_components_LegendComponentImpl();
  1346. this._rectangle = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1347. this._orient = "vertical";
  1348. this._preExecute = null;
  1349. this._selectors = [];
  1350. this._palettes = [];
  1351. this._scale = [];
  1352. this._swatchSizes = [];
  1353. this._shapes = [];
  1354. this._titles = [];
  1355. this._titleFonts = [];
  1356. this._titleFills = [];
  1357. this._titleFontSizes = [];
  1358. this._titleFontFamilies = [];
  1359. this._entryFonts = [];
  1360. this._formatters = [];
  1361. this._lastVisible = [];
  1362. this._visible = [];
  1363. this._dataSlotEntries = [];
  1364. for (var i = 0; i < this._numLegends; ++i) {
  1365. this._selectors[i] = null;
  1366. this._palettes[i] = null;
  1367. this._swatchSizes[i] = null;
  1368. this._shapes[i] = null;
  1369. this._titles[i] = null;
  1370. this._formatters[i] = null;
  1371. this._lastVisible[i] = false;
  1372. this._visible[i] = true;
  1373. }
  1374. },
  1375. /**
  1376. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) The legend component used by this manager; for unit tests
  1377. */
  1378. getLegendComponent : function() {
  1379. return this._comp;
  1380. },
  1381. /**
  1382. * Set a specific legend visible
  1383. * @param (int) legendIndex The index of the legend
  1384. * @param (boolean) visible New value of visible flag
  1385. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1386. */
  1387. visible$0 : function(legendIndex, visible) {
  1388. if (legendIndex < this._visible.length) {
  1389. this._visible[legendIndex] = visible;
  1390. }
  1391. return this;
  1392. },
  1393. /**
  1394. * Set all legend visible
  1395. * @param (boolean) visible New value of visible flag
  1396. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1397. */
  1398. visible$1 : function(visible) {
  1399. for (var i = 0; i < this._visible.length; ++i) {
  1400. this._visible[i] = visible;
  1401. }
  1402. return this;
  1403. },
  1404. /**
  1405. * Set the layout rectangle. The rectangle is copied. If it is null, the layout rectangle is unchanged.
  1406. * @param (rave['internal']['RectStruct']) rect New layout rectangle
  1407. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1408. */
  1409. /** @expose */
  1410. rectangle : function(rect) {
  1411. if (rect) {
  1412. this._rectangle = new rave['internal']['RectStruct'](rect.x, rect.y, rect.width, rect.height);
  1413. }
  1414. return this;
  1415. },
  1416. /**
  1417. * Set the orient property. If the argument is not "horizontal" or "vertical", the orient property is not changed.
  1418. * @param (String) orient New orient
  1419. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1420. */
  1421. /** @expose */
  1422. orient : function(orient) {
  1423. if ("horizontal" == orient || "vertical" == orient) {
  1424. this._orient = orient;
  1425. }
  1426. return this;
  1427. },
  1428. /**
  1429. * 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".
  1430. * @param (String) position Legend position
  1431. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1432. */
  1433. /** @expose */
  1434. position : function(position) {
  1435. return this.orient(com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf(position));
  1436. },
  1437. /**
  1438. * Set the transition information. If the duration is negative, 0 is used.
  1439. * @param (boolean) doTransition Whether to do a transition
  1440. * @param (int) duration Duration of the transition when used
  1441. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1442. */
  1443. /** @expose */
  1444. transition : function(doTransition, duration) {
  1445. this._doTransition = doTransition;
  1446. this._duration = (duration >= 0) ? duration : 0;
  1447. return this;
  1448. },
  1449. /**
  1450. * Set the pre-execute callback for all legends. The callback may be null.
  1451. * @param (rave['library']['internal']['ComponentCallback']) callback The callback
  1452. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1453. */
  1454. /** @expose */
  1455. setPreExecute : function(callback) {
  1456. this._preExecute = callback;
  1457. return this;
  1458. },
  1459. /**
  1460. * Set the selector to be used when rendering a legend. If the index is out of range no selectors change.
  1461. * @param (int) index Legend array index
  1462. * @param (rave['internal']['Selector']) selector Selector, may be null (but this is not advisable)
  1463. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1464. */
  1465. /** @expose */
  1466. selector : function(index, selector) {
  1467. if (index >= 0 && index < this._numLegends) {
  1468. this._selectors[index] = selector;
  1469. }
  1470. return this;
  1471. },
  1472. /**
  1473. * Set the palette of a legend. If the index is out of range no information is changed.
  1474. * @param (int) index Legend array index
  1475. * @param (rave['library']['internal']['Palette']) palette Palette, may be null
  1476. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1477. */
  1478. /** @expose */
  1479. palette : function(index, palette) {
  1480. if (index >= 0 && index < this._numLegends) {
  1481. this._palettes[index] = palette;
  1482. }
  1483. return this;
  1484. },
  1485. /**
  1486. * Set the shape of a legend. If the index is out of range no information is changed.
  1487. * @param (int) index Legend array index
  1488. * @param (String) shape Shape, may be null (defaulting to square)
  1489. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1490. */
  1491. /** @expose */
  1492. shape : function(index, shape) {
  1493. if (index >= 0 && index < this._numLegends) {
  1494. this._shapes[index] = shape;
  1495. }
  1496. return this;
  1497. },
  1498. /**
  1499. * Set the title of a legend. If the index is out of range no information is changed.
  1500. * @param (int) index Legend array index
  1501. * @param (String) title Title, may be null
  1502. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1503. */
  1504. /** @expose */
  1505. title : function(index, title) {
  1506. if (index >= 0 && index < this._numLegends) {
  1507. this._titles[index] = title;
  1508. }
  1509. return this;
  1510. },
  1511. /**
  1512. * Set the title font style of a legend. If the index is out of range no information is changed.
  1513. * @param (int) index Legend array index
  1514. * @param (String) titleFont Title font string, may be null
  1515. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1516. */
  1517. /** @expose */
  1518. titleFont : function(index, titleFont) {
  1519. if (index >= 0 && index < this._numLegends) {
  1520. this._titleFonts[index] = titleFont;
  1521. }
  1522. return this;
  1523. },
  1524. /**
  1525. * Set the entry font style of a legend. If the index is out of range no information is changed.
  1526. * @param (int) index Legend array index
  1527. * @param (String) entryFont Entry font string, may be null
  1528. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1529. */
  1530. /** @expose */
  1531. entryFont : function(index, entryFont) {
  1532. if (index >= 0 && index < this._numLegends) {
  1533. this._entryFonts[index] = entryFont;
  1534. }
  1535. return this;
  1536. },
  1537. /**
  1538. * Set the title fill of a legend. If the index is out of range no information is changed.
  1539. * @param (int) index Legend array index
  1540. * @param (String) titleFill Fill color string, may be null
  1541. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1542. */
  1543. /** @expose */
  1544. titleFill : function(index, titleFill) {
  1545. if (index >= 0 && index < this._numLegends) {
  1546. this._titleFills[index] = titleFill;
  1547. }
  1548. return this;
  1549. },
  1550. /**
  1551. * Set the title font size of a legend. If the index is out of range no information is changed.
  1552. * @param (int) index Legend array index
  1553. * @param (String) titleFontSize Font size string, may be null
  1554. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1555. */
  1556. /** @expose */
  1557. titleFontSize : function(index, titleFontSize) {
  1558. if (index >= 0 && index < this._numLegends) {
  1559. this._titleFontSizes[index] = titleFontSize;
  1560. }
  1561. return this;
  1562. },
  1563. /**
  1564. * Set the title font family of a legend. If the index is out of range no information is changed.
  1565. * @param (int) index Legend array index
  1566. * @param (String) titleFontFamily Font family string, may be null
  1567. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1568. */
  1569. /** @expose */
  1570. titleFontFamily : function(index, titleFontFamily) {
  1571. if (index >= 0 && index < this._numLegends) {
  1572. this._titleFontFamilies[index] = titleFontFamily;
  1573. }
  1574. return this;
  1575. },
  1576. /**
  1577. * Set the scale of a legend. If the index is out of range no information is changed.
  1578. * @param (int) index Legend array index
  1579. * @param (rave['internal']['AbstractScale']) scale Scale, may be null
  1580. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1581. */
  1582. /** @expose */
  1583. scale : function(index, scale) {
  1584. if (index >= 0 && index < this._numLegends) {
  1585. this._scale[index] = scale;
  1586. }
  1587. return this;
  1588. },
  1589. /**
  1590. * Set the swatch size function of a legend. If the index is out of range no information is changed.
  1591. * @param (int) index Legend array index
  1592. * @param (rave['internal']['ValueFunction']) swatchSize Swatch size function, may be null
  1593. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1594. */
  1595. /** @expose */
  1596. swatchSize : function(index, swatchSize) {
  1597. if (index >= 0 && index < this._numLegends) {
  1598. this._swatchSizes[index] = swatchSize;
  1599. }
  1600. return this;
  1601. },
  1602. /**
  1603. * 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.
  1604. * @param (int) index Legend array index
  1605. * @param (Array) entries List of data slot entries, if null an empty list is used
  1606. * @param (String) format One of {@link this.CustomFormatInfo#"none"} or {@link this.CustomFormatInfo#"percent"}
  1607. * @param (rave['internal']['ValueFunction']) defaultFunction Default function to use if no custom formatter is defined, may be null
  1608. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1609. */
  1610. /** @expose */
  1611. formatterList : function(index, entries, format, defaultFunction) {
  1612. if (index >= 0 && index < this._numLegends) {
  1613. this._formatters[index] = this._context.getCustomFormatterWithFlag(["legend", "all"], rave['library']['internal']['BundleContext'].makeCustomFormatInfo("legend-label", "ROLE_NONE", format, entries), defaultFunction, false);
  1614. }
  1615. return this;
  1616. },
  1617. /**
  1618. * 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.
  1619. * @param (int) index Legend array index
  1620. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  1621. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1622. */
  1623. /** @expose */
  1624. formatter : function(index, entry) {
  1625. var entries = [];
  1626. if (entry) {
  1627. entries.push(entry);
  1628. }
  1629. return this.formatterList(index, entries, "none", null);
  1630. },
  1631. /**
  1632. * 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.
  1633. * @return (boolean) Whether any legend are visible (will be drawn)
  1634. */
  1635. /** @expose */
  1636. anyVisible : function() {
  1637. for (var i = 0; i < this._numLegends; ++i) {
  1638. if (this._visible[i] == true && (this._palettes[i] || this._swatchSizes[i])) {
  1639. return true;
  1640. }
  1641. }
  1642. return false;
  1643. },
  1644. /**
  1645. * 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'])} .
  1646. * @param (int) index Legend array index
  1647. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  1648. * @return (com.ibm.rave.bundles.components.LegendsManager) This LegendsManager
  1649. */
  1650. /** @expose */
  1651. setDataSlot : function(index, entry) {
  1652. if (index >= 0 && index < this._numLegends) {
  1653. this._dataSlotEntries[index] = entry;
  1654. }
  1655. return this.formatter(index, entry);
  1656. },
  1657. preLayout$0 : function(layoutComponent) {
  1658. this.preLayout$1(layoutComponent, true);
  1659. return this;
  1660. },
  1661. preLayout$1 : function(layoutComponent, axesBeforeLegend) {
  1662. var layoutTransition = this._doTransition;
  1663. var layoutDuration = this._duration;
  1664. this._doTransition = false;
  1665. this._duration = 0;
  1666. var children = [];
  1667. for (var i = 0; i < this._numLegends; ++i) {
  1668. children[i] = "g.layoutLegend-" + i;
  1669. }
  1670. rave['library']['internal']['AbstractView'].createGroupStructure(this._context.node.select("g.legends-layout"), children);
  1671. var layoutSelectors = [];
  1672. var layoutLastVisible = [];
  1673. for (var i = 0; i < this._numLegends; ++i) {
  1674. layoutSelectors[i] = this._selectors[i];
  1675. layoutLastVisible[i] = this._lastVisible[i];
  1676. this._lastVisible[i] = false;
  1677. if (this._selectors[i]) {
  1678. this._selectors[i] = this._context.node.select("g.layoutLegend-" + i);
  1679. }
  1680. }
  1681. layoutComponent.preLayout(true, !axesBeforeLegend);
  1682. this.rectangle(layoutComponent.legendRect());
  1683. this.draw();
  1684. this._doTransition = layoutTransition;
  1685. this._duration = layoutDuration;
  1686. this._context.node.select("g.legends-layout").selectAll("*").remove();
  1687. for (var i = 0; i < this._numLegends; ++i) {
  1688. this._lastVisible[i] = layoutLastVisible[i];
  1689. this._selectors[i] = layoutSelectors[i];
  1690. }
  1691. return this;
  1692. },
  1693. /**
  1694. * Render the legends using the current global and per-legend settings.
  1695. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1696. */
  1697. /** @expose */
  1698. draw : function() {
  1699. var nVisible = 0;
  1700. for (var i = 0; i < this._numLegends; ++i) {
  1701. if ((this._swatchSizes[i] || this._palettes[i]) && this._visible[i]) {
  1702. nVisible++;
  1703. }
  1704. }
  1705. var x = this._rectangle.x;
  1706. var y = this._rectangle.y;
  1707. var dx;
  1708. var dy;
  1709. var size;
  1710. if (nVisible == 0) {
  1711. dx = 0;
  1712. dy = 0;
  1713. size = [this._rectangle.width, this._rectangle.height];
  1714. } else if ("horizontal" == this._orient) {
  1715. dx = this._rectangle.width / nVisible;
  1716. dy = 0;
  1717. size = [dx, this._rectangle.height];
  1718. } else {
  1719. dx = 0;
  1720. dy = this._rectangle.height / nVisible;
  1721. size = [this._rectangle.width, dy];
  1722. }
  1723. this._comp.orient(this._orient).size(size);
  1724. this._spaceUsed = 0;
  1725. for (var i = 0; i < this._numLegends; ++i) {
  1726. if (this._selectors[i]) {
  1727. var visible = this._visible[i] && (this._palettes[i] || this._swatchSizes[i]);
  1728. 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]);
  1729. var fontStyle = this._context.getPropertyValue("legend.titlestyle.font");
  1730. if (this._titleFonts[i] != null && !(this._titleFonts[i] == "")) {
  1731. this._comp.titleFont(this._titleFonts[i]);
  1732. } else if (fontStyle != null && !(fontStyle == "")) {
  1733. this._comp.titleFont(this._context.getPropertyValue("legend.titlestyle.font"));
  1734. }
  1735. fontStyle = this._context.getPropertyValue("legend.entrystyle.font");
  1736. if (this._entryFonts[i] != null) {
  1737. this._comp.entryFont(this._entryFonts[i]);
  1738. } else if (fontStyle != null && !(fontStyle == "")) {
  1739. this._comp.entryFont(this._context.getPropertyValue("legend.entrystyle.font"));
  1740. }
  1741. var s = (this._doTransition && this._lastVisible[i]) ? this._selectors[i].transition("transition").duration(this._duration) : this._selectors[i];
  1742. s.attr("transform", "translate(" + x + "," + y + ")").call(this._comp);
  1743. var dataSlotEntries = [];
  1744. if (this._dataSlotEntries[i]) {
  1745. dataSlotEntries.push(this._dataSlotEntries[i]);
  1746. }
  1747. this._selectors[i].selectAll(".legendTitle").property("dataSlots", dataSlotEntries);
  1748. if (visible) {
  1749. x += dx;
  1750. y += dy;
  1751. if (this._comp.getSpaceUsed() > this._spaceUsed) {
  1752. this._spaceUsed = this._comp.getSpaceUsed();
  1753. }
  1754. }
  1755. this._lastVisible[i] = visible;
  1756. } else {
  1757. this._lastVisible[i] = false;
  1758. }
  1759. }
  1760. return this;
  1761. },
  1762. /** @expose */
  1763. getSizableType : function() {
  1764. return 2;
  1765. },
  1766. /** @expose */
  1767. getSizableOrientation : function() {
  1768. return this._orient;
  1769. },
  1770. /** @expose */
  1771. getPreferredSize : function() {
  1772. return this._spaceUsed;
  1773. },
  1774. /** @expose */
  1775. getSpillOverSize : function() {
  1776. return 0;
  1777. },
  1778. /** @expose */
  1779. visible : function(a0, a1) {
  1780. var args = arguments;
  1781. if (args.length == 1) {
  1782. return this.visible$1(a0);
  1783. }
  1784. return this.visible$0(a0, a1);
  1785. },
  1786. /** @expose */
  1787. preLayout : function(a0, a1) {
  1788. var args = arguments;
  1789. if (args.length == 1) {
  1790. return this.preLayout$0(a0);
  1791. }
  1792. return this.preLayout$1(a0, a1);
  1793. }
  1794. });
  1795. // $source: com/ibm/rave/bundles/utilities/FontPropertyParser
  1796. /************************************************************************
  1797. ** IBM Confidential
  1798. **
  1799. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1800. **
  1801. ** (C) Copyright IBM Corp. 2017
  1802. **
  1803. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1804. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1805. ************************************************************************/
  1806. // GENERATED
  1807. var com_ibm_rave_bundles_utilities_FontPropertyParser = rave['internal']['Declare']({
  1808. });
  1809. /**
  1810. * Method to parse the css font styles and return a style map.
  1811. * @param (String) fontStyle CSS string (eg. "font-family: courier; font-size: 22; fill: red")
  1812. * @return (Object) Font Style Map
  1813. */
  1814. /** @expose */
  1815. com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont = function(fontStyle) {
  1816. if (fontStyle != null && fontStyle.length > 0) {
  1817. var properties = fontStyle.split(new RegExp(";"));
  1818. var fontStyles = {};
  1819. for (var __i_enFor0 = 0, __len_enFor0 = properties.length;
  1820. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1821. var property = properties[__i_enFor0];
  1822. var fontMap = property.split(new RegExp(":"));
  1823. if (fontMap.length == 2) {
  1824. var key = fontMap[0].trim();
  1825. fontStyles[key == "color" ? "fill" : key] = fontMap[1].trim();
  1826. }
  1827. }
  1828. return fontStyles;
  1829. }
  1830. return null;
  1831. };
  1832. // $source: com/ibm/rave/bundles/components/AxesManager
  1833. /************************************************************************
  1834. ** IBM Confidential
  1835. **
  1836. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1837. **
  1838. ** (C) Copyright IBM Corp. 2018
  1839. **
  1840. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1841. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1842. ************************************************************************/
  1843. // GENERATED
  1844. //@import com/ibm/rave/bundles/components/AxisComponentImpl (runtime) // new, getTranslation
  1845. //@import com/ibm/rave/bundles/components/GridComponentImpl (runtime) // new
  1846. //@import com/ibm/rave/bundles/components/ClipPathComponentImpl (runtime) // new
  1847. /**
  1848. * <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>
  1849. */
  1850. var com_ibm_rave_bundles_components_AxesManager = rave['internal']['Declare']({
  1851. /**
  1852. * Bundle context
  1853. */
  1854. //_context : null,
  1855. /**
  1856. * Selector for the bundle defs node. If null, no clip paths will be defined.
  1857. */
  1858. //_defs : null,
  1859. /**
  1860. * Scales for the axes, indexed by X1, X2, Y1, Y2
  1861. */
  1862. //_scales : null,
  1863. /**
  1864. * Whether to suppress labels when panning, indexed by X1, X2, Y1, Y2.
  1865. */
  1866. //_suppressPanLabels : null,
  1867. /**
  1868. * Value of the axis drawAxisLabels, set when axis is drawn, indexed by X1, X2, Y1, Y2.
  1869. */
  1870. //_drawAxisLabels : null,
  1871. /**
  1872. * Axis components created on demand, indexed by X1, X2, Y1, Y2
  1873. */
  1874. //_axisComponents : null,
  1875. /**
  1876. * When last drawn, the selector used for each axis role, indexed by X1, X2, Y1, Y2; used for redraws.
  1877. */
  1878. //_lastAxisDrawSelectors : null,
  1879. /**
  1880. * Grid components created on demand, indexed by X1, X2, Y1, Y2
  1881. */
  1882. //_gridComponents : null,
  1883. /**
  1884. * When last drawn, the selector used for each grid role, indexed by X1, X2, Y1, Y2; used for redraws.
  1885. */
  1886. //_lastGridDrawSelectors : null,
  1887. /**
  1888. * For clearing axis
  1889. */
  1890. //_clearAxis : null,
  1891. /**
  1892. * For clearing grid
  1893. */
  1894. //_clearGrid : null,
  1895. /**
  1896. * Selectors for the axis groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1897. */
  1898. //_axisSelectors : null,
  1899. /**
  1900. * Selectors for the grid groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1901. */
  1902. //_gridSelectors : null,
  1903. /**
  1904. * Bounding rectangles for the axis groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1905. */
  1906. //_axisRects : null,
  1907. /**
  1908. * Center elements bounds, also the grid bounds.
  1909. */
  1910. //_elementRect : null,
  1911. /**
  1912. * Whether anything was drawn into the axis group last time, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1913. */
  1914. //_lastAxisDrew : null,
  1915. /**
  1916. * Whether anything was drawn into the grid group last time, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1917. */
  1918. //_lastGridDrew : null,
  1919. //_dataSlotEntries : null,
  1920. //_layoutAxisOrder : null,
  1921. /**
  1922. * On the first draw, no transitions are used.
  1923. */
  1924. _firstDraw : false,
  1925. /**
  1926. * Whether to draw the axes and grids.
  1927. */
  1928. _visible : true,
  1929. /**
  1930. * Transition duration, ms
  1931. */
  1932. _duration : 0,
  1933. /**
  1934. * Transpose the axes (assign X to left/right and Y to top/bottom)
  1935. */
  1936. _transpose : false,
  1937. /**
  1938. * Switch the independent (X) axes, drawing X1 where X2 normally goes and vice-versa
  1939. */
  1940. _swapX : false,
  1941. /**
  1942. * Switch the dependent (Y) axes, drawing Y1 where Y2 normally goes and vice-versa
  1943. */
  1944. _swapY : false,
  1945. _layoutInProgress : false,
  1946. _layoutMaxWidth : 0,
  1947. _layoutMaxHeight : 0,
  1948. _xPadding : 0, _xOuterPadding : 0, _yPadding : 0, _yOuterPadding : 0,
  1949. _xPixelPad : 0, _yPixelPad : 0,
  1950. /**
  1951. * Hack to allow heatmap in "unit cell" mode to disable stagger because of the post scaling that messes up axis layout
  1952. */
  1953. _preventStaggerRotate45 : false,
  1954. constructor : function(context) {
  1955. this._scales = [];
  1956. this._suppressPanLabels = [];
  1957. this._drawAxisLabels = [];
  1958. this._axisComponents = [];
  1959. this._lastAxisDrawSelectors = [];
  1960. this._gridComponents = [];
  1961. this._lastGridDrawSelectors = [];
  1962. this._clearAxis = new com_ibm_rave_bundles_components_AxisComponentImpl();
  1963. this._clearGrid = new com_ibm_rave_bundles_components_GridComponentImpl();
  1964. this._axisSelectors = [];
  1965. this._gridSelectors = [];
  1966. this._axisRects = [];
  1967. this._elementRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1968. this._lastAxisDrew = [];
  1969. this._lastGridDrew = [];
  1970. this._dataSlotEntries = [];
  1971. this._layoutAxisOrder = [];
  1972. /**
  1973. * Construct and initialize. No axis scales or selector groups are defined.
  1974. * @param (rave['library']['internal']['BundleContext']) context The bundle context
  1975. */
  1976. {
  1977. this._context = context;
  1978. for (var i = 0; i < 4; ++i) {
  1979. this._scales[i] = null;
  1980. this._suppressPanLabels[i] = false;
  1981. this._axisComponents[i] = null;
  1982. this._lastAxisDrawSelectors[i] = null;
  1983. this._gridComponents[i] = null;
  1984. this._lastGridDrawSelectors[i] = null;
  1985. this._axisSelectors[i] = null;
  1986. this._gridSelectors[i] = null;
  1987. this._axisRects[i] = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1988. this._lastAxisDrew[i] = false;
  1989. this._lastGridDrew[i] = false;
  1990. this._dataSlotEntries[i] = [];
  1991. }
  1992. }
  1993. },
  1994. /** @expose */
  1995. preLayout : function(layoutComponent, axesBeforeLegend, xPadding, xOuterPadding, xPixelPad, yPadding, yOuterPadding, yPixelPad) {
  1996. this._xPadding = xPadding;
  1997. this._xOuterPadding = xOuterPadding;
  1998. this._xPixelPad = xPixelPad;
  1999. this._yPadding = yPadding;
  2000. this._yOuterPadding = yOuterPadding;
  2001. this._yPixelPad = yPixelPad;
  2002. this._layoutInProgress = true;
  2003. var layoutDuration = this._duration;
  2004. this._duration = 0;
  2005. 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"];
  2006. rave['library']['internal']['AbstractView'].createGroupStructure(this._context.node.select("g.axes-layout"), children);
  2007. var layoutAxisSelectors = [];
  2008. var layoutGridSelectors = [];
  2009. var layoutLastAxisDrew = [];
  2010. for (var position = 0; position < 4; ++position) {
  2011. if (this._axisComponents[position]) {
  2012. this._axisComponents[position].preLayout();
  2013. }
  2014. layoutAxisSelectors[position] = this._axisSelectors[position];
  2015. layoutGridSelectors[position] = this._gridSelectors[position];
  2016. layoutLastAxisDrew[position] = this._lastAxisDrew[position];
  2017. if (this._axisSelectors[position]) {
  2018. this.axisSelector(position, this._context.node.select("g.layoutAxis-" + com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position]));
  2019. }
  2020. if (this._gridSelectors[position]) {
  2021. this.gridSelector(position, this._context.node.select("g.layoutGrid-" + com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position]));
  2022. }
  2023. }
  2024. layoutComponent.preLayout(axesBeforeLegend, true);
  2025. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, layoutComponent.elementRect());
  2026. var countHorz = 0;
  2027. var countVert = 0;
  2028. var axes = [];
  2029. for (var position = 0; position < 4; ++position) {
  2030. var role = this.positionToRole(position);
  2031. var isHorz = position == 1 || position == 0;
  2032. if (this._axisSelectors[position] && this._scales[role]) {
  2033. if (isHorz) {
  2034. countHorz++;
  2035. } else {
  2036. countVert++;
  2037. }
  2038. if (this._scales[role].isOrdinal() || this._scales[role].isClustered()) {
  2039. var score = isHorz ? 4 : 2;
  2040. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, score));
  2041. } else {
  2042. var score = isHorz ? 3 : 1;
  2043. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, score));
  2044. }
  2045. } else {
  2046. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, 5));
  2047. }
  2048. }
  2049. axes.sort(function(a1, a2) {
  2050. var a1value = a1.score;
  2051. var a2value = a2.score;
  2052. return a1value < a2value ? -1 : a1value > a2value ? 1 : 0;
  2053. });
  2054. this._layoutAxisOrder = [];
  2055. for (var i = 0; i < 4; ++i) {
  2056. this._layoutAxisOrder[i] = axes[i].position;
  2057. }
  2058. this._layoutMaxWidth = this._elementRect.width * (countVert > 1 ? 0.5 : 0.4);
  2059. this._layoutMaxHeight = this._elementRect.height * (countHorz > 1 ? 0.5 : 0.4);
  2060. for (var index = 0; index < 4; ++index) {
  2061. var position = this._layoutAxisOrder[index];
  2062. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[position], this._elementRect);
  2063. }
  2064. this.draw();
  2065. this._duration = layoutDuration;
  2066. this._context.node.select("g.axes-layout").selectAll("*").remove();
  2067. for (var position = 0; position < 4; ++position) {
  2068. this._lastAxisDrew[position] = layoutLastAxisDrew[position];
  2069. this._axisSelectors[position] = layoutAxisSelectors[position];
  2070. this._gridSelectors[position] = layoutGridSelectors[position];
  2071. }
  2072. this._layoutInProgress = false;
  2073. return this;
  2074. },
  2075. getPositionToDraw : function(index) {
  2076. return this._layoutInProgress ? this._layoutAxisOrder[index] : index;
  2077. },
  2078. preDrawAxis : function(index) {
  2079. if (this._layoutInProgress) {
  2080. var position = this._layoutAxisOrder[index];
  2081. var role = this.positionToRole(position);
  2082. if (role == 0 || role == 1) {
  2083. this.setScaleRangePadded(this._scales[role], false, this._xPadding, this._xOuterPadding, this._xPixelPad);
  2084. } else {
  2085. this.setScaleRangePadded(this._scales[role], true, this._yPadding, this._yOuterPadding, this._yPixelPad);
  2086. }
  2087. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(true);
  2088. }
  2089. },
  2090. postDrawAxis : function(index) {
  2091. if (this._layoutInProgress) {
  2092. var position = this._layoutAxisOrder[index];
  2093. var role = this.positionToRole(position);
  2094. var axis = this._axisComponents[role];
  2095. var size = axis.getPreferredSize();
  2096. if (position == 1 || position == 0) {
  2097. if (size > this._layoutMaxHeight) {
  2098. size = this._layoutMaxHeight;
  2099. }
  2100. this._elementRect.height -= size;
  2101. if (position == 1) {
  2102. this._elementRect.y += size;
  2103. }
  2104. } else {
  2105. if (size > this._layoutMaxWidth) {
  2106. size = this._layoutMaxWidth;
  2107. }
  2108. this._elementRect.width -= size;
  2109. if (position == 2) {
  2110. this._elementRect.x += size;
  2111. }
  2112. }
  2113. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(false);
  2114. }
  2115. },
  2116. /**
  2117. * 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.
  2118. */
  2119. /** @expose */
  2120. draw : function() {
  2121. for (var role = 0; role < 4; ++role) {
  2122. this._lastAxisDrawSelectors[role] = null;
  2123. this._lastGridDrawSelectors[role] = null;
  2124. }
  2125. for (var index = 0; index < 4; ++index) {
  2126. var position = this.getPositionToDraw(index);
  2127. var role = this.positionToRole(position);
  2128. if (!this._visible || !this._axisSelectors[position] || !this._scales[role]) {
  2129. this.clearAxis(position);
  2130. this.clearGrid(position);
  2131. } else {
  2132. this.preDrawAxis(index);
  2133. this.drawAxis(position, role);
  2134. this.postDrawAxis(index);
  2135. if (this._gridSelectors[position]) {
  2136. this.drawGrid(position, role);
  2137. }
  2138. }
  2139. }
  2140. this._firstDraw = false;
  2141. },
  2142. /**
  2143. * @return (boolean) true if we are hiding any labels during pan-zoom.
  2144. */
  2145. /** @expose */
  2146. hideAnyPanZoom : function() {
  2147. return (this._suppressPanLabels[0] || this._suppressPanLabels[1] || this._suppressPanLabels[2] || this._suppressPanLabels[3]);
  2148. },
  2149. /**
  2150. * 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.
  2151. * @param (boolean) panning Whether this is a pan in-progress; use false otherwise including when pan-zoom ends.
  2152. */
  2153. /** @expose */
  2154. redraw : function(panning) {
  2155. for (var role = 0; role < 4; ++role) {
  2156. if (this._axisComponents[role] && this._lastAxisDrawSelectors[role]) {
  2157. this._axisComponents[role].displayTickLabels(this._drawAxisLabels[role]);
  2158. this._axisComponents[role].showPanZoomTickLabels(!panning || !this._suppressPanLabels[role]);
  2159. var isAllow = this._axisComponents[role].isAllowAutomaticAxisLayoutToChangeOrientation();
  2160. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(false);
  2161. this._lastAxisDrawSelectors[role].call(this._axisComponents[role]);
  2162. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(isAllow);
  2163. }
  2164. if (this._gridComponents[role] && this._lastGridDrawSelectors[role]) {
  2165. this._lastGridDrawSelectors[role].call(this._gridComponents[role]);
  2166. }
  2167. }
  2168. },
  2169. /** @expose */
  2170. preventStaggerRotate45 : function(preventStaggerRotate45) {
  2171. this._preventStaggerRotate45 = preventStaggerRotate45;
  2172. },
  2173. /**
  2174. * 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.
  2175. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2176. * @param (int) role The axis role, X1, X2, Y1, or Y2
  2177. */
  2178. drawAxis : function(position, role) {
  2179. var axisGroup = this._axisSelectors[position];
  2180. this._lastAxisDrawSelectors[role] = axisGroup;
  2181. var comp = this.axisComponent(role);
  2182. var layoutModeID = role == 2 ? "axis.y.labels.layoutMode" : role == 3 ? "axis.y2.labels.layoutMode" : "axis.x.labels.layoutMode";
  2183. var allowStaggerID = role == 2 ? "axis.y.labels.allowStagger" : role == 3 ? "axis.y2.labels.allowStagger" : "axis.x.labels.allowStagger";
  2184. var allowRotate45ID = role == 2 ? "axis.y.labels.allowRotate45" : role == 3 ? "axis.y2.labels.allowRotate45" : "axis.x.labels.allowRotate45";
  2185. var allowRotate90ID = role == 2 ? "axis.y.labels.allowRotate90" : role == 3 ? "axis.y2.labels.allowRotate90" : "axis.x.labels.allowRotate90";
  2186. var layoutMode = ""+(this._context.getPropertyValue(layoutModeID));
  2187. var allowStagger = !this._preventStaggerRotate45 && (this._context.getPropertyValue(allowStaggerID));
  2188. var allowRotate45 = !this._preventStaggerRotate45 && (this._context.getPropertyValue(allowRotate45ID));
  2189. var allowRotate90 = (this._context.getPropertyValue(allowRotate90ID));
  2190. var textTruncateIndicator = (this._context.getPropertyValue("axis.labels.truncationText"));
  2191. var axisBounds = this._axisRects[position];
  2192. var orient = com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position];
  2193. var transform = com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation(axisBounds, orient);
  2194. var axisTransform = "translate(" + transform[0] + "," + transform[1] + ")";
  2195. 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);
  2196. this._drawAxisLabels[role] = comp._displayTickLabels;
  2197. var axisGroupUpdate = axisGroup;
  2198. if (this._duration > 0 && !this._firstDraw && this._lastAxisDrew[position]) {
  2199. axisGroupUpdate = axisGroup.transition().duration(this._duration);
  2200. }
  2201. axisGroupUpdate.attr("transform", axisTransform);
  2202. axisGroupUpdate.call(comp);
  2203. var dataSlotEntryList = this._dataSlotEntries[role];
  2204. axisGroup.selectAll(".axis-title").property("dataSlots", dataSlotEntryList);
  2205. this._lastAxisDrew[position] = comp.renderedShapes();
  2206. if (this._defs) {
  2207. var clipAxis = new com_ibm_rave_bundles_components_ClipPathComponentImpl(this._context.instanceId() + "clip" + orient);
  2208. var text = axisGroup.append("text").text("000,000");
  2209. var bbox = text.node().getBBox();
  2210. var w = bbox.width;
  2211. var h = bbox.height;
  2212. text.remove();
  2213. var clipRect;
  2214. if (position == 0 || position == 1) {
  2215. var leftEdge = axisBounds.x + transform[0] * -1;
  2216. var rightEdge = leftEdge + axisBounds.width;
  2217. if (!(this._scales[role].isOrdinal()) && !(this._scales[role].isClustered())) {
  2218. var numericLeftEdge = this._elementRect.x - w + transform[0] * -1;
  2219. var numericRightEdge = numericLeftEdge + this._elementRect.width + w * 2;
  2220. if (numericLeftEdge < leftEdge) {
  2221. leftEdge = numericLeftEdge;
  2222. }
  2223. if (numericRightEdge > rightEdge) {
  2224. rightEdge = numericRightEdge;
  2225. }
  2226. }
  2227. clipRect = new rave['internal']['RectStruct'](leftEdge, axisBounds.y + transform[1] * -1, rightEdge - leftEdge, axisBounds.height);
  2228. } else {
  2229. clipRect = new rave['internal']['RectStruct'](axisBounds.x + transform[0] * -1, this._elementRect.y - h / 2 + transform[1] * -1, axisBounds.width, this._elementRect.height + h);
  2230. }
  2231. clipAxis.clipRect(clipRect).applyTo(axisGroup.select(".axis." + orient)).call(this._defs);
  2232. }
  2233. },
  2234. /**
  2235. * If the axis selector for the position is defined, clear the shapes from the axis group.
  2236. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2237. */
  2238. clearAxis : function(position) {
  2239. if (this._axisSelectors[position]) {
  2240. this._clearAxis.scale(null);
  2241. this._axisSelectors[position].call(this._clearAxis);
  2242. }
  2243. this._lastAxisDrew[position] = false;
  2244. },
  2245. /**
  2246. * 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.
  2247. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2248. * @param (int) role The axis role, X1, X2, Y1, or Y2
  2249. */
  2250. drawGrid : function(position, role) {
  2251. var gridGroup = this._gridSelectors[position];
  2252. this._lastGridDrawSelectors[role] = gridGroup;
  2253. var comp = this.gridComponent(role);
  2254. var axisBounds = this._axisRects[position];
  2255. var orient = com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position];
  2256. var transform = com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation(axisBounds, orient);
  2257. var axisTransform = "translate(" + transform[0] + "," + transform[1] + ")";
  2258. comp.setRole(com_ibm_rave_bundles_components_AxesManager.ROLES[role]).orient(orient).setPreExecute(this._context.getPreExecute()).bounds(this._elementRect).axis(this._axisComponents[role].axis());
  2259. if (this._duration <= 0 || this._firstDraw || !this._lastAxisDrew[position]) {
  2260. gridGroup.attr("transform", axisTransform).call(comp);
  2261. } else {
  2262. gridGroup.transition().duration(this._duration).attr("transform", axisTransform).call(comp);
  2263. }
  2264. this._lastGridDrew[position] = comp.renderedShapes();
  2265. },
  2266. /**
  2267. * If the grid selector for the position is defined, clear the shapes from the grid group.
  2268. * @param (int) position The grid position, BOTTOM, TOP, LEFT, RIGHT
  2269. */
  2270. clearGrid : function(position) {
  2271. if (this._gridSelectors[position]) {
  2272. this._clearGrid.axis(null);
  2273. this._gridSelectors[position].call(this._clearGrid);
  2274. }
  2275. this._lastGridDrew[position] = false;
  2276. },
  2277. /**
  2278. * @param (boolean) visible Whether the manager should draw axes
  2279. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2280. */
  2281. /** @expose */
  2282. visible : function(visible) {
  2283. this._visible = visible;
  2284. return this;
  2285. },
  2286. /**
  2287. * @param (int) duration The transition duration; if <= 0, no transition is used.
  2288. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2289. */
  2290. /** @expose */
  2291. duration : function(duration) {
  2292. this._duration = duration;
  2293. return this;
  2294. },
  2295. /**
  2296. * @param (boolean) transpose Whether to transpose the chart (switch the positions of the X and Y axis)
  2297. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2298. */
  2299. /** @expose */
  2300. transpose : function(transpose) {
  2301. this._transpose = transpose;
  2302. return this;
  2303. },
  2304. /**
  2305. * @param (boolean) swapX Whether to switch the postitions of the X1 and X2 axes
  2306. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2307. */
  2308. /** @expose */
  2309. swapX : function(swapX) {
  2310. this._swapX = swapX;
  2311. return this;
  2312. },
  2313. /**
  2314. * @param (boolean) swapY Whether to switch the postitions of the Y1 and Y2 axes
  2315. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2316. */
  2317. /** @expose */
  2318. swapY : function(swapY) {
  2319. this._swapY = swapY;
  2320. return this;
  2321. },
  2322. /**
  2323. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2324. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale The coordinate scale for that role, may be null
  2325. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2326. */
  2327. /** @expose */
  2328. scale : function(role, scale) {
  2329. this._scales[role] = scale;
  2330. return this;
  2331. },
  2332. /**
  2333. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2334. * @param (boolean) suppressLabels Whether to suppress the labels when panning the axis
  2335. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2336. */
  2337. /** @expose */
  2338. suppressPanLabels : function(role, suppressLabels) {
  2339. this._suppressPanLabels[role] = suppressLabels;
  2340. return this;
  2341. },
  2342. /**
  2343. * 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.
  2344. * @param (int) role The role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2345. * @return (com.ibm.rave.bundles.components.AxisComponentImpl) The component for the role
  2346. */
  2347. /** @expose */
  2348. axisComponent : function(role) {
  2349. if (!this._axisComponents[role]) {
  2350. this._axisComponents[role] = new com_ibm_rave_bundles_components_AxisComponentImpl();
  2351. }
  2352. return this._axisComponents[role];
  2353. },
  2354. /**
  2355. * 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.
  2356. * @param (int) role The role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2357. * @return (com.ibm.rave.bundles.components.GridComponentImpl) The component for the role
  2358. */
  2359. /** @expose */
  2360. gridComponent : function(role) {
  2361. if (!this._gridComponents[role]) {
  2362. this._gridComponents[role] = new com_ibm_rave_bundles_components_GridComponentImpl();
  2363. }
  2364. return this._gridComponents[role];
  2365. },
  2366. /**
  2367. * Set the bundle &lt;defs&gt; node. Clip paths will be defined in this node.
  2368. * @param (rave['internal']['Selector']) defs The defs node
  2369. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2370. */
  2371. /** @expose */
  2372. defsSelector : function(defs) {
  2373. this._defs = com_ibm_rave_bundles_components_AxesManager.checkSelector(defs);
  2374. return this;
  2375. },
  2376. /**
  2377. * Set the selector for an axis group node.
  2378. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2379. * @param (rave['internal']['Selector']) axisGroup The axis group node, may be null
  2380. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2381. */
  2382. /** @expose */
  2383. axisSelector : function(position, axisGroup) {
  2384. this._axisSelectors[position] = com_ibm_rave_bundles_components_AxesManager.checkSelector(axisGroup);
  2385. return this;
  2386. },
  2387. /**
  2388. * Set the selector for a grid group node.
  2389. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2390. * @param (rave['internal']['Selector']) gridGroup The grid group node, may be null
  2391. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2392. */
  2393. /** @expose */
  2394. gridSelector : function(position, gridGroup) {
  2395. this._gridSelectors[position] = com_ibm_rave_bundles_components_AxesManager.checkSelector(gridGroup);
  2396. return this;
  2397. },
  2398. /**
  2399. * Set the element (grid) bounds rectangle to a copy of the given rectangle.
  2400. * @param (rave['internal']['RectStruct']) elementRect The rectangle, if null the bounds are set to 0,0,0,0
  2401. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2402. */
  2403. /** @expose */
  2404. elementRect : function(elementRect) {
  2405. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, elementRect);
  2406. return this;
  2407. },
  2408. /**
  2409. * Set an axis bounds rectangle to a copy of the given rectangle.
  2410. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2411. * @param (rave['internal']['RectStruct']) axisRect The axis bounds, if null the bounds are set to 0,0,0,0
  2412. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2413. */
  2414. /** @expose */
  2415. axisRect : function(position, axisRect) {
  2416. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[position], axisRect);
  2417. return this;
  2418. },
  2419. /**
  2420. * 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.
  2421. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2422. */
  2423. /** @expose */
  2424. useDefaultSelectors : function() {
  2425. this.defsSelector(this._context.node.select("defs"));
  2426. this.axisSelector(0, this._context.node.select("g.axisTransform.bottom"));
  2427. this.axisSelector(1, this._context.node.select("g.axisTransform.top"));
  2428. this.axisSelector(2, this._context.node.select("g.axisTransform.left"));
  2429. this.axisSelector(3, this._context.node.select("g.axisTransform.right"));
  2430. this.gridSelector(0, this._context.node.select("g.grid.bottom"));
  2431. this.gridSelector(1, this._context.node.select("g.grid.top"));
  2432. this.gridSelector(2, this._context.node.select("g.grid.left"));
  2433. this.gridSelector(3, this._context.node.select("g.grid.right"));
  2434. return this;
  2435. },
  2436. /**
  2437. * Convenience method: Set the element rectangle and axis rectangles from the rectangles in the layout.
  2438. * @param (com.ibm.rave.bundles.components.ChartLayoutComponentImpl) layoutInfo Layout information
  2439. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2440. */
  2441. /** @expose */
  2442. useBoundsFromLayout : function(layoutInfo) {
  2443. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, layoutInfo.elementRect());
  2444. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[0], layoutInfo.bottomRect());
  2445. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[1], layoutInfo.topRect());
  2446. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[2], layoutInfo.leftRect());
  2447. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[3], layoutInfo.rightRect());
  2448. return this;
  2449. },
  2450. /**
  2451. * 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.
  2452. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2453. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2454. */
  2455. /** @expose */
  2456. useDefaultX1Properties : function(setGridParameters) {
  2457. 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"))));
  2458. var titleFontStyle = (this._context.getPropertyValue("axis.x.title.style.font"));
  2459. var labelFontStyle = (this._context.getPropertyValue("axis.x.labels.style.font"));
  2460. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2461. this.axisComponent(0).labelStyle(labelFontStyle);
  2462. } else {
  2463. 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")));
  2464. }
  2465. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2466. this.axisComponent(0).titleStyle(titleFontStyle);
  2467. } else {
  2468. 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")));
  2469. }
  2470. if (setGridParameters) {
  2471. 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")));
  2472. }
  2473. this.suppressPanLabels(0, (this._context.getPropertyValue("axis.x.labels.zoomPan")));
  2474. return this;
  2475. },
  2476. /**
  2477. * 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.
  2478. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2479. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2480. */
  2481. /** @expose */
  2482. useDefaultY1Properties : function(setGridParameters) {
  2483. 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")));
  2484. var titleFontStyle = (this._context.getPropertyValue("axis.y.title.style.font"));
  2485. var labelFontStyle = (this._context.getPropertyValue("axis.y.labels.style.font"));
  2486. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2487. this.axisComponent(2).labelStyle(labelFontStyle);
  2488. } else {
  2489. 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")));
  2490. }
  2491. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2492. this.axisComponent(2).titleStyle(titleFontStyle);
  2493. } else {
  2494. 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")));
  2495. }
  2496. if (setGridParameters) {
  2497. 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")));
  2498. }
  2499. this.suppressPanLabels(2, (this._context.getPropertyValue("axis.y.labels.zoomPan")));
  2500. return this;
  2501. },
  2502. /**
  2503. * 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.
  2504. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2505. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2506. */
  2507. /** @expose */
  2508. useDefaultY2Properties : function(setGridParameters) {
  2509. 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")));
  2510. var titleFontStyle = (this._context.getPropertyValue("axis.y2.title.style.font"));
  2511. var labelFontStyle = (this._context.getPropertyValue("axis.y2.labels.style.font"));
  2512. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2513. this.axisComponent(3).labelStyle(labelFontStyle);
  2514. } else {
  2515. 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")));
  2516. }
  2517. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2518. this.axisComponent(3).titleStyle(titleFontStyle);
  2519. } else {
  2520. 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")));
  2521. }
  2522. if (setGridParameters) {
  2523. 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")));
  2524. }
  2525. this.suppressPanLabels(3, (this._context.getPropertyValue("axis.y2.labels.zoomPan")));
  2526. return this;
  2527. },
  2528. /**
  2529. * 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.
  2530. * @param (int) role One of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2531. * @param (Array) entries Non-null list of data slot entries
  2532. * @param (String) format One of {@link this.CustomFormatInfo#"none"} or {@link this.CustomFormatInfo#"percent"}
  2533. * @param (rave['internal']['ValueFunction']) defaultFunction Default function to use if no custom formatter is defined for the axis, may be null
  2534. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2535. */
  2536. /** @expose */
  2537. setTickFormatterList : function(role, entries, format, defaultFunction) {
  2538. var fmtRole;
  2539. switch (role) {
  2540. case 2:
  2541. fmtRole = "ROLE_Y1";
  2542. break;
  2543. case 1:
  2544. fmtRole = "ROLE_X2";
  2545. break;
  2546. case 3:
  2547. fmtRole = "ROLE_Y2";
  2548. break;
  2549. case 0:
  2550. default:
  2551. fmtRole = "ROLE_X1";
  2552. break;
  2553. }
  2554. 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);
  2555. this.axisComponent(role).tickFormat(fmt);
  2556. 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);
  2557. this.axisComponent(role).simplifiedTickFormat(simplefmt);
  2558. return this;
  2559. },
  2560. /**
  2561. * 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.
  2562. * @param (int) role One of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2563. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  2564. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2565. */
  2566. /** @expose */
  2567. setTickFormatter : function(role, entry) {
  2568. var entries = [];
  2569. if (entry) {
  2570. entries.push(entry);
  2571. }
  2572. return this.setTickFormatterList(role, entries, "none", null);
  2573. },
  2574. /**
  2575. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined scale.
  2576. * @param (Number) padding Padding, relevant only for ordinal scales
  2577. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2578. * @param (int) pixelPad Pixel padding at each end
  2579. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2580. */
  2581. /** @expose */
  2582. setScaleRanges : function(padding, outerPadding, pixelPad) {
  2583. this.setIndependentScaleRanges(padding, outerPadding, pixelPad);
  2584. this.setDependentScaleRanges(padding, outerPadding, pixelPad);
  2585. return this;
  2586. },
  2587. /**
  2588. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined independent scale.
  2589. * @param (Number) padding Padding, relevant only for ordinal scales
  2590. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2591. * @param (int) pixelPad Pixel padding at each end
  2592. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2593. */
  2594. /** @expose */
  2595. setIndependentScaleRanges : function(padding, outerPadding, pixelPad) {
  2596. this.setScaleRangePadded(this._scales[0], false, padding, outerPadding, pixelPad);
  2597. this.setScaleRangePadded(this._scales[1], false, padding, outerPadding, pixelPad);
  2598. return this;
  2599. },
  2600. /**
  2601. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined independent scale.
  2602. * @param (Number) padding Padding, relevant only for ordinal scales
  2603. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2604. * @param (int) pixelPad Pixel padding at each end
  2605. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2606. */
  2607. /** @expose */
  2608. setDependentScaleRanges : function(padding, outerPadding, pixelPad) {
  2609. this.setScaleRangePadded(this._scales[2], true, padding, outerPadding, pixelPad);
  2610. this.setScaleRangePadded(this._scales[3], true, padding, outerPadding, pixelPad);
  2611. return this;
  2612. },
  2613. /**
  2614. * 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)} .
  2615. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2616. * @param (rave['library']['internal']['DataSlotEntry']) slot DataSlotEntry to be associated with the axis role.
  2617. */
  2618. setDataSlot$0 : function(role, slot) {
  2619. this.setDataSlot$1(role, [slot]);
  2620. return this;
  2621. },
  2622. /**
  2623. * Set a list of data slot entries that will be associated with the specified axis role.
  2624. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2625. * @param (Array) slots List of DataSlotEntry to be associated with the axis role.
  2626. */
  2627. setDataSlot$1 : function(role, slots) {
  2628. if (role < 4 && role >= 0) {
  2629. this._dataSlotEntries[role].length = 0;
  2630. if (slots) {
  2631. for (var __i_enFor0 = 0, __exp_enFor0 = slots, __len_enFor0 = __exp_enFor0.length;
  2632. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2633. var slot = __exp_enFor0[__i_enFor0];
  2634. this._dataSlotEntries[role].push(slot);
  2635. }
  2636. }
  2637. }
  2638. return this;
  2639. },
  2640. /**
  2641. * </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.
  2642. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale Bundle independent scale
  2643. * @param (boolean) dependent Whether this is the dependent scale
  2644. * @param (Number) padding Padding, relevant only for ordinal scales
  2645. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2646. * @param (int) pixelPad Pixel padding at each end
  2647. */
  2648. setScaleRangePadded : function(scale, dependent, padding, outerPadding, pixelPad) {
  2649. if (scale) {
  2650. var min, max;
  2651. if (dependent == this._transpose) {
  2652. min = this._elementRect.x + pixelPad;
  2653. max = this._elementRect.x + this._elementRect.width - pixelPad;
  2654. } else {
  2655. if (scale.isContinuous()) {
  2656. min = this._elementRect.y + this._elementRect.height - pixelPad;
  2657. max = this._elementRect.y + pixelPad;
  2658. } else {
  2659. min = this._elementRect.y + pixelPad;
  2660. max = this._elementRect.y + this._elementRect.height - pixelPad;
  2661. }
  2662. }
  2663. scale.range(min, max, padding, outerPadding);
  2664. }
  2665. },
  2666. /**
  2667. * Given a geometric position BOTTOM, TOP, LEFT, or RIGHT, return the role X1, X2, Y1, or Y2 used by that role.
  2668. * @param (int) position The position index
  2669. * @return (int) The role index
  2670. */
  2671. positionToRole : function(position) {
  2672. var r = position;
  2673. if (this._transpose) {
  2674. r = (r + 2) % 4;
  2675. }
  2676. if (this._swapX && r < 2) {
  2677. r = 1 - r;
  2678. }
  2679. if (this._swapY && r > 1) {
  2680. r = 5 - r;
  2681. }
  2682. return r;
  2683. },
  2684. /**
  2685. * Given a role X1, X2, Y1, or Y2, return the geometric position BOTTOM, TOP, LEFT, or RIGHT for that role.
  2686. * @param (int) role The role index
  2687. * @return (int) The position index
  2688. */
  2689. roleToPosition : function(role) {
  2690. var p = role;
  2691. if (this._swapX && role < 2) {
  2692. p = 1 - p;
  2693. }
  2694. if (this._swapY && p > 1) {
  2695. p = 5 - p;
  2696. }
  2697. if (this._transpose) {
  2698. p = (p + 2) % 4;
  2699. }
  2700. return p;
  2701. },
  2702. /**
  2703. * Sets the magnitude for the tick interval.
  2704. * @param (int) role role index of the axis
  2705. * @param (Number) tickMagnitude power of 10
  2706. * @return (com.ibm.rave.bundles.components.AxesManager) this
  2707. */
  2708. /** @expose */
  2709. scaleTickMagnitude : function(role, tickMagnitude) {
  2710. this.axisComponent(role).scaleTickMagnitude(tickMagnitude);
  2711. return this;
  2712. },
  2713. /** @expose */
  2714. setDataSlot : function(a0, a1) {
  2715. var args = arguments;
  2716. if (args.length == 2 && typeof a1 === "function") {
  2717. return this.setDataSlot$0(a0, a1);
  2718. }
  2719. return this.setDataSlot$1(a0, a1);
  2720. }
  2721. });
  2722. /**
  2723. * @param (rave['internal']['Selector']) s A selector
  2724. * @return (rave['internal']['Selector']) s if it is non-null and has at least one node, null otherwise
  2725. */
  2726. com_ibm_rave_bundles_components_AxesManager.checkSelector = function(s) {
  2727. return s && !(s.empty()) ? s : null;
  2728. };
  2729. /**
  2730. * Set a rectangle to a copy of another. If the source is null, the target is set to 0,0,0,0
  2731. * @param (rave['internal']['RectStruct']) target A non-null rectangle
  2732. * @param (rave['internal']['RectStruct']) source A possibly-null rectnalge
  2733. */
  2734. com_ibm_rave_bundles_components_AxesManager.setRect = function(target, source) {
  2735. if (source) {
  2736. target.x = source.x;
  2737. target.y = source.y;
  2738. target.width = source.width;
  2739. target.height = source.height;
  2740. } else {
  2741. target.x = 0;
  2742. target.y = 0;
  2743. target.width = 0;
  2744. target.height = 0;
  2745. }
  2746. };
  2747. /**
  2748. * A ValueFunction that appends '%' to the value.
  2749. * @param (int) n Number of digits
  2750. */
  2751. /** @expose */
  2752. com_ibm_rave_bundles_components_AxesManager.percentFormat = function(n) {
  2753. var digits = "." + n + "f";
  2754. var format = rave.format(digits);
  2755. return function(value, ix, gix) {
  2756. return format.call(null, value, 0, 0) + "%";
  2757. };
  2758. };
  2759. /**
  2760. * Called prior to chart layout. Axes are configured with no real bounding constraints to calculate their preferred size.
  2761. */
  2762. com_ibm_rave_bundles_components_AxesManager.AxisLayout = rave['internal']['Declare']({
  2763. /** @expose */
  2764. position : 0,
  2765. /** @expose */
  2766. score : 0,
  2767. constructor : function(position, score) {
  2768. this.position = position;
  2769. this.score = score;
  2770. }
  2771. });
  2772. /**
  2773. * Logical first X (independent) axis, default position bottom
  2774. */
  2775. /** @expose */
  2776. com_ibm_rave_bundles_components_AxesManager.X1 = 0;
  2777. /**
  2778. * Logical second X (independent) axis, default position top
  2779. */
  2780. /** @expose */
  2781. com_ibm_rave_bundles_components_AxesManager.X2 = 1;
  2782. /**
  2783. * Logical first Y (dependent) axis, default position left
  2784. */
  2785. /** @expose */
  2786. com_ibm_rave_bundles_components_AxesManager.Y1 = 2;
  2787. /**
  2788. * Logical first Y (dependent) axis, default position right
  2789. */
  2790. /** @expose */
  2791. com_ibm_rave_bundles_components_AxesManager.Y2 = 3;
  2792. /**
  2793. * Geometric group on bottom
  2794. */
  2795. /** @expose */
  2796. com_ibm_rave_bundles_components_AxesManager.BOTTOM = 0;
  2797. /**
  2798. * Geometric group on top
  2799. */
  2800. /** @expose */
  2801. com_ibm_rave_bundles_components_AxesManager.TOP = 1;
  2802. /**
  2803. * Geometric group on left
  2804. */
  2805. /** @expose */
  2806. com_ibm_rave_bundles_components_AxesManager.LEFT = 2;
  2807. /**
  2808. * Geometric group on right
  2809. */
  2810. /** @expose */
  2811. com_ibm_rave_bundles_components_AxesManager.RIGHT = 3;
  2812. /**
  2813. * Maps the role indexes to the role strings used by the components API
  2814. */
  2815. com_ibm_rave_bundles_components_AxesManager.ROLES = ["ROLE_X1", "ROLE_X2", "ROLE_Y1", "ROLE_Y2"];
  2816. /**
  2817. * Maps the role indexes to the role strings used by the custom formatter API. TODO: Unify the strings
  2818. */
  2819. com_ibm_rave_bundles_components_AxesManager.ROLE_FORMATTERS = ["ROLE_X1", "ROLE_X2", "ROLE_Y1", "ROLE_Y2"];
  2820. /**
  2821. * Maps the position indexes to the orient strings used by D3
  2822. */
  2823. com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS = ["bottom", "top", "left", "right"];
  2824. /**
  2825. * Maps the position indexes to the custom formatter strings
  2826. */
  2827. com_ibm_rave_bundles_components_AxesManager.FORMATTERS = ["bottom", "top", "left", "right"];
  2828. // $source: com/ibm/rave/bundles/component/AxisComponent
  2829. /************************************************************************
  2830. ** IBM Confidential
  2831. **
  2832. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2833. **
  2834. ** (C) Copyright IBM Corp. 2017
  2835. **
  2836. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2837. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2838. ************************************************************************/
  2839. // GENERATED
  2840. /**
  2841. * <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>
  2842. */
  2843. var com_ibm_rave_bundles_component_AxisComponent = rave['internal']['Declare'].implement(
  2844. /**
  2845. * @return (String) The role of the axis in the chart
  2846. */
  2847. //role : function() {},
  2848. /**
  2849. * @return (rave['internal']['Axis']) The capability Axis used by this AxisComponent
  2850. */
  2851. //axis : function() {},
  2852. /**
  2853. * The tickFormat is applied to the values of the ticks to create the string that is displayed.
  2854. * @param (rave['internal']['ValueFunction']) tickFormat The new tickFormat
  2855. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2856. */
  2857. //tickFormat : function(tickFormat) {},
  2858. /**
  2859. * Get the tickFormat function used by this component. May be null.
  2860. * @return (rave['internal']['ValueFunction']) Format function, or null
  2861. */
  2862. //tickFormat : function() {},
  2863. /**
  2864. * Set the indicator to be used for truncated text ex: indicator set to "..." , results in helloworld - > hello...
  2865. * @param (String) indicator the string to be placed to indicated truncated text
  2866. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2867. */
  2868. //textTruncateIndicator : function(indicator) {},
  2869. /**
  2870. * Whether to display the axis title.
  2871. * @param (boolean) displayAxisTitle true to display the axis title, false otherwise
  2872. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2873. */
  2874. //displayAxisTitle : function(displayAxisTitle) {},
  2875. /**
  2876. * Whether to display the axis line.
  2877. * @param (boolean) displayAxisLine true to display the axis line, false otherwise
  2878. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2879. */
  2880. //displayAxisLine : function(displayAxisLine) {},
  2881. /**
  2882. * Whether to display the axis tick marks.
  2883. * @param (boolean) displayTicks true to display the axis ticks, false otherwise
  2884. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2885. */
  2886. //displayTicks : function(displayTicks) {},
  2887. /**
  2888. * Whether to display the axis labels, as set by the show axis labels property
  2889. * @param (boolean) displayTickLabels true to display the axis tick labels, false otherwise
  2890. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2891. */
  2892. //displayTickLabels : function(displayTickLabels) {},
  2893. /**
  2894. * Whether to display the axis labels, as set by the hide pan-zoom labels property
  2895. * @param (boolean) showPanZoomTickLabels true to display the axis tick labels, false otherwise
  2896. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2897. */
  2898. //showPanZoomTickLabels : function(showPanZoomTickLabels) {},
  2899. /**
  2900. * @param (String) axisTitle The new axisTitle
  2901. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2902. */
  2903. //axisTitle : function(axisTitle) {},
  2904. /**
  2905. * 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)} .
  2906. * @param (String) axisColor The new line and tick color
  2907. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2908. */
  2909. //axisColor : function(axisColor) {},
  2910. /**
  2911. * The color used to draw the axis line.
  2912. * @param (String) lineColor The new lineColor
  2913. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2914. */
  2915. //lineColor : function(lineColor) {},
  2916. /**
  2917. * The color used to draw the axis ticks.
  2918. * @param (String) tickColor The new tickColor
  2919. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2920. */
  2921. //tickColor : function(tickColor) {},
  2922. /**
  2923. * The color used to draw the axis labels.
  2924. * @param (String) labelColor The new labelColor
  2925. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2926. */
  2927. //labelColor : function(labelColor) {},
  2928. /**
  2929. * The style for the axis labels.
  2930. * @param (String) fontStyle CSS string of font properties
  2931. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2932. */
  2933. //labelStyle : function(fontStyle) {},
  2934. /**
  2935. * The style for the axis labels.
  2936. * @param (String) fill The color used to draw the labels
  2937. * @param (String) fontSize CSS font size
  2938. * @param (String) fontFamily CSS font-families list
  2939. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2940. */
  2941. //labelStyle : function(fill, fontSize, fontFamily) {},
  2942. /**
  2943. * The color used to draw the axis title.
  2944. * @param (String) titleColor The new titleColor
  2945. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2946. */
  2947. //titleColor : function(titleColor) {},
  2948. /**
  2949. * The style for the axis title.
  2950. * @param (String) fontStyle CSS string of font properties
  2951. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2952. */
  2953. //titleStyle : function(fontStyle) {},
  2954. /**
  2955. * The style for the axis title.
  2956. * @param (String) fill The color used to draw the title
  2957. * @param (String) fontSize CSS font size
  2958. * @param (String) fontFamily CSS font-families list
  2959. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2960. */
  2961. //titleStyle : function(fill, fontSize, fontFamily) {}
  2962. );
  2963. /**
  2964. * The string returned by {@link #this.type()} is "AxisComponent".
  2965. */
  2966. /** @expose */
  2967. com_ibm_rave_bundles_component_AxisComponent.COMPONENT_TYPE = "AxisComponent";
  2968. /**
  2969. * Returned by {@link #this.role()} for the first independent axis.
  2970. */
  2971. /** @expose */
  2972. com_ibm_rave_bundles_component_AxisComponent.ROLE_X1 = "ROLE_X1";
  2973. /**
  2974. * Returned by {@link #this.role()} for the first dependent axis.
  2975. */
  2976. /** @expose */
  2977. com_ibm_rave_bundles_component_AxisComponent.ROLE_Y1 = "ROLE_Y1";
  2978. /**
  2979. * Returned by {@link #this.role()} for the second independent axis.
  2980. */
  2981. /** @expose */
  2982. com_ibm_rave_bundles_component_AxisComponent.ROLE_X2 = "ROLE_X2";
  2983. /**
  2984. * Returned by {@link #this.role()} for the second dependent axis.
  2985. */
  2986. /** @expose */
  2987. com_ibm_rave_bundles_component_AxisComponent.ROLE_Y2 = "ROLE_Y2";
  2988. // $source: com/ibm/rave/bundles/utilities/TextCrossfader
  2989. /************************************************************************
  2990. ** IBM Confidential
  2991. **
  2992. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2993. **
  2994. ** (C) Copyright IBM Corp. 2017
  2995. **
  2996. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2997. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2998. ************************************************************************/
  2999. // GENERATED
  3000. /**
  3001. * <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>
  3002. */
  3003. var com_ibm_rave_bundles_utilities_TextCrossfader = rave['internal']['Declare']({
  3004. });
  3005. /**
  3006. * <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!
  3007. * @param (rave['internal']['Selection']) selection Selection containing the single text node, may be a transition
  3008. * @param (String) oldText Old value of the text string, may be null
  3009. * @param (String) newText New value of the text string, may be null
  3010. * @param (Object) fillOpacity Fill opacity, may be null (in which case 1.0 is assumed)
  3011. * @param (double) delay Number between 0 and 0.5 controlling the timing of the fade
  3012. * @return (rave['internal']['Selection']) The selection, modified by the new text and fill-opacity
  3013. */
  3014. /** @expose */
  3015. com_ibm_rave_bundles_utilities_TextCrossfader.textCrossFade = function(selection, oldText, newText, fillOpacity, delay) {
  3016. if (!(selection.isTransition())) {
  3017. return selection.text(newText);
  3018. }
  3019. var _t = (selection).tween("text", function(data, index, groupIndex) {
  3020. return function(t) {
  3021. this.rave_setText(t < 0.5 ? oldText : newText);
  3022. };
  3023. });
  3024. var t0 = Math.max(0.0, Math.min(0.5, delay));
  3025. if (t0 == 0.5 || (oldText == null && newText == null) || (oldText != null && oldText == newText)) {
  3026. return selection;
  3027. }
  3028. var opacity = fillOpacity == null ? 1.0 : + (fillOpacity);
  3029. var tf = 1.0 / (0.5 - t0);
  3030. return _t.tween("fill-opacity", function(data, index, groupIndex) {
  3031. return function(t) {
  3032. if (t <= t0 || t >= (1.0 - t0)) {
  3033. this.rave_setStyle("fill-opacity", fillOpacity);
  3034. } else {
  3035. this.rave_setStyle("fill-opacity", opacity * Math.abs(t - 0.5) * tf);
  3036. }
  3037. };
  3038. });
  3039. };
  3040. // $source: com/ibm/rave/bundles/utilities/BundleLabelDropper
  3041. /************************************************************************
  3042. ** IBM Confidential
  3043. **
  3044. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3045. **
  3046. ** (C) Copyright IBM Corp. 2017
  3047. **
  3048. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3049. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3050. ************************************************************************/
  3051. // GENERATED
  3052. var com_ibm_rave_bundles_utilities_BundleLabelDropper = rave['internal']['Declare']({
  3053. //_dropOverlap : null,
  3054. labelCount : 0,
  3055. _$functionClassMethod : function() {
  3056. var _$self = function(args) {
  3057. if (args !== null || arguments.length > 1){
  3058. args = Array.prototype.slice.call(arguments, 0);
  3059. }
  3060. {
  3061. _$self.drop(args[0], ((args[1])));
  3062. return null;
  3063. }
  3064. };
  3065. return _$self;
  3066. },
  3067. /** @expose */
  3068. constructor : function() {
  3069. this._dropOverlap = (rave.capabilities.extension("position")).drop().remove(false);
  3070. this._dropOverlap.setOverlapGap(4.0);
  3071. },
  3072. /**
  3073. * Drop the overlapping labels or reset the overlap.
  3074. * @param (rave['internal']['Selection']) labels The selector for the labels
  3075. * @param (boolean) removeOverlap true to remove the overlapping labels, false to reset
  3076. */
  3077. /** @expose */
  3078. drop : function(labels, removeOverlap) {
  3079. if (!(labels.isTransition())) {
  3080. this.applyLabelDrop(labels, removeOverlap);
  3081. } else {
  3082. var steps = [0, 25, 75];
  3083. var self = this;
  3084. (labels).tween("__pointLabelDrop__", function(data, index, groupIndex) {
  3085. if (index == 0) {
  3086. return function(t) {
  3087. var currentStep = Math.floor(t * 100);
  3088. if (steps.length > 0 && currentStep < 100 && currentStep >= steps[0]) {
  3089. steps.splice(0, 1);
  3090. self.applyLabelDrop(labels, removeOverlap);
  3091. }
  3092. };
  3093. }
  3094. return null;
  3095. });
  3096. this.labelCount = 0;
  3097. (labels).each(function(data, index, groupIndex) {
  3098. ++self.labelCount;
  3099. }).each("end", function(args) {
  3100. if (args !== null || arguments.length > 1){
  3101. args = Array.prototype.slice.call(arguments, 0);
  3102. }
  3103. {
  3104. if (--self.labelCount == 0) {
  3105. self.applyLabelDrop(labels, removeOverlap);
  3106. }
  3107. return null;
  3108. }
  3109. });
  3110. }
  3111. },
  3112. applyLabelDrop : function(labels, removeOverlap) {
  3113. if (removeOverlap) {
  3114. labels.call(this._dropOverlap);
  3115. } else {
  3116. this._dropOverlap.reset(labels);
  3117. }
  3118. },
  3119. /** @expose */
  3120. configureForDataLabels : function(rect) {
  3121. if (rect) {
  3122. var ex = [[rect.x, rect.y], [rect.x + rect.width, rect.y + rect.height]];
  3123. this._dropOverlap.extent(ex);
  3124. }
  3125. this._dropOverlap.noClipping();
  3126. }
  3127. });
  3128. /**
  3129. * Drop overlap extension
  3130. */
  3131. //com_ibm_rave_bundles_utilities_BundleLabelDropper.POSITION_EXTENSION = "position";
  3132. /**
  3133. * space between labels during overlap testing
  3134. */
  3135. com_ibm_rave_bundles_utilities_BundleLabelDropper.OVERLAP_GAP = 4;
  3136. // $source: com/ibm/rave/bundles/components/StyleStructs
  3137. /************************************************************************
  3138. ** IBM Confidential
  3139. **
  3140. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3141. **
  3142. ** (C) Copyright IBM Corp. 2017
  3143. **
  3144. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3145. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3146. ************************************************************************/
  3147. // GENERATED
  3148. /**
  3149. * Struct classes to hold style properties.
  3150. */
  3151. var com_ibm_rave_bundles_components_StyleStructs = rave['internal']['Declare']({
  3152. });
  3153. /**
  3154. * Filled shape style properties.
  3155. */
  3156. com_ibm_rave_bundles_components_StyleStructs.ShapeStyle = function() {
  3157. this._fill = null;
  3158. this._stroke = null;
  3159. this._strokeWidth = null;
  3160. };
  3161. /**
  3162. * Line style properties.
  3163. */
  3164. com_ibm_rave_bundles_components_StyleStructs.LineStyle = function() {
  3165. this._stroke = null;
  3166. this._strokeWidth = null;
  3167. this._dashArray = null;
  3168. };
  3169. // $source: com/ibm/rave/bundles/component/GridComponent
  3170. /************************************************************************
  3171. ** IBM Confidential
  3172. **
  3173. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3174. **
  3175. ** (C) Copyright IBM Corp. 2017
  3176. **
  3177. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3178. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3179. ************************************************************************/
  3180. // GENERATED
  3181. /**
  3182. * <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>
  3183. */
  3184. var com_ibm_rave_bundles_component_GridComponent = rave['internal']['Declare'].implement(
  3185. /**
  3186. * @return (String) The role of the grid in the chart
  3187. */
  3188. //role : function() {},
  3189. /**
  3190. * Whether to display the gridlines.
  3191. * @param (boolean) displayGridlines The new displayGridlines
  3192. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3193. */
  3194. //displayGridlines : function(displayGridlines) {},
  3195. /**
  3196. * Set the line styling. Equivalent to calling {@link #this.gridlineColor(String)} and {@link #this.dashArray(String)} .
  3197. * @param (String) stroke The stroke color
  3198. * @param (String) dashArray The stroke-dasharray
  3199. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3200. */
  3201. //gridlineStyle : function(stroke, dashArray) {},
  3202. /**
  3203. * The color used to draw the gridlines.
  3204. * @param (String) gridlineColor The new stroke color
  3205. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3206. */
  3207. //gridlineColor : function(gridlineColor) {},
  3208. /**
  3209. * 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.
  3210. * @param (String) dashArray The new dash array
  3211. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3212. */
  3213. //dashArray : function(dashArray) {}
  3214. );
  3215. /**
  3216. * The string returned by {@link #this.type()} is "GridComponent".
  3217. */
  3218. /** @expose */
  3219. com_ibm_rave_bundles_component_GridComponent.COMPONENT_TYPE = "GridComponent";
  3220. // $source: com/ibm/rave/bundles/components/IntervalDataUtilities
  3221. /************************************************************************
  3222. ** IBM Confidential
  3223. **
  3224. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3225. **
  3226. ** (C) Copyright IBM Corp. 2017
  3227. **
  3228. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3229. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3230. ************************************************************************/
  3231. // GENERATED
  3232. /**
  3233. * 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.
  3234. */
  3235. var com_ibm_rave_bundles_components_IntervalDataUtilities = rave['internal']['Declare']({
  3236. });
  3237. /**
  3238. * <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>
  3239. * @param (Array) data Data array
  3240. * @param (rave['internal']['SingleValueFunction']) x X accessor, should not be null
  3241. * @param (rave['internal']['SingleValueFunction']) xScale Function to check if the X value is valid
  3242. * @param (rave['internal']['SingleValueFunction']) y Y accessor, should not be null
  3243. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3244. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3245. * @return (Array) Array of intervals for the data
  3246. */
  3247. /** @expose */
  3248. com_ibm_rave_bundles_components_IntervalDataUtilities.simpleBars = function(data, x, xScale, y, yStart, color, label) {
  3249. var result = [];
  3250. if (!data || data.length == 0 || !x || !y) {
  3251. return result;
  3252. }
  3253. data.forEach(function(d, ix, list) {
  3254. var xv = x(d);
  3255. if (xv != null && (!xScale || xScale(xv) != null)) {
  3256. var yv = y(d);
  3257. var yvStart = !yStart ? 0 : yStart(d);
  3258. if (yv != null && yvStart != null) {
  3259. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3260. r.key = ix;
  3261. r.ind1 = xv;
  3262. r.ind2 = r.ind1;
  3263. r.cind = r.ind1;
  3264. r.dep1 = yvStart;
  3265. r.dep2 = yv;
  3266. r.cdep = r.dep2;
  3267. r.color = color ? color(d) : null;
  3268. r.label = label ? label(d) : null;
  3269. r.value = r.dep2;
  3270. r._originalData = d;
  3271. r.valueAsPercentOfCategory = 100;
  3272. result.push(r);
  3273. }
  3274. }
  3275. return null;
  3276. });
  3277. var sum = 0;
  3278. for (var i = 0; i < result.length; ++i) {
  3279. var iData = result[i];
  3280. var value = + (iData.value);
  3281. sum += Math.abs(value);
  3282. }
  3283. if (sum != 0) {
  3284. for (var i = 0; i < result.length; ++i) {
  3285. var iData = result[i];
  3286. var value = + (iData.value);
  3287. iData.valueAsPercentOfColor = value / sum * 100;
  3288. }
  3289. }
  3290. return result;
  3291. };
  3292. /**
  3293. * Create intervals for bars in a clustered chart. This is similar to the simple bars, except the independent values are an array of accessors.
  3294. * @param (Array) data Data array
  3295. * @param (Array) x Independent accessor array, should not be null and no entries should be null
  3296. * @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
  3297. * @param (rave['internal']['SingleValueFunction']) y Dependent accessor, should not be null
  3298. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3299. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3300. * @return (Array) Array of intervals for the data
  3301. */
  3302. /** @expose */
  3303. com_ibm_rave_bundles_components_IntervalDataUtilities.clusteredBars = function(data, x, xScale, y, yStart, color, label) {
  3304. var result = [];
  3305. if (!data || data.length == 0 || !x || x.length == 0 || !y) {
  3306. return result;
  3307. }
  3308. var len = x.length;
  3309. var categories = {};
  3310. var colors = {};
  3311. data.forEach(function(d, ix, list) {
  3312. var OK = true;
  3313. var ind = [];
  3314. for (var i = 0; i < len; ++i) {
  3315. var xv = x[i](d);
  3316. if (xv == null || (xScale[i] && xScale[i](xv) == null)) {
  3317. OK = false;
  3318. break;
  3319. }
  3320. ind.push(xv);
  3321. if (i == 0) {
  3322. if (!(categories.hasOwnProperty(xv))) {
  3323. categories[""+(xv)] = 1;
  3324. }
  3325. } else if (!(colors.hasOwnProperty(xv))) {
  3326. colors[""+(xv)] = 1;
  3327. }
  3328. }
  3329. var dep = y(d);
  3330. var depStart = !yStart ? 0 : yStart(d);
  3331. if (OK && dep != null && depStart != null) {
  3332. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3333. r.key = ix;
  3334. r.ind1 = ind;
  3335. r.ind2 = ind;
  3336. r.cind = ind;
  3337. r.dep1 = depStart;
  3338. r.dep2 = dep;
  3339. r.cdep = r.dep2;
  3340. r.color = color ? color(d) : null;
  3341. r.label = label ? label(d) : null;
  3342. r.value = r.dep2;
  3343. r._originalData = d;
  3344. result.push(r);
  3345. }
  3346. return null;
  3347. });
  3348. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(categories), __len_enFor0 = __exp_enFor0.length;
  3349. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3350. var o = __exp_enFor0[__i_enFor0];
  3351. var s = ""+(o);
  3352. var sum = 0;
  3353. for (var i = 0; i < result.length; ++i) {
  3354. var iData = result[i];
  3355. if (s == (iData.ind1)[0]) {
  3356. var value = + (iData.value);
  3357. sum += Math.abs(value);
  3358. }
  3359. }
  3360. if (sum == 0) {
  3361. continue;
  3362. }
  3363. for (var i = 0; i < result.length; ++i) {
  3364. var iData = result[i];
  3365. if (s == (iData.ind1)[0]) {
  3366. var value = + (iData.value);
  3367. iData.valueAsPercentOfCategory = value / sum * 100;
  3368. }
  3369. }
  3370. }
  3371. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(colors), __len_enFor1 = __exp_enFor1.length;
  3372. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3373. var o = __exp_enFor1[__i_enFor1];
  3374. var s = ""+(o);
  3375. var sum = 0;
  3376. for (var i = 0; i < result.length; ++i) {
  3377. var iData = result[i];
  3378. if (s == iData.color) {
  3379. var value = + (iData.value);
  3380. sum += Math.abs(value);
  3381. }
  3382. }
  3383. if (sum == 0) {
  3384. continue;
  3385. }
  3386. for (var i = 0; i < result.length; ++i) {
  3387. var iData = result[i];
  3388. if (s == iData.color) {
  3389. var value = + (iData.value);
  3390. iData.valueAsPercentOfColor = value / sum * 100;
  3391. }
  3392. }
  3393. }
  3394. return result;
  3395. };
  3396. /**
  3397. * 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.
  3398. * @param (Array) data Data array
  3399. * @param (rave['internal']['SingleValueFunction']) x Independent accessor, should not be null
  3400. * @param (rave['internal']['SingleValueFunction']) xScale Possibly-null function to check if X values are in domain
  3401. * @param (rave['internal']['SingleValueFunction']) y Dependent accessor, should not be null
  3402. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3403. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3404. * @param (boolean) percent If true, create percent bars
  3405. * @return (Array) Array of intervals for the data
  3406. */
  3407. /** @expose */
  3408. com_ibm_rave_bundles_components_IntervalDataUtilities.stackedBars = function(data, x, xScale, y, color, label, percent) {
  3409. var result = [];
  3410. if (!data || data.length == 0 || !x || !y) {
  3411. return result;
  3412. }
  3413. var stacks = {};
  3414. var categories = {};
  3415. var colors = {};
  3416. data.forEach(function(d, ix, list) {
  3417. var xv = x(d);
  3418. if (xv != null && (!xScale || xScale(xv) != null)) {
  3419. var yv = y(d);
  3420. if (yv != null) {
  3421. var stack = stacks[xv];
  3422. if (!stack) {
  3423. stack = new com_ibm_rave_bundles_components_IntervalDataUtilities.Stack();
  3424. stacks[xv] = stack;
  3425. }
  3426. var dVal = + (yv);
  3427. if (!percent) {
  3428. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3429. r.key = ix;
  3430. r.ind1 = xv;
  3431. r.ind2 = xv;
  3432. r.cind = xv;
  3433. var sum = dVal < 0.0 ? stack.negativeSum : stack.positiveSum;
  3434. r.dep1 = sum;
  3435. r.dep2 = sum + dVal;
  3436. r.cdep = r.dep2;
  3437. r.color = color ? color(d) : null;
  3438. r.label = label ? label(d) : null;
  3439. r.value = dVal;
  3440. r._originalData = d;
  3441. result.push(r);
  3442. }
  3443. if (dVal < 0.0) {
  3444. stack.negativeSum += dVal;
  3445. } else {
  3446. stack.positiveCount++;
  3447. stack.positiveSum += dVal;
  3448. }
  3449. if (!(categories.hasOwnProperty(xv))) {
  3450. categories[""+(xv)] = 1;
  3451. }
  3452. if (color) {
  3453. var o = color(d);
  3454. if ((o != null) && !(colors.hasOwnProperty(o))) {
  3455. colors[""+(o)] = 1;
  3456. }
  3457. }
  3458. }
  3459. }
  3460. return null;
  3461. });
  3462. if (percent) {
  3463. data.forEach(function(d, ix, list) {
  3464. var xv = x(d);
  3465. if (xv != null && (!xScale || xScale(xv) != null)) {
  3466. var yv = y(d);
  3467. if (yv != null) {
  3468. var stack = stacks[xv];
  3469. var dVal = + (yv);
  3470. var percent;
  3471. if (dVal < 0.0) {
  3472. percent = -100.0 * dVal / stack.negativeSum;
  3473. } else if (stack.positiveSum > 0) {
  3474. percent = 100.0 * dVal / stack.positiveSum;
  3475. } else {
  3476. percent = 100.0 / stack.positiveCount;
  3477. }
  3478. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3479. r.key = ix;
  3480. r.ind1 = xv;
  3481. r.ind2 = xv;
  3482. r.cind = xv;
  3483. var sum = dVal < 0.0 ? stack.negativePercent : stack.positivePercent;
  3484. r.dep1 = sum;
  3485. r.dep2 = sum + percent;
  3486. r.cdep = r.dep2;
  3487. r.color = color ? color(d) : null;
  3488. r.label = label ? label(d) : null;
  3489. r.value = dVal;
  3490. r.valueAsPercentOfCategory = percent;
  3491. r._originalData = d;
  3492. result.push(r);
  3493. if (dVal < 0.0) {
  3494. stack.negativePercent += percent;
  3495. } else {
  3496. stack.positivePercent += percent;
  3497. }
  3498. }
  3499. }
  3500. return null;
  3501. });
  3502. } else {
  3503. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(categories), __len_enFor0 = __exp_enFor0.length;
  3504. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3505. var o = __exp_enFor0[__i_enFor0];
  3506. var s = ""+(o);
  3507. var sum = 0;
  3508. for (var i = 0; i < result.length; ++i) {
  3509. var iData = result[i];
  3510. if (s == iData.ind1) {
  3511. var value = + (iData.value);
  3512. sum += Math.abs(value);
  3513. }
  3514. }
  3515. if (sum == 0) {
  3516. continue;
  3517. }
  3518. for (var i = 0; i < result.length; ++i) {
  3519. var iData = result[i];
  3520. if (s == iData.ind1) {
  3521. var value = + (iData.value);
  3522. iData.valueAsPercentOfCategory = value / sum * 100;
  3523. }
  3524. }
  3525. }
  3526. }
  3527. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(colors), __len_enFor1 = __exp_enFor1.length;
  3528. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3529. var o = __exp_enFor1[__i_enFor1];
  3530. var s = ""+(o);
  3531. var sum = 0;
  3532. for (var i = 0; i < result.length; ++i) {
  3533. var iData = result[i];
  3534. if (s == iData.color) {
  3535. var value = + (iData.value);
  3536. sum += Math.abs(value);
  3537. }
  3538. }
  3539. if (sum == 0) {
  3540. continue;
  3541. }
  3542. for (var i = 0; i < result.length; ++i) {
  3543. var iData = result[i];
  3544. if (s == iData.color) {
  3545. var value = + (iData.value);
  3546. iData.valueAsPercentOfColor = value / sum * 100;
  3547. }
  3548. }
  3549. }
  3550. return result;
  3551. };
  3552. /**
  3553. * Structure class holding interval information.
  3554. */
  3555. com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData = rave['internal']['Declare']({
  3556. /**
  3557. * Key value; for now this is the data index
  3558. */
  3559. /** @expose */
  3560. key : null,
  3561. /**
  3562. * First independent value
  3563. */
  3564. /** @expose */
  3565. ind1 : null,
  3566. /**
  3567. * Second independent value (in all current uses, same as ind1)
  3568. */
  3569. /** @expose */
  3570. ind2 : null,
  3571. /**
  3572. * First dependent value
  3573. */
  3574. /** @expose */
  3575. dep1 : null,
  3576. /**
  3577. * Second dependent value
  3578. */
  3579. /** @expose */
  3580. dep2 : null,
  3581. /**
  3582. * The data value that the interval represents. Not the pixel value. Used in stacked chart
  3583. */
  3584. /** @expose */
  3585. value : null,
  3586. /**
  3587. * Color value
  3588. */
  3589. /** @expose */
  3590. color : null,
  3591. /**
  3592. * Label value
  3593. */
  3594. /** @expose */
  3595. label : null,
  3596. /**
  3597. * Callout independent value (in all current uses, same as ind1)
  3598. */
  3599. /** @expose */
  3600. cind : null,
  3601. /**
  3602. * Callout dependent value (dependent extent)
  3603. */
  3604. /** @expose */
  3605. cdep : null,
  3606. /** @expose */
  3607. _originalData : null,
  3608. /**
  3609. * The data value (in percentage) for specific category
  3610. */
  3611. /** @expose */
  3612. valueAsPercentOfCategory : NaN,
  3613. /**
  3614. * The data value (in percentage) across all categories
  3615. */
  3616. /** @expose */
  3617. valueAsPercentOfColor : NaN,
  3618. /** @expose */
  3619. originalData : function() {
  3620. return this._originalData;
  3621. },
  3622. /** @expose */
  3623. originalDataList : function() {
  3624. var list = [];
  3625. list.push(this._originalData);
  3626. return list;
  3627. }
  3628. });
  3629. com_ibm_rave_bundles_components_IntervalDataUtilities.Stack = function() {
  3630. this.positiveCount = 0;
  3631. this.positiveSum = 0;
  3632. this.negativeSum = 0;
  3633. this.positivePercent = 0;
  3634. this.negativePercent = 0;
  3635. };
  3636. /**
  3637. * Accessor for the callout dependent value
  3638. */
  3639. /** @expose */
  3640. com_ibm_rave_bundles_components_IntervalDataUtilities.CALLOUT_DEPENDENT_ACCESSOR = function(data) {
  3641. return (data).cdep;
  3642. };
  3643. /**
  3644. * Accessor for the callout independent value
  3645. */
  3646. /** @expose */
  3647. com_ibm_rave_bundles_components_IntervalDataUtilities.CALLOUT_INDEPENDENT_ACCESSOR = function(data) {
  3648. return (data).cind;
  3649. };
  3650. /**
  3651. * Accessor for the data value
  3652. */
  3653. /** @expose */
  3654. com_ibm_rave_bundles_components_IntervalDataUtilities.VALUE_ACCESSOR = function(data) {
  3655. return (data).value;
  3656. };
  3657. /**
  3658. * Accessor for data value as percent of category
  3659. */
  3660. /** @expose */
  3661. com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR = function(data) {
  3662. var percent = (data).valueAsPercentOfCategory;
  3663. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3664. };
  3665. /**
  3666. * Accessor for data value as percent of color (series)
  3667. */
  3668. /** @expose */
  3669. com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_COLOR_ACCESSOR = function(data) {
  3670. var percent = (data).valueAsPercentOfColor;
  3671. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3672. };
  3673. // $source: com/ibm/rave/bundles/data/PointDataUtilities
  3674. /************************************************************************
  3675. ** IBM Confidential
  3676. **
  3677. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3678. **
  3679. ** (C) Copyright IBM Corp. 2017
  3680. **
  3681. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3682. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3683. ************************************************************************/
  3684. // GENERATED
  3685. /**
  3686. * Utility class for building arrays of point datum objects from tabular data.
  3687. */
  3688. var com_ibm_rave_bundles_data_PointDataUtilities = rave['internal']['Declare']({
  3689. });
  3690. /**
  3691. * <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>
  3692. * @param (Array) data Input data, list of arbitrary objects
  3693. * @param (rave['internal']['SingleValueFunction']) xAccessor X accessor function, may be null
  3694. * @param (rave['internal']['SingleValueFunction']) xScale Scale to test if the X value should be included, may be null
  3695. * @param (rave['internal']['SingleValueFunction']) yAccessor Y accessor function, may be null
  3696. * @param (rave['internal']['SingleValueFunction']) yScale Scale to test if the Y value should be included, may be null
  3697. * @return (Array) List of PointData objects
  3698. */
  3699. /** @expose */
  3700. com_ibm_rave_bundles_data_PointDataUtilities.buildPoints = function(data, xAccessor, xScale, yAccessor, yScale) {
  3701. var result = [];
  3702. if (data) {
  3703. for (var __i_enFor0 = 0, __exp_enFor0 = data, __len_enFor0 = __exp_enFor0.length;
  3704. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3705. var o = __exp_enFor0[__i_enFor0];
  3706. if (o != null) {
  3707. var xv = null;
  3708. if (xAccessor) {
  3709. xv = xAccessor(o);
  3710. if (xv == null || (xScale && xScale(xv) == null)) {
  3711. continue;
  3712. }
  3713. }
  3714. var yv = null;
  3715. if (yAccessor) {
  3716. yv = yAccessor(o);
  3717. if (yv == null || (yScale && yScale(yv) == null)) {
  3718. continue;
  3719. }
  3720. }
  3721. var datum = new com_ibm_rave_bundles_data_PointDataUtilities.PointDatum();
  3722. datum._x = xv;
  3723. datum._y = yv;
  3724. datum._originalData = o;
  3725. result.push(datum);
  3726. }
  3727. }
  3728. }
  3729. return result;
  3730. };
  3731. /**
  3732. * 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.
  3733. */
  3734. com_ibm_rave_bundles_data_PointDataUtilities.PointDatum = rave['internal']['Declare']({
  3735. /**
  3736. * The X value
  3737. */
  3738. /** @expose */
  3739. _x : null,
  3740. /**
  3741. * The Y value
  3742. */
  3743. /** @expose */
  3744. _y : null,
  3745. /**
  3746. * The data value (in percentage) that the point represents
  3747. */
  3748. /** @expose */
  3749. _yAsPercentOfCategory : null,
  3750. /**
  3751. * The data value (in percentage) that the point represents
  3752. */
  3753. /** @expose */
  3754. _yAsPercentOfColor : null,
  3755. /**
  3756. * The original data
  3757. */
  3758. /** @expose */
  3759. _originalData : null,
  3760. /** @expose */
  3761. originalData : function() {
  3762. return this._originalData;
  3763. },
  3764. /** @expose */
  3765. originalDataList : function() {
  3766. var list = [];
  3767. list.push(this._originalData);
  3768. return list;
  3769. }
  3770. });
  3771. /**
  3772. * Accessor returning the _x property of a PointDatum.
  3773. */
  3774. /** @expose */
  3775. com_ibm_rave_bundles_data_PointDataUtilities.X_ACCESSOR = function(d) {
  3776. return (d)._x;
  3777. };
  3778. /**
  3779. * Accessor returning the _y property of a PointDatum.
  3780. */
  3781. /** @expose */
  3782. com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR = function(d) {
  3783. return (d)._y;
  3784. };
  3785. /**
  3786. * Accessor returning the _yAsPercentOfCategory property of a PointDatum.
  3787. */
  3788. /** @expose */
  3789. com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR = function(d) {
  3790. var percent = + ((d)._yAsPercentOfCategory);
  3791. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3792. };
  3793. /**
  3794. * Accessor returning the _yAsPercentOfColor property of a PointDatum.
  3795. */
  3796. /** @expose */
  3797. com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_COLOR_ACCESSOR = function(d) {
  3798. var percent = + ((d)._yAsPercentOfColor);
  3799. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3800. };
  3801. // $source: com/ibm/rave/bundles/utilities/ColorUtil
  3802. /************************************************************************
  3803. ** IBM Confidential
  3804. **
  3805. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3806. **
  3807. ** (C) Copyright IBM Corp. 2017
  3808. **
  3809. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3810. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3811. ************************************************************************/
  3812. // GENERATED
  3813. var com_ibm_rave_bundles_utilities_ColorUtil = rave['internal']['Declare']({
  3814. });
  3815. /**
  3816. * It is used to get a foreground color which has atleast a 4.5 contrast ratio with the background color.
  3817. * @param (Object) bg bakground color
  3818. * @param (Object) fg foreground color
  3819. * @return (Object) a color ( darker/ligher/same fg color ) which contrast with background.
  3820. */
  3821. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$0 = function(bg, fg) {
  3822. var contrastRatio = com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio(bg, fg);
  3823. if (contrastRatio < 4.5) {
  3824. var bgHSL = rave.hsl(bg);
  3825. var fgHSL = rave.hsl(fg);
  3826. 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);
  3827. if (brightness > 0.5) {
  3828. if (bgHSL.getL() > 0.5) {
  3829. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.min(fgHSL.getL(), bgHSL.getL() - 0.4));
  3830. } else {
  3831. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.min(fgHSL.getL(), 0.1));
  3832. }
  3833. } else {
  3834. if (bgHSL.getL() < 0.5) {
  3835. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.max(fgHSL.getL(), bgHSL.getL() + 0.4));
  3836. } else {
  3837. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.max(fgHSL.getL(), 0.9));
  3838. }
  3839. }
  3840. }
  3841. return fg;
  3842. };
  3843. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$1 = function(labelColor) {
  3844. var labelRGB = rave.rgb(labelColor);
  3845. return labelRGB.contrastShift(21);
  3846. };
  3847. /** @expose */
  3848. com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio = function(colorA, colorB) {
  3849. var foregroundLuminance = rave.rgb(colorA).getLuminance();
  3850. var backgroundLuminance = rave.rgb(colorB).getLuminance();
  3851. var contrastRatio = (foregroundLuminance >= backgroundLuminance) ? (foregroundLuminance + 0.05) / (backgroundLuminance + 0.05) : (backgroundLuminance + 0.05) / (foregroundLuminance + 0.05);
  3852. return contrastRatio;
  3853. };
  3854. /** @expose */
  3855. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor = function(a0, a1) {
  3856. var args = arguments;
  3857. if (args.length == 1) {
  3858. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$1(a0);
  3859. }
  3860. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$0(a0, a1);
  3861. };
  3862. // $source: com/ibm/rave/bundles/nativeImpl/components/TiledmapV2DataLayerImpl
  3863. /************************************************************************
  3864. ** IBM Confidential
  3865. **
  3866. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3867. **
  3868. ** (C) Copyright IBM Corp. 2017
  3869. **
  3870. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3871. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3872. ************************************************************************/
  3873. var com_ibm_rave_bundles_nativeImpl_components_TiledmapV2DataLayerImpl = (function() {
  3874. //Constructor
  3875. function com_ibm_rave_bundles_nativeImpl_components_TiledmapV2DataLayerImpl( _type ) {
  3876. this._type = _type;
  3877. this.data = null;
  3878. this.mapData = null;
  3879. this.combined = false;
  3880. this.featureAccessors = null;
  3881. this.typeData = rave.map();
  3882. }
  3883. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2DataLayerImpl.prototype.getType = function()
  3884. {
  3885. return this._type;
  3886. }
  3887. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2DataLayerImpl.prototype.setData = function( _data )
  3888. {
  3889. this.data = _data;
  3890. }
  3891. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2DataLayerImpl.prototype.setMapData = function( _mapData )
  3892. {
  3893. this.mapData = _mapData;
  3894. }
  3895. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2DataLayerImpl.prototype.setCombined = function( _combined )
  3896. {
  3897. this.combined = _combined;
  3898. }
  3899. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2DataLayerImpl.prototype.setFeatureAccessors = function( _accessors )
  3900. {
  3901. this.featureAccessors = _accessors;
  3902. }
  3903. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2DataLayerImpl.prototype.setTypeData = function( _type, _data )
  3904. {
  3905. this.typeData.set( _type, _data );
  3906. }
  3907. return com_ibm_rave_bundles_nativeImpl_components_TiledmapV2DataLayerImpl;
  3908. }());
  3909. // $source: com/ibm/rave/bundles/nativeImpl/components/TiledmapV2FeatureDataMap
  3910. /************************************************************************
  3911. ** IBM Confidential
  3912. **
  3913. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3914. **
  3915. ** (C) Copyright IBM Corp. 2018, 2019
  3916. **
  3917. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3918. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3919. ************************************************************************/
  3920. var com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap = ( function()
  3921. {
  3922. // setup guid function
  3923. var guid = ( function()
  3924. {
  3925. // Buffer to hold the random numbers
  3926. var buf = typeof Uint8Array === "undefined" ? new Array( 16 ) : new Uint8Array( 16 );
  3927. // Look up table to translate values to hex string (faster than toString( 16 ))
  3928. var lut = new Array( 256 );
  3929. for ( var i = 0; i < 256; ++i )
  3930. lut[i] = ( i < 16 ? "0" : "" ) + i.toString( 16 );
  3931. // setup random values function
  3932. var getRandomValues = ( function( crypto )
  3933. {
  3934. if ( crypto )
  3935. {
  3936. return function( _target )
  3937. {
  3938. return crypto.getRandomValues( _target );
  3939. };
  3940. }
  3941. else
  3942. {
  3943. /**
  3944. * Randomize the array with 8bit unsigned values (using Math.random()).
  3945. * @param _target {Array} The array to randomize.
  3946. * @returns _target {Array} the modified _target array.
  3947. */
  3948. return function( _target )
  3949. {
  3950. for ( var r, i = 0, l = _target.length; i < l; i+=4 )
  3951. {
  3952. r = ( Math.random() * 0xffffffff ) | 0;
  3953. switch ( l - i )
  3954. {
  3955. default: _target[i+3] = ( r >>> 24 ) & 0xff; /*falls through*/
  3956. case 3: _target[i+2] = ( r >>> 16 ) & 0xff; /*falls through*/
  3957. case 2: _target[i+1] = ( r >>> 8 ) & 0xff; /*falls through*/
  3958. case 1: _target[i] = r & 0xff;
  3959. }
  3960. }
  3961. return _target;
  3962. };
  3963. }
  3964. }( typeof crypto !== "undefined" ? crypto : ( typeof msCrypto !== "undefined" ? msCrypto : null ) ) );
  3965. // guid generation function
  3966. return function()
  3967. {
  3968. // Grab new random values
  3969. getRandomValues( buf );
  3970. // Instead of writing a loop the whole concatenation is written out. The number of values is
  3971. // fixed, and this is significantly faster than looping over the array.
  3972. return lut[buf[ 0]] + lut[buf[ 1]] +
  3973. lut[buf[ 2]] + lut[buf[ 3]] +
  3974. lut[buf[ 4]] + lut[buf[ 5]] +
  3975. lut[buf[ 6]|0x40] + lut[buf[ 7]] +
  3976. lut[buf[ 8]|0x80] + lut[buf[ 9]] +
  3977. lut[buf[10]] + lut[buf[11]] +
  3978. lut[buf[12]] + lut[buf[13]] +
  3979. lut[buf[14]] + lut[buf[15]];
  3980. };
  3981. }() );
  3982. // sort point size stops by descending size (the second parameter in the stop array)
  3983. function _sortByPointSizeDesc( _itemA, _itemB )
  3984. {
  3985. var sizeA = _itemA.properties.pointSize ? _itemA.properties.pointSize : null;
  3986. var sizeB = _itemB.properties.pointSize ? _itemB.properties.pointSize : null;
  3987. // handle nulls
  3988. if ( ( sizeA === null ) && ( sizeB === null ) )
  3989. return 0;
  3990. if ( sizeA === null )
  3991. return 1;
  3992. if ( sizeB === null )
  3993. return -1;
  3994. return sizeB - sizeA;
  3995. }
  3996. function com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap()
  3997. {
  3998. this._itemMapById = rave.map();
  3999. this._itemMapByKey = rave.map();
  4000. this._itemMap = rave.map();
  4001. this._featuresByTileSet = rave.map();
  4002. this._featureById = rave.map();
  4003. this._fidIdx = 0;
  4004. this._tileSets = rave.map();
  4005. this._combinedLayers = false;
  4006. }
  4007. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._itemMapById = null;
  4008. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._itemMapByKey = null;
  4009. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._itemMap = null;
  4010. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._fidIdx = null;
  4011. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._tileSets = null;
  4012. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._featuresByTileSet = null;
  4013. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._featureById = null;
  4014. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._combinedLayers = null;
  4015. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype.setCombinedLayers = function( _combinedLayers )
  4016. {
  4017. this._combinedLayers = _combinedLayers;
  4018. }
  4019. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype.add = function( _dataLayer, _data, _key, _feature )
  4020. {
  4021. var item = {
  4022. id: guid(),
  4023. data: {},
  4024. dataSet: {},
  4025. layerIds: {},
  4026. tileSets: {},
  4027. key: _key,
  4028. hasValueAccessor: false,
  4029. hasPointColorAccessor: false,
  4030. hasPointSizeAccessor: false
  4031. };
  4032. var feature;
  4033. if ( _feature )
  4034. {
  4035. // set feature
  4036. feature = _feature;
  4037. // From version 170513 the type of the pk key changed from number to string.
  4038. // To be able to support multiple atlas services, we need to support multiple
  4039. // key types as well.
  4040. if ( feature.pk )
  4041. {
  4042. var pkNumber = false;
  4043. var version = +( feature.mapid.substr( feature.mapid.length - 6,6 ) );
  4044. // check map version, from this version the pk type changed to string
  4045. if ( version >= 170513 )
  4046. item.pk = feature.pk;
  4047. else
  4048. item.pk = +feature.pk;
  4049. }
  4050. if ( feature.location )
  4051. item.fid = "f" + this._nextFid();
  4052. if ( feature.bbox )
  4053. item.bbox = feature.bbox;
  4054. // this is a normal feature
  4055. if ( feature.mapid )
  4056. feature.mapid = "ibmrave." + feature.mapid;
  4057. }
  4058. else if ( !this._combinedLayers && this._hasCustomPolygonData( _dataLayer ) )
  4059. {
  4060. feature = this._getCustomPolygonFeature( _dataLayer );
  4061. var featureId = this._getFeatureId( _dataLayer, _data );
  4062. item[ feature.property ] = featureId;
  4063. }
  4064. else
  4065. {
  4066. item.fid = "f" + this._nextFid();
  4067. // build an adhoc feature from the geoData
  4068. feature = this._buildFeatureFromGeoData( _dataLayer, _data );
  4069. if ( !feature )
  4070. return;
  4071. }
  4072. // setup datalayer and data
  4073. this._setupData( item, _dataLayer, feature, _data );
  4074. // setup lookups
  4075. this._itemMapById.set( item.id, item );
  4076. if ( item.key )
  4077. this._itemMapByKey.set( item.key, item );
  4078. if ( item.fid )
  4079. this._createGeoJSON( _dataLayer, item );
  4080. if ( item.bbox )
  4081. this._addGeoJSONBBox( _dataLayer, item );
  4082. }
  4083. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype.update = function( _dataLayer, _data, _key, _feature )
  4084. {
  4085. var item = this._itemMapByKey.get( _key );
  4086. if ( !item )
  4087. return;
  4088. // setup datalayer and data
  4089. this._setupData( item, _dataLayer, _feature, _data );
  4090. if ( item.fid )
  4091. this._createGeoJSON( _dataLayer, item );
  4092. if ( item.bbox )
  4093. this._addGeoJSONBBox( _dataLayer, item );
  4094. }
  4095. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype.hasFeature = function( _featureKey )
  4096. {
  4097. return this._itemMapByKey.has( _featureKey );
  4098. }
  4099. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype.getById = function( _id )
  4100. {
  4101. return this._itemMapById.get( _id );
  4102. }
  4103. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype.getByKey = function( _key )
  4104. {
  4105. return this._itemMapByKey.get( _key );
  4106. }
  4107. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype.getItem = function( _tileSetId, _layerId, _properties )
  4108. {
  4109. var tileSets = this.getTileSets( { id: _tileSetId } );
  4110. var tileSet = null;
  4111. var key = null;
  4112. if ( !tileSets.length )
  4113. return null;
  4114. // find the tileSet with the correct layer
  4115. tileSets.some( function( _tileSet )
  4116. {
  4117. // verify the tileSet layer
  4118. if ( _tileSet[ _tileSet.layer ] === _layerId )
  4119. {
  4120. tileSet = _tileSet;
  4121. return true;
  4122. }
  4123. return false;
  4124. } );
  4125. if ( !tileSet )
  4126. return null;
  4127. // If we're using a combined layers, the tileset property will be the same for all tilesets.
  4128. // Otherwise, the key should be separate per tileset.
  4129. if ( this._combinedLayers )
  4130. key = tileSet.property + "-" + _properties[ tileSet.property ];
  4131. else
  4132. key = tileSet.id + "-" + tileSet[ tileSet.layer ] + "-" + tileSet.property + "-" + _properties[ tileSet.property ];
  4133. return this._itemMap.get( key );
  4134. }
  4135. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype.getMapFilter = function( _tileSet )
  4136. {
  4137. var expression = [ "in", _tileSet.property ];
  4138. var keysForTileSet = this._itemMapById.values().filter( function( _item )
  4139. {
  4140. return _item.tileSets[ _tileSet.type ] && _item.tileSets[ _tileSet.type ].id === _tileSet.id;
  4141. } ).forEach( function( _item )
  4142. {
  4143. // loop the pk's and add them to the expression
  4144. expression.push( _item[_tileSet.property] );
  4145. } );
  4146. return expression;
  4147. },
  4148. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype.getFeatures = function( _tileSetId )
  4149. {
  4150. var featuresInfo = this._featuresByTileSet.get( _tileSetId );
  4151. if ( featuresInfo )
  4152. {
  4153. // Check if the features need to be sorted.
  4154. // We want to sort the features by size, so that small points show before bigger ones.
  4155. // The order of the features depends on the way they're added to the GeoJSON
  4156. if ( !featuresInfo.sorted )
  4157. {
  4158. featuresInfo.features.sort( _sortByPointSizeDesc );
  4159. featuresInfo.sorted = true;
  4160. }
  4161. return featuresInfo.features;
  4162. }
  4163. return [];
  4164. }
  4165. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype.getTileSets = function( _filter )
  4166. {
  4167. var tileSets = [];
  4168. var keys = _filter ? Object.keys( _filter ) : null;
  4169. this._tileSets.forEach( function( _tileSetKey, _tileSet )
  4170. {
  4171. if ( !keys || keys.every( function( _key ) { return _filter[_key] === _tileSet[_key] } ) )
  4172. tileSets.push( _tileSet );
  4173. } );
  4174. return tileSets;
  4175. }
  4176. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype.size = function()
  4177. {
  4178. return this._itemMapById.size();
  4179. }
  4180. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype.clear = function()
  4181. {
  4182. this._itemMapById = rave.map();
  4183. this._itemMapByKey = rave.map();
  4184. this._itemMap = rave.map();
  4185. this._fidIdx = 0;
  4186. this._tileSets = rave.map();
  4187. this._featuresByTileSet = rave.map();
  4188. this._featureById = rave.map();
  4189. }
  4190. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype.updateDataLayerProperties = function( _dataLayer )
  4191. {
  4192. var self = this;
  4193. this._itemMapById.forEach( function( _id, _item )
  4194. {
  4195. var dataSetId = _dataLayer.getType();
  4196. _dataLayer.typeData.forEach( function( _type, _typeData )
  4197. {
  4198. var tileSet = _item.tileSets[ _type ];
  4199. // check for vector tileSet or geoJson tileSet with same ID
  4200. if ( tileSet && ( ( tileSet.tileType === "vector" ) || ( tileSet.id === self._getAdhocTileId( _type, dataSetId ) ) ) )
  4201. self._updateTypeDataProperties( _type, _typeData, _item );
  4202. } );
  4203. } );
  4204. }
  4205. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype.filter = function( _filter, _sortBy )
  4206. {
  4207. // TODO: make this more generic
  4208. if ( _sortBy )
  4209. {
  4210. // use a rave map for sorting, when requesting the values() they are sorted by key
  4211. var sorted = rave.map();
  4212. this._itemMapById.values().forEach( function( _item )
  4213. {
  4214. if ( _item.tileSets[ _filter.type ] && ( _item.tileSets[ _filter.type ].id === _filter.tileSet ) && _item.layerIds[ _filter.type ] && ( _item.layerIds[ _filter.type ] === _filter.layer ) )
  4215. sorted.set( _item[ _sortBy ], _item );
  4216. } );
  4217. return sorted.values();
  4218. }
  4219. else
  4220. {
  4221. return this._itemMapById.values().filter( function( _item )
  4222. {
  4223. return _item.tileSets[ _filter.type ] && ( _item.tileSets[ _filter.type ].id === _filter.tileSet ) && _item[ _filter.property ];
  4224. } );
  4225. }
  4226. }
  4227. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._addItem = function( _tileSet, _item )
  4228. {
  4229. var key;
  4230. // If we're using a combined layers, the tileset property will be the same for all tilesets.
  4231. // Otherwise, the key should be separate per tileset.
  4232. if ( this._combinedLayers )
  4233. key = _tileSet.property + "-" + _item[ _tileSet.property ];
  4234. else
  4235. key = _tileSet.id + "-" + _tileSet[ _tileSet.layer ] + "-" + _tileSet.property + "-" + _item[ _tileSet.property ];
  4236. this._itemMap.set( key, _item );
  4237. },
  4238. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._hasCustomPolygonData = function( _dataLayer )
  4239. {
  4240. var hasCustomPolygonData = false;
  4241. // since custom polygon data is not available for combined layers we can safely loop the dataLayers (which will be just 1)
  4242. _dataLayer.typeData.forEach( function( _type, _typeData )
  4243. {
  4244. hasCustomPolygonData = hasCustomPolygonData || _typeData.hasOwnProperty( "customPolygon" ) && ( _typeData.customPolygon !== null ) && ( typeof _typeData.customPolygon !== "undefined" );
  4245. } );
  4246. return hasCustomPolygonData;
  4247. }
  4248. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._getCustomPolygonFeature = function( _dataLayer )
  4249. {
  4250. var feature = {
  4251. mapid: null,
  4252. polyLayer: null,
  4253. pointLayer: null,
  4254. property: null,
  4255. customPolygon: true
  4256. };
  4257. // since custom polygon data is not available for combined layers we can safely loop the dataLayers (which will be just 1)
  4258. _dataLayer.typeData.forEach( function( _type, _typeData )
  4259. {
  4260. feature.mapid = _typeData.customPolygon.mapId;
  4261. if ( _type === "region" )
  4262. feature.polyLayer = _typeData.customPolygon.layerName;
  4263. else
  4264. feature.pointLayer = _typeData.customPolygon.layerName;
  4265. feature.property = _typeData.customPolygon.propertyName;
  4266. } );
  4267. return feature;
  4268. }
  4269. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._getFeatureId = function( _dataLayer, _data )
  4270. {
  4271. var featureAccessor = _dataLayer.featureAccessors[ 0 ];
  4272. if ( featureAccessor )
  4273. {
  4274. var geoData = featureAccessor( _data );
  4275. if ( ( typeof geoData === "object" ) && ( geoData.featureId !== null ) )
  4276. return geoData.featureId;
  4277. }
  4278. return null;
  4279. }
  4280. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._setupData = function( _item, _dataLayer, _feature, _data )
  4281. {
  4282. var dataSetId = _dataLayer.getType();
  4283. var self = this;
  4284. var nullColor = null;
  4285. _dataLayer.typeData.forEach( function( _type, _typeData )
  4286. {
  4287. if ( _type === "region" )
  4288. {
  4289. self._setupRegionData( _item, _feature, _data, dataSetId, _type, _typeData );
  4290. nullColor = _typeData.nullColor;
  4291. }
  4292. else
  4293. {
  4294. self._setupPointData( _item, _feature, _data, dataSetId, _type, _typeData );
  4295. }
  4296. } );
  4297. // special case for combined layer
  4298. // add a null value is there are no accessors
  4299. if ( this._combinedLayers && !_item.hasValueAccessor && !_item.hasPointColorAccessor && !_item.hasPointSizeAccessor )
  4300. _item.fillColor = nullColor;
  4301. }
  4302. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._setupRegionData = function( _item, _feature, _data, _dataSetId, _type, _typeData )
  4303. {
  4304. if ( ( _feature.mapid && _feature.polyLayer ) || ( _feature.location ) )
  4305. {
  4306. var tileSet;
  4307. // add tileset info, favor the mapid/polylayer over the location
  4308. if ( _feature.mapid && _feature.polyLayer )
  4309. {
  4310. tileSet = { type: _type, id: _feature.mapid, tileType: "vector", layer: "polyLayer", polyLayer: _type + "-" + _feature.polyLayer, sourceLayer: _feature.polyLayer, opacityProp: "fill-opacity", transparency: _typeData.transparency };
  4311. tileSet.property = ( _feature.property ) ? _feature.property : "pk";
  4312. }
  4313. else
  4314. {
  4315. tileSet = { type: _type, id: this._getAdhocTileId( _type, _dataSetId ), tileType: "geojson", layer: "polyLayer", polyLayer: this._getAdhocLayerId( _dataSetId, "geopoly" ), opacityProp: "circle-opacity", property: "fid", transparency: _typeData.transparency };
  4316. // remember point location
  4317. if ( _feature.location )
  4318. _item[ _type ] = _feature.location;
  4319. }
  4320. tileSet.customPolygon = _feature.customPolygon || false;
  4321. tileSet.propertyType = tileSet.customPolygon ? null : typeof _item[ tileSet.property ];
  4322. _item.tileSets[ _type ] = tileSet;
  4323. this._addTileSet( tileSet );
  4324. layerId = tileSet.polyLayer;
  4325. // set layerId
  4326. _item.layerIds[ _type ] = layerId;
  4327. // set data
  4328. _item.data[ layerId ] = _data;
  4329. _item.dataSet[ layerId ] = _dataSetId;
  4330. // type data
  4331. if ( _typeData.valueAccessor )
  4332. {
  4333. _item.value = _typeData.valueAccessor( _data );
  4334. _item.hasValueAccessor = true;
  4335. }
  4336. else if ( !this._combinedLayers )
  4337. {
  4338. _item.value = null;
  4339. }
  4340. // add item
  4341. this._addItem( tileSet, _item );
  4342. // update type data properties
  4343. this._updateTypeDataProperties( _type, _typeData, _item );
  4344. }
  4345. }
  4346. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._setupPointData = function( _item, _feature, _data, _dataSetId, _type, _typeData )
  4347. {
  4348. var tileSet;
  4349. // add tileset info
  4350. if ( _feature.location )
  4351. {
  4352. tileSet = { type: _type, id: this._getAdhocTileId( _type, _dataSetId ), tileType: "geojson", layer: "pointLayer", pointLayer: this._getAdhocLayerId( _dataSetId, "geopoint" ), property: "fid", transparency: _typeData.transparency };
  4353. }
  4354. else
  4355. {
  4356. tileSet = { type: _type, id: _feature.mapid, tileType: "vector", layer: "pointLayer", pointLayer: _type + "-" + _feature.pointLayer, sourceLayer: _feature.pointLayer, transparency: _typeData.transparency };
  4357. tileSet.property = ( _feature.property ) ? _feature.property : "pk";
  4358. }
  4359. tileSet.customPolygon = _feature.customPolygon || false;
  4360. tileSet.propertyType = tileSet.customPolygon ? null : typeof _item[ tileSet.property ];
  4361. _item.tileSets[ _type ] = tileSet;
  4362. this._addTileSet( tileSet );
  4363. layerId = tileSet.pointLayer;
  4364. // set layerId
  4365. _item.layerIds[ _type ] = layerId;
  4366. // set data
  4367. _item.data[ layerId ] = _data;
  4368. _item.dataSet[ layerId ] = _dataSetId;
  4369. // remember point location
  4370. if ( _feature.location )
  4371. _item[ _type ] = _feature.location;
  4372. if ( _typeData.pointColorAccessor || _typeData.pointSizeAccessor )
  4373. {
  4374. if ( _typeData.pointColorAccessor )
  4375. {
  4376. _item.pointColorValue = _typeData.pointColorAccessor( _data );
  4377. _item.hasPointColorAccessor = true;
  4378. }
  4379. else
  4380. {
  4381. _item.pointColorValue = null;
  4382. }
  4383. if ( _typeData.pointSizeAccessor )
  4384. {
  4385. _item.pointSizeValue = _typeData.pointSizeAccessor( _data )
  4386. _item.hasPointSizeAccessor = true;
  4387. }
  4388. else
  4389. {
  4390. _item.pointSizeValue = null;
  4391. }
  4392. }
  4393. // draw defaultSized points when there are no accessors mapped
  4394. else if ( !this._combinedLayers )
  4395. {
  4396. _item.pointColor = _typeData.nullColor;
  4397. _item.pointSize = _typeData.defaultPointSize;
  4398. }
  4399. // add item
  4400. this._addItem( tileSet, _item );
  4401. // update type data properties
  4402. this._updateTypeDataProperties( _type, _typeData, _item );
  4403. }
  4404. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._getAdhocTileId = function( _type, _dataLayerId )
  4405. {
  4406. return _type + "." + _dataLayerId + ".adhocGeo";
  4407. }
  4408. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._getAdhocLayerId = function( _dataLayerId, _layer )
  4409. {
  4410. return _dataLayerId + "." + _layer;
  4411. }
  4412. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._createGeoJSON = function( _dataLayer, _item )
  4413. {
  4414. // build GeoJSON objects for each type of data
  4415. var keys = _dataLayer.typeData.keys();
  4416. for ( var idx = 0, size = keys.length; idx < size; ++idx )
  4417. {
  4418. var type = keys[ idx ];
  4419. // check if there's location data
  4420. if ( _item[ type ] )
  4421. this._addGeoJSONPoint( this._getAdhocTileId( type, _dataLayer.getType() ), _item, type );
  4422. }
  4423. }
  4424. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._addGeoJSONPoint = function( _tileSetId, _item, _coordinatesField )
  4425. {
  4426. // get features info for tileSet
  4427. var featuresInfo = this._featuresByTileSet.get( _tileSetId );
  4428. if ( !featuresInfo )
  4429. {
  4430. featuresInfo = {
  4431. features: [],
  4432. sorted: false
  4433. };
  4434. this._featuresByTileSet.set( _tileSetId, featuresInfo );
  4435. }
  4436. // reset sorted, since adding features requires re-sort
  4437. featuresInfo.sorted = false;
  4438. // build GeoJSON feature
  4439. var feature = this._featureById.get( _item.fid );
  4440. if ( !feature )
  4441. {
  4442. feature = {
  4443. type: "Feature",
  4444. geometry: {
  4445. type: "Point",
  4446. coordinates: _item[ _coordinatesField ]
  4447. },
  4448. properties: {
  4449. fid: _item.fid
  4450. }
  4451. };
  4452. this._featureById.set( _item.fid, feature )
  4453. }
  4454. if ( _item.pointSize )
  4455. feature.properties.pointSize = _item.pointSize;
  4456. // add feature
  4457. featuresInfo.features.push( feature );
  4458. }
  4459. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._addGeoJSONBBox = function( _dataLayer, _item )
  4460. {
  4461. // bbox will only be available on regions
  4462. var tileSet = _item.tileSets[ "region" ];
  4463. if ( _dataLayer.typeData.has( "region" ) && tileSet )
  4464. {
  4465. var tileSetId = tileSet.id;
  4466. var featuresInfo = this._featuresByTileSet.get( tileSetId );
  4467. if ( !featuresInfo )
  4468. {
  4469. featuresInfo = {
  4470. features: [],
  4471. sorted: true
  4472. };
  4473. this._featuresByTileSet.set( tileSetId, featuresInfo );
  4474. }
  4475. // build GeoJSON feature
  4476. var rect = _item.bbox;
  4477. var feature = {
  4478. type: "Feature",
  4479. geometry: {
  4480. type: "Polygon",
  4481. coordinates: [ [
  4482. [ rect[ 0 ], rect[ 1 ] ],
  4483. [ rect[ 2 ], rect[ 1 ] ],
  4484. [ rect[ 2 ], rect[ 3 ] ],
  4485. [ rect[ 0 ], rect[ 3 ] ],
  4486. [ rect[ 0 ], rect[ 1 ] ] ] ]
  4487. }
  4488. };
  4489. // add feature
  4490. featuresInfo.features.push( feature );
  4491. }
  4492. }
  4493. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._nextFid = function()
  4494. {
  4495. return ++this._fidIdx;
  4496. }
  4497. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._addTileSet = function( _tileSet )
  4498. {
  4499. var key = this._buildKey( _tileSet );
  4500. if ( !this._tileSets.has( key ) )
  4501. this._tileSets.set( key, _tileSet );
  4502. }
  4503. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._buildKey = function( _tileSet )
  4504. {
  4505. return Object.keys( _tileSet ).map( function( _key )
  4506. {
  4507. return _tileSet[ _key ];
  4508. } ).join( "|" );
  4509. }
  4510. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._updateTypeDataProperties = function( _type, _typeData, _item )
  4511. {
  4512. switch( _type )
  4513. {
  4514. case "region":
  4515. // set value and color
  4516. if ( _item.hasOwnProperty( "value" ) )
  4517. {
  4518. var color = _typeData.nullColor;
  4519. if ( _item.value !== null )
  4520. color = _typeData.palette( _item.value );
  4521. _item.fillColor = color ? color : _typeData.nullColor;
  4522. }
  4523. break;
  4524. case "point":
  4525. // set point color
  4526. if ( _item.hasOwnProperty( "pointColorValue" ) )
  4527. {
  4528. if ( _item.pointColorValue !== null )
  4529. {
  4530. var color = _typeData.palette( _item.pointColorValue );
  4531. _item.pointColor = color ? color : _typeData.nullColor;
  4532. }
  4533. else
  4534. {
  4535. _item.pointColor = _typeData.nullColor;
  4536. }
  4537. }
  4538. // set point size
  4539. if ( _item.hasOwnProperty( "pointSizeValue" ) )
  4540. {
  4541. var pointSize = _item.pointSizeValue;
  4542. if ( pointSize != null )
  4543. {
  4544. if ( ( pointSize === 0 ) && ( _typeData.staticZeroValuePointSize !== null ) )
  4545. {
  4546. _item.pointSize = _typeData.staticZeroValuePointSize;
  4547. _item.hasStaticZeroValuePointSize = true;
  4548. }
  4549. else
  4550. {
  4551. _item.pointSize = _typeData.pointSizeScale( pointSize );
  4552. }
  4553. }
  4554. else
  4555. {
  4556. _item.pointSize = _typeData.defaultPointSize;
  4557. }
  4558. }
  4559. break;
  4560. }
  4561. }
  4562. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap.prototype._buildFeatureFromGeoData = function( _dataLayer, _data )
  4563. {
  4564. var feature = null;
  4565. var featureAccessor = _dataLayer.featureAccessors[ 0 ];
  4566. if ( featureAccessor )
  4567. {
  4568. var geoData = featureAccessor( _data );
  4569. if ( typeof geoData === "object" )
  4570. {
  4571. feature = {};
  4572. if ( geoData.hasOwnProperty( "latitude" ) && geoData.hasOwnProperty( "longitude" ) )
  4573. // mapbox uses a longitude, latitude notation
  4574. feature.location = [ geoData.longitude, geoData.latitude ];
  4575. }
  4576. }
  4577. return feature;
  4578. }
  4579. return com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap;
  4580. }());
  4581. // $source: com/ibm/rave/bundles/nativeImpl/components/TiledmapV2MapDataCache
  4582. /************************************************************************
  4583. ** IBM Confidential
  4584. **
  4585. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4586. **
  4587. ** (C) Copyright IBM Corp. 2018
  4588. **
  4589. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4590. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4591. ************************************************************************/
  4592. var com_ibm_rave_bundles_nativeImpl_components_TiledmapV2MapDataCache = ( function()
  4593. {
  4594. function com_ibm_rave_bundles_nativeImpl_components_TiledmapV2MapDataCache()
  4595. {
  4596. this.version = 0;
  4597. this._itemMap = rave.map();
  4598. }
  4599. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2MapDataCache.prototype.version = null;
  4600. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2MapDataCache.prototype._itemMap = null;
  4601. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2MapDataCache.prototype.refreshCache = function( _dataLayers )
  4602. {
  4603. var cacheUpdated = false;
  4604. // get current keys
  4605. var curKeys = rave.set( this._itemMap.keys() );
  4606. var touchedKeys = rave.set();
  4607. // iterate data layers
  4608. for ( var layerIdx = 0, layerSize = _dataLayers.length; layerIdx < layerSize; ++layerIdx )
  4609. {
  4610. var layer = _dataLayers[ layerIdx ];
  4611. // extract mapData
  4612. if ( layer.mapData )
  4613. {
  4614. for ( var itemIdx = 0, itemSize = layer.mapData.length; itemIdx < itemSize; ++itemIdx )
  4615. {
  4616. var item = layer.mapData[ itemIdx ];
  4617. var key = this._buildKey( layer.getType(), this._extractNames( item ) );
  4618. if ( curKeys.has( key ) )
  4619. {
  4620. // compare PKs to check if it's the same item
  4621. var cacheItem = this._itemMap.set( key, item );
  4622. if ( cacheItem.pk === item.pk )
  4623. {
  4624. touchedKeys.add( key );
  4625. curKeys.remove( key );
  4626. }
  4627. }
  4628. else if ( !touchedKeys.has( key ) )
  4629. {
  4630. this._itemMap.set( key, item );
  4631. touchedKeys.add( key );
  4632. cacheUpdated = true;
  4633. }
  4634. }
  4635. }
  4636. }
  4637. // check if there are item which need to be dropped from the cache
  4638. if ( curKeys.size() > 0 )
  4639. {
  4640. var self = this;
  4641. curKeys.forEach( function( _key )
  4642. {
  4643. self._itemMap.remove( _key );
  4644. } );
  4645. cacheUpdated = true;
  4646. }
  4647. // update version when data was updated
  4648. if ( cacheUpdated )
  4649. this.version++;
  4650. }
  4651. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2MapDataCache.prototype.get = function( _key )
  4652. {
  4653. return this._itemMap.get( _key );
  4654. }
  4655. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2MapDataCache.prototype.size = function()
  4656. {
  4657. return this._itemMap.size();
  4658. }
  4659. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2MapDataCache.prototype.clear = function()
  4660. {
  4661. this._itemMap = rave.map();
  4662. }
  4663. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2MapDataCache.prototype.getKey = function( _layerType, _arrKeys )
  4664. {
  4665. return this._buildKey( _layerType, _arrKeys );
  4666. }
  4667. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2MapDataCache.prototype._buildKey = function( _layerType, _arrKeys )
  4668. {
  4669. return _layerType + "|" + _arrKeys.join( "|" );
  4670. }
  4671. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2MapDataCache.prototype._extractNames = function( _item/*, _names */ )
  4672. {
  4673. var names = arguments.length > 1 ? arguments[ 1 ] : [];
  4674. names.push( _item.name );
  4675. if ( _item.refine )
  4676. {
  4677. for ( var idx = 0, size = _item.refine.length; idx < size; ++idx )
  4678. names.push( _item.refine[ idx ] );
  4679. }
  4680. return names;
  4681. }
  4682. return com_ibm_rave_bundles_nativeImpl_components_TiledmapV2MapDataCache;
  4683. }());
  4684. // $source: com/ibm/rave/bundles/nativeImpl/components/TiledmapV2RegionTypeDataImpl
  4685. /************************************************************************
  4686. ** IBM Confidential
  4687. **
  4688. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4689. **
  4690. ** (C) Copyright IBM Corp. 2017,2018
  4691. **
  4692. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4693. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4694. ************************************************************************/
  4695. var com_ibm_rave_bundles_nativeImpl_components_TiledmapV2RegionTypeDataImpl = (function() {
  4696. //Constructor
  4697. function com_ibm_rave_bundles_nativeImpl_components_TiledmapV2RegionTypeDataImpl() {
  4698. this.paletteDef = null;
  4699. this.palette = null;
  4700. this.nullColor = null;
  4701. this.transparency = null;
  4702. this.valueAccessor = null;
  4703. this.minValue = null;
  4704. this.maxValue = null;
  4705. this.hasGeoData = false;
  4706. this.customPolygon = null;
  4707. }
  4708. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2RegionTypeDataImpl.prototype.setPaletteDef = function( _paletteDef )
  4709. {
  4710. this.paletteDef = _paletteDef;
  4711. }
  4712. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2RegionTypeDataImpl.prototype.setPalette = function( _palette )
  4713. {
  4714. this.palette = _palette;
  4715. }
  4716. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2RegionTypeDataImpl.prototype.setNullColor = function( _nullColor )
  4717. {
  4718. this.nullColor = _nullColor;
  4719. }
  4720. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2RegionTypeDataImpl.prototype.setTransparency = function( _transparency )
  4721. {
  4722. this.transparency = _transparency;
  4723. }
  4724. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2RegionTypeDataImpl.prototype.setHasGeoData = function( _hasGeoData )
  4725. {
  4726. this.hasGeoData = _hasGeoData;
  4727. }
  4728. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2RegionTypeDataImpl.prototype.setValueAccessor = function( _accessor )
  4729. {
  4730. this.valueAccessor = _accessor;
  4731. }
  4732. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2RegionTypeDataImpl.prototype.minimumValue = function( _minValue )
  4733. {
  4734. this.minValue = _minValue;
  4735. }
  4736. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2RegionTypeDataImpl.prototype.maximumValue = function( _maxValue )
  4737. {
  4738. this.maxValue = _maxValue;
  4739. }
  4740. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2RegionTypeDataImpl.prototype.setCustomPolygon = function( _mapId, _layerName, _propertyName )
  4741. {
  4742. if ( _mapId && _layerName && _propertyName )
  4743. {
  4744. this.customPolygon = {
  4745. mapId: _mapId,
  4746. layerName: _layerName,
  4747. propertyName: _propertyName
  4748. };
  4749. }
  4750. }
  4751. return com_ibm_rave_bundles_nativeImpl_components_TiledmapV2RegionTypeDataImpl;
  4752. }());
  4753. // $source: com/ibm/rave/bundles/nativeImpl/components/TiledmapV2PointTypeDataImpl
  4754. /************************************************************************
  4755. ** IBM Confidential
  4756. **
  4757. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4758. **
  4759. ** (C) Copyright IBM Corp. 2017,2018
  4760. **
  4761. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4762. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4763. ************************************************************************/
  4764. var com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl = (function() {
  4765. //Constructor
  4766. function com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl() {
  4767. this.paletteDef = null;
  4768. this.palette = null;
  4769. this.nullColor = null;
  4770. this.transparency = null;
  4771. this.pointColorAccessor = null;
  4772. this.pointSizeAccessor = null;
  4773. this.pointSizeScale = null;
  4774. this.defaultPointSize = null;
  4775. this.staticZeroValuePointSize = null;
  4776. this.hasGeoData = false;
  4777. this.customPolygon = null;
  4778. }
  4779. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl.prototype.setPaletteDef = function( _paletteDef )
  4780. {
  4781. this.paletteDef = _paletteDef;
  4782. }
  4783. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl.prototype.setPalette = function( _palette )
  4784. {
  4785. this.palette = _palette;
  4786. }
  4787. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl.prototype.setNullColor = function( _nullColor )
  4788. {
  4789. this.nullColor = _nullColor;
  4790. }
  4791. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl.prototype.setTransparency = function( _transparency )
  4792. {
  4793. this.transparency = _transparency;
  4794. }
  4795. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl.prototype.setHasGeoData = function( _hasGeoData )
  4796. {
  4797. this.hasGeoData = _hasGeoData;
  4798. }
  4799. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl.prototype.setPointColorAccessor = function( _accessor )
  4800. {
  4801. this.pointColorAccessor = _accessor;
  4802. }
  4803. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl.prototype.setPointSizeAccessor = function( _accessor )
  4804. {
  4805. this.pointSizeAccessor = _accessor;
  4806. }
  4807. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl.prototype.setPointSizeScale = function( _scale )
  4808. {
  4809. this.pointSizeScale = _scale;
  4810. }
  4811. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl.prototype.setDefaultPointSize = function( _size )
  4812. {
  4813. this.defaultPointSize = _size;
  4814. }
  4815. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl.prototype.setStaticZeroValuePointSize = function( _size )
  4816. {
  4817. this.staticZeroValuePointSize = _size;
  4818. }
  4819. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl.prototype.setCustomPolygon = function( _mapId, _layerName, _propertyName )
  4820. {
  4821. if ( _mapId && _layerName && _propertyName )
  4822. {
  4823. this.customPolygon = {
  4824. mapId: _mapId,
  4825. layerName: _layerName,
  4826. propertyName: _propertyName
  4827. };
  4828. }
  4829. }
  4830. return com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl;
  4831. }());
  4832. // $source: com/ibm/rave/bundles/internal/nativeImpl/BundleModule
  4833. /************************************************************************
  4834. ** IBM Confidential
  4835. **
  4836. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4837. **
  4838. ** (C) Copyright IBM Corp. 2015
  4839. **
  4840. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4841. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4842. ************************************************************************/
  4843. // Must be the first import
  4844. // @import ./BundleModuleHeader
  4845. // expose DataFormatter to the global variable rave
  4846. //rave["library"]["CustomFormatter"]=com_ibm_rave_library_framework_CustomFormatter;
  4847. // $source: com/ibm/rave/bundles/tiledmapV2Bundle/TiledmapV2Bundle
  4848. /************************************************************************
  4849. ** IBM Confidential
  4850. **
  4851. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4852. **
  4853. ** (C) Copyright IBM Corp. 2018
  4854. **
  4855. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4856. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4857. ************************************************************************/
  4858. // GENERATED
  4859. //@import com/ibm/rave/library/Library (static) // Library
  4860. //@import com/ibm/rave/bundles/RaveBundle (loadtime) // superclass
  4861. //@import com/ibm/rave/bundles/tiledmapV2Bundle/TiledmapV2View (runtime) // new
  4862. var com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2Bundle = rave['internal']['Declare'](com_ibm_rave_bundles_RaveBundle, {
  4863. //mapboxSecretToken : null,
  4864. //mapboxAccoutName : null,
  4865. mapboxtoken : "",
  4866. /** @expose */
  4867. getName : function() {
  4868. return com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2Bundle.BUNDLE_NAME;
  4869. },
  4870. /** @expose */
  4871. createView : function(ctx) {
  4872. ctx.properties.property("tiledmap.token").value(this.mapboxtoken);
  4873. return new com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View(ctx);
  4874. },
  4875. /** @expose */
  4876. _doConfigure : function(configurations, userCallback, bundle) {
  4877. if (configurations) {
  4878. this.mapboxSecretToken = configurations["Mapbox.secretToken"];
  4879. this.mapboxAccoutName = configurations["Mapbox.accountName"];
  4880. this.mapboxtoken = configurations["Mapbox.token"];
  4881. }
  4882. if ((this.mapboxSecretToken != null) && (this.mapboxAccoutName != null)) {
  4883. var requestURL = "https://api.mapbox.com/styles/v1/" + this.mapboxAccoutName + "?access_token=" + this.mapboxSecretToken;
  4884. var self = this;
  4885. rave.json(requestURL, function(error, response) {
  4886. if (response) {
  4887. var properties = bundle.info().properties();
  4888. properties.forEach(function(currentValue, index, array) {
  4889. if (currentValue.simpleId() == "style") {
  4890. var responseArray = response;
  4891. for (var __i_enFor0 = 0, __exp_enFor0 = responseArray, __len_enFor0 = __exp_enFor0.length;
  4892. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4893. var obj = __exp_enFor0[__i_enFor0];
  4894. var style = obj;
  4895. var styleID = ""+(style["id"]);
  4896. var styleName = ""+(style["name"]);
  4897. var value = "mapbox://style/" + self.mapboxAccoutName + "/" + styleID;
  4898. var catalogEntry = {};
  4899. var messages = new rave['library']['internal']['MessagesRegistry']();
  4900. var catalog = null;
  4901. var newOption = null;
  4902. catalogEntry[styleID] = styleName;
  4903. catalog = rave['library']['internal']['Messages'].createFromCatalog(catalogEntry, bundle.locale());
  4904. messages.add(bundle.locale(), catalog);
  4905. newOption = new rave['library']['internal']['StringPropertyOption'](value, ""+(style["id"]), messages);
  4906. currentValue.options().push(newOption);
  4907. if (styleName == "Default") {
  4908. currentValue.setDefaultValue(value);
  4909. }
  4910. }
  4911. }
  4912. return currentValue;
  4913. });
  4914. }
  4915. if (userCallback) {
  4916. userCallback();
  4917. }
  4918. });
  4919. } else if (userCallback) {
  4920. userCallback();
  4921. }
  4922. }
  4923. //constructor : function() {}
  4924. });
  4925. /**
  4926. * Register the bundle factory with the library. The bundle will not be made available if this method is not called.
  4927. */
  4928. /** @expose */
  4929. com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2Bundle.init = function() {
  4930. if (!(com_ibm_rave_library_Library.bundle.isRegistered(com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2Bundle.BUNDLE_NAME))) {
  4931. var bundle;
  4932. com_ibm_rave_library_Library.bundle.extension(com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2Bundle.BUNDLE_NAME, function() {
  4933. if (!bundle) {
  4934. bundle = new com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2Bundle();
  4935. bundle.loadResources();
  4936. require("./mapbox-gl.css");
  4937. require("./vizlibrary-tiledmap.css");
  4938. }
  4939. return bundle;
  4940. });
  4941. }
  4942. return com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2Bundle.BUNDLE_NAME;
  4943. };
  4944. com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2Bundle.BUNDLE_NAME = "tiledmapV2Bundle";
  4945. // Auto initialization
  4946. com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2Bundle.init();
  4947. if (!com_ibm_rave_library_Library.bundle[com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2Bundle.BUNDLE_NAME]) {
  4948. com_ibm_rave_library_Library.bundle[com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2Bundle.BUNDLE_NAME] = function() {
  4949. if (!bundle) {
  4950. bundle = new com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2Bundle();
  4951. bundle.loadResources();
  4952. require("./mapbox-gl.css");
  4953. require("./vizlibrary-tiledmap.css");
  4954. }
  4955. return bundle;
  4956. };
  4957. } else {
  4958. console.log("Could not register extension: TiledmapV2Bundle");
  4959. }
  4960. // $source: com/ibm/rave/bundles/tiledmapV2Bundle/TiledmapV2View
  4961. /************************************************************************
  4962. ** IBM Confidential
  4963. **
  4964. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4965. **
  4966. ** (C) Copyright IBM Corp. 2019
  4967. **
  4968. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4969. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4970. ************************************************************************/
  4971. // GENERATED
  4972. //@import com/ibm/rave/bundles/views/BundleView (loadtime) // superclass
  4973. //@import com/ibm/rave/bundles/nativeImpl/components/TiledmapV2DataLayerImpl (runtime) // new
  4974. //@import com/ibm/rave/bundles/nativeImpl/components/TiledmapV2NativeSubComponentImpl (runtime) // new
  4975. //@import com/ibm/rave/bundles/nativeImpl/components/TiledmapV2RegionTypeDataImpl (runtime) // new
  4976. //@import com/ibm/rave/library/Library (runtime) // Library
  4977. //@import com/ibm/rave/bundles/nativeImpl/components/TiledmapV2PointTypeDataImpl (runtime) // new
  4978. /**
  4979. * <p> A map chart view. For this example, additional files are required to be loaded in addition to the usual data schema, data file, properties, etc. We must also load at least one GeoJSON file, and a palette file as well. </p> <p> The input data properties are the feature name (which could be used to find features in the GeoJSON, if the features there have some kind of id), Standard Color (a numeric referencing a standard palette), Continuous Color (a numeric referencing a continuous palette), and the label that appears on the feature if the features are to be labelled. </p> <p> Properties required for maps are: GeoJSON: A string for one or more GeoJSON URL's required for this map. scale: A default scale for the map missingFeatureColor: The default color assigned to a feature we do not have a color for. borderColor: Color of the borders between features borderThickness: The border thickness. showLabels: If true, display labels. featureLabelFont: The font of the feature labels. featureLabelColor: The color for the feature labels. featureLabelSize: The size for the feature labels. mapProjection: Map Projection Type-- default is mercator; legendDisplay: boolean, to show or hide the legend. legendPosition: The legend position in the chart. </p>
  4980. */
  4981. var com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View = rave['internal']['Declare'](com_ibm_rave_bundles_views_BundleView, {
  4982. //_mapComponent : null,
  4983. //_mapInitializedCallback : null,
  4984. //_maxZoom : null,
  4985. //_mapLocale : null,
  4986. //_mapStyle : null,
  4987. //_registeredEventHandlers : null,
  4988. //_lastChartRect : null,
  4989. //_combinedLayerMapping : null,
  4990. //_regionLayerMapping : null,
  4991. //_pointLayerMapping : null,
  4992. //_latlongLayerMapping : null,
  4993. //_combinedLegendMapping : null,
  4994. //_pointLegendMapping : null,
  4995. //_latlongLegendMapping : null,
  4996. //_delayedInit : null,
  4997. _mapInitialized : false,
  4998. /** @expose */
  4999. constructor : function(context) {
  5000. },
  5001. /** @expose */
  5002. setup : function() {
  5003. com_ibm_rave_bundles_views_BundleView.prototype.setup.call(this);
  5004. var self = this;
  5005. var action = this.context.actions.action("highlight");
  5006. action.setOperation(new (rave['internal']['Declare']([rave['library']['internal']['ActionOperation']], {
  5007. _$functionClassMethod : function() {
  5008. var _$self = function(args) {
  5009. if (args !== null || arguments.length > 1){
  5010. args = Array.prototype.slice.call(arguments);
  5011. }
  5012. {
  5013. if (self._mapComponent) {
  5014. self._mapComponent.highlightAction(args[0]);
  5015. }
  5016. }
  5017. };
  5018. return _$self;
  5019. }
  5020. }))());
  5021. action = this.context.actions.action("select");
  5022. action.setOperation(new (rave['internal']['Declare']([rave['library']['internal']['ActionOperation']], {
  5023. _$functionClassMethod : function() {
  5024. var _$self = function(args) {
  5025. if (args !== null || arguments.length > 1){
  5026. args = Array.prototype.slice.call(arguments);
  5027. }
  5028. {
  5029. if (self._mapComponent) {
  5030. self._mapComponent.selectAction(args[0]);
  5031. }
  5032. }
  5033. };
  5034. return _$self;
  5035. }
  5036. }))());
  5037. action = this.context.actions.action("deselect");
  5038. action.setOperation(new (rave['internal']['Declare']([rave['library']['internal']['ActionOperation']], {
  5039. _$functionClassMethod : function() {
  5040. var _$self = function(args) {
  5041. if (args !== null || arguments.length > 1){
  5042. args = Array.prototype.slice.call(arguments);
  5043. }
  5044. {
  5045. if (self._mapComponent) {
  5046. self._mapComponent.deselectAction(args[0]);
  5047. }
  5048. }
  5049. };
  5050. return _$self;
  5051. }
  5052. }))());
  5053. action = this.context.actions.action("deselectAll");
  5054. action.setOperation(new (rave['internal']['Declare']([rave['library']['internal']['ActionOperation']], {
  5055. _$functionClassMethod : function() {
  5056. var _$self = function(args) {
  5057. if (args !== null || arguments.length > 1){
  5058. args = Array.prototype.slice.call(arguments);
  5059. }
  5060. {
  5061. if (self._mapComponent) {
  5062. self._mapComponent.deselectAllAction();
  5063. }
  5064. }
  5065. };
  5066. return _$self;
  5067. }
  5068. }))());
  5069. action = this.context.actions.action("locate");
  5070. action.setOperation(new (rave['internal']['Declare']([rave['library']['internal']['ActionOperation']], {
  5071. _$functionClassMethod : function() {
  5072. var _$self = function(args) {};
  5073. return _$self;
  5074. },
  5075. get : function(_id) {
  5076. if (_id == "locator") {
  5077. return new (rave['internal']['Declare']({
  5078. getItemsAtPoint : function(_point) {
  5079. if (self._mapComponent) {
  5080. return self._mapComponent.getItemsAtPoint(_point);
  5081. }
  5082. return [];
  5083. },
  5084. getItemsInRect : function(_points) {
  5085. if (self._mapComponent) {
  5086. return self._mapComponent.getItemsInRect(_points);
  5087. }
  5088. return [];
  5089. }
  5090. }))();
  5091. }
  5092. return null;
  5093. }
  5094. }))());
  5095. action = this.context.actions.action("zoom");
  5096. action.setOperation(new (rave['internal']['Declare']([rave['library']['internal']['ActionOperation']], {
  5097. _$functionClassMethod : function() {
  5098. var _$self = function(args) {};
  5099. return _$self;
  5100. },
  5101. get : function(_id) {
  5102. if (_id == "state") {
  5103. return new (rave['internal']['Declare']({
  5104. getBoundingBox : function() {
  5105. if (self._mapComponent) {
  5106. return self._mapComponent.getBoundingBox();
  5107. }
  5108. return null;
  5109. },
  5110. setBoundingBox : function(_bbox) {
  5111. if (self._mapComponent) {
  5112. self._mapComponent.setBoundingBox(_bbox);
  5113. }
  5114. }
  5115. }))();
  5116. }
  5117. return null;
  5118. }
  5119. }))());
  5120. this._combinedLayerMapping = {};
  5121. this._combinedLayerMapping["featureLvl1"] = "featureLvl1";
  5122. this._combinedLayerMapping["featureLvl2"] = "featureLvl2";
  5123. this._combinedLayerMapping["featureLvl3"] = "featureLvl3";
  5124. this._combinedLayerMapping["fill"] = "value";
  5125. this._combinedLayerMapping["pointSize"] = "pointSize";
  5126. this._combinedLayerMapping["pointColor"] = "pointColor";
  5127. this._combinedLayerMapping["region.palette"] = "color.palette";
  5128. this._combinedLayerMapping["region.alt.palette"] = "region.palette";
  5129. this._combinedLayerMapping["region.transparency"] = "color.fillTransparency";
  5130. this._combinedLayerMapping["region.mapData"] = "region.mapData";
  5131. this._combinedLayerMapping["region.custom.mapId"] = "region.custom.mapId";
  5132. this._combinedLayerMapping["region.custom.layerName"] = "region.custom.layerName";
  5133. this._combinedLayerMapping["region.custom.propertyName"] = "region.custom.propertyName";
  5134. this._combinedLayerMapping["point.palette"] = "color.palette";
  5135. this._combinedLayerMapping["point.alt.palette"] = "point.palette";
  5136. this._combinedLayerMapping["point.transparency"] = "color.pointTransparency";
  5137. this._combinedLayerMapping["point.mapData"] = "point.mapData";
  5138. this._combinedLayerMapping["point.minSize"] = "minPointSize";
  5139. this._combinedLayerMapping["point.maxSize"] = "maxPointSize";
  5140. this._combinedLayerMapping["point.defaultSize"] = "point.defaultSize";
  5141. this._combinedLayerMapping["point.staticZeroValueSize"] = "staticZeroValuePointSize";
  5142. this._combinedLayerMapping["point.custom.mapId"] = "point.custom.mapId";
  5143. this._combinedLayerMapping["point.custom.layerName"] = "point.custom.layerName";
  5144. this._combinedLayerMapping["point.custom.propertyName"] = "point.custom.propertyName";
  5145. this._combinedLayerMapping["legend.pointsize.title"] = "legend.pointsize.title";
  5146. this._combinedLayerMapping["legend.pointcolor.title"] = "legend.pointcolor.title";
  5147. this._combinedLegendMapping = {};
  5148. this._combinedLegendMapping["pointSize"] = 0;
  5149. this._combinedLegendMapping["pointColor"] = 1;
  5150. this._regionLayerMapping = {};
  5151. this._regionLayerMapping["featureLvl1"] = "featureLvl1";
  5152. this._regionLayerMapping["featureLvl2"] = "featureLvl2";
  5153. this._regionLayerMapping["featureLvl3"] = "featureLvl3";
  5154. this._regionLayerMapping["fill"] = "fill";
  5155. this._regionLayerMapping["region.palette"] = "region.palette";
  5156. this._regionLayerMapping["region.alt.palette"] = "region.palette";
  5157. this._regionLayerMapping["region.transparency"] = "region.transparency";
  5158. this._regionLayerMapping["region.mapData"] = "region.mapData";
  5159. this._regionLayerMapping["region.custom.mapId"] = "region.custom.mapId";
  5160. this._regionLayerMapping["region.custom.layerName"] = "region.custom.layerName";
  5161. this._regionLayerMapping["region.custom.propertyName"] = "region.custom.propertyName";
  5162. this._pointLayerMapping = {};
  5163. this._pointLayerMapping["featureLvl1"] = "featureLvl1";
  5164. this._pointLayerMapping["featureLvl2"] = "featureLvl2";
  5165. this._pointLayerMapping["featureLvl3"] = "featureLvl3";
  5166. this._pointLayerMapping["pointSize"] = "pointSize";
  5167. this._pointLayerMapping["pointColor"] = "pointColor";
  5168. this._pointLayerMapping["point.palette"] = "point.palette";
  5169. this._pointLayerMapping["point.alt.palette"] = "point.palette";
  5170. this._pointLayerMapping["point.transparency"] = "point.transparency";
  5171. this._pointLayerMapping["point.mapData"] = "point.mapData";
  5172. this._pointLayerMapping["point.minSize"] = "point.minSize";
  5173. this._pointLayerMapping["point.maxSize"] = "point.maxSize";
  5174. this._pointLayerMapping["point.defaultSize"] = "point.defaultSize";
  5175. this._pointLayerMapping["point.staticZeroValueSize"] = "point.staticZeroValueSize";
  5176. this._pointLayerMapping["point.custom.mapId"] = "point.custom.mapId";
  5177. this._pointLayerMapping["point.custom.layerName"] = "point.custom.layerName";
  5178. this._pointLayerMapping["point.custom.propertyName"] = "point.custom.propertyName";
  5179. this._pointLayerMapping["legend.pointsize.title"] = "legend.pointsize.title";
  5180. this._pointLayerMapping["legend.pointcolor.title"] = "legend.pointcolor.title";
  5181. this._pointLayerMapping["sizeLegend"] = "g.legend.size";
  5182. this._pointLayerMapping["colorLegend"] = "g.legend.point";
  5183. this._pointLegendMapping = {};
  5184. this._pointLegendMapping["pointSize"] = 0;
  5185. this._pointLegendMapping["pointColor"] = 1;
  5186. this._latlongLayerMapping = {};
  5187. this._latlongLayerMapping["pointSize"] = "latlongSize";
  5188. this._latlongLayerMapping["pointColor"] = "latlongColor";
  5189. this._latlongLayerMapping["point.palette"] = "latlong.palette";
  5190. this._latlongLayerMapping["point.alt.palette"] = "latlong.palette";
  5191. this._latlongLayerMapping["point.transparency"] = "latlong.transparency";
  5192. this._latlongLayerMapping["point.minSize"] = "latlong.minSize";
  5193. this._latlongLayerMapping["point.maxSize"] = "latlong.maxSize";
  5194. this._latlongLayerMapping["point.defaultSize"] = "latlong.defaultSize";
  5195. this._latlongLayerMapping["point.staticZeroValueSize"] = "latlong.staticZeroValueSize";
  5196. this._latlongLayerMapping["legend.pointsize.title"] = "legend.latlong.pointsize.title";
  5197. this._latlongLayerMapping["legend.pointcolor.title"] = "legend.latlong.pointcolor.title";
  5198. this._latlongLayerMapping["sizeLegend"] = "g.legend.latlongSize";
  5199. this._latlongLayerMapping["colorLegend"] = "g.legend.latlongPoint";
  5200. this._latlongLegendMapping = {};
  5201. this._latlongLegendMapping["pointSize"] = 2;
  5202. this._latlongLegendMapping["pointColor"] = 3;
  5203. this._registeredEventHandlers = [];
  5204. this._delayedInit = null;
  5205. },
  5206. /** @expose */
  5207. dispose : function() {
  5208. if (this._mapComponent) {
  5209. this._mapComponent.dispose();
  5210. }
  5211. },
  5212. /** @expose */
  5213. on : function(_eventName, _callback) {
  5214. rave['library']['internal']['AbstractView'].prototype.on.call(this, _eventName, _callback);
  5215. if (this._mapComponent) {
  5216. this._mapComponent.on(_eventName, function(_e) {
  5217. _callback(_e);
  5218. });
  5219. }
  5220. this._registeredEventHandlers.push(new com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.EventHandler(_eventName, _callback));
  5221. },
  5222. /** @expose */
  5223. draw : function() {
  5224. var accessToken = this.getStringProperty("tiledmap.token");
  5225. if ((accessToken == null) || accessToken == "") {
  5226. return;
  5227. }
  5228. var self = this;
  5229. this.preDraw("g.vizlibrary-tiledmap");
  5230. this.context.node.selectAll("g.legends").style("pointer-events", "all");
  5231. if (!(this.validateDataModel("*"))) {
  5232. return;
  5233. }
  5234. var legendPosition = this.getLegendPosition();
  5235. var showLegend = this.isShowLegend();
  5236. this._legends.visible(showLegend).position(legendPosition).transition(false, 0).setPreExecute(this.context.getPreExecute());
  5237. var maxZoom = this.getProperty("tiledmap.maxZoom");
  5238. var mapLocale = this.getStringPropertyEmptyAsNull("tiledmap.mapLocale");
  5239. if (mapLocale == null) {
  5240. mapLocale = this.context.locale();
  5241. }
  5242. var mapStyle = this.getStringProperty("tiledmap.style");
  5243. var combinedLayers = false;
  5244. var dataLayers = [];
  5245. if (this.dataModel.getDescriptor().id() == "tabular") {
  5246. combinedLayers = true;
  5247. var combinedDataSet = this.dataModel.dataset("data");
  5248. var data = (combinedDataSet.data());
  5249. var geoJson = this.getProperty("tiledmap.geoJson");
  5250. var mapData = null;
  5251. if (geoJson != null) {
  5252. if ((typeof geoJson === "array" || geoJson instanceof Array)) {
  5253. mapData = geoJson;
  5254. } else {
  5255. mapData = (geoJson)["mapboxData"];
  5256. }
  5257. }
  5258. var dataLayer = new com_ibm_rave_bundles_nativeImpl_components_TiledmapV2DataLayerImpl("data");
  5259. dataLayers.push(dataLayer);
  5260. dataLayer.setData(data);
  5261. dataLayer.setMapData(mapData);
  5262. var dseFeatureLvl1 = combinedDataSet.slot(this._combinedLayerMapping["featureLvl1"]).entry();
  5263. var dseFeatureLvl2 = combinedDataSet.slot(this._combinedLayerMapping["featureLvl2"]).entry();
  5264. var dseFeatureLvl3 = combinedDataSet.slot(this._combinedLayerMapping["featureLvl3"]).entry();
  5265. var dsePointSize = combinedDataSet.slot(this._combinedLayerMapping["pointSize"]).entry();
  5266. var dsePointColor = combinedDataSet.slot(this._combinedLayerMapping["pointColor"]).entry();
  5267. var featureAccessors = [];
  5268. featureAccessors.push(rave['library']['internal']['AbstractView'].accessorOf(dseFeatureLvl1));
  5269. featureAccessors.push(rave['library']['internal']['AbstractView'].accessorOf(dseFeatureLvl2));
  5270. featureAccessors.push(rave['library']['internal']['AbstractView'].accessorOf(dseFeatureLvl3));
  5271. dataLayer.setFeatureAccessors(featureAccessors);
  5272. if (dseFeatureLvl1) {
  5273. this._setupRegionDataLayer(dataLayer, combinedDataSet, data, this._combinedLayerMapping, false, showLegend);
  5274. } else {
  5275. this._legends.visible(4, false);
  5276. }
  5277. if ((dseFeatureLvl1) && ((dsePointSize) || (dsePointColor))) {
  5278. this._setupPointDataLayer(dataLayer, combinedDataSet, data, this._combinedLayerMapping, this._pointLegendMapping, false, showLegend);
  5279. } else {
  5280. this._legends.visible(0, false);
  5281. this._legends.visible(1, false);
  5282. }
  5283. this._legends.visible(2, false);
  5284. this._legends.visible(3, false);
  5285. } else if (this.dataModel.getDescriptor().id() == "multiTable") {
  5286. var regionDataSet = this.dataModel.dataset("data.region");
  5287. var pointDataSet = this.dataModel.dataset("data.point");
  5288. var latlongDataSet = this.dataModel.dataset("data.latlong");
  5289. if (regionDataSet.data() != null) {
  5290. var data = (regionDataSet.data());
  5291. var regionLayer = new com_ibm_rave_bundles_nativeImpl_components_TiledmapV2DataLayerImpl("data.region");
  5292. dataLayers.push(regionLayer);
  5293. regionLayer.setData(data);
  5294. regionLayer.setMapData(this.getProperty(this._regionLayerMapping["region.mapData"]));
  5295. var dseFeatureLvl1 = regionDataSet.slot(this._regionLayerMapping["featureLvl1"]).entry();
  5296. var dseFeatureLvl2 = regionDataSet.slot(this._regionLayerMapping["featureLvl2"]).entry();
  5297. var dseFeatureLvl3 = regionDataSet.slot(this._regionLayerMapping["featureLvl3"]).entry();
  5298. var hasGeo = ((dseFeatureLvl1) && (this.getStringProperty(this._regionLayerMapping["region.custom.mapId"]).length > 0) && (this.getStringProperty(this._regionLayerMapping["region.custom.layerName"]).length > 0) && (this.getStringProperty(this._regionLayerMapping["region.custom.propertyName"]).length > 0));
  5299. var featureAccessors = [];
  5300. if (hasGeo) {
  5301. featureAccessors.push(this._createGeoDataAccessor(null, null, null, dseFeatureLvl1));
  5302. } else {
  5303. featureAccessors.push(rave['library']['internal']['AbstractView'].accessorOf(dseFeatureLvl1));
  5304. featureAccessors.push(rave['library']['internal']['AbstractView'].accessorOf(dseFeatureLvl2));
  5305. featureAccessors.push(rave['library']['internal']['AbstractView'].accessorOf(dseFeatureLvl3));
  5306. }
  5307. regionLayer.setFeatureAccessors(featureAccessors);
  5308. this._setupRegionDataLayer(regionLayer, regionDataSet, data, this._regionLayerMapping, hasGeo, showLegend);
  5309. } else {
  5310. this._legends.visible(4, false);
  5311. }
  5312. if (pointDataSet.data() != null) {
  5313. var data = (pointDataSet.data());
  5314. var pointLayer = new com_ibm_rave_bundles_nativeImpl_components_TiledmapV2DataLayerImpl("data.point");
  5315. dataLayers.push(pointLayer);
  5316. pointLayer.setData(data);
  5317. pointLayer.setMapData(this.getProperty(this._pointLayerMapping["point.mapData"]));
  5318. var dseFeatureLvl1 = pointDataSet.slot(this._pointLayerMapping["featureLvl1"]).entry();
  5319. var dseFeatureLvl2 = pointDataSet.slot(this._pointLayerMapping["featureLvl2"]).entry();
  5320. var dseFeatureLvl3 = pointDataSet.slot(this._pointLayerMapping["featureLvl3"]).entry();
  5321. var hasGeo = ((dseFeatureLvl1) && (this.getStringProperty(this._pointLayerMapping["point.custom.mapId"]).length > 0) && (this.getStringProperty(this._pointLayerMapping["point.custom.layerName"]).length > 0) && (this.getStringProperty(this._pointLayerMapping["point.custom.propertyName"]).length > 0));
  5322. var featureAccessors = [];
  5323. if (hasGeo) {
  5324. featureAccessors.push(this._createGeoDataAccessor(null, null, null, dseFeatureLvl1));
  5325. } else {
  5326. featureAccessors.push(rave['library']['internal']['AbstractView'].accessorOf(dseFeatureLvl1));
  5327. featureAccessors.push(rave['library']['internal']['AbstractView'].accessorOf(dseFeatureLvl2));
  5328. featureAccessors.push(rave['library']['internal']['AbstractView'].accessorOf(dseFeatureLvl3));
  5329. }
  5330. pointLayer.setFeatureAccessors(featureAccessors);
  5331. this._setupPointDataLayer(pointLayer, pointDataSet, data, this._pointLayerMapping, this._pointLegendMapping, hasGeo, showLegend);
  5332. } else {
  5333. this._legends.visible(0, false);
  5334. this._legends.visible(1, false);
  5335. }
  5336. if (latlongDataSet.data() != null) {
  5337. var dseLatitude = latlongDataSet.slot("latitude").entry();
  5338. var dseLongitude = latlongDataSet.slot("longitude").entry();
  5339. var dseLabel = latlongDataSet.slot("label").entry();
  5340. var hasGeo = ((dseLatitude) || (dseLongitude));
  5341. if (hasGeo) {
  5342. var featureAccessors = [];
  5343. if ((dseLatitude) && (dseLatitude.type() == "object")) {
  5344. featureAccessors.push(rave['library']['internal']['AbstractView'].accessorOf(dseLatitude));
  5345. } else if ((dseLongitude) && (dseLongitude.type() == "object")) {
  5346. featureAccessors.push(rave['library']['internal']['AbstractView'].accessorOf(dseLongitude));
  5347. } else if ((dseLabel) && (dseLabel.type() == "object")) {
  5348. featureAccessors.push(rave['library']['internal']['AbstractView'].accessorOf(dseLabel));
  5349. } else if ((dseLatitude) && (dseLongitude)) {
  5350. featureAccessors.push(this._createGeoDataAccessor(dseLabel, dseLatitude, dseLongitude, null));
  5351. }
  5352. if (featureAccessors.length > 0) {
  5353. var data = (latlongDataSet.data());
  5354. var latlongLayer = new com_ibm_rave_bundles_nativeImpl_components_TiledmapV2DataLayerImpl("data.latlong");
  5355. dataLayers.push(latlongLayer);
  5356. latlongLayer.setData(data);
  5357. latlongLayer.setFeatureAccessors(featureAccessors);
  5358. this._setupPointDataLayer(latlongLayer, latlongDataSet, data, this._latlongLayerMapping, this._latlongLegendMapping, hasGeo, showLegend);
  5359. }
  5360. }
  5361. } else {
  5362. this._legends.visible(2, false);
  5363. this._legends.visible(3, false);
  5364. }
  5365. }
  5366. if (this.updateType <= 1) {
  5367. this.prepareLayoutComponent();
  5368. this.prepareLayoutSizables(this._layoutComponent, false, false, false, false, this._legends.anyVisible());
  5369. this._legends.preLayout(this._layoutComponent);
  5370. this._layoutComponent.layout();
  5371. }
  5372. var chartRect = this._layoutComponent.elementRect();
  5373. this._legends.rectangle(this._layoutComponent.legendRect());
  5374. this._legends.draw();
  5375. var maxPointSize = this.evaluateSize(this.getStringProperty("point.maxSize"), chartRect.width, 10);
  5376. var autoZoom = this.getBooleanProperty("tiledmap.autoZoom");
  5377. if (!this._mapComponent) {
  5378. this._mapComponent = new com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl();
  5379. this._mapComponent.accessToken(accessToken);
  5380. this._mapComponent.setContainerRect(chartRect);
  5381. this._mapComponent.setup(this.context.node, this.getNLS());
  5382. this._mapComponent.setDataLayers(dataLayers, true, combinedLayers);
  5383. this._mapComponent.draw(this.context.node);
  5384. this._mapComponent.mapStyle(mapStyle);
  5385. this._mapComponent.setMaxBounds(com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.BASE_BOUNDS);
  5386. if (maxZoom != this._maxZoom) {
  5387. this._mapComponent.setMaxZoom(maxZoom);
  5388. }
  5389. this._mapComponent.setMapLocale(mapLocale);
  5390. this._mapComponent.setMaxPointSize(maxPointSize);
  5391. this._mapComponent.setAutoZoom(autoZoom);
  5392. if (this._registeredEventHandlers.length > 0) {
  5393. for (var idx = 0, size = this._registeredEventHandlers.length; idx < size; ++idx) {
  5394. var evt = this._registeredEventHandlers[idx];
  5395. this._mapComponent.on(evt.eventName, new com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.EventCallback(evt.callback));
  5396. }
  5397. }
  5398. this._mapInitializedCallback = function(e) {
  5399. self._mapInitialized = true;
  5400. if (self._delayedInit) {
  5401. if (self._delayedInit.chartRect) {
  5402. self._mapComponent.setContainerRect(self._delayedInit.chartRect);
  5403. }
  5404. self._mapComponent.setDataLayers(self._delayedInit.dataLayers, self._delayedInit.resetData, self._delayedInit.combinedLayers);
  5405. if (self._delayedInit.maxZoom != null) {
  5406. self._mapComponent.setMaxZoom(self._delayedInit.maxZoom);
  5407. }
  5408. if (self._delayedInit.mapLocale != null) {
  5409. self._mapComponent.setMapLocale(self._delayedInit.mapLocale);
  5410. }
  5411. if (self._delayedInit.mapStyle != null) {
  5412. self._mapComponent.mapStyle(self._delayedInit.mapStyle);
  5413. }
  5414. if (self._delayedInit.maxPointSize != null) {
  5415. self._mapComponent.setMaxPointSize(self._delayedInit.maxPointSize);
  5416. }
  5417. self._mapComponent.setAutoZoom(self._delayedInit.autoZoom);
  5418. }
  5419. self._mapComponent.off("style.load", self._mapInitializedCallback);
  5420. };
  5421. this._mapComponent.on("style.load", this._mapInitializedCallback);
  5422. } else if (this._mapInitialized) {
  5423. var resetData = (this.updateType == 0);
  5424. if (!(this._isRectEqual(this._lastChartRect, chartRect))) {
  5425. this._mapComponent.setContainerRect(chartRect);
  5426. }
  5427. this._mapComponent.setDataLayers(dataLayers, resetData, combinedLayers);
  5428. if (this.updateType <= 1) {
  5429. if (maxZoom != this._maxZoom) {
  5430. this._mapComponent.setMaxZoom(maxZoom);
  5431. }
  5432. if (!(mapLocale == this._mapLocale)) {
  5433. this._mapComponent.setMapLocale(mapLocale);
  5434. }
  5435. if (!(mapStyle == this._mapStyle)) {
  5436. this._mapComponent.mapStyle(mapStyle);
  5437. }
  5438. this._mapComponent.setMaxPointSize(maxPointSize);
  5439. this._mapComponent.setAutoZoom(autoZoom);
  5440. }
  5441. if (resetData || ((this.updateType <= 1) && mapStyle == this._mapStyle)) {
  5442. this._mapComponent.fire("style.load");
  5443. }
  5444. } else {
  5445. var resetData = (this.updateType == 0);
  5446. if (!this._delayedInit) {
  5447. this._delayedInit = new com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DelayedInit();
  5448. }
  5449. if (!(this._isRectEqual(this._lastChartRect, chartRect))) {
  5450. this._delayedInit.setChartRect(chartRect);
  5451. }
  5452. this._delayedInit.setDataLayers(dataLayers, resetData, combinedLayers);
  5453. if (maxZoom != this._maxZoom) {
  5454. this._delayedInit.setMaxZoom(maxZoom);
  5455. }
  5456. if (!(mapLocale == this._mapLocale)) {
  5457. this._delayedInit.setMapLocale(mapLocale);
  5458. }
  5459. if (!(mapStyle == this._mapStyle)) {
  5460. this._delayedInit.setMapStyle(mapStyle);
  5461. }
  5462. this._delayedInit.setMaxPointSize(maxPointSize);
  5463. this._delayedInit.setAutoZoom(autoZoom);
  5464. }
  5465. this._maxZoom = maxZoom;
  5466. this._mapLocale = mapLocale;
  5467. this._mapStyle = mapStyle;
  5468. this._lastChartRect = this._cloneRect(chartRect);
  5469. this.resetUpdate();
  5470. },
  5471. _createGeoDataAccessor : function(_captionEntry, _latEntry, _longEntry, _featureIdEntry) {
  5472. return (new com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.GeoDataAccessor(rave['library']['internal']['AbstractView'].accessorOf(_captionEntry), rave['library']['internal']['AbstractView'].accessorOf(_latEntry), rave['library']['internal']['AbstractView'].accessorOf(_longEntry), rave['library']['internal']['AbstractView'].accessorOf(_featureIdEntry))).getAccessor();
  5473. },
  5474. evaluateSize : function(value, extent, defValue) {
  5475. var v = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(value, extent, 10);
  5476. var d = v != null ? v : defValue;
  5477. return Math.max(0, Math.min(d, extent));
  5478. },
  5479. /** @expose */
  5480. getLegendCount : function() {
  5481. return 5;
  5482. },
  5483. /** @expose */
  5484. getGroupStructure : function() {
  5485. return ["defs", "g.vizlibrary vizlibrary-tiledmap", "(", "rect.background chart", "g.chart", "g.legends", "(", "g.legends-layout", "g.legend size", "g.legend point", "g.legend latlongSize", "g.legend latlongPoint", "g.legend region", ")", ")"];
  5486. },
  5487. _setupRegionDataLayer : function(_dataLayer, _dataSet, _data, _layerMap, _geoData, _showLegend) {
  5488. var regionTypeData = new com_ibm_rave_bundles_nativeImpl_components_TiledmapV2RegionTypeDataImpl();
  5489. var nullColor = this.getStringProperty("color.null");
  5490. var nullColorDefault = ""+(this.getPropertyDefault("color.null"));
  5491. var currentPaletteId = this.getStringProperty(_layerMap["region.alt.palette"]);
  5492. if (""+(this.getPropertyDefault(_layerMap["region.alt.palette"])) == currentPaletteId) {
  5493. currentPaletteId = this.getStringProperty(_layerMap["region.palette"]);
  5494. }
  5495. var jsonPalette = com_ibm_rave_library_Library.palettes.getJSONPalette(currentPaletteId);
  5496. var dseValue = _dataSet.slot(_layerMap["fill"]).entry();
  5497. regionTypeData.setValueAccessor(rave['library']['internal']['AbstractView'].accessorOf(dseValue));
  5498. var valueExtent = [0, 0];
  5499. if (dseValue) {
  5500. if (dseValue.domain()) {
  5501. valueExtent = dseValue.domain();
  5502. } else {
  5503. rave.extent(_data, function(data, index, groupIndex) {
  5504. return dseValue(data);
  5505. });
  5506. }
  5507. }
  5508. regionTypeData.minimumValue(+ (valueExtent[0]));
  5509. regionTypeData.maximumValue(+ (valueExtent[1]));
  5510. var featurePalette = com_ibm_rave_library_Library.palettes.getPalette(currentPaletteId);
  5511. featurePalette.setData(_dataSet, _layerMap["fill"]);
  5512. regionTypeData.setPaletteDef(jsonPalette);
  5513. regionTypeData.setPalette(featurePalette);
  5514. regionTypeData.setNullColor(nullColor == "" ? nullColorDefault : nullColor);
  5515. regionTypeData.setHasGeoData(_geoData);
  5516. regionTypeData.setTransparency(this.getIntProperty(_layerMap["region.transparency"]));
  5517. regionTypeData.setCustomPolygon(this.getStringProperty(_layerMap["region.custom.mapId"]), this.getStringProperty(_layerMap["region.custom.layerName"]), this.getStringProperty(_layerMap["region.custom.propertyName"]));
  5518. _dataLayer.setTypeData("region", regionTypeData);
  5519. if (_showLegend) {
  5520. this._legends.visible(4, !!((dseValue))).selector(4, this.context.node.selectAll("g.legend.region")).palette(4, featurePalette).shape(4, "square").title(4, this.context.getDataSlotLabel("legend.regioncolor.title", dseValue)).titleFill(4, (this.context.getPropertyValue("legend.titlestyle.fill"))).titleFontSize(4, (this.context.getPropertyValue("legend.titlestyle.fontsize"))).titleFontFamily(4, (this.context.getPropertyValue("legend.titlestyle.fontfamily"))).setDataSlot(4, dseValue);
  5521. }
  5522. },
  5523. _setupPointDataLayer : function(_dataLayer, _dataSet, _data, _layerMap, _legendMap, _geoData, _showLegend) {
  5524. var pointTypeData = new com_ibm_rave_bundles_nativeImpl_components_TiledmapV2PointTypeDataImpl();
  5525. var nullColor = this.getStringProperty("color.null");
  5526. var nullColorDefault = ""+(this.getPropertyDefault("color.null"));
  5527. var currentPaletteId = this.getStringProperty(_layerMap["point.alt.palette"]);
  5528. if (""+(this.getPropertyDefault(_layerMap["point.alt.palette"])) == currentPaletteId) {
  5529. currentPaletteId = this.getStringProperty(_layerMap["point.palette"]);
  5530. }
  5531. var dsePointColor = _dataSet.slot(_layerMap["pointColor"]).entry();
  5532. var dsePointSize = _dataSet.slot(_layerMap["pointSize"]).entry();
  5533. pointTypeData.setPointColorAccessor(rave['library']['internal']['AbstractView'].accessorOf(dsePointColor));
  5534. pointTypeData.setPointSizeAccessor(rave['library']['internal']['AbstractView'].accessorOf(dsePointSize));
  5535. pointTypeData.setHasGeoData(_geoData);
  5536. pointTypeData.setCustomPolygon(this.getStringProperty(_layerMap["point.custom.mapId"]), this.getStringProperty(_layerMap["point.custom.layerName"]), this.getStringProperty(_layerMap["point.custom.propertyName"]));
  5537. var pointSizeDomain = [0, 0];
  5538. if (dsePointSize) {
  5539. if (dsePointSize.domain()) {
  5540. pointSizeDomain = dsePointSize.domain();
  5541. } else {
  5542. pointSizeDomain = rave.extent(_data, function(data, index, groupIndex) {
  5543. return dsePointSize(data);
  5544. });
  5545. }
  5546. }
  5547. var pointPalette = com_ibm_rave_library_Library.palettes.getPalette(currentPaletteId);
  5548. pointPalette.setData(_dataSet, _layerMap["pointColor"]);
  5549. pointTypeData.setPalette(pointPalette);
  5550. var bb = this._chart.node().rave_getParentNode().rave_getParentNode().getBoundingClientRect();
  5551. var min = this.evaluateSize(this.getStringProperty(_layerMap["point.minSize"]), bb.width, 10);
  5552. var max = this.evaluateSize(this.getStringProperty(_layerMap["point.maxSize"]), bb.width, 10);
  5553. var defaultSize = this.evaluateSize(this.getStringProperty(_layerMap["point.defaultSize"]), bb.width, min + max / 2);
  5554. var pointSizeScale = rave.scale.linear().domain(pointSizeDomain).range([min, max]);
  5555. pointTypeData.setPointSizeScale(pointSizeScale);
  5556. pointTypeData.setDefaultPointSize(defaultSize);
  5557. var nullColorPalette;
  5558. if (pointSizeScale) {
  5559. var minValue = pointSizeScale.domain()[0];
  5560. var maxValue = pointSizeScale.domain()[1];
  5561. nullColorPalette = rave.scale.ordinal().domain([minValue, maxValue]).range([nullColor]);
  5562. }
  5563. pointTypeData.setNullColor(nullColor == "" ? nullColorDefault : nullColor);
  5564. pointTypeData.setTransparency(this.getIntProperty(_layerMap["point.transparency"]));
  5565. var staticZeroValueSize = this.getStringProperty(_layerMap["point.staticZeroValueSize"]);
  5566. if ((staticZeroValueSize == null) || (staticZeroValueSize.length == 0)) {
  5567. pointTypeData.setStaticZeroValuePointSize(null);
  5568. } else {
  5569. pointTypeData.setStaticZeroValuePointSize(this.evaluateSize(staticZeroValueSize, bb.width, 10));
  5570. }
  5571. _dataLayer.setTypeData("point", pointTypeData);
  5572. if (_showLegend) {
  5573. var legendIndex = _legendMap["pointSize"];
  5574. this._legends.visible(legendIndex, !!((dsePointSize))).selector(legendIndex, this.context.node.selectAll(_layerMap["sizeLegend"])).scale(legendIndex, nullColorPalette).shape(legendIndex, "circle").swatchSize(legendIndex, function(_data, index, groupIndex) {
  5575. return Math.PI * Math.pow(+ (+ (pointSizeScale.call(null, _data, index, groupIndex))), 2);
  5576. }).title(legendIndex, this.context.getDataSlotLabel(_layerMap["legend.pointsize.title"], dsePointSize)).titleFill(legendIndex, (this.context.getPropertyValue("legend.titlestyle.fill"))).titleFontSize(legendIndex, (this.context.getPropertyValue("legend.titlestyle.fontsize"))).titleFontFamily(legendIndex, (this.context.getPropertyValue("legend.titlestyle.fontfamily"))).setDataSlot(legendIndex, dsePointSize);
  5577. legendIndex = _legendMap["pointColor"];
  5578. this._legends.visible(legendIndex, !!((dsePointColor))).selector(legendIndex, this.context.node.selectAll(_layerMap["colorLegend"])).palette(legendIndex, pointPalette).shape(legendIndex, "square").title(legendIndex, this.context.getDataSlotLabel(_layerMap["legend.pointcolor.title"], dsePointColor)).titleFill(legendIndex, (this.context.getPropertyValue("legend.titlestyle.fill"))).titleFontSize(legendIndex, (this.context.getPropertyValue("legend.titlestyle.fontsize"))).titleFontFamily(legendIndex, (this.context.getPropertyValue("legend.titlestyle.fontfamily"))).setDataSlot(legendIndex, dsePointColor);
  5579. }
  5580. },
  5581. _cloneRect : function(_rect) {
  5582. return new rave['internal']['RectStruct'](_rect.x, _rect.y, _rect.width, _rect.height);
  5583. },
  5584. _isRectEqual : function(_rectA, _rectB) {
  5585. return ((_rectA.x == _rectB.x) && (_rectA.y == _rectB.y) && (_rectA.width == _rectB.width) && (_rectA.height == _rectB.height));
  5586. },
  5587. getNLS : function() {
  5588. var self = this;
  5589. return function(_key) {
  5590. return self.message(_key, null);
  5591. };
  5592. }
  5593. });
  5594. com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.EventHandler = rave['internal']['Declare']({
  5595. /** @expose */
  5596. eventName : null,
  5597. /** @expose */
  5598. callback : null,
  5599. /** @expose */
  5600. constructor : function(_eventName, _callback) {
  5601. this.eventName = _eventName;
  5602. this.callback = _callback;
  5603. }
  5604. });
  5605. com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DelayedInit = rave['internal']['Declare']({
  5606. /** @expose */
  5607. chartRect : null,
  5608. /** @expose */
  5609. dataLayers : null,
  5610. /** @expose */
  5611. maxZoom : null,
  5612. /** @expose */
  5613. mapLocale : null,
  5614. /** @expose */
  5615. mapStyle : null,
  5616. /** @expose */
  5617. maxPointSize : null,
  5618. /** @expose */
  5619. resetData : false,
  5620. /** @expose */
  5621. combinedLayers : false,
  5622. /** @expose */
  5623. autoZoom : false,
  5624. /** @expose */
  5625. constructor : function() {
  5626. this.chartRect = null;
  5627. this.dataLayers = null;
  5628. this.maxZoom = null;
  5629. this.mapLocale = null;
  5630. this.mapStyle = null;
  5631. this.maxPointSize = null;
  5632. },
  5633. /** @expose */
  5634. setChartRect : function(_chartRect) {
  5635. this.chartRect = _chartRect;
  5636. },
  5637. /** @expose */
  5638. setDataLayers : function(_dataLayers, _resetData, _combinedLayers) {
  5639. this.dataLayers = _dataLayers;
  5640. this.resetData = _resetData;
  5641. this.combinedLayers = _combinedLayers;
  5642. },
  5643. /** @expose */
  5644. setMaxZoom : function(_maxZoom) {
  5645. this.maxZoom = _maxZoom;
  5646. },
  5647. /** @expose */
  5648. setMapLocale : function(_mapLocale) {
  5649. this.mapLocale = _mapLocale;
  5650. },
  5651. /** @expose */
  5652. setMapStyle : function(_mapStyle) {
  5653. this.mapStyle = _mapStyle;
  5654. },
  5655. /** @expose */
  5656. setMaxPointSize : function(_size) {
  5657. this.maxPointSize = _size;
  5658. },
  5659. /** @expose */
  5660. setAutoZoom : function(_autoZoom) {
  5661. this.autoZoom = _autoZoom;
  5662. }
  5663. });
  5664. com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.EventCallback = rave['internal']['Declare']({
  5665. //callback : null,
  5666. _$functionClassMethod : function() {
  5667. var _$self = function(_e) {
  5668. _$self.callback(_e);
  5669. };
  5670. return _$self;
  5671. },
  5672. /** @expose */
  5673. constructor : function(_callback) {
  5674. this.callback = _callback;
  5675. }
  5676. });
  5677. com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.GeoData = rave['internal']['Declare']({
  5678. /** @expose */
  5679. caption : null,
  5680. /** @expose */
  5681. featureId : null,
  5682. /** @expose */
  5683. latitude : 0,
  5684. /** @expose */
  5685. longitude : 0,
  5686. /** @expose */
  5687. invalidLatLong : false,
  5688. /** @expose */
  5689. constructor : function(_caption, _latitude, _longitude, _featureId) {
  5690. this.caption = _caption;
  5691. if (this.isValidLatLong(_latitude, _longitude)) {
  5692. this.latitude = _latitude;
  5693. this.longitude = this.normalizeLongitude(_longitude);
  5694. this.invalidLatLong = false;
  5695. } else {
  5696. this.latitude = 0;
  5697. this.longitude = 0;
  5698. this.invalidLatLong = true;
  5699. }
  5700. this.featureId = _featureId;
  5701. },
  5702. isValidLatLong : function(_latitude, _longitude) {
  5703. if ((_latitude == null) || (_latitude >= 90) || (_latitude <= -90)) {
  5704. return false;
  5705. }
  5706. return (_longitude != null);
  5707. },
  5708. normalizeLongitude : function(_longitude) {
  5709. var longitude = _longitude;
  5710. var correction = (_longitude < 0) ? 360 : -360;
  5711. while ((longitude < -180) || (longitude > 180)) {
  5712. longitude += correction;
  5713. }
  5714. return longitude;
  5715. }
  5716. });
  5717. com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.GeoDataAccessor = rave['internal']['Declare']({
  5718. //captionAccessor : null,
  5719. //latitudeAccessor : null,
  5720. //longitudeAccessor : null,
  5721. //featureIdAccessor : null,
  5722. /** @expose */
  5723. constructor : function(_caption, _latitude, _longitude, _featureId) {
  5724. this.captionAccessor = _caption;
  5725. this.latitudeAccessor = _latitude;
  5726. this.longitudeAccessor = _longitude;
  5727. this.featureIdAccessor = _featureId;
  5728. },
  5729. /** @expose */
  5730. getAccessor : function() {
  5731. var self = this;
  5732. return function(_data) {
  5733. return new com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.GeoData((self.captionAccessor) ? self.captionAccessor(_data) : null, (self.latitudeAccessor) ? self.latitudeAccessor(_data) : 0, (self.longitudeAccessor) ? self.longitudeAccessor(_data) : 0, (self.featureIdAccessor) ? self.featureIdAccessor(_data) : null);
  5734. };
  5735. }
  5736. });
  5737. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASET_DATA = "data";
  5738. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASET_DATA_REGION = "data.region";
  5739. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASET_DATA_POINT = "data.point";
  5740. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASET_DATA_LATLONG = "data.latlong";
  5741. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.TILEDMAP_TOKEN = "tiledmap.token";
  5742. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.TILEDMAP_STYLE = "tiledmap.style";
  5743. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.TILEDMAP_GEOJSON = "tiledmap.geoJson";
  5744. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.TILEDMAP_MAXZOOM = "tiledmap.maxZoom";
  5745. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.TILEDMAP_MAPLOCALE = "tiledmap.mapLocale";
  5746. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.TILEDMAP_AUTOZOOM = "tiledmap.autoZoom";
  5747. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASLOT_FEATURE_LVL1 = "featureLvl1";
  5748. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASLOT_FEATURE_LVL2 = "featureLvl2";
  5749. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASLOT_FEATURE_LVL3 = "featureLvl3";
  5750. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASLOT_LATITUDE = "latitude";
  5751. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASLOT_LONGITUDE = "longitude";
  5752. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASLOT_LABEL = "label";
  5753. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASLOT_VALUE = "value";
  5754. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASLOT_FILL = "fill";
  5755. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASLOT_POINTSIZE = "pointSize";
  5756. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASLOT_POINTCOLOR = "pointColor";
  5757. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASLOT_LATLONG_POINTSIZE = "latlongSize";
  5758. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.DATASLOT_LATLONG_POINTCOLOR = "latlongColor";
  5759. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_MINSIZE = "minPointSize";
  5760. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_MAXSIZE = "maxPointSize";
  5761. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_STATICZEROVALUEPOINTSIZE = "staticZeroValuePointSize";
  5762. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_FILLTRANS = "color.fillTransparency";
  5763. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_POINTTRANS = "color.pointTransparency";
  5764. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_REGION_PALETTE = "region.palette";
  5765. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_REGION_TRANSPARENCY = "region.transparency";
  5766. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_REGION_MAPDATA = "region.mapData";
  5767. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_REGION_CUSTOM_MAPID = "region.custom.mapId";
  5768. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_REGION_CUSTOM_LAYERNAME = "region.custom.layerName";
  5769. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_REGION_CUSTOM_PROPERTYNAME = "region.custom.propertyName";
  5770. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_POINT_PALETTE = "point.palette";
  5771. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_POINT_TRANSPARENCY = "point.transparency";
  5772. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_POINT_MAPDATA = "point.mapData";
  5773. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_POINT_MINSIZE = "point.minSize";
  5774. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_POINT_MAXSIZE = "point.maxSize";
  5775. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_POINT_DEFAULTSIZE = "point.defaultSize";
  5776. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_POINT_STATICZEROVALUESIZE = "point.staticZeroValueSize";
  5777. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_POINT_CUSTOM_MAPID = "point.custom.mapId";
  5778. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_POINT_CUSTOM_LAYERNAME = "point.custom.layerName";
  5779. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_POINT_CUSTOM_PROPERTYNAME = "point.custom.propertyName";
  5780. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_POINT_LEGEND_SIZE_TITLE = "legend.pointsize.title";
  5781. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_POINT_LEGEND_COLOR_TITLE = "legend.pointcolor.title";
  5782. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.SELECTOR_POINTSIZE_LEGEND = "g.legend.size";
  5783. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.SELECTOR_POINTCOLOR_LEGEND = "g.legend.point";
  5784. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_LATLONG_PALETTE = "latlong.palette";
  5785. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_LATLONG_TRANSPARENCY = "latlong.transparency";
  5786. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_LATLONG_MINSIZE = "latlong.minSize";
  5787. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_LATLONG_MAXSIZE = "latlong.maxSize";
  5788. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_LATLONG_DEFAULTSIZE = "latlong.defaultSize";
  5789. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_LATLONG_STATICZEROVALUESIZE = "latlong.staticZeroValueSize";
  5790. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_LATLONG_LEGEND_SIZE_TITLE = "legend.latlong.pointsize.title";
  5791. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.PROP_LATLONG_LEGEND_COLOR_TITLE = "legend.latlong.pointcolor.title";
  5792. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.SELECTOR_LATLONG_POINTSIZE_LEGEND = "g.legend.latlongSize";
  5793. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.SELECTOR_LATLONG_POINTCOLOR_LEGEND = "g.legend.latlongPoint";
  5794. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_DATASLOT_FEATURE_LVL1 = "featureLvl1";
  5795. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_DATASLOT_FEATURE_LVL2 = "featureLvl2";
  5796. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_DATASLOT_FEATURE_LVL3 = "featureLvl3";
  5797. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_DATASLOT_FILL = "fill";
  5798. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_DATASLOT_POINTSIZE = "pointSize";
  5799. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_DATASLOT_POINTCOLOR = "pointColor";
  5800. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_REGION_PALETTE = "region.palette";
  5801. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_REGION_ALT_PALETTE = "region.alt.palette";
  5802. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_REGION_TRANSPARENCY = "region.transparency";
  5803. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_REGION_MAPDATA = "region.mapData";
  5804. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_REGION_CUSTOM_MAPID = "region.custom.mapId";
  5805. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_REGION_CUSTOM_LAYERNAME = "region.custom.layerName";
  5806. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_REGION_CUSTOM_PROPERTYNAME = "region.custom.propertyName";
  5807. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_POINT_PALETTE = "point.palette";
  5808. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_POINT_ALT_PALETTE = "point.alt.palette";
  5809. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_POINT_TRANSPARENCY = "point.transparency";
  5810. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_POINT_MAPDATA = "point.mapData";
  5811. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_POINT_MINSIZE = "point.minSize";
  5812. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_POINT_MAXSIZE = "point.maxSize";
  5813. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_POINT_DEFAULTSIZE = "point.defaultSize";
  5814. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_POINT_STATICZEROVALUESIZE = "point.staticZeroValueSize";
  5815. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_POINT_CUSTOM_MAPID = "point.custom.mapId";
  5816. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_POINT_CUSTOM_LAYERNAME = "point.custom.layerName";
  5817. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_POINT_CUSTOM_PROPERTYNAME = "point.custom.propertyName";
  5818. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_LEGEND_SIZE_TITLE = "legend.pointsize.title";
  5819. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_PROP_LEGEND_COLOR_TITLE = "legend.pointcolor.title";
  5820. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_LEGEND_POINTSIZE = "pointSize";
  5821. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_LEGEND_POINTCOLOR = "pointColor";
  5822. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_SELECTOR_POINTSIZE_LEGEND = "sizeLegend";
  5823. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.NORM_SELECTOR_POINTCOLOR_LEGEND = "colorLegend";
  5824. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.TYPE_REGION = "region";
  5825. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.TYPE_POINT = "point";
  5826. com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.LEGEND_POINTSIZE = 0;
  5827. com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.LEGEND_POINTCOLOR = 1;
  5828. com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.LEGEND_LATLONG_POINTSIZE = 2;
  5829. com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.LEGEND_LATLONG_POINTCOLOR = 3;
  5830. com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.LEGEND_REGIONCOLOR = 4;
  5831. //com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.ELEMENT_SHAPE_SELECTOR = "." + "element-shape";
  5832. com_ibm_rave_bundles_tiledmapV2Bundle_TiledmapV2View.BASE_BOUNDS = [[-180, -85.05112], [180, 85.05112]];
  5833. // $source: com/ibm/rave/bundles/components/BackgroundComponentImpl
  5834. /************************************************************************
  5835. ** IBM Confidential
  5836. **
  5837. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5838. **
  5839. ** (C) Copyright IBM Corp. 2017
  5840. **
  5841. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5842. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5843. ************************************************************************/
  5844. // GENERATED
  5845. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5846. //@import com/ibm/rave/bundles/component/BackgroundComponent (runtime) // BackgroundComponent
  5847. /**
  5848. * <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>
  5849. */
  5850. var com_ibm_rave_bundles_components_BackgroundComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5851. //_backgroundColor : null,
  5852. //_rect : null,
  5853. /** @expose */
  5854. constructor : function() {
  5855. this._rect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5856. },
  5857. /** @expose */
  5858. execute : function(g) {
  5859. this.preExecute();
  5860. g.style("fill", this._backgroundColor != null ? this._backgroundColor : "#FFFFFF").style("fill-opacity", 1.0);
  5861. g.attr("x", this._rect.x).attr("y", this._rect.y).attr("width", this._rect.width).attr("height", this._rect.height);
  5862. },
  5863. /** @expose */
  5864. type : function() {
  5865. return com_ibm_rave_bundles_component_BackgroundComponent.COMPONENT_TYPE;
  5866. },
  5867. backgroundColor$0 : function() {
  5868. return this._backgroundColor;
  5869. },
  5870. backgroundColor$1 : function(backgroundColor) {
  5871. this._backgroundColor = backgroundColor;
  5872. return this;
  5873. },
  5874. /**
  5875. * @param (rave['library']['internal']['ContextSize']) size New value of size property
  5876. * @return (com.ibm.rave.bundles.components.BackgroundComponentImpl) This component
  5877. */
  5878. /** @expose */
  5879. size : function(size) {
  5880. this._rect.x = 0;
  5881. this._rect.y = 0;
  5882. this._rect.width = size.w;
  5883. this._rect.height = size.h;
  5884. return this;
  5885. },
  5886. /** @expose */
  5887. rect : function(rect) {
  5888. var r = new rave['internal']['RectStruct'](rect.x, rect.y, rect.width, rect.height);
  5889. this._rect = r;
  5890. return this;
  5891. },
  5892. /** @expose */
  5893. backgroundColor : function(a0) {
  5894. var args = arguments;
  5895. if (args.length == 0) {
  5896. return this.backgroundColor$0();
  5897. }
  5898. return this.backgroundColor$1(a0);
  5899. }
  5900. });
  5901. // $source: com/ibm/rave/bundles/components/ChartLayoutComponentImpl
  5902. /************************************************************************
  5903. ** IBM Confidential
  5904. **
  5905. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5906. **
  5907. ** (C) Copyright IBM Corp. 2017
  5908. **
  5909. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5910. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5911. ************************************************************************/
  5912. // GENERATED
  5913. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5914. //@import com/ibm/rave/bundles/component/ChartLayoutComponent (runtime) // ChartLayoutComponent
  5915. /**
  5916. * <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>
  5917. */
  5918. var com_ibm_rave_bundles_components_ChartLayoutComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5919. //_padding : null,
  5920. //_legendChartGap : null,
  5921. //_topChartPadding : null,
  5922. //_leftChartPadding : null,
  5923. //_bottomChartPadding : null,
  5924. //_rightChartPadding : null,
  5925. //_legendPosition : null,
  5926. //_legendSizable : null,
  5927. //_axisSizables : null,
  5928. //_overallRect : null,
  5929. //_legendRect : null,
  5930. //_chartRect : null,
  5931. //_topRect : null,
  5932. //_leftRect : null,
  5933. //_bottomRect : null,
  5934. //_rightRect : null,
  5935. //_elementRect : null,
  5936. _leftPadding : 0, _topPadding : 0, _rightPadding : 0, _bottomPadding : 0,
  5937. _legendChartAlign : false,
  5938. _preLegendAtMax : false,
  5939. _preAxesAtZero : false,
  5940. constructor : function() {
  5941. this._axisSizables = [];
  5942. /**
  5943. * Construct. All padding is 0, legendPosition is "right", all slices have a size of 0 (value of null).
  5944. */
  5945. {
  5946. this._padding = 0.0;
  5947. this._topPadding = 0;
  5948. this._leftPadding = 0;
  5949. this._bottomPadding = 0;
  5950. this._rightPadding = 0;
  5951. this._topChartPadding = 0.0;
  5952. this._leftChartPadding = 0.0;
  5953. this._bottomChartPadding = 0.0;
  5954. this._rightChartPadding = 0.0;
  5955. this._legendChartGap = 0.0;
  5956. this._legendPosition = "right";
  5957. this._overallRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5958. this._legendRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5959. this._chartRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5960. this._topRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5961. this._leftRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5962. this._bottomRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5963. this._rightRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5964. this._elementRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5965. this._legendChartAlign = true;
  5966. }
  5967. },
  5968. /** @expose */
  5969. execute : function(g) {
  5970. this.layout();
  5971. },
  5972. /**
  5973. * Calculates rectangles during preliminary layout
  5974. * @param (boolean) legendAtMax true if legend is given max size; false if legend is asked for its preferred size
  5975. * @param (boolean) axesAtZero true if axes are given a size of 0; false if axes are asked for their preferred size
  5976. */
  5977. /** @expose */
  5978. preLayout : function(legendAtMax, axesAtZero) {
  5979. this._preLegendAtMax = legendAtMax;
  5980. this._preAxesAtZero = axesAtZero;
  5981. this.layout();
  5982. this._preLegendAtMax = false;
  5983. this._preAxesAtZero = false;
  5984. },
  5985. /**
  5986. * Calls preExecute, then does the layout with the property values, updating the chart, legend, axis, and elements rectangles.
  5987. */
  5988. /** @expose */
  5989. layout : function() {
  5990. this.preExecute();
  5991. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._chartRect, this._overallRect);
  5992. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._legendRect, this._overallRect);
  5993. var x = this._overallRect.x;
  5994. var y = this._overallRect.y;
  5995. var w = this._overallRect.width;
  5996. var h = this._overallRect.height;
  5997. var maxWH = Math.max(w, h);
  5998. var tbLegend = "top" == this._legendPosition || "bottom" == this._legendPosition;
  5999. var legendPercent = this._axisSizables.length == 0 ? 0.5 : 0.3;
  6000. var legendMaxSize = (tbLegend ? this._legendRect.height : this._legendRect.width) * legendPercent;
  6001. var legendDynamicSize = this._legendSizable ? (this._preLegendAtMax ? maxWH : this._legendSizable.getPreferredSize()) : 0;
  6002. if (legendDynamicSize > legendMaxSize) {
  6003. legendDynamicSize = legendMaxSize;
  6004. }
  6005. var isLegendTop = false;
  6006. var isLegendBottom = false;
  6007. var isLegendLeft = false;
  6008. var isLegendRight = false;
  6009. if ("top" == this._legendPosition) {
  6010. this._legendRect.height = legendDynamicSize;
  6011. this._chartRect.height -= this._legendRect.height;
  6012. this._chartRect.y += this._legendRect.height;
  6013. isLegendTop = true;
  6014. } else if ("bottom" == this._legendPosition) {
  6015. this._legendRect.height = legendDynamicSize;
  6016. this._chartRect.height -= this._legendRect.height;
  6017. this._legendRect.y = y + h - this._legendRect.height;
  6018. isLegendBottom = true;
  6019. } else if ("left" == this._legendPosition) {
  6020. this._legendRect.width = legendDynamicSize;
  6021. this._chartRect.width -= this._legendRect.width;
  6022. this._chartRect.x += this._legendRect.width;
  6023. isLegendLeft = true;
  6024. } else {
  6025. this._legendRect.width = legendDynamicSize;
  6026. this._chartRect.width -= this._legendRect.width;
  6027. this._legendRect.x = x + w - this._legendRect.width;
  6028. isLegendRight = true;
  6029. }
  6030. if (this.evaluatePadding(this._padding, w, h)) {
  6031. var lrgap = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._legendChartGap, w);
  6032. var tbgap = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._legendChartGap, h);
  6033. var chartTop = isLegendTop && this._legendSizable ? tbgap : this._topPadding;
  6034. var chartLeft = isLegendLeft && this._legendSizable ? lrgap : this._leftPadding;
  6035. var chartBottom = isLegendBottom && this._legendSizable ? tbgap : this._bottomPadding;
  6036. var chartRight = isLegendRight && this._legendSizable ? lrgap : this._rightPadding;
  6037. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset(this._chartRect, chartTop, chartLeft, chartBottom, chartRight);
  6038. } else {
  6039. var lrpadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._padding, w);
  6040. var tbpadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._padding, h);
  6041. var chartTop = tbpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._topChartPadding, h);
  6042. var chartLeft = lrpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._leftChartPadding, w);
  6043. var chartBottom = tbpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._bottomChartPadding, h);
  6044. var chartRight = lrpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._rightChartPadding, w);
  6045. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset(this._chartRect, chartTop, chartLeft, chartBottom, chartRight);
  6046. this._topPadding = tbpadding;
  6047. this._leftPadding = lrpadding;
  6048. this._bottomPadding = tbpadding;
  6049. this._rightPadding = lrpadding;
  6050. }
  6051. if (this._legendSizable) {
  6052. if (isLegendRight) {
  6053. this._legendRect.x -= this._rightPadding;
  6054. this._chartRect.width -= this._rightPadding;
  6055. this._legendRect.y += this._topPadding;
  6056. this._legendRect.height -= (this._topPadding + this._bottomPadding);
  6057. } else if (isLegendLeft) {
  6058. this._legendRect.x += this._leftPadding;
  6059. this._chartRect.x += this._leftPadding;
  6060. this._chartRect.width -= this._leftPadding;
  6061. this._legendRect.y += this._topPadding;
  6062. this._legendRect.height -= (this._topPadding + this._bottomPadding);
  6063. } else if (isLegendTop) {
  6064. this._legendRect.y += this._topPadding;
  6065. this._chartRect.y += this._topPadding;
  6066. this._chartRect.height -= this._topPadding;
  6067. this._legendRect.x += this._leftPadding;
  6068. this._legendRect.width -= (this._leftPadding + this._rightPadding);
  6069. } else {
  6070. this._legendRect.y -= this._bottomPadding;
  6071. this._chartRect.height -= this._bottomPadding;
  6072. this._legendRect.x += this._leftPadding;
  6073. this._legendRect.width -= (this._leftPadding + this._rightPadding);
  6074. }
  6075. }
  6076. x = this._chartRect.x;
  6077. y = this._chartRect.y;
  6078. w = this._chartRect.width;
  6079. h = this._chartRect.height;
  6080. var bottomH = 0;
  6081. var topH = 0;
  6082. var leftW = 0;
  6083. var rightW = 0;
  6084. var tbSO = 0;
  6085. var lrSO = 0;
  6086. if (!this._preAxesAtZero) {
  6087. var countHorz = 0;
  6088. var countVert = 0;
  6089. for (var i = 0; i < this._axisSizables.length; ++i) {
  6090. var sizable = this._axisSizables[i];
  6091. if (sizable) {
  6092. var orientation = sizable.getSizableOrientation();
  6093. if ("top" == orientation || "bottom" == orientation) {
  6094. countHorz++;
  6095. } else {
  6096. countVert++;
  6097. }
  6098. }
  6099. }
  6100. for (var i = 0; i < this._axisSizables.length; ++i) {
  6101. var sizable = this._axisSizables[i];
  6102. if (sizable) {
  6103. var orientation = sizable.getSizableOrientation();
  6104. var tbAxis = "top" == orientation || "bottom" == orientation;
  6105. var axisDynamicSize = sizable.getPreferredSize();
  6106. var spillOver = sizable.getSpillOverSize();
  6107. if (tbAxis) {
  6108. var axisPercent = countHorz > 1 ? 0.4 : 0.5;
  6109. if (axisDynamicSize > this._chartRect.height * axisPercent) {
  6110. axisDynamicSize = this._chartRect.height * axisPercent;
  6111. }
  6112. if ("top" == orientation) {
  6113. topH = axisDynamicSize;
  6114. } else {
  6115. bottomH = axisDynamicSize;
  6116. }
  6117. if (spillOver > lrSO) {
  6118. lrSO = spillOver;
  6119. }
  6120. } else {
  6121. var axisPercent = countVert > 1 ? 0.4 : 0.5;
  6122. if (axisDynamicSize > this._chartRect.width * axisPercent) {
  6123. axisDynamicSize = this._chartRect.width * axisPercent;
  6124. }
  6125. if ("left" == orientation) {
  6126. leftW = axisDynamicSize;
  6127. } else {
  6128. rightW = axisDynamicSize;
  6129. }
  6130. if (spillOver > tbSO) {
  6131. tbSO = spillOver;
  6132. }
  6133. }
  6134. }
  6135. }
  6136. }
  6137. if (lrSO > leftW) {
  6138. leftW = lrSO;
  6139. }
  6140. if (lrSO > rightW) {
  6141. rightW = lrSO;
  6142. }
  6143. if (tbSO > topH) {
  6144. topH = tbSO;
  6145. }
  6146. if (tbSO > bottomH) {
  6147. bottomH = tbSO;
  6148. }
  6149. this._leftRect.x = x;
  6150. this._leftRect.width = leftW;
  6151. this._leftRect.y = y;
  6152. this._leftRect.height = h;
  6153. this._rightRect.x = x + w - rightW;
  6154. this._rightRect.width = rightW;
  6155. this._rightRect.y = y;
  6156. this._rightRect.height = h;
  6157. this._topRect.y = y;
  6158. this._topRect.height = topH;
  6159. this._topRect.x = x;
  6160. this._topRect.width = w;
  6161. this._bottomRect.y = y + h - bottomH;
  6162. this._bottomRect.height = bottomH;
  6163. this._bottomRect.x = x;
  6164. this._bottomRect.width = w;
  6165. this._elementRect.x = x + leftW;
  6166. this._elementRect.y = y + topH;
  6167. this._elementRect.width = w - (leftW + rightW);
  6168. this._elementRect.height = h - (topH + bottomH);
  6169. if (this._legendSizable && this._legendChartAlign) {
  6170. if (tbLegend) {
  6171. this._legendRect.x = this._elementRect.x;
  6172. this._legendRect.width = this._elementRect.width;
  6173. } else {
  6174. this._legendRect.y = this._elementRect.y;
  6175. this._legendRect.height = this._elementRect.height;
  6176. }
  6177. }
  6178. },
  6179. evaluatePadding : function(padding, horizontalExtent, verticalExtent) {
  6180. if (padding == null) {
  6181. return false;
  6182. }
  6183. var paddingString = (padding) + "";
  6184. if (paddingString.length == 0) {
  6185. return false;
  6186. }
  6187. this._topPadding = 0;
  6188. this._leftPadding = 0;
  6189. this._bottomPadding = 0;
  6190. this._rightPadding = 0;
  6191. var items = paddingString.split(new RegExp(";"));
  6192. for (var __i_enFor0 = 0, __len_enFor0 = items.length;
  6193. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  6194. var item = items[__i_enFor0];
  6195. var parts = item.split(new RegExp(":"));
  6196. if (items.length == 1 && parts.length != 2) {
  6197. return false;
  6198. }
  6199. if (parts.length == 2) {
  6200. if (0 <= parts[0].indexOf("top")) {
  6201. this._topPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], verticalExtent);
  6202. } else if (0 <= parts[0].indexOf("left")) {
  6203. this._leftPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], horizontalExtent);
  6204. } else if (0 <= parts[0].indexOf("bottom")) {
  6205. this._bottomPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], verticalExtent);
  6206. } else if (0 <= parts[0].indexOf("right")) {
  6207. this._rightPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], horizontalExtent);
  6208. }
  6209. }
  6210. }
  6211. return true;
  6212. },
  6213. /**
  6214. * @return (rave['internal']['RectStruct']) Legend rectangle
  6215. */
  6216. /** @expose */
  6217. legendRect : function() {
  6218. return this._legendRect;
  6219. },
  6220. /**
  6221. * @return (rave['internal']['RectStruct']) Chart (elements plus axes) rectangle
  6222. */
  6223. /** @expose */
  6224. chartRect : function() {
  6225. return this._chartRect;
  6226. },
  6227. /**
  6228. * @return (rave['internal']['RectStruct']) Top axis rectangle
  6229. */
  6230. /** @expose */
  6231. topRect : function() {
  6232. return this._topRect;
  6233. },
  6234. /**
  6235. * @return (rave['internal']['RectStruct']) Left axis rectangle
  6236. */
  6237. /** @expose */
  6238. leftRect : function() {
  6239. return this._leftRect;
  6240. },
  6241. /**
  6242. * @return (rave['internal']['RectStruct']) Bottom axis rectangle
  6243. */
  6244. /** @expose */
  6245. bottomRect : function() {
  6246. return this._bottomRect;
  6247. },
  6248. /**
  6249. * @return (rave['internal']['RectStruct']) Right axis rectangle
  6250. */
  6251. /** @expose */
  6252. rightRect : function() {
  6253. return this._rightRect;
  6254. },
  6255. /**
  6256. * @return (rave['internal']['RectStruct']) Legend rectangle
  6257. */
  6258. /** @expose */
  6259. elementRect : function() {
  6260. return this._elementRect;
  6261. },
  6262. /**
  6263. * Set the overall rectangle. This should be called before doing the layout.
  6264. * @param (rave['internal']['RectStruct']) overall The overall rectangle
  6265. */
  6266. /** @expose */
  6267. overall : function(overall) {
  6268. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._overallRect, overall);
  6269. return this;
  6270. },
  6271. padding$0 : function() {
  6272. return this._padding;
  6273. },
  6274. legendChartAlign$0 : function() {
  6275. return this._legendChartAlign;
  6276. },
  6277. legendChartGap$0 : function() {
  6278. return this._legendChartGap;
  6279. },
  6280. topPadding$0 : function() {
  6281. return this._topChartPadding;
  6282. },
  6283. leftPadding$0 : function() {
  6284. return this._leftChartPadding;
  6285. },
  6286. bottomPadding$0 : function() {
  6287. return this._bottomChartPadding;
  6288. },
  6289. rightPadding$0 : function() {
  6290. return this._rightChartPadding;
  6291. },
  6292. legendPosition$0 : function() {
  6293. return this._legendPosition;
  6294. },
  6295. topPadding$1 : function(padding) {
  6296. this._topChartPadding = padding;
  6297. return this;
  6298. },
  6299. leftPadding$1 : function(padding) {
  6300. this._leftChartPadding = padding;
  6301. return this;
  6302. },
  6303. bottomPadding$1 : function(padding) {
  6304. this._bottomChartPadding = padding;
  6305. return this;
  6306. },
  6307. rightPadding$1 : function(padding) {
  6308. this._rightChartPadding = padding;
  6309. return this;
  6310. },
  6311. /** @expose */
  6312. type : function() {
  6313. return com_ibm_rave_bundles_component_ChartLayoutComponent.COMPONENT_TYPE;
  6314. },
  6315. padding$1 : function(value) {
  6316. this._padding = value;
  6317. return this;
  6318. },
  6319. /** @expose */
  6320. chartPadding : function(top, left, bottom, right) {
  6321. this._topChartPadding = top;
  6322. this._leftChartPadding = left;
  6323. this._bottomChartPadding = bottom;
  6324. this._rightChartPadding = right;
  6325. return this;
  6326. },
  6327. legendChartAlign$1 : function(legendChartAlign) {
  6328. this._legendChartAlign = legendChartAlign;
  6329. return this;
  6330. },
  6331. legendChartGap$1 : function(value) {
  6332. this._legendChartGap = value;
  6333. return this;
  6334. },
  6335. legendPosition$1 : function(position) {
  6336. if ("top" == position || "bottom" == position || "left" == position || "right" == position) {
  6337. this._legendPosition = position;
  6338. }
  6339. return this;
  6340. },
  6341. /** @expose */
  6342. legendSize : function(sizable) {
  6343. this._legendSizable = sizable;
  6344. return this;
  6345. },
  6346. /** @expose */
  6347. removeAxisSizables : function() {
  6348. this._axisSizables.length = 0;
  6349. return this;
  6350. },
  6351. /** @expose */
  6352. addAxisSizable : function(sizable) {
  6353. this._axisSizables.push(sizable);
  6354. return this;
  6355. },
  6356. /** @expose */
  6357. padding : function(a0) {
  6358. var args = arguments;
  6359. if (args.length == 0) {
  6360. return this.padding$0();
  6361. }
  6362. return this.padding$1(a0);
  6363. },
  6364. /** @expose */
  6365. legendChartAlign : function(a0) {
  6366. var args = arguments;
  6367. if (args.length == 0) {
  6368. return this.legendChartAlign$0();
  6369. }
  6370. return this.legendChartAlign$1(a0);
  6371. },
  6372. /** @expose */
  6373. legendChartGap : function(a0) {
  6374. var args = arguments;
  6375. if (args.length == 0) {
  6376. return this.legendChartGap$0();
  6377. }
  6378. return this.legendChartGap$1(a0);
  6379. },
  6380. /** @expose */
  6381. topPadding : function(a0) {
  6382. var args = arguments;
  6383. if (args.length == 0) {
  6384. return this.topPadding$0();
  6385. }
  6386. return this.topPadding$1(a0);
  6387. },
  6388. /** @expose */
  6389. leftPadding : function(a0) {
  6390. var args = arguments;
  6391. if (args.length == 0) {
  6392. return this.leftPadding$0();
  6393. }
  6394. return this.leftPadding$1(a0);
  6395. },
  6396. /** @expose */
  6397. bottomPadding : function(a0) {
  6398. var args = arguments;
  6399. if (args.length == 0) {
  6400. return this.bottomPadding$0();
  6401. }
  6402. return this.bottomPadding$1(a0);
  6403. },
  6404. /** @expose */
  6405. rightPadding : function(a0) {
  6406. var args = arguments;
  6407. if (args.length == 0) {
  6408. return this.rightPadding$0();
  6409. }
  6410. return this.rightPadding$1(a0);
  6411. },
  6412. /** @expose */
  6413. legendPosition : function(a0) {
  6414. var args = arguments;
  6415. if (args.length == 0) {
  6416. return this.legendPosition$0();
  6417. }
  6418. return this.legendPosition$1(a0);
  6419. }
  6420. });
  6421. /**
  6422. * Set preferred rectangle to the same position and size as the source rectangle.
  6423. * @param (rave['internal']['RectStruct']) t preferred rectangle
  6424. * @param (rave['internal']['RectStruct']) s Source rectangle
  6425. * @return (rave['internal']['RectStruct']) preferred rectangle
  6426. */
  6427. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect = function(t, s) {
  6428. t.x = s.x;
  6429. t.y = s.y;
  6430. t.width = s.width;
  6431. t.height = s.height;
  6432. return t;
  6433. };
  6434. /**
  6435. * 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.
  6436. * @param (rave['internal']['RectStruct']) r Rectangle
  6437. * @param (double) top Top inset in pixels
  6438. * @param (double) left Left inset in pixels
  6439. * @param (double) bottom Bottom inset in pixels
  6440. * @param (double) right Right inset in pixels
  6441. * @return (rave['internal']['RectStruct']) The rectangle
  6442. */
  6443. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset = function(r, top, left, bottom, right) {
  6444. var ileft = Math.max(0.0, left);
  6445. var iright = Math.max(0.0, right);
  6446. if (ileft + iright <= r.width) {
  6447. r.x += ileft;
  6448. r.width -= ileft + iright;
  6449. }
  6450. var itop = Math.max(0.0, top);
  6451. var ibottom = Math.max(0.0, bottom);
  6452. if (itop + ibottom <= r.height) {
  6453. r.y += itop;
  6454. r.height -= itop + ibottom;
  6455. }
  6456. return r;
  6457. };
  6458. /**
  6459. * 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.
  6460. * @param (Object) value The size
  6461. * @param (double) extent The extent in the dimension
  6462. * @param defValue The default to use if not parsable
  6463. * @return (double) Size in pixels
  6464. */
  6465. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize = function(value, extent) {
  6466. var v = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(value, extent, 10.0);
  6467. var d = v != null ? v : 0;
  6468. return Math.max(0.0, Math.min(d, extent));
  6469. };
  6470. /** @expose */
  6471. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_AXIS_PERCENT = 0.4;
  6472. /** @expose */
  6473. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_AXIS_PERCENT_SINGLE_PER_ORIENTATION = 0.5;
  6474. /** @expose */
  6475. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_LEGEND_PERCENT = 0.3;
  6476. /** @expose */
  6477. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_LEGEND_PERCENT_NO_AXIS = 0.5;
  6478. // $source: com/ibm/rave/bundles/components/ClipPathComponentImpl
  6479. /************************************************************************
  6480. ** IBM Confidential
  6481. **
  6482. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6483. **
  6484. ** (C) Copyright IBM Corp. 2017
  6485. **
  6486. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6487. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6488. ************************************************************************/
  6489. // GENERATED
  6490. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  6491. /**
  6492. * 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>
  6493. */
  6494. var com_ibm_rave_bundles_components_ClipPathComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  6495. //_id : null,
  6496. //_clipRect : null,
  6497. constructor : function(id) {
  6498. this._clipRect = new rave['internal']['RectStruct'](0, 0, 100, 100);
  6499. /**
  6500. * 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.
  6501. * @param (String) id String ID that is unique <em>across the document</em>.
  6502. */
  6503. {
  6504. this._id = id;
  6505. }
  6506. },
  6507. /** @expose */
  6508. type : function() {
  6509. return "ClipPathComponent";
  6510. },
  6511. /**
  6512. * Set the rectangular clipping area. Make the _clipRect one pixel larger than requested to avoid the cut-off at bounds. TODO: why?!?
  6513. * @param (rave['internal']['RectStruct']) rect The rectangular bounds of the clipping area.
  6514. * @return (com.ibm.rave.bundles.components.ClipPathComponentImpl) This ClipPathComponent.
  6515. */
  6516. /** @expose */
  6517. clipRect : function(rect) {
  6518. this._clipRect = new rave['internal']['RectStruct'](rect.x - 1, rect.y - 1, rect.width + 2, rect.height + 2);
  6519. return this;
  6520. },
  6521. /**
  6522. * Set the clip-path attribute on the provided selection.
  6523. * @return (com.ibm.rave.bundles.components.ClipPathComponentImpl) This ClipPathComponent.
  6524. */
  6525. /** @expose */
  6526. applyTo : function(s) {
  6527. s.attr("clip-path", "url(" + this.url() + ")");
  6528. return this;
  6529. },
  6530. /**
  6531. * Retrieve the id assigned to this clip path.
  6532. */
  6533. /** @expose */
  6534. id : function() {
  6535. return this._id;
  6536. },
  6537. /**
  6538. * Retrieve the URL that can be used to reference this clip path.
  6539. */
  6540. /** @expose */
  6541. url : function() {
  6542. return "#" + this._id;
  6543. },
  6544. /** @expose */
  6545. execute : function(g) {
  6546. var clipPath = g.selectAll("#" + this._id).data([0]);
  6547. clipPath.enter().append("clipPath").attr("id", this._id).append("rect");
  6548. 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);
  6549. }
  6550. });
  6551. // $source: com/ibm/rave/bundles/components/LegendComponentImpl
  6552. /************************************************************************
  6553. ** IBM Confidential
  6554. **
  6555. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6556. **
  6557. ** (C) Copyright IBM Corp. 2017
  6558. **
  6559. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6560. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6561. ************************************************************************/
  6562. // GENERATED
  6563. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  6564. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  6565. /**
  6566. * <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>
  6567. */
  6568. var com_ibm_rave_bundles_components_LegendComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  6569. /**
  6570. * Legend size property
  6571. */
  6572. //_size : null,
  6573. /**
  6574. * Color scale
  6575. */
  6576. //_colorPalette : null,
  6577. /**
  6578. * Orient, "horizontal" or "vertical"
  6579. */
  6580. //_orient : null,
  6581. /**
  6582. * Swatch size function
  6583. */
  6584. //_swatchSizeFunc : null,
  6585. /**
  6586. * Scale
  6587. */
  6588. //_scale : null,
  6589. /**
  6590. * Swatch symbol
  6591. */
  6592. //_shape : null,
  6593. /**
  6594. * Legend title
  6595. */
  6596. //_title : null,
  6597. /**
  6598. * Legend title styling
  6599. */
  6600. //_titleStyle : null,
  6601. /**
  6602. * Legend entry styling
  6603. */
  6604. //_entryStyle : null,
  6605. /**
  6606. * Custom formatter
  6607. */
  6608. //_labelFormat : null,
  6609. /**
  6610. * The swatch legend, created on demand
  6611. */
  6612. //_swatchLegend : null,
  6613. /**
  6614. * The continuous legend, created on demand
  6615. */
  6616. //_continuousLegend : null,
  6617. /**
  6618. * The legend type, either "SwatchLegend" or "ContinuousLegend"
  6619. */
  6620. //_legendType : null,
  6621. /**
  6622. * Is the legend visible
  6623. */
  6624. _visible : false,
  6625. /**
  6626. * Swatch size in square pixels
  6627. */
  6628. _swatchSize : 0,
  6629. /**
  6630. * Constructor; sets bound and, colorScale to null, all other properties to their default values.
  6631. */
  6632. /** @expose */
  6633. constructor : function() {
  6634. this._visible = true;
  6635. this._size = null;
  6636. this._colorPalette = null;
  6637. this._orient = "horizontal";
  6638. this._swatchSize = 16.0 * 16.0;
  6639. this._swatchSizeFunc = null;
  6640. this._scale = null;
  6641. this._shape = "square";
  6642. this._title = null;
  6643. this._titleStyle = {};
  6644. this._entryStyle = {};
  6645. this._labelFormat = null;
  6646. this._swatchLegend = null;
  6647. this._continuousLegend = null;
  6648. this._legendType = null;
  6649. },
  6650. /** @expose */
  6651. type : function() {
  6652. return "LegendComponent";
  6653. },
  6654. /** @expose */
  6655. execute : function(g) {
  6656. if (this._colorPalette) {
  6657. if ("continuous" == this._colorPalette.getType()) {
  6658. if (!this._continuousLegend) {
  6659. this._continuousLegend = (rave.capabilities.extension("legend")).continuous();
  6660. }
  6661. this._legendType = "ContinuousLegend";
  6662. } else {
  6663. if (!this._swatchLegend) {
  6664. this._swatchLegend = (rave.capabilities.extension("legend")).swatch();
  6665. }
  6666. this._legendType = "SwatchLegend";
  6667. }
  6668. } else if (this._swatchSizeFunc) {
  6669. if (!this._swatchLegend) {
  6670. this._swatchLegend = (rave.capabilities.extension("legend")).swatch();
  6671. }
  6672. this._legendType = "SwatchLegend";
  6673. } else {
  6674. this._legendType = null;
  6675. }
  6676. this.preExecute();
  6677. if (!this._visible || (!this._colorPalette && !this._swatchSizeFunc) || !this._size || this._size[0] <= 0 || this._size[1] <= 0) {
  6678. g.selectAll("*").remove();
  6679. return;
  6680. }
  6681. var fontChecker = rave.capabilities.extension("fontchecker");
  6682. if (this._colorPalette && "continuous" == this._colorPalette.getType()) {
  6683. 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);
  6684. var legend = g.call(this._continuousLegend);
  6685. if (this._entryStyle) {
  6686. legend.selectAll(".legendLabel").style(this._entryStyle);
  6687. }
  6688. if (this._titleStyle) {
  6689. legend.selectAll(".legendTitle").style(this._titleStyle);
  6690. }
  6691. if (fontChecker) {
  6692. legend.selectAll(".legendLabel").call(fontChecker);
  6693. legend.selectAll(".legendTitle").call(fontChecker);
  6694. }
  6695. } else {
  6696. var insets = {};
  6697. insets["bottom"] = 5;
  6698. var swatchSize = this._swatchSize;
  6699. var scale = null;
  6700. var labelFormatter = this._labelFormat;
  6701. if (this._swatchSizeFunc && this._scale) {
  6702. swatchSize = this._swatchSizeFunc;
  6703. scale = this._scale;
  6704. }
  6705. if (this._colorPalette) {
  6706. scale = this._colorPalette.getScale();
  6707. var originalDomain = this._colorPalette.originalDomain();
  6708. if (originalDomain) {
  6709. scale.domain(originalDomain);
  6710. var f = this._colorPalette.originalDomainLabelAccessor();
  6711. if (this._labelFormat) {
  6712. var self = this;
  6713. labelFormatter = function(data, index, groupIndex) {
  6714. return self._labelFormat.call(this, f.call(this, data, index, groupIndex), index, groupIndex);
  6715. };
  6716. } else {
  6717. labelFormatter = f;
  6718. }
  6719. }
  6720. }
  6721. 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);
  6722. var legend = g.call(this._swatchLegend);
  6723. if (this._entryStyle) {
  6724. legend.selectAll(".legendLabel").style(this._entryStyle);
  6725. }
  6726. if (this._titleStyle) {
  6727. legend.selectAll(".legendTitle").style(this._titleStyle);
  6728. }
  6729. if (fontChecker) {
  6730. legend.selectAll(".legendLabel").call(fontChecker);
  6731. legend.selectAll(".legendTitle").call(fontChecker);
  6732. }
  6733. }
  6734. },
  6735. /** @expose */
  6736. legend : function() {
  6737. if ("ContinuousLegend" == this._legendType) {
  6738. return this._continuousLegend;
  6739. }
  6740. if ("SwatchLegend" == this._legendType) {
  6741. return this._swatchLegend;
  6742. }
  6743. return null;
  6744. },
  6745. /** @expose */
  6746. legendType : function() {
  6747. return this._legendType;
  6748. },
  6749. /**
  6750. * Set the visible property.
  6751. * @param (boolean) visible New visible
  6752. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  6753. */
  6754. /** @expose */
  6755. visible : function(visible) {
  6756. this._visible = visible;
  6757. return this;
  6758. },
  6759. /**
  6760. * see if the legend is visible
  6761. * @return (boolean) if its visible
  6762. */
  6763. /** @expose */
  6764. isVisible : function() {
  6765. return this._visible;
  6766. },
  6767. /**
  6768. * Set the size property.
  6769. * @param (Array) size New size
  6770. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  6771. */
  6772. /** @expose */
  6773. size : function(size) {
  6774. this._size = size;
  6775. return this;
  6776. },
  6777. /**
  6778. * Set the color scale property.
  6779. * @param (rave['library']['internal']['Palette']) colorPalette New color scale
  6780. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  6781. */
  6782. /** @expose */
  6783. colorPalette : function(colorPalette) {
  6784. this._colorPalette = colorPalette;
  6785. return this;
  6786. },
  6787. /**
  6788. * Set the orient property. If the argument is not "horizontal" or "vertical", it is ignored and the orient property is not changed.
  6789. * @param (String) orient New orient
  6790. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  6791. */
  6792. /** @expose */
  6793. orient : function(orient) {
  6794. if ("horizontal" == orient || "vertical" == orient) {
  6795. this._orient = orient;
  6796. }
  6797. return this;
  6798. },
  6799. /**
  6800. * 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".
  6801. * @param (String) position Legend position
  6802. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  6803. */
  6804. /** @expose */
  6805. position : function(position) {
  6806. return this.orient(com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf(position));
  6807. },
  6808. swatchSize$0 : function(swatchSize) {
  6809. if (swatchSize >= 0.0 && swatchSize != null) {
  6810. this._swatchSize = swatchSize;
  6811. }
  6812. return this;
  6813. },
  6814. /** @expose */
  6815. scale : function(scale) {
  6816. this._scale = scale;
  6817. return this;
  6818. },
  6819. swatchSize$1 : function(swatchSize) {
  6820. if (swatchSize) {
  6821. this._swatchSizeFunc = swatchSize;
  6822. }
  6823. return this;
  6824. },
  6825. /** @expose */
  6826. shape : function(shape) {
  6827. this._shape = shape;
  6828. return this;
  6829. },
  6830. /** @expose */
  6831. title : function(title) {
  6832. this._title = (title != null && title.length > 0) ? title : null;
  6833. return this;
  6834. },
  6835. /** @expose */
  6836. titleFill : function(titleFill) {
  6837. this._titleStyle["fill"] = titleFill;
  6838. return this;
  6839. },
  6840. /** @expose */
  6841. titleFontSize : function(titleFontSize) {
  6842. this._titleStyle["font-size"] = titleFontSize;
  6843. return this;
  6844. },
  6845. /** @expose */
  6846. titleFontFamily : function(titleFontFamily) {
  6847. this._titleStyle["font-family"] = titleFontFamily;
  6848. return this;
  6849. },
  6850. /** @expose */
  6851. labelFormat : function(labelFormat) {
  6852. this._labelFormat = labelFormat;
  6853. return this;
  6854. },
  6855. /** @expose */
  6856. titleFont : function(titleFontStyle) {
  6857. this._titleStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(titleFontStyle);
  6858. return this;
  6859. },
  6860. /** @expose */
  6861. entryFont : function(entryFontStyle) {
  6862. this._entryStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(entryFontStyle);
  6863. return this;
  6864. },
  6865. /** @expose */
  6866. getSpaceUsed : function() {
  6867. if (this._colorPalette && "continuous" == this._colorPalette.getType()) {
  6868. return this._continuousLegend.getUsedSize() + 2;
  6869. } else {
  6870. return this._swatchLegend.getUsedSize() + 2;
  6871. }
  6872. },
  6873. /** @expose */
  6874. swatchSize : function(a0) {
  6875. var args = arguments;
  6876. if (args.length == 1 && typeof a0 === "function") {
  6877. return this.swatchSize$1(a0);
  6878. }
  6879. return this.swatchSize$0(a0);
  6880. }
  6881. });
  6882. /**
  6883. * Get the orient for a position. "top" and "bottom" return "horizontal", anything else ("left", "right", or unknown/null) is "vertical".
  6884. * @param (String) position A position
  6885. * @return (String) "horizontal" or "vertical"
  6886. */
  6887. /** @expose */
  6888. com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf = function(position) {
  6889. if ("top" == position || "bottom" == position) {
  6890. return "horizontal";
  6891. }
  6892. return "vertical";
  6893. };
  6894. //com_ibm_rave_bundles_components_LegendComponentImpl.HORIZONTAL = "horizontal";
  6895. //com_ibm_rave_bundles_components_LegendComponentImpl.VERTICAL = "vertical";
  6896. com_ibm_rave_bundles_components_LegendComponentImpl.BAR_THINKNESS = 16;
  6897. com_ibm_rave_bundles_components_LegendComponentImpl.SWATCH_SIZE = 16;
  6898. /** @expose */
  6899. com_ibm_rave_bundles_components_LegendComponentImpl.TOP = "top";
  6900. /** @expose */
  6901. com_ibm_rave_bundles_components_LegendComponentImpl.BOTTOM = "bottom";
  6902. /** @expose */
  6903. com_ibm_rave_bundles_components_LegendComponentImpl.LEFT = "left";
  6904. /** @expose */
  6905. com_ibm_rave_bundles_components_LegendComponentImpl.RIGHT = "right";
  6906. /** @expose */
  6907. com_ibm_rave_bundles_components_LegendComponentImpl.ADJUSTABLE = -1;
  6908. // $source: com/ibm/rave/bundles/components/AxisComponentImpl
  6909. /************************************************************************
  6910. ** IBM Confidential
  6911. **
  6912. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6913. **
  6914. ** (C) Copyright IBM Corp. 2018
  6915. **
  6916. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6917. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6918. ************************************************************************/
  6919. // GENERATED
  6920. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  6921. //@import com/ibm/rave/bundles/component/AxisComponent (runtime) // AxisComponent
  6922. //@import com/ibm/rave/bundles/utilities/TextCrossfader (runtime) // textCrossFade
  6923. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  6924. //@import com/ibm/rave/bundles/utilities/BundleLabelDropper (runtime) // new
  6925. /**
  6926. * <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>
  6927. */
  6928. var com_ibm_rave_bundles_components_AxisComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  6929. /**
  6930. * Axis - created on demand
  6931. */
  6932. //_axis : null,
  6933. /**
  6934. * Role, from the AxisComponent API
  6935. */
  6936. //_role : null,
  6937. /**
  6938. * CoordinateScale
  6939. */
  6940. //_scale : null,
  6941. /**
  6942. * Orient, always one of the four legal values
  6943. */
  6944. //_orient : null,
  6945. /**
  6946. * Size
  6947. */
  6948. //_bounds : null,
  6949. //_elementRect : null,
  6950. /**
  6951. * The title text; default null (nothing visible)
  6952. */
  6953. /** @expose */
  6954. _axisTitle : null,
  6955. /**
  6956. * The title style; defaults null (use the CSS styling)
  6957. */
  6958. /** @expose */
  6959. _titleStyle : null,
  6960. /**
  6961. * Axis line color; default null (use the CSS styling)
  6962. */
  6963. /** @expose */
  6964. _lineColor : null,
  6965. /**
  6966. * Axis tick color; default null (use the CSS styling)
  6967. */
  6968. /** @expose */
  6969. _tickColor : null,
  6970. /**
  6971. * Axis tick label style; defaults null (use the CSS styling)
  6972. */
  6973. /** @expose */
  6974. _labelStyle : null,
  6975. //_staggerRotate45Nodes : null,
  6976. //_staggerFirstNode : null,
  6977. //_staggerLastNode : null,
  6978. /**
  6979. * Axis tick label formatting
  6980. */
  6981. //_tickFormat : null,
  6982. //_dropOverlap : null,
  6983. /**
  6984. * Used to get the extension to enable axis label wrapping
  6985. */
  6986. //_textFlow : null,
  6987. /**
  6988. * Used to check the fonts on each label to make sure all characters are covered
  6989. */
  6990. //_fontChecker : null,
  6991. /**
  6992. * Run function that applies the properties to the axis line
  6993. */
  6994. //_axisLineProperties : null,
  6995. /**
  6996. * Run function that applies the properties to the axis ticks
  6997. */
  6998. //_axisTickProperties : null,
  6999. /**
  7000. * Run function that applies the properties to the axis tick labels
  7001. */
  7002. //_axisTickLabelProperties : null,
  7003. /**
  7004. * Run function that hides or displays the axis tick labels
  7005. */
  7006. //_displayHideLabels : null,
  7007. /**
  7008. * Run function that hides or displays the axis tick labels
  7009. */
  7010. //_panZoomLabels : null,
  7011. /**
  7012. * The tick handler registered with the axis; will get called during axis transition
  7013. */
  7014. //_tickHandler : null,
  7015. //_textTruncationIndicator : null,
  7016. /**
  7017. * Used when dealing with numeric scale on the vertical axis and the numbers don't fit
  7018. */
  7019. //_simplifiedTickFormat : null,
  7020. //_tickMagnitude : null,
  7021. /**
  7022. * Whether to display the axis title; default true
  7023. */
  7024. /** @expose */
  7025. _displayAxisTitle : false,
  7026. /**
  7027. * Whether to display the axis line; default true
  7028. */
  7029. /** @expose */
  7030. _displayAxisLine : false,
  7031. /**
  7032. * Whether to display the axis ticks; default true
  7033. */
  7034. /** @expose */
  7035. _displayTicks : false,
  7036. /**
  7037. * Whether to display the axis tick labels (conditional on show labels property); default true
  7038. */
  7039. /** @expose */
  7040. _displayTickLabels : false,
  7041. /**
  7042. * Whether to display the axis tick labels (conditional on pan-zoom hide property); default true
  7043. */
  7044. /** @expose */
  7045. _showPanZoomTickLabels : false,
  7046. /**
  7047. * Whether to rotate the axis tick labels; default false
  7048. */
  7049. _rotateLabels : false,
  7050. _staggerCellWidth : 0,
  7051. _staggerAlignFirstAtStart : false,
  7052. _staggerAlignLastAtEnd : false,
  7053. _layoutTimerId : 0,
  7054. _layoutTitleSize : 0,
  7055. _layoutLabelSize : 0,
  7056. _layoutLabelHeight : 0,
  7057. _layoutAverageDigitWidth : 0,
  7058. _layoutSpillOver : 0,
  7059. /**
  7060. * Whether to hide overlapping labels; default true
  7061. */
  7062. /** @expose */
  7063. _hideOverlappingLabels : false,
  7064. /**
  7065. * When true, don't start a new timer
  7066. */
  7067. _pendingLabelTimer : false,
  7068. /**
  7069. * The padding in px between tick axis line and tick label, and also between tick label and title. Default 16px.
  7070. */
  7071. _padding : 0,
  7072. /**
  7073. * After calling the component, this is true if shapes were rendered, false if they were cleared.
  7074. */
  7075. _renderedShapes : false,
  7076. _layoutMode : -1,
  7077. _allowAutoAxisLayoutToChangeOrientaiton : true,
  7078. _lastAutomaticAxisLayoutOrientation : -1,
  7079. _allowStagger : false,
  7080. _allowRotate45 : false,
  7081. _allowRotate90 : false,
  7082. constructor : function() {
  7083. {
  7084. var self = this;
  7085. this._axisLineProperties = function(args) {
  7086. if (args !== null || arguments.length > 1){
  7087. args = Array.prototype.slice.call(arguments, 0);
  7088. }
  7089. {
  7090. var line = this.selectAll("path.domain");
  7091. if (self._lineColor != null) {
  7092. line.style("stroke", self._lineColor);
  7093. }
  7094. if (self._displayAxisLine) {
  7095. line.attr("visibility", null);
  7096. } else {
  7097. line.attr("visibility", "hidden");
  7098. }
  7099. return null;
  7100. }
  7101. };
  7102. this._axisTickProperties = function(args) {
  7103. if (args !== null || arguments.length > 1){
  7104. args = Array.prototype.slice.call(arguments, 0);
  7105. }
  7106. {
  7107. var tickLines = this.selectAll("line");
  7108. if (self._displayTicks) {
  7109. tickLines.attr("visibility", null);
  7110. } else {
  7111. tickLines.attr("visibility", "hidden");
  7112. }
  7113. if (self._lineColor != null) {
  7114. tickLines.style("stroke", self._tickColor);
  7115. }
  7116. return null;
  7117. }
  7118. };
  7119. this._axisTickLabelProperties = function(args) {
  7120. if (args !== null || arguments.length > 1){
  7121. args = Array.prototype.slice.call(arguments, 0);
  7122. }
  7123. {
  7124. var labels = this.selectAll("text");
  7125. labels.each(self._displayHideLabels);
  7126. labels.each(self._panZoomLabels);
  7127. labels.style(self._labelStyle);
  7128. self._axis.ticksHandler(null);
  7129. return null;
  7130. }
  7131. };
  7132. this._displayHideLabels = function(obj, group, index) {
  7133. if (self._displayTickLabels) {
  7134. if (this.rave_hasProperty("__tickLabelHidden__")) {
  7135. this.rave_removeProperty("__tickLabelHidden__");
  7136. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  7137. if (count <= 1) {
  7138. this.rave_removeProperty("__hiddenCount__");
  7139. this.removeAttribute("visibility");
  7140. } else {
  7141. this.rave_setProperty("__hiddenCount__", count - 1);
  7142. }
  7143. }
  7144. } else {
  7145. if (!(this.rave_hasProperty("__tickLabelHidden__"))) {
  7146. this.setAttribute("visibility", "hidden");
  7147. this.rave_setProperty("__tickLabelHidden__", "hidden");
  7148. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  7149. this.rave_setProperty("__hiddenCount__", count + 1);
  7150. }
  7151. }
  7152. };
  7153. this._panZoomLabels = function(obj, group, index) {
  7154. if (self._showPanZoomTickLabels) {
  7155. if (this.rave_hasProperty("__panZoomHidden__")) {
  7156. this.rave_removeProperty("__panZoomHidden__");
  7157. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  7158. if (count <= 1) {
  7159. this.rave_removeProperty("__hiddenCount__");
  7160. this.removeAttribute("visibility");
  7161. } else {
  7162. this.rave_setProperty("__hiddenCount__", count - 1);
  7163. }
  7164. }
  7165. } else {
  7166. if (!(this.rave_hasProperty("__panZoomHidden__"))) {
  7167. this.setAttribute("visibility", "hidden");
  7168. this.rave_setProperty("__panZoomHidden__", "hidden");
  7169. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  7170. this.rave_setProperty("__hiddenCount__", count + 1);
  7171. }
  7172. }
  7173. };
  7174. }
  7175. this._tickHandler = new com_ibm_rave_bundles_components_AxisComponentImpl.AxisTickHandler(this._axisTickLabelProperties, this._axisTickProperties);
  7176. /**
  7177. * Initialize properties to defaults
  7178. */
  7179. {
  7180. this._axis = null;
  7181. this._role = null;
  7182. this._scale = null;
  7183. this._orient = "bottom";
  7184. this._bounds = null;
  7185. this._displayAxisTitle = true;
  7186. this._axisTitle = null;
  7187. this._titleStyle = {};
  7188. this._displayAxisLine = true;
  7189. this._lineColor = null;
  7190. this._displayTicks = true;
  7191. this._tickColor = null;
  7192. this._displayTickLabels = true;
  7193. this._labelStyle = {};
  7194. this._rotateLabels = false;
  7195. this._hideOverlappingLabels = true;
  7196. this._dropOverlap = new com_ibm_rave_bundles_utilities_BundleLabelDropper();
  7197. this._tickFormat = null;
  7198. this._showPanZoomTickLabels = true;
  7199. this._pendingLabelTimer = false;
  7200. this._padding = 16;
  7201. this._textFlow = rave.capabilities.extension("textflow");
  7202. this._fontChecker = rave.capabilities.extension("fontchecker");
  7203. this._renderedShapes = false;
  7204. }
  7205. },
  7206. /** @expose */
  7207. type : function() {
  7208. return com_ibm_rave_bundles_component_AxisComponent.COMPONENT_TYPE;
  7209. },
  7210. /** @expose */
  7211. role : function() {
  7212. return this._role;
  7213. },
  7214. /** @expose */
  7215. execute : function(g) {
  7216. this.preExecute();
  7217. if (!this._scale) {
  7218. g.selectAll("*").remove();
  7219. this._renderedShapes = false;
  7220. return;
  7221. }
  7222. this._renderedShapes = true;
  7223. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  7224. this._hideOverlappingLabels = false;
  7225. this._rotateLabels = true;
  7226. } else {
  7227. this._hideOverlappingLabels = true;
  7228. this._rotateLabels = true;
  7229. }
  7230. this.drawTitle(g);
  7231. this.drawAxis(g);
  7232. this.handleAxisText(g);
  7233. this.drawTitle(g);
  7234. },
  7235. /**
  7236. * This is one place where all the calls that affect the axis text happen in case of allowAutomaticAxisLayout the new behavior applies here
  7237. * @param (rave['internal']['Selector']) g
  7238. */
  7239. handleAxisText : function(g) {
  7240. this.stopLabelDroppingUpdate();
  7241. var duration = 0, delay = 0;
  7242. var g2 = rave.transition(g);
  7243. if (g2.isTransition()) {
  7244. var t2 = (g2);
  7245. duration = t2.duration();
  7246. delay = t2.delay();
  7247. }
  7248. var axisSelector = g.selectAll("g.axis");
  7249. var labels = axisSelector.selectAll("g.tick").filter(rave['library']['internal']['BundleUtils'].notExit).selectAll("text");
  7250. var fontChecker = rave.capabilities.extension("fontchecker");
  7251. labels.style(this._labelStyle);
  7252. if (fontChecker) {
  7253. labels.call(fontChecker);
  7254. }
  7255. var mode = this._allowAutoAxisLayoutToChangeOrientaiton ? this.determineWhichAutoMode(g) : this._lastAutomaticAxisLayoutOrientation;
  7256. this.configureStaggerData(g, mode);
  7257. this.handleLabelsRotationAndPosition(g, labels, mode);
  7258. this.hashingNumericScales(labels, this.labelExtent(g), mode);
  7259. if (duration == 0) {
  7260. this.doLabelWrapping(g, mode);
  7261. this.handleLabelsRotationAndPosition(g, labels, mode);
  7262. }
  7263. this._lastAutomaticAxisLayoutOrientation = mode;
  7264. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  7265. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  7266. var tick = axisSelector.append("g").classed("tick", true);
  7267. var tickText = tick.append("text");
  7268. if (labels.size() == 0) {
  7269. var singleValue = this._scale.scale().domain()[0];
  7270. var formatter = this._tickFormat;
  7271. if (!formatter) {
  7272. var tickFunc = this._scale.scale().tickFormat;
  7273. if (tickFunc) {
  7274. formatter = tickFunc.apply(tickFunc, [singleValue]);
  7275. }
  7276. }
  7277. var node = tickText[0][0];
  7278. var stringValue = formatter ? formatter.call(node, singleValue, 0, 0) : ""+(singleValue);
  7279. tickText.text(stringValue);
  7280. var dim = node.getBBox();
  7281. this._layoutLabelSize = isHorizontal ? dim.height : dim.width;
  7282. if (!isHorizontal || mode != 0) {
  7283. tickText.text(".0");
  7284. this._layoutLabelSize += node.getBBox().width;
  7285. }
  7286. }
  7287. if (!isHorizontal || mode != 0) {
  7288. tickText.text(".0");
  7289. var node = tickText[0][0];
  7290. var dim = node.getBBox();
  7291. this._layoutAverageDigitWidth = dim.width;
  7292. }
  7293. tick.remove();
  7294. }
  7295. if (this._hideOverlappingLabels && duration > 0) {
  7296. this.updateLabelDropping(labels, duration, delay);
  7297. }
  7298. if (duration > 0) {
  7299. this.doLabelWrappingAfterAnimation(g, labels, mode, duration, delay);
  7300. }
  7301. if (!this._displayTickLabels) {
  7302. this._layoutLabelSize = 0;
  7303. this._layoutAverageDigitWidth = 0;
  7304. }
  7305. },
  7306. /**
  7307. * 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
  7308. * @param (rave['internal']['Selector']) g selector
  7309. * @param (rave['internal']['Selector']) labels labels selector
  7310. * @param (int) mode one of HORIZONTAL, STAGGER, ROTATE90
  7311. */
  7312. handleLabelsRotationAndPosition : function(g, labels, mode) {
  7313. if (mode == 2 || mode == 1) {
  7314. if (this._orient == "bottom") {
  7315. this.rotateLabels(g, labels, "end", mode);
  7316. } else if (this._orient == "top") {
  7317. this.rotateLabels(g, labels, "start", mode);
  7318. } else {
  7319. this.rotateLabels(g, labels, "middle", mode);
  7320. }
  7321. } else {
  7322. if (this._orient == "bottom" || this._orient == "top") {
  7323. this.rotateLabels(g, labels, "middle", mode);
  7324. } else if (this._orient == "right") {
  7325. this.rotateLabels(g, labels, "start", mode);
  7326. } else {
  7327. this.rotateLabels(g, labels, "end", mode);
  7328. }
  7329. }
  7330. },
  7331. /**
  7332. * <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>
  7333. * @param (rave['internal']['Selector']) labels
  7334. */
  7335. hashingNumericScales : function(labels, extent, mode) {
  7336. if (!labels || !extent) {
  7337. return;
  7338. }
  7339. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  7340. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  7341. var tickSpace = mode == 1 ? extent[1] : extent[0];
  7342. this._textTruncationIndicator = "";
  7343. this._layoutLabelSize = 0;
  7344. for (var i = 0; i < labels.size(); ++i) {
  7345. var node = labels[i][0];
  7346. var dim = node.getBBox();
  7347. var width = dim.width;
  7348. var height = dim.height;
  7349. var size = !isHorizontal || mode == 1 ? width : height;
  7350. if (size > this._layoutLabelSize) {
  7351. this._layoutLabelSize = size;
  7352. }
  7353. if (width >= tickSpace) {
  7354. if (this._simplifiedTickFormat) {
  7355. var newText = this._simplifiedTickFormat.call(null, node.rave_getData(), 0, 0);
  7356. if (newText != null) {
  7357. node.rave_setText(newText);
  7358. }
  7359. if (node.getBBox().width >= tickSpace) {
  7360. node.rave_setText(this.stringOfSize(node.rave_getText().length, "#"));
  7361. }
  7362. } else {
  7363. node.rave_setText(this.stringOfSize(node.rave_getText().length, "#"));
  7364. }
  7365. }
  7366. }
  7367. }
  7368. },
  7369. /**
  7370. * @param (int) size The desired size of the string
  7371. * @param (String) ch The character to be repeated in the string
  7372. * @return (String) A string of the specified size containing repetition of the specified character
  7373. */
  7374. stringOfSize : function(size, ch) {
  7375. var returnString = "";
  7376. for (var i = 0; i < size; ++i) {
  7377. returnString += ch;
  7378. }
  7379. return returnString;
  7380. },
  7381. configureStaggerData : function(g, mode) {
  7382. if (mode == 3 || mode == 2) {
  7383. var horizontalDimensions = this.labelExtent(g);
  7384. var cellWidth = horizontalDimensions[0];
  7385. var axisSelector = g.selectAll("g.axis");
  7386. var labels = axisSelector.selectAll("text");
  7387. var domain = this._scale.scale().domain();
  7388. var originalDataLabelAccessor = (this._scale).originalDomainLabelAccessor();
  7389. this._staggerRotate45Nodes = [];
  7390. this._staggerFirstNode = null;
  7391. this._staggerLastNode = null;
  7392. for (var i = 0; i < labels.size(); ++i) {
  7393. var node = labels[0][i];
  7394. if (this.isValid(node.rave_getData())) {
  7395. var domainIndex = -1;
  7396. if (mode == 3) {
  7397. var domainLabel = !this._tickFormat ? node.rave_getText() : originalDataLabelAccessor.call(node, node.rave_getData(), 0, 0);
  7398. for (var index = 0; index < domain.length; ++index) {
  7399. if (domain[index].toString() == domainLabel) {
  7400. domainIndex = index;
  7401. break;
  7402. }
  7403. }
  7404. }
  7405. this._staggerRotate45Nodes.push(new com_ibm_rave_bundles_components_AxisComponentImpl.NodeIndex(node, domainIndex));
  7406. if (domainIndex == 0) {
  7407. this._staggerFirstNode = node;
  7408. }
  7409. if (domainIndex == domain.length - 1) {
  7410. this._staggerLastNode = node;
  7411. }
  7412. }
  7413. }
  7414. this._staggerCellWidth = cellWidth * 2;
  7415. this._staggerAlignFirstAtStart = this._staggerFirstNode ? this._staggerFirstNode.getBBox().width > cellWidth : false;
  7416. this._staggerAlignLastAtEnd = this._staggerLastNode ? this._staggerLastNode.getBBox().width > cellWidth : false;
  7417. }
  7418. },
  7419. getStaggerIndex : function(node) {
  7420. for (var index = 0; index < this._staggerRotate45Nodes.length; ++index) {
  7421. if (this._staggerRotate45Nodes[index].contains(node)) {
  7422. var domainIndex = this._staggerRotate45Nodes[index].getIndex();
  7423. return domainIndex == -1 ? 0 : domainIndex;
  7424. }
  7425. }
  7426. return -1;
  7427. },
  7428. getStaggerCount : function() {
  7429. var domain = this._scale.scale().domain();
  7430. return domain.length;
  7431. },
  7432. /**
  7433. * <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>
  7434. * @param (rave['internal']['Selector']) g
  7435. */
  7436. determineWhichAutoMode : function(g) {
  7437. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  7438. var axisSelector = g.selectAll("g.axis");
  7439. var labels = axisSelector.selectAll("text");
  7440. var dim = this.labelExtent(g);
  7441. var cellWidth = dim[0];
  7442. var cellWidth90 = dim[1];
  7443. var layoutLabelHeight = 0;
  7444. var layoutLabelWidth = 0;
  7445. var horizontalScore = 0;
  7446. var staggerScore = 0;
  7447. var rotate45Score = 0;
  7448. var rotate90Score = 0;
  7449. var validNodes = [];
  7450. for (var i = 0; i < labels.size(); ++i) {
  7451. var node = labels[0][i];
  7452. if (this.isValid(node.rave_getData())) {
  7453. validNodes.push(node);
  7454. }
  7455. }
  7456. var labelCount = validNodes.length;
  7457. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  7458. var mode = 0;
  7459. if (isHorizontal) {
  7460. mode = this._layoutMode == 1 ? 1 : 0;
  7461. var tick = axisSelector.append("g").classed("tick", true);
  7462. var tickText = tick.append("text");
  7463. tickText.style(this._labelStyle);
  7464. tickText.text(",0");
  7465. var node = tickText[0][0];
  7466. var zeroWidth = node.getBBox().width;
  7467. tick.remove();
  7468. var widestLabel = 0;
  7469. for (var i = 0; i < labelCount; ++i) {
  7470. node = validNodes[i];
  7471. var nodeRect = node.getBBox();
  7472. if (nodeRect.width > widestLabel) {
  7473. widestLabel = nodeRect.width;
  7474. }
  7475. if (nodeRect.height > this._layoutLabelHeight) {
  7476. this._layoutLabelHeight = nodeRect.height;
  7477. }
  7478. }
  7479. widestLabel += zeroWidth;
  7480. this._layoutSpillOver = mode == 1 ? this._layoutLabelHeight / 2 : widestLabel / 2 + 2;
  7481. } else {
  7482. for (var i = 0; i < labelCount; ++i) {
  7483. var node = validNodes[i];
  7484. var nodeRect = node.getBBox();
  7485. if (nodeRect.height > this._layoutLabelHeight) {
  7486. this._layoutLabelHeight = nodeRect.height;
  7487. }
  7488. }
  7489. this._layoutSpillOver = this._layoutLabelHeight / 2;
  7490. }
  7491. return mode;
  7492. }
  7493. var originalDataLabelAccessor = (this._scale).originalDomainLabelAccessor();
  7494. var staggerStringsWontMatch = this._tickFormat && !originalDataLabelAccessor;
  7495. var calcStagger = ((this._allowStagger && this._layoutMode == -1) || this._layoutMode == 3) && !staggerStringsWontMatch;
  7496. var calcRotate45 = (this._allowRotate45 && this._layoutMode == -1) || this._layoutMode == 2;
  7497. var calcRotate90 = (this._allowRotate90 && this._layoutMode == -1) || this._layoutMode == 1;
  7498. var spaceFor45Label = 0;
  7499. for (var i = 0; i < labelCount; ++i) {
  7500. var node = validNodes[i];
  7501. var nodeRect = node.getBBox();
  7502. layoutLabelHeight = nodeRect.height;
  7503. var labelWidth = nodeRect.width;
  7504. if (labelWidth > layoutLabelWidth) {
  7505. layoutLabelWidth = labelWidth;
  7506. }
  7507. horizontalScore += (labelWidth <= cellWidth ? 1 : cellWidth / labelWidth);
  7508. if (isHorizontal) {
  7509. if (calcStagger) {
  7510. var spaceForLabel = cellWidth * 2;
  7511. if (i == 0 && i == labelCount - 1) {
  7512. spaceForLabel *= 0.5;
  7513. } else if (i == 0 || i == labelCount - 1) {
  7514. spaceForLabel *= 0.75;
  7515. }
  7516. staggerScore += (labelWidth <= spaceForLabel ? 1 : spaceForLabel / labelWidth);
  7517. }
  7518. if (calcRotate45) {
  7519. if (spaceFor45Label == 0) {
  7520. spaceFor45Label = cellWidth90 / 0.7071 - layoutLabelHeight;
  7521. }
  7522. var space = this.calculate45DegreeSpace(node, spaceFor45Label);
  7523. rotate45Score += (labelWidth <= space ? 1 : space / labelWidth);
  7524. }
  7525. if (calcRotate90) {
  7526. rotate90Score += (labelWidth <= cellWidth90 ? 1 : cellWidth90 / labelWidth);
  7527. }
  7528. }
  7529. }
  7530. var mode = 0;
  7531. if (this._layoutMode == -1) {
  7532. if (isHorizontal && this._allowStagger) {
  7533. horizontalScore *= 1.1;
  7534. staggerScore *= 1.1;
  7535. }
  7536. if ((staggerScore > horizontalScore) && (staggerScore >= rotate45Score) && (staggerScore >= rotate90Score)) {
  7537. mode = 3;
  7538. } else if ((rotate45Score > horizontalScore) && (rotate45Score >= rotate90Score)) {
  7539. mode = 2;
  7540. } else if (rotate90Score > horizontalScore) {
  7541. mode = 1;
  7542. }
  7543. } else {
  7544. if ((this._layoutMode == 3 && staggerStringsWontMatch) || !isHorizontal) {
  7545. mode = 0;
  7546. } else {
  7547. mode = this._layoutMode;
  7548. }
  7549. }
  7550. if (isHorizontal) {
  7551. switch (mode) {
  7552. case 3:
  7553. this._layoutLabelSize = layoutLabelHeight * 2;
  7554. break;
  7555. case 2:
  7556. this._layoutLabelSize = (layoutLabelWidth + layoutLabelHeight) * 0.7071;
  7557. break;
  7558. case 1:
  7559. this._layoutLabelSize = layoutLabelWidth;
  7560. break;
  7561. case 0:
  7562. default:
  7563. this._layoutLabelSize = layoutLabelHeight;
  7564. break;
  7565. }
  7566. } else {
  7567. this._layoutLabelSize = layoutLabelWidth;
  7568. }
  7569. this._layoutLabelHeight = layoutLabelHeight;
  7570. return mode;
  7571. },
  7572. calculate45DegreeSpace : function(node, maxWidth) {
  7573. var width = maxWidth;
  7574. var tfm = node.rave_getParentNode().getAttribute("transform");
  7575. if (tfm != null) {
  7576. var tfmString = tfm.toString();
  7577. var indexOfTrans = tfmString.indexOf("translate(");
  7578. if (indexOfTrans != -1) {
  7579. indexOfTrans += 10;
  7580. var indexOfComma = tfmString.indexOf(",", indexOfTrans);
  7581. if (indexOfComma != -1) {
  7582. var xAmount = tfmString.substring(indexOfTrans, indexOfComma);
  7583. var xLabelPos = + (xAmount);
  7584. var width45Degrees = node.getBBox().width;
  7585. var xLabelWidth = width45Degrees * 0.7071;
  7586. var isBottom = this._orient == "bottom";
  7587. if (isBottom) {
  7588. xLabelPos -= node.getBBox().height / 4;
  7589. if (xLabelPos - xLabelWidth < this._bounds.x) {
  7590. xLabelWidth = xLabelPos - this._bounds.x;
  7591. width = xLabelWidth / 0.7071;
  7592. }
  7593. } else {
  7594. if (xLabelPos + xLabelWidth > this._bounds.x + this._bounds.width) {
  7595. xLabelWidth = (this._bounds.x + this._bounds.width) - xLabelPos;
  7596. width = xLabelWidth / 0.7071;
  7597. }
  7598. }
  7599. if (width > maxWidth) {
  7600. width = maxWidth;
  7601. }
  7602. }
  7603. }
  7604. }
  7605. return width;
  7606. },
  7607. /**
  7608. * @param (rave['internal']['Selector']) labels selector with all labels to be rotated
  7609. * @param (rave['internal']['Selector']) g The parent selector of labels
  7610. * @param (String) textAnchor The position of the anchor
  7611. * @param alignmentMode One of HORIZONTAL, STAGGER, ROTATE45, ROTATE90
  7612. */
  7613. rotateLabels : function(g, labels, textAnchor, mode) {
  7614. if (this._rotateLabels) {
  7615. var self = this;
  7616. var positioning = function(data, index, groupIndex) {
  7617. var x = 0;
  7618. var y = 0;
  7619. var rotation_cy = 0;
  7620. var isBottom = self._orient == "bottom";
  7621. if (mode == 3) {
  7622. var cellIndex = self.getStaggerIndex(this);
  7623. if (cellIndex != -1) {
  7624. if (cellIndex % 2 == 1) {
  7625. var staggerDirection = isBottom ? 1 : -1;
  7626. y += (self._layoutLabelHeight * staggerDirection);
  7627. }
  7628. if (cellIndex == 0 && self._staggerAlignFirstAtStart) {
  7629. x -= self._staggerCellWidth / 4;
  7630. } else if (cellIndex == self.getStaggerCount() - 1 && self._staggerAlignLastAtEnd) {
  7631. x += self._staggerCellWidth / 4;
  7632. }
  7633. }
  7634. } else if (mode == 2) {
  7635. if (isBottom) {
  7636. x -= self._layoutLabelHeight;
  7637. } else {
  7638. x += self._layoutLabelHeight / 2;
  7639. }
  7640. } else if (mode == 1) {
  7641. if (isBottom) {
  7642. x -= (this.getBBox().height / 2 + self._layoutLabelHeight / 4);
  7643. rotation_cy = ~~(self._padding / 4 + self._axis.tickSize());
  7644. } else {
  7645. x -= (this.getBBox().height / 2 - self._layoutLabelHeight);
  7646. rotation_cy = ~~-(self._padding / 4 + self._axis.tickSize());
  7647. }
  7648. }
  7649. var rotationDegrees = mode == 1 ? -90 : mode == 2 ? -45 : 0;
  7650. return "translate(" + x + "," + y + ") rotate(" + rotationDegrees + ",0," + rotation_cy + ")";
  7651. };
  7652. labels.attr("transform", positioning).style("text-anchor", textAnchor);
  7653. if (mode == 3) {
  7654. if (this._staggerAlignFirstAtStart) {
  7655. this._staggerFirstNode.rave_setStyle("text-anchor", "start");
  7656. }
  7657. if (this._staggerAlignLastAtEnd) {
  7658. this._staggerLastNode.rave_setStyle("text-anchor", "end");
  7659. }
  7660. }
  7661. }
  7662. },
  7663. /** @expose */
  7664. axis : function() {
  7665. return this._axis;
  7666. },
  7667. /**
  7668. * Draw the axis. The scale is non-null.
  7669. * @param (rave['internal']['Selector']) g Selector group into which the axis is drawn.
  7670. */
  7671. drawAxis : function(g) {
  7672. var axisSelector = g.selectAll("g.axis").data([0]);
  7673. axisSelector.enter().append("g").classed("axis", true).classed(this._orient, true);
  7674. if (!this._axis) {
  7675. this._axis = new rave['internal']['Axis']();
  7676. }
  7677. if (this._hideOverlappingLabels) {
  7678. this._textFlow.valignment("top").dropTextOnFail(false);
  7679. }
  7680. this._axis.ticksHandler(this._tickHandler);
  7681. this._axis.orient(this._orient);
  7682. this._axis.tickFormat(this._tickFormat);
  7683. this._axis.tickPadding(10.0);
  7684. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  7685. var labelHeight = 20.0;
  7686. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  7687. if (isHorizontal) {
  7688. labelHeight /= 0.7071;
  7689. }
  7690. var range = this._scale.scale().rangeExtent();
  7691. var extent = + (range[1]) - + (range[0]);
  7692. this._axis.ticks(extent / labelHeight);
  7693. } else {
  7694. if (this._tickMagnitude == null) {
  7695. this._axis.ticks(10.0);
  7696. } else {
  7697. this._axis.ticks.apply(this._axis, [10.0, this._scale.scale().getTickFormat(), this._tickMagnitude]);
  7698. }
  7699. }
  7700. var s = this._scale.scale();
  7701. if (this._scale.originalDomain()) {
  7702. var sOrdinal = s.copy();
  7703. sOrdinal.domain(this._scale.originalDomain());
  7704. s = sOrdinal;
  7705. var self = this;
  7706. var originalDataLabelAccessor = (self._scale).originalDomainLabelAccessor();
  7707. var tickFormatter;
  7708. if (originalDataLabelAccessor) {
  7709. if (this._tickFormat) {
  7710. tickFormatter = function(data, index, groupIndex) {
  7711. return self._tickFormat.call(this, originalDataLabelAccessor.call(this, data, index, groupIndex), index, groupIndex);
  7712. };
  7713. } else {
  7714. tickFormatter = originalDataLabelAccessor;
  7715. }
  7716. } else {
  7717. tickFormatter = this._tickFormat;
  7718. }
  7719. this._axis.tickFormat(tickFormatter);
  7720. }
  7721. this._axis.scale(s);
  7722. axisSelector.call(this._axis);
  7723. var g2 = rave.transition(axisSelector);
  7724. if (!(g2.isTransition())) {
  7725. axisSelector.selectAll("text").call(this._dropOverlap, this._hideOverlappingLabels);
  7726. }
  7727. axisSelector.selectAll("path.domain").classed("axis-line", true);
  7728. axisSelector.selectAll("g.tick line").classed("axis-tick", true);
  7729. if (this._fontChecker) {
  7730. axisSelector.selectAll("g.tick text").classed("axis-label", true).call(this._fontChecker);
  7731. } else {
  7732. axisSelector.selectAll("g.tick text").classed("axis-label", true);
  7733. }
  7734. axisSelector.call(this._axisLineProperties);
  7735. },
  7736. /**
  7737. * Draw the axis title.
  7738. * @param (rave['internal']['Selector']) g Selector group into which the title is drawn.
  7739. */
  7740. drawTitle : function(g) {
  7741. if (!this._displayAxisTitle || this._axisTitle == null || this._axisTitle.trim().length == 0 || !this._bounds) {
  7742. g.selectAll("text.axis-title." + this._orient).remove();
  7743. return;
  7744. }
  7745. var x = 0;
  7746. var y = 0;
  7747. var dy = "";
  7748. var transform;
  7749. if ("top" == this._orient) {
  7750. x = this._elementRect.x + this._elementRect.width / 2;
  7751. y = -this._bounds.height + this._padding / 4;
  7752. dy = "0.75em";
  7753. } else if ("bottom" == this._orient) {
  7754. x = this._elementRect.x + this._elementRect.width / 2;
  7755. y = this._bounds.height - this._padding / 4;
  7756. dy = "-0.25em";
  7757. } else if ("left" == this._orient) {
  7758. x = -this._elementRect.y - this._elementRect.height / 2;
  7759. y = -this._bounds.width + this._padding / 4;
  7760. dy = "0.75em";
  7761. transform = "rotate(-90)";
  7762. } else {
  7763. x = this._elementRect.y + this._elementRect.height / 2;
  7764. y = -this._bounds.width + this._padding / 4;
  7765. dy = "0.75em";
  7766. transform = "rotate(90)";
  7767. }
  7768. var fillOpacity;
  7769. {
  7770. var tmp = g.append("text").attr("class", "axis-title " + this._orient);
  7771. fillOpacity = tmp.style("fill-opacity");
  7772. tmp.remove();
  7773. } var label = g.selectAll("text.axis-title." + this._orient);
  7774. if (label.size() == 0) {
  7775. 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);
  7776. if (this._fontChecker) {
  7777. g.selectAll("text.axis-title." + this._orient).call(this._fontChecker);
  7778. }
  7779. }
  7780. 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);
  7781. },
  7782. getUnZoomedScale : function(scale) {
  7783. var s = scale.copy();
  7784. if (s.getZoomTransform()) {
  7785. s.getZoomTransform()(1, 0);
  7786. }
  7787. return s;
  7788. },
  7789. isValid : function(data) {
  7790. var s = this.getUnZoomedScale(this._axis.scale());
  7791. var v = + (s.call(null, data, 0, 0));
  7792. var range = this._axis.scale().range();
  7793. if (this._axis.scale().range().indexOf(v)> -1) {
  7794. return true;
  7795. }
  7796. if (range[0] < v && v < range[1]) {
  7797. return true;
  7798. }
  7799. if (range[0] > v && v > range[1]) {
  7800. return true;
  7801. }
  7802. return false;
  7803. },
  7804. /**
  7805. * Apply label wrapping if requested.
  7806. * @param (rave['internal']['Selector']) g
  7807. * @param (int) mode One of HORIZONTAL, STAGGER, ROTATE45, ROTATE90
  7808. */
  7809. doLabelWrapping : function(g, mode) {
  7810. if (this._displayTickLabels) {
  7811. this._textFlow.valignment("top");
  7812. if (!this._hideOverlappingLabels) {
  7813. this._textFlow.dropTextOnFail(true);
  7814. }
  7815. var d = this.labelExtent(g);
  7816. if (!d || d[0] < 0 || d[1] < 0) {
  7817. return;
  7818. }
  7819. var w = ~~ (d[0]);
  7820. var h = ~~ (d[1]);
  7821. if (mode == 2) {
  7822. w = ~~(d[1] / 0.7071 - this._layoutLabelHeight);
  7823. h = ~~(this._layoutLabelHeight / 0.7071);
  7824. } else if (mode == 1) {
  7825. var tmp = w;
  7826. w = h;
  7827. h = tmp;
  7828. }
  7829. var allowWrap = mode == 1;
  7830. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  7831. var hActual = ~~ (this._layoutLabelHeight * 1.2);
  7832. if (hActual > h) {
  7833. h = hActual;
  7834. }
  7835. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  7836. if (mode == 0 && !isHorizontal) {
  7837. allowWrap = true;
  7838. }
  7839. }
  7840. var self = this;
  7841. var cellWidth = w;
  7842. var cellHeight = h;
  7843. this._textFlow.wrap(allowWrap).truncate(true).textTruncateIndicator(this._textTruncationIndicator != null ? this._textTruncationIndicator : "...").spacing(1.2).extent(function(data, index, groupIndex) {
  7844. var width = cellWidth;
  7845. var height = cellHeight;
  7846. if (mode == 2) {
  7847. var cellIndex = self.getStaggerIndex(this);
  7848. if (cellIndex != -1) {
  7849. width = ~~self.calculate45DegreeSpace(this, cellWidth);
  7850. }
  7851. } else if (mode == 3) {
  7852. var cellIndex = self.getStaggerIndex(this);
  7853. if (cellIndex != -1) {
  7854. if (cellIndex == 0 && cellIndex == self.getStaggerCount() - 1) {
  7855. width = cellWidth;
  7856. } else if (cellIndex == 0 || cellIndex == self.getStaggerCount() - 1) {
  7857. width = cellWidth * 3 / 2;
  7858. } else {
  7859. width = cellWidth * 2;
  7860. }
  7861. height = cellHeight / 2;
  7862. }
  7863. }
  7864. return [width, height];
  7865. });
  7866. g.selectAll("g.tick > text").call(this._textFlow);
  7867. }
  7868. },
  7869. /**
  7870. * <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>
  7871. * @param (rave['internal']['Selector']) g Selector group for axis
  7872. * @return (Array) The extent of the axis label bounds
  7873. */
  7874. /** @expose */
  7875. labelExtent : function(g) {
  7876. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  7877. var w = this._bounds.width;
  7878. var h = this._bounds.height;
  7879. if (this._scale.scale().rangeBand) {
  7880. var rangeBandValue = + (this._scale.scale().rangeBand());
  7881. if (isHorizontal) {
  7882. w = rangeBandValue;
  7883. } else {
  7884. h = rangeBandValue;
  7885. }
  7886. }
  7887. this.calcTitleExtent(g);
  7888. if (isHorizontal) {
  7889. h -= this._axis.tickSize();
  7890. h -= this._padding / 2;
  7891. if (this._layoutTitleSize != 0) {
  7892. h -= this._layoutTitleSize;
  7893. h -= this._padding / 2;
  7894. }
  7895. } else {
  7896. w -= this._axis.tickSize();
  7897. w -= this._padding / 2;
  7898. if (this._layoutTitleSize != 0) {
  7899. w -= this._layoutTitleSize;
  7900. w -= this._padding / 2;
  7901. }
  7902. }
  7903. return [w, h];
  7904. },
  7905. calcTitleExtent : function(g) {
  7906. this._layoutTitleSize = 0;
  7907. var title = g.selectAll("text.axis-title");
  7908. if (title.size() > 0) {
  7909. var textHeight = title[0][0].getBBox().height;
  7910. this._layoutTitleSize = textHeight;
  7911. }
  7912. },
  7913. /**
  7914. * Set the role to one of the constants ROLE_X1 etc. defined in AxisComponent.
  7915. * @param (String) role The new role
  7916. * @return (com.ibm.rave.bundles.components.AxisComponentImpl) This object
  7917. */
  7918. /** @expose */
  7919. setRole : function(role) {
  7920. this._role = role;
  7921. return this;
  7922. },
  7923. /**
  7924. * Set the ticks interval on the scale based on the magnitude. tickMagnitude represents power of 10. null value gives the default scale ticks.
  7925. * @param (Number) tickMagnitude
  7926. * @return (com.ibm.rave.bundles.component.AxisComponent) this
  7927. */
  7928. /** @expose */
  7929. scaleTickMagnitude : function(tickMagnitude) {
  7930. this._tickMagnitude = tickMagnitude;
  7931. return this;
  7932. },
  7933. /**
  7934. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale The new scale
  7935. */
  7936. /** @expose */
  7937. scale : function(scale) {
  7938. this._scale = scale ? scale : null;
  7939. return this;
  7940. },
  7941. /**
  7942. * Only legal values are accepted, otherwise the orient is unchanged.
  7943. * @param (String) orient The new orient
  7944. */
  7945. orient$0 : function(orient) {
  7946. if ("left" == orient || "bottom" == orient || "right" == orient || "top" == orient) {
  7947. this._orient = orient;
  7948. if (this._role == null) {
  7949. if ("left" == orient) {
  7950. this._role = "ROLE_Y1";
  7951. } else if ("bottom" == orient) {
  7952. this._role = "ROLE_X1";
  7953. } else if ("right" == orient) {
  7954. this._role = "ROLE_Y2";
  7955. } else {
  7956. this._role = "ROLE_X2";
  7957. }
  7958. }
  7959. }
  7960. return this;
  7961. },
  7962. /**
  7963. * Returns the current orientation string return The current orient
  7964. */
  7965. orient$1 : function() {
  7966. return this._orient;
  7967. },
  7968. /**
  7969. * @param (rave['internal']['RectStruct']) bounds The new bounds
  7970. */
  7971. /** @expose */
  7972. bounds : function(bounds) {
  7973. this._bounds = bounds;
  7974. return this;
  7975. },
  7976. /** @expose */
  7977. elementRect : function(elementRect) {
  7978. this._elementRect = elementRect;
  7979. return this;
  7980. },
  7981. tickFormat$0 : function(tickFormat) {
  7982. this._tickFormat = tickFormat;
  7983. return this;
  7984. },
  7985. tickFormat$1 : function() {
  7986. return this._tickFormat;
  7987. },
  7988. simplifiedTickFormat$0 : function(tickFormat) {
  7989. this._simplifiedTickFormat = tickFormat;
  7990. return this;
  7991. },
  7992. simplifiedTickFormat$1 : function() {
  7993. return this._simplifiedTickFormat;
  7994. },
  7995. /** @expose */
  7996. displayAxisTitle : function(displayAxisTitle) {
  7997. this._displayAxisTitle = displayAxisTitle;
  7998. return this;
  7999. },
  8000. /** @expose */
  8001. displayAxisLine : function(displayAxisLine) {
  8002. this._displayAxisLine = displayAxisLine;
  8003. return this;
  8004. },
  8005. /** @expose */
  8006. displayTicks : function(displayTicks) {
  8007. this._displayTicks = displayTicks;
  8008. return this;
  8009. },
  8010. /** @expose */
  8011. displayTickLabels : function(displayTickLabels) {
  8012. this._displayTickLabels = displayTickLabels;
  8013. return this;
  8014. },
  8015. /** @expose */
  8016. allowAutomaticAxisLayoutToChangeOrientation : function(state) {
  8017. this._allowAutoAxisLayoutToChangeOrientaiton = state;
  8018. return this;
  8019. },
  8020. /** @expose */
  8021. isAllowAutomaticAxisLayoutToChangeOrientation : function() {
  8022. return this._allowAutoAxisLayoutToChangeOrientaiton;
  8023. },
  8024. /** @expose */
  8025. showPanZoomTickLabels : function(showPanZoomTickLabels) {
  8026. this._showPanZoomTickLabels = showPanZoomTickLabels;
  8027. return this;
  8028. },
  8029. /** @expose */
  8030. axisTitle : function(axisTitle) {
  8031. this._axisTitle = axisTitle;
  8032. return this;
  8033. },
  8034. /** @expose */
  8035. axisColor : function(axisColor) {
  8036. this._lineColor = axisColor;
  8037. this._tickColor = axisColor;
  8038. return this;
  8039. },
  8040. /** @expose */
  8041. lineColor : function(lineColor) {
  8042. this._lineColor = lineColor;
  8043. return this;
  8044. },
  8045. /** @expose */
  8046. tickColor : function(tickColor) {
  8047. this._tickColor = tickColor;
  8048. return this;
  8049. },
  8050. /** @expose */
  8051. labelColor : function(labelColor) {
  8052. this._labelStyle["fill"] = labelColor;
  8053. return this;
  8054. },
  8055. labelStyle$0 : function(fill, fontSize, fontFamily) {
  8056. this._labelStyle["fill"] = fill;
  8057. this._labelStyle["font-size"] = fontSize;
  8058. this._labelStyle["font-family"] = fontFamily;
  8059. return this;
  8060. },
  8061. /** @expose */
  8062. titleColor : function(titleColor) {
  8063. this._titleStyle["fill"] = titleColor;
  8064. return this;
  8065. },
  8066. titleStyle$0 : function(fill, fontSize, fontFamily) {
  8067. this._titleStyle["fill"] = fill;
  8068. this._titleStyle["font-size"] = fontSize;
  8069. this._titleStyle["font-family"] = fontFamily;
  8070. return this;
  8071. },
  8072. /**
  8073. * @param (int) padding The new padding
  8074. */
  8075. /** @expose */
  8076. padding : function(padding) {
  8077. this._padding = padding;
  8078. return this;
  8079. },
  8080. /**
  8081. * @param mode LayoutMode for axis, one of: null (numeric axis), automatic, horizontal, stagger, rotate45, rotate90
  8082. */
  8083. /** @expose */
  8084. layoutMode : function(layoutMode) {
  8085. this._layoutMode = -1;
  8086. if (layoutMode != null) {
  8087. if (layoutMode == "horizontal") {
  8088. this._layoutMode = 0;
  8089. } else if (layoutMode == "stagger") {
  8090. this._layoutMode = 3;
  8091. } else if (layoutMode == "rotate45") {
  8092. this._layoutMode = 2;
  8093. } else if (layoutMode == "rotate90") {
  8094. this._layoutMode = 1;
  8095. }
  8096. }
  8097. return this;
  8098. },
  8099. /**
  8100. * @param (boolean) allow Enable Stagger to be considered in the automatic layout algorithm
  8101. */
  8102. /** @expose */
  8103. allowStagger : function(allow) {
  8104. this._allowStagger = allow;
  8105. return this;
  8106. },
  8107. /**
  8108. * @param (boolean) allow Enable Rotate 45 to be considered in the automatic layout algorithm
  8109. */
  8110. /** @expose */
  8111. allowRotate45 : function(allow) {
  8112. this._allowRotate45 = allow;
  8113. return this;
  8114. },
  8115. /**
  8116. * @param (boolean) allow Enable Rotate 90 to be considered in the automatic layout algorithm
  8117. */
  8118. /** @expose */
  8119. allowRotate90 : function(allow) {
  8120. this._allowRotate90 = allow;
  8121. return this;
  8122. },
  8123. /**
  8124. * @return (boolean) True if on the last call the axis rendered shapes, false otherwise
  8125. */
  8126. renderedShapes : function() {
  8127. return this._renderedShapes;
  8128. },
  8129. labelStyle$1 : function(fontStyle) {
  8130. this._labelStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  8131. return this;
  8132. },
  8133. titleStyle$1 : function(fontStyle) {
  8134. this._titleStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  8135. return this;
  8136. },
  8137. /**
  8138. * Determines whether the axis is swapped.
  8139. * @return (boolean) True if axis is swapped
  8140. */
  8141. isAxisSwapped : function() {
  8142. 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")));
  8143. },
  8144. /**
  8145. * <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>
  8146. * @param (String) indicator the string to be placed to indicated truncated text
  8147. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  8148. */
  8149. /** @expose */
  8150. textTruncateIndicator : function(indicator) {
  8151. this._textTruncationIndicator = indicator;
  8152. return this;
  8153. },
  8154. /**
  8155. * If at least one label collision request is pending we stop the label collision component, and shut down the label collision timer event.
  8156. */
  8157. stopLabelDroppingUpdate : function() {
  8158. this._pendingLabelTimer = false;
  8159. },
  8160. /**
  8161. * 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.
  8162. * @param (rave['internal']['Selector']) labels the selection of valid labels for the end of the transition
  8163. * @param (double) duration of the transition. If 0, we don't do anything.
  8164. * @param (double) delay of the transition. Added to the duration to delay the updates.
  8165. */
  8166. updateLabelDropping : function(labels, duration, delay) {
  8167. var self = this;
  8168. var start = delay + duration;
  8169. var labelCollideCallback = function(elapsed) {
  8170. if (!self._pendingLabelTimer) {
  8171. return true;
  8172. }
  8173. labels.call(self._dropOverlap, self._hideOverlappingLabels);
  8174. if (elapsed >= start) {
  8175. self._pendingLabelTimer = false;
  8176. return true;
  8177. }
  8178. return false;
  8179. };
  8180. if (duration > 0) {
  8181. this._pendingLabelTimer = true;
  8182. rave.timer(labelCollideCallback, start);
  8183. }
  8184. },
  8185. doLabelWrappingAfterAnimation : function(g, labels, mode, duration, delay) {
  8186. this._layoutTimerId++;
  8187. var timerId = this._layoutTimerId;
  8188. var self = this;
  8189. var wrapCallback = function(elapsed) {
  8190. if (self._layoutTimerId == timerId) {
  8191. self.doLabelWrapping(g, mode);
  8192. self.handleLabelsRotationAndPosition(g, labels, mode);
  8193. }
  8194. return true;
  8195. };
  8196. rave.timer(wrapCallback, delay + duration);
  8197. },
  8198. /** @expose */
  8199. preLayout : function() {
  8200. this._layoutTitleSize = 0;
  8201. this._layoutLabelSize = 0;
  8202. this._layoutLabelHeight = 0;
  8203. this._layoutAverageDigitWidth = 0;
  8204. this._layoutSpillOver = 0;
  8205. },
  8206. /** @expose */
  8207. getSizableType : function() {
  8208. return this._scale.isOrdinal() || this._scale.isClustered() ? 1 : 0;
  8209. },
  8210. /** @expose */
  8211. getSizableOrientation : function() {
  8212. return this._orient;
  8213. },
  8214. /** @expose */
  8215. getPreferredSize : function() {
  8216. var layoutPaddingSize = 0;
  8217. if (this._axis) {
  8218. layoutPaddingSize = this._axis.tickSize();
  8219. if (this._layoutLabelSize != 0) {
  8220. layoutPaddingSize += this._padding / 2;
  8221. }
  8222. if (this._layoutTitleSize != 0) {
  8223. layoutPaddingSize += this._padding / 2;
  8224. }
  8225. }
  8226. return this._layoutLabelSize + this._layoutAverageDigitWidth + this._layoutTitleSize + layoutPaddingSize + 2;
  8227. },
  8228. /** @expose */
  8229. getSpillOverSize : function() {
  8230. return this._layoutSpillOver;
  8231. },
  8232. /** @expose */
  8233. orient : function(a0) {
  8234. var args = arguments;
  8235. if (args.length == 0) {
  8236. return this.orient$1();
  8237. }
  8238. return this.orient$0(a0);
  8239. },
  8240. /** @expose */
  8241. tickFormat : function(a0) {
  8242. var args = arguments;
  8243. if (args.length == 0) {
  8244. return this.tickFormat$1();
  8245. }
  8246. return this.tickFormat$0(a0);
  8247. },
  8248. /** @expose */
  8249. simplifiedTickFormat : function(a0) {
  8250. var args = arguments;
  8251. if (args.length == 0) {
  8252. return this.simplifiedTickFormat$1();
  8253. }
  8254. return this.simplifiedTickFormat$0(a0);
  8255. },
  8256. /** @expose */
  8257. labelStyle : function(a0, a1, a2) {
  8258. var args = arguments;
  8259. if (args.length == 1) {
  8260. return this.labelStyle$1(a0);
  8261. }
  8262. return this.labelStyle$0(a0, a1, a2);
  8263. },
  8264. /** @expose */
  8265. titleStyle : function(a0, a1, a2) {
  8266. var args = arguments;
  8267. if (args.length == 1) {
  8268. return this.titleStyle$1(a0);
  8269. }
  8270. return this.titleStyle$0(a0, a1, a2);
  8271. }
  8272. });
  8273. /**
  8274. * 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.
  8275. * @param (rave['internal']['RectStruct']) bounds Rectangle of the axis bounds
  8276. * @param (String) orient Orient, "top", "bottom", "left", "right"; if not valid, "bottom" used
  8277. * @return (double[]) Translation [x,y]
  8278. */
  8279. /** @expose */
  8280. com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation = function(bounds, orient) {
  8281. if ("left" == orient) {
  8282. return [bounds.x + bounds.width, 0.0];
  8283. }
  8284. if ("right" == orient) {
  8285. return [bounds.x, 0.0];
  8286. }
  8287. if ("top" == orient) {
  8288. return [0.0, bounds.y + bounds.height];
  8289. }
  8290. return [0.0, bounds.y];
  8291. };
  8292. com_ibm_rave_bundles_components_AxisComponentImpl.NodeIndex = rave['internal']['Declare']({
  8293. //_node : null,
  8294. _domainIndex : 0,
  8295. /** @expose */
  8296. constructor : function(node, domainIndex) {
  8297. this._node = node;
  8298. this._domainIndex = domainIndex;
  8299. },
  8300. /** @expose */
  8301. contains : function(node) {
  8302. return node == this._node;
  8303. },
  8304. /** @expose */
  8305. getIndex : function() {
  8306. return this._domainIndex;
  8307. }
  8308. });
  8309. /**
  8310. * Tick Handler for the axis. This will get called as the core axis is transitioned.
  8311. */
  8312. com_ibm_rave_bundles_components_AxisComponentImpl.AxisTickHandler = rave['internal']['Declare'](rave['internal']['AbstractTickHandler'], {
  8313. //_label : null,
  8314. //_tick : null,
  8315. _$functionClassMethod : function() {
  8316. var _$self = function(args) {
  8317. if (args !== null || arguments.length > 1){
  8318. args = Array.prototype.slice.call(arguments, 0);
  8319. }
  8320. {
  8321. _$self.handle(args[0]);
  8322. return null;
  8323. }
  8324. };
  8325. return _$self;
  8326. },
  8327. constructor : function(label, tick) {
  8328. this._label = label;
  8329. this._tick = tick;
  8330. },
  8331. /** @expose */
  8332. handle : function(ticks) {
  8333. ticks.call(this._tick);
  8334. ticks.call(this._label);
  8335. }
  8336. });
  8337. //com_ibm_rave_bundles_components_AxisComponentImpl.VISIBILITY = "visibility";
  8338. //com_ibm_rave_bundles_components_AxisComponentImpl.HIDDEN = "hidden";
  8339. /** @expose */
  8340. com_ibm_rave_bundles_components_AxisComponentImpl.LABEL_HIDDEN_FLAG = "__tickLabelHidden__";
  8341. /** @expose */
  8342. com_ibm_rave_bundles_components_AxisComponentImpl.PANZOOM_HIDDEN_FLAG = "__panZoomHidden__";
  8343. /** @expose */
  8344. com_ibm_rave_bundles_components_AxisComponentImpl.HIDDEN_COUNT = "__hiddenCount__";
  8345. /** @expose */
  8346. com_ibm_rave_bundles_components_AxisComponentImpl.PREFERRED_SPACE_PER_TICK = 20;
  8347. /** @expose */
  8348. com_ibm_rave_bundles_components_AxisComponentImpl.PREFERRED_TICK_COUNT = 10;
  8349. /** @expose */
  8350. com_ibm_rave_bundles_components_AxisComponentImpl.TICK_PADDING = 10;
  8351. //com_ibm_rave_bundles_components_AxisComponentImpl.HORIZONTAL_WEIGHT = 1.1;
  8352. com_ibm_rave_bundles_components_AxisComponentImpl.HORIZONTAL = 0;
  8353. com_ibm_rave_bundles_components_AxisComponentImpl.ROTATE90 = 1;
  8354. com_ibm_rave_bundles_components_AxisComponentImpl.ROTATE45 = 2;
  8355. com_ibm_rave_bundles_components_AxisComponentImpl.STAGGER = 3;
  8356. /**
  8357. * Constant used for text flow spacing
  8358. */
  8359. com_ibm_rave_bundles_components_AxisComponentImpl.TEXTFLOW_SPACING = 1.2;
  8360. /**
  8361. * Bottom axis orientation string.
  8362. */
  8363. /** @expose */
  8364. com_ibm_rave_bundles_components_AxisComponentImpl.BOTTOM_ORIENTATION = "bottom";
  8365. /**
  8366. * Top axis orientation string.
  8367. */
  8368. /** @expose */
  8369. com_ibm_rave_bundles_components_AxisComponentImpl.TOP_ORIENTATION = "top";
  8370. /**
  8371. * Left axis orientation string.
  8372. */
  8373. /** @expose */
  8374. com_ibm_rave_bundles_components_AxisComponentImpl.LEFT_ORIENTATION = "left";
  8375. /**
  8376. * Right axis orientation string.
  8377. */
  8378. /** @expose */
  8379. com_ibm_rave_bundles_components_AxisComponentImpl.RIGHT_ORIENTATION = "right";
  8380. com_ibm_rave_bundles_components_AxisComponentImpl.AUTOMODE = -1;
  8381. // $source: com/ibm/rave/bundles/components/GridComponentImpl
  8382. /************************************************************************
  8383. ** IBM Confidential
  8384. **
  8385. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8386. **
  8387. ** (C) Copyright IBM Corp. 2017
  8388. **
  8389. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8390. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8391. ************************************************************************/
  8392. // GENERATED
  8393. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  8394. //@import com/ibm/rave/bundles/components/StyleStructs (runtime) // new
  8395. //@import com/ibm/rave/bundles/component/GridComponent (runtime) // GridComponent
  8396. /**
  8397. * <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>
  8398. */
  8399. var com_ibm_rave_bundles_components_GridComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  8400. /**
  8401. * The axis property
  8402. */
  8403. //_axis : null,
  8404. /**
  8405. * Role, from the AxisComponent API
  8406. */
  8407. //_role : null,
  8408. /**
  8409. * The orientation
  8410. */
  8411. //_orient : null,
  8412. /**
  8413. * The bounds
  8414. */
  8415. //_bounds : null,
  8416. /**
  8417. * Style of gridlines
  8418. */
  8419. //_gridlineStyle : null,
  8420. /**
  8421. * Whether to display gridlines
  8422. */
  8423. _displayGridlines : false,
  8424. /**
  8425. * After calling the component, this is true if shapes were rendered, false if they were cleared.
  8426. */
  8427. _renderedShapes : false,
  8428. /**
  8429. * Construct, with all properties the defaults.
  8430. */
  8431. /** @expose */
  8432. constructor : function() {
  8433. this._axis = null;
  8434. this._role = null;
  8435. this._orient = "bottom";
  8436. this._bounds = null;
  8437. this._displayGridlines = true;
  8438. this._gridlineStyle = new com_ibm_rave_bundles_components_StyleStructs.LineStyle();
  8439. this._renderedShapes = false;
  8440. },
  8441. /** @expose */
  8442. type : function() {
  8443. return com_ibm_rave_bundles_component_GridComponent.COMPONENT_TYPE;
  8444. },
  8445. /** @expose */
  8446. role : function() {
  8447. return this._role;
  8448. },
  8449. /** @expose */
  8450. execute : function(g) {
  8451. this.preExecute();
  8452. if (!this._displayGridlines || !this._axis || !this._bounds) {
  8453. g.selectAll("*").remove();
  8454. this._renderedShapes = false;
  8455. return;
  8456. }
  8457. this._renderedShapes = true;
  8458. var size = ("bottom" == this._orient || "top" == this._orient) ? this._bounds.height : this._bounds.width;
  8459. var ticksHandler = this._axis.ticksHandler();
  8460. var tickSize = this._axis.tickSize();
  8461. var outerTickSize = this._axis.outerTickSize();
  8462. var tickFormat = this._axis.tickFormat();
  8463. var ax = this._axis.tickSize(-size, 0).tickFormat("").ticksHandler(null);
  8464. g.call(ax);
  8465. this._axis.tickSize(tickSize, outerTickSize).tickFormat(tickFormat).ticksHandler(ticksHandler);
  8466. g.selectAll("g.tick line").classed("grid-tick", true);
  8467. g.selectAll(".grid-tick").style("stroke", this._gridlineStyle._stroke).style("stroke-dasharray", (this._gridlineStyle._dashArray));
  8468. g.selectAll("path.domain").remove();
  8469. },
  8470. /**
  8471. * @param (rave['internal']['Axis']) axis The new axis
  8472. */
  8473. /** @expose */
  8474. axis : function(axis) {
  8475. this._axis = axis;
  8476. return this;
  8477. },
  8478. /**
  8479. * Set the role to one of the constants ROLE_X1 etc. defined in AxisComponent.
  8480. * @param (String) role The new role
  8481. * @return (com.ibm.rave.bundles.components.GridComponentImpl) This object
  8482. */
  8483. /** @expose */
  8484. setRole : function(role) {
  8485. this._role = role;
  8486. return this;
  8487. },
  8488. /**
  8489. * Only legal values are accepted, otherwise the orient is unchanged.
  8490. * @param (String) orient The new orient
  8491. */
  8492. orient$0 : function(orient) {
  8493. if ("left" == orient || "right" == orient || "bottom" == orient || "top" == orient) {
  8494. this._orient = orient;
  8495. }
  8496. return this;
  8497. },
  8498. /**
  8499. * @param (rave['internal']['RectStruct']) bounds The new bounds
  8500. */
  8501. /** @expose */
  8502. bounds : function(bounds) {
  8503. this._bounds = bounds;
  8504. return this;
  8505. },
  8506. displayGridlines$0 : function(displayGridlines) {
  8507. this._displayGridlines = displayGridlines;
  8508. return this;
  8509. },
  8510. /** @expose */
  8511. gridlineStyle : function(gridlineColor, dashArray) {
  8512. this.gridlineColor(gridlineColor);
  8513. this.dashArray(dashArray);
  8514. return this;
  8515. },
  8516. gridlineColor$0 : function(gridlineColor) {
  8517. this._gridlineStyle._stroke = (gridlineColor != null && gridlineColor.length > 0) ? gridlineColor : null;
  8518. return this;
  8519. },
  8520. dashArray$0 : function(dashArray) {
  8521. this._gridlineStyle._dashArray = (dashArray != null && dashArray.length > 0) ? dashArray : null;
  8522. return this;
  8523. },
  8524. /**
  8525. * @return (String) The orientation of the gridline.
  8526. */
  8527. orient$1 : function() {
  8528. return this._orient;
  8529. },
  8530. displayGridlines$1 : function() {
  8531. return this._displayGridlines;
  8532. },
  8533. gridlineColor$1 : function() {
  8534. return this._gridlineStyle._stroke;
  8535. },
  8536. dashArray$1 : function() {
  8537. return this._gridlineStyle._dashArray;
  8538. },
  8539. /**
  8540. * @return (boolean) True if on the last call the axis rendered shapes, false otherwise
  8541. */
  8542. renderedShapes : function() {
  8543. return this._renderedShapes;
  8544. },
  8545. /** @expose */
  8546. orient : function(a0) {
  8547. var args = arguments;
  8548. if (args.length == 0) {
  8549. return this.orient$1();
  8550. }
  8551. return this.orient$0(a0);
  8552. },
  8553. /** @expose */
  8554. displayGridlines : function(a0) {
  8555. var args = arguments;
  8556. if (args.length == 0) {
  8557. return this.displayGridlines$1();
  8558. }
  8559. return this.displayGridlines$0(a0);
  8560. },
  8561. /** @expose */
  8562. gridlineColor : function(a0) {
  8563. var args = arguments;
  8564. if (args.length == 0) {
  8565. return this.gridlineColor$1();
  8566. }
  8567. return this.gridlineColor$0(a0);
  8568. },
  8569. /** @expose */
  8570. dashArray : function(a0) {
  8571. var args = arguments;
  8572. if (args.length == 0) {
  8573. return this.dashArray$1();
  8574. }
  8575. return this.dashArray$0(a0);
  8576. }
  8577. });
  8578. // $source: com/ibm/rave/bundles/nativeImpl/components/TiledmapV2NativeSubComponentImpl
  8579. /************************************************************************
  8580. ** IBM Confidential
  8581. **
  8582. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8583. **
  8584. ** (C) Copyright IBM Corp. 2017,2020
  8585. **
  8586. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8587. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8588. ************************************************************************/
  8589. // Add javascript dependencies
  8590. // @import ./TiledmapV2FeatureDataMap
  8591. // @import ./TiledmapV2MapDataCache
  8592. var com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl = ( function()
  8593. {
  8594. var reLayerError = /source layer "([^"]+)".*on source "([^"]+)".*style layer "([^"]+)"/i;
  8595. var reNameField = /^\{name/;
  8596. var FILTER_NONE = false;
  8597. /**
  8598. * Returns the optimized bounding box of a geoJSON object.
  8599. * It balances returning the minimal bounding box containing all coordinates of the passed geoJSON object
  8600. * with keeping the map oriented on the Atlantic ocean if the bounding box stretches more then 3/4 of the world.
  8601. * @param {Object} _geo geoJSON object.
  8602. * @param {Array} _bbox (optional) existing bounding box.
  8603. * @returns {Array} The bounding box of the _geo object. If an existing
  8604. * bounding box was specified in _bbox, then this object is modified and
  8605. * returned. This allows chaining the function for multiple objects.
  8606. */
  8607. function getBalancedBoundingBox( _geo, _bbox )
  8608. {
  8609. var coords = flattenCoords( _geo );
  8610. var minbbox = _bbox ? [ _bbox[0], _bbox[1], _bbox[2], _bbox[3] ] : [ Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY ];
  8611. var bbox = _bbox ? [ _bbox[0], _bbox[1], _bbox[2], _bbox[3] ] : [ Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY ];
  8612. // Calculate both the minimal bounding box and a regular bounding box
  8613. for ( var i = coords.length - 1; i >= 0; --i )
  8614. {
  8615. var coord = coords[ i ];
  8616. var coord0 = coord[ 0 ];
  8617. if ( coord0 - minbbox[ 0 ] < 0 )
  8618. {
  8619. // Coordinate is on the left side of the bounding box.
  8620. if ( coord0 + 360 - minbbox[ 2 ] < minbbox[ 0 ] - coord0 )
  8621. coord0 += 360; // adjust x-coordinate
  8622. }
  8623. else if ( coord0 - minbbox[ 2 ] > 0 )
  8624. {
  8625. // Coordinate is on the right side of the bounding box.
  8626. if ( minbbox[ 0 ] - coord0 + 360 < coord0 - minbbox[ 2 ] )
  8627. coord0 -= 360; // adjust x-coordinate
  8628. }
  8629. // Update horizontal for minimal bounding box
  8630. minbbox[ 0 ] = Math.min( coord0, minbbox[ 0 ] );
  8631. minbbox[ 2 ] = Math.max( coord0, minbbox[ 2 ] );
  8632. // Update vertical for minimal bounding box
  8633. minbbox[ 1 ] = Math.min( coord[ 1 ], minbbox[ 1 ] );
  8634. minbbox[ 3 ] = Math.max( coord[ 1 ], minbbox[ 3 ] );
  8635. // Update regular bounding box
  8636. bbox[ 0 ] = Math.min( coord[ 0 ], bbox[ 0 ] );
  8637. bbox[ 1 ] = Math.min( coord[ 1 ], bbox[ 1 ] );
  8638. bbox[ 2 ] = Math.max( coord[ 0 ], bbox[ 2 ] );
  8639. bbox[ 3 ] = Math.max( coord[ 1 ], bbox[ 3 ] );
  8640. }
  8641. // RTC 190107 demands favoring the Atlantic ocean, when showing the map
  8642. // The minbbox determines the minimal bounding box of the passed coordinates.
  8643. // The mechanism used to determine the minbbox has the disadvantage that the minbbox might move
  8644. // the center of the coordinates with wide selections (spanning a large part of the world).
  8645. // In general an orientation over Greenwich is preferred.
  8646. // Check if the bounding box stretches more then 3/4 of the world, in that case, use the regular bbox
  8647. // (which seems to resort to the world view farily quickly)
  8648. var bbExtend = minbbox[ 2 ] - minbbox[ 0 ];
  8649. if ( bbExtend > 270 )
  8650. return bbox;
  8651. // If our minimal bounding box stretches 2/3 of the world and is completely left or right of Greenwich (Longitude = 0),
  8652. // use the regular bbox
  8653. if ( ( bbExtend > 240 ) &&
  8654. ( ( ( minbbox[ 0 ] < -180 ) && ( minbbox[ 2 ] < 0 ) ) || ( ( minbbox[ 2 ] > 180 ) && ( minbbox[ 0 ] > 0 ) ) ) )
  8655. return bbox;
  8656. return minbbox;
  8657. }
  8658. /**
  8659. * Returns a flat list of coordinates contained within a geoJSON object.
  8660. * @param {Object} _geo geoJSON object.
  8661. * @returns {Array} A flat array of coordinates.
  8662. */
  8663. function flattenCoords( _geo )
  8664. {
  8665. var src, src2, dest;
  8666. var i, j, len;
  8667. switch ( _geo.type.toLowerCase() )
  8668. {
  8669. case "point":
  8670. return [ _geo.coordinates ];
  8671. case "linestring":
  8672. case "multipoint":
  8673. return _geo.coordinates;
  8674. case "polygon":
  8675. case "multilinestring":
  8676. src = _geo.coordinates;
  8677. for ( dest = [], i = 0, len = src.length; i < len; ++i )
  8678. dest.push.apply( dest, src[ i ] );
  8679. return dest;
  8680. case "multipolygon":
  8681. src = _geo.coordinates;
  8682. for ( dest = [], i = 0, len = src.length; i < len; ++i )
  8683. for ( src2 = src[ i ], j = 0; j < src2.length; ++j )
  8684. dest.push.apply( dest, src2[ j ] );
  8685. return dest;
  8686. case "feature":
  8687. return flattenCoords( _geo.geometry );
  8688. case "geometrycollection":
  8689. src = _geo.geometries;
  8690. for ( dest = [], i = 0, len = src.length; i < len; ++i )
  8691. dest.push.apply( dest, flattenCoords( src[ i ] ) );
  8692. return dest;
  8693. case "featurecollection":
  8694. src = _geo.features;
  8695. for ( dest = [], i = 0, len = src.length; i < len; ++i )
  8696. dest.push.apply( dest, flattenCoords( src[ i ] ) );
  8697. return dest;
  8698. default:
  8699. return [];
  8700. }
  8701. }
  8702. function setMaxTileCacheSize( _mapOptions )
  8703. {
  8704. var ua = typeof navigator !== "undefined" ? navigator.userAgent : "";
  8705. // IE <= 10 || IE 11
  8706. var isIE = ua.indexOf( 'MSIE ' ) >= 0 || ua.indexOf( 'Trident/' ) >= 0;
  8707. if ( isIE )
  8708. {
  8709. _mapOptions.maxTileCacheSize = 6;
  8710. }
  8711. }
  8712. function easing( _t )
  8713. {
  8714. return _t * (2 - _t);
  8715. }
  8716. //Constructor
  8717. function com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl(node)
  8718. {
  8719. this._featureDataMap = new com_ibm_rave_bundles_nativeImpl_components_TiledmapV2FeatureDataMap();
  8720. this._mapCache = new com_ibm_rave_bundles_nativeImpl_components_TiledmapV2MapDataCache();
  8721. this._mapCacheVersion = this._mapCache.version;
  8722. this._map = null;
  8723. this._nls = null;
  8724. this._mapLoaded = false;
  8725. this._mapboxToken = "";
  8726. this._mapboxStyle = "mapbox://style/mapbox/streets-v9";
  8727. this._mapboxStyleDirty = true;
  8728. this._mapboxDataDirty = true;
  8729. this._mapBBox = null;
  8730. this._containerRect = { // Default rect struct. The width and height are based on the defaults for the D3/Rave Core mercator projection size.
  8731. x: 0,
  8732. y: 0,
  8733. width: 960,
  8734. height: 500
  8735. };
  8736. this._svg = null;
  8737. this._mapContainer = null;
  8738. this._selectedItems = rave.set(); // list of polygons that are currently selected
  8739. this._addedResources = rave.map(); // List added sources and layers
  8740. this._highlights = { items: [] }; // list of polygons that are currently highlighted
  8741. this._dataLayers = [];
  8742. this._mapLocale = "en";
  8743. this._styleDataCache = rave.map();
  8744. this._maxPointSize = null;
  8745. // maxZoom handling
  8746. this._maxZoom = null;
  8747. this._zoomStart = null;
  8748. this._zoomStartHandler = null;
  8749. this._zoomEndHandler = null;
  8750. this._maxZoomCallbacks = [];
  8751. this._mappingErrorCallbacks = [];
  8752. this._autoZoom = true;
  8753. }
  8754. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.draw = function( _svg )
  8755. {
  8756. // console.debug( "TiledMap::draw" );
  8757. //
  8758. // integrators current pass RAVE an svg element for rendering
  8759. // mapbox renders inside a div
  8760. // we still need the svg element for rendering the legend
  8761. // the strategy here is to create a sibling div to the svg element and let mapbox draw there
  8762. var self = this;
  8763. // set the mapbox access token
  8764. mapboxgl.accessToken = this._mapboxToken; // TODO: Could go in the constructor?
  8765. // get access to the root SVG element
  8766. this._svg = _svg;
  8767. var svgOwner = rave.select( this._svg.node().parentNode );
  8768. // add a new container for both mapbox canvas and chart (legend) SVG
  8769. var containerNode = svgOwner.append( "div" )
  8770. .classed( "vizlibrary-tiledmap", true )
  8771. .classed( "tiledmap-container", true )
  8772. .style( "position", "relative" )
  8773. .style( "width", "100%" )
  8774. .style( "height", "100%" );
  8775. // create mapContainer
  8776. this._mapContainer = containerNode.append( "div" )
  8777. .style( "position", "absolute" )
  8778. .style( "text-align", "left" ) // dashboards needs this for now
  8779. .style( "left", this._containerRect.x + "px" )
  8780. .style( "top", this._containerRect.y + "px" )
  8781. .style( "width", this._containerRect.width + "px" )
  8782. .style( "height", this._containerRect.height + "px" );
  8783. // re-parent and style the svg
  8784. containerNode.node().appendChild( this._svg.node() );
  8785. this._svg.style( "position", "absolute" )
  8786. .style( "top","0px" )
  8787. .style( "left","0px" )
  8788. .style( "pointer-events", "none" ); // Prevent pointer events on the svg container itself. The child svg nodes can have events enabled if needed.
  8789. var options = {
  8790. container: this._mapContainer.node(),
  8791. attributionControl: false,
  8792. style: this._mapboxStyle
  8793. };
  8794. setMaxTileCacheSize( options );
  8795. // create the mapbox control
  8796. this._map = new mapboxgl.Map( options );
  8797. // Currently not supporting mapbox rotation.
  8798. this._map.dragRotate.disable();
  8799. this._map.addControl(new mapboxgl.NavigationControl());
  8800. // add attribution control
  8801. this._map.addControl( new mapboxgl.AttributionControl( {
  8802. compact: true
  8803. } ), "bottom-right" );
  8804. var onStyleLoaded = function()
  8805. {
  8806. self._applyMapLocale();
  8807. // a style load causes all layers to be reset as well, reset loaded tilesets
  8808. if ( self._mapboxStyleDirty )
  8809. self._addedResources = rave.map();
  8810. else
  8811. self._clearAddedResources();
  8812. self._mapboxStyleDirty = false;
  8813. self._loadLayers();
  8814. // reset zoom when data was dropped
  8815. if ( self._autoZoom && self._mapboxDataDirty && ( self._featureDataMap.size() === 0 ) )
  8816. self._map.setZoom(0);
  8817. // check delayed bounding box
  8818. if ( self._mapBBox )
  8819. {
  8820. self._fitBounds( self._mapBBox );
  8821. self._mapBBox = null;
  8822. }
  8823. // re-apply selections and highlights
  8824. if ( self._selectedItems.size() )
  8825. self._updateSelectedItemFilters();
  8826. if ( self._highlights.items.length )
  8827. self.highlightAction( self._highlights );
  8828. self._mapboxDataDirty = false;
  8829. }
  8830. this._map.on( "style.load", function()
  8831. {
  8832. // if the map hasn't loaded yet, postpone style.load handling
  8833. if ( self._mapLoaded )
  8834. onStyleLoaded();
  8835. else
  8836. self._map.once( "load", onStyleLoaded );
  8837. } );
  8838. this._map.on( "load", function()
  8839. {
  8840. // mark map loaded
  8841. self._mapLoaded = true;
  8842. } );
  8843. }
  8844. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.fire = function( _type )
  8845. {
  8846. // console.debug( "TiledMap::fire - " + _type );
  8847. this._map.fire( _type );
  8848. }
  8849. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._loadLayers = function()
  8850. {
  8851. // console.debug( "TiledMap::_loadLayers" );
  8852. var self = this;
  8853. var styleData = this._styleDataCache.get( this._mapboxStyle );
  8854. var filter;
  8855. if ( !styleData || ( this._featureDataMap.size() === 0 ) )
  8856. return;
  8857. // to make sure the layers are added in the correct order
  8858. [ "region", "point" ].forEach( function( _type )
  8859. {
  8860. // iterate tilesets
  8861. self._featureDataMap.getTileSets( { type: _type } ).forEach( function( _tileSet )
  8862. {
  8863. // add tileset source
  8864. if ( !self._map.getSource( _tileSet.id ) )
  8865. {
  8866. var source = { type: _tileSet.tileType };
  8867. var actionSourceId = null;
  8868. switch ( _tileSet.tileType )
  8869. {
  8870. case "vector":
  8871. filter = self._featureDataMap.getMapFilter( _tileSet );
  8872. source.url = "mapbox://" + _tileSet.id;
  8873. self._map.addSource( _tileSet.id, source );
  8874. self._addResource( { type: "source", tileType: _tileSet.tileType, id: _tileSet.id } );
  8875. // vector layers get an additional source for hover/select/focus actions
  8876. actionSourceId = _tileSet.id + "Action";
  8877. self._map.addSource( actionSourceId, source );
  8878. self._addResource( { type: "source", tileType: _tileSet.tileType, id: actionSourceId } );
  8879. break;
  8880. case "geojson":
  8881. source.data = {
  8882. type: "FeatureCollection",
  8883. features: self._featureDataMap.getFeatures( _tileSet.id )
  8884. };
  8885. self._map.addSource( _tileSet.id, source );
  8886. self._addResource( { type: "source", tileType: _tileSet.tileType, id: _tileSet.id } );
  8887. break;
  8888. }
  8889. }
  8890. // check for region
  8891. if ( _tileSet.polyLayer )
  8892. {
  8893. var polyLayerId = _tileSet.polyLayer;
  8894. if ( _tileSet.tileType === "vector" )
  8895. {
  8896. // setup fill layer
  8897. if ( !self._map.getLayer( polyLayerId ) )
  8898. {
  8899. // console.debug( "- addLayer: " + polyLayerId );
  8900. self._map.addLayer( {
  8901. "id": polyLayerId,
  8902. "type": "fill",
  8903. "source": _tileSet.id,
  8904. "source-layer": _tileSet.sourceLayer,
  8905. "paint": {
  8906. "fill-opacity": 1 - ( _tileSet.transparency / 100.0 )
  8907. }
  8908. }, styleData.baseLayer );
  8909. self._addResource( { type: "layer", source: _tileSet.id, tileType: _tileSet.tileType, id: polyLayerId } );
  8910. if ( filter )
  8911. {
  8912. self._map.setFilter( polyLayerId, filter );
  8913. }
  8914. }
  8915. // setup focus layer
  8916. layerId = polyLayerId + "Focus";
  8917. if ( !self._map.getLayer( layerId ) )
  8918. {
  8919. // console.debug( "- addLayer: " + layerId );
  8920. self._map.addLayer( {
  8921. "id": layerId,
  8922. "type": "fill",
  8923. "source": actionSourceId,
  8924. "source-layer": _tileSet.sourceLayer,
  8925. "paint": {
  8926. "fill-opacity": 1
  8927. },
  8928. "filter": [ "==", _tileSet.property, FILTER_NONE ]
  8929. }, styleData.baseLayer );
  8930. self._addResource( { type: "layer", source: actionSourceId, tileType: _tileSet.tileType, id: layerId } );
  8931. }
  8932. // setup select layer
  8933. layerId = polyLayerId + "Select";
  8934. if ( !self._map.getLayer( layerId ) )
  8935. {
  8936. // console.debug( "- addLayer: " + layerId );
  8937. self._map.addLayer( {
  8938. "id": layerId,
  8939. "type": "line",
  8940. "source": actionSourceId,
  8941. "source-layer": _tileSet.sourceLayer,
  8942. "paint": {
  8943. "line-width": 2,
  8944. "line-opacity": 1
  8945. },
  8946. "filter": [ "==", _tileSet.property, FILTER_NONE ]
  8947. }, styleData.baseLayer );
  8948. self._addResource( { type: "layer", source: actionSourceId, tileType: _tileSet.tileType, id: layerId } );
  8949. }
  8950. // setup hover layer
  8951. layerId = polyLayerId + "Hover";
  8952. if ( !self._map.getLayer( layerId ) )
  8953. {
  8954. // console.debug( "- addLayer: " + layerId );
  8955. self._map.addLayer( {
  8956. "id": layerId,
  8957. "type": "line",
  8958. "source": actionSourceId,
  8959. "source-layer": _tileSet.sourceLayer,
  8960. "paint": {
  8961. "line-width": 2,
  8962. "line-opacity": 1
  8963. },
  8964. "filter": [ "==", _tileSet.property, FILTER_NONE ]
  8965. }, styleData.baseLayer );
  8966. self._addResource( { type: "layer", source: actionSourceId, tileType: _tileSet.tileType, id: layerId } );
  8967. }
  8968. }
  8969. else if ( _tileSet.tileType === "geojson" )
  8970. {
  8971. // add placeholder layer (regions with only location information)
  8972. layerId = polyLayerId;
  8973. if ( !self._map.getLayer( layerId ) )
  8974. {
  8975. // console.debug( "- addLayer: " + pointLayerId );
  8976. self._map.addLayer( {
  8977. "id": layerId,
  8978. "type": "circle",
  8979. "source": _tileSet.id,
  8980. "paint": {
  8981. "circle-opacity": 1 - ( _tileSet.transparency / 100.0 ),
  8982. "circle-radius": 10,
  8983. "circle-stroke-width": 0
  8984. }
  8985. }, styleData.baseLayer );
  8986. self._addResource( { type: "layer", source: _tileSet.id, tileType: _tileSet.tileType, id: layerId } );
  8987. }
  8988. // setup focus layer
  8989. layerId = polyLayerId + "Focus";
  8990. if ( !self._map.getLayer( layerId ) )
  8991. {
  8992. // console.debug( "- addLayer: " + pointLayerId );
  8993. self._map.addLayer( {
  8994. "id": layerId,
  8995. "type": "circle",
  8996. "source": _tileSet.id,
  8997. "paint": {
  8998. "circle-opacity": 1 - ( _tileSet.transparency / 100.0 ),
  8999. "circle-radius": 10,
  9000. "circle-stroke-width": 0
  9001. }
  9002. }, styleData.baseLayer );
  9003. self._addResource( { type: "layer", source: _tileSet.id, tileType: _tileSet.tileType, id: layerId } );
  9004. }
  9005. // setup select layer
  9006. layerId = polyLayerId + "Select";
  9007. if ( !self._map.getLayer( layerId ) )
  9008. {
  9009. // console.debug( "- addLayer: " + layerId );
  9010. self._map.addLayer( {
  9011. "id": layerId,
  9012. "type": "circle",
  9013. "source": _tileSet.id,
  9014. "paint": {
  9015. "circle-opacity": 0,
  9016. "circle-radius": 10,
  9017. "circle-stroke-width": 2
  9018. },
  9019. "filter": [ "==", _tileSet.property, FILTER_NONE ]
  9020. }, styleData.baseLayer );
  9021. self._addResource( { type: "layer", source: _tileSet.id, tileType: _tileSet.tileType, id: layerId } );
  9022. }
  9023. // setup hover layer
  9024. layerId = polyLayerId + "Hover";
  9025. if ( !self._map.getLayer( layerId ) )
  9026. {
  9027. // console.debug( "- addLayer: " + layerId );
  9028. self._map.addLayer( {
  9029. "id": layerId,
  9030. "type": "circle",
  9031. "source": _tileSet.id,
  9032. "paint": {
  9033. "circle-opacity": 0,
  9034. "circle-radius": 10,
  9035. "circle-stroke-width": 2
  9036. },
  9037. "filter": [ "==", _tileSet.property, FILTER_NONE ]
  9038. }, styleData.baseLayer );
  9039. self._addResource( { type: "layer", source: _tileSet.id, tileType: _tileSet.tileType, id: layerId } );
  9040. }
  9041. }
  9042. }
  9043. // check for point
  9044. if ( _tileSet.pointLayer )
  9045. {
  9046. var pointLayerId = _tileSet.pointLayer;
  9047. var layerDef;
  9048. // add pointlayer
  9049. if ( !self._map.getLayer( pointLayerId ) )
  9050. {
  9051. // console.debug( "- addLayer: " + pointLayerId );
  9052. layerDef = {
  9053. "id": pointLayerId,
  9054. "type": "circle",
  9055. "source": _tileSet.id,
  9056. "paint": {
  9057. "circle-opacity": 1 - ( _tileSet.transparency / 100.0 ),
  9058. "circle-radius": 10,
  9059. "circle-stroke-width": 2
  9060. }
  9061. };
  9062. if ( _tileSet.sourceLayer )
  9063. layerDef[ "source-layer" ] = _tileSet.sourceLayer;
  9064. self._map.addLayer( layerDef, styleData.baseLayer );
  9065. self._addResource( { type: "layer", source: _tileSet.id, tileType: _tileSet.tileType, id: pointLayerId } );
  9066. }
  9067. // setup hover layer
  9068. layerId = pointLayerId + "Hover";
  9069. if ( !self._map.getLayer( layerId ) )
  9070. {
  9071. // console.debug( "- addLayer: " + layerId );
  9072. layerDef = {
  9073. "id": layerId,
  9074. "type": "circle",
  9075. "source": _tileSet.id,
  9076. "paint": {
  9077. "circle-opacity": 0,
  9078. "circle-radius": 10,
  9079. "circle-stroke-width": 2
  9080. },
  9081. "filter": [ "==", _tileSet.property, FILTER_NONE ]
  9082. };
  9083. if ( actionSourceId )
  9084. layerDef[ "source" ] = actionSourceId;
  9085. else
  9086. layerDef[ "source" ] = _tileSet.id;
  9087. if ( _tileSet.sourceLayer )
  9088. layerDef[ "source-layer" ] = _tileSet.sourceLayer;
  9089. self._map.addLayer( layerDef, styleData.baseLayer );
  9090. self._addResource( { type: "layer", source: layerDef[ "source" ], tileType: _tileSet.tileType, id: layerId } );
  9091. }
  9092. }
  9093. } );
  9094. } );
  9095. // setup the layer stops
  9096. self._setupLayerStops();
  9097. // set the bounding box, only when the data (DataPoints and MapBox data) has changed and autoZoom is enabled
  9098. // otherwise maintain the current zoom state.
  9099. if ( this._autoZoom && this._mapboxDataDirty )
  9100. self._setBbox();
  9101. }
  9102. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._setBbox = function()
  9103. {
  9104. // console.debug( "TiledMap::_setBbox" );
  9105. var self = this;
  9106. // determine if all tileSets have coordinates
  9107. var allTileSetsHaveCoordinates = this._featureDataMap.getTileSets().every( function( _tileSet )
  9108. {
  9109. if ( ( _tileSet.tileType === "geojson" ) || ( self._featureDataMap.getFeatures( _tileSet.id ).length > 0 ) )
  9110. return true;
  9111. return false;
  9112. } );
  9113. // zoom to world when there are features without coordinates
  9114. if ( !allTileSetsHaveCoordinates )
  9115. this._map.setZoom(0);
  9116. this._map.on('render',afterChangeComplete);
  9117. function afterChangeComplete()
  9118. {
  9119. if( !self._map.loaded() )
  9120. return; // still not loaded
  9121. // safe to query for features
  9122. self._setBboxFeatures();
  9123. self._map.off( "render", afterChangeComplete ); // remove the handler we don't need it anymore
  9124. }
  9125. }
  9126. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._setBboxFeatures = function()
  9127. {
  9128. // console.debug( "TiledMap::_setBboxFeatures" );
  9129. var featureSet = [];
  9130. var self = this;
  9131. this._featureDataMap.getTileSets().forEach( function( _tileSet )
  9132. {
  9133. // use the features of the geojson type tilesets directly, query mapbox for vector type tilesets
  9134. var features = self._featureDataMap.getFeatures( _tileSet.id );
  9135. if ( _tileSet.tileType === "geojson" )
  9136. {
  9137. featureSet = featureSet.concat( features );
  9138. }
  9139. else
  9140. {
  9141. // if we have features, use them, otherwise query MapBox
  9142. if ( features.length > 0 )
  9143. {
  9144. featureSet = featureSet.concat( features );
  9145. }
  9146. else
  9147. {
  9148. var ids = [];
  9149. self._featureDataMap.filter( { type: _tileSet.type, tileSet: _tileSet.id, property: _tileSet.property } ).forEach( function( _item )
  9150. {
  9151. if ( _item[ _tileSet.property ] !== null )
  9152. ids.push( _item[ _tileSet.property ] );
  9153. } );
  9154. if ( ids.length > 0 )
  9155. {
  9156. var queriedFeatures = self._map.querySourceFeatures( _tileSet.id, {
  9157. sourceLayer: _tileSet.sourceLayer,
  9158. filter: [ "all", ["in", _tileSet.property].concat( ids ) ]
  9159. } );
  9160. featureSet = featureSet.concat( queriedFeatures );
  9161. }
  9162. }
  9163. }
  9164. } );
  9165. // quit when there are no featureSets
  9166. if ( !featureSet.length )
  9167. return;
  9168. // collect the geometry for all features
  9169. var allFeatures = {
  9170. "type": "FeatureCollection",
  9171. "features": []
  9172. };
  9173. featureSet.forEach( function( f )
  9174. {
  9175. allFeatures.features.push({
  9176. "type": "feature",
  9177. "geometry": f.geometry
  9178. } );
  9179. } );
  9180. // calculate the bounding box for all the features
  9181. var bbox = getBalancedBoundingBox( allFeatures );
  9182. var mapBbox = [
  9183. [ bbox[0], bbox[1] ],
  9184. [ bbox[2], bbox[3] ]
  9185. ]
  9186. this._fitBounds( mapBbox );
  9187. }
  9188. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._addStop = function(
  9189. _stopContainer,
  9190. _stopKey,
  9191. _stopValue )
  9192. {
  9193. if ( !_stopContainer.has( _stopValue ) )
  9194. {
  9195. _stopContainer.set( _stopValue, _stopKey );
  9196. }
  9197. else
  9198. {
  9199. var currValue = _stopContainer.get( _stopValue );
  9200. if ( !Array.isArray( currValue ) )
  9201. _stopContainer.set( _stopValue, [ currValue, _stopKey ] );
  9202. else
  9203. _stopContainer.get( _stopValue ).push( _stopKey );
  9204. }
  9205. },
  9206. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._buildStopsExpression = function(
  9207. _property,
  9208. _stops,
  9209. _default )
  9210. {
  9211. if ( !_stops || _stops.size() === 0 )
  9212. {
  9213. return _default;
  9214. }
  9215. var expression = [ "match", [ "to-string", [ "get", _property ] ] ];
  9216. // expression uses this syntax - https://docs.mapbox.com/mapbox-gl-js/style-spec/#expressions-match
  9217. // where label is either a single item or an array.
  9218. _stops.forEach( function( _key, _value )
  9219. {
  9220. expression.push( _value );
  9221. expression.push( _key );
  9222. } );
  9223. // add default
  9224. expression.push( _default );
  9225. return expression;
  9226. },
  9227. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._setupLayerStops = function()
  9228. {
  9229. // console.debug( "TiledMap::_setupLayerStops" );
  9230. var self = this;
  9231. if ( this._featureDataMap.size() )
  9232. {
  9233. // loop the tilesets
  9234. self._featureDataMap.getTileSets().forEach( function( _tileSet )
  9235. {
  9236. var fillStops = rave.map(); // Default colour used in the absence of a value. Should this be the "null" color?
  9237. var fillDarkStops = rave.map();
  9238. var circleColorStops = rave.map();
  9239. var circleDarkColorStops = rave.map();
  9240. var circleHighlightStops = rave.map();
  9241. var circleSizeStops = rave.map();
  9242. var layerId = _tileSet[_tileSet.layer];
  9243. var property = _tileSet.property;
  9244. // only add generate stops for tileSets with a propertyType
  9245. if ( _tileSet.propertyType )
  9246. {
  9247. // setup the stops for the data values of this
  9248. var featureDataItems = self._featureDataMap.filter( { tileSet: _tileSet.id, type: _tileSet.type, layer: layerId }, property );
  9249. for ( var idx = 0, size = featureDataItems.length; idx < size; ++idx )
  9250. {
  9251. var featureData = featureDataItems[ idx ];
  9252. var propertyVal = self._resolveProperty( featureData[ property ], featureData.propertyType );
  9253. // set region color stops
  9254. if ( featureData.hasOwnProperty( "fillColor" ) )
  9255. {
  9256. self._addStop( fillStops, propertyVal, featureData.fillColor );
  9257. self._addStop( fillDarkStops, propertyVal, "" + rave.rgb( featureData.fillColor ).darker() );
  9258. }
  9259. // set point color and size
  9260. if ( featureData.hasOwnProperty( "pointSize" ) )
  9261. {
  9262. self._addStop( circleColorStops, propertyVal, featureData.pointColor );
  9263. var darker = rave.rgb( featureData.pointColor ).darker();
  9264. // skip dark color stop for points with staticZeroValuePointSize applied
  9265. if ( !featureData.hasStaticZeroValuePointSize )
  9266. self._addStop( circleDarkColorStops, propertyVal, "" + darker );
  9267. self._addStop( circleHighlightStops, propertyVal, "" + darker.darker() );
  9268. self._addStop( circleSizeStops, propertyVal, featureData.pointSize );
  9269. }
  9270. }
  9271. }
  9272. var fillStopsExpression = self._buildStopsExpression( property, fillStops, "transparent" );
  9273. var fillDarkStopsExpression = self._buildStopsExpression( property, fillDarkStops, "transparent" );
  9274. var circleColorStopsExpression = self._buildStopsExpression( property, circleColorStops, "transparent" );
  9275. var circleDarkColorStopsExpression = self._buildStopsExpression( property, circleDarkColorStops, "transparent" );
  9276. var circleHighlightStopsExpression = self._buildStopsExpression( property, circleHighlightStops, "transparent" );
  9277. var circleSizeStopsExpression = self._buildStopsExpression( property, circleSizeStops, 0 );
  9278. switch( _tileSet.type )
  9279. {
  9280. case "region":
  9281. if ( _tileSet.tileType === "vector" )
  9282. {
  9283. // set stops for fill layer
  9284. self._map.setPaintProperty( layerId, "fill-color", fillStopsExpression );
  9285. // set focus layer stops
  9286. self._map.setPaintProperty( layerId + "Focus", "fill-color", fillStopsExpression );
  9287. // set stops for select layer
  9288. self._map.setPaintProperty( layerId + "Select", "line-color", fillDarkStopsExpression );
  9289. // set stops for hover layer
  9290. self._map.setPaintProperty( layerId + "Hover", "line-color", fillDarkStopsExpression );
  9291. }
  9292. else if ( _tileSet.tileType === "geojson" )
  9293. {
  9294. // set stops for point color
  9295. self._map.setPaintProperty( layerId, "circle-color", fillStopsExpression);
  9296. self._map.setPaintProperty( layerId, "circle-opacity", 1 - (_tileSet.transparency / 100.0) );
  9297. // set stops for point color
  9298. self._map.setPaintProperty( layerId + "Focus", "circle-color", fillStopsExpression );
  9299. self._map.setPaintProperty( layerId + "Focus", "circle-opacity", 1 - (_tileSet.transparency / 100.0) );
  9300. // set stops for hover layer
  9301. self._map.setPaintProperty( layerId + "Hover", "circle-stroke-color", fillDarkStopsExpression );
  9302. // set stops for select layer
  9303. self._map.setPaintProperty( layerId + "Select", "circle-stroke-color", fillDarkStopsExpression );
  9304. }
  9305. break;
  9306. case "point":
  9307. // set stops for point color
  9308. self._map.setPaintProperty( layerId, "circle-color", circleColorStopsExpression );
  9309. self._map.setPaintProperty( layerId, "circle-opacity", 1 - (_tileSet.transparency / 100.0) );
  9310. // set stops for point border
  9311. self._map.setPaintProperty( layerId, "circle-stroke-color", circleDarkColorStopsExpression );
  9312. // set stops for point size
  9313. self._map.setPaintProperty( layerId, "circle-radius", circleSizeStopsExpression );
  9314. // set stops for hover layer
  9315. self._map.setPaintProperty( layerId + "Hover", "circle-stroke-color", circleHighlightStopsExpression );
  9316. self._map.setPaintProperty( layerId + "Hover", "circle-radius", circleSizeStopsExpression );
  9317. break;
  9318. }
  9319. } );
  9320. }
  9321. }
  9322. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._resolveProperty = function( _value, _type )
  9323. {
  9324. if ( ( _value === null ) || ( typeof _value === "undefined" ) )
  9325. return _value;
  9326. if ( _type === "string" )
  9327. return String( _value );
  9328. if ( _type === "numeric" )
  9329. return Number( _value );
  9330. return _value;
  9331. }
  9332. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._clearMapsCache = function()
  9333. {
  9334. // console.debug( "TiledMap::_clearMapsCache" );
  9335. this._clearAddedResources();
  9336. this._featureDataMap.clear();
  9337. this._selectedItems = rave.set();
  9338. this._highlights = { items: [] };
  9339. }
  9340. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.accessToken = function(accessToken)
  9341. {
  9342. // console.debug( "TiledMap::accessToken" );
  9343. if (accessToken != this._mapboxToken) {
  9344. this._mapboxToken = accessToken;
  9345. }
  9346. }
  9347. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.mapStyle = function(style)
  9348. {
  9349. // console.debug( "TiledMap::mapStyle" );
  9350. if ( style !== this._mapboxStyle )
  9351. {
  9352. var self = this;
  9353. this._mapboxStyle = style;
  9354. this._mapboxStyleDirty = true;
  9355. this._map.setStyle( style );
  9356. }
  9357. else if ( !this._mapLoaded )
  9358. {
  9359. this._map.once( "load", this._updateMapLayout.bind( this ) );
  9360. }
  9361. else
  9362. {
  9363. this._updateMapLayout();
  9364. }
  9365. }
  9366. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._updateMapLayout = function()
  9367. {
  9368. // console.debug( "TiledMap::_updateMapLayout" );
  9369. if ( this._addedResources.size() > 0 )
  9370. this._setupLayerStops();
  9371. else
  9372. this._loadLayers();
  9373. }
  9374. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.deselectAllAction = function()
  9375. {
  9376. // console.debug( "TiledMap::deselectAllAction" );
  9377. if( !this._mapLoaded || !this._featureDataMap.size() )
  9378. return;
  9379. var self = this;
  9380. var type = "region";
  9381. this._featureDataMap.getTileSets( { type: type } ).forEach( function( _tileSet )
  9382. {
  9383. var filter = [ "in", _tileSet.property, FILTER_NONE ];
  9384. self._map.setPaintProperty( _tileSet[_tileSet.layer], _tileSet.opacityProp, 1 - (_tileSet.transparency / 100.0) );
  9385. self._map.setFilter( _tileSet[_tileSet.layer] + "Select", filter );
  9386. self._map.setFilter( _tileSet[_tileSet.layer] + "Focus", filter );
  9387. } );
  9388. this._selectedItems = rave.set();
  9389. }
  9390. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.deselectAction = function( _deselections )
  9391. {
  9392. // console.debug( "TiledMap::deselectAction" );
  9393. if ( !this._mapLoaded )
  9394. this._map.once( "load", this._toggleSelect.bind( this, _deselections, false ) );
  9395. else
  9396. this._toggleSelect( _deselections, false );
  9397. }
  9398. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._updateSelectedItemFilters = function()
  9399. {
  9400. // console.debug( "TiledMap::_updateSelectedItemFilters" );
  9401. var self = this;
  9402. var type = "region";
  9403. this._featureDataMap.getTileSets( { type: type } ).forEach( function( _tileSet )
  9404. {
  9405. var filter = [ "in", _tileSet.property ];
  9406. self._selectedItems.forEach( function( _id )
  9407. {
  9408. var item = self._featureDataMap.getById( _id );
  9409. if ( item && ( _tileSet.id === item.tileSets[_tileSet.type].id ) )
  9410. filter.push( item[ _tileSet.property ] );
  9411. } );
  9412. if ( filter.length === 2 )
  9413. filter.push( FILTER_NONE );
  9414. self._map.setPaintProperty( _tileSet[_tileSet.layer], _tileSet.opacityProp, ( self._selectedItems.size() === 0 ) ? 1 - (_tileSet.transparency / 100.0) : 0.5 );
  9415. self._map.setFilter( _tileSet[_tileSet.layer] + "Select", filter );
  9416. self._map.setFilter( _tileSet[_tileSet.layer] + "Focus", filter );
  9417. } );
  9418. }
  9419. //list of features to select or deselect
  9420. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._toggleSelect = function( _selections, _select )
  9421. {
  9422. // console.debug( "TiledMap::_toggleSelect" );
  9423. if( !_selections || !_selections.items || !this._featureDataMap.size() )
  9424. return;
  9425. // determine item by layer
  9426. var itemsByLayer = this._getItemsByLayer( _selections );
  9427. if ( !itemsByLayer.size() )
  9428. return;
  9429. var self = this;
  9430. // update selected items
  9431. // (currently only regions support selection)
  9432. this._featureDataMap.getTileSets( { type: "region" } ).forEach( function( _tileSet )
  9433. {
  9434. var itemList = itemsByLayer.get( _tileSet.type );
  9435. // we might have caught points as well, skip them
  9436. if ( itemList )
  9437. {
  9438. if ( _select )
  9439. {
  9440. itemList.forEach( function( _item )
  9441. {
  9442. if ( ( _tileSet.id === _item.tileSets[_tileSet.type].id ) && !self._selectedItems.has( _item.id ) )
  9443. self._selectedItems.add( _item.id );
  9444. } );
  9445. }
  9446. else
  9447. {
  9448. itemList.forEach( function( _item )
  9449. {
  9450. if ( ( _tileSet.id === _item.tileSets[_tileSet.type].id ) && self._selectedItems.has( _item.id ) )
  9451. self._selectedItems.remove( _item.id );
  9452. } );
  9453. }
  9454. }
  9455. } );
  9456. this._updateSelectedItemFilters();
  9457. }
  9458. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.selectAction = function( _selections )
  9459. {
  9460. // console.debug( "TiledMap::selectAction" );
  9461. if ( !this._mapLoaded )
  9462. this._map.once( "load", this._toggleSelect.bind( this, _selections, true ) );
  9463. else
  9464. this._toggleSelect( _selections, true );
  9465. }
  9466. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.highlightAction = function( _highlights )
  9467. {
  9468. // console.debug( "TiledMap::highlightAction" );
  9469. if ( !this._mapLoaded || !_highlights || !this._featureDataMap.size() )
  9470. return;
  9471. var self = this;
  9472. // determine items
  9473. var itemsByLayer = this._getItemsByLayer( _highlights );
  9474. if ( ( itemsByLayer.size() === 0 ) && ( this._highlights.items.length === 0 ) )
  9475. return;
  9476. // (un)highlight
  9477. var baseFilter = [ "in" ];
  9478. var filter;
  9479. var itemList;
  9480. this._featureDataMap.getTileSets().forEach( function( _tileSet )
  9481. {
  9482. filter = baseFilter.concat( _tileSet.property );
  9483. itemList = [];
  9484. if ( itemsByLayer.has( _tileSet.type ) )
  9485. {
  9486. itemsByLayer.get( _tileSet.type ).forEach( function( _item )
  9487. {
  9488. if ( _item.tileSets[ _tileSet.type ] && ( _item.tileSets[ _tileSet.type ].id === _tileSet.id ) && ( _item[ _tileSet.property ] !== null ) )
  9489. {
  9490. itemList.push( _item[ _tileSet.property ] );
  9491. }
  9492. } );
  9493. }
  9494. filter = filter.concat( itemList.length ? itemList : FILTER_NONE );
  9495. self._map.setFilter( _tileSet[_tileSet.layer] + "Hover", filter );
  9496. } );
  9497. // remember highlighted items
  9498. this._highlights = _highlights;
  9499. }
  9500. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._getItemsByLayer = function( _query )
  9501. {
  9502. var self = this;
  9503. var itemsByLayer = rave.map();
  9504. var itemList;
  9505. if ( _query.items && _query.items.length )
  9506. {
  9507. _query.items.forEach( function( _item )
  9508. {
  9509. var dataLayer = self._getDataLayer( _item.dataSet );
  9510. // if there's no data layer, we're done
  9511. if ( !dataLayer )
  9512. return;
  9513. var layerType = dataLayer.getType();
  9514. var featureData = null;
  9515. // attempt an item resolve by id first
  9516. if ( _item.id )
  9517. featureData = self._featureDataMap.getById( _item.id );
  9518. // if featureData couldn't be retrieved by id, try to resolve by dataSet id and datum
  9519. if ( !featureData && _item.datum )
  9520. featureData = self._featureDataMap.getByKey( self._getFeatureKeyFromAssignedSlots( dataLayer, _item.datum ) );
  9521. if ( featureData )
  9522. {
  9523. dataLayer.typeData.forEach( function( _type, _typeData )
  9524. {
  9525. // check if there's a tile registered for this data layer
  9526. if ( featureData.tileSets[ _type ] )
  9527. {
  9528. if ( itemsByLayer.has( _type ) )
  9529. {
  9530. itemList = itemsByLayer.get( _type );
  9531. }
  9532. else
  9533. {
  9534. itemList = [];
  9535. itemsByLayer.set( _type, itemList )
  9536. }
  9537. itemList.push( featureData );
  9538. }
  9539. } );
  9540. }
  9541. } );
  9542. }
  9543. return itemsByLayer;
  9544. }
  9545. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.setup = function( _node, _nls )
  9546. {
  9547. // console.debug( "TiledMap::setup" );
  9548. var self = this;
  9549. this._nls = _nls;
  9550. // TODO: "resizeVizContainer" (I suspect) is a Dashboards-specific event name. This should be handled the same way all other bundles are resized (i.e. bundle should call resize() on a new render() call.
  9551. _node[0][0].addEventListener( "resizeVisContainer", function()
  9552. {
  9553. if (self._map) {
  9554. window.setTimeout( function()
  9555. {
  9556. self._map.resize();
  9557. }, 10 );
  9558. }
  9559. } );
  9560. }
  9561. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.off = function( _eventName, _callback )
  9562. {
  9563. // console.debug( "TiledMap::off - " + eventName );
  9564. // check eventName
  9565. switch ( _eventName )
  9566. {
  9567. case "maxZoomReached":
  9568. // remove callback from register
  9569. var pos = this._maxZoomCallbacks.indexOf( _callback );
  9570. if ( pos !== -1 )
  9571. {
  9572. this._maxZoomCallbacks.splice( pos, 1 );
  9573. // clean up if this was the last
  9574. if ( this._maxZoomCallbacks.length === 0 )
  9575. {
  9576. // unregister
  9577. this._map.off( "zoomstart", this._zoomStartHandler );
  9578. this._map.off( "zoomend", this._zoomEndHandler );
  9579. this._zoomStartHandler = null;
  9580. this._zoomEndHandler = null;
  9581. }
  9582. }
  9583. break;
  9584. case "mappingError":
  9585. // remove callback from register
  9586. var pos = this._mappingErrorCallbacks.indexOf( _callback );
  9587. if ( pos !== -1 )
  9588. this._mappingErrorCallbacks.splice( pos, 1 );
  9589. // remove map listeners
  9590. if ( this._mappingErrorCallbacks.length === 0 )
  9591. {
  9592. this._map.off( "error", this._onMapError );
  9593. this._map.off( "data", this._onMapData );
  9594. }
  9595. break;
  9596. default:
  9597. this._map.off( _eventName, _callback );
  9598. break;
  9599. }
  9600. }
  9601. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.on = function( _eventName, _callback )
  9602. {
  9603. // console.debug( "TiledMap::on - " + eventName );
  9604. // this._map.on(eventName, callback);
  9605. var self = this;
  9606. // check eventName
  9607. switch ( _eventName )
  9608. {
  9609. case "maxZoomReached":
  9610. // setup zoom handlers if this is the first callback
  9611. if ( !this._maxZoomCallbacks.length )
  9612. {
  9613. this._zoomStartHandler = function()
  9614. {
  9615. // mark zoom start
  9616. self._zoomStart = self._map.getZoom();
  9617. }
  9618. this._zoomEndHandler = function()
  9619. {
  9620. var zoomEnd = self._map.getZoom();
  9621. // invoke registered callbacks when maxZoom reached
  9622. if ( ( zoomEnd === self._zoomStart ) && ( zoomEnd === self._maxZoom ) )
  9623. self._maxZoomCallbacks.forEach( function( _clb ) { _clb(); } );
  9624. self._zoomStart = null;
  9625. }
  9626. // register handlers
  9627. this._map.on( "zoomstart", this._zoomStartHandler );
  9628. this._map.on( "zoomend", this._zoomEndHandler );
  9629. }
  9630. // register callback
  9631. if ( this._maxZoomCallbacks.indexOf( _callback ) === -1 )
  9632. this._maxZoomCallbacks.push( _callback );
  9633. break;
  9634. case "mappingError":
  9635. // register callback
  9636. if ( this._mappingErrorCallbacks.indexOf( _callback ) === -1 )
  9637. this._mappingErrorCallbacks.push( _callback );
  9638. if ( this._mappingErrorCallbacks.length === 1 )
  9639. {
  9640. this._map.on( "error", this._onMapError.bind( this ) );
  9641. this._map.on( "data", this._onMapData.bind( this ) );
  9642. }
  9643. break;
  9644. case "load":
  9645. case "style.load":
  9646. this._map.on( _eventName, _callback );
  9647. break;
  9648. default:
  9649. this._map.on( _eventName, function( _event )
  9650. {
  9651. var items = [];
  9652. if ( self._mapLoaded )
  9653. items = self._queryRenderedFeatures( _event.point );
  9654. _callback( {
  9655. items: items, // List of data/id combo's
  9656. _mapboxEvent: _event, // The mapbox event (TODO: Will this be necessary for anything?)
  9657. originalEvent: _event.originalEvent // The DOM event, useful for checking "if ctrl was held down", etc.
  9658. });
  9659. } );
  9660. break;
  9661. }
  9662. }
  9663. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.emit = function( _eventName, _data )
  9664. {
  9665. // check eventName
  9666. switch ( _eventName )
  9667. {
  9668. case "mappingError":
  9669. // invoke registered callbacks
  9670. this._mappingErrorCallbacks.forEach( function( _callback )
  9671. {
  9672. _callback( _data );
  9673. } );
  9674. break;
  9675. }
  9676. }
  9677. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.setMaxBounds = function( _lnglat )
  9678. {
  9679. // console.debug( "TiledMap::setMaxBounds" );
  9680. return; // this._map.setMaxBounds(lnglat);
  9681. }
  9682. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.setContainerRect = function( _rect )
  9683. {
  9684. // console.debug( "TiledMap::setContainerRect - [x: " + rect.x + ", y: " + rect.y + ", width: " + rect.width + ", height: " + rect.height + "]" );
  9685. this._containerRect = _rect;
  9686. // Update container dimensions
  9687. if (this._map) {
  9688. var self = this;
  9689. this._mapContainer
  9690. .style("left", this._containerRect.x + "px")
  9691. .style("top", this._containerRect.y + "px")
  9692. .style("width", this._containerRect.width + "px")
  9693. .style("height", this._containerRect.height + "px");
  9694. window.setTimeout( function() {
  9695. self._map.resize();
  9696. }, 10);
  9697. }
  9698. }
  9699. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.setMaxZoom = function( _maxZoom )
  9700. {
  9701. // console.debug( "TiledMap::setMaxZoom" );
  9702. this._maxZoom = _maxZoom;
  9703. this._map.setMaxZoom( _maxZoom );
  9704. }
  9705. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.setMaxPointSize = function( _maxPointSize )
  9706. {
  9707. // console.debug( "TiledMap::setMaxZoom" );
  9708. this._maxPointSize = _maxPointSize;
  9709. }
  9710. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.setMapLocale = function( _mapLocale )
  9711. {
  9712. // console.debug( "TiledMap::setMapLocale" );
  9713. if ( _mapLocale )
  9714. {
  9715. var mapLocale = _mapLocale.toLowerCase();
  9716. var pos = mapLocale.indexOf( "-" );
  9717. if ( pos > -1 )
  9718. mapLocale = mapLocale.substr( 0, pos );
  9719. switch ( mapLocale )
  9720. {
  9721. case "es":
  9722. case "fr":
  9723. case "de":
  9724. case "pt":
  9725. case "ru":
  9726. case "zh":
  9727. this._mapLocale = mapLocale;
  9728. break
  9729. case "en":
  9730. default:
  9731. this._mapLocale = "en";
  9732. break;
  9733. }
  9734. }
  9735. else
  9736. {
  9737. this._mapLocale = "en";
  9738. }
  9739. // set country labels
  9740. if ( this._mapLoaded )
  9741. this._applyMapLocale();
  9742. }
  9743. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._applyMapLocale = function()
  9744. {
  9745. if ( this._map.style.stylesheet )
  9746. {
  9747. var self = this;
  9748. var localizedField = "{name_" + this._mapLocale + "}";
  9749. var styleData = this._styleDataCache.get( this._mapboxStyle );
  9750. // collect style data
  9751. if ( !styleData )
  9752. {
  9753. styleData = { baseLayer: "", symbolLayers: [] };
  9754. this._map.style.stylesheet.layers.forEach( function( _layer )
  9755. {
  9756. if ( _layer.type === "symbol" )
  9757. {
  9758. // for baseLayer, we need the first symbol layer of the last consecutive symbol layers block.
  9759. if ( !styleData.baseLayer.length )
  9760. styleData.baseLayer = _layer.id;
  9761. styleData.symbolLayers.push( _layer.id );
  9762. self._setLocalizedField( _layer, localizedField );
  9763. }
  9764. else
  9765. {
  9766. // reset baseLayer, we've encountered a, none symbol layer after we set the baseLayer.
  9767. if ( styleData.baseLayer.length )
  9768. styleData.baseLayer = "";
  9769. }
  9770. } );
  9771. this._styleDataCache.set( this._mapboxStyle, styleData );
  9772. }
  9773. else
  9774. {
  9775. this._map.style.stylesheet.layers.forEach( function( _layer )
  9776. {
  9777. if ( _layer.type === "symbol" )
  9778. self._setLocalizedField( _layer, localizedField );
  9779. } );
  9780. }
  9781. }
  9782. }
  9783. /**
  9784. * Localize a text field in a map layer
  9785. * @param {Object} _layer A serialized MapBox layer
  9786. * @param {String} _localizedField The localized field
  9787. */
  9788. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._setLocalizedField = function( _layer, _localizedField )
  9789. {
  9790. var textField = ( _layer.layout && _layer.layout[ "text-field" ] ) || null;
  9791. // quit when textField doesn't exist
  9792. if ( !textField )
  9793. return;
  9794. // patch textfield
  9795. if ( ( typeof textField === "string" ) && reNameField.test( textField ) )
  9796. {
  9797. this._map.setLayoutProperty( _layer.id, "text-field", _localizedField );
  9798. }
  9799. else if ( ( typeof textField === "object" ) && textField.hasOwnProperty( "stops" ) )
  9800. {
  9801. var replacedStops = false;
  9802. var patchedStops = textField.stops.map( function( _stop )
  9803. {
  9804. if ( reNameField.test( _stop[1] ) )
  9805. {
  9806. replacedStops = true;
  9807. _stop[1] = _localizedField;
  9808. }
  9809. return _stop;
  9810. } );
  9811. if ( replacedStops )
  9812. {
  9813. textField.stops = patchedStops;
  9814. this._map.setLayoutProperty( _layer.id, "text-field", textField );
  9815. }
  9816. }
  9817. }
  9818. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.bindHandlers = function(context)
  9819. {
  9820. // console.debug( "TiledMap::bindHandlers" );
  9821. var self = this;
  9822. function eventName(name) {
  9823. return name + ".mapboxRebind"
  9824. }
  9825. var mouseEvents = [
  9826. "click",
  9827. "contextmenu",
  9828. "dblclick",
  9829. "mousedown",
  9830. "mousemove",
  9831. "mouseout",
  9832. "mouseup"
  9833. ];
  9834. var touchEvents = [
  9835. "touchcancel",
  9836. "touchend",
  9837. "touchmove",
  9838. "touchstart"
  9839. ];
  9840. var wheelEvents = [
  9841. "mousewheel",
  9842. "wheel"
  9843. ];
  9844. for (var e=0; e<mouseEvents.length; e++) {
  9845. context.on(eventName(mouseEvents[e]), function() {
  9846. var e = dispatchMouseEvent(rave.event.type);
  9847. });
  9848. }
  9849. for (var e=0; e<touchEvents.length; e++) {
  9850. context.on(eventName(touchEvents[e]), function() {
  9851. dispatchTouchEvent(rave.event.type);
  9852. });
  9853. }
  9854. for (var e=0; e<wheelEvents.length; e++) {
  9855. context.on(eventName(wheelEvents[e]), function() {
  9856. rave.event.preventDefault(); // Stop the window from scrolling.
  9857. dispatchWheelEvent(rave.event.type);
  9858. });
  9859. }
  9860. // TODO: Keyboard events don't originate from SVG elements (D3 samples usually listen for keyboard events on the document, separate from the SVG).
  9861. // self._svgOwner.on(eventName("keydown"), function() {
  9862. // dispatchKeyboardEvent(rave.event.type);
  9863. // });
  9864. function dispatchMouseEvent(name) {
  9865. var e;
  9866. if (typeof MouseEvent === "object") { // Internet Explorer just has to be a pain...
  9867. e = document.createEvent("MouseEvent");
  9868. e.initMouseEvent(name, false, false, null, 0, 0, 0, rave.event.clientX, rave.event.clientY, rave.event.ctrlKey, rave.event.altKey, rave.event.shiftKey, rave.event.metaKey, 0, null);
  9869. } else {
  9870. e = new MouseEvent(name, {
  9871. // bubbles
  9872. // cancellable
  9873. // view (don't know what this is...)
  9874. // button
  9875. // buttons
  9876. // relatedTarget
  9877. // region (don't know what this is...)
  9878. // screenX
  9879. // screenY
  9880. "clientX": rave.event.clientX,
  9881. "clientY": rave.event.clientY,
  9882. "ctrlKey": rave.event.ctrlKey,
  9883. "shiftKey": rave.event.shiftKey,
  9884. "altKey": rave.event.altKey,
  9885. "metaKey": rave.event.metaKey
  9886. });
  9887. }
  9888. self._map.getCanvasContainer().dispatchEvent(e);
  9889. }
  9890. function dispatchTouchEvent(name) {
  9891. if (typeof MouseEvent !== "object") { // Only dispatch touch events if we're not running in IE.
  9892. var e = new TouchEvent(name, {
  9893. // bubbles
  9894. // cancellable
  9895. // view (don't know what this is...)
  9896. // button
  9897. // buttons
  9898. // relatedTarget
  9899. // region (don't know what this is...)
  9900. // screenX
  9901. // screenY
  9902. "touches": rave.event.touches,
  9903. "targetTouches": rave.event.targetTouches,
  9904. "changedTouches": rave.event.changedTouches,
  9905. "ctrlKey": rave.event.ctrlKey,
  9906. "shiftKey": rave.event.shiftKey,
  9907. "altKey": rave.event.altKey,
  9908. "metaKey": rave.event.metaKey
  9909. });
  9910. self._map.getCanvasContainer().dispatchEvent(e);
  9911. }
  9912. }
  9913. function dispatchWheelEvent(name) {
  9914. var e;
  9915. if (typeof MouseEvent === "object") { // Internet Explorer just has to be a pain...
  9916. e = document.createEvent("WheelEvent");
  9917. var modifiers = ""; // TODO: Apparently this is supposed to be a space separated string of modifier keys (alt, ctrl, etc). Lets just not implement this until someone asks for it, or better yet, fix the actions framework to handle mapbox interactivity.
  9918. e.initWheelEvent(name, false, false, null, 0, 0, 0, rave.event.clientX, rave.event.clientY, 0, null, modifiers, rave.event.deltaX, rave.event.deltaY, rave.event.deltaZ, rave.event.deltaMode);
  9919. } else {
  9920. e = new WheelEvent(name, {
  9921. // bubbles
  9922. // cancellable
  9923. // view (don't know what this is...)
  9924. // button
  9925. // buttons
  9926. // relatedTarget
  9927. // region (don't know what this is...)
  9928. // screenX
  9929. // screenY
  9930. "clientX": rave.event.clientX,
  9931. "clientY": rave.event.clientY,
  9932. "deltaX": rave.event.deltaX,
  9933. "deltaY": rave.event.deltaY,
  9934. "deltaZ": rave.event.deltaZ,
  9935. "deltaMode": rave.event.deltaMode,
  9936. "ctrlKey": rave.event.ctrlKey,
  9937. "shiftKey": rave.event.shiftKey,
  9938. "altKey": rave.event.altKey,
  9939. "metaKey": rave.event.metaKey
  9940. });
  9941. }
  9942. self._map.getCanvasContainer().dispatchEvent(e);
  9943. }
  9944. // function dispatchKeyboardEvent(name) {
  9945. // var e = new KeyboardEvent(name, {
  9946. // // bubbles
  9947. // // cancellable
  9948. // // view (don't know what this is...)
  9949. // // button
  9950. // // buttons
  9951. // // relatedTarget
  9952. // // region (don't know what this is...)
  9953. // // screenX
  9954. // // screenY
  9955. // "key": rave.event.key,
  9956. // "code": rave.event.code,
  9957. // "location": rave.event.location,
  9958. // "repeat": rave.event.repeat,
  9959. // "isComposing": rave.event.isComposing,
  9960. // "charCode": rave.event.charCode,
  9961. // "keyCode": rave.event.keyCode,
  9962. // "which": rave.event.which,
  9963. // "ctrlKey": rave.event.ctrlKey,
  9964. // "shiftKey": rave.event.shiftKey,
  9965. // "altKey": rave.event.altKey,
  9966. // "metaKey": rave.event.metaKey
  9967. // });
  9968. // self._map.getCanvasContainer().dispatchEvent(e);
  9969. // return e;
  9970. // }
  9971. }
  9972. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._mapFeaturesToData = function( _dataDirty )
  9973. {
  9974. // console.debug( "TiledMap::_mapFeaturesToData" );
  9975. var self = this;
  9976. var lastData = null;
  9977. // Skip mapping if layers are missing.
  9978. if ( !( this._dataLayers && this._dataLayers.length ) )
  9979. return;
  9980. // refresh mapCache
  9981. this._mapCache.refreshCache( this._dataLayers );
  9982. // reset maps
  9983. if ( _dataDirty || ( this._mapCacheVersion !== this._mapCache.version ) )
  9984. {
  9985. this._featureDataMap.clear();
  9986. this._mapCacheVersion = this._mapCache.version;
  9987. }
  9988. // Skip mapping when the data doesn't contain geoData and there's no map data available
  9989. if ( !this._hasGeoDataLayer() && !this._mapCache.size() )
  9990. return;
  9991. var rebuild = ( this._featureDataMap.size() === 0 );
  9992. this._dataLayers.forEach( function( _dataLayer )
  9993. {
  9994. // check if layer has data && featureAccessors
  9995. if ( _dataLayer.data && _dataLayer.data.length && ( _dataLayer.featureAccessors.length > 0 ) )
  9996. {
  9997. var curLayerHasGeoData = self._dataLayerHasGeoData( _dataLayer );
  9998. // do we need to rebuild
  9999. if ( rebuild )
  10000. {
  10001. // check if layer has geo data
  10002. if ( curLayerHasGeoData )
  10003. {
  10004. // loop data
  10005. _dataLayer.data.forEach( function( _data )
  10006. {
  10007. self._featureDataMap.add( _dataLayer, _data );
  10008. } );
  10009. }
  10010. else
  10011. {
  10012. // loop data
  10013. _dataLayer.data.forEach( function( _data )
  10014. {
  10015. // only holds 1 (top) item per key
  10016. var featureKey = self._getFeatureKeyFromAssignedSlots( _dataLayer, _data );
  10017. var feature = self._mapCache.get( featureKey );
  10018. if ( feature )
  10019. {
  10020. if ( self._featureDataMap.hasFeature( featureKey ) )
  10021. self._featureDataMap.update( _dataLayer, _data, featureKey, feature );
  10022. else
  10023. self._featureDataMap.add( _dataLayer, _data, featureKey, feature );
  10024. }
  10025. } );
  10026. }
  10027. }
  10028. else
  10029. {
  10030. // update data layer properties
  10031. self._featureDataMap.updateDataLayerProperties( _dataLayer );
  10032. }
  10033. }
  10034. } );
  10035. }
  10036. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.setDataLayers = function( _dataLayers, _dataDirty, _combinedLayers )
  10037. {
  10038. // console.debug( "TiledMap::setDataLayers" );
  10039. if ( _dataDirty )
  10040. {
  10041. this._mapboxDataDirty = _dataDirty;
  10042. this._clearMapsCache();
  10043. }
  10044. this._featureDataMap.setCombinedLayers( _combinedLayers );
  10045. this._dataLayers = _dataLayers;
  10046. this._mapFeaturesToData( _dataDirty );
  10047. }
  10048. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._sortBySize = function( _renderedFeatures )
  10049. {
  10050. var self = this;
  10051. var featureA, featureB;
  10052. if ( _renderedFeatures && _renderedFeatures.length > 1 )
  10053. {
  10054. _renderedFeatures.sort( function( a, b ) {
  10055. featureA = self._featureDataMap.getById( a.id );
  10056. featureB = self._featureDataMap.getById( b.id );
  10057. if ( featureB && featureB.hasOwnProperty( "pointSize" ) && featureA
  10058. && featureA.hasOwnProperty( "pointSize" ) )
  10059. {
  10060. return featureA.pointSize - featureB.pointSize;
  10061. }
  10062. else
  10063. {
  10064. return 0;
  10065. }
  10066. });
  10067. }
  10068. return _renderedFeatures;
  10069. }
  10070. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.getItemsAtPoint = function( _point )
  10071. {
  10072. return this._queryRenderedFeatures( [ _point.x, _point.y ] );
  10073. }
  10074. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.getItemsInRect = function( _points )
  10075. {
  10076. return this._queryRenderedFeatures( [ [ _points[0].x, _points[0].y ], [ _points[1].x, _points[1].y ] ] );
  10077. }
  10078. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.getBoundingBox = function( _points )
  10079. {
  10080. var bounds = this._map.getBounds();
  10081. // translating bounds to points [ [ West, South ], [ East, North ] ]
  10082. return [ [ bounds._sw.lng, bounds._sw.lat ], [ bounds._ne.lng, bounds._ne.lat ] ];
  10083. }
  10084. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.setBoundingBox = function( _points )
  10085. {
  10086. // translating points [ [ West, South ], [ East, North ] ] to bounds [ [ South, West ], [ North, East ] ]
  10087. if ( _points && ( _points.length === 2 ) )
  10088. {
  10089. var bbox = [ { lng: _points[0][0], lat: _points[0][1] }, { lng: _points[1][0], lat: _points[1][1] } ]
  10090. if ( this._mapLoaded )
  10091. this._fitBounds( bbox );
  10092. else
  10093. this._mapBBox = bbox;
  10094. }
  10095. }
  10096. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.setAutoZoom = function( _autoZoom )
  10097. {
  10098. this._autoZoom = _autoZoom;
  10099. }
  10100. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype.dispose = function()
  10101. {
  10102. if ( this._map )
  10103. {
  10104. this._map.remove();
  10105. }
  10106. }
  10107. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._queryRenderedFeatures = function( _geometry )
  10108. {
  10109. var self = this;
  10110. var layersToQuery = [];
  10111. var items = [];
  10112. // collect query layers
  10113. this._featureDataMap.getTileSets().forEach( function( _tileSet )
  10114. {
  10115. layersToQuery.push( _tileSet[ _tileSet.layer ] );
  10116. } );
  10117. // if we have layers, query mapbox
  10118. if ( layersToQuery.length )
  10119. {
  10120. var features = _geometry ? this._map.queryRenderedFeatures( _geometry, { layers: layersToQuery } ) : [];
  10121. var duplicates = rave.set();
  10122. if ( features && features.length )
  10123. {
  10124. features.forEach( function( _feature )
  10125. {
  10126. var layerId = _feature.layer.id;
  10127. var sourceId = _feature.layer.source;
  10128. var featureData = null;
  10129. // lookup feature data
  10130. featureData = self._featureDataMap.getItem( sourceId, layerId, _feature.properties );
  10131. // check if there's data for the feature's layer
  10132. if ( featureData && featureData.data[ layerId ] )
  10133. {
  10134. items.push( {
  10135. id: featureData.id,
  10136. dataSet: featureData.dataSet[ layerId ],
  10137. datum: featureData.data[ layerId ]
  10138. } );
  10139. }
  10140. } );
  10141. }
  10142. }
  10143. // return the items or null
  10144. return this._sortBySize( items );
  10145. }
  10146. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._getFeatureKeyFromAssignedSlots = function( _dataLayer, _data )
  10147. {
  10148. if ( this._dataLayerHasGeoData( _dataLayer ) )
  10149. {
  10150. return this._getGeoFeatureKey( _dataLayer.getType(), this._getGeoData( _dataLayer, _data ) );
  10151. }
  10152. else
  10153. {
  10154. var keyParts = [];
  10155. // loop FeatureAccessors
  10156. _dataLayer.featureAccessors.forEach( function( _accessor )
  10157. {
  10158. if ( _accessor )
  10159. {
  10160. var value = _accessor( _data );
  10161. if ( value )
  10162. keyParts.push( _accessor( _data ) );
  10163. }
  10164. } );
  10165. return this._mapCache.getKey( _dataLayer.getType(), keyParts );
  10166. }
  10167. }
  10168. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._getGeoData = function( _dataLayer, _data )
  10169. {
  10170. return _dataLayer.featureAccessors[ 0 ]( _data );
  10171. }
  10172. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._getGeoFeatureKey = function( _type, _geoData )
  10173. {
  10174. var keyParts = [ _type ];
  10175. // The first featureAccessor holds the geoObject
  10176. Object.keys( _geoData ).forEach( function ( _key )
  10177. {
  10178. var value = _geoData[ _key ];
  10179. if ( value !== null )
  10180. keyParts.push( value );
  10181. } );
  10182. return keyParts.join( "|" );
  10183. }
  10184. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._getDataLayer = function( _type )
  10185. {
  10186. var dataLayer = null;
  10187. this._dataLayers.some( function( _dataLayer )
  10188. {
  10189. if ( _dataLayer.getType() === _type )
  10190. {
  10191. dataLayer = _dataLayer;
  10192. return true;
  10193. }
  10194. return false;
  10195. } );
  10196. return dataLayer;
  10197. }
  10198. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._addResource = function( _resource )
  10199. {
  10200. var resources = this._addedResources.get( _resource.type );
  10201. if ( !resources )
  10202. {
  10203. resources = [];
  10204. this._addedResources.set( _resource.type, resources );
  10205. }
  10206. resources.push( _resource );
  10207. }
  10208. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._removeResource = function( _id, _type )
  10209. {
  10210. var resources = this._addedResources.get( _type );
  10211. var resource;
  10212. var idx;
  10213. if ( resources )
  10214. {
  10215. // remove layers as well, when type was source
  10216. if ( _type === "source" )
  10217. {
  10218. var layerResources = this._addedResources.get( "layer" );
  10219. if ( layerResources )
  10220. {
  10221. for ( idx = layerResources.length - 1; idx >= 0; --idx )
  10222. {
  10223. resource = layerResources[ idx ];
  10224. if ( resource.source === _id )
  10225. {
  10226. this._map.removeLayer( resource.id );
  10227. layerResources.splice( idx, 1 );
  10228. }
  10229. }
  10230. // remove type when this was the past one
  10231. if ( layerResources.length === 0 )
  10232. this._addedResources.remove( "layer" );
  10233. }
  10234. }
  10235. // remove resource
  10236. for ( idx = resources.length - 1; idx >= 0; --idx )
  10237. {
  10238. resource = resources[ idx ];
  10239. if ( resource.id === _id )
  10240. {
  10241. if ( resource.type === "source" )
  10242. this._map.removeSource( resource.id )
  10243. else
  10244. this._map.removeLayer( resource.id );
  10245. resources.splice( idx, 1 );
  10246. break;
  10247. }
  10248. }
  10249. // remove type when this was the past one
  10250. if ( resources.length === 0 )
  10251. this._addedResources.remove( _type );
  10252. }
  10253. }
  10254. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._clearAddedResources = function()
  10255. {
  10256. var self = this;
  10257. if ( this._addedResources.has( "layer" ) )
  10258. this._addedResources.get( "layer" ).forEach( function( _resouce ) { self._map.removeLayer( _resouce.id ); } );
  10259. if ( this._addedResources.has( "source" ) )
  10260. this._addedResources.get( "source" ).forEach( function( _resouce ) { self._map.removeSource( _resouce.id ) } );
  10261. this._addedResources = rave.map();
  10262. }
  10263. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._fitBounds = function( _bounds )
  10264. {
  10265. // ease in to fit the bounds
  10266. try
  10267. {
  10268. var options = {
  10269. linear: true,
  10270. padding: this._maxPointSize + /*circle border*/2 + /*padding*/5,
  10271. easing: easing
  10272. };
  10273. // limit zoom when bounds consist of 1 point [0,0]
  10274. if ( ( _bounds[0][0] === 0 ) && ( _bounds[0][1] === 0 ) && ( _bounds[1][0] === 0 ) && ( _bounds[1][1] === 0 ) )
  10275. options.maxZoom = 4;
  10276. this._map.fitBounds( _bounds, options );
  10277. }
  10278. catch ( _err )
  10279. {
  10280. console.log( _err )
  10281. }
  10282. }
  10283. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._hasGeoDataLayer = function()
  10284. {
  10285. // check if there's a layer containing geodata
  10286. var self = this;
  10287. return this._dataLayers.some( function( _dataLayer )
  10288. {
  10289. return self._dataLayerHasGeoData( _dataLayer );
  10290. } );
  10291. }
  10292. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._dataLayerHasGeoData = function( _dataLayer )
  10293. {
  10294. // check if the data layer contains geodata
  10295. return _dataLayer.typeData.values().some( function( _typeData )
  10296. {
  10297. return _typeData.hasGeoData;
  10298. } );
  10299. }
  10300. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._endsWith = function( _source, _part )
  10301. {
  10302. return _source.indexOf( _part ) === ( _source.length - _part.length );
  10303. }
  10304. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._onMapError = function( _event )
  10305. {
  10306. // check if it's an error
  10307. if ( _event.type === "error" )
  10308. {
  10309. // check for invalid mapId's
  10310. var skipLog = false;
  10311. if ( _event.status && _event.sourceId && ( _event.status === 404 ) )
  10312. {
  10313. skipLog = true;
  10314. if ( !this._endsWith( _event.sourceId, "Action" ) )
  10315. {
  10316. this.emit( "mappingError", this._getErrorDetails( _event.sourceId, null, null, null ) );
  10317. // remove resources
  10318. this._removeResource( _event.sourceId, "source" )
  10319. this._removeResource( _event.sourceId + "Action", "source" )
  10320. }
  10321. }
  10322. else if ( _event.error )
  10323. {
  10324. var match = reLayerError.exec( _event.error );
  10325. if ( match )
  10326. {
  10327. // only notify <layerName>, skip <layerName>Select, <layerName>Focus and <layerName>Hover
  10328. if ( ( ( "region-" + match[1] ) === match[3] ) || ( ( "point-" + match[1] ) === match[3] ) )
  10329. {
  10330. this.emit( "mappingError", this._getErrorDetails( match[2], match[1], null, null ) );
  10331. this._removeResource( match[3], "layer" )
  10332. skipLog = true;
  10333. }
  10334. else if ( this._endsWith( match[3], "Select" ) || this._endsWith( match[3], "Focus" ) || this._endsWith( match[3], "Hover" ) )
  10335. {
  10336. this._removeResource( match[3], "layer" )
  10337. skipLog = true;
  10338. }
  10339. }
  10340. // ignore tile errors, they are common errors just indicating a specific tile is not available
  10341. // this is considered regular mapbox behavior, and can occur during scroll-zoom, fly/easeTo or
  10342. // when selecting features on different 'admin-levels' making some too small to show,
  10343. // eg. return a specific tile
  10344. else if ( _event.tile && ( _event.tile.state === "errored" ) )
  10345. {
  10346. skipLog = true;
  10347. }
  10348. }
  10349. // Mimic MapBox, and log error to console if it's not handled through the proper channels
  10350. if ( !skipLog )
  10351. console.error( ( _event && _event.error ) || _event || "Empty error event" );
  10352. }
  10353. }
  10354. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._onMapData = function( _event )
  10355. {
  10356. var updateMap = false;
  10357. // only check for our own sources
  10358. if ( ( _event.dataType === "source" ) && ( _event.sourceId !== "mapbox" ) && ( _event.sourceDataType === "metadata" ) )
  10359. {
  10360. // loop tilesets and check if the specified property is available
  10361. this._featureDataMap.getTileSets( { id: _event.sourceId } ).forEach( function( _tileSet )
  10362. {
  10363. if ( _tileSet.customPolygon )
  10364. {
  10365. var source = this._map.getSource( _event.sourceId );
  10366. // type = "vector"
  10367. if ( source && source.vectorLayers )
  10368. {
  10369. var layer;
  10370. for ( var idx = 0, size = source.vectorLayers.length; idx < size; ++idx )
  10371. {
  10372. layer = source.vectorLayers[ idx ];
  10373. if ( ( _tileSet.type + "-" + layer.id ) === _tileSet[ _tileSet.layer ] )
  10374. break;
  10375. layer = null;
  10376. };
  10377. if ( layer )
  10378. {
  10379. var fieldType = layer.fields[ _tileSet.property ];
  10380. if ( fieldType )
  10381. {
  10382. fieldType = fieldType.toLowerCase();
  10383. // validate numbers
  10384. if ( fieldType === "number" )
  10385. {
  10386. if ( this._validateNumeric( _tileSet ) )
  10387. {
  10388. _tileSet.propertyType = fieldType;
  10389. updateMap = true;
  10390. }
  10391. else
  10392. {
  10393. this.emit( "mappingError", this._getErrorDetails( _event.sourceId, layer.id, _tileSet.property, fieldType, _tileSet ) );
  10394. }
  10395. }
  10396. else
  10397. {
  10398. this._ensureString( _tileSet )
  10399. _tileSet.propertyType = fieldType;
  10400. updateMap = true;
  10401. }
  10402. }
  10403. else
  10404. {
  10405. this.emit( "mappingError", this._getErrorDetails( _event.sourceId, layer.id, _tileSet.property, null, _tileSet ) );
  10406. }
  10407. }
  10408. }
  10409. }
  10410. }, this );
  10411. }
  10412. // update the map if we found a valid layer info
  10413. if ( updateMap )
  10414. this._setupLayerStops();
  10415. }
  10416. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._validateNumeric = function( _tileSet )
  10417. {
  10418. // validate if the item's property value can be converted to the specified type
  10419. var featureDataItems = this._featureDataMap.filter( { tileSet: _tileSet.id, type: _tileSet.type, property: _tileSet.property } );
  10420. for ( var idx = 0, size = featureDataItems.length; idx < size; ++idx )
  10421. {
  10422. var featureData = featureDataItems[ idx ];
  10423. var propVal = featureData[ _tileSet.property ];
  10424. if ( isNaN( propVal ) )
  10425. return false;
  10426. featureData[ _tileSet.property ] = +propVal;
  10427. }
  10428. return true;
  10429. }
  10430. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._ensureString = function( _tileSet )
  10431. {
  10432. // validate if the item's property value can be converted to the specified type
  10433. var featureDataItems = this._featureDataMap.filter( { tileSet: _tileSet.id, type: _tileSet.type, property: _tileSet.property } );
  10434. for ( var idx = 0, size = featureDataItems.length; idx < size; ++idx )
  10435. {
  10436. var featureData = featureDataItems[ idx ];
  10437. var propVal = featureData[ _tileSet.property ];
  10438. if ( propVal )
  10439. featureData[ _tileSet.property ] = String( propVal );
  10440. }
  10441. }
  10442. com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl.prototype._getErrorDetails = function( _sourceId, _layerName, _propertyName, _propertyType, _tileSet )
  10443. {
  10444. var errorDetails = {
  10445. error: null,
  10446. dataSet: null,
  10447. property: null
  10448. }
  10449. // find the tileSet
  10450. var filter = { customPolygon: true };
  10451. if ( _sourceId )
  10452. filter.id = _sourceId;
  10453. var tileSets = _tileSet ? [ _tileSet ] : this._featureDataMap.getTileSets( filter );
  10454. tileSets.forEach( function( _tileSet )
  10455. {
  10456. // bail out on incorrect layerName
  10457. if ( _layerName && ( _tileSet.sourceLayer !== _layerName ) )
  10458. return;
  10459. if ( _tileSet.type === "region" )
  10460. {
  10461. errorDetails.dataSet = "data.region";
  10462. if ( _propertyType )
  10463. {
  10464. errorDetails.error = this._nls( "customPolygonPropertyConversionFailure" );
  10465. errorDetails.property = "region.custom.propertyName";
  10466. }
  10467. else if ( _propertyName )
  10468. {
  10469. errorDetails.error = this._nls( "invalidPropertyName" ) + _propertyName;
  10470. errorDetails.property = "region.custom.propertyName";
  10471. }
  10472. else if ( _layerName )
  10473. {
  10474. errorDetails.error = this._nls( "invalidLayerName" ) + _layerName;
  10475. errorDetails.property = "region.custom.layerName";
  10476. }
  10477. else
  10478. {
  10479. errorDetails.error = this._nls( "invalidMapId" ) + _sourceId;
  10480. errorDetails.property = "region.custom.mapId";
  10481. }
  10482. }
  10483. else
  10484. {
  10485. errorDetails.dataSet = "data.point";
  10486. if ( _propertyType )
  10487. {
  10488. errorDetails.error = this._nls( "customPolygonPropertyConversionFailure" );
  10489. errorDetails.property = "point.custom.propertyName";
  10490. }
  10491. else if ( _propertyName )
  10492. {
  10493. errorDetails.error = this._nls( "invalidPropertyName" ) + _propertyName;
  10494. errorDetails.property = "point.custom.propertyName";
  10495. }
  10496. else if ( _layerName )
  10497. {
  10498. errorDetails.error = this._nls( "invalidLayerName" ) + _layerName;
  10499. errorDetails.property = "point.custom.layerName";
  10500. }
  10501. else
  10502. {
  10503. errorDetails.error = this._nls( "invalidMapId" ) + _sourceId;
  10504. errorDetails.property = "point.custom.mapId";
  10505. }
  10506. }
  10507. }, this );
  10508. return errorDetails;
  10509. }
  10510. return com_ibm_rave_bundles_nativeImpl_components_TiledmapV2NativeSubComponentImpl;
  10511. }());
  10512. })();
  10513. },{"./configuration/configuration.json":1,"./i18n/messages_en.json":2,"./mapbox-gl.css":3,"./vizlibrary-tiledmap.css":5,"./vizlibrary.css":6}],5:[function(require,module,exports){
  10514. var css = ".vizlibrary-tiledmap .element-shape {\n stroke: white;\n stroke-width: 1;\n stroke-linejoin: round;\n fill-opacity: 1.0;\n}\n.vizlibrary-tiledmap .bubble {\n fill-opacity: 0.5;\n stroke: white;\n stroke-width: 1;\n pointer-events: none;\n}\n.vizlibrary-tiledmap .dark-label {\n fill: black;\n text-shadow: 1px 1px white;\n}\n.vizlibrary-tiledmap .light-label {\n fill: white;\n text-shadow: 1px 1px black;\n}\n.vizlibrary-tiledmap .label {\n font-size: 10pt;\n font-family: roboto, serif;\n pointer-events: none;\n}\n.vizlibrary-tiledmap path.flash {\n stroke: orange;\n}\n.vizlibrary-tiledmap .bubble.flash {\n stroke: orange;\n}\n.vizlibrary-tiledmap .mapboxgl-canvas-container .mapboxgl-canvas {\n left: 0px;\n top: 0px;\n}\n.vizlibrary-tiledmap.tiledmap-container .mapboxgl-ctrl-top-left,\n.vizlibrary-tiledmap.tiledmap-container .mapboxgl-ctrl-top-right,\n.vizlibrary-tiledmap.tiledmap-container .mapboxgl-ctrl-bottom-left,\n.vizlibrary-tiledmap.tiledmap-container .mapboxgl-ctrl-bottom-right {\n z-index: 0;\n}\n.vizlibrary-tiledmap .mapboxgl-ctrl-compass {\n display: none;\n}\n"; (require("browserify-css").createStyle(css, { "href": "dist/bundles/rave-library-tiledmapV2/node/rave-library-tiledmapV2/vizlibrary-tiledmap.css"})); module.exports = css;
  10515. },{"browserify-css":7}],6:[function(require,module,exports){
  10516. 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-tiledmapV2/node/rave-library-tiledmapV2/vizlibrary.css"})); module.exports = css;
  10517. },{"browserify-css":7}],7:[function(require,module,exports){
  10518. 'use strict';
  10519. // For more information about browser field, check out the browser field at https://github.com/substack/browserify-handbook#browser-field.
  10520. module.exports = {
  10521. // Create a <link> tag with optional data attributes
  10522. createLink: function(href, attributes) {
  10523. var head = document.head || document.getElementsByTagName('head')[0];
  10524. var link = document.createElement('link');
  10525. link.href = href;
  10526. link.rel = 'stylesheet';
  10527. for (var key in attributes) {
  10528. if ( ! attributes.hasOwnProperty(key)) {
  10529. continue;
  10530. }
  10531. var value = attributes[key];
  10532. link.setAttribute('data-' + key, value);
  10533. }
  10534. head.appendChild(link);
  10535. },
  10536. // Create a <style> tag with optional data attributes
  10537. createStyle: function(cssText, attributes) {
  10538. var head = document.head || document.getElementsByTagName('head')[0],
  10539. style = document.createElement('style');
  10540. style.type = 'text/css';
  10541. for (var key in attributes) {
  10542. if ( ! attributes.hasOwnProperty(key)) {
  10543. continue;
  10544. }
  10545. var value = attributes[key];
  10546. style.setAttribute('data-' + key, value);
  10547. }
  10548. if (style.sheet) { // for jsdom and IE9+
  10549. style.innerHTML = cssText;
  10550. style.sheet.cssText = cssText;
  10551. head.appendChild(style);
  10552. } else if (style.styleSheet) { // for IE8 and below
  10553. head.appendChild(style);
  10554. style.styleSheet.cssText = cssText;
  10555. } else { // for Chrome, Firefox, and Safari
  10556. style.appendChild(document.createTextNode(cssText));
  10557. head.appendChild(style);
  10558. }
  10559. }
  10560. };
  10561. },{}]},{},[4]);
  10562. return rave.library.bundle.extension('tiledmapV2Bundle');
  10563. }));