rave-library-boxplot.js 364 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755
  1. ;(function(root, factory) {
  2. if (typeof define === 'function' && define.amd) {
  3. define(['rave', 'rave-library', 'rave-utilities', 'rave-layouts', 'rave-legends'], factory);
  4. } else if (typeof exports === 'object') {
  5. module.exports = factory(require('rave'), require('rave-library'), require('rave-utilities'), require('rave-layouts'), require('rave-legends'));
  6. } else {
  7. root.raveLibraryBoxplot = factory(root.rave, root.raveLibrary, root.raveUtilities, root.raveLayouts, root.raveLegends);
  8. }
  9. }(this, function(rave, raveLibrary, raveUtilities, raveLayouts, raveLegends) {
  10. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  11. module.exports=[{"previews":{"image":[{"file":"resources\/preview_boxplot_small.png","tags":["small","notext"]}],"svg":[{"file":"resources\/preview_boxplot_small.svg","tags":["small","notext"]}]},"genericMeta":{"copyright":"IBM 2016","author":"IBM","description":"boxplot.description","id":"rave-library-boxplot","label":"boxplot.label","version":"1.0.0","tags":["boxplot"]}},{"datamodels":[{"description":"datamodel.tabular.boxplot.description","id":"tabular","label":"datamodel.tabular.label","datasets":[{"dataslots":[{"icon":{"image":"..\/rave-library\/resources\/x_axis_32.png","svg":"..\/rave-library\/resources\/x_axis_32.svg"},"description":"dataslot.x.boxplot.description","id":"x","label":"dataslot.x.label","cardinality":"1","datatypes":["string","numeric","date"],"tags":[]},{"icon":{"image":"..\/rave-library\/resources\/y_axis_32.png","svg":"..\/rave-library\/resources\/y_axis_32.svg"},"description":"dataslot.y.boxplot.description","id":"y","label":"dataslot.y.label","cardinality":"1","datatypes":["numeric"],"tags":[]},{"icon":{"image":"..\/rave-library\/resources\/color_by_32.png","svg":"..\/rave-library\/resources\/color_by_32.svg"},"description":"dataslot.color.description","id":"color","label":"dataslot.color.label","cardinality":"0..1","datatypes":["string"],"tags":[]},{"icon":{"image":"..\/rave-library\/resources\/primary_key_32.png","svg":"..\/rave-library\/resources\/primary_key_32.svg"},"description":"dataslot.key.description","id":"key","label":"dataslot.key.label","cardinality":"0..1","datatypes":["string","numeric"]}],"description":"dataset.tabular.description","id":"data","label":"dataset.tabular.label","type":"tabular","cardinality":"1","tags":["boxplot"]}],"tags":["boxplot"]}]},{"properties":{"boxplot":{"type":"object","properties":{"size":{"default":"10px","resetView":"layout","name":"boxplot.size.name","description":"boxplot.size.description","type":"length"},"median":{"type":"object","properties":{"style":{"type":"object","properties":{"stroke-width":{"default":null,"name":"boxplot.median.style.stroke-width.name","description":"boxplot.median.style.stroke-width.description","type":"length"},"stroke":{"default":null,"name":"boxplot.median.style.stroke.name","description":"boxplot.median.style.stroke.description","type":"color"}}}}},"mean":{"type":"object","properties":{"style":{"type":"object","properties":{"stroke-width":{"default":null,"name":"boxplot.mean.style.stroke-width.name","description":"boxplot.mean.style.stroke-width.description","type":"length"},"stroke":{"default":null,"name":"boxplot.mean.style.stroke.name","description":"boxplot.mean.style.stroke.description","type":"color"}}}}},"whisker":{"type":"object","properties":{"style":{"type":"object","properties":{"stroke-width":{"default":null,"name":"boxplot.whisker.style.stroke-width.name","description":"boxplot.whisker.style.stroke-width.description","type":"length"},"stroke":{"default":null,"name":"boxplot.whisker.style.stroke.name","description":"boxplot.whisker.style.stroke.description","type":"color"}}}}},"outlier":{"type":"object","properties":{"style":{"type":"object","properties":{"stroke-width":{"default":null,"name":"boxplot.outlier.style.stroke-width.name","description":"boxplot.outlier.style.stroke-width.description","type":"length"},"fill":{"default":null,"name":"boxplot.outlier.style.fill.name","description":"boxplot.outlier.style.fill.description","type":"color"},"stroke":{"default":null,"name":"boxplot.outlier.style.stroke.name","description":"boxplot.outlier.style.stroke.description","type":"color"}}}}},"applysize":{"trueLabel":"boxplot.applysize.trueLabel","default":false,"falseLabel":"boxplot.applysize.falseLabel","resetView":"layout","name":"boxplot.applysize.name","description":"boxplot.applysize.description","type":"boolean"},"style":{"type":"object","properties":{"stroke-width":{"default":null,"name":"boxplot.style.stroke-width.name","description":"boxplot.style.stroke-width.description","type":"length"},"fill":{"default":null,"name":"boxplot.style.fill.name","description":"boxplot.style.fill.description","type":"color"},"stroke":{"default":null,"name":"boxplot.style.stroke.name","description":"boxplot.style.stroke.description","type":"color"}}},"extremum":{"type":"object","properties":{"style":{"type":"object","properties":{"stroke-width":{"default":null,"name":"boxplot.extremum.style.stroke-width.name","description":"boxplot.extremum.style.stroke-width.description","type":"length"},"fill":{"default":null,"name":"boxplot.extremum.style.fill.name","description":"boxplot.extremum.style.fill.description","type":"color"},"stroke":{"default":null,"name":"boxplot.extremum.style.stroke.name","description":"boxplot.extremum.style.stroke.description","type":"color"}}}}}}},"data":{"type":"object","properties":{"handling":{"default":"None","resetView":"data","name":"data.handling.name","options":[{"id":"data.handling.options.None","value":"None"},{"id":"data.handling.options.Clustered","value":"Clustered"}],"description":"data.handling.description","type":"string"}}},"color":{"type":"object","properties":{"null":{"default":"silver","name":"color.null.name","description":"color.null.description","type":"color"},"palette":{"name":"color.palette.name","options":["categorical"],"description":"color.palette.description","type":"palette"}}},"effect":{"type":"object","properties":{"duration":{"default":1000,"min":0,"name":"effect.duration.name","description":"effect.duration.description","type":"numeric"},"name":{"default":"none","name":"effect.name.name","options":[{"id":"effect.name.options.none","value":"none"},{"id":"effect.name.options.transition","value":"transition"},{"id":"effect.name.options.grow","value":"grow"}],"description":"effect.name.description","type":"string"}}},"zoom":{"default":"all","resetView":"zoom","name":"zoom.name","options":[{"id":"zoom.options.both","value":"all"},{"id":"zoom.options.x","value":"x"},{"id":"zoom.options.y","value":"y"},{"id":"zoom.options.none","value":"none"}],"description":"zoom.description","type":"string"}}},{"properties":{"axis":{"type":"object","properties":{"labels":{"type":"object","properties":{"truncationText":{"default":"...","name":"axis.labels.truncationText.name","description":"axis.labels.truncationText.description","type":"string"}}}}}}},{"properties":{"layout":{"type":"object","properties":{"axissize":{"type":"object","properties":{"left":{"type":"object","properties":{"min":{"default":"65","resetView":"layout","name":"layout.axissize.left.min.name","description":"layout.axissize.left.min.description","type":"length"},"max":{"default":"65","resetView":"layout","name":"layout.axissize.left.max.name","description":"layout.axissize.left.max.description","type":"length"},"preferred":{"default":"65","resetView":"layout","name":"layout.axissize.left.preferred.name","description":"layout.axissize.left.preferred.description","type":"length"}}}}}}}}},{"properties":{"layout":{"type":"object","properties":{"axissize":{"type":"object","properties":{"bottom":{"type":"object","properties":{"min":{"default":"55","resetView":"layout","name":"layout.axissize.bottom.min.name","description":"layout.axissize.bottom.min.description","type":"length"},"max":{"default":"55","resetView":"layout","name":"layout.axissize.bottom.max.name","description":"layout.axissize.bottom.max.description","type":"length"},"preferred":{"default":"55","resetView":"layout","name":"layout.axissize.bottom.preferred.name","description":"layout.axissize.bottom.preferred.description","type":"length"}}}}}}}}},{"properties":{"layout":{"type":"object","properties":{"padding":{"default":"10","resetView":"layout","name":"layout.padding.name","description":"layout.padding.description","type":"padding"},"legendsize":{"type":"object","properties":{"min":{"default":"0","resetView":"layout","name":"layout.legendsize.min.name","description":"layout.legendsize.min.description","type":"length"},"max":{"default":"20%","resetView":"layout","name":"layout.legendsize.max.name","description":"layout.legendsize.max.description","type":"length"},"preferred":{"default":"20%","resetView":"layout","name":"layout.legendsize.preferred.name","description":"layout.legendsize.preferred.description","type":"length"}}},"legendchart":{"type":"object","properties":{"gap":{"default":"10","resetView":"layout","name":"layout.legendchart.gap.name","description":"layout.legendchart.gap.description","type":"length"},"align":{"default":false,"resetView":"layout","name":"layout.legendchart.align.name","description":"layout.legendchart.align.description","type":"boolean"}}},"chart":{"type":"object","properties":{"padding":{"type":"object","properties":{"top":{"default":"0","resetView":"layout","name":"layout.chart.padding.top.name","description":"layout.chart.padding.top.description","type":"length"},"left":{"default":"0","resetView":"layout","name":"layout.chart.padding.left.name","description":"layout.chart.padding.left.description","type":"length"},"bottom":{"default":"0","resetView":"layout","name":"layout.chart.padding.bottom.name","description":"layout.chart.padding.bottom.description","type":"length"},"right":{"default":"0","resetView":"layout","name":"layout.chart.padding.right.name","description":"layout.chart.padding.right.description","type":"length"}}}}}}}}},{"properties":{"background":{"type":"object","properties":{"elements":{"type":"object","properties":{"color":{"default":"#FFFFFF","name":"background.elements.color.name","description":"background.elements.color.description","type":"color"}}},"chart":{"type":"object","properties":{"color":{"default":"#FFFFFF","name":"background.chart.color.name","description":"background.chart.color.description","type":"color"}}}}}}},{"properties":{"legend":{"type":"object","properties":{"display":{"trueLabel":"legend.display.trueLabel","default":true,"falseLabel":"legend.display.falseLabel","resetView":"layout","name":"legend.display.name","description":"legend.display.description","type":"boolean"},"entrystyle":{"type":"object","properties":{"font":{"name":"legend.entrystyle.font.name","description":"legend.entrystyle.font.description","type":"font"}}},"position":{"default":"right","resetView":"layout","name":"legend.position.name","options":[{"id":"legend.position.options.top","value":"top"},{"id":"legend.position.options.bottom","value":"bottom"},{"id":"legend.position.options.right","value":"right"},{"id":"legend.position.options.left","value":"left"}],"description":"legend.position.description","type":"string"},"title":{"default":"","resetView":"layout","name":"legend.title.name","description":"legend.title.description","type":"string"},"titlestyle":{"type":"object","properties":{"fontfamily":{"default":null,"name":"legend.titlestyle.fontfamily.name","description":"legend.titlestyle.fontfamily.description","type":"string"},"fontsize":{"default":null,"resetView":"layout","name":"legend.titlestyle.fontsize.name","description":"legend.titlestyle.fontsize.description","type":"string"},"fill":{"default":null,"name":"legend.titlestyle.fill.name","description":"legend.titlestyle.fill.description","type":"color"},"font":{"resetView":"layout","name":"legend.titlestyle.font.name","description":"legend.titlestyle.font.description","type":"font"}}}}}}},{"properties":{"axis":{"type":"object","properties":{"x":{"type":"object","properties":{"ticks":{"type":"object","properties":{"display":{"trueLabel":"axis.x.ticks.display.trueLabel","default":false,"falseLabel":"axis.x.ticks.display.falseLabel","name":"axis.x.ticks.display.name","description":"axis.x.ticks.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#eeeeee","name":"axis.x.ticks.style.stroke.name","description":"axis.x.ticks.style.stroke.description","type":"color"}}}}},"line":{"type":"object","properties":{"display":{"trueLabel":"axis.x.line.display.trueLabel","default":false,"falseLabel":"axis.x.line.display.falseLabel","name":"axis.x.line.display.name","description":"axis.x.line.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#eeeeee","name":"axis.x.line.style.stroke.name","description":"axis.x.line.style.stroke.description","type":"color"}}}}},"labels":{"type":"object","properties":{"display":{"trueLabel":"axis.x.labels.display.trueLabel","default":true,"falseLabel":"axis.x.labels.display.falseLabel","resetView":"layout","name":"axis.x.labels.display.name","description":"axis.x.labels.display.description","type":"boolean"},"style":{"type":"object","properties":{"font-size":{"default":null,"resetView":"layout","name":"axis.x.labels.style.font-size.name","description":"axis.x.labels.style.font-size.description","type":"string"},"font-family":{"default":null,"name":"axis.x.labels.style.font-family.name","description":"axis.x.labels.style.font-family.description","type":"string"},"fill":{"default":"#3c4646","name":"axis.x.labels.style.fill.name","description":"axis.x.labels.style.fill.description","type":"color"},"font":{"resetView":"layout","name":"axis.x.labels.style.font.name","description":"axis.x.labels.style.font.description","type":"font"}}},"zoomPan":{"trueLabel":"axis.x.labels.zoomPan.trueLabel","default":false,"falseLabel":"axis.x.labels.zoomPan.falseLabel","name":"axis.x.labels.zoomPan.name","description":"axis.x.labels.zoomPan.description","type":"boolean"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"x":{"type":"object","properties":{"labels":{"type":"object","properties":{"allowRotate90":{"trueLabel":"axis.x.labels.allowRotate90.trueLabel","default":true,"falseLabel":"axis.x.labels.allowRotate90.falseLabel","resetView":"layout","name":"axis.x.labels.allowRotate90.name","description":"axis.x.labels.allowRotate90.description","type":"boolean"},"layoutMode":{"default":"automatic","resetView":"layout","name":"axis.x.labels.layoutMode.name","options":[{"id":"axis.x.labels.layoutMode.options.automatic","value":"automatic"},{"id":"axis.x.labels.layoutMode.options.horizontal","value":"horizontal"},{"id":"axis.x.labels.layoutMode.options.stagger","value":"stagger"},{"id":"axis.x.labels.layoutMode.options.rotate45","value":"rotate45"},{"id":"axis.x.labels.layoutMode.options.rotate90","value":"rotate90"}],"description":"axis.x.labels.layoutMode.description","type":"string"},"allowRotate45":{"trueLabel":"axis.x.labels.allowRotate45.trueLabel","default":true,"falseLabel":"axis.x.labels.allowRotate45.falseLabel","resetView":"layout","name":"axis.x.labels.allowRotate45.name","description":"axis.x.labels.allowRotate45.description","type":"boolean"},"allowStagger":{"trueLabel":"axis.x.labels.allowStagger.trueLabel","default":true,"falseLabel":"axis.x.labels.allowStagger.falseLabel","resetView":"layout","name":"axis.x.labels.allowStagger.name","description":"axis.x.labels.allowStagger.description","type":"boolean"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"x":{"type":"object","properties":{"title":{"type":"object","properties":{"display":{"trueLabel":"axis.x.title.display.trueLabel","default":true,"falseLabel":"axis.x.title.display.falseLabel","resetView":"layout","name":"axis.x.title.display.name","description":"axis.x.title.display.description","type":"boolean"},"style":{"type":"object","properties":{"font-size":{"default":null,"resetView":"layout","name":"axis.x.title.style.font-size.name","description":"axis.x.title.style.font-size.description","type":"string"},"font-family":{"default":null,"name":"axis.x.title.style.font-family.name","description":"axis.x.title.style.font-family.description","type":"string"},"fill":{"default":"#323c3c","name":"axis.x.title.style.fill.name","description":"axis.x.title.style.fill.description","type":"color"},"font":{"resetView":"layout","name":"axis.x.title.style.font.name","description":"axis.x.title.style.font.description","type":"font"}}},"text":{"default":"","resetView":"layout","name":"axis.x.title.text.name","description":"axis.x.title.text.description","type":"string"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"x":{"type":"object","properties":{"scale":{"type":"object","properties":{"includeZero":{"trueLabel":"axis.x.scale.includeZero.trueLabel","default":false,"falseLabel":"axis.x.scale.includeZero.falseLabel","resetView":"layout","name":"axis.x.scale.includeZero.name","description":"axis.x.scale.includeZero.description","type":"boolean"},"nice":{"trueLabel":"axis.x.scale.nice.trueLabel","default":false,"falseLabel":"axis.x.scale.nice.falseLabel","resetView":"layout","name":"axis.x.scale.nice.name","description":"axis.x.scale.nice.description","type":"boolean"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"x":{"type":"object","properties":{"gridlines":{"type":"object","properties":{"display":{"trueLabel":"axis.x.gridlines.display.trueLabel","default":false,"falseLabel":"axis.x.gridlines.display.falseLabel","name":"axis.x.gridlines.display.name","description":"axis.x.gridlines.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke-dasharray":{"default":null,"name":"axis.x.gridlines.style.stroke-dasharray.name","description":"axis.x.gridlines.style.stroke-dasharray.description","type":"dasharray"},"stroke":{"default":"#dfe9e9","name":"axis.x.gridlines.style.stroke.name","description":"axis.x.gridlines.style.stroke.description","type":"color"}}}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"y":{"type":"object","properties":{"ticks":{"type":"object","properties":{"display":{"trueLabel":"axis.y.ticks.display.trueLabel","default":false,"falseLabel":"axis.y.ticks.display.falseLabel","name":"axis.y.ticks.display.name","description":"axis.y.ticks.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#eeeeee","name":"axis.y.ticks.style.stroke.name","description":"axis.y.ticks.style.stroke.description","type":"color"}}}}},"line":{"type":"object","properties":{"display":{"trueLabel":"axis.y.line.display.trueLabel","default":false,"falseLabel":"axis.y.line.display.falseLabel","name":"axis.y.line.display.name","description":"axis.y.line.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke":{"default":"#eeeeee","name":"axis.y.line.style.stroke.name","description":"axis.y.line.style.stroke.description","type":"color"}}}}},"labels":{"type":"object","properties":{"display":{"trueLabel":"axis.y.labels.display.trueLabel","default":true,"falseLabel":"axis.y.labels.display.falseLabel","resetView":"layout","name":"axis.y.labels.display.name","description":"axis.y.labels.display.description","type":"boolean"},"style":{"type":"object","properties":{"font-size":{"default":null,"resetView":"layout","name":"axis.y.labels.style.font-size.name","description":"axis.y.labels.style.font-size.description","type":"string"},"font-family":{"default":null,"name":"axis.y.labels.style.font-family.name","description":"axis.y.labels.style.font-family.description","type":"string"},"fill":{"default":"#3c4646","name":"axis.y.labels.style.fill.name","description":"axis.y.labels.style.fill.description","type":"color"},"font":{"resetView":"layout","name":"axis.y.labels.style.font.name","description":"axis.y.labels.style.font.description","type":"font"}}},"zoomPan":{"trueLabel":"axis.y.labels.zoomPan.trueLabel","default":false,"falseLabel":"axis.y.labels.zoomPan.falseLabel","name":"axis.y.labels.zoomPan.name","description":"axis.y.labels.zoomPan.description","type":"boolean"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"y":{"type":"object","properties":{"title":{"type":"object","properties":{"display":{"trueLabel":"axis.y.title.display.trueLabel","default":true,"falseLabel":"axis.y.title.display.falseLabel","resetView":"layout","name":"axis.y.title.display.name","description":"axis.y.title.display.description","type":"boolean"},"style":{"type":"object","properties":{"font-size":{"default":null,"resetView":"layout","name":"axis.y.title.style.font-size.name","description":"axis.y.title.style.font-size.description","type":"string"},"font-family":{"default":null,"name":"axis.y.title.style.font-family.name","description":"axis.y.title.style.font-family.description","type":"string"},"fill":{"default":"#323c3c","name":"axis.y.title.style.fill.name","description":"axis.y.title.style.fill.description","type":"color"},"font":{"resetView":"layout","name":"axis.y.title.style.font.name","description":"axis.y.title.style.font.description","type":"font"}}},"text":{"default":"","resetView":"layout","name":"axis.y.title.text.name","description":"axis.y.title.text.description","type":"string"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"y":{"type":"object","properties":{"scale":{"type":"object","properties":{"includeZero":{"trueLabel":"axis.y.scale.includeZero.trueLabel","default":false,"falseLabel":"axis.y.scale.includeZero.falseLabel","resetView":"layout","name":"axis.y.scale.includeZero.name","description":"axis.y.scale.includeZero.description","type":"boolean"},"nice":{"trueLabel":"axis.y.scale.nice.trueLabel","default":false,"falseLabel":"axis.y.scale.nice.falseLabel","resetView":"layout","name":"axis.y.scale.nice.name","description":"axis.y.scale.nice.description","type":"boolean"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"y":{"type":"object","properties":{"gridlines":{"type":"object","properties":{"display":{"trueLabel":"axis.y.gridlines.display.trueLabel","default":true,"falseLabel":"axis.y.gridlines.display.falseLabel","name":"axis.y.gridlines.display.name","description":"axis.y.gridlines.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke-dasharray":{"default":null,"name":"axis.y.gridlines.style.stroke-dasharray.name","description":"axis.y.gridlines.style.stroke-dasharray.description","type":"dasharray"},"stroke":{"default":"#dfe9e9","name":"axis.y.gridlines.style.stroke.name","description":"axis.y.gridlines.style.stroke.description","type":"color"}}}}}}}}}}},{"actions":[{"args":[],"icon":null,"options":[],"description":"actions.applyHighlight.description","binding":[{"event":"mouseover","target":".element-shape"}],"id":"highlight","label":"actions.applyHighlight.label","tags":[]},{"args":[],"icon":null,"options":[],"description":"actions.removeHighlight.description","binding":[{"event":"mouseout","target":".element-shape"}],"id":"unhighlight","label":"actions.removeHighlight.label","tags":[]},{"args":[],"icon":null,"options":[],"description":"actions.applySelection.description","binding":[{"event":"mouseover","target":".element-shape"}],"id":"select","label":"actions.applySelection.label","tags":[]},{"args":[],"icon":null,"options":[],"description":"actions.removeSelection.description","binding":[{"event":"mouseout","target":".element-shape"}],"id":"deselect","label":"actions.removeSelection.label","tags":[]},{"args":[],"icon":null,"options":[],"description":"actions.removeAllSelect.description","binding":[{"event":"click","target":".background"}],"id":"deselectAll","label":"actions.removeAllSelect.label","tags":[]},{"args":[],"icon":null,"options":[],"description":"actions.toggleSelect.description","binding":[{"event":"click","target":".element-shape"}],"id":"toggleSelect","label":"actions.toggleSelect.label","tags":[]},{"icon":null,"options":[],"description":"actions.zoom.description","binding":[],"id":"zoom","label":"actions.zoom.label","tags":[]}]},{"propertyPresentations":[{"presentationItems":[{"propertyID":"background.chart.color"},{"propertyID":"color.palette"},{"propertyID":"axis.x.title.text"},{"propertyID":"axis.y.title.text"},{"propertyID":"axis.x.title.display"},{"propertyID":"axis.y.title.display"},{"propertyID":"legend.display"},{"propertyID":"legend.position"},{"propertyID":"legend.title"}],"icon":"","description":"propertyPresentation.simple.description","id":"simple","label":"propertyPresentation.simple.label","tags":["Boxplot","Boxplot Properties Presentation","Simple","ca.dashboard"]},{"presentationItems":[{"propertyGroup":{"presentationItems":[{"propertyID":"background.chart.color"},{"propertyID":"background.elements.color"},{"propertyID":"color.palette"},{"propertyID":"layout.padding"}],"icon":"","description":"propertyPresentation.advanced.commonProperties.description","id":"commonProperties","label":"propertyPresentation.advanced.commonProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"boxplot.applysize"},{"propertyID":"boxplot.extremum.style.fill"},{"propertyID":"boxplot.extremum.style.stroke"},{"propertyID":"boxplot.extremum.style.stroke-width"},{"propertyID":"boxplot.mean.style.stroke"},{"propertyID":"boxplot.mean.style.stroke-width"},{"propertyID":"boxplot.outlier.style.fill"},{"propertyID":"boxplot.outlier.style.stroke"},{"propertyID":"boxplot.outlier.style.stroke-width"},{"propertyID":"boxplot.median.style.stroke"},{"propertyID":"boxplot.median.style.stroke-width"},{"propertyID":"boxplot.size"},{"propertyID":"boxplot.style.fill"},{"propertyID":"boxplot.style.stroke"},{"propertyID":"boxplot.style.stroke-width"},{"propertyID":"boxplot.whisker.style.stroke"},{"propertyID":"boxplot.whisker.style.stroke-width"},{"propertyID":"data.handling"}],"icon":"","description":"boxplot.propertyPresentation.advanced.boxplotSpecificProperties.description","id":"boxplotSpecificProperties","label":"boxplot.propertyPresentation.advanced.boxplotSpecificProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"axis.x.gridlines.display"},{"propertyID":"axis.x.gridlines.style.stroke"},{"propertyID":"axis.x.gridlines.style.stroke-dasharray"},{"propertyID":"axis.x.labels.display"},{"propertyID":"axis.x.labels.style.font"},{"propertyID":"axis.x.line.display"},{"propertyID":"axis.x.line.style.stroke"},{"propertyID":"axis.x.ticks.display"},{"propertyID":"axis.x.ticks.style.stroke"},{"propertyID":"axis.x.title.display"},{"propertyID":"axis.x.title.style.font"},{"propertyID":"axis.x.title.text"}],"icon":"","description":"propertyPresentation.advanced.xAxisProperties.description","id":"xAxisProperties","label":"propertyPresentation.advanced.xAxisProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"axis.y.gridlines.display"},{"propertyID":"axis.y.gridlines.style.stroke"},{"propertyID":"axis.y.gridlines.style.stroke-dasharray"},{"propertyID":"axis.y.labels.display"},{"propertyID":"axis.y.labels.style.font"},{"propertyID":"axis.y.line.display"},{"propertyID":"axis.y.line.style.stroke"},{"propertyID":"axis.y.ticks.display"},{"propertyID":"axis.y.ticks.style.stroke"},{"propertyID":"axis.y.title.display"},{"propertyID":"axis.y.title.style.font"},{"propertyID":"axis.y.title.text"}],"icon":"","description":"propertyPresentation.advanced.yAxisProperties.description","id":"yAxisProperties","label":"propertyPresentation.advanced.yAxisProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"legend.display"},{"propertyID":"legend.position"},{"propertyID":"layout.legendchart.gap"},{"propertyID":"layout.legendchart.align"},{"propertyID":"legend.title"},{"propertyID":"legend.titlestyle.font"},{"propertyID":"legend.entrystyle.font"}],"icon":"","description":"propertyPresentation.advanced.legendProperties.description","id":"legendProperties","label":"propertyPresentation.advanced.legendProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"effect.duration"},{"propertyID":"effect.name"}],"icon":"","description":"propertyPresentation.advanced.clientBehaviorProperties.description","id":"clientBehaviorProperties","label":"propertyPresentation.advanced.clientBehaviorProperties.label","tags":["ca.chart.definition.outputType=interactive"]}}],"icon":"","description":"propertyPresentation.advanced.description","id":"advanced","label":"propertyPresentation.advanced.label","tags":["Boxplot","Boxplot Properties Presentation","advanced","ca.reporting"]}]},{"configurations":[{"dataSlots":[{"dataTypes":["string"],"dataModelId":"tabular","dataSetId":"data","dataSlotId":"x","tags":["ca.chart.definition.categoryValues=indexedFull"]},{"dataTypes":["string"],"dataModelId":"tabular","dataSetId":"data","dataSlotId":"color","tags":["ca.chart.definition.categoryValues=indexedFull"]},{"dataTypes":["string"],"dataModelId":"tabular","dataSetId":"data","hidden":false,"dataSlotId":"key","cardinality":"1"}],"previews":{"image":[{"file":"resources\/boxplot_icon_48.png","tags":["small","nocolor"]},{"file":"resources\/boxplot_preview_320.png","tags":["medium","color"]},{"file":"resources\/boxplot_preview_500.png","tags":["large","nocolor"]}],"svg":[{"file":"resources\/boxplot_icon_48.svg","tags":["small","nocolor"]},{"file":"resources\/boxplot_preview_320.svg","tags":["medium","color"]},{"file":"resources\/boxplot_preview_500.svg","tags":["large","nocolor"]}]},"genericMeta":{"description":"boxplot.config.boxplot.description","id":"boxplot","label":"boxplot.config.boxplot.label","tags":["ca.reporting"]},"properties":[{"id":"effect.duration","value":500},{"id":"data.handling","value":"Clustered"},{"id":"background.chart.color","value":"transparent"},{"id":"background.elements.color","value":"transparent"},{"id":"layout.padding","value":"padding-top:10;padding-left:10;padding-bottom:10;padding-right:10"},{"id":"layout.axissize.bottom.min","value":"5"},{"id":"layout.axissize.bottom.preferred","value":"15%"},{"id":"layout.axissize.bottom.max","value":"200"},{"id":"layout.axissize.left.min","value":"5"},{"id":"layout.axissize.left.preferred","value":"15%"},{"id":"layout.axissize.left.max","value":"200"}]}]},{"build":"development","name":"rave-library-boxplot","description":"This is the IBM Rave boxplot bundle.","ignore":["bower.json"],"main":"bundle.js","version":"1.0.0","dependencies":{"rave-legends":"<2.0.0","rave-library":"<2.0.0","rave":"<3.0.0","rave-layouts":"<2.0.0","rave-utilities":"<2.0.0"}}]
  12. },{}],2:[function(require,module,exports){
  13. module.exports={
  14. "actions.applyHighlight.description": "Highlights a node.",
  15. "actions.applyHighlight.label": "Apply highlight action",
  16. "actions.applySelection.description": "Selects a node.",
  17. "actions.applySelection.label": "Apply selection action",
  18. "actions.args.attributes.description": "Optional map of attribute to value that is applied during the action.",
  19. "actions.args.attributes.label": "Optional attributes function argument",
  20. "actions.args.primaryAttributes.description": "Optional map of primary attributes that are applied during the action.",
  21. "actions.args.primaryAttributes.label": "Optional primary attributes function argument",
  22. "actions.args.primarySelector.description": "Primary selector for the nodes that the action is to apply to.",
  23. "actions.args.primarySelector.label": "Primary selector function argument",
  24. "actions.args.secondaryAttributes.description": "Optional map of secondary attributes that are applied during the action.",
  25. "actions.args.secondaryAttributes.label": "Optional secondary attributes function argument",
  26. "actions.args.secondarySelector.description": "Secondary selector for the nodes that the action is to apply to.",
  27. "actions.args.secondarySelector.label": "Secondary selector function argument",
  28. "actions.args.selector.description": "Selector of the node that the action will apply to.",
  29. "actions.args.selector.label": "Selector function argument",
  30. "actions.breadCrumb.description": "Navigates up and down in detail through a bread crumb.",
  31. "actions.breadCrumb.label": "Bread crumb navigation action",
  32. "actions.chord.selector.description": "Selector for the chords that the action will apply to.",
  33. "actions.chord.selector.label": "Selector function argument for chords",
  34. "actions.chord.toggleSelect.description": "Toggles selection on a chord.",
  35. "actions.chord.toggleSelect.label": "Toggle select on chord action",
  36. "actions.chordGroup.highlight.description": "Highlights a chord group and everything that is connected to it.",
  37. "actions.chordGroup.highlight.label": "Chord group highlight action",
  38. "actions.chordGroup.removeHighlight.description": "Removes highlights from a chord group and everything connected to it.",
  39. "actions.chordGroup.removeHighlight.label": "Chord group remove highlight action",
  40. "actions.chordGroup.selector.description": "Selector for the chord groups that the action will apply to.",
  41. "actions.chordGroup.selector.label": "Selector function argument for chord groups",
  42. "actions.drillDown.description": "Drills down to the next level of detail.",
  43. "actions.drillDown.label": "Drill down action",
  44. "actions.removeAllSelect.description": "Removes all selections from all nodes.",
  45. "actions.removeAllSelect.label": "Remove all selections action",
  46. "actions.removeHighlight.description": "Removes a highlight from a node.",
  47. "actions.removeHighlight.label": "Remove highlight action",
  48. "actions.removeSelection.description": "Removes a selection from a node.",
  49. "actions.removeSelection.label": "Remove selection action",
  50. "actions.toggleSelect.description": "Toggles the selection on a node.",
  51. "actions.toggleSelect.label": "Toggle selection action",
  52. "actions.zoom.args.panX.description": "The amount to pan in the x direction.",
  53. "actions.zoom.args.panX.label": "Zoom x pan amount function argument",
  54. "actions.zoom.args.panY.description": "The amount to pan in the y direction.",
  55. "actions.zoom.args.panY.label": "Zoom y pan amount function argument",
  56. "actions.zoom.args.scale.description": "The scale amount for the zoom action.",
  57. "actions.zoom.args.scale.label": "Zoom scale function argument",
  58. "actions.zoom.description": "Zoom action",
  59. "actions.zoom.label": "Zoom action",
  60. "actions.zoomPackedBubble.description": "Zoom for a packed bubble.",
  61. "actions.zoomPackedBubble.label": "Zoom packed bubble action",
  62. "axis.labels.truncationText.description": "The text that is placed at the end of labels to indicate truncation.",
  63. "axis.labels.truncationText.name": "Axis truncation text",
  64. "axis.x.gridlines.display.description": "Shows or hides the X-axis gridlines.",
  65. "axis.x.gridlines.display.falseLabel": "Hide",
  66. "axis.x.gridlines.display.name": "Show gridlines",
  67. "axis.x.gridlines.display.trueLabel": "Show",
  68. "axis.x.gridlines.style.stroke-dasharray.description": "The dash pattern that is applied to the X-axis gridlines.",
  69. "axis.x.gridlines.style.stroke-dasharray.name": "Gridline dash pattern",
  70. "axis.x.gridlines.style.stroke.description": "The color of the X-axis gridline.",
  71. "axis.x.gridlines.style.stroke.name": "Gridline color",
  72. "axis.x.labels.allowRotate45.description": "Enables or disables the rotate45 option for labels automatic layout.",
  73. "axis.x.labels.allowRotate45.falseLabel": "Disable rotate45 option",
  74. "axis.x.labels.allowRotate45.name": "Allow rotate 45",
  75. "axis.x.labels.allowRotate45.trueLabel": "Enable rotate45 option",
  76. "axis.x.labels.allowRotate90.description": "Enables or disables the rotate90 option for labels automatic layout.",
  77. "axis.x.labels.allowRotate90.falseLabel": "Disable rotate90 option",
  78. "axis.x.labels.allowRotate90.name": "Allow rotate 90",
  79. "axis.x.labels.allowRotate90.trueLabel": "Enable rotate90 option",
  80. "axis.x.labels.allowStagger.description": "Allows the stagger option for labels automatic layout.",
  81. "axis.x.labels.allowStagger.falseLabel": "X-axis do not allow stagger",
  82. "axis.x.labels.allowStagger.name": "Allow stagger",
  83. "axis.x.labels.allowStagger.trueLabel": "X-axis allow stagger",
  84. "axis.x.labels.display.description": "Shows or hides the X-axis labels.",
  85. "axis.x.labels.display.falseLabel": "Hide",
  86. "axis.x.labels.display.name": "Show labels",
  87. "axis.x.labels.display.trueLabel": "Show",
  88. "axis.x.labels.layoutMode.description": "Configure the layout mode for the X-axis labels.",
  89. "axis.x.labels.layoutMode.name": "Layout Mode",
  90. "axis.x.labels.layoutMode.options.automatic": "Automatic",
  91. "axis.x.labels.layoutMode.options.horizontal": "Horizontal",
  92. "axis.x.labels.layoutMode.options.rotate45": "Rotated 45 degrees",
  93. "axis.x.labels.layoutMode.options.rotate90": "Rotated 90 degrees",
  94. "axis.x.labels.layoutMode.options.stagger": "Stagger",
  95. "axis.x.labels.style.fill.description": "The color of X-axis labels.",
  96. "axis.x.labels.style.fill.name": "Label color",
  97. "axis.x.labels.style.font-family.description": "The font families of the X-axis labels.",
  98. "axis.x.labels.style.font-family.name": "Label font families",
  99. "axis.x.labels.style.font-size.description": "The size of X-axis labels (CSS size).",
  100. "axis.x.labels.style.font-size.name": "Label font size",
  101. "axis.x.labels.style.font.description": "The font properties of X-axis labels (CSS styles).",
  102. "axis.x.labels.style.font.name": "Label font",
  103. "axis.x.labels.zoomPan.description": "Shows or hides X-axis labels when panning and zooming.",
  104. "axis.x.labels.zoomPan.falseLabel": "Show",
  105. "axis.x.labels.zoomPan.name": "Label pan-zoom",
  106. "axis.x.labels.zoomPan.trueLabel": "Hide",
  107. "axis.x.line.display.description": "Shows or hides the X-axis line.",
  108. "axis.x.line.display.falseLabel": "Hide",
  109. "axis.x.line.display.name": "Show line",
  110. "axis.x.line.display.trueLabel": "Show",
  111. "axis.x.line.style.stroke.description": "The color of the X-axis line.",
  112. "axis.x.line.style.stroke.name": "Line color",
  113. "axis.x.scale.includeZero.description": "When set to Yes, includes 0 on the X-axis.",
  114. "axis.x.scale.includeZero.falseLabel": "Do not include",
  115. "axis.x.scale.includeZero.name": "Includes zero",
  116. "axis.x.scale.includeZero.trueLabel": "Include",
  117. "axis.x.scale.max.description": "The maximum value that appears on the X-axis.",
  118. "axis.x.scale.max.name": "Maximum value",
  119. "axis.x.scale.min.description": "The minimum value that appears on the X-axis.",
  120. "axis.x.scale.min.name": "Minimum value",
  121. "axis.x.scale.nice.description": "When set to Yes, uses nice endpoint values on the X-axis.",
  122. "axis.x.scale.nice.falseLabel": "Do not nice",
  123. "axis.x.scale.nice.name": "Nicing",
  124. "axis.x.scale.nice.trueLabel": "Apply nicing",
  125. "axis.x.ticks.display.description": "Shows or hides the X-axis tick marks.",
  126. "axis.x.ticks.display.falseLabel": "Hide",
  127. "axis.x.ticks.display.name": "Show ticks",
  128. "axis.x.ticks.display.trueLabel": "Show",
  129. "axis.x.ticks.style.stroke.description": "The color of the X-axis ticks.",
  130. "axis.x.ticks.style.stroke.name": "Tick color",
  131. "axis.x.title.display.description": "Shows or hides the X-axis title.",
  132. "axis.x.title.display.falseLabel": "Hide",
  133. "axis.x.title.display.name": "Show title",
  134. "axis.x.title.display.trueLabel": "Show",
  135. "axis.x.title.style.fill.description": "The color of the X-axis title.",
  136. "axis.x.title.style.fill.name": "Title color",
  137. "axis.x.title.style.font-family.description": "The font family names of the X-axis title.",
  138. "axis.x.title.style.font-family.name": "Title font families",
  139. "axis.x.title.style.font-size.description": "The X-axis title font size (CSS size).",
  140. "axis.x.title.style.font-size.name": "Title font size",
  141. "axis.x.title.style.font.description": "The X-axis title font properties (CSS style).",
  142. "axis.x.title.style.font.name": "Title font",
  143. "axis.x.title.text.description": "The title of the X-axis.",
  144. "axis.x.title.text.name": "Title",
  145. "axis.y.gridlines.display.description": "Shows or hides the Y-axis gridlines.",
  146. "axis.y.gridlines.display.falseLabel": "Hide",
  147. "axis.y.gridlines.display.name": "Show gridlines",
  148. "axis.y.gridlines.display.trueLabel": "Show",
  149. "axis.y.gridlines.style.stroke-dasharray.description": "The dash pattern that is applied to the Y-axis gridlines.",
  150. "axis.y.gridlines.style.stroke-dasharray.name": "Gridline dash pattern",
  151. "axis.y.gridlines.style.stroke.description": "The color of the Y-axis gridline.",
  152. "axis.y.gridlines.style.stroke.name": "Gridline color",
  153. "axis.y.labels.display.description": "Shows or hides the Y-axis labels.",
  154. "axis.y.labels.display.falseLabel": "Hide",
  155. "axis.y.labels.display.name": "Show labels",
  156. "axis.y.labels.display.trueLabel": "Show",
  157. "axis.y.labels.layoutMode.description": "Configure the layout mode for the Y-axis labels.",
  158. "axis.y.labels.layoutMode.name": "Layout Mode",
  159. "axis.y.labels.layoutMode.options.horizontal": "Horizontal",
  160. "axis.y.labels.layoutMode.options.rotate90": "Rotated 90 degrees",
  161. "axis.y.labels.style.fill.description": "The color of Y-axis labels.",
  162. "axis.y.labels.style.fill.name": "Label color",
  163. "axis.y.labels.style.font-family.description": "The font families of the Y-axis labels.",
  164. "axis.y.labels.style.font-family.name": "Label font families",
  165. "axis.y.labels.style.font-size.description": "The size of Y-axis labels (CSS size).",
  166. "axis.y.labels.style.font-size.name": "Label font size",
  167. "axis.y.labels.style.font.description": "The font properties of Y-axis labels (CSS styles).",
  168. "axis.y.labels.style.font.name": "Label font",
  169. "axis.y.labels.zoomPan.description": "Shows or hides Y-axis labels when panning and zooming.",
  170. "axis.y.labels.zoomPan.falseLabel": "Show",
  171. "axis.y.labels.zoomPan.name": "Label pan-zoom",
  172. "axis.y.labels.zoomPan.trueLabel": "Hide",
  173. "axis.y.line.display.description": "Shows or hides the Y-axis line.",
  174. "axis.y.line.display.falseLabel": "Hide",
  175. "axis.y.line.display.name": "Show line",
  176. "axis.y.line.display.trueLabel": "Show",
  177. "axis.y.line.style.stroke.description": "The color of the Y-axis line.",
  178. "axis.y.line.style.stroke.name": "Line color",
  179. "axis.y.scale.includeZero.description": "When set to Yes, includes 0 on the Y-axis.",
  180. "axis.y.scale.includeZero.falseLabel": "Do not include",
  181. "axis.y.scale.includeZero.name": "Includes zero",
  182. "axis.y.scale.includeZero.trueLabel": "Include",
  183. "axis.y.scale.max.description": "The maximum value that appears on the Y-axis.",
  184. "axis.y.scale.max.name": "Maximum value",
  185. "axis.y.scale.min.description": "The minimum value tha appears on the Y-axis.",
  186. "axis.y.scale.min.name": "Minimum value",
  187. "axis.y.scale.nice.description": "When set to Yes, uses nice endpoint values on the Y-axis.",
  188. "axis.y.scale.nice.falseLabel": "Do not nice",
  189. "axis.y.scale.nice.name": "Nicing",
  190. "axis.y.scale.nice.trueLabel": "Apply nicing",
  191. "axis.y.ticks.display.description": "Shows or hides the Y-axis tick marks.",
  192. "axis.y.ticks.display.falseLabel": "Hide",
  193. "axis.y.ticks.display.name": "Show ticks",
  194. "axis.y.ticks.display.trueLabel": "Show",
  195. "axis.y.ticks.style.stroke.description": "The color of the Y-axis ticks.",
  196. "axis.y.ticks.style.stroke.name": "Tick color",
  197. "axis.y.title.display.description": "Shows or hides the Y-axis title.",
  198. "axis.y.title.display.falseLabel": "Hide",
  199. "axis.y.title.display.name": "Show title",
  200. "axis.y.title.display.trueLabel": "Show",
  201. "axis.y.title.style.fill.description": "The color of the Y-axis title.",
  202. "axis.y.title.style.fill.name": "Title color",
  203. "axis.y.title.style.font-family.description": "The font family names of the Y-axis title.",
  204. "axis.y.title.style.font-family.name": "Title font families",
  205. "axis.y.title.style.font-size.description": "The size of the Y-axis title font (CSS size).",
  206. "axis.y.title.style.font-size.name": "Title font size",
  207. "axis.y.title.style.font.description": "The Y-axis title font properties (CSS styles).",
  208. "axis.y.title.style.font.name": "Title font",
  209. "axis.y.title.text.description": "The title of the Y-axis.",
  210. "axis.y.title.text.name": "Title",
  211. "background.chart.color.description": "The background color of the chart.",
  212. "background.chart.color.name": "Background color",
  213. "background.elements.color.description": "The background color behind the elements of the chart.",
  214. "background.elements.color.name": "Elements background color",
  215. "boxplot.applysize.description": "When set to Yes, the size of the box plots is controlled by ordinal data.",
  216. "boxplot.applysize.falseLabel": "Use column width",
  217. "boxplot.applysize.name": "Apply size to ordinal data",
  218. "boxplot.applysize.trueLabel": "Use size",
  219. "boxplot.config.boxplot.description": "Box plots show the statistical summary of a distribution of numbers, such as median values, upper and lower quartiles and outliers.",
  220. "boxplot.config.boxplot.label": "Box plot",
  221. "boxplot.description": "Box plots show the statistical summary of a distribution of numbers, such as median values, upper and lower quartiles and outliers.",
  222. "boxplot.extremum.style.fill.description": "The fill color that is applied to the box plot extreme outliers.",
  223. "boxplot.extremum.style.fill.name": "Extreme outlier fill color",
  224. "boxplot.extremum.style.stroke-width.description": "The width of the box plot extreme outliers.",
  225. "boxplot.extremum.style.stroke-width.name": "Extreme outlier width",
  226. "boxplot.extremum.style.stroke.description": "The color that is applied to the box plot extreme outliers.",
  227. "boxplot.extremum.style.stroke.name": "Extreme outlier color",
  228. "boxplot.label": "Box plot",
  229. "boxplot.mean.style.stroke-width.description": "The width of each box plot mean.",
  230. "boxplot.mean.style.stroke-width.name": "Mean stroke width",
  231. "boxplot.mean.style.stroke.description": "The color that is applied to each box plot mean.",
  232. "boxplot.mean.style.stroke.name": "Mean color",
  233. "boxplot.median.style.stroke-width.description": "The width of the box plot median strokes.",
  234. "boxplot.median.style.stroke-width.name": "Median stroke width",
  235. "boxplot.median.style.stroke.description": "The color that is applied to each box plot median.",
  236. "boxplot.median.style.stroke.name": "Median color",
  237. "boxplot.outlier.style.fill.description": "The fill color that is applied to the box plot outliers.",
  238. "boxplot.outlier.style.fill.name": "Outlier fill color",
  239. "boxplot.outlier.style.stroke-width.description": "The width of the box plot outliers.",
  240. "boxplot.outlier.style.stroke-width.name": "Outlier width",
  241. "boxplot.outlier.style.stroke.description": "The color that is applied to the box plot outliers.",
  242. "boxplot.outlier.style.stroke.name": "Outlier color",
  243. "boxplot.propertyPresentation.advanced.boxplotSpecificProperties.description": "Box plot-specific properties",
  244. "boxplot.propertyPresentation.advanced.boxplotSpecificProperties.label": "Box plot",
  245. "boxplot.size.description": "The width, in pixels, of box plots when continuous data is used.",
  246. "boxplot.size.name": "Size",
  247. "boxplot.style.fill.description": "The fill color that is applied to the box plots.",
  248. "boxplot.style.fill.name": "Fill color",
  249. "boxplot.style.stroke-width.description": "The width of the box plot strokes.",
  250. "boxplot.style.stroke-width.name": "Stroke width",
  251. "boxplot.style.stroke.description": "The color that is applied to the box plot strokes.",
  252. "boxplot.style.stroke.name": "Stroke color",
  253. "boxplot.whisker.style.stroke-width.description": "The width of the box plot whiskers.",
  254. "boxplot.whisker.style.stroke-width.name": "Whisker stroke width",
  255. "boxplot.whisker.style.stroke.description": "The color that is applied to the box plot whiskers.",
  256. "boxplot.whisker.style.stroke.name": "Whisker color",
  257. "color.null.description": "The color palette that controls the colors or patterns that are applied to null values.",
  258. "color.null.name": "Color palette null value",
  259. "color.palette.description": "The color palette that controls the colors or patterns that are applied to data elements in the chart.",
  260. "color.palette.name": "Color palette",
  261. "data.handling.description": "The configuration that is used to plot the data.",
  262. "data.handling.name": "Configuration",
  263. "data.handling.options.Clustered": "Clustered",
  264. "data.handling.options.None": "None",
  265. "datamodel.hierarchial.label": "Hierarchical data model",
  266. "datamodel.tabular.boxplot.description": "The tabular data model for the box plot.",
  267. "datamodel.tabular.label": "Tabular data model",
  268. "dataset.hierarchial.label": "Hierarchical data set",
  269. "dataset.tabular.description": "The tabular data set of rows and columns.",
  270. "dataset.tabular.label": "Tabular data set",
  271. "dataset.tabular.link.description": "Determines the links between the nodes.",
  272. "dataset.tabular.link.label": "Tabular links data set",
  273. "dataset.tabular.node.description": "The tabular data set that defines the nodes.",
  274. "dataset.tabular.node.label": "Tabular node data set",
  275. "dataslot.categories.label": "Categories",
  276. "dataslot.category.label": "Category",
  277. "dataslot.children.description": "When applied to a tree node, returns the children of that node as an array-list.",
  278. "dataslot.children.label": "Children",
  279. "dataslot.color.description": "Determines the color of the shape.",
  280. "dataslot.color.label": "Color",
  281. "dataslot.key.description": "Called for each row to match elements. Primarily used for transitions.",
  282. "dataslot.key.label": "Key",
  283. "dataslot.label.description": "Determines the label of the shape.",
  284. "dataslot.label.label": "Label",
  285. "dataslot.maximumValue.label": "Maximum value",
  286. "dataslot.source.label": "Source",
  287. "dataslot.sourceValue.label": "Source value",
  288. "dataslot.tabular.id.description": "The identifier for the nodes.",
  289. "dataslot.tabular.id.label": "Identifier",
  290. "dataslot.tabular.size.description": "Determines the size of the shape.",
  291. "dataslot.tabular.size.label": "Size",
  292. "dataslot.target.label": "Target",
  293. "dataslot.targetValue.label": "Target value",
  294. "dataslot.value.label": "Value",
  295. "dataslot.x.boxplot.description": "The x coordinate of the box plot. The value can be a number, string, or date.",
  296. "dataslot.x.label": "X axis",
  297. "dataslot.y.boxplot.description": "The y coordinate of the box plot. The value must be a number.",
  298. "dataslot.y.label": "Y axis",
  299. "defaultPalette.description": "Rave2 default description",
  300. "defaultPalette.label": "Rave2 default",
  301. "effect.duration.description": "The animation duration, in ms.",
  302. "effect.duration.name": "Animation duration (ms)",
  303. "effect.name.description": "The effect that is used when the chart is drawn.",
  304. "effect.name.name": "Animation",
  305. "effect.name.options.grow": "Grow",
  306. "effect.name.options.none": "None",
  307. "effect.name.options.transition": "Transition",
  308. "layout.axissize.bottom.max.description": "The maximum size of the bottom axis, as a CSS size or percentage.",
  309. "layout.axissize.bottom.max.name": "Bottom axis maximum size",
  310. "layout.axissize.bottom.min.description": "The minimum size of the bottom axis, as a CSS size or percentage.",
  311. "layout.axissize.bottom.min.name": "Bottom axis minimum size",
  312. "layout.axissize.bottom.preferred.description": "The preferred size of the bottom axis, as a CSS size or percentage.",
  313. "layout.axissize.bottom.preferred.name": "Bottom axis preferred size",
  314. "layout.axissize.left.max.description": "The maximum size of the left axis, as a CSS size or percentage.",
  315. "layout.axissize.left.max.name": "Left axis maximum size",
  316. "layout.axissize.left.min.description": "The minimum size of the left axis, as a CSS size or percentage.",
  317. "layout.axissize.left.min.name": "Left axis minimum size",
  318. "layout.axissize.left.preferred.description": "The preferred size of the left axis, as a CSS size or percentage.",
  319. "layout.axissize.left.preferred.name": "Left axis preferred size",
  320. "layout.axissize.right.max.description": "The maximum size of the right axis, as a CSS size or percentage.",
  321. "layout.axissize.right.max.name": "Right axis maximum size",
  322. "layout.axissize.right.min.description": "The minimum size of the right axis, as a CSS size or percentage.",
  323. "layout.axissize.right.min.name": "Right axis minimum size",
  324. "layout.axissize.right.preferred.description": "The preferred size of the right axis, as a CSS size or percentage.",
  325. "layout.axissize.right.preferred.name": "Right axis preferred size",
  326. "layout.axissize.top.max.description": "The maximum size of the top axis, as a CSS size or percentage.",
  327. "layout.axissize.top.max.name": "Top axis maximum size",
  328. "layout.axissize.top.min.description": "The minimum size of the top axis, as a CSS size or percentage.",
  329. "layout.axissize.top.min.name": "Top axis minimum size",
  330. "layout.axissize.top.preferred.description": "The preferred size of the top axis, as a CSS size or percentage.",
  331. "layout.axissize.top.preferred.name": "Top axis preferred size",
  332. "layout.chart.padding.bottom.description": "The bottom padding for the chart.",
  333. "layout.chart.padding.bottom.name": "Bottom padding",
  334. "layout.chart.padding.left.description": "The left padding for the chart.",
  335. "layout.chart.padding.left.name": "Left padding",
  336. "layout.chart.padding.right.description": "Right padding for the chart.",
  337. "layout.chart.padding.right.name": "Right padding",
  338. "layout.chart.padding.top.description": "The top padding for the chart.",
  339. "layout.chart.padding.top.name": "Top padding",
  340. "layout.legendchart.align.description": "Whether to align the legend to the interior of the chart.",
  341. "layout.legendchart.align.name": "Align legend to chart",
  342. "layout.legendchart.gap.description": "Space between the chart and the legend, as a CSS size or percentage.",
  343. "layout.legendchart.gap.name": "Space between legend and chart",
  344. "layout.legendsize.max.description": "The maximum size of the legend, as a CSS size or percentage.",
  345. "layout.legendsize.max.name": "Maximum size",
  346. "layout.legendsize.min.description": "The minimum size of the legend, as a CSS size or percentage.",
  347. "layout.legendsize.min.name": "Minimum size",
  348. "layout.legendsize.preferred.description": "The preferred size of the legend, as a CSS size or percentage.",
  349. "layout.legendsize.preferred.name": "Preferred size",
  350. "layout.padding.description": "The padding around the chart and legend.",
  351. "layout.padding.name": "Padding",
  352. "legend.display.description": "Shows or hides the legend.",
  353. "legend.display.falseLabel": "Hide",
  354. "legend.display.name": "Show legend",
  355. "legend.display.trueLabel": "Show",
  356. "legend.entrystyle.font.description": "The font properties of the legend entry.",
  357. "legend.entrystyle.font.name": "Entry font",
  358. "legend.position.description": "The position of the legend in the chart.",
  359. "legend.position.name": "Legend position",
  360. "legend.position.options.bottom": "Bottom",
  361. "legend.position.options.left": "Left",
  362. "legend.position.options.right": "Right",
  363. "legend.position.options.top": "Top",
  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. "propertyPresentation.advanced.axisSizeProperties.description": "Axis size properties.",
  375. "propertyPresentation.advanced.axisSizeProperties.label": "Axis size",
  376. "propertyPresentation.advanced.clientBehaviorProperties.description": "Client side properties.",
  377. "propertyPresentation.advanced.clientBehaviorProperties.label": "Client behavior",
  378. "propertyPresentation.advanced.commonProperties.description": "Common properties.",
  379. "propertyPresentation.advanced.commonProperties.label": "Common",
  380. "propertyPresentation.advanced.description": "Advanced list of all properties in a grouped structure.",
  381. "propertyPresentation.advanced.label": "Advanced",
  382. "propertyPresentation.advanced.labelProperties.description": "Label properties",
  383. "propertyPresentation.advanced.labelProperties.label": "Label",
  384. "propertyPresentation.advanced.legendProperties.description": "Legend properties.",
  385. "propertyPresentation.advanced.legendProperties.label": "Legend",
  386. "propertyPresentation.advanced.xAxisProperties.description": "X-axis properties.",
  387. "propertyPresentation.advanced.xAxisProperties.label": "X-axis",
  388. "propertyPresentation.advanced.yAxisProperties.description": "Y-axis properties.",
  389. "propertyPresentation.advanced.yAxisProperties.label": "Y-axis",
  390. "propertyPresentation.simple.description": "Simple list of the most common properties.",
  391. "propertyPresentation.simple.label": "Simple",
  392. "rave2.colorpalette.blueContinuousSequential.description": "Blue continuous sequential description",
  393. "rave2.colorpalette.blueContinuousSequential.label": "Blue continuous sequential",
  394. "rave2.colorpalette.blueDiscreteSequential.description": "Blue discrete sequential description",
  395. "rave2.colorpalette.blueDiscreteSequential.label": "Blue discrete sequential",
  396. "rave2.colorpalette.blueGreenContinuousDivergent.description": "Blue green continuous divergent description",
  397. "rave2.colorpalette.blueGreenContinuousDivergent.label": "Blue green continuous divergent",
  398. "rave2.colorpalette.blueGreenDiscreteDivergent.description": "Blue green discrete divergent description",
  399. "rave2.colorpalette.blueGreenDiscreteDivergent.label": "Blue green discrete divergent",
  400. "rave2.colorpalette.dark.description": "Dark description",
  401. "rave2.colorpalette.dark.label": "Dark",
  402. "rave2.colorpalette.financial.description": "Financial description",
  403. "rave2.colorpalette.financial.label": "Financial",
  404. "rave2.colorpalette.greenContinuousSequential.description": "Green continuous sequential description",
  405. "rave2.colorpalette.greenContinuousSequential.label": "Green continuous sequential",
  406. "rave2.colorpalette.greenDiscreteSequential.description": "Green discrete sequential description",
  407. "rave2.colorpalette.greenDiscreteSequential.label": "Green discrete sequential",
  408. "rave2.colorpalette.light.description": "Light description",
  409. "rave2.colorpalette.light.label": "Light",
  410. "rave2.colorpalette.medical.description": "Medical description",
  411. "rave2.colorpalette.medical.label": "Medical",
  412. "rave2.colorpalette.orangeContinuousSequential.description": "Orange continuous sequential description",
  413. "rave2.colorpalette.orangeContinuousSequential.label": "Orange continuous sequential",
  414. "rave2.colorpalette.orangeDiscreteSequential.description": "Orange discrete sequential description",
  415. "rave2.colorpalette.orangeDiscreteSequential.label": " Orange discrete sequential",
  416. "rave2.colorpalette.purpleContinuousSequential.description": "Purple continuous sequential description",
  417. "rave2.colorpalette.purpleContinuousSequential.label": "Purple continuous sequential",
  418. "rave2.colorpalette.purpleDiscreteSequential.description": "Purple discrete sequential description",
  419. "rave2.colorpalette.purpleDiscreteSequential.label": "Purple discrete sequential",
  420. "rave2.colorpalette.redBlueContinuousDivergent.description": "Red blue continuous divergent description",
  421. "rave2.colorpalette.redBlueContinuousDivergent.label": "Red blue continuous divergent",
  422. "rave2.colorpalette.redBlueDiscreteDivergent.description": "Red blue discrete divergent description",
  423. "rave2.colorpalette.redBlueDiscreteDivergent.label": "Red blue discrete divergent",
  424. "rave2.colorpalette.redBlueInverseContinuousDivergent.description": "Red blue inverse continuous divergent description",
  425. "rave2.colorpalette.redBlueInverseContinuousDivergent.label": "Red blue inverse continuous divergent",
  426. "rave2.colorpalette.redBlueInverseDiscreteDivergent.description": "Red blue inverse discrete divergent description",
  427. "rave2.colorpalette.redBlueInverseDiscreteDivergent.label": "Red blue inverse discrete divergent",
  428. "rave2.colorpalette.redContinuousSequential.description": "Red continuous sequential description",
  429. "rave2.colorpalette.redContinuousSequential.label": "Red continuous sequential",
  430. "rave2.colorpalette.redDiscreteSequential.description": "Red discrete sequential description",
  431. "rave2.colorpalette.redDiscreteSequential.label": " Red discrete sequential",
  432. "rave2.colorpalette.redGreenContinuousDivergent.description": "Red green continuous divergent description",
  433. "rave2.colorpalette.redGreenContinuousDivergent.label": "Red green continuous divergent",
  434. "rave2.colorpalette.redGreenDiscreteDivergent.description": "Red green discrete divergent description",
  435. "rave2.colorpalette.redGreenDiscreteDivergent.label": "Red green discrete divergent",
  436. "rave2.colorpalette.redGreenInverseContinuousDivergent.description": "Red green inverse continuous divergent description",
  437. "rave2.colorpalette.redGreenInverseContinuousDivergent.label": "Red green inverse continuous divergent",
  438. "rave2.colorpalette.redGreenInverseDiscreteDivergent.description": "Red green inverse discrete divergent description",
  439. "rave2.colorpalette.redGreenInverseDiscreteDivergent.label": "Red green inverse discrete divergent",
  440. "rave2.colorpalette.tealContinuousSequential.description": "Teal continuous sequential description",
  441. "rave2.colorpalette.tealContinuousSequential.label": "Teal continuous sequential",
  442. "rave2.colorpalette.tealDiscreteSequential.description": "Teal discrete sequential description",
  443. "rave2.colorpalette.tealDiscreteSequential.label": "Teal discrete sequential",
  444. "rave2.colorpalette.tealPurpleContinuousDivergent.description": "Teal purple continuous divergent description",
  445. "rave2.colorpalette.tealPurpleContinuousDivergent.label": "Teal purple continuous divergent",
  446. "rave2.colorpalette.tealPurpleDiscreteDivergent.description": "Teal purple discrete divergent description",
  447. "rave2.colorpalette.tealPurpleDiscreteDivergent.label": "Teal purple discrete divergent",
  448. "rave2.colorpalette.violetContinuousSequential.description": "Violet continuous sequential description",
  449. "rave2.colorpalette.violetContinuousSequential.label": "Violet continuous sequential",
  450. "rave2.colorpalette.violetDiscreteSequential.description": "Violet discrete sequential description",
  451. "rave2.colorpalette.violetDiscreteSequential.label": "Violet discrete sequential",
  452. "rave2.colorpalette.yellowContinuousSequential.description": "Yellow continuous sequential description",
  453. "rave2.colorpalette.yellowContinuousSequential.label": "Yellow continuous sequential",
  454. "rave2.colorpalette.yellowDiscreteSequential.description": "Yellow discrete sequential description",
  455. "rave2.colorpalette.yellowDiscreteSequential.label": "Yellow discrete sequential",
  456. "zoom.description": "Zooms the chart in the X, Y, or both directions.",
  457. "zoom.name": "Zoom",
  458. "zoom.options.both": "Both",
  459. "zoom.options.none": "None",
  460. "zoom.options.x": "X",
  461. "zoom.options.y": "Y"
  462. }
  463. },{}],3:[function(require,module,exports){
  464. (function() {
  465. var $ = {};
  466. // $source: com/ibm/rave/bundles/internal/nativeImpl/BundleModuleHeader
  467. /************************************************************************
  468. ** IBM Confidential
  469. **
  470. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  471. **
  472. ** (C) Copyright IBM Corp. 2015
  473. **
  474. ** The source code for this program is not published or otherwise divested of its trade secrets,
  475. ** irrespective of what has been deposited with the U.S. Copyright Office.
  476. ************************************************************************/
  477. var com_ibm_rave_library_Library = rave["library"];
  478. rave["internal"]["Declare"] = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"];
  479. rave["internal"]["CSSUtil"]= rave["_"]["com_ibm_rave_core_internal_css_CSSUtil"];
  480. // $source: com/ibm/rave/bundles/RaveBundle
  481. /************************************************************************
  482. ** IBM Confidential
  483. **
  484. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  485. **
  486. ** (C) Copyright IBM Corp. 2017
  487. **
  488. ** The source code for this program is not published or otherwise divested of its trade secrets,
  489. ** irrespective of what has been deposited with the U.S. Copyright Office.
  490. ************************************************************************/
  491. // GENERATED
  492. //@import com/ibm/rave/bundles/internal/nativeImpl/RaveBundleResourceLoader (runtime) // new
  493. /**
  494. * A RaveBundle extends the regular Bundle abstract class but includes common functionality for Rave-made bundles that aren't for general use.
  495. */
  496. var com_ibm_rave_bundles_RaveBundle = rave['internal']['Declare'](rave['library']['internal']['Bundle'], {
  497. /** @expose */
  498. loader : null,
  499. /** @expose */
  500. constructor : function() {
  501. ;
  502. ;
  503. ;
  504. ;
  505. ;
  506. ;
  507. this.loader = new com_ibm_rave_bundles_internal_nativeImpl_RaveBundleResourceLoader("/com/ibm/rave/bundles/" + this.getName());
  508. },
  509. /**
  510. * Load extra resources required for this bundle. Currently the compiled configuration.json file. And .css.
  511. */
  512. /** @expose */
  513. loadResources : function() {
  514. this.setMessageCatalog(rave['library']['internal']['Bundle'].DEFAULT_LOCALE, require("./i18n/messages_en.json"));
  515. var array = require("./configuration/configuration.json");
  516. if (array) {
  517. for (var __i_enFor0 = 0, __exp_enFor0 = array, __len_enFor0 = __exp_enFor0.length;
  518. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  519. var artifact = __exp_enFor0[__i_enFor0];
  520. this.initialize(artifact);
  521. }
  522. }
  523. require("./vizlibrary.css");
  524. }
  525. });
  526. //com_ibm_rave_bundles_RaveBundle.CONFIGURATION_FILE = "./configuration/configuration.json";
  527. // $source: com/ibm/rave/bundles/internal/nativeImpl/RaveBundleResourceLoader
  528. // Intentionally empty - everything in this file is inlined
  529. var com_ibm_rave_bundles_internal_nativeImpl_RaveBundleResourceLoader = function(){};
  530. // $source: com/ibm/rave/bundles/views/BundleView
  531. /************************************************************************
  532. ** IBM Confidential
  533. **
  534. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  535. **
  536. ** (C) Copyright IBM Corp. 2017
  537. **
  538. ** The source code for this program is not published or otherwise divested of its trade secrets,
  539. ** irrespective of what has been deposited with the U.S. Copyright Office.
  540. ************************************************************************/
  541. // GENERATED
  542. //@import com/ibm/rave/bundles/components/BackgroundComponentImpl (runtime) // new
  543. //@import com/ibm/rave/bundles/components/ChartLayoutComponentImpl (runtime) // new
  544. //@import com/ibm/rave/bundles/components/ClipPathComponentImpl (runtime) // new
  545. //@import com/ibm/rave/bundles/components/LegendsManager (runtime) // new
  546. //@import com/ibm/rave/bundles/components/AxesManager (runtime) // new
  547. //@import com/ibm/rave/library/Library (runtime) // Library
  548. //@import com/ibm/rave/bundles/components/IntervalDataUtilities (runtime) // IntervalDataUtilities
  549. //@import com/ibm/rave/bundles/data/PointDataUtilities (runtime) // PointDataUtilities
  550. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  551. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor
  552. var com_ibm_rave_bundles_views_BundleView = rave['internal']['Declare'](rave['library']['internal']['AbstractView'], {
  553. /**
  554. * Background component
  555. */
  556. /** @expose */
  557. _backgroundComponent : null,
  558. /**
  559. * Layout component
  560. */
  561. /** @expose */
  562. _layoutComponent : null,
  563. /**
  564. * Clip component
  565. */
  566. /** @expose */
  567. _clip : null,
  568. /**
  569. * Axes manager
  570. */
  571. /** @expose */
  572. _axes : null,
  573. /**
  574. * Legends manager
  575. */
  576. /** @expose */
  577. _legends : null,
  578. //_groupStructure : null,
  579. /** @expose */
  580. _chart : null,
  581. /** @expose */
  582. dataModel : null,
  583. /** @expose */
  584. _zoomP : null,
  585. /** @expose */
  586. _zoomS : null,
  587. /** @expose */
  588. constructor : function(context) {
  589. },
  590. /** @expose */
  591. getGroupStructure : function() {},
  592. /** @expose */
  593. setup : function() {
  594. rave['library']['internal']['AbstractView'].prototype.setup.call(this);
  595. this._backgroundComponent = new com_ibm_rave_bundles_components_BackgroundComponentImpl();
  596. this._layoutComponent = new com_ibm_rave_bundles_components_ChartLayoutComponentImpl();
  597. this._clip = new com_ibm_rave_bundles_components_ClipPathComponentImpl(this.context.instanceId() + "clipViewport");
  598. if (this.isZoomSupported()) {
  599. this.resetZoom();
  600. }
  601. this._legends = new com_ibm_rave_bundles_components_LegendsManager(this.context, this.getLegendCount());
  602. if (this.isAxesManagerRequired()) {
  603. this._axes = new com_ibm_rave_bundles_components_AxesManager(this.context);
  604. }
  605. this._groupStructure = this.getGroupStructure();
  606. },
  607. /** @expose */
  608. preDraw : function(chartId) {
  609. this.cancelTransitions();
  610. rave['library']['internal']['AbstractView'].createGroupStructure(this.context.node, this._groupStructure);
  611. this._chart = this.context.node.selectAll(chartId);
  612. },
  613. /** @expose */
  614. resetZoom : function() {
  615. this._zoomP = [0, 0, 0, 0];
  616. this._zoomS = [1, 1, 1, 1];
  617. },
  618. /** @expose */
  619. validateDataModel : function(elementsToRemove) {
  620. if (elementsToRemove !== null || arguments.length > 1){
  621. elementsToRemove = Array.prototype.slice.call(arguments);
  622. }
  623. {
  624. this.dataModel = this.context.dataModel();
  625. if (!(this.dataValid())) {
  626. for (var __i_enFor0 = 0, __len_enFor0 = elementsToRemove.length;
  627. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  628. var e = elementsToRemove[__i_enFor0];
  629. this._chart.selectAll(e).selectAll("*").remove();
  630. }
  631. this._legends.visible(false).draw();
  632. return false;
  633. }
  634. return true;
  635. }
  636. },
  637. /** @expose */
  638. dataValid : function() {
  639. return this.dataModel.validate();
  640. },
  641. /** @expose */
  642. getLegendCount : function() {
  643. return 1;
  644. },
  645. /** @expose */
  646. isAxesManagerRequired : function() {
  647. return false;
  648. },
  649. /** @expose */
  650. isZoomSupported : function() {
  651. return true;
  652. },
  653. /** @expose */
  654. getProperty : function(s) {
  655. return this.context.getPropertyValue(s);
  656. },
  657. /** @expose */
  658. getPropertyDefault : function(s) {
  659. return this.context.getPropertyDefault(s);
  660. },
  661. /** @expose */
  662. getBooleanProperty : function(s) {
  663. var obj = this.getProperty(s);
  664. return (obj);
  665. },
  666. /** @expose */
  667. getDoubleProperty : function(s) {
  668. var obj = this.getProperty(s);
  669. return + (obj);
  670. },
  671. /** @expose */
  672. getIntProperty : function(s) {
  673. var obj = this.getProperty(s);
  674. return ~~ (obj);
  675. },
  676. /**
  677. * @param (String) id Property ID
  678. * @return (String) Property value as a string
  679. */
  680. /** @expose */
  681. getStringProperty : function(id) {
  682. var obj = this.getProperty(id);
  683. return (obj == null) ? null : ""+(obj);
  684. },
  685. /**
  686. * @param (String) id Property ID
  687. * @return (String) Property value as a string, returning null for the empty string
  688. */
  689. /** @expose */
  690. getStringPropertyEmptyAsNull : function(id) {
  691. var s = this.getStringProperty(id);
  692. return (s == null || s.length == 0) ? null : s;
  693. },
  694. /**
  695. * @param (String) id Property ID
  696. * @return (Number) Property value as a string, containing size as the number of pixels
  697. */
  698. /** @expose */
  699. getCSSSizeToPixelNumber : function(id) {
  700. var cssSize = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(this.context.getPropertyValue(id), 100.0, 10.0);
  701. return (cssSize == null) ? 0.0 : cssSize;
  702. },
  703. /**
  704. * Based on effect duration and effect property, determine the effect duration in ms.
  705. * @param (String) effect Effect name, one of the options available from EFFECT_OPTIONS.
  706. * @return (int) Effect duration in ms.
  707. */
  708. /** @expose */
  709. getEffectDuration : function(effect) {
  710. var duration = this.getIntProperty("effect.duration");
  711. if ((duration < 0) || (effect == null) || "none" == effect) {
  712. duration = 0;
  713. }
  714. return duration;
  715. },
  716. /** @expose */
  717. getTopPadding : function() {
  718. return this.getProperty("layout.chart.padding.top");
  719. },
  720. /** @expose */
  721. getLeftPadding : function() {
  722. return this.getProperty("layout.chart.padding.left");
  723. },
  724. /** @expose */
  725. getBottomPadding : function() {
  726. return this.getProperty("layout.chart.padding.bottom");
  727. },
  728. /** @expose */
  729. getRightPadding : function() {
  730. return this.getProperty("layout.chart.padding.right");
  731. },
  732. /** @expose */
  733. getLayoutPadding : function() {
  734. return this.getProperty("layout.padding");
  735. },
  736. /** @expose */
  737. getLegendChartGap : function() {
  738. return this.getProperty("layout.legendchart.gap");
  739. },
  740. /** @expose */
  741. getLegendChartAlign : function() {
  742. return this.getBooleanProperty("layout.legendchart.align");
  743. },
  744. /** @expose */
  745. getLegendPosition : function() {
  746. return this.getStringProperty("legend.position");
  747. },
  748. getPalette$0 : function() {
  749. return this.getPalette$1("color.palette");
  750. },
  751. getPalette$1 : function(paletteID) {
  752. var id = this.getStringProperty(paletteID);
  753. var colorPalette = com_ibm_rave_library_Library.palettes.getPalette(id);
  754. return (!colorPalette) ? com_ibm_rave_library_Library.palettes.getDefaultPalette() : colorPalette;
  755. },
  756. getDynamicPalette$0 : function() {
  757. return this.getDynamicPalette$1("color.palette", "color.dynamicPalette.min", "color.dynamicPalette.mid", "color.dynamicPalette.max");
  758. },
  759. /**
  760. * 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.
  761. * @param (String) paletteID The palette ID
  762. * @return (rave['library']['internal']['Palette']) Palette
  763. */
  764. getDynamicPalette$1 : function(paletteID, minId, midId, maxId) {
  765. var colorPalette;
  766. var min = this.getStringProperty(minId);
  767. if (min != null) {
  768. var mid = this.getStringProperty(midId);
  769. if (mid != null) {
  770. var max = this.getStringProperty(maxId);
  771. if (max != null) {
  772. var fills = [min, mid, max];
  773. colorPalette = rave['library']['internal']['AbstractView'].getFillPalette(fills);
  774. }
  775. }
  776. }
  777. return (!colorPalette) ? this.getPalette(paletteID) : colorPalette;
  778. },
  779. /** @expose */
  780. prepareLayoutComponent : function() {
  781. 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());
  782. },
  783. /** @expose */
  784. prepareLayoutSizables : function(layoutComponent, useX2, useY1, useX1, useY2, useLegend) {
  785. layoutComponent.removeAxisSizables();
  786. if (useX1) {
  787. layoutComponent.addAxisSizable(this._axes.axisComponent(0));
  788. }
  789. if (useY1) {
  790. layoutComponent.addAxisSizable(this._axes.axisComponent(2));
  791. }
  792. if (useX2) {
  793. layoutComponent.addAxisSizable(this._axes.axisComponent(1));
  794. }
  795. if (useY2) {
  796. layoutComponent.addAxisSizable(this._axes.axisComponent(3));
  797. }
  798. layoutComponent.legendSize(useLegend ? this._legends : null);
  799. },
  800. /** @expose */
  801. resetUpdate : function() {
  802. this.updateType = 4;
  803. },
  804. /** @expose */
  805. isUpdateNothing : function() {
  806. return this.updateType == 4;
  807. },
  808. /** @expose */
  809. isShowLegend : function() {
  810. return this.getBooleanProperty("legend.display");
  811. },
  812. cancelTransitions : function() {
  813. this.context.node.selectAll("*").interrupt();
  814. },
  815. /** @expose */
  816. setBackgroundProperties : function(elementRect, duration) {
  817. this._backgroundComponent.setPreExecute(this.context.getPreExecute()).size(this.context.size).backgroundColor(this.getStringProperty("background.chart.color"));
  818. this.context.node.selectAll("rect.background.chart").transition().duration(duration).call(this._backgroundComponent);
  819. this._backgroundComponent.setPreExecute(this.context.getPreExecute()).rect(elementRect).backgroundColor(this.getStringProperty("background.elements.color"));
  820. this.context.node.selectAll("rect.background.elements").transition().duration(duration).call(this._backgroundComponent);
  821. },
  822. /** @expose */
  823. isShowDataLabels : function() {
  824. return this.getBooleanProperty("data.label.display");
  825. },
  826. /** @expose */
  827. isShowDataLabelsAsPercentageOfColor : function() {
  828. var dataLabel = this.getStringProperty("data.label.type");
  829. return "PercentOfColor" == dataLabel;
  830. },
  831. /** @expose */
  832. isShowDataLabelsAsPercentageOfCategory : function() {
  833. var dataLabel = this.getStringProperty("data.label.type");
  834. return "PercentOfCategory" == dataLabel;
  835. },
  836. /** @expose */
  837. getlDataLabelAccessor : function(dataSet, slot, isInterval) {
  838. var labelAccessor;
  839. var labelEntry = dataSet.slot(slot).entry();
  840. if (!labelEntry) {
  841. if (this.isShowDataLabelsAsPercentageOfCategory()) {
  842. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR;
  843. } else if (this.isShowDataLabelsAsPercentageOfColor()) {
  844. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_COLOR_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_COLOR_ACCESSOR;
  845. } else {
  846. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.VALUE_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR;
  847. }
  848. } else {
  849. labelAccessor = rave['library']['internal']['AbstractView'].originalDatumAccessor(rave['library']['internal']['AbstractView'].accessorOf(labelEntry));
  850. }
  851. return labelAccessor;
  852. },
  853. /** @expose */
  854. getEntryForDataLabelFormatter : function(dataSet, labelSlot, defaultSlot) {
  855. var labelEntry = dataSet.slot(labelSlot).entry();
  856. return labelEntry ? labelEntry : dataSet.slot(defaultSlot).entry();
  857. },
  858. /** @expose */
  859. getBackgroundConstrastLabelStyle : function() {
  860. var labelFontStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(this.getStringProperty("labelstyle.font"));
  861. if (this.getBooleanProperty("contrast.label.color") == false) {
  862. return labelFontStyle;
  863. }
  864. var defaultFillColor;
  865. if (labelFontStyle) {
  866. defaultFillColor = labelFontStyle["fill"];
  867. if (defaultFillColor == null) {
  868. defaultFillColor = labelFontStyle["color"];
  869. }
  870. } else {
  871. labelFontStyle = {};
  872. }
  873. if (defaultFillColor == null) {
  874. defaultFillColor = "#000000";
  875. }
  876. labelFontStyle["fill"] = com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(this.getStringProperty("background.elements.color"), defaultFillColor);
  877. return labelFontStyle;
  878. },
  879. /** @expose */
  880. getPalette : function(a0) {
  881. var args = arguments;
  882. if (args.length == 0) {
  883. return this.getPalette$0();
  884. }
  885. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  886. return this.getPalette$1(a0);
  887. }
  888. return rave['library']['internal']['AbstractView'].prototype.getPalette.apply(this, args);
  889. },
  890. /** @expose */
  891. getDynamicPalette : function(a0, a1, a2, a3) {
  892. var args = arguments;
  893. if (args.length == 0) {
  894. return this.getDynamicPalette$0();
  895. }
  896. return this.getDynamicPalette$1(a0, a1, a2, a3);
  897. }
  898. });
  899. // $source: com/ibm/rave/bundles/components/BundleComponentImpl
  900. /************************************************************************
  901. ** IBM Confidential
  902. **
  903. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  904. **
  905. ** (C) Copyright IBM Corp. 2017
  906. **
  907. ** The source code for this program is not published or otherwise divested of its trade secrets,
  908. ** irrespective of what has been deposited with the U.S. Copyright Office.
  909. ************************************************************************/
  910. // GENERATED
  911. var com_ibm_rave_bundles_components_BundleComponentImpl = rave['internal']['Declare']({
  912. /**
  913. * The pre-execution callback.
  914. */
  915. //_preExecuteCallback : null,
  916. /**
  917. * The render callback.
  918. */
  919. /** @expose */
  920. _renderCallback : null,
  921. _$functionClassMethod : function() {
  922. var _$self = function(args) {
  923. if (args !== null || arguments.length > 1){
  924. args = Array.prototype.slice.call(arguments, 0);
  925. }
  926. {
  927. var self = _$self;
  928. this.each(function(data, index, groupIndex) {
  929. self.execute(rave.select(this));
  930. });
  931. return null;
  932. }
  933. };
  934. return _$self;
  935. },
  936. /**
  937. * 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.
  938. * @param (rave['internal']['Selector']) g <g> node that this component will be applied to.
  939. */
  940. /** @expose */
  941. execute : function(g) {},
  942. /**
  943. * Set the pre-execute callback for this component.
  944. * @param (rave['library']['internal']['ComponentCallback']) callback The callback
  945. */
  946. /** @expose */
  947. setPreExecute : function(callback) {
  948. this._preExecuteCallback = callback;
  949. return this;
  950. },
  951. /**
  952. * If the pre-execute component is non-null, call it with this object. Note that this object must also implement BundleComponent.
  953. */
  954. /** @expose */
  955. preExecute : function() {
  956. if (this._preExecuteCallback) {
  957. this._preExecuteCallback(this);
  958. }
  959. },
  960. /**
  961. * Set the render callback for this component.
  962. * @param (rave['internal']['RunFunction']) callback The callback
  963. */
  964. /** @expose */
  965. setRenderCallback : function(callback) {
  966. this._renderCallback = callback;
  967. return this;
  968. },
  969. /**
  970. * 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.
  971. */
  972. /** @expose */
  973. type : function() {},
  974. /** @expose */
  975. updateBorder : function(s, borderWidth, borderColor) {
  976. if (borderWidth != null) {
  977. s.each(function(data, index, groupIndex) {
  978. if (!((this.rave_getProperty("selected"))) && !((this.rave_getProperty("highlighted")))) {
  979. this.rave_setStyle("stroke-width", borderWidth, "");
  980. }
  981. });
  982. }
  983. if (borderColor != null) {
  984. s.each(function(data, index, groupIndex) {
  985. if (!((this.rave_getProperty("selected"))) && !((this.rave_getProperty("highlighted")))) {
  986. this.rave_setStyle("stroke", borderColor, "");
  987. }
  988. });
  989. }
  990. },
  991. /** @expose */
  992. getDefaultLabelColor : function(_labelStyle) {
  993. if (!_labelStyle) {
  994. return "#000000";
  995. }
  996. var defaultFillColor;
  997. if (_labelStyle) {
  998. defaultFillColor = _labelStyle["fill"];
  999. if (defaultFillColor == null) {
  1000. defaultFillColor = _labelStyle["color"];
  1001. }
  1002. }
  1003. if (defaultFillColor == null) {
  1004. defaultFillColor = "#000000";
  1005. }
  1006. return defaultFillColor.toString();
  1007. }
  1008. });
  1009. // $source: com/ibm/rave/bundles/component/BackgroundComponent
  1010. /************************************************************************
  1011. ** IBM Confidential
  1012. **
  1013. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1014. **
  1015. ** (C) Copyright IBM Corp. 2017
  1016. **
  1017. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1018. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1019. ************************************************************************/
  1020. // GENERATED
  1021. /**
  1022. * <p> A component that renders the background to the chart. The {@link #this.type()} method returns "BackgroundComponent". </p>
  1023. */
  1024. var com_ibm_rave_bundles_component_BackgroundComponent = rave['internal']['Declare'].implement(
  1025. /**
  1026. * Get the background color.
  1027. * @return (String) The background color
  1028. */
  1029. //backgroundColor : function() {},
  1030. /**
  1031. * Set the background color. If the color is null, white is used.
  1032. * @param (String) backgroundColor The new background color
  1033. * @return (com.ibm.rave.bundles.component.BackgroundComponent) This object
  1034. */
  1035. //backgroundColor : function(backgroundColor) {}
  1036. );
  1037. /**
  1038. * The string returned by {@link #this.type()} is "BackgroundComponent".
  1039. */
  1040. /** @expose */
  1041. com_ibm_rave_bundles_component_BackgroundComponent.COMPONENT_TYPE = "BackgroundComponent";
  1042. // $source: com/ibm/rave/bundles/component/ChartLayoutComponent
  1043. /************************************************************************
  1044. ** IBM Confidential
  1045. **
  1046. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1047. **
  1048. ** (C) Copyright IBM Corp. 2017
  1049. **
  1050. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1051. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1052. ************************************************************************/
  1053. // GENERATED
  1054. /**
  1055. * <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>
  1056. */
  1057. var com_ibm_rave_bundles_component_ChartLayoutComponent = rave['internal']['Declare'].implement(
  1058. //padding : function() {},
  1059. //topPadding : function() {},
  1060. //leftPadding : function() {},
  1061. //bottomPadding : function() {},
  1062. //rightPadding : function() {},
  1063. //legendChartAlign : function() {},
  1064. //legendPosition : function() {},
  1065. //legendChartGap : function() {},
  1066. //legendPosition : function(position) {},
  1067. //topPadding : function(value) {},
  1068. //leftPadding : function(value) {},
  1069. //bottomPadding : function(value) {},
  1070. //rightPadding : function(value) {},
  1071. /**
  1072. * Sets the padding around the outside of the chart/legend.
  1073. * @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.
  1074. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1075. */
  1076. //padding : function(value) {},
  1077. /**
  1078. * Sets all chart paddings. Null values are treated as 0.
  1079. * @param (Object) top New top padding
  1080. * @param (Object) left New left padding
  1081. * @param (Object) bottom New bottom padding
  1082. * @param (Object) right New right padding
  1083. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1084. * @deprecated Please use {@link #this.padding(Object)} and {@link #this.legendChartGap(Object)}
  1085. */
  1086. //chartPadding : function(top, left, bottom, right) {},
  1087. /**
  1088. * Sets whether the legend should align with the chart "body".
  1089. * @param (boolean) legendChartAlign the boolean state
  1090. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1091. */
  1092. //legendChartAlign : function(legendChartAlign) {},
  1093. /**
  1094. * Set the space for the gap between chart and legend
  1095. * @param (Object) value the gap distance (css length)
  1096. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1097. */
  1098. //legendChartGap : function(value) {},
  1099. /**
  1100. * Set the size information for the legend. Null value is treated as no visible legend.
  1101. * @param (com.ibm.rave.bundles.component.ChartLayoutSizable) sizable An object that implements the ChartLayoutSizable interface
  1102. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1103. */
  1104. //legendSize : function(sizable) {},
  1105. /**
  1106. * Reset list of axis sizables to 0
  1107. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1108. */
  1109. //removeAxisSizables : function() {},
  1110. /**
  1111. * Add an axis to be considered in layout operation.
  1112. * @param (com.ibm.rave.bundles.component.ChartLayoutSizable) sizable An object that implements the ChartLayoutSizable interface
  1113. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1114. */
  1115. //addAxisSizable : function(sizable) {}
  1116. );
  1117. /**
  1118. * The string returned by {@link #this.type()} is "ChartLayoutComponent".
  1119. */
  1120. /** @expose */
  1121. com_ibm_rave_bundles_component_ChartLayoutComponent.COMPONENT_TYPE = "ChartLayoutComponent";
  1122. // $source: com/ibm/rave/bundles/components/LegendsManager
  1123. /************************************************************************
  1124. ** IBM Confidential
  1125. **
  1126. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1127. **
  1128. ** (C) Copyright IBM Corp. 2017
  1129. **
  1130. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1131. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1132. ************************************************************************/
  1133. // GENERATED
  1134. //@import com/ibm/rave/bundles/components/LegendComponentImpl (runtime) // new, orientationOf
  1135. /**
  1136. * <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>
  1137. */
  1138. var com_ibm_rave_bundles_components_LegendsManager = rave['internal']['Declare']({
  1139. /**
  1140. * Bundle context
  1141. */
  1142. //_context : null,
  1143. /**
  1144. * Component used to draw all legends
  1145. */
  1146. //_comp : null,
  1147. /**
  1148. * Global visibility; if false no legends are drawn
  1149. */
  1150. //_visible : null,
  1151. /**
  1152. * Rectangle containing all legends
  1153. */
  1154. //_rectangle : null,
  1155. /**
  1156. * Legend orientation
  1157. */
  1158. //_orient : null,
  1159. /**
  1160. * Pre-execute component callback
  1161. */
  1162. //_preExecute : null,
  1163. /**
  1164. * Selectors for each legend
  1165. */
  1166. //_selectors : null,
  1167. /**
  1168. * Palettes for each legend
  1169. */
  1170. //_palettes : null,
  1171. /**
  1172. * Scale size functions for each legend
  1173. */
  1174. //_scale : null,
  1175. /**
  1176. * Swatch size functions for each legend
  1177. */
  1178. //_swatchSizes : null,
  1179. /**
  1180. * Shapes for each legend
  1181. */
  1182. //_shapes : null,
  1183. /**
  1184. * Titles for each legend
  1185. */
  1186. //_titles : null,
  1187. /**
  1188. * Title fonts for each legend
  1189. */
  1190. //_titleFonts : null,
  1191. /**
  1192. * Title fills for each legend
  1193. */
  1194. //_titleFills : null,
  1195. /**
  1196. * Title font sizes for each legend
  1197. */
  1198. //_titleFontSizes : null,
  1199. /**
  1200. * Title font families for each legend
  1201. */
  1202. //_titleFontFamilies : null,
  1203. /**
  1204. * Entry fonts for each legend
  1205. */
  1206. //_entryFonts : null,
  1207. /**
  1208. * Custom formatters for each legend, created from the registered custom formatters
  1209. */
  1210. //_formatters : null,
  1211. /**
  1212. * Whether each legend was visible in the last draw
  1213. */
  1214. //_lastVisible : null,
  1215. //_dataSlotEntries : null,
  1216. /**
  1217. * Number of legends
  1218. */
  1219. _numLegends : 0,
  1220. /**
  1221. * Whether to use a transition.
  1222. */
  1223. _doTransition : false,
  1224. /**
  1225. * Duration of the transition.
  1226. */
  1227. _duration : 0,
  1228. _spaceUsed : 0,
  1229. /**
  1230. * Construct the manager.
  1231. * @param (int) numLegends Number of legends, must be positive
  1232. */
  1233. /** @expose */
  1234. constructor : function(context, numLegends) {
  1235. this._context = context;
  1236. this._numLegends = numLegends;
  1237. this._comp = new com_ibm_rave_bundles_components_LegendComponentImpl();
  1238. this._rectangle = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1239. this._orient = "vertical";
  1240. this._preExecute = null;
  1241. this._selectors = [];
  1242. this._palettes = [];
  1243. this._scale = [];
  1244. this._swatchSizes = [];
  1245. this._shapes = [];
  1246. this._titles = [];
  1247. this._titleFonts = [];
  1248. this._titleFills = [];
  1249. this._titleFontSizes = [];
  1250. this._titleFontFamilies = [];
  1251. this._entryFonts = [];
  1252. this._formatters = [];
  1253. this._lastVisible = [];
  1254. this._visible = [];
  1255. this._dataSlotEntries = [];
  1256. for (var i = 0; i < this._numLegends; ++i) {
  1257. this._selectors[i] = null;
  1258. this._palettes[i] = null;
  1259. this._swatchSizes[i] = null;
  1260. this._shapes[i] = null;
  1261. this._titles[i] = null;
  1262. this._formatters[i] = null;
  1263. this._lastVisible[i] = false;
  1264. this._visible[i] = true;
  1265. }
  1266. },
  1267. /**
  1268. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) The legend component used by this manager; for unit tests
  1269. */
  1270. getLegendComponent : function() {
  1271. return this._comp;
  1272. },
  1273. /**
  1274. * Set a specific legend visible
  1275. * @param (int) legendIndex The index of the legend
  1276. * @param (boolean) visible New value of visible flag
  1277. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1278. */
  1279. visible$0 : function(legendIndex, visible) {
  1280. if (legendIndex < this._visible.length) {
  1281. this._visible[legendIndex] = visible;
  1282. }
  1283. return this;
  1284. },
  1285. /**
  1286. * Set all legend visible
  1287. * @param (boolean) visible New value of visible flag
  1288. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1289. */
  1290. visible$1 : function(visible) {
  1291. for (var i = 0; i < this._visible.length; ++i) {
  1292. this._visible[i] = visible;
  1293. }
  1294. return this;
  1295. },
  1296. /**
  1297. * Set the layout rectangle. The rectangle is copied. If it is null, the layout rectangle is unchanged.
  1298. * @param (rave['internal']['RectStruct']) rect New layout rectangle
  1299. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1300. */
  1301. /** @expose */
  1302. rectangle : function(rect) {
  1303. if (rect) {
  1304. this._rectangle = new rave['internal']['RectStruct'](rect.x, rect.y, rect.width, rect.height);
  1305. }
  1306. return this;
  1307. },
  1308. /**
  1309. * Set the orient property. If the argument is not "horizontal" or "vertical", the orient property is not changed.
  1310. * @param (String) orient New orient
  1311. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1312. */
  1313. /** @expose */
  1314. orient : function(orient) {
  1315. if ("horizontal" == orient || "vertical" == orient) {
  1316. this._orient = orient;
  1317. }
  1318. return this;
  1319. },
  1320. /**
  1321. * 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".
  1322. * @param (String) position Legend position
  1323. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1324. */
  1325. /** @expose */
  1326. position : function(position) {
  1327. return this.orient(com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf(position));
  1328. },
  1329. /**
  1330. * Set the transition information. If the duration is negative, 0 is used.
  1331. * @param (boolean) doTransition Whether to do a transition
  1332. * @param (int) duration Duration of the transition when used
  1333. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1334. */
  1335. /** @expose */
  1336. transition : function(doTransition, duration) {
  1337. this._doTransition = doTransition;
  1338. this._duration = (duration >= 0) ? duration : 0;
  1339. return this;
  1340. },
  1341. /**
  1342. * Set the pre-execute callback for all legends. The callback may be null.
  1343. * @param (rave['library']['internal']['ComponentCallback']) callback The callback
  1344. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1345. */
  1346. /** @expose */
  1347. setPreExecute : function(callback) {
  1348. this._preExecute = callback;
  1349. return this;
  1350. },
  1351. /**
  1352. * Set the selector to be used when rendering a legend. If the index is out of range no selectors change.
  1353. * @param (int) index Legend array index
  1354. * @param (rave['internal']['Selector']) selector Selector, may be null (but this is not advisable)
  1355. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1356. */
  1357. /** @expose */
  1358. selector : function(index, selector) {
  1359. if (index >= 0 && index < this._numLegends) {
  1360. this._selectors[index] = selector;
  1361. }
  1362. return this;
  1363. },
  1364. /**
  1365. * Set the palette of a legend. If the index is out of range no information is changed.
  1366. * @param (int) index Legend array index
  1367. * @param (rave['library']['internal']['Palette']) palette Palette, may be null
  1368. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1369. */
  1370. /** @expose */
  1371. palette : function(index, palette) {
  1372. if (index >= 0 && index < this._numLegends) {
  1373. this._palettes[index] = palette;
  1374. }
  1375. return this;
  1376. },
  1377. /**
  1378. * Set the shape of a legend. If the index is out of range no information is changed.
  1379. * @param (int) index Legend array index
  1380. * @param (String) shape Shape, may be null (defaulting to square)
  1381. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1382. */
  1383. /** @expose */
  1384. shape : function(index, shape) {
  1385. if (index >= 0 && index < this._numLegends) {
  1386. this._shapes[index] = shape;
  1387. }
  1388. return this;
  1389. },
  1390. /**
  1391. * Set the title of a legend. If the index is out of range no information is changed.
  1392. * @param (int) index Legend array index
  1393. * @param (String) title Title, may be null
  1394. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1395. */
  1396. /** @expose */
  1397. title : function(index, title) {
  1398. if (index >= 0 && index < this._numLegends) {
  1399. this._titles[index] = title;
  1400. }
  1401. return this;
  1402. },
  1403. /**
  1404. * Set the title font style of a legend. If the index is out of range no information is changed.
  1405. * @param (int) index Legend array index
  1406. * @param (String) titleFont Title font string, may be null
  1407. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1408. */
  1409. /** @expose */
  1410. titleFont : function(index, titleFont) {
  1411. if (index >= 0 && index < this._numLegends) {
  1412. this._titleFonts[index] = titleFont;
  1413. }
  1414. return this;
  1415. },
  1416. /**
  1417. * Set the entry font style of a legend. If the index is out of range no information is changed.
  1418. * @param (int) index Legend array index
  1419. * @param (String) entryFont Entry font string, may be null
  1420. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1421. */
  1422. /** @expose */
  1423. entryFont : function(index, entryFont) {
  1424. if (index >= 0 && index < this._numLegends) {
  1425. this._entryFonts[index] = entryFont;
  1426. }
  1427. return this;
  1428. },
  1429. /**
  1430. * Set the title fill of a legend. If the index is out of range no information is changed.
  1431. * @param (int) index Legend array index
  1432. * @param (String) titleFill Fill color string, may be null
  1433. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1434. */
  1435. /** @expose */
  1436. titleFill : function(index, titleFill) {
  1437. if (index >= 0 && index < this._numLegends) {
  1438. this._titleFills[index] = titleFill;
  1439. }
  1440. return this;
  1441. },
  1442. /**
  1443. * Set the title font size of a legend. If the index is out of range no information is changed.
  1444. * @param (int) index Legend array index
  1445. * @param (String) titleFontSize Font size string, may be null
  1446. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1447. */
  1448. /** @expose */
  1449. titleFontSize : function(index, titleFontSize) {
  1450. if (index >= 0 && index < this._numLegends) {
  1451. this._titleFontSizes[index] = titleFontSize;
  1452. }
  1453. return this;
  1454. },
  1455. /**
  1456. * Set the title font family of a legend. If the index is out of range no information is changed.
  1457. * @param (int) index Legend array index
  1458. * @param (String) titleFontFamily Font family string, may be null
  1459. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1460. */
  1461. /** @expose */
  1462. titleFontFamily : function(index, titleFontFamily) {
  1463. if (index >= 0 && index < this._numLegends) {
  1464. this._titleFontFamilies[index] = titleFontFamily;
  1465. }
  1466. return this;
  1467. },
  1468. /**
  1469. * Set the scale of a legend. If the index is out of range no information is changed.
  1470. * @param (int) index Legend array index
  1471. * @param (rave['internal']['AbstractScale']) scale Scale, may be null
  1472. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1473. */
  1474. /** @expose */
  1475. scale : function(index, scale) {
  1476. if (index >= 0 && index < this._numLegends) {
  1477. this._scale[index] = scale;
  1478. }
  1479. return this;
  1480. },
  1481. /**
  1482. * Set the swatch size function of a legend. If the index is out of range no information is changed.
  1483. * @param (int) index Legend array index
  1484. * @param (rave['internal']['ValueFunction']) swatchSize Swatch size function, may be null
  1485. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1486. */
  1487. /** @expose */
  1488. swatchSize : function(index, swatchSize) {
  1489. if (index >= 0 && index < this._numLegends) {
  1490. this._swatchSizes[index] = swatchSize;
  1491. }
  1492. return this;
  1493. },
  1494. /**
  1495. * 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.
  1496. * @param (int) index Legend array index
  1497. * @param (Array) entries List of data slot entries, if null an empty list is used
  1498. * @param (String) format One of {@link this.CustomFormatInfo#"none"} or {@link this.CustomFormatInfo#"percent"}
  1499. * @param (rave['internal']['ValueFunction']) defaultFunction Default function to use if no custom formatter is defined, may be null
  1500. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1501. */
  1502. /** @expose */
  1503. formatterList : function(index, entries, format, defaultFunction) {
  1504. if (index >= 0 && index < this._numLegends) {
  1505. this._formatters[index] = this._context.getCustomFormatterWithFlag(["legend", "all"], rave['library']['internal']['BundleContext'].makeCustomFormatInfo("legend-label", "ROLE_NONE", format, entries), defaultFunction, false);
  1506. }
  1507. return this;
  1508. },
  1509. /**
  1510. * 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.
  1511. * @param (int) index Legend array index
  1512. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  1513. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1514. */
  1515. /** @expose */
  1516. formatter : function(index, entry) {
  1517. var entries = [];
  1518. if (entry) {
  1519. entries.push(entry);
  1520. }
  1521. return this.formatterList(index, entries, "none", null);
  1522. },
  1523. /**
  1524. * 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.
  1525. * @return (boolean) Whether any legend are visible (will be drawn)
  1526. */
  1527. /** @expose */
  1528. anyVisible : function() {
  1529. for (var i = 0; i < this._numLegends; ++i) {
  1530. if (this._visible[i] == true && (this._palettes[i] || this._swatchSizes[i])) {
  1531. return true;
  1532. }
  1533. }
  1534. return false;
  1535. },
  1536. /**
  1537. * 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'])} .
  1538. * @param (int) index Legend array index
  1539. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  1540. * @return (com.ibm.rave.bundles.components.LegendsManager) This LegendsManager
  1541. */
  1542. /** @expose */
  1543. setDataSlot : function(index, entry) {
  1544. if (index >= 0 && index < this._numLegends) {
  1545. this._dataSlotEntries[index] = entry;
  1546. }
  1547. return this.formatter(index, entry);
  1548. },
  1549. preLayout$0 : function(layoutComponent) {
  1550. this.preLayout$1(layoutComponent, true);
  1551. return this;
  1552. },
  1553. preLayout$1 : function(layoutComponent, axesBeforeLegend) {
  1554. var layoutTransition = this._doTransition;
  1555. var layoutDuration = this._duration;
  1556. this._doTransition = false;
  1557. this._duration = 0;
  1558. var children = [];
  1559. for (var i = 0; i < this._numLegends; ++i) {
  1560. children[i] = "g.layoutLegend-" + i;
  1561. }
  1562. rave['library']['internal']['AbstractView'].createGroupStructure(this._context.node.select("g.legends-layout"), children);
  1563. var layoutSelectors = [];
  1564. var layoutLastVisible = [];
  1565. for (var i = 0; i < this._numLegends; ++i) {
  1566. layoutSelectors[i] = this._selectors[i];
  1567. layoutLastVisible[i] = this._lastVisible[i];
  1568. this._lastVisible[i] = false;
  1569. if (this._selectors[i]) {
  1570. this._selectors[i] = this._context.node.select("g.layoutLegend-" + i);
  1571. }
  1572. }
  1573. layoutComponent.preLayout(true, !axesBeforeLegend);
  1574. this.rectangle(layoutComponent.legendRect());
  1575. this.draw();
  1576. this._doTransition = layoutTransition;
  1577. this._duration = layoutDuration;
  1578. this._context.node.select("g.legends-layout").selectAll("*").remove();
  1579. for (var i = 0; i < this._numLegends; ++i) {
  1580. this._lastVisible[i] = layoutLastVisible[i];
  1581. this._selectors[i] = layoutSelectors[i];
  1582. }
  1583. return this;
  1584. },
  1585. /**
  1586. * Render the legends using the current global and per-legend settings.
  1587. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1588. */
  1589. /** @expose */
  1590. draw : function() {
  1591. var nVisible = 0;
  1592. for (var i = 0; i < this._numLegends; ++i) {
  1593. if ((this._swatchSizes[i] || this._palettes[i]) && this._visible[i]) {
  1594. nVisible++;
  1595. }
  1596. }
  1597. var x = this._rectangle.x;
  1598. var y = this._rectangle.y;
  1599. var dx;
  1600. var dy;
  1601. var size;
  1602. if (nVisible == 0) {
  1603. dx = 0;
  1604. dy = 0;
  1605. size = [this._rectangle.width, this._rectangle.height];
  1606. } else if ("horizontal" == this._orient) {
  1607. dx = this._rectangle.width / nVisible;
  1608. dy = 0;
  1609. size = [dx, this._rectangle.height];
  1610. } else {
  1611. dx = 0;
  1612. dy = this._rectangle.height / nVisible;
  1613. size = [this._rectangle.width, dy];
  1614. }
  1615. this._comp.orient(this._orient).size(size);
  1616. this._spaceUsed = 0;
  1617. for (var i = 0; i < this._numLegends; ++i) {
  1618. if (this._selectors[i]) {
  1619. var visible = this._visible[i] && (this._palettes[i] || this._swatchSizes[i]);
  1620. 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]);
  1621. var fontStyle = this._context.getPropertyValue("legend.titlestyle.font");
  1622. if (this._titleFonts[i] != null && !(this._titleFonts[i] == "")) {
  1623. this._comp.titleFont(this._titleFonts[i]);
  1624. } else if (fontStyle != null && !(fontStyle == "")) {
  1625. this._comp.titleFont(this._context.getPropertyValue("legend.titlestyle.font"));
  1626. }
  1627. fontStyle = this._context.getPropertyValue("legend.entrystyle.font");
  1628. if (this._entryFonts[i] != null) {
  1629. this._comp.entryFont(this._entryFonts[i]);
  1630. } else if (fontStyle != null && !(fontStyle == "")) {
  1631. this._comp.entryFont(this._context.getPropertyValue("legend.entrystyle.font"));
  1632. }
  1633. var s = (this._doTransition && this._lastVisible[i]) ? this._selectors[i].transition("transition").duration(this._duration) : this._selectors[i];
  1634. s.attr("transform", "translate(" + x + "," + y + ")").call(this._comp);
  1635. var dataSlotEntries = [];
  1636. if (this._dataSlotEntries[i]) {
  1637. dataSlotEntries.push(this._dataSlotEntries[i]);
  1638. }
  1639. this._selectors[i].selectAll(".legendTitle").property("dataSlots", dataSlotEntries);
  1640. if (visible) {
  1641. x += dx;
  1642. y += dy;
  1643. if (this._comp.getSpaceUsed() > this._spaceUsed) {
  1644. this._spaceUsed = this._comp.getSpaceUsed();
  1645. }
  1646. }
  1647. this._lastVisible[i] = visible;
  1648. } else {
  1649. this._lastVisible[i] = false;
  1650. }
  1651. }
  1652. return this;
  1653. },
  1654. /** @expose */
  1655. getSizableType : function() {
  1656. return 2;
  1657. },
  1658. /** @expose */
  1659. getSizableOrientation : function() {
  1660. return this._orient;
  1661. },
  1662. /** @expose */
  1663. getPreferredSize : function() {
  1664. return this._spaceUsed;
  1665. },
  1666. /** @expose */
  1667. getSpillOverSize : function() {
  1668. return 0;
  1669. },
  1670. /** @expose */
  1671. visible : function(a0, a1) {
  1672. var args = arguments;
  1673. if (args.length == 1) {
  1674. return this.visible$1(a0);
  1675. }
  1676. return this.visible$0(a0, a1);
  1677. },
  1678. /** @expose */
  1679. preLayout : function(a0, a1) {
  1680. var args = arguments;
  1681. if (args.length == 1) {
  1682. return this.preLayout$0(a0);
  1683. }
  1684. return this.preLayout$1(a0, a1);
  1685. }
  1686. });
  1687. // $source: com/ibm/rave/bundles/utilities/FontPropertyParser
  1688. /************************************************************************
  1689. ** IBM Confidential
  1690. **
  1691. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1692. **
  1693. ** (C) Copyright IBM Corp. 2017
  1694. **
  1695. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1696. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1697. ************************************************************************/
  1698. // GENERATED
  1699. var com_ibm_rave_bundles_utilities_FontPropertyParser = rave['internal']['Declare']({
  1700. });
  1701. /**
  1702. * Method to parse the css font styles and return a style map.
  1703. * @param (String) fontStyle CSS string (eg. "font-family: courier; font-size: 22; fill: red")
  1704. * @return (Object) Font Style Map
  1705. */
  1706. /** @expose */
  1707. com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont = function(fontStyle) {
  1708. if (fontStyle != null && fontStyle.length > 0) {
  1709. var properties = fontStyle.split(new RegExp(";"));
  1710. var fontStyles = {};
  1711. for (var __i_enFor0 = 0, __len_enFor0 = properties.length;
  1712. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1713. var property = properties[__i_enFor0];
  1714. var fontMap = property.split(new RegExp(":"));
  1715. if (fontMap.length == 2) {
  1716. var key = fontMap[0].trim();
  1717. fontStyles[key == "color" ? "fill" : key] = fontMap[1].trim();
  1718. }
  1719. }
  1720. return fontStyles;
  1721. }
  1722. return null;
  1723. };
  1724. // $source: com/ibm/rave/bundles/components/AxesManager
  1725. /************************************************************************
  1726. ** IBM Confidential
  1727. **
  1728. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1729. **
  1730. ** (C) Copyright IBM Corp. 2018
  1731. **
  1732. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1733. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1734. ************************************************************************/
  1735. // GENERATED
  1736. //@import com/ibm/rave/bundles/components/AxisComponentImpl (runtime) // new, getTranslation
  1737. //@import com/ibm/rave/bundles/components/GridComponentImpl (runtime) // new
  1738. //@import com/ibm/rave/bundles/components/ClipPathComponentImpl (runtime) // new
  1739. /**
  1740. * <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>
  1741. */
  1742. var com_ibm_rave_bundles_components_AxesManager = rave['internal']['Declare']({
  1743. /**
  1744. * Bundle context
  1745. */
  1746. //_context : null,
  1747. /**
  1748. * Selector for the bundle defs node. If null, no clip paths will be defined.
  1749. */
  1750. //_defs : null,
  1751. /**
  1752. * Scales for the axes, indexed by X1, X2, Y1, Y2
  1753. */
  1754. //_scales : null,
  1755. /**
  1756. * Whether to suppress labels when panning, indexed by X1, X2, Y1, Y2.
  1757. */
  1758. //_suppressPanLabels : null,
  1759. /**
  1760. * Value of the axis drawAxisLabels, set when axis is drawn, indexed by X1, X2, Y1, Y2.
  1761. */
  1762. //_drawAxisLabels : null,
  1763. /**
  1764. * Axis components created on demand, indexed by X1, X2, Y1, Y2
  1765. */
  1766. //_axisComponents : null,
  1767. /**
  1768. * When last drawn, the selector used for each axis role, indexed by X1, X2, Y1, Y2; used for redraws.
  1769. */
  1770. //_lastAxisDrawSelectors : null,
  1771. /**
  1772. * Grid components created on demand, indexed by X1, X2, Y1, Y2
  1773. */
  1774. //_gridComponents : null,
  1775. /**
  1776. * When last drawn, the selector used for each grid role, indexed by X1, X2, Y1, Y2; used for redraws.
  1777. */
  1778. //_lastGridDrawSelectors : null,
  1779. /**
  1780. * For clearing axis
  1781. */
  1782. //_clearAxis : null,
  1783. /**
  1784. * For clearing grid
  1785. */
  1786. //_clearGrid : null,
  1787. /**
  1788. * Selectors for the axis groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1789. */
  1790. //_axisSelectors : null,
  1791. /**
  1792. * Selectors for the grid groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1793. */
  1794. //_gridSelectors : null,
  1795. /**
  1796. * Bounding rectangles for the axis groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1797. */
  1798. //_axisRects : null,
  1799. /**
  1800. * Center elements bounds, also the grid bounds.
  1801. */
  1802. //_elementRect : null,
  1803. /**
  1804. * Whether anything was drawn into the axis group last time, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1805. */
  1806. //_lastAxisDrew : null,
  1807. /**
  1808. * Whether anything was drawn into the grid group last time, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1809. */
  1810. //_lastGridDrew : null,
  1811. //_dataSlotEntries : null,
  1812. //_layoutAxisOrder : null,
  1813. /**
  1814. * On the first draw, no transitions are used.
  1815. */
  1816. _firstDraw : false,
  1817. /**
  1818. * Whether to draw the axes and grids.
  1819. */
  1820. _visible : true,
  1821. /**
  1822. * Transition duration, ms
  1823. */
  1824. _duration : 0,
  1825. /**
  1826. * Transpose the axes (assign X to left/right and Y to top/bottom)
  1827. */
  1828. _transpose : false,
  1829. /**
  1830. * Switch the independent (X) axes, drawing X1 where X2 normally goes and vice-versa
  1831. */
  1832. _swapX : false,
  1833. /**
  1834. * Switch the dependent (Y) axes, drawing Y1 where Y2 normally goes and vice-versa
  1835. */
  1836. _swapY : false,
  1837. _layoutInProgress : false,
  1838. _layoutMaxWidth : 0,
  1839. _layoutMaxHeight : 0,
  1840. _xPadding : 0, _xOuterPadding : 0, _yPadding : 0, _yOuterPadding : 0,
  1841. _xPixelPad : 0, _yPixelPad : 0,
  1842. /**
  1843. * Hack to allow heatmap in "unit cell" mode to disable stagger because of the post scaling that messes up axis layout
  1844. */
  1845. _preventStaggerRotate45 : false,
  1846. constructor : function(context) {
  1847. this._scales = [];
  1848. this._suppressPanLabels = [];
  1849. this._drawAxisLabels = [];
  1850. this._axisComponents = [];
  1851. this._lastAxisDrawSelectors = [];
  1852. this._gridComponents = [];
  1853. this._lastGridDrawSelectors = [];
  1854. this._clearAxis = new com_ibm_rave_bundles_components_AxisComponentImpl();
  1855. this._clearGrid = new com_ibm_rave_bundles_components_GridComponentImpl();
  1856. this._axisSelectors = [];
  1857. this._gridSelectors = [];
  1858. this._axisRects = [];
  1859. this._elementRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1860. this._lastAxisDrew = [];
  1861. this._lastGridDrew = [];
  1862. this._dataSlotEntries = [];
  1863. this._layoutAxisOrder = [];
  1864. /**
  1865. * Construct and initialize. No axis scales or selector groups are defined.
  1866. * @param (rave['library']['internal']['BundleContext']) context The bundle context
  1867. */
  1868. {
  1869. this._context = context;
  1870. for (var i = 0; i < 4; ++i) {
  1871. this._scales[i] = null;
  1872. this._suppressPanLabels[i] = false;
  1873. this._axisComponents[i] = null;
  1874. this._lastAxisDrawSelectors[i] = null;
  1875. this._gridComponents[i] = null;
  1876. this._lastGridDrawSelectors[i] = null;
  1877. this._axisSelectors[i] = null;
  1878. this._gridSelectors[i] = null;
  1879. this._axisRects[i] = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1880. this._lastAxisDrew[i] = false;
  1881. this._lastGridDrew[i] = false;
  1882. this._dataSlotEntries[i] = [];
  1883. }
  1884. }
  1885. },
  1886. /** @expose */
  1887. preLayout : function(layoutComponent, axesBeforeLegend, xPadding, xOuterPadding, xPixelPad, yPadding, yOuterPadding, yPixelPad) {
  1888. this._xPadding = xPadding;
  1889. this._xOuterPadding = xOuterPadding;
  1890. this._xPixelPad = xPixelPad;
  1891. this._yPadding = yPadding;
  1892. this._yOuterPadding = yOuterPadding;
  1893. this._yPixelPad = yPixelPad;
  1894. this._layoutInProgress = true;
  1895. var layoutDuration = this._duration;
  1896. this._duration = 0;
  1897. 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"];
  1898. rave['library']['internal']['AbstractView'].createGroupStructure(this._context.node.select("g.axes-layout"), children);
  1899. var layoutAxisSelectors = [];
  1900. var layoutGridSelectors = [];
  1901. var layoutLastAxisDrew = [];
  1902. for (var position = 0; position < 4; ++position) {
  1903. if (this._axisComponents[position]) {
  1904. this._axisComponents[position].preLayout();
  1905. }
  1906. layoutAxisSelectors[position] = this._axisSelectors[position];
  1907. layoutGridSelectors[position] = this._gridSelectors[position];
  1908. layoutLastAxisDrew[position] = this._lastAxisDrew[position];
  1909. if (this._axisSelectors[position]) {
  1910. this.axisSelector(position, this._context.node.select("g.layoutAxis-" + com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position]));
  1911. }
  1912. if (this._gridSelectors[position]) {
  1913. this.gridSelector(position, this._context.node.select("g.layoutGrid-" + com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position]));
  1914. }
  1915. }
  1916. layoutComponent.preLayout(axesBeforeLegend, true);
  1917. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, layoutComponent.elementRect());
  1918. var countHorz = 0;
  1919. var countVert = 0;
  1920. var axes = [];
  1921. for (var position = 0; position < 4; ++position) {
  1922. var role = this.positionToRole(position);
  1923. var isHorz = position == 1 || position == 0;
  1924. if (this._axisSelectors[position] && this._scales[role]) {
  1925. if (isHorz) {
  1926. countHorz++;
  1927. } else {
  1928. countVert++;
  1929. }
  1930. if (this._scales[role].isOrdinal() || this._scales[role].isClustered()) {
  1931. var score = isHorz ? 4 : 2;
  1932. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, score));
  1933. } else {
  1934. var score = isHorz ? 3 : 1;
  1935. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, score));
  1936. }
  1937. } else {
  1938. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, 5));
  1939. }
  1940. }
  1941. axes.sort(function(a1, a2) {
  1942. var a1value = a1.score;
  1943. var a2value = a2.score;
  1944. return a1value < a2value ? -1 : a1value > a2value ? 1 : 0;
  1945. });
  1946. this._layoutAxisOrder = [];
  1947. for (var i = 0; i < 4; ++i) {
  1948. this._layoutAxisOrder[i] = axes[i].position;
  1949. }
  1950. this._layoutMaxWidth = this._elementRect.width * (countVert > 1 ? 0.5 : 0.4);
  1951. this._layoutMaxHeight = this._elementRect.height * (countHorz > 1 ? 0.5 : 0.4);
  1952. for (var index = 0; index < 4; ++index) {
  1953. var position = this._layoutAxisOrder[index];
  1954. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[position], this._elementRect);
  1955. }
  1956. this.draw();
  1957. this._duration = layoutDuration;
  1958. this._context.node.select("g.axes-layout").selectAll("*").remove();
  1959. for (var position = 0; position < 4; ++position) {
  1960. this._lastAxisDrew[position] = layoutLastAxisDrew[position];
  1961. this._axisSelectors[position] = layoutAxisSelectors[position];
  1962. this._gridSelectors[position] = layoutGridSelectors[position];
  1963. }
  1964. this._layoutInProgress = false;
  1965. return this;
  1966. },
  1967. getPositionToDraw : function(index) {
  1968. return this._layoutInProgress ? this._layoutAxisOrder[index] : index;
  1969. },
  1970. preDrawAxis : function(index) {
  1971. if (this._layoutInProgress) {
  1972. var position = this._layoutAxisOrder[index];
  1973. var role = this.positionToRole(position);
  1974. if (role == 0 || role == 1) {
  1975. this.setScaleRangePadded(this._scales[role], false, this._xPadding, this._xOuterPadding, this._xPixelPad);
  1976. } else {
  1977. this.setScaleRangePadded(this._scales[role], true, this._yPadding, this._yOuterPadding, this._yPixelPad);
  1978. }
  1979. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(true);
  1980. }
  1981. },
  1982. postDrawAxis : function(index) {
  1983. if (this._layoutInProgress) {
  1984. var position = this._layoutAxisOrder[index];
  1985. var role = this.positionToRole(position);
  1986. var axis = this._axisComponents[role];
  1987. var size = axis.getPreferredSize();
  1988. if (position == 1 || position == 0) {
  1989. if (size > this._layoutMaxHeight) {
  1990. size = this._layoutMaxHeight;
  1991. }
  1992. this._elementRect.height -= size;
  1993. if (position == 1) {
  1994. this._elementRect.y += size;
  1995. }
  1996. } else {
  1997. if (size > this._layoutMaxWidth) {
  1998. size = this._layoutMaxWidth;
  1999. }
  2000. this._elementRect.width -= size;
  2001. if (position == 2) {
  2002. this._elementRect.x += size;
  2003. }
  2004. }
  2005. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(false);
  2006. }
  2007. },
  2008. /**
  2009. * 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.
  2010. */
  2011. /** @expose */
  2012. draw : function() {
  2013. for (var role = 0; role < 4; ++role) {
  2014. this._lastAxisDrawSelectors[role] = null;
  2015. this._lastGridDrawSelectors[role] = null;
  2016. }
  2017. for (var index = 0; index < 4; ++index) {
  2018. var position = this.getPositionToDraw(index);
  2019. var role = this.positionToRole(position);
  2020. if (!this._visible || !this._axisSelectors[position] || !this._scales[role]) {
  2021. this.clearAxis(position);
  2022. this.clearGrid(position);
  2023. } else {
  2024. this.preDrawAxis(index);
  2025. this.drawAxis(position, role);
  2026. this.postDrawAxis(index);
  2027. if (this._gridSelectors[position]) {
  2028. this.drawGrid(position, role);
  2029. }
  2030. }
  2031. }
  2032. this._firstDraw = false;
  2033. },
  2034. /**
  2035. * @return (boolean) true if we are hiding any labels during pan-zoom.
  2036. */
  2037. /** @expose */
  2038. hideAnyPanZoom : function() {
  2039. return (this._suppressPanLabels[0] || this._suppressPanLabels[1] || this._suppressPanLabels[2] || this._suppressPanLabels[3]);
  2040. },
  2041. /**
  2042. * 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.
  2043. * @param (boolean) panning Whether this is a pan in-progress; use false otherwise including when pan-zoom ends.
  2044. */
  2045. /** @expose */
  2046. redraw : function(panning) {
  2047. for (var role = 0; role < 4; ++role) {
  2048. if (this._axisComponents[role] && this._lastAxisDrawSelectors[role]) {
  2049. this._axisComponents[role].displayTickLabels(this._drawAxisLabels[role]);
  2050. this._axisComponents[role].showPanZoomTickLabels(!panning || !this._suppressPanLabels[role]);
  2051. var isAllow = this._axisComponents[role].isAllowAutomaticAxisLayoutToChangeOrientation();
  2052. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(false);
  2053. this._lastAxisDrawSelectors[role].call(this._axisComponents[role]);
  2054. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(isAllow);
  2055. }
  2056. if (this._gridComponents[role] && this._lastGridDrawSelectors[role]) {
  2057. this._lastGridDrawSelectors[role].call(this._gridComponents[role]);
  2058. }
  2059. }
  2060. },
  2061. /** @expose */
  2062. preventStaggerRotate45 : function(preventStaggerRotate45) {
  2063. this._preventStaggerRotate45 = preventStaggerRotate45;
  2064. },
  2065. /**
  2066. * 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.
  2067. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2068. * @param (int) role The axis role, X1, X2, Y1, or Y2
  2069. */
  2070. drawAxis : function(position, role) {
  2071. var axisGroup = this._axisSelectors[position];
  2072. this._lastAxisDrawSelectors[role] = axisGroup;
  2073. var comp = this.axisComponent(role);
  2074. var layoutModeID = role == 2 ? "axis.y.labels.layoutMode" : role == 3 ? "axis.y2.labels.layoutMode" : "axis.x.labels.layoutMode";
  2075. var allowStaggerID = role == 2 ? "axis.y.labels.allowStagger" : role == 3 ? "axis.y2.labels.allowStagger" : "axis.x.labels.allowStagger";
  2076. var allowRotate45ID = role == 2 ? "axis.y.labels.allowRotate45" : role == 3 ? "axis.y2.labels.allowRotate45" : "axis.x.labels.allowRotate45";
  2077. var allowRotate90ID = role == 2 ? "axis.y.labels.allowRotate90" : role == 3 ? "axis.y2.labels.allowRotate90" : "axis.x.labels.allowRotate90";
  2078. var layoutMode = ""+(this._context.getPropertyValue(layoutModeID));
  2079. var allowStagger = !this._preventStaggerRotate45 && (this._context.getPropertyValue(allowStaggerID));
  2080. var allowRotate45 = !this._preventStaggerRotate45 && (this._context.getPropertyValue(allowRotate45ID));
  2081. var allowRotate90 = (this._context.getPropertyValue(allowRotate90ID));
  2082. var textTruncateIndicator = (this._context.getPropertyValue("axis.labels.truncationText"));
  2083. var axisBounds = this._axisRects[position];
  2084. var orient = com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position];
  2085. var transform = com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation(axisBounds, orient);
  2086. var axisTransform = "translate(" + transform[0] + "," + transform[1] + ")";
  2087. 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);
  2088. this._drawAxisLabels[role] = comp._displayTickLabels;
  2089. var axisGroupUpdate = axisGroup;
  2090. if (this._duration > 0 && !this._firstDraw && this._lastAxisDrew[position]) {
  2091. axisGroupUpdate = axisGroup.transition().duration(this._duration);
  2092. }
  2093. axisGroupUpdate.attr("transform", axisTransform);
  2094. axisGroupUpdate.call(comp);
  2095. var dataSlotEntryList = this._dataSlotEntries[role];
  2096. axisGroup.selectAll(".axis-title").property("dataSlots", dataSlotEntryList);
  2097. this._lastAxisDrew[position] = comp.renderedShapes();
  2098. if (this._defs) {
  2099. var clipAxis = new com_ibm_rave_bundles_components_ClipPathComponentImpl(this._context.instanceId() + "clip" + orient);
  2100. var text = axisGroup.append("text").text("000,000");
  2101. var bbox = text.node().getBBox();
  2102. var w = bbox.width;
  2103. var h = bbox.height;
  2104. text.remove();
  2105. var clipRect;
  2106. if (position == 0 || position == 1) {
  2107. var leftEdge = axisBounds.x + transform[0] * -1;
  2108. var rightEdge = leftEdge + axisBounds.width;
  2109. if (!(this._scales[role].isOrdinal()) && !(this._scales[role].isClustered())) {
  2110. var numericLeftEdge = this._elementRect.x - w + transform[0] * -1;
  2111. var numericRightEdge = numericLeftEdge + this._elementRect.width + w * 2;
  2112. if (numericLeftEdge < leftEdge) {
  2113. leftEdge = numericLeftEdge;
  2114. }
  2115. if (numericRightEdge > rightEdge) {
  2116. rightEdge = numericRightEdge;
  2117. }
  2118. }
  2119. clipRect = new rave['internal']['RectStruct'](leftEdge, axisBounds.y + transform[1] * -1, rightEdge - leftEdge, axisBounds.height);
  2120. } else {
  2121. clipRect = new rave['internal']['RectStruct'](axisBounds.x + transform[0] * -1, this._elementRect.y - h / 2 + transform[1] * -1, axisBounds.width, this._elementRect.height + h);
  2122. }
  2123. clipAxis.clipRect(clipRect).applyTo(axisGroup.select(".axis." + orient)).call(this._defs);
  2124. }
  2125. },
  2126. /**
  2127. * If the axis selector for the position is defined, clear the shapes from the axis group.
  2128. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2129. */
  2130. clearAxis : function(position) {
  2131. if (this._axisSelectors[position]) {
  2132. this._clearAxis.scale(null);
  2133. this._axisSelectors[position].call(this._clearAxis);
  2134. }
  2135. this._lastAxisDrew[position] = false;
  2136. },
  2137. /**
  2138. * 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.
  2139. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2140. * @param (int) role The axis role, X1, X2, Y1, or Y2
  2141. */
  2142. drawGrid : function(position, role) {
  2143. var gridGroup = this._gridSelectors[position];
  2144. this._lastGridDrawSelectors[role] = gridGroup;
  2145. var comp = this.gridComponent(role);
  2146. var axisBounds = this._axisRects[position];
  2147. var orient = com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position];
  2148. var transform = com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation(axisBounds, orient);
  2149. var axisTransform = "translate(" + transform[0] + "," + transform[1] + ")";
  2150. comp.setRole(com_ibm_rave_bundles_components_AxesManager.ROLES[role]).orient(orient).setPreExecute(this._context.getPreExecute()).bounds(this._elementRect).axis(this._axisComponents[role].axis());
  2151. if (this._duration <= 0 || this._firstDraw || !this._lastAxisDrew[position]) {
  2152. gridGroup.attr("transform", axisTransform).call(comp);
  2153. } else {
  2154. gridGroup.transition().duration(this._duration).attr("transform", axisTransform).call(comp);
  2155. }
  2156. this._lastGridDrew[position] = comp.renderedShapes();
  2157. },
  2158. /**
  2159. * If the grid selector for the position is defined, clear the shapes from the grid group.
  2160. * @param (int) position The grid position, BOTTOM, TOP, LEFT, RIGHT
  2161. */
  2162. clearGrid : function(position) {
  2163. if (this._gridSelectors[position]) {
  2164. this._clearGrid.axis(null);
  2165. this._gridSelectors[position].call(this._clearGrid);
  2166. }
  2167. this._lastGridDrew[position] = false;
  2168. },
  2169. /**
  2170. * @param (boolean) visible Whether the manager should draw axes
  2171. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2172. */
  2173. /** @expose */
  2174. visible : function(visible) {
  2175. this._visible = visible;
  2176. return this;
  2177. },
  2178. /**
  2179. * @param (int) duration The transition duration; if <= 0, no transition is used.
  2180. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2181. */
  2182. /** @expose */
  2183. duration : function(duration) {
  2184. this._duration = duration;
  2185. return this;
  2186. },
  2187. /**
  2188. * @param (boolean) transpose Whether to transpose the chart (switch the positions of the X and Y axis)
  2189. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2190. */
  2191. /** @expose */
  2192. transpose : function(transpose) {
  2193. this._transpose = transpose;
  2194. return this;
  2195. },
  2196. /**
  2197. * @param (boolean) swapX Whether to switch the postitions of the X1 and X2 axes
  2198. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2199. */
  2200. /** @expose */
  2201. swapX : function(swapX) {
  2202. this._swapX = swapX;
  2203. return this;
  2204. },
  2205. /**
  2206. * @param (boolean) swapY Whether to switch the postitions of the Y1 and Y2 axes
  2207. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2208. */
  2209. /** @expose */
  2210. swapY : function(swapY) {
  2211. this._swapY = swapY;
  2212. return this;
  2213. },
  2214. /**
  2215. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2216. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale The coordinate scale for that role, may be null
  2217. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2218. */
  2219. /** @expose */
  2220. scale : function(role, scale) {
  2221. this._scales[role] = scale;
  2222. return this;
  2223. },
  2224. /**
  2225. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2226. * @param (boolean) suppressLabels Whether to suppress the labels when panning the axis
  2227. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2228. */
  2229. /** @expose */
  2230. suppressPanLabels : function(role, suppressLabels) {
  2231. this._suppressPanLabels[role] = suppressLabels;
  2232. return this;
  2233. },
  2234. /**
  2235. * 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.
  2236. * @param (int) role The role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2237. * @return (com.ibm.rave.bundles.components.AxisComponentImpl) The component for the role
  2238. */
  2239. /** @expose */
  2240. axisComponent : function(role) {
  2241. if (!this._axisComponents[role]) {
  2242. this._axisComponents[role] = new com_ibm_rave_bundles_components_AxisComponentImpl();
  2243. }
  2244. return this._axisComponents[role];
  2245. },
  2246. /**
  2247. * 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.
  2248. * @param (int) role The role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2249. * @return (com.ibm.rave.bundles.components.GridComponentImpl) The component for the role
  2250. */
  2251. /** @expose */
  2252. gridComponent : function(role) {
  2253. if (!this._gridComponents[role]) {
  2254. this._gridComponents[role] = new com_ibm_rave_bundles_components_GridComponentImpl();
  2255. }
  2256. return this._gridComponents[role];
  2257. },
  2258. /**
  2259. * Set the bundle &lt;defs&gt; node. Clip paths will be defined in this node.
  2260. * @param (rave['internal']['Selector']) defs The defs node
  2261. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2262. */
  2263. /** @expose */
  2264. defsSelector : function(defs) {
  2265. this._defs = com_ibm_rave_bundles_components_AxesManager.checkSelector(defs);
  2266. return this;
  2267. },
  2268. /**
  2269. * Set the selector for an axis group node.
  2270. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2271. * @param (rave['internal']['Selector']) axisGroup The axis group node, may be null
  2272. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2273. */
  2274. /** @expose */
  2275. axisSelector : function(position, axisGroup) {
  2276. this._axisSelectors[position] = com_ibm_rave_bundles_components_AxesManager.checkSelector(axisGroup);
  2277. return this;
  2278. },
  2279. /**
  2280. * Set the selector for a grid group node.
  2281. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2282. * @param (rave['internal']['Selector']) gridGroup The grid group node, may be null
  2283. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2284. */
  2285. /** @expose */
  2286. gridSelector : function(position, gridGroup) {
  2287. this._gridSelectors[position] = com_ibm_rave_bundles_components_AxesManager.checkSelector(gridGroup);
  2288. return this;
  2289. },
  2290. /**
  2291. * Set the element (grid) bounds rectangle to a copy of the given rectangle.
  2292. * @param (rave['internal']['RectStruct']) elementRect The rectangle, if null the bounds are set to 0,0,0,0
  2293. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2294. */
  2295. /** @expose */
  2296. elementRect : function(elementRect) {
  2297. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, elementRect);
  2298. return this;
  2299. },
  2300. /**
  2301. * Set an axis bounds rectangle to a copy of the given rectangle.
  2302. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2303. * @param (rave['internal']['RectStruct']) axisRect The axis bounds, if null the bounds are set to 0,0,0,0
  2304. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2305. */
  2306. /** @expose */
  2307. axisRect : function(position, axisRect) {
  2308. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[position], axisRect);
  2309. return this;
  2310. },
  2311. /**
  2312. * 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.
  2313. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2314. */
  2315. /** @expose */
  2316. useDefaultSelectors : function() {
  2317. this.defsSelector(this._context.node.select("defs"));
  2318. this.axisSelector(0, this._context.node.select("g.axisTransform.bottom"));
  2319. this.axisSelector(1, this._context.node.select("g.axisTransform.top"));
  2320. this.axisSelector(2, this._context.node.select("g.axisTransform.left"));
  2321. this.axisSelector(3, this._context.node.select("g.axisTransform.right"));
  2322. this.gridSelector(0, this._context.node.select("g.grid.bottom"));
  2323. this.gridSelector(1, this._context.node.select("g.grid.top"));
  2324. this.gridSelector(2, this._context.node.select("g.grid.left"));
  2325. this.gridSelector(3, this._context.node.select("g.grid.right"));
  2326. return this;
  2327. },
  2328. /**
  2329. * Convenience method: Set the element rectangle and axis rectangles from the rectangles in the layout.
  2330. * @param (com.ibm.rave.bundles.components.ChartLayoutComponentImpl) layoutInfo Layout information
  2331. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2332. */
  2333. /** @expose */
  2334. useBoundsFromLayout : function(layoutInfo) {
  2335. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, layoutInfo.elementRect());
  2336. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[0], layoutInfo.bottomRect());
  2337. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[1], layoutInfo.topRect());
  2338. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[2], layoutInfo.leftRect());
  2339. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[3], layoutInfo.rightRect());
  2340. return this;
  2341. },
  2342. /**
  2343. * 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.
  2344. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2345. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2346. */
  2347. /** @expose */
  2348. useDefaultX1Properties : function(setGridParameters) {
  2349. 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"))));
  2350. var titleFontStyle = (this._context.getPropertyValue("axis.x.title.style.font"));
  2351. var labelFontStyle = (this._context.getPropertyValue("axis.x.labels.style.font"));
  2352. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2353. this.axisComponent(0).labelStyle(labelFontStyle);
  2354. } else {
  2355. 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")));
  2356. }
  2357. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2358. this.axisComponent(0).titleStyle(titleFontStyle);
  2359. } else {
  2360. 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")));
  2361. }
  2362. if (setGridParameters) {
  2363. 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")));
  2364. }
  2365. this.suppressPanLabels(0, (this._context.getPropertyValue("axis.x.labels.zoomPan")));
  2366. return this;
  2367. },
  2368. /**
  2369. * 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.
  2370. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2371. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2372. */
  2373. /** @expose */
  2374. useDefaultY1Properties : function(setGridParameters) {
  2375. 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")));
  2376. var titleFontStyle = (this._context.getPropertyValue("axis.y.title.style.font"));
  2377. var labelFontStyle = (this._context.getPropertyValue("axis.y.labels.style.font"));
  2378. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2379. this.axisComponent(2).labelStyle(labelFontStyle);
  2380. } else {
  2381. 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")));
  2382. }
  2383. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2384. this.axisComponent(2).titleStyle(titleFontStyle);
  2385. } else {
  2386. 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")));
  2387. }
  2388. if (setGridParameters) {
  2389. 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")));
  2390. }
  2391. this.suppressPanLabels(2, (this._context.getPropertyValue("axis.y.labels.zoomPan")));
  2392. return this;
  2393. },
  2394. /**
  2395. * 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.
  2396. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2397. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2398. */
  2399. /** @expose */
  2400. useDefaultY2Properties : function(setGridParameters) {
  2401. 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")));
  2402. var titleFontStyle = (this._context.getPropertyValue("axis.y2.title.style.font"));
  2403. var labelFontStyle = (this._context.getPropertyValue("axis.y2.labels.style.font"));
  2404. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2405. this.axisComponent(3).labelStyle(labelFontStyle);
  2406. } else {
  2407. 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")));
  2408. }
  2409. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2410. this.axisComponent(3).titleStyle(titleFontStyle);
  2411. } else {
  2412. 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")));
  2413. }
  2414. if (setGridParameters) {
  2415. 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")));
  2416. }
  2417. this.suppressPanLabels(3, (this._context.getPropertyValue("axis.y2.labels.zoomPan")));
  2418. return this;
  2419. },
  2420. /**
  2421. * 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.
  2422. * @param (int) role One of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2423. * @param (Array) entries Non-null list of data slot entries
  2424. * @param (String) format One of {@link this.CustomFormatInfo#"none"} or {@link this.CustomFormatInfo#"percent"}
  2425. * @param (rave['internal']['ValueFunction']) defaultFunction Default function to use if no custom formatter is defined for the axis, may be null
  2426. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2427. */
  2428. /** @expose */
  2429. setTickFormatterList : function(role, entries, format, defaultFunction) {
  2430. var fmtRole;
  2431. switch (role) {
  2432. case 2:
  2433. fmtRole = "ROLE_Y1";
  2434. break;
  2435. case 1:
  2436. fmtRole = "ROLE_X2";
  2437. break;
  2438. case 3:
  2439. fmtRole = "ROLE_Y2";
  2440. break;
  2441. case 0:
  2442. default:
  2443. fmtRole = "ROLE_X1";
  2444. break;
  2445. }
  2446. 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);
  2447. this.axisComponent(role).tickFormat(fmt);
  2448. 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);
  2449. this.axisComponent(role).simplifiedTickFormat(simplefmt);
  2450. return this;
  2451. },
  2452. /**
  2453. * 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.
  2454. * @param (int) role One of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2455. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  2456. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2457. */
  2458. /** @expose */
  2459. setTickFormatter : function(role, entry) {
  2460. var entries = [];
  2461. if (entry) {
  2462. entries.push(entry);
  2463. }
  2464. return this.setTickFormatterList(role, entries, "none", null);
  2465. },
  2466. /**
  2467. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined scale.
  2468. * @param (Number) padding Padding, relevant only for ordinal scales
  2469. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2470. * @param (int) pixelPad Pixel padding at each end
  2471. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2472. */
  2473. /** @expose */
  2474. setScaleRanges : function(padding, outerPadding, pixelPad) {
  2475. this.setIndependentScaleRanges(padding, outerPadding, pixelPad);
  2476. this.setDependentScaleRanges(padding, outerPadding, pixelPad);
  2477. return this;
  2478. },
  2479. /**
  2480. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined independent scale.
  2481. * @param (Number) padding Padding, relevant only for ordinal scales
  2482. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2483. * @param (int) pixelPad Pixel padding at each end
  2484. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2485. */
  2486. /** @expose */
  2487. setIndependentScaleRanges : function(padding, outerPadding, pixelPad) {
  2488. this.setScaleRangePadded(this._scales[0], false, padding, outerPadding, pixelPad);
  2489. this.setScaleRangePadded(this._scales[1], false, padding, outerPadding, pixelPad);
  2490. return this;
  2491. },
  2492. /**
  2493. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined independent scale.
  2494. * @param (Number) padding Padding, relevant only for ordinal scales
  2495. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2496. * @param (int) pixelPad Pixel padding at each end
  2497. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2498. */
  2499. /** @expose */
  2500. setDependentScaleRanges : function(padding, outerPadding, pixelPad) {
  2501. this.setScaleRangePadded(this._scales[2], true, padding, outerPadding, pixelPad);
  2502. this.setScaleRangePadded(this._scales[3], true, padding, outerPadding, pixelPad);
  2503. return this;
  2504. },
  2505. /**
  2506. * 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)} .
  2507. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2508. * @param (rave['library']['internal']['DataSlotEntry']) slot DataSlotEntry to be associated with the axis role.
  2509. */
  2510. setDataSlot$0 : function(role, slot) {
  2511. this.setDataSlot$1(role, [slot]);
  2512. return this;
  2513. },
  2514. /**
  2515. * Set a list of data slot entries that will be associated with the specified axis role.
  2516. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2517. * @param (Array) slots List of DataSlotEntry to be associated with the axis role.
  2518. */
  2519. setDataSlot$1 : function(role, slots) {
  2520. if (role < 4 && role >= 0) {
  2521. this._dataSlotEntries[role].length = 0;
  2522. if (slots) {
  2523. for (var __i_enFor0 = 0, __exp_enFor0 = slots, __len_enFor0 = __exp_enFor0.length;
  2524. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2525. var slot = __exp_enFor0[__i_enFor0];
  2526. this._dataSlotEntries[role].push(slot);
  2527. }
  2528. }
  2529. }
  2530. return this;
  2531. },
  2532. /**
  2533. * </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.
  2534. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale Bundle independent scale
  2535. * @param (boolean) dependent Whether this is the dependent scale
  2536. * @param (Number) padding Padding, relevant only for ordinal scales
  2537. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2538. * @param (int) pixelPad Pixel padding at each end
  2539. */
  2540. setScaleRangePadded : function(scale, dependent, padding, outerPadding, pixelPad) {
  2541. if (scale) {
  2542. var min, max;
  2543. if (dependent == this._transpose) {
  2544. min = this._elementRect.x + pixelPad;
  2545. max = this._elementRect.x + this._elementRect.width - pixelPad;
  2546. } else {
  2547. if (scale.isContinuous()) {
  2548. min = this._elementRect.y + this._elementRect.height - pixelPad;
  2549. max = this._elementRect.y + pixelPad;
  2550. } else {
  2551. min = this._elementRect.y + pixelPad;
  2552. max = this._elementRect.y + this._elementRect.height - pixelPad;
  2553. }
  2554. }
  2555. scale.range(min, max, padding, outerPadding);
  2556. }
  2557. },
  2558. /**
  2559. * Given a geometric position BOTTOM, TOP, LEFT, or RIGHT, return the role X1, X2, Y1, or Y2 used by that role.
  2560. * @param (int) position The position index
  2561. * @return (int) The role index
  2562. */
  2563. positionToRole : function(position) {
  2564. var r = position;
  2565. if (this._transpose) {
  2566. r = (r + 2) % 4;
  2567. }
  2568. if (this._swapX && r < 2) {
  2569. r = 1 - r;
  2570. }
  2571. if (this._swapY && r > 1) {
  2572. r = 5 - r;
  2573. }
  2574. return r;
  2575. },
  2576. /**
  2577. * Given a role X1, X2, Y1, or Y2, return the geometric position BOTTOM, TOP, LEFT, or RIGHT for that role.
  2578. * @param (int) role The role index
  2579. * @return (int) The position index
  2580. */
  2581. roleToPosition : function(role) {
  2582. var p = role;
  2583. if (this._swapX && role < 2) {
  2584. p = 1 - p;
  2585. }
  2586. if (this._swapY && p > 1) {
  2587. p = 5 - p;
  2588. }
  2589. if (this._transpose) {
  2590. p = (p + 2) % 4;
  2591. }
  2592. return p;
  2593. },
  2594. /**
  2595. * Sets the magnitude for the tick interval.
  2596. * @param (int) role role index of the axis
  2597. * @param (Number) tickMagnitude power of 10
  2598. * @return (com.ibm.rave.bundles.components.AxesManager) this
  2599. */
  2600. /** @expose */
  2601. scaleTickMagnitude : function(role, tickMagnitude) {
  2602. this.axisComponent(role).scaleTickMagnitude(tickMagnitude);
  2603. return this;
  2604. },
  2605. /** @expose */
  2606. setDataSlot : function(a0, a1) {
  2607. var args = arguments;
  2608. if (args.length == 2 && typeof a1 === "function") {
  2609. return this.setDataSlot$0(a0, a1);
  2610. }
  2611. return this.setDataSlot$1(a0, a1);
  2612. }
  2613. });
  2614. /**
  2615. * @param (rave['internal']['Selector']) s A selector
  2616. * @return (rave['internal']['Selector']) s if it is non-null and has at least one node, null otherwise
  2617. */
  2618. com_ibm_rave_bundles_components_AxesManager.checkSelector = function(s) {
  2619. return s && !(s.empty()) ? s : null;
  2620. };
  2621. /**
  2622. * Set a rectangle to a copy of another. If the source is null, the target is set to 0,0,0,0
  2623. * @param (rave['internal']['RectStruct']) target A non-null rectangle
  2624. * @param (rave['internal']['RectStruct']) source A possibly-null rectnalge
  2625. */
  2626. com_ibm_rave_bundles_components_AxesManager.setRect = function(target, source) {
  2627. if (source) {
  2628. target.x = source.x;
  2629. target.y = source.y;
  2630. target.width = source.width;
  2631. target.height = source.height;
  2632. } else {
  2633. target.x = 0;
  2634. target.y = 0;
  2635. target.width = 0;
  2636. target.height = 0;
  2637. }
  2638. };
  2639. /**
  2640. * A ValueFunction that appends '%' to the value.
  2641. * @param (int) n Number of digits
  2642. */
  2643. /** @expose */
  2644. com_ibm_rave_bundles_components_AxesManager.percentFormat = function(n) {
  2645. var digits = "." + n + "f";
  2646. var format = rave.format(digits);
  2647. return function(value, ix, gix) {
  2648. return format.call(null, value, 0, 0) + "%";
  2649. };
  2650. };
  2651. /**
  2652. * Called prior to chart layout. Axes are configured with no real bounding constraints to calculate their preferred size.
  2653. */
  2654. com_ibm_rave_bundles_components_AxesManager.AxisLayout = rave['internal']['Declare']({
  2655. /** @expose */
  2656. position : 0,
  2657. /** @expose */
  2658. score : 0,
  2659. constructor : function(position, score) {
  2660. this.position = position;
  2661. this.score = score;
  2662. }
  2663. });
  2664. /**
  2665. * Logical first X (independent) axis, default position bottom
  2666. */
  2667. /** @expose */
  2668. com_ibm_rave_bundles_components_AxesManager.X1 = 0;
  2669. /**
  2670. * Logical second X (independent) axis, default position top
  2671. */
  2672. /** @expose */
  2673. com_ibm_rave_bundles_components_AxesManager.X2 = 1;
  2674. /**
  2675. * Logical first Y (dependent) axis, default position left
  2676. */
  2677. /** @expose */
  2678. com_ibm_rave_bundles_components_AxesManager.Y1 = 2;
  2679. /**
  2680. * Logical first Y (dependent) axis, default position right
  2681. */
  2682. /** @expose */
  2683. com_ibm_rave_bundles_components_AxesManager.Y2 = 3;
  2684. /**
  2685. * Geometric group on bottom
  2686. */
  2687. /** @expose */
  2688. com_ibm_rave_bundles_components_AxesManager.BOTTOM = 0;
  2689. /**
  2690. * Geometric group on top
  2691. */
  2692. /** @expose */
  2693. com_ibm_rave_bundles_components_AxesManager.TOP = 1;
  2694. /**
  2695. * Geometric group on left
  2696. */
  2697. /** @expose */
  2698. com_ibm_rave_bundles_components_AxesManager.LEFT = 2;
  2699. /**
  2700. * Geometric group on right
  2701. */
  2702. /** @expose */
  2703. com_ibm_rave_bundles_components_AxesManager.RIGHT = 3;
  2704. /**
  2705. * Maps the role indexes to the role strings used by the components API
  2706. */
  2707. com_ibm_rave_bundles_components_AxesManager.ROLES = ["ROLE_X1", "ROLE_X2", "ROLE_Y1", "ROLE_Y2"];
  2708. /**
  2709. * Maps the role indexes to the role strings used by the custom formatter API. TODO: Unify the strings
  2710. */
  2711. com_ibm_rave_bundles_components_AxesManager.ROLE_FORMATTERS = ["ROLE_X1", "ROLE_X2", "ROLE_Y1", "ROLE_Y2"];
  2712. /**
  2713. * Maps the position indexes to the orient strings used by D3
  2714. */
  2715. com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS = ["bottom", "top", "left", "right"];
  2716. /**
  2717. * Maps the position indexes to the custom formatter strings
  2718. */
  2719. com_ibm_rave_bundles_components_AxesManager.FORMATTERS = ["bottom", "top", "left", "right"];
  2720. // $source: com/ibm/rave/bundles/component/AxisComponent
  2721. /************************************************************************
  2722. ** IBM Confidential
  2723. **
  2724. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2725. **
  2726. ** (C) Copyright IBM Corp. 2017
  2727. **
  2728. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2729. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2730. ************************************************************************/
  2731. // GENERATED
  2732. /**
  2733. * <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>
  2734. */
  2735. var com_ibm_rave_bundles_component_AxisComponent = rave['internal']['Declare'].implement(
  2736. /**
  2737. * @return (String) The role of the axis in the chart
  2738. */
  2739. //role : function() {},
  2740. /**
  2741. * @return (rave['internal']['Axis']) The capability Axis used by this AxisComponent
  2742. */
  2743. //axis : function() {},
  2744. /**
  2745. * The tickFormat is applied to the values of the ticks to create the string that is displayed.
  2746. * @param (rave['internal']['ValueFunction']) tickFormat The new tickFormat
  2747. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2748. */
  2749. //tickFormat : function(tickFormat) {},
  2750. /**
  2751. * Get the tickFormat function used by this component. May be null.
  2752. * @return (rave['internal']['ValueFunction']) Format function, or null
  2753. */
  2754. //tickFormat : function() {},
  2755. /**
  2756. * Set the indicator to be used for truncated text ex: indicator set to "..." , results in helloworld - > hello...
  2757. * @param (String) indicator the string to be placed to indicated truncated text
  2758. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2759. */
  2760. //textTruncateIndicator : function(indicator) {},
  2761. /**
  2762. * Whether to display the axis title.
  2763. * @param (boolean) displayAxisTitle true to display the axis title, false otherwise
  2764. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2765. */
  2766. //displayAxisTitle : function(displayAxisTitle) {},
  2767. /**
  2768. * Whether to display the axis line.
  2769. * @param (boolean) displayAxisLine true to display the axis line, false otherwise
  2770. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2771. */
  2772. //displayAxisLine : function(displayAxisLine) {},
  2773. /**
  2774. * Whether to display the axis tick marks.
  2775. * @param (boolean) displayTicks true to display the axis ticks, false otherwise
  2776. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2777. */
  2778. //displayTicks : function(displayTicks) {},
  2779. /**
  2780. * Whether to display the axis labels, as set by the show axis labels property
  2781. * @param (boolean) displayTickLabels true to display the axis tick labels, false otherwise
  2782. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2783. */
  2784. //displayTickLabels : function(displayTickLabels) {},
  2785. /**
  2786. * Whether to display the axis labels, as set by the hide pan-zoom labels property
  2787. * @param (boolean) showPanZoomTickLabels true to display the axis tick labels, false otherwise
  2788. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2789. */
  2790. //showPanZoomTickLabels : function(showPanZoomTickLabels) {},
  2791. /**
  2792. * @param (String) axisTitle The new axisTitle
  2793. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2794. */
  2795. //axisTitle : function(axisTitle) {},
  2796. /**
  2797. * 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)} .
  2798. * @param (String) axisColor The new line and tick color
  2799. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2800. */
  2801. //axisColor : function(axisColor) {},
  2802. /**
  2803. * The color used to draw the axis line.
  2804. * @param (String) lineColor The new lineColor
  2805. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2806. */
  2807. //lineColor : function(lineColor) {},
  2808. /**
  2809. * The color used to draw the axis ticks.
  2810. * @param (String) tickColor The new tickColor
  2811. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2812. */
  2813. //tickColor : function(tickColor) {},
  2814. /**
  2815. * The color used to draw the axis labels.
  2816. * @param (String) labelColor The new labelColor
  2817. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2818. */
  2819. //labelColor : function(labelColor) {},
  2820. /**
  2821. * The style for the axis labels.
  2822. * @param (String) fontStyle CSS string of font properties
  2823. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2824. */
  2825. //labelStyle : function(fontStyle) {},
  2826. /**
  2827. * The style for the axis labels.
  2828. * @param (String) fill The color used to draw the labels
  2829. * @param (String) fontSize CSS font size
  2830. * @param (String) fontFamily CSS font-families list
  2831. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2832. */
  2833. //labelStyle : function(fill, fontSize, fontFamily) {},
  2834. /**
  2835. * The color used to draw the axis title.
  2836. * @param (String) titleColor The new titleColor
  2837. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2838. */
  2839. //titleColor : function(titleColor) {},
  2840. /**
  2841. * The style for the axis title.
  2842. * @param (String) fontStyle CSS string of font properties
  2843. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2844. */
  2845. //titleStyle : function(fontStyle) {},
  2846. /**
  2847. * The style for the axis title.
  2848. * @param (String) fill The color used to draw the title
  2849. * @param (String) fontSize CSS font size
  2850. * @param (String) fontFamily CSS font-families list
  2851. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2852. */
  2853. //titleStyle : function(fill, fontSize, fontFamily) {}
  2854. );
  2855. /**
  2856. * The string returned by {@link #this.type()} is "AxisComponent".
  2857. */
  2858. /** @expose */
  2859. com_ibm_rave_bundles_component_AxisComponent.COMPONENT_TYPE = "AxisComponent";
  2860. /**
  2861. * Returned by {@link #this.role()} for the first independent axis.
  2862. */
  2863. /** @expose */
  2864. com_ibm_rave_bundles_component_AxisComponent.ROLE_X1 = "ROLE_X1";
  2865. /**
  2866. * Returned by {@link #this.role()} for the first dependent axis.
  2867. */
  2868. /** @expose */
  2869. com_ibm_rave_bundles_component_AxisComponent.ROLE_Y1 = "ROLE_Y1";
  2870. /**
  2871. * Returned by {@link #this.role()} for the second independent axis.
  2872. */
  2873. /** @expose */
  2874. com_ibm_rave_bundles_component_AxisComponent.ROLE_X2 = "ROLE_X2";
  2875. /**
  2876. * Returned by {@link #this.role()} for the second dependent axis.
  2877. */
  2878. /** @expose */
  2879. com_ibm_rave_bundles_component_AxisComponent.ROLE_Y2 = "ROLE_Y2";
  2880. // $source: com/ibm/rave/bundles/utilities/TextCrossfader
  2881. /************************************************************************
  2882. ** IBM Confidential
  2883. **
  2884. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2885. **
  2886. ** (C) Copyright IBM Corp. 2017
  2887. **
  2888. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2889. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2890. ************************************************************************/
  2891. // GENERATED
  2892. /**
  2893. * <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>
  2894. */
  2895. var com_ibm_rave_bundles_utilities_TextCrossfader = rave['internal']['Declare']({
  2896. });
  2897. /**
  2898. * <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!
  2899. * @param (rave['internal']['Selection']) selection Selection containing the single text node, may be a transition
  2900. * @param (String) oldText Old value of the text string, may be null
  2901. * @param (String) newText New value of the text string, may be null
  2902. * @param (Object) fillOpacity Fill opacity, may be null (in which case 1.0 is assumed)
  2903. * @param (double) delay Number between 0 and 0.5 controlling the timing of the fade
  2904. * @return (rave['internal']['Selection']) The selection, modified by the new text and fill-opacity
  2905. */
  2906. /** @expose */
  2907. com_ibm_rave_bundles_utilities_TextCrossfader.textCrossFade = function(selection, oldText, newText, fillOpacity, delay) {
  2908. if (!(selection.isTransition())) {
  2909. return selection.text(newText);
  2910. }
  2911. var _t = (selection).tween("text", function(data, index, groupIndex) {
  2912. return function(t) {
  2913. this.rave_setText(t < 0.5 ? oldText : newText);
  2914. };
  2915. });
  2916. var t0 = Math.max(0.0, Math.min(0.5, delay));
  2917. if (t0 == 0.5 || (oldText == null && newText == null) || (oldText != null && oldText == newText)) {
  2918. return selection;
  2919. }
  2920. var opacity = fillOpacity == null ? 1.0 : + (fillOpacity);
  2921. var tf = 1.0 / (0.5 - t0);
  2922. return _t.tween("fill-opacity", function(data, index, groupIndex) {
  2923. return function(t) {
  2924. if (t <= t0 || t >= (1.0 - t0)) {
  2925. this.rave_setStyle("fill-opacity", fillOpacity);
  2926. } else {
  2927. this.rave_setStyle("fill-opacity", opacity * Math.abs(t - 0.5) * tf);
  2928. }
  2929. };
  2930. });
  2931. };
  2932. // $source: com/ibm/rave/bundles/utilities/BundleLabelDropper
  2933. /************************************************************************
  2934. ** IBM Confidential
  2935. **
  2936. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2937. **
  2938. ** (C) Copyright IBM Corp. 2017
  2939. **
  2940. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2941. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2942. ************************************************************************/
  2943. // GENERATED
  2944. var com_ibm_rave_bundles_utilities_BundleLabelDropper = rave['internal']['Declare']({
  2945. //_dropOverlap : null,
  2946. labelCount : 0,
  2947. _$functionClassMethod : function() {
  2948. var _$self = function(args) {
  2949. if (args !== null || arguments.length > 1){
  2950. args = Array.prototype.slice.call(arguments, 0);
  2951. }
  2952. {
  2953. _$self.drop(args[0], ((args[1])));
  2954. return null;
  2955. }
  2956. };
  2957. return _$self;
  2958. },
  2959. /** @expose */
  2960. constructor : function() {
  2961. this._dropOverlap = (rave.capabilities.extension("position")).drop().remove(false);
  2962. this._dropOverlap.setOverlapGap(4.0);
  2963. },
  2964. /**
  2965. * Drop the overlapping labels or reset the overlap.
  2966. * @param (rave['internal']['Selection']) labels The selector for the labels
  2967. * @param (boolean) removeOverlap true to remove the overlapping labels, false to reset
  2968. */
  2969. /** @expose */
  2970. drop : function(labels, removeOverlap) {
  2971. if (!(labels.isTransition())) {
  2972. this.applyLabelDrop(labels, removeOverlap);
  2973. } else {
  2974. var steps = [0, 25, 75];
  2975. var self = this;
  2976. (labels).tween("__pointLabelDrop__", function(data, index, groupIndex) {
  2977. if (index == 0) {
  2978. return function(t) {
  2979. var currentStep = Math.floor(t * 100);
  2980. if (steps.length > 0 && currentStep < 100 && currentStep >= steps[0]) {
  2981. steps.splice(0, 1);
  2982. self.applyLabelDrop(labels, removeOverlap);
  2983. }
  2984. };
  2985. }
  2986. return null;
  2987. });
  2988. this.labelCount = 0;
  2989. (labels).each(function(data, index, groupIndex) {
  2990. ++self.labelCount;
  2991. }).each("end", function(args) {
  2992. if (args !== null || arguments.length > 1){
  2993. args = Array.prototype.slice.call(arguments, 0);
  2994. }
  2995. {
  2996. if (--self.labelCount == 0) {
  2997. self.applyLabelDrop(labels, removeOverlap);
  2998. }
  2999. return null;
  3000. }
  3001. });
  3002. }
  3003. },
  3004. applyLabelDrop : function(labels, removeOverlap) {
  3005. if (removeOverlap) {
  3006. labels.call(this._dropOverlap);
  3007. } else {
  3008. this._dropOverlap.reset(labels);
  3009. }
  3010. },
  3011. /** @expose */
  3012. configureForDataLabels : function(rect) {
  3013. if (rect) {
  3014. var ex = [[rect.x, rect.y], [rect.x + rect.width, rect.y + rect.height]];
  3015. this._dropOverlap.extent(ex);
  3016. }
  3017. this._dropOverlap.noClipping();
  3018. }
  3019. });
  3020. /**
  3021. * Drop overlap extension
  3022. */
  3023. //com_ibm_rave_bundles_utilities_BundleLabelDropper.POSITION_EXTENSION = "position";
  3024. /**
  3025. * space between labels during overlap testing
  3026. */
  3027. com_ibm_rave_bundles_utilities_BundleLabelDropper.OVERLAP_GAP = 4;
  3028. // $source: com/ibm/rave/bundles/components/StyleStructs
  3029. /************************************************************************
  3030. ** IBM Confidential
  3031. **
  3032. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3033. **
  3034. ** (C) Copyright IBM Corp. 2017
  3035. **
  3036. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3037. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3038. ************************************************************************/
  3039. // GENERATED
  3040. /**
  3041. * Struct classes to hold style properties.
  3042. */
  3043. var com_ibm_rave_bundles_components_StyleStructs = rave['internal']['Declare']({
  3044. });
  3045. /**
  3046. * Filled shape style properties.
  3047. */
  3048. com_ibm_rave_bundles_components_StyleStructs.ShapeStyle = function() {
  3049. this._fill = null;
  3050. this._stroke = null;
  3051. this._strokeWidth = null;
  3052. };
  3053. /**
  3054. * Line style properties.
  3055. */
  3056. com_ibm_rave_bundles_components_StyleStructs.LineStyle = function() {
  3057. this._stroke = null;
  3058. this._strokeWidth = null;
  3059. this._dashArray = null;
  3060. };
  3061. // $source: com/ibm/rave/bundles/component/GridComponent
  3062. /************************************************************************
  3063. ** IBM Confidential
  3064. **
  3065. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3066. **
  3067. ** (C) Copyright IBM Corp. 2017
  3068. **
  3069. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3070. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3071. ************************************************************************/
  3072. // GENERATED
  3073. /**
  3074. * <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>
  3075. */
  3076. var com_ibm_rave_bundles_component_GridComponent = rave['internal']['Declare'].implement(
  3077. /**
  3078. * @return (String) The role of the grid in the chart
  3079. */
  3080. //role : function() {},
  3081. /**
  3082. * Whether to display the gridlines.
  3083. * @param (boolean) displayGridlines The new displayGridlines
  3084. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3085. */
  3086. //displayGridlines : function(displayGridlines) {},
  3087. /**
  3088. * Set the line styling. Equivalent to calling {@link #this.gridlineColor(String)} and {@link #this.dashArray(String)} .
  3089. * @param (String) stroke The stroke color
  3090. * @param (String) dashArray The stroke-dasharray
  3091. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3092. */
  3093. //gridlineStyle : function(stroke, dashArray) {},
  3094. /**
  3095. * The color used to draw the gridlines.
  3096. * @param (String) gridlineColor The new stroke color
  3097. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3098. */
  3099. //gridlineColor : function(gridlineColor) {},
  3100. /**
  3101. * 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.
  3102. * @param (String) dashArray The new dash array
  3103. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3104. */
  3105. //dashArray : function(dashArray) {}
  3106. );
  3107. /**
  3108. * The string returned by {@link #this.type()} is "GridComponent".
  3109. */
  3110. /** @expose */
  3111. com_ibm_rave_bundles_component_GridComponent.COMPONENT_TYPE = "GridComponent";
  3112. // $source: com/ibm/rave/bundles/components/IntervalDataUtilities
  3113. /************************************************************************
  3114. ** IBM Confidential
  3115. **
  3116. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3117. **
  3118. ** (C) Copyright IBM Corp. 2017
  3119. **
  3120. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3121. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3122. ************************************************************************/
  3123. // GENERATED
  3124. /**
  3125. * 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.
  3126. */
  3127. var com_ibm_rave_bundles_components_IntervalDataUtilities = rave['internal']['Declare']({
  3128. });
  3129. /**
  3130. * <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>
  3131. * @param (Array) data Data array
  3132. * @param (rave['internal']['SingleValueFunction']) x X accessor, should not be null
  3133. * @param (rave['internal']['SingleValueFunction']) xScale Function to check if the X value is valid
  3134. * @param (rave['internal']['SingleValueFunction']) y Y accessor, should not be null
  3135. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3136. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3137. * @return (Array) Array of intervals for the data
  3138. */
  3139. /** @expose */
  3140. com_ibm_rave_bundles_components_IntervalDataUtilities.simpleBars = function(data, x, xScale, y, yStart, color, label) {
  3141. var result = [];
  3142. if (!data || data.length == 0 || !x || !y) {
  3143. return result;
  3144. }
  3145. data.forEach(function(d, ix, list) {
  3146. var xv = x(d);
  3147. if (xv != null && (!xScale || xScale(xv) != null)) {
  3148. var yv = y(d);
  3149. var yvStart = !yStart ? 0 : yStart(d);
  3150. if (yv != null && yvStart != null) {
  3151. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3152. r.key = ix;
  3153. r.ind1 = xv;
  3154. r.ind2 = r.ind1;
  3155. r.cind = r.ind1;
  3156. r.dep1 = yvStart;
  3157. r.dep2 = yv;
  3158. r.cdep = r.dep2;
  3159. r.color = color ? color(d) : null;
  3160. r.label = label ? label(d) : null;
  3161. r.value = r.dep2;
  3162. r._originalData = d;
  3163. r.valueAsPercentOfCategory = 100;
  3164. result.push(r);
  3165. }
  3166. }
  3167. return null;
  3168. });
  3169. var sum = 0;
  3170. for (var i = 0; i < result.length; ++i) {
  3171. var iData = result[i];
  3172. var value = + (iData.value);
  3173. sum += Math.abs(value);
  3174. }
  3175. if (sum != 0) {
  3176. for (var i = 0; i < result.length; ++i) {
  3177. var iData = result[i];
  3178. var value = + (iData.value);
  3179. iData.valueAsPercentOfColor = value / sum * 100;
  3180. }
  3181. }
  3182. return result;
  3183. };
  3184. /**
  3185. * Create intervals for bars in a clustered chart. This is similar to the simple bars, except the independent values are an array of accessors.
  3186. * @param (Array) data Data array
  3187. * @param (Array) x Independent accessor array, should not be null and no entries should be null
  3188. * @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
  3189. * @param (rave['internal']['SingleValueFunction']) y Dependent accessor, should not be null
  3190. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3191. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3192. * @return (Array) Array of intervals for the data
  3193. */
  3194. /** @expose */
  3195. com_ibm_rave_bundles_components_IntervalDataUtilities.clusteredBars = function(data, x, xScale, y, yStart, color, label) {
  3196. var result = [];
  3197. if (!data || data.length == 0 || !x || x.length == 0 || !y) {
  3198. return result;
  3199. }
  3200. var len = x.length;
  3201. var categories = {};
  3202. var colors = {};
  3203. data.forEach(function(d, ix, list) {
  3204. var OK = true;
  3205. var ind = [];
  3206. for (var i = 0; i < len; ++i) {
  3207. var xv = x[i](d);
  3208. if (xv == null || (xScale[i] && xScale[i](xv) == null)) {
  3209. OK = false;
  3210. break;
  3211. }
  3212. ind.push(xv);
  3213. if (i == 0) {
  3214. if (!(categories.hasOwnProperty(xv))) {
  3215. categories[""+(xv)] = 1;
  3216. }
  3217. } else if (!(colors.hasOwnProperty(xv))) {
  3218. colors[""+(xv)] = 1;
  3219. }
  3220. }
  3221. var dep = y(d);
  3222. var depStart = !yStart ? 0 : yStart(d);
  3223. if (OK && dep != null && depStart != null) {
  3224. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3225. r.key = ix;
  3226. r.ind1 = ind;
  3227. r.ind2 = ind;
  3228. r.cind = ind;
  3229. r.dep1 = depStart;
  3230. r.dep2 = dep;
  3231. r.cdep = r.dep2;
  3232. r.color = color ? color(d) : null;
  3233. r.label = label ? label(d) : null;
  3234. r.value = r.dep2;
  3235. r._originalData = d;
  3236. result.push(r);
  3237. }
  3238. return null;
  3239. });
  3240. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(categories), __len_enFor0 = __exp_enFor0.length;
  3241. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3242. var o = __exp_enFor0[__i_enFor0];
  3243. var s = ""+(o);
  3244. var sum = 0;
  3245. for (var i = 0; i < result.length; ++i) {
  3246. var iData = result[i];
  3247. if (s == (iData.ind1)[0]) {
  3248. var value = + (iData.value);
  3249. sum += Math.abs(value);
  3250. }
  3251. }
  3252. if (sum == 0) {
  3253. continue;
  3254. }
  3255. for (var i = 0; i < result.length; ++i) {
  3256. var iData = result[i];
  3257. if (s == (iData.ind1)[0]) {
  3258. var value = + (iData.value);
  3259. iData.valueAsPercentOfCategory = value / sum * 100;
  3260. }
  3261. }
  3262. }
  3263. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(colors), __len_enFor1 = __exp_enFor1.length;
  3264. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3265. var o = __exp_enFor1[__i_enFor1];
  3266. var s = ""+(o);
  3267. var sum = 0;
  3268. for (var i = 0; i < result.length; ++i) {
  3269. var iData = result[i];
  3270. if (s == iData.color) {
  3271. var value = + (iData.value);
  3272. sum += Math.abs(value);
  3273. }
  3274. }
  3275. if (sum == 0) {
  3276. continue;
  3277. }
  3278. for (var i = 0; i < result.length; ++i) {
  3279. var iData = result[i];
  3280. if (s == iData.color) {
  3281. var value = + (iData.value);
  3282. iData.valueAsPercentOfColor = value / sum * 100;
  3283. }
  3284. }
  3285. }
  3286. return result;
  3287. };
  3288. /**
  3289. * 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.
  3290. * @param (Array) data Data array
  3291. * @param (rave['internal']['SingleValueFunction']) x Independent accessor, should not be null
  3292. * @param (rave['internal']['SingleValueFunction']) xScale Possibly-null function to check if X values are in domain
  3293. * @param (rave['internal']['SingleValueFunction']) y Dependent accessor, should not be null
  3294. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3295. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3296. * @param (boolean) percent If true, create percent bars
  3297. * @return (Array) Array of intervals for the data
  3298. */
  3299. /** @expose */
  3300. com_ibm_rave_bundles_components_IntervalDataUtilities.stackedBars = function(data, x, xScale, y, color, label, percent) {
  3301. var result = [];
  3302. if (!data || data.length == 0 || !x || !y) {
  3303. return result;
  3304. }
  3305. var stacks = {};
  3306. var categories = {};
  3307. var colors = {};
  3308. data.forEach(function(d, ix, list) {
  3309. var xv = x(d);
  3310. if (xv != null && (!xScale || xScale(xv) != null)) {
  3311. var yv = y(d);
  3312. if (yv != null) {
  3313. var stack = stacks[xv];
  3314. if (!stack) {
  3315. stack = new com_ibm_rave_bundles_components_IntervalDataUtilities.Stack();
  3316. stacks[xv] = stack;
  3317. }
  3318. var dVal = + (yv);
  3319. if (!percent) {
  3320. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3321. r.key = ix;
  3322. r.ind1 = xv;
  3323. r.ind2 = xv;
  3324. r.cind = xv;
  3325. var sum = dVal < 0.0 ? stack.negativeSum : stack.positiveSum;
  3326. r.dep1 = sum;
  3327. r.dep2 = sum + dVal;
  3328. r.cdep = r.dep2;
  3329. r.color = color ? color(d) : null;
  3330. r.label = label ? label(d) : null;
  3331. r.value = dVal;
  3332. r._originalData = d;
  3333. result.push(r);
  3334. }
  3335. if (dVal < 0.0) {
  3336. stack.negativeSum += dVal;
  3337. } else {
  3338. stack.positiveCount++;
  3339. stack.positiveSum += dVal;
  3340. }
  3341. if (!(categories.hasOwnProperty(xv))) {
  3342. categories[""+(xv)] = 1;
  3343. }
  3344. if (color) {
  3345. var o = color(d);
  3346. if ((o != null) && !(colors.hasOwnProperty(o))) {
  3347. colors[""+(o)] = 1;
  3348. }
  3349. }
  3350. }
  3351. }
  3352. return null;
  3353. });
  3354. if (percent) {
  3355. data.forEach(function(d, ix, list) {
  3356. var xv = x(d);
  3357. if (xv != null && (!xScale || xScale(xv) != null)) {
  3358. var yv = y(d);
  3359. if (yv != null) {
  3360. var stack = stacks[xv];
  3361. var dVal = + (yv);
  3362. var percent;
  3363. if (dVal < 0.0) {
  3364. percent = -100.0 * dVal / stack.negativeSum;
  3365. } else if (stack.positiveSum > 0) {
  3366. percent = 100.0 * dVal / stack.positiveSum;
  3367. } else {
  3368. percent = 100.0 / stack.positiveCount;
  3369. }
  3370. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3371. r.key = ix;
  3372. r.ind1 = xv;
  3373. r.ind2 = xv;
  3374. r.cind = xv;
  3375. var sum = dVal < 0.0 ? stack.negativePercent : stack.positivePercent;
  3376. r.dep1 = sum;
  3377. r.dep2 = sum + percent;
  3378. r.cdep = r.dep2;
  3379. r.color = color ? color(d) : null;
  3380. r.label = label ? label(d) : null;
  3381. r.value = dVal;
  3382. r.valueAsPercentOfCategory = percent;
  3383. r._originalData = d;
  3384. result.push(r);
  3385. if (dVal < 0.0) {
  3386. stack.negativePercent += percent;
  3387. } else {
  3388. stack.positivePercent += percent;
  3389. }
  3390. }
  3391. }
  3392. return null;
  3393. });
  3394. } else {
  3395. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(categories), __len_enFor0 = __exp_enFor0.length;
  3396. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3397. var o = __exp_enFor0[__i_enFor0];
  3398. var s = ""+(o);
  3399. var sum = 0;
  3400. for (var i = 0; i < result.length; ++i) {
  3401. var iData = result[i];
  3402. if (s == iData.ind1) {
  3403. var value = + (iData.value);
  3404. sum += Math.abs(value);
  3405. }
  3406. }
  3407. if (sum == 0) {
  3408. continue;
  3409. }
  3410. for (var i = 0; i < result.length; ++i) {
  3411. var iData = result[i];
  3412. if (s == iData.ind1) {
  3413. var value = + (iData.value);
  3414. iData.valueAsPercentOfCategory = value / sum * 100;
  3415. }
  3416. }
  3417. }
  3418. }
  3419. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(colors), __len_enFor1 = __exp_enFor1.length;
  3420. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3421. var o = __exp_enFor1[__i_enFor1];
  3422. var s = ""+(o);
  3423. var sum = 0;
  3424. for (var i = 0; i < result.length; ++i) {
  3425. var iData = result[i];
  3426. if (s == iData.color) {
  3427. var value = + (iData.value);
  3428. sum += Math.abs(value);
  3429. }
  3430. }
  3431. if (sum == 0) {
  3432. continue;
  3433. }
  3434. for (var i = 0; i < result.length; ++i) {
  3435. var iData = result[i];
  3436. if (s == iData.color) {
  3437. var value = + (iData.value);
  3438. iData.valueAsPercentOfColor = value / sum * 100;
  3439. }
  3440. }
  3441. }
  3442. return result;
  3443. };
  3444. /**
  3445. * Structure class holding interval information.
  3446. */
  3447. com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData = rave['internal']['Declare']({
  3448. /**
  3449. * Key value; for now this is the data index
  3450. */
  3451. /** @expose */
  3452. key : null,
  3453. /**
  3454. * First independent value
  3455. */
  3456. /** @expose */
  3457. ind1 : null,
  3458. /**
  3459. * Second independent value (in all current uses, same as ind1)
  3460. */
  3461. /** @expose */
  3462. ind2 : null,
  3463. /**
  3464. * First dependent value
  3465. */
  3466. /** @expose */
  3467. dep1 : null,
  3468. /**
  3469. * Second dependent value
  3470. */
  3471. /** @expose */
  3472. dep2 : null,
  3473. /**
  3474. * The data value that the interval represents. Not the pixel value. Used in stacked chart
  3475. */
  3476. /** @expose */
  3477. value : null,
  3478. /**
  3479. * Color value
  3480. */
  3481. /** @expose */
  3482. color : null,
  3483. /**
  3484. * Label value
  3485. */
  3486. /** @expose */
  3487. label : null,
  3488. /**
  3489. * Callout independent value (in all current uses, same as ind1)
  3490. */
  3491. /** @expose */
  3492. cind : null,
  3493. /**
  3494. * Callout dependent value (dependent extent)
  3495. */
  3496. /** @expose */
  3497. cdep : null,
  3498. /** @expose */
  3499. _originalData : null,
  3500. /**
  3501. * The data value (in percentage) for specific category
  3502. */
  3503. /** @expose */
  3504. valueAsPercentOfCategory : NaN,
  3505. /**
  3506. * The data value (in percentage) across all categories
  3507. */
  3508. /** @expose */
  3509. valueAsPercentOfColor : NaN,
  3510. /** @expose */
  3511. originalData : function() {
  3512. return this._originalData;
  3513. },
  3514. /** @expose */
  3515. originalDataList : function() {
  3516. var list = [];
  3517. list.push(this._originalData);
  3518. return list;
  3519. }
  3520. });
  3521. com_ibm_rave_bundles_components_IntervalDataUtilities.Stack = function() {
  3522. this.positiveCount = 0;
  3523. this.positiveSum = 0;
  3524. this.negativeSum = 0;
  3525. this.positivePercent = 0;
  3526. this.negativePercent = 0;
  3527. };
  3528. /**
  3529. * Accessor for the callout dependent value
  3530. */
  3531. /** @expose */
  3532. com_ibm_rave_bundles_components_IntervalDataUtilities.CALLOUT_DEPENDENT_ACCESSOR = function(data) {
  3533. return (data).cdep;
  3534. };
  3535. /**
  3536. * Accessor for the callout independent value
  3537. */
  3538. /** @expose */
  3539. com_ibm_rave_bundles_components_IntervalDataUtilities.CALLOUT_INDEPENDENT_ACCESSOR = function(data) {
  3540. return (data).cind;
  3541. };
  3542. /**
  3543. * Accessor for the data value
  3544. */
  3545. /** @expose */
  3546. com_ibm_rave_bundles_components_IntervalDataUtilities.VALUE_ACCESSOR = function(data) {
  3547. return (data).value;
  3548. };
  3549. /**
  3550. * Accessor for data value as percent of category
  3551. */
  3552. /** @expose */
  3553. com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR = function(data) {
  3554. var percent = (data).valueAsPercentOfCategory;
  3555. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3556. };
  3557. /**
  3558. * Accessor for data value as percent of color (series)
  3559. */
  3560. /** @expose */
  3561. com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_COLOR_ACCESSOR = function(data) {
  3562. var percent = (data).valueAsPercentOfColor;
  3563. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3564. };
  3565. // $source: com/ibm/rave/bundles/data/PointDataUtilities
  3566. /************************************************************************
  3567. ** IBM Confidential
  3568. **
  3569. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3570. **
  3571. ** (C) Copyright IBM Corp. 2017
  3572. **
  3573. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3574. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3575. ************************************************************************/
  3576. // GENERATED
  3577. /**
  3578. * Utility class for building arrays of point datum objects from tabular data.
  3579. */
  3580. var com_ibm_rave_bundles_data_PointDataUtilities = rave['internal']['Declare']({
  3581. });
  3582. /**
  3583. * <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>
  3584. * @param (Array) data Input data, list of arbitrary objects
  3585. * @param (rave['internal']['SingleValueFunction']) xAccessor X accessor function, may be null
  3586. * @param (rave['internal']['SingleValueFunction']) xScale Scale to test if the X value should be included, may be null
  3587. * @param (rave['internal']['SingleValueFunction']) yAccessor Y accessor function, may be null
  3588. * @param (rave['internal']['SingleValueFunction']) yScale Scale to test if the Y value should be included, may be null
  3589. * @return (Array) List of PointData objects
  3590. */
  3591. /** @expose */
  3592. com_ibm_rave_bundles_data_PointDataUtilities.buildPoints = function(data, xAccessor, xScale, yAccessor, yScale) {
  3593. var result = [];
  3594. if (data) {
  3595. for (var __i_enFor0 = 0, __exp_enFor0 = data, __len_enFor0 = __exp_enFor0.length;
  3596. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3597. var o = __exp_enFor0[__i_enFor0];
  3598. if (o != null) {
  3599. var xv = null;
  3600. if (xAccessor) {
  3601. xv = xAccessor(o);
  3602. if (xv == null || (xScale && xScale(xv) == null)) {
  3603. continue;
  3604. }
  3605. }
  3606. var yv = null;
  3607. if (yAccessor) {
  3608. yv = yAccessor(o);
  3609. if (yv == null || (yScale && yScale(yv) == null)) {
  3610. continue;
  3611. }
  3612. }
  3613. var datum = new com_ibm_rave_bundles_data_PointDataUtilities.PointDatum();
  3614. datum._x = xv;
  3615. datum._y = yv;
  3616. datum._originalData = o;
  3617. result.push(datum);
  3618. }
  3619. }
  3620. }
  3621. return result;
  3622. };
  3623. /**
  3624. * 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.
  3625. */
  3626. com_ibm_rave_bundles_data_PointDataUtilities.PointDatum = rave['internal']['Declare']({
  3627. /**
  3628. * The X value
  3629. */
  3630. /** @expose */
  3631. _x : null,
  3632. /**
  3633. * The Y value
  3634. */
  3635. /** @expose */
  3636. _y : null,
  3637. /**
  3638. * The data value (in percentage) that the point represents
  3639. */
  3640. /** @expose */
  3641. _yAsPercentOfCategory : null,
  3642. /**
  3643. * The data value (in percentage) that the point represents
  3644. */
  3645. /** @expose */
  3646. _yAsPercentOfColor : null,
  3647. /**
  3648. * The original data
  3649. */
  3650. /** @expose */
  3651. _originalData : null,
  3652. /** @expose */
  3653. originalData : function() {
  3654. return this._originalData;
  3655. },
  3656. /** @expose */
  3657. originalDataList : function() {
  3658. var list = [];
  3659. list.push(this._originalData);
  3660. return list;
  3661. }
  3662. });
  3663. /**
  3664. * Accessor returning the _x property of a PointDatum.
  3665. */
  3666. /** @expose */
  3667. com_ibm_rave_bundles_data_PointDataUtilities.X_ACCESSOR = function(d) {
  3668. return (d)._x;
  3669. };
  3670. /**
  3671. * Accessor returning the _y property of a PointDatum.
  3672. */
  3673. /** @expose */
  3674. com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR = function(d) {
  3675. return (d)._y;
  3676. };
  3677. /**
  3678. * Accessor returning the _yAsPercentOfCategory property of a PointDatum.
  3679. */
  3680. /** @expose */
  3681. com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR = function(d) {
  3682. var percent = + ((d)._yAsPercentOfCategory);
  3683. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3684. };
  3685. /**
  3686. * Accessor returning the _yAsPercentOfColor property of a PointDatum.
  3687. */
  3688. /** @expose */
  3689. com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_COLOR_ACCESSOR = function(d) {
  3690. var percent = + ((d)._yAsPercentOfColor);
  3691. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3692. };
  3693. // $source: com/ibm/rave/bundles/utilities/ColorUtil
  3694. /************************************************************************
  3695. ** IBM Confidential
  3696. **
  3697. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3698. **
  3699. ** (C) Copyright IBM Corp. 2017
  3700. **
  3701. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3702. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3703. ************************************************************************/
  3704. // GENERATED
  3705. var com_ibm_rave_bundles_utilities_ColorUtil = rave['internal']['Declare']({
  3706. });
  3707. /**
  3708. * It is used to get a foreground color which has atleast a 4.5 contrast ratio with the background color.
  3709. * @param (Object) bg bakground color
  3710. * @param (Object) fg foreground color
  3711. * @return (Object) a color ( darker/ligher/same fg color ) which contrast with background.
  3712. */
  3713. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$0 = function(bg, fg) {
  3714. var contrastRatio = com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio(bg, fg);
  3715. if (contrastRatio < 4.5) {
  3716. var bgHSL = rave.hsl(bg);
  3717. var fgHSL = rave.hsl(fg);
  3718. 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);
  3719. if (brightness > 0.5) {
  3720. if (bgHSL.getL() > 0.5) {
  3721. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.min(fgHSL.getL(), bgHSL.getL() - 0.4));
  3722. } else {
  3723. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.min(fgHSL.getL(), 0.1));
  3724. }
  3725. } else {
  3726. if (bgHSL.getL() < 0.5) {
  3727. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.max(fgHSL.getL(), bgHSL.getL() + 0.4));
  3728. } else {
  3729. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.max(fgHSL.getL(), 0.9));
  3730. }
  3731. }
  3732. }
  3733. return fg;
  3734. };
  3735. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$1 = function(labelColor) {
  3736. var labelRGB = rave.rgb(labelColor);
  3737. return labelRGB.contrastShift(21);
  3738. };
  3739. /** @expose */
  3740. com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio = function(colorA, colorB) {
  3741. var foregroundLuminance = rave.rgb(colorA).getLuminance();
  3742. var backgroundLuminance = rave.rgb(colorB).getLuminance();
  3743. var contrastRatio = (foregroundLuminance >= backgroundLuminance) ? (foregroundLuminance + 0.05) / (backgroundLuminance + 0.05) : (backgroundLuminance + 0.05) / (foregroundLuminance + 0.05);
  3744. return contrastRatio;
  3745. };
  3746. /** @expose */
  3747. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor = function(a0, a1) {
  3748. var args = arguments;
  3749. if (args.length == 1) {
  3750. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$1(a0);
  3751. }
  3752. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$0(a0, a1);
  3753. };
  3754. // $source: com/ibm/rave/bundles/component/BoxplotComponent
  3755. /************************************************************************
  3756. ** IBM Confidential
  3757. **
  3758. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3759. **
  3760. ** (C) Copyright IBM Corp. 2017
  3761. **
  3762. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3763. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3764. ************************************************************************/
  3765. // GENERATED
  3766. /**
  3767. * <p> A component that renders boxplot elements. The {@link #this.type()} method returns "BoxplotComponent". </p>
  3768. */
  3769. var com_ibm_rave_bundles_component_BoxplotComponent = rave['internal']['Declare'].implement(
  3770. );
  3771. /**
  3772. * The string returned by {@link #this.type()} is "BoxplotComponent".
  3773. */
  3774. /** @expose */
  3775. com_ibm_rave_bundles_component_BoxplotComponent.COMPONENT_TYPE = "BoxplotComponent";
  3776. // $source: com/ibm/rave/bundles/data/BoxplotDatum
  3777. /************************************************************************
  3778. ** IBM Confidential
  3779. **
  3780. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3781. **
  3782. ** (C) Copyright IBM Corp. 2017
  3783. **
  3784. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3785. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3786. ************************************************************************/
  3787. // GENERATED
  3788. /**
  3789. * <p> Bundle datum for boxplots. The boxplot shapes in the chart have an instance as their datum. It is not from integrator (original) data, but has a list of the original data points from which it is calculated. </p> <p> The X value is the data for used for the boxplot view's X-scale. It may be a single value, or a pair when clustering. The key value uniquely identifies each boxplot in a view. </p> <p> The hinge values are the 25% and 75% quartiles, and are calculated values (may not be in the original data). These are used to draw the boxplot box. </p> <p> The fence values are at (lowerHinge-1.5*(upperHinge-lowerHinge)) and (upperHinge+1.5*(upperHinge-lowerHinge)), and are calculated values (may not be in the original data). They peg at the min and max values. These are used to draw the boxplot whiskers. </p> <p> The extreme values are at (lowerHinge-3.0*(upperHinge-lowerHinge)) and (upperHinge+3.0*(upperHinge-lowerHinge)), and are calculated values (may not be in the original data). They peg at the min and max values. These are used to determine if an outlier is a normal or extreme outlier. <p> The outliers list has the original data objects where the Y value is outside the fences. These are in the order of the original data. They are used to draw the outlier points. </p>
  3790. */
  3791. var com_ibm_rave_bundles_data_BoxplotDatum = rave['internal']['Declare']({
  3792. //_x : null,
  3793. //_key : null,
  3794. //_outliers : null,
  3795. //_data : null,
  3796. _mean : 0,
  3797. _min : 0,
  3798. _lowerHinge : 0,
  3799. _median : 0,
  3800. _upperHinge : 0,
  3801. _max : 0,
  3802. /**
  3803. * Package-protected constructor with values for all properties.
  3804. * @param (Object) x The X value
  3805. * @param (Object) key The key value
  3806. * @param (double) mean The mean
  3807. * @param (double) min The minimum value
  3808. * @param (double) lowerHinge The 25% quartile
  3809. * @param (double) median The median
  3810. * @param (double) upperHinge The 50% quartile
  3811. * @param (double) max The maximum value
  3812. * @param (Array) outliers The original data objects with Y value outside the fences
  3813. * @param (Array) data The original data objects
  3814. */
  3815. constructor : function(x, key, mean, min, lowerHinge, median, upperHinge, max, outliers, data) {
  3816. this._x = x;
  3817. this._key = key;
  3818. this._mean = mean;
  3819. this._min = min;
  3820. this._lowerHinge = lowerHinge;
  3821. this._median = median;
  3822. this._upperHinge = upperHinge;
  3823. this._max = max;
  3824. this._outliers = outliers;
  3825. this._data = data;
  3826. },
  3827. /**
  3828. * @return (Object) The X value
  3829. */
  3830. /** @expose */
  3831. x : function() {
  3832. return this._x;
  3833. },
  3834. /**
  3835. * @return (Object) The key value
  3836. */
  3837. /** @expose */
  3838. key : function() {
  3839. return this._key;
  3840. },
  3841. /**
  3842. * @return (double) The mean of the Y values
  3843. */
  3844. /** @expose */
  3845. mean : function() {
  3846. return this._mean;
  3847. },
  3848. /**
  3849. * @return (double) The smallest Y value in the data
  3850. */
  3851. /** @expose */
  3852. min : function() {
  3853. return this._min;
  3854. },
  3855. /**
  3856. * @return (double) lowerHinge - 3.0(upperHinge-lowerHinge) but not less than min
  3857. */
  3858. /** @expose */
  3859. lowerExtreme : function() {
  3860. return Math.max(this._min, this._lowerHinge - 3.0 * (this._upperHinge - this._lowerHinge));
  3861. },
  3862. /**
  3863. * @return (double) lowerHinge - 1.5(upperHinge-lowerHinge) but not less than min
  3864. */
  3865. /** @expose */
  3866. lowerFence : function() {
  3867. return Math.max(this._min, this._lowerHinge - 1.5 * (this._upperHinge - this._lowerHinge));
  3868. },
  3869. /**
  3870. * @return (double) The 25th percentile of the Y values
  3871. */
  3872. /** @expose */
  3873. lowerHinge : function() {
  3874. return this._lowerHinge;
  3875. },
  3876. /**
  3877. * @return (double) The median of the Y values
  3878. */
  3879. /** @expose */
  3880. median : function() {
  3881. return this._median;
  3882. },
  3883. /**
  3884. * @return (double) The 75th percentile of the Y values
  3885. */
  3886. /** @expose */
  3887. upperHinge : function() {
  3888. return this._upperHinge;
  3889. },
  3890. /**
  3891. * @return (double) upperHinge + 1.5(upperHinge-lowerHinge) but not more than max
  3892. */
  3893. /** @expose */
  3894. upperFence : function() {
  3895. return Math.min(this._max, this._upperHinge + 1.5 * (this._upperHinge - this._lowerHinge));
  3896. },
  3897. /**
  3898. * @return (double) upperHinge + 3.0(upperHinge-lowerHinge) but not more than max
  3899. */
  3900. /** @expose */
  3901. upperExtremum : function() {
  3902. return Math.min(this._max, this._upperHinge + 3.0 * (this._upperHinge - this._lowerHinge));
  3903. },
  3904. /**
  3905. * @return (double) The largest Y value in the data
  3906. */
  3907. /** @expose */
  3908. max : function() {
  3909. return this._max;
  3910. },
  3911. /**
  3912. * @return (Array) The original data objects that are outliers, with Y values outside the fences.
  3913. */
  3914. /** @expose */
  3915. outliers : function() {
  3916. return this._outliers;
  3917. },
  3918. /**
  3919. * @return (Object) A list of the original data objects
  3920. */
  3921. /** @expose */
  3922. originalData : function() {
  3923. return this._data;
  3924. },
  3925. /**
  3926. * @return (Array) A list of the original data objects
  3927. */
  3928. /** @expose */
  3929. originalDataList : function() {
  3930. return this._data;
  3931. }
  3932. });
  3933. // $source: com/ibm/rave/bundles/components/ComponentConfiguration
  3934. /************************************************************************
  3935. ** IBM Confidential
  3936. **
  3937. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3938. **
  3939. ** (C) Copyright IBM Corp. 2017
  3940. **
  3941. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3942. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3943. ************************************************************************/
  3944. // GENERATED
  3945. /**
  3946. * Utility class that does configuration for components, optionally drawing them into selections. Some of the configuration information is taken from a bundle context, and uses standard property IDs as defined in the shared property files and {@link (rave['library']['internal']['CommonPropertyIDs']) CommonPropertyIDs} . If a bundle does not use define the expected properties, an error will occur. In this documentation the property ID is referred to by the CommonPropertyIDs constant, for example property LEGEND_DISPLAY means the property with the ID {@link this.CommonPropertyIDs#"legend.display"} .
  3947. */
  3948. var com_ibm_rave_bundles_components_ComponentConfiguration = rave['internal']['Declare']({
  3949. //constructor : function() {}
  3950. });
  3951. /**
  3952. * <p> Do "standard" configuration of a Zoom and optionally run it on a selection. If the provided Zoom is null a new one is created. Component properties are set as follows: </p> <ul> <li>zoom#x is the xScale if that is non-null, and is not set if it is null</li> <li>zoom#y is the yScale if that is non-null, and is not set if it is null</li> <li>zoom#scaleExtent is the scaleExtent if that is non-null, or (0.2,5.0) otherwise</li> <li>zoom#on binds the "zoom" events to the callback</li> </ul> <p> Note that it is not possible to remove a scale from an existing zoom, since the core Zoom does not allow null scales in the x() and y() methods. To do that, first disable any existing zoom (with Selector#on("zoom",null)) then call this method with a null Zoom. </p> <p> The scales are ordered x, y, x2, y2 in the parameters and in the p and s arrays, since most charts will only have the x and y scales. </p>
  3953. * @param (rave['internal']['Selection']) chart Selection on which to run the zoom, may be null
  3954. * @param (rave['internal']['Zoom']) zoom The Zoom; if null one is created and returned
  3955. * @param (rave['library']['internal']['CoordinateScaleImpl']) xScale X dimension scale, may be null
  3956. * @param (rave['library']['internal']['CoordinateScaleImpl']) yScale Y dimension scale, may be null
  3957. * @param (rave['library']['internal']['CoordinateScaleImpl']) x2Scale X2 dimension scale, may be null
  3958. * @param (rave['library']['internal']['CoordinateScaleImpl']) y2Scale Y2 dimension scale, may be null
  3959. * @param (Array) scaleExtent Scale extent, may be null; if null the range 0.2 to 5.0 is used
  3960. * @param (rave['internal']['RectStruct']) chartRect The rectangle of the chart
  3961. * @param (double[]) p the zoom translate position (x, y, x2, y2)
  3962. * @param (double[]) s the zoom scale (x, y, x2, y2)
  3963. * @param (String) zoomOps The zoom operation (x|y|x2|y2|all)
  3964. * @param (rave['internal']['RunFunction']) callback Callback on each zoom event, must not be null
  3965. * @return (rave['internal']['Zoom']) The zoom
  3966. */
  3967. /** @expose */
  3968. com_ibm_rave_bundles_components_ComponentConfiguration.configureZoom = function(chart, zoom, xScale, yScale, x2Scale, y2Scale, scaleExtent, chartRect, p, s, zoomOps, callback) {
  3969. var z = zoom ? zoom : rave.behavior.zoom();
  3970. var z1 = (x2Scale || y2Scale) && zoomOps == "all" ? rave.behavior.zoom() : null;
  3971. var dummyScale = (rave.scale.linear());
  3972. z.x(dummyScale);
  3973. z.y(dummyScale);
  3974. if (xScale && zoomOps == "x") {
  3975. z.x(xScale.scale());
  3976. z.scale(s[0]);
  3977. z.translate([p[0], 0]);
  3978. }
  3979. if (yScale && zoomOps == "y") {
  3980. z.y(yScale.scale());
  3981. z.scale(s[1]);
  3982. z.translate([0, p[1]]);
  3983. }
  3984. if (x2Scale && zoomOps == "x2") {
  3985. z.x(x2Scale.scale());
  3986. z.scale(s[2]);
  3987. z.translate([p[2], 0]);
  3988. }
  3989. if (y2Scale && zoomOps == "y2") {
  3990. z.y(y2Scale.scale());
  3991. z.scale(s[3]);
  3992. z.translate([0, p[3]]);
  3993. }
  3994. if (zoomOps == "all") {
  3995. if (xScale) {
  3996. z.x(xScale.scale());
  3997. }
  3998. if (yScale) {
  3999. z.y(yScale.scale());
  4000. }
  4001. z.scale(1);
  4002. z.translate([0, 0]);
  4003. if (z1) {
  4004. if (x2Scale) {
  4005. z1.x(x2Scale.scale());
  4006. }
  4007. if (y2Scale) {
  4008. z1.y(y2Scale.scale());
  4009. }
  4010. z1.scale(1);
  4011. z1.translate([0, 0]);
  4012. }
  4013. }
  4014. z.scaleExtent(scaleExtent ? scaleExtent : [1, Infinity]).on("zoom.default", function(args) {
  4015. if (args !== null || arguments.length > 1){
  4016. args = Array.prototype.slice.call(arguments, 0);
  4017. }
  4018. {
  4019. var event = args[3];
  4020. var scale = event.scale;
  4021. var translate = event.translate;
  4022. var scaledX = chartRect.x * (scale - 1);
  4023. var scaledXExtent = (chartRect.width * (1 - scale)) - scaledX;
  4024. translate[0] = Math.min(-scaledX, Math.max(scaledXExtent, translate[0]));
  4025. var scaledY = chartRect.y * (scale - 1);
  4026. var scaledYExtent = (chartRect.height * (1 - scale)) - scaledY;
  4027. translate[1] = Math.min(-scaledY, Math.max(scaledYExtent, translate[1]));
  4028. z.translate([translate[0], translate[1]]);
  4029. if (z1) {
  4030. z1.translate([translate[0], translate[1]]);
  4031. z1.scale(scale);
  4032. }
  4033. if (zoomOps == "x") {
  4034. p[0] = translate[0];
  4035. s[0] = scale;
  4036. } else if (zoomOps == "y") {
  4037. p[1] = translate[1];
  4038. s[1] = scale;
  4039. } else if (zoomOps == "x2") {
  4040. p[2] = translate[0];
  4041. s[2] = scale;
  4042. } else if (zoomOps == "y2") {
  4043. p[3] = translate[1];
  4044. s[3] = scale;
  4045. } else if (zoomOps == "all") {
  4046. p[0] = translate[0];
  4047. p[1] = translate[1];
  4048. p[2] = translate[0];
  4049. p[3] = translate[1];
  4050. s[0] = scale;
  4051. s[1] = scale;
  4052. s[2] = scale;
  4053. s[3] = scale;
  4054. }
  4055. return callback.apply(this, args);
  4056. }
  4057. });
  4058. return z;
  4059. };
  4060. // $source: com/ibm/rave/bundles/internal/nativeImpl/BundleModule
  4061. /************************************************************************
  4062. ** IBM Confidential
  4063. **
  4064. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4065. **
  4066. ** (C) Copyright IBM Corp. 2015
  4067. **
  4068. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4069. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4070. ************************************************************************/
  4071. // Must be the first import
  4072. // @import ./BundleModuleHeader
  4073. // expose DataFormatter to the global variable rave
  4074. //rave["library"]["CustomFormatter"]=com_ibm_rave_library_framework_CustomFormatter;
  4075. // $source: com/ibm/rave/bundles/boxplotBundle/BoxplotBundle
  4076. /************************************************************************
  4077. ** IBM Confidential
  4078. **
  4079. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4080. **
  4081. ** (C) Copyright IBM Corp. 2017
  4082. **
  4083. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4084. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4085. ************************************************************************/
  4086. // GENERATED
  4087. //@import com/ibm/rave/library/Library (static) // Library
  4088. //@import com/ibm/rave/bundles/RaveBundle (loadtime) // superclass
  4089. //@import com/ibm/rave/bundles/boxplotBundle/BoxplotView (runtime) // new
  4090. var com_ibm_rave_bundles_boxplotBundle_BoxplotBundle = rave['internal']['Declare'](com_ibm_rave_bundles_RaveBundle, {
  4091. /** @expose */
  4092. getName : function() {
  4093. return com_ibm_rave_bundles_boxplotBundle_BoxplotBundle.BUNDLE_NAME;
  4094. },
  4095. /** @expose */
  4096. createView : function(ctx) {
  4097. return new com_ibm_rave_bundles_boxplotBundle_BoxplotView(ctx);
  4098. }
  4099. //constructor : function() {}
  4100. });
  4101. /**
  4102. * Register the bundle factory with the library. The bundle will not be made available if this method is not called.
  4103. */
  4104. /** @expose */
  4105. com_ibm_rave_bundles_boxplotBundle_BoxplotBundle.init = function() {
  4106. if (!(com_ibm_rave_library_Library.bundle.isRegistered(com_ibm_rave_bundles_boxplotBundle_BoxplotBundle.BUNDLE_NAME))) {
  4107. var bundle;
  4108. com_ibm_rave_library_Library.bundle.extension(com_ibm_rave_bundles_boxplotBundle_BoxplotBundle.BUNDLE_NAME, function() {
  4109. if (!bundle) {
  4110. bundle = new com_ibm_rave_bundles_boxplotBundle_BoxplotBundle();
  4111. bundle.loadResources();
  4112. require("./vizlibrary-boxplot.css");
  4113. }
  4114. return bundle;
  4115. });
  4116. }
  4117. return com_ibm_rave_bundles_boxplotBundle_BoxplotBundle.BUNDLE_NAME;
  4118. };
  4119. com_ibm_rave_bundles_boxplotBundle_BoxplotBundle.BUNDLE_NAME = "boxplotBundle";
  4120. // Auto initialization
  4121. com_ibm_rave_bundles_boxplotBundle_BoxplotBundle.init();
  4122. if (!com_ibm_rave_library_Library.bundle[com_ibm_rave_bundles_boxplotBundle_BoxplotBundle.BUNDLE_NAME]) {
  4123. com_ibm_rave_library_Library.bundle[com_ibm_rave_bundles_boxplotBundle_BoxplotBundle.BUNDLE_NAME] = function() {
  4124. if (!bundle) {
  4125. bundle = new com_ibm_rave_bundles_boxplotBundle_BoxplotBundle();
  4126. bundle.loadResources();
  4127. require("./vizlibrary-boxplot.css");
  4128. }
  4129. return bundle;
  4130. };
  4131. } else {
  4132. console.log("Could not register extension: BoxplotBundle");
  4133. }
  4134. // $source: com/ibm/rave/bundles/boxplotBundle/BoxplotView
  4135. /************************************************************************
  4136. ** IBM Confidential
  4137. **
  4138. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4139. **
  4140. ** (C) Copyright IBM Corp. 2017
  4141. **
  4142. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4143. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4144. ************************************************************************/
  4145. // GENERATED
  4146. //@import com/ibm/rave/bundles/views/BundleView (loadtime) // superclass
  4147. //@import com/ibm/rave/bundles/components/BoxplotComponentImpl (runtime) // new
  4148. //@import com/ibm/rave/bundles/data/BoxplotDataUtilities (runtime) // makeData
  4149. //@import com/ibm/rave/bundles/components/ComponentConfiguration (runtime) // configureZoom
  4150. var com_ibm_rave_bundles_boxplotBundle_BoxplotView = rave['internal']['Declare'](com_ibm_rave_bundles_views_BundleView, {
  4151. /**
  4152. * The calculated data, from the last time it was recalculated
  4153. */
  4154. //_boxplotData : null,
  4155. /**
  4156. * The X scale, from the last time it was recalculated
  4157. */
  4158. //_xScale : null,
  4159. /**
  4160. * The X scale domain, from the last time it was recalculated
  4161. */
  4162. //_xDomain : null,
  4163. /**
  4164. * The Y scale, from the last time it was recalculated
  4165. */
  4166. //_yScale : null,
  4167. /**
  4168. * The Y scale domain, from the last time it was recalculated
  4169. */
  4170. //_yDomain : null,
  4171. /**
  4172. * Component for drawing the boxplot
  4173. */
  4174. //_boxplotComponent : null,
  4175. /** @expose */
  4176. constructor : function(context) {
  4177. },
  4178. /** @expose */
  4179. setup : function() {
  4180. com_ibm_rave_bundles_views_BundleView.prototype.setup.call(this);
  4181. this._boxplotData = [];
  4182. this._xScale = null;
  4183. this._yScale = null;
  4184. this._boxplotComponent = new com_ibm_rave_bundles_components_BoxplotComponentImpl(this.context);
  4185. var component = this._boxplotComponent;
  4186. rave['library']['internal']['BundleUtils'].setupZoomAction(this.context);
  4187. var action = this.context.actions.action("highlight");
  4188. action.setBindFn(rave['library']['internal']['BundleUtils'].bindAction(this.context, ".chart .element-shape", action, ["mouseenter.default"]));
  4189. action.setOperation(new (rave['internal']['Declare']([rave['library']['internal']['ActionOperation']], {
  4190. _$functionClassMethod : function() {
  4191. var _$self = function(args) {
  4192. if (args !== null || arguments.length > 1){
  4193. args = Array.prototype.slice.call(arguments);
  4194. }
  4195. {
  4196. component.highlight(args[0]);
  4197. }
  4198. };
  4199. return _$self;
  4200. }
  4201. }))());
  4202. action = this.context.actions.action("unhighlight");
  4203. action.setBindFn(rave['library']['internal']['BundleUtils'].bindAction(this.context, ".chart .element-shape", action, ["mouseout.default"]));
  4204. action.setOperation(new (rave['internal']['Declare']([rave['library']['internal']['ActionOperation']], {
  4205. _$functionClassMethod : function() {
  4206. var _$self = function(args) {
  4207. if (args !== null || arguments.length > 1){
  4208. args = Array.prototype.slice.call(arguments);
  4209. }
  4210. {
  4211. component.unhighlight(args[0]);
  4212. }
  4213. };
  4214. return _$self;
  4215. }
  4216. }))());
  4217. action = this.context.actions.action("toggleSelect");
  4218. action.setBindFn(rave['library']['internal']['BundleUtils'].bindAction(this.context, ".chart .element-shape", action, ["click.default", "touchstart.default"]));
  4219. action.setOperation(new (rave['internal']['Declare']([rave['library']['internal']['ActionOperation']], {
  4220. _$functionClassMethod : function() {
  4221. var _$self = function(args) {
  4222. if (args !== null || arguments.length > 1){
  4223. args = Array.prototype.slice.call(arguments);
  4224. }
  4225. {
  4226. component.toggleSelect(args[0]);
  4227. }
  4228. };
  4229. return _$self;
  4230. }
  4231. }))());
  4232. action = this.context.actions.action("deselectAll");
  4233. action.setBindFn(rave['library']['internal']['BundleUtils'].bindAction(this.context, ".background", action, ["click.default", "touchstart.default"]));
  4234. action.setOperation(new (rave['internal']['Declare']([rave['library']['internal']['ActionOperation']], {
  4235. _$functionClassMethod : function() {
  4236. var _$self = function(args) {
  4237. if (args !== null || arguments.length > 1){
  4238. args = Array.prototype.slice.call(arguments);
  4239. }
  4240. {
  4241. component.deselectAll(args[0]);
  4242. }
  4243. };
  4244. return _$self;
  4245. }
  4246. }))());
  4247. },
  4248. /** @expose */
  4249. isAxesManagerRequired : function() {
  4250. return true;
  4251. },
  4252. /** @expose */
  4253. draw : function() {
  4254. if (this.isUpdateNothing()) {
  4255. return;
  4256. }
  4257. this.preDraw("g.vizlibrary-boxplot");
  4258. if (!(this.validateDataModel("g.element-group", "g.grid", "g.axis"))) {
  4259. return;
  4260. }
  4261. var self = this;
  4262. var effect = this.getStringProperty("effect.name");
  4263. var duration = this.getEffectDuration(effect);
  4264. var dataSet = this.dataModel.dataset("data");
  4265. var data = (dataSet.data());
  4266. var xEntry = dataSet.slot("x").entry();
  4267. var yEntry = dataSet.slot("y").entry();
  4268. var colorEntry = dataSet.slot("color").entry();
  4269. var keyEntry = dataSet.slot("key").entry();
  4270. if (!colorEntry && yEntry) {
  4271. dataSet.slot("color").overrideLabel(yEntry.label());
  4272. }
  4273. if (this.updateType == 0) {
  4274. var dataScale = colorEntry ? rave['library']['internal']['ScaleManager'].makeClusteredScale(data, [xEntry, colorEntry]) : rave['library']['internal']['ScaleManager'].makeCoordinateScale(data, xEntry);
  4275. var isClustered = colorEntry && "Clustered" == this.getStringProperty("data.handling");
  4276. if (dataScale) {
  4277. dataScale.range(0.0, 1.0, null, null);
  4278. }
  4279. this._boxplotData = com_ibm_rave_bundles_data_BoxplotDataUtilities.makeData(dataSet.data(), dataScale, isClustered, rave['library']['internal']['AbstractView'].accessorOf(xEntry), rave['library']['internal']['AbstractView'].accessorOf(yEntry), rave['library']['internal']['AbstractView'].accessorOf(colorEntry));
  4280. this._boxplotComponent.data(this._boxplotData);
  4281. }
  4282. var colorPalette = this.getPalette();
  4283. colorPalette.setData(dataSet, "color");
  4284. colorPalette.setNullColor(this.getStringProperty("color.null"));
  4285. var showLegend = this.isShowLegend();
  4286. var legendPosition = this.getLegendPosition();
  4287. this._legends.visible(showLegend).position(legendPosition).transition(!("none" == effect), duration).setPreExecute(this.context.getPreExecute()).selector(0, this.context.node.selectAll("g.legend")).palette(0, colorPalette).title(0, this.context.getDataSlotLabel("legend.title", colorEntry)).titleFill(0, (this.context.getPropertyValue("legend.titlestyle.fill"))).titleFontSize(0, (this.context.getPropertyValue("legend.titlestyle.fontsize"))).titleFontFamily(0, (this.context.getPropertyValue("legend.titlestyle.fontfamily"))).setDataSlot(0, colorEntry);
  4288. if (this.updateType <= 1) {
  4289. var isClustered = colorEntry && "Clustered" == this.getStringProperty("data.handling");
  4290. if (isClustered) {
  4291. this._xScale = rave['library']['internal']['ScaleManager'].makeClusteredScale(data, [xEntry, colorEntry]);
  4292. } else {
  4293. this._xScale = rave['library']['internal']['ScaleManager'].makeCoordinateScale(data, xEntry);
  4294. }
  4295. this._yScale = rave['library']['internal']['ScaleManager'].makeCoordinateScale(data, yEntry);
  4296. this._axes.visible(true).duration(duration).transpose(false).scale(0, this._xScale).scale(2, this._yScale).setDataSlot(0, xEntry).setDataSlot(2, yEntry).useDefaultSelectors().useDefaultX1Properties(true).useDefaultY1Properties(true).setTickFormatter(0, xEntry).setTickFormatter(2, yEntry);
  4297. this.prepareLayoutComponent();
  4298. this.prepareLayoutSizables(this._layoutComponent, false, true, true, false, showLegend);
  4299. var isLegendLeftOrRight = "left" == legendPosition || "right" == legendPosition;
  4300. if (isLegendLeftOrRight) {
  4301. this._legends.preLayout(this._layoutComponent, false);
  4302. this._axes.preLayout(this._layoutComponent, false, 0.1, 0.0, 0, 0.1, 0.05, 0);
  4303. } else {
  4304. this._axes.preLayout(this._layoutComponent, true, 0.1, 0.0, 0, 0.1, 0.05, 0);
  4305. this._legends.preLayout(this._layoutComponent, true);
  4306. }
  4307. this._layoutComponent.layout();
  4308. this._axes.useBoundsFromLayout(this._layoutComponent).setScaleRanges(0.1, 0.0, 0);
  4309. this._legends.rectangle(this._layoutComponent.legendRect());
  4310. if (this._xScale) {
  4311. this._xScale.expandZeroExtent(false);
  4312. this._xScale.expandPixels(this.getBoxplotSize() / 2.0, false);
  4313. if (this.getBooleanProperty("axis.x.scale.includeZero")) {
  4314. this._xScale.includeZero();
  4315. }
  4316. if (this.getBooleanProperty("axis.x.scale.nice")) {
  4317. this._xScale.nice();
  4318. }
  4319. this._xDomain = this._xScale.scale().copy().domain();
  4320. }
  4321. if (this._yScale) {
  4322. this._yScale.expandZeroExtent(false);
  4323. this._yScale.expandPixels(4.0 + 3, true);
  4324. if (this.getBooleanProperty("axis.y.scale.includeZero")) {
  4325. this._yScale.includeZero();
  4326. }
  4327. if (this.getBooleanProperty("axis.y.scale.nice")) {
  4328. this._yScale.nice();
  4329. }
  4330. this._yDomain = this._yScale.scale().copy().domain();
  4331. }
  4332. this.resetZoom();
  4333. }
  4334. this.setBackgroundProperties(this._layoutComponent.elementRect(), duration);
  4335. this._clip.clipRect(this._layoutComponent.elementRect()).applyTo(this.context.node.select(".content")).call(this.context.node.select("defs"));
  4336. this._axes.visible(true).duration(duration).useDefaultSelectors().useDefaultX1Properties(true).useDefaultY1Properties(true).setTickFormatter(0, xEntry).setTickFormatter(2, yEntry);
  4337. this._axes.draw();
  4338. this._legends.draw();
  4339. this._boxplotComponent.xScale(this._xScale).yScale(this._yScale).key(rave['library']['internal']['AbstractView'].originalDatumAccessor(rave['library']['internal']['AbstractView'].accessorOf(keyEntry))).yAccessor(rave['library']['internal']['AbstractView'].originalDatumAccessor(rave['library']['internal']['AbstractView'].accessorOf(yEntry))).colorPalette(colorPalette).colorAccessor(rave['library']['internal']['AbstractView'].accessorOf(colorEntry)).effect(effect).duration(duration).boxplotSize(this.getBoxplotSize()).boxStyle(this.getStringPropertyEmptyAsNull("boxplot.style.fill"), this.getStringPropertyEmptyAsNull("boxplot.style.stroke"), this.context.convertCSSSizeToPixels(this.getStringProperty("boxplot.style.stroke-width"))).whiskerStyle(this.getStringPropertyEmptyAsNull("boxplot.whisker.style.stroke"), this.context.convertCSSSizeToPixels(this.getStringProperty("boxplot.whisker.style.stroke-width"))).meanStyle(this.getStringPropertyEmptyAsNull("boxplot.mean.style.stroke"), this.context.convertCSSSizeToPixels(this.getStringProperty("boxplot.mean.style.stroke-width"))).medianStyle(this.getStringPropertyEmptyAsNull("boxplot.median.style.stroke"), this.context.convertCSSSizeToPixels(this.getStringProperty("boxplot.median.style.stroke-width"))).outlierStyle(this.getStringPropertyEmptyAsNull("boxplot.outlier.style.fill"), this.getStringPropertyEmptyAsNull("boxplot.outlier.style.stroke"), this.context.convertCSSSizeToPixels(this.getStringProperty("boxplot.outlier.style.stroke-width"))).extremeStyle(this.getStringPropertyEmptyAsNull("boxplot.extremum.style.fill"), this.getStringPropertyEmptyAsNull("boxplot.extremum.style.stroke"), this.context.convertCSSSizeToPixels(this.getStringProperty("boxplot.extremum.style.stroke-width")));
  4340. this.context.node.selectAll("g.elements").call(this._boxplotComponent);
  4341. if (this.updateType <= 2) {
  4342. var zoomOp = this.getStringProperty("zoom");
  4343. if (this._xScale && ("all" == zoomOp || "x" == zoomOp)) {
  4344. (this._xScale.scale()).domain(this._xDomain);
  4345. }
  4346. if (this._yScale && ("all" == zoomOp || "y" == zoomOp)) {
  4347. (this._yScale.scale()).domain(this._yDomain);
  4348. }
  4349. var zoom = this.context.actions.action("zoom").get("zoom");
  4350. com_ibm_rave_bundles_components_ComponentConfiguration.configureZoom(this._chart, zoom, this._xScale, this._yScale, null, null, null, this._layoutComponent.elementRect(), this._zoomP, this._zoomS, zoomOp, function(args) {
  4351. if (args !== null || arguments.length > 1){
  4352. args = Array.prototype.slice.call(arguments, 0);
  4353. }
  4354. {
  4355. self._boxplotComponent.boxplotSize(self.getBoxplotSize());
  4356. self.context.node.selectAll("g.elements").call(self._boxplotComponent);
  4357. self._axes.redraw(false);
  4358. return self._chart;
  4359. }
  4360. });
  4361. }
  4362. this.resetUpdate();
  4363. },
  4364. /** @expose */
  4365. getCoordinateScale : function(role) {
  4366. if ("ROLE_X1" == role) {
  4367. return this._xScale;
  4368. }
  4369. if ("ROLE_Y1" == role) {
  4370. return this._yScale;
  4371. }
  4372. return null;
  4373. },
  4374. /**
  4375. * If the X scale is ordinal/clustered and the "boxplot.applysize" property is false, returns the X scale width (minus 8 pixels - TODO: UX). Otherwise returns the "boxplot.size" property. The size property is CSS, and percentages are relative to the chart elements width.
  4376. * @return (double) Size in pixels
  4377. */
  4378. getBoxplotSize : function() {
  4379. if (this._xScale && !(this._xScale.isContinuous()) && !(this.getBooleanProperty("boxplot.applysize"))) {
  4380. return this._xScale.width() - 8;
  4381. }
  4382. var v = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(this.getStringProperty("boxplot.size"), this._layoutComponent.elementRect().width, 10.0);
  4383. return v != null ? v : 10.0;
  4384. },
  4385. /** @expose */
  4386. getGroupStructure : function() {
  4387. return ["defs", "g.vizlibrary vizlibrary-boxplot", "(", "rect.background chart", "g.chart", "(", "g.content", "(", "rect.background elements", "g.gridlines", "(", "g.grid left", "g.grid bottom", ")", "g.elements", ")", "g.axes", "(", "g.axes-layout", "g.axisTransform left", "g.axisTransform bottom", ")", ")", "g.legends", "(", "g.legends-layout", "g.legend", ")", ")"];
  4388. }
  4389. });
  4390. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.DATASET_DATA = "data";
  4391. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.DATASLOT_X = "x";
  4392. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.DATASLOT_Y = "y";
  4393. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.DATASLOT_COLOR = "color";
  4394. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.DATASLOT_KEY = "key";
  4395. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_SIZE_PROPERTY = "boxplot.size";
  4396. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_APPLYSIZE_PROPERTY = "boxplot.applysize";
  4397. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_STYLE_FILL = "boxplot.style.fill";
  4398. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_STYLE_STROKE = "boxplot.style.stroke";
  4399. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_STYLE_STROKEWIDTH = "boxplot.style.stroke-width";
  4400. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_WHISKER_STYLE_STROKE = "boxplot.whisker.style.stroke";
  4401. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_WHISKER_STYLE_STROKEWIDTH = "boxplot.whisker.style.stroke-width";
  4402. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_MEDIAN_STYLE_STROKE = "boxplot.median.style.stroke";
  4403. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_MEDIAN_STYLE_STROKEWIDTH = "boxplot.median.style.stroke-width";
  4404. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_MEAN_STYLE_STROKE = "boxplot.mean.style.stroke";
  4405. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_MEAN_STYLE_STROKEWIDTH = "boxplot.mean.style.stroke-width";
  4406. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_OUTLIER_STYLE_FILL = "boxplot.outlier.style.fill";
  4407. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_OUTLIER_STYLE_STROKE = "boxplot.outlier.style.stroke";
  4408. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_OUTLIER_STYLE_STROKEWIDTH = "boxplot.outlier.style.stroke-width";
  4409. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_EXTREMUM_STYLE_FILL = "boxplot.extremum.style.fill";
  4410. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_EXTREMUM_STYLE_STROKE = "boxplot.extremum.style.stroke";
  4411. //com_ibm_rave_bundles_boxplotBundle_BoxplotView.BOXPLOT_EXTREMUM_STYLE_STROKEWIDTH = "boxplot.extremum.style.stroke-width";
  4412. // $source: com/ibm/rave/bundles/components/BackgroundComponentImpl
  4413. /************************************************************************
  4414. ** IBM Confidential
  4415. **
  4416. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4417. **
  4418. ** (C) Copyright IBM Corp. 2017
  4419. **
  4420. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4421. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4422. ************************************************************************/
  4423. // GENERATED
  4424. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  4425. //@import com/ibm/rave/bundles/component/BackgroundComponent (runtime) // BackgroundComponent
  4426. /**
  4427. * <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>
  4428. */
  4429. var com_ibm_rave_bundles_components_BackgroundComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  4430. //_backgroundColor : null,
  4431. //_rect : null,
  4432. /** @expose */
  4433. constructor : function() {
  4434. this._rect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4435. },
  4436. /** @expose */
  4437. execute : function(g) {
  4438. this.preExecute();
  4439. g.style("fill", this._backgroundColor != null ? this._backgroundColor : "#FFFFFF").style("fill-opacity", 1.0);
  4440. g.attr("x", this._rect.x).attr("y", this._rect.y).attr("width", this._rect.width).attr("height", this._rect.height);
  4441. },
  4442. /** @expose */
  4443. type : function() {
  4444. return com_ibm_rave_bundles_component_BackgroundComponent.COMPONENT_TYPE;
  4445. },
  4446. backgroundColor$0 : function() {
  4447. return this._backgroundColor;
  4448. },
  4449. backgroundColor$1 : function(backgroundColor) {
  4450. this._backgroundColor = backgroundColor;
  4451. return this;
  4452. },
  4453. /**
  4454. * @param (rave['library']['internal']['ContextSize']) size New value of size property
  4455. * @return (com.ibm.rave.bundles.components.BackgroundComponentImpl) This component
  4456. */
  4457. /** @expose */
  4458. size : function(size) {
  4459. this._rect.x = 0;
  4460. this._rect.y = 0;
  4461. this._rect.width = size.w;
  4462. this._rect.height = size.h;
  4463. return this;
  4464. },
  4465. /** @expose */
  4466. rect : function(rect) {
  4467. var r = new rave['internal']['RectStruct'](rect.x, rect.y, rect.width, rect.height);
  4468. this._rect = r;
  4469. return this;
  4470. },
  4471. /** @expose */
  4472. backgroundColor : function(a0) {
  4473. var args = arguments;
  4474. if (args.length == 0) {
  4475. return this.backgroundColor$0();
  4476. }
  4477. return this.backgroundColor$1(a0);
  4478. }
  4479. });
  4480. // $source: com/ibm/rave/bundles/components/ChartLayoutComponentImpl
  4481. /************************************************************************
  4482. ** IBM Confidential
  4483. **
  4484. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4485. **
  4486. ** (C) Copyright IBM Corp. 2017
  4487. **
  4488. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4489. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4490. ************************************************************************/
  4491. // GENERATED
  4492. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  4493. //@import com/ibm/rave/bundles/component/ChartLayoutComponent (runtime) // ChartLayoutComponent
  4494. /**
  4495. * <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>
  4496. */
  4497. var com_ibm_rave_bundles_components_ChartLayoutComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  4498. //_padding : null,
  4499. //_legendChartGap : null,
  4500. //_topChartPadding : null,
  4501. //_leftChartPadding : null,
  4502. //_bottomChartPadding : null,
  4503. //_rightChartPadding : null,
  4504. //_legendPosition : null,
  4505. //_legendSizable : null,
  4506. //_axisSizables : null,
  4507. //_overallRect : null,
  4508. //_legendRect : null,
  4509. //_chartRect : null,
  4510. //_topRect : null,
  4511. //_leftRect : null,
  4512. //_bottomRect : null,
  4513. //_rightRect : null,
  4514. //_elementRect : null,
  4515. _leftPadding : 0, _topPadding : 0, _rightPadding : 0, _bottomPadding : 0,
  4516. _legendChartAlign : false,
  4517. _preLegendAtMax : false,
  4518. _preAxesAtZero : false,
  4519. constructor : function() {
  4520. this._axisSizables = [];
  4521. /**
  4522. * Construct. All padding is 0, legendPosition is "right", all slices have a size of 0 (value of null).
  4523. */
  4524. {
  4525. this._padding = 0.0;
  4526. this._topPadding = 0;
  4527. this._leftPadding = 0;
  4528. this._bottomPadding = 0;
  4529. this._rightPadding = 0;
  4530. this._topChartPadding = 0.0;
  4531. this._leftChartPadding = 0.0;
  4532. this._bottomChartPadding = 0.0;
  4533. this._rightChartPadding = 0.0;
  4534. this._legendChartGap = 0.0;
  4535. this._legendPosition = "right";
  4536. this._overallRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4537. this._legendRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4538. this._chartRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4539. this._topRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4540. this._leftRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4541. this._bottomRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4542. this._rightRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4543. this._elementRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4544. this._legendChartAlign = true;
  4545. }
  4546. },
  4547. /** @expose */
  4548. execute : function(g) {
  4549. this.layout();
  4550. },
  4551. /**
  4552. * Calculates rectangles during preliminary layout
  4553. * @param (boolean) legendAtMax true if legend is given max size; false if legend is asked for its preferred size
  4554. * @param (boolean) axesAtZero true if axes are given a size of 0; false if axes are asked for their preferred size
  4555. */
  4556. /** @expose */
  4557. preLayout : function(legendAtMax, axesAtZero) {
  4558. this._preLegendAtMax = legendAtMax;
  4559. this._preAxesAtZero = axesAtZero;
  4560. this.layout();
  4561. this._preLegendAtMax = false;
  4562. this._preAxesAtZero = false;
  4563. },
  4564. /**
  4565. * Calls preExecute, then does the layout with the property values, updating the chart, legend, axis, and elements rectangles.
  4566. */
  4567. /** @expose */
  4568. layout : function() {
  4569. this.preExecute();
  4570. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._chartRect, this._overallRect);
  4571. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._legendRect, this._overallRect);
  4572. var x = this._overallRect.x;
  4573. var y = this._overallRect.y;
  4574. var w = this._overallRect.width;
  4575. var h = this._overallRect.height;
  4576. var maxWH = Math.max(w, h);
  4577. var tbLegend = "top" == this._legendPosition || "bottom" == this._legendPosition;
  4578. var legendPercent = this._axisSizables.length == 0 ? 0.5 : 0.3;
  4579. var legendMaxSize = (tbLegend ? this._legendRect.height : this._legendRect.width) * legendPercent;
  4580. var legendDynamicSize = this._legendSizable ? (this._preLegendAtMax ? maxWH : this._legendSizable.getPreferredSize()) : 0;
  4581. if (legendDynamicSize > legendMaxSize) {
  4582. legendDynamicSize = legendMaxSize;
  4583. }
  4584. var isLegendTop = false;
  4585. var isLegendBottom = false;
  4586. var isLegendLeft = false;
  4587. var isLegendRight = false;
  4588. if ("top" == this._legendPosition) {
  4589. this._legendRect.height = legendDynamicSize;
  4590. this._chartRect.height -= this._legendRect.height;
  4591. this._chartRect.y += this._legendRect.height;
  4592. isLegendTop = true;
  4593. } else if ("bottom" == this._legendPosition) {
  4594. this._legendRect.height = legendDynamicSize;
  4595. this._chartRect.height -= this._legendRect.height;
  4596. this._legendRect.y = y + h - this._legendRect.height;
  4597. isLegendBottom = true;
  4598. } else if ("left" == this._legendPosition) {
  4599. this._legendRect.width = legendDynamicSize;
  4600. this._chartRect.width -= this._legendRect.width;
  4601. this._chartRect.x += this._legendRect.width;
  4602. isLegendLeft = true;
  4603. } else {
  4604. this._legendRect.width = legendDynamicSize;
  4605. this._chartRect.width -= this._legendRect.width;
  4606. this._legendRect.x = x + w - this._legendRect.width;
  4607. isLegendRight = true;
  4608. }
  4609. if (this.evaluatePadding(this._padding, w, h)) {
  4610. var lrgap = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._legendChartGap, w);
  4611. var tbgap = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._legendChartGap, h);
  4612. var chartTop = isLegendTop && this._legendSizable ? tbgap : this._topPadding;
  4613. var chartLeft = isLegendLeft && this._legendSizable ? lrgap : this._leftPadding;
  4614. var chartBottom = isLegendBottom && this._legendSizable ? tbgap : this._bottomPadding;
  4615. var chartRight = isLegendRight && this._legendSizable ? lrgap : this._rightPadding;
  4616. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset(this._chartRect, chartTop, chartLeft, chartBottom, chartRight);
  4617. } else {
  4618. var lrpadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._padding, w);
  4619. var tbpadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._padding, h);
  4620. var chartTop = tbpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._topChartPadding, h);
  4621. var chartLeft = lrpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._leftChartPadding, w);
  4622. var chartBottom = tbpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._bottomChartPadding, h);
  4623. var chartRight = lrpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._rightChartPadding, w);
  4624. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset(this._chartRect, chartTop, chartLeft, chartBottom, chartRight);
  4625. this._topPadding = tbpadding;
  4626. this._leftPadding = lrpadding;
  4627. this._bottomPadding = tbpadding;
  4628. this._rightPadding = lrpadding;
  4629. }
  4630. if (this._legendSizable) {
  4631. if (isLegendRight) {
  4632. this._legendRect.x -= this._rightPadding;
  4633. this._chartRect.width -= this._rightPadding;
  4634. this._legendRect.y += this._topPadding;
  4635. this._legendRect.height -= (this._topPadding + this._bottomPadding);
  4636. } else if (isLegendLeft) {
  4637. this._legendRect.x += this._leftPadding;
  4638. this._chartRect.x += this._leftPadding;
  4639. this._chartRect.width -= this._leftPadding;
  4640. this._legendRect.y += this._topPadding;
  4641. this._legendRect.height -= (this._topPadding + this._bottomPadding);
  4642. } else if (isLegendTop) {
  4643. this._legendRect.y += this._topPadding;
  4644. this._chartRect.y += this._topPadding;
  4645. this._chartRect.height -= this._topPadding;
  4646. this._legendRect.x += this._leftPadding;
  4647. this._legendRect.width -= (this._leftPadding + this._rightPadding);
  4648. } else {
  4649. this._legendRect.y -= this._bottomPadding;
  4650. this._chartRect.height -= this._bottomPadding;
  4651. this._legendRect.x += this._leftPadding;
  4652. this._legendRect.width -= (this._leftPadding + this._rightPadding);
  4653. }
  4654. }
  4655. x = this._chartRect.x;
  4656. y = this._chartRect.y;
  4657. w = this._chartRect.width;
  4658. h = this._chartRect.height;
  4659. var bottomH = 0;
  4660. var topH = 0;
  4661. var leftW = 0;
  4662. var rightW = 0;
  4663. var tbSO = 0;
  4664. var lrSO = 0;
  4665. if (!this._preAxesAtZero) {
  4666. var countHorz = 0;
  4667. var countVert = 0;
  4668. for (var i = 0; i < this._axisSizables.length; ++i) {
  4669. var sizable = this._axisSizables[i];
  4670. if (sizable) {
  4671. var orientation = sizable.getSizableOrientation();
  4672. if ("top" == orientation || "bottom" == orientation) {
  4673. countHorz++;
  4674. } else {
  4675. countVert++;
  4676. }
  4677. }
  4678. }
  4679. for (var i = 0; i < this._axisSizables.length; ++i) {
  4680. var sizable = this._axisSizables[i];
  4681. if (sizable) {
  4682. var orientation = sizable.getSizableOrientation();
  4683. var tbAxis = "top" == orientation || "bottom" == orientation;
  4684. var axisDynamicSize = sizable.getPreferredSize();
  4685. var spillOver = sizable.getSpillOverSize();
  4686. if (tbAxis) {
  4687. var axisPercent = countHorz > 1 ? 0.4 : 0.5;
  4688. if (axisDynamicSize > this._chartRect.height * axisPercent) {
  4689. axisDynamicSize = this._chartRect.height * axisPercent;
  4690. }
  4691. if ("top" == orientation) {
  4692. topH = axisDynamicSize;
  4693. } else {
  4694. bottomH = axisDynamicSize;
  4695. }
  4696. if (spillOver > lrSO) {
  4697. lrSO = spillOver;
  4698. }
  4699. } else {
  4700. var axisPercent = countVert > 1 ? 0.4 : 0.5;
  4701. if (axisDynamicSize > this._chartRect.width * axisPercent) {
  4702. axisDynamicSize = this._chartRect.width * axisPercent;
  4703. }
  4704. if ("left" == orientation) {
  4705. leftW = axisDynamicSize;
  4706. } else {
  4707. rightW = axisDynamicSize;
  4708. }
  4709. if (spillOver > tbSO) {
  4710. tbSO = spillOver;
  4711. }
  4712. }
  4713. }
  4714. }
  4715. }
  4716. if (lrSO > leftW) {
  4717. leftW = lrSO;
  4718. }
  4719. if (lrSO > rightW) {
  4720. rightW = lrSO;
  4721. }
  4722. if (tbSO > topH) {
  4723. topH = tbSO;
  4724. }
  4725. if (tbSO > bottomH) {
  4726. bottomH = tbSO;
  4727. }
  4728. this._leftRect.x = x;
  4729. this._leftRect.width = leftW;
  4730. this._leftRect.y = y;
  4731. this._leftRect.height = h;
  4732. this._rightRect.x = x + w - rightW;
  4733. this._rightRect.width = rightW;
  4734. this._rightRect.y = y;
  4735. this._rightRect.height = h;
  4736. this._topRect.y = y;
  4737. this._topRect.height = topH;
  4738. this._topRect.x = x;
  4739. this._topRect.width = w;
  4740. this._bottomRect.y = y + h - bottomH;
  4741. this._bottomRect.height = bottomH;
  4742. this._bottomRect.x = x;
  4743. this._bottomRect.width = w;
  4744. this._elementRect.x = x + leftW;
  4745. this._elementRect.y = y + topH;
  4746. this._elementRect.width = w - (leftW + rightW);
  4747. this._elementRect.height = h - (topH + bottomH);
  4748. if (this._legendSizable && this._legendChartAlign) {
  4749. if (tbLegend) {
  4750. this._legendRect.x = this._elementRect.x;
  4751. this._legendRect.width = this._elementRect.width;
  4752. } else {
  4753. this._legendRect.y = this._elementRect.y;
  4754. this._legendRect.height = this._elementRect.height;
  4755. }
  4756. }
  4757. },
  4758. evaluatePadding : function(padding, horizontalExtent, verticalExtent) {
  4759. if (padding == null) {
  4760. return false;
  4761. }
  4762. var paddingString = (padding) + "";
  4763. if (paddingString.length == 0) {
  4764. return false;
  4765. }
  4766. this._topPadding = 0;
  4767. this._leftPadding = 0;
  4768. this._bottomPadding = 0;
  4769. this._rightPadding = 0;
  4770. var items = paddingString.split(new RegExp(";"));
  4771. for (var __i_enFor0 = 0, __len_enFor0 = items.length;
  4772. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4773. var item = items[__i_enFor0];
  4774. var parts = item.split(new RegExp(":"));
  4775. if (items.length == 1 && parts.length != 2) {
  4776. return false;
  4777. }
  4778. if (parts.length == 2) {
  4779. if (0 <= parts[0].indexOf("top")) {
  4780. this._topPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], verticalExtent);
  4781. } else if (0 <= parts[0].indexOf("left")) {
  4782. this._leftPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], horizontalExtent);
  4783. } else if (0 <= parts[0].indexOf("bottom")) {
  4784. this._bottomPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], verticalExtent);
  4785. } else if (0 <= parts[0].indexOf("right")) {
  4786. this._rightPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], horizontalExtent);
  4787. }
  4788. }
  4789. }
  4790. return true;
  4791. },
  4792. /**
  4793. * @return (rave['internal']['RectStruct']) Legend rectangle
  4794. */
  4795. /** @expose */
  4796. legendRect : function() {
  4797. return this._legendRect;
  4798. },
  4799. /**
  4800. * @return (rave['internal']['RectStruct']) Chart (elements plus axes) rectangle
  4801. */
  4802. /** @expose */
  4803. chartRect : function() {
  4804. return this._chartRect;
  4805. },
  4806. /**
  4807. * @return (rave['internal']['RectStruct']) Top axis rectangle
  4808. */
  4809. /** @expose */
  4810. topRect : function() {
  4811. return this._topRect;
  4812. },
  4813. /**
  4814. * @return (rave['internal']['RectStruct']) Left axis rectangle
  4815. */
  4816. /** @expose */
  4817. leftRect : function() {
  4818. return this._leftRect;
  4819. },
  4820. /**
  4821. * @return (rave['internal']['RectStruct']) Bottom axis rectangle
  4822. */
  4823. /** @expose */
  4824. bottomRect : function() {
  4825. return this._bottomRect;
  4826. },
  4827. /**
  4828. * @return (rave['internal']['RectStruct']) Right axis rectangle
  4829. */
  4830. /** @expose */
  4831. rightRect : function() {
  4832. return this._rightRect;
  4833. },
  4834. /**
  4835. * @return (rave['internal']['RectStruct']) Legend rectangle
  4836. */
  4837. /** @expose */
  4838. elementRect : function() {
  4839. return this._elementRect;
  4840. },
  4841. /**
  4842. * Set the overall rectangle. This should be called before doing the layout.
  4843. * @param (rave['internal']['RectStruct']) overall The overall rectangle
  4844. */
  4845. /** @expose */
  4846. overall : function(overall) {
  4847. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._overallRect, overall);
  4848. return this;
  4849. },
  4850. padding$0 : function() {
  4851. return this._padding;
  4852. },
  4853. legendChartAlign$0 : function() {
  4854. return this._legendChartAlign;
  4855. },
  4856. legendChartGap$0 : function() {
  4857. return this._legendChartGap;
  4858. },
  4859. topPadding$0 : function() {
  4860. return this._topChartPadding;
  4861. },
  4862. leftPadding$0 : function() {
  4863. return this._leftChartPadding;
  4864. },
  4865. bottomPadding$0 : function() {
  4866. return this._bottomChartPadding;
  4867. },
  4868. rightPadding$0 : function() {
  4869. return this._rightChartPadding;
  4870. },
  4871. legendPosition$0 : function() {
  4872. return this._legendPosition;
  4873. },
  4874. topPadding$1 : function(padding) {
  4875. this._topChartPadding = padding;
  4876. return this;
  4877. },
  4878. leftPadding$1 : function(padding) {
  4879. this._leftChartPadding = padding;
  4880. return this;
  4881. },
  4882. bottomPadding$1 : function(padding) {
  4883. this._bottomChartPadding = padding;
  4884. return this;
  4885. },
  4886. rightPadding$1 : function(padding) {
  4887. this._rightChartPadding = padding;
  4888. return this;
  4889. },
  4890. /** @expose */
  4891. type : function() {
  4892. return com_ibm_rave_bundles_component_ChartLayoutComponent.COMPONENT_TYPE;
  4893. },
  4894. padding$1 : function(value) {
  4895. this._padding = value;
  4896. return this;
  4897. },
  4898. /** @expose */
  4899. chartPadding : function(top, left, bottom, right) {
  4900. this._topChartPadding = top;
  4901. this._leftChartPadding = left;
  4902. this._bottomChartPadding = bottom;
  4903. this._rightChartPadding = right;
  4904. return this;
  4905. },
  4906. legendChartAlign$1 : function(legendChartAlign) {
  4907. this._legendChartAlign = legendChartAlign;
  4908. return this;
  4909. },
  4910. legendChartGap$1 : function(value) {
  4911. this._legendChartGap = value;
  4912. return this;
  4913. },
  4914. legendPosition$1 : function(position) {
  4915. if ("top" == position || "bottom" == position || "left" == position || "right" == position) {
  4916. this._legendPosition = position;
  4917. }
  4918. return this;
  4919. },
  4920. /** @expose */
  4921. legendSize : function(sizable) {
  4922. this._legendSizable = sizable;
  4923. return this;
  4924. },
  4925. /** @expose */
  4926. removeAxisSizables : function() {
  4927. this._axisSizables.length = 0;
  4928. return this;
  4929. },
  4930. /** @expose */
  4931. addAxisSizable : function(sizable) {
  4932. this._axisSizables.push(sizable);
  4933. return this;
  4934. },
  4935. /** @expose */
  4936. padding : function(a0) {
  4937. var args = arguments;
  4938. if (args.length == 0) {
  4939. return this.padding$0();
  4940. }
  4941. return this.padding$1(a0);
  4942. },
  4943. /** @expose */
  4944. legendChartAlign : function(a0) {
  4945. var args = arguments;
  4946. if (args.length == 0) {
  4947. return this.legendChartAlign$0();
  4948. }
  4949. return this.legendChartAlign$1(a0);
  4950. },
  4951. /** @expose */
  4952. legendChartGap : function(a0) {
  4953. var args = arguments;
  4954. if (args.length == 0) {
  4955. return this.legendChartGap$0();
  4956. }
  4957. return this.legendChartGap$1(a0);
  4958. },
  4959. /** @expose */
  4960. topPadding : function(a0) {
  4961. var args = arguments;
  4962. if (args.length == 0) {
  4963. return this.topPadding$0();
  4964. }
  4965. return this.topPadding$1(a0);
  4966. },
  4967. /** @expose */
  4968. leftPadding : function(a0) {
  4969. var args = arguments;
  4970. if (args.length == 0) {
  4971. return this.leftPadding$0();
  4972. }
  4973. return this.leftPadding$1(a0);
  4974. },
  4975. /** @expose */
  4976. bottomPadding : function(a0) {
  4977. var args = arguments;
  4978. if (args.length == 0) {
  4979. return this.bottomPadding$0();
  4980. }
  4981. return this.bottomPadding$1(a0);
  4982. },
  4983. /** @expose */
  4984. rightPadding : function(a0) {
  4985. var args = arguments;
  4986. if (args.length == 0) {
  4987. return this.rightPadding$0();
  4988. }
  4989. return this.rightPadding$1(a0);
  4990. },
  4991. /** @expose */
  4992. legendPosition : function(a0) {
  4993. var args = arguments;
  4994. if (args.length == 0) {
  4995. return this.legendPosition$0();
  4996. }
  4997. return this.legendPosition$1(a0);
  4998. }
  4999. });
  5000. /**
  5001. * Set preferred rectangle to the same position and size as the source rectangle.
  5002. * @param (rave['internal']['RectStruct']) t preferred rectangle
  5003. * @param (rave['internal']['RectStruct']) s Source rectangle
  5004. * @return (rave['internal']['RectStruct']) preferred rectangle
  5005. */
  5006. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect = function(t, s) {
  5007. t.x = s.x;
  5008. t.y = s.y;
  5009. t.width = s.width;
  5010. t.height = s.height;
  5011. return t;
  5012. };
  5013. /**
  5014. * 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.
  5015. * @param (rave['internal']['RectStruct']) r Rectangle
  5016. * @param (double) top Top inset in pixels
  5017. * @param (double) left Left inset in pixels
  5018. * @param (double) bottom Bottom inset in pixels
  5019. * @param (double) right Right inset in pixels
  5020. * @return (rave['internal']['RectStruct']) The rectangle
  5021. */
  5022. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset = function(r, top, left, bottom, right) {
  5023. var ileft = Math.max(0.0, left);
  5024. var iright = Math.max(0.0, right);
  5025. if (ileft + iright <= r.width) {
  5026. r.x += ileft;
  5027. r.width -= ileft + iright;
  5028. }
  5029. var itop = Math.max(0.0, top);
  5030. var ibottom = Math.max(0.0, bottom);
  5031. if (itop + ibottom <= r.height) {
  5032. r.y += itop;
  5033. r.height -= itop + ibottom;
  5034. }
  5035. return r;
  5036. };
  5037. /**
  5038. * 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.
  5039. * @param (Object) value The size
  5040. * @param (double) extent The extent in the dimension
  5041. * @param defValue The default to use if not parsable
  5042. * @return (double) Size in pixels
  5043. */
  5044. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize = function(value, extent) {
  5045. var v = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(value, extent, 10.0);
  5046. var d = v != null ? v : 0;
  5047. return Math.max(0.0, Math.min(d, extent));
  5048. };
  5049. /** @expose */
  5050. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_AXIS_PERCENT = 0.4;
  5051. /** @expose */
  5052. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_AXIS_PERCENT_SINGLE_PER_ORIENTATION = 0.5;
  5053. /** @expose */
  5054. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_LEGEND_PERCENT = 0.3;
  5055. /** @expose */
  5056. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_LEGEND_PERCENT_NO_AXIS = 0.5;
  5057. // $source: com/ibm/rave/bundles/components/ClipPathComponentImpl
  5058. /************************************************************************
  5059. ** IBM Confidential
  5060. **
  5061. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5062. **
  5063. ** (C) Copyright IBM Corp. 2017
  5064. **
  5065. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5066. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5067. ************************************************************************/
  5068. // GENERATED
  5069. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5070. /**
  5071. * 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>
  5072. */
  5073. var com_ibm_rave_bundles_components_ClipPathComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5074. //_id : null,
  5075. //_clipRect : null,
  5076. constructor : function(id) {
  5077. this._clipRect = new rave['internal']['RectStruct'](0, 0, 100, 100);
  5078. /**
  5079. * 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.
  5080. * @param (String) id String ID that is unique <em>across the document</em>.
  5081. */
  5082. {
  5083. this._id = id;
  5084. }
  5085. },
  5086. /** @expose */
  5087. type : function() {
  5088. return "ClipPathComponent";
  5089. },
  5090. /**
  5091. * Set the rectangular clipping area. Make the _clipRect one pixel larger than requested to avoid the cut-off at bounds. TODO: why?!?
  5092. * @param (rave['internal']['RectStruct']) rect The rectangular bounds of the clipping area.
  5093. * @return (com.ibm.rave.bundles.components.ClipPathComponentImpl) This ClipPathComponent.
  5094. */
  5095. /** @expose */
  5096. clipRect : function(rect) {
  5097. this._clipRect = new rave['internal']['RectStruct'](rect.x - 1, rect.y - 1, rect.width + 2, rect.height + 2);
  5098. return this;
  5099. },
  5100. /**
  5101. * Set the clip-path attribute on the provided selection.
  5102. * @return (com.ibm.rave.bundles.components.ClipPathComponentImpl) This ClipPathComponent.
  5103. */
  5104. /** @expose */
  5105. applyTo : function(s) {
  5106. s.attr("clip-path", "url(" + this.url() + ")");
  5107. return this;
  5108. },
  5109. /**
  5110. * Retrieve the id assigned to this clip path.
  5111. */
  5112. /** @expose */
  5113. id : function() {
  5114. return this._id;
  5115. },
  5116. /**
  5117. * Retrieve the URL that can be used to reference this clip path.
  5118. */
  5119. /** @expose */
  5120. url : function() {
  5121. return "#" + this._id;
  5122. },
  5123. /** @expose */
  5124. execute : function(g) {
  5125. var clipPath = g.selectAll("#" + this._id).data([0]);
  5126. clipPath.enter().append("clipPath").attr("id", this._id).append("rect");
  5127. 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);
  5128. }
  5129. });
  5130. // $source: com/ibm/rave/bundles/components/LegendComponentImpl
  5131. /************************************************************************
  5132. ** IBM Confidential
  5133. **
  5134. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5135. **
  5136. ** (C) Copyright IBM Corp. 2017
  5137. **
  5138. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5139. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5140. ************************************************************************/
  5141. // GENERATED
  5142. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5143. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  5144. /**
  5145. * <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>
  5146. */
  5147. var com_ibm_rave_bundles_components_LegendComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5148. /**
  5149. * Legend size property
  5150. */
  5151. //_size : null,
  5152. /**
  5153. * Color scale
  5154. */
  5155. //_colorPalette : null,
  5156. /**
  5157. * Orient, "horizontal" or "vertical"
  5158. */
  5159. //_orient : null,
  5160. /**
  5161. * Swatch size function
  5162. */
  5163. //_swatchSizeFunc : null,
  5164. /**
  5165. * Scale
  5166. */
  5167. //_scale : null,
  5168. /**
  5169. * Swatch symbol
  5170. */
  5171. //_shape : null,
  5172. /**
  5173. * Legend title
  5174. */
  5175. //_title : null,
  5176. /**
  5177. * Legend title styling
  5178. */
  5179. //_titleStyle : null,
  5180. /**
  5181. * Legend entry styling
  5182. */
  5183. //_entryStyle : null,
  5184. /**
  5185. * Custom formatter
  5186. */
  5187. //_labelFormat : null,
  5188. /**
  5189. * The swatch legend, created on demand
  5190. */
  5191. //_swatchLegend : null,
  5192. /**
  5193. * The continuous legend, created on demand
  5194. */
  5195. //_continuousLegend : null,
  5196. /**
  5197. * The legend type, either "SwatchLegend" or "ContinuousLegend"
  5198. */
  5199. //_legendType : null,
  5200. /**
  5201. * Is the legend visible
  5202. */
  5203. _visible : false,
  5204. /**
  5205. * Swatch size in square pixels
  5206. */
  5207. _swatchSize : 0,
  5208. /**
  5209. * Constructor; sets bound and, colorScale to null, all other properties to their default values.
  5210. */
  5211. /** @expose */
  5212. constructor : function() {
  5213. this._visible = true;
  5214. this._size = null;
  5215. this._colorPalette = null;
  5216. this._orient = "horizontal";
  5217. this._swatchSize = 16.0 * 16.0;
  5218. this._swatchSizeFunc = null;
  5219. this._scale = null;
  5220. this._shape = "square";
  5221. this._title = null;
  5222. this._titleStyle = {};
  5223. this._entryStyle = {};
  5224. this._labelFormat = null;
  5225. this._swatchLegend = null;
  5226. this._continuousLegend = null;
  5227. this._legendType = null;
  5228. },
  5229. /** @expose */
  5230. type : function() {
  5231. return "LegendComponent";
  5232. },
  5233. /** @expose */
  5234. execute : function(g) {
  5235. if (this._colorPalette) {
  5236. if ("continuous" == this._colorPalette.getType()) {
  5237. if (!this._continuousLegend) {
  5238. this._continuousLegend = (rave.capabilities.extension("legend")).continuous();
  5239. }
  5240. this._legendType = "ContinuousLegend";
  5241. } else {
  5242. if (!this._swatchLegend) {
  5243. this._swatchLegend = (rave.capabilities.extension("legend")).swatch();
  5244. }
  5245. this._legendType = "SwatchLegend";
  5246. }
  5247. } else if (this._swatchSizeFunc) {
  5248. if (!this._swatchLegend) {
  5249. this._swatchLegend = (rave.capabilities.extension("legend")).swatch();
  5250. }
  5251. this._legendType = "SwatchLegend";
  5252. } else {
  5253. this._legendType = null;
  5254. }
  5255. this.preExecute();
  5256. if (!this._visible || (!this._colorPalette && !this._swatchSizeFunc) || !this._size || this._size[0] <= 0 || this._size[1] <= 0) {
  5257. g.selectAll("*").remove();
  5258. return;
  5259. }
  5260. var fontChecker = rave.capabilities.extension("fontchecker");
  5261. if (this._colorPalette && "continuous" == this._colorPalette.getType()) {
  5262. 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);
  5263. var legend = g.call(this._continuousLegend);
  5264. if (this._entryStyle) {
  5265. legend.selectAll(".legendLabel").style(this._entryStyle);
  5266. }
  5267. if (this._titleStyle) {
  5268. legend.selectAll(".legendTitle").style(this._titleStyle);
  5269. }
  5270. if (fontChecker) {
  5271. legend.selectAll(".legendLabel").call(fontChecker);
  5272. legend.selectAll(".legendTitle").call(fontChecker);
  5273. }
  5274. } else {
  5275. var insets = {};
  5276. insets["bottom"] = 5;
  5277. var swatchSize = this._swatchSize;
  5278. var scale = null;
  5279. var labelFormatter = this._labelFormat;
  5280. if (this._swatchSizeFunc && this._scale) {
  5281. swatchSize = this._swatchSizeFunc;
  5282. scale = this._scale;
  5283. }
  5284. if (this._colorPalette) {
  5285. scale = this._colorPalette.getScale();
  5286. var originalDomain = this._colorPalette.originalDomain();
  5287. if (originalDomain) {
  5288. scale.domain(originalDomain);
  5289. var f = this._colorPalette.originalDomainLabelAccessor();
  5290. if (this._labelFormat) {
  5291. var self = this;
  5292. labelFormatter = function(data, index, groupIndex) {
  5293. return self._labelFormat.call(this, f.call(this, data, index, groupIndex), index, groupIndex);
  5294. };
  5295. } else {
  5296. labelFormatter = f;
  5297. }
  5298. }
  5299. }
  5300. 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);
  5301. var legend = g.call(this._swatchLegend);
  5302. if (this._entryStyle) {
  5303. legend.selectAll(".legendLabel").style(this._entryStyle);
  5304. }
  5305. if (this._titleStyle) {
  5306. legend.selectAll(".legendTitle").style(this._titleStyle);
  5307. }
  5308. if (fontChecker) {
  5309. legend.selectAll(".legendLabel").call(fontChecker);
  5310. legend.selectAll(".legendTitle").call(fontChecker);
  5311. }
  5312. }
  5313. },
  5314. /** @expose */
  5315. legend : function() {
  5316. if ("ContinuousLegend" == this._legendType) {
  5317. return this._continuousLegend;
  5318. }
  5319. if ("SwatchLegend" == this._legendType) {
  5320. return this._swatchLegend;
  5321. }
  5322. return null;
  5323. },
  5324. /** @expose */
  5325. legendType : function() {
  5326. return this._legendType;
  5327. },
  5328. /**
  5329. * Set the visible property.
  5330. * @param (boolean) visible New visible
  5331. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5332. */
  5333. /** @expose */
  5334. visible : function(visible) {
  5335. this._visible = visible;
  5336. return this;
  5337. },
  5338. /**
  5339. * see if the legend is visible
  5340. * @return (boolean) if its visible
  5341. */
  5342. /** @expose */
  5343. isVisible : function() {
  5344. return this._visible;
  5345. },
  5346. /**
  5347. * Set the size property.
  5348. * @param (Array) size New size
  5349. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5350. */
  5351. /** @expose */
  5352. size : function(size) {
  5353. this._size = size;
  5354. return this;
  5355. },
  5356. /**
  5357. * Set the color scale property.
  5358. * @param (rave['library']['internal']['Palette']) colorPalette New color scale
  5359. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5360. */
  5361. /** @expose */
  5362. colorPalette : function(colorPalette) {
  5363. this._colorPalette = colorPalette;
  5364. return this;
  5365. },
  5366. /**
  5367. * Set the orient property. If the argument is not "horizontal" or "vertical", it is ignored and the orient property is not changed.
  5368. * @param (String) orient New orient
  5369. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5370. */
  5371. /** @expose */
  5372. orient : function(orient) {
  5373. if ("horizontal" == orient || "vertical" == orient) {
  5374. this._orient = orient;
  5375. }
  5376. return this;
  5377. },
  5378. /**
  5379. * 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".
  5380. * @param (String) position Legend position
  5381. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5382. */
  5383. /** @expose */
  5384. position : function(position) {
  5385. return this.orient(com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf(position));
  5386. },
  5387. swatchSize$0 : function(swatchSize) {
  5388. if (swatchSize >= 0.0 && swatchSize != null) {
  5389. this._swatchSize = swatchSize;
  5390. }
  5391. return this;
  5392. },
  5393. /** @expose */
  5394. scale : function(scale) {
  5395. this._scale = scale;
  5396. return this;
  5397. },
  5398. swatchSize$1 : function(swatchSize) {
  5399. if (swatchSize) {
  5400. this._swatchSizeFunc = swatchSize;
  5401. }
  5402. return this;
  5403. },
  5404. /** @expose */
  5405. shape : function(shape) {
  5406. this._shape = shape;
  5407. return this;
  5408. },
  5409. /** @expose */
  5410. title : function(title) {
  5411. this._title = (title != null && title.length > 0) ? title : null;
  5412. return this;
  5413. },
  5414. /** @expose */
  5415. titleFill : function(titleFill) {
  5416. this._titleStyle["fill"] = titleFill;
  5417. return this;
  5418. },
  5419. /** @expose */
  5420. titleFontSize : function(titleFontSize) {
  5421. this._titleStyle["font-size"] = titleFontSize;
  5422. return this;
  5423. },
  5424. /** @expose */
  5425. titleFontFamily : function(titleFontFamily) {
  5426. this._titleStyle["font-family"] = titleFontFamily;
  5427. return this;
  5428. },
  5429. /** @expose */
  5430. labelFormat : function(labelFormat) {
  5431. this._labelFormat = labelFormat;
  5432. return this;
  5433. },
  5434. /** @expose */
  5435. titleFont : function(titleFontStyle) {
  5436. this._titleStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(titleFontStyle);
  5437. return this;
  5438. },
  5439. /** @expose */
  5440. entryFont : function(entryFontStyle) {
  5441. this._entryStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(entryFontStyle);
  5442. return this;
  5443. },
  5444. /** @expose */
  5445. getSpaceUsed : function() {
  5446. if (this._colorPalette && "continuous" == this._colorPalette.getType()) {
  5447. return this._continuousLegend.getUsedSize() + 2;
  5448. } else {
  5449. return this._swatchLegend.getUsedSize() + 2;
  5450. }
  5451. },
  5452. /** @expose */
  5453. swatchSize : function(a0) {
  5454. var args = arguments;
  5455. if (args.length == 1 && typeof a0 === "function") {
  5456. return this.swatchSize$1(a0);
  5457. }
  5458. return this.swatchSize$0(a0);
  5459. }
  5460. });
  5461. /**
  5462. * Get the orient for a position. "top" and "bottom" return "horizontal", anything else ("left", "right", or unknown/null) is "vertical".
  5463. * @param (String) position A position
  5464. * @return (String) "horizontal" or "vertical"
  5465. */
  5466. /** @expose */
  5467. com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf = function(position) {
  5468. if ("top" == position || "bottom" == position) {
  5469. return "horizontal";
  5470. }
  5471. return "vertical";
  5472. };
  5473. //com_ibm_rave_bundles_components_LegendComponentImpl.HORIZONTAL = "horizontal";
  5474. //com_ibm_rave_bundles_components_LegendComponentImpl.VERTICAL = "vertical";
  5475. com_ibm_rave_bundles_components_LegendComponentImpl.BAR_THINKNESS = 16;
  5476. com_ibm_rave_bundles_components_LegendComponentImpl.SWATCH_SIZE = 16;
  5477. /** @expose */
  5478. com_ibm_rave_bundles_components_LegendComponentImpl.TOP = "top";
  5479. /** @expose */
  5480. com_ibm_rave_bundles_components_LegendComponentImpl.BOTTOM = "bottom";
  5481. /** @expose */
  5482. com_ibm_rave_bundles_components_LegendComponentImpl.LEFT = "left";
  5483. /** @expose */
  5484. com_ibm_rave_bundles_components_LegendComponentImpl.RIGHT = "right";
  5485. /** @expose */
  5486. com_ibm_rave_bundles_components_LegendComponentImpl.ADJUSTABLE = -1;
  5487. // $source: com/ibm/rave/bundles/components/AxisComponentImpl
  5488. /************************************************************************
  5489. ** IBM Confidential
  5490. **
  5491. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5492. **
  5493. ** (C) Copyright IBM Corp. 2018
  5494. **
  5495. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5496. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5497. ************************************************************************/
  5498. // GENERATED
  5499. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5500. //@import com/ibm/rave/bundles/component/AxisComponent (runtime) // AxisComponent
  5501. //@import com/ibm/rave/bundles/utilities/TextCrossfader (runtime) // textCrossFade
  5502. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  5503. //@import com/ibm/rave/bundles/utilities/BundleLabelDropper (runtime) // new
  5504. /**
  5505. * <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>
  5506. */
  5507. var com_ibm_rave_bundles_components_AxisComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5508. /**
  5509. * Axis - created on demand
  5510. */
  5511. //_axis : null,
  5512. /**
  5513. * Role, from the AxisComponent API
  5514. */
  5515. //_role : null,
  5516. /**
  5517. * CoordinateScale
  5518. */
  5519. //_scale : null,
  5520. /**
  5521. * Orient, always one of the four legal values
  5522. */
  5523. //_orient : null,
  5524. /**
  5525. * Size
  5526. */
  5527. //_bounds : null,
  5528. //_elementRect : null,
  5529. /**
  5530. * The title text; default null (nothing visible)
  5531. */
  5532. /** @expose */
  5533. _axisTitle : null,
  5534. /**
  5535. * The title style; defaults null (use the CSS styling)
  5536. */
  5537. /** @expose */
  5538. _titleStyle : null,
  5539. /**
  5540. * Axis line color; default null (use the CSS styling)
  5541. */
  5542. /** @expose */
  5543. _lineColor : null,
  5544. /**
  5545. * Axis tick color; default null (use the CSS styling)
  5546. */
  5547. /** @expose */
  5548. _tickColor : null,
  5549. /**
  5550. * Axis tick label style; defaults null (use the CSS styling)
  5551. */
  5552. /** @expose */
  5553. _labelStyle : null,
  5554. //_staggerRotate45Nodes : null,
  5555. //_staggerFirstNode : null,
  5556. //_staggerLastNode : null,
  5557. /**
  5558. * Axis tick label formatting
  5559. */
  5560. //_tickFormat : null,
  5561. //_dropOverlap : null,
  5562. /**
  5563. * Used to get the extension to enable axis label wrapping
  5564. */
  5565. //_textFlow : null,
  5566. /**
  5567. * Used to check the fonts on each label to make sure all characters are covered
  5568. */
  5569. //_fontChecker : null,
  5570. /**
  5571. * Run function that applies the properties to the axis line
  5572. */
  5573. //_axisLineProperties : null,
  5574. /**
  5575. * Run function that applies the properties to the axis ticks
  5576. */
  5577. //_axisTickProperties : null,
  5578. /**
  5579. * Run function that applies the properties to the axis tick labels
  5580. */
  5581. //_axisTickLabelProperties : null,
  5582. /**
  5583. * Run function that hides or displays the axis tick labels
  5584. */
  5585. //_displayHideLabels : null,
  5586. /**
  5587. * Run function that hides or displays the axis tick labels
  5588. */
  5589. //_panZoomLabels : null,
  5590. /**
  5591. * The tick handler registered with the axis; will get called during axis transition
  5592. */
  5593. //_tickHandler : null,
  5594. //_textTruncationIndicator : null,
  5595. /**
  5596. * Used when dealing with numeric scale on the vertical axis and the numbers don't fit
  5597. */
  5598. //_simplifiedTickFormat : null,
  5599. //_tickMagnitude : null,
  5600. /**
  5601. * Whether to display the axis title; default true
  5602. */
  5603. /** @expose */
  5604. _displayAxisTitle : false,
  5605. /**
  5606. * Whether to display the axis line; default true
  5607. */
  5608. /** @expose */
  5609. _displayAxisLine : false,
  5610. /**
  5611. * Whether to display the axis ticks; default true
  5612. */
  5613. /** @expose */
  5614. _displayTicks : false,
  5615. /**
  5616. * Whether to display the axis tick labels (conditional on show labels property); default true
  5617. */
  5618. /** @expose */
  5619. _displayTickLabels : false,
  5620. /**
  5621. * Whether to display the axis tick labels (conditional on pan-zoom hide property); default true
  5622. */
  5623. /** @expose */
  5624. _showPanZoomTickLabels : false,
  5625. /**
  5626. * Whether to rotate the axis tick labels; default false
  5627. */
  5628. _rotateLabels : false,
  5629. _staggerCellWidth : 0,
  5630. _staggerAlignFirstAtStart : false,
  5631. _staggerAlignLastAtEnd : false,
  5632. _layoutTimerId : 0,
  5633. _layoutTitleSize : 0,
  5634. _layoutLabelSize : 0,
  5635. _layoutLabelHeight : 0,
  5636. _layoutAverageDigitWidth : 0,
  5637. _layoutSpillOver : 0,
  5638. /**
  5639. * Whether to hide overlapping labels; default true
  5640. */
  5641. /** @expose */
  5642. _hideOverlappingLabels : false,
  5643. /**
  5644. * When true, don't start a new timer
  5645. */
  5646. _pendingLabelTimer : false,
  5647. /**
  5648. * The padding in px between tick axis line and tick label, and also between tick label and title. Default 16px.
  5649. */
  5650. _padding : 0,
  5651. /**
  5652. * After calling the component, this is true if shapes were rendered, false if they were cleared.
  5653. */
  5654. _renderedShapes : false,
  5655. _layoutMode : -1,
  5656. _allowAutoAxisLayoutToChangeOrientaiton : true,
  5657. _lastAutomaticAxisLayoutOrientation : -1,
  5658. _allowStagger : false,
  5659. _allowRotate45 : false,
  5660. _allowRotate90 : false,
  5661. constructor : function() {
  5662. {
  5663. var self = this;
  5664. this._axisLineProperties = function(args) {
  5665. if (args !== null || arguments.length > 1){
  5666. args = Array.prototype.slice.call(arguments, 0);
  5667. }
  5668. {
  5669. var line = this.selectAll("path.domain");
  5670. if (self._lineColor != null) {
  5671. line.style("stroke", self._lineColor);
  5672. }
  5673. if (self._displayAxisLine) {
  5674. line.attr("visibility", null);
  5675. } else {
  5676. line.attr("visibility", "hidden");
  5677. }
  5678. return null;
  5679. }
  5680. };
  5681. this._axisTickProperties = function(args) {
  5682. if (args !== null || arguments.length > 1){
  5683. args = Array.prototype.slice.call(arguments, 0);
  5684. }
  5685. {
  5686. var tickLines = this.selectAll("line");
  5687. if (self._displayTicks) {
  5688. tickLines.attr("visibility", null);
  5689. } else {
  5690. tickLines.attr("visibility", "hidden");
  5691. }
  5692. if (self._lineColor != null) {
  5693. tickLines.style("stroke", self._tickColor);
  5694. }
  5695. return null;
  5696. }
  5697. };
  5698. this._axisTickLabelProperties = function(args) {
  5699. if (args !== null || arguments.length > 1){
  5700. args = Array.prototype.slice.call(arguments, 0);
  5701. }
  5702. {
  5703. var labels = this.selectAll("text");
  5704. labels.each(self._displayHideLabels);
  5705. labels.each(self._panZoomLabels);
  5706. labels.style(self._labelStyle);
  5707. self._axis.ticksHandler(null);
  5708. return null;
  5709. }
  5710. };
  5711. this._displayHideLabels = function(obj, group, index) {
  5712. if (self._displayTickLabels) {
  5713. if (this.rave_hasProperty("__tickLabelHidden__")) {
  5714. this.rave_removeProperty("__tickLabelHidden__");
  5715. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5716. if (count <= 1) {
  5717. this.rave_removeProperty("__hiddenCount__");
  5718. this.removeAttribute("visibility");
  5719. } else {
  5720. this.rave_setProperty("__hiddenCount__", count - 1);
  5721. }
  5722. }
  5723. } else {
  5724. if (!(this.rave_hasProperty("__tickLabelHidden__"))) {
  5725. this.setAttribute("visibility", "hidden");
  5726. this.rave_setProperty("__tickLabelHidden__", "hidden");
  5727. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5728. this.rave_setProperty("__hiddenCount__", count + 1);
  5729. }
  5730. }
  5731. };
  5732. this._panZoomLabels = function(obj, group, index) {
  5733. if (self._showPanZoomTickLabels) {
  5734. if (this.rave_hasProperty("__panZoomHidden__")) {
  5735. this.rave_removeProperty("__panZoomHidden__");
  5736. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5737. if (count <= 1) {
  5738. this.rave_removeProperty("__hiddenCount__");
  5739. this.removeAttribute("visibility");
  5740. } else {
  5741. this.rave_setProperty("__hiddenCount__", count - 1);
  5742. }
  5743. }
  5744. } else {
  5745. if (!(this.rave_hasProperty("__panZoomHidden__"))) {
  5746. this.setAttribute("visibility", "hidden");
  5747. this.rave_setProperty("__panZoomHidden__", "hidden");
  5748. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  5749. this.rave_setProperty("__hiddenCount__", count + 1);
  5750. }
  5751. }
  5752. };
  5753. }
  5754. this._tickHandler = new com_ibm_rave_bundles_components_AxisComponentImpl.AxisTickHandler(this._axisTickLabelProperties, this._axisTickProperties);
  5755. /**
  5756. * Initialize properties to defaults
  5757. */
  5758. {
  5759. this._axis = null;
  5760. this._role = null;
  5761. this._scale = null;
  5762. this._orient = "bottom";
  5763. this._bounds = null;
  5764. this._displayAxisTitle = true;
  5765. this._axisTitle = null;
  5766. this._titleStyle = {};
  5767. this._displayAxisLine = true;
  5768. this._lineColor = null;
  5769. this._displayTicks = true;
  5770. this._tickColor = null;
  5771. this._displayTickLabels = true;
  5772. this._labelStyle = {};
  5773. this._rotateLabels = false;
  5774. this._hideOverlappingLabels = true;
  5775. this._dropOverlap = new com_ibm_rave_bundles_utilities_BundleLabelDropper();
  5776. this._tickFormat = null;
  5777. this._showPanZoomTickLabels = true;
  5778. this._pendingLabelTimer = false;
  5779. this._padding = 16;
  5780. this._textFlow = rave.capabilities.extension("textflow");
  5781. this._fontChecker = rave.capabilities.extension("fontchecker");
  5782. this._renderedShapes = false;
  5783. }
  5784. },
  5785. /** @expose */
  5786. type : function() {
  5787. return com_ibm_rave_bundles_component_AxisComponent.COMPONENT_TYPE;
  5788. },
  5789. /** @expose */
  5790. role : function() {
  5791. return this._role;
  5792. },
  5793. /** @expose */
  5794. execute : function(g) {
  5795. this.preExecute();
  5796. if (!this._scale) {
  5797. g.selectAll("*").remove();
  5798. this._renderedShapes = false;
  5799. return;
  5800. }
  5801. this._renderedShapes = true;
  5802. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  5803. this._hideOverlappingLabels = false;
  5804. this._rotateLabels = true;
  5805. } else {
  5806. this._hideOverlappingLabels = true;
  5807. this._rotateLabels = true;
  5808. }
  5809. this.drawTitle(g);
  5810. this.drawAxis(g);
  5811. this.handleAxisText(g);
  5812. this.drawTitle(g);
  5813. },
  5814. /**
  5815. * This is one place where all the calls that affect the axis text happen in case of allowAutomaticAxisLayout the new behavior applies here
  5816. * @param (rave['internal']['Selector']) g
  5817. */
  5818. handleAxisText : function(g) {
  5819. this.stopLabelDroppingUpdate();
  5820. var duration = 0, delay = 0;
  5821. var g2 = rave.transition(g);
  5822. if (g2.isTransition()) {
  5823. var t2 = (g2);
  5824. duration = t2.duration();
  5825. delay = t2.delay();
  5826. }
  5827. var axisSelector = g.selectAll("g.axis");
  5828. var labels = axisSelector.selectAll("g.tick").filter(rave['library']['internal']['BundleUtils'].notExit).selectAll("text");
  5829. var fontChecker = rave.capabilities.extension("fontchecker");
  5830. labels.style(this._labelStyle);
  5831. if (fontChecker) {
  5832. labels.call(fontChecker);
  5833. }
  5834. var mode = this._allowAutoAxisLayoutToChangeOrientaiton ? this.determineWhichAutoMode(g) : this._lastAutomaticAxisLayoutOrientation;
  5835. this.configureStaggerData(g, mode);
  5836. this.handleLabelsRotationAndPosition(g, labels, mode);
  5837. this.hashingNumericScales(labels, this.labelExtent(g), mode);
  5838. if (duration == 0) {
  5839. this.doLabelWrapping(g, mode);
  5840. this.handleLabelsRotationAndPosition(g, labels, mode);
  5841. }
  5842. this._lastAutomaticAxisLayoutOrientation = mode;
  5843. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  5844. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  5845. var tick = axisSelector.append("g").classed("tick", true);
  5846. var tickText = tick.append("text");
  5847. if (labels.size() == 0) {
  5848. var singleValue = this._scale.scale().domain()[0];
  5849. var formatter = this._tickFormat;
  5850. if (!formatter) {
  5851. var tickFunc = this._scale.scale().tickFormat;
  5852. if (tickFunc) {
  5853. formatter = tickFunc.apply(tickFunc, [singleValue]);
  5854. }
  5855. }
  5856. var node = tickText[0][0];
  5857. var stringValue = formatter ? formatter.call(node, singleValue, 0, 0) : ""+(singleValue);
  5858. tickText.text(stringValue);
  5859. var dim = node.getBBox();
  5860. this._layoutLabelSize = isHorizontal ? dim.height : dim.width;
  5861. if (!isHorizontal || mode != 0) {
  5862. tickText.text(".0");
  5863. this._layoutLabelSize += node.getBBox().width;
  5864. }
  5865. }
  5866. if (!isHorizontal || mode != 0) {
  5867. tickText.text(".0");
  5868. var node = tickText[0][0];
  5869. var dim = node.getBBox();
  5870. this._layoutAverageDigitWidth = dim.width;
  5871. }
  5872. tick.remove();
  5873. }
  5874. if (this._hideOverlappingLabels && duration > 0) {
  5875. this.updateLabelDropping(labels, duration, delay);
  5876. }
  5877. if (duration > 0) {
  5878. this.doLabelWrappingAfterAnimation(g, labels, mode, duration, delay);
  5879. }
  5880. if (!this._displayTickLabels) {
  5881. this._layoutLabelSize = 0;
  5882. this._layoutAverageDigitWidth = 0;
  5883. }
  5884. },
  5885. /**
  5886. * 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
  5887. * @param (rave['internal']['Selector']) g selector
  5888. * @param (rave['internal']['Selector']) labels labels selector
  5889. * @param (int) mode one of HORIZONTAL, STAGGER, ROTATE90
  5890. */
  5891. handleLabelsRotationAndPosition : function(g, labels, mode) {
  5892. if (mode == 2 || mode == 1) {
  5893. if (this._orient == "bottom") {
  5894. this.rotateLabels(g, labels, "end", mode);
  5895. } else if (this._orient == "top") {
  5896. this.rotateLabels(g, labels, "start", mode);
  5897. } else {
  5898. this.rotateLabels(g, labels, "middle", mode);
  5899. }
  5900. } else {
  5901. if (this._orient == "bottom" || this._orient == "top") {
  5902. this.rotateLabels(g, labels, "middle", mode);
  5903. } else if (this._orient == "right") {
  5904. this.rotateLabels(g, labels, "start", mode);
  5905. } else {
  5906. this.rotateLabels(g, labels, "end", mode);
  5907. }
  5908. }
  5909. },
  5910. /**
  5911. * <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>
  5912. * @param (rave['internal']['Selector']) labels
  5913. */
  5914. hashingNumericScales : function(labels, extent, mode) {
  5915. if (!labels || !extent) {
  5916. return;
  5917. }
  5918. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  5919. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  5920. var tickSpace = mode == 1 ? extent[1] : extent[0];
  5921. this._textTruncationIndicator = "";
  5922. this._layoutLabelSize = 0;
  5923. for (var i = 0; i < labels.size(); ++i) {
  5924. var node = labels[i][0];
  5925. var dim = node.getBBox();
  5926. var width = dim.width;
  5927. var height = dim.height;
  5928. var size = !isHorizontal || mode == 1 ? width : height;
  5929. if (size > this._layoutLabelSize) {
  5930. this._layoutLabelSize = size;
  5931. }
  5932. if (width >= tickSpace) {
  5933. if (this._simplifiedTickFormat) {
  5934. var newText = this._simplifiedTickFormat.call(null, node.rave_getData(), 0, 0);
  5935. if (newText != null) {
  5936. node.rave_setText(newText);
  5937. }
  5938. if (node.getBBox().width >= tickSpace) {
  5939. node.rave_setText(this.stringOfSize(node.rave_getText().length, "#"));
  5940. }
  5941. } else {
  5942. node.rave_setText(this.stringOfSize(node.rave_getText().length, "#"));
  5943. }
  5944. }
  5945. }
  5946. }
  5947. },
  5948. /**
  5949. * @param (int) size The desired size of the string
  5950. * @param (String) ch The character to be repeated in the string
  5951. * @return (String) A string of the specified size containing repetition of the specified character
  5952. */
  5953. stringOfSize : function(size, ch) {
  5954. var returnString = "";
  5955. for (var i = 0; i < size; ++i) {
  5956. returnString += ch;
  5957. }
  5958. return returnString;
  5959. },
  5960. configureStaggerData : function(g, mode) {
  5961. if (mode == 3 || mode == 2) {
  5962. var horizontalDimensions = this.labelExtent(g);
  5963. var cellWidth = horizontalDimensions[0];
  5964. var axisSelector = g.selectAll("g.axis");
  5965. var labels = axisSelector.selectAll("text");
  5966. var domain = this._scale.scale().domain();
  5967. var originalDataLabelAccessor = (this._scale).originalDomainLabelAccessor();
  5968. this._staggerRotate45Nodes = [];
  5969. this._staggerFirstNode = null;
  5970. this._staggerLastNode = null;
  5971. for (var i = 0; i < labels.size(); ++i) {
  5972. var node = labels[0][i];
  5973. if (this.isValid(node.rave_getData())) {
  5974. var domainIndex = -1;
  5975. if (mode == 3) {
  5976. var domainLabel = !this._tickFormat ? node.rave_getText() : originalDataLabelAccessor.call(node, node.rave_getData(), 0, 0);
  5977. for (var index = 0; index < domain.length; ++index) {
  5978. if (domain[index].toString() == domainLabel) {
  5979. domainIndex = index;
  5980. break;
  5981. }
  5982. }
  5983. }
  5984. this._staggerRotate45Nodes.push(new com_ibm_rave_bundles_components_AxisComponentImpl.NodeIndex(node, domainIndex));
  5985. if (domainIndex == 0) {
  5986. this._staggerFirstNode = node;
  5987. }
  5988. if (domainIndex == domain.length - 1) {
  5989. this._staggerLastNode = node;
  5990. }
  5991. }
  5992. }
  5993. this._staggerCellWidth = cellWidth * 2;
  5994. this._staggerAlignFirstAtStart = this._staggerFirstNode ? this._staggerFirstNode.getBBox().width > cellWidth : false;
  5995. this._staggerAlignLastAtEnd = this._staggerLastNode ? this._staggerLastNode.getBBox().width > cellWidth : false;
  5996. }
  5997. },
  5998. getStaggerIndex : function(node) {
  5999. for (var index = 0; index < this._staggerRotate45Nodes.length; ++index) {
  6000. if (this._staggerRotate45Nodes[index].contains(node)) {
  6001. var domainIndex = this._staggerRotate45Nodes[index].getIndex();
  6002. return domainIndex == -1 ? 0 : domainIndex;
  6003. }
  6004. }
  6005. return -1;
  6006. },
  6007. getStaggerCount : function() {
  6008. var domain = this._scale.scale().domain();
  6009. return domain.length;
  6010. },
  6011. /**
  6012. * <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>
  6013. * @param (rave['internal']['Selector']) g
  6014. */
  6015. determineWhichAutoMode : function(g) {
  6016. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6017. var axisSelector = g.selectAll("g.axis");
  6018. var labels = axisSelector.selectAll("text");
  6019. var dim = this.labelExtent(g);
  6020. var cellWidth = dim[0];
  6021. var cellWidth90 = dim[1];
  6022. var layoutLabelHeight = 0;
  6023. var layoutLabelWidth = 0;
  6024. var horizontalScore = 0;
  6025. var staggerScore = 0;
  6026. var rotate45Score = 0;
  6027. var rotate90Score = 0;
  6028. var validNodes = [];
  6029. for (var i = 0; i < labels.size(); ++i) {
  6030. var node = labels[0][i];
  6031. if (this.isValid(node.rave_getData())) {
  6032. validNodes.push(node);
  6033. }
  6034. }
  6035. var labelCount = validNodes.length;
  6036. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  6037. var mode = 0;
  6038. if (isHorizontal) {
  6039. mode = this._layoutMode == 1 ? 1 : 0;
  6040. var tick = axisSelector.append("g").classed("tick", true);
  6041. var tickText = tick.append("text");
  6042. tickText.style(this._labelStyle);
  6043. tickText.text(",0");
  6044. var node = tickText[0][0];
  6045. var zeroWidth = node.getBBox().width;
  6046. tick.remove();
  6047. var widestLabel = 0;
  6048. for (var i = 0; i < labelCount; ++i) {
  6049. node = validNodes[i];
  6050. var nodeRect = node.getBBox();
  6051. if (nodeRect.width > widestLabel) {
  6052. widestLabel = nodeRect.width;
  6053. }
  6054. if (nodeRect.height > this._layoutLabelHeight) {
  6055. this._layoutLabelHeight = nodeRect.height;
  6056. }
  6057. }
  6058. widestLabel += zeroWidth;
  6059. this._layoutSpillOver = mode == 1 ? this._layoutLabelHeight / 2 : widestLabel / 2 + 2;
  6060. } else {
  6061. for (var i = 0; i < labelCount; ++i) {
  6062. var node = validNodes[i];
  6063. var nodeRect = node.getBBox();
  6064. if (nodeRect.height > this._layoutLabelHeight) {
  6065. this._layoutLabelHeight = nodeRect.height;
  6066. }
  6067. }
  6068. this._layoutSpillOver = this._layoutLabelHeight / 2;
  6069. }
  6070. return mode;
  6071. }
  6072. var originalDataLabelAccessor = (this._scale).originalDomainLabelAccessor();
  6073. var staggerStringsWontMatch = this._tickFormat && !originalDataLabelAccessor;
  6074. var calcStagger = ((this._allowStagger && this._layoutMode == -1) || this._layoutMode == 3) && !staggerStringsWontMatch;
  6075. var calcRotate45 = (this._allowRotate45 && this._layoutMode == -1) || this._layoutMode == 2;
  6076. var calcRotate90 = (this._allowRotate90 && this._layoutMode == -1) || this._layoutMode == 1;
  6077. var spaceFor45Label = 0;
  6078. for (var i = 0; i < labelCount; ++i) {
  6079. var node = validNodes[i];
  6080. var nodeRect = node.getBBox();
  6081. layoutLabelHeight = nodeRect.height;
  6082. var labelWidth = nodeRect.width;
  6083. if (labelWidth > layoutLabelWidth) {
  6084. layoutLabelWidth = labelWidth;
  6085. }
  6086. horizontalScore += (labelWidth <= cellWidth ? 1 : cellWidth / labelWidth);
  6087. if (isHorizontal) {
  6088. if (calcStagger) {
  6089. var spaceForLabel = cellWidth * 2;
  6090. if (i == 0 && i == labelCount - 1) {
  6091. spaceForLabel *= 0.5;
  6092. } else if (i == 0 || i == labelCount - 1) {
  6093. spaceForLabel *= 0.75;
  6094. }
  6095. staggerScore += (labelWidth <= spaceForLabel ? 1 : spaceForLabel / labelWidth);
  6096. }
  6097. if (calcRotate45) {
  6098. if (spaceFor45Label == 0) {
  6099. spaceFor45Label = cellWidth90 / 0.7071 - layoutLabelHeight;
  6100. }
  6101. var space = this.calculate45DegreeSpace(node, spaceFor45Label);
  6102. rotate45Score += (labelWidth <= space ? 1 : space / labelWidth);
  6103. }
  6104. if (calcRotate90) {
  6105. rotate90Score += (labelWidth <= cellWidth90 ? 1 : cellWidth90 / labelWidth);
  6106. }
  6107. }
  6108. }
  6109. var mode = 0;
  6110. if (this._layoutMode == -1) {
  6111. if (isHorizontal && this._allowStagger) {
  6112. horizontalScore *= 1.1;
  6113. staggerScore *= 1.1;
  6114. }
  6115. if ((staggerScore > horizontalScore) && (staggerScore >= rotate45Score) && (staggerScore >= rotate90Score)) {
  6116. mode = 3;
  6117. } else if ((rotate45Score > horizontalScore) && (rotate45Score >= rotate90Score)) {
  6118. mode = 2;
  6119. } else if (rotate90Score > horizontalScore) {
  6120. mode = 1;
  6121. }
  6122. } else {
  6123. if ((this._layoutMode == 3 && staggerStringsWontMatch) || !isHorizontal) {
  6124. mode = 0;
  6125. } else {
  6126. mode = this._layoutMode;
  6127. }
  6128. }
  6129. if (isHorizontal) {
  6130. switch (mode) {
  6131. case 3:
  6132. this._layoutLabelSize = layoutLabelHeight * 2;
  6133. break;
  6134. case 2:
  6135. this._layoutLabelSize = (layoutLabelWidth + layoutLabelHeight) * 0.7071;
  6136. break;
  6137. case 1:
  6138. this._layoutLabelSize = layoutLabelWidth;
  6139. break;
  6140. case 0:
  6141. default:
  6142. this._layoutLabelSize = layoutLabelHeight;
  6143. break;
  6144. }
  6145. } else {
  6146. this._layoutLabelSize = layoutLabelWidth;
  6147. }
  6148. this._layoutLabelHeight = layoutLabelHeight;
  6149. return mode;
  6150. },
  6151. calculate45DegreeSpace : function(node, maxWidth) {
  6152. var width = maxWidth;
  6153. var tfm = node.rave_getParentNode().getAttribute("transform");
  6154. if (tfm != null) {
  6155. var tfmString = tfm.toString();
  6156. var indexOfTrans = tfmString.indexOf("translate(");
  6157. if (indexOfTrans != -1) {
  6158. indexOfTrans += 10;
  6159. var indexOfComma = tfmString.indexOf(",", indexOfTrans);
  6160. if (indexOfComma != -1) {
  6161. var xAmount = tfmString.substring(indexOfTrans, indexOfComma);
  6162. var xLabelPos = + (xAmount);
  6163. var width45Degrees = node.getBBox().width;
  6164. var xLabelWidth = width45Degrees * 0.7071;
  6165. var isBottom = this._orient == "bottom";
  6166. if (isBottom) {
  6167. xLabelPos -= node.getBBox().height / 4;
  6168. if (xLabelPos - xLabelWidth < this._bounds.x) {
  6169. xLabelWidth = xLabelPos - this._bounds.x;
  6170. width = xLabelWidth / 0.7071;
  6171. }
  6172. } else {
  6173. if (xLabelPos + xLabelWidth > this._bounds.x + this._bounds.width) {
  6174. xLabelWidth = (this._bounds.x + this._bounds.width) - xLabelPos;
  6175. width = xLabelWidth / 0.7071;
  6176. }
  6177. }
  6178. if (width > maxWidth) {
  6179. width = maxWidth;
  6180. }
  6181. }
  6182. }
  6183. }
  6184. return width;
  6185. },
  6186. /**
  6187. * @param (rave['internal']['Selector']) labels selector with all labels to be rotated
  6188. * @param (rave['internal']['Selector']) g The parent selector of labels
  6189. * @param (String) textAnchor The position of the anchor
  6190. * @param alignmentMode One of HORIZONTAL, STAGGER, ROTATE45, ROTATE90
  6191. */
  6192. rotateLabels : function(g, labels, textAnchor, mode) {
  6193. if (this._rotateLabels) {
  6194. var self = this;
  6195. var positioning = function(data, index, groupIndex) {
  6196. var x = 0;
  6197. var y = 0;
  6198. var rotation_cy = 0;
  6199. var isBottom = self._orient == "bottom";
  6200. if (mode == 3) {
  6201. var cellIndex = self.getStaggerIndex(this);
  6202. if (cellIndex != -1) {
  6203. if (cellIndex % 2 == 1) {
  6204. var staggerDirection = isBottom ? 1 : -1;
  6205. y += (self._layoutLabelHeight * staggerDirection);
  6206. }
  6207. if (cellIndex == 0 && self._staggerAlignFirstAtStart) {
  6208. x -= self._staggerCellWidth / 4;
  6209. } else if (cellIndex == self.getStaggerCount() - 1 && self._staggerAlignLastAtEnd) {
  6210. x += self._staggerCellWidth / 4;
  6211. }
  6212. }
  6213. } else if (mode == 2) {
  6214. if (isBottom) {
  6215. x -= self._layoutLabelHeight;
  6216. } else {
  6217. x += self._layoutLabelHeight / 2;
  6218. }
  6219. } else if (mode == 1) {
  6220. if (isBottom) {
  6221. x -= (this.getBBox().height / 2 + self._layoutLabelHeight / 4);
  6222. rotation_cy = ~~(self._padding / 4 + self._axis.tickSize());
  6223. } else {
  6224. x -= (this.getBBox().height / 2 - self._layoutLabelHeight);
  6225. rotation_cy = ~~-(self._padding / 4 + self._axis.tickSize());
  6226. }
  6227. }
  6228. var rotationDegrees = mode == 1 ? -90 : mode == 2 ? -45 : 0;
  6229. return "translate(" + x + "," + y + ") rotate(" + rotationDegrees + ",0," + rotation_cy + ")";
  6230. };
  6231. labels.attr("transform", positioning).style("text-anchor", textAnchor);
  6232. if (mode == 3) {
  6233. if (this._staggerAlignFirstAtStart) {
  6234. this._staggerFirstNode.rave_setStyle("text-anchor", "start");
  6235. }
  6236. if (this._staggerAlignLastAtEnd) {
  6237. this._staggerLastNode.rave_setStyle("text-anchor", "end");
  6238. }
  6239. }
  6240. }
  6241. },
  6242. /** @expose */
  6243. axis : function() {
  6244. return this._axis;
  6245. },
  6246. /**
  6247. * Draw the axis. The scale is non-null.
  6248. * @param (rave['internal']['Selector']) g Selector group into which the axis is drawn.
  6249. */
  6250. drawAxis : function(g) {
  6251. var axisSelector = g.selectAll("g.axis").data([0]);
  6252. axisSelector.enter().append("g").classed("axis", true).classed(this._orient, true);
  6253. if (!this._axis) {
  6254. this._axis = new rave['internal']['Axis']();
  6255. }
  6256. if (this._hideOverlappingLabels) {
  6257. this._textFlow.valignment("top").dropTextOnFail(false);
  6258. }
  6259. this._axis.ticksHandler(this._tickHandler);
  6260. this._axis.orient(this._orient);
  6261. this._axis.tickFormat(this._tickFormat);
  6262. this._axis.tickPadding(10.0);
  6263. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  6264. var labelHeight = 20.0;
  6265. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6266. if (isHorizontal) {
  6267. labelHeight /= 0.7071;
  6268. }
  6269. var range = this._scale.scale().rangeExtent();
  6270. var extent = + (range[1]) - + (range[0]);
  6271. this._axis.ticks(extent / labelHeight);
  6272. } else {
  6273. if (this._tickMagnitude == null) {
  6274. this._axis.ticks(10.0);
  6275. } else {
  6276. this._axis.ticks.apply(this._axis, [10.0, this._scale.scale().getTickFormat(), this._tickMagnitude]);
  6277. }
  6278. }
  6279. var s = this._scale.scale();
  6280. if (this._scale.originalDomain()) {
  6281. var sOrdinal = s.copy();
  6282. sOrdinal.domain(this._scale.originalDomain());
  6283. s = sOrdinal;
  6284. var self = this;
  6285. var originalDataLabelAccessor = (self._scale).originalDomainLabelAccessor();
  6286. var tickFormatter;
  6287. if (originalDataLabelAccessor) {
  6288. if (this._tickFormat) {
  6289. tickFormatter = function(data, index, groupIndex) {
  6290. return self._tickFormat.call(this, originalDataLabelAccessor.call(this, data, index, groupIndex), index, groupIndex);
  6291. };
  6292. } else {
  6293. tickFormatter = originalDataLabelAccessor;
  6294. }
  6295. } else {
  6296. tickFormatter = this._tickFormat;
  6297. }
  6298. this._axis.tickFormat(tickFormatter);
  6299. }
  6300. this._axis.scale(s);
  6301. axisSelector.call(this._axis);
  6302. var g2 = rave.transition(axisSelector);
  6303. if (!(g2.isTransition())) {
  6304. axisSelector.selectAll("text").call(this._dropOverlap, this._hideOverlappingLabels);
  6305. }
  6306. axisSelector.selectAll("path.domain").classed("axis-line", true);
  6307. axisSelector.selectAll("g.tick line").classed("axis-tick", true);
  6308. if (this._fontChecker) {
  6309. axisSelector.selectAll("g.tick text").classed("axis-label", true).call(this._fontChecker);
  6310. } else {
  6311. axisSelector.selectAll("g.tick text").classed("axis-label", true);
  6312. }
  6313. axisSelector.call(this._axisLineProperties);
  6314. },
  6315. /**
  6316. * Draw the axis title.
  6317. * @param (rave['internal']['Selector']) g Selector group into which the title is drawn.
  6318. */
  6319. drawTitle : function(g) {
  6320. if (!this._displayAxisTitle || this._axisTitle == null || this._axisTitle.trim().length == 0 || !this._bounds) {
  6321. g.selectAll("text.axis-title." + this._orient).remove();
  6322. return;
  6323. }
  6324. var x = 0;
  6325. var y = 0;
  6326. var dy = "";
  6327. var transform;
  6328. if ("top" == this._orient) {
  6329. x = this._elementRect.x + this._elementRect.width / 2;
  6330. y = -this._bounds.height + this._padding / 4;
  6331. dy = "0.75em";
  6332. } else if ("bottom" == this._orient) {
  6333. x = this._elementRect.x + this._elementRect.width / 2;
  6334. y = this._bounds.height - this._padding / 4;
  6335. dy = "-0.25em";
  6336. } else if ("left" == this._orient) {
  6337. x = -this._elementRect.y - this._elementRect.height / 2;
  6338. y = -this._bounds.width + this._padding / 4;
  6339. dy = "0.75em";
  6340. transform = "rotate(-90)";
  6341. } else {
  6342. x = this._elementRect.y + this._elementRect.height / 2;
  6343. y = -this._bounds.width + this._padding / 4;
  6344. dy = "0.75em";
  6345. transform = "rotate(90)";
  6346. }
  6347. var fillOpacity;
  6348. {
  6349. var tmp = g.append("text").attr("class", "axis-title " + this._orient);
  6350. fillOpacity = tmp.style("fill-opacity");
  6351. tmp.remove();
  6352. } var label = g.selectAll("text.axis-title." + this._orient);
  6353. if (label.size() == 0) {
  6354. 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);
  6355. if (this._fontChecker) {
  6356. g.selectAll("text.axis-title." + this._orient).call(this._fontChecker);
  6357. }
  6358. }
  6359. 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);
  6360. },
  6361. getUnZoomedScale : function(scale) {
  6362. var s = scale.copy();
  6363. if (s.getZoomTransform()) {
  6364. s.getZoomTransform()(1, 0);
  6365. }
  6366. return s;
  6367. },
  6368. isValid : function(data) {
  6369. var s = this.getUnZoomedScale(this._axis.scale());
  6370. var v = + (s.call(null, data, 0, 0));
  6371. var range = this._axis.scale().range();
  6372. if (this._axis.scale().range().indexOf(v)> -1) {
  6373. return true;
  6374. }
  6375. if (range[0] < v && v < range[1]) {
  6376. return true;
  6377. }
  6378. if (range[0] > v && v > range[1]) {
  6379. return true;
  6380. }
  6381. return false;
  6382. },
  6383. /**
  6384. * Apply label wrapping if requested.
  6385. * @param (rave['internal']['Selector']) g
  6386. * @param (int) mode One of HORIZONTAL, STAGGER, ROTATE45, ROTATE90
  6387. */
  6388. doLabelWrapping : function(g, mode) {
  6389. if (this._displayTickLabels) {
  6390. this._textFlow.valignment("top");
  6391. if (!this._hideOverlappingLabels) {
  6392. this._textFlow.dropTextOnFail(true);
  6393. }
  6394. var d = this.labelExtent(g);
  6395. if (!d || d[0] < 0 || d[1] < 0) {
  6396. return;
  6397. }
  6398. var w = ~~ (d[0]);
  6399. var h = ~~ (d[1]);
  6400. if (mode == 2) {
  6401. w = ~~(d[1] / 0.7071 - this._layoutLabelHeight);
  6402. h = ~~(this._layoutLabelHeight / 0.7071);
  6403. } else if (mode == 1) {
  6404. var tmp = w;
  6405. w = h;
  6406. h = tmp;
  6407. }
  6408. var allowWrap = mode == 1;
  6409. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  6410. var hActual = ~~ (this._layoutLabelHeight * 1.2);
  6411. if (hActual > h) {
  6412. h = hActual;
  6413. }
  6414. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6415. if (mode == 0 && !isHorizontal) {
  6416. allowWrap = true;
  6417. }
  6418. }
  6419. var self = this;
  6420. var cellWidth = w;
  6421. var cellHeight = h;
  6422. this._textFlow.wrap(allowWrap).truncate(true).textTruncateIndicator(this._textTruncationIndicator != null ? this._textTruncationIndicator : "...").spacing(1.2).extent(function(data, index, groupIndex) {
  6423. var width = cellWidth;
  6424. var height = cellHeight;
  6425. if (mode == 2) {
  6426. var cellIndex = self.getStaggerIndex(this);
  6427. if (cellIndex != -1) {
  6428. width = ~~self.calculate45DegreeSpace(this, cellWidth);
  6429. }
  6430. } else if (mode == 3) {
  6431. var cellIndex = self.getStaggerIndex(this);
  6432. if (cellIndex != -1) {
  6433. if (cellIndex == 0 && cellIndex == self.getStaggerCount() - 1) {
  6434. width = cellWidth;
  6435. } else if (cellIndex == 0 || cellIndex == self.getStaggerCount() - 1) {
  6436. width = cellWidth * 3 / 2;
  6437. } else {
  6438. width = cellWidth * 2;
  6439. }
  6440. height = cellHeight / 2;
  6441. }
  6442. }
  6443. return [width, height];
  6444. });
  6445. g.selectAll("g.tick > text").call(this._textFlow);
  6446. }
  6447. },
  6448. /**
  6449. * <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>
  6450. * @param (rave['internal']['Selector']) g Selector group for axis
  6451. * @return (Array) The extent of the axis label bounds
  6452. */
  6453. /** @expose */
  6454. labelExtent : function(g) {
  6455. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6456. var w = this._bounds.width;
  6457. var h = this._bounds.height;
  6458. if (this._scale.scale().rangeBand) {
  6459. var rangeBandValue = + (this._scale.scale().rangeBand());
  6460. if (isHorizontal) {
  6461. w = rangeBandValue;
  6462. } else {
  6463. h = rangeBandValue;
  6464. }
  6465. }
  6466. this.calcTitleExtent(g);
  6467. if (isHorizontal) {
  6468. h -= this._axis.tickSize();
  6469. h -= this._padding / 2;
  6470. if (this._layoutTitleSize != 0) {
  6471. h -= this._layoutTitleSize;
  6472. h -= this._padding / 2;
  6473. }
  6474. } else {
  6475. w -= this._axis.tickSize();
  6476. w -= this._padding / 2;
  6477. if (this._layoutTitleSize != 0) {
  6478. w -= this._layoutTitleSize;
  6479. w -= this._padding / 2;
  6480. }
  6481. }
  6482. return [w, h];
  6483. },
  6484. calcTitleExtent : function(g) {
  6485. this._layoutTitleSize = 0;
  6486. var title = g.selectAll("text.axis-title");
  6487. if (title.size() > 0) {
  6488. var textHeight = title[0][0].getBBox().height;
  6489. this._layoutTitleSize = textHeight;
  6490. }
  6491. },
  6492. /**
  6493. * Set the role to one of the constants ROLE_X1 etc. defined in AxisComponent.
  6494. * @param (String) role The new role
  6495. * @return (com.ibm.rave.bundles.components.AxisComponentImpl) This object
  6496. */
  6497. /** @expose */
  6498. setRole : function(role) {
  6499. this._role = role;
  6500. return this;
  6501. },
  6502. /**
  6503. * Set the ticks interval on the scale based on the magnitude. tickMagnitude represents power of 10. null value gives the default scale ticks.
  6504. * @param (Number) tickMagnitude
  6505. * @return (com.ibm.rave.bundles.component.AxisComponent) this
  6506. */
  6507. /** @expose */
  6508. scaleTickMagnitude : function(tickMagnitude) {
  6509. this._tickMagnitude = tickMagnitude;
  6510. return this;
  6511. },
  6512. /**
  6513. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale The new scale
  6514. */
  6515. /** @expose */
  6516. scale : function(scale) {
  6517. this._scale = scale ? scale : null;
  6518. return this;
  6519. },
  6520. /**
  6521. * Only legal values are accepted, otherwise the orient is unchanged.
  6522. * @param (String) orient The new orient
  6523. */
  6524. orient$0 : function(orient) {
  6525. if ("left" == orient || "bottom" == orient || "right" == orient || "top" == orient) {
  6526. this._orient = orient;
  6527. if (this._role == null) {
  6528. if ("left" == orient) {
  6529. this._role = "ROLE_Y1";
  6530. } else if ("bottom" == orient) {
  6531. this._role = "ROLE_X1";
  6532. } else if ("right" == orient) {
  6533. this._role = "ROLE_Y2";
  6534. } else {
  6535. this._role = "ROLE_X2";
  6536. }
  6537. }
  6538. }
  6539. return this;
  6540. },
  6541. /**
  6542. * Returns the current orientation string return The current orient
  6543. */
  6544. orient$1 : function() {
  6545. return this._orient;
  6546. },
  6547. /**
  6548. * @param (rave['internal']['RectStruct']) bounds The new bounds
  6549. */
  6550. /** @expose */
  6551. bounds : function(bounds) {
  6552. this._bounds = bounds;
  6553. return this;
  6554. },
  6555. /** @expose */
  6556. elementRect : function(elementRect) {
  6557. this._elementRect = elementRect;
  6558. return this;
  6559. },
  6560. tickFormat$0 : function(tickFormat) {
  6561. this._tickFormat = tickFormat;
  6562. return this;
  6563. },
  6564. tickFormat$1 : function() {
  6565. return this._tickFormat;
  6566. },
  6567. simplifiedTickFormat$0 : function(tickFormat) {
  6568. this._simplifiedTickFormat = tickFormat;
  6569. return this;
  6570. },
  6571. simplifiedTickFormat$1 : function() {
  6572. return this._simplifiedTickFormat;
  6573. },
  6574. /** @expose */
  6575. displayAxisTitle : function(displayAxisTitle) {
  6576. this._displayAxisTitle = displayAxisTitle;
  6577. return this;
  6578. },
  6579. /** @expose */
  6580. displayAxisLine : function(displayAxisLine) {
  6581. this._displayAxisLine = displayAxisLine;
  6582. return this;
  6583. },
  6584. /** @expose */
  6585. displayTicks : function(displayTicks) {
  6586. this._displayTicks = displayTicks;
  6587. return this;
  6588. },
  6589. /** @expose */
  6590. displayTickLabels : function(displayTickLabels) {
  6591. this._displayTickLabels = displayTickLabels;
  6592. return this;
  6593. },
  6594. /** @expose */
  6595. allowAutomaticAxisLayoutToChangeOrientation : function(state) {
  6596. this._allowAutoAxisLayoutToChangeOrientaiton = state;
  6597. return this;
  6598. },
  6599. /** @expose */
  6600. isAllowAutomaticAxisLayoutToChangeOrientation : function() {
  6601. return this._allowAutoAxisLayoutToChangeOrientaiton;
  6602. },
  6603. /** @expose */
  6604. showPanZoomTickLabels : function(showPanZoomTickLabels) {
  6605. this._showPanZoomTickLabels = showPanZoomTickLabels;
  6606. return this;
  6607. },
  6608. /** @expose */
  6609. axisTitle : function(axisTitle) {
  6610. this._axisTitle = axisTitle;
  6611. return this;
  6612. },
  6613. /** @expose */
  6614. axisColor : function(axisColor) {
  6615. this._lineColor = axisColor;
  6616. this._tickColor = axisColor;
  6617. return this;
  6618. },
  6619. /** @expose */
  6620. lineColor : function(lineColor) {
  6621. this._lineColor = lineColor;
  6622. return this;
  6623. },
  6624. /** @expose */
  6625. tickColor : function(tickColor) {
  6626. this._tickColor = tickColor;
  6627. return this;
  6628. },
  6629. /** @expose */
  6630. labelColor : function(labelColor) {
  6631. this._labelStyle["fill"] = labelColor;
  6632. return this;
  6633. },
  6634. labelStyle$0 : function(fill, fontSize, fontFamily) {
  6635. this._labelStyle["fill"] = fill;
  6636. this._labelStyle["font-size"] = fontSize;
  6637. this._labelStyle["font-family"] = fontFamily;
  6638. return this;
  6639. },
  6640. /** @expose */
  6641. titleColor : function(titleColor) {
  6642. this._titleStyle["fill"] = titleColor;
  6643. return this;
  6644. },
  6645. titleStyle$0 : function(fill, fontSize, fontFamily) {
  6646. this._titleStyle["fill"] = fill;
  6647. this._titleStyle["font-size"] = fontSize;
  6648. this._titleStyle["font-family"] = fontFamily;
  6649. return this;
  6650. },
  6651. /**
  6652. * @param (int) padding The new padding
  6653. */
  6654. /** @expose */
  6655. padding : function(padding) {
  6656. this._padding = padding;
  6657. return this;
  6658. },
  6659. /**
  6660. * @param mode LayoutMode for axis, one of: null (numeric axis), automatic, horizontal, stagger, rotate45, rotate90
  6661. */
  6662. /** @expose */
  6663. layoutMode : function(layoutMode) {
  6664. this._layoutMode = -1;
  6665. if (layoutMode != null) {
  6666. if (layoutMode == "horizontal") {
  6667. this._layoutMode = 0;
  6668. } else if (layoutMode == "stagger") {
  6669. this._layoutMode = 3;
  6670. } else if (layoutMode == "rotate45") {
  6671. this._layoutMode = 2;
  6672. } else if (layoutMode == "rotate90") {
  6673. this._layoutMode = 1;
  6674. }
  6675. }
  6676. return this;
  6677. },
  6678. /**
  6679. * @param (boolean) allow Enable Stagger to be considered in the automatic layout algorithm
  6680. */
  6681. /** @expose */
  6682. allowStagger : function(allow) {
  6683. this._allowStagger = allow;
  6684. return this;
  6685. },
  6686. /**
  6687. * @param (boolean) allow Enable Rotate 45 to be considered in the automatic layout algorithm
  6688. */
  6689. /** @expose */
  6690. allowRotate45 : function(allow) {
  6691. this._allowRotate45 = allow;
  6692. return this;
  6693. },
  6694. /**
  6695. * @param (boolean) allow Enable Rotate 90 to be considered in the automatic layout algorithm
  6696. */
  6697. /** @expose */
  6698. allowRotate90 : function(allow) {
  6699. this._allowRotate90 = allow;
  6700. return this;
  6701. },
  6702. /**
  6703. * @return (boolean) True if on the last call the axis rendered shapes, false otherwise
  6704. */
  6705. renderedShapes : function() {
  6706. return this._renderedShapes;
  6707. },
  6708. labelStyle$1 : function(fontStyle) {
  6709. this._labelStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  6710. return this;
  6711. },
  6712. titleStyle$1 : function(fontStyle) {
  6713. this._titleStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  6714. return this;
  6715. },
  6716. /**
  6717. * Determines whether the axis is swapped.
  6718. * @return (boolean) True if axis is swapped
  6719. */
  6720. isAxisSwapped : function() {
  6721. 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")));
  6722. },
  6723. /**
  6724. * <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>
  6725. * @param (String) indicator the string to be placed to indicated truncated text
  6726. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  6727. */
  6728. /** @expose */
  6729. textTruncateIndicator : function(indicator) {
  6730. this._textTruncationIndicator = indicator;
  6731. return this;
  6732. },
  6733. /**
  6734. * If at least one label collision request is pending we stop the label collision component, and shut down the label collision timer event.
  6735. */
  6736. stopLabelDroppingUpdate : function() {
  6737. this._pendingLabelTimer = false;
  6738. },
  6739. /**
  6740. * 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.
  6741. * @param (rave['internal']['Selector']) labels the selection of valid labels for the end of the transition
  6742. * @param (double) duration of the transition. If 0, we don't do anything.
  6743. * @param (double) delay of the transition. Added to the duration to delay the updates.
  6744. */
  6745. updateLabelDropping : function(labels, duration, delay) {
  6746. var self = this;
  6747. var start = delay + duration;
  6748. var labelCollideCallback = function(elapsed) {
  6749. if (!self._pendingLabelTimer) {
  6750. return true;
  6751. }
  6752. labels.call(self._dropOverlap, self._hideOverlappingLabels);
  6753. if (elapsed >= start) {
  6754. self._pendingLabelTimer = false;
  6755. return true;
  6756. }
  6757. return false;
  6758. };
  6759. if (duration > 0) {
  6760. this._pendingLabelTimer = true;
  6761. rave.timer(labelCollideCallback, start);
  6762. }
  6763. },
  6764. doLabelWrappingAfterAnimation : function(g, labels, mode, duration, delay) {
  6765. this._layoutTimerId++;
  6766. var timerId = this._layoutTimerId;
  6767. var self = this;
  6768. var wrapCallback = function(elapsed) {
  6769. if (self._layoutTimerId == timerId) {
  6770. self.doLabelWrapping(g, mode);
  6771. self.handleLabelsRotationAndPosition(g, labels, mode);
  6772. }
  6773. return true;
  6774. };
  6775. rave.timer(wrapCallback, delay + duration);
  6776. },
  6777. /** @expose */
  6778. preLayout : function() {
  6779. this._layoutTitleSize = 0;
  6780. this._layoutLabelSize = 0;
  6781. this._layoutLabelHeight = 0;
  6782. this._layoutAverageDigitWidth = 0;
  6783. this._layoutSpillOver = 0;
  6784. },
  6785. /** @expose */
  6786. getSizableType : function() {
  6787. return this._scale.isOrdinal() || this._scale.isClustered() ? 1 : 0;
  6788. },
  6789. /** @expose */
  6790. getSizableOrientation : function() {
  6791. return this._orient;
  6792. },
  6793. /** @expose */
  6794. getPreferredSize : function() {
  6795. var layoutPaddingSize = 0;
  6796. if (this._axis) {
  6797. layoutPaddingSize = this._axis.tickSize();
  6798. if (this._layoutLabelSize != 0) {
  6799. layoutPaddingSize += this._padding / 2;
  6800. }
  6801. if (this._layoutTitleSize != 0) {
  6802. layoutPaddingSize += this._padding / 2;
  6803. }
  6804. }
  6805. return this._layoutLabelSize + this._layoutAverageDigitWidth + this._layoutTitleSize + layoutPaddingSize + 2;
  6806. },
  6807. /** @expose */
  6808. getSpillOverSize : function() {
  6809. return this._layoutSpillOver;
  6810. },
  6811. /** @expose */
  6812. orient : function(a0) {
  6813. var args = arguments;
  6814. if (args.length == 0) {
  6815. return this.orient$1();
  6816. }
  6817. return this.orient$0(a0);
  6818. },
  6819. /** @expose */
  6820. tickFormat : function(a0) {
  6821. var args = arguments;
  6822. if (args.length == 0) {
  6823. return this.tickFormat$1();
  6824. }
  6825. return this.tickFormat$0(a0);
  6826. },
  6827. /** @expose */
  6828. simplifiedTickFormat : function(a0) {
  6829. var args = arguments;
  6830. if (args.length == 0) {
  6831. return this.simplifiedTickFormat$1();
  6832. }
  6833. return this.simplifiedTickFormat$0(a0);
  6834. },
  6835. /** @expose */
  6836. labelStyle : function(a0, a1, a2) {
  6837. var args = arguments;
  6838. if (args.length == 1) {
  6839. return this.labelStyle$1(a0);
  6840. }
  6841. return this.labelStyle$0(a0, a1, a2);
  6842. },
  6843. /** @expose */
  6844. titleStyle : function(a0, a1, a2) {
  6845. var args = arguments;
  6846. if (args.length == 1) {
  6847. return this.titleStyle$1(a0);
  6848. }
  6849. return this.titleStyle$0(a0, a1, a2);
  6850. }
  6851. });
  6852. /**
  6853. * 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.
  6854. * @param (rave['internal']['RectStruct']) bounds Rectangle of the axis bounds
  6855. * @param (String) orient Orient, "top", "bottom", "left", "right"; if not valid, "bottom" used
  6856. * @return (double[]) Translation [x,y]
  6857. */
  6858. /** @expose */
  6859. com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation = function(bounds, orient) {
  6860. if ("left" == orient) {
  6861. return [bounds.x + bounds.width, 0.0];
  6862. }
  6863. if ("right" == orient) {
  6864. return [bounds.x, 0.0];
  6865. }
  6866. if ("top" == orient) {
  6867. return [0.0, bounds.y + bounds.height];
  6868. }
  6869. return [0.0, bounds.y];
  6870. };
  6871. com_ibm_rave_bundles_components_AxisComponentImpl.NodeIndex = rave['internal']['Declare']({
  6872. //_node : null,
  6873. _domainIndex : 0,
  6874. /** @expose */
  6875. constructor : function(node, domainIndex) {
  6876. this._node = node;
  6877. this._domainIndex = domainIndex;
  6878. },
  6879. /** @expose */
  6880. contains : function(node) {
  6881. return node == this._node;
  6882. },
  6883. /** @expose */
  6884. getIndex : function() {
  6885. return this._domainIndex;
  6886. }
  6887. });
  6888. /**
  6889. * Tick Handler for the axis. This will get called as the core axis is transitioned.
  6890. */
  6891. com_ibm_rave_bundles_components_AxisComponentImpl.AxisTickHandler = rave['internal']['Declare'](rave['internal']['AbstractTickHandler'], {
  6892. //_label : null,
  6893. //_tick : null,
  6894. _$functionClassMethod : function() {
  6895. var _$self = function(args) {
  6896. if (args !== null || arguments.length > 1){
  6897. args = Array.prototype.slice.call(arguments, 0);
  6898. }
  6899. {
  6900. _$self.handle(args[0]);
  6901. return null;
  6902. }
  6903. };
  6904. return _$self;
  6905. },
  6906. constructor : function(label, tick) {
  6907. this._label = label;
  6908. this._tick = tick;
  6909. },
  6910. /** @expose */
  6911. handle : function(ticks) {
  6912. ticks.call(this._tick);
  6913. ticks.call(this._label);
  6914. }
  6915. });
  6916. //com_ibm_rave_bundles_components_AxisComponentImpl.VISIBILITY = "visibility";
  6917. //com_ibm_rave_bundles_components_AxisComponentImpl.HIDDEN = "hidden";
  6918. /** @expose */
  6919. com_ibm_rave_bundles_components_AxisComponentImpl.LABEL_HIDDEN_FLAG = "__tickLabelHidden__";
  6920. /** @expose */
  6921. com_ibm_rave_bundles_components_AxisComponentImpl.PANZOOM_HIDDEN_FLAG = "__panZoomHidden__";
  6922. /** @expose */
  6923. com_ibm_rave_bundles_components_AxisComponentImpl.HIDDEN_COUNT = "__hiddenCount__";
  6924. /** @expose */
  6925. com_ibm_rave_bundles_components_AxisComponentImpl.PREFERRED_SPACE_PER_TICK = 20;
  6926. /** @expose */
  6927. com_ibm_rave_bundles_components_AxisComponentImpl.PREFERRED_TICK_COUNT = 10;
  6928. /** @expose */
  6929. com_ibm_rave_bundles_components_AxisComponentImpl.TICK_PADDING = 10;
  6930. //com_ibm_rave_bundles_components_AxisComponentImpl.HORIZONTAL_WEIGHT = 1.1;
  6931. com_ibm_rave_bundles_components_AxisComponentImpl.HORIZONTAL = 0;
  6932. com_ibm_rave_bundles_components_AxisComponentImpl.ROTATE90 = 1;
  6933. com_ibm_rave_bundles_components_AxisComponentImpl.ROTATE45 = 2;
  6934. com_ibm_rave_bundles_components_AxisComponentImpl.STAGGER = 3;
  6935. /**
  6936. * Constant used for text flow spacing
  6937. */
  6938. com_ibm_rave_bundles_components_AxisComponentImpl.TEXTFLOW_SPACING = 1.2;
  6939. /**
  6940. * Bottom axis orientation string.
  6941. */
  6942. /** @expose */
  6943. com_ibm_rave_bundles_components_AxisComponentImpl.BOTTOM_ORIENTATION = "bottom";
  6944. /**
  6945. * Top axis orientation string.
  6946. */
  6947. /** @expose */
  6948. com_ibm_rave_bundles_components_AxisComponentImpl.TOP_ORIENTATION = "top";
  6949. /**
  6950. * Left axis orientation string.
  6951. */
  6952. /** @expose */
  6953. com_ibm_rave_bundles_components_AxisComponentImpl.LEFT_ORIENTATION = "left";
  6954. /**
  6955. * Right axis orientation string.
  6956. */
  6957. /** @expose */
  6958. com_ibm_rave_bundles_components_AxisComponentImpl.RIGHT_ORIENTATION = "right";
  6959. com_ibm_rave_bundles_components_AxisComponentImpl.AUTOMODE = -1;
  6960. // $source: com/ibm/rave/bundles/components/GridComponentImpl
  6961. /************************************************************************
  6962. ** IBM Confidential
  6963. **
  6964. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6965. **
  6966. ** (C) Copyright IBM Corp. 2017
  6967. **
  6968. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6969. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6970. ************************************************************************/
  6971. // GENERATED
  6972. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  6973. //@import com/ibm/rave/bundles/components/StyleStructs (runtime) // new
  6974. //@import com/ibm/rave/bundles/component/GridComponent (runtime) // GridComponent
  6975. /**
  6976. * <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>
  6977. */
  6978. var com_ibm_rave_bundles_components_GridComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  6979. /**
  6980. * The axis property
  6981. */
  6982. //_axis : null,
  6983. /**
  6984. * Role, from the AxisComponent API
  6985. */
  6986. //_role : null,
  6987. /**
  6988. * The orientation
  6989. */
  6990. //_orient : null,
  6991. /**
  6992. * The bounds
  6993. */
  6994. //_bounds : null,
  6995. /**
  6996. * Style of gridlines
  6997. */
  6998. //_gridlineStyle : null,
  6999. /**
  7000. * Whether to display gridlines
  7001. */
  7002. _displayGridlines : false,
  7003. /**
  7004. * After calling the component, this is true if shapes were rendered, false if they were cleared.
  7005. */
  7006. _renderedShapes : false,
  7007. /**
  7008. * Construct, with all properties the defaults.
  7009. */
  7010. /** @expose */
  7011. constructor : function() {
  7012. this._axis = null;
  7013. this._role = null;
  7014. this._orient = "bottom";
  7015. this._bounds = null;
  7016. this._displayGridlines = true;
  7017. this._gridlineStyle = new com_ibm_rave_bundles_components_StyleStructs.LineStyle();
  7018. this._renderedShapes = false;
  7019. },
  7020. /** @expose */
  7021. type : function() {
  7022. return com_ibm_rave_bundles_component_GridComponent.COMPONENT_TYPE;
  7023. },
  7024. /** @expose */
  7025. role : function() {
  7026. return this._role;
  7027. },
  7028. /** @expose */
  7029. execute : function(g) {
  7030. this.preExecute();
  7031. if (!this._displayGridlines || !this._axis || !this._bounds) {
  7032. g.selectAll("*").remove();
  7033. this._renderedShapes = false;
  7034. return;
  7035. }
  7036. this._renderedShapes = true;
  7037. var size = ("bottom" == this._orient || "top" == this._orient) ? this._bounds.height : this._bounds.width;
  7038. var ticksHandler = this._axis.ticksHandler();
  7039. var tickSize = this._axis.tickSize();
  7040. var outerTickSize = this._axis.outerTickSize();
  7041. var tickFormat = this._axis.tickFormat();
  7042. var ax = this._axis.tickSize(-size, 0).tickFormat("").ticksHandler(null);
  7043. g.call(ax);
  7044. this._axis.tickSize(tickSize, outerTickSize).tickFormat(tickFormat).ticksHandler(ticksHandler);
  7045. g.selectAll("g.tick line").classed("grid-tick", true);
  7046. g.selectAll(".grid-tick").style("stroke", this._gridlineStyle._stroke).style("stroke-dasharray", (this._gridlineStyle._dashArray));
  7047. g.selectAll("path.domain").remove();
  7048. },
  7049. /**
  7050. * @param (rave['internal']['Axis']) axis The new axis
  7051. */
  7052. /** @expose */
  7053. axis : function(axis) {
  7054. this._axis = axis;
  7055. return this;
  7056. },
  7057. /**
  7058. * Set the role to one of the constants ROLE_X1 etc. defined in AxisComponent.
  7059. * @param (String) role The new role
  7060. * @return (com.ibm.rave.bundles.components.GridComponentImpl) This object
  7061. */
  7062. /** @expose */
  7063. setRole : function(role) {
  7064. this._role = role;
  7065. return this;
  7066. },
  7067. /**
  7068. * Only legal values are accepted, otherwise the orient is unchanged.
  7069. * @param (String) orient The new orient
  7070. */
  7071. orient$0 : function(orient) {
  7072. if ("left" == orient || "right" == orient || "bottom" == orient || "top" == orient) {
  7073. this._orient = orient;
  7074. }
  7075. return this;
  7076. },
  7077. /**
  7078. * @param (rave['internal']['RectStruct']) bounds The new bounds
  7079. */
  7080. /** @expose */
  7081. bounds : function(bounds) {
  7082. this._bounds = bounds;
  7083. return this;
  7084. },
  7085. displayGridlines$0 : function(displayGridlines) {
  7086. this._displayGridlines = displayGridlines;
  7087. return this;
  7088. },
  7089. /** @expose */
  7090. gridlineStyle : function(gridlineColor, dashArray) {
  7091. this.gridlineColor(gridlineColor);
  7092. this.dashArray(dashArray);
  7093. return this;
  7094. },
  7095. gridlineColor$0 : function(gridlineColor) {
  7096. this._gridlineStyle._stroke = (gridlineColor != null && gridlineColor.length > 0) ? gridlineColor : null;
  7097. return this;
  7098. },
  7099. dashArray$0 : function(dashArray) {
  7100. this._gridlineStyle._dashArray = (dashArray != null && dashArray.length > 0) ? dashArray : null;
  7101. return this;
  7102. },
  7103. /**
  7104. * @return (String) The orientation of the gridline.
  7105. */
  7106. orient$1 : function() {
  7107. return this._orient;
  7108. },
  7109. displayGridlines$1 : function() {
  7110. return this._displayGridlines;
  7111. },
  7112. gridlineColor$1 : function() {
  7113. return this._gridlineStyle._stroke;
  7114. },
  7115. dashArray$1 : function() {
  7116. return this._gridlineStyle._dashArray;
  7117. },
  7118. /**
  7119. * @return (boolean) True if on the last call the axis rendered shapes, false otherwise
  7120. */
  7121. renderedShapes : function() {
  7122. return this._renderedShapes;
  7123. },
  7124. /** @expose */
  7125. orient : function(a0) {
  7126. var args = arguments;
  7127. if (args.length == 0) {
  7128. return this.orient$1();
  7129. }
  7130. return this.orient$0(a0);
  7131. },
  7132. /** @expose */
  7133. displayGridlines : function(a0) {
  7134. var args = arguments;
  7135. if (args.length == 0) {
  7136. return this.displayGridlines$1();
  7137. }
  7138. return this.displayGridlines$0(a0);
  7139. },
  7140. /** @expose */
  7141. gridlineColor : function(a0) {
  7142. var args = arguments;
  7143. if (args.length == 0) {
  7144. return this.gridlineColor$1();
  7145. }
  7146. return this.gridlineColor$0(a0);
  7147. },
  7148. /** @expose */
  7149. dashArray : function(a0) {
  7150. var args = arguments;
  7151. if (args.length == 0) {
  7152. return this.dashArray$1();
  7153. }
  7154. return this.dashArray$0(a0);
  7155. }
  7156. });
  7157. // $source: com/ibm/rave/bundles/components/KeyedBundleComponentImpl
  7158. /************************************************************************
  7159. ** IBM Confidential
  7160. **
  7161. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7162. **
  7163. ** (C) Copyright IBM Corp. 2017
  7164. **
  7165. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7166. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7167. ************************************************************************/
  7168. // GENERATED
  7169. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  7170. /**
  7171. * This type of component generates scene nodes based on a provided data set. Accordingly, any component deriving from this class can (and should) make use of this class's <em>key function</em>. Typically this key function will be passed to the second argument of {@link this.Selector#this.data(, rave['internal']['ValueFunction'])} method in Rave Core, when joining data to scene nodes. For more information on how key functions are used, see the documentation for {@link this.Selector#this.data(, rave['internal']['ValueFunction'])} in Rave Core.
  7172. * @param < (com.ibm.rave.bundles.components.KeyedBundleComponentImpl) T > Any class that extends this component type must have a self reference in order to support method chaining of the {@link this.KeyedBundleComponentImpl#this.key(rave['internal']['SingleValueFunction'])} method. For example: <pre> public class MyComponent extends DataBasedBundleComponent<MyComponent> { ... ... MyComponent c = new MyComponent(); c.someSetter(arg) .key(keyFunction) // returns the MyComponent instance, rather than a DataBasedBundleComponent instance. .otherSetter(arg2); </pre>
  7173. */
  7174. var com_ibm_rave_bundles_components_KeyedBundleComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  7175. //keyFunction : null,
  7176. /**
  7177. * Set the key function this component should use when joining data to scene nodes.
  7178. * @param (rave['internal']['SingleValueFunction']) keyFunction This function will be passed each datum individually and must return a unique value (a key).
  7179. * @return (com.ibm.rave.bundles.components.KeyedBundleComponentImpl) This.
  7180. */
  7181. /** @expose */
  7182. key : function(keyFunction) {
  7183. this.keyFunction = keyFunction;
  7184. return this;
  7185. },
  7186. /**
  7187. * Returns a {@link (rave['internal']['ValueFunction']) ValueFunction} that wraps the provided key function.
  7188. */
  7189. /** @expose */
  7190. getKey : function() {
  7191. if (!this.keyFunction) {
  7192. return null;
  7193. }
  7194. var self = this;
  7195. return function(datum, index, groupIndex) {
  7196. return self.keyFunction(datum);
  7197. };
  7198. }
  7199. });
  7200. // $source: com/ibm/rave/bundles/components/BoxplotComponentImpl
  7201. /************************************************************************
  7202. ** IBM Confidential
  7203. **
  7204. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7205. **
  7206. ** (C) Copyright IBM Corp. 2017
  7207. **
  7208. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7209. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7210. ************************************************************************/
  7211. // GENERATED
  7212. //@import com/ibm/rave/bundles/components/KeyedBundleComponentImpl (loadtime) // superclass
  7213. //@import com/ibm/rave/bundles/components/StyleStructs (runtime) // new
  7214. //@import com/ibm/rave/bundles/component/BoxplotComponent (runtime) // COMPONENT_TYPE
  7215. /**
  7216. * <p> Component to draw boxplot elements. The data is an array of BoxplotDatum. One boxplot small multiple is drawn per BoxplotDatum. The boxplot X data value is used as a key for the small multiples (this is not the key of the keyed bundle component). </p> <p> Each small multiple draws the boxplot as a group node. The group node has the boxplot shapes (box, median plus, mean line, fence whiskers) and the outliers. The group node and box shapes have the BoxplotDatum as datum. The outliers have the original data for the point as datum. </p> <p> The overall structure is: </p> <pre> &lt;g class="elements"&gt; &lt;g class="boxplot-element"&gt; &lt;g class="boxplot-boxcontainer"&gt; &lt;rect class="element-shape boxplot-box" /&gt; ... lines for the median, mean, whiskers &lt;/g&gt; &lt;circle class="element-shape boxplot-point boxplot-outlierpoint" /&gt; ... more circles for outlier and extreme points &lt;/g&gt; ... one group per boxplot &lt;/g&gt; </pre> <p> The component data properties include the data, the X and Y coordinate scales, and the original data Y accessor (used for the outliers, where the datum is the original data). The component key is the original data key accessor and is only used on the outliers; the boxplot groups are matched by the X values when the data is created. </p> <p> The component creates its own transitions for the small multiples. The effect type and duration control this. </p> <p> The boxplot size is the width in pixels of the boxplot rectangle. The whiskers are 80% of this. The median plus is the smaller of 12 pixels or the size. The outlier radius is the smaller of BOXPLOT_OUTLIER_MAX_RADIUS pixels or half the size. </p> <p> The styling is set with properties. </p> <h3>Use of Properties, and Action Operations</h3> <p> This component is somewhat experimental, though I think the results are good and we should see about moving other components to this model. The approach was prompted by the boxplot UX for interactivity. </p> <p> On selecting or highlighting any of the parts of a boxplot (the box, whiskers, or mean and median symbols), all the parts are to change styles. The points are all treated independently. That meant custom action operations, since the default operations only affect the event target node. The operations get the target node, and find the logical shape for that node. This is the shape itself for a point, and the &lt;g&gt; containing the shape for boxplot parts. The action operation is then applied to that logical shape; for boxplots, this adjusts all the children of the shape. </p> <p> Some of the custom highlight and selection operations used in other charts use properties to record the original styling of the shape, so that styling can be restored when the selection and highlighting changes. That approach is used here, except that the properties are set during the components enter/update/exit pattern. The properties are then used both to style the shape in the update, and to chagne the styling as the selection and highlighting state changes. </p> <p> Some of the custom highlight and selection operations used in other charts use properties to set selection and highlighting state information. That approach is used here. The {@link #"__rave_selection"} indicates the selection state, and can be null, {@link #"1"} , or {@link #"0"} . The operations change the values of these properties, then restyle the shape. The style values are calculated from the styling properties and the selection and highlighting state properties. </p>
  7217. */
  7218. var com_ibm_rave_bundles_components_BoxplotComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_KeyedBundleComponentImpl, {
  7219. /**
  7220. * Context for the bundle using the component
  7221. */
  7222. //_context : null,
  7223. /**
  7224. * Data to be drawn.
  7225. */
  7226. //_data : null,
  7227. /**
  7228. * X-axis scale. Always ordinal.
  7229. */
  7230. //_xScale : null,
  7231. /**
  7232. * Y-axis scale. Always linear.
  7233. */
  7234. //_yScale : null,
  7235. /**
  7236. * Accessor which when applied to the original data, returns the Y-value
  7237. */
  7238. //_originalDataYAccessor : null,
  7239. /**
  7240. * Color palette
  7241. */
  7242. //_colorPalette : null,
  7243. /**
  7244. * Accessor which when applied to the original data, returns the color value
  7245. */
  7246. //_originalDataColorAccessor : null,
  7247. /**
  7248. * Entrance effect
  7249. */
  7250. //_effect : null,
  7251. /**
  7252. * Styling of the boxplot box; currently all null (using CSS), but if non-null will override CSS.
  7253. */
  7254. //_boxStyle : null,
  7255. /**
  7256. * Styling of the boxplot whiskers; currently all null (using CSS), but if non-null will override CSS.
  7257. */
  7258. //_whiskerStyle : null,
  7259. /**
  7260. * Styling of the boxplot median plus; currently all null (using CSS), but if non-null will override CSS.
  7261. */
  7262. //_medianStyle : null,
  7263. /**
  7264. * Styling of the boxplot mean plus; currently all null (using CSS), but if non-null will override CSS.
  7265. */
  7266. //_meanStyle : null,
  7267. /**
  7268. * Styling of the boxplot outlier circles; currently all null (using CSS), but if non-null will override CSS.
  7269. */
  7270. //_outlierStyle : null,
  7271. /**
  7272. * Styling of the boxplot extremum circles; currently all null (using CSS), but if non-null will override CSS.
  7273. */
  7274. //_extremeStyle : null,
  7275. /**
  7276. * Value function applied to a BoxplotDatum that returns the X value
  7277. */
  7278. //_boxplotDatumKeyAccessor : null,
  7279. /**
  7280. * Effect duration
  7281. */
  7282. _duration : 0,
  7283. /**
  7284. * Size (width in pixels) of boxplot.
  7285. */
  7286. _boxplotSize : 0,
  7287. /**
  7288. * Whether the data has changed
  7289. */
  7290. _dataChanged : false,
  7291. /**
  7292. * Construct
  7293. */
  7294. /** @expose */
  7295. constructor : function(context) {
  7296. this._context = context;
  7297. this._data = null;
  7298. this._xScale = null;
  7299. this._yScale = null;
  7300. this._originalDataYAccessor = null;
  7301. this._colorPalette = null;
  7302. this._originalDataColorAccessor = null;
  7303. this._effect = "none";
  7304. this._duration = 0;
  7305. this._dataChanged = false;
  7306. this._boxStyle = new com_ibm_rave_bundles_components_StyleStructs.ShapeStyle();
  7307. this._whiskerStyle = new com_ibm_rave_bundles_components_StyleStructs.LineStyle();
  7308. this._medianStyle = new com_ibm_rave_bundles_components_StyleStructs.LineStyle();
  7309. this._meanStyle = new com_ibm_rave_bundles_components_StyleStructs.LineStyle();
  7310. this._outlierStyle = new com_ibm_rave_bundles_components_StyleStructs.ShapeStyle();
  7311. this._extremeStyle = new com_ibm_rave_bundles_components_StyleStructs.ShapeStyle();
  7312. this._boxplotDatumKeyAccessor = function(data, index, groupIndex) {
  7313. return (data)._key;
  7314. };
  7315. },
  7316. /** @expose */
  7317. type : function() {
  7318. return com_ibm_rave_bundles_component_BoxplotComponent.COMPONENT_TYPE;
  7319. },
  7320. /** @expose */
  7321. data : function(data) {
  7322. this._data = data;
  7323. this._dataChanged = true;
  7324. return this;
  7325. },
  7326. /** @expose */
  7327. xScale : function(xScale) {
  7328. this._xScale = xScale;
  7329. return this;
  7330. },
  7331. /** @expose */
  7332. yScale : function(yScale) {
  7333. this._yScale = yScale;
  7334. return this;
  7335. },
  7336. /** @expose */
  7337. yAccessor : function(yAccessor) {
  7338. this._originalDataYAccessor = yAccessor;
  7339. return this;
  7340. },
  7341. /** @expose */
  7342. colorAccessor : function(colorAccessor) {
  7343. this._originalDataColorAccessor = colorAccessor;
  7344. return this;
  7345. },
  7346. /** @expose */
  7347. colorPalette : function(colorPalette) {
  7348. this._colorPalette = colorPalette;
  7349. return this;
  7350. },
  7351. /** @expose */
  7352. effect : function(effect) {
  7353. this._effect = effect;
  7354. return this;
  7355. },
  7356. /** @expose */
  7357. duration : function(duration) {
  7358. this._duration = (duration > 0) ? duration : 0;
  7359. return this;
  7360. },
  7361. /** @expose */
  7362. boxplotSize : function(boxplotSize) {
  7363. this._boxplotSize = Math.max(2.0, boxplotSize);
  7364. return this;
  7365. },
  7366. /** @expose */
  7367. boxStyle : function(fill, stroke, strokeWidth) {
  7368. this._boxStyle._fill = fill;
  7369. this._boxStyle._stroke = stroke;
  7370. this._boxStyle._strokeWidth = strokeWidth;
  7371. return this;
  7372. },
  7373. /** @expose */
  7374. whiskerStyle : function(stroke, strokeWidth) {
  7375. this._whiskerStyle._stroke = stroke;
  7376. this._whiskerStyle._strokeWidth = strokeWidth;
  7377. return this;
  7378. },
  7379. /** @expose */
  7380. medianStyle : function(stroke, strokeWidth) {
  7381. this._medianStyle._stroke = stroke;
  7382. this._medianStyle._strokeWidth = strokeWidth;
  7383. return this;
  7384. },
  7385. /** @expose */
  7386. meanStyle : function(stroke, strokeWidth) {
  7387. this._meanStyle._stroke = stroke;
  7388. this._meanStyle._strokeWidth = strokeWidth;
  7389. return this;
  7390. },
  7391. /** @expose */
  7392. outlierStyle : function(fill, stroke, strokeWidth) {
  7393. this._outlierStyle._fill = fill;
  7394. this._outlierStyle._stroke = stroke;
  7395. this._outlierStyle._strokeWidth = strokeWidth;
  7396. return this;
  7397. },
  7398. /** @expose */
  7399. extremeStyle : function(fill, stroke, strokeWidth) {
  7400. this._extremeStyle._fill = fill;
  7401. this._extremeStyle._stroke = stroke;
  7402. this._extremeStyle._strokeWidth = strokeWidth;
  7403. return this;
  7404. },
  7405. /** @expose */
  7406. execute : function(g) {
  7407. this.preExecute();
  7408. if (!this._data || !this._xScale || !this._yScale || !this._originalDataYAccessor) {
  7409. g.selectAll("g." + "boxplot-element").remove();
  7410. return;
  7411. }
  7412. var boxplotGroups = g.selectAll("g." + "boxplot-element").data(this._data, this._boxplotDatumKeyAccessor);
  7413. boxplotGroups.exit().remove();
  7414. this.enterBoxplotGroups(boxplotGroups.enter());
  7415. this.updateBoxplotGroups(boxplotGroups);
  7416. this._dataChanged = false;
  7417. this._duration = 0;
  7418. },
  7419. /**
  7420. * Add new g.boxplot-element groups to the chart for an enter selector. The new shape styles and geometry are initialized, based on the entrance effect.
  7421. * @param (rave['internal']['Selector']) groups The enter selector
  7422. */
  7423. enterBoxplotGroups : function(groups) {
  7424. var self = this;
  7425. var grow = "grow" == this._effect && this._duration > 0;
  7426. groups.append("g").attr("class", "boxplot-element").each(function(data, index, groupIndex) {
  7427. var g = rave.select(this);
  7428. var d = data;
  7429. var c = g.append("g").classed("boxplot-boxcontainer", true);
  7430. c.append("rect").classed("element-shape", true).classed("boxplot-box", true);
  7431. c.append("line").classed("element-shape", true).classed("boxplot-whisker", true).classed("boxplot-upperwhiskerbar", true);
  7432. c.append("line").classed("element-shape", true).classed("boxplot-whisker", true).classed("boxplot-upperwhiskerline", true);
  7433. c.append("line").classed("element-shape", true).classed("boxplot-whisker", true).classed("boxplot-lowerwhiskerline", true);
  7434. c.append("line").classed("element-shape", true).classed("boxplot-whisker", true).classed("boxplot-lowerwhiskerbar", true);
  7435. c.append("line").classed("element-shape", true).classed("boxplot-median", true);
  7436. c.append("path").classed("element-shape", true).classed("boxplot-mean", true);
  7437. self.updateOutliers(g, d);
  7438. self.setStyleProperties(g, d);
  7439. self.updateBoxplot(g, d, grow);
  7440. });
  7441. },
  7442. /**
  7443. * Update all the g.boxplot-element groups in a selection with their final geometry and styling. If an effect is required, creates a transition for the update.
  7444. * @param (rave['internal']['Selector']) groups The selection of g.boxplot-element groups
  7445. */
  7446. updateBoxplotGroups : function(groups) {
  7447. var self = this;
  7448. var grow = this._duration > 0 && "grow" == this._effect;
  7449. var doTransition = this._duration > 0 && !("none" == this._effect);
  7450. groups.each(function(data, index, groupIndex) {
  7451. var g = rave.select(this);
  7452. var d = data;
  7453. self.updateOutliers(g, d);
  7454. self.setStyleProperties(g, d);
  7455. if (grow) {
  7456. self.updateBoxplot(g, d, grow);
  7457. }
  7458. self.updateBoxplot(doTransition ? g.transition().duration(self._duration) : g, d, false);
  7459. });
  7460. },
  7461. /**
  7462. * Match the outlier shapes in a boxplot group to the data. Does a data join with enter/exit. Does not update shape geometry.
  7463. * @param (rave['internal']['Selector']) g Selector for the boxplot group
  7464. * @param (com.ibm.rave.bundles.data.BoxplotDatum) d Datum for the boxplot
  7465. */
  7466. updateOutliers : function(g, d) {
  7467. var self = this;
  7468. var outliers = g.selectAll("circle." + "boxplot-point").data(d._outliers, this.getKey());
  7469. outliers.enter().append("circle").classed("element-shape", true).classed("boxplot-point", true);
  7470. outliers.exit().remove();
  7471. var lowerExtreme = d.lowerExtreme();
  7472. var upperExtreme = d.upperExtremum();
  7473. g.selectAll("circle." + "boxplot-point").classed("boxplot-outlier-point", function(data, index, groupIndex) {
  7474. var yv = + (self._originalDataYAccessor(data));
  7475. return !(yv < lowerExtreme || yv > upperExtreme);
  7476. }).classed("boxplot-extreme-point", function(data, index, groupIndex) {
  7477. var yv = + (self._originalDataYAccessor(data));
  7478. return (yv < lowerExtreme || yv > upperExtreme);
  7479. });
  7480. },
  7481. /**
  7482. * Set the geometry and styling of the boxplot group and boxplot shapes in a small multiple. Sets the geometry of all outlier shapes. The shapes must already exist, and the style properties must be set.
  7483. * @param (rave['internal']['Selection']) g Selector for the g.boxplot-element
  7484. * @param (com.ibm.rave.bundles.data.BoxplotDatum) d Boxplot datum
  7485. * @param (boolean) grow If true, the geometry is set for the "grow" enter effect
  7486. * @param paletteColor Color to use for the boxplot shapes
  7487. */
  7488. updateBoxplot : function(g, d, grow) {
  7489. var self = this;
  7490. g.attr("transform", "translate(" + this._xScale.center(d._x) + ",0)");
  7491. var median = this._yScale.center(d._median);
  7492. var lowerFence = grow ? median : this._yScale.center(d.lowerFence());
  7493. var lowerHinge = grow ? median : this._yScale.center(d._lowerHinge);
  7494. var mean = grow ? median : this._yScale.center(d._mean);
  7495. var upperHinge = grow ? median : this._yScale.center(d._upperHinge);
  7496. var upperFence = grow ? median : this._yScale.center(d.upperFence());
  7497. var rectHalfWidth = this._boxplotSize / 2.0;
  7498. var whiskerHalfWidth = 0.8 * rectHalfWidth;
  7499. var medianHalfWidth = rectHalfWidth - 1;
  7500. var meanHalfWidth = Math.min(6.0, rectHalfWidth);
  7501. var outlierRadius = Math.min(4.0, rectHalfWidth);
  7502. var s;
  7503. s = g.select("rect." + "boxplot-box");
  7504. s.attr("x", -rectHalfWidth).attr("y", Math.min(lowerHinge, upperHinge)).attr("width", 2.0 * rectHalfWidth).attr("height", Math.abs(upperHinge - lowerHinge));
  7505. s = g.select("line." + "boxplot-upperwhiskerbar");
  7506. s.attr("x1", -whiskerHalfWidth).attr("x2", whiskerHalfWidth).attr("y1", upperFence).attr("y2", upperFence);
  7507. s = g.select("line." + "boxplot-upperwhiskerline");
  7508. s.attr("x1", 0).attr("x2", 0).attr("y1", upperHinge).attr("y2", upperFence);
  7509. s = g.select("line." + "boxplot-lowerwhiskerbar");
  7510. s.attr("x1", -whiskerHalfWidth).attr("x2", whiskerHalfWidth).attr("y1", lowerFence).attr("y2", lowerFence);
  7511. s = g.select("line." + "boxplot-lowerwhiskerline");
  7512. s.attr("x1", 0).attr("x2", 0).attr("y1", lowerHinge).attr("y2", lowerFence);
  7513. s = g.selectAll("line." + "boxplot-whisker");
  7514. s = g.select("line." + "boxplot-median");
  7515. s.attr("x1", -medianHalfWidth).attr("x2", medianHalfWidth).attr("y1", median).attr("y2", median);
  7516. s = g.select("path." + "boxplot-mean");
  7517. s.attr("d", "M" + (-meanHalfWidth) + "," + mean + "L" + meanHalfWidth + "," + mean + "M0," + (mean - meanHalfWidth) + "L0," + (mean + meanHalfWidth));
  7518. s = g.selectAll("circle." + "boxplot-point");
  7519. s.attr("cx", 0).attr("cy", 0).attr("r", outlierRadius);
  7520. if (grow) {
  7521. s.attr("transform", "translate(0," + median + ")");
  7522. } else {
  7523. s.attr("transform", function(data, index, groupIndex) {
  7524. return "translate(0," + + (self._yScale.center(self._originalDataYAccessor(data))) + ")";
  7525. });
  7526. }
  7527. this.applyShapeStyles(g.selectAll("." + "element-shape"));
  7528. },
  7529. /**
  7530. * Set the styling properties of the boxplot shapes in a small multiple. If the data changed, also clear the selection state properties.
  7531. * @param (rave['internal']['Selector']) g Selector for the g.boxplot-element
  7532. * @param (com.ibm.rave.bundles.data.BoxplotDatum) d Boxplot datum
  7533. */
  7534. setStyleProperties : function(g, d) {
  7535. if (this._dataChanged) {
  7536. g.selectAll("*").property("__rave_highlight", null).property("__rave_selection", null);
  7537. }
  7538. var color = "#4b8400";
  7539. if (this._colorPalette) {
  7540. if (this._originalDataColorAccessor) {
  7541. this._colorPalette.setAccessor(this._originalDataColorAccessor);
  7542. color = this._colorPalette.call(null, d._data[0], 0, 0);
  7543. } else {
  7544. color = this._colorPalette.call(null, null, 0, 0);
  7545. }
  7546. }
  7547. this.setShapeStyleProperties(g.select("rect." + "boxplot-box"), this._boxStyle, color, color);
  7548. this.setLineStyleProperties(g.selectAll("line." + "boxplot-whisker"), this._whiskerStyle, color);
  7549. this.setLineStyleProperties(g.select("line." + "boxplot-median"), this._medianStyle, null);
  7550. this.setLineStyleProperties(g.select("path." + "boxplot-mean"), this._meanStyle, null);
  7551. this.setShapeStyleProperties(g.selectAll("circle." + "boxplot-outlier-point"), this._outlierStyle, null, color);
  7552. this.setShapeStyleProperties(g.selectAll("circle." + "boxplot-extreme-point"), this._extremeStyle, color, color);
  7553. },
  7554. /**
  7555. * Set the original-style properties for a filled shape. Only called when not redrawing. <ul> <li>The fill property is the style's fill if non-null, otherwise the fill color.</li> <li>The stroke property is the style's stroke if non-null, otherwise the stroke color.</li> <li>The stroke width property is the style's stroke width.</li> <li>The opacity property is null.</li> </ul>
  7556. * @param (rave['internal']['Selector']) g Selector for the shapes
  7557. * @param (com.ibm.rave.bundles.components.StyleStructs.ShapeStyle) style Style to apply
  7558. * @param (Object) fill Used when the style fill is null (may be null)
  7559. * @param (Object) stroke Used when the style stroke is null (may be null)
  7560. */
  7561. setShapeStyleProperties : function(g, style, fill, stroke) {
  7562. g.property("__rave_originalstyle_fill", style._fill != null ? style._fill : fill).property("__rave_originalstyle_stroke", style._stroke != null ? style._stroke : stroke).property("__rave_originalstyle_strokewidth", style._strokeWidth).property("__rave_originalstyle_opacity", null);
  7563. },
  7564. /**
  7565. * Set the original-style properties for an unfilled shape. Only called when not redrawing. <ul> <li>The fill property is null.</li> <li>The stroke property is the style's stroke if non-null, otherwise the stroke color.</li> <li>The stroke width property is the style's stroke width.</li> <li>The opacity property is null.</li> </ul>
  7566. * @param (rave['internal']['Selector']) g Selector for the shapes
  7567. * @param (com.ibm.rave.bundles.components.StyleStructs.LineStyle) style Style to apply
  7568. * @param (Object) stroke Used when the style stroke is null (may be null)
  7569. */
  7570. setLineStyleProperties : function(g, style, stroke) {
  7571. g.property("__rave_originalstyle_fill", null).property("__rave_originalstyle_stroke", style._stroke != null ? style._stroke : stroke).property("__rave_originalstyle_strokewidth", style._strokeWidth).property("__rave_originalstyle_opacity", null);
  7572. },
  7573. /**
  7574. * For each node in the selection (there is normally only one), get the shape node. If the logical node does not have the HIGHLIGHT_PROPERTY, add the highlight property and update the node styling.
  7575. * @param (rave['internal']['Selector']) s Selection of nodes
  7576. */
  7577. /** @expose */
  7578. highlight : function(s) {
  7579. var self = this;
  7580. s.each(function(data, index, groupIndex) {
  7581. var shape = self.logicalShape(this);
  7582. if (shape && shape.rave_getProperty("__rave_highlight") == null) {
  7583. self.updateSelectionState(shape, "__rave_highlight", "1");
  7584. }
  7585. });
  7586. },
  7587. /**
  7588. * For each node in the selection (there is normally only one), if the node has the HIGHLIGHT_PROPERTY, remove the highlight property and update the node styling.
  7589. * @param (rave['internal']['Selector']) s Selection of nodes
  7590. */
  7591. /** @expose */
  7592. unhighlight : function(s) {
  7593. var self = this;
  7594. s.each(function(data, index, groupIndex) {
  7595. var shape = self.logicalShape(this);
  7596. if (shape && shape.rave_getProperty("__rave_highlight") != null) {
  7597. self.updateSelectionState(shape, "__rave_highlight", null);
  7598. }
  7599. });
  7600. },
  7601. /**
  7602. * For each node in the selection (there is normally only one), use the node to to find the logical shape (boxplot or outlier) of the chart. Toggle the selection state of that logical shape (if it has no state, make it selected). For each boxplot and outlier in the chart, if the target does not have the SELECTED_PROPERTY, set the property to UNSELECTED.
  7603. * @param (rave['internal']['Selector']) s Selector
  7604. */
  7605. /** @expose */
  7606. toggleSelect : function(s) {
  7607. var self = this;
  7608. s.each(function(data, index, groupIndex) {
  7609. var shape = self.logicalShape(this);
  7610. if (shape) {
  7611. self.updateSelectionState(shape, "__rave_selection", "1" == shape.rave_getProperty("__rave_selection") ? "0" : "1");
  7612. }
  7613. });
  7614. var all = this._context.node.selectAll("." + "boxplot-boxcontainer" + ", ." + "boxplot-point");
  7615. all.each(function(data, index, groupIndex) {
  7616. if (this.rave_getProperty("__rave_selection") == null) {
  7617. self.updateSelectionState(this, "__rave_selection", "0");
  7618. }
  7619. });
  7620. },
  7621. /**
  7622. * For each boxplot and outlier in the chart, if the node has the SELECTED_PROPERTY remove the property and update the shape style.
  7623. * @param (rave['internal']['Selector']) s Selection of nodes (ignored)
  7624. */
  7625. /** @expose */
  7626. deselectAll : function(s) {
  7627. var self = this;
  7628. var all = this._context.node.selectAll("." + "boxplot-boxcontainer" + ", ." + "boxplot-point");
  7629. all.each(function(data, index, groupIndex) {
  7630. if (this.rave_getProperty("__rave_selection") != null) {
  7631. self.updateSelectionState(this, "__rave_selection", null);
  7632. }
  7633. });
  7634. },
  7635. /**
  7636. * For a point (outlier or extremum), returns the same node. For a boxplot shape (box, whiskers, etc.), returns the parent BOXPLOT_BOXCONTAINER group node. Returns null for anything else.
  7637. * @param (rave['internal']['SceneNode']) node A scene node
  7638. * @return (rave['internal']['SceneNode']) The logical shape for that node
  7639. */
  7640. logicalShape : function(node) {
  7641. if (!node) {
  7642. return null;
  7643. }
  7644. if (node.rave_containsClass("boxplot-point")) {
  7645. return node;
  7646. }
  7647. var parent = node.rave_getParentNode();
  7648. if (parent && parent.rave_containsClass("boxplot-boxcontainer")) {
  7649. return parent;
  7650. }
  7651. return null;
  7652. },
  7653. /**
  7654. * Change a selection state property of a node, and update the node styles to match the new selection state. If the node is a BOXPLOT_BOXCONTAINER, all its child nodes (the boxplot shapes) are also processed.
  7655. * @param (rave['internal']['SceneNode']) node The node
  7656. * @param (String) property The property to set
  7657. * @param (String) value The property value
  7658. */
  7659. updateSelectionState : function(node, property, value) {
  7660. node.rave_setProperty(property, value);
  7661. if (node.rave_containsClass("boxplot-boxcontainer")) {
  7662. var self = this;
  7663. rave.select(node).selectAll("." + "element-shape").each(function(data, index, groupIndex) {
  7664. self.updateSelectionState(this, property, value);
  7665. });
  7666. } else {
  7667. this.applyShapeStyles(rave.select(node));
  7668. }
  7669. },
  7670. /**
  7671. * Style the shapes in a selection. Shape styling uses the node style properties and the selection and highlight states.
  7672. * @param (rave['internal']['Selection']) s Selection
  7673. */
  7674. applyShapeStyles : function(s) {
  7675. var self = this;
  7676. s.style("fill", function(data, index, groupIndex) {
  7677. return self.shapeFill(this);
  7678. }).style("stroke", function(data, index, groupIndex) {
  7679. return self.shapeStroke(this);
  7680. }).style("stroke-width", function(data, index, groupIndex) {
  7681. return self.shapeStrokeWidth(this);
  7682. }).style("opacity", function(data, index, groupIndex) {
  7683. return self.shapeOpacity(this);
  7684. });
  7685. },
  7686. /**
  7687. * @param (rave['internal']['SceneNode']) node A scene node with the selection and styling properties set
  7688. * @return (Object) The fill color to use when drawing that node
  7689. */
  7690. shapeFill : function(node) {
  7691. var fill = node.rave_getProperty("__rave_originalstyle_fill");
  7692. if (node.rave_getProperty("__rave_highlight") != null || "1" == node.rave_getProperty("__rave_selection")) {
  7693. if (node.rave_containsClass("boxplot-box") || node.rave_containsClass("boxplot-extreme-point")) {
  7694. return rave.rgb(fill).brighter(0.2).toString();
  7695. }
  7696. }
  7697. return fill;
  7698. },
  7699. /**
  7700. * @param (rave['internal']['SceneNode']) node A scene node with the selection and styling properties set
  7701. * @return (Object) The stroke color to use when drawing that node
  7702. */
  7703. shapeStroke : function(node) {
  7704. var stroke = node.rave_getProperty("__rave_originalstyle_stroke");
  7705. if (node.rave_getProperty("__rave_highlight") != null || "1" == node.rave_getProperty("__rave_selection")) {
  7706. if (node.rave_containsClass("boxplot-box") || node.rave_containsClass("boxplot-whisker") || node.rave_containsClass("boxplot-point")) {
  7707. return rave.rgb(stroke).darker(0.3).toString();
  7708. }
  7709. }
  7710. return stroke;
  7711. },
  7712. /**
  7713. * @param (rave['internal']['SceneNode']) node A scene node with the selection and styling properties set
  7714. * @return (Object) The stroke width to use when drawing that node
  7715. */
  7716. shapeStrokeWidth : function(node) {
  7717. if (node.rave_getProperty("__rave_highlight") != null || "1" == node.rave_getProperty("__rave_selection")) {
  7718. if (node.rave_containsClass("boxplot-box") || node.rave_containsClass("boxplot-whisker") || node.rave_containsClass("boxplot-point")) {
  7719. return "2px";
  7720. }
  7721. }
  7722. return node.rave_getProperty("__rave_originalstyle_strokewidth");
  7723. },
  7724. /**
  7725. * @param (rave['internal']['SceneNode']) node A scene node with the selection and styling properties set
  7726. * @return (Object) The opacity to use when drawing that node
  7727. */
  7728. shapeOpacity : function(node) {
  7729. if ("0" == node.rave_getProperty("__rave_selection")) {
  7730. return 0.3;
  7731. }
  7732. return node.rave_getProperty("__rave_originalstyle_opacity");
  7733. }
  7734. });
  7735. /**
  7736. * Maximum allowed radius of the outlier circles
  7737. */
  7738. /** @expose */
  7739. com_ibm_rave_bundles_components_BoxplotComponentImpl.BOXPLOT_OUTLIER_MAX_RADIUS = 4.0;
  7740. //com_ibm_rave_bundles_components_BoxplotComponentImpl.BOXPLOT_ELEMENT = "boxplot-element";
  7741. //com_ibm_rave_bundles_components_BoxplotComponentImpl.BOXPLOT_BOXCONTAINER = "boxplot-boxcontainer";
  7742. //com_ibm_rave_bundles_components_BoxplotComponentImpl.BOXPLOT_BOX = "boxplot-box";
  7743. //com_ibm_rave_bundles_components_BoxplotComponentImpl.BOXPLOT_WHISKER = "boxplot-whisker";
  7744. //com_ibm_rave_bundles_components_BoxplotComponentImpl.BOXPLOT_MEDIAN = "boxplot-median";
  7745. //com_ibm_rave_bundles_components_BoxplotComponentImpl.BOXPLOT_MEAN = "boxplot-mean";
  7746. //com_ibm_rave_bundles_components_BoxplotComponentImpl.BOXPLOT_POINT = "boxplot-point";
  7747. //com_ibm_rave_bundles_components_BoxplotComponentImpl.BOXPLOT_OUTLIER_POINT = "boxplot-outlier-point";
  7748. //com_ibm_rave_bundles_components_BoxplotComponentImpl.BOXPLOT_EXTREME_POINT = "boxplot-extreme-point";
  7749. //com_ibm_rave_bundles_components_BoxplotComponentImpl.BOXPLOT_WHISKER_UL = "boxplot-upperwhiskerline";
  7750. //com_ibm_rave_bundles_components_BoxplotComponentImpl.BOXPLOT_WHISKER_UB = "boxplot-upperwhiskerbar";
  7751. //com_ibm_rave_bundles_components_BoxplotComponentImpl.BOXPLOT_WHISKER_LL = "boxplot-lowerwhiskerline";
  7752. //com_ibm_rave_bundles_components_BoxplotComponentImpl.BOXPLOT_WHISKER_LB = "boxplot-lowerwhiskerbar";
  7753. //com_ibm_rave_bundles_components_BoxplotComponentImpl.ORIGINAL_FILL = "__rave_originalstyle_fill";
  7754. //com_ibm_rave_bundles_components_BoxplotComponentImpl.ORIGINAL_STROKE = "__rave_originalstyle_stroke";
  7755. //com_ibm_rave_bundles_components_BoxplotComponentImpl.ORIGINAL_STROKEWIDTH = "__rave_originalstyle_strokewidth";
  7756. //com_ibm_rave_bundles_components_BoxplotComponentImpl.ORIGINAL_DASHARRAY = "__rave_originalstyle_strokedasharray";
  7757. //com_ibm_rave_bundles_components_BoxplotComponentImpl.ORIGINAL_OPACITY = "__rave_originalstyle_opacity";
  7758. //com_ibm_rave_bundles_components_BoxplotComponentImpl.HIGHLIGHT_PROPERTY = "__rave_highlight";
  7759. //com_ibm_rave_bundles_components_BoxplotComponentImpl.SELECTION_PROPERTY = "__rave_selection";
  7760. //com_ibm_rave_bundles_components_BoxplotComponentImpl.SELECTION_SELECTED = "1";
  7761. //com_ibm_rave_bundles_components_BoxplotComponentImpl.SELECTION_UNSELECTED = "0";
  7762. // $source: com/ibm/rave/bundles/data/BoxplotDataUtilities
  7763. /************************************************************************
  7764. ** IBM Confidential
  7765. **
  7766. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7767. **
  7768. ** (C) Copyright IBM Corp. 2017
  7769. **
  7770. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7771. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7772. ************************************************************************/
  7773. // GENERATED
  7774. //@import com/ibm/rave/bundles/data/BoxplotDatum (static) // new
  7775. //@import com/ibm/rave/bundles/data/PointDataUtilities (runtime) // new
  7776. /**
  7777. * Converts boxplot data model into array of BoxplotDatum.
  7778. */
  7779. var com_ibm_rave_bundles_data_BoxplotDataUtilities = rave['internal']['Declare']({
  7780. });
  7781. /**
  7782. * <p> Convert boxplot data model into array of BoxplotDatum. The x, y, and optional c accessors are applied to the data objects to get the X, Y, and color values. </p> <p> Points are grouped by a key. When the c accessor is null, the key is the X value value. When the c accessor is non-null, the key is the pair of (X,color). Points for which the key or the Y value are null, or for which the data scale returns null when applied to the key, are ignored. </p> <p> The boxplot datum X is the X value when isClustered is false, or the key when it is true. </p>
  7783. * @param (Array) data Non-null, possibly-empty list of data objects
  7784. * @param (rave['library']['internal']['CoordinateScaleImpl']) dataScale Scale used to test if the values are in the domain
  7785. * @param (boolean) isClustered Whether the data is clustered
  7786. * @param (rave['internal']['SingleValueFunction']) x Non-null accessor returning the "x" value
  7787. * @param (rave['internal']['SingleValueFunction']) y Non-null accessor returning the "y" value
  7788. * @param (rave['internal']['SingleValueFunction']) c Possibly-null accessor returning the "color" value
  7789. * @return (Array) List of BoxplotDatum
  7790. */
  7791. /** @expose */
  7792. com_ibm_rave_bundles_data_BoxplotDataUtilities.makeData = function(data, dataScale, isClustered, x, y, c) {
  7793. var result = [];
  7794. if (!dataScale) {
  7795. return result;
  7796. }
  7797. var clustered = isClustered && c;
  7798. var keyFunc = (!c) ? x : function(d) {
  7799. var xv = x(d);
  7800. var cv = c(d);
  7801. return (xv != null && cv != null) ? [xv, cv] : null;
  7802. };
  7803. var dataMap = {};
  7804. var xMap = {};
  7805. for (var __i_enFor0 = 0, __exp_enFor0 = data, __len_enFor0 = __exp_enFor0.length;
  7806. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  7807. var d = __exp_enFor0[__i_enFor0];
  7808. var key = keyFunc(d);
  7809. var yv = y(d);
  7810. if (key != null && yv != null) {
  7811. var xc = dataScale.center(key);
  7812. if (xc != null) {
  7813. var v = dataMap[xc];
  7814. if (!v) {
  7815. v = [];
  7816. dataMap[xc] = v;
  7817. xMap[xc] = clustered ? key : x(d);
  7818. }
  7819. v.push(d);
  7820. }
  7821. }
  7822. }
  7823. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(dataMap), __len_enFor1 = __exp_enFor1.length;
  7824. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  7825. var xv = __exp_enFor1[__i_enFor1];
  7826. result.push(com_ibm_rave_bundles_data_BoxplotDataUtilities.create(xMap[xv], xv, dataMap[xv], y));
  7827. }
  7828. return result;
  7829. };
  7830. /**
  7831. * Create a boxplot datum from a list of original integrator data. The data does not have to be sorted by the y-values. The list and accessor must be non-null, and the accessor must return a non-null Number for every object in the list.
  7832. * @param (Object) xValue The x-value
  7833. * @param (Array) data The list of data
  7834. * @param (rave['internal']['SingleValueFunction']) y Accessor that returns the "y" value when applied to a data object
  7835. * @return (com.ibm.rave.bundles.data.BoxplotDatum) Boxplot datum
  7836. */
  7837. com_ibm_rave_bundles_data_BoxplotDataUtilities.create = function(xValue, keyValue, data, y) {
  7838. var len = data.length;
  7839. if (len == 1) {
  7840. var m = + (y(data[0]));
  7841. return new com_ibm_rave_bundles_data_BoxplotDatum(xValue, keyValue, m, m, m, m, m, m, [], data);
  7842. }
  7843. var sorted = [];
  7844. var mean = 0.0;
  7845. for (var i = 0; i < len; ++i) {
  7846. var v = (y(data[i]));
  7847. sorted.push(v);
  7848. mean += v;
  7849. }
  7850. mean /= len;
  7851. sorted.sort(function(obj1, obj2) {
  7852. var v = obj1 - obj2;
  7853. return (v < 0) ? -1 : (v > 0) ? 1 : 0;
  7854. });
  7855. var values = [];
  7856. for (var i = 0; i < len; ++i) {
  7857. values[i] = sorted[i];
  7858. }
  7859. var median = com_ibm_rave_bundles_data_BoxplotDataUtilities.quantile(values, 0.5);
  7860. var upperHinge = com_ibm_rave_bundles_data_BoxplotDataUtilities.quantile(values, 0.75);
  7861. var lowerHinge = com_ibm_rave_bundles_data_BoxplotDataUtilities.quantile(values, 0.25);
  7862. var del = 1.5 * (upperHinge - lowerHinge);
  7863. var lowerFence = lowerHinge - del;
  7864. var upperFence = upperHinge + del;
  7865. var outliers = [];
  7866. for (var i = 0; i < len; ++i) {
  7867. var datum = data[i];
  7868. var yv = y(datum);
  7869. var v = + (yv);
  7870. if (v < lowerFence || v > upperFence) {
  7871. var d = new com_ibm_rave_bundles_data_PointDataUtilities.PointDatum();
  7872. d._x = xValue;
  7873. d._y = yv;
  7874. d._originalData = datum;
  7875. outliers.push(d);
  7876. }
  7877. }
  7878. return new com_ibm_rave_bundles_data_BoxplotDatum(xValue, keyValue, mean, values[0], lowerHinge, median, upperHinge, values[len - 1], outliers, data);
  7879. };
  7880. /**
  7881. * From the Rave.Quantile, but using double[] and without the gets and ObjectConverter
  7882. * @param (double[]) values Sorted array of values
  7883. * @param (double) q Quantile value between 0.0 and 1.0
  7884. * @return (double) Value of the
  7885. */
  7886. com_ibm_rave_bundles_data_BoxplotDataUtilities.quantile = function(values, q) {
  7887. var f = (values.length - 1) * q + 1;
  7888. var i = Math.floor(f);
  7889. var v = values[i - 1];
  7890. var r = f - i;
  7891. return (r != 0) ? v + r * (values[i] - v) : v;
  7892. };
  7893. })();
  7894. },{"./configuration/configuration.json":1,"./i18n/messages_en.json":2,"./vizlibrary-boxplot.css":4,"./vizlibrary.css":5}],4:[function(require,module,exports){
  7895. var css = ".vizlibrary-boxplot .bundle-shape {\n fill: #ccc;\n fill-opacity: 1.0;\n}\n.vizlibrary-boxplot .boxplot-box {\n fill: #4b8400;\n}\n.vizlibrary-boxplot .boxplot-whisker {\n stroke: #4b8400;\n stroke-width: 1px;\n}\n.vizlibrary-boxplot .boxplot-mean {\n stroke: white;\n stroke-width: 1.5px;\n pointer-events: none;\n}\n.vizlibrary-boxplot .boxplot-median {\n stroke: white;\n stroke-width: 1.5px;\n pointer-events: none;\n}\n.vizlibrary-boxplot .boxplot-outlier-point {\n fill: white;\n stroke: #4b8400;\n stroke-width: 1px;\n}\n.vizlibrary-boxplot .boxplot-extreme-point {\n fill: #4b8400;\n stroke: #4b8400;\n stroke-width: 1px;\n}\n"; (require("browserify-css").createStyle(css, { "href": "dist/bundles/rave-library-boxplot/node/rave-library-boxplot/vizlibrary-boxplot.css"})); module.exports = css;
  7896. },{"browserify-css":6}],5:[function(require,module,exports){
  7897. 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-boxplot/node/rave-library-boxplot/vizlibrary.css"})); module.exports = css;
  7898. },{"browserify-css":6}],6:[function(require,module,exports){
  7899. 'use strict';
  7900. // For more information about browser field, check out the browser field at https://github.com/substack/browserify-handbook#browser-field.
  7901. module.exports = {
  7902. // Create a <link> tag with optional data attributes
  7903. createLink: function(href, attributes) {
  7904. var head = document.head || document.getElementsByTagName('head')[0];
  7905. var link = document.createElement('link');
  7906. link.href = href;
  7907. link.rel = 'stylesheet';
  7908. for (var key in attributes) {
  7909. if ( ! attributes.hasOwnProperty(key)) {
  7910. continue;
  7911. }
  7912. var value = attributes[key];
  7913. link.setAttribute('data-' + key, value);
  7914. }
  7915. head.appendChild(link);
  7916. },
  7917. // Create a <style> tag with optional data attributes
  7918. createStyle: function(cssText, attributes) {
  7919. var head = document.head || document.getElementsByTagName('head')[0],
  7920. style = document.createElement('style');
  7921. style.type = 'text/css';
  7922. for (var key in attributes) {
  7923. if ( ! attributes.hasOwnProperty(key)) {
  7924. continue;
  7925. }
  7926. var value = attributes[key];
  7927. style.setAttribute('data-' + key, value);
  7928. }
  7929. if (style.sheet) { // for jsdom and IE9+
  7930. style.innerHTML = cssText;
  7931. style.sheet.cssText = cssText;
  7932. head.appendChild(style);
  7933. } else if (style.styleSheet) { // for IE8 and below
  7934. head.appendChild(style);
  7935. style.styleSheet.cssText = cssText;
  7936. } else { // for Chrome, Firefox, and Safari
  7937. style.appendChild(document.createTextNode(cssText));
  7938. head.appendChild(style);
  7939. }
  7940. }
  7941. };
  7942. },{}]},{},[3]);
  7943. return rave.library.bundle.extension('boxplotBundle');
  7944. }));