1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136 |
- if(!dojo._hasResource["dijit._base.manager"]){
- dojo._hasResource["dijit._base.manager"] = true;
- dojo.provide("dijit._base.manager");
- dojo.declare("dijit.WidgetSet", null, {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- constructor: function(){
- this._hash = {};
- this.length = 0;
- },
- add: function(/*dijit._Widget*/ widget){
-
-
-
-
-
- if(this._hash[widget.id]){
- throw new Error("Tried to register widget with id==" + widget.id + " but that id is already registered");
- }
- this._hash[widget.id] = widget;
- this.length++;
- },
- remove: function(/*String*/ id){
-
-
-
- if(this._hash[id]){
- delete this._hash[id];
- this.length--;
- }
- },
- forEach: function(/*Function*/ func, /* Object? */thisObj){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- thisObj = thisObj || dojo.global;
- var i = 0, id;
- for(id in this._hash){
- func.call(thisObj, this._hash[id], i++, this._hash);
- }
- return this;
- },
- filter: function(/*Function*/ filter, /* Object? */thisObj){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- thisObj = thisObj || dojo.global;
- var res = new dijit.WidgetSet(), i = 0, id;
- for(id in this._hash){
- var w = this._hash[id];
- if(filter.call(thisObj, w, i++, this._hash)){
- res.add(w);
- }
- }
- return res;
- },
- byId: function(/*String*/ id){
-
-
-
-
-
-
-
-
- return this._hash[id];
- },
- byClass: function(/*String*/ cls){
-
-
-
-
-
-
-
-
-
- var res = new dijit.WidgetSet(), id, widget;
- for(id in this._hash){
- widget = this._hash[id];
- if(widget.declaredClass == cls){
- res.add(widget);
- }
- }
- return res;
- },
- toArray: function(){
-
-
-
-
-
-
- var ar = [];
- for(var id in this._hash){
- ar.push(this._hash[id]);
- }
- return ar;
- },
- map: function(/* Function */func, /* Object? */thisObj){
-
-
-
-
-
-
-
- return dojo.map(this.toArray(), func, thisObj);
- },
- every: function(func, thisObj){
-
-
-
-
-
-
-
-
-
- thisObj = thisObj || dojo.global;
- var x = 0, i;
- for(i in this._hash){
- if(!func.call(thisObj, this._hash[i], x++, this._hash)){
- return false;
- }
- }
- return true;
- },
- some: function(func, thisObj){
-
-
-
-
-
-
-
-
-
- thisObj = thisObj || dojo.global;
- var x = 0, i;
- for(i in this._hash){
- if(func.call(thisObj, this._hash[i], x++, this._hash)){
- return true;
- }
- }
- return false;
- }
- });
- (function(){
-
- dijit.registry = new dijit.WidgetSet();
- var hash = dijit.registry._hash,
- attr = dojo.attr,
- hasAttr = dojo.hasAttr,
- style = dojo.style;
- dijit.byId = function(/*String|dijit._Widget*/ id){
-
-
- return typeof id == "string" ? hash[id] : id;
- };
- var _widgetTypeCtr = {};
- dijit.getUniqueId = function(/*String*/widgetType){
-
-
-
- var id;
- do{
- id = widgetType + "_" +
- (widgetType in _widgetTypeCtr ?
- ++_widgetTypeCtr[widgetType] : _widgetTypeCtr[widgetType] = 0);
- }while(hash[id]);
- return dijit._scopeName == "dijit" ? id : dijit._scopeName + "_" + id;
- };
-
- dijit.findWidgets = function(/*DomNode*/ root){
-
-
-
-
- var outAry = [];
-
- function getChildrenHelper(root){
- for(var node = root.firstChild; node; node = node.nextSibling){
- if(node.nodeType == 1){
- var widgetId = node.getAttribute("widgetId");
- if(widgetId){
- var widget = hash[widgetId];
- if(widget){
- outAry.push(widget);
- }
- }else{
- getChildrenHelper(node);
- }
- }
- }
- }
-
- getChildrenHelper(root);
- return outAry;
- };
-
- dijit._destroyAll = function(){
-
-
-
-
- dijit._curFocus = null;
- dijit._prevFocus = null;
- dijit._activeStack = [];
-
-
- dojo.forEach(dijit.findWidgets(dojo.body()), function(widget){
-
-
- if(!widget._destroyed){
- if(widget.destroyRecursive){
- widget.destroyRecursive();
- }else if(widget.destroy){
- widget.destroy();
- }
- }
- });
- };
-
- if(dojo.isIE){
-
-
- dojo.addOnWindowUnload(function(){
- dijit._destroyAll();
- });
- }
-
- dijit.byNode = function(/*DOMNode*/ node){
-
-
- return hash[node.getAttribute("widgetId")];
- };
-
- dijit.getEnclosingWidget = function(/*DOMNode*/ node){
-
-
-
- while(node){
- var id = node.getAttribute && node.getAttribute("widgetId");
- if(id){
- return hash[id];
- }
- node = node.parentNode;
- }
- return null;
- };
- var shown = (dijit._isElementShown = function(/*Element*/ elem){
- var s = style(elem);
- return (s.visibility != "hidden")
- && (s.visibility != "collapsed")
- && (s.display != "none")
- && (attr(elem, "type") != "hidden");
- });
-
- dijit.hasDefaultTabStop = function(/*Element*/ elem){
-
-
-
-
- switch(elem.nodeName.toLowerCase()){
- case "a":
-
- return hasAttr(elem, "href");
- case "area":
- case "button":
- case "input":
- case "object":
- case "select":
- case "textarea":
-
- return true;
- case "iframe":
-
- var body;
- try{
-
- var contentDocument = elem.contentDocument;
- if("designMode" in contentDocument && contentDocument.designMode == "on"){
- return true;
- }
- body = contentDocument.body;
- }catch(e1){
-
-
-
- try{
- body = elem.contentWindow.document.body;
- }catch(e2){
- return false;
- }
- }
- return body.contentEditable == 'true' || (body.firstChild && body.firstChild.contentEditable == 'true');
- default:
- return elem.contentEditable == 'true';
- }
- };
-
- var isTabNavigable = (dijit.isTabNavigable = function(/*Element*/ elem){
-
-
-
-
- if(attr(elem, "disabled")){
- return false;
- }else if(hasAttr(elem, "tabIndex")){
-
- return attr(elem, "tabIndex") >= 0;
- }else{
-
- return dijit.hasDefaultTabStop(elem);
- }
- });
- dijit._getTabNavigable = function(/*DOMNode*/ root){
-
-
-
-
-
-
-
-
-
-
-
-
-
- var first, last, lowest, lowestTabindex, highest, highestTabindex, radioSelected = {};
- function radioName(node) {
-
- return node && node.tagName.toLowerCase() == "input" &&
- node.type && node.type.toLowerCase() == "radio" &&
- node.name && node.name.toLowerCase();
- }
- var walkTree = function(/*DOMNode*/parent){
- dojo.query("> *", parent).forEach(function(child){
-
-
- if((dojo.isIE <= 9 && child.scopeName !== "HTML") || !shown(child)){
- return;
- }
- if(isTabNavigable(child)){
- var tabindex = attr(child, "tabIndex");
- if(!hasAttr(child, "tabIndex") || tabindex == 0){
- if(!first){ first = child; }
- last = child;
- }else if(tabindex > 0){
- if(!lowest || tabindex < lowestTabindex){
- lowestTabindex = tabindex;
- lowest = child;
- }
- if(!highest || tabindex >= highestTabindex){
- highestTabindex = tabindex;
- highest = child;
- }
- }
- var rn = radioName(child);
- if(dojo.attr(child, "checked") && rn) {
- radioSelected[rn] = child;
- }
- }
- if(child.nodeName.toUpperCase() != 'SELECT'){
- walkTree(child);
- }
- });
- };
- if(shown(root)){ walkTree(root) }
- function rs(node) {
-
- return radioSelected[radioName(node)] || node;
- }
- return { first: rs(first), last: rs(last), lowest: rs(lowest), highest: rs(highest) };
- }
- dijit.getFirstInTabbingOrder = function(/*String|DOMNode*/ root){
-
-
-
- var elems = dijit._getTabNavigable(dojo.byId(root));
- return elems.lowest ? elems.lowest : elems.first;
- };
-
- dijit.getLastInTabbingOrder = function(/*String|DOMNode*/ root){
-
-
-
- var elems = dijit._getTabNavigable(dojo.byId(root));
- return elems.last ? elems.last : elems.highest;
- };
-
-
-
- dijit.defaultDuration = dojo.config["defaultDuration"] || 200;
- })();
- }
- if(!dojo._hasResource["dojo.Stateful"]){
- dojo._hasResource["dojo.Stateful"] = true;
- dojo.provide("dojo.Stateful");
- dojo.declare("dojo.Stateful", null, {
-
-
-
-
-
-
-
-
-
- postscript: function(mixin){
- if(mixin){
- dojo.mixin(this, mixin);
- }
- },
-
- get: function(/*String*/name){
-
-
-
-
-
-
-
-
-
-
-
-
-
- return this[name];
- },
- set: function(/*String*/name, /*Object*/value){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(typeof name === "object"){
- for(var x in name){
- this.set(x, name[x]);
- }
- return this;
- }
- var oldValue = this[name];
- this[name] = value;
- if(this._watchCallbacks){
- this._watchCallbacks(name, oldValue, value);
- }
- return this;
- },
- watch: function(/*String?*/name, /*Function*/callback){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var callbacks = this._watchCallbacks;
- if(!callbacks){
- var self = this;
- callbacks = this._watchCallbacks = function(name, oldValue, value, ignoreCatchall){
- var notify = function(propertyCallbacks){
- if(propertyCallbacks){
- propertyCallbacks = propertyCallbacks.slice();
- for(var i = 0, l = propertyCallbacks.length; i < l; i++){
- try{
- propertyCallbacks[i].call(self, name, oldValue, value);
- }catch(e){
- console.error(e);
- }
- }
- }
- };
- notify(callbacks['_' + name]);
- if(!ignoreCatchall){
- notify(callbacks["*"]);
- }
- };
- }
- if(!callback && typeof name === "function"){
- callback = name;
- name = "*";
- }else{
-
- name = '_' + name;
- }
- var propertyCallbacks = callbacks[name];
- if(typeof propertyCallbacks !== "object"){
- propertyCallbacks = callbacks[name] = [];
- }
- propertyCallbacks.push(callback);
- return {
- unwatch: function(){
- propertyCallbacks.splice(dojo.indexOf(propertyCallbacks, callback), 1);
- }
- };
- }
-
- });
- }
- if(!dojo._hasResource["dijit._WidgetBase"]){
- dojo._hasResource["dijit._WidgetBase"] = true;
- dojo.provide("dijit._WidgetBase");
- (function(){
- function isEqual(a, b){
-
-
-
-
- return a === b || ( a !== a && b !== b);
- }
- dojo.declare("dijit._WidgetBase", dojo.Stateful, {
-
-
-
-
-
-
-
-
- id: "",
-
-
-
-
-
- lang: "",
-
-
-
-
- dir: "",
-
-
- "class": "",
-
-
- style: "",
-
-
-
-
-
-
-
-
- title: "",
-
-
-
- tooltip: "",
-
-
-
- baseClass: "",
-
-
- srcNodeRef: null,
-
-
-
-
-
- domNode: null,
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- containerNode: null,
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- attributeMap: {id:"", dir:"", lang:"", "class":"", style:"", title:""},
-
-
-
- _blankGif: (dojo.config.blankGif || dojo.moduleUrl("dojo", "resources/blank.gif")).toString(),
-
- postscript: function(/*Object?*/params, /*DomNode|String*/srcNodeRef){
-
-
-
-
- this.create(params, srcNodeRef);
- },
- create: function(/*Object?*/params, /*DomNode|String?*/srcNodeRef){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- this.srcNodeRef = dojo.byId(srcNodeRef);
-
-
- this._connects = [];
-
-
- this._subscribes = [];
-
- if(this.srcNodeRef && (typeof this.srcNodeRef.id == "string")){ this.id = this.srcNodeRef.id; }
- if(params){
- this.params = params;
- dojo._mixin(this, params);
- }
- this.postMixInProperties();
-
-
-
- if(!this.id){
- this.id = dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));
- }
- dijit.registry.add(this);
- this.buildRendering();
- if(this.domNode){
-
-
- this._applyAttributes();
-
-
-
-
- var source = this.srcNodeRef;
- if(source && source.parentNode && this.domNode !== source){
- source.parentNode.replaceChild(this.domNode, source);
- }
- }
- if(this.domNode){
-
-
- this.domNode.setAttribute("widgetId", this.id);
- }
- this.postCreate();
-
- if(this.srcNodeRef && !this.srcNodeRef.parentNode){
- delete this.srcNodeRef;
- }
- this._created = true;
- },
- _applyAttributes: function(){
-
-
-
-
-
-
-
-
-
-
-
-
-
- var condAttrApply = function(attr, scope){
- if((scope.params && attr in scope.params) || scope[attr]){
- scope.set(attr, scope[attr]);
- }
- };
-
- for(var attr in this.attributeMap){
- condAttrApply(attr, this);
- }
-
- dojo.forEach(this._getSetterAttributes(), function(a){
- if(!(a in this.attributeMap)){
- condAttrApply(a, this);
- }
- }, this);
- },
- _getSetterAttributes: function(){
-
-
- var ctor = this.constructor;
- if(!ctor._setterAttrs){
- var r = (ctor._setterAttrs = []),
- attrs,
- proto = ctor.prototype;
- for(var fxName in proto){
- if(dojo.isFunction(proto[fxName]) && (attrs = fxName.match(/^_set([a-zA-Z]*)Attr$/)) && attrs[1]){
- r.push(attrs[1].charAt(0).toLowerCase() + attrs[1].substr(1));
- }
- }
- }
- return ctor._setterAttrs;
- },
- postMixInProperties: function(){
-
-
-
-
-
-
-
- },
- buildRendering: function(){
-
-
-
-
-
-
-
- if(!this.domNode){
-
- this.domNode = this.srcNodeRef || dojo.create('div');
- }
-
-
-
- if(this.baseClass){
- var classes = this.baseClass.split(" ");
- if(!this.isLeftToRight()){
- classes = classes.concat( dojo.map(classes, function(name){ return name+"Rtl"; }));
- }
- dojo.addClass(this.domNode, classes);
- }
- },
- postCreate: function(){
-
-
-
-
-
-
-
-
- },
- startup: function(){
-
-
-
-
-
-
-
- this._started = true;
- },
-
- destroyRecursive: function(/*Boolean?*/ preserveDom){
-
-
-
-
-
-
-
-
-
-
- this._beingDestroyed = true;
- this.destroyDescendants(preserveDom);
- this.destroy(preserveDom);
- },
- destroy: function(/*Boolean*/ preserveDom){
-
-
-
-
-
-
- this._beingDestroyed = true;
- this.uninitialize();
- var d = dojo,
- dfe = d.forEach,
- dun = d.unsubscribe;
- dfe(this._connects, function(array){
- dfe(array, d.disconnect);
- });
- dfe(this._subscribes, function(handle){
- dun(handle);
- });
-
- dfe(this._supportingWidgets || [], function(w){
- if(w.destroyRecursive){
- w.destroyRecursive();
- }else if(w.destroy){
- w.destroy();
- }
- });
- this.destroyRendering(preserveDom);
- dijit.registry.remove(this.id);
- this._destroyed = true;
- },
- destroyRendering: function(/*Boolean?*/ preserveDom){
-
-
-
-
-
-
-
-
- if(this.bgIframe){
- this.bgIframe.destroy(preserveDom);
- delete this.bgIframe;
- }
- if(this.domNode){
- if(preserveDom){
- dojo.removeAttr(this.domNode, "widgetId");
- }else{
- dojo.destroy(this.domNode);
- }
- delete this.domNode;
- }
- if(this.srcNodeRef){
- if(!preserveDom){
- dojo.destroy(this.srcNodeRef);
- }
- delete this.srcNodeRef;
- }
- },
- destroyDescendants: function(/*Boolean?*/ preserveDom){
-
-
-
-
-
-
-
-
- dojo.forEach(this.getChildren(), function(widget){
- if(widget.destroyRecursive){
- widget.destroyRecursive(preserveDom);
- }
- });
- },
- uninitialize: function(){
-
-
-
-
-
- return false;
- },
-
- _setClassAttr: function(/*String*/ value){
-
-
-
-
- var mapNode = this[this.attributeMap["class"] || 'domNode'];
- dojo.replaceClass(mapNode, value, this["class"]);
- this._set("class", value);
- },
- _setStyleAttr: function(/*String||Object*/ value){
-
-
-
-
-
-
-
-
-
- var mapNode = this[this.attributeMap.style || 'domNode'];
-
-
- if(dojo.isObject(value)){
- dojo.style(mapNode, value);
- }else{
- if(mapNode.style.cssText){
- mapNode.style.cssText += "; " + value;
- }else{
- mapNode.style.cssText = value;
- }
- }
- this._set("style", value);
- },
- _attrToDom: function(/*String*/ attr, /*String*/ value){
-
-
-
-
-
-
-
-
- var commands = this.attributeMap[attr];
- dojo.forEach(dojo.isArray(commands) ? commands : [commands], function(command){
-
- var mapNode = this[command.node || command || "domNode"];
- var type = command.type || "attribute";
- switch(type){
- case "attribute":
- if(dojo.isFunction(value)){
- value = dojo.hitch(this, value);
- }
-
-
-
- var attrName = command.attribute ? command.attribute :
- (/^on[A-Z][a-zA-Z]*$/.test(attr) ? attr.toLowerCase() : attr);
- dojo.attr(mapNode, attrName, value);
- break;
- case "innerText":
- mapNode.innerHTML = "";
- mapNode.appendChild(dojo.doc.createTextNode(value));
- break;
- case "innerHTML":
- mapNode.innerHTML = value;
- break;
- case "class":
- dojo.replaceClass(mapNode, value, this[attr]);
- break;
- }
- }, this);
- },
- get: function(name){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var names = this._getAttrNames(name);
- return this[names.g] ? this[names.g]() : this[name];
- },
-
- set: function(name, value){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(typeof name === "object"){
- for(var x in name){
- this.set(x, name[x]);
- }
- return this;
- }
- var names = this._getAttrNames(name);
- if(this[names.s]){
-
- var result = this[names.s].apply(this, Array.prototype.slice.call(arguments, 1));
- }else{
-
- if(name in this.attributeMap){
- this._attrToDom(name, value);
- }
- this._set(name, value);
- }
- return result || this;
- },
-
- _attrPairNames: {},
- _getAttrNames: function(name){
-
-
-
-
-
- var apn = this._attrPairNames;
- if(apn[name]){ return apn[name]; }
- var uc = name.charAt(0).toUpperCase() + name.substr(1);
- return (apn[name] = {
- n: name+"Node",
- s: "_set"+uc+"Attr",
- g: "_get"+uc+"Attr"
- });
- },
- _set: function(/*String*/ name, /*anything*/ value){
-
-
-
- var oldValue = this[name];
- this[name] = value;
- if(this._watchCallbacks && this._created && !isEqual(value, oldValue)){
- this._watchCallbacks(name, oldValue, value);
- }
- },
- toString: function(){
-
-
-
-
-
-
- return '[Widget ' + this.declaredClass + ', ' + (this.id || 'NO ID') + ']';
- },
- getDescendants: function(){
-
-
-
-
- return this.containerNode ? dojo.query('[widgetId]', this.containerNode).map(dijit.byNode) : [];
- },
- getChildren: function(){
-
-
-
- return this.containerNode ? dijit.findWidgets(this.containerNode) : [];
- },
- connect: function(
- /*Object|null*/ obj,
- /*String|Function*/ event,
- /*String|Function*/ method){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var handles = [dojo._connect(obj, event, this, method)];
- this._connects.push(handles);
- return handles;
- },
- disconnect: function(/* _Widget.Handle */ handles){
-
-
-
-
-
- for(var i=0; i<this._connects.length; i++){
- if(this._connects[i] == handles){
- dojo.forEach(handles, dojo.disconnect);
- this._connects.splice(i, 1);
- return;
- }
- }
- },
- subscribe: function(
- /*String*/ topic,
- /*String|Function*/ method){
-
-
-
-
-
-
-
-
-
-
-
-
-
- var handle = dojo.subscribe(topic, this, method);
-
- this._subscribes.push(handle);
- return handle;
- },
- unsubscribe: function(/*Object*/ handle){
-
-
-
- for(var i=0; i<this._subscribes.length; i++){
- if(this._subscribes[i] == handle){
- dojo.unsubscribe(handle);
- this._subscribes.splice(i, 1);
- return;
- }
- }
- },
- isLeftToRight: function(){
-
-
-
-
- return this.dir ? (this.dir == "ltr") : dojo._isBodyLtr();
- },
- placeAt: function(/* String|DomNode|_Widget */reference, /* String?|Int? */position){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(reference.declaredClass && reference.addChild){
- reference.addChild(this, position);
- }else{
- dojo.place(this.domNode, reference, position);
- }
- return this;
- },
- defer: function(fcn, delay){
-
-
-
-
-
-
-
-
- var timer = setTimeout(dojo.hitch(this,
- function(){
- timer = null;
- if(!this._destroyed){
- dojo.hitch(this, fcn)();
- }
- }),
- delay || 0
- );
- return {
- remove: function(){
- if(timer){
- clearTimeout(timer);
- timer = null;
- }
- return null;
- }
- };
- }
- });
- })();
- }
- if(!dojo._hasResource["dojo.window"]){
- dojo._hasResource["dojo.window"] = true;
- dojo.provide("dojo.window");
- dojo.getObject("window", true, dojo);
- dojo.window.getBox = function(){
-
-
- var scrollRoot = (dojo.doc.compatMode == 'BackCompat') ? dojo.body() : dojo.doc.documentElement;
-
- var scroll = dojo._docScroll();
- return { w: scrollRoot.clientWidth, h: scrollRoot.clientHeight, l: scroll.x, t: scroll.y };
- };
- dojo.window.get = function(doc){
-
-
-
-
-
-
- if(dojo.isIE && window !== document.parentWindow){
-
- doc.parentWindow.execScript("document._parentWindow = window;", "Javascript");
-
-
- var win = doc._parentWindow;
- doc._parentWindow = null;
- return win;
- }
- return doc.parentWindow || doc.defaultView;
- };
- dojo.window.scrollIntoView = function(/*DomNode*/ node, /*Object?*/ pos){
-
-
-
-
-
-
-
- node = dojo.byId(node);
- var body, doc = node.ownerDocument || dojo.doc;
-
- if(!("rtl_adjust_position_for_verticalScrollBar" in dojo.window)){
- body = dojo.body();
- var scrollable = dojo.create('div', {
- style: {overflow:'scroll', overflowX:'visible', direction:'rtl', visibility:'hidden', position:'absolute', left:'0', top:'0', width:'64px', height:'64px'}
- }, body, "last"),
- div = dojo.create('div', {
- style: {overflow:'hidden', direction:'ltr'}
- }, scrollable, "last");
- dojo.window.rtl_adjust_position_for_verticalScrollBar = dojo.position(div).x != 0;
- scrollable.removeChild(div);
- body.removeChild(scrollable);
- }
- if(!("position_fixed_support" in dojo.window)){
-
- body = dojo.body();
- var outer = dojo.create('span', {
- style: {visibility:'hidden', position:'fixed', left:'1px', top:'1px'}
- }, body, "last"),
- inner = dojo.create('span', {
- style: {position:'fixed', left:'0', top:'0'}
- }, outer, "last");
- dojo.window.position_fixed_support = dojo.position(inner).x != dojo.position(outer).x;
- outer.removeChild(inner);
- body.removeChild(outer);
- }
- try{
- body = doc.body || doc.getElementsByTagName("body")[0];
- var html = doc.documentElement || body.parentNode,
- isIE = dojo.isIE,
- isWK = dojo.isWebKit;
-
- if(node == body || node == html){ return; }
- if(!(dojo.isMozilla || isIE || isWK || dojo.isOpera) && ("scrollIntoView" in node)){
- node.scrollIntoView(false);
- return;
- }
- var backCompat = doc.compatMode == 'BackCompat',
- rootWidth = Math.min(body.clientWidth || html.clientWidth, html.clientWidth || body.clientWidth),
- rootHeight = Math.min(body.clientHeight || html.clientHeight, html.clientHeight || body.clientHeight),
- scrollRoot = (isWK || backCompat) ? body : html,
- nodePos = pos || dojo.position(node),
- el = node.parentNode,
- isFixed = function(el){
- return (isIE <= 6 || (isIE == 7 && backCompat))
- ? false
- : (dojo.window.position_fixed_support && (dojo.style(el, 'position').toLowerCase() == "fixed"));
- };
- if(isFixed(node)){ return; }
- while(el){
- if(el == body){ el = scrollRoot; }
- var elPos = dojo.position(el),
- fixedPos = isFixed(el),
- rtl = dojo.getComputedStyle(el).direction.toLowerCase() == "rtl";
-
- if(el == scrollRoot){
- elPos.w = rootWidth; elPos.h = rootHeight;
- if(scrollRoot == html && isIE && rtl){ elPos.x += scrollRoot.offsetWidth-elPos.w; }
- if(elPos.x < 0 || !isIE || isIE >= 9){ elPos.x = 0; }
- if(elPos.y < 0 || !isIE || isIE >= 9){ elPos.y = 0; }
- }else{
- var pb = dojo._getPadBorderExtents(el);
- elPos.w -= pb.w; elPos.h -= pb.h; elPos.x += pb.l; elPos.y += pb.t;
- var clientSize = el.clientWidth,
- scrollBarSize = elPos.w - clientSize;
- if(clientSize > 0 && scrollBarSize > 0){
- if(rtl && dojo.window.rtl_adjust_position_for_verticalScrollBar){
- elPos.x += scrollBarSize;
- }
- elPos.w = clientSize;
- }
- clientSize = el.clientHeight;
- scrollBarSize = elPos.h - clientSize;
- if(clientSize > 0 && scrollBarSize > 0){
- elPos.h = clientSize;
- }
- }
- if(fixedPos){
- if(elPos.y < 0){
- elPos.h += elPos.y; elPos.y = 0;
- }
- if(elPos.x < 0){
- elPos.w += elPos.x; elPos.x = 0;
- }
- if(elPos.y + elPos.h > rootHeight){
- elPos.h = rootHeight - elPos.y;
- }
- if(elPos.x + elPos.w > rootWidth){
- elPos.w = rootWidth - elPos.x;
- }
- }
-
- var l = nodePos.x - elPos.x,
- t = nodePos.y - elPos.y,
- r = l + nodePos.w - elPos.w,
- bot = t + nodePos.h - elPos.h;
- var s, old;
- if(r * l > 0 && (!!el.scrollLeft || el == scrollRoot || el.scrollWidth > el.offsetHeight)){
- s = Math[l < 0? "max" : "min"](l, r);
- if(rtl && ((isIE == 8 && !backCompat) || isIE >= 9)){ s = -s; }
- old = el.scrollLeft;
- el.scrollLeft += s;
- s = el.scrollLeft - old;
- nodePos.x -= s;
- }
- if(bot * t > 0 && (!!el.scrollTop || el == scrollRoot || el.scrollHeight > el.offsetHeight)){
- s = Math.ceil(Math[t < 0? "max" : "min"](t, bot));
- old = el.scrollTop;
- el.scrollTop += s;
- s = el.scrollTop - old;
- nodePos.y -= s;
- }
- el = (el != scrollRoot) && !fixedPos && el.parentNode;
- }
- }catch(error){
- console.error('scrollIntoView: ' + error);
- node.scrollIntoView(false);
- }
- };
- }
- if(!dojo._hasResource["dijit._base.focus"]){
- dojo._hasResource["dijit._base.focus"] = true;
- dojo.provide("dijit._base.focus");
- dojo.mixin(dijit, {
-
-
- _curFocus: null,
-
-
- _prevFocus: null,
- isCollapsed: function(){
-
-
- return dijit.getBookmark().isCollapsed;
- },
- getBookmark: function(){
-
-
- var bm, rg, tg, sel = dojo.doc.selection, cf = dijit._curFocus;
- if(dojo.global.getSelection){
-
- sel = dojo.global.getSelection();
- if(sel){
- if(sel.isCollapsed){
- tg = cf? cf.tagName : "";
- if(tg){
-
- tg = tg.toLowerCase();
- if(tg == "textarea" ||
- (tg == "input" && (!cf.type || cf.type.toLowerCase() == "text"))){
- sel = {
- start: cf.selectionStart,
- end: cf.selectionEnd,
- node: cf,
- pRange: true
- };
- return {isCollapsed: (sel.end <= sel.start), mark: sel};
- }
- }
- bm = {isCollapsed:true};
- if(sel.rangeCount){
- bm.mark = sel.getRangeAt(0).cloneRange();
- }
- }else{
- rg = sel.getRangeAt(0);
- bm = {isCollapsed: false, mark: rg.cloneRange()};
- }
- }
- }else if(sel){
-
-
-
- tg = cf ? cf.tagName : "";
- tg = tg.toLowerCase();
- if(cf && tg && (tg == "button" || tg == "textarea" || tg == "input")){
- if(sel.type && sel.type.toLowerCase() == "none"){
- return {
- isCollapsed: true,
- mark: null
- }
- }else{
- rg = sel.createRange();
- return {
- isCollapsed: rg.text && rg.text.length?false:true,
- mark: {
- range: rg,
- pRange: true
- }
- };
- }
- }
- bm = {};
-
- try{
-
-
- rg = sel.createRange();
- bm.isCollapsed = !(sel.type == 'Text' ? rg.htmlText.length : rg.length);
- }catch(e){
- bm.isCollapsed = true;
- return bm;
- }
- if(sel.type.toUpperCase() == 'CONTROL'){
- if(rg.length){
- bm.mark=[];
- var i=0,len=rg.length;
- while(i<len){
- bm.mark.push(rg.item(i++));
- }
- }else{
- bm.isCollapsed = true;
- bm.mark = null;
- }
- }else{
- bm.mark = rg.getBookmark();
- }
- }else{
- console.warn("No idea how to store the current selection for this browser!");
- }
- return bm;
- },
- moveToBookmark: function(/*Object*/bookmark){
-
-
-
-
- var _doc = dojo.doc,
- mark = bookmark.mark;
- if(mark){
- if(dojo.global.getSelection){
-
- var sel = dojo.global.getSelection();
- if(sel && sel.removeAllRanges){
- if(mark.pRange){
- var r = mark;
- var n = r.node;
- n.selectionStart = r.start;
- n.selectionEnd = r.end;
- }else{
- sel.removeAllRanges();
- sel.addRange(mark);
- }
- }else{
- console.warn("No idea how to restore selection for this browser!");
- }
- }else if(_doc.selection && mark){
-
- var rg;
- if(mark.pRange){
- rg = mark.range;
- }else if(dojo.isArray(mark)){
- rg = _doc.body.createControlRange();
-
-
- dojo.forEach(mark, function(n){
- rg.addElement(n);
- });
- }else{
- rg = _doc.body.createTextRange();
- rg.moveToBookmark(mark);
- }
- rg.select();
- }
- }
- },
- getFocus: function(/*Widget?*/ menu, /*Window?*/ openedForWindow){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var node = !dijit._curFocus || (menu && dojo.isDescendant(dijit._curFocus, menu.domNode)) ? dijit._prevFocus : dijit._curFocus;
- return {
- node: node,
- bookmark: (node == dijit._curFocus) && dojo.withGlobal(openedForWindow || dojo.global, dijit.getBookmark),
- openedForWindow: openedForWindow
- };
- },
- focus: function(/*Object || DomNode */ handle){
-
-
-
-
-
- if(!handle){ return; }
- var node = "node" in handle ? handle.node : handle,
- bookmark = handle.bookmark,
- openedForWindow = handle.openedForWindow,
- collapsed = bookmark ? bookmark.isCollapsed : false;
-
-
-
- if(node){
- var focusNode = (node.tagName.toLowerCase() == "iframe") ? node.contentWindow : node;
- if(focusNode && focusNode.focus){
- try{
-
-
- focusNode.focus();
- }catch(e){}
- }
- dijit._onFocusNode(node);
- }
-
-
-
-
- if(bookmark && dojo.withGlobal(openedForWindow || dojo.global, dijit.isCollapsed) && !collapsed){
- if(openedForWindow){
- openedForWindow.focus();
- }
- try{
- dojo.withGlobal(openedForWindow || dojo.global, dijit.moveToBookmark, null, [bookmark]);
- }catch(e2){
-
- }
- }
- },
-
-
- _activeStack: [],
- registerIframe: function(/*DomNode*/ iframe){
-
-
-
-
-
-
-
-
- return dijit.registerWin(iframe.contentWindow, iframe);
- },
- unregisterIframe: function(/*Object*/ handle){
-
-
-
-
-
- dijit.unregisterWin(handle);
- },
- registerWin: function(/*Window?*/targetWindow, /*DomNode?*/ effectiveNode){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var mousedownListener = function(evt){
- dijit._justMouseDowned = true;
- setTimeout(function(){ dijit._justMouseDowned = false; }, 0);
-
-
-
- if(dojo.isIE && evt && evt.srcElement && evt.srcElement.parentNode == null){
- return;
- }
- dijit._onTouchNode(effectiveNode || evt.target || evt.srcElement, "mouse");
- };
-
-
-
-
-
-
-
- var doc = dojo.isIE ? targetWindow.document.documentElement : targetWindow.document;
- if(doc){
- if(dojo.isIE){
- targetWindow.document.body.attachEvent('onmousedown', mousedownListener);
- var activateListener = function(evt){
-
-
- if(evt.srcElement.tagName.toLowerCase() != "#document" &&
- dijit.isTabNavigable(evt.srcElement)){
- dijit._onFocusNode(effectiveNode || evt.srcElement);
- }else{
- dijit._onTouchNode(effectiveNode || evt.srcElement);
- }
- };
- doc.attachEvent('onactivate', activateListener);
- var deactivateListener = function(evt){
- dijit._onBlurNode(effectiveNode || evt.srcElement);
- };
- doc.attachEvent('ondeactivate', deactivateListener);
- return function(){
- targetWindow.document.detachEvent('onmousedown', mousedownListener);
- doc.detachEvent('onactivate', activateListener);
- doc.detachEvent('ondeactivate', deactivateListener);
- doc = null;
- };
- }else{
- doc.body.addEventListener('mousedown', mousedownListener, true);
- var focusListener = function(evt){
- dijit._onFocusNode(effectiveNode || evt.target);
- };
- doc.addEventListener('focus', focusListener, true);
- var blurListener = function(evt){
- dijit._onBlurNode(effectiveNode || evt.target);
- };
- doc.addEventListener('blur', blurListener, true);
- return function(){
- doc.body.removeEventListener('mousedown', mousedownListener, true);
- doc.removeEventListener('focus', focusListener, true);
- doc.removeEventListener('blur', blurListener, true);
- doc = null;
- };
- }
- }
- },
- unregisterWin: function(/*Handle*/ handle){
-
-
-
-
-
- handle && handle();
- },
- _onBlurNode: function(/*DomNode*/ node){
-
-
-
-
-
- dijit._prevFocus = dijit._curFocus;
- dijit._curFocus = null;
- if(dijit._justMouseDowned){
-
-
- return;
- }
-
- if(dijit._clearActiveWidgetsTimer){
- clearTimeout(dijit._clearActiveWidgetsTimer);
- }
- dijit._clearActiveWidgetsTimer = setTimeout(function(){
- delete dijit._clearActiveWidgetsTimer;
- dijit._setStack([]);
- dijit._prevFocus = null;
- }, 100);
- },
- _onTouchNode: function(/*DomNode*/ node, /*String*/ by){
-
-
-
-
-
-
-
- if(dijit._clearActiveWidgetsTimer){
- clearTimeout(dijit._clearActiveWidgetsTimer);
- delete dijit._clearActiveWidgetsTimer;
- }
-
- var newStack=[];
- try{
- while(node){
- var popupParent = dojo.attr(node, "dijitPopupParent");
- if(popupParent){
- node=dijit.byId(popupParent).domNode;
- }else if(node.tagName && node.tagName.toLowerCase() == "body"){
-
- if(node === dojo.body()){
-
- break;
- }
-
-
- node=dojo.window.get(node.ownerDocument).frameElement;
- }else{
-
-
-
- var id = node.getAttribute && node.getAttribute("widgetId"),
- widget = id && dijit.byId(id);
- if(widget && !(by == "mouse" && widget.get("disabled"))){
- newStack.unshift(id);
- }
- node=node.parentNode;
- }
- }
- }catch(e){ }
- dijit._setStack(newStack, by);
- },
- _onFocusNode: function(/*DomNode*/ node){
-
-
- if(!node){
- return;
- }
- if(node.nodeType == 9){
-
-
-
- return;
- }
- dijit._onTouchNode(node);
- if(node == dijit._curFocus){ return; }
- if(dijit._curFocus){
- dijit._prevFocus = dijit._curFocus;
- }
- dijit._curFocus = node;
- dojo.publish("focusNode", [node]);
- },
- _setStack: function(/*String[]*/ newStack, /*String*/ by){
-
-
-
-
-
-
- var oldStack = dijit._activeStack;
- dijit._activeStack = newStack;
-
- for(var nCommon=0; nCommon<Math.min(oldStack.length, newStack.length); nCommon++){
- if(oldStack[nCommon] != newStack[nCommon]){
- break;
- }
- }
- var widget;
-
- for(var i=oldStack.length-1; i>=nCommon; i--){
- widget = dijit.byId(oldStack[i]);
- if(widget){
- widget._focused = false;
- widget.set("focused", false);
- widget._hasBeenBlurred = true;
- if(widget._onBlur){
- widget._onBlur(by);
- }
- dojo.publish("widgetBlur", [widget, by]);
- }
- }
-
- for(i=nCommon; i<newStack.length; i++){
- widget = dijit.byId(newStack[i]);
- if(widget){
- widget._focused = true;
- widget.set("focused", true);
- if(widget._onFocus){
- widget._onFocus(by);
- }
- dojo.publish("widgetFocus", [widget, by]);
- }
- }
- }
- });
- dojo.addOnLoad(function(){
- var handle = dijit.registerWin(window);
- if(dojo.isIE){
- dojo.addOnWindowUnload(function(){
- dijit.unregisterWin(handle);
- handle = null;
- })
- }
- });
- }
- if(!dojo._hasResource["dojo.AdapterRegistry"]){
- dojo._hasResource["dojo.AdapterRegistry"] = true;
- dojo.provide("dojo.AdapterRegistry");
- dojo.AdapterRegistry = function(/*Boolean?*/ returnWrappers){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- this.pairs = [];
- this.returnWrappers = returnWrappers || false;
- };
- dojo.extend(dojo.AdapterRegistry, {
- register: function(/*String*/ name, /*Function*/ check, /*Function*/ wrap, /*Boolean?*/ directReturn, /*Boolean?*/ override){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- this.pairs[((override) ? "unshift" : "push")]([name, check, wrap, directReturn]);
- },
- match: function(/* ... */){
-
-
-
-
-
- for(var i = 0; i < this.pairs.length; i++){
- var pair = this.pairs[i];
- if(pair[1].apply(this, arguments)){
- if((pair[3])||(this.returnWrappers)){
- return pair[2];
- }else{
- return pair[2].apply(this, arguments);
- }
- }
- }
- throw new Error("No match found");
- },
- unregister: function(name){
-
-
-
-
- for(var i = 0; i < this.pairs.length; i++){
- var pair = this.pairs[i];
- if(pair[0] == name){
- this.pairs.splice(i, 1);
- return true;
- }
- }
- return false;
- }
- });
- }
- if(!dojo._hasResource["dijit._base.place"]){
- dojo._hasResource["dijit._base.place"] = true;
- dojo.provide("dijit._base.place");
- dijit.getViewport = function(){
-
-
- return dojo.window.getBox();
- };
- dijit.placeOnScreen = function(
- /* DomNode */ node,
- /* dijit.__Position */ pos,
- /* String[] */ corners,
- /* dijit.__Position? */ padding){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var choices = dojo.map(corners, function(corner){
- var c = { corner: corner, pos: {x:pos.x,y:pos.y} };
- if(padding){
- c.pos.x += corner.charAt(1) == 'L' ? padding.x : -padding.x;
- c.pos.y += corner.charAt(0) == 'T' ? padding.y : -padding.y;
- }
- return c;
- });
- return dijit._place(node, choices);
- }
- dijit._place = function(/*DomNode*/ node, choices, layoutNode, /*Object*/ aroundNodeCoords){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var view = dojo.window.getBox();
-
-
-
- if(!node.parentNode || String(node.parentNode.tagName).toLowerCase() != "body"){
- dojo.body().appendChild(node);
- }
- var best = null;
- dojo.some(choices, function(choice){
- var corner = choice.corner;
- var pos = choice.pos;
- var overflow = 0;
-
- var spaceAvailable = {
- w: corner.charAt(1) == 'L' ? (view.l + view.w) - pos.x : pos.x - view.l,
- h: corner.charAt(1) == 'T' ? (view.t + view.h) - pos.y : pos.y - view.t
- };
-
-
-
- if(layoutNode){
- var res = layoutNode(node, choice.aroundCorner, corner, spaceAvailable, aroundNodeCoords);
- overflow = typeof res == "undefined" ? 0 : res;
- }
-
- var style = node.style;
- var oldDisplay = style.display;
- var oldVis = style.visibility;
- style.visibility = "hidden";
- style.display = "";
- var mb = dojo.marginBox(node);
- style.display = oldDisplay;
- style.visibility = oldVis;
-
-
- var startX = Math.max(view.l, corner.charAt(1) == 'L' ? pos.x : (pos.x - mb.w)),
- startY = Math.max(view.t, corner.charAt(0) == 'T' ? pos.y : (pos.y - mb.h)),
- endX = Math.min(view.l + view.w, corner.charAt(1) == 'L' ? (startX + mb.w) : pos.x),
- endY = Math.min(view.t + view.h, corner.charAt(0) == 'T' ? (startY + mb.h) : pos.y),
- width = endX - startX,
- height = endY - startY;
- overflow += (mb.w - width) + (mb.h - height);
- if(best == null || overflow < best.overflow){
- best = {
- corner: corner,
- aroundCorner: choice.aroundCorner,
- x: startX,
- y: startY,
- w: width,
- h: height,
- overflow: overflow,
- spaceAvailable: spaceAvailable
- };
- }
-
- return !overflow;
- });
-
-
- if(best.overflow && layoutNode){
- layoutNode(node, best.aroundCorner, best.corner, best.spaceAvailable, aroundNodeCoords);
- }
-
-
-
-
-
-
-
- var l = dojo._isBodyLtr(),
- s = node.style;
- s.top = best.y + "px";
- s[l ? "left" : "right"] = (l ? best.x : view.w - best.x - best.w) + "px";
- s[l ? "right" : "left"] = "auto";
- return best;
- }
- dijit.placeOnScreenAroundNode = function(
- /* DomNode */ node,
- /* DomNode */ aroundNode,
- /* Object */ aroundCorners,
- /* Function? */ layoutNode){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- aroundNode = dojo.byId(aroundNode);
- var aroundNodePos = dojo.position(aroundNode, true);
-
- return dijit._placeOnScreenAroundRect(node,
- aroundNodePos.x, aroundNodePos.y, aroundNodePos.w, aroundNodePos.h,
- aroundCorners, layoutNode);
- };
- dijit.placeOnScreenAroundRectangle = function(
- /* DomNode */ node,
- /* dijit.__Rectangle */ aroundRect,
- /* Object */ aroundCorners,
- /* Function */ layoutNode){
-
-
-
-
- return dijit._placeOnScreenAroundRect(node,
- aroundRect.x, aroundRect.y, aroundRect.width, aroundRect.height,
- aroundCorners, layoutNode);
- };
- dijit._placeOnScreenAroundRect = function(
- /* DomNode */ node,
- /* Number */ x,
- /* Number */ y,
- /* Number */ width,
- /* Number */ height,
- /* Object */ aroundCorners,
- /* Function */ layoutNode){
-
-
-
-
-
- var choices = [];
- for(var nodeCorner in aroundCorners){
- choices.push( {
- aroundCorner: nodeCorner,
- corner: aroundCorners[nodeCorner],
- pos: {
- x: x + (nodeCorner.charAt(1) == 'L' ? 0 : width),
- y: y + (nodeCorner.charAt(0) == 'T' ? 0 : height)
- }
- });
- }
- return dijit._place(node, choices, layoutNode, {w: width, h: height});
- };
- dijit.placementRegistry= new dojo.AdapterRegistry();
- dijit.placementRegistry.register("node",
- function(n, x){
- return typeof x == "object" &&
- typeof x.offsetWidth != "undefined" && typeof x.offsetHeight != "undefined";
- },
- dijit.placeOnScreenAroundNode);
- dijit.placementRegistry.register("rect",
- function(n, x){
- return typeof x == "object" &&
- "x" in x && "y" in x && "width" in x && "height" in x;
- },
- dijit.placeOnScreenAroundRectangle);
- dijit.placeOnScreenAroundElement = function(
- /* DomNode */ node,
- /* Object */ aroundElement,
- /* Object */ aroundCorners,
- /* Function */ layoutNode){
-
-
-
- return dijit.placementRegistry.match.apply(dijit.placementRegistry, arguments);
- };
- dijit.getPopupAroundAlignment = function(/*Array*/ position, /*Boolean*/ leftToRight){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var align = {};
- dojo.forEach(position, function(pos){
- switch(pos){
- case "after":
- align[leftToRight ? "BR" : "BL"] = leftToRight ? "BL" : "BR";
- break;
- case "before":
- align[leftToRight ? "BL" : "BR"] = leftToRight ? "BR" : "BL";
- break;
- case "below-alt":
- leftToRight = !leftToRight;
-
- case "below":
-
- align[leftToRight ? "BL" : "BR"] = leftToRight ? "TL" : "TR";
- align[leftToRight ? "BR" : "BL"] = leftToRight ? "TR" : "TL";
- break;
- case "above-alt":
- leftToRight = !leftToRight;
-
- case "above":
- default:
-
- align[leftToRight ? "TL" : "TR"] = leftToRight ? "BL" : "BR";
- align[leftToRight ? "TR" : "TL"] = leftToRight ? "BR" : "BL";
- break;
- }
- });
- return align;
- };
- }
- if(!dojo._hasResource["dijit._base.window"]){
- dojo._hasResource["dijit._base.window"] = true;
- dojo.provide("dijit._base.window");
- dijit.getDocumentWindow = function(doc){
- return dojo.window.get(doc);
- };
- }
- if(!dojo._hasResource["dijit._base.popup"]){
- dojo._hasResource["dijit._base.popup"] = true;
- dojo.provide("dijit._base.popup");
- dijit.popup = {
-
-
-
-
-
- _stack: [],
-
-
-
-
- _beginZIndex: 1000,
- _idGen: 1,
- _createWrapper: function(/*Widget || DomNode*/ widget){
-
-
-
-
- var node = widget.domNode || widget,
- wrapper = widget.declaredClass ? widget._popupWrapper :
- node.parentNode && dojo.hasClass(node.parentNode, "dijitPopup") ? node.parentNode : null;
- if(!wrapper){
-
-
-
- wrapper = dojo.create("div",{
- "class":"dijitPopup",
- style:{ display: "none"},
- role: "presentation"
- }, dojo.body());
- wrapper.appendChild(node);
- var s = node.style;
- s.display = "";
- s.visibility = "";
- s.position = "";
- s.top = "0px";
- if(widget.declaredClass){
- widget._popupWrapper = wrapper;
- dojo.connect(widget, "destroy", function(){
- dojo.destroy(wrapper);
- delete widget._popupWrapper;
- });
- }
- }
-
- return wrapper;
- },
- moveOffScreen: function(/*Widget || DomNode*/ widget){
-
-
-
-
-
-
- var wrapper = this._createWrapper(widget);
- dojo.style(wrapper, {
- visibility: "hidden",
- top: "-9999px",
- display: ""
- });
- },
- hide: function(/*dijit._Widget*/ widget){
-
-
-
-
-
-
-
-
-
- var wrapper = this._createWrapper(widget);
- dojo.style(wrapper, "display", "none");
- },
-
- getTopPopup: function(){
-
-
-
- var stack = this._stack;
- for(var pi=stack.length-1; pi > 0 && stack[pi].parent === stack[pi-1].widget; pi--){
-
- }
- return stack[pi];
- },
- open: function(/*dijit.popup.__OpenArgs*/ args){
-
-
-
-
-
-
-
-
-
-
-
-
-
- var stack = this._stack,
- widget = args.popup,
- orient = args.orient || (
- (args.parent ? args.parent.isLeftToRight() : dojo._isBodyLtr()) ?
- {'BL':'TL', 'BR':'TR', 'TL':'BL', 'TR':'BR'} :
- {'BR':'TR', 'BL':'TL', 'TR':'BR', 'TL':'BL'}
- ),
- around = args.around,
- id = (args.around && args.around.id) ? (args.around.id+"_dropdown") : ("popup_"+this._idGen++);
-
-
-
- while(stack.length && (!args.parent || !dojo.isDescendant(args.parent.domNode, stack[stack.length-1].widget.domNode))){
- dijit.popup.close(stack[stack.length-1].widget);
- }
-
- var wrapper = this._createWrapper(widget);
- dojo.attr(wrapper, {
- id: id,
- style: {
- zIndex: this._beginZIndex + stack.length
- },
- "class": "dijitPopup " + (widget.baseClass || widget["class"] || "").split(" ")[0] +"Popup",
- dijitPopupParent: args.parent ? args.parent.id : ""
- });
- if(dojo.isIE || dojo.isMoz){
- if(!widget.bgIframe){
-
- widget.bgIframe = new dijit.BackgroundIframe(wrapper);
- }
- }
-
- var best = around ?
- dijit.placeOnScreenAroundElement(wrapper, around, orient, widget.orient ? dojo.hitch(widget, "orient") : null) :
- dijit.placeOnScreen(wrapper, args, orient == 'R' ? ['TR','BR','TL','BL'] : ['TL','BL','TR','BR'], args.padding);
- wrapper.style.display = "";
- wrapper.style.visibility = "visible";
- widget.domNode.style.visibility = "visible";
- var handlers = [];
-
-
- handlers.push(dojo.connect(wrapper, "onkeypress", this, function(evt){
- if(evt.charOrCode == dojo.keys.ESCAPE && args.onCancel){
- dojo.stopEvent(evt);
- args.onCancel();
- }else if(evt.charOrCode === dojo.keys.TAB){
- dojo.stopEvent(evt);
- var topPopup = this.getTopPopup();
- if(topPopup && topPopup.onCancel){
- topPopup.onCancel();
- }
- }
- }));
-
-
- if(widget.onCancel){
- handlers.push(dojo.connect(widget, "onCancel", args.onCancel));
- }
- handlers.push(dojo.connect(widget, widget.onExecute ? "onExecute" : "onChange", this, function(){
- var topPopup = this.getTopPopup();
- if(topPopup && topPopup.onExecute){
- topPopup.onExecute();
- }
- }));
- stack.push({
- widget: widget,
- parent: args.parent,
- onExecute: args.onExecute,
- onCancel: args.onCancel,
- onClose: args.onClose,
- handlers: handlers
- });
- if(widget.onOpen){
-
- widget.onOpen(best);
- }
- return best;
- },
- close: function(/*dijit._Widget?*/ popup){
-
-
-
- var stack = this._stack;
-
-
-
-
-
- while((popup && dojo.some(stack, function(elem){return elem.widget == popup;})) ||
- (!popup && stack.length)){
- var top = stack.pop(),
- widget = top.widget,
- onClose = top.onClose;
- if(widget.onClose){
-
- widget.onClose();
- }
- dojo.forEach(top.handlers, dojo.disconnect);
-
- if(widget && widget.domNode){
- this.hide(widget);
- }
-
- if(onClose){
- onClose();
- }
- }
- }
- };
- dijit._frames = new function(){
-
-
- var queue = [];
- this.pop = function(){
- var iframe;
- if(queue.length){
- iframe = queue.pop();
- iframe.style.display="";
- }else{
- if(dojo.isIE < 9){
- var burl = dojo.config["dojoBlankHtmlUrl"] || (dojo.moduleUrl("dojo", "resources/blank.html")+"") || "javascript:\"\"";
- var html="<iframe src='" + burl + "'"
- + " style='position: absolute; left: 0px; top: 0px;"
- + "z-index: -1; filter:Alpha(Opacity=\"0\");'>";
- iframe = dojo.doc.createElement(html);
- }else{
- iframe = dojo.create("iframe");
- iframe.src = 'javascript:""';
- iframe.className = "dijitBackgroundIframe";
- dojo.style(iframe, "opacity", 0.1);
- }
- iframe.tabIndex = -1;
- dijit.setWaiRole(iframe,"presentation");
- }
- return iframe;
- };
- this.push = function(iframe){
- iframe.style.display="none";
- queue.push(iframe);
- }
- }();
- dijit.BackgroundIframe = function(/*DomNode*/ node){
-
-
-
-
-
-
-
- if(!node.id){ throw new Error("no id"); }
- if(dojo.isIE || dojo.isMoz){
- var iframe = (this.iframe = dijit._frames.pop());
- node.appendChild(iframe);
- if(dojo.isIE<7 || dojo.isQuirks){
- this.resize(node);
- this._conn = dojo.connect(node, 'onresize', this, function(){
- this.resize(node);
- });
- }else{
- dojo.style(iframe, {
- width: '100%',
- height: '100%'
- });
- }
- }
- };
- dojo.extend(dijit.BackgroundIframe, {
- resize: function(node){
-
-
-
- if(this.iframe){
- dojo.style(this.iframe, {
- width: node.offsetWidth + 'px',
- height: node.offsetHeight + 'px'
- });
- }
- },
- destroy: function(){
-
-
- if(this._conn){
- dojo.disconnect(this._conn);
- this._conn = null;
- }
- if(this.iframe){
- dijit._frames.push(this.iframe);
- delete this.iframe;
- }
- }
- });
- }
- if(!dojo._hasResource["dijit._base.scroll"]){
- dojo._hasResource["dijit._base.scroll"] = true;
- dojo.provide("dijit._base.scroll");
- dijit.scrollIntoView = function(/*DomNode*/ node, /*Object?*/ pos){
-
-
-
-
- dojo.window.scrollIntoView(node, pos);
- };
- }
- if(!dojo._hasResource["dojo.uacss"]){
- dojo._hasResource["dojo.uacss"] = true;
- dojo.provide("dojo.uacss");
- (function(){
-
-
-
-
-
-
-
-
-
- var d = dojo,
- html = d.doc.documentElement,
- ie = d.isIE,
- opera = d.isOpera,
- maj = Math.floor,
- ff = d.isFF,
- boxModel = d.boxModel.replace(/-/,''),
- classes = {
- dj_quirks: d.isQuirks,
-
- dj_opera: opera,
- dj_khtml: d.isKhtml,
- dj_webkit: d.isWebKit,
- dj_safari: d.isSafari,
- dj_chrome: d.isChrome,
- dj_gecko: d.isMozilla
- };
- if(ie){
- classes["dj_ie"] = true;
- classes["dj_ie" + maj(ie)] = true;
- classes["dj_iequirks"] = d.isQuirks;
- }
- if(ff){
- classes["dj_ff" + maj(ff)] = true;
- }
- classes["dj_" + boxModel] = true;
-
- var classStr = "";
- for(var clz in classes){
- if(classes[clz]){
- classStr += clz + " ";
- }
- }
- html.className = d.trim(html.className + " " + classStr);
-
-
-
- dojo._loaders.unshift(function(){
- if(!dojo._isBodyLtr()){
- var rtlClassStr = "dj_rtl dijitRtl " + classStr.replace(/ /g, "-rtl ")
- html.className = d.trim(html.className + " " + rtlClassStr);
- }
- });
- })();
- }
- if(!dojo._hasResource["dijit._base.sniff"]){
- dojo._hasResource["dijit._base.sniff"] = true;
- dojo.provide("dijit._base.sniff");
- }
- if(!dojo._hasResource["dijit._base.typematic"]){
- dojo._hasResource["dijit._base.typematic"] = true;
- dojo.provide("dijit._base.typematic");
- dijit.typematic = {
-
-
-
-
-
- _fireEventAndReload: function(){
- this._timer = null;
- this._callback(++this._count, this._node, this._evt);
-
-
-
- this._currentTimeout = Math.max(
- this._currentTimeout < 0 ? this._initialDelay :
- (this._subsequentDelay > 1 ? this._subsequentDelay : Math.round(this._currentTimeout * this._subsequentDelay)),
- this._minDelay);
- this._timer = setTimeout(dojo.hitch(this, "_fireEventAndReload"), this._currentTimeout);
- },
- trigger: function(/*Event*/ evt, /*Object*/ _this, /*DOMNode*/ node, /*Function*/ callback, /*Object*/ obj, /*Number*/ subsequentDelay, /*Number*/ initialDelay, /*Number?*/ minDelay){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(obj != this._obj){
- this.stop();
- this._initialDelay = initialDelay || 500;
- this._subsequentDelay = subsequentDelay || 0.90;
- this._minDelay = minDelay || 10;
- this._obj = obj;
- this._evt = evt;
- this._node = node;
- this._currentTimeout = -1;
- this._count = -1;
- this._callback = dojo.hitch(_this, callback);
- this._fireEventAndReload();
- this._evt = dojo.mixin({faux: true}, evt);
- }
- },
- stop: function(){
-
-
- if(this._timer){
- clearTimeout(this._timer);
- this._timer = null;
- }
- if(this._obj){
- this._callback(-1, this._node, this._evt);
- this._obj = null;
- }
- },
- addKeyListener: function(/*DOMNode*/ node, /*Object*/ keyObject, /*Object*/ _this, /*Function*/ callback, /*Number*/ subsequentDelay, /*Number*/ initialDelay, /*Number?*/ minDelay){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(keyObject.keyCode){
- keyObject.charOrCode = keyObject.keyCode;
- dojo.deprecated("keyCode attribute parameter for dijit.typematic.addKeyListener is deprecated. Use charOrCode instead.", "", "2.0");
- }else if(keyObject.charCode){
- keyObject.charOrCode = String.fromCharCode(keyObject.charCode);
- dojo.deprecated("charCode attribute parameter for dijit.typematic.addKeyListener is deprecated. Use charOrCode instead.", "", "2.0");
- }
- return [
- dojo.connect(node, "onkeypress", this, function(evt){
- if(evt.charOrCode == keyObject.charOrCode &&
- (keyObject.ctrlKey === undefined || keyObject.ctrlKey == evt.ctrlKey) &&
- (keyObject.altKey === undefined || keyObject.altKey == evt.altKey) &&
- (keyObject.metaKey === undefined || keyObject.metaKey == (evt.metaKey || false)) &&
- (keyObject.shiftKey === undefined || keyObject.shiftKey == evt.shiftKey)){
- dojo.stopEvent(evt);
- dijit.typematic.trigger(evt, _this, node, callback, keyObject, subsequentDelay, initialDelay, minDelay);
- }else if(dijit.typematic._obj == keyObject){
- dijit.typematic.stop();
- }
- }),
- dojo.connect(node, "onkeyup", this, function(evt){
- if(dijit.typematic._obj == keyObject){
- dijit.typematic.stop();
- }
- })
- ];
- },
- addMouseListener: function(/*DOMNode*/ node, /*Object*/ _this, /*Function*/ callback, /*Number*/ subsequentDelay, /*Number*/ initialDelay, /*Number?*/ minDelay){
-
-
-
-
-
- var dc = dojo.connect;
- return [
- dc(node, "mousedown", this, function(evt){
- dojo.stopEvent(evt);
- dijit.typematic.trigger(evt, _this, node, callback, node, subsequentDelay, initialDelay, minDelay);
- }),
- dc(node, "mouseup", this, function(evt){
- dojo.stopEvent(evt);
- dijit.typematic.stop();
- }),
- dc(node, "mouseout", this, function(evt){
- dojo.stopEvent(evt);
- dijit.typematic.stop();
- }),
- dc(node, "mousemove", this, function(evt){
- evt.preventDefault();
- }),
- dc(node, "dblclick", this, function(evt){
- dojo.stopEvent(evt);
- if(dojo.isIE < 9){
- dijit.typematic.trigger(evt, _this, node, callback, node, subsequentDelay, initialDelay, minDelay);
- setTimeout(dojo.hitch(this, dijit.typematic.stop), 50);
- }
- })
- ];
- },
- addListener: function(/*Node*/ mouseNode, /*Node*/ keyNode, /*Object*/ keyObject, /*Object*/ _this, /*Function*/ callback, /*Number*/ subsequentDelay, /*Number*/ initialDelay, /*Number?*/ minDelay){
-
-
-
-
-
-
-
-
-
-
- return this.addKeyListener(keyNode, keyObject, _this, callback, subsequentDelay, initialDelay, minDelay).concat(
- this.addMouseListener(mouseNode, _this, callback, subsequentDelay, initialDelay, minDelay));
- }
- };
- }
- if(!dojo._hasResource["dijit._base.wai"]){
- dojo._hasResource["dijit._base.wai"] = true;
- dojo.provide("dijit._base.wai");
- dijit.wai = {
- onload: function(){
-
-
-
-
-
-
-
- var div = dojo.create("div",{
- id: "a11yTestNode",
- style:{
- cssText:'border: 1px solid;'
- + 'border-color:red green;'
- + 'position: absolute;'
- + 'height: 5px;'
- + 'top: -999px;'
- + 'background-image: url("' + (dojo.config.blankGif || dojo.moduleUrl("dojo", "resources/blank.gif")) + '");'
- }
- }, dojo.body());
-
- var cs = dojo.getComputedStyle(div);
- if(cs){
- var bkImg = cs.backgroundImage;
- var needsA11y = (cs.borderTopColor == cs.borderRightColor) || (bkImg != null && (bkImg == "none" || bkImg == "url(invalid-url:)" ));
- dojo[needsA11y ? "addClass" : "removeClass"](dojo.body(), "dijit_a11y");
- if(dojo.isIE){
- div.outerHTML = "";
- }else{
- dojo.body().removeChild(div);
- }
- }
- }
- };
- if(dojo.isIE || dojo.isMoz){
- dojo._loaders.unshift(dijit.wai.onload);
- }
- dojo.mixin(dijit, {
- hasWaiRole: function(/*Element*/ elem, /*String?*/ role){
-
-
-
-
-
-
- var waiRole = this.getWaiRole(elem);
- return role ? (waiRole.indexOf(role) > -1) : (waiRole.length > 0);
- },
- getWaiRole: function(/*Element*/ elem){
-
-
-
-
-
- return dojo.trim((dojo.attr(elem, "role") || "").replace("wairole:",""));
- },
- setWaiRole: function(/*Element*/ elem, /*String*/ role){
-
-
-
-
- dojo.attr(elem, "role", role);
- },
- removeWaiRole: function(/*Element*/ elem, /*String*/ role){
-
-
-
- var roleValue = dojo.attr(elem, "role");
- if(!roleValue){ return; }
- if(role){
- var t = dojo.trim((" " + roleValue + " ").replace(" " + role + " ", " "));
- dojo.attr(elem, "role", t);
- }else{
- elem.removeAttribute("role");
- }
- },
- hasWaiState: function(/*Element*/ elem, /*String*/ state){
-
-
-
-
-
-
-
- return elem.hasAttribute ? elem.hasAttribute("aria-"+state) : !!elem.getAttribute("aria-"+state);
- },
- getWaiState: function(/*Element*/ elem, /*String*/ state){
-
-
-
-
-
-
-
- return elem.getAttribute("aria-"+state) || "";
- },
- setWaiState: function(/*Element*/ elem, /*String*/ state, /*String*/ value){
-
-
-
-
- elem.setAttribute("aria-"+state, value);
- },
- removeWaiState: function(/*Element*/ elem, /*String*/ state){
-
-
-
-
- elem.removeAttribute("aria-"+state);
- }
- });
- }
- if(!dojo._hasResource["dijit._base"]){
- dojo._hasResource["dijit._base"] = true;
- dojo.provide("dijit._base");
- }
- if(!dojo._hasResource["dijit._Widget"]){
- dojo._hasResource["dijit._Widget"] = true;
- dojo.provide("dijit._Widget");
- dojo.connect(dojo, "_connect",
- function(/*dijit._Widget*/ widget, /*String*/ event){
- if(widget && dojo.isFunction(widget._onConnect)){
- widget._onConnect(event);
- }
- });
- dijit._connectOnUseEventHandler = function(/*Event*/ event){};
- dijit._lastKeyDownNode = null;
- if(dojo.isIE){
- (function(){
- var keydownCallback = function(evt){
- dijit._lastKeyDownNode = evt.srcElement;
- };
- dojo.doc.attachEvent('onkeydown', keydownCallback);
- dojo.addOnWindowUnload(function(){
- dojo.doc.detachEvent('onkeydown', keydownCallback);
- });
- })();
- }else{
- dojo.doc.addEventListener('keydown', function(evt){
- dijit._lastKeyDownNode = evt.target;
- }, true);
- }
- (function(){
- dojo.declare("dijit._Widget", dijit._WidgetBase, {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- _deferredConnects: {
- onClick: "",
- onDblClick: "",
- onKeyDown: "",
- onKeyPress: "",
- onKeyUp: "",
- onMouseMove: "",
- onMouseDown: "",
- onMouseOut: "",
- onMouseOver: "",
- onMouseLeave: "",
- onMouseEnter: "",
- onMouseUp: ""
- },
- onClick: dijit._connectOnUseEventHandler,
-
- onDblClick: dijit._connectOnUseEventHandler,
-
- onKeyDown: dijit._connectOnUseEventHandler,
-
- onKeyPress: dijit._connectOnUseEventHandler,
-
- onKeyUp: dijit._connectOnUseEventHandler,
-
- onMouseDown: dijit._connectOnUseEventHandler,
-
- onMouseMove: dijit._connectOnUseEventHandler,
-
- onMouseOut: dijit._connectOnUseEventHandler,
-
- onMouseOver: dijit._connectOnUseEventHandler,
-
- onMouseLeave: dijit._connectOnUseEventHandler,
-
- onMouseEnter: dijit._connectOnUseEventHandler,
-
- onMouseUp: dijit._connectOnUseEventHandler,
-
- create: function(/*Object?*/params, /*DomNode|String?*/srcNodeRef){
-
-
-
-
- this._deferredConnects = dojo.clone(this._deferredConnects);
- for(var attr in this.attributeMap){
- delete this._deferredConnects[attr];
- }
- for(attr in this._deferredConnects){
- if(this[attr] !== dijit._connectOnUseEventHandler){
- delete this._deferredConnects[attr];
- }
- }
- this.inherited(arguments);
- if(this.domNode){
-
-
-
- for(attr in this.params){
- this._onConnect(attr);
- }
- }
- },
- _onConnect: function(/*String*/ event){
-
-
-
-
-
-
-
-
- if(event in this._deferredConnects){
- var mapNode = this[this._deferredConnects[event] || 'domNode'];
- this.connect(mapNode, event.toLowerCase(), event);
- delete this._deferredConnects[event];
- }
- },
-
-
-
-
-
- focused: false,
- isFocusable: function(){
-
-
-
- return this.focus && (dojo.style(this.domNode, "display") != "none");
- },
- onFocus: function(){
-
-
-
-
-
-
- },
- onBlur: function(){
-
-
-
-
-
-
-
- },
- _onFocus: function(e){
-
-
-
-
-
- this.onFocus();
- },
- _onBlur: function(){
-
-
-
-
-
- this.onBlur();
- },
-
- setAttribute: function(/*String*/ attr, /*anything*/ value){
-
-
-
-
- dojo.deprecated(this.declaredClass+"::setAttribute(attr, value) is deprecated. Use set() instead.", "", "2.0");
- this.set(attr, value);
- },
- attr: function(/*String|Object*/name, /*Object?*/value){
-
-
-
-
-
-
-
-
-
-
-
-
- if(dojo.config.isDebug){
- var alreadyCalledHash = arguments.callee._ach || (arguments.callee._ach = {}),
- caller = (arguments.callee.caller || "unknown caller").toString();
- if(!alreadyCalledHash[caller]){
- dojo.deprecated(this.declaredClass + "::attr() is deprecated. Use get() or set() instead, called from " +
- caller, "", "2.0");
- alreadyCalledHash[caller] = true;
- }
- }
- var args = arguments.length;
- if(args >= 2 || typeof name === "object"){
- return this.set.apply(this, arguments);
- }else{
- return this.get(name);
- }
- },
-
-
-
-
-
- nodesWithKeyClick: ["input", "button"],
- connect: function(
- /*Object|null*/ obj,
- /*String|Function*/ event,
- /*String|Function*/ method){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var d = dojo,
- dc = d._connect,
- handles = this.inherited(arguments, [obj, event == "ondijitclick" ? "onclick" : event, method]);
- if(event == "ondijitclick"){
-
-
-
- if(d.indexOf(this.nodesWithKeyClick, obj.nodeName.toLowerCase()) == -1){
- var m = d.hitch(this, method);
- handles.push(
- dc(obj, "onkeydown", this, function(e){
-
- if((e.keyCode == d.keys.ENTER || e.keyCode == d.keys.SPACE) &&
- !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey){
-
- dijit._lastKeyDownNode = e.target;
-
-
-
-
- if(!("openDropDown" in this && obj == this._buttonNode)){
- e.preventDefault();
- }
- }
- }),
- dc(obj, "onkeyup", this, function(e){
-
- if( (e.keyCode == d.keys.ENTER || e.keyCode == d.keys.SPACE) &&
- e.target == dijit._lastKeyDownNode &&
- !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey){
-
- dijit._lastKeyDownNode = null;
- return m(e);
- }
- })
- );
- }
- }
- return handles;
- },
-
- _onShow: function(){
-
-
-
- this.onShow();
- },
- onShow: function(){
-
-
-
-
-
-
-
-
- },
- onHide: function(){
-
-
-
-
-
-
-
-
- },
- onClose: function(){
-
-
-
-
-
-
-
-
-
- return true;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.gfx.matrix"]){
- dojo._hasResource["dojox.gfx.matrix"] = true;
- dojo.provide("dojox.gfx.matrix");
- (function(){
- var m = dojox.gfx.matrix;
-
- var _degToRadCache = {};
- m._degToRad = function(degree){
- return _degToRadCache[degree] || (_degToRadCache[degree] = (Math.PI * degree / 180));
- };
- m._radToDeg = function(radian){ return radian / Math.PI * 180; };
- m.Matrix2D = function(arg){
-
-
-
-
-
- if(arg){
- if(typeof arg == "number"){
- this.xx = this.yy = arg;
- }else if(arg instanceof Array){
- if(arg.length > 0){
- var matrix = m.normalize(arg[0]);
-
- for(var i = 1; i < arg.length; ++i){
- var l = matrix, r = dojox.gfx.matrix.normalize(arg[i]);
- matrix = new m.Matrix2D();
- matrix.xx = l.xx * r.xx + l.xy * r.yx;
- matrix.xy = l.xx * r.xy + l.xy * r.yy;
- matrix.yx = l.yx * r.xx + l.yy * r.yx;
- matrix.yy = l.yx * r.xy + l.yy * r.yy;
- matrix.dx = l.xx * r.dx + l.xy * r.dy + l.dx;
- matrix.dy = l.yx * r.dx + l.yy * r.dy + l.dy;
- }
- dojo.mixin(this, matrix);
- }
- }else{
- dojo.mixin(this, arg);
- }
- }
- };
-
- dojo.extend(m.Matrix2D, {xx: 1, xy: 0, yx: 0, yy: 1, dx: 0, dy: 0});
- dojo.mixin(m, {
-
-
-
-
- identity: new m.Matrix2D(),
-
-
- flipX: new m.Matrix2D({xx: -1}),
-
-
- flipY: new m.Matrix2D({yy: -1}),
-
-
- flipXY: new m.Matrix2D({xx: -1, yy: -1}),
-
- translate: function(a, b){
-
-
-
-
- if(arguments.length > 1){
- return new m.Matrix2D({dx: a, dy: b});
- }
-
-
-
- return new m.Matrix2D({dx: a.x, dy: a.y});
- },
- scale: function(a, b){
-
-
-
-
- if(arguments.length > 1){
- return new m.Matrix2D({xx: a, yy: b});
- }
- if(typeof a == "number"){
-
-
-
- return new m.Matrix2D({xx: a, yy: a});
- }
-
-
-
- return new m.Matrix2D({xx: a.x, yy: a.y});
- },
- rotate: function(angle){
-
-
-
-
- var c = Math.cos(angle);
- var s = Math.sin(angle);
- return new m.Matrix2D({xx: c, xy: -s, yx: s, yy: c});
- },
- rotateg: function(degree){
-
-
-
-
-
- return m.rotate(m._degToRad(degree));
- },
- skewX: function(angle) {
-
-
-
-
- return new m.Matrix2D({xy: Math.tan(angle)});
- },
- skewXg: function(degree){
-
-
-
-
-
- return m.skewX(m._degToRad(degree));
- },
- skewY: function(angle){
-
-
-
-
- return new m.Matrix2D({yx: Math.tan(angle)});
- },
- skewYg: function(degree){
-
-
-
-
-
- return m.skewY(m._degToRad(degree));
- },
- reflect: function(a, b){
-
-
-
-
-
- if(arguments.length == 1){
- b = a.y;
- a = a.x;
- }
-
-
-
-
- var a2 = a * a, b2 = b * b, n2 = a2 + b2, xy = 2 * a * b / n2;
- return new m.Matrix2D({xx: 2 * a2 / n2 - 1, xy: xy, yx: xy, yy: 2 * b2 / n2 - 1});
- },
- project: function(a, b){
-
-
-
-
-
- if(arguments.length == 1){
- b = a.y;
- a = a.x;
- }
-
-
-
-
- var a2 = a * a, b2 = b * b, n2 = a2 + b2, xy = a * b / n2;
- return new m.Matrix2D({xx: a2 / n2, xy: xy, yx: xy, yy: b2 / n2});
- },
-
- normalize: function(matrix){
-
-
-
-
- return (matrix instanceof m.Matrix2D) ? matrix : new m.Matrix2D(matrix);
- },
-
- clone: function(matrix){
-
-
- var obj = new m.Matrix2D();
- for(var i in matrix){
- if(typeof(matrix[i]) == "number" && typeof(obj[i]) == "number" && obj[i] != matrix[i]) obj[i] = matrix[i];
- }
- return obj;
- },
- invert: function(matrix){
-
-
- var M = m.normalize(matrix),
- D = M.xx * M.yy - M.xy * M.yx,
- M = new m.Matrix2D({
- xx: M.yy/D, xy: -M.xy/D,
- yx: -M.yx/D, yy: M.xx/D,
- dx: (M.xy * M.dy - M.yy * M.dx) / D,
- dy: (M.yx * M.dx - M.xx * M.dy) / D
- });
- return M;
- },
- _multiplyPoint: function(matrix, x, y){
-
-
-
-
- return {x: matrix.xx * x + matrix.xy * y + matrix.dx, y: matrix.yx * x + matrix.yy * y + matrix.dy};
- },
- multiplyPoint: function(matrix, /* Number||Point */ a, /* Number, optional */ b){
-
-
-
-
- var M = m.normalize(matrix);
- if(typeof a == "number" && typeof b == "number"){
- return m._multiplyPoint(M, a, b);
- }
-
-
-
-
- return m._multiplyPoint(M, a.x, a.y);
- },
- multiply: function(matrix){
-
-
-
- var M = m.normalize(matrix);
-
- for(var i = 1; i < arguments.length; ++i){
- var l = M, r = m.normalize(arguments[i]);
- M = new m.Matrix2D();
- M.xx = l.xx * r.xx + l.xy * r.yx;
- M.xy = l.xx * r.xy + l.xy * r.yy;
- M.yx = l.yx * r.xx + l.yy * r.yx;
- M.yy = l.yx * r.xy + l.yy * r.yy;
- M.dx = l.xx * r.dx + l.xy * r.dy + l.dx;
- M.dy = l.yx * r.dx + l.yy * r.dy + l.dy;
- }
- return M;
- },
-
- _sandwich: function(matrix, x, y){
-
-
-
-
- return m.multiply(m.translate(x, y), matrix, m.translate(-x, -y));
- },
- scaleAt: function(a, b, c, d){
-
-
-
-
-
-
-
-
-
-
-
- switch(arguments.length){
- case 4:
-
- return m._sandwich(m.scale(a, b), c, d);
- case 3:
- if(typeof c == "number"){
-
-
-
-
-
- return m._sandwich(m.scale(a), b, c);
- }
-
-
-
-
-
- return m._sandwich(m.scale(a, b), c.x, c.y);
- }
-
-
-
-
-
- return m._sandwich(m.scale(a), b.x, b.y);
- },
- rotateAt: function(angle, a, b){
-
-
-
-
-
-
-
-
- if(arguments.length > 2){
- return m._sandwich(m.rotate(angle), a, b);
- }
-
-
-
-
- return m._sandwich(m.rotate(angle), a.x, a.y);
- },
- rotategAt: function(degree, a, b){
-
-
-
-
-
-
-
-
- if(arguments.length > 2){
- return m._sandwich(m.rotateg(degree), a, b);
- }
-
-
-
-
- return m._sandwich(m.rotateg(degree), a.x, a.y);
- },
- skewXAt: function(angle, a, b){
-
-
-
-
-
-
-
-
- if(arguments.length > 2){
- return m._sandwich(m.skewX(angle), a, b);
- }
-
-
-
-
- return m._sandwich(m.skewX(angle), a.x, a.y);
- },
- skewXgAt: function(degree, a, b){
-
-
-
-
-
-
-
-
- if(arguments.length > 2){
- return m._sandwich(m.skewXg(degree), a, b);
- }
-
-
-
-
- return m._sandwich(m.skewXg(degree), a.x, a.y);
- },
- skewYAt: function(angle, a, b){
-
-
-
-
-
-
-
-
- if(arguments.length > 2){
- return m._sandwich(m.skewY(angle), a, b);
- }
-
-
-
-
- return m._sandwich(m.skewY(angle), a.x, a.y);
- },
- skewYgAt: function(/* Number */ degree, /* Number||Point */ a, /* Number, optional */ b){
-
-
-
-
-
-
-
-
- if(arguments.length > 2){
- return m._sandwich(m.skewYg(degree), a, b);
- }
-
-
-
-
- return m._sandwich(m.skewYg(degree), a.x, a.y);
- }
-
- });
- })();
- dojox.gfx.Matrix2D = dojox.gfx.matrix.Matrix2D;
- }
- if(!dojo._hasResource["dojox.gfx._base"]){
- dojo._hasResource["dojox.gfx._base"] = true;
- dojo.provide("dojox.gfx._base");
- (function(){
- var g = dojox.gfx, b = g._base;
-
- g._hasClass = function(/*DomNode*/node, /*String*/classStr){
-
-
-
-
- var cls = node.getAttribute("className");
- return cls && (" " + cls + " ").indexOf(" " + classStr + " ") >= 0;
- };
- g._addClass = function(/*DomNode*/node, /*String*/classStr){
-
-
-
- var cls = node.getAttribute("className") || "";
- if(!cls || (" " + cls + " ").indexOf(" " + classStr + " ") < 0){
- node.setAttribute("className", cls + (cls ? " " : "") + classStr);
- }
- };
- g._removeClass = function(/*DomNode*/node, /*String*/classStr){
-
- var cls = node.getAttribute("className");
- if(cls){
- node.setAttribute(
- "className",
- cls.replace(new RegExp('(^|\\s+)' + classStr + '(\\s+|$)'), "$1$2")
- );
- }
- };
-
-
- b._getFontMeasurements = function(){
-
-
-
- var heights = {
- '1em': 0, '1ex': 0, '100%': 0, '12pt': 0, '16px': 0, 'xx-small': 0,
- 'x-small': 0, 'small': 0, 'medium': 0, 'large': 0, 'x-large': 0,
- 'xx-large': 0
- };
- if(dojo.isIE){
-
-
- dojo.doc.documentElement.style.fontSize="100%";
- }
-
- var div = dojo.create("div", {style: {
- position: "absolute",
- left: "0",
- top: "-100px",
- width: "30px",
- height: "1000em",
- borderWidth: "0",
- margin: "0",
- padding: "0",
- outline: "none",
- lineHeight: "1",
- overflow: "hidden"
- }}, dojo.body());
-
- for(var p in heights){
- div.style.fontSize = p;
- heights[p] = Math.round(div.offsetHeight * 12/16) * 16/12 / 1000;
- }
- dojo.body().removeChild(div);
- return heights;
- };
- var fontMeasurements = null;
- b._getCachedFontMeasurements = function(recalculate){
- if(recalculate || !fontMeasurements){
- fontMeasurements = b._getFontMeasurements();
- }
- return fontMeasurements;
- };
-
- var measuringNode = null, empty = {};
- b._getTextBox = function( /*String*/ text,
- /*Object*/ style,
- /*String?*/ className){
- var m, s, al = arguments.length;
- if(!measuringNode){
- measuringNode = dojo.create("div", {style: {
- position: "absolute",
- top: "-10000px",
- left: "0"
- }}, dojo.body());
- }
- m = measuringNode;
-
- m.className = "";
- s = m.style;
- s.borderWidth = "0";
- s.margin = "0";
- s.padding = "0";
- s.outline = "0";
-
- if(al > 1 && style){
- for(var i in style){
- if(i in empty){ continue; }
- s[i] = style[i];
- }
- }
-
- if(al > 2 && className){
- m.className = className;
- }
-
- m.innerHTML = text;
- if(m["getBoundingClientRect"]){
- var bcr = m.getBoundingClientRect();
- return {l: bcr.left, t: bcr.top, w: bcr.width || (bcr.right - bcr.left), h: bcr.height || (bcr.bottom - bcr.top)};
- }else{
- return dojo.marginBox(m);
- }
- };
-
- var uniqueId = 0;
- b._getUniqueId = function(){
-
- var id;
- do{
- id = dojo._scopeName + "Unique" + (++uniqueId);
- }while(dojo.byId(id));
- return id;
- };
- })();
- dojo.mixin(dojox.gfx, {
-
-
-
- defaultPath: {
- type: "path", path: ""
- },
- defaultPolyline: {
- type: "polyline", points: []
- },
- defaultRect: {
- type: "rect", x: 0, y: 0, width: 100, height: 100, r: 0
- },
- defaultEllipse: {
- type: "ellipse", cx: 0, cy: 0, rx: 200, ry: 100
- },
- defaultCircle: {
- type: "circle", cx: 0, cy: 0, r: 100
- },
- defaultLine: {
- type: "line", x1: 0, y1: 0, x2: 100, y2: 100
- },
- defaultImage: {
- type: "image", x: 0, y: 0, width: 0, height: 0, src: ""
- },
- defaultText: {
- type: "text", x: 0, y: 0, text: "", align: "start",
- decoration: "none", rotated: false, kerning: true
- },
- defaultTextPath: {
- type: "textpath", text: "", align: "start",
- decoration: "none", rotated: false, kerning: true
- },
-
- defaultStroke: {
- type: "stroke", color: "black", style: "solid", width: 1,
- cap: "butt", join: 4
- },
- defaultLinearGradient: {
- type: "linear", x1: 0, y1: 0, x2: 100, y2: 100,
- colors: [
- { offset: 0, color: "black" }, { offset: 1, color: "white" }
- ]
- },
- defaultRadialGradient: {
- type: "radial", cx: 0, cy: 0, r: 100,
- colors: [
- { offset: 0, color: "black" }, { offset: 1, color: "white" }
- ]
- },
- defaultPattern: {
- type: "pattern", x: 0, y: 0, width: 0, height: 0, src: ""
- },
- defaultFont: {
- type: "font", style: "normal", variant: "normal",
- weight: "normal", size: "10pt", family: "serif"
- },
- getDefault: (function(){
- var typeCtorCache = {};
-
- return function(/*String*/ type){
- var t = typeCtorCache[type];
- if(t){
- return new t();
- }
- t = typeCtorCache[type] = new Function;
- t.prototype = dojox.gfx[ "default" + type ];
- return new t();
- }
- })(),
- normalizeColor: function(/*Color*/ color){
-
-
-
- return (color instanceof dojo.Color) ? color : new dojo.Color(color);
- },
- normalizeParameters: function(existed, update){
-
-
-
-
-
-
-
-
- if(update){
- var empty = {};
- for(var x in existed){
- if(x in update && !(x in empty)){
- existed[x] = update[x];
- }
- }
- }
- return existed;
- },
- makeParameters: function(defaults, update){
-
-
-
-
-
-
-
- if(!update){
-
- return dojo.delegate(defaults);
- }
- var result = {};
- for(var i in defaults){
- if(!(i in result)){
- result[i] = dojo.clone((i in update) ? update[i] : defaults[i]);
- }
- }
- return result;
- },
- formatNumber: function(x, addSpace){
-
-
-
- var val = x.toString();
- if(val.indexOf("e") >= 0){
- val = x.toFixed(4);
- }else{
- var point = val.indexOf(".");
- if(point >= 0 && val.length - point > 5){
- val = x.toFixed(4);
- }
- }
- if(x < 0){
- return val;
- }
- return addSpace ? " " + val : val;
- },
-
- makeFontString: function(font){
-
-
- return font.style + " " + font.variant + " " + font.weight + " " + font.size + " " + font.family;
- },
- splitFontString: function(str){
-
-
-
-
-
-
-
-
-
-
- var font = dojox.gfx.getDefault("Font");
- var t = str.split(/\s+/);
- do{
- if(t.length < 5){ break; }
- font.style = t[0];
- font.variant = t[1];
- font.weight = t[2];
- var i = t[3].indexOf("/");
- font.size = i < 0 ? t[3] : t[3].substring(0, i);
- var j = 4;
- if(i < 0){
- if(t[4] == "/"){
- j = 6;
- }else if(t[4].charAt(0) == "/"){
- j = 5;
- }
- }
- if(j < t.length){
- font.family = t.slice(j).join(" ");
- }
- }while(false);
- return font;
- },
-
- cm_in_pt: 72 / 2.54,
- mm_in_pt: 7.2 / 2.54,
- px_in_pt: function(){
-
- return dojox.gfx._base._getCachedFontMeasurements()["12pt"] / 12;
- },
- pt2px: function(len){
-
-
- return len * dojox.gfx.px_in_pt();
- },
- px2pt: function(len){
-
-
- return len / dojox.gfx.px_in_pt();
- },
- normalizedLength: function(len) {
-
-
- if(len.length == 0) return 0;
- if(len.length > 2){
- var px_in_pt = dojox.gfx.px_in_pt();
- var val = parseFloat(len);
- switch(len.slice(-2)){
- case "px": return val;
- case "pt": return val * px_in_pt;
- case "in": return val * 72 * px_in_pt;
- case "pc": return val * 12 * px_in_pt;
- case "mm": return val * dojox.gfx.mm_in_pt * px_in_pt;
- case "cm": return val * dojox.gfx.cm_in_pt * px_in_pt;
- }
- }
- return parseFloat(len);
- },
-
- pathVmlRegExp: /([A-Za-z]+)|(\d+(\.\d+)?)|(\.\d+)|(-\d+(\.\d+)?)|(-\.\d+)/g,
- pathSvgRegExp: /([A-Za-z])|(\d+(\.\d+)?)|(\.\d+)|(-\d+(\.\d+)?)|(-\.\d+)/g,
- equalSources: function(a, b){
-
- return a && b && a == b;
- },
-
- switchTo: function(renderer){
- var ns = dojox.gfx[renderer];
- if(ns){
- dojo.forEach(["Group", "Rect", "Ellipse", "Circle", "Line",
- "Polyline", "Image", "Text", "Path", "TextPath",
- "Surface", "createSurface"], function(name){
- dojox.gfx[name] = ns[name];
- });
- }
- }
- });
- }
- if(!dojo._hasResource["dojox.gfx"]){
- dojo._hasResource["dojox.gfx"] = true;
- dojo.provide("dojox.gfx");
- dojo.loadInit(function(){
-
-
-
- var gfx = dojo.getObject("dojox.gfx", true), sl, flag, match;
- while(!gfx.renderer){
-
-
- if(dojo.config.forceGfxRenderer){
- dojox.gfx.renderer = dojo.config.forceGfxRenderer;
- break;
- }
- var renderers = (typeof dojo.config.gfxRenderer == "string" ?
- dojo.config.gfxRenderer : "svg,vml,canvas,silverlight").split(",");
- for(var i = 0; i < renderers.length; ++i){
- switch(renderers[i]){
- case "svg":
-
- if("SVGAngle" in dojo.global){
- dojox.gfx.renderer = "svg";
- }
- break;
- case "vml":
- if(dojo.isIE){
- dojox.gfx.renderer = "vml";
- }
- break;
- case "silverlight":
- try{
- if(dojo.isIE){
- sl = new ActiveXObject("AgControl.AgControl");
- if(sl && sl.IsVersionSupported("1.0")){
- flag = true;
- }
- }else{
- if(navigator.plugins["Silverlight Plug-In"]){
- flag = true;
- }
- }
- }catch(e){
- flag = false;
- }finally{
- sl = null;
- }
- if(flag){
- dojox.gfx.renderer = "silverlight";
- }
- break;
- case "canvas":
- if(dojo.global.CanvasRenderingContext2D){
- dojox.gfx.renderer = "canvas";
- }
- break;
- }
- if(gfx.renderer){
- break;
- }
- }
- break;
- }
-
- if(dojo.config.isDebug){
- console.log("gfx renderer = " + gfx.renderer);
- }
-
- if(gfx[gfx.renderer]){
-
- gfx.switchTo(gfx.renderer);
- }else{
-
- gfx.loadAndSwitch = gfx.renderer;
- dojo["require"]("dojox.gfx." + gfx.renderer);
- }
- });
- }
- if(!dojo._hasResource["dojox.lang.functional.lambda"]){
- dojo._hasResource["dojox.lang.functional.lambda"] = true;
- dojo.provide("dojox.lang.functional.lambda");
- (function(){
- var df = dojox.lang.functional, lcache = {};
-
- var split = "ab".split(/a*/).length > 1 ? String.prototype.split :
- function(sep){
- var r = this.split.call(this, sep),
- m = sep.exec(this);
- if(m && m.index == 0){ r.unshift(""); }
- return r;
- };
-
- var lambda = function(/*String*/ s){
- var args = [], sects = split.call(s, /\s*->\s*/m);
- if(sects.length > 1){
- while(sects.length){
- s = sects.pop();
- args = sects.pop().split(/\s*,\s*|\s+/m);
- if(sects.length){ sects.push("(function(" + args + "){return (" + s + ")})"); }
- }
- }else if(s.match(/\b_\b/)){
- args = ["_"];
- }else{
- var l = s.match(/^\s*(?:[+*\/%&|\^\.=<>]|!=)/m),
- r = s.match(/[+\-*\/%&|\^\.=<>!]\s*$/m);
- if(l || r){
- if(l){
- args.push("$1");
- s = "$1" + s;
- }
- if(r){
- args.push("$2");
- s = s + "$2";
- }
- }else{
-
-
- var vars = s.
- replace(/(?:\b[A-Z]|\.[a-zA-Z_$])[a-zA-Z_$\d]*|[a-zA-Z_$][a-zA-Z_$\d]*:|this|true|false|null|undefined|typeof|instanceof|in|delete|new|void|arguments|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|escape|eval|isFinite|isNaN|parseFloat|parseInt|unescape|dojo|dijit|dojox|window|document|'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g, "").
- match(/([a-z_$][a-z_$\d]*)/gi) || [], t = {};
- dojo.forEach(vars, function(v){
- if(!(v in t)){
- args.push(v);
- t[v] = 1;
- }
- });
- }
- }
- return {args: args, body: s};
- };
- var compose = function(/*Array*/ a){
- return a.length ?
- function(){
- var i = a.length - 1, x = df.lambda(a[i]).apply(this, arguments);
- for(--i; i >= 0; --i){ x = df.lambda(a[i]).call(this, x); }
- return x;
- }
- :
-
- function(x){ return x; };
- };
- dojo.mixin(df, {
-
- rawLambda: function(/*String*/ s){
-
-
-
-
-
-
-
-
-
- return lambda(s);
- },
- buildLambda: function(/*String*/ s){
-
-
-
-
-
-
-
-
- s = lambda(s);
- return "function(" + s.args.join(",") + "){return (" + s.body + ");}";
- },
- lambda: function(/*Function|String|Array*/ s){
-
-
-
-
-
-
-
-
- if(typeof s == "function"){ return s; }
- if(s instanceof Array){ return compose(s); }
- if(s in lcache){ return lcache[s]; }
- s = lambda(s);
- return lcache[s] = new Function(s.args, "return (" + s.body + ");");
- },
- clearLambdaCache: function(){
-
-
- lcache = {};
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.lang.functional.array"]){
- dojo._hasResource["dojox.lang.functional.array"] = true;
- dojo.provide("dojox.lang.functional.array");
- (function(){
- var d = dojo, df = dojox.lang.functional, empty = {};
- d.mixin(df, {
-
-
- filter: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- var t = [], v, i, n;
- if(d.isArray(a)){
-
- for(i = 0, n = a.length; i < n; ++i){
- v = a[i];
- if(f.call(o, v, i, a)){ t.push(v); }
- }
- }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
-
- for(i = 0; a.hasNext();){
- v = a.next();
- if(f.call(o, v, i++, a)){ t.push(v); }
- }
- }else{
-
- for(i in a){
- if(!(i in empty)){
- v = a[i];
- if(f.call(o, v, i, a)){ t.push(v); }
- }
- }
- }
- return t;
- },
- forEach: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- var i, n;
- if(d.isArray(a)){
-
- for(i = 0, n = a.length; i < n; f.call(o, a[i], i, a), ++i);
- }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
-
- for(i = 0; a.hasNext(); f.call(o, a.next(), i++, a));
- }else{
-
- for(i in a){
- if(!(i in empty)){
- f.call(o, a[i], i, a);
- }
- }
- }
- return o;
- },
- map: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- var t, n, i;
- if(d.isArray(a)){
-
- t = new Array(n = a.length);
- for(i = 0; i < n; t[i] = f.call(o, a[i], i, a), ++i);
- }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
-
- t = [];
- for(i = 0; a.hasNext(); t.push(f.call(o, a.next(), i++, a)));
- }else{
-
- t = [];
- for(i in a){
- if(!(i in empty)){
- t.push(f.call(o, a[i], i, a));
- }
- }
- }
- return t;
- },
- every: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- var i, n;
- if(d.isArray(a)){
-
- for(i = 0, n = a.length; i < n; ++i){
- if(!f.call(o, a[i], i, a)){
- return false;
- }
- }
- }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
-
- for(i = 0; a.hasNext();){
- if(!f.call(o, a.next(), i++, a)){
- return false;
- }
- }
- }else{
-
- for(i in a){
- if(!(i in empty)){
- if(!f.call(o, a[i], i, a)){
- return false;
- }
- }
- }
- }
- return true;
- },
- some: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- var i, n;
- if(d.isArray(a)){
-
- for(i = 0, n = a.length; i < n; ++i){
- if(f.call(o, a[i], i, a)){
- return true;
- }
- }
- }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
-
- for(i = 0; a.hasNext();){
- if(f.call(o, a.next(), i++, a)){
- return true;
- }
- }
- }else{
-
- for(i in a){
- if(!(i in empty)){
- if(f.call(o, a[i], i, a)){
- return true;
- }
- }
- }
- }
- return false;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.lang.functional.object"]){
- dojo._hasResource["dojox.lang.functional.object"] = true;
- dojo.provide("dojox.lang.functional.object");
- (function(){
- var d = dojo, df = dojox.lang.functional, empty = {};
- d.mixin(df, {
-
- keys: function(/*Object*/ obj){
-
- var t = [];
- for(var i in obj){
- if(!(i in empty)){
- t.push(i);
- }
- }
- return t;
- },
- values: function(/*Object*/ obj){
-
- var t = [];
- for(var i in obj){
- if(!(i in empty)){
- t.push(obj[i]);
- }
- }
- return t;
- },
- filterIn: function(/*Object*/ obj, /*Function|String|Array*/ f, /*Object?*/ o){
-
-
- o = o || d.global; f = df.lambda(f);
- var t = {}, v, i;
- for(i in obj){
- if(!(i in empty)){
- v = obj[i];
- if(f.call(o, v, i, obj)){ t[i] = v; }
- }
- }
- return t;
- },
- forIn: function(/*Object*/ obj, /*Function|String|Array*/ f, /*Object?*/ o){
-
- o = o || d.global; f = df.lambda(f);
- for(var i in obj){
- if(!(i in empty)){
- f.call(o, obj[i], i, obj);
- }
- }
- return o;
- },
- mapIn: function(/*Object*/ obj, /*Function|String|Array*/ f, /*Object?*/ o){
-
-
- o = o || d.global; f = df.lambda(f);
- var t = {}, i;
- for(i in obj){
- if(!(i in empty)){
- t[i] = f.call(o, obj[i], i, obj);
- }
- }
- return t;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.lang.functional"]){
- dojo._hasResource["dojox.lang.functional"] = true;
- dojo.provide("dojox.lang.functional");
- }
- if(!dojo._hasResource["dojox.lang.functional.fold"]){
- dojo._hasResource["dojox.lang.functional.fold"] = true;
- dojo.provide("dojox.lang.functional.fold");
- (function(){
- var d = dojo, df = dojox.lang.functional, empty = {};
- d.mixin(df, {
-
- foldl: function(/*Array|String|Object*/ a, /*Function*/ f, /*Object*/ z, /*Object?*/ o){
-
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- var i, n;
- if(d.isArray(a)){
-
- for(i = 0, n = a.length; i < n; z = f.call(o, z, a[i], i, a), ++i);
- }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
-
- for(i = 0; a.hasNext(); z = f.call(o, z, a.next(), i++, a));
- }else{
-
- for(i in a){
- if(!(i in empty)){
- z = f.call(o, z, a[i], i, a);
- }
- }
- }
- return z;
- },
- foldl1: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- var z, i, n;
- if(d.isArray(a)){
-
- z = a[0];
- for(i = 1, n = a.length; i < n; z = f.call(o, z, a[i], i, a), ++i);
- }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
-
- if(a.hasNext()){
- z = a.next();
- for(i = 1; a.hasNext(); z = f.call(o, z, a.next(), i++, a));
- }
- }else{
-
- var first = true;
- for(i in a){
- if(!(i in empty)){
- if(first){
- z = a[i];
- first = false;
- }else{
- z = f.call(o, z, a[i], i, a);
- }
- }
- }
- }
- return z;
- },
- foldr: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){
-
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- for(var i = a.length; i > 0; --i, z = f.call(o, z, a[i], i, a));
- return z;
- },
- foldr1: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- var n = a.length, z = a[n - 1], i = n - 1;
- for(; i > 0; --i, z = f.call(o, z, a[i], i, a));
- return z;
- },
-
- reduce: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ z){
-
-
- return arguments.length < 3 ? df.foldl1(a, f) : df.foldl(a, f, z);
- },
- reduceRight: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ z){
-
-
- return arguments.length < 3 ? df.foldr1(a, f) : df.foldr(a, f, z);
- },
-
- unfold: function(/*Function|String|Array*/ pr, /*Function|String|Array*/ f,
- /*Function|String|Array*/ g, /*Object*/ z, /*Object?*/ o){
-
- o = o || d.global; f = df.lambda(f); g = df.lambda(g); pr = df.lambda(pr);
- var t = [];
- for(; !pr.call(o, z); t.push(f.call(o, z)), z = g.call(o, z));
- return t;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.lang.functional.reversed"]){
- dojo._hasResource["dojox.lang.functional.reversed"] = true;
- dojo.provide("dojox.lang.functional.reversed");
- (function(){
- var d = dojo, df = dojox.lang.functional;
- d.mixin(df, {
-
-
- filterRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- var t = [], v, i = a.length - 1;
- for(; i >= 0; --i){
- v = a[i];
- if(f.call(o, v, i, a)){ t.push(v); }
- }
- return t;
- },
- forEachRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- for(var i = a.length - 1; i >= 0; f.call(o, a[i], i, a), --i);
- },
- mapRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- var n = a.length, t = new Array(n), i = n - 1, j = 0;
- for(; i >= 0; t[j++] = f.call(o, a[i], i, a), --i);
- return t;
- },
- everyRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- for(var i = a.length - 1; i >= 0; --i){
- if(!f.call(o, a[i], i, a)){
- return false;
- }
- }
- return true;
- },
- someRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- for(var i = a.length - 1; i >= 0; --i){
- if(f.call(o, a[i], i, a)){
- return true;
- }
- }
- return false;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.Element"]){
- dojo._hasResource["dojox.charting.Element"] = true;
- dojo.provide("dojox.charting.Element");
- dojo.declare("dojox.charting.Element", null, {
-
-
-
-
-
-
-
-
-
-
-
- chart: null,
- group: null,
- htmlElements: null,
- dirty: true,
- constructor: function(chart){
-
-
-
-
- this.chart = chart;
- this.group = null;
- this.htmlElements = [];
- this.dirty = true;
- this.trailingSymbol = "...";
- this._events = [];
- },
- createGroup: function(creator){
-
-
-
-
-
-
- if(!creator){ creator = this.chart.surface; }
- if(!this.group){
- this.group = creator.createGroup();
- }
- return this;
- },
- purgeGroup: function(){
-
-
-
-
- this.destroyHtmlElements();
- if(this.group){
- this.group.clear();
- this.group.removeShape();
- this.group = null;
- }
- this.dirty = true;
- if(this._events.length){
- dojo.forEach(this._events, function(item){
- item.shape.disconnect(item.handle);
- });
- this._events = [];
- }
- return this;
- },
- cleanGroup: function(creator){
-
-
-
-
-
-
- this.destroyHtmlElements();
- if(!creator){ creator = this.chart.surface; }
- if(this.group){
- this.group.clear();
- }else{
- this.group = creator.createGroup();
- }
- this.dirty = true;
- return this;
- },
- destroyHtmlElements: function(){
-
-
- if(this.htmlElements.length){
- dojo.forEach(this.htmlElements, dojo.destroy);
- this.htmlElements = [];
- }
- },
- destroy: function(){
-
-
- this.purgeGroup();
- },
-
- getTextWidth: function(s, font){
- return dojox.gfx._base._getTextBox(s, {font: font}).w || 0;
- },
- getTextWithLimitLength: function(s, font, limitWidth, truncated){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (!s || s.length <= 0) {
- return {
- text: "",
- truncated: truncated || false
- };
- }
- if(!limitWidth || limitWidth <= 0){
- return {
- text: s,
- truncated: truncated || false
- };
- }
- var delta = 2,
-
- trucPercentage = 0.618,
- minStr = s.substring(0,1) + this.trailingSymbol,
- minWidth = this.getTextWidth(minStr, font);
- if (limitWidth <= minWidth) {
- return {
- text: minStr,
- truncated: true
- };
- }
- var width = this.getTextWidth(s, font);
- if(width <= limitWidth){
- return {
- text: s,
- truncated: truncated || false
- };
- }else{
- var begin = 0,
- end = s.length;
- while(begin < end){
- if(end - begin <= delta ){
- while (this.getTextWidth(s.substring(0, begin) + this.trailingSymbol, font) > limitWidth) {
- begin -= 1;
- }
- return {
- text: (s.substring(0,begin) + this.trailingSymbol),
- truncated: true
- };
- }
- var index = begin + Math.round((end - begin) * trucPercentage),
- widthIntercepted = this.getTextWidth(s.substring(0, index), font);
- if(widthIntercepted < limitWidth){
- begin = index;
- end = end;
- }else{
- begin = begin;
- end = index;
- }
- }
- }
- },
- getTextWithLimitCharCount: function(s, font, wcLimit, truncated){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (!s || s.length <= 0) {
- return {
- text: "",
- truncated: truncated || false
- };
- }
- if(!wcLimit || wcLimit <= 0 || s.length <= wcLimit){
- return {
- text: s,
- truncated: truncated || false
- };
- }
- return {
- text: s.substring(0, wcLimit) + this.trailingSymbol,
- truncated: true
- };
- },
-
- _plotFill: function(fill, dim, offsets){
-
- if(!fill || !fill.type || !fill.space){
- return fill;
- }
- var space = fill.space;
- switch(fill.type){
- case "linear":
- if(space === "plot" || space === "shapeX" || space === "shapeY"){
-
- fill = dojox.gfx.makeParameters(dojox.gfx.defaultLinearGradient, fill);
- fill.space = space;
-
- if(space === "plot" || space === "shapeX"){
-
- var span = dim.height - offsets.t - offsets.b;
- fill.y1 = offsets.t + span * fill.y1 / 100;
- fill.y2 = offsets.t + span * fill.y2 / 100;
- }
- if(space === "plot" || space === "shapeY"){
-
- var span = dim.width - offsets.l - offsets.r;
- fill.x1 = offsets.l + span * fill.x1 / 100;
- fill.x2 = offsets.l + span * fill.x2 / 100;
- }
- }
- break;
- case "radial":
- if(space === "plot"){
-
-
- fill = dojox.gfx.makeParameters(dojox.gfx.defaultRadialGradient, fill);
- fill.space = space;
-
- var spanX = dim.width - offsets.l - offsets.r,
- spanY = dim.height - offsets.t - offsets.b;
- fill.cx = offsets.l + spanX * fill.cx / 100;
- fill.cy = offsets.t + spanY * fill.cy / 100;
- fill.r = fill.r * Math.sqrt(spanX * spanX + spanY * spanY) / 200;
- }
- break;
- case "pattern":
- if(space === "plot" || space === "shapeX" || space === "shapeY"){
-
- fill = dojox.gfx.makeParameters(dojox.gfx.defaultPattern, fill);
- fill.space = space;
-
- if(space === "plot" || space === "shapeX"){
-
- var span = dim.height - offsets.t - offsets.b;
- fill.y = offsets.t + span * fill.y / 100;
- fill.height = span * fill.height / 100;
- }
- if(space === "plot" || space === "shapeY"){
-
- var span = dim.width - offsets.l - offsets.r;
- fill.x = offsets.l + span * fill.x / 100;
- fill.width = span * fill.width / 100;
- }
- }
- break;
- }
- return fill;
- },
- _shapeFill: function(fill, bbox){
-
- if(!fill || !fill.space){
- return fill;
- }
- var space = fill.space;
- switch(fill.type){
- case "linear":
- if(space === "shape" || space === "shapeX" || space === "shapeY"){
-
- fill = dojox.gfx.makeParameters(dojox.gfx.defaultLinearGradient, fill);
- fill.space = space;
-
- if(space === "shape" || space === "shapeX"){
-
- var span = bbox.width;
- fill.x1 = bbox.x + span * fill.x1 / 100;
- fill.x2 = bbox.x + span * fill.x2 / 100;
- }
- if(space === "shape" || space === "shapeY"){
-
- var span = bbox.height;
- fill.y1 = bbox.y + span * fill.y1 / 100;
- fill.y2 = bbox.y + span * fill.y2 / 100;
- }
- }
- break;
- case "radial":
- if(space === "shape"){
-
-
- fill = dojox.gfx.makeParameters(dojox.gfx.defaultRadialGradient, fill);
- fill.space = space;
-
- fill.cx = bbox.x + bbox.width / 2;
- fill.cy = bbox.y + bbox.height / 2;
- fill.r = fill.r * bbox.width / 200;
- }
- break;
- case "pattern":
- if(space === "shape" || space === "shapeX" || space === "shapeY"){
-
- fill = dojox.gfx.makeParameters(dojox.gfx.defaultPattern, fill);
- fill.space = space;
-
- if(space === "shape" || space === "shapeX"){
-
- var span = bbox.width;
- fill.x = bbox.x + span * fill.x / 100;
- fill.width = span * fill.width / 100;
- }
- if(space === "shape" || space === "shapeY"){
-
- var span = bbox.height;
- fill.y = bbox.y + span * fill.y / 100;
- fill.height = span * fill.height / 100;
- }
- }
- break;
- }
- return fill;
- },
- _pseudoRadialFill: function(fill, center, radius, start, end){
-
- if(!fill || fill.type !== "radial" || fill.space !== "shape"){
- return fill;
- }
-
- var space = fill.space;
- fill = dojox.gfx.makeParameters(dojox.gfx.defaultRadialGradient, fill);
- fill.space = space;
- if(arguments.length < 4){
-
- fill.cx = center.x;
- fill.cy = center.y;
- fill.r = fill.r * radius / 100;
- return fill;
- }
-
- var angle = arguments.length < 5 ? start : (end + start) / 2;
- return {
- type: "linear",
- x1: center.x,
- y1: center.y,
- x2: center.x + fill.r * radius * Math.cos(angle) / 100,
- y2: center.y + fill.r * radius * Math.sin(angle) / 100,
- colors: fill.colors
- };
- return fill;
- }
- });
- }
- if(!dojo._hasResource["dojo.colors"]){
- dojo._hasResource["dojo.colors"] = true;
- dojo.provide("dojo.colors");
- dojo.getObject("colors", true, dojo);
- (function(){
-
- var hue2rgb = function(m1, m2, h){
- if(h < 0){ ++h; }
- if(h > 1){ --h; }
- var h6 = 6 * h;
- if(h6 < 1){ return m1 + (m2 - m1) * h6; }
- if(2 * h < 1){ return m2; }
- if(3 * h < 2){ return m1 + (m2 - m1) * (2 / 3 - h) * 6; }
- return m1;
- };
-
- dojo.colorFromRgb = function(/*String*/ color, /*dojo.Color?*/ obj){
-
-
-
-
-
- var m = color.toLowerCase().match(/^(rgba?|hsla?)\(([\s\.\-,%0-9]+)\)/);
- if(m){
- var c = m[2].split(/\s*,\s*/), l = c.length, t = m[1], a;
- if((t == "rgb" && l == 3) || (t == "rgba" && l == 4)){
- var r = c[0];
- if(r.charAt(r.length - 1) == "%"){
-
- a = dojo.map(c, function(x){
- return parseFloat(x) * 2.56;
- });
- if(l == 4){ a[3] = c[3]; }
- return dojo.colorFromArray(a, obj);
- }
- return dojo.colorFromArray(c, obj);
- }
- if((t == "hsl" && l == 3) || (t == "hsla" && l == 4)){
-
- var H = ((parseFloat(c[0]) % 360) + 360) % 360 / 360,
- S = parseFloat(c[1]) / 100,
- L = parseFloat(c[2]) / 100,
-
-
- m2 = L <= 0.5 ? L * (S + 1) : L + S - L * S,
- m1 = 2 * L - m2;
- a = [
- hue2rgb(m1, m2, H + 1 / 3) * 256,
- hue2rgb(m1, m2, H) * 256,
- hue2rgb(m1, m2, H - 1 / 3) * 256,
- 1
- ];
- if(l == 4){ a[3] = c[3]; }
- return dojo.colorFromArray(a, obj);
- }
- }
- return null;
- };
-
- var confine = function(c, low, high){
-
-
-
- c = Number(c);
- return isNaN(c) ? high : c < low ? low : c > high ? high : c;
- };
-
- dojo.Color.prototype.sanitize = function(){
-
- var t = this;
- t.r = Math.round(confine(t.r, 0, 255));
- t.g = Math.round(confine(t.g, 0, 255));
- t.b = Math.round(confine(t.b, 0, 255));
- t.a = confine(t.a, 0, 1);
- return this;
- };
- })();
- dojo.colors.makeGrey = function(/*Number*/ g, /*Number?*/ a){
-
- return dojo.colorFromArray([g, g, g, a]);
- };
- dojo.mixin(dojo.Color.named, {
- aliceblue: [240,248,255],
- antiquewhite: [250,235,215],
- aquamarine: [127,255,212],
- azure: [240,255,255],
- beige: [245,245,220],
- bisque: [255,228,196],
- blanchedalmond: [255,235,205],
- blueviolet: [138,43,226],
- brown: [165,42,42],
- burlywood: [222,184,135],
- cadetblue: [95,158,160],
- chartreuse: [127,255,0],
- chocolate: [210,105,30],
- coral: [255,127,80],
- cornflowerblue: [100,149,237],
- cornsilk: [255,248,220],
- crimson: [220,20,60],
- cyan: [0,255,255],
- darkblue: [0,0,139],
- darkcyan: [0,139,139],
- darkgoldenrod: [184,134,11],
- darkgray: [169,169,169],
- darkgreen: [0,100,0],
- darkgrey: [169,169,169],
- darkkhaki: [189,183,107],
- darkmagenta: [139,0,139],
- darkolivegreen: [85,107,47],
- darkorange: [255,140,0],
- darkorchid: [153,50,204],
- darkred: [139,0,0],
- darksalmon: [233,150,122],
- darkseagreen: [143,188,143],
- darkslateblue: [72,61,139],
- darkslategray: [47,79,79],
- darkslategrey: [47,79,79],
- darkturquoise: [0,206,209],
- darkviolet: [148,0,211],
- deeppink: [255,20,147],
- deepskyblue: [0,191,255],
- dimgray: [105,105,105],
- dimgrey: [105,105,105],
- dodgerblue: [30,144,255],
- firebrick: [178,34,34],
- floralwhite: [255,250,240],
- forestgreen: [34,139,34],
- gainsboro: [220,220,220],
- ghostwhite: [248,248,255],
- gold: [255,215,0],
- goldenrod: [218,165,32],
- greenyellow: [173,255,47],
- grey: [128,128,128],
- honeydew: [240,255,240],
- hotpink: [255,105,180],
- indianred: [205,92,92],
- indigo: [75,0,130],
- ivory: [255,255,240],
- khaki: [240,230,140],
- lavender: [230,230,250],
- lavenderblush: [255,240,245],
- lawngreen: [124,252,0],
- lemonchiffon: [255,250,205],
- lightblue: [173,216,230],
- lightcoral: [240,128,128],
- lightcyan: [224,255,255],
- lightgoldenrodyellow: [250,250,210],
- lightgray: [211,211,211],
- lightgreen: [144,238,144],
- lightgrey: [211,211,211],
- lightpink: [255,182,193],
- lightsalmon: [255,160,122],
- lightseagreen: [32,178,170],
- lightskyblue: [135,206,250],
- lightslategray: [119,136,153],
- lightslategrey: [119,136,153],
- lightsteelblue: [176,196,222],
- lightyellow: [255,255,224],
- limegreen: [50,205,50],
- linen: [250,240,230],
- magenta: [255,0,255],
- mediumaquamarine: [102,205,170],
- mediumblue: [0,0,205],
- mediumorchid: [186,85,211],
- mediumpurple: [147,112,219],
- mediumseagreen: [60,179,113],
- mediumslateblue: [123,104,238],
- mediumspringgreen: [0,250,154],
- mediumturquoise: [72,209,204],
- mediumvioletred: [199,21,133],
- midnightblue: [25,25,112],
- mintcream: [245,255,250],
- mistyrose: [255,228,225],
- moccasin: [255,228,181],
- navajowhite: [255,222,173],
- oldlace: [253,245,230],
- olivedrab: [107,142,35],
- orange: [255,165,0],
- orangered: [255,69,0],
- orchid: [218,112,214],
- palegoldenrod: [238,232,170],
- palegreen: [152,251,152],
- paleturquoise: [175,238,238],
- palevioletred: [219,112,147],
- papayawhip: [255,239,213],
- peachpuff: [255,218,185],
- peru: [205,133,63],
- pink: [255,192,203],
- plum: [221,160,221],
- powderblue: [176,224,230],
- rosybrown: [188,143,143],
- royalblue: [65,105,225],
- saddlebrown: [139,69,19],
- salmon: [250,128,114],
- sandybrown: [244,164,96],
- seagreen: [46,139,87],
- seashell: [255,245,238],
- sienna: [160,82,45],
- skyblue: [135,206,235],
- slateblue: [106,90,205],
- slategray: [112,128,144],
- slategrey: [112,128,144],
- snow: [255,250,250],
- springgreen: [0,255,127],
- steelblue: [70,130,180],
- tan: [210,180,140],
- thistle: [216,191,216],
- tomato: [255,99,71],
- transparent: [0, 0, 0, 0],
- turquoise: [64,224,208],
- violet: [238,130,238],
- wheat: [245,222,179],
- whitesmoke: [245,245,245],
- yellowgreen: [154,205,50]
- });
- }
- if(!dojo._hasResource["dojox.color._base"]){
- dojo._hasResource["dojox.color._base"] = true;
- dojo.provide("dojox.color._base");
- dojox.color.Color=dojo.Color;
- dojox.color.blend=dojo.blendColors;
- dojox.color.fromRgb=dojo.colorFromRgb;
- dojox.color.fromHex=dojo.colorFromHex;
- dojox.color.fromArray=dojo.colorFromArray;
- dojox.color.fromString=dojo.colorFromString;
- dojox.color.greyscale=dojo.colors.makeGrey;
- dojo.mixin(dojox.color, {
- fromCmy: function(/* Object|Array|int */cyan, /*int*/magenta, /*int*/yellow){
-
-
-
- if(dojo.isArray(cyan)){
- magenta=cyan[1], yellow=cyan[2], cyan=cyan[0];
- } else if(dojo.isObject(cyan)){
- magenta=cyan.m, yellow=cyan.y, cyan=cyan.c;
- }
- cyan/=100, magenta/=100, yellow/=100;
- var r=1-cyan, g=1-magenta, b=1-yellow;
- return new dojox.color.Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) });
- },
- fromCmyk: function(/* Object|Array|int */cyan, /*int*/magenta, /*int*/yellow, /*int*/black){
-
-
-
- if(dojo.isArray(cyan)){
- magenta=cyan[1], yellow=cyan[2], black=cyan[3], cyan=cyan[0];
- } else if(dojo.isObject(cyan)){
- magenta=cyan.m, yellow=cyan.y, black=cyan.b, cyan=cyan.c;
- }
- cyan/=100, magenta/=100, yellow/=100, black/=100;
- var r,g,b;
- r = 1-Math.min(1, cyan*(1-black)+black);
- g = 1-Math.min(1, magenta*(1-black)+black);
- b = 1-Math.min(1, yellow*(1-black)+black);
- return new dojox.color.Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) });
- },
-
- fromHsl: function(/* Object|Array|int */hue, /* int */saturation, /* int */luminosity){
-
-
-
- if(dojo.isArray(hue)){
- saturation=hue[1], luminosity=hue[2], hue=hue[0];
- } else if(dojo.isObject(hue)){
- saturation=hue.s, luminosity=hue.l, hue=hue.h;
- }
- saturation/=100;
- luminosity/=100;
- while(hue<0){ hue+=360; }
- while(hue>=360){ hue-=360; }
-
- var r, g, b;
- if(hue<120){
- r=(120-hue)/60, g=hue/60, b=0;
- } else if (hue<240){
- r=0, g=(240-hue)/60, b=(hue-120)/60;
- } else {
- r=(hue-240)/60, g=0, b=(360-hue)/60;
- }
-
- r=2*saturation*Math.min(r, 1)+(1-saturation);
- g=2*saturation*Math.min(g, 1)+(1-saturation);
- b=2*saturation*Math.min(b, 1)+(1-saturation);
- if(luminosity<0.5){
- r*=luminosity, g*=luminosity, b*=luminosity;
- }else{
- r=(1-luminosity)*r+2*luminosity-1;
- g=(1-luminosity)*g+2*luminosity-1;
- b=(1-luminosity)*b+2*luminosity-1;
- }
- return new dojox.color.Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) });
- },
-
- fromHsv: function(/* Object|Array|int */hue, /* int */saturation, /* int */value){
-
-
-
- if(dojo.isArray(hue)){
- saturation=hue[1], value=hue[2], hue=hue[0];
- } else if (dojo.isObject(hue)){
- saturation=hue.s, value=hue.v, hue=hue.h;
- }
-
- if(hue==360){ hue=0; }
- saturation/=100;
- value/=100;
-
- var r, g, b;
- if(saturation==0){
- r=value, b=value, g=value;
- }else{
- var hTemp=hue/60, i=Math.floor(hTemp), f=hTemp-i;
- var p=value*(1-saturation);
- var q=value*(1-(saturation*f));
- var t=value*(1-(saturation*(1-f)));
- switch(i){
- case 0:{ r=value, g=t, b=p; break; }
- case 1:{ r=q, g=value, b=p; break; }
- case 2:{ r=p, g=value, b=t; break; }
- case 3:{ r=p, g=q, b=value; break; }
- case 4:{ r=t, g=p, b=value; break; }
- case 5:{ r=value, g=p, b=q; break; }
- }
- }
- return new dojox.color.Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) });
- }
- });
- dojo.extend(dojox.color.Color, {
- toCmy: function(){
-
-
- var cyan=1-(this.r/255), magenta=1-(this.g/255), yellow=1-(this.b/255);
- return { c:Math.round(cyan*100), m:Math.round(magenta*100), y:Math.round(yellow*100) };
- },
-
- toCmyk: function(){
-
-
- var cyan, magenta, yellow, black;
- var r=this.r/255, g=this.g/255, b=this.b/255;
- black = Math.min(1-r, 1-g, 1-b);
- cyan = (1-r-black)/(1-black);
- magenta = (1-g-black)/(1-black);
- yellow = (1-b-black)/(1-black);
- return { c:Math.round(cyan*100), m:Math.round(magenta*100), y:Math.round(yellow*100), b:Math.round(black*100) };
- },
-
- toHsl: function(){
-
-
- var r=this.r/255, g=this.g/255, b=this.b/255;
- var min = Math.min(r, b, g), max = Math.max(r, g, b);
- var delta = max-min;
- var h=0, s=0, l=(min+max)/2;
- if(l>0 && l<1){
- s = delta/((l<0.5)?(2*l):(2-2*l));
- }
- if(delta>0){
- if(max==r && max!=g){
- h+=(g-b)/delta;
- }
- if(max==g && max!=b){
- h+=(2+(b-r)/delta);
- }
- if(max==b && max!=r){
- h+=(4+(r-g)/delta);
- }
- h*=60;
- }
- return { h:h, s:Math.round(s*100), l:Math.round(l*100) };
- },
- toHsv: function(){
-
-
- var r=this.r/255, g=this.g/255, b=this.b/255;
- var min = Math.min(r, b, g), max = Math.max(r, g, b);
- var delta = max-min;
- var h = null, s = (max==0)?0:(delta/max);
- if(s==0){
- h = 0;
- }else{
- if(r==max){
- h = 60*(g-b)/delta;
- }else if(g==max){
- h = 120 + 60*(b-r)/delta;
- }else{
- h = 240 + 60*(r-g)/delta;
- }
- if(h<0){ h+=360; }
- }
- return { h:h, s:Math.round(s*100), v:Math.round(max*100) };
- }
- });
- }
- if(!dojo._hasResource["dojox.color"]){
- dojo._hasResource["dojox.color"] = true;
- dojo.provide("dojox.color");
- }
- if(!dojo._hasResource["dojox.color.Palette"]){
- dojo._hasResource["dojox.color.Palette"] = true;
- dojo.provide("dojox.color.Palette");
- (function(){
- var dxc = dojox.color;
-
-
- dxc.Palette = function(/* String|Array|dojox.color.Color|dojox.color.Palette */base){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- this.colors = [];
- if(base instanceof dojox.color.Palette){
- this.colors = base.colors.slice(0);
- }
- else if(base instanceof dojox.color.Color){
- this.colors = [ null, null, base, null, null ];
- }
- else if(dojo.isArray(base)){
- this.colors = dojo.map(base.slice(0), function(item){
- if(dojo.isString(item)){ return new dojox.color.Color(item); }
- return item;
- });
- }
- else if (dojo.isString(base)){
- this.colors = [ null, null, new dojox.color.Color(base), null, null ];
- }
- }
-
-
- function tRGBA(p, param, val){
- var ret = new dojox.color.Palette();
- ret.colors = [];
- dojo.forEach(p.colors, function(item){
- var r=(param=="dr")?item.r+val:item.r,
- g=(param=="dg")?item.g+val:item.g,
- b=(param=="db")?item.b+val:item.b,
- a=(param=="da")?item.a+val:item.a
- ret.colors.push(new dojox.color.Color({
- r: Math.min(255, Math.max(0, r)),
- g: Math.min(255, Math.max(0, g)),
- b: Math.min(255, Math.max(0, b)),
- a: Math.min(1, Math.max(0, a))
- }));
- });
- return ret;
- }
- function tCMY(p, param, val){
- var ret = new dojox.color.Palette();
- ret.colors = [];
- dojo.forEach(p.colors, function(item){
- var o=item.toCmy(),
- c=(param=="dc")?o.c+val:o.c,
- m=(param=="dm")?o.m+val:o.m,
- y=(param=="dy")?o.y+val:o.y;
- ret.colors.push(dojox.color.fromCmy(
- Math.min(100, Math.max(0, c)),
- Math.min(100, Math.max(0, m)),
- Math.min(100, Math.max(0, y))
- ));
- });
- return ret;
- }
- function tCMYK(p, param, val){
- var ret = new dojox.color.Palette();
- ret.colors = [];
- dojo.forEach(p.colors, function(item){
- var o=item.toCmyk(),
- c=(param=="dc")?o.c+val:o.c,
- m=(param=="dm")?o.m+val:o.m,
- y=(param=="dy")?o.y+val:o.y,
- k=(param=="dk")?o.b+val:o.b;
- ret.colors.push(dojox.color.fromCmyk(
- Math.min(100, Math.max(0, c)),
- Math.min(100, Math.max(0, m)),
- Math.min(100, Math.max(0, y)),
- Math.min(100, Math.max(0, k))
- ));
- });
- return ret;
- }
- function tHSL(p, param, val){
- var ret = new dojox.color.Palette();
- ret.colors = [];
- dojo.forEach(p.colors, function(item){
- var o=item.toHsl(),
- h=(param=="dh")?o.h+val:o.h,
- s=(param=="ds")?o.s+val:o.s,
- l=(param=="dl")?o.l+val:o.l;
- ret.colors.push(dojox.color.fromHsl(h%360, Math.min(100, Math.max(0, s)), Math.min(100, Math.max(0, l))));
- });
- return ret;
- }
- function tHSV(p, param, val){
- var ret = new dojox.color.Palette();
- ret.colors = [];
- dojo.forEach(p.colors, function(item){
- var o=item.toHsv(),
- h=(param=="dh")?o.h+val:o.h,
- s=(param=="ds")?o.s+val:o.s,
- v=(param=="dv")?o.v+val:o.v;
- ret.colors.push(dojox.color.fromHsv(h%360, Math.min(100, Math.max(0, s)), Math.min(100, Math.max(0, v))));
- });
- return ret;
- }
-
- function rangeDiff(val, low, high){
-
-
- return high-((high-val)*((high-low)/high));
- }
-
- dojo.extend(dxc.Palette, {
- transform: function(/* dojox.color.Palette.__transformArgs */kwArgs){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var fn=tRGBA;
- if(kwArgs.use){
-
- var use=kwArgs.use.toLowerCase();
- if(use.indexOf("hs")==0){
- if(use.charAt(2)=="l"){ fn=tHSL; }
- else { fn=tHSV; }
- }
- else if(use.indexOf("cmy")==0){
- if(use.charAt(3)=="k"){ fn=tCMYK; }
- else { fn=tCMY; }
- }
- }
-
- else if("dc" in kwArgs || "dm" in kwArgs || "dy" in kwArgs){
- if("dk" in kwArgs){ fn = tCMYK; }
- else { fn = tCMY; }
- }
- else if("dh" in kwArgs || "ds" in kwArgs){
- if("dv" in kwArgs){ fn = tHSV; }
- else { fn = tHSL; }
- }
- var palette = this;
- for(var p in kwArgs){
-
- if(p=="use"){ continue; }
- palette = fn(palette, p, kwArgs[p]);
- }
- return palette;
- },
- clone: function(){
-
-
- return new dxc.Palette(this);
- }
- });
- dojo.mixin(dxc.Palette, {
- generators: {
- analogous:function(/* dojox.color.Palette.__analogousArgs */args){
-
-
-
- var high=args.high||60,
- low=args.low||18,
- base = dojo.isString(args.base)?new dojox.color.Color(args.base):args.base,
- hsv=base.toHsv();
-
- var h=[
- (hsv.h+low+360)%360,
- (hsv.h+Math.round(low/2)+360)%360,
- hsv.h,
- (hsv.h-Math.round(high/2)+360)%360,
- (hsv.h-high+360)%360
- ];
- var s1=Math.max(10, (hsv.s<=95)?hsv.s+5:(100-(hsv.s-95))),
- s2=(hsv.s>1)?hsv.s-1:21-hsv.s,
- v1=(hsv.v>=92)?hsv.v-9:Math.max(hsv.v+9, 20),
- v2=(hsv.v<=90)?Math.max(hsv.v+5, 20):(95+Math.ceil((hsv.v-90)/2)),
- s=[ s1, s2, hsv.s, s1, s1 ],
- v=[ v1, v2, hsv.v, v1, v2 ]
- return new dxc.Palette(dojo.map(h, function(hue, i){
- return dojox.color.fromHsv(hue, s[i], v[i]);
- }));
- },
- monochromatic: function(/* dojox.color.Palette.__generatorArgs */args){
-
-
-
- var base = dojo.isString(args.base)?new dojox.color.Color(args.base):args.base,
- hsv = base.toHsv();
-
-
- var s1 = (hsv.s-30>9)?hsv.s-30:hsv.s+30,
- s2 = hsv.s,
- v1 = rangeDiff(hsv.v, 20, 100),
- v2 = (hsv.v-20>20)?hsv.v-20:hsv.v+60,
- v3 = (hsv.v-50>20)?hsv.v-50:hsv.v+30;
- return new dxc.Palette([
- dojox.color.fromHsv(hsv.h, s1, v1),
- dojox.color.fromHsv(hsv.h, s2, v3),
- base,
- dojox.color.fromHsv(hsv.h, s1, v3),
- dojox.color.fromHsv(hsv.h, s2, v2)
- ]);
- },
- triadic: function(/* dojox.color.Palette.__generatorArgs */args){
-
-
-
- var base = dojo.isString(args.base)?new dojox.color.Color(args.base):args.base,
- hsv = base.toHsv();
- var h1 = (hsv.h+57+360)%360,
- h2 = (hsv.h-157+360)%360,
- s1 = (hsv.s>20)?hsv.s-10:hsv.s+10,
- s2 = (hsv.s>90)?hsv.s-10:hsv.s+10,
- s3 = (hsv.s>95)?hsv.s-5:hsv.s+5,
- v1 = (hsv.v-20>20)?hsv.v-20:hsv.v+20,
- v2 = (hsv.v-30>20)?hsv.v-30:hsv.v+30,
- v3 = (hsv.v-30>70)?hsv.v-30:hsv.v+30;
- return new dxc.Palette([
- dojox.color.fromHsv(h1, s1, hsv.v),
- dojox.color.fromHsv(hsv.h, s2, v2),
- base,
- dojox.color.fromHsv(h2, s2, v1),
- dojox.color.fromHsv(h2, s3, v3)
- ]);
- },
- complementary: function(/* dojox.color.Palette.__generatorArgs */args){
-
-
-
- var base = dojo.isString(args.base)?new dojox.color.Color(args.base):args.base,
- hsv = base.toHsv();
- var h1 = ((hsv.h*2)+137<360)?(hsv.h*2)+137:Math.floor(hsv.h/2)-137,
- s1 = Math.max(hsv.s-10, 0),
- s2 = rangeDiff(hsv.s, 10, 100),
- s3 = Math.min(100, hsv.s+20),
- v1 = Math.min(100, hsv.v+30),
- v2 = (hsv.v>20)?hsv.v-30:hsv.v+30;
- return new dxc.Palette([
- dojox.color.fromHsv(hsv.h, s1, v1),
- dojox.color.fromHsv(hsv.h, s2, v2),
- base,
- dojox.color.fromHsv(h1, s3, v2),
- dojox.color.fromHsv(h1, hsv.s, hsv.v)
- ]);
- },
- splitComplementary: function(/* dojox.color.Palette.__splitComplementaryArgs */args){
-
-
-
- var base = dojo.isString(args.base)?new dojox.color.Color(args.base):args.base,
- dangle = args.da || 30,
- hsv = base.toHsv();
- var baseh = ((hsv.h*2)+137<360)?(hsv.h*2)+137:Math.floor(hsv.h/2)-137,
- h1 = (baseh-dangle+360)%360,
- h2 = (baseh+dangle)%360,
- s1 = Math.max(hsv.s-10, 0),
- s2 = rangeDiff(hsv.s, 10, 100),
- s3 = Math.min(100, hsv.s+20),
- v1 = Math.min(100, hsv.v+30),
- v2 = (hsv.v>20)?hsv.v-30:hsv.v+30;
- return new dxc.Palette([
- dojox.color.fromHsv(h1, s1, v1),
- dojox.color.fromHsv(h1, s2, v2),
- base,
- dojox.color.fromHsv(h2, s3, v2),
- dojox.color.fromHsv(h2, hsv.s, hsv.v)
- ]);
- },
- compound: function(/* dojox.color.Palette.__generatorArgs */args){
-
-
-
- var base = dojo.isString(args.base)?new dojox.color.Color(args.base):args.base,
- hsv = base.toHsv();
- var h1 = ((hsv.h*2)+18<360)?(hsv.h*2)+18:Math.floor(hsv.h/2)-18,
- h2 = ((hsv.h*2)+120<360)?(hsv.h*2)+120:Math.floor(hsv.h/2)-120,
- h3 = ((hsv.h*2)+99<360)?(hsv.h*2)+99:Math.floor(hsv.h/2)-99,
- s1 = (hsv.s-40>10)?hsv.s-40:hsv.s+40,
- s2 = (hsv.s-10>80)?hsv.s-10:hsv.s+10,
- s3 = (hsv.s-25>10)?hsv.s-25:hsv.s+25,
- v1 = (hsv.v-40>10)?hsv.v-40:hsv.v+40,
- v2 = (hsv.v-20>80)?hsv.v-20:hsv.v+20,
- v3 = Math.max(hsv.v, 20);
- return new dxc.Palette([
- dojox.color.fromHsv(h1, s1, v1),
- dojox.color.fromHsv(h1, s2, v2),
- base,
- dojox.color.fromHsv(h2, s3, v3),
- dojox.color.fromHsv(h3, s2, v2)
- ]);
- },
- shades: function(/* dojox.color.Palette.__generatorArgs */args){
-
-
-
- var base = dojo.isString(args.base)?new dojox.color.Color(args.base):args.base,
- hsv = base.toHsv();
- var s = (hsv.s==100 && hsv.v==0)?0:hsv.s,
- v1 = (hsv.v-50>20)?hsv.v-50:hsv.v+30,
- v2 = (hsv.v-25>=20)?hsv.v-25:hsv.v+55,
- v3 = (hsv.v-75>=20)?hsv.v-75:hsv.v+5,
- v4 = Math.max(hsv.v-10, 20);
- return new dxc.Palette([
- new dojox.color.fromHsv(hsv.h, s, v1),
- new dojox.color.fromHsv(hsv.h, s, v2),
- base,
- new dojox.color.fromHsv(hsv.h, s, v3),
- new dojox.color.fromHsv(hsv.h, s, v4)
- ]);
- }
- },
- generate: function(/* String|dojox.color.Color */base, /* Function|String */type){
-
-
-
-
-
- if(dojo.isFunction(type)){
- return type({ base: base });
- }
- else if(dxc.Palette.generators[type]){
- return dxc.Palette.generators[type]({ base: base });
- }
- throw new Error("dojox.color.Palette.generate: the specified generator ('" + type + "') does not exist.");
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.lang.utils"]){
- dojo._hasResource["dojox.lang.utils"] = true;
- dojo.provide("dojox.lang.utils");
- (function(){
- var empty = {}, du = dojox.lang.utils, opts = Object.prototype.toString;
- var clone = function(o){
- if(o){
- switch(opts.call(o)){
- case "[object Array]":
- return o.slice(0);
- case "[object Object]":
- return dojo.delegate(o);
- }
- }
- return o;
- }
-
- dojo.mixin(du, {
- coerceType: function(target, source){
-
-
-
- switch(typeof target){
- case "number": return Number(eval("(" + source + ")"));
- case "string": return String(source);
- case "boolean": return Boolean(eval("(" + source + ")"));
- }
- return eval("(" + source + ")");
- },
-
- updateWithObject: function(target, source, conv){
-
-
-
-
- if(!source){ return target; }
- for(var x in target){
- if(x in source && !(x in empty)){
- var t = target[x];
- if(t && typeof t == "object"){
- du.updateWithObject(t, source[x], conv);
- }else{
- target[x] = conv ? du.coerceType(t, source[x]) : clone(source[x]);
- }
- }
- }
- return target;
- },
-
- updateWithPattern: function(target, source, pattern, conv){
-
-
-
-
-
- if(!source || !pattern){ return target; }
- for(var x in pattern){
- if(x in source && !(x in empty)){
- target[x] = conv ? du.coerceType(pattern[x], source[x]) : clone(source[x]);
- }
- }
- return target;
- },
-
- merge: function(object, mixin){
-
-
-
- if(mixin){
- var otype = opts.call(object), mtype = opts.call(mixin), t, i, l, m;
- switch(mtype){
- case "[object Array]":
- if(mtype == otype){
- t = new Array(Math.max(object.length, mixin.length));
- for(i = 0, l = t.length; i < l; ++i){
- t[i] = du.merge(object[i], mixin[i]);
- }
- return t;
- }
- return mixin.slice(0);
- case "[object Object]":
- if(mtype == otype && object){
- t = dojo.delegate(object);
- for(i in mixin){
- if(i in object){
- l = object[i];
- m = mixin[i];
- if(m !== l){
- t[i] = du.merge(l, m);
- }
- }else{
- t[i] = dojo.clone(mixin[i]);
- }
- }
- return t;
- }
- return dojo.clone(mixin);
- }
- }
- return mixin;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.gfx.gradutils"]){
- dojo._hasResource["dojox.gfx.gradutils"] = true;
- dojo.provide("dojox.gfx.gradutils");
- (function(){
- var d = dojo, m = dojox.gfx.matrix, C = d.Color;
-
- function findColor(o, c){
- if(o <= 0){
- return c[0].color;
- }
- var len = c.length;
- if(o >= 1){
- return c[len - 1].color;
- }
-
- for(var i = 0; i < len; ++i){
- var stop = c[i];
- if(stop.offset >= o){
- if(i){
- var prev = c[i - 1];
- return d.blendColors(new C(prev.color), new C(stop.color),
- (o - prev.offset) / (stop.offset - prev.offset));
- }
- return stop.color;
- }
- }
- return c[len - 1].color;
- }
- dojox.gfx.gradutils.getColor = function(fill, pt){
-
-
-
-
-
-
- var o;
- if(fill){
- switch(fill.type){
- case "linear":
- var angle = Math.atan2(fill.y2 - fill.y1, fill.x2 - fill.x1),
- rotation = m.rotate(-angle),
- projection = m.project(fill.x2 - fill.x1, fill.y2 - fill.y1),
- p = m.multiplyPoint(projection, pt),
- pf1 = m.multiplyPoint(projection, fill.x1, fill.y1),
- pf2 = m.multiplyPoint(projection, fill.x2, fill.y2),
- scale = m.multiplyPoint(rotation, pf2.x - pf1.x, pf2.y - pf1.y).x,
- o = m.multiplyPoint(rotation, p.x - pf1.x, p.y - pf1.y).x / scale;
- break;
- case "radial":
- var dx = pt.x - fill.cx, dy = pt.y - fill.cy,
- o = Math.sqrt(dx * dx + dy * dy) / fill.r;
- break;
- }
- return findColor(o, fill.colors);
- }
-
- return new C(fill || [0, 0, 0, 0]);
- };
- dojox.gfx.gradutils.reverse = function(fill){
-
-
-
-
- if(fill){
- switch(fill.type){
- case "linear":
- case "radial":
- fill = dojo.delegate(fill);
- if(fill.colors){
- var c = fill.colors, l = c.length, i = 0, stop,
- n = fill.colors = new Array(c.length);
- for(; i < l; ++i){
- stop = c[i];
- n[i] = {
- offset: 1 - stop.offset,
- color: stop.color
- };
- }
- n.sort(function(a, b){ return a.offset - b.offset; });
- }
- break;
- }
- }
- return fill;
- };
- })();
- }
- if(!dojo._hasResource["dojox.charting.Theme"]){
- dojo._hasResource["dojox.charting.Theme"] = true;
- dojo.provide("dojox.charting.Theme");
- dojo.declare("dojox.charting.Theme", null, {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- shapeSpaces: {shape: 1, shapeX: 1, shapeY: 1},
- constructor: function(kwArgs){
-
-
-
- kwArgs = kwArgs || {};
-
- var def = dojox.charting.Theme.defaultTheme;
- dojo.forEach(["chart", "plotarea", "axis", "series", "marker"], function(name){
- this[name] = dojo.delegate(def[name], kwArgs[name]);
- }, this);
-
- if(kwArgs.seriesThemes && kwArgs.seriesThemes.length){
- this.colors = null;
- this.seriesThemes = kwArgs.seriesThemes.slice(0);
- }else{
- this.seriesThemes = null;
- this.colors = (kwArgs.colors || dojox.charting.Theme.defaultColors).slice(0);
- }
- this.markerThemes = null;
- if(kwArgs.markerThemes && kwArgs.markerThemes.length){
- this.markerThemes = kwArgs.markerThemes.slice(0);
- }
- this.markers = kwArgs.markers ? dojo.clone(kwArgs.markers) : dojo.delegate(dojox.charting.Theme.defaultMarkers);
-
- this.noGradConv = kwArgs.noGradConv;
- this.noRadialConv = kwArgs.noRadialConv;
- if(kwArgs.reverseFills){
- this.reverseFills();
- }
-
- this._current = 0;
- this._buildMarkerArray();
- },
- clone: function(){
-
-
-
-
- var theme = new dojox.charting.Theme({
-
- chart: this.chart,
- plotarea: this.plotarea,
- axis: this.axis,
- series: this.series,
- marker: this.marker,
-
- colors: this.colors,
- markers: this.markers,
- seriesThemes: this.seriesThemes,
- markerThemes: this.markerThemes,
-
- noGradConv: this.noGradConv,
- noRadialConv: this.noRadialConv
- });
-
- dojo.forEach(
- ["clone", "clear", "next", "skip", "addMixin", "post", "getTick"],
- function(name){
- if(this.hasOwnProperty(name)){
- theme[name] = this[name];
- }
- },
- this
- );
- return theme;
- },
- clear: function(){
-
-
- this._current = 0;
- },
- next: function(elementType, mixin, doPost){
-
-
-
-
-
-
-
-
-
-
- var merge = dojox.lang.utils.merge, series, marker;
- if(this.colors){
- series = dojo.delegate(this.series);
- marker = dojo.delegate(this.marker);
- var color = new dojo.Color(this.colors[this._current % this.colors.length]), old;
-
- if(series.stroke && series.stroke.color){
- series.stroke = dojo.delegate(series.stroke);
- old = new dojo.Color(series.stroke.color);
- series.stroke.color = new dojo.Color(color);
- series.stroke.color.a = old.a;
- }else{
- series.stroke = {color: color};
- }
- if(marker.stroke && marker.stroke.color){
- marker.stroke = dojo.delegate(marker.stroke);
- old = new dojo.Color(marker.stroke.color);
- marker.stroke.color = new dojo.Color(color);
- marker.stroke.color.a = old.a;
- }else{
- marker.stroke = {color: color};
- }
-
- if(!series.fill || series.fill.type){
- series.fill = color;
- }else{
- old = new dojo.Color(series.fill);
- series.fill = new dojo.Color(color);
- series.fill.a = old.a;
- }
- if(!marker.fill || marker.fill.type){
- marker.fill = color;
- }else{
- old = new dojo.Color(marker.fill);
- marker.fill = new dojo.Color(color);
- marker.fill.a = old.a;
- }
- }else{
- series = this.seriesThemes ?
- merge(this.series, this.seriesThemes[this._current % this.seriesThemes.length]) :
- this.series;
- marker = this.markerThemes ?
- merge(this.marker, this.markerThemes[this._current % this.markerThemes.length]) :
- series;
- }
- var symbol = marker && marker.symbol || this._markers[this._current % this._markers.length];
- var theme = {series: series, marker: marker, symbol: symbol};
-
-
- ++this._current;
- if(mixin){
- theme = this.addMixin(theme, elementType, mixin);
- }
- if(doPost){
- theme = this.post(theme, elementType);
- }
- return theme;
- },
- skip: function(){
-
-
- ++this._current;
- },
- addMixin: function(theme, elementType, mixin, doPost){
-
-
-
-
-
-
-
-
-
-
-
-
- if(dojo.isArray(mixin)){
- dojo.forEach(mixin, function(m){
- theme = this.addMixin(theme, elementType, m);
- }, this);
- }else{
- var t = {};
- if("color" in mixin){
- if(elementType == "line" || elementType == "area"){
- dojo.setObject("series.stroke.color", mixin.color, t);
- dojo.setObject("marker.stroke.color", mixin.color, t);
- }else{
- dojo.setObject("series.fill", mixin.color, t);
- }
- }
- dojo.forEach(["stroke", "outline", "shadow", "fill", "font", "fontColor", "labelWiring"], function(name){
- var markerName = "marker" + name.charAt(0).toUpperCase() + name.substr(1),
- b = markerName in mixin;
- if(name in mixin){
- dojo.setObject("series." + name, mixin[name], t);
- if(!b){
- dojo.setObject("marker." + name, mixin[name], t);
- }
- }
- if(b){
- dojo.setObject("marker." + name, mixin[markerName], t);
- }
- });
- if("marker" in mixin){
- t.symbol = mixin.marker;
- }
- theme = dojox.lang.utils.merge(theme, t);
- }
- if(doPost){
- theme = this.post(theme, elementType);
- }
- return theme;
- },
- post: function(theme, elementType){
-
-
-
-
-
-
-
-
- var fill = theme.series.fill, t;
- if(!this.noGradConv && this.shapeSpaces[fill.space] && fill.type == "linear"){
- if(elementType == "bar"){
-
- t = {
- x1: fill.y1,
- y1: fill.x1,
- x2: fill.y2,
- y2: fill.x2
- };
- }else if(!this.noRadialConv && fill.space == "shape" && (elementType == "slice" || elementType == "circle")){
-
- t = {
- type: "radial",
- cx: 0,
- cy: 0,
- r: 100
- };
- }
- if(t){
- return dojox.lang.utils.merge(theme, {series: {fill: t}});
- }
- }
- return theme;
- },
- getTick: function(name, mixin){
-
-
-
-
-
-
- var tick = this.axis.tick, tickName = name + "Tick";
- merge = dojox.lang.utils.merge;
- if(tick){
- if(this.axis[tickName]){
- tick = merge(tick, this.axis[tickName]);
- }
- }else{
- tick = this.axis[tickName];
- }
- if(mixin){
- if(tick){
- if(mixin[tickName]){
- tick = merge(tick, mixin[tickName]);
- }
- }else{
- tick = mixin[tickName];
- }
- }
- return tick;
- },
- inspectObjects: function(f){
- dojo.forEach(["chart", "plotarea", "axis", "series", "marker"], function(name){
- f(this[name]);
- }, this);
- if(this.seriesThemes){
- dojo.forEach(this.seriesThemes, f);
- }
- if(this.markerThemes){
- dojo.forEach(this.markerThemes, f);
- }
- },
- reverseFills: function(){
- this.inspectObjects(function(o){
- if(o && o.fill){
- o.fill = dojox.gfx.gradutils.reverse(o.fill);
- }
- });
- },
- addMarker:function(/*String*/ name, /*String*/ segment){
-
-
-
-
- this.markers[name] = segment;
- this._buildMarkerArray();
- },
- setMarkers:function(/*Object*/ obj){
-
-
-
-
-
-
- this.markers = obj;
- this._buildMarkerArray();
- },
- _buildMarkerArray: function(){
- this._markers = [];
- for(var p in this.markers){
- this._markers.push(this.markers[p]);
- }
- }
- });
- dojo.mixin(dojox.charting.Theme, {
- defaultMarkers: {
- CIRCLE: "m-3,0 c0,-4 6,-4 6,0 m-6,0 c0,4 6,4 6,0",
- SQUARE: "m-3,-3 l0,6 6,0 0,-6 z",
- DIAMOND: "m0,-3 l3,3 -3,3 -3,-3 z",
- CROSS: "m0,-3 l0,6 m-3,-3 l6,0",
- X: "m-3,-3 l6,6 m0,-6 l-6,6",
- TRIANGLE: "m-3,3 l3,-6 3,6 z",
- TRIANGLE_INVERTED: "m-3,-3 l3,6 3,-6 z"
- },
- defaultColors:[
-
- "#54544c", "#858e94", "#6e767a", "#948585", "#474747"
- ],
- defaultTheme: {
-
- chart:{
- stroke: null,
- fill: "white",
- pageStyle: null,
- titleGap: 20,
- titlePos: "top",
- titleFont: "normal normal bold 14pt Tahoma",
- titleFontColor: "#333"
- },
- plotarea:{
- stroke: null,
- fill: "white"
- },
-
- axis:{
- stroke: {
- color: "#333",
- width: 1
- },
- tick: {
- color: "#666",
- position: "center",
- font: "normal normal normal 7pt Tahoma",
- fontColor: "#333",
- titleGap: 15,
- titleFont: "normal normal normal 11pt Tahoma",
- titleFontColor: "#333",
- titleOrientation: "axis"
- },
- majorTick: {
- width: 1,
- length: 6
- },
- minorTick: {
- width: 0.8,
- length: 3
- },
- microTick: {
- width: 0.5,
- length: 1
- }
- },
- series: {
-
- stroke: {width: 1.5, color: "#333"},
- outline: {width: 0.1, color: "#ccc"},
-
- shadow: null,
- fill: "#ccc",
- font: "normal normal normal 8pt Tahoma",
- fontColor: "#000",
- labelWiring: {width: 1, color: "#ccc"}
- },
- marker: {
- stroke: {width: 1.5, color: "#333"},
- outline: {width: 0.1, color: "#ccc"},
-
- shadow: null,
- fill: "#ccc",
- font: "normal normal normal 8pt Tahoma",
- fontColor: "#000"
- }
- },
- defineColors: function(kwArgs){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- kwArgs = kwArgs || {};
- var c = [], n = kwArgs.num || 5;
- if(kwArgs.colors){
-
- var l = kwArgs.colors.length;
- for(var i = 0; i < n; i++){
- c.push(kwArgs.colors[i % l]);
- }
- return c;
- }
- if(kwArgs.hue){
-
- var s = kwArgs.saturation || 100;
- var st = kwArgs.low || 30;
- var end = kwArgs.high || 90;
-
- var l = (end + st) / 2;
-
- return dojox.color.Palette.generate(
- dojox.color.fromHsv(kwArgs.hue, s, l), "monochromatic"
- ).colors;
- }
- if(kwArgs.generator){
-
- return dojox.color.Palette.generate(kwArgs.base, kwArgs.generator).colors;
- }
- return c;
- },
-
- generateGradient: function(fillPattern, colorFrom, colorTo){
- var fill = dojo.delegate(fillPattern);
- fill.colors = [
- {offset: 0, color: colorFrom},
- {offset: 1, color: colorTo}
- ];
- return fill;
- },
-
- generateHslColor: function(color, luminance){
- color = new dojox.color.Color(color);
- var hsl = color.toHsl(),
- result = dojox.color.fromHsl(hsl.h, hsl.s, luminance);
- result.a = color.a;
- return result;
- },
- generateHslGradient: function(color, fillPattern, lumFrom, lumTo){
- color = new dojox.color.Color(color);
- var hsl = color.toHsl(),
- colorFrom = dojox.color.fromHsl(hsl.h, hsl.s, lumFrom),
- colorTo = dojox.color.fromHsl(hsl.h, hsl.s, lumTo);
- colorFrom.a = colorTo.a = color.a;
- return dojox.charting.Theme.generateGradient(fillPattern, colorFrom, colorTo);
- }
- });
- }
- if(!dojo._hasResource["dojox.charting.Series"]){
- dojo._hasResource["dojox.charting.Series"] = true;
- dojo.provide("dojox.charting.Series");
- dojo.declare("dojox.charting.Series", dojox.charting.Element, {
-
-
- constructor: function(chart, data, kwArgs){
-
-
-
-
-
-
-
-
-
-
-
- dojo.mixin(this, kwArgs);
- if(typeof this.plot != "string"){ this.plot = "default"; }
- this.update(data);
- },
- clear: function(){
-
-
- this.dyn = {};
- },
-
- update: function(data){
-
-
-
-
-
-
-
- if(dojo.isArray(data)){
- this.data = data;
- }else{
- this.source = data;
- this.data = this.source.data;
- if(this.source.setSeriesObject){
- this.source.setSeriesObject(this);
- }
- }
- this.dirty = true;
- this.clear();
- }
- });
- }
- if(!dojo._hasResource["dojox.charting.axis2d.common"]){
- dojo._hasResource["dojox.charting.axis2d.common"] = true;
- dojo.provide("dojox.charting.axis2d.common");
- (function(){
- var g = dojox.gfx;
- var clearNode = function(s){
- s.marginLeft = "0px";
- s.marginTop = "0px";
- s.marginRight = "0px";
- s.marginBottom = "0px";
- s.paddingLeft = "0px";
- s.paddingTop = "0px";
- s.paddingRight = "0px";
- s.paddingBottom = "0px";
- s.borderLeftWidth = "0px";
- s.borderTopWidth = "0px";
- s.borderRightWidth = "0px";
- s.borderBottomWidth = "0px";
- };
- var getBoxWidth = function(n){
-
- if(n["getBoundingClientRect"]){
- var bcr = n.getBoundingClientRect();
- return bcr.width || (bcr.right - bcr.left);
- }else{
- return dojo.marginBox(n).w;
- }
- };
- dojo.mixin(dojox.charting.axis2d.common, {
-
-
- createText: {
- gfx: function(chart, creator, x, y, align, text, font, fontColor){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- return creator.createText({
- x: x, y: y, text: text, align: align
- }).setFont(font).setFill(fontColor);
- },
- html: function(chart, creator, x, y, align, text, font, fontColor, labelWidth){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var p = dojo.doc.createElement("div"), s = p.style, boxWidth;
- clearNode(s);
- s.font = font;
- p.innerHTML = String(text).replace(/\s/g, " ");
- s.color = fontColor;
-
- s.position = "absolute";
- s.left = "-10000px";
- dojo.body().appendChild(p);
- var size = g.normalizedLength(g.splitFontString(font).size);
-
- if(!labelWidth){
- boxWidth = getBoxWidth(p);
- }
-
- dojo.body().removeChild(p);
- s.position = "relative";
- if(labelWidth){
- s.width = labelWidth + "px";
-
- switch(align){
- case "middle":
- s.textAlign = "center";
- s.left = (x - labelWidth / 2) + "px";
- break;
- case "end":
- s.textAlign = "right";
- s.left = (x - labelWidth) + "px";
- break;
- default:
- s.left = x + "px";
- s.textAlign = "left";
- break;
- }
- }else{
- switch(align){
- case "middle":
- s.left = Math.floor(x - boxWidth / 2) + "px";
-
- break;
- case "end":
- s.left = Math.floor(x - boxWidth) + "px";
-
- break;
-
- default:
- s.left = Math.floor(x) + "px";
- break;
- }
- }
- s.top = Math.floor(y - size) + "px";
- s.whiteSpace = "nowrap";
-
- var wrap = dojo.doc.createElement("div"), w = wrap.style;
- clearNode(w);
- w.width = "0px";
- w.height = "0px";
-
- wrap.appendChild(p)
- chart.node.insertBefore(wrap, chart.node.firstChild);
- return wrap;
- }
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.Chart"]){
- dojo._hasResource["dojox.charting.Chart"] = true;
- dojo.provide("dojox.charting.Chart");
- (function(){
- var df = dojox.lang.functional, dc = dojox.charting, g = dojox.gfx,
- clear = df.lambda("item.clear()"),
- purge = df.lambda("item.purgeGroup()"),
- destroy = df.lambda("item.destroy()"),
- makeClean = df.lambda("item.dirty = false"),
- makeDirty = df.lambda("item.dirty = true"),
- getName = df.lambda("item.name");
- dojo.declare("dojox.charting.Chart", null, {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- constructor: function(/* DOMNode */node, /* dojox.charting.__ChartCtorArgs? */kwArgs){
-
-
-
-
-
- if(!kwArgs){ kwArgs = {}; }
- this.margins = kwArgs.margins ? kwArgs.margins : {l: 10, t: 10, r: 10, b: 10};
- this.stroke = kwArgs.stroke;
- this.fill = kwArgs.fill;
- this.delayInMs = kwArgs.delayInMs || 200;
- this.title = kwArgs.title;
- this.titleGap = kwArgs.titleGap;
- this.titlePos = kwArgs.titlePos;
- this.titleFont = kwArgs.titleFont;
- this.titleFontColor = kwArgs.titleFontColor;
- this.chartTitle = null;
-
- this.theme = null;
- this.axes = {};
- this.stack = [];
- this.plots = {};
- this.series = [];
- this.runs = {};
- this.dirty = true;
- this.coords = null;
-
- this.node = dojo.byId(node);
- var box = dojo.marginBox(node);
- this.surface = g.createSurface(this.node, box.w || 400, box.h || 300);
- },
- destroy: function(){
-
-
-
- dojo.forEach(this.series, destroy);
- dojo.forEach(this.stack, destroy);
- df.forIn(this.axes, destroy);
- if(this.chartTitle && this.chartTitle.tagName){
-
- dojo.destroy(this.chartTitle);
- }
- this.surface.destroy();
- },
- getCoords: function(){
-
-
-
-
-
- if(!this.coords){
- this.coords = dojo.coords(this.node, true);
- }
- return this.coords;
- },
- setTheme: function(theme){
-
-
-
-
-
-
- this.theme = theme.clone();
- this.dirty = true;
- return this;
- },
- addAxis: function(name, kwArgs){
-
-
-
-
-
-
-
-
- var axis, axisType = kwArgs && kwArgs.type || "Default";
- if(typeof axisType == "string"){
- if(!dc.axis2d || !dc.axis2d[axisType]){
- throw Error("Can't find axis: " + axisType + " - didn't you forget to dojo" + ".require() it?");
- }
- axis = new dc.axis2d[axisType](this, kwArgs);
- }else{
- axis = new axisType(this, kwArgs);
- }
- axis.name = name;
- axis.dirty = true;
- if(name in this.axes){
- this.axes[name].destroy();
- }
- this.axes[name] = axis;
- this.dirty = true;
- return this;
- },
- getAxis: function(name){
-
-
-
-
-
-
- return this.axes[name];
- },
- removeAxis: function(name){
-
-
-
-
-
-
- if(name in this.axes){
-
- this.axes[name].destroy();
- delete this.axes[name];
-
- this.dirty = true;
- }
- return this;
- },
- addPlot: function(name, kwArgs){
-
-
-
-
-
-
-
-
-
-
-
- var plot, plotType = kwArgs && kwArgs.type || "Default";
- if(typeof plotType == "string"){
- if(!dc.plot2d || !dc.plot2d[plotType]){
- throw Error("Can't find plot: " + plotType + " - didn't you forget to dojo" + ".require() it?");
- }
- plot = new dc.plot2d[plotType](this, kwArgs);
- }else{
- plot = new plotType(this, kwArgs);
- }
- plot.name = name;
- plot.dirty = true;
- if(name in this.plots){
- this.stack[this.plots[name]].destroy();
- this.stack[this.plots[name]] = plot;
- }else{
- this.plots[name] = this.stack.length;
- this.stack.push(plot);
- }
- this.dirty = true;
- return this;
- },
- removePlot: function(name){
-
-
-
-
-
-
- if(name in this.plots){
-
- var index = this.plots[name];
- delete this.plots[name];
-
- this.stack[index].destroy();
-
- this.stack.splice(index, 1);
-
- df.forIn(this.plots, function(idx, name, plots){
- if(idx > index){
- plots[name] = idx - 1;
- }
- });
-
- var ns = dojo.filter(this.series, function(run){ return run.plot != name; });
- if(ns.length < this.series.length){
-
- dojo.forEach(this.series, function(run){
- if(run.plot == name){
- run.destroy();
- }
- });
-
- this.runs = {};
- dojo.forEach(ns, function(run, index){
- this.runs[run.plot] = index;
- }, this);
- this.series = ns;
- }
-
- this.dirty = true;
- }
- return this;
- },
- getPlotOrder: function(){
-
-
-
-
- return df.map(this.stack, getName);
- },
- setPlotOrder: function(newOrder){
-
-
-
-
-
-
-
- var names = {},
- order = df.filter(newOrder, function(name){
- if(!(name in this.plots) || (name in names)){
- return false;
- }
- names[name] = 1;
- return true;
- }, this);
- if(order.length < this.stack.length){
- df.forEach(this.stack, function(plot){
- var name = plot.name;
- if(!(name in names)){
- order.push(name);
- }
- });
- }
- var newStack = df.map(order, function(name){
- return this.stack[this.plots[name]];
- }, this);
- df.forEach(newStack, function(plot, i){
- this.plots[plot.name] = i;
- }, this);
- this.stack = newStack;
- this.dirty = true;
- return this;
- },
- movePlotToFront: function(name){
-
-
-
-
-
-
- if(name in this.plots){
- var index = this.plots[name];
- if(index){
- var newOrder = this.getPlotOrder();
- newOrder.splice(index, 1);
- newOrder.unshift(name);
- return this.setPlotOrder(newOrder);
- }
- }
- return this;
- },
- movePlotToBack: function(name){
-
-
-
-
-
-
- if(name in this.plots){
- var index = this.plots[name];
- if(index < this.stack.length - 1){
- var newOrder = this.getPlotOrder();
- newOrder.splice(index, 1);
- newOrder.push(name);
- return this.setPlotOrder(newOrder);
- }
- }
- return this;
- },
- addSeries: function(name, data, kwArgs){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var run = new dc.Series(this, data, kwArgs);
- run.name = name;
- if(name in this.runs){
- this.series[this.runs[name]].destroy();
- this.series[this.runs[name]] = run;
- }else{
- this.runs[name] = this.series.length;
- this.series.push(run);
- }
- this.dirty = true;
-
- if(!("ymin" in run) && "min" in run){ run.ymin = run.min; }
- if(!("ymax" in run) && "max" in run){ run.ymax = run.max; }
- return this;
- },
- removeSeries: function(name){
-
-
-
-
-
-
- if(name in this.runs){
-
- var index = this.runs[name];
- delete this.runs[name];
-
- this.series[index].destroy();
-
- this.series.splice(index, 1);
-
- df.forIn(this.runs, function(idx, name, runs){
- if(idx > index){
- runs[name] = idx - 1;
- }
- });
- this.dirty = true;
- }
- return this;
- },
- updateSeries: function(name, data){
-
-
-
-
-
-
-
-
-
-
-
- if(name in this.runs){
- var run = this.series[this.runs[name]];
- run.update(data);
- this._invalidateDependentPlots(run.plot, false);
- this._invalidateDependentPlots(run.plot, true);
- }
- return this;
- },
- getSeriesOrder: function(plotName){
-
-
-
-
-
-
- return df.map(df.filter(this.series, function(run){
- return run.plot == plotName;
- }), getName);
- },
- setSeriesOrder: function(newOrder){
-
-
-
-
-
-
-
-
- var plotName, names = {},
- order = df.filter(newOrder, function(name){
- if(!(name in this.runs) || (name in names)){
- return false;
- }
- var run = this.series[this.runs[name]];
- if(plotName){
- if(run.plot != plotName){
- return false;
- }
- }else{
- plotName = run.plot;
- }
- names[name] = 1;
- return true;
- }, this);
- df.forEach(this.series, function(run){
- var name = run.name;
- if(!(name in names) && run.plot == plotName){
- order.push(name);
- }
- });
- var newSeries = df.map(order, function(name){
- return this.series[this.runs[name]];
- }, this);
- this.series = newSeries.concat(df.filter(this.series, function(run){
- return run.plot != plotName;
- }));
- df.forEach(this.series, function(run, i){
- this.runs[run.name] = i;
- }, this);
- this.dirty = true;
- return this;
- },
- moveSeriesToFront: function(name){
-
-
-
-
-
-
- if(name in this.runs){
- var index = this.runs[name],
- newOrder = this.getSeriesOrder(this.series[index].plot);
- if(name != newOrder[0]){
- newOrder.splice(index, 1);
- newOrder.unshift(name);
- return this.setSeriesOrder(newOrder);
- }
- }
- return this;
- },
- moveSeriesToBack: function(name){
-
-
-
-
-
-
- if(name in this.runs){
- var index = this.runs[name],
- newOrder = this.getSeriesOrder(this.series[index].plot);
- if(name != newOrder[newOrder.length - 1]){
- newOrder.splice(index, 1);
- newOrder.push(name);
- return this.setSeriesOrder(newOrder);
- }
- }
- return this;
- },
- resize: function(width, height){
-
-
-
-
-
-
-
-
-
-
-
- var box;
- switch(arguments.length){
-
- case 1:
-
- box = dojo.mixin({}, width);
- dojo.marginBox(this.node, box);
- break;
- case 2:
- box = {w: width, h: height};
-
- dojo.marginBox(this.node, box);
- break;
- }
-
- box = dojo.marginBox(this.node);
-
- this.surface.setDimensions(box.w, box.h);
- this.dirty = true;
- this.coords = null;
- return this.render();
- },
- getGeometry: function(){
-
-
-
-
-
- var ret = {};
- df.forIn(this.axes, function(axis){
- if(axis.initialized()){
- ret[axis.name] = {
- name: axis.name,
- vertical: axis.vertical,
- scaler: axis.scaler,
- ticks: axis.ticks
- };
- }
- });
- return ret;
- },
- setAxisWindow: function(name, scale, offset, zoom){
-
-
-
-
-
-
-
-
-
-
-
-
-
- var axis = this.axes[name];
- if(axis){
- axis.setWindow(scale, offset);
- dojo.forEach(this.stack,function(plot){
- if(plot.hAxis == name || plot.vAxis == name){
- plot.zoom = zoom;
- }
- })
- }
- return this;
- },
- setWindow: function(sx, sy, dx, dy, zoom){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(!("plotArea" in this)){
- this.calculateGeometry();
- }
- df.forIn(this.axes, function(axis){
- var scale, offset, bounds = axis.getScaler().bounds,
- s = bounds.span / (bounds.upper - bounds.lower);
- if(axis.vertical){
- scale = sy;
- offset = dy / s / scale;
- }else{
- scale = sx;
- offset = dx / s / scale;
- }
- axis.setWindow(scale, offset);
- });
- dojo.forEach(this.stack, function(plot){ plot.zoom = zoom; });
- return this;
- },
- zoomIn: function(name, range){
-
-
-
-
-
-
-
- var axis = this.axes[name];
- if(axis){
- var scale, offset, bounds = axis.getScaler().bounds;
- var lower = Math.min(range[0],range[1]);
- var upper = Math.max(range[0],range[1]);
- lower = range[0] < bounds.lower ? bounds.lower : lower;
- upper = range[1] > bounds.upper ? bounds.upper : upper;
- scale = (bounds.upper - bounds.lower) / (upper - lower);
- offset = lower - bounds.lower;
- this.setAxisWindow(name, scale, offset);
- this.render();
- }
- },
- calculateGeometry: function(){
-
-
-
-
-
- if(this.dirty){
- return this.fullGeometry();
- }
-
- var dirty = dojo.filter(this.stack, function(plot){
- return plot.dirty ||
- (plot.hAxis && this.axes[plot.hAxis].dirty) ||
- (plot.vAxis && this.axes[plot.vAxis].dirty);
- }, this);
- calculateAxes(dirty, this.plotArea);
- return this;
- },
- fullGeometry: function(){
-
-
-
-
-
-
- this._makeDirty();
-
- dojo.forEach(this.stack, clear);
-
-
- if(!this.theme){
- this.setTheme(new dojox.charting.Theme(dojox.charting._def));
- }
-
- dojo.forEach(this.series, function(run){
- if(!(run.plot in this.plots)){
- if(!dc.plot2d || !dc.plot2d.Default){
- throw Error("Can't find plot: Default - didn't you forget to dojo" + ".require() it?");
- }
- var plot = new dc.plot2d.Default(this, {});
- plot.name = run.plot;
- this.plots[run.plot] = this.stack.length;
- this.stack.push(plot);
- }
- this.stack[this.plots[run.plot]].addSeries(run);
- }, this);
-
- dojo.forEach(this.stack, function(plot){
- if(plot.hAxis){
- plot.setAxis(this.axes[plot.hAxis]);
- }
- if(plot.vAxis){
- plot.setAxis(this.axes[plot.vAxis]);
- }
- }, this);
-
-
- var dim = this.dim = this.surface.getDimensions();
- dim.width = g.normalizedLength(dim.width);
- dim.height = g.normalizedLength(dim.height);
- df.forIn(this.axes, clear);
- calculateAxes(this.stack, dim);
-
- var offsets = this.offsets = { l: 0, r: 0, t: 0, b: 0 };
- df.forIn(this.axes, function(axis){
- df.forIn(axis.getOffsets(), function(o, i){ offsets[i] += o; });
- });
-
- if(this.title){
- this.titleGap = (this.titleGap==0) ? 0 : this.titleGap || this.theme.chart.titleGap || 20;
- this.titlePos = this.titlePos || this.theme.chart.titlePos || "top";
- this.titleFont = this.titleFont || this.theme.chart.titleFont;
- this.titleFontColor = this.titleFontColor || this.theme.chart.titleFontColor || "black";
- var tsize = g.normalizedLength(g.splitFontString(this.titleFont).size);
- offsets[this.titlePos=="top" ? "t":"b"] += (tsize + this.titleGap);
- }
-
- df.forIn(this.margins, function(o, i){ offsets[i] += o; });
-
- this.plotArea = {
- width: dim.width - offsets.l - offsets.r,
- height: dim.height - offsets.t - offsets.b
- };
- df.forIn(this.axes, clear);
- calculateAxes(this.stack, this.plotArea);
- return this;
- },
- render: function(){
-
-
-
-
-
-
- if(this.theme){
- this.theme.clear();
- }
- if(this.dirty){
- return this.fullRender();
- }
- this.calculateGeometry();
-
- df.forEachRev(this.stack, function(plot){ plot.render(this.dim, this.offsets); }, this);
-
- df.forIn(this.axes, function(axis){ axis.render(this.dim, this.offsets); }, this);
- this._makeClean();
-
- if(this.surface.render){ this.surface.render(); };
-
- return this;
- },
- fullRender: function(){
-
-
-
-
-
-
- this.fullGeometry();
- var offsets = this.offsets, dim = this.dim, rect;
-
-
-
-
- dojo.forEach(this.series, purge);
- df.forIn(this.axes, purge);
- dojo.forEach(this.stack, purge);
- if(this.chartTitle && this.chartTitle.tagName){
-
- dojo.destroy(this.chartTitle);
- }
- this.surface.clear();
- this.chartTitle = null;
-
-
- var t = this.theme,
- fill = t.plotarea && t.plotarea.fill,
- stroke = t.plotarea && t.plotarea.stroke,
- rect = {
- x: offsets.l - 1, y: offsets.t - 1,
- width: dim.width - offsets.l - offsets.r + 2,
- height: dim.height - offsets.t - offsets.b + 2
- };
- if(fill){
- fill = dc.Element.prototype._shapeFill(dc.Element.prototype._plotFill(fill, dim, offsets), rect);
- this.surface.createRect(rect).setFill(fill);
- }
- if(stroke){
- this.surface.createRect({
- x: offsets.l, y: offsets.t,
- width: dim.width - offsets.l - offsets.r + 1,
- height: dim.height - offsets.t - offsets.b + 1
- }).setStroke(stroke);
- }
-
- df.foldr(this.stack, function(z, plot){ return plot.render(dim, offsets), 0; }, 0);
-
- fill = this.fill !== undefined ? this.fill : (t.chart && t.chart.fill);
- stroke = this.stroke !== undefined ? this.stroke : (t.chart && t.chart.stroke);
-
- if(fill == "inherit"){
-
- var node = this.node, fill = new dojo.Color(dojo.style(node, "backgroundColor"));
- while(fill.a==0 && node!=document.documentElement){
- fill = new dojo.Color(dojo.style(node, "backgroundColor"));
- node = node.parentNode;
- }
- }
- if(fill){
- fill = dc.Element.prototype._plotFill(fill, dim, offsets);
- if(offsets.l){
- rect = {
- width: offsets.l,
- height: dim.height + 1
- };
- this.surface.createRect(rect).setFill(dc.Element.prototype._shapeFill(fill, rect));
- }
- if(offsets.r){
- rect = {
- x: dim.width - offsets.r,
- width: offsets.r + 1,
- height: dim.height + 2
- };
- this.surface.createRect(rect).setFill(dc.Element.prototype._shapeFill(fill, rect));
- }
- if(offsets.t){
- rect = {
- width: dim.width + 1,
- height: offsets.t
- };
- this.surface.createRect(rect).setFill(dc.Element.prototype._shapeFill(fill, rect));
- }
- if(offsets.b){
- rect = {
- y: dim.height - offsets.b,
- width: dim.width + 1,
- height: offsets.b + 2
- };
- this.surface.createRect(rect).setFill(dc.Element.prototype._shapeFill(fill, rect));
- }
- }
- if(stroke){
- this.surface.createRect({
- width: dim.width - 1,
- height: dim.height - 1
- }).setStroke(stroke);
- }
-
- if(this.title){
- var forceHtmlLabels = (g.renderer == "canvas"),
- labelType = forceHtmlLabels || !dojo.isIE && !dojo.isOpera ? "html" : "gfx",
- tsize = g.normalizedLength(g.splitFontString(this.titleFont).size);
- this.chartTitle = dc.axis2d.common.createText[labelType](
- this,
- this.surface,
- dim.width/2,
- this.titlePos=="top" ? tsize + this.margins.t : dim.height - this.margins.b,
- "middle",
- this.title,
- this.titleFont,
- this.titleFontColor
- );
- }
-
- df.forIn(this.axes, function(axis){ axis.render(dim, offsets); });
- this._makeClean();
-
- if(this.surface.render){ this.surface.render(); };
-
- return this;
- },
- delayedRender: function(){
-
-
-
-
-
- if(!this._delayedRenderHandle){
- this._delayedRenderHandle = setTimeout(
- dojo.hitch(this, function(){
- clearTimeout(this._delayedRenderHandle);
- this._delayedRenderHandle = null;
- this.render();
- }),
- this.delayInMs
- );
- }
- return this;
- },
- connectToPlot: function(name, object, method){
-
-
-
-
-
-
-
-
-
-
- return name in this.plots ? this.stack[this.plots[name]].connect(object, method) : null;
- },
- fireEvent: function(seriesName, eventName, index){
-
-
-
-
-
-
-
-
-
-
- if(seriesName in this.runs){
- var plotName = this.series[this.runs[seriesName]].plot;
- if(plotName in this.plots){
- var plot = this.stack[this.plots[plotName]];
- if(plot){
- plot.fireEvent(seriesName, eventName, index);
- }
- }
- }
- return this;
- },
- _makeClean: function(){
-
- dojo.forEach(this.axes, makeClean);
- dojo.forEach(this.stack, makeClean);
- dojo.forEach(this.series, makeClean);
- this.dirty = false;
- },
- _makeDirty: function(){
-
- dojo.forEach(this.axes, makeDirty);
- dojo.forEach(this.stack, makeDirty);
- dojo.forEach(this.series, makeDirty);
- this.dirty = true;
- },
- _invalidateDependentPlots: function(plotName, /* Boolean */ verticalAxis){
- if(plotName in this.plots){
- var plot = this.stack[this.plots[plotName]], axis,
- axisName = verticalAxis ? "vAxis" : "hAxis";
- if(plot[axisName]){
- axis = this.axes[plot[axisName]];
- if(axis && axis.dependOnData()){
- axis.dirty = true;
-
- dojo.forEach(this.stack, function(p){
- if(p[axisName] && p[axisName] == plot[axisName]){
- p.dirty = true;
- }
- });
- }
- }else{
- plot.dirty = true;
- }
- }
- }
- });
- function hSection(stats){
- return {min: stats.hmin, max: stats.hmax};
- }
- function vSection(stats){
- return {min: stats.vmin, max: stats.vmax};
- }
- function hReplace(stats, h){
- stats.hmin = h.min;
- stats.hmax = h.max;
- }
- function vReplace(stats, v){
- stats.vmin = v.min;
- stats.vmax = v.max;
- }
- function combineStats(target, source){
- if(target && source){
- target.min = Math.min(target.min, source.min);
- target.max = Math.max(target.max, source.max);
- }
- return target || source;
- }
- function calculateAxes(stack, plotArea){
- var plots = {}, axes = {};
- dojo.forEach(stack, function(plot){
- var stats = plots[plot.name] = plot.getSeriesStats();
- if(plot.hAxis){
- axes[plot.hAxis] = combineStats(axes[plot.hAxis], hSection(stats));
- }
- if(plot.vAxis){
- axes[plot.vAxis] = combineStats(axes[plot.vAxis], vSection(stats));
- }
- });
- dojo.forEach(stack, function(plot){
- var stats = plots[plot.name];
- if(plot.hAxis){
- hReplace(stats, axes[plot.hAxis]);
- }
- if(plot.vAxis){
- vReplace(stats, axes[plot.vAxis]);
- }
- plot.initializeScalers(plotArea, stats);
- });
- }
- })();
- }
- if(!dojo._hasResource["dojox.charting.widget.Chart"]){
- dojo._hasResource["dojox.charting.widget.Chart"] = true;
- dojo.provide("dojox.charting.widget.Chart");
- (function(){
- var collectParams, collectAxisParams, collectPlotParams,
- collectActionParams, collectDataParams,
- notNull = function(o){ return o; },
- df = dojox.lang.functional,
- du = dojox.lang.utils,
- dc = dojox.charting,
- d = dojo;
-
- dojo.declare("dojox.charting.widget.Chart", dijit._Widget, {
-
-
-
- theme: null,
-
-
- margins: null,
-
-
- stroke: null,
- fill: null,
-
-
-
- buildRendering: function(){
- var n = this.domNode = this.srcNodeRef;
-
-
- var axes = d.query("> .axis", n).map(collectAxisParams).filter(notNull),
- plots = d.query("> .plot", n).map(collectPlotParams).filter(notNull),
- actions = d.query("> .action", n).map(collectActionParams).filter(notNull),
- series = d.query("> .series", n).map(collectDataParams).filter(notNull);
-
-
- n.innerHTML = "";
- var c = this.chart = new dc.Chart(n, {
- margins: this.margins,
- stroke: this.stroke,
- fill: this.fill
- });
-
-
- if(this.theme){
- c.setTheme(this.theme);
- }
- axes.forEach(function(axis){
- c.addAxis(axis.name, axis.kwArgs);
- });
- plots.forEach(function(plot){
- c.addPlot(plot.name, plot.kwArgs);
- });
-
- this.actions = actions.map(function(action){
- return new action.action(c, action.plot, action.kwArgs)
- });
-
- var render = df.foldl(series, function(render, series){
- if(series.type == "data"){
- c.addSeries(series.name, series.data, series.kwArgs);
- render = true;
- }else{
- c.addSeries(series.name, [0], series.kwArgs);
- var kw = {};
- du.updateWithPattern(
- kw,
- series.kwArgs,
- {
- "query": "",
- "queryOptions": null,
- "start": 0,
- "count": 1
-
- },
- true
- );
- if(series.kwArgs.sort){
-
- kw.sort = dojo.clone(series.kwArgs.sort);
- }
- d.mixin(kw, {
- onComplete: function(data){
- var values;
- if("valueFn" in series.kwArgs){
- var fn = series.kwArgs.valueFn;
- values = d.map(data, function(x){
- return fn(series.data.getValue(x, series.field, 0));
- });
- }else{
- values = d.map(data, function(x){
- return series.data.getValue(x, series.field, 0);
- });
- }
- c.addSeries(series.name, values, series.kwArgs).render();
- }
- });
- series.data.fetch(kw);
- }
- return render;
- }, false);
- if(render){ c.render(); }
- },
- destroy: function(){
-
- this.chart.destroy();
- this.inherited(arguments);
- },
- resize: function(box){
-
-
-
-
-
-
-
-
- this.chart.resize(box);
- }
- });
-
- collectParams = function(node, type, kw){
- var dp = eval("(" + type + ".prototype.defaultParams)");
- var x, attr;
- for(x in dp){
- if(x in kw){ continue; }
- attr = node.getAttribute(x);
- kw[x] = du.coerceType(dp[x], attr == null || typeof attr == "undefined" ? dp[x] : attr);
- }
- var op = eval("(" + type + ".prototype.optionalParams)");
- for(x in op){
- if(x in kw){ continue; }
- attr = node.getAttribute(x);
- if(attr != null){
- kw[x] = du.coerceType(op[x], attr);
- }
- }
- };
-
- collectAxisParams = function(node){
- var name = node.getAttribute("name"), type = node.getAttribute("type");
- if(!name){ return null; }
- var o = {name: name, kwArgs: {}}, kw = o.kwArgs;
- if(type){
- if(dc.axis2d[type]){
- type = dojox._scopeName + ".charting.axis2d." + type;
- }
- var axis = eval("(" + type + ")");
- if(axis){ kw.type = axis; }
- }else{
- type = dojox._scopeName + ".charting.axis2d.Default";
- }
- collectParams(node, type, kw);
-
- if(kw.font || kw.fontColor){
- if(!kw.tick){
- kw.tick = {};
- }
- if(kw.font){
- kw.tick.font = kw.font;
- }
- if(kw.fontColor){
- kw.tick.fontColor = kw.fontColor;
- }
- }
- return o;
- };
-
- collectPlotParams = function(node){
-
- var name = node.getAttribute("name"), type = node.getAttribute("type");
- if(!name){ return null; }
- var o = {name: name, kwArgs: {}}, kw = o.kwArgs;
- if(type){
- if(dc.plot2d && dc.plot2d[type]){
- type = dojox._scopeName + ".charting.plot2d." + type;
- }
- var plot = eval("(" + type + ")");
- if(plot){ kw.type = plot; }
- }else{
- type = dojox._scopeName + ".charting.plot2d.Default";
- }
- collectParams(node, type, kw);
- return o;
- };
-
- collectActionParams = function(node){
-
- var plot = node.getAttribute("plot"), type = node.getAttribute("type");
- if(!plot){ plot = "default"; }
- var o = {plot: plot, kwArgs: {}}, kw = o.kwArgs;
- if(type){
- if(dc.action2d[type]){
- type = dojox._scopeName + ".charting.action2d." + type;
- }
- var action = eval("(" + type + ")");
- if(!action){ return null; }
- o.action = action;
- }else{
- return null;
- }
- collectParams(node, type, kw);
- return o;
- };
- collectDataParams = function(node){
- var ga = d.partial(d.attr, node);
- var name = ga("name");
- if(!name){ return null; }
- var o = { name: name, kwArgs: {} }, kw = o.kwArgs, t;
- t = ga("plot");
- if(t != null){ kw.plot = t; }
- t = ga("marker");
- if(t != null){ kw.marker = t; }
- t = ga("stroke");
- if(t != null){ kw.stroke = eval("(" + t + ")"); }
- t = ga("outline");
- if(t != null){ kw.outline = eval("(" + t + ")"); }
- t = ga("shadow");
- if(t != null){ kw.shadow = eval("(" + t + ")"); }
- t = ga("fill");
- if(t != null){ kw.fill = eval("(" + t + ")"); }
- t = ga("font");
- if(t != null){ kw.font = t; }
- t = ga("fontColor");
- if(t != null){ kw.fontColor = eval("(" + t + ")"); }
- t = ga("legend");
- if(t != null){ kw.legend = t; }
- t = ga("data");
- if(t != null){
- o.type = "data";
- o.data = t ? dojo.map(String(t).split(','), Number) : [];
- return o;
- }
- t = ga("array");
- if(t != null){
- o.type = "data";
- o.data = eval("(" + t + ")");
- return o;
- }
- t = ga("store");
- if(t != null){
- o.type = "store";
- o.data = eval("(" + t + ")");
- t = ga("field");
- o.field = t != null ? t : "value";
- t = ga("query");
- if(!!t){ kw.query = t; }
- t = ga("queryOptions");
- if(!!t){ kw.queryOptions = eval("(" + t + ")"); }
- t = ga("start");
- if(!!t){ kw.start = Number(t); }
- t = ga("count");
- if(!!t){ kw.count = Number(t); }
- t = ga("sort");
- if(!!t){ kw.sort = eval("("+t+")"); }
- t = ga("valueFn");
- if(!!t){ kw.valueFn = df.lambda(t); }
- return o;
- }
- return null;
- };
- })();
- }
- if(!dojo._hasResource["dojo.fx.easing"]){
- dojo._hasResource["dojo.fx.easing"] = true;
- dojo.provide("dojo.fx.easing");
- dojo.getObject("fx.easing", true, dojo);
- dojo.fx.easing = {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- linear: function(/* Decimal? */n){
-
- return n;
- },
- quadIn: function(/* Decimal? */n){
- return Math.pow(n, 2);
- },
- quadOut: function(/* Decimal? */n){
- return n * (n - 2) * -1;
- },
- quadInOut: function(/* Decimal? */n){
- n = n * 2;
- if(n < 1){ return Math.pow(n, 2) / 2; }
- return -1 * ((--n) * (n - 2) - 1) / 2;
- },
- cubicIn: function(/* Decimal? */n){
- return Math.pow(n, 3);
- },
- cubicOut: function(/* Decimal? */n){
- return Math.pow(n - 1, 3) + 1;
- },
- cubicInOut: function(/* Decimal? */n){
- n = n * 2;
- if(n < 1){ return Math.pow(n, 3) / 2; }
- n -= 2;
- return (Math.pow(n, 3) + 2) / 2;
- },
- quartIn: function(/* Decimal? */n){
- return Math.pow(n, 4);
- },
- quartOut: function(/* Decimal? */n){
- return -1 * (Math.pow(n - 1, 4) - 1);
- },
- quartInOut: function(/* Decimal? */n){
- n = n * 2;
- if(n < 1){ return Math.pow(n, 4) / 2; }
- n -= 2;
- return -1 / 2 * (Math.pow(n, 4) - 2);
- },
- quintIn: function(/* Decimal? */n){
- return Math.pow(n, 5);
- },
- quintOut: function(/* Decimal? */n){
- return Math.pow(n - 1, 5) + 1;
- },
- quintInOut: function(/* Decimal? */n){
- n = n * 2;
- if(n < 1){ return Math.pow(n, 5) / 2; };
- n -= 2;
- return (Math.pow(n, 5) + 2) / 2;
- },
- sineIn: function(/* Decimal? */n){
- return -1 * Math.cos(n * (Math.PI / 2)) + 1;
- },
- sineOut: function(/* Decimal? */n){
- return Math.sin(n * (Math.PI / 2));
- },
- sineInOut: function(/* Decimal? */n){
- return -1 * (Math.cos(Math.PI * n) - 1) / 2;
- },
- expoIn: function(/* Decimal? */n){
- return (n == 0) ? 0 : Math.pow(2, 10 * (n - 1));
- },
- expoOut: function(/* Decimal? */n){
- return (n == 1) ? 1 : (-1 * Math.pow(2, -10 * n) + 1);
- },
- expoInOut: function(/* Decimal? */n){
- if(n == 0){ return 0; }
- if(n == 1){ return 1; }
- n = n * 2;
- if(n < 1){ return Math.pow(2, 10 * (n - 1)) / 2; }
- --n;
- return (-1 * Math.pow(2, -10 * n) + 2) / 2;
- },
- circIn: function(/* Decimal? */n){
- return -1 * (Math.sqrt(1 - Math.pow(n, 2)) - 1);
- },
- circOut: function(/* Decimal? */n){
- n = n - 1;
- return Math.sqrt(1 - Math.pow(n, 2));
- },
- circInOut: function(/* Decimal? */n){
- n = n * 2;
- if(n < 1){ return -1 / 2 * (Math.sqrt(1 - Math.pow(n, 2)) - 1); }
- n -= 2;
- return 1 / 2 * (Math.sqrt(1 - Math.pow(n, 2)) + 1);
- },
- backIn: function(/* Decimal? */n){
-
-
-
-
-
-
- var s = 1.70158;
- return Math.pow(n, 2) * ((s + 1) * n - s);
- },
- backOut: function(/* Decimal? */n){
-
-
-
-
-
-
-
-
-
- n = n - 1;
- var s = 1.70158;
- return Math.pow(n, 2) * ((s + 1) * n + s) + 1;
- },
- backInOut: function(/* Decimal? */n){
-
-
-
-
-
-
-
- var s = 1.70158 * 1.525;
- n = n * 2;
- if(n < 1){ return (Math.pow(n, 2) * ((s + 1) * n - s)) / 2; }
- n-=2;
- return (Math.pow(n, 2) * ((s + 1) * n + s) + 2) / 2;
- },
- elasticIn: function(/* Decimal? */n){
-
-
-
-
-
-
-
-
- if(n == 0 || n == 1){ return n; }
- var p = .3;
- var s = p / 4;
- n = n - 1;
- return -1 * Math.pow(2, 10 * n) * Math.sin((n - s) * (2 * Math.PI) / p);
- },
- elasticOut: function(/* Decimal? */n){
-
-
-
-
-
-
-
-
-
-
- if(n==0 || n == 1){ return n; }
- var p = .3;
- var s = p / 4;
- return Math.pow(2, -10 * n) * Math.sin((n - s) * (2 * Math.PI) / p) + 1;
- },
- elasticInOut: function(/* Decimal? */n){
-
-
-
-
-
-
-
-
-
-
- if(n == 0) return 0;
- n = n * 2;
- if(n == 2) return 1;
- var p = .3 * 1.5;
- var s = p / 4;
- if(n < 1){
- n -= 1;
- return -.5 * (Math.pow(2, 10 * n) * Math.sin((n - s) * (2 * Math.PI) / p));
- }
- n -= 1;
- return .5 * (Math.pow(2, -10 * n) * Math.sin((n - s) * (2 * Math.PI) / p)) + 1;
- },
- bounceIn: function(/* Decimal? */n){
-
-
- return (1 - dojo.fx.easing.bounceOut(1 - n));
- },
- bounceOut: function(/* Decimal? */n){
-
-
- var s = 7.5625;
- var p = 2.75;
- var l;
- if(n < (1 / p)){
- l = s * Math.pow(n, 2);
- }else if(n < (2 / p)){
- n -= (1.5 / p);
- l = s * Math.pow(n, 2) + .75;
- }else if(n < (2.5 / p)){
- n -= (2.25 / p);
- l = s * Math.pow(n, 2) + .9375;
- }else{
- n -= (2.625 / p);
- l = s * Math.pow(n, 2) + .984375;
- }
- return l;
- },
- bounceInOut: function(/* Decimal? */n){
-
-
- if(n < 0.5){ return dojo.fx.easing.bounceIn(n * 2) / 2; }
- return (dojo.fx.easing.bounceOut(n * 2 - 1) / 2) + 0.5;
- }
- };
- }
- if(!dojo._hasResource["dojox.gfx.fx"]){
- dojo._hasResource["dojox.gfx.fx"] = true;
- dojo.provide("dojox.gfx.fx");
- (function(){
- var d = dojo, g = dojox.gfx, m = g.matrix;
-
- function InterpolNumber(start, end){
- this.start = start, this.end = end;
- }
- InterpolNumber.prototype.getValue = function(r){
- return (this.end - this.start) * r + this.start;
- };
- function InterpolUnit(start, end, units){
- this.start = start, this.end = end;
- this.units = units;
- }
- InterpolUnit.prototype.getValue = function(r){
- return (this.end - this.start) * r + this.start + this.units;
- };
- function InterpolColor(start, end){
- this.start = start, this.end = end;
- this.temp = new dojo.Color();
- }
- InterpolColor.prototype.getValue = function(r){
- return d.blendColors(this.start, this.end, r, this.temp);
- };
- function InterpolValues(values){
- this.values = values;
- this.length = values.length;
- }
- InterpolValues.prototype.getValue = function(r){
- return this.values[Math.min(Math.floor(r * this.length), this.length - 1)];
- };
- function InterpolObject(values, def){
- this.values = values;
- this.def = def ? def : {};
- }
- InterpolObject.prototype.getValue = function(r){
- var ret = dojo.clone(this.def);
- for(var i in this.values){
- ret[i] = this.values[i].getValue(r);
- }
- return ret;
- };
- function InterpolTransform(stack, original){
- this.stack = stack;
- this.original = original;
- }
- InterpolTransform.prototype.getValue = function(r){
- var ret = [];
- dojo.forEach(this.stack, function(t){
- if(t instanceof m.Matrix2D){
- ret.push(t);
- return;
- }
- if(t.name == "original" && this.original){
- ret.push(this.original);
- return;
- }
- if(!(t.name in m)){ return; }
- var f = m[t.name];
- if(typeof f != "function"){
-
- ret.push(f);
- return;
- }
- var val = dojo.map(t.start, function(v, i){
- return (t.end[i] - v) * r + v;
- }),
- matrix = f.apply(m, val);
- if(matrix instanceof m.Matrix2D){
- ret.push(matrix);
- }
- }, this);
- return ret;
- };
- var transparent = new d.Color(0, 0, 0, 0);
- function getColorInterpol(prop, obj, name, def){
- if(prop.values){
- return new InterpolValues(prop.values);
- }
- var value, start, end;
- if(prop.start){
- start = g.normalizeColor(prop.start);
- }else{
- start = value = obj ? (name ? obj[name] : obj) : def;
- }
- if(prop.end){
- end = g.normalizeColor(prop.end);
- }else{
- if(!value){
- value = obj ? (name ? obj[name] : obj) : def;
- }
- end = value;
- }
- return new InterpolColor(start, end);
- }
- function getNumberInterpol(prop, obj, name, def){
- if(prop.values){
- return new InterpolValues(prop.values);
- }
- var value, start, end;
- if(prop.start){
- start = prop.start;
- }else{
- start = value = obj ? obj[name] : def;
- }
- if(prop.end){
- end = prop.end;
- }else{
- if(typeof value != "number"){
- value = obj ? obj[name] : def;
- }
- end = value;
- }
- return new InterpolNumber(start, end);
- }
- g.fx.animateStroke = function(/*Object*/ args){
-
-
-
-
-
-
-
-
-
-
- if(!args.easing){ args.easing = d._defaultEasing; }
- var anim = new d.Animation(args), shape = args.shape, stroke;
- d.connect(anim, "beforeBegin", anim, function(){
- stroke = shape.getStroke();
- var prop = args.color, values = {}, value, start, end;
- if(prop){
- values.color = getColorInterpol(prop, stroke, "color", transparent);
- }
- prop = args.style;
- if(prop && prop.values){
- values.style = new InterpolValues(prop.values);
- }
- prop = args.width;
- if(prop){
- values.width = getNumberInterpol(prop, stroke, "width", 1);
- }
- prop = args.cap;
- if(prop && prop.values){
- values.cap = new InterpolValues(prop.values);
- }
- prop = args.join;
- if(prop){
- if(prop.values){
- values.join = new InterpolValues(prop.values);
- }else{
- start = prop.start ? prop.start : (stroke && stroke.join || 0);
- end = prop.end ? prop.end : (stroke && stroke.join || 0);
- if(typeof start == "number" && typeof end == "number"){
- values.join = new InterpolNumber(start, end);
- }
- }
- }
- this.curve = new InterpolObject(values, stroke);
- });
- d.connect(anim, "onAnimate", shape, "setStroke");
- return anim;
- };
- g.fx.animateFill = function(/*Object*/ args){
-
-
-
-
-
-
-
-
-
- if(!args.easing){ args.easing = d._defaultEasing; }
- var anim = new d.Animation(args), shape = args.shape, fill;
- d.connect(anim, "beforeBegin", anim, function(){
- fill = shape.getFill();
- var prop = args.color, values = {};
- if(prop){
- this.curve = getColorInterpol(prop, fill, "", transparent);
- }
- });
- d.connect(anim, "onAnimate", shape, "setFill");
- return anim;
- };
- g.fx.animateFont = function(/*Object*/ args){
-
-
-
-
-
-
-
-
-
- if(!args.easing){ args.easing = d._defaultEasing; }
- var anim = new d.Animation(args), shape = args.shape, font;
- d.connect(anim, "beforeBegin", anim, function(){
- font = shape.getFont();
- var prop = args.style, values = {}, value, start, end;
- if(prop && prop.values){
- values.style = new InterpolValues(prop.values);
- }
- prop = args.variant;
- if(prop && prop.values){
- values.variant = new InterpolValues(prop.values);
- }
- prop = args.weight;
- if(prop && prop.values){
- values.weight = new InterpolValues(prop.values);
- }
- prop = args.family;
- if(prop && prop.values){
- values.family = new InterpolValues(prop.values);
- }
- prop = args.size;
- if(prop && prop.units){
- start = parseFloat(prop.start ? prop.start : (shape.font && shape.font.size || "0"));
- end = parseFloat(prop.end ? prop.end : (shape.font && shape.font.size || "0"));
- values.size = new InterpolUnit(start, end, prop.units);
- }
- this.curve = new InterpolObject(values, font);
- });
- d.connect(anim, "onAnimate", shape, "setFont");
- return anim;
- };
- g.fx.animateTransform = function(/*Object*/ args){
-
-
-
-
-
-
-
-
-
-
-
- if(!args.easing){ args.easing = d._defaultEasing; }
- var anim = new d.Animation(args), shape = args.shape, original;
- d.connect(anim, "beforeBegin", anim, function(){
- original = shape.getTransform();
- this.curve = new InterpolTransform(args.transform, original);
- });
- d.connect(anim, "onAnimate", shape, "setTransform");
- return anim;
- };
- })();
- }
- if(!dojo._hasResource["dojox.charting.action2d.Base"]){
- dojo._hasResource["dojox.charting.action2d.Base"] = true;
- dojo.provide("dojox.charting.action2d.Base");
- (function(){
- var DEFAULT_DURATION = 400,
- DEFAULT_EASING = dojo.fx.easing.backOut,
- df = dojox.lang.functional;
- dojo.declare("dojox.charting.action2d.Base", null, {
- overOutEvents: {onmouseover: 1, onmouseout: 1},
- constructor: function(chart, plot, kwargs){
-
-
-
-
-
-
-
-
- this.chart = chart;
- this.plot = plot || "default";
- this.anim = {};
-
- if(!kwargs){ kwargs = {}; }
- this.duration = kwargs.duration ? kwargs.duration : DEFAULT_DURATION;
- this.easing = kwargs.easing ? kwargs.easing : DEFAULT_EASING;
- },
- connect: function(){
-
-
- this.handle = this.chart.connectToPlot(this.plot, this, "process");
- },
- disconnect: function(){
-
-
- if(this.handle){
- dojo.disconnect(this.handle);
- this.handle = null;
- }
- },
- reset: function(){
-
-
- },
- destroy: function(){
-
-
- this.disconnect();
- df.forIn(this.anim, function(o){
- df.forIn(o, function(anim){
- anim.action.stop(true);
- });
- });
- this.anim = {};
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.action2d.Highlight"]){
- dojo._hasResource["dojox.charting.action2d.Highlight"] = true;
- dojo.provide("dojox.charting.action2d.Highlight");
- (function(){
- var DEFAULT_SATURATION = 100,
- DEFAULT_LUMINOSITY1 = 75,
- DEFAULT_LUMINOSITY2 = 50,
- c = dojox.color,
- cc = function(color){
- return function(){ return color; };
- },
- hl = function(color){
- var a = new c.Color(color),
- x = a.toHsl();
- if(x.s == 0){
- x.l = x.l < 50 ? 100 : 0;
- }else{
- x.s = DEFAULT_SATURATION;
- if(x.l < DEFAULT_LUMINOSITY2){
- x.l = DEFAULT_LUMINOSITY1;
- }else if(x.l > DEFAULT_LUMINOSITY1){
- x.l = DEFAULT_LUMINOSITY2;
- }else{
- x.l = x.l - DEFAULT_LUMINOSITY2 > DEFAULT_LUMINOSITY1 - x.l ?
- DEFAULT_LUMINOSITY2 : DEFAULT_LUMINOSITY1;
- }
- }
- return c.fromHsl(x);
- };
- dojo.declare("dojox.charting.action2d.Highlight", dojox.charting.action2d.Base, {
-
-
-
-
- defaultParams: {
- duration: 400,
- easing: dojo.fx.easing.backOut
- },
- optionalParams: {
- highlight: "red"
-
- },
- constructor: function(chart, plot, kwArgs){
-
-
-
-
-
-
-
-
- var a = kwArgs && kwArgs.highlight;
- this.colorFun = a ? (dojo.isFunction(a) ? a : cc(a)) : hl;
- this.connect();
- },
- process: function(o){
-
-
-
-
- if(!o.shape || !(o.type in this.overOutEvents)){ return; }
- var runName = o.run.name, index = o.index, anim, startFill, endFill;
- if(runName in this.anim){
- anim = this.anim[runName][index];
- }else{
- this.anim[runName] = {};
- }
- if(anim){
- anim.action.stop(true);
- }else{
- var color = o.shape.getFill();
- if(!color || !(color instanceof dojo.Color)){
- return;
- }
- this.anim[runName][index] = anim = {
- start: color,
- end: this.colorFun(color)
- };
- }
- var start = anim.start, end = anim.end;
- if(o.type == "onmouseout"){
-
- var t = start;
- start = end;
- end = t;
- }
- anim.action = dojox.gfx.fx.animateFill({
- shape: o.shape,
- duration: this.duration,
- easing: this.easing,
- color: {start: start, end: end}
- });
- if(o.type == "onmouseout"){
- dojo.connect(anim.action, "onEnd", this, function(){
- if(this.anim[runName]){
- delete this.anim[runName][index];
- }
- });
- }
- anim.action.play();
- }
- });
- })();
- }
- if(!dojo._hasResource["dojo.fx.Toggler"]){
- dojo._hasResource["dojo.fx.Toggler"] = true;
- dojo.provide("dojo.fx.Toggler");
- dojo.declare("dojo.fx.Toggler", null, {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- node: null,
-
-
- showFunc: dojo.fadeIn,
-
-
- hideFunc: dojo.fadeOut,
-
-
- showDuration: 200,
-
-
- hideDuration: 200,
-
-
-
-
-
-
-
- constructor: function(args){
- var _t = this;
- dojo.mixin(_t, args);
- _t.node = args.node;
- _t._showArgs = dojo.mixin({}, args);
- _t._showArgs.node = _t.node;
- _t._showArgs.duration = _t.showDuration;
- _t.showAnim = _t.showFunc(_t._showArgs);
- _t._hideArgs = dojo.mixin({}, args);
- _t._hideArgs.node = _t.node;
- _t._hideArgs.duration = _t.hideDuration;
- _t.hideAnim = _t.hideFunc(_t._hideArgs);
- dojo.connect(_t.showAnim, "beforeBegin", dojo.hitch(_t.hideAnim, "stop", true));
- dojo.connect(_t.hideAnim, "beforeBegin", dojo.hitch(_t.showAnim, "stop", true));
- },
- show: function(delay){
-
-
-
- return this.showAnim.play(delay || 0);
- },
- hide: function(delay){
-
-
-
- return this.hideAnim.play(delay || 0);
- }
- });
- }
- if(!dojo._hasResource["dojo.fx"]){
- dojo._hasResource["dojo.fx"] = true;
- dojo.provide("dojo.fx");
- (function(){
-
- var d = dojo,
- _baseObj = {
- _fire: function(evt, args){
- if(this[evt]){
- this[evt].apply(this, args||[]);
- }
- return this;
- }
- };
- var _chain = function(animations){
- this._index = -1;
- this._animations = animations||[];
- this._current = this._onAnimateCtx = this._onEndCtx = null;
- this.duration = 0;
- d.forEach(this._animations, function(a){
- this.duration += a.duration;
- if(a.delay){ this.duration += a.delay; }
- }, this);
- };
- d.extend(_chain, {
- _onAnimate: function(){
- this._fire("onAnimate", arguments);
- },
- _onEnd: function(){
- d.disconnect(this._onAnimateCtx);
- d.disconnect(this._onEndCtx);
- this._onAnimateCtx = this._onEndCtx = null;
- if(this._index + 1 == this._animations.length){
- this._fire("onEnd");
- }else{
-
- this._current = this._animations[++this._index];
- this._onAnimateCtx = d.connect(this._current, "onAnimate", this, "_onAnimate");
- this._onEndCtx = d.connect(this._current, "onEnd", this, "_onEnd");
- this._current.play(0, true);
- }
- },
- play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
- if(!this._current){ this._current = this._animations[this._index = 0]; }
- if(!gotoStart && this._current.status() == "playing"){ return this; }
- var beforeBegin = d.connect(this._current, "beforeBegin", this, function(){
- this._fire("beforeBegin");
- }),
- onBegin = d.connect(this._current, "onBegin", this, function(arg){
- this._fire("onBegin", arguments);
- }),
- onPlay = d.connect(this._current, "onPlay", this, function(arg){
- this._fire("onPlay", arguments);
- d.disconnect(beforeBegin);
- d.disconnect(onBegin);
- d.disconnect(onPlay);
- });
- if(this._onAnimateCtx){
- d.disconnect(this._onAnimateCtx);
- }
- this._onAnimateCtx = d.connect(this._current, "onAnimate", this, "_onAnimate");
- if(this._onEndCtx){
- d.disconnect(this._onEndCtx);
- }
- this._onEndCtx = d.connect(this._current, "onEnd", this, "_onEnd");
- this._current.play.apply(this._current, arguments);
- return this;
- },
- pause: function(){
- if(this._current){
- var e = d.connect(this._current, "onPause", this, function(arg){
- this._fire("onPause", arguments);
- d.disconnect(e);
- });
- this._current.pause();
- }
- return this;
- },
- gotoPercent: function(/*Decimal*/percent, /*Boolean?*/ andPlay){
- this.pause();
- var offset = this.duration * percent;
- this._current = null;
- d.some(this._animations, function(a){
- if(a.duration <= offset){
- this._current = a;
- return true;
- }
- offset -= a.duration;
- return false;
- });
- if(this._current){
- this._current.gotoPercent(offset / this._current.duration, andPlay);
- }
- return this;
- },
- stop: function(/*boolean?*/ gotoEnd){
- if(this._current){
- if(gotoEnd){
- for(; this._index + 1 < this._animations.length; ++this._index){
- this._animations[this._index].stop(true);
- }
- this._current = this._animations[this._index];
- }
- var e = d.connect(this._current, "onStop", this, function(arg){
- this._fire("onStop", arguments);
- d.disconnect(e);
- });
- this._current.stop();
- }
- return this;
- },
- status: function(){
- return this._current ? this._current.status() : "stopped";
- },
- destroy: function(){
- if(this._onAnimateCtx){ d.disconnect(this._onAnimateCtx); }
- if(this._onEndCtx){ d.disconnect(this._onEndCtx); }
- }
- });
- d.extend(_chain, _baseObj);
- dojo.fx.chain = function(/*dojo.Animation[]*/ animations){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- return new _chain(animations)
- };
- var _combine = function(animations){
- this._animations = animations||[];
- this._connects = [];
- this._finished = 0;
- this.duration = 0;
- d.forEach(animations, function(a){
- var duration = a.duration;
- if(a.delay){ duration += a.delay; }
- if(this.duration < duration){ this.duration = duration; }
- this._connects.push(d.connect(a, "onEnd", this, "_onEnd"));
- }, this);
-
- this._pseudoAnimation = new d.Animation({curve: [0, 1], duration: this.duration});
- var self = this;
- d.forEach(["beforeBegin", "onBegin", "onPlay", "onAnimate", "onPause", "onStop", "onEnd"],
- function(evt){
- self._connects.push(d.connect(self._pseudoAnimation, evt,
- function(){ self._fire(evt, arguments); }
- ));
- }
- );
- };
- d.extend(_combine, {
- _doAction: function(action, args){
- d.forEach(this._animations, function(a){
- a[action].apply(a, args);
- });
- return this;
- },
- _onEnd: function(){
- if(++this._finished > this._animations.length){
- this._fire("onEnd");
- }
- },
- _call: function(action, args){
- var t = this._pseudoAnimation;
- t[action].apply(t, args);
- },
- play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
- this._finished = 0;
- this._doAction("play", arguments);
- this._call("play", arguments);
- return this;
- },
- pause: function(){
- this._doAction("pause", arguments);
- this._call("pause", arguments);
- return this;
- },
- gotoPercent: function(/*Decimal*/percent, /*Boolean?*/ andPlay){
- var ms = this.duration * percent;
- d.forEach(this._animations, function(a){
- a.gotoPercent(a.duration < ms ? 1 : (ms / a.duration), andPlay);
- });
- this._call("gotoPercent", arguments);
- return this;
- },
- stop: function(/*boolean?*/ gotoEnd){
- this._doAction("stop", arguments);
- this._call("stop", arguments);
- return this;
- },
- status: function(){
- return this._pseudoAnimation.status();
- },
- destroy: function(){
- d.forEach(this._connects, dojo.disconnect);
- }
- });
- d.extend(_combine, _baseObj);
- dojo.fx.combine = function(/*dojo.Animation[]*/ animations){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- return new _combine(animations);
- };
- dojo.fx.wipeIn = function(/*Object*/ args){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var node = args.node = d.byId(args.node), s = node.style, o;
- var anim = d.animateProperty(d.mixin({
- properties: {
- height: {
-
- start: function(){
-
-
- o = s.overflow;
- s.overflow = "hidden";
- if(s.visibility == "hidden" || s.display == "none"){
- s.height = "1px";
- s.display = "";
- s.visibility = "";
- return 1;
- }else{
- var height = d.style(node, "height");
- return Math.max(height, 1);
- }
- },
- end: function(){
- return node.scrollHeight;
- }
- }
- }
- }, args));
- d.connect(anim, "onEnd", function(){
- s.height = "auto";
- s.overflow = o;
- });
- return anim;
- };
- dojo.fx.wipeOut = function(/*Object*/ args){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var node = args.node = d.byId(args.node), s = node.style, o;
-
- var anim = d.animateProperty(d.mixin({
- properties: {
- height: {
- end: 1
- }
- }
- }, args));
- d.connect(anim, "beforeBegin", function(){
- o = s.overflow;
- s.overflow = "hidden";
- s.display = "";
- });
- d.connect(anim, "onEnd", function(){
- s.overflow = o;
- s.height = "auto";
- s.display = "none";
- });
- return anim;
- };
- dojo.fx.slideTo = function(/*Object*/ args){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var node = args.node = d.byId(args.node),
- top = null, left = null;
- var init = (function(n){
- return function(){
- var cs = d.getComputedStyle(n);
- var pos = cs.position;
- top = (pos == 'absolute' ? n.offsetTop : parseInt(cs.top) || 0);
- left = (pos == 'absolute' ? n.offsetLeft : parseInt(cs.left) || 0);
- if(pos != 'absolute' && pos != 'relative'){
- var ret = d.position(n, true);
- top = ret.y;
- left = ret.x;
- n.style.position="absolute";
- n.style.top=top+"px";
- n.style.left=left+"px";
- }
- };
- })(node);
- init();
- var anim = d.animateProperty(d.mixin({
- properties: {
- top: args.top || 0,
- left: args.left || 0
- }
- }, args));
- d.connect(anim, "beforeBegin", anim, init);
- return anim;
- };
- })();
- }
- if(!dojo._hasResource["dojox.charting.action2d.Magnify"]){
- dojo._hasResource["dojox.charting.action2d.Magnify"] = true;
- dojo.provide("dojox.charting.action2d.Magnify");
- (function(){
- var DEFAULT_SCALE = 2,
- m = dojox.gfx.matrix,
- gf = dojox.gfx.fx;
- dojo.declare("dojox.charting.action2d.Magnify", dojox.charting.action2d.Base, {
-
-
-
- defaultParams: {
- duration: 400,
- easing: dojo.fx.easing.backOut,
- scale: DEFAULT_SCALE
- },
- optionalParams: {},
- constructor: function(chart, plot, kwArgs){
-
-
-
-
-
-
-
-
-
- this.scale = kwArgs && typeof kwArgs.scale == "number" ? kwArgs.scale : DEFAULT_SCALE;
- this.connect();
- },
- process: function(o){
-
-
-
-
- if(!o.shape || !(o.type in this.overOutEvents) ||
- !("cx" in o) || !("cy" in o)){ return; }
- var runName = o.run.name, index = o.index, vector = [], anim, init, scale;
- if(runName in this.anim){
- anim = this.anim[runName][index];
- }else{
- this.anim[runName] = {};
- }
- if(anim){
- anim.action.stop(true);
- }else{
- this.anim[runName][index] = anim = {};
- }
- if(o.type == "onmouseover"){
- init = m.identity;
- scale = this.scale;
- }else{
- init = m.scaleAt(this.scale, o.cx, o.cy);
- scale = 1 / this.scale;
- }
- var kwArgs = {
- shape: o.shape,
- duration: this.duration,
- easing: this.easing,
- transform: [
- {name: "scaleAt", start: [1, o.cx, o.cy], end: [scale, o.cx, o.cy]},
- init
- ]
- };
- if(o.shape){
- vector.push(gf.animateTransform(kwArgs));
- }
- if(o.oultine){
- kwArgs.shape = o.outline;
- vector.push(gf.animateTransform(kwArgs));
- }
- if(o.shadow){
- kwArgs.shape = o.shadow;
- vector.push(gf.animateTransform(kwArgs));
- }
- if(!vector.length){
- delete this.anim[runName][index];
- return;
- }
- anim.action = dojo.fx.combine(vector);
- if(o.type == "onmouseout"){
- dojo.connect(anim.action, "onEnd", this, function(){
- if(this.anim[runName]){
- delete this.anim[runName][index];
- }
- });
- }
- anim.action.play();
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.lang.functional.scan"]){
- dojo._hasResource["dojox.lang.functional.scan"] = true;
- dojo.provide("dojox.lang.functional.scan");
- (function(){
- var d = dojo, df = dojox.lang.functional, empty = {};
- d.mixin(df, {
-
- scanl: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){
-
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- var t, n, i;
- if(d.isArray(a)){
-
- t = new Array((n = a.length) + 1);
- t[0] = z;
- for(i = 0; i < n; z = f.call(o, z, a[i], i, a), t[++i] = z);
- }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
-
- t = [z];
- for(i = 0; a.hasNext(); t.push(z = f.call(o, z, a.next(), i++, a)));
- }else{
-
- t = [z];
- for(i in a){
- if(!(i in empty)){
- t.push(z = f.call(o, z, a[i], i, a));
- }
- }
- }
- return t;
- },
- scanl1: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
-
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- var t, n, z, first = true;
- if(d.isArray(a)){
-
- t = new Array(n = a.length);
- t[0] = z = a[0];
- for(var i = 1; i < n; t[i] = z = f.call(o, z, a[i], i, a), ++i);
- }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
-
- if(a.hasNext()){
- t = [z = a.next()];
- for(var i = 1; a.hasNext(); t.push(z = f.call(o, z, a.next(), i++, a)));
- }
- }else{
-
- for(var i in a){
- if(!(i in empty)){
- if(first){
- t = [z = a[i]];
- first = false;
- }else{
- t.push(z = f.call(o, z, a[i], i, a));
- }
- }
- }
- }
- return t;
- },
- scanr: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){
-
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- var n = a.length, t = new Array(n + 1), i = n;
- t[n] = z;
- for(; i > 0; --i, z = f.call(o, z, a[i], i, a), t[i] = z);
- return t;
- },
- scanr1: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
-
-
-
- if(typeof a == "string"){ a = a.split(""); }
- o = o || d.global; f = df.lambda(f);
- var n = a.length, t = new Array(n), z = a[n - 1], i = n - 1;
- t[i] = z;
- for(; i > 0; --i, z = f.call(o, z, a[i], i, a), t[i] = z);
- return t;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.action2d.MoveSlice"]){
- dojo._hasResource["dojox.charting.action2d.MoveSlice"] = true;
- dojo.provide("dojox.charting.action2d.MoveSlice");
- (function(){
- var DEFAULT_SCALE = 1.05,
- DEFAULT_SHIFT = 7,
- m = dojox.gfx.matrix,
- gf = dojox.gfx.fx,
- df = dojox.lang.functional;
- dojo.declare("dojox.charting.action2d.MoveSlice", dojox.charting.action2d.Base, {
-
-
-
- defaultParams: {
- duration: 400,
- easing: dojo.fx.easing.backOut,
- scale: DEFAULT_SCALE,
- shift: DEFAULT_SHIFT
- },
- optionalParams: {},
- constructor: function(chart, plot, kwArgs){
-
-
-
-
-
-
-
-
- if(!kwArgs){ kwArgs = {}; }
- this.scale = typeof kwArgs.scale == "number" ? kwArgs.scale : DEFAULT_SCALE;
- this.shift = typeof kwArgs.shift == "number" ? kwArgs.shift : DEFAULT_SHIFT;
- this.connect();
- },
- process: function(o){
-
-
-
-
- if(!o.shape || o.element != "slice" || !(o.type in this.overOutEvents)){ return; }
- if(!this.angles){
-
- var startAngle = m._degToRad(o.plot.opt.startAngle);
- if(typeof o.run.data[0] == "number"){
- this.angles = df.map(df.scanl(o.run.data, "+", startAngle),
- "* 2 * Math.PI / this", df.foldl(o.run.data, "+", 0));
- }else{
- this.angles = df.map(df.scanl(o.run.data, "a + b.y", startAngle),
- "* 2 * Math.PI / this", df.foldl(o.run.data, "a + b.y", 0));
- }
- }
- var index = o.index, anim, startScale, endScale, startOffset, endOffset,
- angle = (this.angles[index] + this.angles[index + 1]) / 2,
- rotateTo0 = m.rotateAt(-angle, o.cx, o.cy),
- rotateBack = m.rotateAt( angle, o.cx, o.cy);
- anim = this.anim[index];
- if(anim){
- anim.action.stop(true);
- }else{
- this.anim[index] = anim = {};
- }
- if(o.type == "onmouseover"){
- startOffset = 0;
- endOffset = this.shift;
- startScale = 1;
- endScale = this.scale;
- }else{
- startOffset = this.shift;
- endOffset = 0;
- startScale = this.scale;
- endScale = 1;
- }
- anim.action = dojox.gfx.fx.animateTransform({
- shape: o.shape,
- duration: this.duration,
- easing: this.easing,
- transform: [
- rotateBack,
- {name: "translate", start: [startOffset, 0], end: [endOffset, 0]},
- {name: "scaleAt", start: [startScale, o.cx, o.cy], end: [endScale, o.cx, o.cy]},
- rotateTo0
- ]
- });
- if(o.type == "onmouseout"){
- dojo.connect(anim.action, "onEnd", this, function(){
- delete this.anim[index];
- });
- }
- anim.action.play();
- },
- reset: function(){
- delete this.angles;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.action2d.Shake"]){
- dojo._hasResource["dojox.charting.action2d.Shake"] = true;
- dojo.provide("dojox.charting.action2d.Shake");
- (function(){
- var DEFAULT_SHIFT = 3,
- m = dojox.gfx.matrix,
- gf = dojox.gfx.fx;
- dojo.declare("dojox.charting.action2d.Shake", dojox.charting.action2d.Base, {
-
-
-
- defaultParams: {
- duration: 400,
- easing: dojo.fx.easing.backOut,
- shiftX: DEFAULT_SHIFT,
- shiftY: DEFAULT_SHIFT
- },
- optionalParams: {},
- constructor: function(chart, plot, kwArgs){
-
-
-
-
-
-
-
-
- if(!kwArgs){ kwArgs = {}; }
- this.shiftX = typeof kwArgs.shiftX == "number" ? kwArgs.shiftX : DEFAULT_SHIFT;
- this.shiftY = typeof kwArgs.shiftY == "number" ? kwArgs.shiftY : DEFAULT_SHIFT;
- this.connect();
- },
- process: function(o){
-
-
-
-
- if(!o.shape || !(o.type in this.overOutEvents)){ return; }
- var runName = o.run.name, index = o.index, vector = [], anim,
- shiftX = o.type == "onmouseover" ? this.shiftX : -this.shiftX,
- shiftY = o.type == "onmouseover" ? this.shiftY : -this.shiftY;
- if(runName in this.anim){
- anim = this.anim[runName][index];
- }else{
- this.anim[runName] = {};
- }
- if(anim){
- anim.action.stop(true);
- }else{
- this.anim[runName][index] = anim = {};
- }
- var kwArgs = {
- shape: o.shape,
- duration: this.duration,
- easing: this.easing,
- transform: [
- {name: "translate", start: [this.shiftX, this.shiftY], end: [0, 0]},
- m.identity
- ]
- };
- if(o.shape){
- vector.push(gf.animateTransform(kwArgs));
- }
- if(o.oultine){
- kwArgs.shape = o.outline;
- vector.push(gf.animateTransform(kwArgs));
- }
- if(o.shadow){
- kwArgs.shape = o.shadow;
- vector.push(gf.animateTransform(kwArgs));
- }
- if(!vector.length){
- delete this.anim[runName][index];
- return;
- }
- anim.action = dojo.fx.combine(vector);
- if(o.type == "onmouseout"){
- dojo.connect(anim.action, "onEnd", this, function(){
- if(this.anim[runName]){
- delete this.anim[runName][index];
- }
- });
- }
- anim.action.play();
- }
- });
- })();
- }
- if(!dojo._hasResource["dojo.string"]){
- dojo._hasResource["dojo.string"] = true;
- dojo.provide("dojo.string");
- dojo.getObject("string", true, dojo);
- dojo.string.rep = function(/*String*/str, /*Integer*/num){
-
-
-
-
-
-
-
- if(num <= 0 || !str){ return ""; }
-
- var buf = [];
- for(;;){
- if(num & 1){
- buf.push(str);
- }
- if(!(num >>= 1)){ break; }
- str += str;
- }
- return buf.join("");
- };
- dojo.string.pad = function(/*String*/text, /*Integer*/size, /*String?*/ch, /*Boolean?*/end){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(!ch){
- ch = '0';
- }
- var out = String(text),
- pad = dojo.string.rep(ch, Math.ceil((size - out.length) / ch.length));
- return end ? out + pad : pad + out;
- };
- dojo.string.substitute = function( /*String*/ template,
- /*Object|Array*/map,
- /*Function?*/ transform,
- /*Object?*/ thisObject){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- thisObject = thisObject || dojo.global;
- transform = transform ?
- dojo.hitch(thisObject, transform) : function(v){ return v; };
- return template.replace(/\$\{([^\s\:\}]+)(?:\:([^\s\:\}]+))?\}/g,
- function(match, key, format){
- var value = dojo.getObject(key, false, map);
- if(format){
- value = dojo.getObject(format, false, thisObject).call(thisObject, value, key);
- }
- return transform(value, key).toString();
- });
- };
- dojo.string.trim = String.prototype.trim ?
- dojo.trim :
- function(str){
- str = str.replace(/^\s+/, '');
- for(var i = str.length - 1; i >= 0; i--){
- if(/\S/.test(str.charAt(i))){
- str = str.substring(0, i + 1);
- break;
- }
- }
- return str;
- };
- }
- if(!dojo._hasResource["dojo.date.stamp"]){
- dojo._hasResource["dojo.date.stamp"] = true;
- dojo.provide("dojo.date.stamp");
- dojo.getObject("date.stamp", true, dojo);
- dojo.date.stamp.fromISOString = function(/*String*/formattedString, /*Number?*/defaultTime){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(!dojo.date.stamp._isoRegExp){
- dojo.date.stamp._isoRegExp =
- /^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(.\d+)?)?((?:[+-](\d{2}):(\d{2}))|Z)?)?$/;
- }
- var match = dojo.date.stamp._isoRegExp.exec(formattedString),
- result = null;
- if(match){
- match.shift();
- if(match[1]){match[1]--;}
- if(match[6]){match[6] *= 1000;}
- if(defaultTime){
-
- defaultTime = new Date(defaultTime);
- dojo.forEach(dojo.map(["FullYear", "Month", "Date", "Hours", "Minutes", "Seconds", "Milliseconds"], function(prop){
- return defaultTime["get" + prop]();
- }), function(value, index){
- match[index] = match[index] || value;
- });
- }
- result = new Date(match[0]||1970, match[1]||0, match[2]||1, match[3]||0, match[4]||0, match[5]||0, match[6]||0);
- if(match[0] < 100){
- result.setFullYear(match[0] || 1970);
- }
- var offset = 0,
- zoneSign = match[7] && match[7].charAt(0);
- if(zoneSign != 'Z'){
- offset = ((match[8] || 0) * 60) + (Number(match[9]) || 0);
- if(zoneSign != '-'){ offset *= -1; }
- }
- if(zoneSign){
- offset -= result.getTimezoneOffset();
- }
- if(offset){
- result.setTime(result.getTime() + offset * 60000);
- }
- }
- return result;
- };
- dojo.date.stamp.toISOString = function(/*Date*/dateObject, /*dojo.date.stamp.__Options?*/options){
-
-
-
-
-
-
-
-
-
-
- var _ = function(n){ return (n < 10) ? "0" + n : n; };
- options = options || {};
- var formattedDate = [],
- getter = options.zulu ? "getUTC" : "get",
- date = "";
- if(options.selector != "time"){
- var year = dateObject[getter+"FullYear"]();
- date = ["0000".substr((year+"").length)+year, _(dateObject[getter+"Month"]()+1), _(dateObject[getter+"Date"]())].join('-');
- }
- formattedDate.push(date);
- if(options.selector != "date"){
- var time = [_(dateObject[getter+"Hours"]()), _(dateObject[getter+"Minutes"]()), _(dateObject[getter+"Seconds"]())].join(':');
- var millis = dateObject[getter+"Milliseconds"]();
- if(options.milliseconds){
- time += "."+ (millis < 100 ? "0" : "") + _(millis);
- }
- if(options.zulu){
- time += "Z";
- }else if(options.selector != "time"){
- var timezoneOffset = dateObject.getTimezoneOffset();
- var absOffset = Math.abs(timezoneOffset);
- time += (timezoneOffset > 0 ? "-" : "+") +
- _(Math.floor(absOffset/60)) + ":" + _(absOffset%60);
- }
- formattedDate.push(time);
- }
- return formattedDate.join('T');
- };
- }
- if(!dojo._hasResource["dojo.parser"]){
- dojo._hasResource["dojo.parser"] = true;
- dojo.provide("dojo.parser");
- new Date("X");
- dojo.parser = new function(){
-
-
- var d = dojo;
- function val2type(/*Object*/ value){
-
-
- if(d.isString(value)){ return "string"; }
- if(typeof value == "number"){ return "number"; }
- if(typeof value == "boolean"){ return "boolean"; }
- if(d.isFunction(value)){ return "function"; }
- if(d.isArray(value)){ return "array"; }
- if(value instanceof Date) { return "date"; }
- if(value instanceof d._Url){ return "url"; }
- return "object";
- }
- function str2obj(/*String*/ value, /*String*/ type){
-
-
- switch(type){
- case "string":
- return value;
- case "number":
- return value.length ? Number(value) : NaN;
- case "boolean":
-
- return typeof value == "boolean" ? value : !(value.toLowerCase()=="false");
- case "function":
- if(d.isFunction(value)){
-
-
-
- value=value.toString();
- value=d.trim(value.substring(value.indexOf('{')+1, value.length-1));
- }
- try{
- if(value === "" || value.search(/[^\w\.]+/i) != -1){
-
- return new Function(value);
- }else{
-
-
- return d.getObject(value, false) || new Function(value);
- }
- }catch(e){ return new Function(); }
- case "array":
- return value ? value.split(/\s*,\s*/) : [];
- case "date":
- switch(value){
- case "": return new Date("");
- case "now": return new Date();
- default: return d.date.stamp.fromISOString(value);
- }
- case "url":
- return d.baseUrl + value;
- default:
- return d.fromJson(value);
- }
- }
- var dummyClass = {}, instanceClasses = {
-
-
- };
-
-
-
-
- d.connect(d, "extend", function(){
- instanceClasses = {};
- });
- function getProtoInfo(cls, params){
-
-
-
-
- for(var name in cls){
- if(name.charAt(0)=="_"){ continue; }
- if(name in dummyClass){ continue; }
- params[name] = val2type(cls[name]);
- }
- return params;
- }
- function getClassInfo(/*String*/ className, /*Boolean*/ skipParamsLookup){
-
-
-
-
-
-
-
-
-
-
-
- var c = instanceClasses[className];
- if(!c){
-
- var cls = d.getObject(className), params = null;
- if(!cls){ return null; }
- if(!skipParamsLookup){
- params = getProtoInfo(cls.prototype, {})
- }
- c = { cls: cls, params: params };
-
- }else if(!skipParamsLookup && !c.params){
-
-
-
-
- c.params = getProtoInfo(c.cls.prototype, {});
- }
-
- return c;
- }
- this._functionFromScript = function(script, attrData){
-
-
-
-
-
-
-
-
- var preamble = "";
- var suffix = "";
- var argsStr = (script.getAttribute(attrData + "args") || script.getAttribute("args"));
- if(argsStr){
- d.forEach(argsStr.split(/\s*,\s*/), function(part, idx){
- preamble += "var "+part+" = arguments["+idx+"]; ";
- });
- }
- var withStr = script.getAttribute("with");
- if(withStr && withStr.length){
- d.forEach(withStr.split(/\s*,\s*/), function(part){
- preamble += "with("+part+"){";
- suffix += "}";
- });
- }
- return new Function(preamble+script.innerHTML+suffix);
- };
- this.instantiate = function(/* Array */nodes, /* Object? */mixin, /* Object? */args){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var thelist = [],
- mixin = mixin||{};
- args = args||{};
-
- var attrName = (args.scope || d._scopeName) + "Type",
- attrData = "data-" + (args.scope || d._scopeName) + "-";
- d.forEach(nodes, function(obj){
- if(!obj){ return; }
-
- var node, type, clsInfo, clazz, scripts, fastpath;
- if(obj.node){
-
- node = obj.node;
- type = obj.type;
- fastpath = obj.fastpath;
- clsInfo = obj.clsInfo || (type && getClassInfo(type, fastpath));
- clazz = clsInfo && clsInfo.cls;
- scripts = obj.scripts;
- }else{
-
- node = obj;
- type = attrName in mixin ? mixin[attrName] : node.getAttribute(attrName);
- clsInfo = type && getClassInfo(type);
- clazz = clsInfo && clsInfo.cls;
- scripts = (clazz && (clazz._noScript || clazz.prototype._noScript) ? [] :
- d.query("> script[type^='dojo/']", node));
- }
- if(!clsInfo){
- throw new Error("Could not load class '" + type);
- }
-
-
-
- var params = {};
-
- if(args.defaults){
-
- d._mixin(params, args.defaults);
- }
- if(obj.inherited){
-
- d._mixin(params, obj.inherited);
- }
-
-
- if(fastpath){
- var extra = node.getAttribute(attrData + "props");
- if(extra && extra.length){
- try{
- extra = d.fromJson.call(args.propsThis, "{" + extra + "}");
- d._mixin(params, extra);
- }catch(e){
-
- throw new Error(e.toString() + " in data-dojo-props='" + extra + "'");
- }
- }
-
-
- var attachPoint = node.getAttribute(attrData + "attach-point");
- if(attachPoint){
- params.dojoAttachPoint = attachPoint;
- }
- var attachEvent = node.getAttribute(attrData + "attach-event");
- if(attachEvent){
- params.dojoAttachEvent = attachEvent;
- }
- dojo.mixin(params, mixin);
- }else{
-
-
-
- var attributes = node.attributes;
-
- for(var name in clsInfo.params){
- var item = name in mixin ? { value:mixin[name], specified:true } : attributes.getNamedItem(name);
- if(!item || (!item.specified && (!dojo.isIE || name.toLowerCase()!="value"))){ continue; }
- var value = item.value;
-
- switch(name){
- case "class":
- value = "className" in mixin ? mixin.className : node.className;
- break;
- case "style":
- value = "style" in mixin ? mixin.style : (node.style && node.style.cssText);
- }
- var _type = clsInfo.params[name];
- if(typeof value == "string"){
- params[name] = str2obj(value, _type);
- }else{
- params[name] = value;
- }
- }
- }
-
-
-
-
-
-
- var connects = [],
- calls = [];
- d.forEach(scripts, function(script){
- node.removeChild(script);
-
- var event = (script.getAttribute(attrData + "event") || script.getAttribute("event")),
- type = script.getAttribute("type"),
- nf = d.parser._functionFromScript(script, attrData);
- if(event){
- if(type == "dojo/connect"){
- connects.push({event: event, func: nf});
- }else{
- params[event] = nf;
- }
- }else{
- calls.push(nf);
- }
- });
- var markupFactory = clazz.markupFactory || clazz.prototype && clazz.prototype.markupFactory;
-
- var instance = markupFactory ? markupFactory(params, node, clazz) : new clazz(params, node);
- thelist.push(instance);
-
-
- var jsname = (node.getAttribute(attrData + "id") || node.getAttribute("jsId"));
- if(jsname){
- d.setObject(jsname, instance);
- }
-
- d.forEach(connects, function(connect){
- d.connect(instance, connect.event, null, connect.func);
- });
- d.forEach(calls, function(func){
- func.call(instance);
- });
- });
-
-
-
- if(!mixin._started){
-
-
-
-
-
- d.forEach(thelist, function(instance){
- if( !args.noStart && instance &&
- dojo.isFunction(instance.startup) &&
- !instance._started &&
- (!instance.getParent || !instance.getParent())
- ){
- instance.startup();
- }
- });
- }
- return thelist;
- };
- this.parse = function(rootNode, args){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var root;
- if(!args && rootNode && rootNode.rootNode){
- args = rootNode;
- root = args.rootNode;
- }else{
- root = rootNode;
- }
- root = root ? dojo.byId(root) : dojo.body();
- args = args || {};
- var attrName = (args.scope || d._scopeName) + "Type",
- attrData = "data-" + (args.scope || d._scopeName) + "-";
- function scan(parent, list){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var inherited = dojo.clone(parent.inherited);
- dojo.forEach(["dir", "lang"], function(name){
-
- var val = parent.node.getAttribute(name);
- if(val){
- inherited[name] = val;
- }
- });
-
- var scripts = parent.clsInfo && !parent.clsInfo.cls.prototype._noScript ? parent.scripts : null;
-
- var recurse = (!parent.clsInfo || !parent.clsInfo.cls.prototype.stopParser) || (args && args.template);
-
- for(var child = parent.node.firstChild; child; child = child.nextSibling){
- if(child.nodeType == 1){
-
- var type, html5 = recurse && child.getAttribute(attrData + "type");
- if(html5){
- type = html5;
- }else{
-
- type = recurse && child.getAttribute(attrName);
- }
-
- var fastpath = html5 == type;
- if(type){
-
- var params = {
- "type": type,
- fastpath: fastpath,
- clsInfo: getClassInfo(type, fastpath),
- node: child,
- scripts: [],
- inherited: inherited
- };
- list.push(params);
-
-
- scan(params, list);
- }else if(scripts && child.nodeName.toLowerCase() == "script"){
-
- type = child.getAttribute("type");
- if (type && /^dojo\/\w/i.test(type)) {
- scripts.push(child);
- }
- }else if(recurse){
-
- scan({
- node: child,
- inherited: inherited
- }, list);
- }
- }
- }
- }
-
- var inherited = {};
- if(args && args.inherited){
- for(var key in args.inherited){
- if(args.inherited[key]){ inherited[key] = args.inherited[key]; }
- }
- }
-
- var list = [];
- scan({
- node: root,
- inherited: inherited
- }, list);
-
- var mixin = args && args.template ? {template: true} : null;
- return this.instantiate(list, mixin, args);
- };
- }();
- (function(){
- var parseRunner = function(){
- if(dojo.config.parseOnLoad){
- dojo.parser.parse();
- }
- };
-
- if(dojo.getObject("dijit.wai.onload") === dojo._loaders[0]){
- dojo._loaders.splice(1, 0, parseRunner);
- }else{
- dojo._loaders.unshift(parseRunner);
- }
- })();
- }
- if(!dojo._hasResource["dojo.cache"]){
- dojo._hasResource["dojo.cache"] = true;
- dojo.provide("dojo.cache");
- var cache = {};
- dojo.cache = function(/*String||Object*/module, /*String*/url, /*String||Object?*/value){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(typeof module == "string"){
- var pathObj = dojo.moduleUrl(module, url);
- }else{
- pathObj = module;
- value = url;
- }
- var key = pathObj.toString();
- var val = value;
- if(value != undefined && !dojo.isString(value)){
- val = ("value" in value ? value.value : undefined);
- }
- var sanitize = value && value.sanitize ? true : false;
- if(typeof val == "string"){
-
- val = cache[key] = sanitize ? dojo.cache._sanitize(val) : val;
- }else if(val === null){
-
- delete cache[key];
- }else{
-
-
- if(!(key in cache)){
- val = dojo._getText(key);
- cache[key] = sanitize ? dojo.cache._sanitize(val) : val;
- }
- val = cache[key];
- }
- return val;
- };
- dojo.cache._sanitize = function(/*String*/val){
-
-
-
-
-
-
- if(val){
- val = val.replace(/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, "");
- var matches = val.match(/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im);
- if(matches){
- val = matches[1];
- }
- }else{
- val = "";
- }
- return val;
- };
- }
- if(!dojo._hasResource["dijit._Templated"]){
- dojo._hasResource["dijit._Templated"] = true;
- dojo.provide("dijit._Templated");
- dojo.declare("dijit._Templated",
- null,
- {
-
-
-
-
-
-
-
-
-
- templateString: null,
-
-
-
- templatePath: null,
-
-
-
- widgetsInTemplate: false,
-
-
-
-
- _skipNodeCache: false,
-
-
-
-
-
-
-
- _earlyTemplatedStartup: false,
- constructor: function(){
- this._attachPoints = [];
- this._attachEvents = [];
- },
- _stringRepl: function(tmpl){
-
-
-
-
- var className = this.declaredClass, _this = this;
-
-
- return dojo.string.substitute(tmpl, this, function(value, key){
- if(key.charAt(0) == '!'){ value = dojo.getObject(key.substr(1), false, _this); }
- if(typeof value == "undefined"){ throw new Error(className+" template:"+key); }
- if(value == null){ return ""; }
-
-
- return key.charAt(0) == "!" ? value :
-
-
- value.toString().replace(/"/g,""");
- }, this);
- },
- buildRendering: function(){
-
-
-
-
-
-
-
- var cached = dijit._Templated.getCachedTemplate(this.templatePath, this.templateString, this._skipNodeCache);
- var node;
- if(dojo.isString(cached)){
- node = dojo._toDom(this._stringRepl(cached));
- if(node.nodeType != 1){
-
- throw new Error("Invalid template: " + cached);
- }
- }else{
-
- node = cached.cloneNode(true);
- }
- this.domNode = node;
-
-
- this.inherited(arguments);
-
-
- this._attachTemplateNodes(node);
- if(this.widgetsInTemplate){
-
- var cw = (this._startupWidgets = dojo.parser.parse(node, {
- noStart: !this._earlyTemplatedStartup,
- template: true,
- inherited: {dir: this.dir, lang: this.lang},
- propsThis: this,
- scope: "dojo"
- }));
- this._supportingWidgets = dijit.findWidgets(node);
- this._attachTemplateNodes(cw, function(n,p){
- return n[p];
- });
- }
- this._fillContent(this.srcNodeRef);
- },
- _fillContent: function(/*DomNode*/ source){
-
-
-
-
-
- var dest = this.containerNode;
- if(source && dest){
- while(source.hasChildNodes()){
- dest.appendChild(source.firstChild);
- }
- }
- },
- _attachTemplateNodes: function(rootNode, getAttrFunc){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getAttrFunc = getAttrFunc || function(n,p){ return n.getAttribute(p); };
- var nodes = dojo.isArray(rootNode) ? rootNode : (rootNode.all || rootNode.getElementsByTagName("*"));
- var x = dojo.isArray(rootNode) ? 0 : -1;
- for(; x<nodes.length; x++){
- var baseNode = (x == -1) ? rootNode : nodes[x];
- if(this.widgetsInTemplate && (getAttrFunc(baseNode, "dojoType") || getAttrFunc(baseNode, "data-dojo-type"))){
- continue;
- }
-
- var attachPoint = getAttrFunc(baseNode, "dojoAttachPoint") || getAttrFunc(baseNode, "data-dojo-attach-point");
- if(attachPoint){
- var point, points = attachPoint.split(/\s*,\s*/);
- while((point = points.shift())){
- if(dojo.isArray(this[point])){
- this[point].push(baseNode);
- }else{
- this[point]=baseNode;
- }
- this._attachPoints.push(point);
- }
- }
-
- var attachEvent = getAttrFunc(baseNode, "dojoAttachEvent") || getAttrFunc(baseNode, "data-dojo-attach-event");;
- if(attachEvent){
-
-
- var event, events = attachEvent.split(/\s*,\s*/);
- var trim = dojo.trim;
- while((event = events.shift())){
- if(event){
- var thisFunc = null;
- if(event.indexOf(":") != -1){
-
- var funcNameArr = event.split(":");
- event = trim(funcNameArr[0]);
- thisFunc = trim(funcNameArr[1]);
- }else{
- event = trim(event);
- }
- if(!thisFunc){
- thisFunc = event;
- }
- this._attachEvents.push(this.connect(baseNode, event, thisFunc));
- }
- }
- }
-
-
- var role = getAttrFunc(baseNode, "waiRole");
- if(role){
- dijit.setWaiRole(baseNode, role);
- }
- var values = getAttrFunc(baseNode, "waiState");
- if(values){
- dojo.forEach(values.split(/\s*,\s*/), function(stateValue){
- if(stateValue.indexOf('-') != -1){
- var pair = stateValue.split('-');
- dijit.setWaiState(baseNode, pair[0], pair[1]);
- }
- });
- }
- }
- },
- startup: function(){
- dojo.forEach(this._startupWidgets, function(w){
- if(w && !w._started && w.startup){
- w.startup();
- }
- });
- this.inherited(arguments);
- },
- destroyRendering: function(){
-
- dojo.forEach(this._attachPoints, function(point){
- delete this[point];
- }, this);
- this._attachPoints = [];
-
- dojo.forEach(this._attachEvents, this.disconnect, this);
- this._attachEvents = [];
-
- this.inherited(arguments);
- }
- }
- );
- dijit._Templated._templateCache = {};
- dijit._Templated.getCachedTemplate = function(templatePath, templateString, alwaysUseString){
-
-
-
-
-
-
-
-
-
-
-
-
- var tmplts = dijit._Templated._templateCache;
- var key = templateString || templatePath;
- var cached = tmplts[key];
- if(cached){
- try{
-
- if(!cached.ownerDocument || cached.ownerDocument == dojo.doc){
-
- return cached;
- }
- }catch(e){ }
- dojo.destroy(cached);
- }
-
- if(!templateString){
- templateString = dojo.cache(templatePath, {sanitize: true});
- }
- templateString = dojo.string.trim(templateString);
- if(alwaysUseString || templateString.match(/\$\{([^\}]+)\}/g)){
-
- return (tmplts[key] = templateString);
- }else{
-
- var node = dojo._toDom(templateString);
- if(node.nodeType != 1){
- throw new Error("Invalid template: " + templateString);
- }
- return (tmplts[key] = node);
- }
- };
- if(dojo.isIE){
- dojo.addOnWindowUnload(function(){
- var cache = dijit._Templated._templateCache;
- for(var key in cache){
- var value = cache[key];
- if(typeof value == "object"){
- dojo.destroy(value);
- }
- delete cache[key];
- }
- });
- }
- dojo.extend(dijit._Widget,{
- dojoAttachEvent: "",
- dojoAttachPoint: "",
- waiRole: "",
- waiState:""
- });
- }
- if(!dojo._hasResource["dijit.Tooltip"]){
- dojo._hasResource["dijit.Tooltip"] = true;
- dojo.provide("dijit.Tooltip");
- dojo.declare(
- "dijit._MasterTooltip",
- [dijit._Widget, dijit._Templated],
- {
-
-
-
-
-
-
-
-
-
- duration: dijit.defaultDuration,
- templateString: dojo.cache("dijit", "templates/Tooltip.html", "<div class=\"dijitTooltip dijitTooltipLeft\" id=\"dojoTooltip\"\n\t><div class=\"dijitTooltipContainer dijitTooltipContents\" dojoAttachPoint=\"containerNode\" role='alert'></div\n\t><div class=\"dijitTooltipConnector\" dojoAttachPoint=\"connectorNode\"></div\n></div>\n"),
- postCreate: function(){
- dojo.body().appendChild(this.domNode);
- this.bgIframe = new dijit.BackgroundIframe(this.domNode);
-
- this.fadeIn = dojo.fadeIn({ node: this.domNode, duration: this.duration, onEnd: dojo.hitch(this, "_onShow") });
- this.fadeOut = dojo.fadeOut({ node: this.domNode, duration: this.duration, onEnd: dojo.hitch(this, "_onHide") });
- },
- show: function(/*String*/ innerHTML, /*DomNode*/ aroundNode, /*String[]?*/ position, /*Boolean*/ rtl){
-
-
-
- if(this.aroundNode && this.aroundNode === aroundNode){
- return;
- }
-
- this.domNode.width = "auto";
- if(this.fadeOut.status() == "playing"){
-
- this._onDeck=arguments;
- return;
- }
- this.containerNode.innerHTML=innerHTML;
- var pos = dijit.placeOnScreenAroundElement(this.domNode, aroundNode, dijit.getPopupAroundAlignment((position && position.length) ? position : dijit.Tooltip.defaultPosition, !rtl), dojo.hitch(this, "orient"));
-
- dojo.style(this.domNode, "opacity", 0);
- this.fadeIn.play();
- this.isShowingNow = true;
- this.aroundNode = aroundNode;
- },
- orient: function(/*DomNode*/ node, /*String*/ aroundCorner, /*String*/ tooltipCorner, /*Object*/ spaceAvailable, /*Object*/ aroundNodeCoords){
-
-
-
-
-
-
- this.connectorNode.style.top = "";
-
-
- var tooltipSpaceAvaliableWidth = spaceAvailable.w - this.connectorNode.offsetWidth;
- node.className = "dijitTooltip " +
- {
- "BL-TL": "dijitTooltipBelow dijitTooltipABLeft",
- "TL-BL": "dijitTooltipAbove dijitTooltipABLeft",
- "BR-TR": "dijitTooltipBelow dijitTooltipABRight",
- "TR-BR": "dijitTooltipAbove dijitTooltipABRight",
- "BR-BL": "dijitTooltipRight",
- "BL-BR": "dijitTooltipLeft"
- }[aroundCorner + "-" + tooltipCorner];
-
-
- this.domNode.style.width = "auto";
- var size = dojo.contentBox(this.domNode);
-
- var width = Math.min((Math.max(tooltipSpaceAvaliableWidth,1)), size.w);
- var widthWasReduced = width < size.w;
-
- this.domNode.style.width = width+"px";
-
-
- if(widthWasReduced){
- this.containerNode.style.overflow = "auto";
- var scrollWidth = this.containerNode.scrollWidth;
- this.containerNode.style.overflow = "visible";
- if(scrollWidth > width){
- scrollWidth = scrollWidth + dojo.style(this.domNode,"paddingLeft") + dojo.style(this.domNode,"paddingRight");
- this.domNode.style.width = scrollWidth + "px";
- }
- }
-
-
- if(tooltipCorner.charAt(0) == 'B' && aroundCorner.charAt(0) == 'B'){
- var mb = dojo.marginBox(node);
- var tooltipConnectorHeight = this.connectorNode.offsetHeight;
- if(mb.h > spaceAvailable.h){
-
- var aroundNodePlacement = spaceAvailable.h - (aroundNodeCoords.h / 2) - (tooltipConnectorHeight / 2);
- this.connectorNode.style.top = aroundNodePlacement + "px";
- this.connectorNode.style.bottom = "";
- }else{
-
-
-
- this.connectorNode.style.bottom = Math.min(
- Math.max(aroundNodeCoords.h/2 - tooltipConnectorHeight/2, 0),
- mb.h - tooltipConnectorHeight) + "px";
- this.connectorNode.style.top = "";
- }
- }else{
-
- this.connectorNode.style.top = "";
- this.connectorNode.style.bottom = "";
- }
-
- return Math.max(0, size.w - tooltipSpaceAvaliableWidth);
- },
- _onShow: function(){
-
-
-
-
- if(dojo.isIE){
-
- this.domNode.style.filter="";
- }
- },
- hide: function(aroundNode){
-
-
- if(this._onDeck && this._onDeck[1] == aroundNode){
-
-
- this._onDeck=null;
- }else if(this.aroundNode === aroundNode){
-
- this.fadeIn.stop();
- this.isShowingNow = false;
- this.aroundNode = null;
- this.fadeOut.play();
- }else{
-
- }
- },
- _onHide: function(){
-
-
-
-
- this.domNode.style.cssText="";
- this.containerNode.innerHTML="";
- if(this._onDeck){
-
- this.show.apply(this, this._onDeck);
- this._onDeck=null;
- }
- }
- }
- );
- dijit.showTooltip = function(/*String*/ innerHTML, /*DomNode*/ aroundNode, /*String[]?*/ position, /*Boolean*/ rtl){
-
-
-
-
- if(!dijit._masterTT){ dijit._masterTT = new dijit._MasterTooltip(); }
- return dijit._masterTT.show(innerHTML, aroundNode, position, rtl);
- };
- dijit.hideTooltip = function(aroundNode){
-
-
- if(!dijit._masterTT){ dijit._masterTT = new dijit._MasterTooltip(); }
- return dijit._masterTT.hide(aroundNode);
- };
- dojo.declare(
- "dijit.Tooltip",
- dijit._Widget,
- {
-
-
-
-
-
- label: "",
-
-
-
- showDelay: 400,
-
-
-
- connectId: [],
-
-
- position: [],
- _setConnectIdAttr: function(/*String*/ newId){
-
-
-
- dojo.forEach(this._connections || [], function(nested){
- dojo.forEach(nested, dojo.hitch(this, "disconnect"));
- }, this);
-
- var ary = dojo.isArrayLike(newId) ? newId : (newId ? [newId] : []);
- this._connections = dojo.map(ary, function(id){
- var node = dojo.byId(id);
- return node ? [
- this.connect(node, "onmouseenter", "_onTargetMouseEnter"),
- this.connect(node, "onmouseleave", "_onTargetMouseLeave"),
- this.connect(node, "onfocus", "_onTargetFocus"),
- this.connect(node, "onblur", "_onTargetBlur")
- ] : [];
- }, this);
-
- this._set("connectId", newId);
- this._connectIds = ary;
- },
- addTarget: function(/*DOMNODE || String*/ node){
-
-
-
- var id = node.id || node;
- if(dojo.indexOf(this._connectIds, id) == -1){
- this.set("connectId", this._connectIds.concat(id));
- }
- },
- removeTarget: function(/*DOMNODE || String*/ node){
-
-
-
-
- var id = node.id || node,
- idx = dojo.indexOf(this._connectIds, id);
- if(idx >= 0){
-
- this._connectIds.splice(idx, 1);
- this.set("connectId", this._connectIds);
- }
- },
- buildRendering: function(){
- this.inherited(arguments);
- dojo.addClass(this.domNode,"dijitTooltipData");
- },
- startup: function(){
- this.inherited(arguments);
-
-
- var ids = this.connectId;
- dojo.forEach(dojo.isArrayLike(ids) ? ids : [ids], this.addTarget, this);
- },
- _onTargetMouseEnter: function(/*Event*/ e){
-
-
-
-
- this._onHover(e);
- },
- _onTargetMouseLeave: function(/*Event*/ e){
-
-
-
-
- this._onUnHover(e);
- },
- _onTargetFocus: function(/*Event*/ e){
-
-
-
-
- this._focus = true;
- this._onHover(e);
- },
- _onTargetBlur: function(/*Event*/ e){
-
-
-
-
- this._focus = false;
- this._onUnHover(e);
- },
- _onHover: function(/*Event*/ e){
-
-
-
-
-
- if(!this._showTimer){
- var target = e.target;
- this._showTimer = setTimeout(dojo.hitch(this, function(){this.open(target)}), this.showDelay);
- }
- },
- _onUnHover: function(/*Event*/ e){
-
-
-
-
-
-
-
- if(this._focus){ return; }
- if(this._showTimer){
- clearTimeout(this._showTimer);
- delete this._showTimer;
- }
- this.close();
- },
- open: function(/*DomNode*/ target){
-
-
-
-
- if(this._showTimer){
- clearTimeout(this._showTimer);
- delete this._showTimer;
- }
- dijit.showTooltip(this.label || this.domNode.innerHTML, target, this.position, !this.isLeftToRight());
- this._connectNode = target;
- this.onShow(target, this.position);
- },
- close: function(){
-
-
-
-
- if(this._connectNode){
-
- dijit.hideTooltip(this._connectNode);
- delete this._connectNode;
- this.onHide();
- }
- if(this._showTimer){
-
- clearTimeout(this._showTimer);
- delete this._showTimer;
- }
- },
- onShow: function(target, position){
-
-
-
-
- },
- onHide: function(){
-
-
-
-
- },
- uninitialize: function(){
- this.close();
- this.inherited(arguments);
- }
- }
- );
- dijit.Tooltip.defaultPosition = ["after", "before"];
- }
- if(!dojo._hasResource["dojox.charting.action2d.Tooltip"]){
- dojo._hasResource["dojox.charting.action2d.Tooltip"] = true;
- dojo.provide("dojox.charting.action2d.Tooltip");
- (function(){
- var DEFAULT_TEXT = function(o){
- var t = o.run && o.run.data && o.run.data[o.index];
- if(t && typeof t != "number" && (t.tooltip || t.text)){
- return t.tooltip || t.text;
- }
- if(o.element == "candlestick"){
- return '<table cellpadding="1" cellspacing="0" border="0" style="font-size:0.9em;">'
- + '<tr><td>Open:</td><td align="right"><strong>' + o.data.open + '</strong></td></tr>'
- + '<tr><td>High:</td><td align="right"><strong>' + o.data.high + '</strong></td></tr>'
- + '<tr><td>Low:</td><td align="right"><strong>' + o.data.low + '</strong></td></tr>'
- + '<tr><td>Close:</td><td align="right"><strong>' + o.data.close + '</strong></td></tr>'
- + (o.data.mid !== undefined ? '<tr><td>Mid:</td><td align="right"><strong>' + o.data.mid + '</strong></td></tr>' : '')
- + '</table>';
- }
- return o.element == "bar" ? o.x : o.y;
- };
- var df = dojox.lang.functional, m = dojox.gfx.matrix, pi4 = Math.PI / 4, pi2 = Math.PI / 2;
-
- dojo.declare("dojox.charting.action2d.Tooltip", dojox.charting.action2d.Base, {
-
-
-
- defaultParams: {
- text: DEFAULT_TEXT
- },
- optionalParams: {},
- constructor: function(chart, plot, kwArgs){
-
-
-
-
-
-
-
-
- this.text = kwArgs && kwArgs.text ? kwArgs.text : DEFAULT_TEXT;
-
- this.connect();
- },
-
- process: function(o){
-
-
-
-
- if(o.type === "onplotreset" || o.type === "onmouseout"){
- dijit.hideTooltip(this.aroundRect);
- this.aroundRect = null;
- if(o.type === "onplotreset"){
- delete this.angles;
- }
- return;
- }
-
- if(!o.shape || o.type !== "onmouseover"){ return; }
-
-
- var aroundRect = {type: "rect"}, position = ["after", "before"];
- switch(o.element){
- case "marker":
- aroundRect.x = o.cx;
- aroundRect.y = o.cy;
- aroundRect.width = aroundRect.height = 1;
- break;
- case "circle":
- aroundRect.x = o.cx - o.cr;
- aroundRect.y = o.cy - o.cr;
- aroundRect.width = aroundRect.height = 2 * o.cr;
- break;
- case "column":
- position = ["above", "below"];
-
- case "bar":
- aroundRect = dojo.clone(o.shape.getShape());
- break;
- case "candlestick":
- aroundRect.x = o.x;
- aroundRect.y = o.y;
- aroundRect.width = o.width;
- aroundRect.height = o.height;
- break;
- default:
-
- if(!this.angles){
-
- if(typeof o.run.data[0] == "number"){
- this.angles = df.map(df.scanl(o.run.data, "+", 0),
- "* 2 * Math.PI / this", df.foldl(o.run.data, "+", 0));
- }else{
- this.angles = df.map(df.scanl(o.run.data, "a + b.y", 0),
- "* 2 * Math.PI / this", df.foldl(o.run.data, "a + b.y", 0));
- }
- }
- var startAngle = m._degToRad(o.plot.opt.startAngle),
- angle = (this.angles[o.index] + this.angles[o.index + 1]) / 2 + startAngle;
- aroundRect.x = o.cx + o.cr * Math.cos(angle);
- aroundRect.y = o.cy + o.cr * Math.sin(angle);
- aroundRect.width = aroundRect.height = 1;
-
- if(angle < pi4){
-
- }else if(angle < pi2 + pi4){
- position = ["below", "above"];
- }else if(angle < Math.PI + pi4){
- position = ["before", "after"];
- }else if(angle < 2 * Math.PI - pi4){
- position = ["above", "below"];
- }
-
- break;
- }
-
-
- var lt = dojo.coords(this.chart.node, true);
- aroundRect.x += lt.x;
- aroundRect.y += lt.y;
- aroundRect.x = Math.round(aroundRect.x);
- aroundRect.y = Math.round(aroundRect.y);
- aroundRect.width = Math.ceil(aroundRect.width);
- aroundRect.height = Math.ceil(aroundRect.height);
- this.aroundRect = aroundRect;
- var tooltip = this.text(o);
- if(tooltip){
- dijit.showTooltip(tooltip, this.aroundRect, position);
- }
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.scaler.common"]){
- dojo._hasResource["dojox.charting.scaler.common"] = true;
- dojo.provide("dojox.charting.scaler.common");
- (function(){
- var eq = function(/*Number*/ a, /*Number*/ b){
-
- return Math.abs(a - b) <= 1e-6 * (Math.abs(a) + Math.abs(b));
- };
-
- dojo.mixin(dojox.charting.scaler.common, {
- findString: function(/*String*/ val, /*Array*/ text){
- val = val.toLowerCase();
- for(var i = 0; i < text.length; ++i){
- if(val == text[i]){ return true; }
- }
- return false;
- },
- getNumericLabel: function(/*Number*/ number, /*Number*/ precision, /*Object*/ kwArgs){
- var def = "";
- if(dojo.number){
- def = (kwArgs.fixed ? dojo.number.format(number, {places : precision < 0 ? -precision : 0}) :
- dojo.number.format(number)) || "";
- }else{
- def = kwArgs.fixed ? number.toFixed(precision < 0 ? -precision : 0) : number.toString();
- }
- if(kwArgs.labelFunc){
- var r = kwArgs.labelFunc(def, number, precision);
- if(r){ return r; }
-
- }
- if(kwArgs.labels){
-
- var l = kwArgs.labels, lo = 0, hi = l.length;
- while(lo < hi){
- var mid = Math.floor((lo + hi) / 2), val = l[mid].value;
- if(val < number){
- lo = mid + 1;
- }else{
- hi = mid;
- }
- }
-
- if(lo < l.length && eq(l[lo].value, number)){
- return l[lo].text;
- }
- --lo;
- if(lo >= 0 && lo < l.length && eq(l[lo].value, number)){
- return l[lo].text;
- }
- lo += 2;
- if(lo < l.length && eq(l[lo].value, number)){
- return l[lo].text;
- }
-
- }
- return def;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.scaler.linear"]){
- dojo._hasResource["dojox.charting.scaler.linear"] = true;
- dojo.provide("dojox.charting.scaler.linear");
- (function(){
- var deltaLimit = 3,
- dc = dojox.charting, dcs = dc.scaler, dcsc = dcs.common,
- findString = dcsc.findString,
- getLabel = dcsc.getNumericLabel;
-
- var calcTicks = function(min, max, kwArgs, majorTick, minorTick, microTick, span){
- kwArgs = dojo.delegate(kwArgs);
- if(!majorTick){
- if(kwArgs.fixUpper == "major"){ kwArgs.fixUpper = "minor"; }
- if(kwArgs.fixLower == "major"){ kwArgs.fixLower = "minor"; }
- }
- if(!minorTick){
- if(kwArgs.fixUpper == "minor"){ kwArgs.fixUpper = "micro"; }
- if(kwArgs.fixLower == "minor"){ kwArgs.fixLower = "micro"; }
- }
- if(!microTick){
- if(kwArgs.fixUpper == "micro"){ kwArgs.fixUpper = "none"; }
- if(kwArgs.fixLower == "micro"){ kwArgs.fixLower = "none"; }
- }
- var lowerBound = findString(kwArgs.fixLower, ["major"]) ?
- Math.floor(kwArgs.min / majorTick) * majorTick :
- findString(kwArgs.fixLower, ["minor"]) ?
- Math.floor(kwArgs.min / minorTick) * minorTick :
- findString(kwArgs.fixLower, ["micro"]) ?
- Math.floor(kwArgs.min / microTick) * microTick : kwArgs.min,
- upperBound = findString(kwArgs.fixUpper, ["major"]) ?
- Math.ceil(kwArgs.max / majorTick) * majorTick :
- findString(kwArgs.fixUpper, ["minor"]) ?
- Math.ceil(kwArgs.max / minorTick) * minorTick :
- findString(kwArgs.fixUpper, ["micro"]) ?
- Math.ceil(kwArgs.max / microTick) * microTick : kwArgs.max;
-
- if(kwArgs.useMin){ min = lowerBound; }
- if(kwArgs.useMax){ max = upperBound; }
-
- var majorStart = (!majorTick || kwArgs.useMin && findString(kwArgs.fixLower, ["major"])) ?
- min : Math.ceil(min / majorTick) * majorTick,
- minorStart = (!minorTick || kwArgs.useMin && findString(kwArgs.fixLower, ["major", "minor"])) ?
- min : Math.ceil(min / minorTick) * minorTick,
- microStart = (! microTick || kwArgs.useMin && findString(kwArgs.fixLower, ["major", "minor", "micro"])) ?
- min : Math.ceil(min / microTick) * microTick,
- majorCount = !majorTick ? 0 : (kwArgs.useMax && findString(kwArgs.fixUpper, ["major"]) ?
- Math.round((max - majorStart) / majorTick) :
- Math.floor((max - majorStart) / majorTick)) + 1,
- minorCount = !minorTick ? 0 : (kwArgs.useMax && findString(kwArgs.fixUpper, ["major", "minor"]) ?
- Math.round((max - minorStart) / minorTick) :
- Math.floor((max - minorStart) / minorTick)) + 1,
- microCount = !microTick ? 0 : (kwArgs.useMax && findString(kwArgs.fixUpper, ["major", "minor", "micro"]) ?
- Math.round((max - microStart) / microTick) :
- Math.floor((max - microStart) / microTick)) + 1,
- minorPerMajor = minorTick ? Math.round(majorTick / minorTick) : 0,
- microPerMinor = microTick ? Math.round(minorTick / microTick) : 0,
- majorPrecision = majorTick ? Math.floor(Math.log(majorTick) / Math.LN10) : 0,
- minorPrecision = minorTick ? Math.floor(Math.log(minorTick) / Math.LN10) : 0,
- scale = span / (max - min);
- if(!isFinite(scale)){ scale = 1; }
-
- return {
- bounds: {
- lower: lowerBound,
- upper: upperBound,
- from: min,
- to: max,
- scale: scale,
- span: span
- },
- major: {
- tick: majorTick,
- start: majorStart,
- count: majorCount,
- prec: majorPrecision
- },
- minor: {
- tick: minorTick,
- start: minorStart,
- count: minorCount,
- prec: minorPrecision
- },
- micro: {
- tick: microTick,
- start: microStart,
- count: microCount,
- prec: 0
- },
- minorPerMajor: minorPerMajor,
- microPerMinor: microPerMinor,
- scaler: dcs.linear
- };
- };
-
- dojo.mixin(dojox.charting.scaler.linear, {
- buildScaler: function(/*Number*/ min, /*Number*/ max, /*Number*/ span, /*Object*/ kwArgs){
- var h = {fixUpper: "none", fixLower: "none", natural: false};
- if(kwArgs){
- if("fixUpper" in kwArgs){ h.fixUpper = String(kwArgs.fixUpper); }
- if("fixLower" in kwArgs){ h.fixLower = String(kwArgs.fixLower); }
- if("natural" in kwArgs){ h.natural = Boolean(kwArgs.natural); }
- }
-
-
- if("min" in kwArgs){ min = kwArgs.min; }
- if("max" in kwArgs){ max = kwArgs.max; }
- if(kwArgs.includeZero){
- if(min > 0){ min = 0; }
- if(max < 0){ max = 0; }
- }
- h.min = min;
- h.useMin = true;
- h.max = max;
- h.useMax = true;
-
- if("from" in kwArgs){
- min = kwArgs.from;
- h.useMin = false;
- }
- if("to" in kwArgs){
- max = kwArgs.to;
- h.useMax = false;
- }
-
-
- if(max <= min){
- return calcTicks(min, max, h, 0, 0, 0, span);
- }
-
- var mag = Math.floor(Math.log(max - min) / Math.LN10),
- major = kwArgs && ("majorTickStep" in kwArgs) ? kwArgs.majorTickStep : Math.pow(10, mag),
- minor = 0, micro = 0, ticks;
-
-
- if(kwArgs && ("minorTickStep" in kwArgs)){
- minor = kwArgs.minorTickStep;
- }else{
- do{
- minor = major / 10;
- if(!h.natural || minor > 0.9){
- ticks = calcTicks(min, max, h, major, minor, 0, span);
- if(ticks.bounds.scale * ticks.minor.tick > deltaLimit){ break; }
- }
- minor = major / 5;
- if(!h.natural || minor > 0.9){
- ticks = calcTicks(min, max, h, major, minor, 0, span);
- if(ticks.bounds.scale * ticks.minor.tick > deltaLimit){ break; }
- }
- minor = major / 2;
- if(!h.natural || minor > 0.9){
- ticks = calcTicks(min, max, h, major, minor, 0, span);
- if(ticks.bounds.scale * ticks.minor.tick > deltaLimit){ break; }
- }
- return calcTicks(min, max, h, major, 0, 0, span);
- }while(false);
- }
-
-
- if(kwArgs && ("microTickStep" in kwArgs)){
- micro = kwArgs.microTickStep;
- ticks = calcTicks(min, max, h, major, minor, micro, span);
- }else{
- do{
- micro = minor / 10;
- if(!h.natural || micro > 0.9){
- ticks = calcTicks(min, max, h, major, minor, micro, span);
- if(ticks.bounds.scale * ticks.micro.tick > deltaLimit){ break; }
- }
- micro = minor / 5;
- if(!h.natural || micro > 0.9){
- ticks = calcTicks(min, max, h, major, minor, micro, span);
- if(ticks.bounds.scale * ticks.micro.tick > deltaLimit){ break; }
- }
- micro = minor / 2;
- if(!h.natural || micro > 0.9){
- ticks = calcTicks(min, max, h, major, minor, micro, span);
- if(ticks.bounds.scale * ticks.micro.tick > deltaLimit){ break; }
- }
- micro = 0;
- }while(false);
- }
-
- return micro ? ticks : calcTicks(min, max, h, major, minor, 0, span);
- },
- buildTicks: function(/*Object*/ scaler, /*Object*/ kwArgs){
- var step, next, tick,
- nextMajor = scaler.major.start,
- nextMinor = scaler.minor.start,
- nextMicro = scaler.micro.start;
- if(kwArgs.microTicks && scaler.micro.tick){
- step = scaler.micro.tick, next = nextMicro;
- }else if(kwArgs.minorTicks && scaler.minor.tick){
- step = scaler.minor.tick, next = nextMinor;
- }else if(scaler.major.tick){
- step = scaler.major.tick, next = nextMajor;
- }else{
-
- return null;
- }
-
- var revScale = 1 / scaler.bounds.scale;
- if(scaler.bounds.to <= scaler.bounds.from || isNaN(revScale) || !isFinite(revScale) ||
- step <= 0 || isNaN(step) || !isFinite(step)){
-
- return null;
- }
-
- var majorTicks = [], minorTicks = [], microTicks = [];
- while(next <= scaler.bounds.to + revScale){
- if(Math.abs(nextMajor - next) < step / 2){
-
- tick = {value: nextMajor};
- if(kwArgs.majorLabels){
- tick.label = getLabel(nextMajor, scaler.major.prec, kwArgs);
- }
- majorTicks.push(tick);
- nextMajor += scaler.major.tick;
- nextMinor += scaler.minor.tick;
- nextMicro += scaler.micro.tick;
- }else if(Math.abs(nextMinor - next) < step / 2){
-
- if(kwArgs.minorTicks){
- tick = {value: nextMinor};
- if(kwArgs.minorLabels && (scaler.minMinorStep <= scaler.minor.tick * scaler.bounds.scale)){
- tick.label = getLabel(nextMinor, scaler.minor.prec, kwArgs);
- }
- minorTicks.push(tick);
- }
- nextMinor += scaler.minor.tick;
- nextMicro += scaler.micro.tick;
- }else{
-
- if(kwArgs.microTicks){
- microTicks.push({value: nextMicro});
- }
- nextMicro += scaler.micro.tick;
- }
- next += step;
- }
- return {major: majorTicks, minor: minorTicks, micro: microTicks};
- },
- getTransformerFromModel: function(/*Object*/ scaler){
- var offset = scaler.bounds.from, scale = scaler.bounds.scale;
- return function(x){ return (x - offset) * scale; };
- },
- getTransformerFromPlot: function(/*Object*/ scaler){
- var offset = scaler.bounds.from, scale = scaler.bounds.scale;
- return function(x){ return x / scale + offset; };
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.axis2d.Base"]){
- dojo._hasResource["dojox.charting.axis2d.Base"] = true;
- dojo.provide("dojox.charting.axis2d.Base");
- dojo.declare("dojox.charting.axis2d.Base", dojox.charting.Element, {
-
-
-
-
- constructor: function(chart, kwArgs){
-
-
-
-
-
-
- this.vertical = kwArgs && kwArgs.vertical;
- },
- clear: function(){
-
-
-
-
- return this;
- },
- initialized: function(){
-
-
-
-
- return false;
- },
- calculate: function(min, max, span){
-
-
-
-
- return this;
- },
- getScaler: function(){
-
-
-
-
- return null;
- },
- getTicks: function(){
-
-
-
-
- return null;
- },
- getOffsets: function(){
-
-
-
-
- return {l: 0, r: 0, t: 0, b: 0};
- },
- render: function(dim, offsets){
-
-
-
-
- this.dirty = false;
- return this;
- }
- });
- }
- if(!dojo._hasResource["dojox.charting.axis2d.Invisible"]){
- dojo._hasResource["dojox.charting.axis2d.Invisible"] = true;
- dojo.provide("dojox.charting.axis2d.Invisible");
- (function(){
- var dc = dojox.charting,
- df = dojox.lang.functional,
- du = dojox.lang.utils,
- g = dojox.gfx,
- lin = dc.scaler.linear,
- merge = du.merge,
- labelGap = 4,
- centerAnchorLimit = 45;
- dojo.declare("dojox.charting.axis2d.Invisible", dojox.charting.axis2d.Base, {
-
-
-
-
-
-
-
-
- defaultParams: {
- vertical: false,
- fixUpper: "none",
- fixLower: "none",
- natural: false,
- leftBottom: true,
- includeZero: false,
- fixed: true,
- majorLabels: true,
- minorTicks: true,
- minorLabels: true,
- microTicks: false,
- rotation: 0
- },
- optionalParams: {
- min: 0,
- max: 1,
- from: 0,
- to: 1,
- majorTickStep: 4,
- minorTickStep: 2,
- microTickStep: 1,
- labels: [],
-
-
- labelFunc: null,
- maxLabelSize: 0,
- maxLabelCharCount: 0,
- trailingSymbol: null
-
-
- },
- constructor: function(chart, kwArgs){
-
-
-
-
-
-
- this.opt = dojo.clone(this.defaultParams);
- du.updateWithObject(this.opt, kwArgs);
- du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
- },
- dependOnData: function(){
-
-
- return !("min" in this.opt) || !("max" in this.opt);
- },
- clear: function(){
-
-
-
-
- delete this.scaler;
- delete this.ticks;
- this.dirty = true;
- return this;
- },
- initialized: function(){
-
-
-
-
- return "scaler" in this && !(this.dirty && this.dependOnData());
- },
- setWindow: function(scale, offset){
-
-
-
-
-
-
-
-
- this.scale = scale;
- this.offset = offset;
- return this.clear();
- },
- getWindowScale: function(){
-
-
- return "scale" in this ? this.scale : 1;
- },
- getWindowOffset: function(){
-
-
- return "offset" in this ? this.offset : 0;
- },
- _groupLabelWidth: function(labels, font, wcLimit){
- if(!labels.length){
- return 0;
- }
- if(dojo.isObject(labels[0])){
- labels = df.map(labels, function(label){ return label.text; });
- }
- if (wcLimit) {
- labels = df.map(labels, function(label){
- return dojo.trim(label).length == 0 ? "" : label.substring(0, wcLimit) + this.trailingSymbol;
- }, this);
- }
- var s = labels.join("<br>");
- return dojox.gfx._base._getTextBox(s, {font: font}).w || 0;
- },
- calculate: function(min, max, span, labels){
-
-
-
-
-
-
-
-
-
-
-
-
- if(this.initialized()){
- return this;
- }
- var o = this.opt;
- this.labels = "labels" in o ? o.labels : labels;
- this.scaler = lin.buildScaler(min, max, span, o);
- var tsb = this.scaler.bounds;
- if("scale" in this){
-
- o.from = tsb.lower + this.offset;
- o.to = (tsb.upper - tsb.lower) / this.scale + o.from;
-
- if( !isFinite(o.from) ||
- isNaN(o.from) ||
- !isFinite(o.to) ||
- isNaN(o.to) ||
- o.to - o.from >= tsb.upper - tsb.lower
- ){
-
- delete o.from;
- delete o.to;
- delete this.scale;
- delete this.offset;
- }else{
-
- if(o.from < tsb.lower){
- o.to += tsb.lower - o.from;
- o.from = tsb.lower;
- }else if(o.to > tsb.upper){
- o.from += tsb.upper - o.to;
- o.to = tsb.upper;
- }
-
- this.offset = o.from - tsb.lower;
- }
-
- this.scaler = lin.buildScaler(min, max, span, o);
- tsb = this.scaler.bounds;
-
- if(this.scale == 1 && this.offset == 0){
- delete this.scale;
- delete this.offset;
- }
- }
- var ta = this.chart.theme.axis, labelWidth = 0, rotation = o.rotation % 360,
-
- taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font),
- size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,
- cosr = Math.abs(Math.cos(rotation * Math.PI / 180)),
- sinr = Math.abs(Math.sin(rotation * Math.PI / 180));
- if(rotation < 0){
- rotation += 360;
- }
- if(size){
- if(this.vertical ? rotation != 0 && rotation != 180 : rotation != 90 && rotation != 270){
-
- if(this.labels){
- labelWidth = this._groupLabelWidth(this.labels, taFont, o.maxLabelCharCount);
- }else{
- var labelLength = Math.ceil(
- Math.log(
- Math.max(
- Math.abs(tsb.from),
- Math.abs(tsb.to)
- )
- ) / Math.LN10
- ),
- t = [];
- if(tsb.from < 0 || tsb.to < 0){
- t.push("-");
- }
- t.push(dojo.string.rep("9", labelLength));
- var precision = Math.floor(
- Math.log( tsb.to - tsb.from ) / Math.LN10
- );
- if(precision > 0){
- t.push(".");
- t.push(dojo.string.rep("9", precision));
- }
- labelWidth = dojox.gfx._base._getTextBox(
- t.join(""),
- { font: taFont }
- ).w;
- }
- labelWidth = o.maxLabelSize ? Math.min(o.maxLabelSize, labelWidth) : labelWidth;
- }else{
- labelWidth = size;
- }
- switch(rotation){
- case 0:
- case 90:
- case 180:
- case 270:
-
- break;
- default:
-
- var gap1 = Math.sqrt(labelWidth * labelWidth + size * size),
- gap2 = this.vertical ? size * cosr + labelWidth * sinr : labelWidth * cosr + size * sinr;
- labelWidth = Math.min(gap1, gap2);
- break;
- }
- }
- this.scaler.minMinorStep = labelWidth + labelGap;
- this.ticks = lin.buildTicks(this.scaler, o);
- return this;
- },
- getScaler: function(){
-
-
- return this.scaler;
- },
- getTicks: function(){
-
-
- return this.ticks;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.axis2d.Default"]){
- dojo._hasResource["dojox.charting.axis2d.Default"] = true;
- dojo.provide("dojox.charting.axis2d.Default");
- (function(){
- var dc = dojox.charting,
- du = dojox.lang.utils,
- g = dojox.gfx,
- lin = dc.scaler.linear,
- labelGap = 4,
- centerAnchorLimit = 45;
- dojo.declare("dojox.charting.axis2d.Default", dojox.charting.axis2d.Invisible, {
-
-
-
-
-
-
-
-
- defaultParams: {
- vertical: false,
- fixUpper: "none",
- fixLower: "none",
- natural: false,
- leftBottom: true,
- includeZero: false,
- fixed: true,
- majorLabels: true,
- minorTicks: true,
- minorLabels: true,
- microTicks: false,
- rotation: 0,
- htmlLabels: true
- },
- optionalParams: {
- min: 0,
- max: 1,
- from: 0,
- to: 1,
- majorTickStep: 4,
- minorTickStep: 2,
- microTickStep: 1,
- labels: [],
-
-
- labelFunc: null,
- maxLabelSize: 0,
- maxLabelCharCount: 0,
- trailingSymbol: null,
-
-
-
- stroke: {},
- majorTick: {},
- minorTick: {},
- microTick: {},
- tick: {},
- font: "",
- fontColor: "",
- title: "",
- titleGap: 0,
- titleFont: "",
- titleFontColor: "",
- titleOrientation: ""
- },
- constructor: function(chart, kwArgs){
-
-
-
-
-
-
- this.opt = dojo.clone(this.defaultParams);
- du.updateWithObject(this.opt, kwArgs);
- du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
- },
- getOffsets: function(){
-
-
-
-
- var s = this.scaler, offsets = { l: 0, r: 0, t: 0, b: 0 };
- if(!s){
- return offsets;
- }
- var o = this.opt, labelWidth = 0, a, b, c, d,
- gl = dc.scaler.common.getNumericLabel,
- offset = 0, ma = s.major, mi = s.minor,
- ta = this.chart.theme.axis,
-
- taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font),
- taTitleFont = o.titleFont || (ta.tick && ta.tick.titleFont),
- taTitleGap = (o.titleGap==0) ? 0 : o.titleGap || (ta.tick && ta.tick.titleGap) || 15,
- taMajorTick = this.chart.theme.getTick("major", o),
- taMinorTick = this.chart.theme.getTick("minor", o),
- size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,
- tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0,
- rotation = o.rotation % 360, leftBottom = o.leftBottom,
- cosr = Math.abs(Math.cos(rotation * Math.PI / 180)),
- sinr = Math.abs(Math.sin(rotation * Math.PI / 180));
- this.trailingSymbol = (o.trailingSymbol === undefined || o.trailingSymbol === null) ? this.trailingSymbol : o.trailingSymbol;
- if(rotation < 0){
- rotation += 360;
- }
- if(size){
-
- if(this.labels){
- labelWidth = this._groupLabelWidth(this.labels, taFont, o.maxLabelCharCount);
- }else{
- labelWidth = this._groupLabelWidth([
- gl(ma.start, ma.prec, o),
- gl(ma.start + ma.count * ma.tick, ma.prec, o),
- gl(mi.start, mi.prec, o),
- gl(mi.start + mi.count * mi.tick, mi.prec, o)
- ], taFont, o.maxLabelCharCount);
- }
- labelWidth = o.maxLabelSize ? Math.min(o.maxLabelSize, labelWidth) : labelWidth;
- if(this.vertical){
- var side = leftBottom ? "l" : "r";
- switch(rotation){
- case 0:
- case 180:
- offsets[side] = labelWidth;
- offsets.t = offsets.b = size / 2;
- break;
- case 90:
- case 270:
- offsets[side] = size;
- offsets.t = offsets.b = labelWidth / 2;
- break;
- default:
- if(rotation <= centerAnchorLimit || (180 < rotation && rotation <= (180 + centerAnchorLimit))){
- offsets[side] = size * sinr / 2 + labelWidth * cosr;
- offsets[leftBottom ? "t" : "b"] = size * cosr / 2 + labelWidth * sinr;
- offsets[leftBottom ? "b" : "t"] = size * cosr / 2;
- }else if(rotation > (360 - centerAnchorLimit) || (180 > rotation && rotation > (180 - centerAnchorLimit))){
- offsets[side] = size * sinr / 2 + labelWidth * cosr;
- offsets[leftBottom ? "b" : "t"] = size * cosr / 2 + labelWidth * sinr;
- offsets[leftBottom ? "t" : "b"] = size * cosr / 2;
- }else if(rotation < 90 || (180 < rotation && rotation < 270)){
- offsets[side] = size * sinr + labelWidth * cosr;
- offsets[leftBottom ? "t" : "b"] = size * cosr + labelWidth * sinr;
- }else{
- offsets[side] = size * sinr + labelWidth * cosr;
- offsets[leftBottom ? "b" : "t"] = size * cosr + labelWidth * sinr;
- }
- break;
- }
- offsets[side] += labelGap + Math.max(taMajorTick.length, taMinorTick.length) + (o.title ? (tsize + taTitleGap) : 0);
- }else{
- var side = leftBottom ? "b" : "t";
- switch(rotation){
- case 0:
- case 180:
- offsets[side] = size;
- offsets.l = offsets.r = labelWidth / 2;
- break;
- case 90:
- case 270:
- offsets[side] = labelWidth;
- offsets.l = offsets.r = size / 2;
- break;
- default:
- if((90 - centerAnchorLimit) <= rotation && rotation <= 90 || (270 - centerAnchorLimit) <= rotation && rotation <= 270){
- offsets[side] = size * sinr / 2 + labelWidth * cosr;
- offsets[leftBottom ? "r" : "l"] = size * cosr / 2 + labelWidth * sinr;
- offsets[leftBottom ? "l" : "r"] = size * cosr / 2;
- }else if(90 <= rotation && rotation <= (90 + centerAnchorLimit) || 270 <= rotation && rotation <= (270 + centerAnchorLimit)){
- offsets[side] = size * sinr / 2 + labelWidth * cosr;
- offsets[leftBottom ? "l" : "r"] = size * cosr / 2 + labelWidth * sinr;
- offsets[leftBottom ? "r" : "l"] = size * cosr / 2;
- }else if(rotation < centerAnchorLimit || (180 < rotation && rotation < (180 - centerAnchorLimit))){
- offsets[side] = size * sinr + labelWidth * cosr;
- offsets[leftBottom ? "r" : "l"] = size * cosr + labelWidth * sinr;
- }else{
- offsets[side] = size * sinr + labelWidth * cosr;
- offsets[leftBottom ? "l" : "r"] = size * cosr + labelWidth * sinr;
- }
- break;
- }
- offsets[side] += labelGap + Math.max(taMajorTick.length, taMinorTick.length) + (o.title ? (tsize + taTitleGap) : 0);
- }
- }
- if(labelWidth){
- this._cachedLabelWidth = labelWidth;
- }
- return offsets;
- },
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(!this.dirty){
- return this;
- }
-
- var o = this.opt, ta = this.chart.theme.axis, leftBottom = o.leftBottom, rotation = o.rotation % 360,
- start, stop, titlePos, titleRotation=0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign,
-
- taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font),
- taTitleFont = o.titleFont || (ta.tick && ta.tick.titleFont),
-
- taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black",
- taTitleFontColor = o.titleFontColor || (ta.tick && ta.tick.titleFontColor) || "black",
- taTitleGap = (o.titleGap==0) ? 0 : o.titleGap || (ta.tick && ta.tick.titleGap) || 15,
- taTitleOrientation = o.titleOrientation || (ta.tick && ta.tick.titleOrientation) || "axis",
- taMajorTick = this.chart.theme.getTick("major", o),
- taMinorTick = this.chart.theme.getTick("minor", o),
- taMicroTick = this.chart.theme.getTick("micro", o),
- tickSize = Math.max(taMajorTick.length, taMinorTick.length, taMicroTick.length),
- taStroke = "stroke" in o ? o.stroke : ta.stroke,
- size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,
- cosr = Math.abs(Math.cos(rotation * Math.PI / 180)),
- sinr = Math.abs(Math.sin(rotation * Math.PI / 180)),
- tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0;
- if(rotation < 0){
- rotation += 360;
- }
- if(this.vertical){
- start = {y: dim.height - offsets.b};
- stop = {y: offsets.t};
- titlePos = {y: (dim.height - offsets.b + offsets.t)/2};
- titleOffset = size * sinr + (this._cachedLabelWidth || 0) * cosr + labelGap + Math.max(taMajorTick.length, taMinorTick.length) + tsize + taTitleGap;
- axisVector = {x: 0, y: -1};
- labelOffset = {x: 0, y: 0};
- tickVector = {x: 1, y: 0};
- anchorOffset = {x: labelGap, y: 0};
- switch(rotation){
- case 0:
- labelAlign = "end";
- labelOffset.y = size * 0.4;
- break;
- case 90:
- labelAlign = "middle";
- labelOffset.x = -size;
- break;
- case 180:
- labelAlign = "start";
- labelOffset.y = -size * 0.4;
- break;
- case 270:
- labelAlign = "middle";
- break;
- default:
- if(rotation < centerAnchorLimit){
- labelAlign = "end";
- labelOffset.y = size * 0.4;
- }else if(rotation < 90){
- labelAlign = "end";
- labelOffset.y = size * 0.4;
- }else if(rotation < (180 - centerAnchorLimit)){
- labelAlign = "start";
- }else if(rotation < (180 + centerAnchorLimit)){
- labelAlign = "start";
- labelOffset.y = -size * 0.4;
- }else if(rotation < 270){
- labelAlign = "start";
- labelOffset.x = leftBottom ? 0 : size * 0.4;
- }else if(rotation < (360 - centerAnchorLimit)){
- labelAlign = "end";
- labelOffset.x = leftBottom ? 0 : size * 0.4;
- }else{
- labelAlign = "end";
- labelOffset.y = size * 0.4;
- }
- }
- if(leftBottom){
- start.x = stop.x = offsets.l;
- titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 90 : 270;
- titlePos.x = offsets.l - titleOffset + (titleRotation == 270 ? tsize : 0);
- tickVector.x = -1;
- anchorOffset.x = -anchorOffset.x;
- }else{
- start.x = stop.x = dim.width - offsets.r;
- titleRotation = (taTitleOrientation && taTitleOrientation == "axis") ? 90 : 270;
- titlePos.x = dim.width - offsets.r + titleOffset - (titleRotation == 270 ? 0 : tsize);
- switch(labelAlign){
- case "start":
- labelAlign = "end";
- break;
- case "end":
- labelAlign = "start";
- break;
- case "middle":
- labelOffset.x += size;
- break;
- }
- }
- }else{
- start = {x: offsets.l};
- stop = {x: dim.width - offsets.r};
- titlePos = {x: (dim.width - offsets.r + offsets.l)/2};
- titleOffset = size * cosr + (this._cachedLabelWidth || 0) * sinr + labelGap + Math.max(taMajorTick.length, taMinorTick.length) + tsize + taTitleGap;
- axisVector = {x: 1, y: 0};
- labelOffset = {x: 0, y: 0};
- tickVector = {x: 0, y: 1};
- anchorOffset = {x: 0, y: labelGap};
- switch(rotation){
- case 0:
- labelAlign = "middle";
- labelOffset.y = size;
- break;
- case 90:
- labelAlign = "start";
- labelOffset.x = -size * 0.4;
- break;
- case 180:
- labelAlign = "middle";
- break;
- case 270:
- labelAlign = "end";
- labelOffset.x = size * 0.4;
- break;
- default:
- if(rotation < (90 - centerAnchorLimit)){
- labelAlign = "start";
- labelOffset.y = leftBottom ? size : 0;
- }else if(rotation < (90 + centerAnchorLimit)){
- labelAlign = "start";
- labelOffset.x = -size * 0.4;
- }else if(rotation < 180){
- labelAlign = "start";
- labelOffset.y = leftBottom ? 0 : -size;
- }else if(rotation < (270 - centerAnchorLimit)){
- labelAlign = "end";
- labelOffset.y = leftBottom ? 0 : -size;
- }else if(rotation < (270 + centerAnchorLimit)){
- labelAlign = "end";
- labelOffset.y = leftBottom ? size * 0.4 : 0;
- }else{
- labelAlign = "end";
- labelOffset.y = leftBottom ? size : 0;
- }
- }
- if(leftBottom){
- start.y = stop.y = dim.height - offsets.b;
- titleRotation = (taTitleOrientation && taTitleOrientation == "axis") ? 180 : 0;
- titlePos.y = dim.height - offsets.b + titleOffset - (titleRotation ? tsize : 0);
- }else{
- start.y = stop.y = offsets.t;
- titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0;
- titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize);
- tickVector.y = -1;
- anchorOffset.y = -anchorOffset.y;
- switch(labelAlign){
- case "start":
- labelAlign = "end";
- break;
- case "end":
- labelAlign = "start";
- break;
- case "middle":
- labelOffset.y -= size;
- break;
- }
- }
- }
-
- this.cleanGroup();
- try{
- var s = this.group,
- c = this.scaler,
- t = this.ticks,
- canLabel,
- f = lin.getTransformerFromModel(this.scaler),
-
-
- labelType = !titleRotation && !rotation && this.opt.htmlLabels && !dojo.isIE && !dojo.isOpera ? "html" : "gfx",
- dx = tickVector.x * taMajorTick.length,
- dy = tickVector.y * taMajorTick.length;
- s.createLine({
- x1: start.x,
- y1: start.y,
- x2: stop.x,
- y2: stop.y
- }).setStroke(taStroke);
-
-
- if(o.title){
- var axisTitle = dc.axis2d.common.createText[labelType](
- this.chart,
- s,
- titlePos.x,
- titlePos.y,
- "middle",
- o.title,
- taTitleFont,
- taTitleFontColor
- );
- if(labelType == "html"){
- this.htmlElements.push(axisTitle);
- }else{
-
-
- axisTitle.setTransform(g.matrix.rotategAt(titleRotation, titlePos.x, titlePos.y));
- }
- }
- dojo.forEach(t.major, function(tick){
- var offset = f(tick.value), elem,
- x = start.x + axisVector.x * offset,
- y = start.y + axisVector.y * offset;
- s.createLine({
- x1: x, y1: y,
- x2: x + dx,
- y2: y + dy
- }).setStroke(taMajorTick);
- if(tick.label){
- var label = o.maxLabelCharCount ? this.getTextWithLimitCharCount(tick.label, taFont, o.maxLabelCharCount) : {
- text: tick.label,
- truncated: false
- };
- label = o.maxLabelSize ? this.getTextWithLimitLength(label.text, taFont, o.maxLabelSize, label.truncated) : label;
- elem = dc.axis2d.common.createText[labelType](
- this.chart,
- s,
- x + dx + anchorOffset.x + (rotation ? 0 : labelOffset.x),
- y + dy + anchorOffset.y + (rotation ? 0 : labelOffset.y),
- labelAlign,
- label.text,
- taFont,
- taFontColor
-
- );
- label.truncated && this.labelTooltip(elem, this.chart, tick.label, label.text, taFont, labelType);
- if(labelType == "html"){
- this.htmlElements.push(elem);
- }else if(rotation){
- elem.setTransform([
- {dx: labelOffset.x, dy: labelOffset.y},
- g.matrix.rotategAt(
- rotation,
- x + dx + anchorOffset.x,
- y + dy + anchorOffset.y
- )
- ]);
- }
- }
- }, this);
- dx = tickVector.x * taMinorTick.length;
- dy = tickVector.y * taMinorTick.length;
- canLabel = c.minMinorStep <= c.minor.tick * c.bounds.scale;
- dojo.forEach(t.minor, function(tick){
- var offset = f(tick.value), elem,
- x = start.x + axisVector.x * offset,
- y = start.y + axisVector.y * offset;
- s.createLine({
- x1: x, y1: y,
- x2: x + dx,
- y2: y + dy
- }).setStroke(taMinorTick);
- if(canLabel && tick.label){
- var label = o.maxLabelCharCount ? this.getTextWithLimitCharCount(tick.label, taFont, o.maxLabelCharCount) : {
- text: tick.label,
- truncated: false
- };
- label = o.maxLabelSize ? this.getTextWithLimitLength(label.text, taFont, o.maxLabelSize, label.truncated) : label;
- elem = dc.axis2d.common.createText[labelType](
- this.chart,
- s,
- x + dx + anchorOffset.x + (rotation ? 0 : labelOffset.x),
- y + dy + anchorOffset.y + (rotation ? 0 : labelOffset.y),
- labelAlign,
- label.text,
- taFont,
- taFontColor
-
- );
- label.truncated && this.labelTooltip(elem, this.chart, tick.label, label.text, taFont, labelType);
- if(labelType == "html"){
- this.htmlElements.push(elem);
- }else if(rotation){
- elem.setTransform([
- {dx: labelOffset.x, dy: labelOffset.y},
- g.matrix.rotategAt(
- rotation,
- x + dx + anchorOffset.x,
- y + dy + anchorOffset.y
- )
- ]);
- }
- }
- }, this);
- dx = tickVector.x * taMicroTick.length;
- dy = tickVector.y * taMicroTick.length;
- dojo.forEach(t.micro, function(tick){
- var offset = f(tick.value), elem,
- x = start.x + axisVector.x * offset,
- y = start.y + axisVector.y * offset;
- s.createLine({
- x1: x, y1: y,
- x2: x + dx,
- y2: y + dy
- }).setStroke(taMicroTick);
- }, this);
- }catch(e){
-
- }
- this.dirty = false;
- return this;
- },
- labelTooltip: function(elem, chart, label, truncatedLabel, font, elemType){
-
-
- if(!dijit || !dijit.Tooltip){
- return;
- }
- var aroundRect = {type: "rect"}, position = ["above", "below"],
- fontWidth = dojox.gfx._base._getTextBox(truncatedLabel, {font: font}).w || 0;
- fontHeight = font ? g.normalizedLength(g.splitFontString(font).size) : 0;
- if(elemType == "html"){
- dojo.mixin(aroundRect, dojo.coords(elem.firstChild, true));
- aroundRect.width = Math.ceil(fontWidth);
- aroundRect.height = Math.ceil(fontHeight);
- this._events.push({
- shape: dojo,
- handle: dojo.connect(elem.firstChild, "onmouseover", this, function(e){
- dijit.showTooltip(label, aroundRect, position);
- })
- });
- this._events.push({
- shape: dojo,
- handle: dojo.connect(elem.firstChild, "onmouseout", this, function(e){
- dijit.hideTooltip(aroundRect);
- })
- });
- }else{
- var shp = elem.getShape(),
- lt = dojo.coords(chart.node, true);
- aroundRect = dojo.mixin(aroundRect, {
- x: shp.x - fontWidth / 2,
- y: shp.y
- });
- aroundRect.x += lt.x;
- aroundRect.y += lt.y;
- aroundRect.x = Math.round(aroundRect.x);
- aroundRect.y = Math.round(aroundRect.y);
- aroundRect.width = Math.ceil(fontWidth);
- aroundRect.height = Math.ceil(fontHeight);
- this._events.push({
- shape: elem,
- handle: elem.connect("onmouseenter", this, function(e){
- dijit.showTooltip(label, aroundRect, position);
- })
- });
- this._events.push({
- shape: elem,
- handle: elem.connect("onmouseleave", this, function(e){
- dijit.hideTooltip(aroundRect);
- })
- });
- }
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.common"]){
- dojo._hasResource["dojox.charting.plot2d.common"] = true;
- dojo.provide("dojox.charting.plot2d.common");
- (function(){
- var df = dojox.lang.functional, dc = dojox.charting.plot2d.common;
- dojo.mixin(dojox.charting.plot2d.common, {
- makeStroke: function(stroke){
- if(!stroke){ return stroke; }
- if(typeof stroke == "string" || stroke instanceof dojo.Color){
- stroke = {color: stroke};
- }
- return dojox.gfx.makeParameters(dojox.gfx.defaultStroke, stroke);
- },
- augmentColor: function(target, color){
- var t = new dojo.Color(target),
- c = new dojo.Color(color);
- c.a = t.a;
- return c;
- },
- augmentStroke: function(stroke, color){
- var s = dc.makeStroke(stroke);
- if(s){
- s.color = dc.augmentColor(s.color, color);
- }
- return s;
- },
- augmentFill: function(fill, color){
- var fc, c = new dojo.Color(color);
- if(typeof fill == "string" || fill instanceof dojo.Color){
- return dc.augmentColor(fill, color);
- }
- return fill;
- },
- defaultStats: {
- vmin: Number.POSITIVE_INFINITY, vmax: Number.NEGATIVE_INFINITY,
- hmin: Number.POSITIVE_INFINITY, hmax: Number.NEGATIVE_INFINITY
- },
- collectSimpleStats: function(series){
- var stats = dojo.delegate(dc.defaultStats);
- for(var i = 0; i < series.length; ++i){
- var run = series[i];
- for(var j = 0; j < run.data.length; j++){
- if(run.data[j] !== null){
- if(typeof run.data[j] == "number"){
-
- var old_vmin = stats.vmin, old_vmax = stats.vmax;
- if(!("ymin" in run) || !("ymax" in run)){
- dojo.forEach(run.data, function(val, i){
- if(val !== null){
- var x = i + 1, y = val;
- if(isNaN(y)){ y = 0; }
- stats.hmin = Math.min(stats.hmin, x);
- stats.hmax = Math.max(stats.hmax, x);
- stats.vmin = Math.min(stats.vmin, y);
- stats.vmax = Math.max(stats.vmax, y);
- }
- });
- }
- if("ymin" in run){ stats.vmin = Math.min(old_vmin, run.ymin); }
- if("ymax" in run){ stats.vmax = Math.max(old_vmax, run.ymax); }
- }else{
-
- var old_hmin = stats.hmin, old_hmax = stats.hmax,
- old_vmin = stats.vmin, old_vmax = stats.vmax;
- if(!("xmin" in run) || !("xmax" in run) || !("ymin" in run) || !("ymax" in run)){
- dojo.forEach(run.data, function(val, i){
- if(val !== null){
- var x = "x" in val ? val.x : i + 1, y = val.y;
- if(isNaN(x)){ x = 0; }
- if(isNaN(y)){ y = 0; }
- stats.hmin = Math.min(stats.hmin, x);
- stats.hmax = Math.max(stats.hmax, x);
- stats.vmin = Math.min(stats.vmin, y);
- stats.vmax = Math.max(stats.vmax, y);
- }
- });
- }
- if("xmin" in run){ stats.hmin = Math.min(old_hmin, run.xmin); }
- if("xmax" in run){ stats.hmax = Math.max(old_hmax, run.xmax); }
- if("ymin" in run){ stats.vmin = Math.min(old_vmin, run.ymin); }
- if("ymax" in run){ stats.vmax = Math.max(old_vmax, run.ymax); }
- }
- break;
- }
- }
- }
- return stats;
- },
- calculateBarSize: function(/* Number */ availableSize, /* Object */ opt, /* Number? */ clusterSize){
- if(!clusterSize){
- clusterSize = 1;
- }
- var gap = opt.gap, size = (availableSize - 2 * gap) / clusterSize;
- if("minBarSize" in opt){
- size = Math.max(size, opt.minBarSize);
- }
- if("maxBarSize" in opt){
- size = Math.min(size, opt.maxBarSize);
- }
- size = Math.max(size, 1);
- gap = (availableSize - size * clusterSize) / 2;
- return {size: size, gap: gap};
- },
- collectStackedStats: function(series){
-
- var stats = dojo.clone(dc.defaultStats);
- if(series.length){
-
- stats.hmin = Math.min(stats.hmin, 1);
- stats.hmax = df.foldl(series, "seed, run -> Math.max(seed, run.data.length)", stats.hmax);
-
- for(var i = 0; i < stats.hmax; ++i){
- var v = series[0].data[i];
- v = v && (typeof v == "number" ? v : v.y);
- if(isNaN(v)){ v = 0; }
- stats.vmin = Math.min(stats.vmin, v);
- for(var j = 1; j < series.length; ++j){
- var t = series[j].data[i];
- t = t && (typeof t == "number" ? t : t.y);
- if(isNaN(t)){ t = 0; }
- v += t;
- }
- stats.vmax = Math.max(stats.vmax, v);
- }
- }
- return stats;
- },
- curve: function(/* Number[] */a, /* Number|String */tension){
-
-
-
- var arr = a.slice(0);
- if(tension == "x") {
- arr[arr.length] = arr[0];
- }
- var p=dojo.map(arr, function(item, i){
- if(i==0){ return "M" + item.x + "," + item.y; }
- if(!isNaN(tension)) {
- var dx=item.x-arr[i-1].x, dy=arr[i-1].y;
- return "C"+(item.x-(tension-1)*(dx/tension))+","+dy+" "+(item.x-(dx/tension))+","+item.y+" "+item.x+","+item.y;
- } else if(tension == "X" || tension == "x" || tension == "S") {
-
- var p0, p1 = arr[i-1], p2 = arr[i], p3;
- var bz1x, bz1y, bz2x, bz2y;
- var f = 1/6;
- if(i==1) {
- if(tension == "x") {
- p0 = arr[arr.length-2];
- } else {
- p0 = p1;
- }
- f = 1/3;
- } else {
- p0 = arr[i-2];
- }
- if(i==(arr.length-1)) {
- if(tension == "x") {
- p3 = arr[1];
- } else {
- p3 = p2;
- }
- f = 1/3;
- } else {
- p3 = arr[i+1];
- }
- var p1p2 = Math.sqrt((p2.x-p1.x)*(p2.x-p1.x)+(p2.y-p1.y)*(p2.y-p1.y));
- var p0p2 = Math.sqrt((p2.x-p0.x)*(p2.x-p0.x)+(p2.y-p0.y)*(p2.y-p0.y));
- var p1p3 = Math.sqrt((p3.x-p1.x)*(p3.x-p1.x)+(p3.y-p1.y)*(p3.y-p1.y));
- var p0p2f = p0p2 * f;
- var p1p3f = p1p3 * f;
- if(p0p2f > p1p2/2 && p1p3f > p1p2/2) {
- p0p2f = p1p2/2;
- p1p3f = p1p2/2;
- } else if(p0p2f > p1p2/2) {
- p0p2f = p1p2/2;
- p1p3f = p1p2/2 * p1p3/p0p2;
- } else if(p1p3f > p1p2/2) {
- p1p3f = p1p2/2;
- p0p2f = p1p2/2 * p0p2/p1p3;
- }
- if(tension == "S") {
- if(p0 == p1) { p0p2f = 0; }
- if(p2 == p3) { p1p3f = 0; }
- }
- bz1x = p1.x + p0p2f*(p2.x - p0.x)/p0p2;
- bz1y = p1.y + p0p2f*(p2.y - p0.y)/p0p2;
- bz2x = p2.x - p1p3f*(p3.x - p1.x)/p1p3;
- bz2y = p2.y - p1p3f*(p3.y - p1.y)/p1p3;
- }
- return "C"+(bz1x+","+bz1y+" "+bz2x+","+bz2y+" "+p2.x+","+p2.y);
- });
- return p.join(" ");
- },
-
- getLabel: function(/*Number*/number, /*Boolean*/fixed, /*Number*/precision){
- if(dojo.number){
- return (fixed ? dojo.number.format(number, {places : precision}) :
- dojo.number.format(number)) || "";
- }
- return fixed ? number.toFixed(precision) : number.toString();
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.scaler.primitive"]){
- dojo._hasResource["dojox.charting.scaler.primitive"] = true;
- dojo.provide("dojox.charting.scaler.primitive");
- dojox.charting.scaler.primitive = {
- buildScaler: function(/*Number*/ min, /*Number*/ max, /*Number*/ span, /*Object*/ kwArgs){
- if(min == max){
-
- min -= 0.5;
- max += 0.5;
-
- }
- return {
- bounds: {
- lower: min,
- upper: max,
- from: min,
- to: max,
- scale: span / (max - min),
- span: span
- },
- scaler: dojox.charting.scaler.primitive
- };
- },
- buildTicks: function(/*Object*/ scaler, /*Object*/ kwArgs){
- return {major: [], minor: [], micro: []};
- },
- getTransformerFromModel: function(/*Object*/ scaler){
- var offset = scaler.bounds.from, scale = scaler.bounds.scale;
- return function(x){ return (x - offset) * scale; };
- },
- getTransformerFromPlot: function(/*Object*/ scaler){
- var offset = scaler.bounds.from, scale = scaler.bounds.scale;
- return function(x){ return x / scale + offset; };
- }
- };
- }
- if(!dojo._hasResource["dojox.charting.plot2d._PlotEvents"]){
- dojo._hasResource["dojox.charting.plot2d._PlotEvents"] = true;
- dojo.provide("dojox.charting.plot2d._PlotEvents");
- dojo.declare("dojox.charting.plot2d._PlotEvents", null, {
- constructor: function(){
- this._shapeEvents = [];
- this._eventSeries = {};
- },
- destroy: function(){
-
-
- this.resetEvents();
- this.inherited(arguments);
- },
- plotEvent: function(o){
-
-
-
-
- },
- raiseEvent: function(o){
-
-
-
-
- this.plotEvent(o);
- var t = dojo.delegate(o);
- t.originalEvent = o.type;
- t.originalPlot = o.plot;
- t.type = "onindirect";
- dojo.forEach(this.chart.stack, function(plot){
- if(plot !== this && plot.plotEvent){
- t.plot = plot;
- plot.plotEvent(t);
- }
- }, this);
- },
- connect: function(object, method){
-
-
-
-
-
-
-
-
- this.dirty = true;
- return dojo.connect(this, "plotEvent", object, method);
- },
- events: function(){
-
-
-
-
- var ls = this.plotEvent._listeners;
- if(!ls || !ls.length){ return false; }
- for(var i in ls){
- if(!(i in Array.prototype)){
- return true;
- }
- }
- return false;
- },
- resetEvents: function(){
-
-
- if(this._shapeEvents.length){
- dojo.forEach(this._shapeEvents, function(item){
- item.shape.disconnect(item.handle);
- });
- this._shapeEvents = [];
- }
- this.raiseEvent({type: "onplotreset", plot: this});
- },
- _connectSingleEvent: function(o, eventName){
- this._shapeEvents.push({
- shape: o.eventMask,
- handle: o.eventMask.connect(eventName, this, function(e){
- o.type = eventName;
- o.event = e;
- this.raiseEvent(o);
- o.event = null;
- })
- });
- },
- _connectEvents: function(o){
- if(o){
- o.chart = this.chart;
- o.plot = this;
- o.hAxis = this.hAxis || null;
- o.vAxis = this.vAxis || null;
- o.eventMask = o.eventMask || o.shape;
- this._connectSingleEvent(o, "onmouseover");
- this._connectSingleEvent(o, "onmouseout");
- this._connectSingleEvent(o, "onclick");
- }
- },
- _reconnectEvents: function(seriesName){
- var a = this._eventSeries[seriesName];
- if(a){
- dojo.forEach(a, this._connectEvents, this);
- }
- },
- fireEvent: function(seriesName, eventName, index, eventObject){
-
-
-
-
-
-
-
-
-
-
-
-
- var s = this._eventSeries[seriesName];
- if(s && s.length && index < s.length){
- var o = s[index];
- o.type = eventName;
- o.event = eventObject || null;
- this.raiseEvent(o);
- o.event = null;
- }
- }
- });
- }
- if(!dojo._hasResource["dojox.charting.plot2d.Base"]){
- dojo._hasResource["dojox.charting.plot2d.Base"] = true;
- dojo.provide("dojox.charting.plot2d.Base");
- dojo.declare("dojox.charting.plot2d.Base", [dojox.charting.Element, dojox.charting.plot2d._PlotEvents], {
- constructor: function(chart, kwArgs){
-
-
-
-
-
-
- this.zoom = null,
- this.zoomQueue = [];
- this.lastWindow = {vscale: 1, hscale: 1, xoffset: 0, yoffset: 0};
- },
- clear: function(){
-
-
-
-
- this.series = [];
- this._hAxis = null;
- this._vAxis = null;
- this.dirty = true;
- return this;
- },
- setAxis: function(axis){
-
-
-
-
-
-
- if(axis){
- this[axis.vertical ? "_vAxis" : "_hAxis"] = axis;
- }
- return this;
- },
- addSeries: function(run){
-
-
-
-
-
-
- this.series.push(run);
- return this;
- },
- getSeriesStats: function(){
-
-
-
-
- return dojox.charting.plot2d.common.collectSimpleStats(this.series);
- },
- calculateAxes: function(dim){
-
-
-
-
-
-
- this.initializeScalers(dim, this.getSeriesStats());
- return this;
- },
- isDirty: function(){
-
-
-
-
- return this.dirty || this._hAxis && this._hAxis.dirty || this._vAxis && this._vAxis.dirty;
- },
- isDataDirty: function(){
-
-
-
-
- return dojo.some(this.series, function(item){ return item.dirty; });
- },
- performZoom: function(dim, offsets){
-
-
-
-
-
-
-
-
-
- var vs = this._vAxis.scale || 1,
- hs = this._hAxis.scale || 1,
- vOffset = dim.height - offsets.b,
- hBounds = this._hScaler.bounds,
- xOffset = (hBounds.from - hBounds.lower) * hBounds.scale,
- vBounds = this._vScaler.bounds,
- yOffset = (vBounds.from - vBounds.lower) * vBounds.scale;
-
- rVScale = vs / this.lastWindow.vscale,
- rHScale = hs / this.lastWindow.hscale,
- rXOffset = (this.lastWindow.xoffset - xOffset)/
- ((this.lastWindow.hscale == 1)? hs : this.lastWindow.hscale),
- rYOffset = (yOffset - this.lastWindow.yoffset)/
- ((this.lastWindow.vscale == 1)? vs : this.lastWindow.vscale),
- shape = this.group,
- anim = dojox.gfx.fx.animateTransform(dojo.delegate({
- shape: shape,
- duration: 1200,
- transform:[
- {name:"translate", start:[0, 0], end: [offsets.l * (1 - rHScale), vOffset * (1 - rVScale)]},
- {name:"scale", start:[1, 1], end: [rHScale, rVScale]},
- {name:"original"},
- {name:"translate", start: [0, 0], end: [rXOffset, rYOffset]}
- ]}, this.zoom));
- dojo.mixin(this.lastWindow, {vscale: vs, hscale: hs, xoffset: xOffset, yoffset: yOffset});
-
-
- this.zoomQueue.push(anim);
-
- dojo.connect(anim, "onEnd", this, function(){
- this.zoom = null;
- this.zoomQueue.shift();
- if(this.zoomQueue.length > 0){
- this.zoomQueue[0].play();
- }
- });
- if(this.zoomQueue.length == 1){
- this.zoomQueue[0].play();
- }
- return this;
- },
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- return this;
- },
- getRequiredColors: function(){
-
-
-
-
- return this.series.length;
- },
- initializeScalers: function(dim, stats){
-
-
-
-
-
-
-
-
- if(this._hAxis){
- if(!this._hAxis.initialized()){
- this._hAxis.calculate(stats.hmin, stats.hmax, dim.width);
- }
- this._hScaler = this._hAxis.getScaler();
- }else{
- this._hScaler = dojox.charting.scaler.primitive.buildScaler(stats.hmin, stats.hmax, dim.width);
- }
- if(this._vAxis){
- if(!this._vAxis.initialized()){
- this._vAxis.calculate(stats.vmin, stats.vmax, dim.height);
- }
- this._vScaler = this._vAxis.getScaler();
- }else{
- this._vScaler = dojox.charting.scaler.primitive.buildScaler(stats.vmin, stats.vmax, dim.height);
- }
- return this;
- }
- });
- }
- if(!dojo._hasResource["dojox.charting.plot2d.Default"]){
- dojo._hasResource["dojox.charting.plot2d.Default"] = true;
- dojo.provide("dojox.charting.plot2d.Default");
- (function(){
- var df = dojox.lang.functional, du = dojox.lang.utils,
- dc = dojox.charting.plot2d.common,
- purgeGroup = df.lambda("item.purgeGroup()");
- var DEFAULT_ANIMATION_LENGTH = 1200;
- dojo.declare("dojox.charting.plot2d.Default", dojox.charting.plot2d.Base, {
- defaultParams: {
- hAxis: "x",
- vAxis: "y",
- lines: true,
- areas: false,
- markers: false,
- tension: "",
- animate: false
- },
- optionalParams: {
-
- stroke: {},
- outline: {},
- shadow: {},
- fill: {},
- font: "",
- fontColor: "",
- markerStroke: {},
- markerOutline: {},
- markerShadow: {},
- markerFill: {},
- markerFont: "",
- markerFontColor: ""
- },
- constructor: function(chart, kwArgs){
-
-
-
-
-
-
- this.opt = dojo.clone(this.defaultParams);
- du.updateWithObject(this.opt, kwArgs);
- du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
- this.series = [];
- this.hAxis = this.opt.hAxis;
- this.vAxis = this.opt.vAxis;
-
- this.animate = this.opt.animate;
- },
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
-
- if(this.zoom && !this.isDataDirty()){
- return this.performZoom(dim, offsets);
- }
- this.resetEvents();
- this.dirty = this.isDirty();
- if(this.dirty){
- dojo.forEach(this.series, purgeGroup);
- this._eventSeries = {};
- this.cleanGroup();
- this.group.setTransform(null);
- var s = this.group;
- df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
- }
- var t = this.chart.theme, stroke, outline, marker, events = this.events();
- for(var i = this.series.length - 1; i >= 0; --i){
- var run = this.series[i];
- if(!this.dirty && !run.dirty){
- t.skip();
- this._reconnectEvents(run.name);
- continue;
- }
- run.cleanGroup();
- if(!run.data.length){
- run.dirty = false;
- t.skip();
- continue;
- }
- var theme = t.next(this.opt.areas ? "area" : "line", [this.opt, run], true),
- s = run.group, rsegments = [], startindexes = [], rseg = null, lpoly,
- ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
- vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
- eventSeries = this._eventSeries[run.name] = new Array(run.data.length);
-
- for(var j = 0; j < run.data.length; j++){
- if(run.data[j] != null){
- if(!rseg){
- rseg = [];
- startindexes.push(j);
- rsegments.push(rseg)
- }
- rseg.push(run.data[j]);
- }else{
- rseg = null;
- }
- }
- for(var seg = 0; seg < rsegments.length; seg++){
- if(typeof rsegments[seg][0] == "number"){
- lpoly = dojo.map(rsegments[seg], function(v, i){
- return {
- x: ht(i + startindexes[seg] + 1) + offsets.l,
- y: dim.height - offsets.b - vt(v)
- };
- }, this);
- }else{
- lpoly = dojo.map(rsegments[seg], function(v, i){
- return {
- x: ht(v.x) + offsets.l,
- y: dim.height - offsets.b - vt(v.y)
- };
- }, this);
- }
- var lpath = this.opt.tension ? dc.curve(lpoly, this.opt.tension) : "";
- if(this.opt.areas && lpoly.length > 1){
- var fill = theme.series.fill;
- var apoly = dojo.clone(lpoly);
- if(this.opt.tension){
- var apath = "L" + apoly[apoly.length-1].x + "," + (dim.height - offsets.b) +
- " L" + apoly[0].x + "," + (dim.height - offsets.b) +
- " L" + apoly[0].x + "," + apoly[0].y;
- run.dyn.fill = s.createPath(lpath + " " + apath).setFill(fill).getFill();
- } else {
- apoly.push({x: lpoly[lpoly.length - 1].x, y: dim.height - offsets.b});
- apoly.push({x: lpoly[0].x, y: dim.height - offsets.b});
- apoly.push(lpoly[0]);
- run.dyn.fill = s.createPolyline(apoly).setFill(fill).getFill();
- }
- }
- if(this.opt.lines || this.opt.markers){
-
- stroke = theme.series.stroke;
- if(theme.series.outline){
- outline = run.dyn.outline = dc.makeStroke(theme.series.outline);
- outline.width = 2 * outline.width + stroke.width;
- }
- }
- if(this.opt.markers){
- run.dyn.marker = theme.symbol;
- }
- var frontMarkers = null, outlineMarkers = null, shadowMarkers = null;
- if(stroke && theme.series.shadow && lpoly.length > 1){
- var shadow = theme.series.shadow,
- spoly = dojo.map(lpoly, function(c){
- return {x: c.x + shadow.dx, y: c.y + shadow.dy};
- });
- if(this.opt.lines){
- if(this.opt.tension){
- run.dyn.shadow = s.createPath(dc.curve(spoly, this.opt.tension)).setStroke(shadow).getStroke();
- } else {
- run.dyn.shadow = s.createPolyline(spoly).setStroke(shadow).getStroke();
- }
- }
- if(this.opt.markers && theme.marker.shadow){
- shadow = theme.marker.shadow;
- shadowMarkers = dojo.map(spoly, function(c){
- return s.createPath("M" + c.x + " " + c.y + " " + theme.symbol).
- setStroke(shadow).setFill(shadow.color);
- }, this);
- }
- }
- if(this.opt.lines && lpoly.length > 1){
- if(outline){
- if(this.opt.tension){
- run.dyn.outline = s.createPath(lpath).setStroke(outline).getStroke();
- } else {
- run.dyn.outline = s.createPolyline(lpoly).setStroke(outline).getStroke();
- }
- }
- if(this.opt.tension){
- run.dyn.stroke = s.createPath(lpath).setStroke(stroke).getStroke();
- } else {
- run.dyn.stroke = s.createPolyline(lpoly).setStroke(stroke).getStroke();
- }
- }
- if(this.opt.markers){
- frontMarkers = new Array(lpoly.length);
- outlineMarkers = new Array(lpoly.length);
- outline = null;
- if(theme.marker.outline){
- outline = dc.makeStroke(theme.marker.outline);
- outline.width = 2 * outline.width + (theme.marker.stroke ? theme.marker.stroke.width : 0);
- }
- dojo.forEach(lpoly, function(c, i){
- var path = "M" + c.x + " " + c.y + " " + theme.symbol;
- if(outline){
- outlineMarkers[i] = s.createPath(path).setStroke(outline);
- }
- frontMarkers[i] = s.createPath(path).setStroke(theme.marker.stroke).setFill(theme.marker.fill);
- }, this);
- run.dyn.markerFill = theme.marker.fill;
- run.dyn.markerStroke = theme.marker.stroke;
- if(events){
- dojo.forEach(frontMarkers, function(s, i){
- var o = {
- element: "marker",
- index: i + startindexes[seg],
- run: run,
- shape: s,
- outline: outlineMarkers[i] || null,
- shadow: shadowMarkers && shadowMarkers[i] || null,
- cx: lpoly[i].x,
- cy: lpoly[i].y
- };
- if(typeof rsegments[seg][0] == "number"){
- o.x = i + startindexes[seg] + 1;
- o.y = rsegments[seg][i];
- }else{
- o.x = rsegments[seg][i].x;
- o.y = rsegments[seg][i].y;
- }
- this._connectEvents(o);
- eventSeries[i + startindexes[seg]] = o;
- }, this);
- }else{
- delete this._eventSeries[run.name];
- }
- }
- }
- run.dirty = false;
- }
- if(this.animate){
-
- var plotGroup = this.group;
- dojox.gfx.fx.animateTransform(dojo.delegate({
- shape: plotGroup,
- duration: DEFAULT_ANIMATION_LENGTH,
- transform:[
- {name:"translate", start: [0, dim.height - offsets.b], end: [0, 0]},
- {name:"scale", start: [1, 0], end:[1, 1]},
- {name:"original"}
- ]
- }, this.animate)).play();
- }
- this.dirty = false;
- return this;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.Lines"]){
- dojo._hasResource["dojox.charting.plot2d.Lines"] = true;
- dojo.provide("dojox.charting.plot2d.Lines");
- dojo.declare("dojox.charting.plot2d.Lines", dojox.charting.plot2d.Default, {
-
-
- constructor: function(){
-
-
- this.opt.lines = true;
- }
- });
- }
- if(!dojo._hasResource["dojox.charting.plot2d.Areas"]){
- dojo._hasResource["dojox.charting.plot2d.Areas"] = true;
- dojo.provide("dojox.charting.plot2d.Areas");
- dojo.declare("dojox.charting.plot2d.Areas", dojox.charting.plot2d.Default, {
-
-
- constructor: function(){
- this.opt.lines = true;
- this.opt.areas = true;
- }
- });
- }
- if(!dojo._hasResource["dojox.charting.plot2d.Markers"]){
- dojo._hasResource["dojox.charting.plot2d.Markers"] = true;
- dojo.provide("dojox.charting.plot2d.Markers");
- dojo.declare("dojox.charting.plot2d.Markers", dojox.charting.plot2d.Default, {
-
-
- constructor: function(){
-
-
- this.opt.markers = true;
- }
- });
- }
- if(!dojo._hasResource["dojox.charting.plot2d.MarkersOnly"]){
- dojo._hasResource["dojox.charting.plot2d.MarkersOnly"] = true;
- dojo.provide("dojox.charting.plot2d.MarkersOnly");
- dojo.declare("dojox.charting.plot2d.MarkersOnly", dojox.charting.plot2d.Default, {
-
-
- constructor: function(){
-
-
- this.opt.lines = false;
- this.opt.markers = true;
- }
- });
- }
- if(!dojo._hasResource["dojox.charting.plot2d.Scatter"]){
- dojo._hasResource["dojox.charting.plot2d.Scatter"] = true;
- dojo.provide("dojox.charting.plot2d.Scatter");
- (function(){
- var df = dojox.lang.functional, du = dojox.lang.utils,
- dc = dojox.charting.plot2d.common,
- purgeGroup = df.lambda("item.purgeGroup()");
- dojo.declare("dojox.charting.plot2d.Scatter", dojox.charting.plot2d.Base, {
-
-
- defaultParams: {
- hAxis: "x",
- vAxis: "y",
- shadows: null,
- animate: null
- },
- optionalParams: {
-
- markerStroke: {},
- markerOutline: {},
- markerShadow: {},
- markerFill: {},
- markerFont: "",
- markerFontColor: ""
- },
- constructor: function(chart, kwArgs){
-
-
-
-
-
-
- this.opt = dojo.clone(this.defaultParams);
- du.updateWithObject(this.opt, kwArgs);
- du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
- this.series = [];
- this.hAxis = this.opt.hAxis;
- this.vAxis = this.opt.vAxis;
- this.animate = this.opt.animate;
- },
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(this.zoom && !this.isDataDirty()){
- return this.performZoom(dim, offsets);
- }
- this.resetEvents();
- this.dirty = this.isDirty();
- if(this.dirty){
- dojo.forEach(this.series, purgeGroup);
- this._eventSeries = {};
- this.cleanGroup();
- var s = this.group;
- df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
- }
- var t = this.chart.theme, events = this.events();
- for(var i = this.series.length - 1; i >= 0; --i){
- var run = this.series[i];
- if(!this.dirty && !run.dirty){
- t.skip();
- this._reconnectEvents(run.name);
- continue;
- }
- run.cleanGroup();
- if(!run.data.length){
- run.dirty = false;
- t.skip();
- continue;
- }
- var theme = t.next("marker", [this.opt, run]), s = run.group, lpoly,
- ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
- vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler);
- if(typeof run.data[0] == "number"){
- lpoly = dojo.map(run.data, function(v, i){
- return {
- x: ht(i + 1) + offsets.l,
- y: dim.height - offsets.b - vt(v)
- };
- }, this);
- }else{
- lpoly = dojo.map(run.data, function(v, i){
- return {
- x: ht(v.x) + offsets.l,
- y: dim.height - offsets.b - vt(v.y)
- };
- }, this);
- }
- var shadowMarkers = new Array(lpoly.length),
- frontMarkers = new Array(lpoly.length),
- outlineMarkers = new Array(lpoly.length);
- dojo.forEach(lpoly, function(c, i){
- var finalTheme = typeof run.data[i] == "number" ?
- t.post(theme, "marker") :
- t.addMixin(theme, "marker", run.data[i], true),
- path = "M" + c.x + " " + c.y + " " + finalTheme.symbol;
- if(finalTheme.marker.shadow){
- shadowMarkers[i] = s.createPath("M" + (c.x + finalTheme.marker.shadow.dx) + " " +
- (c.y + finalTheme.marker.shadow.dy) + " " + finalTheme.symbol).
- setStroke(finalTheme.marker.shadow).setFill(finalTheme.marker.shadow.color);
- if(this.animate){
- this._animateScatter(shadowMarkers[i], dim.height - offsets.b);
- }
- }
- if(finalTheme.marker.outline){
- var outline = dc.makeStroke(finalTheme.marker.outline);
- outline.width = 2 * outline.width + finalTheme.marker.stroke.width;
- outlineMarkers[i] = s.createPath(path).setStroke(outline);
- if(this.animate){
- this._animateScatter(outlineMarkers[i], dim.height - offsets.b);
- }
- }
- var stroke = dc.makeStroke(finalTheme.marker.stroke),
- fill = this._plotFill(finalTheme.marker.fill, dim, offsets);
- if(fill && (fill.type === "linear" || fill.type == "radial")){
- var color = dojox.gfx.gradutils.getColor(fill, {x: c.x, y: c.y});
- if(stroke){
- stroke.color = color;
- }
- frontMarkers[i] = s.createPath(path).setStroke(stroke).setFill(color);
- }else{
- frontMarkers[i] = s.createPath(path).setStroke(stroke).setFill(fill);
- }
- if(this.animate){
- this._animateScatter(frontMarkers[i], dim.height - offsets.b);
- }
- }, this);
- if(frontMarkers.length){
- run.dyn.stroke = frontMarkers[frontMarkers.length - 1].getStroke();
- run.dyn.fill = frontMarkers[frontMarkers.length - 1].getFill();
- }
- if(events){
- var eventSeries = new Array(frontMarkers.length);
- dojo.forEach(frontMarkers, function(s, i){
- var o = {
- element: "marker",
- index: i,
- run: run,
- shape: s,
- outline: outlineMarkers && outlineMarkers[i] || null,
- shadow: shadowMarkers && shadowMarkers[i] || null,
- cx: lpoly[i].x,
- cy: lpoly[i].y
- };
- if(typeof run.data[0] == "number"){
- o.x = i + 1;
- o.y = run.data[i];
- }else{
- o.x = run.data[i].x;
- o.y = run.data[i].y;
- }
- this._connectEvents(o);
- eventSeries[i] = o;
- }, this);
- this._eventSeries[run.name] = eventSeries;
- }else{
- delete this._eventSeries[run.name];
- }
- run.dirty = false;
- }
- this.dirty = false;
- return this;
- },
- _animateScatter: function(shape, offset){
- dojox.gfx.fx.animateTransform(dojo.delegate({
- shape: shape,
- duration: 1200,
- transform: [
- {name: "translate", start: [0, offset], end: [0, 0]},
- {name: "scale", start: [0, 0], end: [1, 1]},
- {name: "original"}
- ]
- }, this.animate)).play();
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.lang.functional.sequence"]){
- dojo._hasResource["dojox.lang.functional.sequence"] = true;
- dojo.provide("dojox.lang.functional.sequence");
- (function(){
- var d = dojo, df = dojox.lang.functional;
- d.mixin(df, {
-
- repeat: function(/*Number*/ n, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){
-
-
- o = o || d.global; f = df.lambda(f);
- var t = new Array(n), i = 1;
- t[0] = z;
- for(; i < n; t[i] = z = f.call(o, z), ++i);
- return t;
- },
- until: function(/*Function|String|Array*/ pr, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){
-
-
- o = o || d.global; f = df.lambda(f); pr = df.lambda(pr);
- var t = [];
- for(; !pr.call(o, z); t.push(z), z = f.call(o, z));
- return t;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.Stacked"]){
- dojo._hasResource["dojox.charting.plot2d.Stacked"] = true;
- dojo.provide("dojox.charting.plot2d.Stacked");
- (function(){
- var df = dojox.lang.functional, dc = dojox.charting.plot2d.common,
- purgeGroup = df.lambda("item.purgeGroup()");
- dojo.declare("dojox.charting.plot2d.Stacked", dojox.charting.plot2d.Default, {
-
-
-
-
- getSeriesStats: function(){
-
-
-
-
- var stats = dc.collectStackedStats(this.series);
- this._maxRunLength = stats.hmax;
- return stats;
- },
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(this._maxRunLength <= 0){
- return this;
- }
-
- var acc = df.repeat(this._maxRunLength, "-> 0", 0);
- for(var i = 0; i < this.series.length; ++i){
- var run = this.series[i];
- for(var j = 0; j < run.data.length; ++j){
- var v = run.data[j];
- if(v !== null){
- if(isNaN(v)){ v = 0; }
- acc[j] += v;
- }
- }
- }
-
- if(this.zoom && !this.isDataDirty()){
- return this.performZoom(dim, offsets);
- }
- this.resetEvents();
- this.dirty = this.isDirty();
- if(this.dirty){
- dojo.forEach(this.series, purgeGroup);
- this._eventSeries = {};
- this.cleanGroup();
- var s = this.group;
- df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
- }
- var t = this.chart.theme, events = this.events(),
- ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
- vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler);
- for(var i = this.series.length - 1; i >= 0; --i){
- var run = this.series[i];
- if(!this.dirty && !run.dirty){
- t.skip();
- this._reconnectEvents(run.name);
- continue;
- }
- run.cleanGroup();
- var theme = t.next(this.opt.areas ? "area" : "line", [this.opt, run], true),
- s = run.group, outline,
- lpoly = dojo.map(acc, function(v, i){
- return {
- x: ht(i + 1) + offsets.l,
- y: dim.height - offsets.b - vt(v)
- };
- }, this);
- var lpath = this.opt.tension ? dc.curve(lpoly, this.opt.tension) : "";
- if(this.opt.areas){
- var apoly = dojo.clone(lpoly);
- if(this.opt.tension){
- var p=dc.curve(apoly, this.opt.tension);
- p += " L" + lpoly[lpoly.length - 1].x + "," + (dim.height - offsets.b) +
- " L" + lpoly[0].x + "," + (dim.height - offsets.b) +
- " L" + lpoly[0].x + "," + lpoly[0].y;
- run.dyn.fill = s.createPath(p).setFill(theme.series.fill).getFill();
- } else {
- apoly.push({x: lpoly[lpoly.length - 1].x, y: dim.height - offsets.b});
- apoly.push({x: lpoly[0].x, y: dim.height - offsets.b});
- apoly.push(lpoly[0]);
- run.dyn.fill = s.createPolyline(apoly).setFill(theme.series.fill).getFill();
- }
- }
- if(this.opt.lines || this.opt.markers){
- if(theme.series.outline){
- outline = dc.makeStroke(theme.series.outline);
- outline.width = 2 * outline.width + theme.series.stroke.width;
- }
- }
- if(this.opt.markers){
- run.dyn.marker = theme.symbol;
- }
- var frontMarkers, outlineMarkers, shadowMarkers;
- if(theme.series.shadow && theme.series.stroke){
- var shadow = theme.series.shadow,
- spoly = dojo.map(lpoly, function(c){
- return {x: c.x + shadow.dx, y: c.y + shadow.dy};
- });
- if(this.opt.lines){
- if(this.opt.tension){
- run.dyn.shadow = s.createPath(dc.curve(spoly, this.opt.tension)).setStroke(shadow).getStroke();
- } else {
- run.dyn.shadow = s.createPolyline(spoly).setStroke(shadow).getStroke();
- }
- }
- if(this.opt.markers){
- shadow = theme.marker.shadow;
- shadowMarkers = dojo.map(spoly, function(c){
- return s.createPath("M" + c.x + " " + c.y + " " + theme.symbol).
- setStroke(shadow).setFill(shadow.color);
- }, this);
- }
- }
- if(this.opt.lines){
- if(outline){
- if(this.opt.tension){
- run.dyn.outline = s.createPath(lpath).setStroke(outline).getStroke();
- } else {
- run.dyn.outline = s.createPolyline(lpoly).setStroke(outline).getStroke();
- }
- }
- if(this.opt.tension){
- run.dyn.stroke = s.createPath(lpath).setStroke(theme.series.stroke).getStroke();
- } else {
- run.dyn.stroke = s.createPolyline(lpoly).setStroke(theme.series.stroke).getStroke();
- }
- }
- if(this.opt.markers){
- frontMarkers = new Array(lpoly.length);
- outlineMarkers = new Array(lpoly.length);
- outline = null;
- if(theme.marker.outline){
- outline = dc.makeStroke(theme.marker.outline);
- outline.width = 2 * outline.width + (theme.marker.stroke ? theme.marker.stroke.width : 0);
- }
- dojo.forEach(lpoly, function(c, i){
- var path = "M" + c.x + " " + c.y + " " + theme.symbol;
- if(outline){
- outlineMarkers[i] = s.createPath(path).setStroke(outline);
- }
- frontMarkers[i] = s.createPath(path).setStroke(theme.marker.stroke).setFill(theme.marker.fill);
- }, this);
- if(events){
- var eventSeries = new Array(frontMarkers.length);
- dojo.forEach(frontMarkers, function(s, i){
- var o = {
- element: "marker",
- index: i,
- run: run,
- shape: s,
- outline: outlineMarkers[i] || null,
- shadow: shadowMarkers && shadowMarkers[i] || null,
- cx: lpoly[i].x,
- cy: lpoly[i].y,
- x: i + 1,
- y: run.data[i]
- };
- this._connectEvents(o);
- eventSeries[i] = o;
- }, this);
- this._eventSeries[run.name] = eventSeries;
- }else{
- delete this._eventSeries[run.name];
- }
- }
- run.dirty = false;
-
- for(var j = 0; j < run.data.length; ++j){
- var v = run.data[j];
- if(v !== null){
- if(isNaN(v)){ v = 0; }
- acc[j] -= v;
- }
- }
- }
- this.dirty = false;
- return this;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.StackedLines"]){
- dojo._hasResource["dojox.charting.plot2d.StackedLines"] = true;
- dojo.provide("dojox.charting.plot2d.StackedLines");
- dojo.declare("dojox.charting.plot2d.StackedLines", dojox.charting.plot2d.Stacked, {
-
-
- constructor: function(){
-
-
- this.opt.lines = true;
- }
- });
- }
- if(!dojo._hasResource["dojox.charting.plot2d.StackedAreas"]){
- dojo._hasResource["dojox.charting.plot2d.StackedAreas"] = true;
- dojo.provide("dojox.charting.plot2d.StackedAreas");
- dojo.declare("dojox.charting.plot2d.StackedAreas", dojox.charting.plot2d.Stacked, {
-
-
- constructor: function(){
-
-
- this.opt.lines = true;
- this.opt.areas = true;
- }
- });
- }
- if(!dojo._hasResource["dojox.charting.plot2d.Columns"]){
- dojo._hasResource["dojox.charting.plot2d.Columns"] = true;
- dojo.provide("dojox.charting.plot2d.Columns");
- (function(){
- var df = dojox.lang.functional, du = dojox.lang.utils,
- dc = dojox.charting.plot2d.common,
- purgeGroup = df.lambda("item.purgeGroup()");
- dojo.declare("dojox.charting.plot2d.Columns", dojox.charting.plot2d.Base, {
-
-
- defaultParams: {
- hAxis: "x",
- vAxis: "y",
- gap: 0,
- animate: null
- },
- optionalParams: {
- minBarSize: 1,
- maxBarSize: 1,
-
- stroke: {},
- outline: {},
- shadow: {},
- fill: {},
- font: "",
- fontColor: ""
- },
- constructor: function(chart, kwArgs){
-
-
-
-
-
-
- this.opt = dojo.clone(this.defaultParams);
- du.updateWithObject(this.opt, kwArgs);
- du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
- this.series = [];
- this.hAxis = this.opt.hAxis;
- this.vAxis = this.opt.vAxis;
- this.animate = this.opt.animate;
- },
- getSeriesStats: function(){
-
-
-
-
- var stats = dc.collectSimpleStats(this.series);
- stats.hmin -= 0.5;
- stats.hmax += 0.5;
- return stats;
- },
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(this.zoom && !this.isDataDirty()){
- return this.performZoom(dim, offsets);
- }
- this.resetEvents();
- this.dirty = this.isDirty();
- if(this.dirty){
- dojo.forEach(this.series, purgeGroup);
- this._eventSeries = {};
- this.cleanGroup();
- var s = this.group;
- df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
- }
- var t = this.chart.theme, f, gap, width,
- ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
- vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
- baseline = Math.max(0, this._vScaler.bounds.lower),
- baselineHeight = vt(baseline),
- events = this.events();
- f = dc.calculateBarSize(this._hScaler.bounds.scale, this.opt);
- gap = f.gap;
- width = f.size;
- for(var i = this.series.length - 1; i >= 0; --i){
- var run = this.series[i];
- if(!this.dirty && !run.dirty){
- t.skip();
- this._reconnectEvents(run.name);
- continue;
- }
- run.cleanGroup();
- var theme = t.next("column", [this.opt, run]), s = run.group,
- eventSeries = new Array(run.data.length);
- for(var j = 0; j < run.data.length; ++j){
- var value = run.data[j];
- if(value !== null){
- var v = typeof value == "number" ? value : value.y,
- vv = vt(v),
- height = vv - baselineHeight,
- h = Math.abs(height),
- finalTheme = typeof value != "number" ?
- t.addMixin(theme, "column", value, true) :
- t.post(theme, "column");
- if(width >= 1 && h >= 0){
- var rect = {
- x: offsets.l + ht(j + 0.5) + gap,
- y: dim.height - offsets.b - (v > baseline ? vv : baselineHeight),
- width: width, height: h
- };
- var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
- specialFill = this._shapeFill(specialFill, rect);
- var shape = s.createRect(rect).setFill(specialFill).setStroke(finalTheme.series.stroke);
- run.dyn.fill = shape.getFill();
- run.dyn.stroke = shape.getStroke();
- if(events){
- var o = {
- element: "column",
- index: j,
- run: run,
- shape: shape,
- x: j + 0.5,
- y: v
- };
- this._connectEvents(o);
- eventSeries[j] = o;
- }
- if(this.animate){
- this._animateColumn(shape, dim.height - offsets.b - baselineHeight, h);
- }
- }
- }
- }
- this._eventSeries[run.name] = eventSeries;
- run.dirty = false;
- }
- this.dirty = false;
- return this;
- },
- _animateColumn: function(shape, voffset, vsize){
- dojox.gfx.fx.animateTransform(dojo.delegate({
- shape: shape,
- duration: 1200,
- transform: [
- {name: "translate", start: [0, voffset - (voffset/vsize)], end: [0, 0]},
- {name: "scale", start: [1, 1/vsize], end: [1, 1]},
- {name: "original"}
- ]
- }, this.animate)).play();
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.StackedColumns"]){
- dojo._hasResource["dojox.charting.plot2d.StackedColumns"] = true;
- dojo.provide("dojox.charting.plot2d.StackedColumns");
- (function(){
- var df = dojox.lang.functional, dc = dojox.charting.plot2d.common,
- purgeGroup = df.lambda("item.purgeGroup()");
- dojo.declare("dojox.charting.plot2d.StackedColumns", dojox.charting.plot2d.Columns, {
-
-
- getSeriesStats: function(){
-
-
-
-
- var stats = dc.collectStackedStats(this.series);
- this._maxRunLength = stats.hmax;
- stats.hmin -= 0.5;
- stats.hmax += 0.5;
- return stats;
- },
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(this._maxRunLength <= 0){
- return this;
- }
-
- var acc = df.repeat(this._maxRunLength, "-> 0", 0);
- for(var i = 0; i < this.series.length; ++i){
- var run = this.series[i];
- for(var j = 0; j < run.data.length; ++j){
- var value = run.data[j];
- if(value !== null){
- var v = typeof value == "number" ? value : value.y;
- if(isNaN(v)){ v = 0; }
- acc[j] += v;
- }
- }
- }
-
- if(this.zoom && !this.isDataDirty()){
- return this.performZoom(dim, offsets);
- }
- this.resetEvents();
- this.dirty = this.isDirty();
- if(this.dirty){
- dojo.forEach(this.series, purgeGroup);
- this._eventSeries = {};
- this.cleanGroup();
- var s = this.group;
- df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
- }
- var t = this.chart.theme, f, gap, width,
- ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
- vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
- events = this.events();
- f = dc.calculateBarSize(this._hScaler.bounds.scale, this.opt);
- gap = f.gap;
- width = f.size;
- for(var i = this.series.length - 1; i >= 0; --i){
- var run = this.series[i];
- if(!this.dirty && !run.dirty){
- t.skip();
- this._reconnectEvents(run.name);
- continue;
- }
- run.cleanGroup();
- var theme = t.next("column", [this.opt, run]), s = run.group,
- eventSeries = new Array(acc.length);
- for(var j = 0; j < acc.length; ++j){
- var value = run.data[j];
- if(value !== null){
- var v = acc[j],
- height = vt(v),
- finalTheme = typeof value != "number" ?
- t.addMixin(theme, "column", value, true) :
- t.post(theme, "column");
- if(width >= 1 && height >= 0){
- var rect = {
- x: offsets.l + ht(j + 0.5) + gap,
- y: dim.height - offsets.b - vt(v),
- width: width, height: height
- };
- var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
- specialFill = this._shapeFill(specialFill, rect);
- var shape = s.createRect(rect).setFill(specialFill).setStroke(finalTheme.series.stroke);
- run.dyn.fill = shape.getFill();
- run.dyn.stroke = shape.getStroke();
- if(events){
- var o = {
- element: "column",
- index: j,
- run: run,
- shape: shape,
- x: j + 0.5,
- y: v
- };
- this._connectEvents(o);
- eventSeries[j] = o;
- }
- if(this.animate){
- this._animateColumn(shape, dim.height - offsets.b, height);
- }
- }
- }
- }
- this._eventSeries[run.name] = eventSeries;
- run.dirty = false;
-
- for(var j = 0; j < run.data.length; ++j){
- var value = run.data[j];
- if(value !== null){
- var v = typeof value == "number" ? value : value.y;
- if(isNaN(v)){ v = 0; }
- acc[j] -= v;
- }
- }
- }
- this.dirty = false;
- return this;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.ClusteredColumns"]){
- dojo._hasResource["dojox.charting.plot2d.ClusteredColumns"] = true;
- dojo.provide("dojox.charting.plot2d.ClusteredColumns");
- (function(){
- var df = dojox.lang.functional, dc = dojox.charting.plot2d.common,
- purgeGroup = df.lambda("item.purgeGroup()");
- dojo.declare("dojox.charting.plot2d.ClusteredColumns", dojox.charting.plot2d.Columns, {
-
-
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(this.zoom && !this.isDataDirty()){
- return this.performZoom(dim, offsets);
- }
- this.resetEvents();
- this.dirty = this.isDirty();
- if(this.dirty){
- dojo.forEach(this.series, purgeGroup);
- this._eventSeries = {};
- this.cleanGroup();
- var s = this.group;
- df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
- }
- var t = this.chart.theme, f, gap, width, thickness,
- ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
- vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
- baseline = Math.max(0, this._vScaler.bounds.lower),
- baselineHeight = vt(baseline),
- events = this.events();
- f = dc.calculateBarSize(this._hScaler.bounds.scale, this.opt, this.series.length);
- gap = f.gap;
- width = thickness = f.size;
- for(var i = 0; i < this.series.length; ++i){
- var run = this.series[i], shift = thickness * i;
- if(!this.dirty && !run.dirty){
- t.skip();
- this._reconnectEvents(run.name);
- continue;
- }
- run.cleanGroup();
- var theme = t.next("column", [this.opt, run]), s = run.group,
- eventSeries = new Array(run.data.length);
- for(var j = 0; j < run.data.length; ++j){
- var value = run.data[j];
- if(value !== null){
- var v = typeof value == "number" ? value : value.y,
- vv = vt(v),
- height = vv - baselineHeight,
- h = Math.abs(height),
- finalTheme = typeof value != "number" ?
- t.addMixin(theme, "column", value, true) :
- t.post(theme, "column");
- if(width >= 1 && h >= 0){
- var rect = {
- x: offsets.l + ht(j + 0.5) + gap + shift,
- y: dim.height - offsets.b - (v > baseline ? vv : baselineHeight),
- width: width, height: h
- };
- var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
- specialFill = this._shapeFill(specialFill, rect);
- var shape = s.createRect(rect).setFill(specialFill).setStroke(finalTheme.series.stroke);
- run.dyn.fill = shape.getFill();
- run.dyn.stroke = shape.getStroke();
- if(events){
- var o = {
- element: "column",
- index: j,
- run: run,
- shape: shape,
- x: j + 0.5,
- y: v
- };
- this._connectEvents(o);
- eventSeries[j] = o;
- }
- if(this.animate){
- this._animateColumn(shape, dim.height - offsets.b - baselineHeight, h);
- }
- }
- }
- }
- this._eventSeries[run.name] = eventSeries;
- run.dirty = false;
- }
- this.dirty = false;
- return this;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.Bars"]){
- dojo._hasResource["dojox.charting.plot2d.Bars"] = true;
- dojo.provide("dojox.charting.plot2d.Bars");
- (function(){
- var df = dojox.lang.functional, du = dojox.lang.utils,
- dc = dojox.charting.plot2d.common,
- purgeGroup = df.lambda("item.purgeGroup()");
- dojo.declare("dojox.charting.plot2d.Bars", dojox.charting.plot2d.Base, {
-
-
- defaultParams: {
- hAxis: "x",
- vAxis: "y",
- gap: 0,
- animate: null
- },
- optionalParams: {
- minBarSize: 1,
- maxBarSize: 1,
-
- stroke: {},
- outline: {},
- shadow: {},
- fill: {},
- font: "",
- fontColor: ""
- },
- constructor: function(chart, kwArgs){
-
-
-
-
-
-
- this.opt = dojo.clone(this.defaultParams);
- du.updateWithObject(this.opt, kwArgs);
- du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
- this.series = [];
- this.hAxis = this.opt.hAxis;
- this.vAxis = this.opt.vAxis;
- this.animate = this.opt.animate;
- },
- getSeriesStats: function(){
-
-
-
-
- var stats = dc.collectSimpleStats(this.series), t;
- stats.hmin -= 0.5;
- stats.hmax += 0.5;
- t = stats.hmin, stats.hmin = stats.vmin, stats.vmin = t;
- t = stats.hmax, stats.hmax = stats.vmax, stats.vmax = t;
- return stats;
- },
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(this.zoom && !this.isDataDirty()){
- return this.performZoom(dim, offsets);
- }
- this.dirty = this.isDirty();
- this.resetEvents();
- if(this.dirty){
- dojo.forEach(this.series, purgeGroup);
- this._eventSeries = {};
- this.cleanGroup();
- var s = this.group;
- df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
- }
- var t = this.chart.theme, f, gap, height,
- ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
- vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
- baseline = Math.max(0, this._hScaler.bounds.lower),
- baselineWidth = ht(baseline),
- events = this.events();
- f = dc.calculateBarSize(this._vScaler.bounds.scale, this.opt);
- gap = f.gap;
- height = f.size;
- for(var i = this.series.length - 1; i >= 0; --i){
- var run = this.series[i];
- if(!this.dirty && !run.dirty){
- t.skip();
- this._reconnectEvents(run.name);
- continue;
- }
- run.cleanGroup();
- var theme = t.next("bar", [this.opt, run]), s = run.group,
- eventSeries = new Array(run.data.length);
- for(var j = 0; j < run.data.length; ++j){
- var value = run.data[j];
- if(value !== null){
- var v = typeof value == "number" ? value : value.y,
- hv = ht(v),
- width = hv - baselineWidth,
- w = Math.abs(width),
- finalTheme = typeof value != "number" ?
- t.addMixin(theme, "bar", value, true) :
- t.post(theme, "bar");
- if(w >= 0 && height >= 1){
- var rect = {
- x: offsets.l + (v < baseline ? hv : baselineWidth),
- y: dim.height - offsets.b - vt(j + 1.5) + gap,
- width: w, height: height
- };
- var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
- specialFill = this._shapeFill(specialFill, rect);
- var shape = s.createRect(rect).setFill(specialFill).setStroke(finalTheme.series.stroke);
- run.dyn.fill = shape.getFill();
- run.dyn.stroke = shape.getStroke();
- if(events){
- var o = {
- element: "bar",
- index: j,
- run: run,
- shape: shape,
- x: v,
- y: j + 1.5
- };
- this._connectEvents(o);
- eventSeries[j] = o;
- }
- if(this.animate){
- this._animateBar(shape, offsets.l + baselineWidth, -w);
- }
- }
- }
- }
- this._eventSeries[run.name] = eventSeries;
- run.dirty = false;
- }
- this.dirty = false;
- return this;
- },
- _animateBar: function(shape, hoffset, hsize){
- dojox.gfx.fx.animateTransform(dojo.delegate({
- shape: shape,
- duration: 1200,
- transform: [
- {name: "translate", start: [hoffset - (hoffset/hsize), 0], end: [0, 0]},
- {name: "scale", start: [1/hsize, 1], end: [1, 1]},
- {name: "original"}
- ]
- }, this.animate)).play();
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.StackedBars"]){
- dojo._hasResource["dojox.charting.plot2d.StackedBars"] = true;
- dojo.provide("dojox.charting.plot2d.StackedBars");
- (function(){
- var df = dojox.lang.functional, dc = dojox.charting.plot2d.common,
- purgeGroup = df.lambda("item.purgeGroup()");
- dojo.declare("dojox.charting.plot2d.StackedBars", dojox.charting.plot2d.Bars, {
-
-
- getSeriesStats: function(){
-
-
-
-
- var stats = dc.collectStackedStats(this.series), t;
- this._maxRunLength = stats.hmax;
- stats.hmin -= 0.5;
- stats.hmax += 0.5;
- t = stats.hmin, stats.hmin = stats.vmin, stats.vmin = t;
- t = stats.hmax, stats.hmax = stats.vmax, stats.vmax = t;
- return stats;
- },
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(this._maxRunLength <= 0){
- return this;
- }
-
- var acc = df.repeat(this._maxRunLength, "-> 0", 0);
- for(var i = 0; i < this.series.length; ++i){
- var run = this.series[i];
- for(var j = 0; j < run.data.length; ++j){
- var value = run.data[j];
- if(value !== null){
- var v = typeof value == "number" ? value : value.y;
- if(isNaN(v)){ v = 0; }
- acc[j] += v;
- }
- }
- }
-
- if(this.zoom && !this.isDataDirty()){
- return this.performZoom(dim, offsets);
- }
- this.resetEvents();
- this.dirty = this.isDirty();
- if(this.dirty){
- dojo.forEach(this.series, purgeGroup);
- this._eventSeries = {};
- this.cleanGroup();
- var s = this.group;
- df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
- }
- var t = this.chart.theme, f, gap, height,
- ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
- vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
- events = this.events();
- f = dc.calculateBarSize(this._vScaler.bounds.scale, this.opt);
- gap = f.gap;
- height = f.size;
- for(var i = this.series.length - 1; i >= 0; --i){
- var run = this.series[i];
- if(!this.dirty && !run.dirty){
- t.skip();
- this._reconnectEvents(run.name);
- continue;
- }
- run.cleanGroup();
- var theme = t.next("bar", [this.opt, run]), s = run.group,
- eventSeries = new Array(acc.length);
- for(var j = 0; j < acc.length; ++j){
- var value = run.data[j];
- if(value !== null){
- var v = acc[j],
- width = ht(v),
- finalTheme = typeof value != "number" ?
- t.addMixin(theme, "bar", value, true) :
- t.post(theme, "bar");
- if(width >= 0 && height >= 1){
- var rect = {
- x: offsets.l,
- y: dim.height - offsets.b - vt(j + 1.5) + gap,
- width: width, height: height
- };
- var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
- specialFill = this._shapeFill(specialFill, rect);
- var shape = s.createRect(rect).setFill(specialFill).setStroke(finalTheme.series.stroke);
- run.dyn.fill = shape.getFill();
- run.dyn.stroke = shape.getStroke();
- if(events){
- var o = {
- element: "bar",
- index: j,
- run: run,
- shape: shape,
- x: v,
- y: j + 1.5
- };
- this._connectEvents(o);
- eventSeries[j] = o;
- }
- if(this.animate){
- this._animateBar(shape, offsets.l, -width);
- }
- }
- }
- }
- this._eventSeries[run.name] = eventSeries;
- run.dirty = false;
-
- for(var j = 0; j < run.data.length; ++j){
- var value = run.data[j];
- if(value !== null){
- var v = typeof value == "number" ? value : value.y;
- if(isNaN(v)){ v = 0; }
- acc[j] -= v;
- }
- }
- }
- this.dirty = false;
- return this;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.ClusteredBars"]){
- dojo._hasResource["dojox.charting.plot2d.ClusteredBars"] = true;
- dojo.provide("dojox.charting.plot2d.ClusteredBars");
- (function(){
- var df = dojox.lang.functional, dc = dojox.charting.plot2d.common,
- purgeGroup = df.lambda("item.purgeGroup()");
- dojo.declare("dojox.charting.plot2d.ClusteredBars", dojox.charting.plot2d.Bars, {
-
-
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(this.zoom && !this.isDataDirty()){
- return this.performZoom(dim, offsets);
- }
- this.resetEvents();
- this.dirty = this.isDirty();
- if(this.dirty){
- dojo.forEach(this.series, purgeGroup);
- this._eventSeries = {};
- this.cleanGroup();
- var s = this.group;
- df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
- }
- var t = this.chart.theme, f, gap, height, thickness,
- ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
- vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
- baseline = Math.max(0, this._hScaler.bounds.lower),
- baselineWidth = ht(baseline),
- events = this.events();
- f = dc.calculateBarSize(this._vScaler.bounds.scale, this.opt, this.series.length);
- gap = f.gap;
- height = thickness = f.size;
- for(var i = this.series.length - 1; i >= 0; --i){
- var run = this.series[i], shift = thickness * (this.series.length - i - 1);
- if(!this.dirty && !run.dirty){
- t.skip();
- this._reconnectEvents(run.name);
- continue;
- }
- run.cleanGroup();
- var theme = t.next("bar", [this.opt, run]), s = run.group,
- eventSeries = new Array(run.data.length);
- for(var j = 0; j < run.data.length; ++j){
- var value = run.data[j];
- if(value !== null){
- var v = typeof value == "number" ? value : value.y,
- hv = ht(v),
- width = hv - baselineWidth,
- w = Math.abs(width),
- finalTheme = typeof value != "number" ?
- t.addMixin(theme, "bar", value, true) :
- t.post(theme, "bar");
- if(w >= 0 && height >= 1){
- var rect = {
- x: offsets.l + (v < baseline ? hv : baselineWidth),
- y: dim.height - offsets.b - vt(j + 1.5) + gap + shift,
- width: w, height: height
- };
- var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
- specialFill = this._shapeFill(specialFill, rect);
- var shape = s.createRect(rect).setFill(specialFill).setStroke(finalTheme.series.stroke);
- run.dyn.fill = shape.getFill();
- run.dyn.stroke = shape.getStroke();
- if(events){
- var o = {
- element: "bar",
- index: j,
- run: run,
- shape: shape,
- x: v,
- y: j + 1.5
- };
- this._connectEvents(o);
- eventSeries[j] = o;
- }
- if(this.animate){
- this._animateBar(shape, offsets.l + baselineWidth, -width);
- }
- }
- }
- }
- this._eventSeries[run.name] = eventSeries;
- run.dirty = false;
- }
- this.dirty = false;
- return this;
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.Grid"]){
- dojo._hasResource["dojox.charting.plot2d.Grid"] = true;
- dojo.provide("dojox.charting.plot2d.Grid");
- (function(){
- var du = dojox.lang.utils, dc = dojox.charting.plot2d.common;
- dojo.declare("dojox.charting.plot2d.Grid", dojox.charting.Element, {
-
-
-
- defaultParams: {
- hAxis: "x",
- vAxis: "y",
- hMajorLines: true,
- hMinorLines: false,
- vMajorLines: true,
- vMinorLines: false,
- hStripes: "none",
- vStripes: "none",
- animate: null
- },
- optionalParams: {},
- constructor: function(chart, kwArgs){
-
-
-
-
-
-
- this.opt = dojo.clone(this.defaultParams);
- du.updateWithObject(this.opt, kwArgs);
- this.hAxis = this.opt.hAxis;
- this.vAxis = this.opt.vAxis;
- this.dirty = true;
- this.animate = this.opt.animate;
- this.zoom = null,
- this.zoomQueue = [];
- this.lastWindow = {vscale: 1, hscale: 1, xoffset: 0, yoffset: 0};
- },
- clear: function(){
-
-
-
-
- this._hAxis = null;
- this._vAxis = null;
- this.dirty = true;
- return this;
- },
- setAxis: function(axis){
-
-
-
-
- if(axis){
- this[axis.vertical ? "_vAxis" : "_hAxis"] = axis;
- }
- return this;
- },
- addSeries: function(run){
-
-
-
-
- return this;
- },
- getSeriesStats: function(){
-
-
-
-
- return dojo.delegate(dc.defaultStats);
- },
- initializeScalers: function(){
-
-
- return this;
- },
- isDirty: function(){
-
-
-
-
- return this.dirty || this._hAxis && this._hAxis.dirty || this._vAxis && this._vAxis.dirty;
- },
- performZoom: function(dim, offsets){
-
-
-
-
-
-
-
-
-
- var vs = this._vAxis.scale || 1,
- hs = this._hAxis.scale || 1,
- vOffset = dim.height - offsets.b,
- hBounds = this._hAxis.getScaler().bounds,
- xOffset = (hBounds.from - hBounds.lower) * hBounds.scale,
- vBounds = this._vAxis.getScaler().bounds,
- yOffset = (vBounds.from - vBounds.lower) * vBounds.scale;
-
- rVScale = vs / this.lastWindow.vscale,
- rHScale = hs / this.lastWindow.hscale,
- rXOffset = (this.lastWindow.xoffset - xOffset)/
- ((this.lastWindow.hscale == 1)? hs : this.lastWindow.hscale),
- rYOffset = (yOffset - this.lastWindow.yoffset)/
- ((this.lastWindow.vscale == 1)? vs : this.lastWindow.vscale),
- shape = this.group,
- anim = dojox.gfx.fx.animateTransform(dojo.delegate({
- shape: shape,
- duration: 1200,
- transform:[
- {name:"translate", start:[0, 0], end: [offsets.l * (1 - rHScale), vOffset * (1 - rVScale)]},
- {name:"scale", start:[1, 1], end: [rHScale, rVScale]},
- {name:"original"},
- {name:"translate", start: [0, 0], end: [rXOffset, rYOffset]}
- ]}, this.zoom));
- dojo.mixin(this.lastWindow, {vscale: vs, hscale: hs, xoffset: xOffset, yoffset: yOffset});
-
-
- this.zoomQueue.push(anim);
-
- dojo.connect(anim, "onEnd", this, function(){
- this.zoom = null;
- this.zoomQueue.shift();
- if(this.zoomQueue.length > 0){
- this.zoomQueue[0].play();
- }
- });
- if(this.zoomQueue.length == 1){
- this.zoomQueue[0].play();
- }
- return this;
- },
- getRequiredColors: function(){
-
-
-
-
- return 0;
- },
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(this.zoom){
- return this.performZoom(dim, offsets);
- }
- this.dirty = this.isDirty();
- if(!this.dirty){ return this; }
- this.cleanGroup();
- var s = this.group, ta = this.chart.theme.axis;
-
- try{
- var vScaler = this._vAxis.getScaler(),
- vt = vScaler.scaler.getTransformerFromModel(vScaler),
- ticks = this._vAxis.getTicks();
- if(this.opt.hMinorLines){
- dojo.forEach(ticks.minor, function(tick){
- var y = dim.height - offsets.b - vt(tick.value);
- var hMinorLine = s.createLine({
- x1: offsets.l,
- y1: y,
- x2: dim.width - offsets.r,
- y2: y
- }).setStroke(ta.minorTick);
- if(this.animate){
- this._animateGrid(hMinorLine, "h", offsets.l, offsets.r + offsets.l - dim.width);
- }
- }, this);
- }
- if(this.opt.hMajorLines){
- dojo.forEach(ticks.major, function(tick){
- var y = dim.height - offsets.b - vt(tick.value);
- var hMajorLine = s.createLine({
- x1: offsets.l,
- y1: y,
- x2: dim.width - offsets.r,
- y2: y
- }).setStroke(ta.majorTick);
- if(this.animate){
- this._animateGrid(hMajorLine, "h", offsets.l, offsets.r + offsets.l - dim.width);
- }
- }, this);
- }
- }catch(e){
-
- }
-
- try{
- var hScaler = this._hAxis.getScaler(),
- ht = hScaler.scaler.getTransformerFromModel(hScaler),
- ticks = this._hAxis.getTicks();
- if(ticks && this.opt.vMinorLines){
- dojo.forEach(ticks.minor, function(tick){
- var x = offsets.l + ht(tick.value);
- var vMinorLine = s.createLine({
- x1: x,
- y1: offsets.t,
- x2: x,
- y2: dim.height - offsets.b
- }).setStroke(ta.minorTick);
- if(this.animate){
- this._animateGrid(vMinorLine, "v", dim.height - offsets.b, dim.height - offsets.b - offsets.t);
- }
- }, this);
- }
- if(ticks && this.opt.vMajorLines){
- dojo.forEach(ticks.major, function(tick){
- var x = offsets.l + ht(tick.value);
- var vMajorLine = s.createLine({
- x1: x,
- y1: offsets.t,
- x2: x,
- y2: dim.height - offsets.b
- }).setStroke(ta.majorTick);
- if(this.animate){
- this._animateGrid(vMajorLine, "v", dim.height - offsets.b, dim.height - offsets.b - offsets.t);
- }
- }, this);
- }
- }catch(e){
-
- }
- this.dirty = false;
- return this;
- },
- _animateGrid: function(shape, type, offset, size){
- var transStart = type == "h" ? [offset, 0] : [0, offset];
- var scaleStart = type == "h" ? [1/size, 1] : [1, 1/size];
- dojox.gfx.fx.animateTransform(dojo.delegate({
- shape: shape,
- duration: 1200,
- transform: [
- {name: "translate", start: transStart, end: [0, 0]},
- {name: "scale", start: scaleStart, end: [1, 1]},
- {name: "original"}
- ]
- }, this.animate)).play();
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.Pie"]){
- dojo._hasResource["dojox.charting.plot2d.Pie"] = true;
- dojo.provide("dojox.charting.plot2d.Pie");
- (function(){
- var df = dojox.lang.functional, du = dojox.lang.utils,
- dc = dojox.charting.plot2d.common,
- da = dojox.charting.axis2d.common,
- g = dojox.gfx, m = g.matrix,
- FUDGE_FACTOR = 0.2;
- dojo.declare("dojox.charting.plot2d.Pie", [dojox.charting.Element, dojox.charting.plot2d._PlotEvents], {
-
-
- defaultParams: {
- labels: true,
- ticks: false,
- fixed: true,
- precision: 1,
- labelOffset: 20,
- labelStyle: "default",
- htmlLabels: true,
- radGrad: "native",
- fanSize: 5,
- startAngle: 0
- },
- optionalParams: {
- radius: 0,
-
- stroke: {},
- outline: {},
- shadow: {},
- fill: {},
- font: "",
- fontColor: "",
- labelWiring: {}
- },
- constructor: function(chart, kwArgs){
-
-
- this.opt = dojo.clone(this.defaultParams);
- du.updateWithObject(this.opt, kwArgs);
- du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
- this.run = null;
- this.dyn = [];
- },
- clear: function(){
-
-
-
-
- this.dirty = true;
- this.dyn = [];
- this.run = null;
- return this;
- },
- setAxis: function(axis){
-
-
-
-
- return this;
- },
- addSeries: function(run){
-
-
-
-
- this.run = run;
- return this;
- },
- getSeriesStats: function(){
-
-
-
-
- return dojo.delegate(dc.defaultStats);
- },
- initializeScalers: function(){
-
-
- return this;
- },
- getRequiredColors: function(){
-
-
- return this.run ? this.run.data.length : 0;
- },
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(!this.dirty){ return this; }
- this.resetEvents();
- this.dirty = false;
- this._eventSeries = {};
- this.cleanGroup();
- var s = this.group, t = this.chart.theme;
- if(!this.run || !this.run.data.length){
- return this;
- }
-
- var rx = (dim.width - offsets.l - offsets.r) / 2,
- ry = (dim.height - offsets.t - offsets.b) / 2,
- r = Math.min(rx, ry),
- taFont = "font" in this.opt ? this.opt.font : t.axis.font,
- size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,
- taFontColor = "fontColor" in this.opt ? this.opt.fontColor : t.axis.fontColor,
- startAngle = m._degToRad(this.opt.startAngle),
- start = startAngle, step, filteredRun, slices, labels, shift, labelR,
- run = this.run.data,
- events = this.events();
- if(typeof run[0] == "number"){
- filteredRun = df.map(run, "x ? Math.max(x, 0) : 0");
- if(df.every(filteredRun, "<= 0")){
- return this;
- }
- slices = df.map(filteredRun, "/this", df.foldl(filteredRun, "+", 0));
- if(this.opt.labels){
- labels = dojo.map(slices, function(x){
- return x > 0 ? this._getLabel(x * 100) + "%" : "";
- }, this);
- }
- }else{
- filteredRun = df.map(run, "x ? Math.max(x.y, 0) : 0");
- if(df.every(filteredRun, "<= 0")){
- return this;
- }
- slices = df.map(filteredRun, "/this", df.foldl(filteredRun, "+", 0));
- if(this.opt.labels){
- labels = dojo.map(slices, function(x, i){
- if(x <= 0){ return ""; }
- var v = run[i];
- return "text" in v ? v.text : this._getLabel(x * 100) + "%";
- }, this);
- }
- }
- var themes = df.map(run, function(v, i){
- if(v === null || typeof v == "number"){
- return t.next("slice", [this.opt, this.run], true);
- }
- return t.next("slice", [this.opt, this.run, v], true);
- }, this);
- if(this.opt.labels){
- shift = df.foldl1(df.map(labels, function(label, i){
- var font = themes[i].series.font;
- return dojox.gfx._base._getTextBox(label, {font: font}).w;
- }, this), "Math.max(a, b)") / 2;
- if(this.opt.labelOffset < 0){
- r = Math.min(rx - 2 * shift, ry - size) + this.opt.labelOffset;
- }
- labelR = r - this.opt.labelOffset;
- }
- if("radius" in this.opt){
- r = this.opt.radius;
- labelR = r - this.opt.labelOffset;
- }
- var circle = {
- cx: offsets.l + rx,
- cy: offsets.t + ry,
- r: r
- };
- this.dyn = [];
-
- var eventSeries = new Array(slices.length);
- dojo.some(slices, function(slice, i){
- if(slice < 0){
-
- return false;
- }
- if(slice == 0){
- this.dyn.push({fill: null, stroke: null});
- return false;
- }
- var v = run[i], theme = themes[i], specialFill;
- if(slice >= 1){
-
- specialFill = this._plotFill(theme.series.fill, dim, offsets);
- specialFill = this._shapeFill(specialFill,
- {
- x: circle.cx - circle.r, y: circle.cy - circle.r,
- width: 2 * circle.r, height: 2 * circle.r
- });
- specialFill = this._pseudoRadialFill(specialFill, {x: circle.cx, y: circle.cy}, circle.r);
- var shape = s.createCircle(circle).setFill(specialFill).setStroke(theme.series.stroke);
- this.dyn.push({fill: specialFill, stroke: theme.series.stroke});
- if(events){
- var o = {
- element: "slice",
- index: i,
- run: this.run,
- shape: shape,
- x: i,
- y: typeof v == "number" ? v : v.y,
- cx: circle.cx,
- cy: circle.cy,
- cr: r
- };
- this._connectEvents(o);
- eventSeries[i] = o;
- }
- return true;
- }
-
- var end = start + slice * 2 * Math.PI;
- if(i + 1 == slices.length){
- end = startAngle + 2 * Math.PI;
- }
- var step = end - start,
- x1 = circle.cx + r * Math.cos(start),
- y1 = circle.cy + r * Math.sin(start),
- x2 = circle.cx + r * Math.cos(end),
- y2 = circle.cy + r * Math.sin(end);
-
- var fanSize = m._degToRad(this.opt.fanSize);
- if(theme.series.fill && theme.series.fill.type === "radial" && this.opt.radGrad === "fan" && step > fanSize){
- var group = s.createGroup(), nfans = Math.ceil(step / fanSize), delta = step / nfans;
- specialFill = this._shapeFill(theme.series.fill,
- {x: circle.cx - circle.r, y: circle.cy - circle.r, width: 2 * circle.r, height: 2 * circle.r});
- for(var j = 0; j < nfans; ++j){
- var fansx = j == 0 ? x1 : circle.cx + r * Math.cos(start + (j - FUDGE_FACTOR) * delta),
- fansy = j == 0 ? y1 : circle.cy + r * Math.sin(start + (j - FUDGE_FACTOR) * delta),
- fanex = j == nfans - 1 ? x2 : circle.cx + r * Math.cos(start + (j + 1 + FUDGE_FACTOR) * delta),
- faney = j == nfans - 1 ? y2 : circle.cy + r * Math.sin(start + (j + 1 + FUDGE_FACTOR) * delta),
- fan = group.createPath({}).
- moveTo(circle.cx, circle.cy).
- lineTo(fansx, fansy).
- arcTo(r, r, 0, delta > Math.PI, true, fanex, faney).
- lineTo(circle.cx, circle.cy).
- closePath().
- setFill(this._pseudoRadialFill(specialFill, {x: circle.cx, y: circle.cy}, r, start + (j + 0.5) * delta, start + (j + 0.5) * delta));
- }
- group.createPath({}).
- moveTo(circle.cx, circle.cy).
- lineTo(x1, y1).
- arcTo(r, r, 0, step > Math.PI, true, x2, y2).
- lineTo(circle.cx, circle.cy).
- closePath().
- setStroke(theme.series.stroke);
- shape = group;
- }else{
- shape = s.createPath({}).
- moveTo(circle.cx, circle.cy).
- lineTo(x1, y1).
- arcTo(r, r, 0, step > Math.PI, true, x2, y2).
- lineTo(circle.cx, circle.cy).
- closePath().
- setStroke(theme.series.stroke);
- var specialFill = theme.series.fill;
- if(specialFill && specialFill.type === "radial"){
- specialFill = this._shapeFill(specialFill, {x: circle.cx - circle.r, y: circle.cy - circle.r, width: 2 * circle.r, height: 2 * circle.r});
- if(this.opt.radGrad === "linear"){
- specialFill = this._pseudoRadialFill(specialFill, {x: circle.cx, y: circle.cy}, r, start, end);
- }
- }else if(specialFill && specialFill.type === "linear"){
- specialFill = this._plotFill(specialFill, dim, offsets);
- specialFill = this._shapeFill(specialFill, shape.getBoundingBox());
- }
- shape.setFill(specialFill);
- }
- this.dyn.push({fill: specialFill, stroke: theme.series.stroke});
- if(events){
- var o = {
- element: "slice",
- index: i,
- run: this.run,
- shape: shape,
- x: i,
- y: typeof v == "number" ? v : v.y,
- cx: circle.cx,
- cy: circle.cy,
- cr: r
- };
- this._connectEvents(o);
- eventSeries[i] = o;
- }
- start = end;
- return false;
- }, this);
-
- if(this.opt.labels){
- if(this.opt.labelStyle == "default"){
- start = startAngle;
- dojo.some(slices, function(slice, i){
- if(slice <= 0){
-
- return false;
- }
- var theme = themes[i];
- if(slice >= 1){
-
- var v = run[i], elem = da.createText[this.opt.htmlLabels && dojox.gfx.renderer != "vml" ? "html" : "gfx"](
- this.chart, s, circle.cx, circle.cy + size / 2, "middle", labels[i],
- theme.series.font, theme.series.fontColor);
- if(this.opt.htmlLabels){
- this.htmlElements.push(elem);
- }
- return true;
- }
-
- var end = start + slice * 2 * Math.PI, v = run[i];
- if(i + 1 == slices.length){
- end = startAngle + 2 * Math.PI;
- }
- var labelAngle = (start + end) / 2,
- x = circle.cx + labelR * Math.cos(labelAngle),
- y = circle.cy + labelR * Math.sin(labelAngle) + size / 2;
-
- var elem = da.createText[this.opt.htmlLabels && dojox.gfx.renderer != "vml" ? "html" : "gfx"]
- (this.chart, s, x, y, "middle", labels[i], theme.series.font, theme.series.fontColor);
- if(this.opt.htmlLabels){
- this.htmlElements.push(elem);
- }
- start = end;
- return false;
- }, this);
- }else if(this.opt.labelStyle == "columns"){
- start = startAngle;
-
- var labeledSlices = [];
- dojo.forEach(slices, function(slice, i){
- var end = start + slice * 2 * Math.PI;
- if(i + 1 == slices.length){
- end = startAngle + 2 * Math.PI;
- }
- var labelAngle = (start + end) / 2;
- labeledSlices.push({
- angle: labelAngle,
- left: Math.cos(labelAngle) < 0,
- theme: themes[i],
- index: i,
- omit: end - start < 0.001
- });
- start = end;
- });
-
- var labelHeight = dojox.gfx._base._getTextBox("a",{font:taFont}).h;
- this._getProperLabelRadius(labeledSlices, labelHeight, circle.r * 1.1);
-
- dojo.forEach(labeledSlices, function(slice, i){
- if (!slice.omit) {
- var leftColumn = circle.cx - circle.r * 2,
- rightColumn = circle.cx + circle.r * 2,
- labelWidth = dojox.gfx._base._getTextBox(labels[i], {font: taFont}).w,
- x = circle.cx + slice.labelR * Math.cos(slice.angle),
- y = circle.cy + slice.labelR * Math.sin(slice.angle),
- jointX = (slice.left) ? (leftColumn + labelWidth) : (rightColumn - labelWidth),
- labelX = (slice.left) ? leftColumn : jointX;
- var wiring = s.createPath().moveTo(circle.cx + circle.r * Math.cos(slice.angle), circle.cy + circle.r * Math.sin(slice.angle))
- if (Math.abs(slice.labelR * Math.cos(slice.angle)) < circle.r * 2 - labelWidth) {
- wiring.lineTo(x, y);
- }
- wiring.lineTo(jointX, y).setStroke(slice.theme.series.labelWiring);
- var elem = da.createText[this.opt.htmlLabels && dojox.gfx.renderer != "vml" ? "html" : "gfx"](
- this.chart, s, labelX, y, "left", labels[i], slice.theme.series.font, slice.theme.series.fontColor);
- if (this.opt.htmlLabels) {
- this.htmlElements.push(elem);
- }
- }
- },this);
- }
- }
-
- var esi = 0;
- this._eventSeries[this.run.name] = df.map(run, function(v){
- return v <= 0 ? null : eventSeries[esi++];
- });
- return this;
- },
-
- _getProperLabelRadius: function(slices, labelHeight, minRidius){
- var leftCenterSlice = {},rightCenterSlice = {},leftMinSIN = 1, rightMinSIN = 1;
- if (slices.length == 1) {
- slices[0].labelR = minRidius;
- return;
- }
- for(var i = 0;i<slices.length;i++){
- var tempSIN = Math.abs(Math.sin(slices[i].angle));
- if(slices[i].left){
- if(leftMinSIN > tempSIN){
- leftMinSIN = tempSIN;
- leftCenterSlice = slices[i];
- }
- }else{
- if(rightMinSIN > tempSIN){
- rightMinSIN = tempSIN;
- rightCenterSlice = slices[i];
- }
- }
- }
- leftCenterSlice.labelR = rightCenterSlice.labelR = minRidius;
- this._caculateLabelR(leftCenterSlice,slices,labelHeight);
- this._caculateLabelR(rightCenterSlice,slices,labelHeight);
- },
- _caculateLabelR: function(firstSlice,slices,labelHeight){
- var i = firstSlice.index,length = slices.length,
- currentLabelR = firstSlice.labelR;
- while(!(slices[i%length].left ^ slices[(i+1)%length].left)){
- if (!slices[(i + 1) % length].omit) {
- var nextLabelR = (Math.sin(slices[i % length].angle) * currentLabelR + ((slices[i % length].left) ? (-labelHeight) : labelHeight)) /
- Math.sin(slices[(i + 1) % length].angle);
- currentLabelR = (nextLabelR < firstSlice.labelR) ? firstSlice.labelR : nextLabelR;
- slices[(i + 1) % length].labelR = currentLabelR;
- }
- i++;
- }
- i = firstSlice.index,j = (i == 0)?length-1 : i - 1;
- while(!(slices[i].left ^ slices[j].left)){
- if (!slices[j].omit) {
- var nextLabelR = (Math.sin(slices[i].angle) * currentLabelR + ((slices[i].left) ? labelHeight : (-labelHeight))) /
- Math.sin(slices[j].angle);
- currentLabelR = (nextLabelR < firstSlice.labelR) ? firstSlice.labelR : nextLabelR;
- slices[j].labelR = currentLabelR;
- }
- i--;j--;
- i = (i < 0)?i+slices.length:i;
- j = (j < 0)?j+slices.length:j;
- }
- },
-
- _getLabel: function(number){
- return dc.getLabel(number, this.opt.fixed, this.opt.precision);
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.Bubble"]){
- dojo._hasResource["dojox.charting.plot2d.Bubble"] = true;
- dojo.provide("dojox.charting.plot2d.Bubble");
- (function(){
- var df = dojox.lang.functional, du = dojox.lang.utils,
- dc = dojox.charting.plot2d.common,
- purgeGroup = df.lambda("item.purgeGroup()");
- dojo.declare("dojox.charting.plot2d.Bubble", dojox.charting.plot2d.Base, {
-
-
-
- defaultParams: {
- hAxis: "x",
- vAxis: "y",
- animate: null
- },
- optionalParams: {
-
- stroke: {},
- outline: {},
- shadow: {},
- fill: {},
- font: "",
- fontColor: ""
- },
- constructor: function(chart, kwArgs){
-
-
-
-
-
-
- this.opt = dojo.clone(this.defaultParams);
- du.updateWithObject(this.opt, kwArgs);
- du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
- this.series = [];
- this.hAxis = this.opt.hAxis;
- this.vAxis = this.opt.vAxis;
- this.animate = this.opt.animate;
- },
-
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(this.zoom && !this.isDataDirty()){
- return this.performZoom(dim, offsets);
- }
- this.resetEvents();
- this.dirty = this.isDirty();
- if(this.dirty){
- dojo.forEach(this.series, purgeGroup);
- this._eventSeries = {};
- this.cleanGroup();
- var s = this.group;
- df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
- }
- var t = this.chart.theme,
- ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
- vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
- events = this.events();
- for(var i = this.series.length - 1; i >= 0; --i){
- var run = this.series[i];
- if(!this.dirty && !run.dirty){
- t.skip();
- this._reconnectEvents(run.name);
- continue;
- }
- run.cleanGroup();
- if(!run.data.length){
- run.dirty = false;
- t.skip();
- continue;
- }
- if(typeof run.data[0] == "number"){
- console.warn("dojox.charting.plot2d.Bubble: the data in the following series cannot be rendered as a bubble chart; ", run);
- continue;
- }
- var theme = t.next("circle", [this.opt, run]), s = run.group,
- points = dojo.map(run.data, function(v, i){
- return v ? {
- x: ht(v.x) + offsets.l,
- y: dim.height - offsets.b - vt(v.y),
- radius: this._vScaler.bounds.scale * (v.size / 2)
- } : null;
- }, this);
- var frontCircles = null, outlineCircles = null, shadowCircles = null;
-
- if(theme.series.shadow){
- shadowCircles = dojo.map(points, function(item){
- if(item !== null){
- var finalTheme = t.addMixin(theme, "circle", item, true),
- shadow = finalTheme.series.shadow;
- var shape = s.createCircle({
- cx: item.x + shadow.dx, cy: item.y + shadow.dy, r: item.radius
- }).setStroke(shadow).setFill(shadow.color);
- if(this.animate){
- this._animateBubble(shape, dim.height - offsets.b, item.radius);
- }
- return shape;
- }
- return null;
- }, this);
- if(shadowCircles.length){
- run.dyn.shadow = shadowCircles[shadowCircles.length - 1].getStroke();
- }
- }
-
- if(theme.series.outline){
- outlineCircles = dojo.map(points, function(item){
- if(item !== null){
- var finalTheme = t.addMixin(theme, "circle", item, true),
- outline = dc.makeStroke(finalTheme.series.outline);
- outline.width = 2 * outline.width + theme.series.stroke.width;
- var shape = s.createCircle({
- cx: item.x, cy: item.y, r: item.radius
- }).setStroke(outline);
- if(this.animate){
- this._animateBubble(shape, dim.height - offsets.b, item.radius);
- }
- return shape;
- }
- return null;
- }, this);
- if(outlineCircles.length){
- run.dyn.outline = outlineCircles[outlineCircles.length - 1].getStroke();
- }
- }
-
- frontCircles = dojo.map(points, function(item){
- if(item !== null){
- var finalTheme = t.addMixin(theme, "circle", item, true),
- rect = {
- x: item.x - item.radius,
- y: item.y - item.radius,
- width: 2 * item.radius,
- height: 2 * item.radius
- };
- var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
- specialFill = this._shapeFill(specialFill, rect);
- var shape = s.createCircle({
- cx: item.x, cy: item.y, r: item.radius
- }).setFill(specialFill).setStroke(finalTheme.series.stroke);
- if(this.animate){
- this._animateBubble(shape, dim.height - offsets.b, item.radius);
- }
- return shape;
- }
- return null;
- }, this);
- if(frontCircles.length){
- run.dyn.fill = frontCircles[frontCircles.length - 1].getFill();
- run.dyn.stroke = frontCircles[frontCircles.length - 1].getStroke();
- }
- if(events){
- var eventSeries = new Array(frontCircles.length);
- dojo.forEach(frontCircles, function(s, i){
- if(s !== null){
- var o = {
- element: "circle",
- index: i,
- run: run,
- shape: s,
- outline: outlineCircles && outlineCircles[i] || null,
- shadow: shadowCircles && shadowCircles[i] || null,
- x: run.data[i].x,
- y: run.data[i].y,
- r: run.data[i].size / 2,
- cx: points[i].x,
- cy: points[i].y,
- cr: points[i].radius
- };
- this._connectEvents(o);
- eventSeries[i] = o;
- }
- }, this);
- this._eventSeries[run.name] = eventSeries;
- }else{
- delete this._eventSeries[run.name];
- }
- run.dirty = false;
- }
- this.dirty = false;
- return this;
- },
- _animateBubble: function(shape, offset, size){
- dojox.gfx.fx.animateTransform(dojo.delegate({
- shape: shape,
- duration: 1200,
- transform: [
- {name: "translate", start: [0, offset], end: [0, 0]},
- {name: "scale", start: [0, 1/size], end: [1, 1]},
- {name: "original"}
- ]
- }, this.animate)).play();
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.Candlesticks"]){
- dojo._hasResource["dojox.charting.plot2d.Candlesticks"] = true;
- dojo.provide("dojox.charting.plot2d.Candlesticks");
- (function(){
- var df = dojox.lang.functional, du = dojox.lang.utils,
- dc = dojox.charting.plot2d.common,
- purgeGroup = df.lambda("item.purgeGroup()");
-
-
-
-
-
- dojo.declare("dojox.charting.plot2d.Candlesticks", dojox.charting.plot2d.Base, {
-
-
-
-
-
-
- defaultParams: {
- hAxis: "x",
- vAxis: "y",
- gap: 2,
- animate: null
- },
- optionalParams: {
- minBarSize: 1,
- maxBarSize: 1,
-
- stroke: {},
- outline: {},
- shadow: {},
- fill: {},
- font: "",
- fontColor: ""
- },
- constructor: function(chart, kwArgs){
-
-
-
-
-
-
- this.opt = dojo.clone(this.defaultParams);
- du.updateWithObject(this.opt, kwArgs);
- du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
- this.series = [];
- this.hAxis = this.opt.hAxis;
- this.vAxis = this.opt.vAxis;
- this.animate = this.opt.animate;
- },
- collectStats: function(series){
-
-
-
-
-
-
-
-
-
-
- var stats = dojo.delegate(dc.defaultStats);
- for(var i=0; i<series.length; i++){
- var run = series[i];
- if(!run.data.length){ continue; }
- var old_vmin = stats.vmin, old_vmax = stats.vmax;
- if(!("ymin" in run) || !("ymax" in run)){
- dojo.forEach(run.data, function(val, idx){
- if(val !== null){
- var x = val.x || idx + 1;
- stats.hmin = Math.min(stats.hmin, x);
- stats.hmax = Math.max(stats.hmax, x);
- stats.vmin = Math.min(stats.vmin, val.open, val.close, val.high, val.low);
- stats.vmax = Math.max(stats.vmax, val.open, val.close, val.high, val.low);
- }
- });
- }
- if("ymin" in run){ stats.vmin = Math.min(old_vmin, run.ymin); }
- if("ymax" in run){ stats.vmax = Math.max(old_vmax, run.ymax); }
- }
- return stats;
- },
- getSeriesStats: function(){
-
-
-
-
- var stats = this.collectStats(this.series);
- stats.hmin -= 0.5;
- stats.hmax += 0.5;
- return stats;
- },
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(this.zoom && !this.isDataDirty()){
- return this.performZoom(dim, offsets);
- }
- this.resetEvents();
- this.dirty = this.isDirty();
- if(this.dirty){
- dojo.forEach(this.series, purgeGroup);
- this._eventSeries = {};
- this.cleanGroup();
- var s = this.group;
- df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
- }
- var t = this.chart.theme, f, gap, width,
- ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
- vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
- baseline = Math.max(0, this._vScaler.bounds.lower),
- baselineHeight = vt(baseline),
- events = this.events();
- f = dc.calculateBarSize(this._hScaler.bounds.scale, this.opt);
- gap = f.gap;
- width = f.size;
- for(var i = this.series.length - 1; i >= 0; --i){
- var run = this.series[i];
- if(!this.dirty && !run.dirty){
- t.skip();
- this._reconnectEvents(run.name);
- continue;
- }
- run.cleanGroup();
- var theme = t.next("candlestick", [this.opt, run]), s = run.group,
- eventSeries = new Array(run.data.length);
- for(var j = 0; j < run.data.length; ++j){
- var v = run.data[j];
- if(v !== null){
- var finalTheme = t.addMixin(theme, "candlestick", v, true);
-
- var x = ht(v.x || (j+0.5)) + offsets.l + gap,
- y = dim.height - offsets.b,
- open = vt(v.open),
- close = vt(v.close),
- high = vt(v.high),
- low = vt(v.low);
- if("mid" in v){
- var mid = vt(v.mid);
- }
- if(low > high){
- var tmp = high;
- high = low;
- low = tmp;
- }
- if(width >= 1){
-
- var doFill = open > close;
- var line = { x1: width/2, x2: width/2, y1: y - high, y2: y - low },
- rect = {
- x: 0, y: y-Math.max(open, close),
- width: width, height: Math.max(doFill ? open-close : close-open, 1)
- };
- shape = s.createGroup();
- shape.setTransform({dx: x, dy: 0 });
- var inner = shape.createGroup();
- inner.createLine(line).setStroke(finalTheme.series.stroke);
- inner.createRect(rect).setStroke(finalTheme.series.stroke).
- setFill(doFill ? finalTheme.series.fill : "white");
- if("mid" in v){
-
- inner.createLine({
- x1: (finalTheme.series.stroke.width||1), x2: width - (finalTheme.series.stroke.width || 1),
- y1: y - mid, y2: y - mid
- }).setStroke(doFill ? "white" : finalTheme.series.stroke);
- }
-
- run.dyn.fill = finalTheme.series.fill;
- run.dyn.stroke = finalTheme.series.stroke;
- if(events){
- var o = {
- element: "candlestick",
- index: j,
- run: run,
- shape: inner,
- x: x,
- y: y-Math.max(open, close),
- cx: width/2,
- cy: (y-Math.max(open, close)) + (Math.max(doFill ? open-close : close-open, 1)/2),
- width: width,
- height: Math.max(doFill ? open-close : close-open, 1),
- data: v
- };
- this._connectEvents(o);
- eventSeries[j] = o;
- }
- }
- if(this.animate){
- this._animateCandlesticks(shape, y - low, high - low);
- }
- }
- }
- this._eventSeries[run.name] = eventSeries;
- run.dirty = false;
- }
- this.dirty = false;
- return this;
- },
- _animateCandlesticks: function(shape, voffset, vsize){
- dojox.gfx.fx.animateTransform(dojo.delegate({
- shape: shape,
- duration: 1200,
- transform: [
- {name: "translate", start: [0, voffset - (voffset/vsize)], end: [0, 0]},
- {name: "scale", start: [1, 1/vsize], end: [1, 1]},
- {name: "original"}
- ]
- }, this.animate)).play();
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.OHLC"]){
- dojo._hasResource["dojox.charting.plot2d.OHLC"] = true;
- dojo.provide("dojox.charting.plot2d.OHLC");
- (function(){
- var df = dojox.lang.functional, du = dojox.lang.utils,
- dc = dojox.charting.plot2d.common,
- purgeGroup = df.lambda("item.purgeGroup()");
-
-
-
-
-
- dojo.declare("dojox.charting.plot2d.OHLC", dojox.charting.plot2d.Base, {
-
-
-
-
-
-
- defaultParams: {
- hAxis: "x",
- vAxis: "y",
- gap: 2,
- animate: null
- },
- optionalParams: {
- minBarSize: 1,
- maxBarSize: 1,
-
- stroke: {},
- outline: {},
- shadow: {},
- fill: {},
- font: "",
- fontColor: ""
- },
- constructor: function(chart, kwArgs){
-
-
-
-
-
-
- this.opt = dojo.clone(this.defaultParams);
- du.updateWithObject(this.opt, kwArgs);
- du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
- this.series = [];
- this.hAxis = this.opt.hAxis;
- this.vAxis = this.opt.vAxis;
- this.animate = this.opt.animate;
- },
- collectStats: function(series){
-
-
-
-
-
-
-
-
-
-
- var stats = dojo.delegate(dc.defaultStats);
- for(var i=0; i<series.length; i++){
- var run = series[i];
- if(!run.data.length){ continue; }
- var old_vmin = stats.vmin, old_vmax = stats.vmax;
- if(!("ymin" in run) || !("ymax" in run)){
- dojo.forEach(run.data, function(val, idx){
- if(val !== null){
- var x = val.x || idx + 1;
- stats.hmin = Math.min(stats.hmin, x);
- stats.hmax = Math.max(stats.hmax, x);
- stats.vmin = Math.min(stats.vmin, val.open, val.close, val.high, val.low);
- stats.vmax = Math.max(stats.vmax, val.open, val.close, val.high, val.low);
- }
- });
- }
- if("ymin" in run){ stats.vmin = Math.min(old_vmin, run.ymin); }
- if("ymax" in run){ stats.vmax = Math.max(old_vmax, run.ymax); }
- }
- return stats;
- },
- getSeriesStats: function(){
-
-
-
-
- var stats = this.collectStats(this.series);
- stats.hmin -= 0.5;
- stats.hmax += 0.5;
- return stats;
- },
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(this.zoom && !this.isDataDirty()){
- return this.performZoom(dim, offsets);
- }
- this.resetEvents();
- this.dirty = this.isDirty();
- if(this.dirty){
- dojo.forEach(this.series, purgeGroup);
- this._eventSeries = {};
- this.cleanGroup();
- var s = this.group;
- df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
- }
- var t = this.chart.theme, f, gap, width,
- ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
- vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
- baseline = Math.max(0, this._vScaler.bounds.lower),
- baselineHeight = vt(baseline),
- events = this.events();
- f = dc.calculateBarSize(this._hScaler.bounds.scale, this.opt);
- gap = f.gap;
- width = f.size;
- for(var i = this.series.length - 1; i >= 0; --i){
- var run = this.series[i];
- if(!this.dirty && !run.dirty){
- t.skip();
- this._reconnectEvents(run.name);
- continue;
- }
- run.cleanGroup();
- var theme = t.next("candlestick", [this.opt, run]), s = run.group,
- eventSeries = new Array(run.data.length);
- for(var j = 0; j < run.data.length; ++j){
- var v = run.data[j];
- if(v !== null){
- var finalTheme = t.addMixin(theme, "candlestick", v, true);
-
- var x = ht(v.x || (j+0.5)) + offsets.l + gap,
- y = dim.height - offsets.b,
- open = vt(v.open),
- close = vt(v.close),
- high = vt(v.high),
- low = vt(v.low);
- if(low > high){
- var tmp = high;
- high = low;
- low = tmp;
- }
- if(width >= 1){
- var hl = {x1: width/2, x2: width/2, y1: y - high, y2: y - low},
- op = {x1: 0, x2: ((width/2) + ((finalTheme.series.stroke.width||1)/2)), y1: y-open, y2: y-open},
- cl = {x1: ((width/2) - ((finalTheme.series.stroke.width||1)/2)), x2: width, y1: y-close, y2: y-close};
- shape = s.createGroup();
- shape.setTransform({dx: x, dy: 0});
- var inner = shape.createGroup();
- inner.createLine(hl).setStroke(finalTheme.series.stroke);
- inner.createLine(op).setStroke(finalTheme.series.stroke);
- inner.createLine(cl).setStroke(finalTheme.series.stroke);
-
- run.dyn.stroke = finalTheme.series.stroke;
- if(events){
- var o = {
- element: "candlestick",
- index: j,
- run: run,
- shape: inner,
- x: x,
- y: y-Math.max(open, close),
- cx: width/2,
- cy: (y-Math.max(open, close)) + (Math.max(open > close ? open-close : close-open, 1)/2),
- width: width,
- height: Math.max(open > close ? open-close : close-open, 1),
- data: v
- };
- this._connectEvents(o);
- eventSeries[j] = o;
- }
- }
- if(this.animate){
- this._animateOHLC(shape, y - low, high - low);
- }
- }
- }
- this._eventSeries[run.name] = eventSeries;
- run.dirty = false;
- }
- this.dirty = false;
- return this;
- },
- _animateOHLC: function(shape, voffset, vsize){
- dojox.gfx.fx.animateTransform(dojo.delegate({
- shape: shape,
- duration: 1200,
- transform: [
- {name: "translate", start: [0, voffset - (voffset/vsize)], end: [0, 0]},
- {name: "scale", start: [1, 1/vsize], end: [1, 1]},
- {name: "original"}
- ]
- }, this.animate)).play();
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.charting.plot2d.Spider"]){
- dojo._hasResource["dojox.charting.plot2d.Spider"] = true;
- dojo.provide("dojox.charting.plot2d.Spider");
- dojo.experimental("dojox.charting.plot2d.Spider");
- (function(){
- var df = dojox.lang.functional, du = dojox.lang.utils,
- dc = dojox.charting.plot2d.common,
- da = dojox.charting.axis2d.common,
- g = dojox.gfx, m = g.matrix,
- FUDGE_FACTOR = 0.2;
- dojo.declare("dojox.charting.plot2d.Spider", [dojox.charting.Element, dojox.charting.plot2d._PlotEvents], {
-
-
- defaultParams: {
- labels: true,
- ticks: false,
- fixed: true,
- precision: 1,
- labelOffset: -10,
- labelStyle: "default",
- htmlLabels: true,
- startAngle: -90,
- divisions: 3,
- axisColor: "",
- axisWidth: 0,
- spiderColor: "",
- spiderWidth: 0,
- seriesWidth: 0,
- seriesFillAlpha: 0.2,
- spiderOrigin: 0.16,
- markerSize: 3,
- spiderType: "polygon",
- animationType: dojo.fx.easing.backOut,
- axisTickFont: "",
- axisTickFontColor: "",
- axisFont: "",
- axisFontColor: ""
- },
- optionalParams: {
- radius: 0,
- font: "",
- fontColor: ""
- },
- constructor: function(chart, kwArgs){
-
-
- this.opt = dojo.clone(this.defaultParams);
- du.updateWithObject(this.opt, kwArgs);
- du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
- this.series = [];
- this.dyn = [];
- this.datas = {};
- this.labelKey = [];
- this.oldSeriePoints = {};
- this.animations = {};
- },
- clear: function(){
-
-
-
-
- this.dirty = true;
- this.dyn = [];
- this.series = [];
- this.datas = {};
- this.labelKey = [];
- this.oldSeriePoints = {};
- this.animations = {};
- return this;
- },
- setAxis: function(axis){
-
-
-
-
- return this;
- },
- addSeries: function(run){
-
-
-
-
-
-
- var matched = false;
- this.series.push(run);
- for(var key in run.data){
- var val = run.data[key],
- data = this.datas[key];
- if(data){
- data.vlist.push(val);
- data.min = Math.min(data.min, val);
- data.max = Math.max(data.max, val);
- }else{
- this.datas[key] = {min: val, max: val, vlist: [val]};
- }
- }
- if (this.labelKey.length <= 0) {
- for (var key in run.data) {
- this.labelKey.push(key);
- }
- }
- return this;
- },
- getSeriesStats: function(){
-
-
-
-
- return dojox.charting.plot2d.common.collectSimpleStats(this.series);
- },
- calculateAxes: function(dim){
-
-
-
-
-
-
- this.initializeScalers(dim, this.getSeriesStats());
- return this;
- },
- getRequiredColors: function(){
-
-
-
-
- return this.series.length;
- },
- initializeScalers: function(dim, stats){
-
-
-
-
-
-
-
-
- if(this._hAxis){
- if(!this._hAxis.initialized()){
- this._hAxis.calculate(stats.hmin, stats.hmax, dim.width);
- }
- this._hScaler = this._hAxis.getScaler();
- }else{
- this._hScaler = dojox.charting.scaler.primitive.buildScaler(stats.hmin, stats.hmax, dim.width);
- }
- if(this._vAxis){
- if(!this._vAxis.initialized()){
- this._vAxis.calculate(stats.vmin, stats.vmax, dim.height);
- }
- this._vScaler = this._vAxis.getScaler();
- }else{
- this._vScaler = dojox.charting.scaler.primitive.buildScaler(stats.vmin, stats.vmax, dim.height);
- }
- return this;
- },
- render: function(dim, offsets){
-
-
-
-
-
-
-
-
- if(!this.dirty){ return this; }
- this.dirty = false;
- this.cleanGroup();
- var s = this.group, t = this.chart.theme;
- this.resetEvents();
- if(!this.series || !this.series.length){
- return this;
- }
-
- var o = this.opt, ta = t.axis,
- rx = (dim.width - offsets.l - offsets.r) / 2,
- ry = (dim.height - offsets.t - offsets.b) / 2,
- r = Math.min(rx, ry),
- axisTickFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font) || "normal normal normal 7pt Tahoma",
- axisFont = o.axisFont || (ta.tick && ta.tick.titleFont) || "normal normal normal 11pt Tahoma",
- axisTickFontColor = o.axisTickFontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "silver",
- axisFontColor = o.axisFontColor || (ta.tick && ta.tick.titleFontColor) || "black",
- axisColor = o.axisColor || (ta.tick && ta.tick.axisColor) || "silver",
- spiderColor = o.spiderColor || (ta.tick && ta.tick.spiderColor) || "silver",
- axisWidth = o.axisWidth || (ta.stroke && ta.stroke.width) || 2,
- spiderWidth = o.spiderWidth || (ta.stroke && ta.stroke.width) || 2,
- seriesWidth = o.seriesWidth || (ta.stroke && ta.stroke.width) || 2,
- asize = g.normalizedLength(g.splitFontString(axisFont).size),
- startAngle = m._degToRad(o.startAngle),
- start = startAngle, step, filteredRun, slices, labels, shift, labelR,
- outerPoints, innerPoints, divisionPoints, divisionRadius, labelPoints,
- ro = o.spiderOrigin, dv = o.divisions >= 3 ? o.divisions : 3, ms = o.markerSize,
- spt = o.spiderType, at = o.animationType, lboffset = o.labelOffset < -10 ? o.labelOffset : -10,
- axisExtra = 0.2;
-
- if(o.labels){
- labels = dojo.map(this.series, function(s){
- return s.name;
- }, this);
- shift = df.foldl1(df.map(labels, function(label, i){
- var font = t.series.font;
- return dojox.gfx._base._getTextBox(label, {
- font: font
- }).w;
- }, this), "Math.max(a, b)") / 2;
- r = Math.min(rx - 2 * shift, ry - asize) + lboffset;
- labelR = r - lboffset;
- }
- if ("radius" in o) {
- r = o.radius;
- labelR = r - lboffset;
- }
- r /= (1+axisExtra);
- var circle = {
- cx: offsets.l + rx,
- cy: offsets.t + ry,
- r: r
- };
-
- for (var i = this.series.length - 1; i >= 0; i--) {
- var serieEntry = this.series[i];
- if (!this.dirty && !serieEntry.dirty) {
- t.skip();
- continue;
- }
- serieEntry.cleanGroup();
- var run = serieEntry.data;
- if (run !== null) {
- var len = this._getObjectLength(run);
-
- if (!outerPoints || outerPoints.length <= 0) {
- outerPoints = [], innerPoints = [], labelPoints = [];
- this._buildPoints(outerPoints, len, circle, r, start, true);
- this._buildPoints(innerPoints, len, circle, r*ro, start, true);
- this._buildPoints(labelPoints, len, circle, labelR, start);
- if(dv > 2){
- divisionPoints = [], divisionRadius = [];
- for (var j = 0; j < dv - 2; j++) {
- divisionPoints[j] = [];
- this._buildPoints(divisionPoints[j], len, circle, r*(ro + (1-ro)*(j+1)/(dv-1)), start, true);
- divisionRadius[j] = r*(ro + (1-ro)*(j+1)/(dv-1));
- }
- }
- }
- }
- }
-
-
-
- var axisGroup = s.createGroup(), axisStroke = {color: axisColor, width: axisWidth},
- spiderStroke = {color: spiderColor, width: spiderWidth};
- for (var j = outerPoints.length - 1; j >= 0; --j) {
- var point = outerPoints[j],
- st = {
- x: point.x + (point.x - circle.cx) * axisExtra,
- y: point.y + (point.y - circle.cy) * axisExtra
- },
- nd = {
- x: point.x + (point.x - circle.cx) * axisExtra / 2,
- y: point.y + (point.y - circle.cy) * axisExtra / 2
- };
- axisGroup.createLine({
- x1: circle.cx,
- y1: circle.cy,
- x2: st.x,
- y2: st.y
- }).setStroke(axisStroke);
-
- this._drawArrow(axisGroup, st, nd, axisStroke);
- }
-
-
- var labelGroup = s.createGroup();
- for (var j = labelPoints.length - 1; j >= 0; --j) {
- var point = labelPoints[j],
- fontWidth = dojox.gfx._base._getTextBox(this.labelKey[j], {font: axisFont}).w || 0,
- render = this.opt.htmlLabels && dojox.gfx.renderer != "vml" ? "html" : "gfx";
- elem = da.createText[render](this.chart, labelGroup, (!dojo._isBodyLtr() && render == "html") ? (point.x + fontWidth - dim.width) : point.x, point.y,
- "middle", this.labelKey[j], axisFont, axisFontColor);
- if (this.opt.htmlLabels) {
- this.htmlElements.push(elem);
- }
- }
-
-
- var spiderGroup = s.createGroup();
- if(spt == "polygon"){
- spiderGroup.createPolyline(outerPoints).setStroke(spiderStroke);
- spiderGroup.createPolyline(innerPoints).setStroke(spiderStroke);
- if (divisionPoints.length > 0) {
- for (var j = divisionPoints.length - 1; j >= 0; --j) {
- spiderGroup.createPolyline(divisionPoints[j]).setStroke(spiderStroke);
- }
- }
- }else{
- var ccount = this._getObjectLength(this.datas);
- spiderGroup.createCircle({cx: circle.cx, cy: circle.cy, r: r}).setStroke(spiderStroke);
- spiderGroup.createCircle({cx: circle.cx, cy: circle.cy, r: r*ro}).setStroke(spiderStroke);
- if (divisionRadius.length > 0) {
- for (var j = divisionRadius.length - 1; j >= 0; --j) {
- spiderGroup.createCircle({cx: circle.cx, cy: circle.cy, r: divisionRadius[j]}).setStroke(spiderStroke);
- }
- }
- }
-
- var textGroup = s.createGroup(), len = this._getObjectLength(this.datas), k = 0;
- for(var key in this.datas){
- var data = this.datas[key], min = data.min, max = data.max, distance = max - min,
- end = start + 2 * Math.PI * k / len;
- for (var i = 0; i < dv; i++) {
- var text = min + distance*i/(dv-1), point = this._getCoordinate(circle, r*(ro + (1-ro)*i/(dv-1)), end);
- text = this._getLabel(text);
- var fontWidth = dojox.gfx._base._getTextBox(text, {font: axisTickFont}).w || 0,
- render = this.opt.htmlLabels && dojox.gfx.renderer != "vml" ? "html" : "gfx";
- if (this.opt.htmlLabels) {
- this.htmlElements.push(da.createText[render]
- (this.chart, textGroup, (!dojo._isBodyLtr() && render == "html") ? (point.x + fontWidth - dim.width) : point.x, point.y,
- "start", text, axisTickFont, axisTickFontColor));
- }
- }
- k++;
- }
-
-
- this.chart.seriesShapes = {};
- var animationConnections = [];
- for (var i = this.series.length - 1; i >= 0; i--) {
- var serieEntry = this.series[i], run = serieEntry.data;
- if (run !== null) {
-
- var seriePoints = [], k = 0, tipData = [];
- for(var key in run){
- var data = this.datas[key], min = data.min, max = data.max, distance = max - min,
- entry = run[key], end = start + 2 * Math.PI * k / len,
- point = this._getCoordinate(circle, r*(ro + (1-ro)*(entry-min)/distance), end);
- seriePoints.push(point);
- tipData.push({sname: serieEntry.name, key: key, data: entry});
- k++;
- }
- seriePoints[seriePoints.length] = seriePoints[0];
- tipData[tipData.length] = tipData[0];
- var polygonBoundRect = this._getBoundary(seriePoints),
- theme = t.next("spider", [o, serieEntry]), ts = serieEntry.group,
- f = g.normalizeColor(theme.series.fill), sk = {color: theme.series.fill, width: seriesWidth};
- f.a = o.seriesFillAlpha;
- serieEntry.dyn = {fill: f, stroke: sk};
-
- var osps = this.oldSeriePoints[serieEntry.name];
- var cs = this._createSeriesEntry(ts, (osps || innerPoints), seriePoints, f, sk, r, ro, ms, at);
- this.chart.seriesShapes[serieEntry.name] = cs;
- this.oldSeriePoints[serieEntry.name] = seriePoints;
-
- var po = {
- element: "spider_poly",
- index: i,
- id: "spider_poly_"+serieEntry.name,
- run: serieEntry,
- plot: this,
- shape: cs.poly,
- parent: ts,
- brect: polygonBoundRect,
- cx: circle.cx,
- cy: circle.cy,
- cr: r,
- f: f,
- s: s
- };
- this._connectEvents(po);
-
- var so = {
- element: "spider_plot",
- index: i,
- id: "spider_plot_"+serieEntry.name,
- run: serieEntry,
- plot: this,
- shape: serieEntry.group
- };
- this._connectEvents(so);
-
- dojo.forEach(cs.circles, function(c, i){
- var shape = c.getShape(),
- co = {
- element: "spider_circle",
- index: i,
- id: "spider_circle_"+serieEntry.name+i,
- run: serieEntry,
- plot: this,
- shape: c,
- parent: ts,
- tdata: tipData[i],
- cx: seriePoints[i].x,
- cy: seriePoints[i].y,
- f: f,
- s: s
- };
- this._connectEvents(co);
- }, this);
- }
- }
- return this;
- },
- _createSeriesEntry: function(ts, osps, sps, f, sk, r, ro, ms, at){
-
- var spoly = ts.createPolyline(osps).setFill(f).setStroke(sk), scircle = [];
- for (var j = 0; j < osps.length; j++) {
- var point = osps[j], cr = ms;
- var circle = ts.createCircle({cx: point.x, cy: point.y, r: cr}).setFill(f).setStroke(sk);
- scircle.push(circle);
- }
-
- var anims = dojo.map(sps, function(np, j){
-
- var sp = osps[j],
- anim = new dojo._Animation({
- duration: 1000,
- easing: at,
- curve: [sp.y, np.y]
- });
- var spl = spoly, sc = scircle[j];
- dojo.connect(anim, "onAnimate", function(y){
-
- var pshape = spl.getShape();
- pshape.points[j].y = y;
- spl.setShape(pshape);
-
- var cshape = sc.getShape();
- cshape.cy = y;
- sc.setShape(cshape);
- });
- return anim;
- });
-
- var anims1 = dojo.map(sps, function(np, j){
-
- var sp = osps[j],
- anim = new dojo._Animation({
- duration: 1000,
- easing: at,
- curve: [sp.x, np.x]
- });
- var spl = spoly, sc = scircle[j];
- dojo.connect(anim, "onAnimate", function(x){
-
- var pshape = spl.getShape();
- pshape.points[j].x = x;
- spl.setShape(pshape);
-
- var cshape = sc.getShape();
- cshape.cx = x;
- sc.setShape(cshape);
- });
- return anim;
- });
- var masterAnimation = dojo.fx.combine(anims.concat(anims1));
- masterAnimation.play();
- return {group :ts, poly: spoly, circles: scircle};
- },
- plotEvent: function(o){
-
-
-
-
- var runName = o.id ? o.id : "default", a;
- if (runName in this.animations) {
- a = this.animations[runName];
- a.anim && a.anim.stop(true);
- } else {
- a = this.animations[runName] = {};
- }
- if(o.element == "spider_poly"){
- if(!a.color){
- var color = o.shape.getFill();
- if(!color || !(color instanceof dojo.Color)){
- return;
- }
- a.color = {
- start: color,
- end: transColor(color)
- };
- }
- var start = a.color.start, end = a.color.end;
- if(o.type == "onmouseout"){
-
- var t = start; start = end; end = t;
- }
- a.anim = dojox.gfx.fx.animateFill({
- shape: o.shape,
- duration: 800,
- easing: dojo.fx.easing.backOut,
- color: {start: start, end: end}
- });
- a.anim.play();
- }else if(o.element == "spider_circle"){
- var init, scale, defaultScale = 1.5;
- if(o.type == "onmouseover"){
- init = dojox.gfx.matrix.identity;
- scale = defaultScale;
-
- var aroundRect = {type: "rect"};
- aroundRect.x = o.cx;
- aroundRect.y = o.cy;
- aroundRect.width = aroundRect.height = 1;
- var lt = dojo.coords(this.chart.node, true);
- aroundRect.x += lt.x;
- aroundRect.y += lt.y;
- aroundRect.x = Math.round(aroundRect.x);
- aroundRect.y = Math.round(aroundRect.y);
- aroundRect.width = Math.ceil(aroundRect.width);
- aroundRect.height = Math.ceil(aroundRect.height);
- this.aroundRect = aroundRect;
- var position = ["after", "before"];
- if(dijit && dijit.Tooltip){
- dijit.showTooltip(o.tdata.sname + "<br/>" + o.tdata.key + "<br/>" + o.tdata.data, this.aroundRect, position);
- }
- }else{
- init = dojox.gfx.matrix.scaleAt(defaultScale, o.cx, o.cy);
- scale = 1/defaultScale;
- if(dijit && dijit.Tooltip){
- this.aroundRect && dijit.hideTooltip(this.aroundRect);
- }
- }
- var cs = o.shape.getShape(),
- init = m.scaleAt(defaultScale, cs.cx, cs.cy),
- kwArgs = {
- shape: o.shape,
- duration: 200,
- easing: dojo.fx.easing.backOut,
- transform: [
- {name: "scaleAt", start: [1, cs.cx, cs.cy], end: [scale, cs.cx, cs.cy]},
- init
- ]
- };
- a.anim = dojox.gfx.fx.animateTransform(kwArgs);
- a.anim.play();
- }else if(o.element == "spider_plot"){
-
- if (o.type == "onmouseover" && !dojo.isIE) {
- o.shape.moveToFront();
- }
- }
- },
- _getBoundary: function(points){
- var xmax = points[0].x,
- xmin = points[0].x,
- ymax = points[0].y,
- ymin = points[0].y;
- for(var i = 0; i < points.length; i++){
- var point = points[i];
- xmax = Math.max(point.x, xmax);
- ymax = Math.max(point.y, ymax);
- xmin = Math.min(point.x, xmin);
- ymin = Math.min(point.y, ymin);
- }
- return {
- x: xmin,
- y: ymin,
- width: xmax - xmin,
- height: ymax - ymin
- };
- },
-
- _drawArrow: function(s, start, end, stroke){
- var len = Math.sqrt(Math.pow(end.x - start.x, 2) + Math.pow(end.y - start.y, 2)),
- sin = (end.y - start.y)/len, cos = (end.x - start.x)/len,
- point2 = {x: end.x + (len/3)*(-sin), y: end.y + (len/3)*cos},
- point3 = {x: end.x + (len/3)*sin, y: end.y + (len/3)*(-cos)};
- s.createPolyline([start, point2, point3]).setFill(stroke.color).setStroke(stroke);
- },
-
- _buildPoints: function(points, count, circle, radius, angle, recursive){
- for (var i = 0; i < count; i++) {
- var end = angle + 2 * Math.PI * i / count;
- points.push(this._getCoordinate(circle, radius, end));
- }
- if(recursive){
- points.push(this._getCoordinate(circle, radius, angle + 2 * Math.PI));
- }
- },
-
- _getCoordinate: function(circle, radius, angle){
- return {
- x: circle.cx + radius * Math.cos(angle),
- y: circle.cy + radius * Math.sin(angle)
- }
- },
-
- _getObjectLength: function(obj){
- var count = 0;
- if(dojo.isObject(obj)){
- for(var key in obj){
- count++;
- }
- }
- return count;
- },
-
- _getLabel: function(number){
- return dc.getLabel(number, this.opt.fixed, this.opt.precision);
- }
- });
-
- function transColor(color){
- var a = new dojox.color.Color(color),
- x = a.toHsl();
- if(x.s == 0){
- x.l = x.l < 50 ? 100 : 0;
- }else{
- x.s = 100;
- if(x.l < 50){
- x.l = 75;
- }else if(x.l > 75){
- x.l = 50;
- }else{
- x.l = x.l - 50 > 75 - x.l ?
- 50 : 75;
- }
- }
- var color = dojox.color.fromHsl(x);
- color.a = 0.7;
- return color;
- }
-
- })();
- }
- if(!dojo._hasResource["dojox.charting.Chart2D"]){
- dojo._hasResource["dojox.charting.Chart2D"] = true;
- dojo.provide("dojox.charting.Chart2D");
- dojo.deprecated("dojox.charting.Chart2D", "Use dojo.charting.Chart instead and require all other components explicitly", "2.0");
- dojox.charting.Chart2D = dojox.charting.Chart;
- }
- if(!dojo._hasResource["dojox.charting.widget.Chart2D"]){
- dojo._hasResource["dojox.charting.widget.Chart2D"] = true;
- dojo.provide("dojox.charting.widget.Chart2D");
- dojo.deprecated("dojox.charting.widget.Chart2D", "Use dojo.charting.widget.Chart instead and require all other components explicitly", "2.0");
- dojox.charting.widget.Chart2D = dojox.charting.widget.Chart;
- }
- if(!dojo._hasResource["dojox.charting.themes.GreySkies"]){
- dojo._hasResource["dojox.charting.themes.GreySkies"] = true;
- dojo.provide("dojox.charting.themes.GreySkies");
- (function(){
- var dxc=dojox.charting;
- dxc.themes.GreySkies=new dxc.Theme(dxc.Theme._def);
- })();
- }
- if(!dojo._hasResource["dojox.charting.widget.Sparkline"]){
- dojo._hasResource["dojox.charting.widget.Sparkline"] = true;
- dojo.provide("dojox.charting.widget.Sparkline");
- (function(){
- var d = dojo;
- dojo.declare("dojox.charting.widget.Sparkline",
- dojox.charting.widget.Chart2D,
- {
- theme: dojox.charting.themes.GreySkies,
- margins: { l: 0, r: 0, t: 0, b: 0 },
- type: "Lines",
- valueFn: "Number(x)",
- store: "",
- field: "",
- query: "",
- queryOptions: "",
- start: "0",
- count: "Infinity",
- sort: "",
- data: "",
- name: "default",
- buildRendering: function(){
- var n = this.srcNodeRef;
- if( !n.childNodes.length ||
- !d.query("> .axis, > .plot, > .action, > .series", n).length){
- var plot = document.createElement("div");
- d.attr(plot, {
- "class": "plot",
- "name": "default",
- "type": this.type
- });
- n.appendChild(plot);
- var series = document.createElement("div");
- d.attr(series, {
- "class": "series",
- plot: "default",
- name: this.name,
- start: this.start,
- count: this.count,
- valueFn: this.valueFn
- });
- d.forEach(
- ["store", "field", "query", "queryOptions", "sort", "data"],
- function(i){
- if(this[i].length){
- d.attr(series, i, this[i]);
- }
- },
- this
- );
- n.appendChild(series);
- }
- this.inherited(arguments);
- }
- }
- );
- })();
- }
- if(!dojo._hasResource["dojox.charting.widget.Legend"]){
- dojo._hasResource["dojox.charting.widget.Legend"] = true;
- dojo.provide("dojox.charting.widget.Legend");
- var REVERSED_SERIES = /\.(StackedColumns|StackedAreas|ClusteredBars)$/;
- dojo.declare("dojox.charting.widget.Legend", [dijit._Widget, dijit._Templated], {
-
-
-
-
-
-
-
-
-
-
-
-
-
- chartRef: "",
- horizontal: true,
- swatchSize: 18,
-
- templateString: "<table dojoAttachPoint='legendNode' class='dojoxLegendNode' role='group' aria-label='chart legend'><tbody dojoAttachPoint='legendBody'></tbody></table>",
-
- legendNode: null,
- legendBody: null,
-
- postCreate: function(){
- if(!this.chart){
- if(!this.chartRef){ return; }
- this.chart = dijit.byId(this.chartRef);
- if(!this.chart){
- var node = dojo.byId(this.chartRef);
- if(node){
- this.chart = dijit.byNode(node);
- }else{
- console.log("Could not find chart instance with id: " + this.chartRef);
- return;
- }
- }
- this.series = this.chart.chart.series;
- }else{
- this.series = this.chart.series;
- }
-
- this.refresh();
- },
- refresh: function(){
-
-
- var df = dojox.lang.functional;
-
- if(this._surfaces){
- dojo.forEach(this._surfaces, function(surface){
- surface.destroy();
- });
- }
- this._surfaces = [];
- while(this.legendBody.lastChild){
- dojo.destroy(this.legendBody.lastChild);
- }
- if(this.horizontal){
- dojo.addClass(this.legendNode, "dojoxLegendHorizontal");
-
- this._tr = dojo.create("tr", null, this.legendBody);
- this._inrow = 0;
- }
-
- var s = this.series;
- if(s.length == 0){
- return;
- }
- if(s[0].chart.stack[0].declaredClass == "dojox.charting.plot2d.Pie"){
- var t = s[0].chart.stack[0];
- if(typeof t.run.data[0] == "number"){
- var filteredRun = df.map(t.run.data, "Math.max(x, 0)");
- if(df.every(filteredRun, "<= 0")){
- return;
- }
- var slices = df.map(filteredRun, "/this", df.foldl(filteredRun, "+", 0));
- dojo.forEach(slices, function(x, i){
- this._addLabel(t.dyn[i], t._getLabel(x * 100) + "%");
- }, this);
- }else{
- dojo.forEach(t.run.data, function(x, i){
- this._addLabel(t.dyn[i], x.legend || x.text || x.y);
- }, this);
- }
- }else{
- if(this._isReversal()){
- s = s.slice(0).reverse();
- }
- dojo.forEach(s, function(x){
- this._addLabel(x.dyn, x.legend || x.name);
- }, this);
- }
- },
- _addLabel: function(dyn, label){
-
- var wrapper = dojo.create("td"),
- icon = dojo.create("div", null, wrapper),
- text = dojo.create("label", null, wrapper),
- div = dojo.create("div", {
- style: {
- "width": this.swatchSize + "px",
- "height":this.swatchSize + "px",
- "float": "left"
- }
- }, icon);
- dojo.addClass(icon, "dojoxLegendIcon dijitInline");
- dojo.addClass(text, "dojoxLegendText");
-
- if(this._tr){
-
- this._tr.appendChild(wrapper);
- if(++this._inrow === this.horizontal){
-
- this._tr = dojo.create("tr", null, this.legendBody);
- this._inrow = 0;
- }
- }else{
-
- var tr = dojo.create("tr", null, this.legendBody);
- tr.appendChild(wrapper);
- }
-
-
- this._makeIcon(div, dyn);
- text.innerHTML = String(label);
- },
- _makeIcon: function(div, dyn){
- var mb = { h: this.swatchSize, w: this.swatchSize };
- var surface = dojox.gfx.createSurface(div, mb.w, mb.h);
- this._surfaces.push(surface);
- if(dyn.fill){
-
- surface.createRect({x: 2, y: 2, width: mb.w - 4, height: mb.h - 4}).
- setFill(dyn.fill).setStroke(dyn.stroke);
- }else if(dyn.stroke || dyn.marker){
-
- var line = {x1: 0, y1: mb.h / 2, x2: mb.w, y2: mb.h / 2};
- if(dyn.stroke){
- surface.createLine(line).setStroke(dyn.stroke);
- }
- if(dyn.marker){
-
- var c = {x: mb.w / 2, y: mb.h / 2};
- if(dyn.stroke){
- surface.createPath({path: "M" + c.x + " " + c.y + " " + dyn.marker}).
- setFill(dyn.stroke.color).setStroke(dyn.stroke);
- }else{
- surface.createPath({path: "M" + c.x + " " + c.y + " " + dyn.marker}).
- setFill(dyn.color).setStroke(dyn.color);
- }
- }
- }else{
-
- surface.createRect({x: 2, y: 2, width: mb.w - 4, height: mb.h - 4}).
- setStroke("black");
- surface.createLine({x1: 2, y1: 2, x2: mb.w - 2, y2: mb.h - 2}).setStroke("black");
- surface.createLine({x1: 2, y1: mb.h - 2, x2: mb.w - 2, y2: 2}).setStroke("black");
- }
- },
- _isReversal: function(){
- return (!this.horizontal) && dojo.some(this.chart.stack, function(item){
- return REVERSED_SERIES.test(item.declaredClass);
- });
- }
- });
- }
|