rave-library-line.js 404 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688
  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.raveLibraryLine = 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_line_small.png","tags":["small","notext"]}],"svg":[{"file":"resources\/preview_line_small.svg","tags":["small","notext"]}]},"genericMeta":{"copyright":"IBM 2015, 2016","author":"IBM","description":"line.description","id":"rave-library-line","label":"line.label","version":"1.0.0","tags":["line"]}},{"datamodels":[{"description":"datamodel.tabular.line.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.line.description","id":"x","label":"dataslot.x.label","cardinality":"1","datatypes":["numeric","string","date"],"tags":["ca.dashboard.defaultSort=ascending"]},{"icon":{"image":"..\/rave-library\/resources\/color_by_32.png","svg":"..\/rave-library\/resources\/color_by_32.svg"},"description":"dataslot.color.line.description","id":"color","label":"dataslot.color.label","cardinality":"0..1","datatypes":["string"],"tags":["ca.dashboard.repeatHere=true"]},{"icon":{"image":"..\/rave-library\/resources\/numeric_value_32.png","svg":"..\/rave-library\/resources\/numeric_value_32.svg"},"description":"dataslot.y.line.description","id":"y","label":"dataslot.value.label","cardinality":"1","datatypes":["numeric"],"tags":["ca.dashboard.multiple=true"]},{"icon":{"image":"..\/rave-library\/resources\/label_32.png","svg":"..\/rave-library\/resources\/label_32.svg"},"description":"dataslot.label.line.description","id":"label","label":"dataslot.label.label","cardinality":"0..1","datatypes":["string"]},{"icon":{"image":"..\/rave-library\/resources\/primary_key_32.png","svg":"..\/rave-library\/resources\/primary_key_32.svg"},"description":"dataslot.key.description","id":"key","label":"dataslot.key.label","cardinality":"0..1","datatypes":["numeric","string","date"]}],"description":"dataset.tabular.description","id":"data","label":"dataset.tabular.label","type":"tabular","cardinality":"1"}],"tags":["line","simple","basic"]}]},{"properties":{"sortX":{"trueLabel":"line.trueValue.sortX","default":true,"falseLabel":"line.falseValue.sortX","resetView":"data","name":"sortX.name","description":"sortX.description","type":"boolean"},"label.shadow":{"default":false,"resetView":"layout","name":"label.shadow.name","description":"label.shadow.description","type":"boolean"},"color":{"type":"object","properties":{"palette":{"name":"color.palette.name","options":["categorical"],"description":"color.palette.description","type":"palette"}}},"labelstyle":{"type":"object","properties":{"font":{"default":null,"name":"labelstyle.font.name","description":"labelstyle.font.description","type":"string"}}},"effect":{"type":"object","properties":{"duration":{"default":1000,"min":0,"name":"effect.duration.name","description":"effect.duration.description","type":"numeric"},"name":{"default":"fromBase","name":"effect.name.name","options":[{"id":"effect.name.options.fromBase","value":"fromBase"},{"id":"effect.name.options.transition","value":"transition"},{"id":"effect.name.options.none","value":"none"}],"description":"effect.name.description","type":"string"}}},"contrast":{"type":"object","properties":{"label":{"type":"object","properties":{"color":{"default":false,"resetView":"layout","name":"contrast.label.color.name","description":"contrast.label.color.description","type":"boolean"}}}}},"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"},"lineWithPoints":{"type":"object","properties":{"symbol":{"default":"circle","resetView":"layout","name":"lineWithPoints.symbol.name","options":[{"id":"lineWithPoints.symbol.options.circle","value":"circle"},{"id":"lineWithPoints.symbol.options.cross","value":"cross"},{"id":"lineWithPoints.symbol.options.diamond","value":"diamond"},{"id":"lineWithPoints.symbol.options.square","value":"square"},{"id":"lineWithPoints.symbol.options.triangle-down","value":"triangle-down"},{"id":"lineWithPoints.symbol.options.triangle-up","value":"triangle-up"},{"id":"lineWithPoints.symbol.options.horizontal-rectangle","value":"horizontal-rectangle"},{"id":"lineWithPoints.symbol.options.vertical-rectangle","value":"vertical-rectangle"},{"id":"lineWithPoints.symbol.options.triangle-left","value":"triangle-left"},{"id":"lineWithPoints.symbol.options.triangle-right","value":"triangle-right"},{"id":"lineWithPoints.symbol.options.star","value":"star"},{"id":"lineWithPoints.symbol.options.donut","value":"donut"},{"id":"lineWithPoints.symbol.options.donut-plus","value":"donutPlus"}],"description":"lineWithPoints.symbol.description","type":"string"},"showMissingAsGap":{"default":"true","name":"lineWithPoints.showMissingAsGap.name","description":"lineWithPoints.showMissingAsGap.description","type":"boolean"},"size":{"default":"40","resetView":"layout","name":"lineWithPoints.size.name","description":"lineWithPoints.size.description","type":"string"},"display":{"default":"line_points","name":"lineWithPoints.display.name","options":[{"id":"lineWithPoints.display.options.linePoints","value":"line_points"},{"id":"lineWithPoints.display.options.line","value":"line"},{"id":"lineWithPoints.display.options.points","value":"points"}],"description":"lineWithPoints.display.description","type":"string"},"interpolate":{"default":"linear","name":"lineWithPoints.interpolate.name","options":[{"id":"lineWithPoints.interpolate.options.linear","value":"linear"},{"id":"lineWithPoints.interpolate.options.step","value":"step"},{"id":"lineWithPoints.interpolate.options.step-before","value":"step-before"},{"id":"lineWithPoints.interpolate.options.step-after","value":"step-after"},{"id":"lineWithPoints.interpolate.options.basis","value":"basis"},{"id":"lineWithPoints.interpolate.options.basis-open","value":"basis-open"},{"id":"lineWithPoints.interpolate.options.cardinal","value":"cardinal"},{"id":"lineWithPoints.interpolate.options.cardinal-open","value":"cardinal-open"},{"id":"lineWithPoints.interpolate.options.monotone","value":"monotone"}],"description":"lineWithPoints.interpolate.description","type":"string"}}},"itemLabel":{"trueLabel":"line.trueLabel.itemLabel","default":true,"falseLabel":"line.falseLabel.itemLabel","name":"item.label.name","description":"item.label.description","type":"boolean"}}},{"properties":{"axis":{"type":"object","properties":{"labels":{"type":"object","properties":{"truncationText":{"default":"...","name":"axis.labels.truncationText.name","description":"axis.labels.truncationText.description","type":"string"}}}}}}},{"configurations":[{"dataSlots":[{"dataTypes":["numeric"],"dataModelId":"tabular","dataSetId":"data","hidden":false,"dataSlotId":"y","tags":["ca.chart.definition.supportsRange=true"]},{"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"]},{"dataModelId":"tabular","dataSetId":"data","hidden":true,"dataSlotId":"label"},{"dataModelId":"tabular","dataSetId":"data","hidden":true,"dataSlotId":"key"}],"previews":{"image":[{"file":"resources\/line_icon_48.png","tags":["small","nocolor"]},{"file":"resources\/line_preview_320.png","tags":["medium","color"]},{"file":"resources\/line_preview_500.png","tags":["large","nocolor"]}],"svg":[{"file":"resources\/line_icon_48.svg","tags":["small","nocolor"]},{"file":"resources\/line_preview_320.svg","tags":["medium","color"]},{"file":"resources\/line_preview_500.svg","tags":["large","nocolor"]}]},"genericMeta":{"description":"line.config.line.description","id":"line","label":"line.config.line.label","tags":["ca.reporting"]},"properties":[{"id":"effect.duration","value":500},{"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":"30%"},{"id":"layout.axissize.left.max","value":"200"}]},{"dataSlots":[{"dataTypes":["numeric"],"dataModelId":"tabular","dataSetId":"data","hidden":false,"dataSlotId":"y","tags":["ca.chart.definition.supportsRange=true"]},{"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"]},{"dataModelId":"tabular","dataSetId":"data","hidden":true,"dataSlotId":"label"},{"dataModelId":"tabular","dataSetId":"data","hidden":true,"dataSlotId":"key"}],"previews":{"image":[{"file":"resources\/stepped_line_icon_48.png","tags":["small","nocolor"]},{"file":"resources\/stepped_line_preview_320.png","tags":["medium","color"]},{"file":"resources\/stepped_line_preview_500.png","tags":["large","nocolor"]}],"svg":[{"file":"resources\/stepped_line_icon_48.svg","tags":["small","nocolor"]},{"file":"resources\/stepped_line_preview_320.svg","tags":["medium","color"]},{"file":"resources\/stepped_line_preview_500.svg","tags":["large","nocolor"]}]},"genericMeta":{"description":"line.config.stepline.description","id":"stepline","label":"line.config.stepline.label","tags":["ca.reporting"]},"properties":[{"id":"effect.duration","value":500},{"id":"lineWithPoints.interpolate","value":"step"},{"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":"30%"},{"id":"layout.axissize.left.max","value":"200"}]},{"dataSlots":[{"dataTypes":["numeric"],"dataModelId":"tabular","dataSetId":"data","hidden":false,"dataSlotId":"y","tags":["ca.chart.definition.supportsRange=true"]},{"dataTypes":["string"],"dataModelId":"tabular","dataSetId":"data","dataSlotId":"x","tags":["ca.chart.definition.categoryValues=indexedFull"]},{"dataModelId":"tabular","dataSetId":"data","dataSlotId":"color","tags":["ca.chart.definition.categoryValues=indexedFull"]},{"dataModelId":"tabular","dataSetId":"data","hidden":true,"dataSlotId":"label"},{"dataModelId":"tabular","dataSetId":"data","hidden":true,"dataSlotId":"key"}],"previews":{"image":[{"file":"resources\/smooth_line_icon_48.png","tags":["small","nocolor"]},{"file":"resources\/smooth_line_preview_320.png","tags":["medium","color"]},{"file":"resources\/smooth_line_preview_500.png","tags":["large","nocolor"]}],"svg":[{"file":"resources\/smooth_line_icon_48.svg","tags":["small","nocolor"]},{"file":"resources\/smooth_line_preview_320.svg","tags":["medium","color"]},{"file":"resources\/smooth_line_preview_500.svg","tags":["large","nocolor"]}]},"genericMeta":{"description":"line.config.smoothline.description","id":"smoothline","label":"line.config.smoothline.label","tags":["ca.reporting","ca.dashboard"]},"properties":[{"id":"effect.duration","value":500},{"id":"lineWithPoints.interpolate","value":"cardinal"},{"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":"30%"},{"id":"layout.axissize.left.max","value":"200"}]}]},{"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":{"data":{"type":"object","properties":{"label":{"type":"object","properties":{"display":{"default":false,"resetView":"layout","name":"data.label.display.name","description":"data.label.display.description","type":"boolean"},"type":{"default":"Value","resetView":"layout","name":"data.label.type.name","options":[{"id":"data.label.type.options.value","value":"Value"},{"id":"data.label.type.options.percentByCategory","value":"PercentOfCategory"},{"id":"data.label.type.options.percentByColor","value":"PercentOfColor"}],"description":"data.label.type.description","type":"string"}}}}}}},{"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":{"transpose":{"trueLabel":"transpose.trueLabel","default":false,"falseLabel":"transpose.falseLabel","resetView":"layout","name":"transpose.name","description":"transpose.description","type":"boolean"}}},{"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":{"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":{"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":{"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":{"labels":{"type":"object","properties":{"layoutMode":{"default":"horizontal","resetView":"layout","name":"axis.y.labels.layoutMode.name","options":[{"id":"axis.y.labels.layoutMode.options.horizontal","value":"horizontal"},{"id":"axis.y.labels.layoutMode.options.rotate90","value":"rotate90"}],"description":"axis.y.labels.layoutMode.description","type":"string"}}}}}}}}},{"properties":{"axis":{"type":"object","properties":{"y":{"type":"object","properties":{"gridlines":{"type":"object","properties":{"display":{"trueLabel":"axis.y.gridlines.display.trueLabel","default":true,"falseLabel":"axis.y.gridlines.display.falseLabel","name":"axis.y.gridlines.display.name","description":"axis.y.gridlines.display.description","type":"boolean"},"style":{"type":"object","properties":{"stroke-dasharray":{"default":null,"name":"axis.y.gridlines.style.stroke-dasharray.name","description":"axis.y.gridlines.style.stroke-dasharray.description","type":"dasharray"},"stroke":{"default":"#dfe9e9","name":"axis.y.gridlines.style.stroke.name","description":"axis.y.gridlines.style.stroke.description","type":"color"}}}}}}}}}}},{"properties":{"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":{"y":{"type":"object","properties":{"scale":{"type":"object","properties":{"nice":{"trueLabel":"axis.y.scale.nice.trueLabel","default":true,"falseLabel":"axis.y.scale.nice.falseLabel","resetView":"layout","name":"axis.y.scale.nice.name","description":"axis.y.scale.nice.description","type":"boolean"}}}}}}}}},{"actions":[{"args":[{"icon":null,"description":"actions.args.selector.description","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.applyHighlight.description","binding":[{"event":"mouseover","target":".element-shape"}],"id":"highlight","label":"actions.applyHighlight.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.selector.description","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.removeHighlight.description","binding":[{"event":"mouseout","target":".element-shape"}],"id":"unhighlight","label":"actions.removeHighlight.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.selector.label","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.applySelection.description","binding":[{"event":"mouseover","target":".element-shape"}],"id":"select","label":"actions.applySelection.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.selector.description","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.removeSelection.description","binding":[{"event":"mouseout","target":".element-shape"}],"id":"deselect","label":"actions.removeSelection.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.selector.description","id":"selector","label":"actions.args.selector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.attributes.description","id":"attrs","label":"actions.args.attributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.removeAllSelect.description","binding":[{"event":"click","target":".background"}],"id":"deselectAll","label":"actions.removeAllSelect.label","tags":[]},{"args":[{"icon":null,"description":"actions.args.primarySelector.description","id":"PrimarySelector","label":"actions.args.primarySelector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.secondarySelector.description","id":"secondarySelector","label":"actions.args.secondarySelector.label","type":"selector","tags":[]},{"icon":null,"description":"actions.args.primaryAttributes.description","id":"PrimaryStyles","label":"actions.args.primaryAttributes.label","type":"attributeMap","tags":[]},{"icon":null,"description":"actions.args.secondaryAttributes.description","id":"SecondarySyles","label":"actions.args.secondaryAttributes.label","type":"attributeMap","tags":[]}],"icon":null,"options":[],"description":"actions.toggleSelect.description","binding":[{"event":"click","target":".element-shape"}],"id":"toggleSelect","label":"actions.toggleSelect.label","tags":[]},{"icon":null,"options":[],"description":"actions.zoom.description","binding":[],"id":"zoom","label":"actions.zoom.label","tags":[]}]},{"propertyPresentations":[{"presentationItems":[{"propertyID":"color.palette"},{"propertyID":"axis.x.title.display"},{"propertyID":"axis.y.title.display"},{"propertyID":"legend.display"},{"propertyID":"legend.position"},{"propertyID":"lineWithPoints.interpolate"},{"propertyID":"lineWithPoints.symbol"}],"icon":"","description":"propertyPresentation.simple.description","id":"simple","label":"propertyPresentation.simple.label","tags":["Line","Line Properties Presentation","Simple","ca.dashboard"]},{"presentationItems":[{"propertyGroup":{"presentationItems":[{"propertyID":"background.chart.color"},{"propertyID":"background.elements.color"},{"propertyID":"color.palette"},{"propertyID":"layout.padding"}],"icon":"","description":"propertyPresentation.advanced.commonProperties.description","id":"commonProperties","label":"propertyPresentation.advanced.commonProperties.label","tags":[]}},{"propertyGroup":{"presentationItems":[{"propertyID":"lineWithPoints.display"},{"propertyID":"lineWithPoints.size"},{"propertyID":"lineWithPoints.symbol"},{"propertyID":"lineWithPoints.showMissingAsGap"},{"propertyID":"sortX"},{"propertyID":"transpose"}],"icon":"","description":"line.propertyPresentation.advanced.lineSpecificProperties.description","id":"lineSpecificProperties","label":"line.propertyPresentation.advanced.lineSpecificProperties.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":["Line","Line Properties Presentation","advanced","ca.reporting"]}]},{"build":"development","name":"rave-library-line","description":"This is the IBM Rave line 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. "automatic.label.color.description": "Adjust the label color to contrast with background.",
  63. "automatic.label.color.name": "Automatically adjust data label font color",
  64. "axis.labels.truncationText.description": "The text that is placed at the end of labels to indicate truncation.",
  65. "axis.labels.truncationText.name": "Axis truncation text",
  66. "axis.x.gridlines.display.description": "Shows or hides the X-axis gridlines.",
  67. "axis.x.gridlines.display.falseLabel": "Hide",
  68. "axis.x.gridlines.display.name": "Show gridlines",
  69. "axis.x.gridlines.display.trueLabel": "Show",
  70. "axis.x.gridlines.style.stroke-dasharray.description": "The dash pattern that is applied to the X-axis gridlines.",
  71. "axis.x.gridlines.style.stroke-dasharray.name": "Gridline dash pattern",
  72. "axis.x.gridlines.style.stroke.description": "The color of the X-axis gridline.",
  73. "axis.x.gridlines.style.stroke.name": "Gridline color",
  74. "axis.x.labels.allowRotate45.description": "Enables or disables the rotate45 option for labels automatic layout.",
  75. "axis.x.labels.allowRotate45.falseLabel": "Disable rotate45 option",
  76. "axis.x.labels.allowRotate45.name": "Allow rotate 45",
  77. "axis.x.labels.allowRotate45.trueLabel": "Enable rotate45 option",
  78. "axis.x.labels.allowRotate90.description": "Enables or disables the rotate90 option for labels automatic layout.",
  79. "axis.x.labels.allowRotate90.falseLabel": "Disable rotate90 option",
  80. "axis.x.labels.allowRotate90.name": "Allow rotate 90",
  81. "axis.x.labels.allowRotate90.trueLabel": "Enable rotate90 option",
  82. "axis.x.labels.allowStagger.description": "Allows the stagger option for labels automatic layout.",
  83. "axis.x.labels.allowStagger.falseLabel": "X-axis do not allow stagger",
  84. "axis.x.labels.allowStagger.name": "Allow stagger",
  85. "axis.x.labels.allowStagger.trueLabel": "X-axis allow stagger",
  86. "axis.x.labels.display.description": "Shows or hides the X-axis labels.",
  87. "axis.x.labels.display.falseLabel": "Hide",
  88. "axis.x.labels.display.name": "Show labels",
  89. "axis.x.labels.display.trueLabel": "Show",
  90. "axis.x.labels.layoutMode.description": "Configure the layout mode for the X-axis labels.",
  91. "axis.x.labels.layoutMode.name": "Layout Mode",
  92. "axis.x.labels.layoutMode.options.automatic": "Automatic",
  93. "axis.x.labels.layoutMode.options.horizontal": "Horizontal",
  94. "axis.x.labels.layoutMode.options.rotate45": "Rotated 45 degrees",
  95. "axis.x.labels.layoutMode.options.rotate90": "Rotated 90 degrees",
  96. "axis.x.labels.layoutMode.options.stagger": "Stagger",
  97. "axis.x.labels.style.fill.description": "The color of X-axis labels.",
  98. "axis.x.labels.style.fill.name": "Label color",
  99. "axis.x.labels.style.font-family.description": "The font families of the X-axis labels.",
  100. "axis.x.labels.style.font-family.name": "Label font families",
  101. "axis.x.labels.style.font-size.description": "The size of X-axis labels (CSS size).",
  102. "axis.x.labels.style.font-size.name": "Label font size",
  103. "axis.x.labels.style.font.description": "The font properties of X-axis labels (CSS styles).",
  104. "axis.x.labels.style.font.name": "Label font",
  105. "axis.x.labels.zoomPan.description": "Shows or hides X-axis labels when panning and zooming.",
  106. "axis.x.labels.zoomPan.falseLabel": "Show",
  107. "axis.x.labels.zoomPan.name": "Label pan-zoom",
  108. "axis.x.labels.zoomPan.trueLabel": "Hide",
  109. "axis.x.line.display.description": "Shows or hides the X-axis line.",
  110. "axis.x.line.display.falseLabel": "Hide",
  111. "axis.x.line.display.name": "Show line",
  112. "axis.x.line.display.trueLabel": "Show",
  113. "axis.x.line.style.stroke.description": "The color of the X-axis line.",
  114. "axis.x.line.style.stroke.name": "Line color",
  115. "axis.x.scale.includeZero.description": "When set to Yes, includes 0 on the X-axis.",
  116. "axis.x.scale.includeZero.falseLabel": "Do not include",
  117. "axis.x.scale.includeZero.name": "Includes zero",
  118. "axis.x.scale.includeZero.trueLabel": "Include",
  119. "axis.x.scale.max.description": "The maximum value that appears on the X-axis.",
  120. "axis.x.scale.max.name": "Maximum value",
  121. "axis.x.scale.min.description": "The minimum value that appears on the X-axis.",
  122. "axis.x.scale.min.name": "Minimum value",
  123. "axis.x.scale.nice.description": "When set to Yes, uses nice endpoint values on the X-axis.",
  124. "axis.x.scale.nice.falseLabel": "Do not nice",
  125. "axis.x.scale.nice.name": "Nicing",
  126. "axis.x.scale.nice.trueLabel": "Apply nicing",
  127. "axis.x.ticks.display.description": "Shows or hides the X-axis tick marks.",
  128. "axis.x.ticks.display.falseLabel": "Hide",
  129. "axis.x.ticks.display.name": "Show ticks",
  130. "axis.x.ticks.display.trueLabel": "Show",
  131. "axis.x.ticks.style.stroke.description": "The color of the X-axis ticks.",
  132. "axis.x.ticks.style.stroke.name": "Tick color",
  133. "axis.x.title.display.description": "Shows or hides the X-axis title.",
  134. "axis.x.title.display.falseLabel": "Hide",
  135. "axis.x.title.display.name": "Show title",
  136. "axis.x.title.display.trueLabel": "Show",
  137. "axis.x.title.style.fill.description": "The color of the X-axis title.",
  138. "axis.x.title.style.fill.name": "Title color",
  139. "axis.x.title.style.font-family.description": "The font family names of the X-axis title.",
  140. "axis.x.title.style.font-family.name": "Title font families",
  141. "axis.x.title.style.font-size.description": "The X-axis title font size (CSS size).",
  142. "axis.x.title.style.font-size.name": "Title font size",
  143. "axis.x.title.style.font.description": "The X-axis title font properties (CSS style).",
  144. "axis.x.title.style.font.name": "Title font",
  145. "axis.x.title.text.description": "The title of the X-axis.",
  146. "axis.x.title.text.name": "Title",
  147. "axis.y.gridlines.display.description": "Shows or hides the Y-axis gridlines.",
  148. "axis.y.gridlines.display.falseLabel": "Hide",
  149. "axis.y.gridlines.display.name": "Show gridlines",
  150. "axis.y.gridlines.display.trueLabel": "Show",
  151. "axis.y.gridlines.style.stroke-dasharray.description": "The dash pattern that is applied to the Y-axis gridlines.",
  152. "axis.y.gridlines.style.stroke-dasharray.name": "Gridline dash pattern",
  153. "axis.y.gridlines.style.stroke.description": "The color of the Y-axis gridline.",
  154. "axis.y.gridlines.style.stroke.name": "Gridline color",
  155. "axis.y.labels.display.description": "Shows or hides the Y-axis labels.",
  156. "axis.y.labels.display.falseLabel": "Hide",
  157. "axis.y.labels.display.name": "Show labels",
  158. "axis.y.labels.display.trueLabel": "Show",
  159. "axis.y.labels.layoutMode.description": "Configure the layout mode for the Y-axis labels.",
  160. "axis.y.labels.layoutMode.name": "Layout Mode",
  161. "axis.y.labels.layoutMode.options.horizontal": "Horizontal",
  162. "axis.y.labels.layoutMode.options.rotate90": "Rotated 90 degrees",
  163. "axis.y.labels.style.fill.description": "The color of Y-axis labels.",
  164. "axis.y.labels.style.fill.name": "Label color",
  165. "axis.y.labels.style.font-family.description": "The font families of the Y-axis labels.",
  166. "axis.y.labels.style.font-family.name": "Label font families",
  167. "axis.y.labels.style.font-size.description": "The size of Y-axis labels (CSS size).",
  168. "axis.y.labels.style.font-size.name": "Label font size",
  169. "axis.y.labels.style.font.description": "The font properties of Y-axis labels (CSS styles).",
  170. "axis.y.labels.style.font.name": "Label font",
  171. "axis.y.labels.zoomPan.description": "Shows or hides Y-axis labels when panning and zooming.",
  172. "axis.y.labels.zoomPan.falseLabel": "Show",
  173. "axis.y.labels.zoomPan.name": "Label pan-zoom",
  174. "axis.y.labels.zoomPan.trueLabel": "Hide",
  175. "axis.y.line.display.description": "Shows or hides the Y-axis line.",
  176. "axis.y.line.display.falseLabel": "Hide",
  177. "axis.y.line.display.name": "Show line",
  178. "axis.y.line.display.trueLabel": "Show",
  179. "axis.y.line.style.stroke.description": "The color of the Y-axis line.",
  180. "axis.y.line.style.stroke.name": "Line color",
  181. "axis.y.scale.includeZero.description": "When set to Yes, includes 0 on the Y-axis.",
  182. "axis.y.scale.includeZero.falseLabel": "Do not include",
  183. "axis.y.scale.includeZero.name": "Includes zero",
  184. "axis.y.scale.includeZero.trueLabel": "Include",
  185. "axis.y.scale.max.description": "The maximum value that appears on the Y-axis.",
  186. "axis.y.scale.max.name": "Maximum value",
  187. "axis.y.scale.min.description": "The minimum value tha appears on the Y-axis.",
  188. "axis.y.scale.min.name": "Minimum value",
  189. "axis.y.scale.nice.description": "When set to Yes, uses nice endpoint values on the Y-axis.",
  190. "axis.y.scale.nice.falseLabel": "Do not nice",
  191. "axis.y.scale.nice.name": "Nicing",
  192. "axis.y.scale.nice.trueLabel": "Apply nicing",
  193. "axis.y.ticks.display.description": "Shows or hides the Y-axis tick marks.",
  194. "axis.y.ticks.display.falseLabel": "Hide",
  195. "axis.y.ticks.display.name": "Show ticks",
  196. "axis.y.ticks.display.trueLabel": "Show",
  197. "axis.y.ticks.style.stroke.description": "The color of the Y-axis ticks.",
  198. "axis.y.ticks.style.stroke.name": "Tick color",
  199. "axis.y.title.display.description": "Shows or hides the Y-axis title.",
  200. "axis.y.title.display.falseLabel": "Hide",
  201. "axis.y.title.display.name": "Show title",
  202. "axis.y.title.display.trueLabel": "Show",
  203. "axis.y.title.style.fill.description": "The color of the Y-axis title.",
  204. "axis.y.title.style.fill.name": "Title color",
  205. "axis.y.title.style.font-family.description": "The font family names of the Y-axis title.",
  206. "axis.y.title.style.font-family.name": "Title font families",
  207. "axis.y.title.style.font-size.description": "The size of the Y-axis title font (CSS size).",
  208. "axis.y.title.style.font-size.name": "Title font size",
  209. "axis.y.title.style.font.description": "The Y-axis title font properties (CSS styles).",
  210. "axis.y.title.style.font.name": "Title font",
  211. "axis.y.title.text.description": "The title of the Y-axis.",
  212. "axis.y.title.text.name": "Title",
  213. "background.chart.color.description": "The background color of the chart.",
  214. "background.chart.color.name": "Background color",
  215. "background.color.description": "The background color of the chart.",
  216. "background.elements.color.description": "The background color behind the elements of the chart.",
  217. "background.elements.color.name": "Elements background color",
  218. "color.palette.description": "The color palette that controls the colors or patterns that are applied to data elements in the chart.",
  219. "color.palette.name": "Color palette",
  220. "contrast.label.color.description": "Adjust the label color to contrast with background.",
  221. "contrast.label.color.name": "Contrast label color with background",
  222. "data.handling.description": "The configuration that is used to plot the data.",
  223. "data.handling.name": "Configuration",
  224. "data.label.display.description": "Shows or hides data labels.",
  225. "data.label.display.name": "Data label",
  226. "data.label.type.description": "Type of data labels to display.",
  227. "data.label.type.name": "Data label type",
  228. "data.label.type.options.percentByCategory": "Percentage of category",
  229. "data.label.type.options.percentByColor": "Percentage of color (series)",
  230. "data.label.type.options.value": "Value",
  231. "datamodel.hierarchial.label": "Hierarchical data model",
  232. "datamodel.tabular.label": "Tabular data model",
  233. "datamodel.tabular.line.description": "The tabular line model, where each entry is a point on the line with x, y, and optional group. The group value is used to group the points into lines.",
  234. "dataset.hierarchial.label": "Hierarchical data set",
  235. "dataset.tabular.description": "The tabular data set of rows and columns.",
  236. "dataset.tabular.label": "Tabular data set",
  237. "dataset.tabular.link.description": "Determines the links between the nodes.",
  238. "dataset.tabular.link.label": "Tabular links data set",
  239. "dataset.tabular.node.description": "The tabular data set that defines the nodes.",
  240. "dataset.tabular.node.label": "Tabular node data set",
  241. "dataslot.categories.label": "Categories",
  242. "dataslot.category.label": "Category",
  243. "dataslot.children.description": "When applied to a tree node, returns the children of that node as an array-list.",
  244. "dataslot.children.label": "Children",
  245. "dataslot.color.description": "Determines the color of the shape.",
  246. "dataslot.color.label": "Color",
  247. "dataslot.color.line.description": "A group that is used to combine points into lines. If not specified, all points are in one line. Groups are also used for the line color.",
  248. "dataslot.key.description": "Called for each row to match elements. Primarily used for transitions.",
  249. "dataslot.key.label": "Key",
  250. "dataslot.label.description": "Determines the label of the shape.",
  251. "dataslot.label.label": "Label",
  252. "dataslot.label.line.description": "If defined, the label of the point (not the line).",
  253. "dataslot.maximumValue.label": "Maximum value",
  254. "dataslot.source.label": "Source",
  255. "dataslot.sourceValue.label": "Source value",
  256. "dataslot.tabular.id.description": "The identifier for the nodes.",
  257. "dataslot.tabular.id.label": "Identifier",
  258. "dataslot.tabular.size.description": "Determines the size of the shape.",
  259. "dataslot.tabular.size.label": "Size",
  260. "dataslot.target.label": "Target",
  261. "dataslot.targetValue.label": "Target value",
  262. "dataslot.value.label": "Value",
  263. "dataslot.x.label": "X axis",
  264. "dataslot.x.line.description": "The x coordinate of the point. The value can be a number, string, or date.",
  265. "dataslot.y.label": "Y axis",
  266. "dataslot.y.line.description": "The y coordinate of the point. The value must be a number.",
  267. "defaultPalette.description": "Rave2 default description",
  268. "defaultPalette.label": "Rave2 default",
  269. "effect.duration.description": "The animation duration, in ms.",
  270. "effect.duration.name": "Animation duration (ms)",
  271. "effect.name.description": "The effect that is used when the chart is drawn.",
  272. "effect.name.name": "Animation",
  273. "effect.name.options.fromBase": "From base",
  274. "effect.name.options.none": "None",
  275. "effect.name.options.transition": "Transition",
  276. "grid.color.description": "The color of the grid lines.",
  277. "grid.color.name": "Grid lines color",
  278. "grid.display.description": "Shows or hides the grid lines.",
  279. "grid.display.name": "Show grid lines",
  280. "item.label.description": "Shows or hides item labels.",
  281. "item.label.name": "Item labels",
  282. "label.shadow.description": "Show or hide shadow for labels.",
  283. "label.shadow.name": "Label shadow",
  284. "labelstyle.font.description": "Font styles for the item labels",
  285. "labelstyle.font.name": "Item label font",
  286. "layout.axissize.bottom.max.description": "The maximum size of the bottom axis, as a CSS size or percentage.",
  287. "layout.axissize.bottom.max.name": "Bottom axis maximum size",
  288. "layout.axissize.bottom.min.description": "The minimum size of the bottom axis, as a CSS size or percentage.",
  289. "layout.axissize.bottom.min.name": "Bottom axis minimum size",
  290. "layout.axissize.bottom.preferred.description": "The preferred size of the bottom axis, as a CSS size or percentage.",
  291. "layout.axissize.bottom.preferred.name": "Bottom axis preferred size",
  292. "layout.axissize.left.max.description": "The maximum size of the left axis, as a CSS size or percentage.",
  293. "layout.axissize.left.max.name": "Left axis maximum size",
  294. "layout.axissize.left.min.description": "The minimum size of the left axis, as a CSS size or percentage.",
  295. "layout.axissize.left.min.name": "Left axis minimum size",
  296. "layout.axissize.left.preferred.description": "The preferred size of the left axis, as a CSS size or percentage.",
  297. "layout.axissize.left.preferred.name": "Left axis preferred size",
  298. "layout.axissize.right.max.description": "The maximum size of the right axis, as a CSS size or percentage.",
  299. "layout.axissize.right.max.name": "Right axis maximum size",
  300. "layout.axissize.right.min.description": "The minimum size of the right axis, as a CSS size or percentage.",
  301. "layout.axissize.right.min.name": "Right axis minimum size",
  302. "layout.axissize.right.preferred.description": "The preferred size of the right axis, as a CSS size or percentage.",
  303. "layout.axissize.right.preferred.name": "Right axis preferred size",
  304. "layout.axissize.top.max.description": "The maximum size of the top axis, as a CSS size or percentage.",
  305. "layout.axissize.top.max.name": "Top axis maximum size",
  306. "layout.axissize.top.min.description": "The minimum size of the top axis, as a CSS size or percentage.",
  307. "layout.axissize.top.min.name": "Top axis minimum size",
  308. "layout.axissize.top.preferred.description": "The preferred size of the top axis, as a CSS size or percentage.",
  309. "layout.axissize.top.preferred.name": "Top axis preferred size",
  310. "layout.chart.padding.bottom.description": "The bottom padding for the chart.",
  311. "layout.chart.padding.bottom.name": "Bottom padding",
  312. "layout.chart.padding.left.description": "The left padding for the chart.",
  313. "layout.chart.padding.left.name": "Left padding",
  314. "layout.chart.padding.right.description": "Right padding for the chart.",
  315. "layout.chart.padding.right.name": "Right padding",
  316. "layout.chart.padding.top.description": "The top padding for the chart.",
  317. "layout.chart.padding.top.name": "Top padding",
  318. "layout.legendchart.align.description": "Whether to align the legend to the interior of the chart.",
  319. "layout.legendchart.align.name": "Align legend to chart",
  320. "layout.legendchart.gap.description": "Space between the chart and the legend, as a CSS size or percentage.",
  321. "layout.legendchart.gap.name": "Space between legend and chart",
  322. "layout.legendsize.max.description": "The maximum size of the legend, as a CSS size or percentage.",
  323. "layout.legendsize.max.name": "Maximum size",
  324. "layout.legendsize.min.description": "The minimum size of the legend, as a CSS size or percentage.",
  325. "layout.legendsize.min.name": "Minimum size",
  326. "layout.legendsize.preferred.description": "The preferred size of the legend, as a CSS size or percentage.",
  327. "layout.legendsize.preferred.name": "Preferred size",
  328. "layout.padding.description": "The padding around the chart and legend.",
  329. "layout.padding.name": "Padding",
  330. "legend.display.description": "Shows or hides the legend.",
  331. "legend.display.falseLabel": "Hide",
  332. "legend.display.name": "Show legend",
  333. "legend.display.trueLabel": "Show",
  334. "legend.entrystyle.font.description": "The font properties of the legend entry.",
  335. "legend.entrystyle.font.name": "Entry font",
  336. "legend.position.description": "The position of the legend in the chart.",
  337. "legend.position.name": "Legend position",
  338. "legend.position.options.bottom": "Bottom",
  339. "legend.position.options.left": "Left",
  340. "legend.position.options.right": "Right",
  341. "legend.position.options.top": "Top",
  342. "legend.title.description": "The title of the legend.",
  343. "legend.title.name": "Title",
  344. "legend.titlestyle.fill.description": "The color of the legend title.",
  345. "legend.titlestyle.fill.name": "Title color",
  346. "legend.titlestyle.font.description": "The font properties of the legend title.",
  347. "legend.titlestyle.font.name": "Title font",
  348. "legend.titlestyle.fontfamily.description": "The font family of the legend title.",
  349. "legend.titlestyle.fontfamily.name": "Title font family",
  350. "legend.titlestyle.fontsize.description": "The font size of the legend title.",
  351. "legend.titlestyle.fontsize.name": "Title font size",
  352. "line.config.line.description": "Line visualizations plot data at regular points connected by lines. You can use line visualizations to show trends over time and compare many data series.",
  353. "line.config.line.label": "Line",
  354. "line.config.smoothline.description": "Line visualizations plot data at regular points connected by lines. You can use line visualizations to show trends over time and compare many data series.",
  355. "line.config.smoothline.label": "Smooth line",
  356. "line.config.stepline.description": "Step line visualizations plot data at regular points, forming a series of steps between data points. You can use line visualizations to show trends over time and compare many data series.",
  357. "line.config.stepline.label": "Step line",
  358. "line.description": "Line charts plot data at regular points connected by lines. You can use line charts to show trends over time and compare many data series.",
  359. "line.falseLabel.itemLabel": "Hide",
  360. "line.falseLabel.nullPoint": "Line only",
  361. "line.falseValue.sortX": "Do not sort lines (use data ordering)",
  362. "line.label": "Line",
  363. "line.propertyPresentation.advanced.lineSpecificProperties.description": "Line-specific properties",
  364. "line.propertyPresentation.advanced.lineSpecificProperties.label": "Line",
  365. "line.trueLabel.itemLabel": "Show",
  366. "line.trueLabel.nullPoint": "Line with points",
  367. "line.trueValue.sortX": "Sort lines by x value",
  368. "lineWithPoints.display.description": "Shows line and points, line only, or points only.",
  369. "lineWithPoints.display.name": "Chart display mode",
  370. "lineWithPoints.display.options.line": "Line(s) only",
  371. "lineWithPoints.display.options.linePoints": "Line and points",
  372. "lineWithPoints.display.options.points": "Points only",
  373. "lineWithPoints.interpolate.description": "Controls how the line in the line chart is drawn.",
  374. "lineWithPoints.interpolate.name": "Interpolation mode",
  375. "lineWithPoints.interpolate.options.basis": "Basis",
  376. "lineWithPoints.interpolate.options.basis-open": "Basis-open",
  377. "lineWithPoints.interpolate.options.cardinal": "Cardinal",
  378. "lineWithPoints.interpolate.options.cardinal-open": "Cardinal-open",
  379. "lineWithPoints.interpolate.options.linear": "Linear",
  380. "lineWithPoints.interpolate.options.monotone": "Monotone",
  381. "lineWithPoints.interpolate.options.step": "Step",
  382. "lineWithPoints.interpolate.options.step-after": "Step-after",
  383. "lineWithPoints.interpolate.options.step-before": "Step-before",
  384. "lineWithPoints.showMissingAsGap.description": "Show missing data as gap instead of interpolating a line across the missing data",
  385. "lineWithPoints.showMissingAsGap.name": "Show missing data as gap",
  386. "lineWithPoints.size.description": "The size, in square pixels, of the line-with-points symbol.",
  387. "lineWithPoints.size.name": "Line-with-points size",
  388. "lineWithPoints.symbol.description": "The shape that is used for the line-with-points symbol.",
  389. "lineWithPoints.symbol.name": "Line-with-points symbol",
  390. "lineWithPoints.symbol.options.circle": "Circle",
  391. "lineWithPoints.symbol.options.cross": "Cross",
  392. "lineWithPoints.symbol.options.diamond": "Diamond",
  393. "lineWithPoints.symbol.options.donut": "Donut",
  394. "lineWithPoints.symbol.options.donut-plus": "Donut-plus",
  395. "lineWithPoints.symbol.options.horizontal-rectangle": "Horizontal-rectangle",
  396. "lineWithPoints.symbol.options.rectangle": "Rectangle",
  397. "lineWithPoints.symbol.options.square": "Square",
  398. "lineWithPoints.symbol.options.star": "Star",
  399. "lineWithPoints.symbol.options.triangle-down": "Triangle-down",
  400. "lineWithPoints.symbol.options.triangle-left": "Triangle-left",
  401. "lineWithPoints.symbol.options.triangle-right": "Triangle-right",
  402. "lineWithPoints.symbol.options.triangle-up": "Triangle-up",
  403. "lineWithPoints.symbol.options.vertical-rectangle": "Vertical-rectangle",
  404. "propertyPresentation.advanced.axisSizeProperties.description": "Axis size properties.",
  405. "propertyPresentation.advanced.axisSizeProperties.label": "Axis size",
  406. "propertyPresentation.advanced.clientBehaviorProperties.description": "Client side properties.",
  407. "propertyPresentation.advanced.clientBehaviorProperties.label": "Client behavior",
  408. "propertyPresentation.advanced.commonProperties.description": "Common properties.",
  409. "propertyPresentation.advanced.commonProperties.label": "Common",
  410. "propertyPresentation.advanced.description": "Advanced list of all properties in a grouped structure.",
  411. "propertyPresentation.advanced.label": "Advanced",
  412. "propertyPresentation.advanced.labelProperties.description": "Label properties",
  413. "propertyPresentation.advanced.labelProperties.label": "Label",
  414. "propertyPresentation.advanced.legendProperties.description": "Legend properties.",
  415. "propertyPresentation.advanced.legendProperties.label": "Legend",
  416. "propertyPresentation.advanced.xAxisProperties.description": "X-axis properties.",
  417. "propertyPresentation.advanced.xAxisProperties.label": "X-axis",
  418. "propertyPresentation.advanced.yAxisProperties.description": "Y-axis properties.",
  419. "propertyPresentation.advanced.yAxisProperties.label": "Y-axis",
  420. "propertyPresentation.simple.description": "Simple list of the most common properties.",
  421. "propertyPresentation.simple.label": "Simple",
  422. "rave2.colorpalette.blueContinuousSequential.description": "Blue continuous sequential description",
  423. "rave2.colorpalette.blueContinuousSequential.label": "Blue continuous sequential",
  424. "rave2.colorpalette.blueDiscreteSequential.description": "Blue discrete sequential description",
  425. "rave2.colorpalette.blueDiscreteSequential.label": "Blue discrete sequential",
  426. "rave2.colorpalette.blueGreenContinuousDivergent.description": "Blue green continuous divergent description",
  427. "rave2.colorpalette.blueGreenContinuousDivergent.label": "Blue green continuous divergent",
  428. "rave2.colorpalette.blueGreenDiscreteDivergent.description": "Blue green discrete divergent description",
  429. "rave2.colorpalette.blueGreenDiscreteDivergent.label": "Blue green discrete divergent",
  430. "rave2.colorpalette.dark.description": "Dark description",
  431. "rave2.colorpalette.dark.label": "Dark",
  432. "rave2.colorpalette.financial.description": "Financial description",
  433. "rave2.colorpalette.financial.label": "Financial",
  434. "rave2.colorpalette.greenContinuousSequential.description": "Green continuous sequential description",
  435. "rave2.colorpalette.greenContinuousSequential.label": "Green continuous sequential",
  436. "rave2.colorpalette.greenDiscreteSequential.description": "Green discrete sequential description",
  437. "rave2.colorpalette.greenDiscreteSequential.label": "Green discrete sequential",
  438. "rave2.colorpalette.light.description": "Light description",
  439. "rave2.colorpalette.light.label": "Light",
  440. "rave2.colorpalette.medical.description": "Medical description",
  441. "rave2.colorpalette.medical.label": "Medical",
  442. "rave2.colorpalette.orangeContinuousSequential.description": "Orange continuous sequential description",
  443. "rave2.colorpalette.orangeContinuousSequential.label": "Orange continuous sequential",
  444. "rave2.colorpalette.orangeDiscreteSequential.description": "Orange discrete sequential description",
  445. "rave2.colorpalette.orangeDiscreteSequential.label": " Orange discrete sequential",
  446. "rave2.colorpalette.purpleContinuousSequential.description": "Purple continuous sequential description",
  447. "rave2.colorpalette.purpleContinuousSequential.label": "Purple continuous sequential",
  448. "rave2.colorpalette.purpleDiscreteSequential.description": "Purple discrete sequential description",
  449. "rave2.colorpalette.purpleDiscreteSequential.label": "Purple discrete sequential",
  450. "rave2.colorpalette.redBlueContinuousDivergent.description": "Red blue continuous divergent description",
  451. "rave2.colorpalette.redBlueContinuousDivergent.label": "Red blue continuous divergent",
  452. "rave2.colorpalette.redBlueDiscreteDivergent.description": "Red blue discrete divergent description",
  453. "rave2.colorpalette.redBlueDiscreteDivergent.label": "Red blue discrete divergent",
  454. "rave2.colorpalette.redBlueInverseContinuousDivergent.description": "Red blue inverse continuous divergent description",
  455. "rave2.colorpalette.redBlueInverseContinuousDivergent.label": "Red blue inverse continuous divergent",
  456. "rave2.colorpalette.redBlueInverseDiscreteDivergent.description": "Red blue inverse discrete divergent description",
  457. "rave2.colorpalette.redBlueInverseDiscreteDivergent.label": "Red blue inverse discrete divergent",
  458. "rave2.colorpalette.redContinuousSequential.description": "Red continuous sequential description",
  459. "rave2.colorpalette.redContinuousSequential.label": "Red continuous sequential",
  460. "rave2.colorpalette.redDiscreteSequential.description": "Red discrete sequential description",
  461. "rave2.colorpalette.redDiscreteSequential.label": " Red discrete sequential",
  462. "rave2.colorpalette.redGreenContinuousDivergent.description": "Red green continuous divergent description",
  463. "rave2.colorpalette.redGreenContinuousDivergent.label": "Red green continuous divergent",
  464. "rave2.colorpalette.redGreenDiscreteDivergent.description": "Red green discrete divergent description",
  465. "rave2.colorpalette.redGreenDiscreteDivergent.label": "Red green discrete divergent",
  466. "rave2.colorpalette.redGreenInverseContinuousDivergent.description": "Red green inverse continuous divergent description",
  467. "rave2.colorpalette.redGreenInverseContinuousDivergent.label": "Red green inverse continuous divergent",
  468. "rave2.colorpalette.redGreenInverseDiscreteDivergent.description": "Red green inverse discrete divergent description",
  469. "rave2.colorpalette.redGreenInverseDiscreteDivergent.label": "Red green inverse discrete divergent",
  470. "rave2.colorpalette.tealContinuousSequential.description": "Teal continuous sequential description",
  471. "rave2.colorpalette.tealContinuousSequential.label": "Teal continuous sequential",
  472. "rave2.colorpalette.tealDiscreteSequential.description": "Teal discrete sequential description",
  473. "rave2.colorpalette.tealDiscreteSequential.label": "Teal discrete sequential",
  474. "rave2.colorpalette.tealPurpleContinuousDivergent.description": "Teal purple continuous divergent description",
  475. "rave2.colorpalette.tealPurpleContinuousDivergent.label": "Teal purple continuous divergent",
  476. "rave2.colorpalette.tealPurpleDiscreteDivergent.description": "Teal purple discrete divergent description",
  477. "rave2.colorpalette.tealPurpleDiscreteDivergent.label": "Teal purple discrete divergent",
  478. "rave2.colorpalette.violetContinuousSequential.description": "Violet continuous sequential description",
  479. "rave2.colorpalette.violetContinuousSequential.label": "Violet continuous sequential",
  480. "rave2.colorpalette.violetDiscreteSequential.description": "Violet discrete sequential description",
  481. "rave2.colorpalette.violetDiscreteSequential.label": "Violet discrete sequential",
  482. "rave2.colorpalette.yellowContinuousSequential.description": "Yellow continuous sequential description",
  483. "rave2.colorpalette.yellowContinuousSequential.label": "Yellow continuous sequential",
  484. "rave2.colorpalette.yellowDiscreteSequential.description": "Yellow discrete sequential description",
  485. "rave2.colorpalette.yellowDiscreteSequential.label": "Yellow discrete sequential",
  486. "sortX.description": "Sorts the line points by x.",
  487. "sortX.name": "Sort points by x",
  488. "transpose.description": "When set to Yes, the Y-axis shows the independent scale and the X-axis shows the dependent scale.",
  489. "transpose.falseLabel": "Do not transpose",
  490. "transpose.name": "Switch X and Y axes",
  491. "transpose.trueLabel": "Transpose",
  492. "zoom.description": "Zooms the chart in the X, Y, or both directions.",
  493. "zoom.name": "Zoom",
  494. "zoom.options.both": "Both",
  495. "zoom.options.none": "None",
  496. "zoom.options.x": "X",
  497. "zoom.options.y": "Y"
  498. }
  499. },{}],3:[function(require,module,exports){
  500. (function() {
  501. var $ = {};
  502. // $source: com/ibm/rave/bundles/internal/nativeImpl/BundleModuleHeader
  503. /************************************************************************
  504. ** IBM Confidential
  505. **
  506. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  507. **
  508. ** (C) Copyright IBM Corp. 2015
  509. **
  510. ** The source code for this program is not published or otherwise divested of its trade secrets,
  511. ** irrespective of what has been deposited with the U.S. Copyright Office.
  512. ************************************************************************/
  513. var com_ibm_rave_library_Library = rave["library"];
  514. rave["internal"]["Declare"] = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"];
  515. rave["internal"]["CSSUtil"]= rave["_"]["com_ibm_rave_core_internal_css_CSSUtil"];
  516. // $source: com/ibm/rave/bundles/RaveBundle
  517. /************************************************************************
  518. ** IBM Confidential
  519. **
  520. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  521. **
  522. ** (C) Copyright IBM Corp. 2017
  523. **
  524. ** The source code for this program is not published or otherwise divested of its trade secrets,
  525. ** irrespective of what has been deposited with the U.S. Copyright Office.
  526. ************************************************************************/
  527. // GENERATED
  528. //@import com/ibm/rave/bundles/internal/nativeImpl/RaveBundleResourceLoader (runtime) // new
  529. /**
  530. * A RaveBundle extends the regular Bundle abstract class but includes common functionality for Rave-made bundles that aren't for general use.
  531. */
  532. var com_ibm_rave_bundles_RaveBundle = rave['internal']['Declare'](rave['library']['internal']['Bundle'], {
  533. /** @expose */
  534. loader : null,
  535. /** @expose */
  536. constructor : function() {
  537. ;
  538. ;
  539. ;
  540. ;
  541. ;
  542. ;
  543. this.loader = new com_ibm_rave_bundles_internal_nativeImpl_RaveBundleResourceLoader("/com/ibm/rave/bundles/" + this.getName());
  544. },
  545. /**
  546. * Load extra resources required for this bundle. Currently the compiled configuration.json file. And .css.
  547. */
  548. /** @expose */
  549. loadResources : function() {
  550. this.setMessageCatalog(rave['library']['internal']['Bundle'].DEFAULT_LOCALE, require("./i18n/messages_en.json"));
  551. var array = require("./configuration/configuration.json");
  552. if (array) {
  553. for (var __i_enFor0 = 0, __exp_enFor0 = array, __len_enFor0 = __exp_enFor0.length;
  554. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  555. var artifact = __exp_enFor0[__i_enFor0];
  556. this.initialize(artifact);
  557. }
  558. }
  559. require("./vizlibrary.css");
  560. }
  561. });
  562. //com_ibm_rave_bundles_RaveBundle.CONFIGURATION_FILE = "./configuration/configuration.json";
  563. // $source: com/ibm/rave/bundles/internal/nativeImpl/RaveBundleResourceLoader
  564. // Intentionally empty - everything in this file is inlined
  565. var com_ibm_rave_bundles_internal_nativeImpl_RaveBundleResourceLoader = function(){};
  566. // $source: com/ibm/rave/bundles/views/BundleView
  567. /************************************************************************
  568. ** IBM Confidential
  569. **
  570. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  571. **
  572. ** (C) Copyright IBM Corp. 2017
  573. **
  574. ** The source code for this program is not published or otherwise divested of its trade secrets,
  575. ** irrespective of what has been deposited with the U.S. Copyright Office.
  576. ************************************************************************/
  577. // GENERATED
  578. //@import com/ibm/rave/bundles/components/BackgroundComponentImpl (runtime) // new
  579. //@import com/ibm/rave/bundles/components/ChartLayoutComponentImpl (runtime) // new
  580. //@import com/ibm/rave/bundles/components/ClipPathComponentImpl (runtime) // new
  581. //@import com/ibm/rave/bundles/components/LegendsManager (runtime) // new
  582. //@import com/ibm/rave/bundles/components/AxesManager (runtime) // new
  583. //@import com/ibm/rave/library/Library (runtime) // Library
  584. //@import com/ibm/rave/bundles/components/IntervalDataUtilities (runtime) // IntervalDataUtilities
  585. //@import com/ibm/rave/bundles/data/PointDataUtilities (runtime) // PointDataUtilities
  586. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  587. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor
  588. var com_ibm_rave_bundles_views_BundleView = rave['internal']['Declare'](rave['library']['internal']['AbstractView'], {
  589. /**
  590. * Background component
  591. */
  592. /** @expose */
  593. _backgroundComponent : null,
  594. /**
  595. * Layout component
  596. */
  597. /** @expose */
  598. _layoutComponent : null,
  599. /**
  600. * Clip component
  601. */
  602. /** @expose */
  603. _clip : null,
  604. /**
  605. * Axes manager
  606. */
  607. /** @expose */
  608. _axes : null,
  609. /**
  610. * Legends manager
  611. */
  612. /** @expose */
  613. _legends : null,
  614. //_groupStructure : null,
  615. /** @expose */
  616. _chart : null,
  617. /** @expose */
  618. dataModel : null,
  619. /** @expose */
  620. _zoomP : null,
  621. /** @expose */
  622. _zoomS : null,
  623. /** @expose */
  624. constructor : function(context) {
  625. },
  626. /** @expose */
  627. getGroupStructure : function() {},
  628. /** @expose */
  629. setup : function() {
  630. rave['library']['internal']['AbstractView'].prototype.setup.call(this);
  631. this._backgroundComponent = new com_ibm_rave_bundles_components_BackgroundComponentImpl();
  632. this._layoutComponent = new com_ibm_rave_bundles_components_ChartLayoutComponentImpl();
  633. this._clip = new com_ibm_rave_bundles_components_ClipPathComponentImpl(this.context.instanceId() + "clipViewport");
  634. if (this.isZoomSupported()) {
  635. this.resetZoom();
  636. }
  637. this._legends = new com_ibm_rave_bundles_components_LegendsManager(this.context, this.getLegendCount());
  638. if (this.isAxesManagerRequired()) {
  639. this._axes = new com_ibm_rave_bundles_components_AxesManager(this.context);
  640. }
  641. this._groupStructure = this.getGroupStructure();
  642. },
  643. /** @expose */
  644. preDraw : function(chartId) {
  645. this.cancelTransitions();
  646. rave['library']['internal']['AbstractView'].createGroupStructure(this.context.node, this._groupStructure);
  647. this._chart = this.context.node.selectAll(chartId);
  648. },
  649. /** @expose */
  650. resetZoom : function() {
  651. this._zoomP = [0, 0, 0, 0];
  652. this._zoomS = [1, 1, 1, 1];
  653. },
  654. /** @expose */
  655. validateDataModel : function(elementsToRemove) {
  656. if (elementsToRemove !== null || arguments.length > 1){
  657. elementsToRemove = Array.prototype.slice.call(arguments);
  658. }
  659. {
  660. this.dataModel = this.context.dataModel();
  661. if (!(this.dataValid())) {
  662. for (var __i_enFor0 = 0, __len_enFor0 = elementsToRemove.length;
  663. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  664. var e = elementsToRemove[__i_enFor0];
  665. this._chart.selectAll(e).selectAll("*").remove();
  666. }
  667. this._legends.visible(false).draw();
  668. return false;
  669. }
  670. return true;
  671. }
  672. },
  673. /** @expose */
  674. dataValid : function() {
  675. return this.dataModel.validate();
  676. },
  677. /** @expose */
  678. getLegendCount : function() {
  679. return 1;
  680. },
  681. /** @expose */
  682. isAxesManagerRequired : function() {
  683. return false;
  684. },
  685. /** @expose */
  686. isZoomSupported : function() {
  687. return true;
  688. },
  689. /** @expose */
  690. getProperty : function(s) {
  691. return this.context.getPropertyValue(s);
  692. },
  693. /** @expose */
  694. getPropertyDefault : function(s) {
  695. return this.context.getPropertyDefault(s);
  696. },
  697. /** @expose */
  698. getBooleanProperty : function(s) {
  699. var obj = this.getProperty(s);
  700. return (obj);
  701. },
  702. /** @expose */
  703. getDoubleProperty : function(s) {
  704. var obj = this.getProperty(s);
  705. return + (obj);
  706. },
  707. /** @expose */
  708. getIntProperty : function(s) {
  709. var obj = this.getProperty(s);
  710. return ~~ (obj);
  711. },
  712. /**
  713. * @param (String) id Property ID
  714. * @return (String) Property value as a string
  715. */
  716. /** @expose */
  717. getStringProperty : function(id) {
  718. var obj = this.getProperty(id);
  719. return (obj == null) ? null : ""+(obj);
  720. },
  721. /**
  722. * @param (String) id Property ID
  723. * @return (String) Property value as a string, returning null for the empty string
  724. */
  725. /** @expose */
  726. getStringPropertyEmptyAsNull : function(id) {
  727. var s = this.getStringProperty(id);
  728. return (s == null || s.length == 0) ? null : s;
  729. },
  730. /**
  731. * @param (String) id Property ID
  732. * @return (Number) Property value as a string, containing size as the number of pixels
  733. */
  734. /** @expose */
  735. getCSSSizeToPixelNumber : function(id) {
  736. var cssSize = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(this.context.getPropertyValue(id), 100.0, 10.0);
  737. return (cssSize == null) ? 0.0 : cssSize;
  738. },
  739. /**
  740. * Based on effect duration and effect property, determine the effect duration in ms.
  741. * @param (String) effect Effect name, one of the options available from EFFECT_OPTIONS.
  742. * @return (int) Effect duration in ms.
  743. */
  744. /** @expose */
  745. getEffectDuration : function(effect) {
  746. var duration = this.getIntProperty("effect.duration");
  747. if ((duration < 0) || (effect == null) || "none" == effect) {
  748. duration = 0;
  749. }
  750. return duration;
  751. },
  752. /** @expose */
  753. getTopPadding : function() {
  754. return this.getProperty("layout.chart.padding.top");
  755. },
  756. /** @expose */
  757. getLeftPadding : function() {
  758. return this.getProperty("layout.chart.padding.left");
  759. },
  760. /** @expose */
  761. getBottomPadding : function() {
  762. return this.getProperty("layout.chart.padding.bottom");
  763. },
  764. /** @expose */
  765. getRightPadding : function() {
  766. return this.getProperty("layout.chart.padding.right");
  767. },
  768. /** @expose */
  769. getLayoutPadding : function() {
  770. return this.getProperty("layout.padding");
  771. },
  772. /** @expose */
  773. getLegendChartGap : function() {
  774. return this.getProperty("layout.legendchart.gap");
  775. },
  776. /** @expose */
  777. getLegendChartAlign : function() {
  778. return this.getBooleanProperty("layout.legendchart.align");
  779. },
  780. /** @expose */
  781. getLegendPosition : function() {
  782. return this.getStringProperty("legend.position");
  783. },
  784. getPalette$0 : function() {
  785. return this.getPalette$1("color.palette");
  786. },
  787. getPalette$1 : function(paletteID) {
  788. var id = this.getStringProperty(paletteID);
  789. var colorPalette = com_ibm_rave_library_Library.palettes.getPalette(id);
  790. return (!colorPalette) ? com_ibm_rave_library_Library.palettes.getDefaultPalette() : colorPalette;
  791. },
  792. getDynamicPalette$0 : function() {
  793. return this.getDynamicPalette$1("color.palette", "color.dynamicPalette.min", "color.dynamicPalette.mid", "color.dynamicPalette.max");
  794. },
  795. /**
  796. * 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.
  797. * @param (String) paletteID The palette ID
  798. * @return (rave['library']['internal']['Palette']) Palette
  799. */
  800. getDynamicPalette$1 : function(paletteID, minId, midId, maxId) {
  801. var colorPalette;
  802. var min = this.getStringProperty(minId);
  803. if (min != null) {
  804. var mid = this.getStringProperty(midId);
  805. if (mid != null) {
  806. var max = this.getStringProperty(maxId);
  807. if (max != null) {
  808. var fills = [min, mid, max];
  809. colorPalette = rave['library']['internal']['AbstractView'].getFillPalette(fills);
  810. }
  811. }
  812. }
  813. return (!colorPalette) ? this.getPalette(paletteID) : colorPalette;
  814. },
  815. /** @expose */
  816. prepareLayoutComponent : function() {
  817. 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());
  818. },
  819. /** @expose */
  820. prepareLayoutSizables : function(layoutComponent, useX2, useY1, useX1, useY2, useLegend) {
  821. layoutComponent.removeAxisSizables();
  822. if (useX1) {
  823. layoutComponent.addAxisSizable(this._axes.axisComponent(0));
  824. }
  825. if (useY1) {
  826. layoutComponent.addAxisSizable(this._axes.axisComponent(2));
  827. }
  828. if (useX2) {
  829. layoutComponent.addAxisSizable(this._axes.axisComponent(1));
  830. }
  831. if (useY2) {
  832. layoutComponent.addAxisSizable(this._axes.axisComponent(3));
  833. }
  834. layoutComponent.legendSize(useLegend ? this._legends : null);
  835. },
  836. /** @expose */
  837. resetUpdate : function() {
  838. this.updateType = 4;
  839. },
  840. /** @expose */
  841. isUpdateNothing : function() {
  842. return this.updateType == 4;
  843. },
  844. /** @expose */
  845. isShowLegend : function() {
  846. return this.getBooleanProperty("legend.display");
  847. },
  848. cancelTransitions : function() {
  849. this.context.node.selectAll("*").interrupt();
  850. },
  851. /** @expose */
  852. setBackgroundProperties : function(elementRect, duration) {
  853. this._backgroundComponent.setPreExecute(this.context.getPreExecute()).size(this.context.size).backgroundColor(this.getStringProperty("background.chart.color"));
  854. this.context.node.selectAll("rect.background.chart").transition().duration(duration).call(this._backgroundComponent);
  855. this._backgroundComponent.setPreExecute(this.context.getPreExecute()).rect(elementRect).backgroundColor(this.getStringProperty("background.elements.color"));
  856. this.context.node.selectAll("rect.background.elements").transition().duration(duration).call(this._backgroundComponent);
  857. },
  858. /** @expose */
  859. isShowDataLabels : function() {
  860. return this.getBooleanProperty("data.label.display");
  861. },
  862. /** @expose */
  863. isShowDataLabelsAsPercentageOfColor : function() {
  864. var dataLabel = this.getStringProperty("data.label.type");
  865. return "PercentOfColor" == dataLabel;
  866. },
  867. /** @expose */
  868. isShowDataLabelsAsPercentageOfCategory : function() {
  869. var dataLabel = this.getStringProperty("data.label.type");
  870. return "PercentOfCategory" == dataLabel;
  871. },
  872. /** @expose */
  873. getlDataLabelAccessor : function(dataSet, slot, isInterval) {
  874. var labelAccessor;
  875. var labelEntry = dataSet.slot(slot).entry();
  876. if (!labelEntry) {
  877. if (this.isShowDataLabelsAsPercentageOfCategory()) {
  878. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR;
  879. } else if (this.isShowDataLabelsAsPercentageOfColor()) {
  880. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_COLOR_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_COLOR_ACCESSOR;
  881. } else {
  882. labelAccessor = isInterval ? com_ibm_rave_bundles_components_IntervalDataUtilities.VALUE_ACCESSOR : com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR;
  883. }
  884. } else {
  885. labelAccessor = rave['library']['internal']['AbstractView'].originalDatumAccessor(rave['library']['internal']['AbstractView'].accessorOf(labelEntry));
  886. }
  887. return labelAccessor;
  888. },
  889. /** @expose */
  890. getEntryForDataLabelFormatter : function(dataSet, labelSlot, defaultSlot) {
  891. var labelEntry = dataSet.slot(labelSlot).entry();
  892. return labelEntry ? labelEntry : dataSet.slot(defaultSlot).entry();
  893. },
  894. /** @expose */
  895. getBackgroundConstrastLabelStyle : function() {
  896. var labelFontStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(this.getStringProperty("labelstyle.font"));
  897. if (this.getBooleanProperty("contrast.label.color") == false) {
  898. return labelFontStyle;
  899. }
  900. var defaultFillColor;
  901. if (labelFontStyle) {
  902. defaultFillColor = labelFontStyle["fill"];
  903. if (defaultFillColor == null) {
  904. defaultFillColor = labelFontStyle["color"];
  905. }
  906. } else {
  907. labelFontStyle = {};
  908. }
  909. if (defaultFillColor == null) {
  910. defaultFillColor = "#000000";
  911. }
  912. labelFontStyle["fill"] = com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(this.getStringProperty("background.elements.color"), defaultFillColor);
  913. return labelFontStyle;
  914. },
  915. /** @expose */
  916. getPalette : function(a0) {
  917. var args = arguments;
  918. if (args.length == 0) {
  919. return this.getPalette$0();
  920. }
  921. if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
  922. return this.getPalette$1(a0);
  923. }
  924. return rave['library']['internal']['AbstractView'].prototype.getPalette.apply(this, args);
  925. },
  926. /** @expose */
  927. getDynamicPalette : function(a0, a1, a2, a3) {
  928. var args = arguments;
  929. if (args.length == 0) {
  930. return this.getDynamicPalette$0();
  931. }
  932. return this.getDynamicPalette$1(a0, a1, a2, a3);
  933. }
  934. });
  935. // $source: com/ibm/rave/bundles/components/BundleComponentImpl
  936. /************************************************************************
  937. ** IBM Confidential
  938. **
  939. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  940. **
  941. ** (C) Copyright IBM Corp. 2017
  942. **
  943. ** The source code for this program is not published or otherwise divested of its trade secrets,
  944. ** irrespective of what has been deposited with the U.S. Copyright Office.
  945. ************************************************************************/
  946. // GENERATED
  947. var com_ibm_rave_bundles_components_BundleComponentImpl = rave['internal']['Declare']({
  948. /**
  949. * The pre-execution callback.
  950. */
  951. //_preExecuteCallback : null,
  952. /**
  953. * The render callback.
  954. */
  955. /** @expose */
  956. _renderCallback : null,
  957. _$functionClassMethod : function() {
  958. var _$self = function(args) {
  959. if (args !== null || arguments.length > 1){
  960. args = Array.prototype.slice.call(arguments, 0);
  961. }
  962. {
  963. var self = _$self;
  964. this.each(function(data, index, groupIndex) {
  965. self.execute(rave.select(this));
  966. });
  967. return null;
  968. }
  969. };
  970. return _$self;
  971. },
  972. /**
  973. * 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.
  974. * @param (rave['internal']['Selector']) g <g> node that this component will be applied to.
  975. */
  976. /** @expose */
  977. execute : function(g) {},
  978. /**
  979. * Set the pre-execute callback for this component.
  980. * @param (rave['library']['internal']['ComponentCallback']) callback The callback
  981. */
  982. /** @expose */
  983. setPreExecute : function(callback) {
  984. this._preExecuteCallback = callback;
  985. return this;
  986. },
  987. /**
  988. * If the pre-execute component is non-null, call it with this object. Note that this object must also implement BundleComponent.
  989. */
  990. /** @expose */
  991. preExecute : function() {
  992. if (this._preExecuteCallback) {
  993. this._preExecuteCallback(this);
  994. }
  995. },
  996. /**
  997. * Set the render callback for this component.
  998. * @param (rave['internal']['RunFunction']) callback The callback
  999. */
  1000. /** @expose */
  1001. setRenderCallback : function(callback) {
  1002. this._renderCallback = callback;
  1003. return this;
  1004. },
  1005. /**
  1006. * 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.
  1007. */
  1008. /** @expose */
  1009. type : function() {},
  1010. /** @expose */
  1011. updateBorder : function(s, borderWidth, borderColor) {
  1012. if (borderWidth != null) {
  1013. s.each(function(data, index, groupIndex) {
  1014. if (!((this.rave_getProperty("selected"))) && !((this.rave_getProperty("highlighted")))) {
  1015. this.rave_setStyle("stroke-width", borderWidth, "");
  1016. }
  1017. });
  1018. }
  1019. if (borderColor != null) {
  1020. s.each(function(data, index, groupIndex) {
  1021. if (!((this.rave_getProperty("selected"))) && !((this.rave_getProperty("highlighted")))) {
  1022. this.rave_setStyle("stroke", borderColor, "");
  1023. }
  1024. });
  1025. }
  1026. },
  1027. /** @expose */
  1028. getDefaultLabelColor : function(_labelStyle) {
  1029. if (!_labelStyle) {
  1030. return "#000000";
  1031. }
  1032. var defaultFillColor;
  1033. if (_labelStyle) {
  1034. defaultFillColor = _labelStyle["fill"];
  1035. if (defaultFillColor == null) {
  1036. defaultFillColor = _labelStyle["color"];
  1037. }
  1038. }
  1039. if (defaultFillColor == null) {
  1040. defaultFillColor = "#000000";
  1041. }
  1042. return defaultFillColor.toString();
  1043. }
  1044. });
  1045. // $source: com/ibm/rave/bundles/component/BackgroundComponent
  1046. /************************************************************************
  1047. ** IBM Confidential
  1048. **
  1049. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1050. **
  1051. ** (C) Copyright IBM Corp. 2017
  1052. **
  1053. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1054. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1055. ************************************************************************/
  1056. // GENERATED
  1057. /**
  1058. * <p> A component that renders the background to the chart. The {@link #this.type()} method returns "BackgroundComponent". </p>
  1059. */
  1060. var com_ibm_rave_bundles_component_BackgroundComponent = rave['internal']['Declare'].implement(
  1061. /**
  1062. * Get the background color.
  1063. * @return (String) The background color
  1064. */
  1065. //backgroundColor : function() {},
  1066. /**
  1067. * Set the background color. If the color is null, white is used.
  1068. * @param (String) backgroundColor The new background color
  1069. * @return (com.ibm.rave.bundles.component.BackgroundComponent) This object
  1070. */
  1071. //backgroundColor : function(backgroundColor) {}
  1072. );
  1073. /**
  1074. * The string returned by {@link #this.type()} is "BackgroundComponent".
  1075. */
  1076. /** @expose */
  1077. com_ibm_rave_bundles_component_BackgroundComponent.COMPONENT_TYPE = "BackgroundComponent";
  1078. // $source: com/ibm/rave/bundles/component/ChartLayoutComponent
  1079. /************************************************************************
  1080. ** IBM Confidential
  1081. **
  1082. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1083. **
  1084. ** (C) Copyright IBM Corp. 2017
  1085. **
  1086. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1087. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1088. ************************************************************************/
  1089. // GENERATED
  1090. /**
  1091. * <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>
  1092. */
  1093. var com_ibm_rave_bundles_component_ChartLayoutComponent = rave['internal']['Declare'].implement(
  1094. //padding : function() {},
  1095. //topPadding : function() {},
  1096. //leftPadding : function() {},
  1097. //bottomPadding : function() {},
  1098. //rightPadding : function() {},
  1099. //legendChartAlign : function() {},
  1100. //legendPosition : function() {},
  1101. //legendChartGap : function() {},
  1102. //legendPosition : function(position) {},
  1103. //topPadding : function(value) {},
  1104. //leftPadding : function(value) {},
  1105. //bottomPadding : function(value) {},
  1106. //rightPadding : function(value) {},
  1107. /**
  1108. * Sets the padding around the outside of the chart/legend.
  1109. * @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.
  1110. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1111. */
  1112. //padding : function(value) {},
  1113. /**
  1114. * Sets all chart paddings. Null values are treated as 0.
  1115. * @param (Object) top New top padding
  1116. * @param (Object) left New left padding
  1117. * @param (Object) bottom New bottom padding
  1118. * @param (Object) right New right padding
  1119. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1120. * @deprecated Please use {@link #this.padding(Object)} and {@link #this.legendChartGap(Object)}
  1121. */
  1122. //chartPadding : function(top, left, bottom, right) {},
  1123. /**
  1124. * Sets whether the legend should align with the chart "body".
  1125. * @param (boolean) legendChartAlign the boolean state
  1126. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1127. */
  1128. //legendChartAlign : function(legendChartAlign) {},
  1129. /**
  1130. * Set the space for the gap between chart and legend
  1131. * @param (Object) value the gap distance (css length)
  1132. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1133. */
  1134. //legendChartGap : function(value) {},
  1135. /**
  1136. * Set the size information for the legend. Null value is treated as no visible legend.
  1137. * @param (com.ibm.rave.bundles.component.ChartLayoutSizable) sizable An object that implements the ChartLayoutSizable interface
  1138. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1139. */
  1140. //legendSize : function(sizable) {},
  1141. /**
  1142. * Reset list of axis sizables to 0
  1143. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1144. */
  1145. //removeAxisSizables : function() {},
  1146. /**
  1147. * Add an axis to be considered in layout operation.
  1148. * @param (com.ibm.rave.bundles.component.ChartLayoutSizable) sizable An object that implements the ChartLayoutSizable interface
  1149. * @return (com.ibm.rave.bundles.component.ChartLayoutComponent) This object
  1150. */
  1151. //addAxisSizable : function(sizable) {}
  1152. );
  1153. /**
  1154. * The string returned by {@link #this.type()} is "ChartLayoutComponent".
  1155. */
  1156. /** @expose */
  1157. com_ibm_rave_bundles_component_ChartLayoutComponent.COMPONENT_TYPE = "ChartLayoutComponent";
  1158. // $source: com/ibm/rave/bundles/components/LegendsManager
  1159. /************************************************************************
  1160. ** IBM Confidential
  1161. **
  1162. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1163. **
  1164. ** (C) Copyright IBM Corp. 2017
  1165. **
  1166. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1167. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1168. ************************************************************************/
  1169. // GENERATED
  1170. //@import com/ibm/rave/bundles/components/LegendComponentImpl (runtime) // new, orientationOf
  1171. /**
  1172. * <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>
  1173. */
  1174. var com_ibm_rave_bundles_components_LegendsManager = rave['internal']['Declare']({
  1175. /**
  1176. * Bundle context
  1177. */
  1178. //_context : null,
  1179. /**
  1180. * Component used to draw all legends
  1181. */
  1182. //_comp : null,
  1183. /**
  1184. * Global visibility; if false no legends are drawn
  1185. */
  1186. //_visible : null,
  1187. /**
  1188. * Rectangle containing all legends
  1189. */
  1190. //_rectangle : null,
  1191. /**
  1192. * Legend orientation
  1193. */
  1194. //_orient : null,
  1195. /**
  1196. * Pre-execute component callback
  1197. */
  1198. //_preExecute : null,
  1199. /**
  1200. * Selectors for each legend
  1201. */
  1202. //_selectors : null,
  1203. /**
  1204. * Palettes for each legend
  1205. */
  1206. //_palettes : null,
  1207. /**
  1208. * Scale size functions for each legend
  1209. */
  1210. //_scale : null,
  1211. /**
  1212. * Swatch size functions for each legend
  1213. */
  1214. //_swatchSizes : null,
  1215. /**
  1216. * Shapes for each legend
  1217. */
  1218. //_shapes : null,
  1219. /**
  1220. * Titles for each legend
  1221. */
  1222. //_titles : null,
  1223. /**
  1224. * Title fonts for each legend
  1225. */
  1226. //_titleFonts : null,
  1227. /**
  1228. * Title fills for each legend
  1229. */
  1230. //_titleFills : null,
  1231. /**
  1232. * Title font sizes for each legend
  1233. */
  1234. //_titleFontSizes : null,
  1235. /**
  1236. * Title font families for each legend
  1237. */
  1238. //_titleFontFamilies : null,
  1239. /**
  1240. * Entry fonts for each legend
  1241. */
  1242. //_entryFonts : null,
  1243. /**
  1244. * Custom formatters for each legend, created from the registered custom formatters
  1245. */
  1246. //_formatters : null,
  1247. /**
  1248. * Whether each legend was visible in the last draw
  1249. */
  1250. //_lastVisible : null,
  1251. //_dataSlotEntries : null,
  1252. /**
  1253. * Number of legends
  1254. */
  1255. _numLegends : 0,
  1256. /**
  1257. * Whether to use a transition.
  1258. */
  1259. _doTransition : false,
  1260. /**
  1261. * Duration of the transition.
  1262. */
  1263. _duration : 0,
  1264. _spaceUsed : 0,
  1265. /**
  1266. * Construct the manager.
  1267. * @param (int) numLegends Number of legends, must be positive
  1268. */
  1269. /** @expose */
  1270. constructor : function(context, numLegends) {
  1271. this._context = context;
  1272. this._numLegends = numLegends;
  1273. this._comp = new com_ibm_rave_bundles_components_LegendComponentImpl();
  1274. this._rectangle = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1275. this._orient = "vertical";
  1276. this._preExecute = null;
  1277. this._selectors = [];
  1278. this._palettes = [];
  1279. this._scale = [];
  1280. this._swatchSizes = [];
  1281. this._shapes = [];
  1282. this._titles = [];
  1283. this._titleFonts = [];
  1284. this._titleFills = [];
  1285. this._titleFontSizes = [];
  1286. this._titleFontFamilies = [];
  1287. this._entryFonts = [];
  1288. this._formatters = [];
  1289. this._lastVisible = [];
  1290. this._visible = [];
  1291. this._dataSlotEntries = [];
  1292. for (var i = 0; i < this._numLegends; ++i) {
  1293. this._selectors[i] = null;
  1294. this._palettes[i] = null;
  1295. this._swatchSizes[i] = null;
  1296. this._shapes[i] = null;
  1297. this._titles[i] = null;
  1298. this._formatters[i] = null;
  1299. this._lastVisible[i] = false;
  1300. this._visible[i] = true;
  1301. }
  1302. },
  1303. /**
  1304. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) The legend component used by this manager; for unit tests
  1305. */
  1306. getLegendComponent : function() {
  1307. return this._comp;
  1308. },
  1309. /**
  1310. * Set a specific legend visible
  1311. * @param (int) legendIndex The index of the legend
  1312. * @param (boolean) visible New value of visible flag
  1313. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1314. */
  1315. visible$0 : function(legendIndex, visible) {
  1316. if (legendIndex < this._visible.length) {
  1317. this._visible[legendIndex] = visible;
  1318. }
  1319. return this;
  1320. },
  1321. /**
  1322. * Set all legend visible
  1323. * @param (boolean) visible New value of visible flag
  1324. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1325. */
  1326. visible$1 : function(visible) {
  1327. for (var i = 0; i < this._visible.length; ++i) {
  1328. this._visible[i] = visible;
  1329. }
  1330. return this;
  1331. },
  1332. /**
  1333. * Set the layout rectangle. The rectangle is copied. If it is null, the layout rectangle is unchanged.
  1334. * @param (rave['internal']['RectStruct']) rect New layout rectangle
  1335. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1336. */
  1337. /** @expose */
  1338. rectangle : function(rect) {
  1339. if (rect) {
  1340. this._rectangle = new rave['internal']['RectStruct'](rect.x, rect.y, rect.width, rect.height);
  1341. }
  1342. return this;
  1343. },
  1344. /**
  1345. * Set the orient property. If the argument is not "horizontal" or "vertical", the orient property is not changed.
  1346. * @param (String) orient New orient
  1347. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1348. */
  1349. /** @expose */
  1350. orient : function(orient) {
  1351. if ("horizontal" == orient || "vertical" == orient) {
  1352. this._orient = orient;
  1353. }
  1354. return this;
  1355. },
  1356. /**
  1357. * 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".
  1358. * @param (String) position Legend position
  1359. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1360. */
  1361. /** @expose */
  1362. position : function(position) {
  1363. return this.orient(com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf(position));
  1364. },
  1365. /**
  1366. * Set the transition information. If the duration is negative, 0 is used.
  1367. * @param (boolean) doTransition Whether to do a transition
  1368. * @param (int) duration Duration of the transition when used
  1369. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1370. */
  1371. /** @expose */
  1372. transition : function(doTransition, duration) {
  1373. this._doTransition = doTransition;
  1374. this._duration = (duration >= 0) ? duration : 0;
  1375. return this;
  1376. },
  1377. /**
  1378. * Set the pre-execute callback for all legends. The callback may be null.
  1379. * @param (rave['library']['internal']['ComponentCallback']) callback The callback
  1380. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1381. */
  1382. /** @expose */
  1383. setPreExecute : function(callback) {
  1384. this._preExecute = callback;
  1385. return this;
  1386. },
  1387. /**
  1388. * Set the selector to be used when rendering a legend. If the index is out of range no selectors change.
  1389. * @param (int) index Legend array index
  1390. * @param (rave['internal']['Selector']) selector Selector, may be null (but this is not advisable)
  1391. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1392. */
  1393. /** @expose */
  1394. selector : function(index, selector) {
  1395. if (index >= 0 && index < this._numLegends) {
  1396. this._selectors[index] = selector;
  1397. }
  1398. return this;
  1399. },
  1400. /**
  1401. * Set the palette of a legend. If the index is out of range no information is changed.
  1402. * @param (int) index Legend array index
  1403. * @param (rave['library']['internal']['Palette']) palette Palette, may be null
  1404. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1405. */
  1406. /** @expose */
  1407. palette : function(index, palette) {
  1408. if (index >= 0 && index < this._numLegends) {
  1409. this._palettes[index] = palette;
  1410. }
  1411. return this;
  1412. },
  1413. /**
  1414. * Set the shape of a legend. If the index is out of range no information is changed.
  1415. * @param (int) index Legend array index
  1416. * @param (String) shape Shape, may be null (defaulting to square)
  1417. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1418. */
  1419. /** @expose */
  1420. shape : function(index, shape) {
  1421. if (index >= 0 && index < this._numLegends) {
  1422. this._shapes[index] = shape;
  1423. }
  1424. return this;
  1425. },
  1426. /**
  1427. * Set the title of a legend. If the index is out of range no information is changed.
  1428. * @param (int) index Legend array index
  1429. * @param (String) title Title, may be null
  1430. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1431. */
  1432. /** @expose */
  1433. title : function(index, title) {
  1434. if (index >= 0 && index < this._numLegends) {
  1435. this._titles[index] = title;
  1436. }
  1437. return this;
  1438. },
  1439. /**
  1440. * Set the title font style of a legend. If the index is out of range no information is changed.
  1441. * @param (int) index Legend array index
  1442. * @param (String) titleFont Title font string, may be null
  1443. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1444. */
  1445. /** @expose */
  1446. titleFont : function(index, titleFont) {
  1447. if (index >= 0 && index < this._numLegends) {
  1448. this._titleFonts[index] = titleFont;
  1449. }
  1450. return this;
  1451. },
  1452. /**
  1453. * Set the entry font style of a legend. If the index is out of range no information is changed.
  1454. * @param (int) index Legend array index
  1455. * @param (String) entryFont Entry font string, may be null
  1456. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1457. */
  1458. /** @expose */
  1459. entryFont : function(index, entryFont) {
  1460. if (index >= 0 && index < this._numLegends) {
  1461. this._entryFonts[index] = entryFont;
  1462. }
  1463. return this;
  1464. },
  1465. /**
  1466. * Set the title fill of a legend. If the index is out of range no information is changed.
  1467. * @param (int) index Legend array index
  1468. * @param (String) titleFill Fill color string, may be null
  1469. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1470. */
  1471. /** @expose */
  1472. titleFill : function(index, titleFill) {
  1473. if (index >= 0 && index < this._numLegends) {
  1474. this._titleFills[index] = titleFill;
  1475. }
  1476. return this;
  1477. },
  1478. /**
  1479. * Set the title font size of a legend. If the index is out of range no information is changed.
  1480. * @param (int) index Legend array index
  1481. * @param (String) titleFontSize Font size string, may be null
  1482. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1483. */
  1484. /** @expose */
  1485. titleFontSize : function(index, titleFontSize) {
  1486. if (index >= 0 && index < this._numLegends) {
  1487. this._titleFontSizes[index] = titleFontSize;
  1488. }
  1489. return this;
  1490. },
  1491. /**
  1492. * Set the title font family of a legend. If the index is out of range no information is changed.
  1493. * @param (int) index Legend array index
  1494. * @param (String) titleFontFamily Font family string, may be null
  1495. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1496. */
  1497. /** @expose */
  1498. titleFontFamily : function(index, titleFontFamily) {
  1499. if (index >= 0 && index < this._numLegends) {
  1500. this._titleFontFamilies[index] = titleFontFamily;
  1501. }
  1502. return this;
  1503. },
  1504. /**
  1505. * Set the scale of a legend. If the index is out of range no information is changed.
  1506. * @param (int) index Legend array index
  1507. * @param (rave['internal']['AbstractScale']) scale Scale, may be null
  1508. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1509. */
  1510. /** @expose */
  1511. scale : function(index, scale) {
  1512. if (index >= 0 && index < this._numLegends) {
  1513. this._scale[index] = scale;
  1514. }
  1515. return this;
  1516. },
  1517. /**
  1518. * Set the swatch size function of a legend. If the index is out of range no information is changed.
  1519. * @param (int) index Legend array index
  1520. * @param (rave['internal']['ValueFunction']) swatchSize Swatch size function, may be null
  1521. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1522. */
  1523. /** @expose */
  1524. swatchSize : function(index, swatchSize) {
  1525. if (index >= 0 && index < this._numLegends) {
  1526. this._swatchSizes[index] = swatchSize;
  1527. }
  1528. return this;
  1529. },
  1530. /**
  1531. * 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.
  1532. * @param (int) index Legend array index
  1533. * @param (Array) entries List of data slot entries, if null an empty list is used
  1534. * @param (String) format One of {@link this.CustomFormatInfo#"none"} or {@link this.CustomFormatInfo#"percent"}
  1535. * @param (rave['internal']['ValueFunction']) defaultFunction Default function to use if no custom formatter is defined, may be null
  1536. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1537. */
  1538. /** @expose */
  1539. formatterList : function(index, entries, format, defaultFunction) {
  1540. if (index >= 0 && index < this._numLegends) {
  1541. this._formatters[index] = this._context.getCustomFormatterWithFlag(["legend", "all"], rave['library']['internal']['BundleContext'].makeCustomFormatInfo("legend-label", "ROLE_NONE", format, entries), defaultFunction, false);
  1542. }
  1543. return this;
  1544. },
  1545. /**
  1546. * 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.
  1547. * @param (int) index Legend array index
  1548. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  1549. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1550. */
  1551. /** @expose */
  1552. formatter : function(index, entry) {
  1553. var entries = [];
  1554. if (entry) {
  1555. entries.push(entry);
  1556. }
  1557. return this.formatterList(index, entries, "none", null);
  1558. },
  1559. /**
  1560. * 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.
  1561. * @return (boolean) Whether any legend are visible (will be drawn)
  1562. */
  1563. /** @expose */
  1564. anyVisible : function() {
  1565. for (var i = 0; i < this._numLegends; ++i) {
  1566. if (this._visible[i] == true && (this._palettes[i] || this._swatchSizes[i])) {
  1567. return true;
  1568. }
  1569. }
  1570. return false;
  1571. },
  1572. /**
  1573. * 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'])} .
  1574. * @param (int) index Legend array index
  1575. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  1576. * @return (com.ibm.rave.bundles.components.LegendsManager) This LegendsManager
  1577. */
  1578. /** @expose */
  1579. setDataSlot : function(index, entry) {
  1580. if (index >= 0 && index < this._numLegends) {
  1581. this._dataSlotEntries[index] = entry;
  1582. }
  1583. return this.formatter(index, entry);
  1584. },
  1585. preLayout$0 : function(layoutComponent) {
  1586. this.preLayout$1(layoutComponent, true);
  1587. return this;
  1588. },
  1589. preLayout$1 : function(layoutComponent, axesBeforeLegend) {
  1590. var layoutTransition = this._doTransition;
  1591. var layoutDuration = this._duration;
  1592. this._doTransition = false;
  1593. this._duration = 0;
  1594. var children = [];
  1595. for (var i = 0; i < this._numLegends; ++i) {
  1596. children[i] = "g.layoutLegend-" + i;
  1597. }
  1598. rave['library']['internal']['AbstractView'].createGroupStructure(this._context.node.select("g.legends-layout"), children);
  1599. var layoutSelectors = [];
  1600. var layoutLastVisible = [];
  1601. for (var i = 0; i < this._numLegends; ++i) {
  1602. layoutSelectors[i] = this._selectors[i];
  1603. layoutLastVisible[i] = this._lastVisible[i];
  1604. this._lastVisible[i] = false;
  1605. if (this._selectors[i]) {
  1606. this._selectors[i] = this._context.node.select("g.layoutLegend-" + i);
  1607. }
  1608. }
  1609. layoutComponent.preLayout(true, !axesBeforeLegend);
  1610. this.rectangle(layoutComponent.legendRect());
  1611. this.draw();
  1612. this._doTransition = layoutTransition;
  1613. this._duration = layoutDuration;
  1614. this._context.node.select("g.legends-layout").selectAll("*").remove();
  1615. for (var i = 0; i < this._numLegends; ++i) {
  1616. this._lastVisible[i] = layoutLastVisible[i];
  1617. this._selectors[i] = layoutSelectors[i];
  1618. }
  1619. return this;
  1620. },
  1621. /**
  1622. * Render the legends using the current global and per-legend settings.
  1623. * @return (com.ibm.rave.bundles.components.LegendsManager) This object
  1624. */
  1625. /** @expose */
  1626. draw : function() {
  1627. var nVisible = 0;
  1628. for (var i = 0; i < this._numLegends; ++i) {
  1629. if ((this._swatchSizes[i] || this._palettes[i]) && this._visible[i]) {
  1630. nVisible++;
  1631. }
  1632. }
  1633. var x = this._rectangle.x;
  1634. var y = this._rectangle.y;
  1635. var dx;
  1636. var dy;
  1637. var size;
  1638. if (nVisible == 0) {
  1639. dx = 0;
  1640. dy = 0;
  1641. size = [this._rectangle.width, this._rectangle.height];
  1642. } else if ("horizontal" == this._orient) {
  1643. dx = this._rectangle.width / nVisible;
  1644. dy = 0;
  1645. size = [dx, this._rectangle.height];
  1646. } else {
  1647. dx = 0;
  1648. dy = this._rectangle.height / nVisible;
  1649. size = [this._rectangle.width, dy];
  1650. }
  1651. this._comp.orient(this._orient).size(size);
  1652. this._spaceUsed = 0;
  1653. for (var i = 0; i < this._numLegends; ++i) {
  1654. if (this._selectors[i]) {
  1655. var visible = this._visible[i] && (this._palettes[i] || this._swatchSizes[i]);
  1656. 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]);
  1657. var fontStyle = this._context.getPropertyValue("legend.titlestyle.font");
  1658. if (this._titleFonts[i] != null && !(this._titleFonts[i] == "")) {
  1659. this._comp.titleFont(this._titleFonts[i]);
  1660. } else if (fontStyle != null && !(fontStyle == "")) {
  1661. this._comp.titleFont(this._context.getPropertyValue("legend.titlestyle.font"));
  1662. }
  1663. fontStyle = this._context.getPropertyValue("legend.entrystyle.font");
  1664. if (this._entryFonts[i] != null) {
  1665. this._comp.entryFont(this._entryFonts[i]);
  1666. } else if (fontStyle != null && !(fontStyle == "")) {
  1667. this._comp.entryFont(this._context.getPropertyValue("legend.entrystyle.font"));
  1668. }
  1669. var s = (this._doTransition && this._lastVisible[i]) ? this._selectors[i].transition("transition").duration(this._duration) : this._selectors[i];
  1670. s.attr("transform", "translate(" + x + "," + y + ")").call(this._comp);
  1671. var dataSlotEntries = [];
  1672. if (this._dataSlotEntries[i]) {
  1673. dataSlotEntries.push(this._dataSlotEntries[i]);
  1674. }
  1675. this._selectors[i].selectAll(".legendTitle").property("dataSlots", dataSlotEntries);
  1676. if (visible) {
  1677. x += dx;
  1678. y += dy;
  1679. if (this._comp.getSpaceUsed() > this._spaceUsed) {
  1680. this._spaceUsed = this._comp.getSpaceUsed();
  1681. }
  1682. }
  1683. this._lastVisible[i] = visible;
  1684. } else {
  1685. this._lastVisible[i] = false;
  1686. }
  1687. }
  1688. return this;
  1689. },
  1690. /** @expose */
  1691. getSizableType : function() {
  1692. return 2;
  1693. },
  1694. /** @expose */
  1695. getSizableOrientation : function() {
  1696. return this._orient;
  1697. },
  1698. /** @expose */
  1699. getPreferredSize : function() {
  1700. return this._spaceUsed;
  1701. },
  1702. /** @expose */
  1703. getSpillOverSize : function() {
  1704. return 0;
  1705. },
  1706. /** @expose */
  1707. visible : function(a0, a1) {
  1708. var args = arguments;
  1709. if (args.length == 1) {
  1710. return this.visible$1(a0);
  1711. }
  1712. return this.visible$0(a0, a1);
  1713. },
  1714. /** @expose */
  1715. preLayout : function(a0, a1) {
  1716. var args = arguments;
  1717. if (args.length == 1) {
  1718. return this.preLayout$0(a0);
  1719. }
  1720. return this.preLayout$1(a0, a1);
  1721. }
  1722. });
  1723. // $source: com/ibm/rave/bundles/utilities/FontPropertyParser
  1724. /************************************************************************
  1725. ** IBM Confidential
  1726. **
  1727. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1728. **
  1729. ** (C) Copyright IBM Corp. 2017
  1730. **
  1731. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1732. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1733. ************************************************************************/
  1734. // GENERATED
  1735. var com_ibm_rave_bundles_utilities_FontPropertyParser = rave['internal']['Declare']({
  1736. });
  1737. /**
  1738. * Method to parse the css font styles and return a style map.
  1739. * @param (String) fontStyle CSS string (eg. "font-family: courier; font-size: 22; fill: red")
  1740. * @return (Object) Font Style Map
  1741. */
  1742. /** @expose */
  1743. com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont = function(fontStyle) {
  1744. if (fontStyle != null && fontStyle.length > 0) {
  1745. var properties = fontStyle.split(new RegExp(";"));
  1746. var fontStyles = {};
  1747. for (var __i_enFor0 = 0, __len_enFor0 = properties.length;
  1748. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  1749. var property = properties[__i_enFor0];
  1750. var fontMap = property.split(new RegExp(":"));
  1751. if (fontMap.length == 2) {
  1752. var key = fontMap[0].trim();
  1753. fontStyles[key == "color" ? "fill" : key] = fontMap[1].trim();
  1754. }
  1755. }
  1756. return fontStyles;
  1757. }
  1758. return null;
  1759. };
  1760. // $source: com/ibm/rave/bundles/components/AxesManager
  1761. /************************************************************************
  1762. ** IBM Confidential
  1763. **
  1764. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  1765. **
  1766. ** (C) Copyright IBM Corp. 2018
  1767. **
  1768. ** The source code for this program is not published or otherwise divested of its trade secrets,
  1769. ** irrespective of what has been deposited with the U.S. Copyright Office.
  1770. ************************************************************************/
  1771. // GENERATED
  1772. //@import com/ibm/rave/bundles/components/AxisComponentImpl (runtime) // new, getTranslation
  1773. //@import com/ibm/rave/bundles/components/GridComponentImpl (runtime) // new
  1774. //@import com/ibm/rave/bundles/components/ClipPathComponentImpl (runtime) // new
  1775. /**
  1776. * <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>
  1777. */
  1778. var com_ibm_rave_bundles_components_AxesManager = rave['internal']['Declare']({
  1779. /**
  1780. * Bundle context
  1781. */
  1782. //_context : null,
  1783. /**
  1784. * Selector for the bundle defs node. If null, no clip paths will be defined.
  1785. */
  1786. //_defs : null,
  1787. /**
  1788. * Scales for the axes, indexed by X1, X2, Y1, Y2
  1789. */
  1790. //_scales : null,
  1791. /**
  1792. * Whether to suppress labels when panning, indexed by X1, X2, Y1, Y2.
  1793. */
  1794. //_suppressPanLabels : null,
  1795. /**
  1796. * Value of the axis drawAxisLabels, set when axis is drawn, indexed by X1, X2, Y1, Y2.
  1797. */
  1798. //_drawAxisLabels : null,
  1799. /**
  1800. * Axis components created on demand, indexed by X1, X2, Y1, Y2
  1801. */
  1802. //_axisComponents : null,
  1803. /**
  1804. * When last drawn, the selector used for each axis role, indexed by X1, X2, Y1, Y2; used for redraws.
  1805. */
  1806. //_lastAxisDrawSelectors : null,
  1807. /**
  1808. * Grid components created on demand, indexed by X1, X2, Y1, Y2
  1809. */
  1810. //_gridComponents : null,
  1811. /**
  1812. * When last drawn, the selector used for each grid role, indexed by X1, X2, Y1, Y2; used for redraws.
  1813. */
  1814. //_lastGridDrawSelectors : null,
  1815. /**
  1816. * For clearing axis
  1817. */
  1818. //_clearAxis : null,
  1819. /**
  1820. * For clearing grid
  1821. */
  1822. //_clearGrid : null,
  1823. /**
  1824. * Selectors for the axis groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1825. */
  1826. //_axisSelectors : null,
  1827. /**
  1828. * Selectors for the grid groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1829. */
  1830. //_gridSelectors : null,
  1831. /**
  1832. * Bounding rectangles for the axis groups, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1833. */
  1834. //_axisRects : null,
  1835. /**
  1836. * Center elements bounds, also the grid bounds.
  1837. */
  1838. //_elementRect : null,
  1839. /**
  1840. * Whether anything was drawn into the axis group last time, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1841. */
  1842. //_lastAxisDrew : null,
  1843. /**
  1844. * Whether anything was drawn into the grid group last time, indexed by TOP, BOTTOM, LEFT, RIGHT.
  1845. */
  1846. //_lastGridDrew : null,
  1847. //_dataSlotEntries : null,
  1848. //_layoutAxisOrder : null,
  1849. /**
  1850. * On the first draw, no transitions are used.
  1851. */
  1852. _firstDraw : false,
  1853. /**
  1854. * Whether to draw the axes and grids.
  1855. */
  1856. _visible : true,
  1857. /**
  1858. * Transition duration, ms
  1859. */
  1860. _duration : 0,
  1861. /**
  1862. * Transpose the axes (assign X to left/right and Y to top/bottom)
  1863. */
  1864. _transpose : false,
  1865. /**
  1866. * Switch the independent (X) axes, drawing X1 where X2 normally goes and vice-versa
  1867. */
  1868. _swapX : false,
  1869. /**
  1870. * Switch the dependent (Y) axes, drawing Y1 where Y2 normally goes and vice-versa
  1871. */
  1872. _swapY : false,
  1873. _layoutInProgress : false,
  1874. _layoutMaxWidth : 0,
  1875. _layoutMaxHeight : 0,
  1876. _xPadding : 0, _xOuterPadding : 0, _yPadding : 0, _yOuterPadding : 0,
  1877. _xPixelPad : 0, _yPixelPad : 0,
  1878. /**
  1879. * Hack to allow heatmap in "unit cell" mode to disable stagger because of the post scaling that messes up axis layout
  1880. */
  1881. _preventStaggerRotate45 : false,
  1882. constructor : function(context) {
  1883. this._scales = [];
  1884. this._suppressPanLabels = [];
  1885. this._drawAxisLabels = [];
  1886. this._axisComponents = [];
  1887. this._lastAxisDrawSelectors = [];
  1888. this._gridComponents = [];
  1889. this._lastGridDrawSelectors = [];
  1890. this._clearAxis = new com_ibm_rave_bundles_components_AxisComponentImpl();
  1891. this._clearGrid = new com_ibm_rave_bundles_components_GridComponentImpl();
  1892. this._axisSelectors = [];
  1893. this._gridSelectors = [];
  1894. this._axisRects = [];
  1895. this._elementRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1896. this._lastAxisDrew = [];
  1897. this._lastGridDrew = [];
  1898. this._dataSlotEntries = [];
  1899. this._layoutAxisOrder = [];
  1900. /**
  1901. * Construct and initialize. No axis scales or selector groups are defined.
  1902. * @param (rave['library']['internal']['BundleContext']) context The bundle context
  1903. */
  1904. {
  1905. this._context = context;
  1906. for (var i = 0; i < 4; ++i) {
  1907. this._scales[i] = null;
  1908. this._suppressPanLabels[i] = false;
  1909. this._axisComponents[i] = null;
  1910. this._lastAxisDrawSelectors[i] = null;
  1911. this._gridComponents[i] = null;
  1912. this._lastGridDrawSelectors[i] = null;
  1913. this._axisSelectors[i] = null;
  1914. this._gridSelectors[i] = null;
  1915. this._axisRects[i] = new rave['internal']['RectStruct'](0, 0, 0, 0);
  1916. this._lastAxisDrew[i] = false;
  1917. this._lastGridDrew[i] = false;
  1918. this._dataSlotEntries[i] = [];
  1919. }
  1920. }
  1921. },
  1922. /** @expose */
  1923. preLayout : function(layoutComponent, axesBeforeLegend, xPadding, xOuterPadding, xPixelPad, yPadding, yOuterPadding, yPixelPad) {
  1924. this._xPadding = xPadding;
  1925. this._xOuterPadding = xOuterPadding;
  1926. this._xPixelPad = xPixelPad;
  1927. this._yPadding = yPadding;
  1928. this._yOuterPadding = yOuterPadding;
  1929. this._yPixelPad = yPixelPad;
  1930. this._layoutInProgress = true;
  1931. var layoutDuration = this._duration;
  1932. this._duration = 0;
  1933. 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"];
  1934. rave['library']['internal']['AbstractView'].createGroupStructure(this._context.node.select("g.axes-layout"), children);
  1935. var layoutAxisSelectors = [];
  1936. var layoutGridSelectors = [];
  1937. var layoutLastAxisDrew = [];
  1938. for (var position = 0; position < 4; ++position) {
  1939. if (this._axisComponents[position]) {
  1940. this._axisComponents[position].preLayout();
  1941. }
  1942. layoutAxisSelectors[position] = this._axisSelectors[position];
  1943. layoutGridSelectors[position] = this._gridSelectors[position];
  1944. layoutLastAxisDrew[position] = this._lastAxisDrew[position];
  1945. if (this._axisSelectors[position]) {
  1946. this.axisSelector(position, this._context.node.select("g.layoutAxis-" + com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position]));
  1947. }
  1948. if (this._gridSelectors[position]) {
  1949. this.gridSelector(position, this._context.node.select("g.layoutGrid-" + com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position]));
  1950. }
  1951. }
  1952. layoutComponent.preLayout(axesBeforeLegend, true);
  1953. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, layoutComponent.elementRect());
  1954. var countHorz = 0;
  1955. var countVert = 0;
  1956. var axes = [];
  1957. for (var position = 0; position < 4; ++position) {
  1958. var role = this.positionToRole(position);
  1959. var isHorz = position == 1 || position == 0;
  1960. if (this._axisSelectors[position] && this._scales[role]) {
  1961. if (isHorz) {
  1962. countHorz++;
  1963. } else {
  1964. countVert++;
  1965. }
  1966. if (this._scales[role].isOrdinal() || this._scales[role].isClustered()) {
  1967. var score = isHorz ? 4 : 2;
  1968. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, score));
  1969. } else {
  1970. var score = isHorz ? 3 : 1;
  1971. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, score));
  1972. }
  1973. } else {
  1974. axes.push(new com_ibm_rave_bundles_components_AxesManager.AxisLayout(position, 5));
  1975. }
  1976. }
  1977. axes.sort(function(a1, a2) {
  1978. var a1value = a1.score;
  1979. var a2value = a2.score;
  1980. return a1value < a2value ? -1 : a1value > a2value ? 1 : 0;
  1981. });
  1982. this._layoutAxisOrder = [];
  1983. for (var i = 0; i < 4; ++i) {
  1984. this._layoutAxisOrder[i] = axes[i].position;
  1985. }
  1986. this._layoutMaxWidth = this._elementRect.width * (countVert > 1 ? 0.5 : 0.4);
  1987. this._layoutMaxHeight = this._elementRect.height * (countHorz > 1 ? 0.5 : 0.4);
  1988. for (var index = 0; index < 4; ++index) {
  1989. var position = this._layoutAxisOrder[index];
  1990. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[position], this._elementRect);
  1991. }
  1992. this.draw();
  1993. this._duration = layoutDuration;
  1994. this._context.node.select("g.axes-layout").selectAll("*").remove();
  1995. for (var position = 0; position < 4; ++position) {
  1996. this._lastAxisDrew[position] = layoutLastAxisDrew[position];
  1997. this._axisSelectors[position] = layoutAxisSelectors[position];
  1998. this._gridSelectors[position] = layoutGridSelectors[position];
  1999. }
  2000. this._layoutInProgress = false;
  2001. return this;
  2002. },
  2003. getPositionToDraw : function(index) {
  2004. return this._layoutInProgress ? this._layoutAxisOrder[index] : index;
  2005. },
  2006. preDrawAxis : function(index) {
  2007. if (this._layoutInProgress) {
  2008. var position = this._layoutAxisOrder[index];
  2009. var role = this.positionToRole(position);
  2010. if (role == 0 || role == 1) {
  2011. this.setScaleRangePadded(this._scales[role], false, this._xPadding, this._xOuterPadding, this._xPixelPad);
  2012. } else {
  2013. this.setScaleRangePadded(this._scales[role], true, this._yPadding, this._yOuterPadding, this._yPixelPad);
  2014. }
  2015. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(true);
  2016. }
  2017. },
  2018. postDrawAxis : function(index) {
  2019. if (this._layoutInProgress) {
  2020. var position = this._layoutAxisOrder[index];
  2021. var role = this.positionToRole(position);
  2022. var axis = this._axisComponents[role];
  2023. var size = axis.getPreferredSize();
  2024. if (position == 1 || position == 0) {
  2025. if (size > this._layoutMaxHeight) {
  2026. size = this._layoutMaxHeight;
  2027. }
  2028. this._elementRect.height -= size;
  2029. if (position == 1) {
  2030. this._elementRect.y += size;
  2031. }
  2032. } else {
  2033. if (size > this._layoutMaxWidth) {
  2034. size = this._layoutMaxWidth;
  2035. }
  2036. this._elementRect.width -= size;
  2037. if (position == 2) {
  2038. this._elementRect.x += size;
  2039. }
  2040. }
  2041. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(false);
  2042. }
  2043. },
  2044. /**
  2045. * 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.
  2046. */
  2047. /** @expose */
  2048. draw : function() {
  2049. for (var role = 0; role < 4; ++role) {
  2050. this._lastAxisDrawSelectors[role] = null;
  2051. this._lastGridDrawSelectors[role] = null;
  2052. }
  2053. for (var index = 0; index < 4; ++index) {
  2054. var position = this.getPositionToDraw(index);
  2055. var role = this.positionToRole(position);
  2056. if (!this._visible || !this._axisSelectors[position] || !this._scales[role]) {
  2057. this.clearAxis(position);
  2058. this.clearGrid(position);
  2059. } else {
  2060. this.preDrawAxis(index);
  2061. this.drawAxis(position, role);
  2062. this.postDrawAxis(index);
  2063. if (this._gridSelectors[position]) {
  2064. this.drawGrid(position, role);
  2065. }
  2066. }
  2067. }
  2068. this._firstDraw = false;
  2069. },
  2070. /**
  2071. * @return (boolean) true if we are hiding any labels during pan-zoom.
  2072. */
  2073. /** @expose */
  2074. hideAnyPanZoom : function() {
  2075. return (this._suppressPanLabels[0] || this._suppressPanLabels[1] || this._suppressPanLabels[2] || this._suppressPanLabels[3]);
  2076. },
  2077. /**
  2078. * 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.
  2079. * @param (boolean) panning Whether this is a pan in-progress; use false otherwise including when pan-zoom ends.
  2080. */
  2081. /** @expose */
  2082. redraw : function(panning) {
  2083. for (var role = 0; role < 4; ++role) {
  2084. if (this._axisComponents[role] && this._lastAxisDrawSelectors[role]) {
  2085. this._axisComponents[role].displayTickLabels(this._drawAxisLabels[role]);
  2086. this._axisComponents[role].showPanZoomTickLabels(!panning || !this._suppressPanLabels[role]);
  2087. var isAllow = this._axisComponents[role].isAllowAutomaticAxisLayoutToChangeOrientation();
  2088. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(false);
  2089. this._lastAxisDrawSelectors[role].call(this._axisComponents[role]);
  2090. this._axisComponents[role].allowAutomaticAxisLayoutToChangeOrientation(isAllow);
  2091. }
  2092. if (this._gridComponents[role] && this._lastGridDrawSelectors[role]) {
  2093. this._lastGridDrawSelectors[role].call(this._gridComponents[role]);
  2094. }
  2095. }
  2096. },
  2097. /** @expose */
  2098. preventStaggerRotate45 : function(preventStaggerRotate45) {
  2099. this._preventStaggerRotate45 = preventStaggerRotate45;
  2100. },
  2101. /**
  2102. * 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.
  2103. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2104. * @param (int) role The axis role, X1, X2, Y1, or Y2
  2105. */
  2106. drawAxis : function(position, role) {
  2107. var axisGroup = this._axisSelectors[position];
  2108. this._lastAxisDrawSelectors[role] = axisGroup;
  2109. var comp = this.axisComponent(role);
  2110. var layoutModeID = role == 2 ? "axis.y.labels.layoutMode" : role == 3 ? "axis.y2.labels.layoutMode" : "axis.x.labels.layoutMode";
  2111. var allowStaggerID = role == 2 ? "axis.y.labels.allowStagger" : role == 3 ? "axis.y2.labels.allowStagger" : "axis.x.labels.allowStagger";
  2112. var allowRotate45ID = role == 2 ? "axis.y.labels.allowRotate45" : role == 3 ? "axis.y2.labels.allowRotate45" : "axis.x.labels.allowRotate45";
  2113. var allowRotate90ID = role == 2 ? "axis.y.labels.allowRotate90" : role == 3 ? "axis.y2.labels.allowRotate90" : "axis.x.labels.allowRotate90";
  2114. var layoutMode = ""+(this._context.getPropertyValue(layoutModeID));
  2115. var allowStagger = !this._preventStaggerRotate45 && (this._context.getPropertyValue(allowStaggerID));
  2116. var allowRotate45 = !this._preventStaggerRotate45 && (this._context.getPropertyValue(allowRotate45ID));
  2117. var allowRotate90 = (this._context.getPropertyValue(allowRotate90ID));
  2118. var textTruncateIndicator = (this._context.getPropertyValue("axis.labels.truncationText"));
  2119. var axisBounds = this._axisRects[position];
  2120. var orient = com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position];
  2121. var transform = com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation(axisBounds, orient);
  2122. var axisTransform = "translate(" + transform[0] + "," + transform[1] + ")";
  2123. 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);
  2124. this._drawAxisLabels[role] = comp._displayTickLabels;
  2125. var axisGroupUpdate = axisGroup;
  2126. if (this._duration > 0 && !this._firstDraw && this._lastAxisDrew[position]) {
  2127. axisGroupUpdate = axisGroup.transition().duration(this._duration);
  2128. }
  2129. axisGroupUpdate.attr("transform", axisTransform);
  2130. axisGroupUpdate.call(comp);
  2131. var dataSlotEntryList = this._dataSlotEntries[role];
  2132. axisGroup.selectAll(".axis-title").property("dataSlots", dataSlotEntryList);
  2133. this._lastAxisDrew[position] = comp.renderedShapes();
  2134. if (this._defs) {
  2135. var clipAxis = new com_ibm_rave_bundles_components_ClipPathComponentImpl(this._context.instanceId() + "clip" + orient);
  2136. var text = axisGroup.append("text").text("000,000");
  2137. var bbox = text.node().getBBox();
  2138. var w = bbox.width;
  2139. var h = bbox.height;
  2140. text.remove();
  2141. var clipRect;
  2142. if (position == 0 || position == 1) {
  2143. var leftEdge = axisBounds.x + transform[0] * -1;
  2144. var rightEdge = leftEdge + axisBounds.width;
  2145. if (!(this._scales[role].isOrdinal()) && !(this._scales[role].isClustered())) {
  2146. var numericLeftEdge = this._elementRect.x - w + transform[0] * -1;
  2147. var numericRightEdge = numericLeftEdge + this._elementRect.width + w * 2;
  2148. if (numericLeftEdge < leftEdge) {
  2149. leftEdge = numericLeftEdge;
  2150. }
  2151. if (numericRightEdge > rightEdge) {
  2152. rightEdge = numericRightEdge;
  2153. }
  2154. }
  2155. clipRect = new rave['internal']['RectStruct'](leftEdge, axisBounds.y + transform[1] * -1, rightEdge - leftEdge, axisBounds.height);
  2156. } else {
  2157. clipRect = new rave['internal']['RectStruct'](axisBounds.x + transform[0] * -1, this._elementRect.y - h / 2 + transform[1] * -1, axisBounds.width, this._elementRect.height + h);
  2158. }
  2159. clipAxis.clipRect(clipRect).applyTo(axisGroup.select(".axis." + orient)).call(this._defs);
  2160. }
  2161. },
  2162. /**
  2163. * If the axis selector for the position is defined, clear the shapes from the axis group.
  2164. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2165. */
  2166. clearAxis : function(position) {
  2167. if (this._axisSelectors[position]) {
  2168. this._clearAxis.scale(null);
  2169. this._axisSelectors[position].call(this._clearAxis);
  2170. }
  2171. this._lastAxisDrew[position] = false;
  2172. },
  2173. /**
  2174. * 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.
  2175. * @param (int) position The axis position, BOTTOM, TOP, LEFT, RIGHT
  2176. * @param (int) role The axis role, X1, X2, Y1, or Y2
  2177. */
  2178. drawGrid : function(position, role) {
  2179. var gridGroup = this._gridSelectors[position];
  2180. this._lastGridDrawSelectors[role] = gridGroup;
  2181. var comp = this.gridComponent(role);
  2182. var axisBounds = this._axisRects[position];
  2183. var orient = com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS[position];
  2184. var transform = com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation(axisBounds, orient);
  2185. var axisTransform = "translate(" + transform[0] + "," + transform[1] + ")";
  2186. comp.setRole(com_ibm_rave_bundles_components_AxesManager.ROLES[role]).orient(orient).setPreExecute(this._context.getPreExecute()).bounds(this._elementRect).axis(this._axisComponents[role].axis());
  2187. if (this._duration <= 0 || this._firstDraw || !this._lastAxisDrew[position]) {
  2188. gridGroup.attr("transform", axisTransform).call(comp);
  2189. } else {
  2190. gridGroup.transition().duration(this._duration).attr("transform", axisTransform).call(comp);
  2191. }
  2192. this._lastGridDrew[position] = comp.renderedShapes();
  2193. },
  2194. /**
  2195. * If the grid selector for the position is defined, clear the shapes from the grid group.
  2196. * @param (int) position The grid position, BOTTOM, TOP, LEFT, RIGHT
  2197. */
  2198. clearGrid : function(position) {
  2199. if (this._gridSelectors[position]) {
  2200. this._clearGrid.axis(null);
  2201. this._gridSelectors[position].call(this._clearGrid);
  2202. }
  2203. this._lastGridDrew[position] = false;
  2204. },
  2205. /**
  2206. * @param (boolean) visible Whether the manager should draw axes
  2207. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2208. */
  2209. /** @expose */
  2210. visible : function(visible) {
  2211. this._visible = visible;
  2212. return this;
  2213. },
  2214. /**
  2215. * @param (int) duration The transition duration; if <= 0, no transition is used.
  2216. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2217. */
  2218. /** @expose */
  2219. duration : function(duration) {
  2220. this._duration = duration;
  2221. return this;
  2222. },
  2223. /**
  2224. * @param (boolean) transpose Whether to transpose the chart (switch the positions of the X and Y axis)
  2225. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2226. */
  2227. /** @expose */
  2228. transpose : function(transpose) {
  2229. this._transpose = transpose;
  2230. return this;
  2231. },
  2232. /**
  2233. * @param (boolean) swapX Whether to switch the postitions of the X1 and X2 axes
  2234. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2235. */
  2236. /** @expose */
  2237. swapX : function(swapX) {
  2238. this._swapX = swapX;
  2239. return this;
  2240. },
  2241. /**
  2242. * @param (boolean) swapY Whether to switch the postitions of the Y1 and Y2 axes
  2243. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2244. */
  2245. /** @expose */
  2246. swapY : function(swapY) {
  2247. this._swapY = swapY;
  2248. return this;
  2249. },
  2250. /**
  2251. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2252. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale The coordinate scale for that role, may be null
  2253. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2254. */
  2255. /** @expose */
  2256. scale : function(role, scale) {
  2257. this._scales[role] = scale;
  2258. return this;
  2259. },
  2260. /**
  2261. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2262. * @param (boolean) suppressLabels Whether to suppress the labels when panning the axis
  2263. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2264. */
  2265. /** @expose */
  2266. suppressPanLabels : function(role, suppressLabels) {
  2267. this._suppressPanLabels[role] = suppressLabels;
  2268. return this;
  2269. },
  2270. /**
  2271. * 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.
  2272. * @param (int) role The role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2273. * @return (com.ibm.rave.bundles.components.AxisComponentImpl) The component for the role
  2274. */
  2275. /** @expose */
  2276. axisComponent : function(role) {
  2277. if (!this._axisComponents[role]) {
  2278. this._axisComponents[role] = new com_ibm_rave_bundles_components_AxisComponentImpl();
  2279. }
  2280. return this._axisComponents[role];
  2281. },
  2282. /**
  2283. * 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.
  2284. * @param (int) role The role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2285. * @return (com.ibm.rave.bundles.components.GridComponentImpl) The component for the role
  2286. */
  2287. /** @expose */
  2288. gridComponent : function(role) {
  2289. if (!this._gridComponents[role]) {
  2290. this._gridComponents[role] = new com_ibm_rave_bundles_components_GridComponentImpl();
  2291. }
  2292. return this._gridComponents[role];
  2293. },
  2294. /**
  2295. * Set the bundle &lt;defs&gt; node. Clip paths will be defined in this node.
  2296. * @param (rave['internal']['Selector']) defs The defs node
  2297. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2298. */
  2299. /** @expose */
  2300. defsSelector : function(defs) {
  2301. this._defs = com_ibm_rave_bundles_components_AxesManager.checkSelector(defs);
  2302. return this;
  2303. },
  2304. /**
  2305. * Set the selector for an axis group node.
  2306. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2307. * @param (rave['internal']['Selector']) axisGroup The axis group node, may be null
  2308. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2309. */
  2310. /** @expose */
  2311. axisSelector : function(position, axisGroup) {
  2312. this._axisSelectors[position] = com_ibm_rave_bundles_components_AxesManager.checkSelector(axisGroup);
  2313. return this;
  2314. },
  2315. /**
  2316. * Set the selector for a grid group node.
  2317. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2318. * @param (rave['internal']['Selector']) gridGroup The grid group node, may be null
  2319. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2320. */
  2321. /** @expose */
  2322. gridSelector : function(position, gridGroup) {
  2323. this._gridSelectors[position] = com_ibm_rave_bundles_components_AxesManager.checkSelector(gridGroup);
  2324. return this;
  2325. },
  2326. /**
  2327. * Set the element (grid) bounds rectangle to a copy of the given rectangle.
  2328. * @param (rave['internal']['RectStruct']) elementRect The rectangle, if null the bounds are set to 0,0,0,0
  2329. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2330. */
  2331. /** @expose */
  2332. elementRect : function(elementRect) {
  2333. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, elementRect);
  2334. return this;
  2335. },
  2336. /**
  2337. * Set an axis bounds rectangle to a copy of the given rectangle.
  2338. * @param (int) position The position, one of BOTTOM, TOP, LEFT, RIGHT
  2339. * @param (rave['internal']['RectStruct']) axisRect The axis bounds, if null the bounds are set to 0,0,0,0
  2340. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2341. */
  2342. /** @expose */
  2343. axisRect : function(position, axisRect) {
  2344. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[position], axisRect);
  2345. return this;
  2346. },
  2347. /**
  2348. * 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.
  2349. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2350. */
  2351. /** @expose */
  2352. useDefaultSelectors : function() {
  2353. this.defsSelector(this._context.node.select("defs"));
  2354. this.axisSelector(0, this._context.node.select("g.axisTransform.bottom"));
  2355. this.axisSelector(1, this._context.node.select("g.axisTransform.top"));
  2356. this.axisSelector(2, this._context.node.select("g.axisTransform.left"));
  2357. this.axisSelector(3, this._context.node.select("g.axisTransform.right"));
  2358. this.gridSelector(0, this._context.node.select("g.grid.bottom"));
  2359. this.gridSelector(1, this._context.node.select("g.grid.top"));
  2360. this.gridSelector(2, this._context.node.select("g.grid.left"));
  2361. this.gridSelector(3, this._context.node.select("g.grid.right"));
  2362. return this;
  2363. },
  2364. /**
  2365. * Convenience method: Set the element rectangle and axis rectangles from the rectangles in the layout.
  2366. * @param (com.ibm.rave.bundles.components.ChartLayoutComponentImpl) layoutInfo Layout information
  2367. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2368. */
  2369. /** @expose */
  2370. useBoundsFromLayout : function(layoutInfo) {
  2371. com_ibm_rave_bundles_components_AxesManager.setRect(this._elementRect, layoutInfo.elementRect());
  2372. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[0], layoutInfo.bottomRect());
  2373. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[1], layoutInfo.topRect());
  2374. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[2], layoutInfo.leftRect());
  2375. com_ibm_rave_bundles_components_AxesManager.setRect(this._axisRects[3], layoutInfo.rightRect());
  2376. return this;
  2377. },
  2378. /**
  2379. * 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.
  2380. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2381. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2382. */
  2383. /** @expose */
  2384. useDefaultX1Properties : function(setGridParameters) {
  2385. 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"))));
  2386. var titleFontStyle = (this._context.getPropertyValue("axis.x.title.style.font"));
  2387. var labelFontStyle = (this._context.getPropertyValue("axis.x.labels.style.font"));
  2388. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2389. this.axisComponent(0).labelStyle(labelFontStyle);
  2390. } else {
  2391. 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")));
  2392. }
  2393. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2394. this.axisComponent(0).titleStyle(titleFontStyle);
  2395. } else {
  2396. 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")));
  2397. }
  2398. if (setGridParameters) {
  2399. 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")));
  2400. }
  2401. this.suppressPanLabels(0, (this._context.getPropertyValue("axis.x.labels.zoomPan")));
  2402. return this;
  2403. },
  2404. /**
  2405. * 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.
  2406. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2407. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2408. */
  2409. /** @expose */
  2410. useDefaultY1Properties : function(setGridParameters) {
  2411. 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")));
  2412. var titleFontStyle = (this._context.getPropertyValue("axis.y.title.style.font"));
  2413. var labelFontStyle = (this._context.getPropertyValue("axis.y.labels.style.font"));
  2414. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2415. this.axisComponent(2).labelStyle(labelFontStyle);
  2416. } else {
  2417. 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")));
  2418. }
  2419. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2420. this.axisComponent(2).titleStyle(titleFontStyle);
  2421. } else {
  2422. 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")));
  2423. }
  2424. if (setGridParameters) {
  2425. 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")));
  2426. }
  2427. this.suppressPanLabels(2, (this._context.getPropertyValue("axis.y.labels.zoomPan")));
  2428. return this;
  2429. },
  2430. /**
  2431. * 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.
  2432. * @param (boolean) setGridParameters Whether to set the grid parameters (do not use if chart does not define grid)
  2433. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2434. */
  2435. /** @expose */
  2436. useDefaultY2Properties : function(setGridParameters) {
  2437. 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")));
  2438. var titleFontStyle = (this._context.getPropertyValue("axis.y2.title.style.font"));
  2439. var labelFontStyle = (this._context.getPropertyValue("axis.y2.labels.style.font"));
  2440. if (labelFontStyle != null && labelFontStyle.length > 0) {
  2441. this.axisComponent(3).labelStyle(labelFontStyle);
  2442. } else {
  2443. 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")));
  2444. }
  2445. if (titleFontStyle != null && titleFontStyle.length > 0) {
  2446. this.axisComponent(3).titleStyle(titleFontStyle);
  2447. } else {
  2448. 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")));
  2449. }
  2450. if (setGridParameters) {
  2451. 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")));
  2452. }
  2453. this.suppressPanLabels(3, (this._context.getPropertyValue("axis.y2.labels.zoomPan")));
  2454. return this;
  2455. },
  2456. /**
  2457. * 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.
  2458. * @param (int) role One of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2459. * @param (Array) entries Non-null list of data slot entries
  2460. * @param (String) format One of {@link this.CustomFormatInfo#"none"} or {@link this.CustomFormatInfo#"percent"}
  2461. * @param (rave['internal']['ValueFunction']) defaultFunction Default function to use if no custom formatter is defined for the axis, may be null
  2462. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2463. */
  2464. /** @expose */
  2465. setTickFormatterList : function(role, entries, format, defaultFunction) {
  2466. var fmtRole;
  2467. switch (role) {
  2468. case 2:
  2469. fmtRole = "ROLE_Y1";
  2470. break;
  2471. case 1:
  2472. fmtRole = "ROLE_X2";
  2473. break;
  2474. case 3:
  2475. fmtRole = "ROLE_Y2";
  2476. break;
  2477. case 0:
  2478. default:
  2479. fmtRole = "ROLE_X1";
  2480. break;
  2481. }
  2482. 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);
  2483. this.axisComponent(role).tickFormat(fmt);
  2484. 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);
  2485. this.axisComponent(role).simplifiedTickFormat(simplefmt);
  2486. return this;
  2487. },
  2488. /**
  2489. * 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.
  2490. * @param (int) role One of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2491. * @param (rave['library']['internal']['DataSlotEntry']) entry Data slot entry, if null it is not added to the list
  2492. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2493. */
  2494. /** @expose */
  2495. setTickFormatter : function(role, entry) {
  2496. var entries = [];
  2497. if (entry) {
  2498. entries.push(entry);
  2499. }
  2500. return this.setTickFormatterList(role, entries, "none", null);
  2501. },
  2502. /**
  2503. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined scale.
  2504. * @param (Number) padding Padding, relevant only for ordinal scales
  2505. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2506. * @param (int) pixelPad Pixel padding at each end
  2507. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2508. */
  2509. /** @expose */
  2510. setScaleRanges : function(padding, outerPadding, pixelPad) {
  2511. this.setIndependentScaleRanges(padding, outerPadding, pixelPad);
  2512. this.setDependentScaleRanges(padding, outerPadding, pixelPad);
  2513. return this;
  2514. },
  2515. /**
  2516. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined independent scale.
  2517. * @param (Number) padding Padding, relevant only for ordinal scales
  2518. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2519. * @param (int) pixelPad Pixel padding at each end
  2520. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2521. */
  2522. /** @expose */
  2523. setIndependentScaleRanges : function(padding, outerPadding, pixelPad) {
  2524. this.setScaleRangePadded(this._scales[0], false, padding, outerPadding, pixelPad);
  2525. this.setScaleRangePadded(this._scales[1], false, padding, outerPadding, pixelPad);
  2526. return this;
  2527. },
  2528. /**
  2529. * Calls {@link #this.setScaleRangePadded(rave['library']['internal']['CoordinateScaleImpl'], , Number, Number, )} for each defined independent scale.
  2530. * @param (Number) padding Padding, relevant only for ordinal scales
  2531. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2532. * @param (int) pixelPad Pixel padding at each end
  2533. * @return (com.ibm.rave.bundles.components.AxesManager) This object
  2534. */
  2535. /** @expose */
  2536. setDependentScaleRanges : function(padding, outerPadding, pixelPad) {
  2537. this.setScaleRangePadded(this._scales[2], true, padding, outerPadding, pixelPad);
  2538. this.setScaleRangePadded(this._scales[3], true, padding, outerPadding, pixelPad);
  2539. return this;
  2540. },
  2541. /**
  2542. * 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)} .
  2543. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2544. * @param (rave['library']['internal']['DataSlotEntry']) slot DataSlotEntry to be associated with the axis role.
  2545. */
  2546. setDataSlot$0 : function(role, slot) {
  2547. this.setDataSlot$1(role, [slot]);
  2548. return this;
  2549. },
  2550. /**
  2551. * Set a list of data slot entries that will be associated with the specified axis role.
  2552. * @param (int) role An axis role, one of {@link this.AxesManager#0} , {@link this.AxesManager#1} , {@link this.AxesManager#2} , {@link this.AxesManager#3} .
  2553. * @param (Array) slots List of DataSlotEntry to be associated with the axis role.
  2554. */
  2555. setDataSlot$1 : function(role, slots) {
  2556. if (role < 4 && role >= 0) {
  2557. this._dataSlotEntries[role].length = 0;
  2558. if (slots) {
  2559. for (var __i_enFor0 = 0, __exp_enFor0 = slots, __len_enFor0 = __exp_enFor0.length;
  2560. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  2561. var slot = __exp_enFor0[__i_enFor0];
  2562. this._dataSlotEntries[role].push(slot);
  2563. }
  2564. }
  2565. }
  2566. return this;
  2567. },
  2568. /**
  2569. * </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.
  2570. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale Bundle independent scale
  2571. * @param (boolean) dependent Whether this is the dependent scale
  2572. * @param (Number) padding Padding, relevant only for ordinal scales
  2573. * @param (Number) outerPadding Outer padding, relevant only for ordinal scales
  2574. * @param (int) pixelPad Pixel padding at each end
  2575. */
  2576. setScaleRangePadded : function(scale, dependent, padding, outerPadding, pixelPad) {
  2577. if (scale) {
  2578. var min, max;
  2579. if (dependent == this._transpose) {
  2580. min = this._elementRect.x + pixelPad;
  2581. max = this._elementRect.x + this._elementRect.width - pixelPad;
  2582. } else {
  2583. if (scale.isContinuous()) {
  2584. min = this._elementRect.y + this._elementRect.height - pixelPad;
  2585. max = this._elementRect.y + pixelPad;
  2586. } else {
  2587. min = this._elementRect.y + pixelPad;
  2588. max = this._elementRect.y + this._elementRect.height - pixelPad;
  2589. }
  2590. }
  2591. scale.range(min, max, padding, outerPadding);
  2592. }
  2593. },
  2594. /**
  2595. * Given a geometric position BOTTOM, TOP, LEFT, or RIGHT, return the role X1, X2, Y1, or Y2 used by that role.
  2596. * @param (int) position The position index
  2597. * @return (int) The role index
  2598. */
  2599. positionToRole : function(position) {
  2600. var r = position;
  2601. if (this._transpose) {
  2602. r = (r + 2) % 4;
  2603. }
  2604. if (this._swapX && r < 2) {
  2605. r = 1 - r;
  2606. }
  2607. if (this._swapY && r > 1) {
  2608. r = 5 - r;
  2609. }
  2610. return r;
  2611. },
  2612. /**
  2613. * Given a role X1, X2, Y1, or Y2, return the geometric position BOTTOM, TOP, LEFT, or RIGHT for that role.
  2614. * @param (int) role The role index
  2615. * @return (int) The position index
  2616. */
  2617. roleToPosition : function(role) {
  2618. var p = role;
  2619. if (this._swapX && role < 2) {
  2620. p = 1 - p;
  2621. }
  2622. if (this._swapY && p > 1) {
  2623. p = 5 - p;
  2624. }
  2625. if (this._transpose) {
  2626. p = (p + 2) % 4;
  2627. }
  2628. return p;
  2629. },
  2630. /**
  2631. * Sets the magnitude for the tick interval.
  2632. * @param (int) role role index of the axis
  2633. * @param (Number) tickMagnitude power of 10
  2634. * @return (com.ibm.rave.bundles.components.AxesManager) this
  2635. */
  2636. /** @expose */
  2637. scaleTickMagnitude : function(role, tickMagnitude) {
  2638. this.axisComponent(role).scaleTickMagnitude(tickMagnitude);
  2639. return this;
  2640. },
  2641. /** @expose */
  2642. setDataSlot : function(a0, a1) {
  2643. var args = arguments;
  2644. if (args.length == 2 && typeof a1 === "function") {
  2645. return this.setDataSlot$0(a0, a1);
  2646. }
  2647. return this.setDataSlot$1(a0, a1);
  2648. }
  2649. });
  2650. /**
  2651. * @param (rave['internal']['Selector']) s A selector
  2652. * @return (rave['internal']['Selector']) s if it is non-null and has at least one node, null otherwise
  2653. */
  2654. com_ibm_rave_bundles_components_AxesManager.checkSelector = function(s) {
  2655. return s && !(s.empty()) ? s : null;
  2656. };
  2657. /**
  2658. * Set a rectangle to a copy of another. If the source is null, the target is set to 0,0,0,0
  2659. * @param (rave['internal']['RectStruct']) target A non-null rectangle
  2660. * @param (rave['internal']['RectStruct']) source A possibly-null rectnalge
  2661. */
  2662. com_ibm_rave_bundles_components_AxesManager.setRect = function(target, source) {
  2663. if (source) {
  2664. target.x = source.x;
  2665. target.y = source.y;
  2666. target.width = source.width;
  2667. target.height = source.height;
  2668. } else {
  2669. target.x = 0;
  2670. target.y = 0;
  2671. target.width = 0;
  2672. target.height = 0;
  2673. }
  2674. };
  2675. /**
  2676. * A ValueFunction that appends '%' to the value.
  2677. * @param (int) n Number of digits
  2678. */
  2679. /** @expose */
  2680. com_ibm_rave_bundles_components_AxesManager.percentFormat = function(n) {
  2681. var digits = "." + n + "f";
  2682. var format = rave.format(digits);
  2683. return function(value, ix, gix) {
  2684. return format.call(null, value, 0, 0) + "%";
  2685. };
  2686. };
  2687. /**
  2688. * Called prior to chart layout. Axes are configured with no real bounding constraints to calculate their preferred size.
  2689. */
  2690. com_ibm_rave_bundles_components_AxesManager.AxisLayout = rave['internal']['Declare']({
  2691. /** @expose */
  2692. position : 0,
  2693. /** @expose */
  2694. score : 0,
  2695. constructor : function(position, score) {
  2696. this.position = position;
  2697. this.score = score;
  2698. }
  2699. });
  2700. /**
  2701. * Logical first X (independent) axis, default position bottom
  2702. */
  2703. /** @expose */
  2704. com_ibm_rave_bundles_components_AxesManager.X1 = 0;
  2705. /**
  2706. * Logical second X (independent) axis, default position top
  2707. */
  2708. /** @expose */
  2709. com_ibm_rave_bundles_components_AxesManager.X2 = 1;
  2710. /**
  2711. * Logical first Y (dependent) axis, default position left
  2712. */
  2713. /** @expose */
  2714. com_ibm_rave_bundles_components_AxesManager.Y1 = 2;
  2715. /**
  2716. * Logical first Y (dependent) axis, default position right
  2717. */
  2718. /** @expose */
  2719. com_ibm_rave_bundles_components_AxesManager.Y2 = 3;
  2720. /**
  2721. * Geometric group on bottom
  2722. */
  2723. /** @expose */
  2724. com_ibm_rave_bundles_components_AxesManager.BOTTOM = 0;
  2725. /**
  2726. * Geometric group on top
  2727. */
  2728. /** @expose */
  2729. com_ibm_rave_bundles_components_AxesManager.TOP = 1;
  2730. /**
  2731. * Geometric group on left
  2732. */
  2733. /** @expose */
  2734. com_ibm_rave_bundles_components_AxesManager.LEFT = 2;
  2735. /**
  2736. * Geometric group on right
  2737. */
  2738. /** @expose */
  2739. com_ibm_rave_bundles_components_AxesManager.RIGHT = 3;
  2740. /**
  2741. * Maps the role indexes to the role strings used by the components API
  2742. */
  2743. com_ibm_rave_bundles_components_AxesManager.ROLES = ["ROLE_X1", "ROLE_X2", "ROLE_Y1", "ROLE_Y2"];
  2744. /**
  2745. * Maps the role indexes to the role strings used by the custom formatter API. TODO: Unify the strings
  2746. */
  2747. com_ibm_rave_bundles_components_AxesManager.ROLE_FORMATTERS = ["ROLE_X1", "ROLE_X2", "ROLE_Y1", "ROLE_Y2"];
  2748. /**
  2749. * Maps the position indexes to the orient strings used by D3
  2750. */
  2751. com_ibm_rave_bundles_components_AxesManager.ORIENTATIONS = ["bottom", "top", "left", "right"];
  2752. /**
  2753. * Maps the position indexes to the custom formatter strings
  2754. */
  2755. com_ibm_rave_bundles_components_AxesManager.FORMATTERS = ["bottom", "top", "left", "right"];
  2756. // $source: com/ibm/rave/bundles/component/AxisComponent
  2757. /************************************************************************
  2758. ** IBM Confidential
  2759. **
  2760. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2761. **
  2762. ** (C) Copyright IBM Corp. 2017
  2763. **
  2764. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2765. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2766. ************************************************************************/
  2767. // GENERATED
  2768. /**
  2769. * <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>
  2770. */
  2771. var com_ibm_rave_bundles_component_AxisComponent = rave['internal']['Declare'].implement(
  2772. /**
  2773. * @return (String) The role of the axis in the chart
  2774. */
  2775. //role : function() {},
  2776. /**
  2777. * @return (rave['internal']['Axis']) The capability Axis used by this AxisComponent
  2778. */
  2779. //axis : function() {},
  2780. /**
  2781. * The tickFormat is applied to the values of the ticks to create the string that is displayed.
  2782. * @param (rave['internal']['ValueFunction']) tickFormat The new tickFormat
  2783. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2784. */
  2785. //tickFormat : function(tickFormat) {},
  2786. /**
  2787. * Get the tickFormat function used by this component. May be null.
  2788. * @return (rave['internal']['ValueFunction']) Format function, or null
  2789. */
  2790. //tickFormat : function() {},
  2791. /**
  2792. * Set the indicator to be used for truncated text ex: indicator set to "..." , results in helloworld - > hello...
  2793. * @param (String) indicator the string to be placed to indicated truncated text
  2794. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2795. */
  2796. //textTruncateIndicator : function(indicator) {},
  2797. /**
  2798. * Whether to display the axis title.
  2799. * @param (boolean) displayAxisTitle true to display the axis title, false otherwise
  2800. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2801. */
  2802. //displayAxisTitle : function(displayAxisTitle) {},
  2803. /**
  2804. * Whether to display the axis line.
  2805. * @param (boolean) displayAxisLine true to display the axis line, false otherwise
  2806. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2807. */
  2808. //displayAxisLine : function(displayAxisLine) {},
  2809. /**
  2810. * Whether to display the axis tick marks.
  2811. * @param (boolean) displayTicks true to display the axis ticks, false otherwise
  2812. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2813. */
  2814. //displayTicks : function(displayTicks) {},
  2815. /**
  2816. * Whether to display the axis labels, as set by the show axis labels property
  2817. * @param (boolean) displayTickLabels true to display the axis tick labels, false otherwise
  2818. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2819. */
  2820. //displayTickLabels : function(displayTickLabels) {},
  2821. /**
  2822. * Whether to display the axis labels, as set by the hide pan-zoom labels property
  2823. * @param (boolean) showPanZoomTickLabels true to display the axis tick labels, false otherwise
  2824. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2825. */
  2826. //showPanZoomTickLabels : function(showPanZoomTickLabels) {},
  2827. /**
  2828. * @param (String) axisTitle The new axisTitle
  2829. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2830. */
  2831. //axisTitle : function(axisTitle) {},
  2832. /**
  2833. * 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)} .
  2834. * @param (String) axisColor The new line and tick color
  2835. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2836. */
  2837. //axisColor : function(axisColor) {},
  2838. /**
  2839. * The color used to draw the axis line.
  2840. * @param (String) lineColor The new lineColor
  2841. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2842. */
  2843. //lineColor : function(lineColor) {},
  2844. /**
  2845. * The color used to draw the axis ticks.
  2846. * @param (String) tickColor The new tickColor
  2847. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2848. */
  2849. //tickColor : function(tickColor) {},
  2850. /**
  2851. * The color used to draw the axis labels.
  2852. * @param (String) labelColor The new labelColor
  2853. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2854. */
  2855. //labelColor : function(labelColor) {},
  2856. /**
  2857. * The style for the axis labels.
  2858. * @param (String) fontStyle CSS string of font properties
  2859. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2860. */
  2861. //labelStyle : function(fontStyle) {},
  2862. /**
  2863. * The style for the axis labels.
  2864. * @param (String) fill The color used to draw the labels
  2865. * @param (String) fontSize CSS font size
  2866. * @param (String) fontFamily CSS font-families list
  2867. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2868. */
  2869. //labelStyle : function(fill, fontSize, fontFamily) {},
  2870. /**
  2871. * The color used to draw the axis title.
  2872. * @param (String) titleColor The new titleColor
  2873. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2874. */
  2875. //titleColor : function(titleColor) {},
  2876. /**
  2877. * The style for the axis title.
  2878. * @param (String) fontStyle CSS string of font properties
  2879. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2880. */
  2881. //titleStyle : function(fontStyle) {},
  2882. /**
  2883. * The style for the axis title.
  2884. * @param (String) fill The color used to draw the title
  2885. * @param (String) fontSize CSS font size
  2886. * @param (String) fontFamily CSS font-families list
  2887. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  2888. */
  2889. //titleStyle : function(fill, fontSize, fontFamily) {}
  2890. );
  2891. /**
  2892. * The string returned by {@link #this.type()} is "AxisComponent".
  2893. */
  2894. /** @expose */
  2895. com_ibm_rave_bundles_component_AxisComponent.COMPONENT_TYPE = "AxisComponent";
  2896. /**
  2897. * Returned by {@link #this.role()} for the first independent axis.
  2898. */
  2899. /** @expose */
  2900. com_ibm_rave_bundles_component_AxisComponent.ROLE_X1 = "ROLE_X1";
  2901. /**
  2902. * Returned by {@link #this.role()} for the first dependent axis.
  2903. */
  2904. /** @expose */
  2905. com_ibm_rave_bundles_component_AxisComponent.ROLE_Y1 = "ROLE_Y1";
  2906. /**
  2907. * Returned by {@link #this.role()} for the second independent axis.
  2908. */
  2909. /** @expose */
  2910. com_ibm_rave_bundles_component_AxisComponent.ROLE_X2 = "ROLE_X2";
  2911. /**
  2912. * Returned by {@link #this.role()} for the second dependent axis.
  2913. */
  2914. /** @expose */
  2915. com_ibm_rave_bundles_component_AxisComponent.ROLE_Y2 = "ROLE_Y2";
  2916. // $source: com/ibm/rave/bundles/utilities/TextCrossfader
  2917. /************************************************************************
  2918. ** IBM Confidential
  2919. **
  2920. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2921. **
  2922. ** (C) Copyright IBM Corp. 2017
  2923. **
  2924. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2925. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2926. ************************************************************************/
  2927. // GENERATED
  2928. /**
  2929. * <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>
  2930. */
  2931. var com_ibm_rave_bundles_utilities_TextCrossfader = rave['internal']['Declare']({
  2932. });
  2933. /**
  2934. * <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!
  2935. * @param (rave['internal']['Selection']) selection Selection containing the single text node, may be a transition
  2936. * @param (String) oldText Old value of the text string, may be null
  2937. * @param (String) newText New value of the text string, may be null
  2938. * @param (Object) fillOpacity Fill opacity, may be null (in which case 1.0 is assumed)
  2939. * @param (double) delay Number between 0 and 0.5 controlling the timing of the fade
  2940. * @return (rave['internal']['Selection']) The selection, modified by the new text and fill-opacity
  2941. */
  2942. /** @expose */
  2943. com_ibm_rave_bundles_utilities_TextCrossfader.textCrossFade = function(selection, oldText, newText, fillOpacity, delay) {
  2944. if (!(selection.isTransition())) {
  2945. return selection.text(newText);
  2946. }
  2947. var _t = (selection).tween("text", function(data, index, groupIndex) {
  2948. return function(t) {
  2949. this.rave_setText(t < 0.5 ? oldText : newText);
  2950. };
  2951. });
  2952. var t0 = Math.max(0.0, Math.min(0.5, delay));
  2953. if (t0 == 0.5 || (oldText == null && newText == null) || (oldText != null && oldText == newText)) {
  2954. return selection;
  2955. }
  2956. var opacity = fillOpacity == null ? 1.0 : + (fillOpacity);
  2957. var tf = 1.0 / (0.5 - t0);
  2958. return _t.tween("fill-opacity", function(data, index, groupIndex) {
  2959. return function(t) {
  2960. if (t <= t0 || t >= (1.0 - t0)) {
  2961. this.rave_setStyle("fill-opacity", fillOpacity);
  2962. } else {
  2963. this.rave_setStyle("fill-opacity", opacity * Math.abs(t - 0.5) * tf);
  2964. }
  2965. };
  2966. });
  2967. };
  2968. // $source: com/ibm/rave/bundles/utilities/BundleLabelDropper
  2969. /************************************************************************
  2970. ** IBM Confidential
  2971. **
  2972. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  2973. **
  2974. ** (C) Copyright IBM Corp. 2017
  2975. **
  2976. ** The source code for this program is not published or otherwise divested of its trade secrets,
  2977. ** irrespective of what has been deposited with the U.S. Copyright Office.
  2978. ************************************************************************/
  2979. // GENERATED
  2980. var com_ibm_rave_bundles_utilities_BundleLabelDropper = rave['internal']['Declare']({
  2981. //_dropOverlap : null,
  2982. labelCount : 0,
  2983. _$functionClassMethod : function() {
  2984. var _$self = function(args) {
  2985. if (args !== null || arguments.length > 1){
  2986. args = Array.prototype.slice.call(arguments, 0);
  2987. }
  2988. {
  2989. _$self.drop(args[0], ((args[1])));
  2990. return null;
  2991. }
  2992. };
  2993. return _$self;
  2994. },
  2995. /** @expose */
  2996. constructor : function() {
  2997. this._dropOverlap = (rave.capabilities.extension("position")).drop().remove(false);
  2998. this._dropOverlap.setOverlapGap(4.0);
  2999. },
  3000. /**
  3001. * Drop the overlapping labels or reset the overlap.
  3002. * @param (rave['internal']['Selection']) labels The selector for the labels
  3003. * @param (boolean) removeOverlap true to remove the overlapping labels, false to reset
  3004. */
  3005. /** @expose */
  3006. drop : function(labels, removeOverlap) {
  3007. if (!(labels.isTransition())) {
  3008. this.applyLabelDrop(labels, removeOverlap);
  3009. } else {
  3010. var steps = [0, 25, 75];
  3011. var self = this;
  3012. (labels).tween("__pointLabelDrop__", function(data, index, groupIndex) {
  3013. if (index == 0) {
  3014. return function(t) {
  3015. var currentStep = Math.floor(t * 100);
  3016. if (steps.length > 0 && currentStep < 100 && currentStep >= steps[0]) {
  3017. steps.splice(0, 1);
  3018. self.applyLabelDrop(labels, removeOverlap);
  3019. }
  3020. };
  3021. }
  3022. return null;
  3023. });
  3024. this.labelCount = 0;
  3025. (labels).each(function(data, index, groupIndex) {
  3026. ++self.labelCount;
  3027. }).each("end", function(args) {
  3028. if (args !== null || arguments.length > 1){
  3029. args = Array.prototype.slice.call(arguments, 0);
  3030. }
  3031. {
  3032. if (--self.labelCount == 0) {
  3033. self.applyLabelDrop(labels, removeOverlap);
  3034. }
  3035. return null;
  3036. }
  3037. });
  3038. }
  3039. },
  3040. applyLabelDrop : function(labels, removeOverlap) {
  3041. if (removeOverlap) {
  3042. labels.call(this._dropOverlap);
  3043. } else {
  3044. this._dropOverlap.reset(labels);
  3045. }
  3046. },
  3047. /** @expose */
  3048. configureForDataLabels : function(rect) {
  3049. if (rect) {
  3050. var ex = [[rect.x, rect.y], [rect.x + rect.width, rect.y + rect.height]];
  3051. this._dropOverlap.extent(ex);
  3052. }
  3053. this._dropOverlap.noClipping();
  3054. }
  3055. });
  3056. /**
  3057. * Drop overlap extension
  3058. */
  3059. //com_ibm_rave_bundles_utilities_BundleLabelDropper.POSITION_EXTENSION = "position";
  3060. /**
  3061. * space between labels during overlap testing
  3062. */
  3063. com_ibm_rave_bundles_utilities_BundleLabelDropper.OVERLAP_GAP = 4;
  3064. // $source: com/ibm/rave/bundles/components/StyleStructs
  3065. /************************************************************************
  3066. ** IBM Confidential
  3067. **
  3068. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3069. **
  3070. ** (C) Copyright IBM Corp. 2017
  3071. **
  3072. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3073. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3074. ************************************************************************/
  3075. // GENERATED
  3076. /**
  3077. * Struct classes to hold style properties.
  3078. */
  3079. var com_ibm_rave_bundles_components_StyleStructs = rave['internal']['Declare']({
  3080. });
  3081. /**
  3082. * Filled shape style properties.
  3083. */
  3084. com_ibm_rave_bundles_components_StyleStructs.ShapeStyle = function() {
  3085. this._fill = null;
  3086. this._stroke = null;
  3087. this._strokeWidth = null;
  3088. };
  3089. /**
  3090. * Line style properties.
  3091. */
  3092. com_ibm_rave_bundles_components_StyleStructs.LineStyle = function() {
  3093. this._stroke = null;
  3094. this._strokeWidth = null;
  3095. this._dashArray = null;
  3096. };
  3097. // $source: com/ibm/rave/bundles/component/GridComponent
  3098. /************************************************************************
  3099. ** IBM Confidential
  3100. **
  3101. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3102. **
  3103. ** (C) Copyright IBM Corp. 2017
  3104. **
  3105. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3106. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3107. ************************************************************************/
  3108. // GENERATED
  3109. /**
  3110. * <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>
  3111. */
  3112. var com_ibm_rave_bundles_component_GridComponent = rave['internal']['Declare'].implement(
  3113. /**
  3114. * @return (String) The role of the grid in the chart
  3115. */
  3116. //role : function() {},
  3117. /**
  3118. * Whether to display the gridlines.
  3119. * @param (boolean) displayGridlines The new displayGridlines
  3120. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3121. */
  3122. //displayGridlines : function(displayGridlines) {},
  3123. /**
  3124. * Set the line styling. Equivalent to calling {@link #this.gridlineColor(String)} and {@link #this.dashArray(String)} .
  3125. * @param (String) stroke The stroke color
  3126. * @param (String) dashArray The stroke-dasharray
  3127. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3128. */
  3129. //gridlineStyle : function(stroke, dashArray) {},
  3130. /**
  3131. * The color used to draw the gridlines.
  3132. * @param (String) gridlineColor The new stroke color
  3133. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3134. */
  3135. //gridlineColor : function(gridlineColor) {},
  3136. /**
  3137. * 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.
  3138. * @param (String) dashArray The new dash array
  3139. * @return (com.ibm.rave.bundles.component.GridComponent) This component
  3140. */
  3141. //dashArray : function(dashArray) {}
  3142. );
  3143. /**
  3144. * The string returned by {@link #this.type()} is "GridComponent".
  3145. */
  3146. /** @expose */
  3147. com_ibm_rave_bundles_component_GridComponent.COMPONENT_TYPE = "GridComponent";
  3148. // $source: com/ibm/rave/bundles/components/IntervalDataUtilities
  3149. /************************************************************************
  3150. ** IBM Confidential
  3151. **
  3152. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3153. **
  3154. ** (C) Copyright IBM Corp. 2017
  3155. **
  3156. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3157. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3158. ************************************************************************/
  3159. // GENERATED
  3160. /**
  3161. * 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.
  3162. */
  3163. var com_ibm_rave_bundles_components_IntervalDataUtilities = rave['internal']['Declare']({
  3164. });
  3165. /**
  3166. * <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>
  3167. * @param (Array) data Data array
  3168. * @param (rave['internal']['SingleValueFunction']) x X accessor, should not be null
  3169. * @param (rave['internal']['SingleValueFunction']) xScale Function to check if the X value is valid
  3170. * @param (rave['internal']['SingleValueFunction']) y Y accessor, should not be null
  3171. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3172. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3173. * @return (Array) Array of intervals for the data
  3174. */
  3175. /** @expose */
  3176. com_ibm_rave_bundles_components_IntervalDataUtilities.simpleBars = function(data, x, xScale, y, yStart, color, label) {
  3177. var result = [];
  3178. if (!data || data.length == 0 || !x || !y) {
  3179. return result;
  3180. }
  3181. data.forEach(function(d, ix, list) {
  3182. var xv = x(d);
  3183. if (xv != null && (!xScale || xScale(xv) != null)) {
  3184. var yv = y(d);
  3185. var yvStart = !yStart ? 0 : yStart(d);
  3186. if (yv != null && yvStart != null) {
  3187. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3188. r.key = ix;
  3189. r.ind1 = xv;
  3190. r.ind2 = r.ind1;
  3191. r.cind = r.ind1;
  3192. r.dep1 = yvStart;
  3193. r.dep2 = yv;
  3194. r.cdep = r.dep2;
  3195. r.color = color ? color(d) : null;
  3196. r.label = label ? label(d) : null;
  3197. r.value = r.dep2;
  3198. r._originalData = d;
  3199. r.valueAsPercentOfCategory = 100;
  3200. result.push(r);
  3201. }
  3202. }
  3203. return null;
  3204. });
  3205. var sum = 0;
  3206. for (var i = 0; i < result.length; ++i) {
  3207. var iData = result[i];
  3208. var value = + (iData.value);
  3209. sum += Math.abs(value);
  3210. }
  3211. if (sum != 0) {
  3212. for (var i = 0; i < result.length; ++i) {
  3213. var iData = result[i];
  3214. var value = + (iData.value);
  3215. iData.valueAsPercentOfColor = value / sum * 100;
  3216. }
  3217. }
  3218. return result;
  3219. };
  3220. /**
  3221. * Create intervals for bars in a clustered chart. This is similar to the simple bars, except the independent values are an array of accessors.
  3222. * @param (Array) data Data array
  3223. * @param (Array) x Independent accessor array, should not be null and no entries should be null
  3224. * @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
  3225. * @param (rave['internal']['SingleValueFunction']) y Dependent accessor, should not be null
  3226. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3227. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3228. * @return (Array) Array of intervals for the data
  3229. */
  3230. /** @expose */
  3231. com_ibm_rave_bundles_components_IntervalDataUtilities.clusteredBars = function(data, x, xScale, y, yStart, color, label) {
  3232. var result = [];
  3233. if (!data || data.length == 0 || !x || x.length == 0 || !y) {
  3234. return result;
  3235. }
  3236. var len = x.length;
  3237. var categories = {};
  3238. var colors = {};
  3239. data.forEach(function(d, ix, list) {
  3240. var OK = true;
  3241. var ind = [];
  3242. for (var i = 0; i < len; ++i) {
  3243. var xv = x[i](d);
  3244. if (xv == null || (xScale[i] && xScale[i](xv) == null)) {
  3245. OK = false;
  3246. break;
  3247. }
  3248. ind.push(xv);
  3249. if (i == 0) {
  3250. if (!(categories.hasOwnProperty(xv))) {
  3251. categories[""+(xv)] = 1;
  3252. }
  3253. } else if (!(colors.hasOwnProperty(xv))) {
  3254. colors[""+(xv)] = 1;
  3255. }
  3256. }
  3257. var dep = y(d);
  3258. var depStart = !yStart ? 0 : yStart(d);
  3259. if (OK && dep != null && depStart != null) {
  3260. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3261. r.key = ix;
  3262. r.ind1 = ind;
  3263. r.ind2 = ind;
  3264. r.cind = ind;
  3265. r.dep1 = depStart;
  3266. r.dep2 = dep;
  3267. r.cdep = r.dep2;
  3268. r.color = color ? color(d) : null;
  3269. r.label = label ? label(d) : null;
  3270. r.value = r.dep2;
  3271. r._originalData = d;
  3272. result.push(r);
  3273. }
  3274. return null;
  3275. });
  3276. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(categories), __len_enFor0 = __exp_enFor0.length;
  3277. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3278. var o = __exp_enFor0[__i_enFor0];
  3279. var s = ""+(o);
  3280. var sum = 0;
  3281. for (var i = 0; i < result.length; ++i) {
  3282. var iData = result[i];
  3283. if (s == (iData.ind1)[0]) {
  3284. var value = + (iData.value);
  3285. sum += Math.abs(value);
  3286. }
  3287. }
  3288. if (sum == 0) {
  3289. continue;
  3290. }
  3291. for (var i = 0; i < result.length; ++i) {
  3292. var iData = result[i];
  3293. if (s == (iData.ind1)[0]) {
  3294. var value = + (iData.value);
  3295. iData.valueAsPercentOfCategory = value / sum * 100;
  3296. }
  3297. }
  3298. }
  3299. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(colors), __len_enFor1 = __exp_enFor1.length;
  3300. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3301. var o = __exp_enFor1[__i_enFor1];
  3302. var s = ""+(o);
  3303. var sum = 0;
  3304. for (var i = 0; i < result.length; ++i) {
  3305. var iData = result[i];
  3306. if (s == iData.color) {
  3307. var value = + (iData.value);
  3308. sum += Math.abs(value);
  3309. }
  3310. }
  3311. if (sum == 0) {
  3312. continue;
  3313. }
  3314. for (var i = 0; i < result.length; ++i) {
  3315. var iData = result[i];
  3316. if (s == iData.color) {
  3317. var value = + (iData.value);
  3318. iData.valueAsPercentOfColor = value / sum * 100;
  3319. }
  3320. }
  3321. }
  3322. return result;
  3323. };
  3324. /**
  3325. * 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.
  3326. * @param (Array) data Data array
  3327. * @param (rave['internal']['SingleValueFunction']) x Independent accessor, should not be null
  3328. * @param (rave['internal']['SingleValueFunction']) xScale Possibly-null function to check if X values are in domain
  3329. * @param (rave['internal']['SingleValueFunction']) y Dependent accessor, should not be null
  3330. * @param (rave['internal']['SingleValueFunction']) color Color accessor, may be null
  3331. * @param (rave['internal']['SingleValueFunction']) label Label accessor, may be null
  3332. * @param (boolean) percent If true, create percent bars
  3333. * @return (Array) Array of intervals for the data
  3334. */
  3335. /** @expose */
  3336. com_ibm_rave_bundles_components_IntervalDataUtilities.stackedBars = function(data, x, xScale, y, color, label, percent) {
  3337. var result = [];
  3338. if (!data || data.length == 0 || !x || !y) {
  3339. return result;
  3340. }
  3341. var stacks = {};
  3342. var categories = {};
  3343. var colors = {};
  3344. data.forEach(function(d, ix, list) {
  3345. var xv = x(d);
  3346. if (xv != null && (!xScale || xScale(xv) != null)) {
  3347. var yv = y(d);
  3348. if (yv != null) {
  3349. var stack = stacks[xv];
  3350. if (!stack) {
  3351. stack = new com_ibm_rave_bundles_components_IntervalDataUtilities.Stack();
  3352. stacks[xv] = stack;
  3353. }
  3354. var dVal = + (yv);
  3355. if (!percent) {
  3356. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3357. r.key = ix;
  3358. r.ind1 = xv;
  3359. r.ind2 = xv;
  3360. r.cind = xv;
  3361. var sum = dVal < 0.0 ? stack.negativeSum : stack.positiveSum;
  3362. r.dep1 = sum;
  3363. r.dep2 = sum + dVal;
  3364. r.cdep = r.dep2;
  3365. r.color = color ? color(d) : null;
  3366. r.label = label ? label(d) : null;
  3367. r.value = dVal;
  3368. r._originalData = d;
  3369. result.push(r);
  3370. }
  3371. if (dVal < 0.0) {
  3372. stack.negativeSum += dVal;
  3373. } else {
  3374. stack.positiveCount++;
  3375. stack.positiveSum += dVal;
  3376. }
  3377. if (!(categories.hasOwnProperty(xv))) {
  3378. categories[""+(xv)] = 1;
  3379. }
  3380. if (color) {
  3381. var o = color(d);
  3382. if ((o != null) && !(colors.hasOwnProperty(o))) {
  3383. colors[""+(o)] = 1;
  3384. }
  3385. }
  3386. }
  3387. }
  3388. return null;
  3389. });
  3390. if (percent) {
  3391. data.forEach(function(d, ix, list) {
  3392. var xv = x(d);
  3393. if (xv != null && (!xScale || xScale(xv) != null)) {
  3394. var yv = y(d);
  3395. if (yv != null) {
  3396. var stack = stacks[xv];
  3397. var dVal = + (yv);
  3398. var percent;
  3399. if (dVal < 0.0) {
  3400. percent = -100.0 * dVal / stack.negativeSum;
  3401. } else if (stack.positiveSum > 0) {
  3402. percent = 100.0 * dVal / stack.positiveSum;
  3403. } else {
  3404. percent = 100.0 / stack.positiveCount;
  3405. }
  3406. var r = new com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData();
  3407. r.key = ix;
  3408. r.ind1 = xv;
  3409. r.ind2 = xv;
  3410. r.cind = xv;
  3411. var sum = dVal < 0.0 ? stack.negativePercent : stack.positivePercent;
  3412. r.dep1 = sum;
  3413. r.dep2 = sum + percent;
  3414. r.cdep = r.dep2;
  3415. r.color = color ? color(d) : null;
  3416. r.label = label ? label(d) : null;
  3417. r.value = dVal;
  3418. r.valueAsPercentOfCategory = percent;
  3419. r._originalData = d;
  3420. result.push(r);
  3421. if (dVal < 0.0) {
  3422. stack.negativePercent += percent;
  3423. } else {
  3424. stack.positivePercent += percent;
  3425. }
  3426. }
  3427. }
  3428. return null;
  3429. });
  3430. } else {
  3431. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(categories), __len_enFor0 = __exp_enFor0.length;
  3432. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3433. var o = __exp_enFor0[__i_enFor0];
  3434. var s = ""+(o);
  3435. var sum = 0;
  3436. for (var i = 0; i < result.length; ++i) {
  3437. var iData = result[i];
  3438. if (s == iData.ind1) {
  3439. var value = + (iData.value);
  3440. sum += Math.abs(value);
  3441. }
  3442. }
  3443. if (sum == 0) {
  3444. continue;
  3445. }
  3446. for (var i = 0; i < result.length; ++i) {
  3447. var iData = result[i];
  3448. if (s == iData.ind1) {
  3449. var value = + (iData.value);
  3450. iData.valueAsPercentOfCategory = value / sum * 100;
  3451. }
  3452. }
  3453. }
  3454. }
  3455. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(colors), __len_enFor1 = __exp_enFor1.length;
  3456. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3457. var o = __exp_enFor1[__i_enFor1];
  3458. var s = ""+(o);
  3459. var sum = 0;
  3460. for (var i = 0; i < result.length; ++i) {
  3461. var iData = result[i];
  3462. if (s == iData.color) {
  3463. var value = + (iData.value);
  3464. sum += Math.abs(value);
  3465. }
  3466. }
  3467. if (sum == 0) {
  3468. continue;
  3469. }
  3470. for (var i = 0; i < result.length; ++i) {
  3471. var iData = result[i];
  3472. if (s == iData.color) {
  3473. var value = + (iData.value);
  3474. iData.valueAsPercentOfColor = value / sum * 100;
  3475. }
  3476. }
  3477. }
  3478. return result;
  3479. };
  3480. /**
  3481. * Structure class holding interval information.
  3482. */
  3483. com_ibm_rave_bundles_components_IntervalDataUtilities.IntervalData = rave['internal']['Declare']({
  3484. /**
  3485. * Key value; for now this is the data index
  3486. */
  3487. /** @expose */
  3488. key : null,
  3489. /**
  3490. * First independent value
  3491. */
  3492. /** @expose */
  3493. ind1 : null,
  3494. /**
  3495. * Second independent value (in all current uses, same as ind1)
  3496. */
  3497. /** @expose */
  3498. ind2 : null,
  3499. /**
  3500. * First dependent value
  3501. */
  3502. /** @expose */
  3503. dep1 : null,
  3504. /**
  3505. * Second dependent value
  3506. */
  3507. /** @expose */
  3508. dep2 : null,
  3509. /**
  3510. * The data value that the interval represents. Not the pixel value. Used in stacked chart
  3511. */
  3512. /** @expose */
  3513. value : null,
  3514. /**
  3515. * Color value
  3516. */
  3517. /** @expose */
  3518. color : null,
  3519. /**
  3520. * Label value
  3521. */
  3522. /** @expose */
  3523. label : null,
  3524. /**
  3525. * Callout independent value (in all current uses, same as ind1)
  3526. */
  3527. /** @expose */
  3528. cind : null,
  3529. /**
  3530. * Callout dependent value (dependent extent)
  3531. */
  3532. /** @expose */
  3533. cdep : null,
  3534. /** @expose */
  3535. _originalData : null,
  3536. /**
  3537. * The data value (in percentage) for specific category
  3538. */
  3539. /** @expose */
  3540. valueAsPercentOfCategory : NaN,
  3541. /**
  3542. * The data value (in percentage) across all categories
  3543. */
  3544. /** @expose */
  3545. valueAsPercentOfColor : NaN,
  3546. /** @expose */
  3547. originalData : function() {
  3548. return this._originalData;
  3549. },
  3550. /** @expose */
  3551. originalDataList : function() {
  3552. var list = [];
  3553. list.push(this._originalData);
  3554. return list;
  3555. }
  3556. });
  3557. com_ibm_rave_bundles_components_IntervalDataUtilities.Stack = function() {
  3558. this.positiveCount = 0;
  3559. this.positiveSum = 0;
  3560. this.negativeSum = 0;
  3561. this.positivePercent = 0;
  3562. this.negativePercent = 0;
  3563. };
  3564. /**
  3565. * Accessor for the callout dependent value
  3566. */
  3567. /** @expose */
  3568. com_ibm_rave_bundles_components_IntervalDataUtilities.CALLOUT_DEPENDENT_ACCESSOR = function(data) {
  3569. return (data).cdep;
  3570. };
  3571. /**
  3572. * Accessor for the callout independent value
  3573. */
  3574. /** @expose */
  3575. com_ibm_rave_bundles_components_IntervalDataUtilities.CALLOUT_INDEPENDENT_ACCESSOR = function(data) {
  3576. return (data).cind;
  3577. };
  3578. /**
  3579. * Accessor for the data value
  3580. */
  3581. /** @expose */
  3582. com_ibm_rave_bundles_components_IntervalDataUtilities.VALUE_ACCESSOR = function(data) {
  3583. return (data).value;
  3584. };
  3585. /**
  3586. * Accessor for data value as percent of category
  3587. */
  3588. /** @expose */
  3589. com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR = function(data) {
  3590. var percent = (data).valueAsPercentOfCategory;
  3591. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3592. };
  3593. /**
  3594. * Accessor for data value as percent of color (series)
  3595. */
  3596. /** @expose */
  3597. com_ibm_rave_bundles_components_IntervalDataUtilities.PERCENT_OF_COLOR_ACCESSOR = function(data) {
  3598. var percent = (data).valueAsPercentOfColor;
  3599. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3600. };
  3601. // $source: com/ibm/rave/bundles/data/PointDataUtilities
  3602. /************************************************************************
  3603. ** IBM Confidential
  3604. **
  3605. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3606. **
  3607. ** (C) Copyright IBM Corp. 2017
  3608. **
  3609. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3610. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3611. ************************************************************************/
  3612. // GENERATED
  3613. /**
  3614. * Utility class for building arrays of point datum objects from tabular data.
  3615. */
  3616. var com_ibm_rave_bundles_data_PointDataUtilities = rave['internal']['Declare']({
  3617. });
  3618. /**
  3619. * <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>
  3620. * @param (Array) data Input data, list of arbitrary objects
  3621. * @param (rave['internal']['SingleValueFunction']) xAccessor X accessor function, may be null
  3622. * @param (rave['internal']['SingleValueFunction']) xScale Scale to test if the X value should be included, may be null
  3623. * @param (rave['internal']['SingleValueFunction']) yAccessor Y accessor function, may be null
  3624. * @param (rave['internal']['SingleValueFunction']) yScale Scale to test if the Y value should be included, may be null
  3625. * @return (Array) List of PointData objects
  3626. */
  3627. /** @expose */
  3628. com_ibm_rave_bundles_data_PointDataUtilities.buildPoints = function(data, xAccessor, xScale, yAccessor, yScale) {
  3629. var result = [];
  3630. if (data) {
  3631. for (var __i_enFor0 = 0, __exp_enFor0 = data, __len_enFor0 = __exp_enFor0.length;
  3632. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3633. var o = __exp_enFor0[__i_enFor0];
  3634. if (o != null) {
  3635. var xv = null;
  3636. if (xAccessor) {
  3637. xv = xAccessor(o);
  3638. if (xv == null || (xScale && xScale(xv) == null)) {
  3639. continue;
  3640. }
  3641. }
  3642. var yv = null;
  3643. if (yAccessor) {
  3644. yv = yAccessor(o);
  3645. if (yv == null || (yScale && yScale(yv) == null)) {
  3646. continue;
  3647. }
  3648. }
  3649. var datum = new com_ibm_rave_bundles_data_PointDataUtilities.PointDatum();
  3650. datum._x = xv;
  3651. datum._y = yv;
  3652. datum._originalData = o;
  3653. result.push(datum);
  3654. }
  3655. }
  3656. }
  3657. return result;
  3658. };
  3659. /**
  3660. * 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.
  3661. */
  3662. com_ibm_rave_bundles_data_PointDataUtilities.PointDatum = rave['internal']['Declare']({
  3663. /**
  3664. * The X value
  3665. */
  3666. /** @expose */
  3667. _x : null,
  3668. /**
  3669. * The Y value
  3670. */
  3671. /** @expose */
  3672. _y : null,
  3673. /**
  3674. * The data value (in percentage) that the point represents
  3675. */
  3676. /** @expose */
  3677. _yAsPercentOfCategory : null,
  3678. /**
  3679. * The data value (in percentage) that the point represents
  3680. */
  3681. /** @expose */
  3682. _yAsPercentOfColor : null,
  3683. /**
  3684. * The original data
  3685. */
  3686. /** @expose */
  3687. _originalData : null,
  3688. /** @expose */
  3689. originalData : function() {
  3690. return this._originalData;
  3691. },
  3692. /** @expose */
  3693. originalDataList : function() {
  3694. var list = [];
  3695. list.push(this._originalData);
  3696. return list;
  3697. }
  3698. });
  3699. /**
  3700. * Accessor returning the _x property of a PointDatum.
  3701. */
  3702. /** @expose */
  3703. com_ibm_rave_bundles_data_PointDataUtilities.X_ACCESSOR = function(d) {
  3704. return (d)._x;
  3705. };
  3706. /**
  3707. * Accessor returning the _y property of a PointDatum.
  3708. */
  3709. /** @expose */
  3710. com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR = function(d) {
  3711. return (d)._y;
  3712. };
  3713. /**
  3714. * Accessor returning the _yAsPercentOfCategory property of a PointDatum.
  3715. */
  3716. /** @expose */
  3717. com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_CATEGORY_ACCESSOR = function(d) {
  3718. var percent = + ((d)._yAsPercentOfCategory);
  3719. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3720. };
  3721. /**
  3722. * Accessor returning the _yAsPercentOfColor property of a PointDatum.
  3723. */
  3724. /** @expose */
  3725. com_ibm_rave_bundles_data_PointDataUtilities.PERCENT_OF_COLOR_ACCESSOR = function(d) {
  3726. var percent = + ((d)._yAsPercentOfColor);
  3727. return isNaN(percent) ? "" : percent.toFixed(1) + "%";
  3728. };
  3729. // $source: com/ibm/rave/bundles/utilities/ColorUtil
  3730. /************************************************************************
  3731. ** IBM Confidential
  3732. **
  3733. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3734. **
  3735. ** (C) Copyright IBM Corp. 2017
  3736. **
  3737. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3738. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3739. ************************************************************************/
  3740. // GENERATED
  3741. var com_ibm_rave_bundles_utilities_ColorUtil = rave['internal']['Declare']({
  3742. });
  3743. /**
  3744. * It is used to get a foreground color which has atleast a 4.5 contrast ratio with the background color.
  3745. * @param (Object) bg bakground color
  3746. * @param (Object) fg foreground color
  3747. * @return (Object) a color ( darker/ligher/same fg color ) which contrast with background.
  3748. */
  3749. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$0 = function(bg, fg) {
  3750. var contrastRatio = com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio(bg, fg);
  3751. if (contrastRatio < 4.5) {
  3752. var bgHSL = rave.hsl(bg);
  3753. var fgHSL = rave.hsl(fg);
  3754. 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);
  3755. if (brightness > 0.5) {
  3756. if (bgHSL.getL() > 0.5) {
  3757. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.min(fgHSL.getL(), bgHSL.getL() - 0.4));
  3758. } else {
  3759. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.min(fgHSL.getL(), 0.1));
  3760. }
  3761. } else {
  3762. if (bgHSL.getL() < 0.5) {
  3763. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.max(fgHSL.getL(), bgHSL.getL() + 0.4));
  3764. } else {
  3765. return rave.hsl(fgHSL.getH(), fgHSL.getS(), Math.max(fgHSL.getL(), 0.9));
  3766. }
  3767. }
  3768. }
  3769. return fg;
  3770. };
  3771. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$1 = function(labelColor) {
  3772. var labelRGB = rave.rgb(labelColor);
  3773. return labelRGB.contrastShift(21);
  3774. };
  3775. /** @expose */
  3776. com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio = function(colorA, colorB) {
  3777. var foregroundLuminance = rave.rgb(colorA).getLuminance();
  3778. var backgroundLuminance = rave.rgb(colorB).getLuminance();
  3779. var contrastRatio = (foregroundLuminance >= backgroundLuminance) ? (foregroundLuminance + 0.05) / (backgroundLuminance + 0.05) : (backgroundLuminance + 0.05) / (foregroundLuminance + 0.05);
  3780. return contrastRatio;
  3781. };
  3782. /** @expose */
  3783. com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor = function(a0, a1) {
  3784. var args = arguments;
  3785. if (args.length == 1) {
  3786. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$1(a0);
  3787. }
  3788. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor$0(a0, a1);
  3789. };
  3790. // $source: com/ibm/rave/bundles/utilities/PathUtils
  3791. /************************************************************************
  3792. ** IBM Confidential
  3793. **
  3794. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3795. **
  3796. ** (C) Copyright IBM Corp. 2017
  3797. **
  3798. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3799. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3800. ************************************************************************/
  3801. // GENERATED
  3802. var com_ibm_rave_bundles_utilities_PathUtils = rave['internal']['Declare']({
  3803. });
  3804. /**
  3805. * Transition a path element selection with a fade-out-fade-in effect. In many cases, transitioning between two unrelated path strings will result in an undesirable morphing effect. This method allows the path to first fade out (to opacity 0), update the path string without morphing, then fade back in.
  3806. * @param (rave['internal']['Selection']) selection A selection (either Selector or Transition) containing "path" elements.
  3807. * @param (rave['internal']['ValueFunction']) pathFunction The path string generator function, e.g. Rave.svg.line().
  3808. */
  3809. /** @expose */
  3810. com_ibm_rave_bundles_utilities_PathUtils.fadeOutIn = function(selection, pathFunction) {
  3811. if (selection.isTransition()) {
  3812. var transition = selection;
  3813. transition.ease("linear").styleTween("opacity", function(data, index, value) {
  3814. var path = rave.select(this);
  3815. if (!(this.rave_hasProperty("__rave_originalOpacity__"))) {
  3816. this.rave_setProperty("__rave_originalOpacity__", path.style("opacity"));
  3817. }
  3818. var styleOpacity = this.rave_getProperty("__rave_originalOpacity__");
  3819. var opacity = styleOpacity != null ? parseFloat(""+(styleOpacity)) : 1.0;
  3820. var mid1 = 0.45, mid2 = 0.55;
  3821. var s = rave.scale.linear().domain([0.0, mid1, mid2, 1.0]).range([opacity, 0.0, 0.0, opacity]);
  3822. var setPath = [];
  3823. setPath[0] = false;
  3824. return function(t) {
  3825. if (t > mid1 && !setPath[0]) {
  3826. path.attr("d", pathFunction);
  3827. setPath[0] = true;
  3828. }
  3829. return + (s.call(null, t, 0, 0));
  3830. };
  3831. });
  3832. transition.each("end", function(args) {
  3833. if (args !== null || arguments.length > 1){
  3834. args = Array.prototype.slice.call(arguments, 0);
  3835. }
  3836. {
  3837. this.rave_removeProperty("__rave_originalOpacity__");
  3838. return null;
  3839. }
  3840. });
  3841. } else {
  3842. selection.attr("d", pathFunction);
  3843. }
  3844. };
  3845. //com_ibm_rave_bundles_utilities_PathUtils.OPACITY = "opacity";
  3846. //com_ibm_rave_bundles_utilities_PathUtils.ORIGINAL_OPACITY = "__rave_originalOpacity__";
  3847. //com_ibm_rave_bundles_utilities_PathUtils.PATH_DATA = "d";
  3848. //com_ibm_rave_bundles_utilities_PathUtils.EASE_LINEAR = "linear";
  3849. // $source: com/ibm/rave/bundles/component/LineComponent
  3850. /************************************************************************
  3851. ** IBM Confidential
  3852. **
  3853. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3854. **
  3855. ** (C) Copyright IBM Corp. 2017
  3856. **
  3857. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3858. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3859. ************************************************************************/
  3860. // GENERATED
  3861. /**
  3862. * <p> A component that renders line elements (polylines, each with a series of points in X and Y dimensions, as in a line chart). The {@link #this.type()} method returns "LineComponent". </p>
  3863. */
  3864. var com_ibm_rave_bundles_component_LineComponent = rave['internal']['Declare'].implement(
  3865. /**
  3866. * The interpolation modes are from the RAVE core line path generator, for example "linear", "cardinal".
  3867. * @param (String) interpolate The interpolation mode
  3868. * @return (com.ibm.rave.bundles.component.LineComponent) This component
  3869. */
  3870. //interpolate : function(interpolate) {}
  3871. );
  3872. /**
  3873. * The string returned by {@link #this.type()} is "LineComponent".
  3874. */
  3875. /** @expose */
  3876. com_ibm_rave_bundles_component_LineComponent.COMPONENT_TYPE = "LineComponent";
  3877. // $source: com/ibm/rave/bundles/data/LineDataUtilities
  3878. /************************************************************************
  3879. ** IBM Confidential
  3880. **
  3881. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  3882. **
  3883. ** (C) Copyright IBM Corp. 2017
  3884. **
  3885. ** The source code for this program is not published or otherwise divested of its trade secrets,
  3886. ** irrespective of what has been deposited with the U.S. Copyright Office.
  3887. ************************************************************************/
  3888. // GENERATED
  3889. //@import com/ibm/rave/bundles/data/PointDataUtilities (runtime) // new
  3890. /**
  3891. * <p> Utility class for working with line and area features, as used in the line, area, and composite bundles. A line or area is represented by a LineDatum, which has a group (line ID) and a points array. The points are two-element arrays as used in the RAVE core line and area path generators. </p> <p> The buildLines method takes tabular data and accessors as used in all three bundles' data models, where the table is of <I>point</I> data with X, Y, and group slots. Points with null X are ignored; other points are formed into lines using the group values. Note that line points may have null Y values; this causes a gap in the line or area. Points are added in data order. </p> <p> The other static methods work with an array of LineDatum as returned by buildLines: </p> <ul> <li> Sort each line by the X value of its points, using a CoordinateScale to define X-ordering. </li> <li> Get all points from the lines that have non-null X and Y values. These points are the ones that would be shown in a line-with-points chart. </li> <li> Get all points from the lines that match the "null-point-null" pattern. This means that the point has a non-null Y, and the points before and after it (using the current line sorting) have null Y. The first point in the line is considered to have a null Y before it, and the last point a null Y after it. </li> </ul> <p> Points are returned as an array of PointDatum so may be used in components exactly as the points returned by PointDataUtilities. </p>
  3892. */
  3893. var com_ibm_rave_bundles_data_LineDataUtilities = rave['internal']['Declare']({
  3894. });
  3895. /**
  3896. * <p> Process tabular data as used in the tabular data models of the line, area, and composite bundles, returning an array-list of LineData objects. Each row of data in the table is a single point with X, Y, and optional group values. The group accessor returns strings, as in all three bundles. The points are grouped by the accessor values (null is treated as a distinct value) and each group forms a LineData. If the group accessor is null, all points are in one group. </p> <p> If the xScale is non-null and returns null for an X value, the point is ignored. </p> <p> The LineData group value is the unique group value (possibly null). The LineData points are the [X,Y] coordinates as an ArrayEx, suitable for use with the line and area path generators. The points in each line are in row (input array) order. This wil be the single place where we need to fix the sorting problem, defect 23553. </p>
  3897. * @param (Array) data Array of data objects
  3898. * @param (rave['internal']['SingleValueFunction']) xAccessor Non-null X accessor function
  3899. * @param (rave['internal']['SingleValueFunction']) xScale Value function used to check if X value is in domain
  3900. * @param (rave['internal']['SingleValueFunction']) yAccessor Non-null Y accessor function
  3901. * @param (rave['internal']['SingleValueFunction']) groupAccessor Possibly-null group accessor function
  3902. * @return (Array) Non-null but possibly empty array of LineData items, one per distinct group value
  3903. */
  3904. /** @expose */
  3905. com_ibm_rave_bundles_data_LineDataUtilities.buildLines = function(data, xAccessor, xScale, yAccessor, groupAccessor) {
  3906. var result = [];
  3907. if (!data || data.length == 0) {
  3908. return result;
  3909. }
  3910. var categories = {};
  3911. var noGroup;
  3912. var lines = {};
  3913. for (var __i_enFor0 = 0, __exp_enFor0 = data, __len_enFor0 = __exp_enFor0.length;
  3914. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  3915. var datum = __exp_enFor0[__i_enFor0];
  3916. if (datum == null) {
  3917. continue;
  3918. }
  3919. var xValue = xAccessor(datum);
  3920. if (xValue != null && (!xScale || xScale(xValue) != null)) {
  3921. if (!(categories.hasOwnProperty(xValue))) {
  3922. categories[""+(xValue)] = 1;
  3923. }
  3924. var group = groupAccessor ? (groupAccessor(datum)) : null;
  3925. var line;
  3926. if (group == null) {
  3927. if (!noGroup) {
  3928. noGroup = new com_ibm_rave_bundles_data_LineDataUtilities.LineDatum(null);
  3929. result.push(noGroup);
  3930. }
  3931. line = noGroup;
  3932. } else {
  3933. line = lines[group];
  3934. if (!line) {
  3935. line = new com_ibm_rave_bundles_data_LineDataUtilities.LineDatum(group);
  3936. lines[group] = line;
  3937. result.push(line);
  3938. }
  3939. }
  3940. line.addPoint(datum, xValue, yAccessor(datum));
  3941. }
  3942. }
  3943. for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(categories), __len_enFor1 = __exp_enFor1.length;
  3944. __i_enFor1 < __len_enFor1; ++__i_enFor1) {
  3945. var o = __exp_enFor1[__i_enFor1];
  3946. var s = ""+(o);
  3947. var sum = 0;
  3948. for (var i = 0; i < result.length; ++i) {
  3949. var lineDatum = result[i];
  3950. for (var j = 0; j < lineDatum._pointData.length; ++j) {
  3951. var pointDatum = lineDatum._pointData[j];
  3952. if (s == pointDatum._x) {
  3953. pointDatum._yAsPercentOfCategory = NaN;
  3954. var value = + (pointDatum._y);
  3955. sum += Math.abs(value);
  3956. }
  3957. }
  3958. }
  3959. if (sum == 0) {
  3960. continue;
  3961. }
  3962. for (var i = 0; i < result.length; ++i) {
  3963. var lineDatum = result[i];
  3964. for (var j = 0; j < lineDatum._pointData.length; ++j) {
  3965. var pointDatum = lineDatum._pointData[j];
  3966. if (s == pointDatum._x) {
  3967. var value = + (pointDatum._y);
  3968. pointDatum._yAsPercentOfCategory = value / sum * 100;
  3969. }
  3970. }
  3971. }
  3972. }
  3973. for (var i = 0; i < result.length; ++i) {
  3974. var sum = 0;
  3975. var lineDatum = result[i];
  3976. for (var j = 0; j < lineDatum._pointData.length; ++j) {
  3977. var pointDatum = lineDatum._pointData[j];
  3978. pointDatum._yAsPercentOfColor = NaN;
  3979. var value = + (pointDatum._y);
  3980. sum += Math.abs(value);
  3981. }
  3982. if (sum != 0) {
  3983. for (var j = 0; j < lineDatum._pointData.length; ++j) {
  3984. var pointDatum = lineDatum._pointData[j];
  3985. var value = + (pointDatum._y);
  3986. pointDatum._yAsPercentOfColor = value / sum * 100;
  3987. }
  3988. }
  3989. }
  3990. return result;
  3991. };
  3992. com_ibm_rave_bundles_data_LineDataUtilities.get = function(val, data) {
  3993. for (var i = 0; i < data.length; ++i) {
  3994. var entry = data[i];
  3995. if (entry.key===val) {
  3996. return entry;
  3997. }
  3998. }
  3999. return null;
  4000. };
  4001. /** @expose */
  4002. com_ibm_rave_bundles_data_LineDataUtilities.buildLinesForStacking = function(data, xAccessor, yAccessor, groupAccessor) {
  4003. if (!data || data.length == 0) {
  4004. return [];
  4005. }
  4006. var keyToOriginalValue = {};
  4007. var stacks = [];
  4008. var nest = rave.nest();
  4009. nest.key(function(d) {
  4010. var keyValue = xAccessor(d);
  4011. var strKeyValue = (keyValue);
  4012. keyToOriginalValue[strKeyValue] = keyValue;
  4013. return strKeyValue;
  4014. });
  4015. nest.key(function(d) {
  4016. var stack = groupAccessor(d).toString();
  4017. if (!(stacks.indexOf(stack)> -1)) {
  4018. stacks.push(stack);
  4019. }
  4020. return stack;
  4021. });
  4022. var result = nest.entries(data);
  4023. var missingValue = new Number(0);
  4024. var stackData = stacks.map(function(name, index, array) {
  4025. var line = new com_ibm_rave_bundles_data_LineDataUtilities.LineDatum(array[index].valueOf());
  4026. result.forEach(function(currentValue, index, array) {
  4027. var values = currentValue.values;
  4028. var currentElement = com_ibm_rave_bundles_data_LineDataUtilities.get(line.group, values);
  4029. var datum = null;
  4030. var yValue = null;
  4031. if (!currentElement) {
  4032. yValue = missingValue;
  4033. } else {
  4034. datum = (currentElement.values)[0];
  4035. yValue = yAccessor(datum);
  4036. if (yValue == null) {
  4037. yValue = missingValue;
  4038. }
  4039. }
  4040. line.addPoint(datum, keyToOriginalValue[currentValue.key], yValue);
  4041. return null;
  4042. });
  4043. return line;
  4044. });
  4045. return stackData;
  4046. };
  4047. /**
  4048. * <p> Sort an array of LineData by the X-coordinate. The CoordinateScale must be initialized with the domain of the line data, and its range must be set. The points of each line are sorted in increasing order of the scaled X-value. </p> <p> For efficiency this method assumes the lines are as created by buildLines, so each point is non-null, and has two values of which the first is non-null. </p>
  4049. * @param (Array) lines A non-null array of LineDatum objects, such as produced by buildLines
  4050. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale A non-null scale
  4051. */
  4052. /** @expose */
  4053. com_ibm_rave_bundles_data_LineDataUtilities.sortLines = function(lines, scale) {
  4054. var comp = function(a, b) {
  4055. var av = scale.center(a._x);
  4056. if (av == null) {
  4057. return 1;
  4058. }
  4059. var bv = scale.center(b._x);
  4060. if (bv == null) {
  4061. return -1;
  4062. }
  4063. var v = av - bv;
  4064. return v < 0 ? -1 : v > 0 ? 1 : 0;
  4065. };
  4066. for (var __i_enFor0 = 0, __exp_enFor0 = lines, __len_enFor0 = __exp_enFor0.length;
  4067. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4068. var line = __exp_enFor0[__i_enFor0];
  4069. line.sort(comp);
  4070. }
  4071. };
  4072. /**
  4073. * Get one PointDatum object for every point in the lines, omitting any points where the X or Y value is null. The returned array may be empty.
  4074. * @param (Array) lines A non-null array of LineDatum objects, such as produced by buildLines
  4075. * @return (Array) Array of PointDatum for points where X and Y are both non-null
  4076. */
  4077. /** @expose */
  4078. com_ibm_rave_bundles_data_LineDataUtilities.getLineWithPoints = function(lines) {
  4079. var result = [];
  4080. for (var __i_enFor0 = 0, __exp_enFor0 = lines, __len_enFor0 = __exp_enFor0.length;
  4081. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4082. var line = __exp_enFor0[__i_enFor0];
  4083. line.getLineWithPoints(result);
  4084. }
  4085. return result;
  4086. };
  4087. /**
  4088. * Get one PointDatum object for every point in the lines that meets the "null-point-null" criterion: The point has non-null X and Y, and the points before/after it have null Y.
  4089. * @param (Array) lines A non-null array of LineDatum objects, such as produced by buildLines
  4090. * @return (Array) Array of PointDatum for points meeting the null-point-null criterion
  4091. */
  4092. /** @expose */
  4093. com_ibm_rave_bundles_data_LineDataUtilities.getNPNPoints = function(lines) {
  4094. var result = [];
  4095. for (var __i_enFor0 = 0, __exp_enFor0 = lines, __len_enFor0 = __exp_enFor0.length;
  4096. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4097. var line = __exp_enFor0[__i_enFor0];
  4098. line.getNPNPoints(result);
  4099. }
  4100. return result;
  4101. };
  4102. /**
  4103. * <p> Representation of a line. Assumes that the line will be built from data objects representing points, and grouped into lines by a group key. Contains: </p> <p> Group key, for the line identifier. May be null. </p> <p> Array of PointDatum objects. This is used when sorting the point data. </p> <p> Array of points for line or area generator. Each point is a two-element [x,y] array in the unscaled data space. </p> <p> Original data. This is an array of objects from the original point data. </p>
  4104. */
  4105. com_ibm_rave_bundles_data_LineDataUtilities.LineDatum = rave['internal']['Declare']({
  4106. /**
  4107. * Group key, may be null
  4108. */
  4109. /** @expose */
  4110. group : null,
  4111. /**
  4112. * Array of line-generator points in data space, non-null but may be empty
  4113. */
  4114. /** @expose */
  4115. points : null,
  4116. /**
  4117. * Array of point datum objects, non-null but may be empty.
  4118. */
  4119. //_pointData : null,
  4120. /**
  4121. * Original data, non-null but may be empty.
  4122. */
  4123. //_originalData : null,
  4124. /**
  4125. * Construct.
  4126. * @param (String) group The line's group.
  4127. */
  4128. constructor : function(group) {
  4129. this.group = group;
  4130. this.points = [];
  4131. this._pointData = [];
  4132. this._originalData = [];
  4133. },
  4134. /** @expose */
  4135. originalData : function() {
  4136. return this._originalData;
  4137. },
  4138. /** @expose */
  4139. originalDataList : function() {
  4140. return this._originalData;
  4141. },
  4142. /**
  4143. * Add a point to the line.
  4144. * @param (Object) originalData Original data for this point
  4145. * @param (Object) x X value, must not be null
  4146. * @param (Object) y Y value, may be null (for line/non-stacking area charts with gaps for null Y)
  4147. */
  4148. addPoint : function(originalData, x, y) {
  4149. var point = new com_ibm_rave_bundles_data_PointDataUtilities.PointDatum();
  4150. point._x = x;
  4151. point._y = y;
  4152. point._originalData = originalData;
  4153. this.points.push([x, y]);
  4154. this._pointData.push(point);
  4155. this._originalData.push(originalData);
  4156. },
  4157. /**
  4158. * Sort the points by X value (data values) using the comparator, which must compare the X values of two PointDatum objects. The PointDatum array is sorted first, then the line generator and original data arrays are sorted to match.
  4159. * @param (rave['internal']['Comparator']) comp Comparator that takes PointDatum arguments and sorts by X value
  4160. */
  4161. sort : function(comp) {
  4162. this._pointData.sort(comp);
  4163. var N = this._pointData.length;
  4164. for (var i = 0; i < N; ++i) {
  4165. var d = this._pointData[i];
  4166. var p = this.points[i];
  4167. p[0] = d._x;
  4168. p[1] = d._y;
  4169. this._originalData[i] = d._originalData;
  4170. }
  4171. },
  4172. /**
  4173. * Add all PointDatum objects where X and Y are non-null to the array. For efficiency this assumes the X values are non-null.
  4174. * @param (Array) result Array collecting points
  4175. */
  4176. getLineWithPoints : function(result) {
  4177. for (var __i_enFor0 = 0, __exp_enFor0 = this._pointData, __len_enFor0 = __exp_enFor0.length;
  4178. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4179. var point = __exp_enFor0[__i_enFor0];
  4180. if (point._y != null) {
  4181. result.push(point);
  4182. }
  4183. }
  4184. },
  4185. /**
  4186. * Add all PointDatum objects that meet the "null-point-null" criterion to the array. For efficiency this assumes the X values are non-null.
  4187. * @param (Array) result Array collecting points
  4188. */
  4189. getNPNPoints : function(result) {
  4190. var N = this._pointData.length;
  4191. var lastY;
  4192. for (var i = 0; i < N; ++i) {
  4193. var point = this._pointData[i];
  4194. if (point._y != null) {
  4195. var nextY = (i < N - 1) ? this._pointData[i + 1]._y : null;
  4196. if (lastY == null && nextY == null) {
  4197. result.push(point);
  4198. }
  4199. }
  4200. lastY = point._y;
  4201. }
  4202. }
  4203. });
  4204. /**
  4205. * A value function that takes a LineData as argument and returns the group.
  4206. */
  4207. /** @expose */
  4208. com_ibm_rave_bundles_data_LineDataUtilities.GROUP_ACCESSOR = function(d) {
  4209. return (d).group;
  4210. };
  4211. /**
  4212. * A value function that takes a LineData as argument and returns theoints.
  4213. */
  4214. /** @expose */
  4215. com_ibm_rave_bundles_data_LineDataUtilities.POINTS_ACCESSOR = function(d) {
  4216. return (d).points;
  4217. };
  4218. // $source: com/ibm/rave/bundles/component/PointComponent
  4219. /************************************************************************
  4220. ** IBM Confidential
  4221. **
  4222. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4223. **
  4224. ** (C) Copyright IBM Corp. 2017
  4225. **
  4226. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4227. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4228. ************************************************************************/
  4229. // GENERATED
  4230. /**
  4231. * <p> A component that renders point elements (glyphs based on data, showing a point with X and Y dimensions, as in a scatterplot chart). The {@link #this.type()} method returns "PointComponent". </p>
  4232. */
  4233. var com_ibm_rave_bundles_component_PointComponent = rave['internal']['Declare'].implement(
  4234. /**
  4235. * The default size used for a point, when no size scale is used or when the size data for the element is null.
  4236. * @param (double) defaultSize The new defaultSize
  4237. * @return (com.ibm.rave.bundles.component.PointComponent) This component
  4238. */
  4239. //defaultSize : function(defaultSize) {},
  4240. /**
  4241. * Turn labels on or off. If labels are on but there is no label data, empty text nodes will be created.
  4242. * @param (boolean) itemLabel Whether to use labels
  4243. * @return (com.ibm.rave.bundles.component.PointComponent) This component
  4244. */
  4245. //itemLabel : function(itemLabel) {},
  4246. /**
  4247. * Whether to drop overlapping labels.
  4248. * @param (boolean) itemOverlap The new itemOverlap
  4249. * @return (com.ibm.rave.bundles.component.PointComponent) This component
  4250. */
  4251. //itemOverlap : function(itemOverlap) {},
  4252. /**
  4253. * The symbol to be used for the points.
  4254. * @param (String) symbol The new symbol
  4255. * @return (com.ibm.rave.bundles.component.PointComponent) This component
  4256. */
  4257. //symbol : function(symbol) {},
  4258. /**
  4259. * Set the width of border
  4260. * @param (String) borderWidth CSS value
  4261. * @return (com.ibm.rave.bundles.component.PointComponent) This component
  4262. */
  4263. //borderWidth : function(borderWidth) {},
  4264. /**
  4265. * Set the color of border
  4266. * @param (String) borderColor
  4267. * @return (com.ibm.rave.bundles.component.PointComponent) This component
  4268. */
  4269. //borderColor : function(borderColor) {},
  4270. /**
  4271. * Set the classname of the labellayer
  4272. * @param string
  4273. * @return (com.ibm.rave.bundles.component.PointComponent) This object
  4274. */
  4275. //labelLayerClassName : function(className) {},
  4276. /**
  4277. * Set the classname of the elementlayer
  4278. * @param string
  4279. * @return (com.ibm.rave.bundles.component.PointComponent) This object
  4280. */
  4281. //elementLayerClassName : function(className) {},
  4282. /**
  4283. * Sets function that will specify position of item label for given chart element.
  4284. * @param (rave['internal']['ValueFunction']) labelPosition Function to be used to determine label position
  4285. * @return (com.ibm.rave.bundles.component.PointComponent) This object
  4286. */
  4287. //itemLabelPosition : function(labelPosition) {}
  4288. );
  4289. /**
  4290. * The string returned by {@link #this.type()} is "PointComponent".
  4291. */
  4292. /** @expose */
  4293. com_ibm_rave_bundles_component_PointComponent.COMPONENT_TYPE = "PointComponent";
  4294. // $source: com/ibm/rave/bundles/utilities/LabelStyleUtil
  4295. /************************************************************************
  4296. ** IBM Confidential
  4297. **
  4298. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4299. **
  4300. ** (C) Copyright IBM Corp. 2017
  4301. **
  4302. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4303. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4304. ************************************************************************/
  4305. // GENERATED
  4306. //@import com/ibm/rave/bundles/components/FilterComponentImpl (runtime) // new
  4307. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor, getContrastRatio
  4308. /**
  4309. * This class can be used to apply styles on labels. Eg: when we need to overrule the given label style properties.
  4310. */
  4311. var com_ibm_rave_bundles_utilities_LabelStyleUtil = rave['internal']['Declare']({
  4312. //_labelFontStyle : null,
  4313. //_contrastLabelColorfilter : null,
  4314. //_sameLabelColorfilter : null,
  4315. /**
  4316. * eg: apply contrast label color with background. apply different font size for each level label. apply a contrast shadow for a label.
  4317. */
  4318. //_labelFillColor : null,
  4319. //_labelFontSize : null,
  4320. _labelShadow : false,
  4321. _$functionClassMethod : function() {
  4322. var _$self = function(args) {
  4323. if (args !== null || arguments.length > 1){
  4324. args = Array.prototype.slice.call(arguments, 0);
  4325. }
  4326. {
  4327. if (_$self._labelFontStyle) {
  4328. for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(_$self._labelFontStyle), __len_enFor0 = __exp_enFor0.length;
  4329. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  4330. var stylenName = __exp_enFor0[__i_enFor0];
  4331. if ((stylenName == "fill" || stylenName == "color" && _$self._labelFillColor) || (stylenName == "font-size" && _$self._labelFontSize) || (stylenName == "text-shadow" && _$self._labelShadow == true)) {
  4332. continue;
  4333. }
  4334. this.style(stylenName, _$self._labelFontStyle[stylenName]);
  4335. }
  4336. }
  4337. if (_$self._labelFillColor) {
  4338. this.style("fill", _$self._labelFillColor);
  4339. }
  4340. if (_$self._labelFontSize) {
  4341. this.style("font-size", _$self._labelFontSize);
  4342. }
  4343. var labels = this.selectAll("*");
  4344. if (labels.length == 0) {
  4345. labels = this;
  4346. }
  4347. if (_$self._labelShadow) {
  4348. var self = _$self;
  4349. var defaultLabelFill = _$self.getDefaultLabelColor(_$self._labelFontStyle);
  4350. _$self._contrastLabelColorfilter = new com_ibm_rave_bundles_components_FilterComponentImpl("contrast_label_drop_shadow");
  4351. _$self._contrastLabelColorfilter.setDropshadow("1px", "1px", "0px", rave.rgb(com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(defaultLabelFill)));
  4352. _$self._sameLabelColorfilter = new com_ibm_rave_bundles_components_FilterComponentImpl("same_label_drop_shadow");
  4353. _$self._sameLabelColorfilter.setDropshadow("1px", "1px", "0px", rave.rgb(defaultLabelFill));
  4354. var owner = this.node().rave_getOwner();
  4355. rave.select(owner).select("defs").call(_$self._contrastLabelColorfilter);
  4356. rave.select(owner).select("defs").call(_$self._sameLabelColorfilter);
  4357. this.each(function(data, index, groupIndex) {
  4358. if (self._labelFillColor) {
  4359. var contrastRatio = com_ibm_rave_bundles_utilities_ColorUtil.getContrastRatio(rave.rgb(self._labelFillColor.call(this, data, index, groupIndex)), defaultLabelFill);
  4360. if (contrastRatio < 4.5) {
  4361. this.setAttribute("filter", "url(#" + self._contrastLabelColorfilter.getId() + ")");
  4362. } else {
  4363. this.setAttribute("filter", "url(#" + self._sameLabelColorfilter.getId() + ")");
  4364. }
  4365. } else {
  4366. this.setAttribute("filter", "url(#" + self._contrastLabelColorfilter.getId() + ")");
  4367. }
  4368. });
  4369. labels.each(function(data, index, groupIndex) {
  4370. if (self._labelFillColor) {
  4371. this.rave_setProperty("_rave_drop_shadow", "1px 1px 0px " + com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(self._labelFillColor.call(this, data, index, groupIndex)).toString());
  4372. } else {
  4373. this.rave_setProperty("_rave_drop_shadow", "1px 1px 0px " + com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(defaultLabelFill).toString());
  4374. }
  4375. });
  4376. } else {
  4377. labels.each(function(data, index, groupIndex) {
  4378. this.rave_setProperty("_rave_drop_shadow", null);
  4379. });
  4380. this.attr("filter", null);
  4381. }
  4382. return null;
  4383. }
  4384. };
  4385. return _$self;
  4386. },
  4387. /** @expose */
  4388. labelFont : function(labelFontStyle) {
  4389. this._labelFontStyle = labelFontStyle;
  4390. return this;
  4391. },
  4392. /** @expose */
  4393. labelFillColor : function(_labelFillColor) {
  4394. this._labelFillColor = _labelFillColor;
  4395. return this;
  4396. },
  4397. /** @expose */
  4398. labelFontSize : function(_labelFontSize) {
  4399. this._labelFontSize = _labelFontSize;
  4400. return this;
  4401. },
  4402. /** @expose */
  4403. labelShadow : function(labelShadow) {
  4404. this._labelShadow = labelShadow;
  4405. return this;
  4406. },
  4407. /** @expose */
  4408. getDefaultLabelColor : function(_labelStyle) {
  4409. if (!_labelStyle) {
  4410. return "#000000";
  4411. }
  4412. var defaultFillColor;
  4413. if (_labelStyle) {
  4414. defaultFillColor = _labelStyle["fill"];
  4415. if (defaultFillColor == null) {
  4416. defaultFillColor = _labelStyle["color"];
  4417. }
  4418. }
  4419. if (defaultFillColor == null) {
  4420. defaultFillColor = "#000000";
  4421. }
  4422. return defaultFillColor.toString();
  4423. }
  4424. });
  4425. // $source: com/ibm/rave/bundles/components/ComponentConfiguration
  4426. /************************************************************************
  4427. ** IBM Confidential
  4428. **
  4429. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4430. **
  4431. ** (C) Copyright IBM Corp. 2017
  4432. **
  4433. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4434. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4435. ************************************************************************/
  4436. // GENERATED
  4437. /**
  4438. * 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"} .
  4439. */
  4440. var com_ibm_rave_bundles_components_ComponentConfiguration = rave['internal']['Declare']({
  4441. //constructor : function() {}
  4442. });
  4443. /**
  4444. * <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>
  4445. * @param (rave['internal']['Selection']) chart Selection on which to run the zoom, may be null
  4446. * @param (rave['internal']['Zoom']) zoom The Zoom; if null one is created and returned
  4447. * @param (rave['library']['internal']['CoordinateScaleImpl']) xScale X dimension scale, may be null
  4448. * @param (rave['library']['internal']['CoordinateScaleImpl']) yScale Y dimension scale, may be null
  4449. * @param (rave['library']['internal']['CoordinateScaleImpl']) x2Scale X2 dimension scale, may be null
  4450. * @param (rave['library']['internal']['CoordinateScaleImpl']) y2Scale Y2 dimension scale, may be null
  4451. * @param (Array) scaleExtent Scale extent, may be null; if null the range 0.2 to 5.0 is used
  4452. * @param (rave['internal']['RectStruct']) chartRect The rectangle of the chart
  4453. * @param (double[]) p the zoom translate position (x, y, x2, y2)
  4454. * @param (double[]) s the zoom scale (x, y, x2, y2)
  4455. * @param (String) zoomOps The zoom operation (x|y|x2|y2|all)
  4456. * @param (rave['internal']['RunFunction']) callback Callback on each zoom event, must not be null
  4457. * @return (rave['internal']['Zoom']) The zoom
  4458. */
  4459. /** @expose */
  4460. com_ibm_rave_bundles_components_ComponentConfiguration.configureZoom = function(chart, zoom, xScale, yScale, x2Scale, y2Scale, scaleExtent, chartRect, p, s, zoomOps, callback) {
  4461. var z = zoom ? zoom : rave.behavior.zoom();
  4462. var z1 = (x2Scale || y2Scale) && zoomOps == "all" ? rave.behavior.zoom() : null;
  4463. var dummyScale = (rave.scale.linear());
  4464. z.x(dummyScale);
  4465. z.y(dummyScale);
  4466. if (xScale && zoomOps == "x") {
  4467. z.x(xScale.scale());
  4468. z.scale(s[0]);
  4469. z.translate([p[0], 0]);
  4470. }
  4471. if (yScale && zoomOps == "y") {
  4472. z.y(yScale.scale());
  4473. z.scale(s[1]);
  4474. z.translate([0, p[1]]);
  4475. }
  4476. if (x2Scale && zoomOps == "x2") {
  4477. z.x(x2Scale.scale());
  4478. z.scale(s[2]);
  4479. z.translate([p[2], 0]);
  4480. }
  4481. if (y2Scale && zoomOps == "y2") {
  4482. z.y(y2Scale.scale());
  4483. z.scale(s[3]);
  4484. z.translate([0, p[3]]);
  4485. }
  4486. if (zoomOps == "all") {
  4487. if (xScale) {
  4488. z.x(xScale.scale());
  4489. }
  4490. if (yScale) {
  4491. z.y(yScale.scale());
  4492. }
  4493. z.scale(1);
  4494. z.translate([0, 0]);
  4495. if (z1) {
  4496. if (x2Scale) {
  4497. z1.x(x2Scale.scale());
  4498. }
  4499. if (y2Scale) {
  4500. z1.y(y2Scale.scale());
  4501. }
  4502. z1.scale(1);
  4503. z1.translate([0, 0]);
  4504. }
  4505. }
  4506. z.scaleExtent(scaleExtent ? scaleExtent : [1, Infinity]).on("zoom.default", function(args) {
  4507. if (args !== null || arguments.length > 1){
  4508. args = Array.prototype.slice.call(arguments, 0);
  4509. }
  4510. {
  4511. var event = args[3];
  4512. var scale = event.scale;
  4513. var translate = event.translate;
  4514. var scaledX = chartRect.x * (scale - 1);
  4515. var scaledXExtent = (chartRect.width * (1 - scale)) - scaledX;
  4516. translate[0] = Math.min(-scaledX, Math.max(scaledXExtent, translate[0]));
  4517. var scaledY = chartRect.y * (scale - 1);
  4518. var scaledYExtent = (chartRect.height * (1 - scale)) - scaledY;
  4519. translate[1] = Math.min(-scaledY, Math.max(scaledYExtent, translate[1]));
  4520. z.translate([translate[0], translate[1]]);
  4521. if (z1) {
  4522. z1.translate([translate[0], translate[1]]);
  4523. z1.scale(scale);
  4524. }
  4525. if (zoomOps == "x") {
  4526. p[0] = translate[0];
  4527. s[0] = scale;
  4528. } else if (zoomOps == "y") {
  4529. p[1] = translate[1];
  4530. s[1] = scale;
  4531. } else if (zoomOps == "x2") {
  4532. p[2] = translate[0];
  4533. s[2] = scale;
  4534. } else if (zoomOps == "y2") {
  4535. p[3] = translate[1];
  4536. s[3] = scale;
  4537. } else if (zoomOps == "all") {
  4538. p[0] = translate[0];
  4539. p[1] = translate[1];
  4540. p[2] = translate[0];
  4541. p[3] = translate[1];
  4542. s[0] = scale;
  4543. s[1] = scale;
  4544. s[2] = scale;
  4545. s[3] = scale;
  4546. }
  4547. return callback.apply(this, args);
  4548. }
  4549. });
  4550. return z;
  4551. };
  4552. // $source: com/ibm/rave/bundles/internal/nativeImpl/BundleModule
  4553. /************************************************************************
  4554. ** IBM Confidential
  4555. **
  4556. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4557. **
  4558. ** (C) Copyright IBM Corp. 2015
  4559. **
  4560. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4561. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4562. ************************************************************************/
  4563. // Must be the first import
  4564. // @import ./BundleModuleHeader
  4565. // expose DataFormatter to the global variable rave
  4566. //rave["library"]["CustomFormatter"]=com_ibm_rave_library_framework_CustomFormatter;
  4567. // $source: com/ibm/rave/bundles/lineBundle/LineBundle
  4568. /************************************************************************
  4569. ** IBM Confidential
  4570. **
  4571. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4572. **
  4573. ** (C) Copyright IBM Corp. 2017
  4574. **
  4575. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4576. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4577. ************************************************************************/
  4578. // GENERATED
  4579. //@import com/ibm/rave/library/Library (static) // Library
  4580. //@import com/ibm/rave/bundles/RaveBundle (loadtime) // superclass
  4581. //@import com/ibm/rave/bundles/lineBundle/LineView (runtime) // new
  4582. var com_ibm_rave_bundles_lineBundle_LineBundle = rave['internal']['Declare'](com_ibm_rave_bundles_RaveBundle, {
  4583. /** @expose */
  4584. getName : function() {
  4585. return "lineBundle";
  4586. },
  4587. /** @expose */
  4588. createView : function(ctx) {
  4589. return new com_ibm_rave_bundles_lineBundle_LineView(ctx);
  4590. }
  4591. //constructor : function() {}
  4592. });
  4593. /**
  4594. * Register the bundle factory with the library. The bundle will not be made available if this method is not called.
  4595. */
  4596. /** @expose */
  4597. com_ibm_rave_bundles_lineBundle_LineBundle.init = function() {
  4598. if (!(com_ibm_rave_library_Library.bundle.isRegistered("lineBundle"))) {
  4599. var bundle;
  4600. com_ibm_rave_library_Library.bundle.extension("lineBundle", function() {
  4601. if (!bundle) {
  4602. bundle = new com_ibm_rave_bundles_lineBundle_LineBundle();
  4603. bundle.loadResources();
  4604. require("./vizlibrary-line.css");
  4605. }
  4606. return bundle;
  4607. });
  4608. }
  4609. return "lineBundle";
  4610. };
  4611. com_ibm_rave_bundles_lineBundle_LineBundle.BUNDLE_NAME = "lineBundle";
  4612. // Auto initialization
  4613. com_ibm_rave_bundles_lineBundle_LineBundle.init();
  4614. if (!com_ibm_rave_library_Library.bundle["lineBundle"]) {
  4615. com_ibm_rave_library_Library.bundle["lineBundle"] = function() {
  4616. if (!bundle) {
  4617. bundle = new com_ibm_rave_bundles_lineBundle_LineBundle();
  4618. bundle.loadResources();
  4619. require("./vizlibrary-line.css");
  4620. }
  4621. return bundle;
  4622. };
  4623. } else {
  4624. console.log("Could not register extension: LineBundle");
  4625. }
  4626. // $source: com/ibm/rave/bundles/lineBundle/LineView
  4627. /************************************************************************
  4628. ** IBM Confidential
  4629. **
  4630. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4631. **
  4632. ** (C) Copyright IBM Corp. 2018
  4633. **
  4634. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4635. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4636. ************************************************************************/
  4637. // GENERATED
  4638. //@import com/ibm/rave/bundles/views/BundleView (loadtime) // superclass
  4639. //@import com/ibm/rave/bundles/components/LineComponentImpl (runtime) // new
  4640. //@import com/ibm/rave/bundles/data/LineDataUtilities (runtime) // getNPNPoints, buildLines, sortLines, LineDataUtilities, getLineWithPoints
  4641. //@import com/ibm/rave/bundles/components/PointComponentImpl (runtime) // new
  4642. //@import com/ibm/rave/bundles/data/PointDataUtilities (runtime) // PointDataUtilities
  4643. //@import com/ibm/rave/bundles/components/ComponentConfiguration (runtime) // configureZoom
  4644. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  4645. /**
  4646. * Draws a line chart with axes, grid, and legend, using the components.
  4647. */
  4648. var com_ibm_rave_bundles_lineBundle_LineView = rave['internal']['Declare'](com_ibm_rave_bundles_views_BundleView, {
  4649. /**
  4650. * Line component,
  4651. */
  4652. //_lineComponent : null,
  4653. /**
  4654. * Point component
  4655. */
  4656. //_pointComponent : null,
  4657. /**
  4658. * Dependent coordinate scale
  4659. */
  4660. //_dependentScale : null,
  4661. /**
  4662. * Independent coordinate scale
  4663. */
  4664. //_independentScale : null,
  4665. /**
  4666. * Line data
  4667. */
  4668. //_lineData : null,
  4669. /**
  4670. * Point data; the line points which have non-null X and Y
  4671. */
  4672. //_pointData : null,
  4673. /**
  4674. * Null-point data; the line points which have non-null X and Y, and are flanked by points with null Y
  4675. */
  4676. //_pointNPNData : null,
  4677. //zoomXScale : null, //zoomYScale : null,
  4678. //zoomendedTimer : null,
  4679. /**
  4680. * Construct the view
  4681. * @param (rave['library']['internal']['BundleContext']) context Bundle context
  4682. */
  4683. /** @expose */
  4684. constructor : function(context) {
  4685. this._lineComponent = null;
  4686. this._lineData = null;
  4687. this._pointData = null;
  4688. this._pointNPNData = null;
  4689. },
  4690. /** @expose */
  4691. isAxesManagerRequired : function() {
  4692. return true;
  4693. },
  4694. /** @expose */
  4695. setup : function() {
  4696. com_ibm_rave_bundles_views_BundleView.prototype.setup.call(this);
  4697. rave['library']['internal']['BundleUtils'].setupDefaultActions(this.context, ".chart ." + "element-shape", null);
  4698. var highlightAction = this.context.actions.action("highlight");
  4699. var unhighlightAction = this.context.actions.action("unhighlight");
  4700. var self = this;
  4701. highlightAction.setBindFn(function() {
  4702. self.context.node.selectAll(".element-line .element-shape").on("mouseenter.default", function(data, index, groupIndex, event) {
  4703. var attributes = {};
  4704. attributes["stroke-width"] = "4px";
  4705. highlightAction(rave.select(this), attributes);
  4706. });
  4707. self.context.node.selectAll(".element-point .element-shape").on("mouseenter.default", function(data, index, groupIndex, event) {
  4708. highlightAction(rave.select(this));
  4709. });
  4710. });
  4711. highlightAction.setUnbindFn(function() {
  4712. self.context.node.selectAll(".element-shape").on("mouseenter.default", null);
  4713. });
  4714. unhighlightAction.setBindFn(function() {
  4715. self.context.node.selectAll(".element-line .element-shape").on("mouseout.default", function(data, index, groupIndex, event) {
  4716. var attributes = {};
  4717. attributes["stroke-width"] = "2px";
  4718. unhighlightAction(rave.select(this), attributes);
  4719. });
  4720. self.context.node.selectAll(".element-point .element-shape").on("mouseout.default", function(data, index, groupIndex, event) {
  4721. var attributes = {};
  4722. attributes["stroke-width"] = "0px";
  4723. unhighlightAction(rave.select(this), attributes);
  4724. });
  4725. });
  4726. unhighlightAction.setUnbindFn(function() {
  4727. self.context.node.selectAll(".element-shape").on("mouseout.default", null);
  4728. });
  4729. var deselectAllAction = this.context.actions.action("deselectAll");
  4730. var deselectAllEventListener = function(data, index, groupIndex, event) {
  4731. self.context.node.selectAll(".element-shape").style("stroke-width", 0).style("opacity", 1).property("selected", null);
  4732. self.context.node.selectAll(".element-line .element-shape").style("stroke-width", 2);
  4733. };
  4734. deselectAllAction.setBindFn(rave['library']['internal']['BundleUtils'].bindOrUnbindActionFunctionCreater(this.context, ".background", ["click.default", "touchstart.default"], deselectAllEventListener));
  4735. this._lineComponent = new com_ibm_rave_bundles_components_LineComponentImpl();
  4736. this._lineComponent.pointsAccessor(com_ibm_rave_bundles_data_LineDataUtilities.POINTS_ACCESSOR).groupAccessor(com_ibm_rave_bundles_data_LineDataUtilities.GROUP_ACCESSOR);
  4737. this._pointComponent = new com_ibm_rave_bundles_components_PointComponentImpl();
  4738. this._pointComponent.independentAccessor(com_ibm_rave_bundles_data_PointDataUtilities.X_ACCESSOR).dependentAccessor(com_ibm_rave_bundles_data_PointDataUtilities.Y_ACCESSOR);
  4739. },
  4740. /** @expose */
  4741. draw : function() {
  4742. if (this.isUpdateNothing()) {
  4743. return;
  4744. }
  4745. this.preDraw("g.vizlibrary-line");
  4746. if (!(this.validateDataModel("g.element-group", "g.grid", "g.axis"))) {
  4747. return;
  4748. }
  4749. var effect = this.getStringProperty("effect.name");
  4750. var duration = this.getEffectDuration(effect);
  4751. var dataSet = this.dataModel.dataset("data");
  4752. var yDataSlotEntry = dataSet.slot("y").entry();
  4753. var colorDataSlotEntry = dataSet.slot("color").entry();
  4754. if (!colorDataSlotEntry && yDataSlotEntry) {
  4755. dataSet.slot("color").overrideLabel(yDataSlotEntry.label());
  4756. }
  4757. var data = (dataSet.data());
  4758. var transpose = this.getBooleanProperty("transpose");
  4759. var colorPalette = this.getPalette();
  4760. colorPalette.setData(dataSet, "color");
  4761. colorPalette.setAccessor(com_ibm_rave_bundles_data_LineDataUtilities.GROUP_ACCESSOR);
  4762. var legendPosition = this.getLegendPosition();
  4763. var drawOptions = this.getStringProperty("lineWithPoints.display");
  4764. this._legends.visible(this.isShowLegend()).position(legendPosition).transition(!("none" == effect), duration).setPreExecute(this.context.getPreExecute()).selector(0, this.context.node.selectAll("g.legend")).palette(0, colorPalette).shape(0, (!(drawOptions == "line")) ? this.getStringProperty("lineWithPoints.symbol") : "compositeViewLegendLineSymbol").title(0, this.context.getDataSlotLabel("legend.title", dataSet.slot("color").entry())).titleFill(0, (this.context.getPropertyValue("legend.titlestyle.fill"))).titleFontSize(0, (this.context.getPropertyValue("legend.titlestyle.fontsize"))).titleFontFamily(0, (this.context.getPropertyValue("legend.titlestyle.fontfamily"))).setDataSlot(0, dataSet.slot("color").entry());
  4765. if (this.updateType == 0) {
  4766. var xEntry = dataSet.slot("x").entry();
  4767. this._lineData = com_ibm_rave_bundles_data_LineDataUtilities.buildLines(data, rave['library']['internal']['AbstractView'].accessorOf(xEntry), rave['library']['internal']['AbstractView'].domainCheckerOf(data, xEntry), rave['library']['internal']['AbstractView'].accessorOf(dataSet.slot("y").entry()), rave['library']['internal']['AbstractView'].accessorOf(dataSet.slot("color").entry()));
  4768. this.context.actions.action("deselectAll")(this.context.node.selectAll(".element-point .element-shape"));
  4769. }
  4770. if (this.updateType <= 1) {
  4771. this._independentScale = rave['library']['internal']['ScaleManager'].makeCoordinateScale(data, dataSet.slot("x").entry());
  4772. this._dependentScale = rave['library']['internal']['ScaleManager'].makeCoordinateScale(data, dataSet.slot("y").entry());
  4773. var subDomainDivisionY = yDataSlotEntry.subDomainDivision();
  4774. var scaleDivisionY = subDomainDivisionY == null ? null : + (subDomainDivisionY);
  4775. this._axes.visible(true).duration(duration).transpose(transpose).scale(0, this._independentScale).scale(2, this._dependentScale).setDataSlot(0, dataSet.slot("x").entry()).setDataSlot(2, dataSet.slot("y").entry()).scaleTickMagnitude(2, scaleDivisionY).useDefaultSelectors().useDefaultX1Properties(true).useDefaultY1Properties(true).setTickFormatter(0, dataSet.slot("x").entry()).setTickFormatter(2, dataSet.slot("y").entry());
  4776. this.prepareLayoutComponent();
  4777. this.prepareLayoutSizables(this._layoutComponent, false, true, true, false, this._legends.anyVisible());
  4778. legendPosition = this._layoutComponent.legendPosition();
  4779. var isLegendLeftOrRight = "left" == legendPosition || "right" == legendPosition;
  4780. if (isLegendLeftOrRight) {
  4781. this._legends.preLayout(this._layoutComponent, false);
  4782. this._axes.preLayout(this._layoutComponent, false, 0.1, 0.05, 0, 0.1, 0.05, 0);
  4783. } else {
  4784. this._axes.preLayout(this._layoutComponent, true, 0.1, 0.05, 0, 0.1, 0.05, 0);
  4785. this._legends.preLayout(this._layoutComponent, true);
  4786. }
  4787. this._layoutComponent.layout();
  4788. this._legends.position(legendPosition);
  4789. this._axes.useBoundsFromLayout(this._layoutComponent).setScaleRanges(0.1, 0.0, 0);
  4790. if (this._dependentScale) {
  4791. if (this.getBooleanProperty("axis.y.scale.includeZero")) {
  4792. this._dependentScale.includeZero();
  4793. }
  4794. this._dependentScale.expandZeroExtent(false);
  4795. if (this.getBooleanProperty("axis.y.scale.nice")) {
  4796. this._dependentScale.nice(scaleDivisionY);
  4797. }
  4798. var pixels = 2 + Math.sqrt(this.getCSSSizeToPixelNumber("lineWithPoints.size"));
  4799. this._dependentScale.expandPixels(pixels, true);
  4800. if (transpose) {
  4801. this.zoomXScale = this._dependentScale.scale().copy();
  4802. } else {
  4803. this.zoomYScale = this._dependentScale.scale().copy();
  4804. }
  4805. }
  4806. if (this._independentScale) {
  4807. this._independentScale.expandZeroExtent(false);
  4808. if (this.getBooleanProperty("axis.x.scale.nice")) {
  4809. this._independentScale.nice();
  4810. }
  4811. if (this.getBooleanProperty("axis.x.scale.includeZero")) {
  4812. this._independentScale.includeZero();
  4813. }
  4814. if (transpose) {
  4815. this.zoomYScale = this._independentScale.scale().copy();
  4816. } else {
  4817. this.zoomXScale = this._independentScale.scale().copy();
  4818. }
  4819. }
  4820. this.resetZoom();
  4821. }
  4822. if (this.updateType == 0 && this._independentScale && this.getBooleanProperty("sortX")) {
  4823. com_ibm_rave_bundles_data_LineDataUtilities.sortLines(this._lineData, this._independentScale);
  4824. }
  4825. if (this.updateType == 0) {
  4826. this._pointData = com_ibm_rave_bundles_data_LineDataUtilities.getLineWithPoints(this._lineData);
  4827. this._pointNPNData = com_ibm_rave_bundles_data_LineDataUtilities.getNPNPoints(this._lineData);
  4828. }
  4829. var chartRect = this._layoutComponent.elementRect();
  4830. this._clip.clipRect(chartRect).applyTo(this._chart.select(".content")).call(this.context.node.select("defs").transition().duration(duration));
  4831. this._chart.select("rect.background.elements").attr("x", chartRect.x).attr("y", chartRect.y).attr("width", chartRect.width).attr("height", chartRect.height);
  4832. this._legends.rectangle(this._layoutComponent.legendRect());
  4833. var xScale = transpose ? this._dependentScale : this._independentScale;
  4834. var yScale = transpose ? this._independentScale : this._dependentScale;
  4835. this.setBackgroundProperties(chartRect, duration);
  4836. var showMissingAsGap = this.getBooleanProperty("lineWithPoints.showMissingAsGap");
  4837. this._lineComponent.data((!(drawOptions == "points")) ? this._lineData : null).independentScale(this._independentScale).dependentScale(this._dependentScale).transpose(transpose).colorPalette(colorPalette).effect(effect).showMissingAsGap(showMissingAsGap).setPreExecute(this.context.getPreExecute()).interpolate(this.getStringProperty("lineWithPoints.interpolate"));
  4838. this._chart.selectAll("g.element-line").transition().duration(duration).call(this._lineComponent);
  4839. if (drawOptions == "line_points" || drawOptions == "points" || this.isShowDataLabels()) {
  4840. this._pointComponent.data(this._pointData);
  4841. } else {
  4842. this._pointComponent.data(showMissingAsGap ? this._pointNPNData : null);
  4843. }
  4844. var pointsColorPalette = this.getPalette();
  4845. pointsColorPalette.setData(dataSet, "color");
  4846. pointsColorPalette.setAccessor(rave['library']['internal']['AbstractView'].originalDatumAccessor(rave['library']['internal']['AbstractView'].accessorOf(dataSet.slot("color").entry())));
  4847. this.configureDataLabels(dataSet);
  4848. this._pointComponent.bounds(chartRect).independentScale(this._independentScale).dependentScale(this._dependentScale).transpose(transpose).colorPalette(pointsColorPalette).labelFont(this.getBackgroundConstrastLabelStyle()).labelContrast(this.getBooleanProperty("contrast.label.color")).labelShadow(this.getBooleanProperty("label.shadow")).effect(effect).key(rave['library']['internal']['AbstractView'].originalDatumAccessor(rave['library']['internal']['AbstractView'].accessorOf(dataSet.slot("key").entry()))).setPreExecute(this.context.getPreExecute()).defaultSize(this.getCSSSizeToPixelNumber("lineWithPoints.size")).symbol((drawOptions == "line_points" || drawOptions == "points") ? this.getStringProperty("lineWithPoints.symbol") : null);
  4849. this._chart.selectAll("g.element-point").transition().duration(duration).call(this._pointComponent);
  4850. this._axes.visible(true).duration(duration).useDefaultSelectors().useDefaultX1Properties(true).useDefaultY1Properties(true).setTickFormatter(0, dataSet.slot("x").entry()).setTickFormatter(2, dataSet.slot("y").entry());
  4851. this._axes.draw();
  4852. this._legends.draw();
  4853. if (this.updateType <= 2) {
  4854. var ops = this.getStringProperty("zoom");
  4855. if (xScale && (ops == "all" || ops == "x")) {
  4856. (xScale.scale()).domain(this.zoomXScale.domain());
  4857. }
  4858. if (yScale && (ops == "all" || ops == "y")) {
  4859. (yScale.scale()).domain(this.zoomYScale.domain());
  4860. }
  4861. var self = this;
  4862. var zoom = this.context.actions.action("zoom").get("zoom");
  4863. com_ibm_rave_bundles_components_ComponentConfiguration.configureZoom(this._chart, zoom, xScale, yScale, null, null, null, chartRect, this._zoomP, this._zoomS, this.getStringProperty("zoom"), function(args) {
  4864. if (args !== null || arguments.length > 1){
  4865. args = Array.prototype.slice.call(arguments, 0);
  4866. }
  4867. {
  4868. self._chart.selectAll("g.element-line").call(self._lineComponent);
  4869. if (self._pointComponent) {
  4870. self._chart.selectAll("g.element-point").call(self._pointComponent);
  4871. }
  4872. self._axes.redraw(true);
  4873. return self._chart;
  4874. }
  4875. });
  4876. zoom.on("zoomend.hideLabels", function(args) {
  4877. if (args !== null || arguments.length > 1){
  4878. args = Array.prototype.slice.call(arguments, 0);
  4879. }
  4880. {
  4881. if (self._axes.hideAnyPanZoom()) {
  4882. if (self.zoomendedTimer != null) {
  4883. clearTimeout(self.zoomendedTimer);
  4884. }
  4885. self.zoomendedTimer = setTimeout(function() {
  4886. self.zoomendedTimer = null;
  4887. self._axes.redraw(false);
  4888. }, 300);
  4889. }
  4890. return null;
  4891. }
  4892. });
  4893. }
  4894. this.resetUpdate();
  4895. this._chart.selectAll(".element-shape").classed("bundle-shape", true);
  4896. this._chart.selectAll(".legendShape").classed("bundle-shape", true);
  4897. },
  4898. /** @expose */
  4899. getCoordinateScale : function(role) {
  4900. if ("ROLE_X1" == role) {
  4901. return this._independentScale;
  4902. }
  4903. if ("ROLE_Y1" == role) {
  4904. return this._dependentScale;
  4905. }
  4906. return null;
  4907. },
  4908. /** @expose */
  4909. requireUpdate : function(property) {
  4910. if (property == "lineWithPoints.nullpointnull" && this.getStringProperty("lineWithPoints.display") == "line_points") {
  4911. return 4;
  4912. }
  4913. return rave['library']['internal']['AbstractView'].prototype.requireUpdate.call(this, property);
  4914. },
  4915. /** @expose */
  4916. configureDataLabels : function(dataSet) {
  4917. if (!(this.isShowDataLabels())) {
  4918. this._pointComponent.itemLabel(false);
  4919. this._pointComponent.itemLabelPosition(null);
  4920. this._pointComponent.labelFont(null);
  4921. this._pointComponent.labelAccessor(null);
  4922. this._pointComponent.labelFormatter(null);
  4923. return;
  4924. }
  4925. var self = this;
  4926. var dataLabelPosition = function(data, index, groupIndex) {
  4927. var currentData = data;
  4928. var prevData = (index == 0) ? null : self._pointData[index - 1];
  4929. var nextData = (index == self._pointData.length - 1) ? null : self._pointData[index + 1];
  4930. if (!prevData || !nextData) {
  4931. return 0;
  4932. }
  4933. var angleWithPreviousPoint = Math.atan2(self._dependentScale.center(prevData._y) - self._dependentScale.center(currentData._y), self._independentScale.center(prevData._x) - self._independentScale.center(currentData._x));
  4934. var angleWithNextPoint = Math.atan2(self._dependentScale.center(nextData._y) - self._dependentScale.center(currentData._y), self._independentScale.center(nextData._x) - self._independentScale.center(currentData._x));
  4935. if (angleWithNextPoint <= 0 && angleWithPreviousPoint <= 0) {
  4936. return 2;
  4937. }
  4938. if ((angleWithNextPoint >= 0 && angleWithPreviousPoint >= 0) || ((180 - Math.abs(angleWithPreviousPoint * (180 / Math.PI)) < 30) && Math.abs(angleWithNextPoint * (180 / Math.PI)) < 30)) {
  4939. return 0;
  4940. }
  4941. if (180 - Math.abs(angleWithPreviousPoint * (180 / Math.PI)) > 30) {
  4942. return 3;
  4943. }
  4944. return 4;
  4945. };
  4946. var labelAccessor = this.getlDataLabelAccessor(dataSet, "label", false);
  4947. var labelEntry = this.getEntryForDataLabelFormatter(dataSet, "label", "y");
  4948. this._pointComponent.itemLabel(true);
  4949. this._pointComponent.labelFont(com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(this.getStringProperty("labelstyle.font")));
  4950. this._pointComponent.labelFormatter(this.context.getCustomFormatterForElementLabels(labelEntry));
  4951. this._pointComponent.labelAccessor(labelAccessor);
  4952. this._pointComponent.itemLabelPosition(dataLabelPosition);
  4953. },
  4954. /** @expose */
  4955. getGroupStructure : function() {
  4956. return ["defs", "g.vizlibrary vizlibrary-line", "(", "rect.background chart", "g.chart", "(", "rect.background elements", "g.gridlines", "(", "g.grid left", "g.grid bottom", ")", "g.axes", "(", "g.axes-layout", "g.axisTransform left", "g.axisTransform bottom", ")", "g.content", "(", "g.elements", "(", "g.element-group element-line", "g.element-point", "(", "g.element-group", "g.element-label-group", ")", ")", ")", "g.axis-callout", ")", "g.legends", "(", "g.legends-layout", "g.legend", ")", ")"];
  4957. }
  4958. });
  4959. //com_ibm_rave_bundles_lineBundle_LineView.DATASET_DATA = "data";
  4960. //com_ibm_rave_bundles_lineBundle_LineView.DATASLOT_X = "x";
  4961. //com_ibm_rave_bundles_lineBundle_LineView.DATASLOT_Y = "y";
  4962. //com_ibm_rave_bundles_lineBundle_LineView.DATASLOT_GROUP = "color";
  4963. //com_ibm_rave_bundles_lineBundle_LineView.DATASLOT_LABEL = "label";
  4964. //com_ibm_rave_bundles_lineBundle_LineView.DATASLOT_KEY = "key";
  4965. //com_ibm_rave_bundles_lineBundle_LineView.LINE_WITH_POINTS_SYMBOL = "lineWithPoints.symbol";
  4966. //com_ibm_rave_bundles_lineBundle_LineView.LINE_WITH_POINTS_DISPLAY = "lineWithPoints.display";
  4967. //com_ibm_rave_bundles_lineBundle_LineView.LINE_INTERPOLATE_PROPERTY = "lineWithPoints.interpolate";
  4968. //com_ibm_rave_bundles_lineBundle_LineView.LINE_MISSING_AS_GAP_PROPERTY = "lineWithPoints.showMissingAsGap";
  4969. // $source: com/ibm/rave/bundles/components/BackgroundComponentImpl
  4970. /************************************************************************
  4971. ** IBM Confidential
  4972. **
  4973. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  4974. **
  4975. ** (C) Copyright IBM Corp. 2017
  4976. **
  4977. ** The source code for this program is not published or otherwise divested of its trade secrets,
  4978. ** irrespective of what has been deposited with the U.S. Copyright Office.
  4979. ************************************************************************/
  4980. // GENERATED
  4981. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  4982. //@import com/ibm/rave/bundles/component/BackgroundComponent (runtime) // BackgroundComponent
  4983. /**
  4984. * <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>
  4985. */
  4986. var com_ibm_rave_bundles_components_BackgroundComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  4987. //_backgroundColor : null,
  4988. //_rect : null,
  4989. /** @expose */
  4990. constructor : function() {
  4991. this._rect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  4992. },
  4993. /** @expose */
  4994. execute : function(g) {
  4995. this.preExecute();
  4996. g.style("fill", this._backgroundColor != null ? this._backgroundColor : "#FFFFFF").style("fill-opacity", 1.0);
  4997. g.attr("x", this._rect.x).attr("y", this._rect.y).attr("width", this._rect.width).attr("height", this._rect.height);
  4998. },
  4999. /** @expose */
  5000. type : function() {
  5001. return com_ibm_rave_bundles_component_BackgroundComponent.COMPONENT_TYPE;
  5002. },
  5003. backgroundColor$0 : function() {
  5004. return this._backgroundColor;
  5005. },
  5006. backgroundColor$1 : function(backgroundColor) {
  5007. this._backgroundColor = backgroundColor;
  5008. return this;
  5009. },
  5010. /**
  5011. * @param (rave['library']['internal']['ContextSize']) size New value of size property
  5012. * @return (com.ibm.rave.bundles.components.BackgroundComponentImpl) This component
  5013. */
  5014. /** @expose */
  5015. size : function(size) {
  5016. this._rect.x = 0;
  5017. this._rect.y = 0;
  5018. this._rect.width = size.w;
  5019. this._rect.height = size.h;
  5020. return this;
  5021. },
  5022. /** @expose */
  5023. rect : function(rect) {
  5024. var r = new rave['internal']['RectStruct'](rect.x, rect.y, rect.width, rect.height);
  5025. this._rect = r;
  5026. return this;
  5027. },
  5028. /** @expose */
  5029. backgroundColor : function(a0) {
  5030. var args = arguments;
  5031. if (args.length == 0) {
  5032. return this.backgroundColor$0();
  5033. }
  5034. return this.backgroundColor$1(a0);
  5035. }
  5036. });
  5037. // $source: com/ibm/rave/bundles/components/ChartLayoutComponentImpl
  5038. /************************************************************************
  5039. ** IBM Confidential
  5040. **
  5041. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5042. **
  5043. ** (C) Copyright IBM Corp. 2017
  5044. **
  5045. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5046. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5047. ************************************************************************/
  5048. // GENERATED
  5049. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5050. //@import com/ibm/rave/bundles/component/ChartLayoutComponent (runtime) // ChartLayoutComponent
  5051. /**
  5052. * <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>
  5053. */
  5054. var com_ibm_rave_bundles_components_ChartLayoutComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5055. //_padding : null,
  5056. //_legendChartGap : null,
  5057. //_topChartPadding : null,
  5058. //_leftChartPadding : null,
  5059. //_bottomChartPadding : null,
  5060. //_rightChartPadding : null,
  5061. //_legendPosition : null,
  5062. //_legendSizable : null,
  5063. //_axisSizables : null,
  5064. //_overallRect : null,
  5065. //_legendRect : null,
  5066. //_chartRect : null,
  5067. //_topRect : null,
  5068. //_leftRect : null,
  5069. //_bottomRect : null,
  5070. //_rightRect : null,
  5071. //_elementRect : null,
  5072. _leftPadding : 0, _topPadding : 0, _rightPadding : 0, _bottomPadding : 0,
  5073. _legendChartAlign : false,
  5074. _preLegendAtMax : false,
  5075. _preAxesAtZero : false,
  5076. constructor : function() {
  5077. this._axisSizables = [];
  5078. /**
  5079. * Construct. All padding is 0, legendPosition is "right", all slices have a size of 0 (value of null).
  5080. */
  5081. {
  5082. this._padding = 0.0;
  5083. this._topPadding = 0;
  5084. this._leftPadding = 0;
  5085. this._bottomPadding = 0;
  5086. this._rightPadding = 0;
  5087. this._topChartPadding = 0.0;
  5088. this._leftChartPadding = 0.0;
  5089. this._bottomChartPadding = 0.0;
  5090. this._rightChartPadding = 0.0;
  5091. this._legendChartGap = 0.0;
  5092. this._legendPosition = "right";
  5093. this._overallRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5094. this._legendRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5095. this._chartRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5096. this._topRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5097. this._leftRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5098. this._bottomRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5099. this._rightRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5100. this._elementRect = new rave['internal']['RectStruct'](0, 0, 0, 0);
  5101. this._legendChartAlign = true;
  5102. }
  5103. },
  5104. /** @expose */
  5105. execute : function(g) {
  5106. this.layout();
  5107. },
  5108. /**
  5109. * Calculates rectangles during preliminary layout
  5110. * @param (boolean) legendAtMax true if legend is given max size; false if legend is asked for its preferred size
  5111. * @param (boolean) axesAtZero true if axes are given a size of 0; false if axes are asked for their preferred size
  5112. */
  5113. /** @expose */
  5114. preLayout : function(legendAtMax, axesAtZero) {
  5115. this._preLegendAtMax = legendAtMax;
  5116. this._preAxesAtZero = axesAtZero;
  5117. this.layout();
  5118. this._preLegendAtMax = false;
  5119. this._preAxesAtZero = false;
  5120. },
  5121. /**
  5122. * Calls preExecute, then does the layout with the property values, updating the chart, legend, axis, and elements rectangles.
  5123. */
  5124. /** @expose */
  5125. layout : function() {
  5126. this.preExecute();
  5127. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._chartRect, this._overallRect);
  5128. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._legendRect, this._overallRect);
  5129. var x = this._overallRect.x;
  5130. var y = this._overallRect.y;
  5131. var w = this._overallRect.width;
  5132. var h = this._overallRect.height;
  5133. var maxWH = Math.max(w, h);
  5134. var tbLegend = "top" == this._legendPosition || "bottom" == this._legendPosition;
  5135. var legendPercent = this._axisSizables.length == 0 ? 0.5 : 0.3;
  5136. var legendMaxSize = (tbLegend ? this._legendRect.height : this._legendRect.width) * legendPercent;
  5137. var legendDynamicSize = this._legendSizable ? (this._preLegendAtMax ? maxWH : this._legendSizable.getPreferredSize()) : 0;
  5138. if (legendDynamicSize > legendMaxSize) {
  5139. legendDynamicSize = legendMaxSize;
  5140. }
  5141. var isLegendTop = false;
  5142. var isLegendBottom = false;
  5143. var isLegendLeft = false;
  5144. var isLegendRight = false;
  5145. if ("top" == this._legendPosition) {
  5146. this._legendRect.height = legendDynamicSize;
  5147. this._chartRect.height -= this._legendRect.height;
  5148. this._chartRect.y += this._legendRect.height;
  5149. isLegendTop = true;
  5150. } else if ("bottom" == this._legendPosition) {
  5151. this._legendRect.height = legendDynamicSize;
  5152. this._chartRect.height -= this._legendRect.height;
  5153. this._legendRect.y = y + h - this._legendRect.height;
  5154. isLegendBottom = true;
  5155. } else if ("left" == this._legendPosition) {
  5156. this._legendRect.width = legendDynamicSize;
  5157. this._chartRect.width -= this._legendRect.width;
  5158. this._chartRect.x += this._legendRect.width;
  5159. isLegendLeft = true;
  5160. } else {
  5161. this._legendRect.width = legendDynamicSize;
  5162. this._chartRect.width -= this._legendRect.width;
  5163. this._legendRect.x = x + w - this._legendRect.width;
  5164. isLegendRight = true;
  5165. }
  5166. if (this.evaluatePadding(this._padding, w, h)) {
  5167. var lrgap = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._legendChartGap, w);
  5168. var tbgap = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._legendChartGap, h);
  5169. var chartTop = isLegendTop && this._legendSizable ? tbgap : this._topPadding;
  5170. var chartLeft = isLegendLeft && this._legendSizable ? lrgap : this._leftPadding;
  5171. var chartBottom = isLegendBottom && this._legendSizable ? tbgap : this._bottomPadding;
  5172. var chartRight = isLegendRight && this._legendSizable ? lrgap : this._rightPadding;
  5173. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset(this._chartRect, chartTop, chartLeft, chartBottom, chartRight);
  5174. } else {
  5175. var lrpadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._padding, w);
  5176. var tbpadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._padding, h);
  5177. var chartTop = tbpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._topChartPadding, h);
  5178. var chartLeft = lrpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._leftChartPadding, w);
  5179. var chartBottom = tbpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._bottomChartPadding, h);
  5180. var chartRight = lrpadding + com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(this._rightChartPadding, w);
  5181. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset(this._chartRect, chartTop, chartLeft, chartBottom, chartRight);
  5182. this._topPadding = tbpadding;
  5183. this._leftPadding = lrpadding;
  5184. this._bottomPadding = tbpadding;
  5185. this._rightPadding = lrpadding;
  5186. }
  5187. if (this._legendSizable) {
  5188. if (isLegendRight) {
  5189. this._legendRect.x -= this._rightPadding;
  5190. this._chartRect.width -= this._rightPadding;
  5191. this._legendRect.y += this._topPadding;
  5192. this._legendRect.height -= (this._topPadding + this._bottomPadding);
  5193. } else if (isLegendLeft) {
  5194. this._legendRect.x += this._leftPadding;
  5195. this._chartRect.x += this._leftPadding;
  5196. this._chartRect.width -= this._leftPadding;
  5197. this._legendRect.y += this._topPadding;
  5198. this._legendRect.height -= (this._topPadding + this._bottomPadding);
  5199. } else if (isLegendTop) {
  5200. this._legendRect.y += this._topPadding;
  5201. this._chartRect.y += this._topPadding;
  5202. this._chartRect.height -= this._topPadding;
  5203. this._legendRect.x += this._leftPadding;
  5204. this._legendRect.width -= (this._leftPadding + this._rightPadding);
  5205. } else {
  5206. this._legendRect.y -= this._bottomPadding;
  5207. this._chartRect.height -= this._bottomPadding;
  5208. this._legendRect.x += this._leftPadding;
  5209. this._legendRect.width -= (this._leftPadding + this._rightPadding);
  5210. }
  5211. }
  5212. x = this._chartRect.x;
  5213. y = this._chartRect.y;
  5214. w = this._chartRect.width;
  5215. h = this._chartRect.height;
  5216. var bottomH = 0;
  5217. var topH = 0;
  5218. var leftW = 0;
  5219. var rightW = 0;
  5220. var tbSO = 0;
  5221. var lrSO = 0;
  5222. if (!this._preAxesAtZero) {
  5223. var countHorz = 0;
  5224. var countVert = 0;
  5225. for (var i = 0; i < this._axisSizables.length; ++i) {
  5226. var sizable = this._axisSizables[i];
  5227. if (sizable) {
  5228. var orientation = sizable.getSizableOrientation();
  5229. if ("top" == orientation || "bottom" == orientation) {
  5230. countHorz++;
  5231. } else {
  5232. countVert++;
  5233. }
  5234. }
  5235. }
  5236. for (var i = 0; i < this._axisSizables.length; ++i) {
  5237. var sizable = this._axisSizables[i];
  5238. if (sizable) {
  5239. var orientation = sizable.getSizableOrientation();
  5240. var tbAxis = "top" == orientation || "bottom" == orientation;
  5241. var axisDynamicSize = sizable.getPreferredSize();
  5242. var spillOver = sizable.getSpillOverSize();
  5243. if (tbAxis) {
  5244. var axisPercent = countHorz > 1 ? 0.4 : 0.5;
  5245. if (axisDynamicSize > this._chartRect.height * axisPercent) {
  5246. axisDynamicSize = this._chartRect.height * axisPercent;
  5247. }
  5248. if ("top" == orientation) {
  5249. topH = axisDynamicSize;
  5250. } else {
  5251. bottomH = axisDynamicSize;
  5252. }
  5253. if (spillOver > lrSO) {
  5254. lrSO = spillOver;
  5255. }
  5256. } else {
  5257. var axisPercent = countVert > 1 ? 0.4 : 0.5;
  5258. if (axisDynamicSize > this._chartRect.width * axisPercent) {
  5259. axisDynamicSize = this._chartRect.width * axisPercent;
  5260. }
  5261. if ("left" == orientation) {
  5262. leftW = axisDynamicSize;
  5263. } else {
  5264. rightW = axisDynamicSize;
  5265. }
  5266. if (spillOver > tbSO) {
  5267. tbSO = spillOver;
  5268. }
  5269. }
  5270. }
  5271. }
  5272. }
  5273. if (lrSO > leftW) {
  5274. leftW = lrSO;
  5275. }
  5276. if (lrSO > rightW) {
  5277. rightW = lrSO;
  5278. }
  5279. if (tbSO > topH) {
  5280. topH = tbSO;
  5281. }
  5282. if (tbSO > bottomH) {
  5283. bottomH = tbSO;
  5284. }
  5285. this._leftRect.x = x;
  5286. this._leftRect.width = leftW;
  5287. this._leftRect.y = y;
  5288. this._leftRect.height = h;
  5289. this._rightRect.x = x + w - rightW;
  5290. this._rightRect.width = rightW;
  5291. this._rightRect.y = y;
  5292. this._rightRect.height = h;
  5293. this._topRect.y = y;
  5294. this._topRect.height = topH;
  5295. this._topRect.x = x;
  5296. this._topRect.width = w;
  5297. this._bottomRect.y = y + h - bottomH;
  5298. this._bottomRect.height = bottomH;
  5299. this._bottomRect.x = x;
  5300. this._bottomRect.width = w;
  5301. this._elementRect.x = x + leftW;
  5302. this._elementRect.y = y + topH;
  5303. this._elementRect.width = w - (leftW + rightW);
  5304. this._elementRect.height = h - (topH + bottomH);
  5305. if (this._legendSizable && this._legendChartAlign) {
  5306. if (tbLegend) {
  5307. this._legendRect.x = this._elementRect.x;
  5308. this._legendRect.width = this._elementRect.width;
  5309. } else {
  5310. this._legendRect.y = this._elementRect.y;
  5311. this._legendRect.height = this._elementRect.height;
  5312. }
  5313. }
  5314. },
  5315. evaluatePadding : function(padding, horizontalExtent, verticalExtent) {
  5316. if (padding == null) {
  5317. return false;
  5318. }
  5319. var paddingString = (padding) + "";
  5320. if (paddingString.length == 0) {
  5321. return false;
  5322. }
  5323. this._topPadding = 0;
  5324. this._leftPadding = 0;
  5325. this._bottomPadding = 0;
  5326. this._rightPadding = 0;
  5327. var items = paddingString.split(new RegExp(";"));
  5328. for (var __i_enFor0 = 0, __len_enFor0 = items.length;
  5329. __i_enFor0 < __len_enFor0; ++__i_enFor0) {
  5330. var item = items[__i_enFor0];
  5331. var parts = item.split(new RegExp(":"));
  5332. if (items.length == 1 && parts.length != 2) {
  5333. return false;
  5334. }
  5335. if (parts.length == 2) {
  5336. if (0 <= parts[0].indexOf("top")) {
  5337. this._topPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], verticalExtent);
  5338. } else if (0 <= parts[0].indexOf("left")) {
  5339. this._leftPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], horizontalExtent);
  5340. } else if (0 <= parts[0].indexOf("bottom")) {
  5341. this._bottomPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], verticalExtent);
  5342. } else if (0 <= parts[0].indexOf("right")) {
  5343. this._rightPadding = com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize(parts[1], horizontalExtent);
  5344. }
  5345. }
  5346. }
  5347. return true;
  5348. },
  5349. /**
  5350. * @return (rave['internal']['RectStruct']) Legend rectangle
  5351. */
  5352. /** @expose */
  5353. legendRect : function() {
  5354. return this._legendRect;
  5355. },
  5356. /**
  5357. * @return (rave['internal']['RectStruct']) Chart (elements plus axes) rectangle
  5358. */
  5359. /** @expose */
  5360. chartRect : function() {
  5361. return this._chartRect;
  5362. },
  5363. /**
  5364. * @return (rave['internal']['RectStruct']) Top axis rectangle
  5365. */
  5366. /** @expose */
  5367. topRect : function() {
  5368. return this._topRect;
  5369. },
  5370. /**
  5371. * @return (rave['internal']['RectStruct']) Left axis rectangle
  5372. */
  5373. /** @expose */
  5374. leftRect : function() {
  5375. return this._leftRect;
  5376. },
  5377. /**
  5378. * @return (rave['internal']['RectStruct']) Bottom axis rectangle
  5379. */
  5380. /** @expose */
  5381. bottomRect : function() {
  5382. return this._bottomRect;
  5383. },
  5384. /**
  5385. * @return (rave['internal']['RectStruct']) Right axis rectangle
  5386. */
  5387. /** @expose */
  5388. rightRect : function() {
  5389. return this._rightRect;
  5390. },
  5391. /**
  5392. * @return (rave['internal']['RectStruct']) Legend rectangle
  5393. */
  5394. /** @expose */
  5395. elementRect : function() {
  5396. return this._elementRect;
  5397. },
  5398. /**
  5399. * Set the overall rectangle. This should be called before doing the layout.
  5400. * @param (rave['internal']['RectStruct']) overall The overall rectangle
  5401. */
  5402. /** @expose */
  5403. overall : function(overall) {
  5404. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect(this._overallRect, overall);
  5405. return this;
  5406. },
  5407. padding$0 : function() {
  5408. return this._padding;
  5409. },
  5410. legendChartAlign$0 : function() {
  5411. return this._legendChartAlign;
  5412. },
  5413. legendChartGap$0 : function() {
  5414. return this._legendChartGap;
  5415. },
  5416. topPadding$0 : function() {
  5417. return this._topChartPadding;
  5418. },
  5419. leftPadding$0 : function() {
  5420. return this._leftChartPadding;
  5421. },
  5422. bottomPadding$0 : function() {
  5423. return this._bottomChartPadding;
  5424. },
  5425. rightPadding$0 : function() {
  5426. return this._rightChartPadding;
  5427. },
  5428. legendPosition$0 : function() {
  5429. return this._legendPosition;
  5430. },
  5431. topPadding$1 : function(padding) {
  5432. this._topChartPadding = padding;
  5433. return this;
  5434. },
  5435. leftPadding$1 : function(padding) {
  5436. this._leftChartPadding = padding;
  5437. return this;
  5438. },
  5439. bottomPadding$1 : function(padding) {
  5440. this._bottomChartPadding = padding;
  5441. return this;
  5442. },
  5443. rightPadding$1 : function(padding) {
  5444. this._rightChartPadding = padding;
  5445. return this;
  5446. },
  5447. /** @expose */
  5448. type : function() {
  5449. return com_ibm_rave_bundles_component_ChartLayoutComponent.COMPONENT_TYPE;
  5450. },
  5451. padding$1 : function(value) {
  5452. this._padding = value;
  5453. return this;
  5454. },
  5455. /** @expose */
  5456. chartPadding : function(top, left, bottom, right) {
  5457. this._topChartPadding = top;
  5458. this._leftChartPadding = left;
  5459. this._bottomChartPadding = bottom;
  5460. this._rightChartPadding = right;
  5461. return this;
  5462. },
  5463. legendChartAlign$1 : function(legendChartAlign) {
  5464. this._legendChartAlign = legendChartAlign;
  5465. return this;
  5466. },
  5467. legendChartGap$1 : function(value) {
  5468. this._legendChartGap = value;
  5469. return this;
  5470. },
  5471. legendPosition$1 : function(position) {
  5472. if ("top" == position || "bottom" == position || "left" == position || "right" == position) {
  5473. this._legendPosition = position;
  5474. }
  5475. return this;
  5476. },
  5477. /** @expose */
  5478. legendSize : function(sizable) {
  5479. this._legendSizable = sizable;
  5480. return this;
  5481. },
  5482. /** @expose */
  5483. removeAxisSizables : function() {
  5484. this._axisSizables.length = 0;
  5485. return this;
  5486. },
  5487. /** @expose */
  5488. addAxisSizable : function(sizable) {
  5489. this._axisSizables.push(sizable);
  5490. return this;
  5491. },
  5492. /** @expose */
  5493. padding : function(a0) {
  5494. var args = arguments;
  5495. if (args.length == 0) {
  5496. return this.padding$0();
  5497. }
  5498. return this.padding$1(a0);
  5499. },
  5500. /** @expose */
  5501. legendChartAlign : function(a0) {
  5502. var args = arguments;
  5503. if (args.length == 0) {
  5504. return this.legendChartAlign$0();
  5505. }
  5506. return this.legendChartAlign$1(a0);
  5507. },
  5508. /** @expose */
  5509. legendChartGap : function(a0) {
  5510. var args = arguments;
  5511. if (args.length == 0) {
  5512. return this.legendChartGap$0();
  5513. }
  5514. return this.legendChartGap$1(a0);
  5515. },
  5516. /** @expose */
  5517. topPadding : function(a0) {
  5518. var args = arguments;
  5519. if (args.length == 0) {
  5520. return this.topPadding$0();
  5521. }
  5522. return this.topPadding$1(a0);
  5523. },
  5524. /** @expose */
  5525. leftPadding : function(a0) {
  5526. var args = arguments;
  5527. if (args.length == 0) {
  5528. return this.leftPadding$0();
  5529. }
  5530. return this.leftPadding$1(a0);
  5531. },
  5532. /** @expose */
  5533. bottomPadding : function(a0) {
  5534. var args = arguments;
  5535. if (args.length == 0) {
  5536. return this.bottomPadding$0();
  5537. }
  5538. return this.bottomPadding$1(a0);
  5539. },
  5540. /** @expose */
  5541. rightPadding : function(a0) {
  5542. var args = arguments;
  5543. if (args.length == 0) {
  5544. return this.rightPadding$0();
  5545. }
  5546. return this.rightPadding$1(a0);
  5547. },
  5548. /** @expose */
  5549. legendPosition : function(a0) {
  5550. var args = arguments;
  5551. if (args.length == 0) {
  5552. return this.legendPosition$0();
  5553. }
  5554. return this.legendPosition$1(a0);
  5555. }
  5556. });
  5557. /**
  5558. * Set preferred rectangle to the same position and size as the source rectangle.
  5559. * @param (rave['internal']['RectStruct']) t preferred rectangle
  5560. * @param (rave['internal']['RectStruct']) s Source rectangle
  5561. * @return (rave['internal']['RectStruct']) preferred rectangle
  5562. */
  5563. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.copyRect = function(t, s) {
  5564. t.x = s.x;
  5565. t.y = s.y;
  5566. t.width = s.width;
  5567. t.height = s.height;
  5568. return t;
  5569. };
  5570. /**
  5571. * 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.
  5572. * @param (rave['internal']['RectStruct']) r Rectangle
  5573. * @param (double) top Top inset in pixels
  5574. * @param (double) left Left inset in pixels
  5575. * @param (double) bottom Bottom inset in pixels
  5576. * @param (double) right Right inset in pixels
  5577. * @return (rave['internal']['RectStruct']) The rectangle
  5578. */
  5579. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.inset = function(r, top, left, bottom, right) {
  5580. var ileft = Math.max(0.0, left);
  5581. var iright = Math.max(0.0, right);
  5582. if (ileft + iright <= r.width) {
  5583. r.x += ileft;
  5584. r.width -= ileft + iright;
  5585. }
  5586. var itop = Math.max(0.0, top);
  5587. var ibottom = Math.max(0.0, bottom);
  5588. if (itop + ibottom <= r.height) {
  5589. r.y += itop;
  5590. r.height -= itop + ibottom;
  5591. }
  5592. return r;
  5593. };
  5594. /**
  5595. * 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.
  5596. * @param (Object) value The size
  5597. * @param (double) extent The extent in the dimension
  5598. * @param defValue The default to use if not parsable
  5599. * @return (double) Size in pixels
  5600. */
  5601. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.evaluateSize = function(value, extent) {
  5602. var v = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber(value, extent, 10.0);
  5603. var d = v != null ? v : 0;
  5604. return Math.max(0.0, Math.min(d, extent));
  5605. };
  5606. /** @expose */
  5607. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_AXIS_PERCENT = 0.4;
  5608. /** @expose */
  5609. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_AXIS_PERCENT_SINGLE_PER_ORIENTATION = 0.5;
  5610. /** @expose */
  5611. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_LEGEND_PERCENT = 0.3;
  5612. /** @expose */
  5613. com_ibm_rave_bundles_components_ChartLayoutComponentImpl.MAX_LEGEND_PERCENT_NO_AXIS = 0.5;
  5614. // $source: com/ibm/rave/bundles/components/ClipPathComponentImpl
  5615. /************************************************************************
  5616. ** IBM Confidential
  5617. **
  5618. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5619. **
  5620. ** (C) Copyright IBM Corp. 2017
  5621. **
  5622. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5623. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5624. ************************************************************************/
  5625. // GENERATED
  5626. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5627. /**
  5628. * 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>
  5629. */
  5630. var com_ibm_rave_bundles_components_ClipPathComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5631. //_id : null,
  5632. //_clipRect : null,
  5633. constructor : function(id) {
  5634. this._clipRect = new rave['internal']['RectStruct'](0, 0, 100, 100);
  5635. /**
  5636. * 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.
  5637. * @param (String) id String ID that is unique <em>across the document</em>.
  5638. */
  5639. {
  5640. this._id = id;
  5641. }
  5642. },
  5643. /** @expose */
  5644. type : function() {
  5645. return "ClipPathComponent";
  5646. },
  5647. /**
  5648. * Set the rectangular clipping area. Make the _clipRect one pixel larger than requested to avoid the cut-off at bounds. TODO: why?!?
  5649. * @param (rave['internal']['RectStruct']) rect The rectangular bounds of the clipping area.
  5650. * @return (com.ibm.rave.bundles.components.ClipPathComponentImpl) This ClipPathComponent.
  5651. */
  5652. /** @expose */
  5653. clipRect : function(rect) {
  5654. this._clipRect = new rave['internal']['RectStruct'](rect.x - 1, rect.y - 1, rect.width + 2, rect.height + 2);
  5655. return this;
  5656. },
  5657. /**
  5658. * Set the clip-path attribute on the provided selection.
  5659. * @return (com.ibm.rave.bundles.components.ClipPathComponentImpl) This ClipPathComponent.
  5660. */
  5661. /** @expose */
  5662. applyTo : function(s) {
  5663. s.attr("clip-path", "url(" + this.url() + ")");
  5664. return this;
  5665. },
  5666. /**
  5667. * Retrieve the id assigned to this clip path.
  5668. */
  5669. /** @expose */
  5670. id : function() {
  5671. return this._id;
  5672. },
  5673. /**
  5674. * Retrieve the URL that can be used to reference this clip path.
  5675. */
  5676. /** @expose */
  5677. url : function() {
  5678. return "#" + this._id;
  5679. },
  5680. /** @expose */
  5681. execute : function(g) {
  5682. var clipPath = g.selectAll("#" + this._id).data([0]);
  5683. clipPath.enter().append("clipPath").attr("id", this._id).append("rect");
  5684. 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);
  5685. }
  5686. });
  5687. // $source: com/ibm/rave/bundles/components/LegendComponentImpl
  5688. /************************************************************************
  5689. ** IBM Confidential
  5690. **
  5691. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  5692. **
  5693. ** (C) Copyright IBM Corp. 2017
  5694. **
  5695. ** The source code for this program is not published or otherwise divested of its trade secrets,
  5696. ** irrespective of what has been deposited with the U.S. Copyright Office.
  5697. ************************************************************************/
  5698. // GENERATED
  5699. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  5700. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  5701. /**
  5702. * <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>
  5703. */
  5704. var com_ibm_rave_bundles_components_LegendComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  5705. /**
  5706. * Legend size property
  5707. */
  5708. //_size : null,
  5709. /**
  5710. * Color scale
  5711. */
  5712. //_colorPalette : null,
  5713. /**
  5714. * Orient, "horizontal" or "vertical"
  5715. */
  5716. //_orient : null,
  5717. /**
  5718. * Swatch size function
  5719. */
  5720. //_swatchSizeFunc : null,
  5721. /**
  5722. * Scale
  5723. */
  5724. //_scale : null,
  5725. /**
  5726. * Swatch symbol
  5727. */
  5728. //_shape : null,
  5729. /**
  5730. * Legend title
  5731. */
  5732. //_title : null,
  5733. /**
  5734. * Legend title styling
  5735. */
  5736. //_titleStyle : null,
  5737. /**
  5738. * Legend entry styling
  5739. */
  5740. //_entryStyle : null,
  5741. /**
  5742. * Custom formatter
  5743. */
  5744. //_labelFormat : null,
  5745. /**
  5746. * The swatch legend, created on demand
  5747. */
  5748. //_swatchLegend : null,
  5749. /**
  5750. * The continuous legend, created on demand
  5751. */
  5752. //_continuousLegend : null,
  5753. /**
  5754. * The legend type, either "SwatchLegend" or "ContinuousLegend"
  5755. */
  5756. //_legendType : null,
  5757. /**
  5758. * Is the legend visible
  5759. */
  5760. _visible : false,
  5761. /**
  5762. * Swatch size in square pixels
  5763. */
  5764. _swatchSize : 0,
  5765. /**
  5766. * Constructor; sets bound and, colorScale to null, all other properties to their default values.
  5767. */
  5768. /** @expose */
  5769. constructor : function() {
  5770. this._visible = true;
  5771. this._size = null;
  5772. this._colorPalette = null;
  5773. this._orient = "horizontal";
  5774. this._swatchSize = 16.0 * 16.0;
  5775. this._swatchSizeFunc = null;
  5776. this._scale = null;
  5777. this._shape = "square";
  5778. this._title = null;
  5779. this._titleStyle = {};
  5780. this._entryStyle = {};
  5781. this._labelFormat = null;
  5782. this._swatchLegend = null;
  5783. this._continuousLegend = null;
  5784. this._legendType = null;
  5785. },
  5786. /** @expose */
  5787. type : function() {
  5788. return "LegendComponent";
  5789. },
  5790. /** @expose */
  5791. execute : function(g) {
  5792. if (this._colorPalette) {
  5793. if ("continuous" == this._colorPalette.getType()) {
  5794. if (!this._continuousLegend) {
  5795. this._continuousLegend = (rave.capabilities.extension("legend")).continuous();
  5796. }
  5797. this._legendType = "ContinuousLegend";
  5798. } else {
  5799. if (!this._swatchLegend) {
  5800. this._swatchLegend = (rave.capabilities.extension("legend")).swatch();
  5801. }
  5802. this._legendType = "SwatchLegend";
  5803. }
  5804. } else if (this._swatchSizeFunc) {
  5805. if (!this._swatchLegend) {
  5806. this._swatchLegend = (rave.capabilities.extension("legend")).swatch();
  5807. }
  5808. this._legendType = "SwatchLegend";
  5809. } else {
  5810. this._legendType = null;
  5811. }
  5812. this.preExecute();
  5813. if (!this._visible || (!this._colorPalette && !this._swatchSizeFunc) || !this._size || this._size[0] <= 0 || this._size[1] <= 0) {
  5814. g.selectAll("*").remove();
  5815. return;
  5816. }
  5817. var fontChecker = rave.capabilities.extension("fontchecker");
  5818. if (this._colorPalette && "continuous" == this._colorPalette.getType()) {
  5819. 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);
  5820. var legend = g.call(this._continuousLegend);
  5821. if (this._entryStyle) {
  5822. legend.selectAll(".legendLabel").style(this._entryStyle);
  5823. }
  5824. if (this._titleStyle) {
  5825. legend.selectAll(".legendTitle").style(this._titleStyle);
  5826. }
  5827. if (fontChecker) {
  5828. legend.selectAll(".legendLabel").call(fontChecker);
  5829. legend.selectAll(".legendTitle").call(fontChecker);
  5830. }
  5831. } else {
  5832. var insets = {};
  5833. insets["bottom"] = 5;
  5834. var swatchSize = this._swatchSize;
  5835. var scale = null;
  5836. var labelFormatter = this._labelFormat;
  5837. if (this._swatchSizeFunc && this._scale) {
  5838. swatchSize = this._swatchSizeFunc;
  5839. scale = this._scale;
  5840. }
  5841. if (this._colorPalette) {
  5842. scale = this._colorPalette.getScale();
  5843. var originalDomain = this._colorPalette.originalDomain();
  5844. if (originalDomain) {
  5845. scale.domain(originalDomain);
  5846. var f = this._colorPalette.originalDomainLabelAccessor();
  5847. if (this._labelFormat) {
  5848. var self = this;
  5849. labelFormatter = function(data, index, groupIndex) {
  5850. return self._labelFormat.call(this, f.call(this, data, index, groupIndex), index, groupIndex);
  5851. };
  5852. } else {
  5853. labelFormatter = f;
  5854. }
  5855. }
  5856. }
  5857. 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);
  5858. var legend = g.call(this._swatchLegend);
  5859. if (this._entryStyle) {
  5860. legend.selectAll(".legendLabel").style(this._entryStyle);
  5861. }
  5862. if (this._titleStyle) {
  5863. legend.selectAll(".legendTitle").style(this._titleStyle);
  5864. }
  5865. if (fontChecker) {
  5866. legend.selectAll(".legendLabel").call(fontChecker);
  5867. legend.selectAll(".legendTitle").call(fontChecker);
  5868. }
  5869. }
  5870. },
  5871. /** @expose */
  5872. legend : function() {
  5873. if ("ContinuousLegend" == this._legendType) {
  5874. return this._continuousLegend;
  5875. }
  5876. if ("SwatchLegend" == this._legendType) {
  5877. return this._swatchLegend;
  5878. }
  5879. return null;
  5880. },
  5881. /** @expose */
  5882. legendType : function() {
  5883. return this._legendType;
  5884. },
  5885. /**
  5886. * Set the visible property.
  5887. * @param (boolean) visible New visible
  5888. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5889. */
  5890. /** @expose */
  5891. visible : function(visible) {
  5892. this._visible = visible;
  5893. return this;
  5894. },
  5895. /**
  5896. * see if the legend is visible
  5897. * @return (boolean) if its visible
  5898. */
  5899. /** @expose */
  5900. isVisible : function() {
  5901. return this._visible;
  5902. },
  5903. /**
  5904. * Set the size property.
  5905. * @param (Array) size New size
  5906. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5907. */
  5908. /** @expose */
  5909. size : function(size) {
  5910. this._size = size;
  5911. return this;
  5912. },
  5913. /**
  5914. * Set the color scale property.
  5915. * @param (rave['library']['internal']['Palette']) colorPalette New color scale
  5916. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5917. */
  5918. /** @expose */
  5919. colorPalette : function(colorPalette) {
  5920. this._colorPalette = colorPalette;
  5921. return this;
  5922. },
  5923. /**
  5924. * Set the orient property. If the argument is not "horizontal" or "vertical", it is ignored and the orient property is not changed.
  5925. * @param (String) orient New orient
  5926. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5927. */
  5928. /** @expose */
  5929. orient : function(orient) {
  5930. if ("horizontal" == orient || "vertical" == orient) {
  5931. this._orient = orient;
  5932. }
  5933. return this;
  5934. },
  5935. /**
  5936. * 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".
  5937. * @param (String) position Legend position
  5938. * @return (com.ibm.rave.bundles.components.LegendComponentImpl) This object
  5939. */
  5940. /** @expose */
  5941. position : function(position) {
  5942. return this.orient(com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf(position));
  5943. },
  5944. swatchSize$0 : function(swatchSize) {
  5945. if (swatchSize >= 0.0 && swatchSize != null) {
  5946. this._swatchSize = swatchSize;
  5947. }
  5948. return this;
  5949. },
  5950. /** @expose */
  5951. scale : function(scale) {
  5952. this._scale = scale;
  5953. return this;
  5954. },
  5955. swatchSize$1 : function(swatchSize) {
  5956. if (swatchSize) {
  5957. this._swatchSizeFunc = swatchSize;
  5958. }
  5959. return this;
  5960. },
  5961. /** @expose */
  5962. shape : function(shape) {
  5963. this._shape = shape;
  5964. return this;
  5965. },
  5966. /** @expose */
  5967. title : function(title) {
  5968. this._title = (title != null && title.length > 0) ? title : null;
  5969. return this;
  5970. },
  5971. /** @expose */
  5972. titleFill : function(titleFill) {
  5973. this._titleStyle["fill"] = titleFill;
  5974. return this;
  5975. },
  5976. /** @expose */
  5977. titleFontSize : function(titleFontSize) {
  5978. this._titleStyle["font-size"] = titleFontSize;
  5979. return this;
  5980. },
  5981. /** @expose */
  5982. titleFontFamily : function(titleFontFamily) {
  5983. this._titleStyle["font-family"] = titleFontFamily;
  5984. return this;
  5985. },
  5986. /** @expose */
  5987. labelFormat : function(labelFormat) {
  5988. this._labelFormat = labelFormat;
  5989. return this;
  5990. },
  5991. /** @expose */
  5992. titleFont : function(titleFontStyle) {
  5993. this._titleStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(titleFontStyle);
  5994. return this;
  5995. },
  5996. /** @expose */
  5997. entryFont : function(entryFontStyle) {
  5998. this._entryStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(entryFontStyle);
  5999. return this;
  6000. },
  6001. /** @expose */
  6002. getSpaceUsed : function() {
  6003. if (this._colorPalette && "continuous" == this._colorPalette.getType()) {
  6004. return this._continuousLegend.getUsedSize() + 2;
  6005. } else {
  6006. return this._swatchLegend.getUsedSize() + 2;
  6007. }
  6008. },
  6009. /** @expose */
  6010. swatchSize : function(a0) {
  6011. var args = arguments;
  6012. if (args.length == 1 && typeof a0 === "function") {
  6013. return this.swatchSize$1(a0);
  6014. }
  6015. return this.swatchSize$0(a0);
  6016. }
  6017. });
  6018. /**
  6019. * Get the orient for a position. "top" and "bottom" return "horizontal", anything else ("left", "right", or unknown/null) is "vertical".
  6020. * @param (String) position A position
  6021. * @return (String) "horizontal" or "vertical"
  6022. */
  6023. /** @expose */
  6024. com_ibm_rave_bundles_components_LegendComponentImpl.orientationOf = function(position) {
  6025. if ("top" == position || "bottom" == position) {
  6026. return "horizontal";
  6027. }
  6028. return "vertical";
  6029. };
  6030. //com_ibm_rave_bundles_components_LegendComponentImpl.HORIZONTAL = "horizontal";
  6031. //com_ibm_rave_bundles_components_LegendComponentImpl.VERTICAL = "vertical";
  6032. com_ibm_rave_bundles_components_LegendComponentImpl.BAR_THINKNESS = 16;
  6033. com_ibm_rave_bundles_components_LegendComponentImpl.SWATCH_SIZE = 16;
  6034. /** @expose */
  6035. com_ibm_rave_bundles_components_LegendComponentImpl.TOP = "top";
  6036. /** @expose */
  6037. com_ibm_rave_bundles_components_LegendComponentImpl.BOTTOM = "bottom";
  6038. /** @expose */
  6039. com_ibm_rave_bundles_components_LegendComponentImpl.LEFT = "left";
  6040. /** @expose */
  6041. com_ibm_rave_bundles_components_LegendComponentImpl.RIGHT = "right";
  6042. /** @expose */
  6043. com_ibm_rave_bundles_components_LegendComponentImpl.ADJUSTABLE = -1;
  6044. // $source: com/ibm/rave/bundles/components/AxisComponentImpl
  6045. /************************************************************************
  6046. ** IBM Confidential
  6047. **
  6048. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  6049. **
  6050. ** (C) Copyright IBM Corp. 2018
  6051. **
  6052. ** The source code for this program is not published or otherwise divested of its trade secrets,
  6053. ** irrespective of what has been deposited with the U.S. Copyright Office.
  6054. ************************************************************************/
  6055. // GENERATED
  6056. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  6057. //@import com/ibm/rave/bundles/component/AxisComponent (runtime) // AxisComponent
  6058. //@import com/ibm/rave/bundles/utilities/TextCrossfader (runtime) // textCrossFade
  6059. //@import com/ibm/rave/bundles/utilities/FontPropertyParser (runtime) // parseCSSFont
  6060. //@import com/ibm/rave/bundles/utilities/BundleLabelDropper (runtime) // new
  6061. /**
  6062. * <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>
  6063. */
  6064. var com_ibm_rave_bundles_components_AxisComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  6065. /**
  6066. * Axis - created on demand
  6067. */
  6068. //_axis : null,
  6069. /**
  6070. * Role, from the AxisComponent API
  6071. */
  6072. //_role : null,
  6073. /**
  6074. * CoordinateScale
  6075. */
  6076. //_scale : null,
  6077. /**
  6078. * Orient, always one of the four legal values
  6079. */
  6080. //_orient : null,
  6081. /**
  6082. * Size
  6083. */
  6084. //_bounds : null,
  6085. //_elementRect : null,
  6086. /**
  6087. * The title text; default null (nothing visible)
  6088. */
  6089. /** @expose */
  6090. _axisTitle : null,
  6091. /**
  6092. * The title style; defaults null (use the CSS styling)
  6093. */
  6094. /** @expose */
  6095. _titleStyle : null,
  6096. /**
  6097. * Axis line color; default null (use the CSS styling)
  6098. */
  6099. /** @expose */
  6100. _lineColor : null,
  6101. /**
  6102. * Axis tick color; default null (use the CSS styling)
  6103. */
  6104. /** @expose */
  6105. _tickColor : null,
  6106. /**
  6107. * Axis tick label style; defaults null (use the CSS styling)
  6108. */
  6109. /** @expose */
  6110. _labelStyle : null,
  6111. //_staggerRotate45Nodes : null,
  6112. //_staggerFirstNode : null,
  6113. //_staggerLastNode : null,
  6114. /**
  6115. * Axis tick label formatting
  6116. */
  6117. //_tickFormat : null,
  6118. //_dropOverlap : null,
  6119. /**
  6120. * Used to get the extension to enable axis label wrapping
  6121. */
  6122. //_textFlow : null,
  6123. /**
  6124. * Used to check the fonts on each label to make sure all characters are covered
  6125. */
  6126. //_fontChecker : null,
  6127. /**
  6128. * Run function that applies the properties to the axis line
  6129. */
  6130. //_axisLineProperties : null,
  6131. /**
  6132. * Run function that applies the properties to the axis ticks
  6133. */
  6134. //_axisTickProperties : null,
  6135. /**
  6136. * Run function that applies the properties to the axis tick labels
  6137. */
  6138. //_axisTickLabelProperties : null,
  6139. /**
  6140. * Run function that hides or displays the axis tick labels
  6141. */
  6142. //_displayHideLabels : null,
  6143. /**
  6144. * Run function that hides or displays the axis tick labels
  6145. */
  6146. //_panZoomLabels : null,
  6147. /**
  6148. * The tick handler registered with the axis; will get called during axis transition
  6149. */
  6150. //_tickHandler : null,
  6151. //_textTruncationIndicator : null,
  6152. /**
  6153. * Used when dealing with numeric scale on the vertical axis and the numbers don't fit
  6154. */
  6155. //_simplifiedTickFormat : null,
  6156. //_tickMagnitude : null,
  6157. /**
  6158. * Whether to display the axis title; default true
  6159. */
  6160. /** @expose */
  6161. _displayAxisTitle : false,
  6162. /**
  6163. * Whether to display the axis line; default true
  6164. */
  6165. /** @expose */
  6166. _displayAxisLine : false,
  6167. /**
  6168. * Whether to display the axis ticks; default true
  6169. */
  6170. /** @expose */
  6171. _displayTicks : false,
  6172. /**
  6173. * Whether to display the axis tick labels (conditional on show labels property); default true
  6174. */
  6175. /** @expose */
  6176. _displayTickLabels : false,
  6177. /**
  6178. * Whether to display the axis tick labels (conditional on pan-zoom hide property); default true
  6179. */
  6180. /** @expose */
  6181. _showPanZoomTickLabels : false,
  6182. /**
  6183. * Whether to rotate the axis tick labels; default false
  6184. */
  6185. _rotateLabels : false,
  6186. _staggerCellWidth : 0,
  6187. _staggerAlignFirstAtStart : false,
  6188. _staggerAlignLastAtEnd : false,
  6189. _layoutTimerId : 0,
  6190. _layoutTitleSize : 0,
  6191. _layoutLabelSize : 0,
  6192. _layoutLabelHeight : 0,
  6193. _layoutAverageDigitWidth : 0,
  6194. _layoutSpillOver : 0,
  6195. /**
  6196. * Whether to hide overlapping labels; default true
  6197. */
  6198. /** @expose */
  6199. _hideOverlappingLabels : false,
  6200. /**
  6201. * When true, don't start a new timer
  6202. */
  6203. _pendingLabelTimer : false,
  6204. /**
  6205. * The padding in px between tick axis line and tick label, and also between tick label and title. Default 16px.
  6206. */
  6207. _padding : 0,
  6208. /**
  6209. * After calling the component, this is true if shapes were rendered, false if they were cleared.
  6210. */
  6211. _renderedShapes : false,
  6212. _layoutMode : -1,
  6213. _allowAutoAxisLayoutToChangeOrientaiton : true,
  6214. _lastAutomaticAxisLayoutOrientation : -1,
  6215. _allowStagger : false,
  6216. _allowRotate45 : false,
  6217. _allowRotate90 : false,
  6218. constructor : function() {
  6219. {
  6220. var self = this;
  6221. this._axisLineProperties = function(args) {
  6222. if (args !== null || arguments.length > 1){
  6223. args = Array.prototype.slice.call(arguments, 0);
  6224. }
  6225. {
  6226. var line = this.selectAll("path.domain");
  6227. if (self._lineColor != null) {
  6228. line.style("stroke", self._lineColor);
  6229. }
  6230. if (self._displayAxisLine) {
  6231. line.attr("visibility", null);
  6232. } else {
  6233. line.attr("visibility", "hidden");
  6234. }
  6235. return null;
  6236. }
  6237. };
  6238. this._axisTickProperties = function(args) {
  6239. if (args !== null || arguments.length > 1){
  6240. args = Array.prototype.slice.call(arguments, 0);
  6241. }
  6242. {
  6243. var tickLines = this.selectAll("line");
  6244. if (self._displayTicks) {
  6245. tickLines.attr("visibility", null);
  6246. } else {
  6247. tickLines.attr("visibility", "hidden");
  6248. }
  6249. if (self._lineColor != null) {
  6250. tickLines.style("stroke", self._tickColor);
  6251. }
  6252. return null;
  6253. }
  6254. };
  6255. this._axisTickLabelProperties = function(args) {
  6256. if (args !== null || arguments.length > 1){
  6257. args = Array.prototype.slice.call(arguments, 0);
  6258. }
  6259. {
  6260. var labels = this.selectAll("text");
  6261. labels.each(self._displayHideLabels);
  6262. labels.each(self._panZoomLabels);
  6263. labels.style(self._labelStyle);
  6264. self._axis.ticksHandler(null);
  6265. return null;
  6266. }
  6267. };
  6268. this._displayHideLabels = function(obj, group, index) {
  6269. if (self._displayTickLabels) {
  6270. if (this.rave_hasProperty("__tickLabelHidden__")) {
  6271. this.rave_removeProperty("__tickLabelHidden__");
  6272. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  6273. if (count <= 1) {
  6274. this.rave_removeProperty("__hiddenCount__");
  6275. this.removeAttribute("visibility");
  6276. } else {
  6277. this.rave_setProperty("__hiddenCount__", count - 1);
  6278. }
  6279. }
  6280. } else {
  6281. if (!(this.rave_hasProperty("__tickLabelHidden__"))) {
  6282. this.setAttribute("visibility", "hidden");
  6283. this.rave_setProperty("__tickLabelHidden__", "hidden");
  6284. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  6285. this.rave_setProperty("__hiddenCount__", count + 1);
  6286. }
  6287. }
  6288. };
  6289. this._panZoomLabels = function(obj, group, index) {
  6290. if (self._showPanZoomTickLabels) {
  6291. if (this.rave_hasProperty("__panZoomHidden__")) {
  6292. this.rave_removeProperty("__panZoomHidden__");
  6293. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  6294. if (count <= 1) {
  6295. this.rave_removeProperty("__hiddenCount__");
  6296. this.removeAttribute("visibility");
  6297. } else {
  6298. this.rave_setProperty("__hiddenCount__", count - 1);
  6299. }
  6300. }
  6301. } else {
  6302. if (!(this.rave_hasProperty("__panZoomHidden__"))) {
  6303. this.setAttribute("visibility", "hidden");
  6304. this.rave_setProperty("__panZoomHidden__", "hidden");
  6305. var count = ~~ (this.rave_getProperty("__hiddenCount__"));
  6306. this.rave_setProperty("__hiddenCount__", count + 1);
  6307. }
  6308. }
  6309. };
  6310. }
  6311. this._tickHandler = new com_ibm_rave_bundles_components_AxisComponentImpl.AxisTickHandler(this._axisTickLabelProperties, this._axisTickProperties);
  6312. /**
  6313. * Initialize properties to defaults
  6314. */
  6315. {
  6316. this._axis = null;
  6317. this._role = null;
  6318. this._scale = null;
  6319. this._orient = "bottom";
  6320. this._bounds = null;
  6321. this._displayAxisTitle = true;
  6322. this._axisTitle = null;
  6323. this._titleStyle = {};
  6324. this._displayAxisLine = true;
  6325. this._lineColor = null;
  6326. this._displayTicks = true;
  6327. this._tickColor = null;
  6328. this._displayTickLabels = true;
  6329. this._labelStyle = {};
  6330. this._rotateLabels = false;
  6331. this._hideOverlappingLabels = true;
  6332. this._dropOverlap = new com_ibm_rave_bundles_utilities_BundleLabelDropper();
  6333. this._tickFormat = null;
  6334. this._showPanZoomTickLabels = true;
  6335. this._pendingLabelTimer = false;
  6336. this._padding = 16;
  6337. this._textFlow = rave.capabilities.extension("textflow");
  6338. this._fontChecker = rave.capabilities.extension("fontchecker");
  6339. this._renderedShapes = false;
  6340. }
  6341. },
  6342. /** @expose */
  6343. type : function() {
  6344. return com_ibm_rave_bundles_component_AxisComponent.COMPONENT_TYPE;
  6345. },
  6346. /** @expose */
  6347. role : function() {
  6348. return this._role;
  6349. },
  6350. /** @expose */
  6351. execute : function(g) {
  6352. this.preExecute();
  6353. if (!this._scale) {
  6354. g.selectAll("*").remove();
  6355. this._renderedShapes = false;
  6356. return;
  6357. }
  6358. this._renderedShapes = true;
  6359. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  6360. this._hideOverlappingLabels = false;
  6361. this._rotateLabels = true;
  6362. } else {
  6363. this._hideOverlappingLabels = true;
  6364. this._rotateLabels = true;
  6365. }
  6366. this.drawTitle(g);
  6367. this.drawAxis(g);
  6368. this.handleAxisText(g);
  6369. this.drawTitle(g);
  6370. },
  6371. /**
  6372. * This is one place where all the calls that affect the axis text happen in case of allowAutomaticAxisLayout the new behavior applies here
  6373. * @param (rave['internal']['Selector']) g
  6374. */
  6375. handleAxisText : function(g) {
  6376. this.stopLabelDroppingUpdate();
  6377. var duration = 0, delay = 0;
  6378. var g2 = rave.transition(g);
  6379. if (g2.isTransition()) {
  6380. var t2 = (g2);
  6381. duration = t2.duration();
  6382. delay = t2.delay();
  6383. }
  6384. var axisSelector = g.selectAll("g.axis");
  6385. var labels = axisSelector.selectAll("g.tick").filter(rave['library']['internal']['BundleUtils'].notExit).selectAll("text");
  6386. var fontChecker = rave.capabilities.extension("fontchecker");
  6387. labels.style(this._labelStyle);
  6388. if (fontChecker) {
  6389. labels.call(fontChecker);
  6390. }
  6391. var mode = this._allowAutoAxisLayoutToChangeOrientaiton ? this.determineWhichAutoMode(g) : this._lastAutomaticAxisLayoutOrientation;
  6392. this.configureStaggerData(g, mode);
  6393. this.handleLabelsRotationAndPosition(g, labels, mode);
  6394. this.hashingNumericScales(labels, this.labelExtent(g), mode);
  6395. if (duration == 0) {
  6396. this.doLabelWrapping(g, mode);
  6397. this.handleLabelsRotationAndPosition(g, labels, mode);
  6398. }
  6399. this._lastAutomaticAxisLayoutOrientation = mode;
  6400. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  6401. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6402. var tick = axisSelector.append("g").classed("tick", true);
  6403. var tickText = tick.append("text");
  6404. if (labels.size() == 0) {
  6405. var singleValue = this._scale.scale().domain()[0];
  6406. var formatter = this._tickFormat;
  6407. if (!formatter) {
  6408. var tickFunc = this._scale.scale().tickFormat;
  6409. if (tickFunc) {
  6410. formatter = tickFunc.apply(tickFunc, [singleValue]);
  6411. }
  6412. }
  6413. var node = tickText[0][0];
  6414. var stringValue = formatter ? formatter.call(node, singleValue, 0, 0) : ""+(singleValue);
  6415. tickText.text(stringValue);
  6416. var dim = node.getBBox();
  6417. this._layoutLabelSize = isHorizontal ? dim.height : dim.width;
  6418. if (!isHorizontal || mode != 0) {
  6419. tickText.text(".0");
  6420. this._layoutLabelSize += node.getBBox().width;
  6421. }
  6422. }
  6423. if (!isHorizontal || mode != 0) {
  6424. tickText.text(".0");
  6425. var node = tickText[0][0];
  6426. var dim = node.getBBox();
  6427. this._layoutAverageDigitWidth = dim.width;
  6428. }
  6429. tick.remove();
  6430. }
  6431. if (this._hideOverlappingLabels && duration > 0) {
  6432. this.updateLabelDropping(labels, duration, delay);
  6433. }
  6434. if (duration > 0) {
  6435. this.doLabelWrappingAfterAnimation(g, labels, mode, duration, delay);
  6436. }
  6437. if (!this._displayTickLabels) {
  6438. this._layoutLabelSize = 0;
  6439. this._layoutAverageDigitWidth = 0;
  6440. }
  6441. },
  6442. /**
  6443. * 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
  6444. * @param (rave['internal']['Selector']) g selector
  6445. * @param (rave['internal']['Selector']) labels labels selector
  6446. * @param (int) mode one of HORIZONTAL, STAGGER, ROTATE90
  6447. */
  6448. handleLabelsRotationAndPosition : function(g, labels, mode) {
  6449. if (mode == 2 || mode == 1) {
  6450. if (this._orient == "bottom") {
  6451. this.rotateLabels(g, labels, "end", mode);
  6452. } else if (this._orient == "top") {
  6453. this.rotateLabels(g, labels, "start", mode);
  6454. } else {
  6455. this.rotateLabels(g, labels, "middle", mode);
  6456. }
  6457. } else {
  6458. if (this._orient == "bottom" || this._orient == "top") {
  6459. this.rotateLabels(g, labels, "middle", mode);
  6460. } else if (this._orient == "right") {
  6461. this.rotateLabels(g, labels, "start", mode);
  6462. } else {
  6463. this.rotateLabels(g, labels, "end", mode);
  6464. }
  6465. }
  6466. },
  6467. /**
  6468. * <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>
  6469. * @param (rave['internal']['Selector']) labels
  6470. */
  6471. hashingNumericScales : function(labels, extent, mode) {
  6472. if (!labels || !extent) {
  6473. return;
  6474. }
  6475. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  6476. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6477. var tickSpace = mode == 1 ? extent[1] : extent[0];
  6478. this._textTruncationIndicator = "";
  6479. this._layoutLabelSize = 0;
  6480. for (var i = 0; i < labels.size(); ++i) {
  6481. var node = labels[i][0];
  6482. var dim = node.getBBox();
  6483. var width = dim.width;
  6484. var height = dim.height;
  6485. var size = !isHorizontal || mode == 1 ? width : height;
  6486. if (size > this._layoutLabelSize) {
  6487. this._layoutLabelSize = size;
  6488. }
  6489. if (width >= tickSpace) {
  6490. if (this._simplifiedTickFormat) {
  6491. var newText = this._simplifiedTickFormat.call(null, node.rave_getData(), 0, 0);
  6492. if (newText != null) {
  6493. node.rave_setText(newText);
  6494. }
  6495. if (node.getBBox().width >= tickSpace) {
  6496. node.rave_setText(this.stringOfSize(node.rave_getText().length, "#"));
  6497. }
  6498. } else {
  6499. node.rave_setText(this.stringOfSize(node.rave_getText().length, "#"));
  6500. }
  6501. }
  6502. }
  6503. }
  6504. },
  6505. /**
  6506. * @param (int) size The desired size of the string
  6507. * @param (String) ch The character to be repeated in the string
  6508. * @return (String) A string of the specified size containing repetition of the specified character
  6509. */
  6510. stringOfSize : function(size, ch) {
  6511. var returnString = "";
  6512. for (var i = 0; i < size; ++i) {
  6513. returnString += ch;
  6514. }
  6515. return returnString;
  6516. },
  6517. configureStaggerData : function(g, mode) {
  6518. if (mode == 3 || mode == 2) {
  6519. var horizontalDimensions = this.labelExtent(g);
  6520. var cellWidth = horizontalDimensions[0];
  6521. var axisSelector = g.selectAll("g.axis");
  6522. var labels = axisSelector.selectAll("text");
  6523. var domain = this._scale.scale().domain();
  6524. var originalDataLabelAccessor = (this._scale).originalDomainLabelAccessor();
  6525. this._staggerRotate45Nodes = [];
  6526. this._staggerFirstNode = null;
  6527. this._staggerLastNode = null;
  6528. for (var i = 0; i < labels.size(); ++i) {
  6529. var node = labels[0][i];
  6530. if (this.isValid(node.rave_getData())) {
  6531. var domainIndex = -1;
  6532. if (mode == 3) {
  6533. var domainLabel = !this._tickFormat ? node.rave_getText() : originalDataLabelAccessor.call(node, node.rave_getData(), 0, 0);
  6534. for (var index = 0; index < domain.length; ++index) {
  6535. if (domain[index].toString() == domainLabel) {
  6536. domainIndex = index;
  6537. break;
  6538. }
  6539. }
  6540. }
  6541. this._staggerRotate45Nodes.push(new com_ibm_rave_bundles_components_AxisComponentImpl.NodeIndex(node, domainIndex));
  6542. if (domainIndex == 0) {
  6543. this._staggerFirstNode = node;
  6544. }
  6545. if (domainIndex == domain.length - 1) {
  6546. this._staggerLastNode = node;
  6547. }
  6548. }
  6549. }
  6550. this._staggerCellWidth = cellWidth * 2;
  6551. this._staggerAlignFirstAtStart = this._staggerFirstNode ? this._staggerFirstNode.getBBox().width > cellWidth : false;
  6552. this._staggerAlignLastAtEnd = this._staggerLastNode ? this._staggerLastNode.getBBox().width > cellWidth : false;
  6553. }
  6554. },
  6555. getStaggerIndex : function(node) {
  6556. for (var index = 0; index < this._staggerRotate45Nodes.length; ++index) {
  6557. if (this._staggerRotate45Nodes[index].contains(node)) {
  6558. var domainIndex = this._staggerRotate45Nodes[index].getIndex();
  6559. return domainIndex == -1 ? 0 : domainIndex;
  6560. }
  6561. }
  6562. return -1;
  6563. },
  6564. getStaggerCount : function() {
  6565. var domain = this._scale.scale().domain();
  6566. return domain.length;
  6567. },
  6568. /**
  6569. * <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>
  6570. * @param (rave['internal']['Selector']) g
  6571. */
  6572. determineWhichAutoMode : function(g) {
  6573. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6574. var axisSelector = g.selectAll("g.axis");
  6575. var labels = axisSelector.selectAll("text");
  6576. var dim = this.labelExtent(g);
  6577. var cellWidth = dim[0];
  6578. var cellWidth90 = dim[1];
  6579. var layoutLabelHeight = 0;
  6580. var layoutLabelWidth = 0;
  6581. var horizontalScore = 0;
  6582. var staggerScore = 0;
  6583. var rotate45Score = 0;
  6584. var rotate90Score = 0;
  6585. var validNodes = [];
  6586. for (var i = 0; i < labels.size(); ++i) {
  6587. var node = labels[0][i];
  6588. if (this.isValid(node.rave_getData())) {
  6589. validNodes.push(node);
  6590. }
  6591. }
  6592. var labelCount = validNodes.length;
  6593. if (!(this._scale.isOrdinal()) && !(this._scale.isClustered())) {
  6594. var mode = 0;
  6595. if (isHorizontal) {
  6596. mode = this._layoutMode == 1 ? 1 : 0;
  6597. var tick = axisSelector.append("g").classed("tick", true);
  6598. var tickText = tick.append("text");
  6599. tickText.style(this._labelStyle);
  6600. tickText.text(",0");
  6601. var node = tickText[0][0];
  6602. var zeroWidth = node.getBBox().width;
  6603. tick.remove();
  6604. var widestLabel = 0;
  6605. for (var i = 0; i < labelCount; ++i) {
  6606. node = validNodes[i];
  6607. var nodeRect = node.getBBox();
  6608. if (nodeRect.width > widestLabel) {
  6609. widestLabel = nodeRect.width;
  6610. }
  6611. if (nodeRect.height > this._layoutLabelHeight) {
  6612. this._layoutLabelHeight = nodeRect.height;
  6613. }
  6614. }
  6615. widestLabel += zeroWidth;
  6616. this._layoutSpillOver = mode == 1 ? this._layoutLabelHeight / 2 : widestLabel / 2 + 2;
  6617. } else {
  6618. for (var i = 0; i < labelCount; ++i) {
  6619. var node = validNodes[i];
  6620. var nodeRect = node.getBBox();
  6621. if (nodeRect.height > this._layoutLabelHeight) {
  6622. this._layoutLabelHeight = nodeRect.height;
  6623. }
  6624. }
  6625. this._layoutSpillOver = this._layoutLabelHeight / 2;
  6626. }
  6627. return mode;
  6628. }
  6629. var originalDataLabelAccessor = (this._scale).originalDomainLabelAccessor();
  6630. var staggerStringsWontMatch = this._tickFormat && !originalDataLabelAccessor;
  6631. var calcStagger = ((this._allowStagger && this._layoutMode == -1) || this._layoutMode == 3) && !staggerStringsWontMatch;
  6632. var calcRotate45 = (this._allowRotate45 && this._layoutMode == -1) || this._layoutMode == 2;
  6633. var calcRotate90 = (this._allowRotate90 && this._layoutMode == -1) || this._layoutMode == 1;
  6634. var spaceFor45Label = 0;
  6635. for (var i = 0; i < labelCount; ++i) {
  6636. var node = validNodes[i];
  6637. var nodeRect = node.getBBox();
  6638. layoutLabelHeight = nodeRect.height;
  6639. var labelWidth = nodeRect.width;
  6640. if (labelWidth > layoutLabelWidth) {
  6641. layoutLabelWidth = labelWidth;
  6642. }
  6643. horizontalScore += (labelWidth <= cellWidth ? 1 : cellWidth / labelWidth);
  6644. if (isHorizontal) {
  6645. if (calcStagger) {
  6646. var spaceForLabel = cellWidth * 2;
  6647. if (i == 0 && i == labelCount - 1) {
  6648. spaceForLabel *= 0.5;
  6649. } else if (i == 0 || i == labelCount - 1) {
  6650. spaceForLabel *= 0.75;
  6651. }
  6652. staggerScore += (labelWidth <= spaceForLabel ? 1 : spaceForLabel / labelWidth);
  6653. }
  6654. if (calcRotate45) {
  6655. if (spaceFor45Label == 0) {
  6656. spaceFor45Label = cellWidth90 / 0.7071 - layoutLabelHeight;
  6657. }
  6658. var space = this.calculate45DegreeSpace(node, spaceFor45Label);
  6659. rotate45Score += (labelWidth <= space ? 1 : space / labelWidth);
  6660. }
  6661. if (calcRotate90) {
  6662. rotate90Score += (labelWidth <= cellWidth90 ? 1 : cellWidth90 / labelWidth);
  6663. }
  6664. }
  6665. }
  6666. var mode = 0;
  6667. if (this._layoutMode == -1) {
  6668. if (isHorizontal && this._allowStagger) {
  6669. horizontalScore *= 1.1;
  6670. staggerScore *= 1.1;
  6671. }
  6672. if ((staggerScore > horizontalScore) && (staggerScore >= rotate45Score) && (staggerScore >= rotate90Score)) {
  6673. mode = 3;
  6674. } else if ((rotate45Score > horizontalScore) && (rotate45Score >= rotate90Score)) {
  6675. mode = 2;
  6676. } else if (rotate90Score > horizontalScore) {
  6677. mode = 1;
  6678. }
  6679. } else {
  6680. if ((this._layoutMode == 3 && staggerStringsWontMatch) || !isHorizontal) {
  6681. mode = 0;
  6682. } else {
  6683. mode = this._layoutMode;
  6684. }
  6685. }
  6686. if (isHorizontal) {
  6687. switch (mode) {
  6688. case 3:
  6689. this._layoutLabelSize = layoutLabelHeight * 2;
  6690. break;
  6691. case 2:
  6692. this._layoutLabelSize = (layoutLabelWidth + layoutLabelHeight) * 0.7071;
  6693. break;
  6694. case 1:
  6695. this._layoutLabelSize = layoutLabelWidth;
  6696. break;
  6697. case 0:
  6698. default:
  6699. this._layoutLabelSize = layoutLabelHeight;
  6700. break;
  6701. }
  6702. } else {
  6703. this._layoutLabelSize = layoutLabelWidth;
  6704. }
  6705. this._layoutLabelHeight = layoutLabelHeight;
  6706. return mode;
  6707. },
  6708. calculate45DegreeSpace : function(node, maxWidth) {
  6709. var width = maxWidth;
  6710. var tfm = node.rave_getParentNode().getAttribute("transform");
  6711. if (tfm != null) {
  6712. var tfmString = tfm.toString();
  6713. var indexOfTrans = tfmString.indexOf("translate(");
  6714. if (indexOfTrans != -1) {
  6715. indexOfTrans += 10;
  6716. var indexOfComma = tfmString.indexOf(",", indexOfTrans);
  6717. if (indexOfComma != -1) {
  6718. var xAmount = tfmString.substring(indexOfTrans, indexOfComma);
  6719. var xLabelPos = + (xAmount);
  6720. var width45Degrees = node.getBBox().width;
  6721. var xLabelWidth = width45Degrees * 0.7071;
  6722. var isBottom = this._orient == "bottom";
  6723. if (isBottom) {
  6724. xLabelPos -= node.getBBox().height / 4;
  6725. if (xLabelPos - xLabelWidth < this._bounds.x) {
  6726. xLabelWidth = xLabelPos - this._bounds.x;
  6727. width = xLabelWidth / 0.7071;
  6728. }
  6729. } else {
  6730. if (xLabelPos + xLabelWidth > this._bounds.x + this._bounds.width) {
  6731. xLabelWidth = (this._bounds.x + this._bounds.width) - xLabelPos;
  6732. width = xLabelWidth / 0.7071;
  6733. }
  6734. }
  6735. if (width > maxWidth) {
  6736. width = maxWidth;
  6737. }
  6738. }
  6739. }
  6740. }
  6741. return width;
  6742. },
  6743. /**
  6744. * @param (rave['internal']['Selector']) labels selector with all labels to be rotated
  6745. * @param (rave['internal']['Selector']) g The parent selector of labels
  6746. * @param (String) textAnchor The position of the anchor
  6747. * @param alignmentMode One of HORIZONTAL, STAGGER, ROTATE45, ROTATE90
  6748. */
  6749. rotateLabels : function(g, labels, textAnchor, mode) {
  6750. if (this._rotateLabels) {
  6751. var self = this;
  6752. var positioning = function(data, index, groupIndex) {
  6753. var x = 0;
  6754. var y = 0;
  6755. var rotation_cy = 0;
  6756. var isBottom = self._orient == "bottom";
  6757. if (mode == 3) {
  6758. var cellIndex = self.getStaggerIndex(this);
  6759. if (cellIndex != -1) {
  6760. if (cellIndex % 2 == 1) {
  6761. var staggerDirection = isBottom ? 1 : -1;
  6762. y += (self._layoutLabelHeight * staggerDirection);
  6763. }
  6764. if (cellIndex == 0 && self._staggerAlignFirstAtStart) {
  6765. x -= self._staggerCellWidth / 4;
  6766. } else if (cellIndex == self.getStaggerCount() - 1 && self._staggerAlignLastAtEnd) {
  6767. x += self._staggerCellWidth / 4;
  6768. }
  6769. }
  6770. } else if (mode == 2) {
  6771. if (isBottom) {
  6772. x -= self._layoutLabelHeight;
  6773. } else {
  6774. x += self._layoutLabelHeight / 2;
  6775. }
  6776. } else if (mode == 1) {
  6777. if (isBottom) {
  6778. x -= (this.getBBox().height / 2 + self._layoutLabelHeight / 4);
  6779. rotation_cy = ~~(self._padding / 4 + self._axis.tickSize());
  6780. } else {
  6781. x -= (this.getBBox().height / 2 - self._layoutLabelHeight);
  6782. rotation_cy = ~~-(self._padding / 4 + self._axis.tickSize());
  6783. }
  6784. }
  6785. var rotationDegrees = mode == 1 ? -90 : mode == 2 ? -45 : 0;
  6786. return "translate(" + x + "," + y + ") rotate(" + rotationDegrees + ",0," + rotation_cy + ")";
  6787. };
  6788. labels.attr("transform", positioning).style("text-anchor", textAnchor);
  6789. if (mode == 3) {
  6790. if (this._staggerAlignFirstAtStart) {
  6791. this._staggerFirstNode.rave_setStyle("text-anchor", "start");
  6792. }
  6793. if (this._staggerAlignLastAtEnd) {
  6794. this._staggerLastNode.rave_setStyle("text-anchor", "end");
  6795. }
  6796. }
  6797. }
  6798. },
  6799. /** @expose */
  6800. axis : function() {
  6801. return this._axis;
  6802. },
  6803. /**
  6804. * Draw the axis. The scale is non-null.
  6805. * @param (rave['internal']['Selector']) g Selector group into which the axis is drawn.
  6806. */
  6807. drawAxis : function(g) {
  6808. var axisSelector = g.selectAll("g.axis").data([0]);
  6809. axisSelector.enter().append("g").classed("axis", true).classed(this._orient, true);
  6810. if (!this._axis) {
  6811. this._axis = new rave['internal']['Axis']();
  6812. }
  6813. if (this._hideOverlappingLabels) {
  6814. this._textFlow.valignment("top").dropTextOnFail(false);
  6815. }
  6816. this._axis.ticksHandler(this._tickHandler);
  6817. this._axis.orient(this._orient);
  6818. this._axis.tickFormat(this._tickFormat);
  6819. this._axis.tickPadding(10.0);
  6820. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  6821. var labelHeight = 20.0;
  6822. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6823. if (isHorizontal) {
  6824. labelHeight /= 0.7071;
  6825. }
  6826. var range = this._scale.scale().rangeExtent();
  6827. var extent = + (range[1]) - + (range[0]);
  6828. this._axis.ticks(extent / labelHeight);
  6829. } else {
  6830. if (this._tickMagnitude == null) {
  6831. this._axis.ticks(10.0);
  6832. } else {
  6833. this._axis.ticks.apply(this._axis, [10.0, this._scale.scale().getTickFormat(), this._tickMagnitude]);
  6834. }
  6835. }
  6836. var s = this._scale.scale();
  6837. if (this._scale.originalDomain()) {
  6838. var sOrdinal = s.copy();
  6839. sOrdinal.domain(this._scale.originalDomain());
  6840. s = sOrdinal;
  6841. var self = this;
  6842. var originalDataLabelAccessor = (self._scale).originalDomainLabelAccessor();
  6843. var tickFormatter;
  6844. if (originalDataLabelAccessor) {
  6845. if (this._tickFormat) {
  6846. tickFormatter = function(data, index, groupIndex) {
  6847. return self._tickFormat.call(this, originalDataLabelAccessor.call(this, data, index, groupIndex), index, groupIndex);
  6848. };
  6849. } else {
  6850. tickFormatter = originalDataLabelAccessor;
  6851. }
  6852. } else {
  6853. tickFormatter = this._tickFormat;
  6854. }
  6855. this._axis.tickFormat(tickFormatter);
  6856. }
  6857. this._axis.scale(s);
  6858. axisSelector.call(this._axis);
  6859. var g2 = rave.transition(axisSelector);
  6860. if (!(g2.isTransition())) {
  6861. axisSelector.selectAll("text").call(this._dropOverlap, this._hideOverlappingLabels);
  6862. }
  6863. axisSelector.selectAll("path.domain").classed("axis-line", true);
  6864. axisSelector.selectAll("g.tick line").classed("axis-tick", true);
  6865. if (this._fontChecker) {
  6866. axisSelector.selectAll("g.tick text").classed("axis-label", true).call(this._fontChecker);
  6867. } else {
  6868. axisSelector.selectAll("g.tick text").classed("axis-label", true);
  6869. }
  6870. axisSelector.call(this._axisLineProperties);
  6871. },
  6872. /**
  6873. * Draw the axis title.
  6874. * @param (rave['internal']['Selector']) g Selector group into which the title is drawn.
  6875. */
  6876. drawTitle : function(g) {
  6877. if (!this._displayAxisTitle || this._axisTitle == null || this._axisTitle.trim().length == 0 || !this._bounds) {
  6878. g.selectAll("text.axis-title." + this._orient).remove();
  6879. return;
  6880. }
  6881. var x = 0;
  6882. var y = 0;
  6883. var dy = "";
  6884. var transform;
  6885. if ("top" == this._orient) {
  6886. x = this._elementRect.x + this._elementRect.width / 2;
  6887. y = -this._bounds.height + this._padding / 4;
  6888. dy = "0.75em";
  6889. } else if ("bottom" == this._orient) {
  6890. x = this._elementRect.x + this._elementRect.width / 2;
  6891. y = this._bounds.height - this._padding / 4;
  6892. dy = "-0.25em";
  6893. } else if ("left" == this._orient) {
  6894. x = -this._elementRect.y - this._elementRect.height / 2;
  6895. y = -this._bounds.width + this._padding / 4;
  6896. dy = "0.75em";
  6897. transform = "rotate(-90)";
  6898. } else {
  6899. x = this._elementRect.y + this._elementRect.height / 2;
  6900. y = -this._bounds.width + this._padding / 4;
  6901. dy = "0.75em";
  6902. transform = "rotate(90)";
  6903. }
  6904. var fillOpacity;
  6905. {
  6906. var tmp = g.append("text").attr("class", "axis-title " + this._orient);
  6907. fillOpacity = tmp.style("fill-opacity");
  6908. tmp.remove();
  6909. } var label = g.selectAll("text.axis-title." + this._orient);
  6910. if (label.size() == 0) {
  6911. 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);
  6912. if (this._fontChecker) {
  6913. g.selectAll("text.axis-title." + this._orient).call(this._fontChecker);
  6914. }
  6915. }
  6916. 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);
  6917. },
  6918. getUnZoomedScale : function(scale) {
  6919. var s = scale.copy();
  6920. if (s.getZoomTransform()) {
  6921. s.getZoomTransform()(1, 0);
  6922. }
  6923. return s;
  6924. },
  6925. isValid : function(data) {
  6926. var s = this.getUnZoomedScale(this._axis.scale());
  6927. var v = + (s.call(null, data, 0, 0));
  6928. var range = this._axis.scale().range();
  6929. if (this._axis.scale().range().indexOf(v)> -1) {
  6930. return true;
  6931. }
  6932. if (range[0] < v && v < range[1]) {
  6933. return true;
  6934. }
  6935. if (range[0] > v && v > range[1]) {
  6936. return true;
  6937. }
  6938. return false;
  6939. },
  6940. /**
  6941. * Apply label wrapping if requested.
  6942. * @param (rave['internal']['Selector']) g
  6943. * @param (int) mode One of HORIZONTAL, STAGGER, ROTATE45, ROTATE90
  6944. */
  6945. doLabelWrapping : function(g, mode) {
  6946. if (this._displayTickLabels) {
  6947. this._textFlow.valignment("top");
  6948. if (!this._hideOverlappingLabels) {
  6949. this._textFlow.dropTextOnFail(true);
  6950. }
  6951. var d = this.labelExtent(g);
  6952. if (!d || d[0] < 0 || d[1] < 0) {
  6953. return;
  6954. }
  6955. var w = ~~ (d[0]);
  6956. var h = ~~ (d[1]);
  6957. if (mode == 2) {
  6958. w = ~~(d[1] / 0.7071 - this._layoutLabelHeight);
  6959. h = ~~(this._layoutLabelHeight / 0.7071);
  6960. } else if (mode == 1) {
  6961. var tmp = w;
  6962. w = h;
  6963. h = tmp;
  6964. }
  6965. var allowWrap = mode == 1;
  6966. if (this._scale.isOrdinal() || this._scale.isClustered()) {
  6967. var hActual = ~~ (this._layoutLabelHeight * 1.2);
  6968. if (hActual > h) {
  6969. h = hActual;
  6970. }
  6971. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  6972. if (mode == 0 && !isHorizontal) {
  6973. allowWrap = true;
  6974. }
  6975. }
  6976. var self = this;
  6977. var cellWidth = w;
  6978. var cellHeight = h;
  6979. this._textFlow.wrap(allowWrap).truncate(true).textTruncateIndicator(this._textTruncationIndicator != null ? this._textTruncationIndicator : "...").spacing(1.2).extent(function(data, index, groupIndex) {
  6980. var width = cellWidth;
  6981. var height = cellHeight;
  6982. if (mode == 2) {
  6983. var cellIndex = self.getStaggerIndex(this);
  6984. if (cellIndex != -1) {
  6985. width = ~~self.calculate45DegreeSpace(this, cellWidth);
  6986. }
  6987. } else if (mode == 3) {
  6988. var cellIndex = self.getStaggerIndex(this);
  6989. if (cellIndex != -1) {
  6990. if (cellIndex == 0 && cellIndex == self.getStaggerCount() - 1) {
  6991. width = cellWidth;
  6992. } else if (cellIndex == 0 || cellIndex == self.getStaggerCount() - 1) {
  6993. width = cellWidth * 3 / 2;
  6994. } else {
  6995. width = cellWidth * 2;
  6996. }
  6997. height = cellHeight / 2;
  6998. }
  6999. }
  7000. return [width, height];
  7001. });
  7002. g.selectAll("g.tick > text").call(this._textFlow);
  7003. }
  7004. },
  7005. /**
  7006. * <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>
  7007. * @param (rave['internal']['Selector']) g Selector group for axis
  7008. * @return (Array) The extent of the axis label bounds
  7009. */
  7010. /** @expose */
  7011. labelExtent : function(g) {
  7012. var isHorizontal = this._orient == "bottom" || this._orient == "top";
  7013. var w = this._bounds.width;
  7014. var h = this._bounds.height;
  7015. if (this._scale.scale().rangeBand) {
  7016. var rangeBandValue = + (this._scale.scale().rangeBand());
  7017. if (isHorizontal) {
  7018. w = rangeBandValue;
  7019. } else {
  7020. h = rangeBandValue;
  7021. }
  7022. }
  7023. this.calcTitleExtent(g);
  7024. if (isHorizontal) {
  7025. h -= this._axis.tickSize();
  7026. h -= this._padding / 2;
  7027. if (this._layoutTitleSize != 0) {
  7028. h -= this._layoutTitleSize;
  7029. h -= this._padding / 2;
  7030. }
  7031. } else {
  7032. w -= this._axis.tickSize();
  7033. w -= this._padding / 2;
  7034. if (this._layoutTitleSize != 0) {
  7035. w -= this._layoutTitleSize;
  7036. w -= this._padding / 2;
  7037. }
  7038. }
  7039. return [w, h];
  7040. },
  7041. calcTitleExtent : function(g) {
  7042. this._layoutTitleSize = 0;
  7043. var title = g.selectAll("text.axis-title");
  7044. if (title.size() > 0) {
  7045. var textHeight = title[0][0].getBBox().height;
  7046. this._layoutTitleSize = textHeight;
  7047. }
  7048. },
  7049. /**
  7050. * Set the role to one of the constants ROLE_X1 etc. defined in AxisComponent.
  7051. * @param (String) role The new role
  7052. * @return (com.ibm.rave.bundles.components.AxisComponentImpl) This object
  7053. */
  7054. /** @expose */
  7055. setRole : function(role) {
  7056. this._role = role;
  7057. return this;
  7058. },
  7059. /**
  7060. * Set the ticks interval on the scale based on the magnitude. tickMagnitude represents power of 10. null value gives the default scale ticks.
  7061. * @param (Number) tickMagnitude
  7062. * @return (com.ibm.rave.bundles.component.AxisComponent) this
  7063. */
  7064. /** @expose */
  7065. scaleTickMagnitude : function(tickMagnitude) {
  7066. this._tickMagnitude = tickMagnitude;
  7067. return this;
  7068. },
  7069. /**
  7070. * @param (rave['library']['internal']['CoordinateScaleImpl']) scale The new scale
  7071. */
  7072. /** @expose */
  7073. scale : function(scale) {
  7074. this._scale = scale ? scale : null;
  7075. return this;
  7076. },
  7077. /**
  7078. * Only legal values are accepted, otherwise the orient is unchanged.
  7079. * @param (String) orient The new orient
  7080. */
  7081. orient$0 : function(orient) {
  7082. if ("left" == orient || "bottom" == orient || "right" == orient || "top" == orient) {
  7083. this._orient = orient;
  7084. if (this._role == null) {
  7085. if ("left" == orient) {
  7086. this._role = "ROLE_Y1";
  7087. } else if ("bottom" == orient) {
  7088. this._role = "ROLE_X1";
  7089. } else if ("right" == orient) {
  7090. this._role = "ROLE_Y2";
  7091. } else {
  7092. this._role = "ROLE_X2";
  7093. }
  7094. }
  7095. }
  7096. return this;
  7097. },
  7098. /**
  7099. * Returns the current orientation string return The current orient
  7100. */
  7101. orient$1 : function() {
  7102. return this._orient;
  7103. },
  7104. /**
  7105. * @param (rave['internal']['RectStruct']) bounds The new bounds
  7106. */
  7107. /** @expose */
  7108. bounds : function(bounds) {
  7109. this._bounds = bounds;
  7110. return this;
  7111. },
  7112. /** @expose */
  7113. elementRect : function(elementRect) {
  7114. this._elementRect = elementRect;
  7115. return this;
  7116. },
  7117. tickFormat$0 : function(tickFormat) {
  7118. this._tickFormat = tickFormat;
  7119. return this;
  7120. },
  7121. tickFormat$1 : function() {
  7122. return this._tickFormat;
  7123. },
  7124. simplifiedTickFormat$0 : function(tickFormat) {
  7125. this._simplifiedTickFormat = tickFormat;
  7126. return this;
  7127. },
  7128. simplifiedTickFormat$1 : function() {
  7129. return this._simplifiedTickFormat;
  7130. },
  7131. /** @expose */
  7132. displayAxisTitle : function(displayAxisTitle) {
  7133. this._displayAxisTitle = displayAxisTitle;
  7134. return this;
  7135. },
  7136. /** @expose */
  7137. displayAxisLine : function(displayAxisLine) {
  7138. this._displayAxisLine = displayAxisLine;
  7139. return this;
  7140. },
  7141. /** @expose */
  7142. displayTicks : function(displayTicks) {
  7143. this._displayTicks = displayTicks;
  7144. return this;
  7145. },
  7146. /** @expose */
  7147. displayTickLabels : function(displayTickLabels) {
  7148. this._displayTickLabels = displayTickLabels;
  7149. return this;
  7150. },
  7151. /** @expose */
  7152. allowAutomaticAxisLayoutToChangeOrientation : function(state) {
  7153. this._allowAutoAxisLayoutToChangeOrientaiton = state;
  7154. return this;
  7155. },
  7156. /** @expose */
  7157. isAllowAutomaticAxisLayoutToChangeOrientation : function() {
  7158. return this._allowAutoAxisLayoutToChangeOrientaiton;
  7159. },
  7160. /** @expose */
  7161. showPanZoomTickLabels : function(showPanZoomTickLabels) {
  7162. this._showPanZoomTickLabels = showPanZoomTickLabels;
  7163. return this;
  7164. },
  7165. /** @expose */
  7166. axisTitle : function(axisTitle) {
  7167. this._axisTitle = axisTitle;
  7168. return this;
  7169. },
  7170. /** @expose */
  7171. axisColor : function(axisColor) {
  7172. this._lineColor = axisColor;
  7173. this._tickColor = axisColor;
  7174. return this;
  7175. },
  7176. /** @expose */
  7177. lineColor : function(lineColor) {
  7178. this._lineColor = lineColor;
  7179. return this;
  7180. },
  7181. /** @expose */
  7182. tickColor : function(tickColor) {
  7183. this._tickColor = tickColor;
  7184. return this;
  7185. },
  7186. /** @expose */
  7187. labelColor : function(labelColor) {
  7188. this._labelStyle["fill"] = labelColor;
  7189. return this;
  7190. },
  7191. labelStyle$0 : function(fill, fontSize, fontFamily) {
  7192. this._labelStyle["fill"] = fill;
  7193. this._labelStyle["font-size"] = fontSize;
  7194. this._labelStyle["font-family"] = fontFamily;
  7195. return this;
  7196. },
  7197. /** @expose */
  7198. titleColor : function(titleColor) {
  7199. this._titleStyle["fill"] = titleColor;
  7200. return this;
  7201. },
  7202. titleStyle$0 : function(fill, fontSize, fontFamily) {
  7203. this._titleStyle["fill"] = fill;
  7204. this._titleStyle["font-size"] = fontSize;
  7205. this._titleStyle["font-family"] = fontFamily;
  7206. return this;
  7207. },
  7208. /**
  7209. * @param (int) padding The new padding
  7210. */
  7211. /** @expose */
  7212. padding : function(padding) {
  7213. this._padding = padding;
  7214. return this;
  7215. },
  7216. /**
  7217. * @param mode LayoutMode for axis, one of: null (numeric axis), automatic, horizontal, stagger, rotate45, rotate90
  7218. */
  7219. /** @expose */
  7220. layoutMode : function(layoutMode) {
  7221. this._layoutMode = -1;
  7222. if (layoutMode != null) {
  7223. if (layoutMode == "horizontal") {
  7224. this._layoutMode = 0;
  7225. } else if (layoutMode == "stagger") {
  7226. this._layoutMode = 3;
  7227. } else if (layoutMode == "rotate45") {
  7228. this._layoutMode = 2;
  7229. } else if (layoutMode == "rotate90") {
  7230. this._layoutMode = 1;
  7231. }
  7232. }
  7233. return this;
  7234. },
  7235. /**
  7236. * @param (boolean) allow Enable Stagger to be considered in the automatic layout algorithm
  7237. */
  7238. /** @expose */
  7239. allowStagger : function(allow) {
  7240. this._allowStagger = allow;
  7241. return this;
  7242. },
  7243. /**
  7244. * @param (boolean) allow Enable Rotate 45 to be considered in the automatic layout algorithm
  7245. */
  7246. /** @expose */
  7247. allowRotate45 : function(allow) {
  7248. this._allowRotate45 = allow;
  7249. return this;
  7250. },
  7251. /**
  7252. * @param (boolean) allow Enable Rotate 90 to be considered in the automatic layout algorithm
  7253. */
  7254. /** @expose */
  7255. allowRotate90 : function(allow) {
  7256. this._allowRotate90 = allow;
  7257. return this;
  7258. },
  7259. /**
  7260. * @return (boolean) True if on the last call the axis rendered shapes, false otherwise
  7261. */
  7262. renderedShapes : function() {
  7263. return this._renderedShapes;
  7264. },
  7265. labelStyle$1 : function(fontStyle) {
  7266. this._labelStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  7267. return this;
  7268. },
  7269. titleStyle$1 : function(fontStyle) {
  7270. this._titleStyle = com_ibm_rave_bundles_utilities_FontPropertyParser.parseCSSFont(fontStyle);
  7271. return this;
  7272. },
  7273. /**
  7274. * Determines whether the axis is swapped.
  7275. * @return (boolean) True if axis is swapped
  7276. */
  7277. isAxisSwapped : function() {
  7278. 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")));
  7279. },
  7280. /**
  7281. * <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>
  7282. * @param (String) indicator the string to be placed to indicated truncated text
  7283. * @return (com.ibm.rave.bundles.component.AxisComponent) This component
  7284. */
  7285. /** @expose */
  7286. textTruncateIndicator : function(indicator) {
  7287. this._textTruncationIndicator = indicator;
  7288. return this;
  7289. },
  7290. /**
  7291. * If at least one label collision request is pending we stop the label collision component, and shut down the label collision timer event.
  7292. */
  7293. stopLabelDroppingUpdate : function() {
  7294. this._pendingLabelTimer = false;
  7295. },
  7296. /**
  7297. * 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.
  7298. * @param (rave['internal']['Selector']) labels the selection of valid labels for the end of the transition
  7299. * @param (double) duration of the transition. If 0, we don't do anything.
  7300. * @param (double) delay of the transition. Added to the duration to delay the updates.
  7301. */
  7302. updateLabelDropping : function(labels, duration, delay) {
  7303. var self = this;
  7304. var start = delay + duration;
  7305. var labelCollideCallback = function(elapsed) {
  7306. if (!self._pendingLabelTimer) {
  7307. return true;
  7308. }
  7309. labels.call(self._dropOverlap, self._hideOverlappingLabels);
  7310. if (elapsed >= start) {
  7311. self._pendingLabelTimer = false;
  7312. return true;
  7313. }
  7314. return false;
  7315. };
  7316. if (duration > 0) {
  7317. this._pendingLabelTimer = true;
  7318. rave.timer(labelCollideCallback, start);
  7319. }
  7320. },
  7321. doLabelWrappingAfterAnimation : function(g, labels, mode, duration, delay) {
  7322. this._layoutTimerId++;
  7323. var timerId = this._layoutTimerId;
  7324. var self = this;
  7325. var wrapCallback = function(elapsed) {
  7326. if (self._layoutTimerId == timerId) {
  7327. self.doLabelWrapping(g, mode);
  7328. self.handleLabelsRotationAndPosition(g, labels, mode);
  7329. }
  7330. return true;
  7331. };
  7332. rave.timer(wrapCallback, delay + duration);
  7333. },
  7334. /** @expose */
  7335. preLayout : function() {
  7336. this._layoutTitleSize = 0;
  7337. this._layoutLabelSize = 0;
  7338. this._layoutLabelHeight = 0;
  7339. this._layoutAverageDigitWidth = 0;
  7340. this._layoutSpillOver = 0;
  7341. },
  7342. /** @expose */
  7343. getSizableType : function() {
  7344. return this._scale.isOrdinal() || this._scale.isClustered() ? 1 : 0;
  7345. },
  7346. /** @expose */
  7347. getSizableOrientation : function() {
  7348. return this._orient;
  7349. },
  7350. /** @expose */
  7351. getPreferredSize : function() {
  7352. var layoutPaddingSize = 0;
  7353. if (this._axis) {
  7354. layoutPaddingSize = this._axis.tickSize();
  7355. if (this._layoutLabelSize != 0) {
  7356. layoutPaddingSize += this._padding / 2;
  7357. }
  7358. if (this._layoutTitleSize != 0) {
  7359. layoutPaddingSize += this._padding / 2;
  7360. }
  7361. }
  7362. return this._layoutLabelSize + this._layoutAverageDigitWidth + this._layoutTitleSize + layoutPaddingSize + 2;
  7363. },
  7364. /** @expose */
  7365. getSpillOverSize : function() {
  7366. return this._layoutSpillOver;
  7367. },
  7368. /** @expose */
  7369. orient : function(a0) {
  7370. var args = arguments;
  7371. if (args.length == 0) {
  7372. return this.orient$1();
  7373. }
  7374. return this.orient$0(a0);
  7375. },
  7376. /** @expose */
  7377. tickFormat : function(a0) {
  7378. var args = arguments;
  7379. if (args.length == 0) {
  7380. return this.tickFormat$1();
  7381. }
  7382. return this.tickFormat$0(a0);
  7383. },
  7384. /** @expose */
  7385. simplifiedTickFormat : function(a0) {
  7386. var args = arguments;
  7387. if (args.length == 0) {
  7388. return this.simplifiedTickFormat$1();
  7389. }
  7390. return this.simplifiedTickFormat$0(a0);
  7391. },
  7392. /** @expose */
  7393. labelStyle : function(a0, a1, a2) {
  7394. var args = arguments;
  7395. if (args.length == 1) {
  7396. return this.labelStyle$1(a0);
  7397. }
  7398. return this.labelStyle$0(a0, a1, a2);
  7399. },
  7400. /** @expose */
  7401. titleStyle : function(a0, a1, a2) {
  7402. var args = arguments;
  7403. if (args.length == 1) {
  7404. return this.titleStyle$1(a0);
  7405. }
  7406. return this.titleStyle$0(a0, a1, a2);
  7407. }
  7408. });
  7409. /**
  7410. * 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.
  7411. * @param (rave['internal']['RectStruct']) bounds Rectangle of the axis bounds
  7412. * @param (String) orient Orient, "top", "bottom", "left", "right"; if not valid, "bottom" used
  7413. * @return (double[]) Translation [x,y]
  7414. */
  7415. /** @expose */
  7416. com_ibm_rave_bundles_components_AxisComponentImpl.getTranslation = function(bounds, orient) {
  7417. if ("left" == orient) {
  7418. return [bounds.x + bounds.width, 0.0];
  7419. }
  7420. if ("right" == orient) {
  7421. return [bounds.x, 0.0];
  7422. }
  7423. if ("top" == orient) {
  7424. return [0.0, bounds.y + bounds.height];
  7425. }
  7426. return [0.0, bounds.y];
  7427. };
  7428. com_ibm_rave_bundles_components_AxisComponentImpl.NodeIndex = rave['internal']['Declare']({
  7429. //_node : null,
  7430. _domainIndex : 0,
  7431. /** @expose */
  7432. constructor : function(node, domainIndex) {
  7433. this._node = node;
  7434. this._domainIndex = domainIndex;
  7435. },
  7436. /** @expose */
  7437. contains : function(node) {
  7438. return node == this._node;
  7439. },
  7440. /** @expose */
  7441. getIndex : function() {
  7442. return this._domainIndex;
  7443. }
  7444. });
  7445. /**
  7446. * Tick Handler for the axis. This will get called as the core axis is transitioned.
  7447. */
  7448. com_ibm_rave_bundles_components_AxisComponentImpl.AxisTickHandler = rave['internal']['Declare'](rave['internal']['AbstractTickHandler'], {
  7449. //_label : null,
  7450. //_tick : null,
  7451. _$functionClassMethod : function() {
  7452. var _$self = function(args) {
  7453. if (args !== null || arguments.length > 1){
  7454. args = Array.prototype.slice.call(arguments, 0);
  7455. }
  7456. {
  7457. _$self.handle(args[0]);
  7458. return null;
  7459. }
  7460. };
  7461. return _$self;
  7462. },
  7463. constructor : function(label, tick) {
  7464. this._label = label;
  7465. this._tick = tick;
  7466. },
  7467. /** @expose */
  7468. handle : function(ticks) {
  7469. ticks.call(this._tick);
  7470. ticks.call(this._label);
  7471. }
  7472. });
  7473. //com_ibm_rave_bundles_components_AxisComponentImpl.VISIBILITY = "visibility";
  7474. //com_ibm_rave_bundles_components_AxisComponentImpl.HIDDEN = "hidden";
  7475. /** @expose */
  7476. com_ibm_rave_bundles_components_AxisComponentImpl.LABEL_HIDDEN_FLAG = "__tickLabelHidden__";
  7477. /** @expose */
  7478. com_ibm_rave_bundles_components_AxisComponentImpl.PANZOOM_HIDDEN_FLAG = "__panZoomHidden__";
  7479. /** @expose */
  7480. com_ibm_rave_bundles_components_AxisComponentImpl.HIDDEN_COUNT = "__hiddenCount__";
  7481. /** @expose */
  7482. com_ibm_rave_bundles_components_AxisComponentImpl.PREFERRED_SPACE_PER_TICK = 20;
  7483. /** @expose */
  7484. com_ibm_rave_bundles_components_AxisComponentImpl.PREFERRED_TICK_COUNT = 10;
  7485. /** @expose */
  7486. com_ibm_rave_bundles_components_AxisComponentImpl.TICK_PADDING = 10;
  7487. //com_ibm_rave_bundles_components_AxisComponentImpl.HORIZONTAL_WEIGHT = 1.1;
  7488. com_ibm_rave_bundles_components_AxisComponentImpl.HORIZONTAL = 0;
  7489. com_ibm_rave_bundles_components_AxisComponentImpl.ROTATE90 = 1;
  7490. com_ibm_rave_bundles_components_AxisComponentImpl.ROTATE45 = 2;
  7491. com_ibm_rave_bundles_components_AxisComponentImpl.STAGGER = 3;
  7492. /**
  7493. * Constant used for text flow spacing
  7494. */
  7495. com_ibm_rave_bundles_components_AxisComponentImpl.TEXTFLOW_SPACING = 1.2;
  7496. /**
  7497. * Bottom axis orientation string.
  7498. */
  7499. /** @expose */
  7500. com_ibm_rave_bundles_components_AxisComponentImpl.BOTTOM_ORIENTATION = "bottom";
  7501. /**
  7502. * Top axis orientation string.
  7503. */
  7504. /** @expose */
  7505. com_ibm_rave_bundles_components_AxisComponentImpl.TOP_ORIENTATION = "top";
  7506. /**
  7507. * Left axis orientation string.
  7508. */
  7509. /** @expose */
  7510. com_ibm_rave_bundles_components_AxisComponentImpl.LEFT_ORIENTATION = "left";
  7511. /**
  7512. * Right axis orientation string.
  7513. */
  7514. /** @expose */
  7515. com_ibm_rave_bundles_components_AxisComponentImpl.RIGHT_ORIENTATION = "right";
  7516. com_ibm_rave_bundles_components_AxisComponentImpl.AUTOMODE = -1;
  7517. // $source: com/ibm/rave/bundles/components/GridComponentImpl
  7518. /************************************************************************
  7519. ** IBM Confidential
  7520. **
  7521. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7522. **
  7523. ** (C) Copyright IBM Corp. 2017
  7524. **
  7525. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7526. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7527. ************************************************************************/
  7528. // GENERATED
  7529. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  7530. //@import com/ibm/rave/bundles/components/StyleStructs (runtime) // new
  7531. //@import com/ibm/rave/bundles/component/GridComponent (runtime) // GridComponent
  7532. /**
  7533. * <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>
  7534. */
  7535. var com_ibm_rave_bundles_components_GridComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  7536. /**
  7537. * The axis property
  7538. */
  7539. //_axis : null,
  7540. /**
  7541. * Role, from the AxisComponent API
  7542. */
  7543. //_role : null,
  7544. /**
  7545. * The orientation
  7546. */
  7547. //_orient : null,
  7548. /**
  7549. * The bounds
  7550. */
  7551. //_bounds : null,
  7552. /**
  7553. * Style of gridlines
  7554. */
  7555. //_gridlineStyle : null,
  7556. /**
  7557. * Whether to display gridlines
  7558. */
  7559. _displayGridlines : false,
  7560. /**
  7561. * After calling the component, this is true if shapes were rendered, false if they were cleared.
  7562. */
  7563. _renderedShapes : false,
  7564. /**
  7565. * Construct, with all properties the defaults.
  7566. */
  7567. /** @expose */
  7568. constructor : function() {
  7569. this._axis = null;
  7570. this._role = null;
  7571. this._orient = "bottom";
  7572. this._bounds = null;
  7573. this._displayGridlines = true;
  7574. this._gridlineStyle = new com_ibm_rave_bundles_components_StyleStructs.LineStyle();
  7575. this._renderedShapes = false;
  7576. },
  7577. /** @expose */
  7578. type : function() {
  7579. return com_ibm_rave_bundles_component_GridComponent.COMPONENT_TYPE;
  7580. },
  7581. /** @expose */
  7582. role : function() {
  7583. return this._role;
  7584. },
  7585. /** @expose */
  7586. execute : function(g) {
  7587. this.preExecute();
  7588. if (!this._displayGridlines || !this._axis || !this._bounds) {
  7589. g.selectAll("*").remove();
  7590. this._renderedShapes = false;
  7591. return;
  7592. }
  7593. this._renderedShapes = true;
  7594. var size = ("bottom" == this._orient || "top" == this._orient) ? this._bounds.height : this._bounds.width;
  7595. var ticksHandler = this._axis.ticksHandler();
  7596. var tickSize = this._axis.tickSize();
  7597. var outerTickSize = this._axis.outerTickSize();
  7598. var tickFormat = this._axis.tickFormat();
  7599. var ax = this._axis.tickSize(-size, 0).tickFormat("").ticksHandler(null);
  7600. g.call(ax);
  7601. this._axis.tickSize(tickSize, outerTickSize).tickFormat(tickFormat).ticksHandler(ticksHandler);
  7602. g.selectAll("g.tick line").classed("grid-tick", true);
  7603. g.selectAll(".grid-tick").style("stroke", this._gridlineStyle._stroke).style("stroke-dasharray", (this._gridlineStyle._dashArray));
  7604. g.selectAll("path.domain").remove();
  7605. },
  7606. /**
  7607. * @param (rave['internal']['Axis']) axis The new axis
  7608. */
  7609. /** @expose */
  7610. axis : function(axis) {
  7611. this._axis = axis;
  7612. return this;
  7613. },
  7614. /**
  7615. * Set the role to one of the constants ROLE_X1 etc. defined in AxisComponent.
  7616. * @param (String) role The new role
  7617. * @return (com.ibm.rave.bundles.components.GridComponentImpl) This object
  7618. */
  7619. /** @expose */
  7620. setRole : function(role) {
  7621. this._role = role;
  7622. return this;
  7623. },
  7624. /**
  7625. * Only legal values are accepted, otherwise the orient is unchanged.
  7626. * @param (String) orient The new orient
  7627. */
  7628. orient$0 : function(orient) {
  7629. if ("left" == orient || "right" == orient || "bottom" == orient || "top" == orient) {
  7630. this._orient = orient;
  7631. }
  7632. return this;
  7633. },
  7634. /**
  7635. * @param (rave['internal']['RectStruct']) bounds The new bounds
  7636. */
  7637. /** @expose */
  7638. bounds : function(bounds) {
  7639. this._bounds = bounds;
  7640. return this;
  7641. },
  7642. displayGridlines$0 : function(displayGridlines) {
  7643. this._displayGridlines = displayGridlines;
  7644. return this;
  7645. },
  7646. /** @expose */
  7647. gridlineStyle : function(gridlineColor, dashArray) {
  7648. this.gridlineColor(gridlineColor);
  7649. this.dashArray(dashArray);
  7650. return this;
  7651. },
  7652. gridlineColor$0 : function(gridlineColor) {
  7653. this._gridlineStyle._stroke = (gridlineColor != null && gridlineColor.length > 0) ? gridlineColor : null;
  7654. return this;
  7655. },
  7656. dashArray$0 : function(dashArray) {
  7657. this._gridlineStyle._dashArray = (dashArray != null && dashArray.length > 0) ? dashArray : null;
  7658. return this;
  7659. },
  7660. /**
  7661. * @return (String) The orientation of the gridline.
  7662. */
  7663. orient$1 : function() {
  7664. return this._orient;
  7665. },
  7666. displayGridlines$1 : function() {
  7667. return this._displayGridlines;
  7668. },
  7669. gridlineColor$1 : function() {
  7670. return this._gridlineStyle._stroke;
  7671. },
  7672. dashArray$1 : function() {
  7673. return this._gridlineStyle._dashArray;
  7674. },
  7675. /**
  7676. * @return (boolean) True if on the last call the axis rendered shapes, false otherwise
  7677. */
  7678. renderedShapes : function() {
  7679. return this._renderedShapes;
  7680. },
  7681. /** @expose */
  7682. orient : function(a0) {
  7683. var args = arguments;
  7684. if (args.length == 0) {
  7685. return this.orient$1();
  7686. }
  7687. return this.orient$0(a0);
  7688. },
  7689. /** @expose */
  7690. displayGridlines : function(a0) {
  7691. var args = arguments;
  7692. if (args.length == 0) {
  7693. return this.displayGridlines$1();
  7694. }
  7695. return this.displayGridlines$0(a0);
  7696. },
  7697. /** @expose */
  7698. gridlineColor : function(a0) {
  7699. var args = arguments;
  7700. if (args.length == 0) {
  7701. return this.gridlineColor$1();
  7702. }
  7703. return this.gridlineColor$0(a0);
  7704. },
  7705. /** @expose */
  7706. dashArray : function(a0) {
  7707. var args = arguments;
  7708. if (args.length == 0) {
  7709. return this.dashArray$1();
  7710. }
  7711. return this.dashArray$0(a0);
  7712. }
  7713. });
  7714. // $source: com/ibm/rave/bundles/components/KeyedBundleComponentImpl
  7715. /************************************************************************
  7716. ** IBM Confidential
  7717. **
  7718. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7719. **
  7720. ** (C) Copyright IBM Corp. 2017
  7721. **
  7722. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7723. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7724. ************************************************************************/
  7725. // GENERATED
  7726. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  7727. /**
  7728. * 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.
  7729. * @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>
  7730. */
  7731. var com_ibm_rave_bundles_components_KeyedBundleComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  7732. //keyFunction : null,
  7733. /**
  7734. * Set the key function this component should use when joining data to scene nodes.
  7735. * @param (rave['internal']['SingleValueFunction']) keyFunction This function will be passed each datum individually and must return a unique value (a key).
  7736. * @return (com.ibm.rave.bundles.components.KeyedBundleComponentImpl) This.
  7737. */
  7738. /** @expose */
  7739. key : function(keyFunction) {
  7740. this.keyFunction = keyFunction;
  7741. return this;
  7742. },
  7743. /**
  7744. * Returns a {@link (rave['internal']['ValueFunction']) ValueFunction} that wraps the provided key function.
  7745. */
  7746. /** @expose */
  7747. getKey : function() {
  7748. if (!this.keyFunction) {
  7749. return null;
  7750. }
  7751. var self = this;
  7752. return function(datum, index, groupIndex) {
  7753. return self.keyFunction(datum);
  7754. };
  7755. }
  7756. });
  7757. // $source: com/ibm/rave/bundles/components/AbstractPathComponent
  7758. /************************************************************************
  7759. ** IBM Confidential
  7760. **
  7761. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7762. **
  7763. ** (C) Copyright IBM Corp. 2017
  7764. **
  7765. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7766. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7767. ************************************************************************/
  7768. // GENERATED
  7769. //@import com/ibm/rave/bundles/components/KeyedBundleComponentImpl (loadtime) // superclass
  7770. //@import com/ibm/rave/bundles/utilities/PathUtils (runtime) // fadeOutIn
  7771. /**
  7772. * Base class for Line and Area components, both of which create similar path-based elements.
  7773. */
  7774. var com_ibm_rave_bundles_components_AbstractPathComponent = rave['internal']['Declare'](com_ibm_rave_bundles_components_KeyedBundleComponentImpl, {
  7775. /**
  7776. * Interpolation Mode (Smoothness of the line)
  7777. */
  7778. /** @expose */
  7779. _interpolateMode : null,
  7780. /**
  7781. * Keep track of the previous Interpolation Mode
  7782. */
  7783. /** @expose */
  7784. _previousInterpolateMode : null,
  7785. constructor : function() {
  7786. this._interpolateMode = rave['internal']['SVGLine'].r2_svg_lineLinear.getKey();
  7787. this._previousInterpolateMode = this._interpolateMode;
  7788. },
  7789. /** @expose */
  7790. updatePath : function(updateSelection, pathFunction) {
  7791. if (this._interpolateMode != null && !(this._interpolateMode == this._previousInterpolateMode)) {
  7792. com_ibm_rave_bundles_utilities_PathUtils.fadeOutIn(updateSelection, pathFunction);
  7793. } else {
  7794. updateSelection.attr("d", pathFunction);
  7795. }
  7796. this._previousInterpolateMode = this._interpolateMode;
  7797. }
  7798. });
  7799. // $source: com/ibm/rave/bundles/components/LineComponentImpl
  7800. /************************************************************************
  7801. ** IBM Confidential
  7802. **
  7803. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  7804. **
  7805. ** (C) Copyright IBM Corp. 2017
  7806. **
  7807. ** The source code for this program is not published or otherwise divested of its trade secrets,
  7808. ** irrespective of what has been deposited with the U.S. Copyright Office.
  7809. ************************************************************************/
  7810. // GENERATED
  7811. //@import com/ibm/rave/bundles/components/AbstractPathComponent (loadtime) // superclass
  7812. //@import com/ibm/rave/bundles/component/LineComponent (runtime) // LineComponent
  7813. /**
  7814. * <p> A component to draw line charts. The component puts its shapes into the selector passed to its execute method. </p> <p> The data array passed to the component has one entry per line to be drawn. Each entry has two properties. Accessors are used to get these properties from the object. Their roles are: </p> <ul> <li> <b>points</b>: Required, an array (ArrayEx). This array is passed to a line path generator, so each entry is a point in the line. The default line path accessors may be used (each entry is an array of x,y); the line component has optional accessors for these two properties. </li> <li> <b>color</b>: A color value. Optional, a single value which if defined is used with the color scale to color the lines. </li> </ul> <p> The component properties are: </p> <p> <b>data</b>: An array with one entry per line, structured as described above. If null, no lines are drawn. </p> <p> <b>pointsAccessor</b>: A value function applied to an entry in the data array, returning the value of the <b>points</b> role (the array of points). If null, no lines are drawn. The default implementation assumes the entry is an object (OMap) and gets and gets the "points" property of the object. </p> <p> <b>colorAccessor</b>: A value function applied to an entry in the data array, returning the value for the <b>color</b> role. If null, the line is drawn but not colored. The default implementation assumes the entry is an object (OMap) and gets the "color" property of the object. </p> <p> <b>independentAccessor</b>: A value function applied to a point object to get the independent value. If null, no lines are drawn. The default implementation assumes each point is an array and returns the first object (as in the default line generator). </p> <p> <b>independentScale</b>: A scale applied to the independent value of the point to get the pixel coordinate for drawing the line. If null, no lines are drawn. The default is null. </p> <p> <b>dependentAccessor</b>: A value function applied to a point object to get the dependent value. If null, no lines are drawn. The default implementation assumes each point is an array and returns the second object (as in the default line generator). </p> <p> <b>dependentScale</b>: A scale applied to the dependent value of the point to get the pixel coordinate for drawing the line. If null, no lines are drawn. The default is null. </p> <p> <b>colorScale</b>: A scale applied to the value in the <b>color</b> role to get a color value for drawing the line. If null or if it returns null, the line is drawn in the primary color. </p> <p> <b>primaryColor</b>: The color used to draw the line when the line has no color or there is no color scale. If null, the line is drawn but not colored, and the CSS style will be used. </p> <p> <b>transpose</b>: A boolean. If false the categorical data is shown on the X axis and the linear data on the Y; if true they are swapped. Default false. </p> <p> <b>effect</b>: A string. If non-null, requests an entrance effect. The only supported entrance effect is "fromBase", where the line grows up from the dependent axis zero; any other value is treated as null. This property is cleared to null on each render, for convenience in setting up zooming. Default null. </p>
  7815. */
  7816. var com_ibm_rave_bundles_components_LineComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_AbstractPathComponent, {
  7817. /**
  7818. * Data
  7819. */
  7820. //_data : null,
  7821. /**
  7822. * Accessor for points role
  7823. */
  7824. //_pointsAccessor : null,
  7825. /**
  7826. * Accessor for color role
  7827. */
  7828. //_groupAccessor : null,
  7829. /**
  7830. * Accessor for independent variable from a point
  7831. */
  7832. //_independentAccessor : null,
  7833. /**
  7834. * Independent variable scale
  7835. */
  7836. //_independentScale : null,
  7837. /**
  7838. * Accessor for dependent variable from a point
  7839. */
  7840. //_dependentAccessor : null,
  7841. /**
  7842. * Dependent scale
  7843. */
  7844. //_dependentScale : null,
  7845. /**
  7846. * Color scale
  7847. */
  7848. //_colorPalette : null,
  7849. /**
  7850. * Effect, only "fromBase" supported
  7851. */
  7852. //_effect : null,
  7853. /**
  7854. * Accessor for checking to see if Y value is null
  7855. */
  7856. //_definedAccessor : null,
  7857. /**
  7858. * Transpose
  7859. */
  7860. _transpose : false,
  7861. /**
  7862. * Show gaps for missing data
  7863. */
  7864. _showMissingAsGap : false,
  7865. /**
  7866. * Initialize all properties to default values.
  7867. */
  7868. /** @expose */
  7869. constructor : function() {
  7870. this._data = null;
  7871. this._interpolateMode = null;
  7872. this._pointsAccessor = function(data) {
  7873. return (data)["points"];
  7874. };
  7875. this._groupAccessor = null;
  7876. this._independentAccessor = function(data) {
  7877. return (data)[0];
  7878. };
  7879. this._independentScale = null;
  7880. this._dependentAccessor = function(data) {
  7881. return (data)[1];
  7882. };
  7883. var self = this;
  7884. this._definedAccessor = function(data) {
  7885. return (self._dependentAccessor(data) != null) && (self._independentAccessor(data) != null);
  7886. };
  7887. this._dependentScale = null;
  7888. this._colorPalette = null;
  7889. this._transpose = false;
  7890. this._effect = null;
  7891. this._showMissingAsGap = true;
  7892. },
  7893. /** @expose */
  7894. type : function() {
  7895. return com_ibm_rave_bundles_component_LineComponent.COMPONENT_TYPE;
  7896. },
  7897. /** @expose */
  7898. execute : function(g) {
  7899. this.preExecute();
  7900. if (!this._data || !this._pointsAccessor || !this._independentAccessor || !this._independentScale || !this._dependentAccessor || !this._dependentScale) {
  7901. g.selectAll("*").remove();
  7902. return;
  7903. }
  7904. var self = this;
  7905. var independent = function(data, index, groupIndex) {
  7906. return self._independentScale.center(self._independentAccessor(data));
  7907. };
  7908. var dependent = function(data, index, groupIndex) {
  7909. return self._dependentScale.center(self._dependentAccessor(data));
  7910. };
  7911. var definedAccessorY = function(data, index, groupIndex) {
  7912. return (self._definedAccessor(data));
  7913. };
  7914. var line = rave.svg.line().x(this._transpose ? dependent : independent).y(this._transpose ? independent : dependent).showMissingAsGap(this._showMissingAsGap);
  7915. var lineFunction = function(d, index, groupIndex) {
  7916. return line.call(this, self._pointsAccessor(d), index, groupIndex);
  7917. };
  7918. line.defined(definedAccessorY);
  7919. line.interpolate(this._interpolateMode);
  7920. var lines = g.selectAll("path.element-shape").data(this._data, this._groupAccessor ? function(data, index, groupIndex) {
  7921. return self._groupAccessor(data);
  7922. } : null);
  7923. lines.exit().remove();
  7924. var enter = lines.enter();
  7925. if (enter.size() > 0) {
  7926. enter = enter.append("path").attr("class", "element-shape").style("stroke", this._colorPalette);
  7927. if ("fromBase" == this._effect) {
  7928. var dependentZero = function(data, index, groupIndex) {
  7929. return self._dependentScale.center(0.0);
  7930. };
  7931. var zeroLine = rave.svg.line().x(this._transpose ? dependentZero : independent).y(this._transpose ? independent : dependentZero);
  7932. zeroLine.defined(definedAccessorY);
  7933. enter.attr("d", function(d, index, groupIndex) {
  7934. return zeroLine.call(this, self._pointsAccessor(d), index, groupIndex);
  7935. });
  7936. } else {
  7937. enter.attr("d", lineFunction);
  7938. }
  7939. }
  7940. var linesUpdate = rave.transition(lines).style("stroke", this._colorPalette);
  7941. this.updatePath(linesUpdate, lineFunction);
  7942. this._effect = null;
  7943. },
  7944. /**
  7945. * @param (java.lang.Object[]) data The new data
  7946. */
  7947. /** @expose */
  7948. data : function(data) {
  7949. this._data = data;
  7950. return this;
  7951. },
  7952. /**
  7953. * @param (rave['internal']['SingleValueFunction']) pointsAccessor The new pointsAccessor
  7954. */
  7955. /** @expose */
  7956. pointsAccessor : function(pointsAccessor) {
  7957. this._pointsAccessor = pointsAccessor;
  7958. return this;
  7959. },
  7960. /**
  7961. * @param (rave['internal']['SingleValueFunction']) groupAccessor The new groupAccessor
  7962. */
  7963. /** @expose */
  7964. groupAccessor : function(groupAccessor) {
  7965. this._groupAccessor = groupAccessor;
  7966. return this;
  7967. },
  7968. /**
  7969. * @param (rave['internal']['SingleValueFunction']) independentAccessor The new independent accessor
  7970. */
  7971. /** @expose */
  7972. independentAccessor : function(independentAccessor) {
  7973. this._independentAccessor = independentAccessor;
  7974. return this;
  7975. },
  7976. /**
  7977. * @param (rave['library']['internal']['CoordinateScaleImpl']) independentScale The new independent scale
  7978. */
  7979. /** @expose */
  7980. independentScale : function(independentScale) {
  7981. this._independentScale = independentScale;
  7982. return this;
  7983. },
  7984. /**
  7985. * @param (rave['internal']['SingleValueFunction']) dependentAccessor The new dependent accessor
  7986. */
  7987. /** @expose */
  7988. dependentAccessor : function(dependentAccessor) {
  7989. this._dependentAccessor = dependentAccessor;
  7990. return this;
  7991. },
  7992. /**
  7993. * @param (rave['internal']['SingleValueFunction']) definedAccessor The new defined accessor
  7994. */
  7995. /** @expose */
  7996. definedAccessor : function(definedAccessor) {
  7997. this._definedAccessor = definedAccessor;
  7998. return this;
  7999. },
  8000. /**
  8001. * @param (rave['library']['internal']['CoordinateScaleImpl']) dependentScale The new dependent scale
  8002. */
  8003. /** @expose */
  8004. dependentScale : function(dependentScale) {
  8005. this._dependentScale = dependentScale;
  8006. return this;
  8007. },
  8008. /**
  8009. * @param (rave['library']['internal']['Palette']) colorPalette The new color palette
  8010. */
  8011. /** @expose */
  8012. colorPalette : function(colorPalette) {
  8013. this._colorPalette = colorPalette ? colorPalette : null;
  8014. return this;
  8015. },
  8016. /**
  8017. * @param (boolean) transpose The new transpose
  8018. */
  8019. /** @expose */
  8020. transpose : function(transpose) {
  8021. this._transpose = transpose;
  8022. return this;
  8023. },
  8024. /**
  8025. * @param (String) effect The new effect
  8026. */
  8027. /** @expose */
  8028. effect : function(effect) {
  8029. this._effect = effect;
  8030. return this;
  8031. },
  8032. /**
  8033. * Configure whether lines generated should show a gap (line break) if a value is missing
  8034. * @param (boolean) state true (default) for a gap, false for a line across missing values
  8035. */
  8036. /** @expose */
  8037. showMissingAsGap : function(state) {
  8038. this._showMissingAsGap = state;
  8039. return this;
  8040. },
  8041. /**
  8042. * @param (String) mode sets the interpolation mode that makes the line of the area chart smooth or jagged.
  8043. */
  8044. /** @expose */
  8045. interpolate : function(mode) {
  8046. this._interpolateMode = mode;
  8047. return this;
  8048. }
  8049. });
  8050. // $source: com/ibm/rave/bundles/components/PointComponentImpl
  8051. /************************************************************************
  8052. ** IBM Confidential
  8053. **
  8054. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8055. **
  8056. ** (C) Copyright IBM Corp. 2017
  8057. **
  8058. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8059. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8060. ************************************************************************/
  8061. // GENERATED
  8062. //@import com/ibm/rave/bundles/components/KeyedBundleComponentImpl (loadtime) // superclass
  8063. //@import com/ibm/rave/bundles/component/PointComponent (runtime) // PointComponent
  8064. //@import com/ibm/rave/bundles/utilities/PathUtils (runtime) // fadeOutIn
  8065. //@import com/ibm/rave/bundles/utilities/ColorUtil (runtime) // getContrastColor
  8066. //@import com/ibm/rave/bundles/utilities/BundleLabelDropper (runtime) // new
  8067. //@import com/ibm/rave/bundles/utilities/LabelStyleUtil (runtime) // new
  8068. /**
  8069. * <p> A component to draw point charts. The component puts its shapes into the selector passed to its execute method. </p> <p> The data array passed to the component has one entry per point to be drawn. Each entry has five properties. Accessors are used to get these properties from the object, and scales to convert them to a graphical property. If a property is not defined (either no accessor or no scale), a default value is used for the property. The five properties are: </p> <ul> <li> <b>dependent</b>: One of the two coordinate variables for the points. If not defined the coordinate is the midpoint of the chart dimension. </li> <li> <b>independent</b>: One of the two coordinate variables for the points. If not defined the coordinate is the midpoint of the chart dimension. </li> <li> <b>color</b>: Used for the fill color of the points. If not defined the fill is a default value set with a property. </li> <li> <b>size</b>: Used to size the points. If not defined the point is sized to a default value set with a property. </li> <li> <b>label</b>: Label for the point. If not defined the point is not labeled. The point component does not do internationalization, and this string is the value displayed. </li> </ul> <p> Scatterplots in general do not distinguish between the dependent and independent variables. The names are used here for compatibility with other two-axis plots such as the line and column. </p> <p> The component properties are: </p> <p> <b>data</b>: An array with one entry per point. If null, no points are drawn. </p> <p> <b>independentAccessor</b>: A value function applied to a data object to get the independent value. If null, the midpoint of the coordinate range is used. The default is null. </p> <p> <b>independentScale</b>: A scale applied to the independent value to get the pixel coordinate for drawing the line. If null, the midpoint of the coordinate range is used. The default is null. </p> <p> <b>dependentAccessor</b>: A value function applied to a data object to get the dependent value. If null, the midpoint of the coordinate range is used. The default is null. </p> <p> <b>dependentScale</b>: A scale applied to the dependent value to get the pixel coordinate for drawing the line. If null, the midpoint of the coordinate range is used. The default is null. </p> <p> <b>colorAccessor</b>: A value function applied to a data object to get the color value. If null, the point is drawn in the primary color. The default is null. </p> <p> <b>colorPalette</b>: A palette applied to the color value to get a color value for drawing the point. If null or if it returns null, the point is drawn in the primary color. </p> <p> <b>sizeAccessor</b>: A value function applied to a data object to get the size value used for the point size. If null, the point is drawn with the default size. The default is null. </p> <p> <b>sizeScale</b>: A scale applied to the size value to get the size for drawing for drawing the line. If null or if it returns null, the point is drawn with the default size. The default is null. </p> <p> <b>labelAccessor</b>: A value function applied to a data object to get the label. If null, the point is not labeled. The default is null. </p> <p> <b>labelFormatter</b>: A value function applied to the data label (as returned by the labelAccessor) to get the formatted text string used in the chart. If null, the data label is coerced to a string and used as the formatted text string. The default is null. The method is not called when the data label is null. </p> <p> <b>bounds</b>: The bounding rectangle of the component, used to find the midpoints of the coordinates when the independent or dependent variables are not defined. If either of those variables is not defined and the bounds is null, no points are drawn. The default is null. </p> <p> <b>transpose</b>: A boolean. If false the independent data is shown on the X axis and the dependent data on the Y; if true they are swapped. Default false. </p> <p> <b>primaryColor</b>: The color used to draw the point when the point has no color value or there is no color scale. If null, the point is drawn but not colored, and the CSS style will be used. </p> <p> <b>symbol</b>: The symbol used to draw the shape, which must be one of the RAVE/D3 symbol generator names or "rectangle". If null, the point is drawn as a circle. </p> <p> <b>defaultSize</b>: The size used to draw the point when the point has no size value or there is no size scale. The default is 100 and the value cannot be set to less than 0. Note that this uses the RAVE/D3 convention, where the size is in square pixels. </p> <p> <b>itemLabel</b>: A boolean. If true and if the label accessor is defined, the label is shown on each item. Default true. </p> <p> <b>itemOverlap</b>: A boolean. If true, overlapping labels are removed. Default is true. </p> <p> <b>effect</b>: A string. Requests an entrance effect; if null or not a supported effect, no entrance effect is used. Default null. The supported effects are: </p> <ul> <li> "grow": Shapes start at size zero and grow to full size. </li> <li> "fromBase": Shapes start at dependent coordinate 0 and move to final position. Only used when the dependent scale is non-ordinal. </li> <li> "grow+fromBase": Combines the grow and fromBase effects. </li> </ul>
  8070. */
  8071. var com_ibm_rave_bundles_components_PointComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_KeyedBundleComponentImpl, {
  8072. /**
  8073. * Data
  8074. */
  8075. //_data : null,
  8076. /**
  8077. * Accessor for independent variable
  8078. */
  8079. //_independentAccessor : null,
  8080. /**
  8081. * Independent variable scale
  8082. */
  8083. //_independentScale : null,
  8084. /**
  8085. * Accessor for dependent variable
  8086. */
  8087. //_dependentAccessor : null,
  8088. /**
  8089. * Dependent scale
  8090. */
  8091. //_dependentScale : null,
  8092. /**
  8093. * Color scale
  8094. */
  8095. //_colorPalette : null,
  8096. /**
  8097. * Accessor for size role
  8098. */
  8099. //_sizeAccessor : null,
  8100. /**
  8101. * Size scale
  8102. */
  8103. //_sizeScale : null,
  8104. /**
  8105. * Accessor for label role
  8106. */
  8107. //_labelAccessor : null,
  8108. /**
  8109. * Label formatter, may be null
  8110. */
  8111. //_labelFormatter : null,
  8112. //_labelFontStyle : null,
  8113. /**
  8114. * Bounds
  8115. */
  8116. //_bounds : null,
  8117. /**
  8118. * Symbol
  8119. */
  8120. //_symbol : null,
  8121. /**
  8122. * Previous symbol: allows better transitions between symbols
  8123. */
  8124. //_prevSymbol : null,
  8125. //_dropOverlap : null,
  8126. /**
  8127. * Effect
  8128. */
  8129. //_effect : null,
  8130. //_borderWidth : null,
  8131. //_borderColor : null,
  8132. //_itemLabelPosition : null,
  8133. //_labelStyleUtil : null,
  8134. /**
  8135. * Transpose
  8136. */
  8137. _transpose : false,
  8138. /**
  8139. * Default size
  8140. */
  8141. _defaultSize : 0,
  8142. /**
  8143. * Show label
  8144. */
  8145. _itemLabel : false,
  8146. /**
  8147. * Drop overlapping labels
  8148. */
  8149. _itemOverlap : false,
  8150. _labelLayerClass : ".element-label-group",
  8151. _elementLayerClass : ".element-group",
  8152. _labelContrast : false,
  8153. _labelShadow : false,
  8154. constructor : function() {
  8155. this._labelFontStyle = {};
  8156. {
  8157. this._data = null;
  8158. this._independentAccessor = null;
  8159. this._independentScale = null;
  8160. this._dependentAccessor = null;
  8161. this._dependentScale = null;
  8162. this._colorPalette = null;
  8163. this._sizeAccessor = null;
  8164. this._sizeScale = null;
  8165. this._labelAccessor = null;
  8166. this._labelFormatter = null;
  8167. this._bounds = null;
  8168. this._transpose = false;
  8169. this._defaultSize = 400.0;
  8170. this._symbol = null;
  8171. this._prevSymbol = null;
  8172. this._itemLabel = true;
  8173. this._itemOverlap = true;
  8174. this._effect = null;
  8175. this._dropOverlap = new com_ibm_rave_bundles_utilities_BundleLabelDropper();
  8176. this._borderWidth = null;
  8177. this._borderColor = null;
  8178. this._labelStyleUtil = new com_ibm_rave_bundles_utilities_LabelStyleUtil();
  8179. if (!(rave.svg.symbolTypes.indexOf("donutPlus")> -1)) {
  8180. rave.svg.symbolCreator("donutPlus", rave['library']['internal']['CommonPropertyConstants'].DONUT_PLUS);
  8181. }
  8182. if (!(rave.svg.symbolTypes.indexOf("donut-thin")> -1)) {
  8183. rave.svg.symbolCreator("donut-thin", rave['library']['internal']['CommonPropertyConstants'].DONUT_THIN);
  8184. }
  8185. }
  8186. },
  8187. /** @expose */
  8188. type : function() {
  8189. return com_ibm_rave_bundles_component_PointComponent.COMPONENT_TYPE;
  8190. },
  8191. /** @expose */
  8192. execute : function(g) {
  8193. this.preExecute();
  8194. var elementGroupSelector = g.selectAll(this._elementLayerClass);
  8195. var labelGroupSelector = g.selectAll(this._labelLayerClass);
  8196. if (g.classed(this._elementLayerClass) || elementGroupSelector.size() == 0 || labelGroupSelector.size() == 0) {
  8197. elementGroupSelector = g;
  8198. labelGroupSelector = g;
  8199. }
  8200. if (!this._data || (!this._bounds && (!this._independentAccessor || !this._independentScale || !this._dependentAccessor || !this._dependentScale))) {
  8201. elementGroupSelector.selectAll("*").remove();
  8202. labelGroupSelector.selectAll("*").remove();
  8203. return;
  8204. }
  8205. elementGroupSelector.selectAll("*").remove();
  8206. labelGroupSelector.selectAll("*").remove();
  8207. var self = this;
  8208. var enterTransform = this.pointTransform(true);
  8209. var finalTransform = this.pointTransform(false);
  8210. var symbols = [];
  8211. if (this._symbol == null) {
  8212. elementGroupSelector.selectAll("*").remove();
  8213. } else if (this._symbol == "donutPlus") {
  8214. var s = new rave['internal']['Symbol']().type("circle");
  8215. symbols.push(s);
  8216. s = new rave['internal']['Symbol']().type("donut-thin");
  8217. symbols.push(s);
  8218. } else {
  8219. var s = new rave['internal']['Symbol']().type(this._symbol);
  8220. symbols.push(s);
  8221. elementGroupSelector.selectAll("." + com_ibm_rave_bundles_components_PointComponentImpl.SECONDARY_ELEMENT).remove();
  8222. }
  8223. for (var i = 0; i < symbols.length; ++i) {
  8224. var type = i == 0 ? "element-shape" : com_ibm_rave_bundles_components_PointComponentImpl.SECONDARY_ELEMENT;
  8225. var shapes = elementGroupSelector.selectAll("." + type).data(this._data, this.getKey());
  8226. shapes.exit().remove();
  8227. var symbol = symbols[i];
  8228. var fillStyle = this.symbolFill(type);
  8229. shapes.enter().append("path").attr("class", type).attr("transform", enterTransform).attr("d", symbol.size(this.enterSize(this._defaultSize, type))).style("fill", fillStyle).style("stroke", fillStyle).style("stroke-width", "0px");
  8230. var s = rave.transition(shapes).attr("transform", finalTransform).style("fill", fillStyle);
  8231. this.updateBorder(s, this._borderWidth, this._borderColor);
  8232. symbol.size(this.finalSize(this._defaultSize, type));
  8233. if (this._prevSymbol != null && !(this._prevSymbol == this._symbol)) {
  8234. com_ibm_rave_bundles_utilities_PathUtils.fadeOutIn(s, symbol);
  8235. } else {
  8236. s.attr("d", symbol);
  8237. }
  8238. }
  8239. if (this._itemLabel && this._labelAccessor) {
  8240. var elementLabelGroupSelector = g.selectAll(this._labelLayerClass);
  8241. if (elementLabelGroupSelector.size() == 0) {
  8242. elementLabelGroupSelector = g;
  8243. }
  8244. var labels = elementLabelGroupSelector.selectAll("element-label").data(this._data, this.getKey());
  8245. labels.exit().remove();
  8246. var labelText = !this._labelFormatter ? function(data, index, groupIndex) {
  8247. return self._labelAccessor(data);
  8248. } : function(data, index, groupIndex) {
  8249. var v = self._labelAccessor(data);
  8250. return v == null ? null : self._labelFormatter.call(this, v, index, groupIndex);
  8251. };
  8252. var fontChecker = rave.capabilities.extension("fontchecker");
  8253. labels.enter().append("text").attr("class", "element-label").attr("x", this.positionX(true)).attr("y", this.positionY(true)).attr("dx", this.getXOffset()).attr("dy", this.getYOffset()).style("text-anchor", this.getAnchor()).text(labelText);
  8254. var labelColor = this.getDefaultLabelColor(this._labelFontStyle);
  8255. this._labelStyleUtil.labelFont(this._labelFontStyle).labelFillColor(this._labelContrast ? this.getLabelFill() : function(data, index, groupIndex) {
  8256. return labelColor;
  8257. }).labelShadow(this._labelShadow);
  8258. labels.call(this._labelStyleUtil);
  8259. if (fontChecker) {
  8260. labels.call(fontChecker);
  8261. }
  8262. var labelTransition = rave.transition(labels).attr("x", this.positionX(false)).attr("y", this.positionY(false)).attr("dx", this.getXOffset()).attr("dy", this.getYOffset()).style("text-anchor", this.getAnchor()).text(labelText);
  8263. this._dropOverlap.configureForDataLabels(this._bounds);
  8264. labelTransition.call(this._dropOverlap, this._itemOverlap);
  8265. } else {
  8266. var elementLabelGroupSelector = g.selectAll(this._labelLayerClass);
  8267. if (elementLabelGroupSelector.size() == 0) {
  8268. elementLabelGroupSelector = g;
  8269. }
  8270. elementLabelGroupSelector.selectAll("text.element-label").remove();
  8271. }
  8272. },
  8273. symbolFill : function(type) {
  8274. var self = this;
  8275. return function(d, index, groupIndex) {
  8276. if (self._symbol == "donutPlus" && type == com_ibm_rave_bundles_components_PointComponentImpl.SECONDARY_ELEMENT) {
  8277. return "white";
  8278. }
  8279. return !self._colorPalette ? null : self._colorPalette.call(null, d, 0, 0);
  8280. };
  8281. },
  8282. /**
  8283. * Get the enter transform of a shape, for the argument to attr("transform",v). If the effect requires from-base movement, this is a translate where the independent coordinate starts at the scale zero. Otherwise it is the same as finalTransform(). This should only be called if either bounds is non-null, or the dependent and independent accessors and scales are all non-null. The result depends on the transpose, on which accessors and scales are defined, on the bounds, and on the effect.
  8284. * @return (rave['internal']['ValueFunction']) Transform value function
  8285. */
  8286. pointTransform : function(enter) {
  8287. var useDependentZero = enter && ("fromBase" == this._effect || "growfromBase" == this._effect);
  8288. var dependent = useDependentZero ? this.dependentZero() : this.dependent();
  8289. var independent = this.independent();
  8290. if (this._transpose) {
  8291. return function(data, index, groupIndex) {
  8292. return "translate(" + dependent.call(this, data, index, groupIndex) + "," + independent.call(this, data, index, groupIndex) + ")";
  8293. };
  8294. }
  8295. return function(data, index, groupIndex) {
  8296. return "translate(" + independent.call(this, data, index, groupIndex) + "," + dependent.call(this, data, index, groupIndex) + ")";
  8297. };
  8298. },
  8299. /**
  8300. * Get the enter x of a label, for the argument to attr("x",v). If the effect requires from-base movement, this is a translate where the independent coordinate starts at the scale zero. Otherwise it is the same as finalTransform(). This should only be called if either bounds is non-null, or the dependent and independent accessors and scales are all non-null. The result depends on the transpose, on which accessors and scales are defined, on the bounds, and on the effect.
  8301. * @return (rave['internal']['ValueFunction']) X value function
  8302. */
  8303. positionX : function(enter) {
  8304. var useDependentZero = enter && ("fromBase" == this._effect || "growfromBase" == this._effect);
  8305. var dependent = useDependentZero ? this.dependentZero() : this.dependent();
  8306. var independent = this.independent();
  8307. if (this._transpose) {
  8308. return function(data, index, groupIndex) {
  8309. return dependent.call(this, data, index, groupIndex);
  8310. };
  8311. }
  8312. return function(data, index, groupIndex) {
  8313. return independent.call(this, data, index, groupIndex);
  8314. };
  8315. },
  8316. /**
  8317. * Get the enter y of a label, for the argument to attr("y",v). If the effect requires from-base movement, this is a translate where the independent coordinate starts at the scale zero. Otherwise it is the same as finalTransform(). This should only be called if either bounds is non-null, or the dependent and independent accessors and scales are all non-null. The result depends on the transpose, on which accessors and scales are defined, on the bounds, and on the effect.
  8318. * @return (rave['internal']['ValueFunction']) Y value function
  8319. */
  8320. positionY : function(enter) {
  8321. var useDependentZero = enter && ("fromBase" == this._effect || "growfromBase" == this._effect);
  8322. var dependent = useDependentZero ? this.dependentZero() : this.dependent();
  8323. var independent = this.independent();
  8324. if (this._transpose) {
  8325. return function(data, index, groupIndex) {
  8326. return independent.call(this, data, index, groupIndex);
  8327. };
  8328. }
  8329. return function(data, index, groupIndex) {
  8330. return dependent.call(this, data, index, groupIndex);
  8331. };
  8332. },
  8333. /**
  8334. * Get a value function that returns the scaled independent coordinate. It should be called only if bounds is defined, or if the independent accessor and scale are both defined.
  8335. * @return (rave['internal']['ValueFunction']) Value function for scaled independent coordinate
  8336. */
  8337. independent : function() {
  8338. if (this._independentAccessor && this._independentScale) {
  8339. var self = this;
  8340. return function(data, index, groupIndex) {
  8341. return self._independentScale.center(self._independentAccessor(data));
  8342. };
  8343. }
  8344. var midpoint = this._transpose ? this._bounds.y + this._bounds.height / 2.0 : this._bounds.x + this._bounds.width / 2.0;
  8345. return function(data, index, groupIndex) {
  8346. return midpoint;
  8347. };
  8348. },
  8349. /**
  8350. * Get a value function that returns the scaled independent coordinate. It should be called only if bounds is defined, or if the dependent accessor and scale are both defined.
  8351. * @return (rave['internal']['ValueFunction']) Value function for scaled independent coordinate
  8352. */
  8353. dependent : function() {
  8354. if (this._dependentAccessor && this._dependentScale) {
  8355. var self = this;
  8356. return function(data, index, groupIndex) {
  8357. return self._dependentScale.center(self._dependentAccessor(data));
  8358. };
  8359. }
  8360. var midpoint = this._transpose ? this._bounds.x + this._bounds.width / 2.0 : this._bounds.y + this._bounds.height / 2.0;
  8361. return function(data, index, groupIndex) {
  8362. return midpoint;
  8363. };
  8364. },
  8365. /**
  8366. * Get a value function that returns the scaled independent zero. If the independent scale is ordinal, this returns the same thing as dependent(); otherwise it returns the scaled zero of the dependent scale.
  8367. * @return (rave['internal']['ValueFunction']) Value function for scaled independent coordinate
  8368. */
  8369. dependentZero : function() {
  8370. if (!this._dependentScale || !(this._dependentScale.isLinear())) {
  8371. return this.dependent();
  8372. }
  8373. var self = this;
  8374. return function(data, index, groupIndex) {
  8375. return self._dependentScale.center(0.0);
  8376. };
  8377. },
  8378. /**
  8379. * Get the initial size of a shape, for the argument to BundleSymbol#size(). If the effect requires shape-grow, this is 0.0. Otherwise it is the final size.
  8380. * @return (rave['internal']['ValueFunction']) Size value function
  8381. */
  8382. enterSize : function(size, type) {
  8383. if ("grow" == this._effect || "growfromBase" == this._effect) {
  8384. return function(data, index, groupIndex) {
  8385. return 0.0;
  8386. };
  8387. }
  8388. return this.finalSize(size, type);
  8389. },
  8390. /**
  8391. * Get the final size of a shape, for the argument to BundleSymbol#size(). If the size accessor and size scale are both defined, the size comes from the scale applied to the accessor value (using the default size for a null accessor value); otherwise it is the default size.
  8392. * @return (rave['internal']['ValueFunction']) Size value function
  8393. */
  8394. finalSize : function(size, type) {
  8395. var self = this;
  8396. var ratio = self._symbol == "donutPlus" && type == com_ibm_rave_bundles_components_PointComponentImpl.SECONDARY_ELEMENT ? 0.6 : 1;
  8397. if (this._sizeAccessor && this._sizeScale) {
  8398. return function(d, index, groupIndex) {
  8399. var v = self._sizeAccessor(d);
  8400. return v != null ? + (self._sizeScale.call(null, v, 0, 0)) * ratio : size * ratio;
  8401. };
  8402. }
  8403. return function(d, index, groupIndex) {
  8404. return size * ratio;
  8405. };
  8406. },
  8407. getAnchor : function() {
  8408. var self = this;
  8409. return function(data, index, groupIndex) {
  8410. if (!self._itemLabelPosition) {
  8411. return "middle";
  8412. }
  8413. var labelPosition = self._itemLabelPosition.call(this, data, index, groupIndex);
  8414. if (0 == labelPosition || 2 == labelPosition || 1 == labelPosition) {
  8415. return "middle";
  8416. } else if (3 == labelPosition) {
  8417. return "end";
  8418. } else if (4 == labelPosition || 5 == labelPosition) {
  8419. return "start";
  8420. }
  8421. return "middle";
  8422. };
  8423. },
  8424. getLabelFill : function() {
  8425. var self = this;
  8426. var labelColor = this.getDefaultLabelColor(this._labelFontStyle);
  8427. return function(data, index, groupIndex) {
  8428. if (!self._colorPalette || !self._itemLabelPosition) {
  8429. return labelColor;
  8430. }
  8431. var labelPosition = self._itemLabelPosition.call(this, data, index, groupIndex);
  8432. if (1 == labelPosition) {
  8433. var elementColor = self._colorPalette.call(this, data, index, groupIndex);
  8434. if (elementColor != null) {
  8435. return com_ibm_rave_bundles_utilities_ColorUtil.getContrastColor(elementColor, labelColor).toString();
  8436. }
  8437. }
  8438. return labelColor;
  8439. };
  8440. },
  8441. getXOffset : function() {
  8442. var self = this;
  8443. return function(data, index, groupIndex) {
  8444. var padding = 5;
  8445. if ((!self._itemLabelPosition)) {
  8446. return "0em";
  8447. }
  8448. var labelPosition = self._itemLabelPosition.call(this, data, index, groupIndex);
  8449. if (3 == labelPosition) {
  8450. return "-" + (Math.sqrt(self.finalSize(self._defaultSize, self._symbol).call(this, data, index, groupIndex)) / 2 + padding) + "px";
  8451. }
  8452. if (4 == labelPosition) {
  8453. return "" + (Math.sqrt(self.finalSize(self._defaultSize, self._symbol).call(this, data, index, groupIndex)) / 2 + padding) + "px";
  8454. }
  8455. if (5 == labelPosition) {
  8456. return "" + (Math.sqrt(self.finalSize(self._defaultSize, self._symbol).call(this, data, index, groupIndex)) / 2) + "px";
  8457. }
  8458. return "0em";
  8459. };
  8460. },
  8461. getYOffset : function() {
  8462. var self = this;
  8463. return function(data, index, groupIndex) {
  8464. var padding = 5;
  8465. if ((!self._itemLabelPosition)) {
  8466. return "0.3em";
  8467. }
  8468. var labelPosition = self._itemLabelPosition.call(this, data, index, groupIndex);
  8469. if (0 == labelPosition) {
  8470. return "-" + (Math.sqrt(self.finalSize(self._defaultSize, self._symbol).call(this, data, index, groupIndex)) / 2 + padding) + "px";
  8471. }
  8472. if (2 == labelPosition) {
  8473. var fontHeight = rave['library']['internal']['CSSConverter'].convertCSSSizeToPixelNumber("1em", 100.0, 10.0);
  8474. return "" + (Math.sqrt(self.finalSize(self._defaultSize, self._symbol).call(this, data, index, groupIndex)) / 2 + fontHeight + padding) + "px";
  8475. }
  8476. if (5 == labelPosition) {
  8477. return "-" + (Math.sqrt(self.finalSize(self._defaultSize, self._symbol).call(this, data, index, groupIndex)) / 2) + "px";
  8478. }
  8479. return "0.3em";
  8480. };
  8481. },
  8482. /**
  8483. * @param (java.lang.Object[]) data The new data
  8484. */
  8485. /** @expose */
  8486. data : function(data) {
  8487. this._data = data;
  8488. return this;
  8489. },
  8490. /**
  8491. * @param (rave['internal']['SingleValueFunction']) independentAccessor The new independent accessor
  8492. */
  8493. /** @expose */
  8494. independentAccessor : function(independentAccessor) {
  8495. this._independentAccessor = independentAccessor;
  8496. return this;
  8497. },
  8498. /**
  8499. * @param (rave['library']['internal']['CoordinateScaleImpl']) independentScale The new independent scale
  8500. */
  8501. /** @expose */
  8502. independentScale : function(independentScale) {
  8503. this._independentScale = independentScale;
  8504. return this;
  8505. },
  8506. /**
  8507. * @param (rave['internal']['SingleValueFunction']) dependentAccessor The new dependent accessor
  8508. */
  8509. /** @expose */
  8510. dependentAccessor : function(dependentAccessor) {
  8511. this._dependentAccessor = dependentAccessor;
  8512. return this;
  8513. },
  8514. /**
  8515. * @param (rave['library']['internal']['CoordinateScaleImpl']) dependentScale The new dependent scale
  8516. */
  8517. /** @expose */
  8518. dependentScale : function(dependentScale) {
  8519. this._dependentScale = dependentScale;
  8520. return this;
  8521. },
  8522. /**
  8523. * @param (rave['library']['internal']['Palette']) colorPalette The new colorPalette
  8524. */
  8525. /** @expose */
  8526. colorPalette : function(colorPalette) {
  8527. this._colorPalette = colorPalette;
  8528. return this;
  8529. },
  8530. /**
  8531. * @param (rave['internal']['SingleValueFunction']) sizeAccessor The new sizeAccessor
  8532. */
  8533. /** @expose */
  8534. sizeAccessor : function(sizeAccessor) {
  8535. this._sizeAccessor = sizeAccessor;
  8536. return this;
  8537. },
  8538. /**
  8539. * @param (rave['internal']['AbstractScale']) sizeScale The new sizeScale
  8540. */
  8541. /** @expose */
  8542. sizeScale : function(sizeScale) {
  8543. this._sizeScale = sizeScale;
  8544. return this;
  8545. },
  8546. /**
  8547. * @param (rave['internal']['SingleValueFunction']) labelAccessor The new labelAccessor
  8548. */
  8549. /** @expose */
  8550. labelAccessor : function(labelAccessor) {
  8551. this._labelAccessor = labelAccessor;
  8552. return this;
  8553. },
  8554. /**
  8555. * @param (rave['internal']['ValueFunction']) labelFormatter The new labelFormatter
  8556. */
  8557. /** @expose */
  8558. labelFormatter : function(labelFormatter) {
  8559. this._labelFormatter = labelFormatter;
  8560. return this;
  8561. },
  8562. /**
  8563. * @param (rave['internal']['ValueFunction']) labelPosition Function to be used to determine label position
  8564. */
  8565. /** @expose */
  8566. itemLabelPosition : function(labelPosition) {
  8567. this._itemLabelPosition = labelPosition;
  8568. return this;
  8569. },
  8570. /**
  8571. * @param (rave['internal']['RectStruct']) bounds The new bounds
  8572. */
  8573. /** @expose */
  8574. bounds : function(bounds) {
  8575. this._bounds = bounds;
  8576. return this;
  8577. },
  8578. /**
  8579. * @param (boolean) transpose The new transpose
  8580. */
  8581. /** @expose */
  8582. transpose : function(transpose) {
  8583. this._transpose = transpose;
  8584. return this;
  8585. },
  8586. /**
  8587. * @param (double) defaultSize The new defaultSize
  8588. */
  8589. /** @expose */
  8590. defaultSize : function(defaultSize) {
  8591. this._defaultSize = defaultSize;
  8592. return this;
  8593. },
  8594. /** @expose */
  8595. itemLabel : function(itemLabel) {
  8596. this._itemLabel = itemLabel;
  8597. return this;
  8598. },
  8599. /** @expose */
  8600. labelFont : function(labelFont) {
  8601. this._labelFontStyle = labelFont;
  8602. return this;
  8603. },
  8604. /**
  8605. * @param (boolean) itemOverlap The new itemOverlap
  8606. */
  8607. /** @expose */
  8608. itemOverlap : function(itemOverlap) {
  8609. this._itemOverlap = itemOverlap;
  8610. return this;
  8611. },
  8612. /**
  8613. * @param (String) symbol The new symbol
  8614. */
  8615. /** @expose */
  8616. symbol : function(symbol) {
  8617. this._prevSymbol = this._symbol;
  8618. this._symbol = symbol;
  8619. return this;
  8620. },
  8621. /**
  8622. * @param (String) effect The new effect
  8623. */
  8624. /** @expose */
  8625. effect : function(effect) {
  8626. this._effect = effect;
  8627. return this;
  8628. },
  8629. /** @expose */
  8630. borderWidth : function(borderWidth) {
  8631. this._borderWidth = borderWidth;
  8632. return this;
  8633. },
  8634. /** @expose */
  8635. borderColor : function(borderColor) {
  8636. this._borderColor = borderColor;
  8637. return this;
  8638. },
  8639. /**
  8640. * @param (String) className - the class name for labelslayer. If not set, the default is ".element-label-group" return this
  8641. */
  8642. /** @expose */
  8643. labelLayerClassName : function(className) {
  8644. this._labelLayerClass = className;
  8645. return this;
  8646. },
  8647. /**
  8648. * @param (String) className - the class name for elementslayer. If not set, the default is ".element-group" return this
  8649. */
  8650. /** @expose */
  8651. elementLayerClassName : function(className) {
  8652. this._elementLayerClass = className;
  8653. return this;
  8654. },
  8655. /**
  8656. * @param (boolean) labelContrast {boolean} whether to contrast the label color with background/background element color.
  8657. * @return (com.ibm.rave.bundles.components.PointComponentImpl) this
  8658. */
  8659. /** @expose */
  8660. labelContrast : function(labelContrast) {
  8661. this._labelContrast = labelContrast;
  8662. return this;
  8663. },
  8664. /**
  8665. * @param (boolean) labelShadow {boolean} whether to show a label shadow with a contrast label color.
  8666. * @return (com.ibm.rave.bundles.components.PointComponentImpl) this
  8667. */
  8668. /** @expose */
  8669. labelShadow : function(labelShadow) {
  8670. this._labelShadow = labelShadow;
  8671. return this;
  8672. }
  8673. });
  8674. /** @expose */
  8675. com_ibm_rave_bundles_components_PointComponentImpl.SECONDARY_ELEMENT = "element-shape-secondary";
  8676. /** @expose */
  8677. com_ibm_rave_bundles_components_PointComponentImpl.LABEL_POSITION_TOP = 0;
  8678. /** @expose */
  8679. com_ibm_rave_bundles_components_PointComponentImpl.LABEL_POSITION_CENTER = 1;
  8680. /** @expose */
  8681. com_ibm_rave_bundles_components_PointComponentImpl.LABEL_POSITION_BOTTOM = 2;
  8682. /** @expose */
  8683. com_ibm_rave_bundles_components_PointComponentImpl.LABEL_POSITION_LEFT = 3;
  8684. /** @expose */
  8685. com_ibm_rave_bundles_components_PointComponentImpl.LABEL_POSITION_RIGHT = 4;
  8686. /** @expose */
  8687. com_ibm_rave_bundles_components_PointComponentImpl.LABEL_POSITION_TOP_RIGHT = 5;
  8688. // $source: com/ibm/rave/bundles/components/FilterComponentImpl
  8689. /************************************************************************
  8690. ** IBM Confidential
  8691. **
  8692. ** IBM Business Analytics: Rapidly Adaptive Visualization Engine
  8693. **
  8694. ** (C) Copyright IBM Corp. 2017
  8695. **
  8696. ** The source code for this program is not published or otherwise divested of its trade secrets,
  8697. ** irrespective of what has been deposited with the U.S. Copyright Office.
  8698. ************************************************************************/
  8699. // GENERATED
  8700. //@import com/ibm/rave/bundles/components/BundleComponentImpl (loadtime) // superclass
  8701. var com_ibm_rave_bundles_components_FilterComponentImpl = rave['internal']['Declare'](com_ibm_rave_bundles_components_BundleComponentImpl, {
  8702. //_id : null,
  8703. //color : null,
  8704. offset_x : 0,
  8705. offset_y : 0,
  8706. blur_radius : 0,
  8707. /** @expose */
  8708. constructor : function(id) {
  8709. this._id = id;
  8710. },
  8711. /** @expose */
  8712. setDropshadow : function(offset_x, offset_y, radius, rgb) {
  8713. this.offset_x = this.getValue(offset_x);
  8714. this.offset_y = this.getValue(offset_y);
  8715. this.blur_radius = this.getValue(radius);
  8716. this.color = rgb;
  8717. },
  8718. getValue : function(s) {
  8719. if (s == null) {
  8720. return 0;
  8721. }
  8722. return + (s.substring(0, s.length - 2));
  8723. },
  8724. /** @expose */
  8725. execute : function(g) {
  8726. var s = g.selectAll("#" + this._id).data([0]);
  8727. var filter = s.enter().append("filter").attr("id", this._id).attr("height", "500%").attr("width", "500%");
  8728. filter.append("feGaussianBlur").attr("in", "SourceAlpha");
  8729. filter.append("feOffset").attr("result", "offsetBlur");
  8730. filter.append("feFlood");
  8731. filter.append("feComposite").attr("in2", "offsetBlur").attr("operator", "in");
  8732. var merge = filter.append("feMerge");
  8733. merge.append("feMergeNode");
  8734. merge.append("feMergeNode").attr("in", "SourceGraphic");
  8735. s.select("feGaussianBlur").attr("stdDeviation", this.blur_radius);
  8736. s.select("feOffset").attr("dx", this.offset_x).attr("dy", this.offset_y);
  8737. s.select("feFlood").attr("flood-color", !this.color ? "black" : this.color);
  8738. },
  8739. /** @expose */
  8740. type : function() {
  8741. return "FilterComponent";
  8742. },
  8743. /** @expose */
  8744. getId : function() {
  8745. return this._id;
  8746. }
  8747. });
  8748. })();
  8749. },{"./configuration/configuration.json":1,"./i18n/messages_en.json":2,"./vizlibrary-line.css":4,"./vizlibrary.css":5}],4:[function(require,module,exports){
  8750. var css = ".vizlibrary-line .element-line {\n fill: none;\n stroke: #222;\n stroke-width: 2;\n stroke-opacity: 1;\n}\n.vizlibrary-line .element-shape-secondary {\n pointer-events: none;\n}\n.vizlibrary-line .element-label {\n pointer-events: none;\n}\n"; (require("browserify-css").createStyle(css, { "href": "dist/bundles/rave-library-line/node/rave-library-line/vizlibrary-line.css"})); module.exports = css;
  8751. },{"browserify-css":6}],5:[function(require,module,exports){
  8752. 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-line/node/rave-library-line/vizlibrary.css"})); module.exports = css;
  8753. },{"browserify-css":6}],6:[function(require,module,exports){
  8754. 'use strict';
  8755. // For more information about browser field, check out the browser field at https://github.com/substack/browserify-handbook#browser-field.
  8756. module.exports = {
  8757. // Create a <link> tag with optional data attributes
  8758. createLink: function(href, attributes) {
  8759. var head = document.head || document.getElementsByTagName('head')[0];
  8760. var link = document.createElement('link');
  8761. link.href = href;
  8762. link.rel = 'stylesheet';
  8763. for (var key in attributes) {
  8764. if ( ! attributes.hasOwnProperty(key)) {
  8765. continue;
  8766. }
  8767. var value = attributes[key];
  8768. link.setAttribute('data-' + key, value);
  8769. }
  8770. head.appendChild(link);
  8771. },
  8772. // Create a <style> tag with optional data attributes
  8773. createStyle: function(cssText, attributes) {
  8774. var head = document.head || document.getElementsByTagName('head')[0],
  8775. style = document.createElement('style');
  8776. style.type = 'text/css';
  8777. for (var key in attributes) {
  8778. if ( ! attributes.hasOwnProperty(key)) {
  8779. continue;
  8780. }
  8781. var value = attributes[key];
  8782. style.setAttribute('data-' + key, value);
  8783. }
  8784. if (style.sheet) { // for jsdom and IE9+
  8785. style.innerHTML = cssText;
  8786. style.sheet.cssText = cssText;
  8787. head.appendChild(style);
  8788. } else if (style.styleSheet) { // for IE8 and below
  8789. head.appendChild(style);
  8790. style.styleSheet.cssText = cssText;
  8791. } else { // for Chrome, Firefox, and Safari
  8792. style.appendChild(document.createTextNode(cssText));
  8793. head.appendChild(style);
  8794. }
  8795. }
  8796. };
  8797. },{}]},{},[3]);
  8798. return rave.library.bundle.extension('lineBundle');
  8799. }));