Chart2D.js.uncompressed.js 654 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475
  1. require({cache:{
  2. 'dojox/charting/plot2d/_PlotEvents':function(){
  3. define("dojox/charting/plot2d/_PlotEvents", ["dojo/_base/lang", "dojo/_base/array", "dojo/_base/declare", "dojo/_base/connect"],
  4. function(lang, arr, declare, hub){
  5. return declare("dojox.charting.plot2d._PlotEvents", null, {
  6. constructor: function(){
  7. this._shapeEvents = [];
  8. this._eventSeries = {};
  9. },
  10. destroy: function(){
  11. // summary:
  12. // Destroy any internal elements and event handlers.
  13. this.resetEvents();
  14. this.inherited(arguments);
  15. },
  16. plotEvent: function(o){
  17. // summary:
  18. // Stub function for use by specific plots.
  19. // o: Object
  20. // An object intended to represent event parameters.
  21. },
  22. raiseEvent: function(o){
  23. // summary:
  24. // Raises events in predefined order
  25. // o: Object
  26. // An object intended to represent event parameters.
  27. this.plotEvent(o);
  28. var t = lang.delegate(o);
  29. t.originalEvent = o.type;
  30. t.originalPlot = o.plot;
  31. t.type = "onindirect";
  32. arr.forEach(this.chart.stack, function(plot){
  33. if(plot !== this && plot.plotEvent){
  34. t.plot = plot;
  35. plot.plotEvent(t);
  36. }
  37. }, this);
  38. },
  39. connect: function(object, method){
  40. // summary:
  41. // Helper function to connect any object's method to our plotEvent.
  42. // object: Object
  43. // The object to connect to.
  44. // method: String|Function
  45. // The method to fire when our plotEvent is fired.
  46. // returns: Array
  47. // The handle as returned from dojo.connect (see dojo.connect).
  48. this.dirty = true;
  49. return hub.connect(this, "plotEvent", object, method); // Array
  50. },
  51. events: function(){
  52. // summary:
  53. // Find out if any event handlers have been connected to our plotEvent.
  54. // returns: Boolean
  55. // A flag indicating that there are handlers attached.
  56. return !!this.plotEvent.after;
  57. },
  58. resetEvents: function(){
  59. // summary:
  60. // Reset all events attached to our plotEvent (i.e. disconnect).
  61. if(this._shapeEvents.length){
  62. arr.forEach(this._shapeEvents, function(item){
  63. item.shape.disconnect(item.handle);
  64. });
  65. this._shapeEvents = [];
  66. }
  67. this.raiseEvent({type: "onplotreset", plot: this});
  68. },
  69. _connectSingleEvent: function(o, eventName){
  70. this._shapeEvents.push({
  71. shape: o.eventMask,
  72. handle: o.eventMask.connect(eventName, this, function(e){
  73. o.type = eventName;
  74. o.event = e;
  75. this.raiseEvent(o);
  76. o.event = null;
  77. })
  78. });
  79. },
  80. _connectEvents: function(o){
  81. if(o){
  82. o.chart = this.chart;
  83. o.plot = this;
  84. o.hAxis = this.hAxis || null;
  85. o.vAxis = this.vAxis || null;
  86. o.eventMask = o.eventMask || o.shape;
  87. this._connectSingleEvent(o, "onmouseover");
  88. this._connectSingleEvent(o, "onmouseout");
  89. this._connectSingleEvent(o, "onclick");
  90. }
  91. },
  92. _reconnectEvents: function(seriesName){
  93. var a = this._eventSeries[seriesName];
  94. if(a){
  95. arr.forEach(a, this._connectEvents, this);
  96. }
  97. },
  98. fireEvent: function(seriesName, eventName, index, eventObject){
  99. // summary:
  100. // Emulates firing an event for a given data value (specified by
  101. // an index) of a given series.
  102. // seriesName: String:
  103. // Series name.
  104. // eventName: String:
  105. // Event name to emulate.
  106. // index: Number:
  107. // Valid data value index used to raise an event.
  108. // eventObject: Object?:
  109. // Optional event object. Especially useful for synthetic events.
  110. // Default: null.
  111. var s = this._eventSeries[seriesName];
  112. if(s && s.length && index < s.length){
  113. var o = s[index];
  114. o.type = eventName;
  115. o.event = eventObject || null;
  116. this.raiseEvent(o);
  117. o.event = null;
  118. }
  119. }
  120. });
  121. });
  122. },
  123. 'dojo/uacss':function(){
  124. define(["./dom-geometry", "./_base/lang", "./ready", "./_base/sniff", "./_base/window"],
  125. function(geometry, lang, ready, has, baseWindow){
  126. // module:
  127. // dojo/uacss
  128. // summary:
  129. // Applies pre-set CSS classes to the top-level HTML node, based on:
  130. // - browser (ex: dj_ie)
  131. // - browser version (ex: dj_ie6)
  132. // - box model (ex: dj_contentBox)
  133. // - text direction (ex: dijitRtl)
  134. //
  135. // In addition, browser, browser version, and box model are
  136. // combined with an RTL flag when browser text is RTL. ex: dj_ie-rtl.
  137. var
  138. html = baseWindow.doc.documentElement,
  139. ie = has("ie"),
  140. opera = has("opera"),
  141. maj = Math.floor,
  142. ff = has("ff"),
  143. boxModel = geometry.boxModel.replace(/-/,''),
  144. classes = {
  145. "dj_quirks": has("quirks"),
  146. // NOTE: Opera not supported by dijit
  147. "dj_opera": opera,
  148. "dj_khtml": has("khtml"),
  149. "dj_webkit": has("webkit"),
  150. "dj_safari": has("safari"),
  151. "dj_chrome": has("chrome"),
  152. "dj_gecko": has("mozilla")
  153. }; // no dojo unsupported browsers
  154. if(ie){
  155. classes["dj_ie"] = true;
  156. classes["dj_ie" + maj(ie)] = true;
  157. classes["dj_iequirks"] = has("quirks");
  158. }
  159. if(ff){
  160. classes["dj_ff" + maj(ff)] = true;
  161. }
  162. classes["dj_" + boxModel] = true;
  163. // apply browser, browser version, and box model class names
  164. var classStr = "";
  165. for(var clz in classes){
  166. if(classes[clz]){
  167. classStr += clz + " ";
  168. }
  169. }
  170. html.className = lang.trim(html.className + " " + classStr);
  171. // If RTL mode, then add dj_rtl flag plus repeat existing classes with -rtl extension.
  172. // We can't run the code below until the <body> tag has loaded (so we can check for dir=rtl).
  173. // priority is 90 to run ahead of parser priority of 100
  174. ready(90, function(){
  175. if(!geometry.isBodyLtr()){
  176. var rtlClassStr = "dj_rtl dijitRtl " + classStr.replace(/ /g, "-rtl ");
  177. html.className = lang.trim(html.className + " " + rtlClassStr + "dj_rtl dijitRtl " + classStr.replace(/ /g, "-rtl "));
  178. }
  179. });
  180. return has;
  181. });
  182. },
  183. 'dojox/charting/axis2d/Invisible':function(){
  184. define("dojox/charting/axis2d/Invisible", ["dojo/_base/lang", "dojo/_base/declare", "./Base", "../scaler/linear",
  185. "dojox/gfx", "dojox/lang/utils", "dojox/lang/functional", "dojo/string"],
  186. function(lang, declare, Base, lin, g, du, df, dstring){
  187. /*=====
  188. var Base = dojox.charting.axis2d.Base;
  189. =====*/
  190. var merge = du.merge,
  191. labelGap = 4, // in pixels
  192. centerAnchorLimit = 45; // in degrees
  193. return declare("dojox.charting.axis2d.Invisible", Base, {
  194. // summary:
  195. // The default axis object used in dojox.charting. See dojox.charting.Chart.addAxis for details.
  196. //
  197. // defaultParams: Object
  198. // The default parameters used to define any axis.
  199. // optionalParams: Object
  200. // Any optional parameters needed to define an axis.
  201. /*
  202. // TODO: the documentation tools need these to be pre-defined in order to pick them up
  203. // correctly, but the code here is partially predicated on whether or not the properties
  204. // actually exist. For now, we will leave these undocumented but in the code for later. -- TRT
  205. // opt: Object
  206. // The actual options used to define this axis, created at initialization.
  207. // scalar: Object
  208. // The calculated helper object to tell charts how to draw an axis and any data.
  209. // ticks: Object
  210. // The calculated tick object that helps a chart draw the scaling on an axis.
  211. // dirty: Boolean
  212. // The state of the axis (whether it needs to be redrawn or not)
  213. // scale: Number
  214. // The current scale of the axis.
  215. // offset: Number
  216. // The current offset of the axis.
  217. opt: null,
  218. scalar: null,
  219. ticks: null,
  220. dirty: true,
  221. scale: 1,
  222. offset: 0,
  223. */
  224. defaultParams: {
  225. vertical: false, // true for vertical axis
  226. fixUpper: "none", // align the upper on ticks: "major", "minor", "micro", "none"
  227. fixLower: "none", // align the lower on ticks: "major", "minor", "micro", "none"
  228. natural: false, // all tick marks should be made on natural numbers
  229. leftBottom: true, // position of the axis, used with "vertical"
  230. includeZero: false, // 0 should be included
  231. fixed: true, // all labels are fixed numbers
  232. majorLabels: true, // draw major labels
  233. minorTicks: true, // draw minor ticks
  234. minorLabels: true, // draw minor labels
  235. microTicks: false, // draw micro ticks
  236. rotation: 0 // label rotation angle in degrees
  237. },
  238. optionalParams: {
  239. min: 0, // minimal value on this axis
  240. max: 1, // maximal value on this axis
  241. from: 0, // visible from this value
  242. to: 1, // visible to this value
  243. majorTickStep: 4, // major tick step
  244. minorTickStep: 2, // minor tick step
  245. microTickStep: 1, // micro tick step
  246. labels: [], // array of labels for major ticks
  247. // with corresponding numeric values
  248. // ordered by values
  249. labelFunc: null, // function to compute label values
  250. maxLabelSize: 0, // size in px. For use with labelFunc
  251. maxLabelCharCount: 0, // size in word count.
  252. trailingSymbol: null
  253. // TODO: add support for minRange!
  254. // minRange: 1, // smallest distance from min allowed on the axis
  255. },
  256. constructor: function(chart, kwArgs){
  257. // summary:
  258. // The constructor for an axis.
  259. // chart: dojox.charting.Chart
  260. // The chart the axis belongs to.
  261. // kwArgs: dojox.charting.axis2d.__AxisCtorArgs?
  262. // Any optional keyword arguments to be used to define this axis.
  263. this.opt = lang.clone(this.defaultParams);
  264. du.updateWithObject(this.opt, kwArgs);
  265. du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
  266. },
  267. dependOnData: function(){
  268. // summary:
  269. // Find out whether or not the axis options depend on the data in the axis.
  270. return !("min" in this.opt) || !("max" in this.opt); // Boolean
  271. },
  272. clear: function(){
  273. // summary:
  274. // Clear out all calculated properties on this axis;
  275. // returns: dojox.charting.axis2d.Default
  276. // The reference to the axis for functional chaining.
  277. delete this.scaler;
  278. delete this.ticks;
  279. this.dirty = true;
  280. return this; // dojox.charting.axis2d.Default
  281. },
  282. initialized: function(){
  283. // summary:
  284. // Finds out if this axis has been initialized or not.
  285. // returns: Boolean
  286. // Whether a scaler has been calculated and if the axis is not dirty.
  287. return "scaler" in this && !(this.dirty && this.dependOnData());
  288. },
  289. setWindow: function(scale, offset){
  290. // summary:
  291. // Set the drawing "window" for the axis.
  292. // scale: Number
  293. // The new scale for the axis.
  294. // offset: Number
  295. // The new offset for the axis.
  296. // returns: dojox.charting.axis2d.Default
  297. // The reference to the axis for functional chaining.
  298. this.scale = scale;
  299. this.offset = offset;
  300. return this.clear(); // dojox.charting.axis2d.Default
  301. },
  302. getWindowScale: function(){
  303. // summary:
  304. // Get the current windowing scale of the axis.
  305. return "scale" in this ? this.scale : 1; // Number
  306. },
  307. getWindowOffset: function(){
  308. // summary:
  309. // Get the current windowing offset for the axis.
  310. return "offset" in this ? this.offset : 0; // Number
  311. },
  312. _groupLabelWidth: function(labels, font, wcLimit){
  313. if(!labels.length){
  314. return 0;
  315. }
  316. if(lang.isObject(labels[0])){
  317. labels = df.map(labels, function(label){ return label.text; });
  318. }
  319. if (wcLimit) {
  320. labels = df.map(labels, function(label){
  321. return lang.trim(label).length == 0 ? "" : label.substring(0, wcLimit) + this.trailingSymbol;
  322. }, this);
  323. }
  324. var s = labels.join("<br>");
  325. return g._base._getTextBox(s, {font: font}).w || 0;
  326. },
  327. calculate: function(min, max, span, labels){
  328. // summary:
  329. // Perform all calculations needed to render this axis.
  330. // min: Number
  331. // The smallest value represented on this axis.
  332. // max: Number
  333. // The largest value represented on this axis.
  334. // span: Number
  335. // The span in pixels over which axis calculations are made.
  336. // labels: String[]
  337. // Optional list of labels.
  338. // returns: dojox.charting.axis2d.Default
  339. // The reference to the axis for functional chaining.
  340. if(this.initialized()){
  341. return this;
  342. }
  343. var o = this.opt;
  344. this.labels = "labels" in o ? o.labels : labels;
  345. this.scaler = lin.buildScaler(min, max, span, o);
  346. var tsb = this.scaler.bounds;
  347. if("scale" in this){
  348. // calculate new range
  349. o.from = tsb.lower + this.offset;
  350. o.to = (tsb.upper - tsb.lower) / this.scale + o.from;
  351. // make sure that bounds are correct
  352. if( !isFinite(o.from) ||
  353. isNaN(o.from) ||
  354. !isFinite(o.to) ||
  355. isNaN(o.to) ||
  356. o.to - o.from >= tsb.upper - tsb.lower
  357. ){
  358. // any error --- remove from/to bounds
  359. delete o.from;
  360. delete o.to;
  361. delete this.scale;
  362. delete this.offset;
  363. }else{
  364. // shift the window, if we are out of bounds
  365. if(o.from < tsb.lower){
  366. o.to += tsb.lower - o.from;
  367. o.from = tsb.lower;
  368. }else if(o.to > tsb.upper){
  369. o.from += tsb.upper - o.to;
  370. o.to = tsb.upper;
  371. }
  372. // update the offset
  373. this.offset = o.from - tsb.lower;
  374. }
  375. // re-calculate the scaler
  376. this.scaler = lin.buildScaler(min, max, span, o);
  377. tsb = this.scaler.bounds;
  378. // cleanup
  379. if(this.scale == 1 && this.offset == 0){
  380. delete this.scale;
  381. delete this.offset;
  382. }
  383. }
  384. var ta = this.chart.theme.axis, labelWidth = 0, rotation = o.rotation % 360,
  385. // TODO: we use one font --- of major tick, we need to use major and minor fonts
  386. taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font),
  387. size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,
  388. cosr = Math.abs(Math.cos(rotation * Math.PI / 180)),
  389. sinr = Math.abs(Math.sin(rotation * Math.PI / 180));
  390. if(rotation < 0){
  391. rotation += 360;
  392. }
  393. if(size){
  394. if(this.vertical ? rotation != 0 && rotation != 180 : rotation != 90 && rotation != 270){
  395. // we need width of all labels
  396. if(this.labels){
  397. labelWidth = this._groupLabelWidth(this.labels, taFont, o.maxLabelCharCount);
  398. }else{
  399. var labelLength = Math.ceil(
  400. Math.log(
  401. Math.max(
  402. Math.abs(tsb.from),
  403. Math.abs(tsb.to)
  404. )
  405. ) / Math.LN10
  406. ),
  407. t = [];
  408. if(tsb.from < 0 || tsb.to < 0){
  409. t.push("-");
  410. }
  411. t.push(dstring.rep("9", labelLength));
  412. var precision = Math.floor(
  413. Math.log( tsb.to - tsb.from ) / Math.LN10
  414. );
  415. if(precision > 0){
  416. t.push(".");
  417. t.push(dstring.rep("9", precision));
  418. }
  419. labelWidth = g._base._getTextBox(
  420. t.join(""),
  421. { font: taFont }
  422. ).w;
  423. }
  424. labelWidth = o.maxLabelSize ? Math.min(o.maxLabelSize, labelWidth) : labelWidth;
  425. }else{
  426. labelWidth = size;
  427. }
  428. switch(rotation){
  429. case 0:
  430. case 90:
  431. case 180:
  432. case 270:
  433. // trivial cases: use labelWidth
  434. break;
  435. default:
  436. // rotated labels
  437. var gap1 = Math.sqrt(labelWidth * labelWidth + size * size), // short labels
  438. gap2 = this.vertical ? size * cosr + labelWidth * sinr : labelWidth * cosr + size * sinr; // slanted labels
  439. labelWidth = Math.min(gap1, gap2);
  440. break;
  441. }
  442. }
  443. this.scaler.minMinorStep = labelWidth + labelGap;
  444. this.ticks = lin.buildTicks(this.scaler, o);
  445. return this; // dojox.charting.axis2d.Default
  446. },
  447. getScaler: function(){
  448. // summary:
  449. // Get the pre-calculated scaler object.
  450. return this.scaler; // Object
  451. },
  452. getTicks: function(){
  453. // summary:
  454. // Get the pre-calculated ticks object.
  455. return this.ticks; // Object
  456. }
  457. });
  458. });
  459. },
  460. 'dojox/lang/utils':function(){
  461. define("dojox/lang/utils", ["..", "dojo/_base/lang"],
  462. function(dojox, lang){
  463. var du = lang.getObject("lang.utils", true, dojox);
  464. var empty = {}, opts = Object.prototype.toString;
  465. var clone = function(o){
  466. if(o){
  467. switch(opts.call(o)){
  468. case "[object Array]":
  469. return o.slice(0);
  470. case "[object Object]":
  471. return lang.delegate(o);
  472. }
  473. }
  474. return o;
  475. }
  476. lang.mixin(du, {
  477. coerceType: function(target, source){
  478. // summary: Coerces one object to the type of another.
  479. // target: Object: object, which typeof result is used to coerce "source" object.
  480. // source: Object: object, which will be forced to change type.
  481. switch(typeof target){
  482. case "number": return Number(eval("(" + source + ")"));
  483. case "string": return String(source);
  484. case "boolean": return Boolean(eval("(" + source + ")"));
  485. }
  486. return eval("(" + source + ")");
  487. },
  488. updateWithObject: function(target, source, conv){
  489. // summary: Updates an existing object in place with properties from an "source" object.
  490. // target: Object: the "target" object to be updated
  491. // source: Object: the "source" object, whose properties will be used to source the existed object.
  492. // conv: Boolean?: force conversion to the original type
  493. if(!source){ return target; }
  494. for(var x in target){
  495. if(x in source && !(x in empty)){
  496. var t = target[x];
  497. if(t && typeof t == "object"){
  498. du.updateWithObject(t, source[x], conv);
  499. }else{
  500. target[x] = conv ? du.coerceType(t, source[x]) : clone(source[x]);
  501. }
  502. }
  503. }
  504. return target; // Object
  505. },
  506. updateWithPattern: function(target, source, pattern, conv){
  507. // summary: Updates an existing object in place with properties from an "source" object.
  508. // target: Object: the "target" object to be updated
  509. // source: Object: the "source" object, whose properties will be used to source the existed object.
  510. // pattern: Object: object, whose properties will be used to pull values from the "source"
  511. // conv: Boolean?: force conversion to the original type
  512. if(!source || !pattern){ return target; }
  513. for(var x in pattern){
  514. if(x in source && !(x in empty)){
  515. target[x] = conv ? du.coerceType(pattern[x], source[x]) : clone(source[x]);
  516. }
  517. }
  518. return target; // Object
  519. },
  520. merge: function(object, mixin){
  521. // summary: Merge two objects structurally, mixin properties will override object's properties.
  522. // object: Object: original object.
  523. // mixin: Object: additional object, which properties will override object's properties.
  524. if(mixin){
  525. var otype = opts.call(object), mtype = opts.call(mixin), t, i, l, m;
  526. switch(mtype){
  527. case "[object Array]":
  528. if(mtype == otype){
  529. t = new Array(Math.max(object.length, mixin.length));
  530. for(i = 0, l = t.length; i < l; ++i){
  531. t[i] = du.merge(object[i], mixin[i]);
  532. }
  533. return t;
  534. }
  535. return mixin.slice(0);
  536. case "[object Object]":
  537. if(mtype == otype && object){
  538. t = lang.delegate(object);
  539. for(i in mixin){
  540. if(i in object){
  541. l = object[i];
  542. m = mixin[i];
  543. if(m !== l){
  544. t[i] = du.merge(l, m);
  545. }
  546. }else{
  547. t[i] = lang.clone(mixin[i]);
  548. }
  549. }
  550. return t;
  551. }
  552. return lang.clone(mixin);
  553. }
  554. }
  555. return mixin;
  556. }
  557. });
  558. return du;
  559. });
  560. },
  561. 'dojox/charting/plot2d/Pie':function(){
  562. define("dojox/charting/plot2d/Pie", ["dojo/_base/lang", "dojo/_base/array" ,"dojo/_base/declare",
  563. "../Element", "./_PlotEvents", "./common", "../axis2d/common",
  564. "dojox/gfx", "dojox/gfx/matrix", "dojox/lang/functional", "dojox/lang/utils"],
  565. function(lang, arr, declare, Element, PlotEvents, dc, da, g, m, df, du){
  566. /*=====
  567. var Element = dojox.charting.Element;
  568. var PlotEvents = dojox.charting.plot2d._PlotEvents;
  569. dojo.declare("dojox.charting.plot2d.__PieCtorArgs", dojox.charting.plot2d.__DefaultCtorArgs, {
  570. // summary:
  571. // Specialized keyword arguments object for use in defining parameters on a Pie chart.
  572. // labels: Boolean?
  573. // Whether or not to draw labels for each pie slice. Default is true.
  574. labels: true,
  575. // ticks: Boolean?
  576. // Whether or not to draw ticks to labels within each slice. Default is false.
  577. ticks: false,
  578. // fixed: Boolean?
  579. // TODO
  580. fixed: true,
  581. // precision: Number?
  582. // The precision at which to sum/add data values. Default is 1.
  583. precision: 1,
  584. // labelOffset: Number?
  585. // The amount in pixels by which to offset labels. Default is 20.
  586. labelOffset: 20,
  587. // labelStyle: String?
  588. // Options as to where to draw labels. Values include "default", and "columns". Default is "default".
  589. labelStyle: "default", // default/columns
  590. // htmlLabels: Boolean?
  591. // Whether or not to use HTML to render slice labels. Default is true.
  592. htmlLabels: true,
  593. // radGrad: String?
  594. // The type of radial gradient to use in rendering. Default is "native".
  595. radGrad: "native",
  596. // fanSize: Number?
  597. // The amount for a radial gradient. Default is 5.
  598. fanSize: 5,
  599. // startAngle: Number?
  600. // Where to being rendering gradients in slices, in degrees. Default is 0.
  601. startAngle: 0,
  602. // radius: Number?
  603. // The size of the radial gradient. Default is 0.
  604. radius: 0
  605. });
  606. =====*/
  607. var FUDGE_FACTOR = 0.2; // use to overlap fans
  608. return declare("dojox.charting.plot2d.Pie", [Element, PlotEvents], {
  609. // summary:
  610. // The plot that represents a typical pie chart.
  611. defaultParams: {
  612. labels: true,
  613. ticks: false,
  614. fixed: true,
  615. precision: 1,
  616. labelOffset: 20,
  617. labelStyle: "default", // default/columns
  618. htmlLabels: true, // use HTML to draw labels
  619. radGrad: "native", // or "linear", or "fan"
  620. fanSize: 5, // maximum fan size in degrees
  621. startAngle: 0 // start angle for slices in degrees
  622. },
  623. optionalParams: {
  624. radius: 0,
  625. // theme components
  626. stroke: {},
  627. outline: {},
  628. shadow: {},
  629. fill: {},
  630. font: "",
  631. fontColor: "",
  632. labelWiring: {}
  633. },
  634. constructor: function(chart, kwArgs){
  635. // summary:
  636. // Create a pie plot.
  637. this.opt = lang.clone(this.defaultParams);
  638. du.updateWithObject(this.opt, kwArgs);
  639. du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
  640. this.run = null;
  641. this.dyn = [];
  642. },
  643. clear: function(){
  644. // summary:
  645. // Clear out all of the information tied to this plot.
  646. // returns: dojox.charting.plot2d.Pie
  647. // A reference to this plot for functional chaining.
  648. this.dirty = true;
  649. this.dyn = [];
  650. this.run = null;
  651. return this; // dojox.charting.plot2d.Pie
  652. },
  653. setAxis: function(axis){
  654. // summary:
  655. // Dummy method, since axes are irrelevant with a Pie chart.
  656. // returns: dojox.charting.plot2d.Pie
  657. // The reference to this plot for functional chaining.
  658. return this; // dojox.charting.plot2d.Pie
  659. },
  660. addSeries: function(run){
  661. // summary:
  662. // Add a series of data to this plot.
  663. // returns: dojox.charting.plot2d.Pie
  664. // The reference to this plot for functional chaining.
  665. this.run = run;
  666. return this; // dojox.charting.plot2d.Pie
  667. },
  668. getSeriesStats: function(){
  669. // summary:
  670. // Returns default stats (irrelevant for this type of plot).
  671. // returns: Object
  672. // {hmin, hmax, vmin, vmax} min/max in both directions.
  673. return lang.delegate(dc.defaultStats);
  674. },
  675. initializeScalers: function(){
  676. // summary:
  677. // Does nothing (irrelevant for this type of plot).
  678. return this;
  679. },
  680. getRequiredColors: function(){
  681. // summary:
  682. // Return the number of colors needed to draw this plot.
  683. return this.run ? this.run.data.length : 0;
  684. },
  685. render: function(dim, offsets){
  686. // summary:
  687. // Render the plot on the chart.
  688. // dim: Object
  689. // An object of the form { width, height }.
  690. // offsets: Object
  691. // An object of the form { l, r, t, b }.
  692. // returns: dojox.charting.plot2d.Pie
  693. // A reference to this plot for functional chaining.
  694. if(!this.dirty){ return this; }
  695. this.resetEvents();
  696. this.dirty = false;
  697. this._eventSeries = {};
  698. this.cleanGroup();
  699. var s = this.group, t = this.chart.theme;
  700. if(!this.run || !this.run.data.length){
  701. return this;
  702. }
  703. // calculate the geometry
  704. var rx = (dim.width - offsets.l - offsets.r) / 2,
  705. ry = (dim.height - offsets.t - offsets.b) / 2,
  706. r = Math.min(rx, ry),
  707. taFont = "font" in this.opt ? this.opt.font : t.axis.font,
  708. size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,
  709. taFontColor = "fontColor" in this.opt ? this.opt.fontColor : t.axis.fontColor,
  710. startAngle = m._degToRad(this.opt.startAngle),
  711. start = startAngle, step, filteredRun, slices, labels, shift, labelR,
  712. run = this.run.data,
  713. events = this.events();
  714. if(typeof run[0] == "number"){
  715. filteredRun = df.map(run, "x ? Math.max(x, 0) : 0");
  716. if(df.every(filteredRun, "<= 0")){
  717. return this;
  718. }
  719. slices = df.map(filteredRun, "/this", df.foldl(filteredRun, "+", 0));
  720. if(this.opt.labels){
  721. labels = arr.map(slices, function(x){
  722. return x > 0 ? this._getLabel(x * 100) + "%" : "";
  723. }, this);
  724. }
  725. }else{
  726. filteredRun = df.map(run, "x ? Math.max(x.y, 0) : 0");
  727. if(df.every(filteredRun, "<= 0")){
  728. return this;
  729. }
  730. slices = df.map(filteredRun, "/this", df.foldl(filteredRun, "+", 0));
  731. if(this.opt.labels){
  732. labels = arr.map(slices, function(x, i){
  733. if(x <= 0){ return ""; }
  734. var v = run[i];
  735. return "text" in v ? v.text : this._getLabel(x * 100) + "%";
  736. }, this);
  737. }
  738. }
  739. var themes = df.map(run, function(v, i){
  740. if(v === null || typeof v == "number"){
  741. return t.next("slice", [this.opt, this.run], true);
  742. }
  743. return t.next("slice", [this.opt, this.run, v], true);
  744. }, this);
  745. if(this.opt.labels){
  746. shift = df.foldl1(df.map(labels, function(label, i){
  747. var font = themes[i].series.font;
  748. return g._base._getTextBox(label, {font: font}).w;
  749. }, this), "Math.max(a, b)") / 2;
  750. if(this.opt.labelOffset < 0){
  751. r = Math.min(rx - 2 * shift, ry - size) + this.opt.labelOffset;
  752. }
  753. labelR = r - this.opt.labelOffset;
  754. }
  755. if("radius" in this.opt){
  756. r = this.opt.radius;
  757. labelR = r - this.opt.labelOffset;
  758. }
  759. var circle = {
  760. cx: offsets.l + rx,
  761. cy: offsets.t + ry,
  762. r: r
  763. };
  764. this.dyn = [];
  765. // draw slices
  766. var eventSeries = new Array(slices.length);
  767. arr.some(slices, function(slice, i){
  768. if(slice < 0){
  769. // degenerated slice
  770. return false; // continue
  771. }
  772. if(slice == 0){
  773. this.dyn.push({fill: null, stroke: null});
  774. return false;
  775. }
  776. var v = run[i], theme = themes[i], specialFill;
  777. if(slice >= 1){
  778. // whole pie
  779. specialFill = this._plotFill(theme.series.fill, dim, offsets);
  780. specialFill = this._shapeFill(specialFill,
  781. {
  782. x: circle.cx - circle.r, y: circle.cy - circle.r,
  783. width: 2 * circle.r, height: 2 * circle.r
  784. });
  785. specialFill = this._pseudoRadialFill(specialFill, {x: circle.cx, y: circle.cy}, circle.r);
  786. var shape = s.createCircle(circle).setFill(specialFill).setStroke(theme.series.stroke);
  787. this.dyn.push({fill: specialFill, stroke: theme.series.stroke});
  788. if(events){
  789. var o = {
  790. element: "slice",
  791. index: i,
  792. run: this.run,
  793. shape: shape,
  794. x: i,
  795. y: typeof v == "number" ? v : v.y,
  796. cx: circle.cx,
  797. cy: circle.cy,
  798. cr: r
  799. };
  800. this._connectEvents(o);
  801. eventSeries[i] = o;
  802. }
  803. return true; // stop iteration
  804. }
  805. // calculate the geometry of the slice
  806. var end = start + slice * 2 * Math.PI;
  807. if(i + 1 == slices.length){
  808. end = startAngle + 2 * Math.PI;
  809. }
  810. var step = end - start,
  811. x1 = circle.cx + r * Math.cos(start),
  812. y1 = circle.cy + r * Math.sin(start),
  813. x2 = circle.cx + r * Math.cos(end),
  814. y2 = circle.cy + r * Math.sin(end);
  815. // draw the slice
  816. var fanSize = m._degToRad(this.opt.fanSize);
  817. if(theme.series.fill && theme.series.fill.type === "radial" && this.opt.radGrad === "fan" && step > fanSize){
  818. var group = s.createGroup(), nfans = Math.ceil(step / fanSize), delta = step / nfans;
  819. specialFill = this._shapeFill(theme.series.fill,
  820. {x: circle.cx - circle.r, y: circle.cy - circle.r, width: 2 * circle.r, height: 2 * circle.r});
  821. for(var j = 0; j < nfans; ++j){
  822. var fansx = j == 0 ? x1 : circle.cx + r * Math.cos(start + (j - FUDGE_FACTOR) * delta),
  823. fansy = j == 0 ? y1 : circle.cy + r * Math.sin(start + (j - FUDGE_FACTOR) * delta),
  824. fanex = j == nfans - 1 ? x2 : circle.cx + r * Math.cos(start + (j + 1 + FUDGE_FACTOR) * delta),
  825. faney = j == nfans - 1 ? y2 : circle.cy + r * Math.sin(start + (j + 1 + FUDGE_FACTOR) * delta),
  826. fan = group.createPath().
  827. moveTo(circle.cx, circle.cy).
  828. lineTo(fansx, fansy).
  829. arcTo(r, r, 0, delta > Math.PI, true, fanex, faney).
  830. lineTo(circle.cx, circle.cy).
  831. closePath().
  832. setFill(this._pseudoRadialFill(specialFill, {x: circle.cx, y: circle.cy}, r, start + (j + 0.5) * delta, start + (j + 0.5) * delta));
  833. }
  834. group.createPath().
  835. moveTo(circle.cx, circle.cy).
  836. lineTo(x1, y1).
  837. arcTo(r, r, 0, step > Math.PI, true, x2, y2).
  838. lineTo(circle.cx, circle.cy).
  839. closePath().
  840. setStroke(theme.series.stroke);
  841. shape = group;
  842. }else{
  843. shape = s.createPath().
  844. moveTo(circle.cx, circle.cy).
  845. lineTo(x1, y1).
  846. arcTo(r, r, 0, step > Math.PI, true, x2, y2).
  847. lineTo(circle.cx, circle.cy).
  848. closePath().
  849. setStroke(theme.series.stroke);
  850. var specialFill = theme.series.fill;
  851. if(specialFill && specialFill.type === "radial"){
  852. specialFill = this._shapeFill(specialFill, {x: circle.cx - circle.r, y: circle.cy - circle.r, width: 2 * circle.r, height: 2 * circle.r});
  853. if(this.opt.radGrad === "linear"){
  854. specialFill = this._pseudoRadialFill(specialFill, {x: circle.cx, y: circle.cy}, r, start, end);
  855. }
  856. }else if(specialFill && specialFill.type === "linear"){
  857. specialFill = this._plotFill(specialFill, dim, offsets);
  858. specialFill = this._shapeFill(specialFill, shape.getBoundingBox());
  859. }
  860. shape.setFill(specialFill);
  861. }
  862. this.dyn.push({fill: specialFill, stroke: theme.series.stroke});
  863. if(events){
  864. var o = {
  865. element: "slice",
  866. index: i,
  867. run: this.run,
  868. shape: shape,
  869. x: i,
  870. y: typeof v == "number" ? v : v.y,
  871. cx: circle.cx,
  872. cy: circle.cy,
  873. cr: r
  874. };
  875. this._connectEvents(o);
  876. eventSeries[i] = o;
  877. }
  878. start = end;
  879. return false; // continue
  880. }, this);
  881. // draw labels
  882. if(this.opt.labels){
  883. if(this.opt.labelStyle == "default"){
  884. start = startAngle;
  885. arr.some(slices, function(slice, i){
  886. if(slice <= 0){
  887. // degenerated slice
  888. return false; // continue
  889. }
  890. var theme = themes[i];
  891. if(slice >= 1){
  892. // whole pie
  893. var v = run[i], elem = da.createText[this.opt.htmlLabels && g.renderer != "vml" ? "html" : "gfx"](
  894. this.chart, s, circle.cx, circle.cy + size / 2, "middle", labels[i],
  895. theme.series.font, theme.series.fontColor);
  896. if(this.opt.htmlLabels){
  897. this.htmlElements.push(elem);
  898. }
  899. return true; // stop iteration
  900. }
  901. // calculate the geometry of the slice
  902. var end = start + slice * 2 * Math.PI, v = run[i];
  903. if(i + 1 == slices.length){
  904. end = startAngle + 2 * Math.PI;
  905. }
  906. var labelAngle = (start + end) / 2,
  907. x = circle.cx + labelR * Math.cos(labelAngle),
  908. y = circle.cy + labelR * Math.sin(labelAngle) + size / 2;
  909. // draw the label
  910. var elem = da.createText[this.opt.htmlLabels && g.renderer != "vml" ? "html" : "gfx"]
  911. (this.chart, s, x, y, "middle", labels[i], theme.series.font, theme.series.fontColor);
  912. if(this.opt.htmlLabels){
  913. this.htmlElements.push(elem);
  914. }
  915. start = end;
  916. return false; // continue
  917. }, this);
  918. }else if(this.opt.labelStyle == "columns"){
  919. start = startAngle;
  920. //calculate label angles
  921. var labeledSlices = [];
  922. arr.forEach(slices, function(slice, i){
  923. var end = start + slice * 2 * Math.PI;
  924. if(i + 1 == slices.length){
  925. end = startAngle + 2 * Math.PI;
  926. }
  927. var labelAngle = (start + end) / 2;
  928. labeledSlices.push({
  929. angle: labelAngle,
  930. left: Math.cos(labelAngle) < 0,
  931. theme: themes[i],
  932. index: i,
  933. omit: end - start < 0.001
  934. });
  935. start = end;
  936. });
  937. //calculate label radius to each slice
  938. var labelHeight = g._base._getTextBox("a",{font:taFont}).h;
  939. this._getProperLabelRadius(labeledSlices, labelHeight, circle.r * 1.1);
  940. //draw label and wiring
  941. arr.forEach(labeledSlices, function(slice, i){
  942. if (!slice.omit) {
  943. var leftColumn = circle.cx - circle.r * 2,
  944. rightColumn = circle.cx + circle.r * 2,
  945. labelWidth = g._base._getTextBox(labels[i], {font: taFont}).w,
  946. x = circle.cx + slice.labelR * Math.cos(slice.angle),
  947. y = circle.cy + slice.labelR * Math.sin(slice.angle),
  948. jointX = (slice.left) ? (leftColumn + labelWidth) : (rightColumn - labelWidth),
  949. labelX = (slice.left) ? leftColumn : jointX;
  950. var wiring = s.createPath().moveTo(circle.cx + circle.r * Math.cos(slice.angle), circle.cy + circle.r * Math.sin(slice.angle))
  951. if (Math.abs(slice.labelR * Math.cos(slice.angle)) < circle.r * 2 - labelWidth) {
  952. wiring.lineTo(x, y);
  953. }
  954. wiring.lineTo(jointX, y).setStroke(slice.theme.series.labelWiring);
  955. var elem = da.createText[this.opt.htmlLabels && g.renderer != "vml" ? "html" : "gfx"](
  956. this.chart, s, labelX, y, "left", labels[i], slice.theme.series.font, slice.theme.series.fontColor);
  957. if (this.opt.htmlLabels) {
  958. this.htmlElements.push(elem);
  959. }
  960. }
  961. },this);
  962. }
  963. }
  964. // post-process events to restore the original indexing
  965. var esi = 0;
  966. this._eventSeries[this.run.name] = df.map(run, function(v){
  967. return v <= 0 ? null : eventSeries[esi++];
  968. });
  969. return this; // dojox.charting.plot2d.Pie
  970. },
  971. _getProperLabelRadius: function(slices, labelHeight, minRidius){
  972. var leftCenterSlice = {},rightCenterSlice = {},leftMinSIN = 1, rightMinSIN = 1;
  973. if (slices.length == 1) {
  974. slices[0].labelR = minRidius;
  975. return;
  976. }
  977. for(var i = 0;i<slices.length;i++){
  978. var tempSIN = Math.abs(Math.sin(slices[i].angle));
  979. if(slices[i].left){
  980. if(leftMinSIN >= tempSIN){
  981. leftMinSIN = tempSIN;
  982. leftCenterSlice = slices[i];
  983. }
  984. }else{
  985. if(rightMinSIN >= tempSIN){
  986. rightMinSIN = tempSIN;
  987. rightCenterSlice = slices[i];
  988. }
  989. }
  990. }
  991. leftCenterSlice.labelR = rightCenterSlice.labelR = minRidius;
  992. this._calculateLabelR(leftCenterSlice,slices,labelHeight);
  993. this._calculateLabelR(rightCenterSlice,slices,labelHeight);
  994. },
  995. _calculateLabelR: function(firstSlice,slices,labelHeight){
  996. var i = firstSlice.index,length = slices.length,
  997. currentLabelR = firstSlice.labelR;
  998. while(!(slices[i%length].left ^ slices[(i+1)%length].left)){
  999. if (!slices[(i + 1) % length].omit) {
  1000. var nextLabelR = (Math.sin(slices[i % length].angle) * currentLabelR + ((slices[i % length].left) ? (-labelHeight) : labelHeight)) /
  1001. Math.sin(slices[(i + 1) % length].angle);
  1002. currentLabelR = (nextLabelR < firstSlice.labelR) ? firstSlice.labelR : nextLabelR;
  1003. slices[(i + 1) % length].labelR = currentLabelR;
  1004. }
  1005. i++;
  1006. }
  1007. i = firstSlice.index;
  1008. var j = (i == 0)?length-1 : i - 1;
  1009. while(!(slices[i].left ^ slices[j].left)){
  1010. if (!slices[j].omit) {
  1011. var nextLabelR = (Math.sin(slices[i].angle) * currentLabelR + ((slices[i].left) ? labelHeight : (-labelHeight))) /
  1012. Math.sin(slices[j].angle);
  1013. currentLabelR = (nextLabelR < firstSlice.labelR) ? firstSlice.labelR : nextLabelR;
  1014. slices[j].labelR = currentLabelR;
  1015. }
  1016. i--;j--;
  1017. i = (i < 0)?i+slices.length:i;
  1018. j = (j < 0)?j+slices.length:j;
  1019. }
  1020. },
  1021. // utilities
  1022. _getLabel: function(number){
  1023. return dc.getLabel(number, this.opt.fixed, this.opt.precision);
  1024. }
  1025. });
  1026. });
  1027. },
  1028. 'dijit/hccss':function(){
  1029. define("dijit/hccss", [
  1030. "require", // require.toUrl
  1031. "dojo/_base/config", // config.blankGif
  1032. "dojo/dom-class", // domClass.add domConstruct.create domStyle.getComputedStyle
  1033. "dojo/dom-construct", // domClass.add domConstruct.create domStyle.getComputedStyle
  1034. "dojo/dom-style", // domClass.add domConstruct.create domStyle.getComputedStyle
  1035. "dojo/ready", // ready
  1036. "dojo/_base/sniff", // has("ie") has("mozilla")
  1037. "dojo/_base/window" // win.body
  1038. ], function(require, config, domClass, domConstruct, domStyle, ready, has, win){
  1039. // module:
  1040. // dijit/hccss
  1041. // summary:
  1042. // Test if computer is in high contrast mode, and sets dijit_a11y flag on <body> if it is.
  1043. if(has("ie") || has("mozilla")){ // NOTE: checking in Safari messes things up
  1044. // priority is 90 to run ahead of parser priority of 100
  1045. ready(90, function(){
  1046. // summary:
  1047. // Detects if we are in high-contrast mode or not
  1048. // create div for testing if high contrast mode is on or images are turned off
  1049. var div = domConstruct.create("div",{
  1050. id: "a11yTestNode",
  1051. style:{
  1052. cssText:'border: 1px solid;'
  1053. + 'border-color:red green;'
  1054. + 'position: absolute;'
  1055. + 'height: 5px;'
  1056. + 'top: -999px;'
  1057. + 'background-image: url("' + (config.blankGif || require.toUrl("dojo/resources/blank.gif")) + '");'
  1058. }
  1059. }, win.body());
  1060. // test it
  1061. var cs = domStyle.getComputedStyle(div);
  1062. if(cs){
  1063. var bkImg = cs.backgroundImage;
  1064. var needsA11y = (cs.borderTopColor == cs.borderRightColor) || (bkImg != null && (bkImg == "none" || bkImg == "url(invalid-url:)" ));
  1065. if(needsA11y){
  1066. domClass.add(win.body(), "dijit_a11y");
  1067. }
  1068. if(has("ie")){
  1069. div.outerHTML = ""; // prevent mixed-content warning, see http://support.microsoft.com/kb/925014
  1070. }else{
  1071. win.body().removeChild(div);
  1072. }
  1073. }
  1074. });
  1075. }
  1076. });
  1077. },
  1078. 'dojox/charting/action2d/Shake':function(){
  1079. define(["dojo/_base/connect", "dojo/_base/declare", "./PlotAction",
  1080. "dojo/fx", "dojo/fx/easing", "dojox/gfx/matrix", "dojox/gfx/fx"],
  1081. function(hub, declare, PlotAction, df, dfe, m, gf){
  1082. /*=====
  1083. dojo.declare("dojox.charting.action2d.__ShakeCtorArgs", dojox.charting.action2d.__PlotActionCtorArgstorArgs, {
  1084. // summary:
  1085. // Additional arguments for highlighting actions.
  1086. // shift: Number?
  1087. // The amount in pixels to shift the pie slice. Default is 3.
  1088. shift: 3
  1089. });
  1090. var PlotAction = dojox.charting.action2d.PlotAction;
  1091. =====*/
  1092. var DEFAULT_SHIFT = 3;
  1093. return declare("dojox.charting.action2d.Shake", PlotAction, {
  1094. // summary:
  1095. // Create a shaking action for use on an element in a chart.
  1096. // the data description block for the widget parser
  1097. defaultParams: {
  1098. duration: 400, // duration of the action in ms
  1099. easing: dfe.backOut, // easing for the action
  1100. shiftX: DEFAULT_SHIFT, // shift of the element along the X axis
  1101. shiftY: DEFAULT_SHIFT // shift of the element along the Y axis
  1102. },
  1103. optionalParams: {}, // no optional parameters
  1104. constructor: function(chart, plot, kwArgs){
  1105. // summary:
  1106. // Create the shaking action and connect it to the plot.
  1107. // chart: dojox.charting.Chart
  1108. // The chart this action belongs to.
  1109. // plot: String?
  1110. // The plot this action is attached to. If not passed, "default" is assumed.
  1111. // kwArgs: dojox.charting.action2d.__ShakeCtorArgs?
  1112. // Optional keyword arguments object for setting parameters.
  1113. if(!kwArgs){ kwArgs = {}; }
  1114. this.shiftX = typeof kwArgs.shiftX == "number" ? kwArgs.shiftX : DEFAULT_SHIFT;
  1115. this.shiftY = typeof kwArgs.shiftY == "number" ? kwArgs.shiftY : DEFAULT_SHIFT;
  1116. this.connect();
  1117. },
  1118. process: function(o){
  1119. // summary:
  1120. // Process the action on the given object.
  1121. // o: dojox.gfx.Shape
  1122. // The object on which to process the slice moving action.
  1123. if(!o.shape || !(o.type in this.overOutEvents)){ return; }
  1124. var runName = o.run.name, index = o.index, vector = [], anim,
  1125. shiftX = o.type == "onmouseover" ? this.shiftX : -this.shiftX,
  1126. shiftY = o.type == "onmouseover" ? this.shiftY : -this.shiftY;
  1127. if(runName in this.anim){
  1128. anim = this.anim[runName][index];
  1129. }else{
  1130. this.anim[runName] = {};
  1131. }
  1132. if(anim){
  1133. anim.action.stop(true);
  1134. }else{
  1135. this.anim[runName][index] = anim = {};
  1136. }
  1137. var kwArgs = {
  1138. shape: o.shape,
  1139. duration: this.duration,
  1140. easing: this.easing,
  1141. transform: [
  1142. {name: "translate", start: [this.shiftX, this.shiftY], end: [0, 0]},
  1143. m.identity
  1144. ]
  1145. };
  1146. if(o.shape){
  1147. vector.push(gf.animateTransform(kwArgs));
  1148. }
  1149. if(o.oultine){
  1150. kwArgs.shape = o.outline;
  1151. vector.push(gf.animateTransform(kwArgs));
  1152. }
  1153. if(o.shadow){
  1154. kwArgs.shape = o.shadow;
  1155. vector.push(gf.animateTransform(kwArgs));
  1156. }
  1157. if(!vector.length){
  1158. delete this.anim[runName][index];
  1159. return;
  1160. }
  1161. anim.action = df.combine(vector);
  1162. if(o.type == "onmouseout"){
  1163. hub.connect(anim.action, "onEnd", this, function(){
  1164. if(this.anim[runName]){
  1165. delete this.anim[runName][index];
  1166. }
  1167. });
  1168. }
  1169. anim.action.play();
  1170. }
  1171. });
  1172. });
  1173. },
  1174. 'dojox/lang/functional/lambda':function(){
  1175. define("dojox/lang/functional/lambda", ["../..", "dojo/_base/kernel", "dojo/_base/lang", "dojo/_base/array"], function(dojox, dojo, lang, arr){
  1176. var df = lang.getObject("lang.functional", true, dojox);
  1177. // This module adds high-level functions and related constructs:
  1178. // - anonymous functions built from the string
  1179. // Acknoledgements:
  1180. // - lambda() is based on work by Oliver Steele
  1181. // (http://osteele.com/sources/javascript/functional/functional.js)
  1182. // which was published under MIT License
  1183. // Notes:
  1184. // - lambda() produces functions, which after the compilation step are
  1185. // as fast as regular JS functions (at least theoretically).
  1186. // Lambda input values:
  1187. // - returns functions unchanged
  1188. // - converts strings to functions
  1189. // - converts arrays to a functional composition
  1190. var lcache = {};
  1191. // split() is augmented on IE6 to ensure the uniform behavior
  1192. var split = "ab".split(/a*/).length > 1 ? String.prototype.split :
  1193. function(sep){
  1194. var r = this.split.call(this, sep),
  1195. m = sep.exec(this);
  1196. if(m && m.index == 0){ r.unshift(""); }
  1197. return r;
  1198. };
  1199. var lambda = function(/*String*/ s){
  1200. var args = [], sects = split.call(s, /\s*->\s*/m);
  1201. if(sects.length > 1){
  1202. while(sects.length){
  1203. s = sects.pop();
  1204. args = sects.pop().split(/\s*,\s*|\s+/m);
  1205. if(sects.length){ sects.push("(function(" + args + "){return (" + s + ")})"); }
  1206. }
  1207. }else if(s.match(/\b_\b/)){
  1208. args = ["_"];
  1209. }else{
  1210. var l = s.match(/^\s*(?:[+*\/%&|\^\.=<>]|!=)/m),
  1211. r = s.match(/[+\-*\/%&|\^\.=<>!]\s*$/m);
  1212. if(l || r){
  1213. if(l){
  1214. args.push("$1");
  1215. s = "$1" + s;
  1216. }
  1217. if(r){
  1218. args.push("$2");
  1219. s = s + "$2";
  1220. }
  1221. }else{
  1222. // the point of the long regex below is to exclude all well-known
  1223. // lower-case words from the list of potential arguments
  1224. var vars = s.
  1225. 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, "").
  1226. match(/([a-z_$][a-z_$\d]*)/gi) || [], t = {};
  1227. arr.forEach(vars, function(v){
  1228. if(!(v in t)){
  1229. args.push(v);
  1230. t[v] = 1;
  1231. }
  1232. });
  1233. }
  1234. }
  1235. return {args: args, body: s}; // Object
  1236. };
  1237. var compose = function(/*Array*/ a){
  1238. return a.length ?
  1239. function(){
  1240. var i = a.length - 1, x = df.lambda(a[i]).apply(this, arguments);
  1241. for(--i; i >= 0; --i){ x = df.lambda(a[i]).call(this, x); }
  1242. return x;
  1243. }
  1244. :
  1245. // identity
  1246. function(x){ return x; };
  1247. };
  1248. lang.mixin(df, {
  1249. // lambda
  1250. rawLambda: function(/*String*/ s){
  1251. // summary:
  1252. // builds a function from a snippet, or array (composing),
  1253. // returns an object describing the function; functions are
  1254. // passed through unmodified.
  1255. // description:
  1256. // This method is to normalize a functional representation (a
  1257. // text snippet) to an object that contains an array of
  1258. // arguments, and a body , which is used to calculate the
  1259. // returning value.
  1260. return lambda(s); // Object
  1261. },
  1262. buildLambda: function(/*String*/ s){
  1263. // summary:
  1264. // builds a function from a snippet, returns a string, which
  1265. // represents the function.
  1266. // description:
  1267. // This method returns a textual representation of a function
  1268. // built from the snippet. It is meant to be evaled in the
  1269. // proper context, so local variables can be pulled from the
  1270. // environment.
  1271. s = lambda(s);
  1272. return "function(" + s.args.join(",") + "){return (" + s.body + ");}"; // String
  1273. },
  1274. lambda: function(/*Function|String|Array*/ s){
  1275. // summary:
  1276. // builds a function from a snippet, or array (composing),
  1277. // returns a function object; functions are passed through
  1278. // unmodified.
  1279. // description:
  1280. // This method is used to normalize a functional
  1281. // representation (a text snippet, an array, or a function) to
  1282. // a function object.
  1283. if(typeof s == "function"){ return s; }
  1284. if(s instanceof Array){ return compose(s); }
  1285. if(s in lcache){ return lcache[s]; }
  1286. s = lambda(s);
  1287. return lcache[s] = new Function(s.args, "return (" + s.body + ");"); // Function
  1288. },
  1289. clearLambdaCache: function(){
  1290. // summary:
  1291. // clears internal cache of lambdas
  1292. lcache = {};
  1293. }
  1294. });
  1295. return df;
  1296. });
  1297. },
  1298. 'dojox/lang/functional/reversed':function(){
  1299. define("dojox/lang/functional/reversed", ["dojo/_base/lang", "dojo/_base/window" ,"./lambda"],
  1300. function(lang, win, df){
  1301. // This module adds high-level functions and related constructs:
  1302. // - reversed versions of array-processing functions similar to standard JS functions
  1303. // Notes:
  1304. // - this module provides reversed versions of standard array-processing functions:
  1305. // forEachRev, mapRev, filterRev
  1306. // Defined methods:
  1307. // - take any valid lambda argument as the functional argument
  1308. // - operate on dense arrays
  1309. // - take a string as the array argument
  1310. /*=====
  1311. var df = dojox.lang.functional;
  1312. =====*/
  1313. lang.mixin(df, {
  1314. // JS 1.6 standard array functions, which can take a lambda as a parameter.
  1315. // Consider using dojo._base.array functions, if you don't need the lambda support.
  1316. filterRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
  1317. // summary: creates a new array with all elements that pass the test
  1318. // implemented by the provided function.
  1319. if(typeof a == "string"){ a = a.split(""); }
  1320. o = o || win.global; f = df.lambda(f);
  1321. var t = [], v, i = a.length - 1;
  1322. for(; i >= 0; --i){
  1323. v = a[i];
  1324. if(f.call(o, v, i, a)){ t.push(v); }
  1325. }
  1326. return t; // Array
  1327. },
  1328. forEachRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
  1329. // summary: executes a provided function once per array element.
  1330. if(typeof a == "string"){ a = a.split(""); }
  1331. o = o || win.global; f = df.lambda(f);
  1332. for(var i = a.length - 1; i >= 0; f.call(o, a[i], i, a), --i);
  1333. },
  1334. mapRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
  1335. // summary: creates a new array with the results of calling
  1336. // a provided function on every element in this array.
  1337. if(typeof a == "string"){ a = a.split(""); }
  1338. o = o || win.global; f = df.lambda(f);
  1339. var n = a.length, t = new Array(n), i = n - 1, j = 0;
  1340. for(; i >= 0; t[j++] = f.call(o, a[i], i, a), --i);
  1341. return t; // Array
  1342. },
  1343. everyRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
  1344. // summary: tests whether all elements in the array pass the test
  1345. // implemented by the provided function.
  1346. if(typeof a == "string"){ a = a.split(""); }
  1347. o = o || win.global; f = df.lambda(f);
  1348. for(var i = a.length - 1; i >= 0; --i){
  1349. if(!f.call(o, a[i], i, a)){
  1350. return false; // Boolean
  1351. }
  1352. }
  1353. return true; // Boolean
  1354. },
  1355. someRev: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
  1356. // summary: tests whether some element in the array passes the test
  1357. // implemented by the provided function.
  1358. if(typeof a == "string"){ a = a.split(""); }
  1359. o = o || win.global; f = df.lambda(f);
  1360. for(var i = a.length - 1; i >= 0; --i){
  1361. if(f.call(o, a[i], i, a)){
  1362. return true; // Boolean
  1363. }
  1364. }
  1365. return false; // Boolean
  1366. }
  1367. });
  1368. return df;
  1369. });
  1370. },
  1371. 'dojox/charting/scaler/primitive':function(){
  1372. define("dojox/charting/scaler/primitive", ["dojo/_base/lang"],
  1373. function(lang){
  1374. var primitive = lang.getObject("dojox.charting.scaler.primitive", true);
  1375. return lang.mixin(primitive, {
  1376. buildScaler: function(/*Number*/ min, /*Number*/ max, /*Number*/ span, /*Object*/ kwArgs){
  1377. if(min == max){
  1378. // artificially extend bounds
  1379. min -= 0.5;
  1380. max += 0.5;
  1381. // now the line will be centered
  1382. }
  1383. return {
  1384. bounds: {
  1385. lower: min,
  1386. upper: max,
  1387. from: min,
  1388. to: max,
  1389. scale: span / (max - min),
  1390. span: span
  1391. },
  1392. scaler: primitive
  1393. };
  1394. },
  1395. buildTicks: function(/*Object*/ scaler, /*Object*/ kwArgs){
  1396. return {major: [], minor: [], micro: []}; // Object
  1397. },
  1398. getTransformerFromModel: function(/*Object*/ scaler){
  1399. var offset = scaler.bounds.from, scale = scaler.bounds.scale;
  1400. return function(x){ return (x - offset) * scale; }; // Function
  1401. },
  1402. getTransformerFromPlot: function(/*Object*/ scaler){
  1403. var offset = scaler.bounds.from, scale = scaler.bounds.scale;
  1404. return function(x){ return x / scale + offset; }; // Function
  1405. }
  1406. });
  1407. });
  1408. },
  1409. 'dojox/charting/plot2d/Candlesticks':function(){
  1410. define("dojox/charting/plot2d/Candlesticks", ["dojo/_base/lang", "dojo/_base/declare", "dojo/_base/array", "./Base", "./common",
  1411. "dojox/lang/functional", "dojox/lang/functional/reversed", "dojox/lang/utils", "dojox/gfx/fx"],
  1412. function(lang, declare, arr, Base, dc, df, dfr, du, fx){
  1413. /*=====
  1414. var Base = dojox.charting.plot2d.Base;
  1415. =====*/
  1416. var purgeGroup = dfr.lambda("item.purgeGroup()");
  1417. // Candlesticks are based on the Bars plot type; we expect the following passed
  1418. // as values in a series:
  1419. // { x?, open, close, high, low, mid? }
  1420. // if x is not provided, the array index is used.
  1421. // failing to provide the OHLC values will throw an error.
  1422. return declare("dojox.charting.plot2d.Candlesticks", Base, {
  1423. // summary:
  1424. // A plot that represents typical candlesticks (financial reporting, primarily).
  1425. // Unlike most charts, the Candlestick expects data points to be represented by
  1426. // an object of the form { x?, open, close, high, low, mid? }, where both
  1427. // x and mid are optional parameters. If x is not provided, the index of the
  1428. // data array is used.
  1429. defaultParams: {
  1430. hAxis: "x", // use a horizontal axis named "x"
  1431. vAxis: "y", // use a vertical axis named "y"
  1432. gap: 2, // gap between columns in pixels
  1433. animate: null // animate bars into place
  1434. },
  1435. optionalParams: {
  1436. minBarSize: 1, // minimal candle width in pixels
  1437. maxBarSize: 1, // maximal candle width in pixels
  1438. // theme component
  1439. stroke: {},
  1440. outline: {},
  1441. shadow: {},
  1442. fill: {},
  1443. font: "",
  1444. fontColor: ""
  1445. },
  1446. constructor: function(chart, kwArgs){
  1447. // summary:
  1448. // The constructor for a candlestick chart.
  1449. // chart: dojox.charting.Chart
  1450. // The chart this plot belongs to.
  1451. // kwArgs: dojox.charting.plot2d.__BarCtorArgs?
  1452. // An optional keyword arguments object to help define the plot.
  1453. this.opt = lang.clone(this.defaultParams);
  1454. du.updateWithObject(this.opt, kwArgs);
  1455. du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
  1456. this.series = [];
  1457. this.hAxis = this.opt.hAxis;
  1458. this.vAxis = this.opt.vAxis;
  1459. this.animate = this.opt.animate;
  1460. },
  1461. collectStats: function(series){
  1462. // summary:
  1463. // Collect all statistics for drawing this chart. Since the common
  1464. // functionality only assumes x and y, Candlesticks must create it's own
  1465. // stats (since data has no y value, but open/close/high/low instead).
  1466. // series: dojox.charting.Series[]
  1467. // The data series array to be drawn on this plot.
  1468. // returns: Object
  1469. // Returns an object in the form of { hmin, hmax, vmin, vmax }.
  1470. // we have to roll our own, since we need to use all four passed
  1471. // values to figure out our stats, and common only assumes x and y.
  1472. var stats = lang.delegate(dc.defaultStats);
  1473. for(var i=0; i<series.length; i++){
  1474. var run = series[i];
  1475. if(!run.data.length){ continue; }
  1476. var old_vmin = stats.vmin, old_vmax = stats.vmax;
  1477. if(!("ymin" in run) || !("ymax" in run)){
  1478. arr.forEach(run.data, function(val, idx){
  1479. if(val !== null){
  1480. var x = val.x || idx + 1;
  1481. stats.hmin = Math.min(stats.hmin, x);
  1482. stats.hmax = Math.max(stats.hmax, x);
  1483. stats.vmin = Math.min(stats.vmin, val.open, val.close, val.high, val.low);
  1484. stats.vmax = Math.max(stats.vmax, val.open, val.close, val.high, val.low);
  1485. }
  1486. });
  1487. }
  1488. if("ymin" in run){ stats.vmin = Math.min(old_vmin, run.ymin); }
  1489. if("ymax" in run){ stats.vmax = Math.max(old_vmax, run.ymax); }
  1490. }
  1491. return stats; // Object
  1492. },
  1493. getSeriesStats: function(){
  1494. // summary:
  1495. // Calculate the min/max on all attached series in both directions.
  1496. // returns: Object
  1497. // {hmin, hmax, vmin, vmax} min/max in both directions.
  1498. var stats = this.collectStats(this.series);
  1499. stats.hmin -= 0.5;
  1500. stats.hmax += 0.5;
  1501. return stats;
  1502. },
  1503. render: function(dim, offsets){
  1504. // summary:
  1505. // Run the calculations for any axes for this plot.
  1506. // dim: Object
  1507. // An object in the form of { width, height }
  1508. // offsets: Object
  1509. // An object of the form { l, r, t, b}.
  1510. // returns: dojox.charting.plot2d.Candlesticks
  1511. // A reference to this plot for functional chaining.
  1512. if(this.zoom && !this.isDataDirty()){
  1513. return this.performZoom(dim, offsets);
  1514. }
  1515. this.resetEvents();
  1516. this.dirty = this.isDirty();
  1517. if(this.dirty){
  1518. arr.forEach(this.series, purgeGroup);
  1519. this._eventSeries = {};
  1520. this.cleanGroup();
  1521. var s = this.group;
  1522. df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
  1523. }
  1524. var t = this.chart.theme, f, gap, width,
  1525. ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
  1526. vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
  1527. baseline = Math.max(0, this._vScaler.bounds.lower),
  1528. baselineHeight = vt(baseline),
  1529. events = this.events();
  1530. f = dc.calculateBarSize(this._hScaler.bounds.scale, this.opt);
  1531. gap = f.gap;
  1532. width = f.size;
  1533. for(var i = this.series.length - 1; i >= 0; --i){
  1534. var run = this.series[i];
  1535. if(!this.dirty && !run.dirty){
  1536. t.skip();
  1537. this._reconnectEvents(run.name);
  1538. continue;
  1539. }
  1540. run.cleanGroup();
  1541. var theme = t.next("candlestick", [this.opt, run]), s = run.group,
  1542. eventSeries = new Array(run.data.length);
  1543. for(var j = 0; j < run.data.length; ++j){
  1544. var v = run.data[j];
  1545. if(v !== null){
  1546. var finalTheme = t.addMixin(theme, "candlestick", v, true);
  1547. // calculate the points we need for OHLC
  1548. var x = ht(v.x || (j+0.5)) + offsets.l + gap,
  1549. y = dim.height - offsets.b,
  1550. open = vt(v.open),
  1551. close = vt(v.close),
  1552. high = vt(v.high),
  1553. low = vt(v.low);
  1554. if("mid" in v){
  1555. var mid = vt(v.mid);
  1556. }
  1557. if(low > high){
  1558. var tmp = high;
  1559. high = low;
  1560. low = tmp;
  1561. }
  1562. if(width >= 1){
  1563. // draw the line and rect, set up as a group and pass that to the events.
  1564. var doFill = open > close;
  1565. var line = { x1: width/2, x2: width/2, y1: y - high, y2: y - low },
  1566. rect = {
  1567. x: 0, y: y-Math.max(open, close),
  1568. width: width, height: Math.max(doFill ? open-close : close-open, 1)
  1569. };
  1570. var shape = s.createGroup();
  1571. shape.setTransform({dx: x, dy: 0 });
  1572. var inner = shape.createGroup();
  1573. inner.createLine(line).setStroke(finalTheme.series.stroke);
  1574. inner.createRect(rect).setStroke(finalTheme.series.stroke).
  1575. setFill(doFill ? finalTheme.series.fill : "white");
  1576. if("mid" in v){
  1577. // add the mid line.
  1578. inner.createLine({
  1579. x1: (finalTheme.series.stroke.width||1), x2: width - (finalTheme.series.stroke.width || 1),
  1580. y1: y - mid, y2: y - mid
  1581. }).setStroke(doFill ? "white" : finalTheme.series.stroke);
  1582. }
  1583. // TODO: double check this.
  1584. run.dyn.fill = finalTheme.series.fill;
  1585. run.dyn.stroke = finalTheme.series.stroke;
  1586. if(events){
  1587. var o = {
  1588. element: "candlestick",
  1589. index: j,
  1590. run: run,
  1591. shape: inner,
  1592. x: x,
  1593. y: y-Math.max(open, close),
  1594. cx: width/2,
  1595. cy: (y-Math.max(open, close)) + (Math.max(doFill ? open-close : close-open, 1)/2),
  1596. width: width,
  1597. height: Math.max(doFill ? open-close : close-open, 1),
  1598. data: v
  1599. };
  1600. this._connectEvents(o);
  1601. eventSeries[j] = o;
  1602. }
  1603. }
  1604. if(this.animate){
  1605. this._animateCandlesticks(shape, y - low, high - low);
  1606. }
  1607. }
  1608. }
  1609. this._eventSeries[run.name] = eventSeries;
  1610. run.dirty = false;
  1611. }
  1612. this.dirty = false;
  1613. return this; // dojox.charting.plot2d.Candlesticks
  1614. },
  1615. _animateCandlesticks: function(shape, voffset, vsize){
  1616. fx.animateTransform(lang.delegate({
  1617. shape: shape,
  1618. duration: 1200,
  1619. transform: [
  1620. {name: "translate", start: [0, voffset - (voffset/vsize)], end: [0, 0]},
  1621. {name: "scale", start: [1, 1/vsize], end: [1, 1]},
  1622. {name: "original"}
  1623. ]
  1624. }, this.animate)).play();
  1625. }
  1626. });
  1627. });
  1628. },
  1629. 'dojox/charting/widget/Sparkline':function(){
  1630. define("dojox/charting/widget/Sparkline", ["dojo/_base/lang", "dojo/_base/array", "dojo/_base/declare", "dojo/_base/html", "dojo/query",
  1631. "./Chart", "../themes/GreySkies", "../plot2d/Lines", "dojo/dom-prop"],
  1632. function(lang, arrayUtil, declare, html, query, Chart, GreySkies, Lines, domProp){
  1633. /*=====
  1634. var Chart = dojox.charting.widget.Chart;
  1635. =====*/
  1636. declare("dojox.charting.widget.Sparkline", Chart, {
  1637. theme: GreySkies,
  1638. margins: { l: 0, r: 0, t: 0, b: 0 },
  1639. type: "Lines",
  1640. valueFn: "Number(x)",
  1641. store: "",
  1642. field: "",
  1643. query: "",
  1644. queryOptions: "",
  1645. start: "0",
  1646. count: "Infinity",
  1647. sort: "",
  1648. data: "",
  1649. name: "default",
  1650. buildRendering: function(){
  1651. var n = this.srcNodeRef;
  1652. if( !n.childNodes.length || // shortcut the query
  1653. !query("> .axis, > .plot, > .action, > .series", n).length){
  1654. var plot = document.createElement("div");
  1655. domProp.set(plot, {
  1656. "class": "plot",
  1657. "name": "default",
  1658. "type": this.type
  1659. });
  1660. n.appendChild(plot);
  1661. var series = document.createElement("div");
  1662. domProp.set(series, {
  1663. "class": "series",
  1664. plot: "default",
  1665. name: this.name,
  1666. start: this.start,
  1667. count: this.count,
  1668. valueFn: this.valueFn
  1669. });
  1670. arrayUtil.forEach(
  1671. ["store", "field", "query", "queryOptions", "sort", "data"],
  1672. function(i){
  1673. if(this[i].length){
  1674. domProp.set(series, i, this[i]);
  1675. }
  1676. },
  1677. this
  1678. );
  1679. n.appendChild(series);
  1680. }
  1681. this.inherited(arguments);
  1682. }
  1683. }
  1684. );
  1685. });
  1686. },
  1687. 'dojox/gfx/matrix':function(){
  1688. define("dojox/gfx/matrix", ["./_base","dojo/_base/lang"],
  1689. function(g, lang){
  1690. var m = g.matrix = {};
  1691. /*===== g = dojox.gfx; m = dojox.gfx.matrix =====*/
  1692. // candidates for dojox.math:
  1693. var _degToRadCache = {};
  1694. m._degToRad = function(degree){
  1695. return _degToRadCache[degree] || (_degToRadCache[degree] = (Math.PI * degree / 180));
  1696. };
  1697. m._radToDeg = function(radian){ return radian / Math.PI * 180; };
  1698. m.Matrix2D = function(arg){
  1699. // summary:
  1700. // a 2D matrix object
  1701. // description: Normalizes a 2D matrix-like object. If arrays is passed,
  1702. // all objects of the array are normalized and multiplied sequentially.
  1703. // arg: Object
  1704. // a 2D matrix-like object, a number, or an array of such objects
  1705. if(arg){
  1706. if(typeof arg == "number"){
  1707. this.xx = this.yy = arg;
  1708. }else if(arg instanceof Array){
  1709. if(arg.length > 0){
  1710. var matrix = m.normalize(arg[0]);
  1711. // combine matrices
  1712. for(var i = 1; i < arg.length; ++i){
  1713. var l = matrix, r = m.normalize(arg[i]);
  1714. matrix = new m.Matrix2D();
  1715. matrix.xx = l.xx * r.xx + l.xy * r.yx;
  1716. matrix.xy = l.xx * r.xy + l.xy * r.yy;
  1717. matrix.yx = l.yx * r.xx + l.yy * r.yx;
  1718. matrix.yy = l.yx * r.xy + l.yy * r.yy;
  1719. matrix.dx = l.xx * r.dx + l.xy * r.dy + l.dx;
  1720. matrix.dy = l.yx * r.dx + l.yy * r.dy + l.dy;
  1721. }
  1722. lang.mixin(this, matrix);
  1723. }
  1724. }else{
  1725. lang.mixin(this, arg);
  1726. }
  1727. }
  1728. };
  1729. // the default (identity) matrix, which is used to fill in missing values
  1730. lang.extend(m.Matrix2D, {xx: 1, xy: 0, yx: 0, yy: 1, dx: 0, dy: 0});
  1731. lang.mixin(m, {
  1732. // summary: class constants, and methods of dojox.gfx.matrix
  1733. // matrix constants
  1734. // identity: dojox.gfx.matrix.Matrix2D
  1735. // an identity matrix constant: identity * (x, y) == (x, y)
  1736. identity: new m.Matrix2D(),
  1737. // flipX: dojox.gfx.matrix.Matrix2D
  1738. // a matrix, which reflects points at x = 0 line: flipX * (x, y) == (-x, y)
  1739. flipX: new m.Matrix2D({xx: -1}),
  1740. // flipY: dojox.gfx.matrix.Matrix2D
  1741. // a matrix, which reflects points at y = 0 line: flipY * (x, y) == (x, -y)
  1742. flipY: new m.Matrix2D({yy: -1}),
  1743. // flipXY: dojox.gfx.matrix.Matrix2D
  1744. // a matrix, which reflects points at the origin of coordinates: flipXY * (x, y) == (-x, -y)
  1745. flipXY: new m.Matrix2D({xx: -1, yy: -1}),
  1746. // matrix creators
  1747. translate: function(a, b){
  1748. // summary: forms a translation matrix
  1749. // description: The resulting matrix is used to translate (move) points by specified offsets.
  1750. // a: Number: an x coordinate value
  1751. // b: Number: a y coordinate value
  1752. if(arguments.length > 1){
  1753. return new m.Matrix2D({dx: a, dy: b}); // dojox.gfx.matrix.Matrix2D
  1754. }
  1755. // branch
  1756. // a: dojox.gfx.Point: a point-like object, which specifies offsets for both dimensions
  1757. // b: null
  1758. return new m.Matrix2D({dx: a.x, dy: a.y}); // dojox.gfx.matrix.Matrix2D
  1759. },
  1760. scale: function(a, b){
  1761. // summary: forms a scaling matrix
  1762. // description: The resulting matrix is used to scale (magnify) points by specified offsets.
  1763. // a: Number: a scaling factor used for the x coordinate
  1764. // b: Number: a scaling factor used for the y coordinate
  1765. if(arguments.length > 1){
  1766. return new m.Matrix2D({xx: a, yy: b}); // dojox.gfx.matrix.Matrix2D
  1767. }
  1768. if(typeof a == "number"){
  1769. // branch
  1770. // a: Number: a uniform scaling factor used for the both coordinates
  1771. // b: null
  1772. return new m.Matrix2D({xx: a, yy: a}); // dojox.gfx.matrix.Matrix2D
  1773. }
  1774. // branch
  1775. // a: dojox.gfx.Point: a point-like object, which specifies scale factors for both dimensions
  1776. // b: null
  1777. return new m.Matrix2D({xx: a.x, yy: a.y}); // dojox.gfx.matrix.Matrix2D
  1778. },
  1779. rotate: function(angle){
  1780. // summary: forms a rotating matrix
  1781. // description: The resulting matrix is used to rotate points
  1782. // around the origin of coordinates (0, 0) by specified angle.
  1783. // angle: Number: an angle of rotation in radians (>0 for CW)
  1784. var c = Math.cos(angle);
  1785. var s = Math.sin(angle);
  1786. return new m.Matrix2D({xx: c, xy: -s, yx: s, yy: c}); // dojox.gfx.matrix.Matrix2D
  1787. },
  1788. rotateg: function(degree){
  1789. // summary: forms a rotating matrix
  1790. // description: The resulting matrix is used to rotate points
  1791. // around the origin of coordinates (0, 0) by specified degree.
  1792. // See dojox.gfx.matrix.rotate() for comparison.
  1793. // degree: Number: an angle of rotation in degrees (>0 for CW)
  1794. return m.rotate(m._degToRad(degree)); // dojox.gfx.matrix.Matrix2D
  1795. },
  1796. skewX: function(angle) {
  1797. // summary: forms an x skewing matrix
  1798. // description: The resulting matrix is used to skew points in the x dimension
  1799. // around the origin of coordinates (0, 0) by specified angle.
  1800. // angle: Number: an skewing angle in radians
  1801. return new m.Matrix2D({xy: Math.tan(angle)}); // dojox.gfx.matrix.Matrix2D
  1802. },
  1803. skewXg: function(degree){
  1804. // summary: forms an x skewing matrix
  1805. // description: The resulting matrix is used to skew points in the x dimension
  1806. // around the origin of coordinates (0, 0) by specified degree.
  1807. // See dojox.gfx.matrix.skewX() for comparison.
  1808. // degree: Number: an skewing angle in degrees
  1809. return m.skewX(m._degToRad(degree)); // dojox.gfx.matrix.Matrix2D
  1810. },
  1811. skewY: function(angle){
  1812. // summary: forms a y skewing matrix
  1813. // description: The resulting matrix is used to skew points in the y dimension
  1814. // around the origin of coordinates (0, 0) by specified angle.
  1815. // angle: Number: an skewing angle in radians
  1816. return new m.Matrix2D({yx: Math.tan(angle)}); // dojox.gfx.matrix.Matrix2D
  1817. },
  1818. skewYg: function(degree){
  1819. // summary: forms a y skewing matrix
  1820. // description: The resulting matrix is used to skew points in the y dimension
  1821. // around the origin of coordinates (0, 0) by specified degree.
  1822. // See dojox.gfx.matrix.skewY() for comparison.
  1823. // degree: Number: an skewing angle in degrees
  1824. return m.skewY(m._degToRad(degree)); // dojox.gfx.matrix.Matrix2D
  1825. },
  1826. reflect: function(a, b){
  1827. // summary: forms a reflection matrix
  1828. // description: The resulting matrix is used to reflect points around a vector,
  1829. // which goes through the origin.
  1830. // a: dojox.gfx.Point: a point-like object, which specifies a vector of reflection
  1831. // b: null
  1832. if(arguments.length == 1){
  1833. b = a.y;
  1834. a = a.x;
  1835. }
  1836. // branch
  1837. // a: Number: an x coordinate value
  1838. // b: Number: a y coordinate value
  1839. // make a unit vector
  1840. var a2 = a * a, b2 = b * b, n2 = a2 + b2, xy = 2 * a * b / n2;
  1841. return new m.Matrix2D({xx: 2 * a2 / n2 - 1, xy: xy, yx: xy, yy: 2 * b2 / n2 - 1}); // dojox.gfx.matrix.Matrix2D
  1842. },
  1843. project: function(a, b){
  1844. // summary: forms an orthogonal projection matrix
  1845. // description: The resulting matrix is used to project points orthogonally on a vector,
  1846. // which goes through the origin.
  1847. // a: dojox.gfx.Point: a point-like object, which specifies a vector of projection
  1848. // b: null
  1849. if(arguments.length == 1){
  1850. b = a.y;
  1851. a = a.x;
  1852. }
  1853. // branch
  1854. // a: Number: an x coordinate value
  1855. // b: Number: a y coordinate value
  1856. // make a unit vector
  1857. var a2 = a * a, b2 = b * b, n2 = a2 + b2, xy = a * b / n2;
  1858. return new m.Matrix2D({xx: a2 / n2, xy: xy, yx: xy, yy: b2 / n2}); // dojox.gfx.matrix.Matrix2D
  1859. },
  1860. // ensure matrix 2D conformance
  1861. normalize: function(matrix){
  1862. // summary: converts an object to a matrix, if necessary
  1863. // description: Converts any 2D matrix-like object or an array of
  1864. // such objects to a valid dojox.gfx.matrix.Matrix2D object.
  1865. // matrix: Object: an object, which is converted to a matrix, if necessary
  1866. return (matrix instanceof m.Matrix2D) ? matrix : new m.Matrix2D(matrix); // dojox.gfx.matrix.Matrix2D
  1867. },
  1868. // common operations
  1869. clone: function(matrix){
  1870. // summary: creates a copy of a 2D matrix
  1871. // matrix: dojox.gfx.matrix.Matrix2D: a 2D matrix-like object to be cloned
  1872. var obj = new m.Matrix2D();
  1873. for(var i in matrix){
  1874. if(typeof(matrix[i]) == "number" && typeof(obj[i]) == "number" && obj[i] != matrix[i]) obj[i] = matrix[i];
  1875. }
  1876. return obj; // dojox.gfx.matrix.Matrix2D
  1877. },
  1878. invert: function(matrix){
  1879. // summary: inverts a 2D matrix
  1880. // matrix: dojox.gfx.matrix.Matrix2D: a 2D matrix-like object to be inverted
  1881. var M = m.normalize(matrix),
  1882. D = M.xx * M.yy - M.xy * M.yx;
  1883. M = new m.Matrix2D({
  1884. xx: M.yy/D, xy: -M.xy/D,
  1885. yx: -M.yx/D, yy: M.xx/D,
  1886. dx: (M.xy * M.dy - M.yy * M.dx) / D,
  1887. dy: (M.yx * M.dx - M.xx * M.dy) / D
  1888. });
  1889. return M; // dojox.gfx.matrix.Matrix2D
  1890. },
  1891. _multiplyPoint: function(matrix, x, y){
  1892. // summary: applies a matrix to a point
  1893. // matrix: dojox.gfx.matrix.Matrix2D: a 2D matrix object to be applied
  1894. // x: Number: an x coordinate of a point
  1895. // y: Number: a y coordinate of a point
  1896. return {x: matrix.xx * x + matrix.xy * y + matrix.dx, y: matrix.yx * x + matrix.yy * y + matrix.dy}; // dojox.gfx.Point
  1897. },
  1898. multiplyPoint: function(matrix, /* Number||Point */ a, /* Number? */ b){
  1899. // summary: applies a matrix to a point
  1900. // matrix: dojox.gfx.matrix.Matrix2D: a 2D matrix object to be applied
  1901. // a: Number: an x coordinate of a point
  1902. // b: Number?: a y coordinate of a point
  1903. var M = m.normalize(matrix);
  1904. if(typeof a == "number" && typeof b == "number"){
  1905. return m._multiplyPoint(M, a, b); // dojox.gfx.Point
  1906. }
  1907. // branch
  1908. // matrix: dojox.gfx.matrix.Matrix2D: a 2D matrix object to be applied
  1909. // a: dojox.gfx.Point: a point
  1910. // b: null
  1911. return m._multiplyPoint(M, a.x, a.y); // dojox.gfx.Point
  1912. },
  1913. multiply: function(matrix){
  1914. // summary: combines matrices by multiplying them sequentially in the given order
  1915. // matrix: dojox.gfx.matrix.Matrix2D...: a 2D matrix-like object,
  1916. // all subsequent arguments are matrix-like objects too
  1917. var M = m.normalize(matrix);
  1918. // combine matrices
  1919. for(var i = 1; i < arguments.length; ++i){
  1920. var l = M, r = m.normalize(arguments[i]);
  1921. M = new m.Matrix2D();
  1922. M.xx = l.xx * r.xx + l.xy * r.yx;
  1923. M.xy = l.xx * r.xy + l.xy * r.yy;
  1924. M.yx = l.yx * r.xx + l.yy * r.yx;
  1925. M.yy = l.yx * r.xy + l.yy * r.yy;
  1926. M.dx = l.xx * r.dx + l.xy * r.dy + l.dx;
  1927. M.dy = l.yx * r.dx + l.yy * r.dy + l.dy;
  1928. }
  1929. return M; // dojox.gfx.matrix.Matrix2D
  1930. },
  1931. // high level operations
  1932. _sandwich: function(matrix, x, y){
  1933. // summary: applies a matrix at a centrtal point
  1934. // matrix: dojox.gfx.matrix.Matrix2D: a 2D matrix-like object, which is applied at a central point
  1935. // x: Number: an x component of the central point
  1936. // y: Number: a y component of the central point
  1937. return m.multiply(m.translate(x, y), matrix, m.translate(-x, -y)); // dojox.gfx.matrix.Matrix2D
  1938. },
  1939. scaleAt: function(a, b, c, d){
  1940. // summary: scales a picture using a specified point as a center of scaling
  1941. // description: Compare with dojox.gfx.matrix.scale().
  1942. // a: Number: a scaling factor used for the x coordinate
  1943. // b: Number: a scaling factor used for the y coordinate
  1944. // c: Number: an x component of a central point
  1945. // d: Number: a y component of a central point
  1946. // accepts several signatures:
  1947. // 1) uniform scale factor, Point
  1948. // 2) uniform scale factor, x, y
  1949. // 3) x scale, y scale, Point
  1950. // 4) x scale, y scale, x, y
  1951. switch(arguments.length){
  1952. case 4:
  1953. // a and b are scale factor components, c and d are components of a point
  1954. return m._sandwich(m.scale(a, b), c, d); // dojox.gfx.matrix.Matrix2D
  1955. case 3:
  1956. if(typeof c == "number"){
  1957. // branch
  1958. // a: Number: a uniform scaling factor used for both coordinates
  1959. // b: Number: an x component of a central point
  1960. // c: Number: a y component of a central point
  1961. // d: null
  1962. return m._sandwich(m.scale(a), b, c); // dojox.gfx.matrix.Matrix2D
  1963. }
  1964. // branch
  1965. // a: Number: a scaling factor used for the x coordinate
  1966. // b: Number: a scaling factor used for the y coordinate
  1967. // c: dojox.gfx.Point: a central point
  1968. // d: null
  1969. return m._sandwich(m.scale(a, b), c.x, c.y); // dojox.gfx.matrix.Matrix2D
  1970. }
  1971. // branch
  1972. // a: Number: a uniform scaling factor used for both coordinates
  1973. // b: dojox.gfx.Point: a central point
  1974. // c: null
  1975. // d: null
  1976. return m._sandwich(m.scale(a), b.x, b.y); // dojox.gfx.matrix.Matrix2D
  1977. },
  1978. rotateAt: function(angle, a, b){
  1979. // summary: rotates a picture using a specified point as a center of rotation
  1980. // description: Compare with dojox.gfx.matrix.rotate().
  1981. // angle: Number: an angle of rotation in radians (>0 for CW)
  1982. // a: Number: an x component of a central point
  1983. // b: Number: a y component of a central point
  1984. // accepts several signatures:
  1985. // 1) rotation angle in radians, Point
  1986. // 2) rotation angle in radians, x, y
  1987. if(arguments.length > 2){
  1988. return m._sandwich(m.rotate(angle), a, b); // dojox.gfx.matrix.Matrix2D
  1989. }
  1990. // branch
  1991. // angle: Number: an angle of rotation in radians (>0 for CCW)
  1992. // a: dojox.gfx.Point: a central point
  1993. // b: null
  1994. return m._sandwich(m.rotate(angle), a.x, a.y); // dojox.gfx.matrix.Matrix2D
  1995. },
  1996. rotategAt: function(degree, a, b){
  1997. // summary: rotates a picture using a specified point as a center of rotation
  1998. // description: Compare with dojox.gfx.matrix.rotateg().
  1999. // degree: Number: an angle of rotation in degrees (>0 for CW)
  2000. // a: Number: an x component of a central point
  2001. // b: Number: a y component of a central point
  2002. // accepts several signatures:
  2003. // 1) rotation angle in degrees, Point
  2004. // 2) rotation angle in degrees, x, y
  2005. if(arguments.length > 2){
  2006. return m._sandwich(m.rotateg(degree), a, b); // dojox.gfx.matrix.Matrix2D
  2007. }
  2008. // branch
  2009. // degree: Number: an angle of rotation in degrees (>0 for CCW)
  2010. // a: dojox.gfx.Point: a central point
  2011. // b: null
  2012. return m._sandwich(m.rotateg(degree), a.x, a.y); // dojox.gfx.matrix.Matrix2D
  2013. },
  2014. skewXAt: function(angle, a, b){
  2015. // summary: skews a picture along the x axis using a specified point as a center of skewing
  2016. // description: Compare with dojox.gfx.matrix.skewX().
  2017. // angle: Number: an skewing angle in radians
  2018. // a: Number: an x component of a central point
  2019. // b: Number: a y component of a central point
  2020. // accepts several signatures:
  2021. // 1) skew angle in radians, Point
  2022. // 2) skew angle in radians, x, y
  2023. if(arguments.length > 2){
  2024. return m._sandwich(m.skewX(angle), a, b); // dojox.gfx.matrix.Matrix2D
  2025. }
  2026. // branch
  2027. // angle: Number: an skewing angle in radians
  2028. // a: dojox.gfx.Point: a central point
  2029. // b: null
  2030. return m._sandwich(m.skewX(angle), a.x, a.y); // dojox.gfx.matrix.Matrix2D
  2031. },
  2032. skewXgAt: function(degree, a, b){
  2033. // summary: skews a picture along the x axis using a specified point as a center of skewing
  2034. // description: Compare with dojox.gfx.matrix.skewXg().
  2035. // degree: Number: an skewing angle in degrees
  2036. // a: Number: an x component of a central point
  2037. // b: Number: a y component of a central point
  2038. // accepts several signatures:
  2039. // 1) skew angle in degrees, Point
  2040. // 2) skew angle in degrees, x, y
  2041. if(arguments.length > 2){
  2042. return m._sandwich(m.skewXg(degree), a, b); // dojox.gfx.matrix.Matrix2D
  2043. }
  2044. // branch
  2045. // degree: Number: an skewing angle in degrees
  2046. // a: dojox.gfx.Point: a central point
  2047. // b: null
  2048. return m._sandwich(m.skewXg(degree), a.x, a.y); // dojox.gfx.matrix.Matrix2D
  2049. },
  2050. skewYAt: function(angle, a, b){
  2051. // summary: skews a picture along the y axis using a specified point as a center of skewing
  2052. // description: Compare with dojox.gfx.matrix.skewY().
  2053. // angle: Number: an skewing angle in radians
  2054. // a: Number: an x component of a central point
  2055. // b: Number: a y component of a central point
  2056. // accepts several signatures:
  2057. // 1) skew angle in radians, Point
  2058. // 2) skew angle in radians, x, y
  2059. if(arguments.length > 2){
  2060. return m._sandwich(m.skewY(angle), a, b); // dojox.gfx.matrix.Matrix2D
  2061. }
  2062. // branch
  2063. // angle: Number: an skewing angle in radians
  2064. // a: dojox.gfx.Point: a central point
  2065. // b: null
  2066. return m._sandwich(m.skewY(angle), a.x, a.y); // dojox.gfx.matrix.Matrix2D
  2067. },
  2068. skewYgAt: function(/* Number */ degree, /* Number||Point */ a, /* Number? */ b){
  2069. // summary: skews a picture along the y axis using a specified point as a center of skewing
  2070. // description: Compare with dojox.gfx.matrix.skewYg().
  2071. // degree: Number: an skewing angle in degrees
  2072. // a: Number: an x component of a central point
  2073. // b: Number?: a y component of a central point
  2074. // accepts several signatures:
  2075. // 1) skew angle in degrees, Point
  2076. // 2) skew angle in degrees, x, y
  2077. if(arguments.length > 2){
  2078. return m._sandwich(m.skewYg(degree), a, b); // dojox.gfx.matrix.Matrix2D
  2079. }
  2080. // branch
  2081. // degree: Number: an skewing angle in degrees
  2082. // a: dojox.gfx.Point: a central point
  2083. // b: null
  2084. return m._sandwich(m.skewYg(degree), a.x, a.y); // dojox.gfx.matrix.Matrix2D
  2085. }
  2086. //TODO: rect-to-rect mapping, scale-to-fit (isotropic and anisotropic versions)
  2087. });
  2088. // propagate Matrix2D up
  2089. g.Matrix2D = m.Matrix2D;
  2090. return m;
  2091. });
  2092. },
  2093. 'dojox/charting/plot2d/Scatter':function(){
  2094. define("dojox/charting/plot2d/Scatter", ["dojo/_base/lang", "dojo/_base/array", "dojo/_base/declare", "./Base", "./common",
  2095. "dojox/lang/functional", "dojox/lang/functional/reversed", "dojox/lang/utils", "dojox/gfx/fx", "dojox/gfx/gradutils"],
  2096. function(lang, arr, declare, Base, dc, df, dfr, du, fx, gradutils){
  2097. /*=====
  2098. var Base = dojox.charting.plot2d.Base;
  2099. =====*/
  2100. var purgeGroup = dfr.lambda("item.purgeGroup()");
  2101. return declare("dojox.charting.plot2d.Scatter", Base, {
  2102. // summary:
  2103. // A plot object representing a typical scatter chart.
  2104. defaultParams: {
  2105. hAxis: "x", // use a horizontal axis named "x"
  2106. vAxis: "y", // use a vertical axis named "y"
  2107. shadows: null, // draw shadows
  2108. animate: null // animate chart to place
  2109. },
  2110. optionalParams: {
  2111. // theme component
  2112. markerStroke: {},
  2113. markerOutline: {},
  2114. markerShadow: {},
  2115. markerFill: {},
  2116. markerFont: "",
  2117. markerFontColor: ""
  2118. },
  2119. constructor: function(chart, kwArgs){
  2120. // summary:
  2121. // Create the scatter plot.
  2122. // chart: dojox.charting.Chart
  2123. // The chart this plot belongs to.
  2124. // kwArgs: dojox.charting.plot2d.__DefaultCtorArgs?
  2125. // An optional keyword arguments object to help define this plot's parameters.
  2126. this.opt = lang.clone(this.defaultParams);
  2127. du.updateWithObject(this.opt, kwArgs);
  2128. du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
  2129. this.series = [];
  2130. this.hAxis = this.opt.hAxis;
  2131. this.vAxis = this.opt.vAxis;
  2132. this.animate = this.opt.animate;
  2133. },
  2134. render: function(dim, offsets){
  2135. // summary:
  2136. // Run the calculations for any axes for this plot.
  2137. // dim: Object
  2138. // An object in the form of { width, height }
  2139. // offsets: Object
  2140. // An object of the form { l, r, t, b}.
  2141. // returns: dojox.charting.plot2d.Scatter
  2142. // A reference to this plot for functional chaining.
  2143. if(this.zoom && !this.isDataDirty()){
  2144. return this.performZoom(dim, offsets);
  2145. }
  2146. this.resetEvents();
  2147. this.dirty = this.isDirty();
  2148. if(this.dirty){
  2149. arr.forEach(this.series, purgeGroup);
  2150. this._eventSeries = {};
  2151. this.cleanGroup();
  2152. var s = this.group;
  2153. df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
  2154. }
  2155. var t = this.chart.theme, events = this.events();
  2156. for(var i = this.series.length - 1; i >= 0; --i){
  2157. var run = this.series[i];
  2158. if(!this.dirty && !run.dirty){
  2159. t.skip();
  2160. this._reconnectEvents(run.name);
  2161. continue;
  2162. }
  2163. run.cleanGroup();
  2164. if(!run.data.length){
  2165. run.dirty = false;
  2166. t.skip();
  2167. continue;
  2168. }
  2169. var theme = t.next("marker", [this.opt, run]), s = run.group, lpoly,
  2170. ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
  2171. vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler);
  2172. if(typeof run.data[0] == "number"){
  2173. lpoly = arr.map(run.data, function(v, i){
  2174. return {
  2175. x: ht(i + 1) + offsets.l,
  2176. y: dim.height - offsets.b - vt(v)
  2177. };
  2178. }, this);
  2179. }else{
  2180. lpoly = arr.map(run.data, function(v, i){
  2181. return {
  2182. x: ht(v.x) + offsets.l,
  2183. y: dim.height - offsets.b - vt(v.y)
  2184. };
  2185. }, this);
  2186. }
  2187. var shadowMarkers = new Array(lpoly.length),
  2188. frontMarkers = new Array(lpoly.length),
  2189. outlineMarkers = new Array(lpoly.length);
  2190. arr.forEach(lpoly, function(c, i){
  2191. var finalTheme = typeof run.data[i] == "number" ?
  2192. t.post(theme, "marker") :
  2193. t.addMixin(theme, "marker", run.data[i], true),
  2194. path = "M" + c.x + " " + c.y + " " + finalTheme.symbol;
  2195. if(finalTheme.marker.shadow){
  2196. shadowMarkers[i] = s.createPath("M" + (c.x + finalTheme.marker.shadow.dx) + " " +
  2197. (c.y + finalTheme.marker.shadow.dy) + " " + finalTheme.symbol).
  2198. setStroke(finalTheme.marker.shadow).setFill(finalTheme.marker.shadow.color);
  2199. if(this.animate){
  2200. this._animateScatter(shadowMarkers[i], dim.height - offsets.b);
  2201. }
  2202. }
  2203. if(finalTheme.marker.outline){
  2204. var outline = dc.makeStroke(finalTheme.marker.outline);
  2205. outline.width = 2 * outline.width + finalTheme.marker.stroke.width;
  2206. outlineMarkers[i] = s.createPath(path).setStroke(outline);
  2207. if(this.animate){
  2208. this._animateScatter(outlineMarkers[i], dim.height - offsets.b);
  2209. }
  2210. }
  2211. var stroke = dc.makeStroke(finalTheme.marker.stroke),
  2212. fill = this._plotFill(finalTheme.marker.fill, dim, offsets);
  2213. if(fill && (fill.type === "linear" || fill.type == "radial")){
  2214. var color = gradutils.getColor(fill, {x: c.x, y: c.y});
  2215. if(stroke){
  2216. stroke.color = color;
  2217. }
  2218. frontMarkers[i] = s.createPath(path).setStroke(stroke).setFill(color);
  2219. }else{
  2220. frontMarkers[i] = s.createPath(path).setStroke(stroke).setFill(fill);
  2221. }
  2222. if(this.animate){
  2223. this._animateScatter(frontMarkers[i], dim.height - offsets.b);
  2224. }
  2225. }, this);
  2226. if(frontMarkers.length){
  2227. run.dyn.stroke = frontMarkers[frontMarkers.length - 1].getStroke();
  2228. run.dyn.fill = frontMarkers[frontMarkers.length - 1].getFill();
  2229. }
  2230. if(events){
  2231. var eventSeries = new Array(frontMarkers.length);
  2232. arr.forEach(frontMarkers, function(s, i){
  2233. var o = {
  2234. element: "marker",
  2235. index: i,
  2236. run: run,
  2237. shape: s,
  2238. outline: outlineMarkers && outlineMarkers[i] || null,
  2239. shadow: shadowMarkers && shadowMarkers[i] || null,
  2240. cx: lpoly[i].x,
  2241. cy: lpoly[i].y
  2242. };
  2243. if(typeof run.data[0] == "number"){
  2244. o.x = i + 1;
  2245. o.y = run.data[i];
  2246. }else{
  2247. o.x = run.data[i].x;
  2248. o.y = run.data[i].y;
  2249. }
  2250. this._connectEvents(o);
  2251. eventSeries[i] = o;
  2252. }, this);
  2253. this._eventSeries[run.name] = eventSeries;
  2254. }else{
  2255. delete this._eventSeries[run.name];
  2256. }
  2257. run.dirty = false;
  2258. }
  2259. this.dirty = false;
  2260. return this; // dojox.charting.plot2d.Scatter
  2261. },
  2262. _animateScatter: function(shape, offset){
  2263. fx.animateTransform(lang.delegate({
  2264. shape: shape,
  2265. duration: 1200,
  2266. transform: [
  2267. {name: "translate", start: [0, offset], end: [0, 0]},
  2268. {name: "scale", start: [0, 0], end: [1, 1]},
  2269. {name: "original"}
  2270. ]
  2271. }, this.animate)).play();
  2272. }
  2273. });
  2274. });
  2275. },
  2276. 'dojox/lang/functional/scan':function(){
  2277. define("dojox/lang/functional/scan", ["dojo/_base/kernel", "dojo/_base/lang", "./lambda"], function(d, darray, df){
  2278. // This module adds high-level functions and related constructs:
  2279. // - "scan" family of functions
  2280. // Notes:
  2281. // - missing high-level functions are provided with the compatible API:
  2282. // scanl, scanl1, scanr, scanr1
  2283. // Defined methods:
  2284. // - take any valid lambda argument as the functional argument
  2285. // - operate on dense arrays
  2286. // - take a string as the array argument
  2287. // - take an iterator objects as the array argument (only scanl, and scanl1)
  2288. var empty = {};
  2289. d.mixin(df, {
  2290. // classic reduce-class functions
  2291. scanl: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){
  2292. // summary: repeatedly applies a binary function to an array from left
  2293. // to right using a seed value as a starting point; returns an array
  2294. // of values produced by foldl() at that point.
  2295. if(typeof a == "string"){ a = a.split(""); }
  2296. o = o || d.global; f = df.lambda(f);
  2297. var t, n, i;
  2298. if(d.isArray(a)){
  2299. // array
  2300. t = new Array((n = a.length) + 1);
  2301. t[0] = z;
  2302. for(i = 0; i < n; z = f.call(o, z, a[i], i, a), t[++i] = z);
  2303. }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
  2304. // iterator
  2305. t = [z];
  2306. for(i = 0; a.hasNext(); t.push(z = f.call(o, z, a.next(), i++, a)));
  2307. }else{
  2308. // object/dictionary
  2309. t = [z];
  2310. for(i in a){
  2311. if(!(i in empty)){
  2312. t.push(z = f.call(o, z, a[i], i, a));
  2313. }
  2314. }
  2315. }
  2316. return t; // Array
  2317. },
  2318. scanl1: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
  2319. // summary: repeatedly applies a binary function to an array from left
  2320. // to right; returns an array of values produced by foldl1() at that
  2321. // point.
  2322. if(typeof a == "string"){ a = a.split(""); }
  2323. o = o || d.global; f = df.lambda(f);
  2324. var t, n, z, first = true;
  2325. if(d.isArray(a)){
  2326. // array
  2327. t = new Array(n = a.length);
  2328. t[0] = z = a[0];
  2329. for(var i = 1; i < n; t[i] = z = f.call(o, z, a[i], i, a), ++i);
  2330. }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
  2331. // iterator
  2332. if(a.hasNext()){
  2333. t = [z = a.next()];
  2334. for(i = 1; a.hasNext(); t.push(z = f.call(o, z, a.next(), i++, a)));
  2335. }
  2336. }else{
  2337. // object/dictionary
  2338. for(i in a){
  2339. if(!(i in empty)){
  2340. if(first){
  2341. t = [z = a[i]];
  2342. first = false;
  2343. }else{
  2344. t.push(z = f.call(o, z, a[i], i, a));
  2345. }
  2346. }
  2347. }
  2348. }
  2349. return t; // Array
  2350. },
  2351. scanr: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){
  2352. // summary: repeatedly applies a binary function to an array from right
  2353. // to left using a seed value as a starting point; returns an array
  2354. // of values produced by foldr() at that point.
  2355. if(typeof a == "string"){ a = a.split(""); }
  2356. o = o || d.global; f = df.lambda(f);
  2357. var n = a.length, t = new Array(n + 1), i = n;
  2358. t[n] = z;
  2359. for(; i > 0; --i, z = f.call(o, z, a[i], i, a), t[i] = z);
  2360. return t; // Array
  2361. },
  2362. scanr1: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
  2363. // summary: repeatedly applies a binary function to an array from right
  2364. // to left; returns an array of values produced by foldr1() at that
  2365. // point.
  2366. if(typeof a == "string"){ a = a.split(""); }
  2367. o = o || d.global; f = df.lambda(f);
  2368. var n = a.length, t = new Array(n), z = a[n - 1], i = n - 1;
  2369. t[i] = z;
  2370. for(; i > 0; --i, z = f.call(o, z, a[i], i, a), t[i] = z);
  2371. return t; // Array
  2372. }
  2373. });
  2374. });
  2375. },
  2376. 'dijit/Viewport':function(){
  2377. define("dijit/Viewport", [
  2378. "dojo/Evented",
  2379. "dojo/on",
  2380. "dojo/ready",
  2381. "dojo/_base/sniff",
  2382. "dojo/_base/window", // global
  2383. "dojo/window" // getBox()
  2384. ], function(Evented, on, ready, has, win, winUtils){
  2385. // module:
  2386. // dijit/Viewport
  2387. /*=====
  2388. return {
  2389. // summary:
  2390. // Utility singleton to watch for viewport resizes, avoiding duplicate notifications
  2391. // which can lead to infinite loops.
  2392. // description:
  2393. // Usage: Viewport.on("resize", myCallback).
  2394. //
  2395. // myCallback() is called without arguments in case it's _WidgetBase.resize(),
  2396. // which would interpret the argument as the size to make the widget.
  2397. };
  2398. =====*/
  2399. var Viewport = new Evented();
  2400. var focusedNode;
  2401. ready(200, function(){
  2402. var oldBox = winUtils.getBox();
  2403. Viewport._rlh = on(win.global, "resize", function(){
  2404. var newBox = winUtils.getBox();
  2405. if(oldBox.h == newBox.h && oldBox.w == newBox.w){ return; }
  2406. oldBox = newBox;
  2407. Viewport.emit("resize");
  2408. });
  2409. // Also catch zoom changes on IE8, since they don't naturally generate resize events
  2410. if(has("ie") == 8){
  2411. var deviceXDPI = screen.deviceXDPI;
  2412. setInterval(function(){
  2413. if(screen.deviceXDPI != deviceXDPI){
  2414. deviceXDPI = screen.deviceXDPI;
  2415. Viewport.emit("resize");
  2416. }
  2417. }, 500);
  2418. }
  2419. // On iOS, keep track of the focused node so we can guess when the keyboard is/isn't being displayed.
  2420. if(has("ios")){
  2421. on(document, "focusin", function(evt){
  2422. focusedNode = evt.target;
  2423. });
  2424. on(document, "focusout", function(evt){
  2425. focusedNode = null;
  2426. });
  2427. }
  2428. });
  2429. Viewport.getEffectiveBox = function(/*Document*/ doc){
  2430. // summary:
  2431. // Get the size of the viewport, or on mobile devices, the part of the viewport not obscured by the
  2432. // virtual keyboard.
  2433. var box = winUtils.getBox(doc);
  2434. // Account for iOS virtual keyboard, if it's being shown. Unfortunately no direct way to check or measure.
  2435. var tag = focusedNode && focusedNode.tagName && focusedNode.tagName.toLowerCase();
  2436. if(has("ios") && focusedNode && !focusedNode.readOnly && (tag == "textarea" || (tag == "input" &&
  2437. /^(color|email|number|password|search|tel|text|url)$/.test(focusedNode.type)))){
  2438. // Box represents the size of the viewport. Some of the viewport is likely covered by the keyboard.
  2439. // Estimate height of visible viewport assuming viewport goes to bottom of screen, but is covered by keyboard.
  2440. box.h *= (orientation == 0 || orientation == 180 ? 0.66 : 0.40);
  2441. // Above measurement will be inaccurate if viewport was scrolled up so far that it ends before the bottom
  2442. // of the screen. In this case, keyboard isn't covering as much of the viewport as we thought.
  2443. // We know the visible size is at least the distance from the top of the viewport to the focused node.
  2444. var rect = focusedNode.getBoundingClientRect();
  2445. box.h = Math.max(box.h, rect.top + rect.height);
  2446. }
  2447. return box;
  2448. };
  2449. return Viewport;
  2450. });
  2451. },
  2452. 'dojox/color/_base':function(){
  2453. define("dojox/color/_base", ["dojo/_base/kernel", "../main", "dojo/_base/lang", "dojo/_base/Color", "dojo/colors"],
  2454. function(dojo, dojox, lang, Color, colors){
  2455. var cx = lang.getObject("dojox.color", true);
  2456. /*===== cx = dojox.color =====*/
  2457. // alias all the dojo.Color mechanisms
  2458. cx.Color=Color;
  2459. cx.blend=Color.blendColors;
  2460. cx.fromRgb=Color.fromRgb;
  2461. cx.fromHex=Color.fromHex;
  2462. cx.fromArray=Color.fromArray;
  2463. cx.fromString=Color.fromString;
  2464. // alias the dojo.colors mechanisms
  2465. cx.greyscale=colors.makeGrey;
  2466. lang.mixin(cx,{
  2467. fromCmy: function(/* Object|Array|int */cyan, /*int*/magenta, /*int*/yellow){
  2468. // summary
  2469. // Create a dojox.color.Color from a CMY defined color.
  2470. // All colors should be expressed as 0-100 (percentage)
  2471. if(lang.isArray(cyan)){
  2472. magenta=cyan[1], yellow=cyan[2], cyan=cyan[0];
  2473. } else if(lang.isObject(cyan)){
  2474. magenta=cyan.m, yellow=cyan.y, cyan=cyan.c;
  2475. }
  2476. cyan/=100, magenta/=100, yellow/=100;
  2477. var r=1-cyan, g=1-magenta, b=1-yellow;
  2478. return new Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) }); // dojox.color.Color
  2479. },
  2480. fromCmyk: function(/* Object|Array|int */cyan, /*int*/magenta, /*int*/yellow, /*int*/black){
  2481. // summary
  2482. // Create a dojox.color.Color from a CMYK defined color.
  2483. // All colors should be expressed as 0-100 (percentage)
  2484. if(lang.isArray(cyan)){
  2485. magenta=cyan[1], yellow=cyan[2], black=cyan[3], cyan=cyan[0];
  2486. } else if(lang.isObject(cyan)){
  2487. magenta=cyan.m, yellow=cyan.y, black=cyan.b, cyan=cyan.c;
  2488. }
  2489. cyan/=100, magenta/=100, yellow/=100, black/=100;
  2490. var r,g,b;
  2491. r = 1-Math.min(1, cyan*(1-black)+black);
  2492. g = 1-Math.min(1, magenta*(1-black)+black);
  2493. b = 1-Math.min(1, yellow*(1-black)+black);
  2494. return new Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) }); // dojox.color.Color
  2495. },
  2496. fromHsl: function(/* Object|Array|int */hue, /* int */saturation, /* int */luminosity){
  2497. // summary
  2498. // Create a dojox.color.Color from an HSL defined color.
  2499. // hue from 0-359 (degrees), saturation and luminosity 0-100.
  2500. if(lang.isArray(hue)){
  2501. saturation=hue[1], luminosity=hue[2], hue=hue[0];
  2502. } else if(lang.isObject(hue)){
  2503. saturation=hue.s, luminosity=hue.l, hue=hue.h;
  2504. }
  2505. saturation/=100;
  2506. luminosity/=100;
  2507. while(hue<0){ hue+=360; }
  2508. while(hue>=360){ hue-=360; }
  2509. var r, g, b;
  2510. if(hue<120){
  2511. r=(120-hue)/60, g=hue/60, b=0;
  2512. } else if (hue<240){
  2513. r=0, g=(240-hue)/60, b=(hue-120)/60;
  2514. } else {
  2515. r=(hue-240)/60, g=0, b=(360-hue)/60;
  2516. }
  2517. r=2*saturation*Math.min(r, 1)+(1-saturation);
  2518. g=2*saturation*Math.min(g, 1)+(1-saturation);
  2519. b=2*saturation*Math.min(b, 1)+(1-saturation);
  2520. if(luminosity<0.5){
  2521. r*=luminosity, g*=luminosity, b*=luminosity;
  2522. }else{
  2523. r=(1-luminosity)*r+2*luminosity-1;
  2524. g=(1-luminosity)*g+2*luminosity-1;
  2525. b=(1-luminosity)*b+2*luminosity-1;
  2526. }
  2527. return new Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) }); // dojox.color.Color
  2528. }
  2529. });
  2530. cx.fromHsv = function(/* Object|Array|int */hue, /* int */saturation, /* int */value){
  2531. // summary
  2532. // Create a dojox.color.Color from an HSV defined color.
  2533. // hue from 0-359 (degrees), saturation and value 0-100.
  2534. if(lang.isArray(hue)){
  2535. saturation=hue[1], value=hue[2], hue=hue[0];
  2536. } else if (lang.isObject(hue)){
  2537. saturation=hue.s, value=hue.v, hue=hue.h;
  2538. }
  2539. if(hue==360){ hue=0; }
  2540. saturation/=100;
  2541. value/=100;
  2542. var r, g, b;
  2543. if(saturation==0){
  2544. r=value, b=value, g=value;
  2545. }else{
  2546. var hTemp=hue/60, i=Math.floor(hTemp), f=hTemp-i;
  2547. var p=value*(1-saturation);
  2548. var q=value*(1-(saturation*f));
  2549. var t=value*(1-(saturation*(1-f)));
  2550. switch(i){
  2551. case 0:{ r=value, g=t, b=p; break; }
  2552. case 1:{ r=q, g=value, b=p; break; }
  2553. case 2:{ r=p, g=value, b=t; break; }
  2554. case 3:{ r=p, g=q, b=value; break; }
  2555. case 4:{ r=t, g=p, b=value; break; }
  2556. case 5:{ r=value, g=p, b=q; break; }
  2557. }
  2558. }
  2559. return new Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) }); // dojox.color.Color
  2560. };
  2561. lang.extend(Color,{
  2562. toCmy: function(){
  2563. // summary
  2564. // Convert this Color to a CMY definition.
  2565. var cyan=1-(this.r/255), magenta=1-(this.g/255), yellow=1-(this.b/255);
  2566. return { c:Math.round(cyan*100), m:Math.round(magenta*100), y:Math.round(yellow*100) }; // Object
  2567. },
  2568. toCmyk: function(){
  2569. // summary
  2570. // Convert this Color to a CMYK definition.
  2571. var cyan, magenta, yellow, black;
  2572. var r=this.r/255, g=this.g/255, b=this.b/255;
  2573. black = Math.min(1-r, 1-g, 1-b);
  2574. cyan = (1-r-black)/(1-black);
  2575. magenta = (1-g-black)/(1-black);
  2576. yellow = (1-b-black)/(1-black);
  2577. return { c:Math.round(cyan*100), m:Math.round(magenta*100), y:Math.round(yellow*100), b:Math.round(black*100) }; // Object
  2578. },
  2579. toHsl: function(){
  2580. // summary
  2581. // Convert this Color to an HSL definition.
  2582. var r=this.r/255, g=this.g/255, b=this.b/255;
  2583. var min = Math.min(r, b, g), max = Math.max(r, g, b);
  2584. var delta = max-min;
  2585. var h=0, s=0, l=(min+max)/2;
  2586. if(l>0 && l<1){
  2587. s = delta/((l<0.5)?(2*l):(2-2*l));
  2588. }
  2589. if(delta>0){
  2590. if(max==r && max!=g){
  2591. h+=(g-b)/delta;
  2592. }
  2593. if(max==g && max!=b){
  2594. h+=(2+(b-r)/delta);
  2595. }
  2596. if(max==b && max!=r){
  2597. h+=(4+(r-g)/delta);
  2598. }
  2599. h*=60;
  2600. }
  2601. return { h:h, s:Math.round(s*100), l:Math.round(l*100) }; // Object
  2602. },
  2603. toHsv: function(){
  2604. // summary
  2605. // Convert this Color to an HSV definition.
  2606. var r=this.r/255, g=this.g/255, b=this.b/255;
  2607. var min = Math.min(r, b, g), max = Math.max(r, g, b);
  2608. var delta = max-min;
  2609. var h = null, s = (max==0)?0:(delta/max);
  2610. if(s==0){
  2611. h = 0;
  2612. }else{
  2613. if(r==max){
  2614. h = 60*(g-b)/delta;
  2615. }else if(g==max){
  2616. h = 120 + 60*(b-r)/delta;
  2617. }else{
  2618. h = 240 + 60*(r-g)/delta;
  2619. }
  2620. if(h<0){ h+=360; }
  2621. }
  2622. return { h:h, s:Math.round(s*100), v:Math.round(max*100) }; // Object
  2623. }
  2624. });
  2625. return cx;
  2626. });
  2627. },
  2628. 'dojox/charting/plot2d/OHLC':function(){
  2629. define("dojox/charting/plot2d/OHLC", ["dojo/_base/lang", "dojo/_base/array", "dojo/_base/declare", "./Base", "./common",
  2630. "dojox/lang/functional", "dojox/lang/functional/reversed", "dojox/lang/utils", "dojox/gfx/fx"],
  2631. function(lang, arr, declare, Base, dc, df, dfr, du, fx){
  2632. /*=====
  2633. var Base = dojox.charting.plot2d.Base;
  2634. =====*/
  2635. var purgeGroup = dfr.lambda("item.purgeGroup()");
  2636. // Candlesticks are based on the Bars plot type; we expect the following passed
  2637. // as values in a series:
  2638. // { x?, open, close, high, low }
  2639. // if x is not provided, the array index is used.
  2640. // failing to provide the OHLC values will throw an error.
  2641. return declare("dojox.charting.plot2d.OHLC", Base, {
  2642. // summary:
  2643. // A plot that represents typical open/high/low/close (financial reporting, primarily).
  2644. // Unlike most charts, the Candlestick expects data points to be represented by
  2645. // an object of the form { x?, open, close, high, low, mid? }, where both
  2646. // x and mid are optional parameters. If x is not provided, the index of the
  2647. // data array is used.
  2648. defaultParams: {
  2649. hAxis: "x", // use a horizontal axis named "x"
  2650. vAxis: "y", // use a vertical axis named "y"
  2651. gap: 2, // gap between columns in pixels
  2652. animate: null // animate chart to place
  2653. },
  2654. optionalParams: {
  2655. minBarSize: 1, // minimal bar size in pixels
  2656. maxBarSize: 1, // maximal bar size in pixels
  2657. // theme component
  2658. stroke: {},
  2659. outline: {},
  2660. shadow: {},
  2661. fill: {},
  2662. font: "",
  2663. fontColor: ""
  2664. },
  2665. constructor: function(chart, kwArgs){
  2666. // summary:
  2667. // The constructor for a candlestick chart.
  2668. // chart: dojox.charting.Chart
  2669. // The chart this plot belongs to.
  2670. // kwArgs: dojox.charting.plot2d.__BarCtorArgs?
  2671. // An optional keyword arguments object to help define the plot.
  2672. this.opt = lang.clone(this.defaultParams);
  2673. du.updateWithObject(this.opt, kwArgs);
  2674. du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
  2675. this.series = [];
  2676. this.hAxis = this.opt.hAxis;
  2677. this.vAxis = this.opt.vAxis;
  2678. this.animate = this.opt.animate;
  2679. },
  2680. collectStats: function(series){
  2681. // summary:
  2682. // Collect all statistics for drawing this chart. Since the common
  2683. // functionality only assumes x and y, OHLC must create it's own
  2684. // stats (since data has no y value, but open/close/high/low instead).
  2685. // series: dojox.charting.Series[]
  2686. // The data series array to be drawn on this plot.
  2687. // returns: Object
  2688. // Returns an object in the form of { hmin, hmax, vmin, vmax }.
  2689. // we have to roll our own, since we need to use all four passed
  2690. // values to figure out our stats, and common only assumes x and y.
  2691. var stats = lang.delegate(dc.defaultStats);
  2692. for(var i=0; i<series.length; i++){
  2693. var run = series[i];
  2694. if(!run.data.length){ continue; }
  2695. var old_vmin = stats.vmin, old_vmax = stats.vmax;
  2696. if(!("ymin" in run) || !("ymax" in run)){
  2697. arr.forEach(run.data, function(val, idx){
  2698. if(val !== null){
  2699. var x = val.x || idx + 1;
  2700. stats.hmin = Math.min(stats.hmin, x);
  2701. stats.hmax = Math.max(stats.hmax, x);
  2702. stats.vmin = Math.min(stats.vmin, val.open, val.close, val.high, val.low);
  2703. stats.vmax = Math.max(stats.vmax, val.open, val.close, val.high, val.low);
  2704. }
  2705. });
  2706. }
  2707. if("ymin" in run){ stats.vmin = Math.min(old_vmin, run.ymin); }
  2708. if("ymax" in run){ stats.vmax = Math.max(old_vmax, run.ymax); }
  2709. }
  2710. return stats;
  2711. },
  2712. getSeriesStats: function(){
  2713. // summary:
  2714. // Calculate the min/max on all attached series in both directions.
  2715. // returns: Object
  2716. // {hmin, hmax, vmin, vmax} min/max in both directions.
  2717. var stats = this.collectStats(this.series);
  2718. stats.hmin -= 0.5;
  2719. stats.hmax += 0.5;
  2720. return stats;
  2721. },
  2722. render: function(dim, offsets){
  2723. // summary:
  2724. // Run the calculations for any axes for this plot.
  2725. // dim: Object
  2726. // An object in the form of { width, height }
  2727. // offsets: Object
  2728. // An object of the form { l, r, t, b}.
  2729. // returns: dojox.charting.plot2d.OHLC
  2730. // A reference to this plot for functional chaining.
  2731. if(this.zoom && !this.isDataDirty()){
  2732. return this.performZoom(dim, offsets);
  2733. }
  2734. this.resetEvents();
  2735. this.dirty = this.isDirty();
  2736. if(this.dirty){
  2737. arr.forEach(this.series, purgeGroup);
  2738. this._eventSeries = {};
  2739. this.cleanGroup();
  2740. var s = this.group;
  2741. df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
  2742. }
  2743. var t = this.chart.theme, f, gap, width,
  2744. ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
  2745. vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
  2746. baseline = Math.max(0, this._vScaler.bounds.lower),
  2747. baselineHeight = vt(baseline),
  2748. events = this.events();
  2749. f = dc.calculateBarSize(this._hScaler.bounds.scale, this.opt);
  2750. gap = f.gap;
  2751. width = f.size;
  2752. for(var i = this.series.length - 1; i >= 0; --i){
  2753. var run = this.series[i];
  2754. if(!this.dirty && !run.dirty){
  2755. t.skip();
  2756. this._reconnectEvents(run.name);
  2757. continue;
  2758. }
  2759. run.cleanGroup();
  2760. var theme = t.next("candlestick", [this.opt, run]), s = run.group,
  2761. eventSeries = new Array(run.data.length);
  2762. for(var j = 0; j < run.data.length; ++j){
  2763. var v = run.data[j];
  2764. if(v !== null){
  2765. var finalTheme = t.addMixin(theme, "candlestick", v, true);
  2766. // calculate the points we need for OHLC
  2767. var x = ht(v.x || (j+0.5)) + offsets.l + gap,
  2768. y = dim.height - offsets.b,
  2769. open = vt(v.open),
  2770. close = vt(v.close),
  2771. high = vt(v.high),
  2772. low = vt(v.low);
  2773. if(low > high){
  2774. var tmp = high;
  2775. high = low;
  2776. low = tmp;
  2777. }
  2778. if(width >= 1){
  2779. var hl = {x1: width/2, x2: width/2, y1: y - high, y2: y - low},
  2780. op = {x1: 0, x2: ((width/2) + ((finalTheme.series.stroke.width||1)/2)), y1: y-open, y2: y-open},
  2781. cl = {x1: ((width/2) - ((finalTheme.series.stroke.width||1)/2)), x2: width, y1: y-close, y2: y-close};
  2782. var shape = s.createGroup();
  2783. shape.setTransform({dx: x, dy: 0});
  2784. var inner = shape.createGroup();
  2785. inner.createLine(hl).setStroke(finalTheme.series.stroke);
  2786. inner.createLine(op).setStroke(finalTheme.series.stroke);
  2787. inner.createLine(cl).setStroke(finalTheme.series.stroke);
  2788. // TODO: double check this.
  2789. run.dyn.stroke = finalTheme.series.stroke;
  2790. if(events){
  2791. var o = {
  2792. element: "candlestick",
  2793. index: j,
  2794. run: run,
  2795. shape: inner,
  2796. x: x,
  2797. y: y-Math.max(open, close),
  2798. cx: width/2,
  2799. cy: (y-Math.max(open, close)) + (Math.max(open > close ? open-close : close-open, 1)/2),
  2800. width: width,
  2801. height: Math.max(open > close ? open-close : close-open, 1),
  2802. data: v
  2803. };
  2804. this._connectEvents(o);
  2805. eventSeries[j] = o;
  2806. }
  2807. }
  2808. if(this.animate){
  2809. this._animateOHLC(shape, y - low, high - low);
  2810. }
  2811. }
  2812. }
  2813. this._eventSeries[run.name] = eventSeries;
  2814. run.dirty = false;
  2815. }
  2816. this.dirty = false;
  2817. return this; // dojox.charting.plot2d.OHLC
  2818. },
  2819. _animateOHLC: function(shape, voffset, vsize){
  2820. fx.animateTransform(lang.delegate({
  2821. shape: shape,
  2822. duration: 1200,
  2823. transform: [
  2824. {name: "translate", start: [0, voffset - (voffset/vsize)], end: [0, 0]},
  2825. {name: "scale", start: [1, 1/vsize], end: [1, 1]},
  2826. {name: "original"}
  2827. ]
  2828. }, this.animate)).play();
  2829. }
  2830. });
  2831. });
  2832. },
  2833. 'dojox/charting/plot2d/ClusteredColumns':function(){
  2834. define("dojox/charting/plot2d/ClusteredColumns", ["dojo/_base/array", "dojo/_base/declare", "./Columns", "./common",
  2835. "dojox/lang/functional", "dojox/lang/functional/reversed", "dojox/lang/utils"],
  2836. function(arr, declare, Columns, dc, df, dfr, du){
  2837. /*=====
  2838. var Columns = dojox.charting.plot2d.Columns;
  2839. =====*/
  2840. var purgeGroup = dfr.lambda("item.purgeGroup()");
  2841. return declare("dojox.charting.plot2d.ClusteredColumns", Columns, {
  2842. // summary:
  2843. // A plot representing grouped or clustered columns (vertical bars).
  2844. render: function(dim, offsets){
  2845. // summary:
  2846. // Run the calculations for any axes for this plot.
  2847. // dim: Object
  2848. // An object in the form of { width, height }
  2849. // offsets: Object
  2850. // An object of the form { l, r, t, b}.
  2851. // returns: dojox.charting.plot2d.ClusteredColumns
  2852. // A reference to this plot for functional chaining.
  2853. if(this.zoom && !this.isDataDirty()){
  2854. return this.performZoom(dim, offsets);
  2855. }
  2856. this.resetEvents();
  2857. this.dirty = this.isDirty();
  2858. if(this.dirty){
  2859. arr.forEach(this.series, purgeGroup);
  2860. this._eventSeries = {};
  2861. this.cleanGroup();
  2862. var s = this.group;
  2863. df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
  2864. }
  2865. var t = this.chart.theme, f, gap, width, thickness,
  2866. ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
  2867. vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
  2868. baseline = Math.max(0, this._vScaler.bounds.lower),
  2869. baselineHeight = vt(baseline),
  2870. events = this.events();
  2871. f = dc.calculateBarSize(this._hScaler.bounds.scale, this.opt, this.series.length);
  2872. gap = f.gap;
  2873. width = thickness = f.size;
  2874. for(var i = 0; i < this.series.length; ++i){
  2875. var run = this.series[i], shift = thickness * i;
  2876. if(!this.dirty && !run.dirty){
  2877. t.skip();
  2878. this._reconnectEvents(run.name);
  2879. continue;
  2880. }
  2881. run.cleanGroup();
  2882. var theme = t.next("column", [this.opt, run]), s = run.group,
  2883. eventSeries = new Array(run.data.length);
  2884. for(var j = 0; j < run.data.length; ++j){
  2885. var value = run.data[j];
  2886. if(value !== null){
  2887. var v = typeof value == "number" ? value : value.y,
  2888. vv = vt(v),
  2889. height = vv - baselineHeight,
  2890. h = Math.abs(height),
  2891. finalTheme = typeof value != "number" ?
  2892. t.addMixin(theme, "column", value, true) :
  2893. t.post(theme, "column");
  2894. if(width >= 1 && h >= 0){
  2895. var rect = {
  2896. x: offsets.l + ht(j + 0.5) + gap + shift,
  2897. y: dim.height - offsets.b - (v > baseline ? vv : baselineHeight),
  2898. width: width, height: h
  2899. };
  2900. var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
  2901. specialFill = this._shapeFill(specialFill, rect);
  2902. var shape = s.createRect(rect).setFill(specialFill).setStroke(finalTheme.series.stroke);
  2903. run.dyn.fill = shape.getFill();
  2904. run.dyn.stroke = shape.getStroke();
  2905. if(events){
  2906. var o = {
  2907. element: "column",
  2908. index: j,
  2909. run: run,
  2910. shape: shape,
  2911. x: j + 0.5,
  2912. y: v
  2913. };
  2914. this._connectEvents(o);
  2915. eventSeries[j] = o;
  2916. }
  2917. if(this.animate){
  2918. this._animateColumn(shape, dim.height - offsets.b - baselineHeight, h);
  2919. }
  2920. }
  2921. }
  2922. }
  2923. this._eventSeries[run.name] = eventSeries;
  2924. run.dirty = false;
  2925. }
  2926. this.dirty = false;
  2927. return this; // dojox.charting.plot2d.ClusteredColumns
  2928. }
  2929. });
  2930. });
  2931. },
  2932. 'dojox/charting/Chart':function(){
  2933. define("dojox/charting/Chart", ["dojo/_base/lang", "dojo/_base/array","dojo/_base/declare", "dojo/_base/html",
  2934. "dojo/dom", "dojo/dom-geometry", "dojo/dom-construct","dojo/_base/Color", "dojo/_base/sniff",
  2935. "./Element", "./Theme", "./Series", "./axis2d/common", "dojox/gfx/shape",
  2936. "dojox/gfx", "dojox/lang/functional", "dojox/lang/functional/fold", "dojox/lang/functional/reversed"],
  2937. function(lang, arr, declare, html,
  2938. dom, domGeom, domConstruct, Color, has,
  2939. Element, Theme, Series, common, shape,
  2940. g, func, funcFold, funcReversed){
  2941. /*=====
  2942. dojox.charting.__ChartCtorArgs = function(margins, stroke, fill, delayInMs){
  2943. // summary:
  2944. // The keyword arguments that can be passed in a Chart constructor.
  2945. //
  2946. // margins: Object?
  2947. // Optional margins for the chart, in the form of { l, t, r, b}.
  2948. // stroke: dojox.gfx.Stroke?
  2949. // An optional outline/stroke for the chart.
  2950. // fill: dojox.gfx.Fill?
  2951. // An optional fill for the chart.
  2952. // delayInMs: Number
  2953. // Delay in ms for delayedRender(). Default: 200.
  2954. this.margins = margins;
  2955. this.stroke = stroke;
  2956. this.fill = fill;
  2957. this.delayInMs = delayInMs;
  2958. }
  2959. =====*/
  2960. var dc = dojox.charting,
  2961. clear = func.lambda("item.clear()"),
  2962. purge = func.lambda("item.purgeGroup()"),
  2963. destroy = func.lambda("item.destroy()"),
  2964. makeClean = func.lambda("item.dirty = false"),
  2965. makeDirty = func.lambda("item.dirty = true"),
  2966. getName = func.lambda("item.name");
  2967. declare("dojox.charting.Chart", null, {
  2968. // summary:
  2969. // The main chart object in dojox.charting. This will create a two dimensional
  2970. // chart based on dojox.gfx.
  2971. //
  2972. // description:
  2973. // dojox.charting.Chart is the primary object used for any kind of charts. It
  2974. // is simple to create--just pass it a node reference, which is used as the
  2975. // container for the chart--and a set of optional keyword arguments and go.
  2976. //
  2977. // Note that like most of dojox.gfx, most of dojox.charting.Chart's methods are
  2978. // designed to return a reference to the chart itself, to allow for functional
  2979. // chaining. This makes defining everything on a Chart very easy to do.
  2980. //
  2981. // example:
  2982. // Create an area chart, with smoothing.
  2983. // | new dojox.charting.Chart(node))
  2984. // | .addPlot("default", { type: "Areas", tension: "X" })
  2985. // | .setTheme(dojox.charting.themes.Shrooms)
  2986. // | .addSeries("Series A", [1, 2, 0.5, 1.5, 1, 2.8, 0.4])
  2987. // | .addSeries("Series B", [2.6, 1.8, 2, 1, 1.4, 0.7, 2])
  2988. // | .addSeries("Series C", [6.3, 1.8, 3, 0.5, 4.4, 2.7, 2])
  2989. // | .render();
  2990. //
  2991. // example:
  2992. // The form of data in a data series can take a number of forms: a simple array,
  2993. // an array of objects {x,y}, or something custom (as determined by the plot).
  2994. // Here's an example of a Candlestick chart, which expects an object of
  2995. // { open, high, low, close }.
  2996. // | new dojox.charting.Chart(node))
  2997. // | .addPlot("default", {type: "Candlesticks", gap: 1})
  2998. // | .addAxis("x", {fixLower: "major", fixUpper: "major", includeZero: true})
  2999. // | .addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major", natural: true})
  3000. // | .addSeries("Series A", [
  3001. // | { open: 20, close: 16, high: 22, low: 8 },
  3002. // | { open: 16, close: 22, high: 26, low: 6, mid: 18 },
  3003. // | { open: 22, close: 18, high: 22, low: 11, mid: 21 },
  3004. // | { open: 18, close: 29, high: 32, low: 14, mid: 27 },
  3005. // | { open: 29, close: 24, high: 29, low: 13, mid: 27 },
  3006. // | { open: 24, close: 8, high: 24, low: 5 },
  3007. // | { open: 8, close: 16, high: 22, low: 2 },
  3008. // | { open: 16, close: 12, high: 19, low: 7 },
  3009. // | { open: 12, close: 20, high: 22, low: 8 },
  3010. // | { open: 20, close: 16, high: 22, low: 8 },
  3011. // | { open: 16, close: 22, high: 26, low: 6, mid: 18 },
  3012. // | { open: 22, close: 18, high: 22, low: 11, mid: 21 },
  3013. // | { open: 18, close: 29, high: 32, low: 14, mid: 27 },
  3014. // | { open: 29, close: 24, high: 29, low: 13, mid: 27 },
  3015. // | { open: 24, close: 8, high: 24, low: 5 },
  3016. // | { open: 8, close: 16, high: 22, low: 2 },
  3017. // | { open: 16, close: 12, high: 19, low: 7 },
  3018. // | { open: 12, close: 20, high: 22, low: 8 },
  3019. // | { open: 20, close: 16, high: 22, low: 8 },
  3020. // | { open: 16, close: 22, high: 26, low: 6 },
  3021. // | { open: 22, close: 18, high: 22, low: 11 },
  3022. // | { open: 18, close: 29, high: 32, low: 14 },
  3023. // | { open: 29, close: 24, high: 29, low: 13 },
  3024. // | { open: 24, close: 8, high: 24, low: 5 },
  3025. // | { open: 8, close: 16, high: 22, low: 2 },
  3026. // | { open: 16, close: 12, high: 19, low: 7 },
  3027. // | { open: 12, close: 20, high: 22, low: 8 },
  3028. // | { open: 20, close: 16, high: 22, low: 8 }
  3029. // | ],
  3030. // | { stroke: { color: "green" }, fill: "lightgreen" }
  3031. // | )
  3032. // | .render();
  3033. // theme: dojox.charting.Theme?
  3034. // An optional theme to use for styling the chart.
  3035. // axes: dojox.charting.Axis{}?
  3036. // A map of axes for use in plotting a chart.
  3037. // stack: dojox.charting.plot2d.Base[]
  3038. // A stack of plotters.
  3039. // plots: dojox.charting.plot2d.Base{}
  3040. // A map of plotter indices
  3041. // series: dojox.charting.Series[]
  3042. // The stack of data runs used to create plots.
  3043. // runs: dojox.charting.Series{}
  3044. // A map of series indices
  3045. // margins: Object?
  3046. // The margins around the chart. Default is { l:10, t:10, r:10, b:10 }.
  3047. // stroke: dojox.gfx.Stroke?
  3048. // The outline of the chart (stroke in vector graphics terms).
  3049. // fill: dojox.gfx.Fill?
  3050. // The color for the chart.
  3051. // node: DOMNode
  3052. // The container node passed to the constructor.
  3053. // surface: dojox.gfx.Surface
  3054. // The main graphics surface upon which a chart is drawn.
  3055. // dirty: Boolean
  3056. // A boolean flag indicating whether or not the chart needs to be updated/re-rendered.
  3057. // coords: Object
  3058. // The coordinates on a page of the containing node, as returned from dojo.coords.
  3059. constructor: function(/* DOMNode */node, /* dojox.charting.__ChartCtorArgs? */kwArgs){
  3060. // summary:
  3061. // The constructor for a new Chart. Initializes all parameters used for a chart.
  3062. // returns: dojox.charting.Chart
  3063. // The newly created chart.
  3064. // initialize parameters
  3065. if(!kwArgs){ kwArgs = {}; }
  3066. this.margins = kwArgs.margins ? kwArgs.margins : {l: 10, t: 10, r: 10, b: 10};
  3067. this.stroke = kwArgs.stroke;
  3068. this.fill = kwArgs.fill;
  3069. this.delayInMs = kwArgs.delayInMs || 200;
  3070. this.title = kwArgs.title;
  3071. this.titleGap = kwArgs.titleGap;
  3072. this.titlePos = kwArgs.titlePos;
  3073. this.titleFont = kwArgs.titleFont;
  3074. this.titleFontColor = kwArgs.titleFontColor;
  3075. this.chartTitle = null;
  3076. // default initialization
  3077. this.theme = null;
  3078. this.axes = {}; // map of axes
  3079. this.stack = []; // stack of plotters
  3080. this.plots = {}; // map of plotter indices
  3081. this.series = []; // stack of data runs
  3082. this.runs = {}; // map of data run indices
  3083. this.dirty = true;
  3084. this.coords = null;
  3085. this._clearRects = [];
  3086. // create a surface
  3087. this.node = dom.byId(node);
  3088. var box = domGeom.getMarginBox(node);
  3089. this.surface = g.createSurface(this.node, box.w || 400, box.h || 300);
  3090. },
  3091. destroy: function(){
  3092. // summary:
  3093. // Cleanup when a chart is to be destroyed.
  3094. // returns: void
  3095. arr.forEach(this.series, destroy);
  3096. arr.forEach(this.stack, destroy);
  3097. func.forIn(this.axes, destroy);
  3098. if(this.chartTitle && this.chartTitle.tagName){
  3099. // destroy title if it is a DOM node
  3100. domConstruct.destroy(this.chartTitle);
  3101. }
  3102. arr.forEach(this._clearRects, function(child){
  3103. shape.dispose(child);
  3104. });
  3105. this.surface.destroy();
  3106. },
  3107. getCoords: function(){
  3108. // summary:
  3109. // Get the coordinates and dimensions of the containing DOMNode, as
  3110. // returned by dojo.coords.
  3111. // returns: Object
  3112. // The resulting coordinates of the chart. See dojo.coords for details.
  3113. return html.coords(this.node, true); // Object
  3114. },
  3115. setTheme: function(theme){
  3116. // summary:
  3117. // Set a theme of the chart.
  3118. // theme: dojox.charting.Theme
  3119. // The theme to be used for visual rendering.
  3120. // returns: dojox.charting.Chart
  3121. // A reference to the current chart for functional chaining.
  3122. this.theme = theme.clone();
  3123. this.dirty = true;
  3124. return this; // dojox.charting.Chart
  3125. },
  3126. addAxis: function(name, kwArgs){
  3127. // summary:
  3128. // Add an axis to the chart, for rendering.
  3129. // name: String
  3130. // The name of the axis.
  3131. // kwArgs: dojox.charting.axis2d.__AxisCtorArgs?
  3132. // An optional keyword arguments object for use in defining details of an axis.
  3133. // returns: dojox.charting.Chart
  3134. // A reference to the current chart for functional chaining.
  3135. var axis, axisType = kwArgs && kwArgs.type || "Default";
  3136. if(typeof axisType == "string"){
  3137. if(!dc.axis2d || !dc.axis2d[axisType]){
  3138. throw Error("Can't find axis: " + axisType + " - Check " + "require() dependencies.");
  3139. }
  3140. axis = new dc.axis2d[axisType](this, kwArgs);
  3141. }else{
  3142. axis = new axisType(this, kwArgs);
  3143. }
  3144. axis.name = name;
  3145. axis.dirty = true;
  3146. if(name in this.axes){
  3147. this.axes[name].destroy();
  3148. }
  3149. this.axes[name] = axis;
  3150. this.dirty = true;
  3151. return this; // dojox.charting.Chart
  3152. },
  3153. getAxis: function(name){
  3154. // summary:
  3155. // Get the given axis, by name.
  3156. // name: String
  3157. // The name the axis was defined by.
  3158. // returns: dojox.charting.axis2d.Default
  3159. // The axis as stored in the chart's axis map.
  3160. return this.axes[name]; // dojox.charting.axis2d.Default
  3161. },
  3162. removeAxis: function(name){
  3163. // summary:
  3164. // Remove the axis that was defined using name.
  3165. // name: String
  3166. // The axis name, as defined in addAxis.
  3167. // returns: dojox.charting.Chart
  3168. // A reference to the current chart for functional chaining.
  3169. if(name in this.axes){
  3170. // destroy the axis
  3171. this.axes[name].destroy();
  3172. delete this.axes[name];
  3173. // mark the chart as dirty
  3174. this.dirty = true;
  3175. }
  3176. return this; // dojox.charting.Chart
  3177. },
  3178. addPlot: function(name, kwArgs){
  3179. // summary:
  3180. // Add a new plot to the chart, defined by name and using the optional keyword arguments object.
  3181. // Note that dojox.charting assumes the main plot to be called "default"; if you do not have
  3182. // a plot called "default" and attempt to add data series to the chart without specifying the
  3183. // plot to be rendered on, you WILL get errors.
  3184. // name: String
  3185. // The name of the plot to be added to the chart. If you only plan on using one plot, call it "default".
  3186. // kwArgs: dojox.charting.plot2d.__PlotCtorArgs
  3187. // An object with optional parameters for the plot in question.
  3188. // returns: dojox.charting.Chart
  3189. // A reference to the current chart for functional chaining.
  3190. var plot, plotType = kwArgs && kwArgs.type || "Default";
  3191. if(typeof plotType == "string"){
  3192. if(!dc.plot2d || !dc.plot2d[plotType]){
  3193. throw Error("Can't find plot: " + plotType + " - didn't you forget to dojo" + ".require() it?");
  3194. }
  3195. plot = new dc.plot2d[plotType](this, kwArgs);
  3196. }else{
  3197. plot = new plotType(this, kwArgs);
  3198. }
  3199. plot.name = name;
  3200. plot.dirty = true;
  3201. if(name in this.plots){
  3202. this.stack[this.plots[name]].destroy();
  3203. this.stack[this.plots[name]] = plot;
  3204. }else{
  3205. this.plots[name] = this.stack.length;
  3206. this.stack.push(plot);
  3207. }
  3208. this.dirty = true;
  3209. return this; // dojox.charting.Chart
  3210. },
  3211. getPlot: function(name){
  3212. // summary:
  3213. // Get the given plot, by name.
  3214. // name: String
  3215. // The name the plot was defined by.
  3216. // returns: dojox.charting.plot2d.Base
  3217. // The plot.
  3218. return this.stack[this.plots[name]];
  3219. },
  3220. removePlot: function(name){
  3221. // summary:
  3222. // Remove the plot defined using name from the chart's plot stack.
  3223. // name: String
  3224. // The name of the plot as defined using addPlot.
  3225. // returns: dojox.charting.Chart
  3226. // A reference to the current chart for functional chaining.
  3227. if(name in this.plots){
  3228. // get the index and remove the name
  3229. var index = this.plots[name];
  3230. delete this.plots[name];
  3231. // destroy the plot
  3232. this.stack[index].destroy();
  3233. // remove the plot from the stack
  3234. this.stack.splice(index, 1);
  3235. // update indices to reflect the shift
  3236. func.forIn(this.plots, function(idx, name, plots){
  3237. if(idx > index){
  3238. plots[name] = idx - 1;
  3239. }
  3240. });
  3241. // remove all related series
  3242. var ns = arr.filter(this.series, function(run){ return run.plot != name; });
  3243. if(ns.length < this.series.length){
  3244. // kill all removed series
  3245. arr.forEach(this.series, function(run){
  3246. if(run.plot == name){
  3247. run.destroy();
  3248. }
  3249. });
  3250. // rebuild all necessary data structures
  3251. this.runs = {};
  3252. arr.forEach(ns, function(run, index){
  3253. this.runs[run.plot] = index;
  3254. }, this);
  3255. this.series = ns;
  3256. }
  3257. // mark the chart as dirty
  3258. this.dirty = true;
  3259. }
  3260. return this; // dojox.charting.Chart
  3261. },
  3262. getPlotOrder: function(){
  3263. // summary:
  3264. // Returns an array of plot names in the current order
  3265. // (the top-most plot is the first).
  3266. // returns: Array
  3267. return func.map(this.stack, getName); // Array
  3268. },
  3269. setPlotOrder: function(newOrder){
  3270. // summary:
  3271. // Sets new order of plots. newOrder cannot add or remove
  3272. // plots. Wrong names, or dups are ignored.
  3273. // newOrder: Array:
  3274. // Array of plot names compatible with getPlotOrder().
  3275. // returns: dojox.charting.Chart
  3276. // A reference to the current chart for functional chaining.
  3277. var names = {},
  3278. order = func.filter(newOrder, function(name){
  3279. if(!(name in this.plots) || (name in names)){
  3280. return false;
  3281. }
  3282. names[name] = 1;
  3283. return true;
  3284. }, this);
  3285. if(order.length < this.stack.length){
  3286. func.forEach(this.stack, function(plot){
  3287. var name = plot.name;
  3288. if(!(name in names)){
  3289. order.push(name);
  3290. }
  3291. });
  3292. }
  3293. var newStack = func.map(order, function(name){
  3294. return this.stack[this.plots[name]];
  3295. }, this);
  3296. func.forEach(newStack, function(plot, i){
  3297. this.plots[plot.name] = i;
  3298. }, this);
  3299. this.stack = newStack;
  3300. this.dirty = true;
  3301. return this; // dojox.charting.Chart
  3302. },
  3303. movePlotToFront: function(name){
  3304. // summary:
  3305. // Moves a given plot to front.
  3306. // name: String:
  3307. // Plot's name to move.
  3308. // returns: dojox.charting.Chart
  3309. // A reference to the current chart for functional chaining.
  3310. if(name in this.plots){
  3311. var index = this.plots[name];
  3312. if(index){
  3313. var newOrder = this.getPlotOrder();
  3314. newOrder.splice(index, 1);
  3315. newOrder.unshift(name);
  3316. return this.setPlotOrder(newOrder); // dojox.charting.Chart
  3317. }
  3318. }
  3319. return this; // dojox.charting.Chart
  3320. },
  3321. movePlotToBack: function(name){
  3322. // summary:
  3323. // Moves a given plot to back.
  3324. // name: String:
  3325. // Plot's name to move.
  3326. // returns: dojox.charting.Chart
  3327. // A reference to the current chart for functional chaining.
  3328. if(name in this.plots){
  3329. var index = this.plots[name];
  3330. if(index < this.stack.length - 1){
  3331. var newOrder = this.getPlotOrder();
  3332. newOrder.splice(index, 1);
  3333. newOrder.push(name);
  3334. return this.setPlotOrder(newOrder); // dojox.charting.Chart
  3335. }
  3336. }
  3337. return this; // dojox.charting.Chart
  3338. },
  3339. addSeries: function(name, data, kwArgs){
  3340. // summary:
  3341. // Add a data series to the chart for rendering.
  3342. // name: String:
  3343. // The name of the data series to be plotted.
  3344. // data: Array|Object:
  3345. // The array of data points (either numbers or objects) that
  3346. // represents the data to be drawn. Or it can be an object. In
  3347. // the latter case, it should have a property "data" (an array),
  3348. // destroy(), and setSeriesObject().
  3349. // kwArgs: dojox.charting.__SeriesCtorArgs?:
  3350. // An optional keyword arguments object that will be mixed into
  3351. // the resultant series object.
  3352. // returns: dojox.charting.Chart:
  3353. // A reference to the current chart for functional chaining.
  3354. var run = new Series(this, data, kwArgs);
  3355. run.name = name;
  3356. if(name in this.runs){
  3357. this.series[this.runs[name]].destroy();
  3358. this.series[this.runs[name]] = run;
  3359. }else{
  3360. this.runs[name] = this.series.length;
  3361. this.series.push(run);
  3362. }
  3363. this.dirty = true;
  3364. // fix min/max
  3365. if(!("ymin" in run) && "min" in run){ run.ymin = run.min; }
  3366. if(!("ymax" in run) && "max" in run){ run.ymax = run.max; }
  3367. return this; // dojox.charting.Chart
  3368. },
  3369. getSeries: function(name){
  3370. // summary:
  3371. // Get the given series, by name.
  3372. // name: String
  3373. // The name the series was defined by.
  3374. // returns: dojox.charting.Series
  3375. // The series.
  3376. return this.series[this.runs[name]];
  3377. },
  3378. removeSeries: function(name){
  3379. // summary:
  3380. // Remove the series defined by name from the chart.
  3381. // name: String
  3382. // The name of the series as defined by addSeries.
  3383. // returns: dojox.charting.Chart
  3384. // A reference to the current chart for functional chaining.
  3385. if(name in this.runs){
  3386. // get the index and remove the name
  3387. var index = this.runs[name];
  3388. delete this.runs[name];
  3389. // destroy the run
  3390. this.series[index].destroy();
  3391. // remove the run from the stack of series
  3392. this.series.splice(index, 1);
  3393. // update indices to reflect the shift
  3394. func.forIn(this.runs, function(idx, name, runs){
  3395. if(idx > index){
  3396. runs[name] = idx - 1;
  3397. }
  3398. });
  3399. this.dirty = true;
  3400. }
  3401. return this; // dojox.charting.Chart
  3402. },
  3403. updateSeries: function(name, data){
  3404. // summary:
  3405. // Update the given series with a new set of data points.
  3406. // name: String
  3407. // The name of the series as defined in addSeries.
  3408. // data: Array|Object:
  3409. // The array of data points (either numbers or objects) that
  3410. // represents the data to be drawn. Or it can be an object. In
  3411. // the latter case, it should have a property "data" (an array),
  3412. // destroy(), and setSeriesObject().
  3413. // returns: dojox.charting.Chart
  3414. // A reference to the current chart for functional chaining.
  3415. if(name in this.runs){
  3416. var run = this.series[this.runs[name]];
  3417. run.update(data);
  3418. this._invalidateDependentPlots(run.plot, false);
  3419. this._invalidateDependentPlots(run.plot, true);
  3420. }
  3421. return this; // dojox.charting.Chart
  3422. },
  3423. getSeriesOrder: function(plotName){
  3424. // summary:
  3425. // Returns an array of series names in the current order
  3426. // (the top-most series is the first) within a plot.
  3427. // plotName: String:
  3428. // Plot's name.
  3429. // returns: Array
  3430. return func.map(func.filter(this.series, function(run){
  3431. return run.plot == plotName;
  3432. }), getName);
  3433. },
  3434. setSeriesOrder: function(newOrder){
  3435. // summary:
  3436. // Sets new order of series within a plot. newOrder cannot add
  3437. // or remove series. Wrong names, or dups are ignored.
  3438. // newOrder: Array:
  3439. // Array of series names compatible with getPlotOrder(). All
  3440. // series should belong to the same plot.
  3441. // returns: dojox.charting.Chart
  3442. // A reference to the current chart for functional chaining.
  3443. var plotName, names = {},
  3444. order = func.filter(newOrder, function(name){
  3445. if(!(name in this.runs) || (name in names)){
  3446. return false;
  3447. }
  3448. var run = this.series[this.runs[name]];
  3449. if(plotName){
  3450. if(run.plot != plotName){
  3451. return false;
  3452. }
  3453. }else{
  3454. plotName = run.plot;
  3455. }
  3456. names[name] = 1;
  3457. return true;
  3458. }, this);
  3459. func.forEach(this.series, function(run){
  3460. var name = run.name;
  3461. if(!(name in names) && run.plot == plotName){
  3462. order.push(name);
  3463. }
  3464. });
  3465. var newSeries = func.map(order, function(name){
  3466. return this.series[this.runs[name]];
  3467. }, this);
  3468. this.series = newSeries.concat(func.filter(this.series, function(run){
  3469. return run.plot != plotName;
  3470. }));
  3471. func.forEach(this.series, function(run, i){
  3472. this.runs[run.name] = i;
  3473. }, this);
  3474. this.dirty = true;
  3475. return this; // dojox.charting.Chart
  3476. },
  3477. moveSeriesToFront: function(name){
  3478. // summary:
  3479. // Moves a given series to front of a plot.
  3480. // name: String:
  3481. // Series' name to move.
  3482. // returns: dojox.charting.Chart
  3483. // A reference to the current chart for functional chaining.
  3484. if(name in this.runs){
  3485. var index = this.runs[name],
  3486. newOrder = this.getSeriesOrder(this.series[index].plot);
  3487. if(name != newOrder[0]){
  3488. newOrder.splice(index, 1);
  3489. newOrder.unshift(name);
  3490. return this.setSeriesOrder(newOrder); // dojox.charting.Chart
  3491. }
  3492. }
  3493. return this; // dojox.charting.Chart
  3494. },
  3495. moveSeriesToBack: function(name){
  3496. // summary:
  3497. // Moves a given series to back of a plot.
  3498. // name: String:
  3499. // Series' name to move.
  3500. // returns: dojox.charting.Chart
  3501. // A reference to the current chart for functional chaining.
  3502. if(name in this.runs){
  3503. var index = this.runs[name],
  3504. newOrder = this.getSeriesOrder(this.series[index].plot);
  3505. if(name != newOrder[newOrder.length - 1]){
  3506. newOrder.splice(index, 1);
  3507. newOrder.push(name);
  3508. return this.setSeriesOrder(newOrder); // dojox.charting.Chart
  3509. }
  3510. }
  3511. return this; // dojox.charting.Chart
  3512. },
  3513. resize: function(width, height){
  3514. // summary:
  3515. // Resize the chart to the dimensions of width and height.
  3516. // description:
  3517. // Resize the chart and its surface to the width and height dimensions.
  3518. // If no width/height or box is provided, resize the surface to the marginBox of the chart.
  3519. // width: Number
  3520. // The new width of the chart.
  3521. // height: Number
  3522. // The new height of the chart.
  3523. // returns: dojox.charting.Chart
  3524. // A reference to the current chart for functional chaining.
  3525. var box;
  3526. switch(arguments.length){
  3527. // case 0, do not resize the div, just the surface
  3528. case 1:
  3529. // argument, override node box
  3530. box = lang.mixin({}, width);
  3531. domGeom.setMarginBox(this.node, box);
  3532. break;
  3533. case 2:
  3534. box = {w: width, h: height};
  3535. // argument, override node box
  3536. domGeom.setMarginBox(this.node, box);
  3537. break;
  3538. }
  3539. // in all cases take back the computed box
  3540. box = domGeom.getMarginBox(this.node);
  3541. var d = this.surface.getDimensions();
  3542. if(d.width != box.w || d.height != box.h){
  3543. // and set it on the surface
  3544. this.surface.setDimensions(box.w, box.h);
  3545. this.dirty = true;
  3546. return this.render(); // dojox.charting.Chart
  3547. }else{
  3548. return this;
  3549. }
  3550. },
  3551. getGeometry: function(){
  3552. // summary:
  3553. // Returns a map of information about all axes in a chart and what they represent
  3554. // in terms of scaling (see dojox.charting.axis2d.Default.getScaler).
  3555. // returns: Object
  3556. // An map of geometry objects, a one-to-one mapping of axes.
  3557. var ret = {};
  3558. func.forIn(this.axes, function(axis){
  3559. if(axis.initialized()){
  3560. ret[axis.name] = {
  3561. name: axis.name,
  3562. vertical: axis.vertical,
  3563. scaler: axis.scaler,
  3564. ticks: axis.ticks
  3565. };
  3566. }
  3567. });
  3568. return ret; // Object
  3569. },
  3570. setAxisWindow: function(name, scale, offset, zoom){
  3571. // summary:
  3572. // Zooms an axis and all dependent plots. Can be used to zoom in 1D.
  3573. // name: String
  3574. // The name of the axis as defined by addAxis.
  3575. // scale: Number
  3576. // The scale on the target axis.
  3577. // offset: Number
  3578. // Any offest, as measured by axis tick
  3579. // zoom: Boolean|Object?
  3580. // The chart zooming animation trigger. This is null by default,
  3581. // e.g. {duration: 1200}, or just set true.
  3582. // returns: dojox.charting.Chart
  3583. // A reference to the current chart for functional chaining.
  3584. var axis = this.axes[name];
  3585. if(axis){
  3586. axis.setWindow(scale, offset);
  3587. arr.forEach(this.stack,function(plot){
  3588. if(plot.hAxis == name || plot.vAxis == name){
  3589. plot.zoom = zoom;
  3590. }
  3591. });
  3592. }
  3593. return this; // dojox.charting.Chart
  3594. },
  3595. setWindow: function(sx, sy, dx, dy, zoom){
  3596. // summary:
  3597. // Zooms in or out any plots in two dimensions.
  3598. // sx: Number
  3599. // The scale for the x axis.
  3600. // sy: Number
  3601. // The scale for the y axis.
  3602. // dx: Number
  3603. // The pixel offset on the x axis.
  3604. // dy: Number
  3605. // The pixel offset on the y axis.
  3606. // zoom: Boolean|Object?
  3607. // The chart zooming animation trigger. This is null by default,
  3608. // e.g. {duration: 1200}, or just set true.
  3609. // returns: dojox.charting.Chart
  3610. // A reference to the current chart for functional chaining.
  3611. if(!("plotArea" in this)){
  3612. this.calculateGeometry();
  3613. }
  3614. func.forIn(this.axes, function(axis){
  3615. var scale, offset, bounds = axis.getScaler().bounds,
  3616. s = bounds.span / (bounds.upper - bounds.lower);
  3617. if(axis.vertical){
  3618. scale = sy;
  3619. offset = dy / s / scale;
  3620. }else{
  3621. scale = sx;
  3622. offset = dx / s / scale;
  3623. }
  3624. axis.setWindow(scale, offset);
  3625. });
  3626. arr.forEach(this.stack, function(plot){ plot.zoom = zoom; });
  3627. return this; // dojox.charting.Chart
  3628. },
  3629. zoomIn: function(name, range){
  3630. // summary:
  3631. // Zoom the chart to a specific range on one axis. This calls render()
  3632. // directly as a convenience method.
  3633. // name: String
  3634. // The name of the axis as defined by addAxis.
  3635. // range: Array
  3636. // The end points of the zoom range, measured in axis ticks.
  3637. var axis = this.axes[name];
  3638. if(axis){
  3639. var scale, offset, bounds = axis.getScaler().bounds;
  3640. var lower = Math.min(range[0],range[1]);
  3641. var upper = Math.max(range[0],range[1]);
  3642. lower = range[0] < bounds.lower ? bounds.lower : lower;
  3643. upper = range[1] > bounds.upper ? bounds.upper : upper;
  3644. scale = (bounds.upper - bounds.lower) / (upper - lower);
  3645. offset = lower - bounds.lower;
  3646. this.setAxisWindow(name, scale, offset);
  3647. this.render();
  3648. }
  3649. },
  3650. calculateGeometry: function(){
  3651. // summary:
  3652. // Calculate the geometry of the chart based on the defined axes of
  3653. // a chart.
  3654. // returns: dojox.charting.Chart
  3655. // A reference to the current chart for functional chaining.
  3656. if(this.dirty){
  3657. return this.fullGeometry();
  3658. }
  3659. // calculate geometry
  3660. var dirty = arr.filter(this.stack, function(plot){
  3661. return plot.dirty ||
  3662. (plot.hAxis && this.axes[plot.hAxis].dirty) ||
  3663. (plot.vAxis && this.axes[plot.vAxis].dirty);
  3664. }, this);
  3665. calculateAxes(dirty, this.plotArea);
  3666. return this; // dojox.charting.Chart
  3667. },
  3668. fullGeometry: function(){
  3669. // summary:
  3670. // Calculate the full geometry of the chart. This includes passing
  3671. // over all major elements of a chart (plots, axes, series, container)
  3672. // in order to ensure proper rendering.
  3673. // returns: dojox.charting.Chart
  3674. // A reference to the current chart for functional chaining.
  3675. this._makeDirty();
  3676. // clear old values
  3677. arr.forEach(this.stack, clear);
  3678. // rebuild new connections, and add defaults
  3679. // set up a theme
  3680. if(!this.theme){
  3681. this.setTheme(new Theme(dojox.charting._def));
  3682. }
  3683. // assign series
  3684. arr.forEach(this.series, function(run){
  3685. if(!(run.plot in this.plots)){
  3686. if(!dc.plot2d || !dc.plot2d.Default){
  3687. throw Error("Can't find plot: Default - didn't you forget to dojo" + ".require() it?");
  3688. }
  3689. var plot = new dc.plot2d.Default(this, {});
  3690. plot.name = run.plot;
  3691. this.plots[run.plot] = this.stack.length;
  3692. this.stack.push(plot);
  3693. }
  3694. this.stack[this.plots[run.plot]].addSeries(run);
  3695. }, this);
  3696. // assign axes
  3697. arr.forEach(this.stack, function(plot){
  3698. if(plot.hAxis){
  3699. plot.setAxis(this.axes[plot.hAxis]);
  3700. }
  3701. if(plot.vAxis){
  3702. plot.setAxis(this.axes[plot.vAxis]);
  3703. }
  3704. }, this);
  3705. // calculate geometry
  3706. // 1st pass
  3707. var dim = this.dim = this.surface.getDimensions();
  3708. dim.width = g.normalizedLength(dim.width);
  3709. dim.height = g.normalizedLength(dim.height);
  3710. func.forIn(this.axes, clear);
  3711. calculateAxes(this.stack, dim);
  3712. // assumption: we don't have stacked axes yet
  3713. var offsets = this.offsets = { l: 0, r: 0, t: 0, b: 0 };
  3714. func.forIn(this.axes, function(axis){
  3715. func.forIn(axis.getOffsets(), function(o, i){ offsets[i] += o; });
  3716. });
  3717. // add title area
  3718. if(this.title){
  3719. this.titleGap = (this.titleGap==0) ? 0 : this.titleGap || this.theme.chart.titleGap || 20;
  3720. this.titlePos = this.titlePos || this.theme.chart.titlePos || "top";
  3721. this.titleFont = this.titleFont || this.theme.chart.titleFont;
  3722. this.titleFontColor = this.titleFontColor || this.theme.chart.titleFontColor || "black";
  3723. var tsize = g.normalizedLength(g.splitFontString(this.titleFont).size);
  3724. offsets[this.titlePos=="top" ? "t":"b"] += (tsize + this.titleGap);
  3725. }
  3726. // add margins
  3727. func.forIn(this.margins, function(o, i){ offsets[i] += o; });
  3728. // 2nd pass with realistic dimensions
  3729. this.plotArea = {
  3730. width: dim.width - offsets.l - offsets.r,
  3731. height: dim.height - offsets.t - offsets.b
  3732. };
  3733. func.forIn(this.axes, clear);
  3734. calculateAxes(this.stack, this.plotArea);
  3735. return this; // dojox.charting.Chart
  3736. },
  3737. render: function(){
  3738. // summary:
  3739. // Render the chart according to the current information defined. This should
  3740. // be the last call made when defining/creating a chart, or if data within the
  3741. // chart has been changed.
  3742. // returns: dojox.charting.Chart
  3743. // A reference to the current chart for functional chaining.
  3744. if(this.theme){
  3745. this.theme.clear();
  3746. }
  3747. if(this.dirty){
  3748. return this.fullRender();
  3749. }
  3750. this.calculateGeometry();
  3751. // go over the stack backwards
  3752. func.forEachRev(this.stack, function(plot){ plot.render(this.dim, this.offsets); }, this);
  3753. // go over axes
  3754. func.forIn(this.axes, function(axis){ axis.render(this.dim, this.offsets); }, this);
  3755. this._makeClean();
  3756. // BEGIN FOR HTML CANVAS
  3757. if(this.surface.render){ this.surface.render(); };
  3758. // END FOR HTML CANVAS
  3759. return this; // dojox.charting.Chart
  3760. },
  3761. fullRender: function(){
  3762. // summary:
  3763. // Force a full rendering of the chart, including full resets on the chart itself.
  3764. // You should not call this method directly unless absolutely necessary.
  3765. // returns: dojox.charting.Chart
  3766. // A reference to the current chart for functional chaining.
  3767. // calculate geometry
  3768. this.fullGeometry();
  3769. var offsets = this.offsets, dim = this.dim, rect;
  3770. // get required colors
  3771. //var requiredColors = func.foldl(this.stack, "z + plot.getRequiredColors()", 0);
  3772. //this.theme.defineColors({num: requiredColors, cache: false});
  3773. // clear old shapes
  3774. arr.forEach(this.series, purge);
  3775. func.forIn(this.axes, purge);
  3776. arr.forEach(this.stack, purge);
  3777. arr.forEach(this._clearRects, function(child){
  3778. shape.dispose(child);
  3779. });
  3780. this._clearRects = [];
  3781. if(this.chartTitle && this.chartTitle.tagName){
  3782. // destroy title if it is a DOM node
  3783. domConstruct.destroy(this.chartTitle);
  3784. }
  3785. this.surface.clear();
  3786. this.chartTitle = null;
  3787. // generate shapes
  3788. // draw a plot background
  3789. var t = this.theme,
  3790. fill = t.plotarea && t.plotarea.fill,
  3791. stroke = t.plotarea && t.plotarea.stroke,
  3792. // size might be neg if offsets are bigger that chart size this happens quite often at
  3793. // initialization time if the chart widget is used in a BorderContainer
  3794. // this will fail on IE/VML
  3795. w = Math.max(0, dim.width - offsets.l - offsets.r),
  3796. h = Math.max(0, dim.height - offsets.t - offsets.b),
  3797. rect = {
  3798. x: offsets.l - 1, y: offsets.t - 1,
  3799. width: w + 2,
  3800. height: h + 2
  3801. };
  3802. if(fill){
  3803. fill = Element.prototype._shapeFill(Element.prototype._plotFill(fill, dim, offsets), rect);
  3804. this._clearRects.push(this.surface.createRect(rect).setFill(fill));
  3805. }
  3806. if(stroke){
  3807. this._clearRects.push(this.surface.createRect({
  3808. x: offsets.l, y: offsets.t,
  3809. width: w + 1,
  3810. height: h + 1
  3811. }).setStroke(stroke));
  3812. }
  3813. // go over the stack backwards
  3814. func.foldr(this.stack, function(z, plot){ return plot.render(dim, offsets), 0; }, 0);
  3815. // pseudo-clipping: matting
  3816. fill = this.fill !== undefined ? this.fill : (t.chart && t.chart.fill);
  3817. stroke = this.stroke !== undefined ? this.stroke : (t.chart && t.chart.stroke);
  3818. // TRT: support for "inherit" as a named value in a theme.
  3819. if(fill == "inherit"){
  3820. // find the background color of the nearest ancestor node, and use that explicitly.
  3821. var node = this.node, fill = new Color(html.style(node, "backgroundColor"));
  3822. while(fill.a==0 && node!=document.documentElement){
  3823. fill = new Color(html.style(node, "backgroundColor"));
  3824. node = node.parentNode;
  3825. }
  3826. }
  3827. if(fill){
  3828. fill = Element.prototype._plotFill(fill, dim, offsets);
  3829. if(offsets.l){ // left
  3830. rect = {
  3831. width: offsets.l,
  3832. height: dim.height + 1
  3833. };
  3834. this._clearRects.push(this.surface.createRect(rect).setFill(Element.prototype._shapeFill(fill, rect)));
  3835. }
  3836. if(offsets.r){ // right
  3837. rect = {
  3838. x: dim.width - offsets.r,
  3839. width: offsets.r + 1,
  3840. height: dim.height + 2
  3841. };
  3842. this._clearRects.push(this.surface.createRect(rect).setFill(Element.prototype._shapeFill(fill, rect)));
  3843. }
  3844. if(offsets.t){ // top
  3845. rect = {
  3846. width: dim.width + 1,
  3847. height: offsets.t
  3848. };
  3849. this._clearRects.push(this.surface.createRect(rect).setFill(Element.prototype._shapeFill(fill, rect)));
  3850. }
  3851. if(offsets.b){ // bottom
  3852. rect = {
  3853. y: dim.height - offsets.b,
  3854. width: dim.width + 1,
  3855. height: offsets.b + 2
  3856. };
  3857. this._clearRects.push(this.surface.createRect(rect).setFill(Element.prototype._shapeFill(fill, rect)));
  3858. }
  3859. }
  3860. if(stroke){
  3861. this._clearRects.push(this.surface.createRect({
  3862. width: dim.width - 1,
  3863. height: dim.height - 1
  3864. }).setStroke(stroke));
  3865. }
  3866. //create title: Whether to make chart title as a widget which extends dojox.charting.Element?
  3867. if(this.title){
  3868. var forceHtmlLabels = (g.renderer == "canvas"),
  3869. labelType = forceHtmlLabels || !has("ie") && !has("opera") ? "html" : "gfx",
  3870. tsize = g.normalizedLength(g.splitFontString(this.titleFont).size);
  3871. this.chartTitle = common.createText[labelType](
  3872. this,
  3873. this.surface,
  3874. dim.width/2,
  3875. this.titlePos=="top" ? tsize + this.margins.t : dim.height - this.margins.b,
  3876. "middle",
  3877. this.title,
  3878. this.titleFont,
  3879. this.titleFontColor
  3880. );
  3881. }
  3882. // go over axes
  3883. func.forIn(this.axes, function(axis){ axis.render(dim, offsets); });
  3884. this._makeClean();
  3885. // BEGIN FOR HTML CANVAS
  3886. if(this.surface.render){ this.surface.render(); };
  3887. // END FOR HTML CANVAS
  3888. return this; // dojox.charting.Chart
  3889. },
  3890. delayedRender: function(){
  3891. // summary:
  3892. // Delayed render, which is used to collect multiple updates
  3893. // within a delayInMs time window.
  3894. // returns: dojox.charting.Chart
  3895. // A reference to the current chart for functional chaining.
  3896. if(!this._delayedRenderHandle){
  3897. this._delayedRenderHandle = setTimeout(
  3898. lang.hitch(this, function(){
  3899. clearTimeout(this._delayedRenderHandle);
  3900. this._delayedRenderHandle = null;
  3901. this.render();
  3902. }),
  3903. this.delayInMs
  3904. );
  3905. }
  3906. return this; // dojox.charting.Chart
  3907. },
  3908. connectToPlot: function(name, object, method){
  3909. // summary:
  3910. // A convenience method to connect a function to a plot.
  3911. // name: String
  3912. // The name of the plot as defined by addPlot.
  3913. // object: Object
  3914. // The object to be connected.
  3915. // method: Function
  3916. // The function to be executed.
  3917. // returns: Array
  3918. // A handle to the connection, as defined by dojo.connect (see dojo.connect).
  3919. return name in this.plots ? this.stack[this.plots[name]].connect(object, method) : null; // Array
  3920. },
  3921. fireEvent: function(seriesName, eventName, index){
  3922. // summary:
  3923. // Fires a synthetic event for a series item.
  3924. // seriesName: String:
  3925. // Series name.
  3926. // eventName: String:
  3927. // Event name to simulate: onmouseover, onmouseout, onclick.
  3928. // index: Number:
  3929. // Valid data value index for the event.
  3930. // returns: dojox.charting.Chart
  3931. // A reference to the current chart for functional chaining.
  3932. if(seriesName in this.runs){
  3933. var plotName = this.series[this.runs[seriesName]].plot;
  3934. if(plotName in this.plots){
  3935. var plot = this.stack[this.plots[plotName]];
  3936. if(plot){
  3937. plot.fireEvent(seriesName, eventName, index);
  3938. }
  3939. }
  3940. }
  3941. return this; // dojox.charting.Chart
  3942. },
  3943. _makeClean: function(){
  3944. // reset dirty flags
  3945. arr.forEach(this.axes, makeClean);
  3946. arr.forEach(this.stack, makeClean);
  3947. arr.forEach(this.series, makeClean);
  3948. this.dirty = false;
  3949. },
  3950. _makeDirty: function(){
  3951. // reset dirty flags
  3952. arr.forEach(this.axes, makeDirty);
  3953. arr.forEach(this.stack, makeDirty);
  3954. arr.forEach(this.series, makeDirty);
  3955. this.dirty = true;
  3956. },
  3957. _invalidateDependentPlots: function(plotName, /* Boolean */ verticalAxis){
  3958. if(plotName in this.plots){
  3959. var plot = this.stack[this.plots[plotName]], axis,
  3960. axisName = verticalAxis ? "vAxis" : "hAxis";
  3961. if(plot[axisName]){
  3962. axis = this.axes[plot[axisName]];
  3963. if(axis && axis.dependOnData()){
  3964. axis.dirty = true;
  3965. // find all plots and mark them dirty
  3966. arr.forEach(this.stack, function(p){
  3967. if(p[axisName] && p[axisName] == plot[axisName]){
  3968. p.dirty = true;
  3969. }
  3970. });
  3971. }
  3972. }else{
  3973. plot.dirty = true;
  3974. }
  3975. }
  3976. }
  3977. });
  3978. function hSection(stats){
  3979. return {min: stats.hmin, max: stats.hmax};
  3980. }
  3981. function vSection(stats){
  3982. return {min: stats.vmin, max: stats.vmax};
  3983. }
  3984. function hReplace(stats, h){
  3985. stats.hmin = h.min;
  3986. stats.hmax = h.max;
  3987. }
  3988. function vReplace(stats, v){
  3989. stats.vmin = v.min;
  3990. stats.vmax = v.max;
  3991. }
  3992. function combineStats(target, source){
  3993. if(target && source){
  3994. target.min = Math.min(target.min, source.min);
  3995. target.max = Math.max(target.max, source.max);
  3996. }
  3997. return target || source;
  3998. }
  3999. function calculateAxes(stack, plotArea){
  4000. var plots = {}, axes = {};
  4001. arr.forEach(stack, function(plot){
  4002. var stats = plots[plot.name] = plot.getSeriesStats();
  4003. if(plot.hAxis){
  4004. axes[plot.hAxis] = combineStats(axes[plot.hAxis], hSection(stats));
  4005. }
  4006. if(plot.vAxis){
  4007. axes[plot.vAxis] = combineStats(axes[plot.vAxis], vSection(stats));
  4008. }
  4009. });
  4010. arr.forEach(stack, function(plot){
  4011. var stats = plots[plot.name];
  4012. if(plot.hAxis){
  4013. hReplace(stats, axes[plot.hAxis]);
  4014. }
  4015. if(plot.vAxis){
  4016. vReplace(stats, axes[plot.vAxis]);
  4017. }
  4018. plot.initializeScalers(plotArea, stats);
  4019. });
  4020. }
  4021. return dojox.charting.Chart;
  4022. });
  4023. },
  4024. 'dojox/lang/functional/sequence':function(){
  4025. define("dojox/lang/functional/sequence", ["dojo/_base/lang", "./lambda"], function(lang, df){
  4026. // This module adds high-level functions and related constructs:
  4027. // - sequence generators
  4028. // If you want more general sequence builders check out listcomp.js and
  4029. // unfold() (in fold.js).
  4030. // Defined methods:
  4031. // - take any valid lambda argument as the functional argument
  4032. /*=====
  4033. var df = dojox.lang.functional;
  4034. =====*/
  4035. lang.mixin(df, {
  4036. // sequence generators
  4037. repeat: function(/*Number*/ n, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){
  4038. // summary: builds an array by repeatedly applying a unary function N times
  4039. // with a seed value Z. N should be greater than 0.
  4040. o = o || dojo.global; f = df.lambda(f);
  4041. var t = new Array(n), i = 1;
  4042. t[0] = z;
  4043. for(; i < n; t[i] = z = f.call(o, z), ++i);
  4044. return t; // Array
  4045. },
  4046. until: function(/*Function|String|Array*/ pr, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){
  4047. // summary: builds an array by repeatedly applying a unary function with
  4048. // a seed value Z until the predicate is satisfied.
  4049. o = o || dojo.global; f = df.lambda(f); pr = df.lambda(pr);
  4050. var t = [];
  4051. for(; !pr.call(o, z); t.push(z), z = f.call(o, z));
  4052. return t; // Array
  4053. }
  4054. });
  4055. return df;
  4056. });
  4057. },
  4058. 'dojox/charting/plot2d/MarkersOnly':function(){
  4059. define("dojox/charting/plot2d/MarkersOnly", ["dojo/_base/declare", "./Default"], function(declare, Default){
  4060. /*=====
  4061. var Default = dojox.charting.plot2d.Default;
  4062. =====*/
  4063. return declare("dojox.charting.plot2d.MarkersOnly", Default, {
  4064. // summary:
  4065. // A convenience object to draw only markers (like a scatter but not quite).
  4066. constructor: function(){
  4067. // summary:
  4068. // Set up our default plot to only have markers and no lines.
  4069. this.opt.lines = false;
  4070. this.opt.markers = true;
  4071. }
  4072. });
  4073. });
  4074. },
  4075. 'dojox/charting/plot2d/Areas':function(){
  4076. define("dojox/charting/plot2d/Areas", ["dojo/_base/declare", "./Default"],
  4077. function(declare, Default){
  4078. /*=====
  4079. var Default = dojox.charting.plot2d.Default;
  4080. =====*/
  4081. return declare("dojox.charting.plot2d.Areas", Default, {
  4082. // summary:
  4083. // Represents an area chart. See dojox.charting.plot2d.Default for details.
  4084. constructor: function(){
  4085. this.opt.lines = true;
  4086. this.opt.areas = true;
  4087. }
  4088. });
  4089. });
  4090. },
  4091. 'dojox/charting/action2d/Base':function(){
  4092. define("dojox/charting/action2d/Base", ["dojo/_base/lang", "dojo/_base/declare"],
  4093. function(lang, declare){
  4094. return declare("dojox.charting.action2d.Base", null, {
  4095. // summary:
  4096. // Base action class for plot and chart actions.
  4097. constructor: function(chart, plot){
  4098. // summary:
  4099. // Create a new base action. This can either be a plot or a chart action.
  4100. // chart: dojox.charting.Chart
  4101. // The chart this action applies to.
  4102. // plot: String?|dojox.charting.plot2d.Base?
  4103. // Optional target plot for this action. Default is "default".
  4104. this.chart = chart;
  4105. this.plot = plot ? (lang.isString(plot) ? this.chart.getPlot(plot) : plot) : this.chart.getPlot("default");
  4106. },
  4107. connect: function(){
  4108. // summary:
  4109. // Connect this action to the plot or the chart.
  4110. },
  4111. disconnect: function(){
  4112. // summary:
  4113. // Disconnect this action from the plot or the chart.
  4114. },
  4115. destroy: function(){
  4116. // summary:
  4117. // Do any cleanup needed when destroying parent elements.
  4118. this.disconnect();
  4119. }
  4120. });
  4121. });
  4122. },
  4123. 'dojo/fx':function(){
  4124. define([
  4125. "./_base/lang",
  4126. "./Evented",
  4127. "./_base/kernel",
  4128. "./_base/array",
  4129. "./_base/connect",
  4130. "./_base/fx",
  4131. "./dom",
  4132. "./dom-style",
  4133. "./dom-geometry",
  4134. "./ready",
  4135. "require" // for context sensitive loading of Toggler
  4136. ], function(lang, Evented, dojo, arrayUtil, connect, baseFx, dom, domStyle, geom, ready, require) {
  4137. // module:
  4138. // dojo/fx
  4139. // summary:
  4140. // TODOC
  4141. /*=====
  4142. dojo.fx = {
  4143. // summary: Effects library on top of Base animations
  4144. };
  4145. var coreFx = dojo.fx;
  4146. =====*/
  4147. // For back-compat, remove in 2.0.
  4148. if(!dojo.isAsync){
  4149. ready(0, function(){
  4150. var requires = ["./fx/Toggler"];
  4151. require(requires); // use indirection so modules not rolled into a build
  4152. });
  4153. }
  4154. var coreFx = dojo.fx = {};
  4155. var _baseObj = {
  4156. _fire: function(evt, args){
  4157. if(this[evt]){
  4158. this[evt].apply(this, args||[]);
  4159. }
  4160. return this;
  4161. }
  4162. };
  4163. var _chain = function(animations){
  4164. this._index = -1;
  4165. this._animations = animations||[];
  4166. this._current = this._onAnimateCtx = this._onEndCtx = null;
  4167. this.duration = 0;
  4168. arrayUtil.forEach(this._animations, function(a){
  4169. this.duration += a.duration;
  4170. if(a.delay){ this.duration += a.delay; }
  4171. }, this);
  4172. };
  4173. _chain.prototype = new Evented();
  4174. lang.extend(_chain, {
  4175. _onAnimate: function(){
  4176. this._fire("onAnimate", arguments);
  4177. },
  4178. _onEnd: function(){
  4179. connect.disconnect(this._onAnimateCtx);
  4180. connect.disconnect(this._onEndCtx);
  4181. this._onAnimateCtx = this._onEndCtx = null;
  4182. if(this._index + 1 == this._animations.length){
  4183. this._fire("onEnd");
  4184. }else{
  4185. // switch animations
  4186. this._current = this._animations[++this._index];
  4187. this._onAnimateCtx = connect.connect(this._current, "onAnimate", this, "_onAnimate");
  4188. this._onEndCtx = connect.connect(this._current, "onEnd", this, "_onEnd");
  4189. this._current.play(0, true);
  4190. }
  4191. },
  4192. play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
  4193. if(!this._current){ this._current = this._animations[this._index = 0]; }
  4194. if(!gotoStart && this._current.status() == "playing"){ return this; }
  4195. var beforeBegin = connect.connect(this._current, "beforeBegin", this, function(){
  4196. this._fire("beforeBegin");
  4197. }),
  4198. onBegin = connect.connect(this._current, "onBegin", this, function(arg){
  4199. this._fire("onBegin", arguments);
  4200. }),
  4201. onPlay = connect.connect(this._current, "onPlay", this, function(arg){
  4202. this._fire("onPlay", arguments);
  4203. connect.disconnect(beforeBegin);
  4204. connect.disconnect(onBegin);
  4205. connect.disconnect(onPlay);
  4206. });
  4207. if(this._onAnimateCtx){
  4208. connect.disconnect(this._onAnimateCtx);
  4209. }
  4210. this._onAnimateCtx = connect.connect(this._current, "onAnimate", this, "_onAnimate");
  4211. if(this._onEndCtx){
  4212. connect.disconnect(this._onEndCtx);
  4213. }
  4214. this._onEndCtx = connect.connect(this._current, "onEnd", this, "_onEnd");
  4215. this._current.play.apply(this._current, arguments);
  4216. return this;
  4217. },
  4218. pause: function(){
  4219. if(this._current){
  4220. var e = connect.connect(this._current, "onPause", this, function(arg){
  4221. this._fire("onPause", arguments);
  4222. connect.disconnect(e);
  4223. });
  4224. this._current.pause();
  4225. }
  4226. return this;
  4227. },
  4228. gotoPercent: function(/*Decimal*/percent, /*Boolean?*/ andPlay){
  4229. this.pause();
  4230. var offset = this.duration * percent;
  4231. this._current = null;
  4232. arrayUtil.some(this._animations, function(a){
  4233. if(a.duration <= offset){
  4234. this._current = a;
  4235. return true;
  4236. }
  4237. offset -= a.duration;
  4238. return false;
  4239. });
  4240. if(this._current){
  4241. this._current.gotoPercent(offset / this._current.duration, andPlay);
  4242. }
  4243. return this;
  4244. },
  4245. stop: function(/*boolean?*/ gotoEnd){
  4246. if(this._current){
  4247. if(gotoEnd){
  4248. for(; this._index + 1 < this._animations.length; ++this._index){
  4249. this._animations[this._index].stop(true);
  4250. }
  4251. this._current = this._animations[this._index];
  4252. }
  4253. var e = connect.connect(this._current, "onStop", this, function(arg){
  4254. this._fire("onStop", arguments);
  4255. connect.disconnect(e);
  4256. });
  4257. this._current.stop();
  4258. }
  4259. return this;
  4260. },
  4261. status: function(){
  4262. return this._current ? this._current.status() : "stopped";
  4263. },
  4264. destroy: function(){
  4265. if(this._onAnimateCtx){ connect.disconnect(this._onAnimateCtx); }
  4266. if(this._onEndCtx){ connect.disconnect(this._onEndCtx); }
  4267. }
  4268. });
  4269. lang.extend(_chain, _baseObj);
  4270. coreFx.chain = /*===== dojo.fx.chain = =====*/ function(/*dojo.Animation[]*/ animations){
  4271. // summary:
  4272. // Chain a list of `dojo.Animation`s to run in sequence
  4273. //
  4274. // description:
  4275. // Return a `dojo.Animation` which will play all passed
  4276. // `dojo.Animation` instances in sequence, firing its own
  4277. // synthesized events simulating a single animation. (eg:
  4278. // onEnd of this animation means the end of the chain,
  4279. // not the individual animations within)
  4280. //
  4281. // example:
  4282. // Once `node` is faded out, fade in `otherNode`
  4283. // | dojo.fx.chain([
  4284. // | dojo.fadeIn({ node:node }),
  4285. // | dojo.fadeOut({ node:otherNode })
  4286. // | ]).play();
  4287. //
  4288. return new _chain(animations); // dojo.Animation
  4289. };
  4290. var _combine = function(animations){
  4291. this._animations = animations||[];
  4292. this._connects = [];
  4293. this._finished = 0;
  4294. this.duration = 0;
  4295. arrayUtil.forEach(animations, function(a){
  4296. var duration = a.duration;
  4297. if(a.delay){ duration += a.delay; }
  4298. if(this.duration < duration){ this.duration = duration; }
  4299. this._connects.push(connect.connect(a, "onEnd", this, "_onEnd"));
  4300. }, this);
  4301. this._pseudoAnimation = new baseFx.Animation({curve: [0, 1], duration: this.duration});
  4302. var self = this;
  4303. arrayUtil.forEach(["beforeBegin", "onBegin", "onPlay", "onAnimate", "onPause", "onStop", "onEnd"],
  4304. function(evt){
  4305. self._connects.push(connect.connect(self._pseudoAnimation, evt,
  4306. function(){ self._fire(evt, arguments); }
  4307. ));
  4308. }
  4309. );
  4310. };
  4311. lang.extend(_combine, {
  4312. _doAction: function(action, args){
  4313. arrayUtil.forEach(this._animations, function(a){
  4314. a[action].apply(a, args);
  4315. });
  4316. return this;
  4317. },
  4318. _onEnd: function(){
  4319. if(++this._finished > this._animations.length){
  4320. this._fire("onEnd");
  4321. }
  4322. },
  4323. _call: function(action, args){
  4324. var t = this._pseudoAnimation;
  4325. t[action].apply(t, args);
  4326. },
  4327. play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
  4328. this._finished = 0;
  4329. this._doAction("play", arguments);
  4330. this._call("play", arguments);
  4331. return this;
  4332. },
  4333. pause: function(){
  4334. this._doAction("pause", arguments);
  4335. this._call("pause", arguments);
  4336. return this;
  4337. },
  4338. gotoPercent: function(/*Decimal*/percent, /*Boolean?*/ andPlay){
  4339. var ms = this.duration * percent;
  4340. arrayUtil.forEach(this._animations, function(a){
  4341. a.gotoPercent(a.duration < ms ? 1 : (ms / a.duration), andPlay);
  4342. });
  4343. this._call("gotoPercent", arguments);
  4344. return this;
  4345. },
  4346. stop: function(/*boolean?*/ gotoEnd){
  4347. this._doAction("stop", arguments);
  4348. this._call("stop", arguments);
  4349. return this;
  4350. },
  4351. status: function(){
  4352. return this._pseudoAnimation.status();
  4353. },
  4354. destroy: function(){
  4355. arrayUtil.forEach(this._connects, connect.disconnect);
  4356. }
  4357. });
  4358. lang.extend(_combine, _baseObj);
  4359. coreFx.combine = /*===== dojo.fx.combine = =====*/ function(/*dojo.Animation[]*/ animations){
  4360. // summary:
  4361. // Combine a list of `dojo.Animation`s to run in parallel
  4362. //
  4363. // description:
  4364. // Combine an array of `dojo.Animation`s to run in parallel,
  4365. // providing a new `dojo.Animation` instance encompasing each
  4366. // animation, firing standard animation events.
  4367. //
  4368. // example:
  4369. // Fade out `node` while fading in `otherNode` simultaneously
  4370. // | dojo.fx.combine([
  4371. // | dojo.fadeIn({ node:node }),
  4372. // | dojo.fadeOut({ node:otherNode })
  4373. // | ]).play();
  4374. //
  4375. // example:
  4376. // When the longest animation ends, execute a function:
  4377. // | var anim = dojo.fx.combine([
  4378. // | dojo.fadeIn({ node: n, duration:700 }),
  4379. // | dojo.fadeOut({ node: otherNode, duration: 300 })
  4380. // | ]);
  4381. // | dojo.connect(anim, "onEnd", function(){
  4382. // | // overall animation is done.
  4383. // | });
  4384. // | anim.play(); // play the animation
  4385. //
  4386. return new _combine(animations); // dojo.Animation
  4387. };
  4388. coreFx.wipeIn = /*===== dojo.fx.wipeIn = =====*/ function(/*Object*/ args){
  4389. // summary:
  4390. // Expand a node to it's natural height.
  4391. //
  4392. // description:
  4393. // Returns an animation that will expand the
  4394. // node defined in 'args' object from it's current height to
  4395. // it's natural height (with no scrollbar).
  4396. // Node must have no margin/border/padding.
  4397. //
  4398. // args: Object
  4399. // A hash-map of standard `dojo.Animation` constructor properties
  4400. // (such as easing: node: duration: and so on)
  4401. //
  4402. // example:
  4403. // | dojo.fx.wipeIn({
  4404. // | node:"someId"
  4405. // | }).play()
  4406. var node = args.node = dom.byId(args.node), s = node.style, o;
  4407. var anim = baseFx.animateProperty(lang.mixin({
  4408. properties: {
  4409. height: {
  4410. // wrapped in functions so we wait till the last second to query (in case value has changed)
  4411. start: function(){
  4412. // start at current [computed] height, but use 1px rather than 0
  4413. // because 0 causes IE to display the whole panel
  4414. o = s.overflow;
  4415. s.overflow = "hidden";
  4416. if(s.visibility == "hidden" || s.display == "none"){
  4417. s.height = "1px";
  4418. s.display = "";
  4419. s.visibility = "";
  4420. return 1;
  4421. }else{
  4422. var height = domStyle.get(node, "height");
  4423. return Math.max(height, 1);
  4424. }
  4425. },
  4426. end: function(){
  4427. return node.scrollHeight;
  4428. }
  4429. }
  4430. }
  4431. }, args));
  4432. var fini = function(){
  4433. s.height = "auto";
  4434. s.overflow = o;
  4435. };
  4436. connect.connect(anim, "onStop", fini);
  4437. connect.connect(anim, "onEnd", fini);
  4438. return anim; // dojo.Animation
  4439. };
  4440. coreFx.wipeOut = /*===== dojo.fx.wipeOut = =====*/ function(/*Object*/ args){
  4441. // summary:
  4442. // Shrink a node to nothing and hide it.
  4443. //
  4444. // description:
  4445. // Returns an animation that will shrink node defined in "args"
  4446. // from it's current height to 1px, and then hide it.
  4447. //
  4448. // args: Object
  4449. // A hash-map of standard `dojo.Animation` constructor properties
  4450. // (such as easing: node: duration: and so on)
  4451. //
  4452. // example:
  4453. // | dojo.fx.wipeOut({ node:"someId" }).play()
  4454. var node = args.node = dom.byId(args.node), s = node.style, o;
  4455. var anim = baseFx.animateProperty(lang.mixin({
  4456. properties: {
  4457. height: {
  4458. end: 1 // 0 causes IE to display the whole panel
  4459. }
  4460. }
  4461. }, args));
  4462. connect.connect(anim, "beforeBegin", function(){
  4463. o = s.overflow;
  4464. s.overflow = "hidden";
  4465. s.display = "";
  4466. });
  4467. var fini = function(){
  4468. s.overflow = o;
  4469. s.height = "auto";
  4470. s.display = "none";
  4471. };
  4472. connect.connect(anim, "onStop", fini);
  4473. connect.connect(anim, "onEnd", fini);
  4474. return anim; // dojo.Animation
  4475. };
  4476. coreFx.slideTo = /*===== dojo.fx.slideTo = =====*/ function(/*Object*/ args){
  4477. // summary:
  4478. // Slide a node to a new top/left position
  4479. //
  4480. // description:
  4481. // Returns an animation that will slide "node"
  4482. // defined in args Object from its current position to
  4483. // the position defined by (args.left, args.top).
  4484. //
  4485. // args: Object
  4486. // A hash-map of standard `dojo.Animation` constructor properties
  4487. // (such as easing: node: duration: and so on). Special args members
  4488. // are `top` and `left`, which indicate the new position to slide to.
  4489. //
  4490. // example:
  4491. // | .slideTo({ node: node, left:"40", top:"50", units:"px" }).play()
  4492. var node = args.node = dom.byId(args.node),
  4493. top = null, left = null;
  4494. var init = (function(n){
  4495. return function(){
  4496. var cs = domStyle.getComputedStyle(n);
  4497. var pos = cs.position;
  4498. top = (pos == 'absolute' ? n.offsetTop : parseInt(cs.top) || 0);
  4499. left = (pos == 'absolute' ? n.offsetLeft : parseInt(cs.left) || 0);
  4500. if(pos != 'absolute' && pos != 'relative'){
  4501. var ret = geom.position(n, true);
  4502. top = ret.y;
  4503. left = ret.x;
  4504. n.style.position="absolute";
  4505. n.style.top=top+"px";
  4506. n.style.left=left+"px";
  4507. }
  4508. };
  4509. })(node);
  4510. init();
  4511. var anim = baseFx.animateProperty(lang.mixin({
  4512. properties: {
  4513. top: args.top || 0,
  4514. left: args.left || 0
  4515. }
  4516. }, args));
  4517. connect.connect(anim, "beforeBegin", anim, init);
  4518. return anim; // dojo.Animation
  4519. };
  4520. return coreFx;
  4521. });
  4522. },
  4523. 'dojox/gfx/fx':function(){
  4524. define("dojox/gfx/fx", ["dojo/_base/lang", "./_base", "./matrix", "dojo/_base/Color", "dojo/_base/array", "dojo/_base/fx", "dojo/_base/connect"],
  4525. function(lang, g, m, Color, arr, fx, Hub){
  4526. var fxg = g.fx = {};
  4527. /*===== g = dojox.gfx; fxg = dojox.gfx.fx; =====*/
  4528. // Generic interpolators. Should they be moved to dojox.fx?
  4529. function InterpolNumber(start, end){
  4530. this.start = start, this.end = end;
  4531. }
  4532. InterpolNumber.prototype.getValue = function(r){
  4533. return (this.end - this.start) * r + this.start;
  4534. };
  4535. function InterpolUnit(start, end, units){
  4536. this.start = start, this.end = end;
  4537. this.units = units;
  4538. }
  4539. InterpolUnit.prototype.getValue = function(r){
  4540. return (this.end - this.start) * r + this.start + this.units;
  4541. };
  4542. function InterpolColor(start, end){
  4543. this.start = start, this.end = end;
  4544. this.temp = new Color();
  4545. }
  4546. InterpolColor.prototype.getValue = function(r){
  4547. return Color.blendColors(this.start, this.end, r, this.temp);
  4548. };
  4549. function InterpolValues(values){
  4550. this.values = values;
  4551. this.length = values.length;
  4552. }
  4553. InterpolValues.prototype.getValue = function(r){
  4554. return this.values[Math.min(Math.floor(r * this.length), this.length - 1)];
  4555. };
  4556. function InterpolObject(values, def){
  4557. this.values = values;
  4558. this.def = def ? def : {};
  4559. }
  4560. InterpolObject.prototype.getValue = function(r){
  4561. var ret = lang.clone(this.def);
  4562. for(var i in this.values){
  4563. ret[i] = this.values[i].getValue(r);
  4564. }
  4565. return ret;
  4566. };
  4567. function InterpolTransform(stack, original){
  4568. this.stack = stack;
  4569. this.original = original;
  4570. }
  4571. InterpolTransform.prototype.getValue = function(r){
  4572. var ret = [];
  4573. arr.forEach(this.stack, function(t){
  4574. if(t instanceof m.Matrix2D){
  4575. ret.push(t);
  4576. return;
  4577. }
  4578. if(t.name == "original" && this.original){
  4579. ret.push(this.original);
  4580. return;
  4581. }
  4582. if(!(t.name in m)){ return; }
  4583. var f = m[t.name];
  4584. if(typeof f != "function"){
  4585. // constant
  4586. ret.push(f);
  4587. return;
  4588. }
  4589. var val = arr.map(t.start, function(v, i){
  4590. return (t.end[i] - v) * r + v;
  4591. }),
  4592. matrix = f.apply(m, val);
  4593. if(matrix instanceof m.Matrix2D){
  4594. ret.push(matrix);
  4595. }
  4596. }, this);
  4597. return ret;
  4598. };
  4599. var transparent = new Color(0, 0, 0, 0);
  4600. function getColorInterpol(prop, obj, name, def){
  4601. if(prop.values){
  4602. return new InterpolValues(prop.values);
  4603. }
  4604. var value, start, end;
  4605. if(prop.start){
  4606. start = g.normalizeColor(prop.start);
  4607. }else{
  4608. start = value = obj ? (name ? obj[name] : obj) : def;
  4609. }
  4610. if(prop.end){
  4611. end = g.normalizeColor(prop.end);
  4612. }else{
  4613. if(!value){
  4614. value = obj ? (name ? obj[name] : obj) : def;
  4615. }
  4616. end = value;
  4617. }
  4618. return new InterpolColor(start, end);
  4619. }
  4620. function getNumberInterpol(prop, obj, name, def){
  4621. if(prop.values){
  4622. return new InterpolValues(prop.values);
  4623. }
  4624. var value, start, end;
  4625. if(prop.start){
  4626. start = prop.start;
  4627. }else{
  4628. start = value = obj ? obj[name] : def;
  4629. }
  4630. if(prop.end){
  4631. end = prop.end;
  4632. }else{
  4633. if(typeof value != "number"){
  4634. value = obj ? obj[name] : def;
  4635. }
  4636. end = value;
  4637. }
  4638. return new InterpolNumber(start, end);
  4639. }
  4640. fxg.animateStroke = function(/*Object*/ args){
  4641. // summary:
  4642. // Returns an animation which will change stroke properties over time.
  4643. // example:
  4644. // | dojox.gfx.fx.animateStroke{{
  4645. // | shape: shape,
  4646. // | duration: 500,
  4647. // | color: {start: "red", end: "green"},
  4648. // | width: {end: 15},
  4649. // | join: {values: ["miter", "bevel", "round"]}
  4650. // | }).play();
  4651. if(!args.easing){ args.easing = fx._defaultEasing; }
  4652. var anim = new fx.Animation(args), shape = args.shape, stroke;
  4653. Hub.connect(anim, "beforeBegin", anim, function(){
  4654. stroke = shape.getStroke();
  4655. var prop = args.color, values = {}, value, start, end;
  4656. if(prop){
  4657. values.color = getColorInterpol(prop, stroke, "color", transparent);
  4658. }
  4659. prop = args.style;
  4660. if(prop && prop.values){
  4661. values.style = new InterpolValues(prop.values);
  4662. }
  4663. prop = args.width;
  4664. if(prop){
  4665. values.width = getNumberInterpol(prop, stroke, "width", 1);
  4666. }
  4667. prop = args.cap;
  4668. if(prop && prop.values){
  4669. values.cap = new InterpolValues(prop.values);
  4670. }
  4671. prop = args.join;
  4672. if(prop){
  4673. if(prop.values){
  4674. values.join = new InterpolValues(prop.values);
  4675. }else{
  4676. start = prop.start ? prop.start : (stroke && stroke.join || 0);
  4677. end = prop.end ? prop.end : (stroke && stroke.join || 0);
  4678. if(typeof start == "number" && typeof end == "number"){
  4679. values.join = new InterpolNumber(start, end);
  4680. }
  4681. }
  4682. }
  4683. this.curve = new InterpolObject(values, stroke);
  4684. });
  4685. Hub.connect(anim, "onAnimate", shape, "setStroke");
  4686. return anim; // dojo.Animation
  4687. };
  4688. fxg.animateFill = function(/*Object*/ args){
  4689. // summary:
  4690. // Returns an animation which will change fill color over time.
  4691. // Only solid fill color is supported at the moment
  4692. // example:
  4693. // | dojox.gfx.fx.animateFill{{
  4694. // | shape: shape,
  4695. // | duration: 500,
  4696. // | color: {start: "red", end: "green"}
  4697. // | }).play();
  4698. if(!args.easing){ args.easing = fx._defaultEasing; }
  4699. var anim = new fx.Animation(args), shape = args.shape, fill;
  4700. Hub.connect(anim, "beforeBegin", anim, function(){
  4701. fill = shape.getFill();
  4702. var prop = args.color, values = {};
  4703. if(prop){
  4704. this.curve = getColorInterpol(prop, fill, "", transparent);
  4705. }
  4706. });
  4707. Hub.connect(anim, "onAnimate", shape, "setFill");
  4708. return anim; // dojo.Animation
  4709. };
  4710. fxg.animateFont = function(/*Object*/ args){
  4711. // summary:
  4712. // Returns an animation which will change font properties over time.
  4713. // example:
  4714. // | dojox.gfx.fx.animateFont{{
  4715. // | shape: shape,
  4716. // | duration: 500,
  4717. // | variant: {values: ["normal", "small-caps"]},
  4718. // | size: {end: 10, units: "pt"}
  4719. // | }).play();
  4720. if(!args.easing){ args.easing = fx._defaultEasing; }
  4721. var anim = new fx.Animation(args), shape = args.shape, font;
  4722. Hub.connect(anim, "beforeBegin", anim, function(){
  4723. font = shape.getFont();
  4724. var prop = args.style, values = {}, value, start, end;
  4725. if(prop && prop.values){
  4726. values.style = new InterpolValues(prop.values);
  4727. }
  4728. prop = args.variant;
  4729. if(prop && prop.values){
  4730. values.variant = new InterpolValues(prop.values);
  4731. }
  4732. prop = args.weight;
  4733. if(prop && prop.values){
  4734. values.weight = new InterpolValues(prop.values);
  4735. }
  4736. prop = args.family;
  4737. if(prop && prop.values){
  4738. values.family = new InterpolValues(prop.values);
  4739. }
  4740. prop = args.size;
  4741. if(prop && prop.units){
  4742. start = parseFloat(prop.start ? prop.start : (shape.font && shape.font.size || "0"));
  4743. end = parseFloat(prop.end ? prop.end : (shape.font && shape.font.size || "0"));
  4744. values.size = new InterpolUnit(start, end, prop.units);
  4745. }
  4746. this.curve = new InterpolObject(values, font);
  4747. });
  4748. Hub.connect(anim, "onAnimate", shape, "setFont");
  4749. return anim; // dojo.Animation
  4750. };
  4751. fxg.animateTransform = function(/*Object*/ args){
  4752. // summary:
  4753. // Returns an animation which will change transformation over time.
  4754. // example:
  4755. // | dojox.gfx.fx.animateTransform{{
  4756. // | shape: shape,
  4757. // | duration: 500,
  4758. // | transform: [
  4759. // | {name: "translate", start: [0, 0], end: [200, 200]},
  4760. // | {name: "original"}
  4761. // | ]
  4762. // | }).play();
  4763. if(!args.easing){ args.easing = fx._defaultEasing; }
  4764. var anim = new fx.Animation(args), shape = args.shape, original;
  4765. Hub.connect(anim, "beforeBegin", anim, function(){
  4766. original = shape.getTransform();
  4767. this.curve = new InterpolTransform(args.transform, original);
  4768. });
  4769. Hub.connect(anim, "onAnimate", shape, "setTransform");
  4770. return anim; // dojo.Animation
  4771. };
  4772. return fxg;
  4773. });
  4774. },
  4775. 'dojox/charting/action2d/PlotAction':function(){
  4776. define("dojox/charting/action2d/PlotAction", ["dojo/_base/connect", "dojo/_base/declare", "./Base", "dojo/fx/easing", "dojox/lang/functional",
  4777. "dojox/lang/functional/object"],
  4778. function(hub, declare, Base, dfe, df, dlfo){
  4779. /*=====
  4780. dojox.charting.action2d.__PlotActionCtorArgs = function(duration, easing){
  4781. // summary:
  4782. // The base keyword arguments object for creating an action2d.
  4783. // duration: Number?
  4784. // The amount of time in milliseconds for an animation to last. Default is 400.
  4785. // easing: dojo.fx.easing.*?
  4786. // An easing object (see dojo.fx.easing) for use in an animation. The
  4787. // default is dojo.fx.easing.backOut.
  4788. this.duration = duration;
  4789. this.easing = easing;
  4790. }
  4791. var Base = dojox.charting.action2d.Base;
  4792. =====*/
  4793. var DEFAULT_DURATION = 400, // ms
  4794. DEFAULT_EASING = dfe.backOut;
  4795. return declare("dojox.charting.action2d.PlotAction", Base, {
  4796. // summary:
  4797. // Base action class for plot actions.
  4798. overOutEvents: {onmouseover: 1, onmouseout: 1},
  4799. constructor: function(chart, plot, kwargs){
  4800. // summary:
  4801. // Create a new base PlotAction.
  4802. // chart: dojox.charting.Chart
  4803. // The chart this action applies to.
  4804. // plot: String?
  4805. // The name of the plot this action belongs to. If none is passed "default" is assumed.
  4806. // kwargs: dojox.charting.action2d.__PlotActionCtorArgs?
  4807. // Optional arguments for the action.
  4808. this.anim = {};
  4809. // process common optional named parameters
  4810. if(!kwargs){ kwargs = {}; }
  4811. this.duration = kwargs.duration ? kwargs.duration : DEFAULT_DURATION;
  4812. this.easing = kwargs.easing ? kwargs.easing : DEFAULT_EASING;
  4813. },
  4814. connect: function(){
  4815. // summary:
  4816. // Connect this action to the given plot.
  4817. this.handle = this.chart.connectToPlot(this.plot.name, this, "process");
  4818. },
  4819. disconnect: function(){
  4820. // summary:
  4821. // Disconnect this action from the given plot, if connected.
  4822. if(this.handle){
  4823. hub.disconnect(this.handle);
  4824. this.handle = null;
  4825. }
  4826. },
  4827. reset: function(){
  4828. // summary:
  4829. // Reset the action.
  4830. },
  4831. destroy: function(){
  4832. // summary:
  4833. // Do any cleanup needed when destroying parent elements.
  4834. this.inherited(arguments);
  4835. df.forIn(this.anim, function(o){
  4836. df.forIn(o, function(anim){
  4837. anim.action.stop(true);
  4838. });
  4839. });
  4840. this.anim = {};
  4841. }
  4842. });
  4843. });
  4844. },
  4845. 'dijit/BackgroundIframe':function(){
  4846. define("dijit/BackgroundIframe", [
  4847. "require", // require.toUrl
  4848. ".", // to export dijit.BackgroundIframe
  4849. "dojo/_base/config",
  4850. "dojo/dom-construct", // domConstruct.create
  4851. "dojo/dom-style", // domStyle.set
  4852. "dojo/_base/lang", // lang.extend lang.hitch
  4853. "dojo/on",
  4854. "dojo/_base/sniff", // has("ie"), has("mozilla"), has("quirks")
  4855. "dojo/_base/window" // win.doc.createElement
  4856. ], function(require, dijit, config, domConstruct, domStyle, lang, on, has, win){
  4857. // module:
  4858. // dijit/BackgroundIFrame
  4859. // Flag for whether to create background iframe behind popups like Menus and Dialog.
  4860. // A background iframe is useful to prevent problems with popups appearing behind applets/pdf files,
  4861. // and is also useful on older versions of IE (IE6 and IE7) to prevent the "bleed through select" problem.
  4862. // TODO: For 2.0, make this false by default. Also, possibly move definition to has.js so that this module can be
  4863. // conditionally required via dojo/has!bgIfame?dijit/BackgroundIframe
  4864. has.add("bgIframe", has("ie") || has("mozilla"));
  4865. // summary:
  4866. // new dijit.BackgroundIframe(node)
  4867. // Makes a background iframe as a child of node, that fills
  4868. // area (and position) of node
  4869. // TODO: remove _frames, it isn't being used much, since popups never release their
  4870. // iframes (see [22236])
  4871. var _frames = new function(){
  4872. // summary:
  4873. // cache of iframes
  4874. var queue = [];
  4875. this.pop = function(){
  4876. var iframe;
  4877. if(queue.length){
  4878. iframe = queue.pop();
  4879. iframe.style.display="";
  4880. }else{
  4881. if(has("ie") < 9){
  4882. var burl = config["dojoBlankHtmlUrl"] || require.toUrl("dojo/resources/blank.html") || "javascript:\"\"";
  4883. var html="<iframe src='" + burl + "' role='presentation'"
  4884. + " style='position: absolute; left: 0px; top: 0px;"
  4885. + "z-index: -1; filter:Alpha(Opacity=\"0\");'>";
  4886. iframe = win.doc.createElement(html);
  4887. }else{
  4888. iframe = domConstruct.create("iframe");
  4889. iframe.src = 'javascript:""';
  4890. iframe.className = "dijitBackgroundIframe";
  4891. iframe.setAttribute("role", "presentation");
  4892. domStyle.set(iframe, "opacity", 0.1);
  4893. }
  4894. iframe.tabIndex = -1; // Magic to prevent iframe from getting focus on tab keypress - as style didn't work.
  4895. }
  4896. return iframe;
  4897. };
  4898. this.push = function(iframe){
  4899. iframe.style.display="none";
  4900. queue.push(iframe);
  4901. }
  4902. }();
  4903. dijit.BackgroundIframe = function(/*DomNode*/ node){
  4904. // summary:
  4905. // For IE/FF z-index schenanigans. id attribute is required.
  4906. //
  4907. // description:
  4908. // new dijit.BackgroundIframe(node)
  4909. // Makes a background iframe as a child of node, that fills
  4910. // area (and position) of node
  4911. if(!node.id){ throw new Error("no id"); }
  4912. if(has("bgIframe")){
  4913. var iframe = (this.iframe = _frames.pop());
  4914. node.appendChild(iframe);
  4915. if(has("ie")<7 || has("quirks")){
  4916. this.resize(node);
  4917. this._conn = on(node, 'resize', lang.hitch(this, function(){
  4918. this.resize(node);
  4919. }));
  4920. }else{
  4921. domStyle.set(iframe, {
  4922. width: '100%',
  4923. height: '100%'
  4924. });
  4925. }
  4926. }
  4927. };
  4928. lang.extend(dijit.BackgroundIframe, {
  4929. resize: function(node){
  4930. // summary:
  4931. // Resize the iframe so it's the same size as node.
  4932. // Needed on IE6 and IE/quirks because height:100% doesn't work right.
  4933. if(this.iframe){
  4934. domStyle.set(this.iframe, {
  4935. width: node.offsetWidth + 'px',
  4936. height: node.offsetHeight + 'px'
  4937. });
  4938. }
  4939. },
  4940. destroy: function(){
  4941. // summary:
  4942. // destroy the iframe
  4943. if(this._conn){
  4944. this._conn.remove();
  4945. this._conn = null;
  4946. }
  4947. if(this.iframe){
  4948. _frames.push(this.iframe);
  4949. delete this.iframe;
  4950. }
  4951. }
  4952. });
  4953. return dijit.BackgroundIframe;
  4954. });
  4955. },
  4956. 'dojox/main':function(){
  4957. define("dojox/main", ["dojo/_base/kernel"], function(dojo) {
  4958. // module:
  4959. // dojox/main
  4960. // summary:
  4961. // The dojox package main module; dojox package is somewhat unusual in that the main module currently just provides an empty object.
  4962. return dojo.dojox;
  4963. });
  4964. },
  4965. 'dojox/charting/action2d/Magnify':function(){
  4966. define("dojox/charting/action2d/Magnify", ["dojo/_base/connect", "dojo/_base/declare",
  4967. "./PlotAction", "dojox/gfx/matrix",
  4968. "dojox/gfx/fx", "dojo/fx", "dojo/fx/easing"],
  4969. function(Hub, declare, PlotAction, m, gf, df, dfe){
  4970. /*=====
  4971. dojo.declare("dojox.charting.action2d.__MagnifyCtorArgs", dojox.charting.action2d.__PlotActionCtorArgs, {
  4972. // summary:
  4973. // Additional arguments for highlighting actions.
  4974. // scale: Number?
  4975. // The amount to magnify the given object to. Default is 2.
  4976. scale: 2
  4977. });
  4978. var PlotAction = dojox.charting.action2d.PlotAction;
  4979. =====*/
  4980. var DEFAULT_SCALE = 2;
  4981. return declare("dojox.charting.action2d.Magnify", PlotAction, {
  4982. // summary:
  4983. // Create an action that magnifies the object the action is applied to.
  4984. // the data description block for the widget parser
  4985. defaultParams: {
  4986. duration: 400, // duration of the action in ms
  4987. easing: dfe.backOut, // easing for the action
  4988. scale: DEFAULT_SCALE // scale of magnification
  4989. },
  4990. optionalParams: {}, // no optional parameters
  4991. constructor: function(chart, plot, kwArgs){
  4992. // summary:
  4993. // Create the magnifying action.
  4994. // chart: dojox.charting.Chart
  4995. // The chart this action belongs to.
  4996. // plot: String?
  4997. // The plot to apply the action to. If not passed, "default" is assumed.
  4998. // kwArgs: dojox.charting.action2d.__MagnifyCtorArgs?
  4999. // Optional keyword arguments for this action.
  5000. // process optional named parameters
  5001. this.scale = kwArgs && typeof kwArgs.scale == "number" ? kwArgs.scale : DEFAULT_SCALE;
  5002. this.connect();
  5003. },
  5004. process: function(o){
  5005. // summary:
  5006. // Process the action on the given object.
  5007. // o: dojox.gfx.Shape
  5008. // The object on which to process the magnifying action.
  5009. if(!o.shape || !(o.type in this.overOutEvents) ||
  5010. !("cx" in o) || !("cy" in o)){ return; }
  5011. var runName = o.run.name, index = o.index, vector = [], anim, init, scale;
  5012. if(runName in this.anim){
  5013. anim = this.anim[runName][index];
  5014. }else{
  5015. this.anim[runName] = {};
  5016. }
  5017. if(anim){
  5018. anim.action.stop(true);
  5019. }else{
  5020. this.anim[runName][index] = anim = {};
  5021. }
  5022. if(o.type == "onmouseover"){
  5023. init = m.identity;
  5024. scale = this.scale;
  5025. }else{
  5026. init = m.scaleAt(this.scale, o.cx, o.cy);
  5027. scale = 1 / this.scale;
  5028. }
  5029. var kwArgs = {
  5030. shape: o.shape,
  5031. duration: this.duration,
  5032. easing: this.easing,
  5033. transform: [
  5034. {name: "scaleAt", start: [1, o.cx, o.cy], end: [scale, o.cx, o.cy]},
  5035. init
  5036. ]
  5037. };
  5038. if(o.shape){
  5039. vector.push(gf.animateTransform(kwArgs));
  5040. }
  5041. if(o.oultine){
  5042. kwArgs.shape = o.outline;
  5043. vector.push(gf.animateTransform(kwArgs));
  5044. }
  5045. if(o.shadow){
  5046. kwArgs.shape = o.shadow;
  5047. vector.push(gf.animateTransform(kwArgs));
  5048. }
  5049. if(!vector.length){
  5050. delete this.anim[runName][index];
  5051. return;
  5052. }
  5053. anim.action = df.combine(vector);
  5054. if(o.type == "onmouseout"){
  5055. Hub.connect(anim.action, "onEnd", this, function(){
  5056. if(this.anim[runName]){
  5057. delete this.anim[runName][index];
  5058. }
  5059. });
  5060. }
  5061. anim.action.play();
  5062. }
  5063. });
  5064. });
  5065. },
  5066. 'dojo/Stateful':function(){
  5067. define(["./_base/declare", "./_base/lang", "./_base/array"], function(declare, lang, array) {
  5068. // module:
  5069. // dojo/Stateful
  5070. // summary:
  5071. // TODOC
  5072. return declare("dojo.Stateful", null, {
  5073. // summary:
  5074. // Base class for objects that provide named properties with optional getter/setter
  5075. // control and the ability to watch for property changes
  5076. // example:
  5077. // | var obj = new dojo.Stateful();
  5078. // | obj.watch("foo", function(){
  5079. // | console.log("foo changed to " + this.get("foo"));
  5080. // | });
  5081. // | obj.set("foo","bar");
  5082. postscript: function(mixin){
  5083. if(mixin){
  5084. lang.mixin(this, mixin);
  5085. }
  5086. },
  5087. get: function(/*String*/name){
  5088. // summary:
  5089. // Get a property on a Stateful instance.
  5090. // name:
  5091. // The property to get.
  5092. // returns:
  5093. // The property value on this Stateful instance.
  5094. // description:
  5095. // Get a named property on a Stateful object. The property may
  5096. // potentially be retrieved via a getter method in subclasses. In the base class
  5097. // this just retrieves the object's property.
  5098. // For example:
  5099. // | stateful = new dojo.Stateful({foo: 3});
  5100. // | stateful.get("foo") // returns 3
  5101. // | stateful.foo // returns 3
  5102. return this[name]; //Any
  5103. },
  5104. set: function(/*String*/name, /*Object*/value){
  5105. // summary:
  5106. // Set a property on a Stateful instance
  5107. // name:
  5108. // The property to set.
  5109. // value:
  5110. // The value to set in the property.
  5111. // returns:
  5112. // The function returns this dojo.Stateful instance.
  5113. // description:
  5114. // Sets named properties on a stateful object and notifies any watchers of
  5115. // the property. A programmatic setter may be defined in subclasses.
  5116. // For example:
  5117. // | stateful = new dojo.Stateful();
  5118. // | stateful.watch(function(name, oldValue, value){
  5119. // | // this will be called on the set below
  5120. // | }
  5121. // | stateful.set(foo, 5);
  5122. //
  5123. // set() may also be called with a hash of name/value pairs, ex:
  5124. // | myObj.set({
  5125. // | foo: "Howdy",
  5126. // | bar: 3
  5127. // | })
  5128. // This is equivalent to calling set(foo, "Howdy") and set(bar, 3)
  5129. if(typeof name === "object"){
  5130. for(var x in name){
  5131. if(name.hasOwnProperty(x) && x !="_watchCallbacks"){
  5132. this.set(x, name[x]);
  5133. }
  5134. }
  5135. return this;
  5136. }
  5137. var oldValue = this[name];
  5138. this[name] = value;
  5139. if(this._watchCallbacks){
  5140. this._watchCallbacks(name, oldValue, value);
  5141. }
  5142. return this; //dojo.Stateful
  5143. },
  5144. watch: function(/*String?*/name, /*Function*/callback){
  5145. // summary:
  5146. // Watches a property for changes
  5147. // name:
  5148. // Indicates the property to watch. This is optional (the callback may be the
  5149. // only parameter), and if omitted, all the properties will be watched
  5150. // returns:
  5151. // An object handle for the watch. The unwatch method of this object
  5152. // can be used to discontinue watching this property:
  5153. // | var watchHandle = obj.watch("foo", callback);
  5154. // | watchHandle.unwatch(); // callback won't be called now
  5155. // callback:
  5156. // The function to execute when the property changes. This will be called after
  5157. // the property has been changed. The callback will be called with the |this|
  5158. // set to the instance, the first argument as the name of the property, the
  5159. // second argument as the old value and the third argument as the new value.
  5160. var callbacks = this._watchCallbacks;
  5161. if(!callbacks){
  5162. var self = this;
  5163. callbacks = this._watchCallbacks = function(name, oldValue, value, ignoreCatchall){
  5164. var notify = function(propertyCallbacks){
  5165. if(propertyCallbacks){
  5166. propertyCallbacks = propertyCallbacks.slice();
  5167. for(var i = 0, l = propertyCallbacks.length; i < l; i++){
  5168. propertyCallbacks[i].call(self, name, oldValue, value);
  5169. }
  5170. }
  5171. };
  5172. notify(callbacks['_' + name]);
  5173. if(!ignoreCatchall){
  5174. notify(callbacks["*"]); // the catch-all
  5175. }
  5176. }; // we use a function instead of an object so it will be ignored by JSON conversion
  5177. }
  5178. if(!callback && typeof name === "function"){
  5179. callback = name;
  5180. name = "*";
  5181. }else{
  5182. // prepend with dash to prevent name conflicts with function (like "name" property)
  5183. name = '_' + name;
  5184. }
  5185. var propertyCallbacks = callbacks[name];
  5186. if(typeof propertyCallbacks !== "object"){
  5187. propertyCallbacks = callbacks[name] = [];
  5188. }
  5189. propertyCallbacks.push(callback);
  5190. return {
  5191. unwatch: function(){
  5192. propertyCallbacks.splice(array.indexOf(propertyCallbacks, callback), 1);
  5193. }
  5194. }; //Object
  5195. }
  5196. });
  5197. });
  5198. },
  5199. 'dojox/charting/plot2d/Markers':function(){
  5200. define("dojox/charting/plot2d/Markers", ["dojo/_base/declare", "./Default"], function(declare, Default){
  5201. /*=====
  5202. var Default = dojox.charting.plot2d.Default
  5203. =====*/
  5204. return declare("dojox.charting.plot2d.Markers", Default, {
  5205. // summary:
  5206. // A convenience plot to draw a line chart with markers.
  5207. constructor: function(){
  5208. // summary:
  5209. // Set up the plot for lines and markers.
  5210. this.opt.markers = true;
  5211. }
  5212. });
  5213. });
  5214. },
  5215. 'dojox/charting/plot2d/Bubble':function(){
  5216. define("dojox/charting/plot2d/Bubble", ["dojo/_base/lang", "dojo/_base/declare", "dojo/_base/array",
  5217. "./Base", "./common", "dojox/lang/functional", "dojox/lang/functional/reversed",
  5218. "dojox/lang/utils", "dojox/gfx/fx"],
  5219. function(lang, declare, arr, Base, dc, df, dfr, du, fx){
  5220. /*=====
  5221. var Base = dojox.charting.plot2d.Base;
  5222. =====*/
  5223. var purgeGroup = dfr.lambda("item.purgeGroup()");
  5224. return declare("dojox.charting.plot2d.Bubble", Base, {
  5225. // summary:
  5226. // A plot representing bubbles. Note that data for Bubbles requires 3 parameters,
  5227. // in the form of: { x, y, size }, where size determines the size of the bubble.
  5228. defaultParams: {
  5229. hAxis: "x", // use a horizontal axis named "x"
  5230. vAxis: "y", // use a vertical axis named "y"
  5231. animate: null // animate bars into place
  5232. },
  5233. optionalParams: {
  5234. // theme component
  5235. stroke: {},
  5236. outline: {},
  5237. shadow: {},
  5238. fill: {},
  5239. font: "",
  5240. fontColor: ""
  5241. },
  5242. constructor: function(chart, kwArgs){
  5243. // summary:
  5244. // Create a plot of bubbles.
  5245. // chart: dojox.charting.Chart
  5246. // The chart this plot belongs to.
  5247. // kwArgs: dojox.charting.plot2d.__DefaultCtorArgs?
  5248. // Optional keyword arguments object to help define plot parameters.
  5249. this.opt = lang.clone(this.defaultParams);
  5250. du.updateWithObject(this.opt, kwArgs);
  5251. du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
  5252. this.series = [];
  5253. this.hAxis = this.opt.hAxis;
  5254. this.vAxis = this.opt.vAxis;
  5255. this.animate = this.opt.animate;
  5256. },
  5257. // override the render so that we are plotting only circles.
  5258. render: function(dim, offsets){
  5259. // summary:
  5260. // Run the calculations for any axes for this plot.
  5261. // dim: Object
  5262. // An object in the form of { width, height }
  5263. // offsets: Object
  5264. // An object of the form { l, r, t, b}.
  5265. // returns: dojox.charting.plot2d.Bubble
  5266. // A reference to this plot for functional chaining.
  5267. if(this.zoom && !this.isDataDirty()){
  5268. return this.performZoom(dim, offsets);
  5269. }
  5270. this.resetEvents();
  5271. this.dirty = this.isDirty();
  5272. if(this.dirty){
  5273. arr.forEach(this.series, purgeGroup);
  5274. this._eventSeries = {};
  5275. this.cleanGroup();
  5276. var s = this.group;
  5277. df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
  5278. }
  5279. var t = this.chart.theme,
  5280. ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
  5281. vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
  5282. events = this.events();
  5283. for(var i = this.series.length - 1; i >= 0; --i){
  5284. var run = this.series[i];
  5285. if(!this.dirty && !run.dirty){
  5286. t.skip();
  5287. this._reconnectEvents(run.name);
  5288. continue;
  5289. }
  5290. run.cleanGroup();
  5291. if(!run.data.length){
  5292. run.dirty = false;
  5293. t.skip();
  5294. continue;
  5295. }
  5296. if(typeof run.data[0] == "number"){
  5297. console.warn("dojox.charting.plot2d.Bubble: the data in the following series cannot be rendered as a bubble chart; ", run);
  5298. continue;
  5299. }
  5300. var theme = t.next("circle", [this.opt, run]), s = run.group,
  5301. points = arr.map(run.data, function(v, i){
  5302. return v ? {
  5303. x: ht(v.x) + offsets.l,
  5304. y: dim.height - offsets.b - vt(v.y),
  5305. radius: this._vScaler.bounds.scale * (v.size / 2)
  5306. } : null;
  5307. }, this);
  5308. var frontCircles = null, outlineCircles = null, shadowCircles = null;
  5309. // make shadows if needed
  5310. if(theme.series.shadow){
  5311. shadowCircles = arr.map(points, function(item){
  5312. if(item !== null){
  5313. var finalTheme = t.addMixin(theme, "circle", item, true),
  5314. shadow = finalTheme.series.shadow;
  5315. var shape = s.createCircle({
  5316. cx: item.x + shadow.dx, cy: item.y + shadow.dy, r: item.radius
  5317. }).setStroke(shadow).setFill(shadow.color);
  5318. if(this.animate){
  5319. this._animateBubble(shape, dim.height - offsets.b, item.radius);
  5320. }
  5321. return shape;
  5322. }
  5323. return null;
  5324. }, this);
  5325. if(shadowCircles.length){
  5326. run.dyn.shadow = shadowCircles[shadowCircles.length - 1].getStroke();
  5327. }
  5328. }
  5329. // make outlines if needed
  5330. if(theme.series.outline){
  5331. outlineCircles = arr.map(points, function(item){
  5332. if(item !== null){
  5333. var finalTheme = t.addMixin(theme, "circle", item, true),
  5334. outline = dc.makeStroke(finalTheme.series.outline);
  5335. outline.width = 2 * outline.width + theme.series.stroke.width;
  5336. var shape = s.createCircle({
  5337. cx: item.x, cy: item.y, r: item.radius
  5338. }).setStroke(outline);
  5339. if(this.animate){
  5340. this._animateBubble(shape, dim.height - offsets.b, item.radius);
  5341. }
  5342. return shape;
  5343. }
  5344. return null;
  5345. }, this);
  5346. if(outlineCircles.length){
  5347. run.dyn.outline = outlineCircles[outlineCircles.length - 1].getStroke();
  5348. }
  5349. }
  5350. // run through the data and add the circles.
  5351. frontCircles = arr.map(points, function(item){
  5352. if(item !== null){
  5353. var finalTheme = t.addMixin(theme, "circle", item, true),
  5354. rect = {
  5355. x: item.x - item.radius,
  5356. y: item.y - item.radius,
  5357. width: 2 * item.radius,
  5358. height: 2 * item.radius
  5359. };
  5360. var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
  5361. specialFill = this._shapeFill(specialFill, rect);
  5362. var shape = s.createCircle({
  5363. cx: item.x, cy: item.y, r: item.radius
  5364. }).setFill(specialFill).setStroke(finalTheme.series.stroke);
  5365. if(this.animate){
  5366. this._animateBubble(shape, dim.height - offsets.b, item.radius);
  5367. }
  5368. return shape;
  5369. }
  5370. return null;
  5371. }, this);
  5372. if(frontCircles.length){
  5373. run.dyn.fill = frontCircles[frontCircles.length - 1].getFill();
  5374. run.dyn.stroke = frontCircles[frontCircles.length - 1].getStroke();
  5375. }
  5376. if(events){
  5377. var eventSeries = new Array(frontCircles.length);
  5378. arr.forEach(frontCircles, function(s, i){
  5379. if(s !== null){
  5380. var o = {
  5381. element: "circle",
  5382. index: i,
  5383. run: run,
  5384. shape: s,
  5385. outline: outlineCircles && outlineCircles[i] || null,
  5386. shadow: shadowCircles && shadowCircles[i] || null,
  5387. x: run.data[i].x,
  5388. y: run.data[i].y,
  5389. r: run.data[i].size / 2,
  5390. cx: points[i].x,
  5391. cy: points[i].y,
  5392. cr: points[i].radius
  5393. };
  5394. this._connectEvents(o);
  5395. eventSeries[i] = o;
  5396. }
  5397. }, this);
  5398. this._eventSeries[run.name] = eventSeries;
  5399. }else{
  5400. delete this._eventSeries[run.name];
  5401. }
  5402. run.dirty = false;
  5403. }
  5404. this.dirty = false;
  5405. return this; // dojox.charting.plot2d.Bubble
  5406. },
  5407. _animateBubble: function(shape, offset, size){
  5408. fx.animateTransform(lang.delegate({
  5409. shape: shape,
  5410. duration: 1200,
  5411. transform: [
  5412. {name: "translate", start: [0, offset], end: [0, 0]},
  5413. {name: "scale", start: [0, 1/size], end: [1, 1]},
  5414. {name: "original"}
  5415. ]
  5416. }, this.animate)).play();
  5417. }
  5418. });
  5419. });
  5420. },
  5421. 'dojo/touch':function(){
  5422. define(["./_base/kernel", "./aspect", "./dom", "./on", "./has", "./mouse", "./domReady", "./_base/window"],
  5423. function(dojo, aspect, dom, on, has, mouse, domReady, win){
  5424. // module:
  5425. // dojo/touch
  5426. var hasTouch = has("touch");
  5427. // TODO: get iOS version from dojo/sniff after #15827 is fixed
  5428. var ios4 = false;
  5429. if(has("ios")){
  5430. var ua = navigator.userAgent;
  5431. var v = ua.match(/OS ([\d_]+)/) ? RegExp.$1 : "1";
  5432. var os = parseFloat(v.replace(/_/, '.').replace(/_/g, ''));
  5433. ios4 = os < 5;
  5434. }
  5435. // Time of most recent touchstart or touchmove event
  5436. var lastTouch;
  5437. function dualEvent(mouseType, touchType){
  5438. // Returns synthetic event that listens for both the specified mouse event and specified touch event.
  5439. // But ignore fake mouse events that were generated due to the user touching the screen.
  5440. if(hasTouch){
  5441. return function(node, listener){
  5442. var handle1 = on(node, touchType, listener),
  5443. handle2 = on(node, mouseType, function(evt){
  5444. if(!lastTouch || (new Date()).getTime() > lastTouch + 1000){
  5445. listener.call(this, evt);
  5446. }
  5447. });
  5448. return {
  5449. remove: function(){
  5450. handle1.remove();
  5451. handle2.remove();
  5452. }
  5453. };
  5454. };
  5455. }else{
  5456. // Avoid creating listeners for touch events on performance sensitive older browsers like IE6
  5457. return function(node, listener){
  5458. return on(node, mouseType, listener);
  5459. }
  5460. }
  5461. }
  5462. var touchmove, hoveredNode;
  5463. if(hasTouch){
  5464. domReady(function(){
  5465. // Keep track of currently hovered node
  5466. hoveredNode = win.body(); // currently hovered node
  5467. win.doc.addEventListener("touchstart", function(evt){
  5468. lastTouch = (new Date()).getTime();
  5469. // Precede touchstart event with touch.over event. DnD depends on this.
  5470. // Use addEventListener(cb, true) to run cb before any touchstart handlers on node run,
  5471. // and to ensure this code runs even if the listener on the node does event.stop().
  5472. var oldNode = hoveredNode;
  5473. hoveredNode = evt.target;
  5474. on.emit(oldNode, "dojotouchout", {
  5475. target: oldNode,
  5476. relatedTarget: hoveredNode,
  5477. bubbles: true
  5478. });
  5479. on.emit(hoveredNode, "dojotouchover", {
  5480. target: hoveredNode,
  5481. relatedTarget: oldNode,
  5482. bubbles: true
  5483. });
  5484. }, true);
  5485. // Fire synthetic touchover and touchout events on nodes since the browser won't do it natively.
  5486. on(win.doc, "touchmove", function(evt){
  5487. lastTouch = (new Date()).getTime();
  5488. var newNode = win.doc.elementFromPoint(
  5489. evt.pageX - (ios4 ? 0 : win.global.pageXOffset), // iOS 4 expects page coords
  5490. evt.pageY - (ios4 ? 0 : win.global.pageYOffset)
  5491. );
  5492. if(newNode && hoveredNode !== newNode){
  5493. // touch out on the old node
  5494. on.emit(hoveredNode, "dojotouchout", {
  5495. target: hoveredNode,
  5496. relatedTarget: newNode,
  5497. bubbles: true
  5498. });
  5499. // touchover on the new node
  5500. on.emit(newNode, "dojotouchover", {
  5501. target: newNode,
  5502. relatedTarget: hoveredNode,
  5503. bubbles: true
  5504. });
  5505. hoveredNode = newNode;
  5506. }
  5507. });
  5508. });
  5509. // Define synthetic touch.move event that unlike the native touchmove, fires for the node the finger is
  5510. // currently dragging over rather than the node where the touch started.
  5511. touchmove = function(node, listener){
  5512. return on(win.doc, "touchmove", function(evt){
  5513. if(node === win.doc || dom.isDescendant(hoveredNode, node)){
  5514. evt.target = hoveredNode;
  5515. listener.call(this, evt);
  5516. }
  5517. });
  5518. };
  5519. }
  5520. //device neutral events - touch.press|move|release|cancel/over/out
  5521. var touch = {
  5522. press: dualEvent("mousedown", "touchstart"),
  5523. move: dualEvent("mousemove", touchmove),
  5524. release: dualEvent("mouseup", "touchend"),
  5525. cancel: dualEvent(mouse.leave, "touchcancel"),
  5526. over: dualEvent("mouseover", "dojotouchover"),
  5527. out: dualEvent("mouseout", "dojotouchout"),
  5528. enter: mouse._eventHandler(dualEvent("mouseover","dojotouchover")),
  5529. leave: mouse._eventHandler(dualEvent("mouseout", "dojotouchout"))
  5530. };
  5531. /*=====
  5532. touch = {
  5533. // summary:
  5534. // This module provides unified touch event handlers by exporting
  5535. // press, move, release and cancel which can also run well on desktop.
  5536. // Based on http://dvcs.w3.org/hg/webevents/raw-file/tip/touchevents.html
  5537. //
  5538. // example:
  5539. // Used with dojo.on
  5540. // | define(["dojo/on", "dojo/touch"], function(on, touch){
  5541. // | on(node, touch.press, function(e){});
  5542. // | on(node, touch.move, function(e){});
  5543. // | on(node, touch.release, function(e){});
  5544. // | on(node, touch.cancel, function(e){});
  5545. // example:
  5546. // Used with touch.* directly
  5547. // | touch.press(node, function(e){});
  5548. // | touch.move(node, function(e){});
  5549. // | touch.release(node, function(e){});
  5550. // | touch.cancel(node, function(e){});
  5551. press: function(node, listener){
  5552. // summary:
  5553. // Register a listener to 'touchstart'|'mousedown' for the given node
  5554. // node: Dom
  5555. // Target node to listen to
  5556. // listener: Function
  5557. // Callback function
  5558. // returns:
  5559. // A handle which will be used to remove the listener by handle.remove()
  5560. },
  5561. move: function(node, listener){
  5562. // summary:
  5563. // Register a listener to 'touchmove'|'mousemove' for the given node
  5564. // node: Dom
  5565. // Target node to listen to
  5566. // listener: Function
  5567. // Callback function
  5568. // returns:
  5569. // A handle which will be used to remove the listener by handle.remove()
  5570. },
  5571. release: function(node, listener){
  5572. // summary:
  5573. // Register a listener to 'touchend'|'mouseup' for the given node
  5574. // node: Dom
  5575. // Target node to listen to
  5576. // listener: Function
  5577. // Callback function
  5578. // returns:
  5579. // A handle which will be used to remove the listener by handle.remove()
  5580. },
  5581. cancel: function(node, listener){
  5582. // summary:
  5583. // Register a listener to 'touchcancel'|'mouseleave' for the given node
  5584. // node: Dom
  5585. // Target node to listen to
  5586. // listener: Function
  5587. // Callback function
  5588. // returns:
  5589. // A handle which will be used to remove the listener by handle.remove()
  5590. },
  5591. over: function(node, listener){
  5592. // summary:
  5593. // Register a listener to 'mouseover' or touch equivalent for the given node
  5594. // node: Dom
  5595. // Target node to listen to
  5596. // listener: Function
  5597. // Callback function
  5598. // returns:
  5599. // A handle which will be used to remove the listener by handle.remove()
  5600. },
  5601. out: function(node, listener){
  5602. // summary:
  5603. // Register a listener to 'mouseout' or touch equivalent for the given node
  5604. // node: Dom
  5605. // Target node to listen to
  5606. // listener: Function
  5607. // Callback function
  5608. // returns:
  5609. // A handle which will be used to remove the listener by handle.remove()
  5610. },
  5611. enter: function(node, listener){
  5612. // summary:
  5613. // Register a listener to mouse.enter or touch equivalent for the given node
  5614. // node: Dom
  5615. // Target node to listen to
  5616. // listener: Function
  5617. // Callback function
  5618. // returns:
  5619. // A handle which will be used to remove the listener by handle.remove()
  5620. },
  5621. leave: function(node, listener){
  5622. // summary:
  5623. // Register a listener to mouse.leave or touch equivalent for the given node
  5624. // node: Dom
  5625. // Target node to listen to
  5626. // listener: Function
  5627. // Callback function
  5628. // returns:
  5629. // A handle which will be used to remove the listener by handle.remove()
  5630. }
  5631. };
  5632. =====*/
  5633. 1 && (dojo.touch = touch);
  5634. return touch;
  5635. });
  5636. },
  5637. 'dojox/gfx/gradutils':function(){
  5638. // Various generic utilities to deal with a linear gradient
  5639. define("dojox/gfx/gradutils", ["./_base", "dojo/_base/lang", "./matrix", "dojo/_base/Color"],
  5640. function(g, lang, m, Color){
  5641. /*===== g= dojox.gfx =====*/
  5642. var gradutils = g.gradutils = {};
  5643. /*===== g= dojox.gfx; gradutils = dojox.gfx.gradutils; =====*/
  5644. function findColor(o, c){
  5645. if(o <= 0){
  5646. return c[0].color;
  5647. }
  5648. var len = c.length;
  5649. if(o >= 1){
  5650. return c[len - 1].color;
  5651. }
  5652. //TODO: use binary search
  5653. for(var i = 0; i < len; ++i){
  5654. var stop = c[i];
  5655. if(stop.offset >= o){
  5656. if(i){
  5657. var prev = c[i - 1];
  5658. return Color.blendColors(new Color(prev.color), new Color(stop.color),
  5659. (o - prev.offset) / (stop.offset - prev.offset));
  5660. }
  5661. return stop.color;
  5662. }
  5663. }
  5664. return c[len - 1].color;
  5665. }
  5666. gradutils.getColor = function(fill, pt){
  5667. // summary:
  5668. // sample a color from a gradient using a point
  5669. // fill: Object:
  5670. // fill object
  5671. // pt: dojox.gfx.Point:
  5672. // point where to sample a color
  5673. var o;
  5674. if(fill){
  5675. switch(fill.type){
  5676. case "linear":
  5677. var angle = Math.atan2(fill.y2 - fill.y1, fill.x2 - fill.x1),
  5678. rotation = m.rotate(-angle),
  5679. projection = m.project(fill.x2 - fill.x1, fill.y2 - fill.y1),
  5680. p = m.multiplyPoint(projection, pt),
  5681. pf1 = m.multiplyPoint(projection, fill.x1, fill.y1),
  5682. pf2 = m.multiplyPoint(projection, fill.x2, fill.y2),
  5683. scale = m.multiplyPoint(rotation, pf2.x - pf1.x, pf2.y - pf1.y).x;
  5684. o = m.multiplyPoint(rotation, p.x - pf1.x, p.y - pf1.y).x / scale;
  5685. break;
  5686. case "radial":
  5687. var dx = pt.x - fill.cx, dy = pt.y - fill.cy;
  5688. o = Math.sqrt(dx * dx + dy * dy) / fill.r;
  5689. break;
  5690. }
  5691. return findColor(o, fill.colors); // dojo.Color
  5692. }
  5693. // simple color
  5694. return new Color(fill || [0, 0, 0, 0]); // dojo.Color
  5695. };
  5696. gradutils.reverse = function(fill){
  5697. // summary:
  5698. // reverses a gradient
  5699. // fill: Object:
  5700. // fill object
  5701. if(fill){
  5702. switch(fill.type){
  5703. case "linear":
  5704. case "radial":
  5705. fill = lang.delegate(fill);
  5706. if(fill.colors){
  5707. var c = fill.colors, l = c.length, i = 0, stop,
  5708. n = fill.colors = new Array(c.length);
  5709. for(; i < l; ++i){
  5710. stop = c[i];
  5711. n[i] = {
  5712. offset: 1 - stop.offset,
  5713. color: stop.color
  5714. };
  5715. }
  5716. n.sort(function(a, b){ return a.offset - b.offset; });
  5717. }
  5718. break;
  5719. }
  5720. }
  5721. return fill; // Object
  5722. };
  5723. return gradutils;
  5724. });
  5725. },
  5726. 'dojo/string':function(){
  5727. define(["./_base/kernel", "./_base/lang"], function(dojo, lang) {
  5728. // module:
  5729. // dojo/string
  5730. // summary:
  5731. // TODOC
  5732. lang.getObject("string", true, dojo);
  5733. /*=====
  5734. dojo.string = {
  5735. // summary: String utilities for Dojo
  5736. };
  5737. =====*/
  5738. dojo.string.rep = function(/*String*/str, /*Integer*/num){
  5739. // summary:
  5740. // Efficiently replicate a string `n` times.
  5741. // str:
  5742. // the string to replicate
  5743. // num:
  5744. // number of times to replicate the string
  5745. if(num <= 0 || !str){ return ""; }
  5746. var buf = [];
  5747. for(;;){
  5748. if(num & 1){
  5749. buf.push(str);
  5750. }
  5751. if(!(num >>= 1)){ break; }
  5752. str += str;
  5753. }
  5754. return buf.join(""); // String
  5755. };
  5756. dojo.string.pad = function(/*String*/text, /*Integer*/size, /*String?*/ch, /*Boolean?*/end){
  5757. // summary:
  5758. // Pad a string to guarantee that it is at least `size` length by
  5759. // filling with the character `ch` at either the start or end of the
  5760. // string. Pads at the start, by default.
  5761. // text:
  5762. // the string to pad
  5763. // size:
  5764. // length to provide padding
  5765. // ch:
  5766. // character to pad, defaults to '0'
  5767. // end:
  5768. // adds padding at the end if true, otherwise pads at start
  5769. // example:
  5770. // | // Fill the string to length 10 with "+" characters on the right. Yields "Dojo++++++".
  5771. // | dojo.string.pad("Dojo", 10, "+", true);
  5772. if(!ch){
  5773. ch = '0';
  5774. }
  5775. var out = String(text),
  5776. pad = dojo.string.rep(ch, Math.ceil((size - out.length) / ch.length));
  5777. return end ? out + pad : pad + out; // String
  5778. };
  5779. dojo.string.substitute = function( /*String*/ template,
  5780. /*Object|Array*/map,
  5781. /*Function?*/ transform,
  5782. /*Object?*/ thisObject){
  5783. // summary:
  5784. // Performs parameterized substitutions on a string. Throws an
  5785. // exception if any parameter is unmatched.
  5786. // template:
  5787. // a string with expressions in the form `${key}` to be replaced or
  5788. // `${key:format}` which specifies a format function. keys are case-sensitive.
  5789. // map:
  5790. // hash to search for substitutions
  5791. // transform:
  5792. // a function to process all parameters before substitution takes
  5793. // place, e.g. mylib.encodeXML
  5794. // thisObject:
  5795. // where to look for optional format function; default to the global
  5796. // namespace
  5797. // example:
  5798. // Substitutes two expressions in a string from an Array or Object
  5799. // | // returns "File 'foo.html' is not found in directory '/temp'."
  5800. // | // by providing substitution data in an Array
  5801. // | dojo.string.substitute(
  5802. // | "File '${0}' is not found in directory '${1}'.",
  5803. // | ["foo.html","/temp"]
  5804. // | );
  5805. // |
  5806. // | // also returns "File 'foo.html' is not found in directory '/temp'."
  5807. // | // but provides substitution data in an Object structure. Dotted
  5808. // | // notation may be used to traverse the structure.
  5809. // | dojo.string.substitute(
  5810. // | "File '${name}' is not found in directory '${info.dir}'.",
  5811. // | { name: "foo.html", info: { dir: "/temp" } }
  5812. // | );
  5813. // example:
  5814. // Use a transform function to modify the values:
  5815. // | // returns "file 'foo.html' is not found in directory '/temp'."
  5816. // | dojo.string.substitute(
  5817. // | "${0} is not found in ${1}.",
  5818. // | ["foo.html","/temp"],
  5819. // | function(str){
  5820. // | // try to figure out the type
  5821. // | var prefix = (str.charAt(0) == "/") ? "directory": "file";
  5822. // | return prefix + " '" + str + "'";
  5823. // | }
  5824. // | );
  5825. // example:
  5826. // Use a formatter
  5827. // | // returns "thinger -- howdy"
  5828. // | dojo.string.substitute(
  5829. // | "${0:postfix}", ["thinger"], null, {
  5830. // | postfix: function(value, key){
  5831. // | return value + " -- howdy";
  5832. // | }
  5833. // | }
  5834. // | );
  5835. thisObject = thisObject || dojo.global;
  5836. transform = transform ?
  5837. lang.hitch(thisObject, transform) : function(v){ return v; };
  5838. return template.replace(/\$\{([^\s\:\}]+)(?:\:([^\s\:\}]+))?\}/g,
  5839. function(match, key, format){
  5840. var value = lang.getObject(key, false, map);
  5841. if(format){
  5842. value = lang.getObject(format, false, thisObject).call(thisObject, value, key);
  5843. }
  5844. return transform(value, key).toString();
  5845. }); // String
  5846. };
  5847. /*=====
  5848. dojo.string.trim = function(str){
  5849. // summary:
  5850. // Trims whitespace from both sides of the string
  5851. // str: String
  5852. // String to be trimmed
  5853. // returns: String
  5854. // Returns the trimmed string
  5855. // description:
  5856. // This version of trim() was taken from [Steven Levithan's blog](http://blog.stevenlevithan.com/archives/faster-trim-javascript).
  5857. // The short yet performant version of this function is dojo.trim(),
  5858. // which is part of Dojo base. Uses String.prototype.trim instead, if available.
  5859. return ""; // String
  5860. }
  5861. =====*/
  5862. dojo.string.trim = String.prototype.trim ?
  5863. lang.trim : // aliasing to the native function
  5864. function(str){
  5865. str = str.replace(/^\s+/, '');
  5866. for(var i = str.length - 1; i >= 0; i--){
  5867. if(/\S/.test(str.charAt(i))){
  5868. str = str.substring(0, i + 1);
  5869. break;
  5870. }
  5871. }
  5872. return str;
  5873. };
  5874. return dojo.string;
  5875. });
  5876. },
  5877. 'dijit/registry':function(){
  5878. define("dijit/registry", [
  5879. "dojo/_base/array", // array.forEach array.map
  5880. "dojo/_base/sniff", // has("ie")
  5881. "dojo/_base/unload", // unload.addOnWindowUnload
  5882. "dojo/_base/window", // win.body
  5883. "." // dijit._scopeName
  5884. ], function(array, has, unload, win, dijit){
  5885. // module:
  5886. // dijit/registry
  5887. // summary:
  5888. // Registry of existing widget on page, plus some utility methods.
  5889. // Must be accessed through AMD api, ex:
  5890. // require(["dijit/registry"], function(registry){ registry.byId("foo"); })
  5891. var _widgetTypeCtr = {}, hash = {};
  5892. var registry = {
  5893. // summary:
  5894. // A set of widgets indexed by id
  5895. length: 0,
  5896. add: function(/*dijit._Widget*/ widget){
  5897. // summary:
  5898. // Add a widget to the registry. If a duplicate ID is detected, a error is thrown.
  5899. //
  5900. // widget: dijit._Widget
  5901. // Any dijit._Widget subclass.
  5902. if(hash[widget.id]){
  5903. throw new Error("Tried to register widget with id==" + widget.id + " but that id is already registered");
  5904. }
  5905. hash[widget.id] = widget;
  5906. this.length++;
  5907. },
  5908. remove: function(/*String*/ id){
  5909. // summary:
  5910. // Remove a widget from the registry. Does not destroy the widget; simply
  5911. // removes the reference.
  5912. if(hash[id]){
  5913. delete hash[id];
  5914. this.length--;
  5915. }
  5916. },
  5917. byId: function(/*String|Widget*/ id){
  5918. // summary:
  5919. // Find a widget by it's id.
  5920. // If passed a widget then just returns the widget.
  5921. return typeof id == "string" ? hash[id] : id; // dijit._Widget
  5922. },
  5923. byNode: function(/*DOMNode*/ node){
  5924. // summary:
  5925. // Returns the widget corresponding to the given DOMNode
  5926. return hash[node.getAttribute("widgetId")]; // dijit._Widget
  5927. },
  5928. toArray: function(){
  5929. // summary:
  5930. // Convert registry into a true Array
  5931. //
  5932. // example:
  5933. // Work with the widget .domNodes in a real Array
  5934. // | array.map(dijit.registry.toArray(), function(w){ return w.domNode; });
  5935. var ar = [];
  5936. for(var id in hash){
  5937. ar.push(hash[id]);
  5938. }
  5939. return ar; // dijit._Widget[]
  5940. },
  5941. getUniqueId: function(/*String*/widgetType){
  5942. // summary:
  5943. // Generates a unique id for a given widgetType
  5944. var id;
  5945. do{
  5946. id = widgetType + "_" +
  5947. (widgetType in _widgetTypeCtr ?
  5948. ++_widgetTypeCtr[widgetType] : _widgetTypeCtr[widgetType] = 0);
  5949. }while(hash[id]);
  5950. return dijit._scopeName == "dijit" ? id : dijit._scopeName + "_" + id; // String
  5951. },
  5952. findWidgets: function(/*DomNode*/ root){
  5953. // summary:
  5954. // Search subtree under root returning widgets found.
  5955. // Doesn't search for nested widgets (ie, widgets inside other widgets).
  5956. var outAry = [];
  5957. function getChildrenHelper(root){
  5958. for(var node = root.firstChild; node; node = node.nextSibling){
  5959. if(node.nodeType == 1){
  5960. var widgetId = node.getAttribute("widgetId");
  5961. if(widgetId){
  5962. var widget = hash[widgetId];
  5963. if(widget){ // may be null on page w/multiple dojo's loaded
  5964. outAry.push(widget);
  5965. }
  5966. }else{
  5967. getChildrenHelper(node);
  5968. }
  5969. }
  5970. }
  5971. }
  5972. getChildrenHelper(root);
  5973. return outAry;
  5974. },
  5975. _destroyAll: function(){
  5976. // summary:
  5977. // Code to destroy all widgets and do other cleanup on page unload
  5978. // Clean up focus manager lingering references to widgets and nodes
  5979. dijit._curFocus = null;
  5980. dijit._prevFocus = null;
  5981. dijit._activeStack = [];
  5982. // Destroy all the widgets, top down
  5983. array.forEach(registry.findWidgets(win.body()), function(widget){
  5984. // Avoid double destroy of widgets like Menu that are attached to <body>
  5985. // even though they are logically children of other widgets.
  5986. if(!widget._destroyed){
  5987. if(widget.destroyRecursive){
  5988. widget.destroyRecursive();
  5989. }else if(widget.destroy){
  5990. widget.destroy();
  5991. }
  5992. }
  5993. });
  5994. },
  5995. getEnclosingWidget: function(/*DOMNode*/ node){
  5996. // summary:
  5997. // Returns the widget whose DOM tree contains the specified DOMNode, or null if
  5998. // the node is not contained within the DOM tree of any widget
  5999. while(node){
  6000. var id = node.getAttribute && node.getAttribute("widgetId");
  6001. if(id){
  6002. return hash[id];
  6003. }
  6004. node = node.parentNode;
  6005. }
  6006. return null;
  6007. },
  6008. // In case someone needs to access hash.
  6009. // Actually, this is accessed from WidgetSet back-compatibility code
  6010. _hash: hash
  6011. };
  6012. /*=====
  6013. dijit.registry = {
  6014. // summary:
  6015. // A list of widgets on a page.
  6016. };
  6017. =====*/
  6018. dijit.registry = registry;
  6019. return registry;
  6020. });
  6021. },
  6022. 'dojox/charting/plot2d/Lines':function(){
  6023. define("dojox/charting/plot2d/Lines", ["dojo/_base/declare", "./Default"], function(declare, Default){
  6024. /*=====
  6025. var Default = dojox.charting.plot2d.Default;
  6026. =====*/
  6027. return declare("dojox.charting.plot2d.Lines", Default, {
  6028. // summary:
  6029. // A convenience constructor to create a typical line chart.
  6030. constructor: function(){
  6031. // summary:
  6032. // Preset our default plot to be line-based.
  6033. this.opt.lines = true;
  6034. }
  6035. });
  6036. });
  6037. },
  6038. 'dijit/_base/manager':function(){
  6039. define("dijit/_base/manager", [
  6040. "dojo/_base/array",
  6041. "dojo/_base/config", // defaultDuration
  6042. "../registry",
  6043. ".." // for setting exports to dijit namespace
  6044. ], function(array, config, registry, dijit){
  6045. // module:
  6046. // dijit/_base/manager
  6047. // summary:
  6048. // Shim to methods on registry, plus a few other declarations.
  6049. // New code should access dijit/registry directly when possible.
  6050. /*=====
  6051. dijit.byId = function(id){
  6052. // summary:
  6053. // Returns a widget by it's id, or if passed a widget, no-op (like dom.byId())
  6054. // id: String|dijit._Widget
  6055. return registry.byId(id); // dijit._Widget
  6056. };
  6057. dijit.getUniqueId = function(widgetType){
  6058. // summary:
  6059. // Generates a unique id for a given widgetType
  6060. // widgetType: String
  6061. return registry.getUniqueId(widgetType); // String
  6062. };
  6063. dijit.findWidgets = function(root){
  6064. // summary:
  6065. // Search subtree under root returning widgets found.
  6066. // Doesn't search for nested widgets (ie, widgets inside other widgets).
  6067. // root: DOMNode
  6068. return registry.findWidgets(root);
  6069. };
  6070. dijit._destroyAll = function(){
  6071. // summary:
  6072. // Code to destroy all widgets and do other cleanup on page unload
  6073. return registry._destroyAll();
  6074. };
  6075. dijit.byNode = function(node){
  6076. // summary:
  6077. // Returns the widget corresponding to the given DOMNode
  6078. // node: DOMNode
  6079. return registry.byNode(node); // dijit._Widget
  6080. };
  6081. dijit.getEnclosingWidget = function(node){
  6082. // summary:
  6083. // Returns the widget whose DOM tree contains the specified DOMNode, or null if
  6084. // the node is not contained within the DOM tree of any widget
  6085. // node: DOMNode
  6086. return registry.getEnclosingWidget(node);
  6087. };
  6088. =====*/
  6089. array.forEach(["byId", "getUniqueId", "findWidgets", "_destroyAll", "byNode", "getEnclosingWidget"], function(name){
  6090. dijit[name] = registry[name];
  6091. });
  6092. /*=====
  6093. dojo.mixin(dijit, {
  6094. // defaultDuration: Integer
  6095. // The default fx.animation speed (in ms) to use for all Dijit
  6096. // transitional fx.animations, unless otherwise specified
  6097. // on a per-instance basis. Defaults to 200, overrided by
  6098. // `djConfig.defaultDuration`
  6099. defaultDuration: 200
  6100. });
  6101. =====*/
  6102. dijit.defaultDuration = config["defaultDuration"] || 200;
  6103. return dijit;
  6104. });
  6105. },
  6106. 'dojox/charting/plot2d/StackedAreas':function(){
  6107. define("dojox/charting/plot2d/StackedAreas", ["dojo/_base/declare", "./Stacked"], function(declare, Stacked){
  6108. /*=====
  6109. var Stacked = dojox.charting.plot2d.Stacked;
  6110. =====*/
  6111. return declare("dojox.charting.plot2d.StackedAreas", Stacked, {
  6112. // summary:
  6113. // A convenience object to set up a stacked area plot.
  6114. constructor: function(){
  6115. // summary:
  6116. // Force our Stacked plotter to include both lines and areas.
  6117. this.opt.lines = true;
  6118. this.opt.areas = true;
  6119. }
  6120. });
  6121. });
  6122. },
  6123. 'dojox/charting/plot2d/Stacked':function(){
  6124. define(["dojo/_base/lang", "dojo/_base/declare", "dojo/_base/array", "./Default", "./common",
  6125. "dojox/lang/functional", "dojox/lang/functional/reversed", "dojox/lang/functional/sequence"],
  6126. function(lang, declare, arr, Default, dc, df, dfr, dfs){
  6127. /*=====
  6128. var Default = dojox.charting.plot2d.Default;
  6129. =====*/
  6130. var purgeGroup = dfr.lambda("item.purgeGroup()");
  6131. return declare("dojox.charting.plot2d.Stacked", Default, {
  6132. // summary:
  6133. // Like the default plot, Stacked sets up lines, areas and markers
  6134. // in a stacked fashion (values on the y axis added to each other)
  6135. // as opposed to a direct one.
  6136. getSeriesStats: function(){
  6137. // summary:
  6138. // Calculate the min/max on all attached series in both directions.
  6139. // returns: Object
  6140. // {hmin, hmax, vmin, vmax} min/max in both directions.
  6141. var stats = dc.collectStackedStats(this.series);
  6142. this._maxRunLength = stats.hmax;
  6143. return stats;
  6144. },
  6145. render: function(dim, offsets){
  6146. // summary:
  6147. // Run the calculations for any axes for this plot.
  6148. // dim: Object
  6149. // An object in the form of { width, height }
  6150. // offsets: Object
  6151. // An object of the form { l, r, t, b}.
  6152. // returns: dojox.charting.plot2d.Stacked
  6153. // A reference to this plot for functional chaining.
  6154. if(this._maxRunLength <= 0){
  6155. return this;
  6156. }
  6157. // stack all values
  6158. var acc = df.repeat(this._maxRunLength, "-> 0", 0);
  6159. for(var i = 0; i < this.series.length; ++i){
  6160. var run = this.series[i];
  6161. for(var j = 0; j < run.data.length; ++j){
  6162. var v = run.data[j];
  6163. if(v !== null){
  6164. if(isNaN(v)){ v = 0; }
  6165. acc[j] += v;
  6166. }
  6167. }
  6168. }
  6169. // draw runs in backwards
  6170. if(this.zoom && !this.isDataDirty()){
  6171. return this.performZoom(dim, offsets);
  6172. }
  6173. this.resetEvents();
  6174. this.dirty = this.isDirty();
  6175. if(this.dirty){
  6176. arr.forEach(this.series, purgeGroup);
  6177. this._eventSeries = {};
  6178. this.cleanGroup();
  6179. var s = this.group;
  6180. df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
  6181. }
  6182. var t = this.chart.theme, events = this.events(),
  6183. ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
  6184. vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler);
  6185. for(var i = this.series.length - 1; i >= 0; --i){
  6186. var run = this.series[i];
  6187. if(!this.dirty && !run.dirty){
  6188. t.skip();
  6189. this._reconnectEvents(run.name);
  6190. continue;
  6191. }
  6192. run.cleanGroup();
  6193. var theme = t.next(this.opt.areas ? "area" : "line", [this.opt, run], true),
  6194. s = run.group, outline,
  6195. lpoly = arr.map(acc, function(v, i){
  6196. return {
  6197. x: ht(i + 1) + offsets.l,
  6198. y: dim.height - offsets.b - vt(v)
  6199. };
  6200. }, this);
  6201. var lpath = this.opt.tension ? dc.curve(lpoly, this.opt.tension) : "";
  6202. if(this.opt.areas){
  6203. var apoly = lang.clone(lpoly);
  6204. if(this.opt.tension){
  6205. var p=dc.curve(apoly, this.opt.tension);
  6206. p += " L" + lpoly[lpoly.length - 1].x + "," + (dim.height - offsets.b) +
  6207. " L" + lpoly[0].x + "," + (dim.height - offsets.b) +
  6208. " L" + lpoly[0].x + "," + lpoly[0].y;
  6209. run.dyn.fill = s.createPath(p).setFill(theme.series.fill).getFill();
  6210. } else {
  6211. apoly.push({x: lpoly[lpoly.length - 1].x, y: dim.height - offsets.b});
  6212. apoly.push({x: lpoly[0].x, y: dim.height - offsets.b});
  6213. apoly.push(lpoly[0]);
  6214. run.dyn.fill = s.createPolyline(apoly).setFill(theme.series.fill).getFill();
  6215. }
  6216. }
  6217. if(this.opt.lines || this.opt.markers){
  6218. if(theme.series.outline){
  6219. outline = dc.makeStroke(theme.series.outline);
  6220. outline.width = 2 * outline.width + theme.series.stroke.width;
  6221. }
  6222. }
  6223. if(this.opt.markers){
  6224. run.dyn.marker = theme.symbol;
  6225. }
  6226. var frontMarkers, outlineMarkers, shadowMarkers;
  6227. if(theme.series.shadow && theme.series.stroke){
  6228. var shadow = theme.series.shadow,
  6229. spoly = arr.map(lpoly, function(c){
  6230. return {x: c.x + shadow.dx, y: c.y + shadow.dy};
  6231. });
  6232. if(this.opt.lines){
  6233. if(this.opt.tension){
  6234. run.dyn.shadow = s.createPath(dc.curve(spoly, this.opt.tension)).setStroke(shadow).getStroke();
  6235. } else {
  6236. run.dyn.shadow = s.createPolyline(spoly).setStroke(shadow).getStroke();
  6237. }
  6238. }
  6239. if(this.opt.markers){
  6240. shadow = theme.marker.shadow;
  6241. shadowMarkers = arr.map(spoly, function(c){
  6242. return s.createPath("M" + c.x + " " + c.y + " " + theme.symbol).
  6243. setStroke(shadow).setFill(shadow.color);
  6244. }, this);
  6245. }
  6246. }
  6247. if(this.opt.lines){
  6248. if(outline){
  6249. if(this.opt.tension){
  6250. run.dyn.outline = s.createPath(lpath).setStroke(outline).getStroke();
  6251. } else {
  6252. run.dyn.outline = s.createPolyline(lpoly).setStroke(outline).getStroke();
  6253. }
  6254. }
  6255. if(this.opt.tension){
  6256. run.dyn.stroke = s.createPath(lpath).setStroke(theme.series.stroke).getStroke();
  6257. } else {
  6258. run.dyn.stroke = s.createPolyline(lpoly).setStroke(theme.series.stroke).getStroke();
  6259. }
  6260. }
  6261. if(this.opt.markers){
  6262. frontMarkers = new Array(lpoly.length);
  6263. outlineMarkers = new Array(lpoly.length);
  6264. outline = null;
  6265. if(theme.marker.outline){
  6266. outline = dc.makeStroke(theme.marker.outline);
  6267. outline.width = 2 * outline.width + (theme.marker.stroke ? theme.marker.stroke.width : 0);
  6268. }
  6269. arr.forEach(lpoly, function(c, i){
  6270. var path = "M" + c.x + " " + c.y + " " + theme.symbol;
  6271. if(outline){
  6272. outlineMarkers[i] = s.createPath(path).setStroke(outline);
  6273. }
  6274. frontMarkers[i] = s.createPath(path).setStroke(theme.marker.stroke).setFill(theme.marker.fill);
  6275. }, this);
  6276. if(events){
  6277. var eventSeries = new Array(frontMarkers.length);
  6278. arr.forEach(frontMarkers, function(s, i){
  6279. var o = {
  6280. element: "marker",
  6281. index: i,
  6282. run: run,
  6283. shape: s,
  6284. outline: outlineMarkers[i] || null,
  6285. shadow: shadowMarkers && shadowMarkers[i] || null,
  6286. cx: lpoly[i].x,
  6287. cy: lpoly[i].y,
  6288. x: i + 1,
  6289. y: run.data[i]
  6290. };
  6291. this._connectEvents(o);
  6292. eventSeries[i] = o;
  6293. }, this);
  6294. this._eventSeries[run.name] = eventSeries;
  6295. }else{
  6296. delete this._eventSeries[run.name];
  6297. }
  6298. }
  6299. run.dirty = false;
  6300. // update the accumulator
  6301. for(var j = 0; j < run.data.length; ++j){
  6302. var v = run.data[j];
  6303. if(v !== null){
  6304. if(isNaN(v)){ v = 0; }
  6305. acc[j] -= v;
  6306. }
  6307. }
  6308. }
  6309. this.dirty = false;
  6310. return this; // dojox.charting.plot2d.Stacked
  6311. }
  6312. });
  6313. });
  6314. },
  6315. 'dojo/fx/easing':function(){
  6316. define(["../_base/lang"], function(lang) {
  6317. // module:
  6318. // dojo/fx/easing
  6319. // summary:
  6320. // This module defines standard easing functions that are useful for animations.
  6321. var easingFuncs = /*===== dojo.fx.easing= =====*/ {
  6322. // summary:
  6323. // Collection of easing functions to use beyond the default
  6324. // `dojo._defaultEasing` function.
  6325. //
  6326. // description:
  6327. //
  6328. // Easing functions are used to manipulate the iteration through
  6329. // an `dojo.Animation`s _Line. _Line being the properties of an Animation,
  6330. // and the easing function progresses through that Line determing
  6331. // how quickly (or slowly) it should go. Or more accurately: modify
  6332. // the value of the _Line based on the percentage of animation completed.
  6333. //
  6334. // All functions follow a simple naming convention of "ease type" + "when".
  6335. // If the name of the function ends in Out, the easing described appears
  6336. // towards the end of the animation. "In" means during the beginning,
  6337. // and InOut means both ranges of the Animation will applied, both
  6338. // beginning and end.
  6339. //
  6340. // One does not call the easing function directly, it must be passed to
  6341. // the `easing` property of an animation.
  6342. //
  6343. // example:
  6344. // | dojo.require("dojo.fx.easing");
  6345. // | var anim = dojo.fadeOut({
  6346. // | node: 'node',
  6347. // | duration: 2000,
  6348. // | // note there is no ()
  6349. // | easing: dojo.fx.easing.quadIn
  6350. // | }).play();
  6351. //
  6352. linear: function(/* Decimal? */n){
  6353. // summary: A linear easing function
  6354. return n;
  6355. },
  6356. quadIn: function(/* Decimal? */n){
  6357. return Math.pow(n, 2);
  6358. },
  6359. quadOut: function(/* Decimal? */n){
  6360. return n * (n - 2) * -1;
  6361. },
  6362. quadInOut: function(/* Decimal? */n){
  6363. n = n * 2;
  6364. if(n < 1){ return Math.pow(n, 2) / 2; }
  6365. return -1 * ((--n) * (n - 2) - 1) / 2;
  6366. },
  6367. cubicIn: function(/* Decimal? */n){
  6368. return Math.pow(n, 3);
  6369. },
  6370. cubicOut: function(/* Decimal? */n){
  6371. return Math.pow(n - 1, 3) + 1;
  6372. },
  6373. cubicInOut: function(/* Decimal? */n){
  6374. n = n * 2;
  6375. if(n < 1){ return Math.pow(n, 3) / 2; }
  6376. n -= 2;
  6377. return (Math.pow(n, 3) + 2) / 2;
  6378. },
  6379. quartIn: function(/* Decimal? */n){
  6380. return Math.pow(n, 4);
  6381. },
  6382. quartOut: function(/* Decimal? */n){
  6383. return -1 * (Math.pow(n - 1, 4) - 1);
  6384. },
  6385. quartInOut: function(/* Decimal? */n){
  6386. n = n * 2;
  6387. if(n < 1){ return Math.pow(n, 4) / 2; }
  6388. n -= 2;
  6389. return -1 / 2 * (Math.pow(n, 4) - 2);
  6390. },
  6391. quintIn: function(/* Decimal? */n){
  6392. return Math.pow(n, 5);
  6393. },
  6394. quintOut: function(/* Decimal? */n){
  6395. return Math.pow(n - 1, 5) + 1;
  6396. },
  6397. quintInOut: function(/* Decimal? */n){
  6398. n = n * 2;
  6399. if(n < 1){ return Math.pow(n, 5) / 2; }
  6400. n -= 2;
  6401. return (Math.pow(n, 5) + 2) / 2;
  6402. },
  6403. sineIn: function(/* Decimal? */n){
  6404. return -1 * Math.cos(n * (Math.PI / 2)) + 1;
  6405. },
  6406. sineOut: function(/* Decimal? */n){
  6407. return Math.sin(n * (Math.PI / 2));
  6408. },
  6409. sineInOut: function(/* Decimal? */n){
  6410. return -1 * (Math.cos(Math.PI * n) - 1) / 2;
  6411. },
  6412. expoIn: function(/* Decimal? */n){
  6413. return (n == 0) ? 0 : Math.pow(2, 10 * (n - 1));
  6414. },
  6415. expoOut: function(/* Decimal? */n){
  6416. return (n == 1) ? 1 : (-1 * Math.pow(2, -10 * n) + 1);
  6417. },
  6418. expoInOut: function(/* Decimal? */n){
  6419. if(n == 0){ return 0; }
  6420. if(n == 1){ return 1; }
  6421. n = n * 2;
  6422. if(n < 1){ return Math.pow(2, 10 * (n - 1)) / 2; }
  6423. --n;
  6424. return (-1 * Math.pow(2, -10 * n) + 2) / 2;
  6425. },
  6426. circIn: function(/* Decimal? */n){
  6427. return -1 * (Math.sqrt(1 - Math.pow(n, 2)) - 1);
  6428. },
  6429. circOut: function(/* Decimal? */n){
  6430. n = n - 1;
  6431. return Math.sqrt(1 - Math.pow(n, 2));
  6432. },
  6433. circInOut: function(/* Decimal? */n){
  6434. n = n * 2;
  6435. if(n < 1){ return -1 / 2 * (Math.sqrt(1 - Math.pow(n, 2)) - 1); }
  6436. n -= 2;
  6437. return 1 / 2 * (Math.sqrt(1 - Math.pow(n, 2)) + 1);
  6438. },
  6439. backIn: function(/* Decimal? */n){
  6440. // summary:
  6441. // An easing function that starts away from the target,
  6442. // and quickly accelerates towards the end value.
  6443. //
  6444. // Use caution when the easing will cause values to become
  6445. // negative as some properties cannot be set to negative values.
  6446. var s = 1.70158;
  6447. return Math.pow(n, 2) * ((s + 1) * n - s);
  6448. },
  6449. backOut: function(/* Decimal? */n){
  6450. // summary:
  6451. // An easing function that pops past the range briefly, and slowly comes back.
  6452. //
  6453. // description:
  6454. // An easing function that pops past the range briefly, and slowly comes back.
  6455. //
  6456. // Use caution when the easing will cause values to become negative as some
  6457. // properties cannot be set to negative values.
  6458. n = n - 1;
  6459. var s = 1.70158;
  6460. return Math.pow(n, 2) * ((s + 1) * n + s) + 1;
  6461. },
  6462. backInOut: function(/* Decimal? */n){
  6463. // summary:
  6464. // An easing function combining the effects of `backIn` and `backOut`
  6465. //
  6466. // description:
  6467. // An easing function combining the effects of `backIn` and `backOut`.
  6468. // Use caution when the easing will cause values to become negative
  6469. // as some properties cannot be set to negative values.
  6470. var s = 1.70158 * 1.525;
  6471. n = n * 2;
  6472. if(n < 1){ return (Math.pow(n, 2) * ((s + 1) * n - s)) / 2; }
  6473. n-=2;
  6474. return (Math.pow(n, 2) * ((s + 1) * n + s) + 2) / 2;
  6475. },
  6476. elasticIn: function(/* Decimal? */n){
  6477. // summary:
  6478. // An easing function the elastically snaps from the start value
  6479. //
  6480. // description:
  6481. // An easing function the elastically snaps from the start value
  6482. //
  6483. // Use caution when the elasticity will cause values to become negative
  6484. // as some properties cannot be set to negative values.
  6485. if(n == 0 || n == 1){ return n; }
  6486. var p = .3;
  6487. var s = p / 4;
  6488. n = n - 1;
  6489. return -1 * Math.pow(2, 10 * n) * Math.sin((n - s) * (2 * Math.PI) / p);
  6490. },
  6491. elasticOut: function(/* Decimal? */n){
  6492. // summary:
  6493. // An easing function that elasticly snaps around the target value,
  6494. // near the end of the Animation
  6495. //
  6496. // description:
  6497. // An easing function that elasticly snaps around the target value,
  6498. // near the end of the Animation
  6499. //
  6500. // Use caution when the elasticity will cause values to become
  6501. // negative as some properties cannot be set to negative values.
  6502. if(n==0 || n == 1){ return n; }
  6503. var p = .3;
  6504. var s = p / 4;
  6505. return Math.pow(2, -10 * n) * Math.sin((n - s) * (2 * Math.PI) / p) + 1;
  6506. },
  6507. elasticInOut: function(/* Decimal? */n){
  6508. // summary:
  6509. // An easing function that elasticly snaps around the value, near
  6510. // the beginning and end of the Animation.
  6511. //
  6512. // description:
  6513. // An easing function that elasticly snaps around the value, near
  6514. // the beginning and end of the Animation.
  6515. //
  6516. // Use caution when the elasticity will cause values to become
  6517. // negative as some properties cannot be set to negative values.
  6518. if(n == 0) return 0;
  6519. n = n * 2;
  6520. if(n == 2) return 1;
  6521. var p = .3 * 1.5;
  6522. var s = p / 4;
  6523. if(n < 1){
  6524. n -= 1;
  6525. return -.5 * (Math.pow(2, 10 * n) * Math.sin((n - s) * (2 * Math.PI) / p));
  6526. }
  6527. n -= 1;
  6528. return .5 * (Math.pow(2, -10 * n) * Math.sin((n - s) * (2 * Math.PI) / p)) + 1;
  6529. },
  6530. bounceIn: function(/* Decimal? */n){
  6531. // summary:
  6532. // An easing function that 'bounces' near the beginning of an Animation
  6533. return (1 - easingFuncs.bounceOut(1 - n)); // Decimal
  6534. },
  6535. bounceOut: function(/* Decimal? */n){
  6536. // summary:
  6537. // An easing function that 'bounces' near the end of an Animation
  6538. var s = 7.5625;
  6539. var p = 2.75;
  6540. var l;
  6541. if(n < (1 / p)){
  6542. l = s * Math.pow(n, 2);
  6543. }else if(n < (2 / p)){
  6544. n -= (1.5 / p);
  6545. l = s * Math.pow(n, 2) + .75;
  6546. }else if(n < (2.5 / p)){
  6547. n -= (2.25 / p);
  6548. l = s * Math.pow(n, 2) + .9375;
  6549. }else{
  6550. n -= (2.625 / p);
  6551. l = s * Math.pow(n, 2) + .984375;
  6552. }
  6553. return l;
  6554. },
  6555. bounceInOut: function(/* Decimal? */n){
  6556. // summary:
  6557. // An easing function that 'bounces' at the beginning and end of the Animation
  6558. if(n < 0.5){ return easingFuncs.bounceIn(n * 2) / 2; }
  6559. return (easingFuncs.bounceOut(n * 2 - 1) / 2) + 0.5; // Decimal
  6560. }
  6561. };
  6562. lang.setObject("dojo.fx.easing", easingFuncs);
  6563. return easingFuncs;
  6564. });
  6565. },
  6566. 'dojox/charting/action2d/Highlight':function(){
  6567. define("dojox/charting/action2d/Highlight", ["dojo/_base/kernel", "dojo/_base/lang", "dojo/_base/declare", "dojo/_base/Color", "dojo/_base/connect", "dojox/color/_base",
  6568. "./PlotAction", "dojo/fx/easing", "dojox/gfx/fx"],
  6569. function(dojo, lang, declare, Color, hub, c, PlotAction, dfe, dgf){
  6570. /*=====
  6571. dojo.declare("dojox.charting.action2d.__HighlightCtorArgs", dojox.charting.action2d.__PlotActionCtorArgs, {
  6572. // summary:
  6573. // Additional arguments for highlighting actions.
  6574. // highlight: String|dojo.Color|Function?
  6575. // Either a color or a function that creates a color when highlighting happens.
  6576. highlight: null
  6577. });
  6578. var PlotAction = dojox.charting.action2d.PlotAction;
  6579. =====*/
  6580. var DEFAULT_SATURATION = 100, // %
  6581. DEFAULT_LUMINOSITY1 = 75, // %
  6582. DEFAULT_LUMINOSITY2 = 50, // %
  6583. cc = function(color){
  6584. return function(){ return color; };
  6585. },
  6586. hl = function(color){
  6587. var a = new c.Color(color),
  6588. x = a.toHsl();
  6589. if(x.s == 0){
  6590. x.l = x.l < 50 ? 100 : 0;
  6591. }else{
  6592. x.s = DEFAULT_SATURATION;
  6593. if(x.l < DEFAULT_LUMINOSITY2){
  6594. x.l = DEFAULT_LUMINOSITY1;
  6595. }else if(x.l > DEFAULT_LUMINOSITY1){
  6596. x.l = DEFAULT_LUMINOSITY2;
  6597. }else{
  6598. x.l = x.l - DEFAULT_LUMINOSITY2 > DEFAULT_LUMINOSITY1 - x.l ?
  6599. DEFAULT_LUMINOSITY2 : DEFAULT_LUMINOSITY1;
  6600. }
  6601. }
  6602. return c.fromHsl(x);
  6603. };
  6604. return declare("dojox.charting.action2d.Highlight", PlotAction, {
  6605. // summary:
  6606. // Creates a highlighting action on a plot, where an element on that plot
  6607. // has a highlight on it.
  6608. // the data description block for the widget parser
  6609. defaultParams: {
  6610. duration: 400, // duration of the action in ms
  6611. easing: dfe.backOut // easing for the action
  6612. },
  6613. optionalParams: {
  6614. highlight: "red" // name for the highlight color
  6615. // programmatic instantiation can use functions and color objects
  6616. },
  6617. constructor: function(chart, plot, kwArgs){
  6618. // summary:
  6619. // Create the highlighting action and connect it to the plot.
  6620. // chart: dojox.charting.Chart
  6621. // The chart this action belongs to.
  6622. // plot: String?
  6623. // The plot this action is attached to. If not passed, "default" is assumed.
  6624. // kwArgs: charting.action2d.__HighlightCtorArgs?
  6625. // Optional keyword arguments object for setting parameters.
  6626. var a = kwArgs && kwArgs.highlight;
  6627. this.colorFun = a ? (lang.isFunction(a) ? a : cc(a)) : hl;
  6628. this.connect();
  6629. },
  6630. process: function(o){
  6631. // summary:
  6632. // Process the action on the given object.
  6633. // o: dojox.gfx.Shape
  6634. // The object on which to process the highlighting action.
  6635. if(!o.shape || !(o.type in this.overOutEvents)){ return; }
  6636. var runName = o.run.name, index = o.index, anim, startFill, endFill;
  6637. if(runName in this.anim){
  6638. anim = this.anim[runName][index];
  6639. }else{
  6640. this.anim[runName] = {};
  6641. }
  6642. if(anim){
  6643. anim.action.stop(true);
  6644. }else{
  6645. var color = o.shape.getFill();
  6646. if(!color || !(color instanceof Color)){
  6647. return;
  6648. }
  6649. this.anim[runName][index] = anim = {
  6650. start: color,
  6651. end: this.colorFun(color)
  6652. };
  6653. }
  6654. var start = anim.start, end = anim.end;
  6655. if(o.type == "onmouseout"){
  6656. // swap colors
  6657. var t = start;
  6658. start = end;
  6659. end = t;
  6660. }
  6661. anim.action = dgf.animateFill({
  6662. shape: o.shape,
  6663. duration: this.duration,
  6664. easing: this.easing,
  6665. color: {start: start, end: end}
  6666. });
  6667. if(o.type == "onmouseout"){
  6668. hub.connect(anim.action, "onEnd", this, function(){
  6669. if(this.anim[runName]){
  6670. delete this.anim[runName][index];
  6671. }
  6672. });
  6673. }
  6674. anim.action.play();
  6675. }
  6676. });
  6677. });
  6678. },
  6679. 'dojox/color/Palette':function(){
  6680. define("dojox/color/Palette", ["dojo/_base/kernel", "../main", "dojo/_base/lang", "dojo/_base/array", "./_base"],
  6681. function(dojo, dojox, lang, arr, dxc){
  6682. /***************************************************************
  6683. * dojox.color.Palette
  6684. *
  6685. * The Palette object is loosely based on the color palettes
  6686. * at Kuler (http://kuler.adobe.com). They are 5 color palettes
  6687. * with the base color considered to be the third color in the
  6688. * palette (for generation purposes).
  6689. *
  6690. * Palettes can be generated from well-known algorithms or they
  6691. * can be manually created by passing an array to the constructor.
  6692. *
  6693. * Palettes can be transformed, using a set of specific params
  6694. * similar to the way shapes can be transformed with dojox.gfx.
  6695. * However, unlike with transformations in dojox.gfx, transforming
  6696. * a palette will return you a new Palette object, in effect
  6697. * a clone of the original.
  6698. ***************************************************************/
  6699. // ctor ----------------------------------------------------------------------------
  6700. dxc.Palette = function(/* String|Array|dojox.color.Color|dojox.color.Palette */base){
  6701. // summary:
  6702. // An object that represents a palette of colors.
  6703. // description:
  6704. // A Palette is a representation of a set of colors. While the standard
  6705. // number of colors contained in a palette is 5, it can really handle any
  6706. // number of colors.
  6707. //
  6708. // A palette is useful for the ability to transform all the colors in it
  6709. // using a simple object-based approach. In addition, you can generate
  6710. // palettes using dojox.color.Palette.generate; these generated palettes
  6711. // are based on the palette generators at http://kuler.adobe.com.
  6712. //
  6713. // colors: dojox.color.Color[]
  6714. // The actual color references in this palette.
  6715. this.colors = [];
  6716. if(base instanceof dxc.Palette){
  6717. this.colors = base.colors.slice(0);
  6718. }
  6719. else if(base instanceof dxc.Color){
  6720. this.colors = [ null, null, base, null, null ];
  6721. }
  6722. else if(lang.isArray(base)){
  6723. this.colors = arr.map(base.slice(0), function(item){
  6724. if(lang.isString(item)){ return new dxc.Color(item); }
  6725. return item;
  6726. });
  6727. }
  6728. else if (lang.isString(base)){
  6729. this.colors = [ null, null, new dxc.Color(base), null, null ];
  6730. }
  6731. }
  6732. // private functions ---------------------------------------------------------------
  6733. // transformations
  6734. function tRGBA(p, param, val){
  6735. var ret = new dxc.Palette();
  6736. ret.colors = [];
  6737. arr.forEach(p.colors, function(item){
  6738. var r=(param=="dr")?item.r+val:item.r,
  6739. g=(param=="dg")?item.g+val:item.g,
  6740. b=(param=="db")?item.b+val:item.b,
  6741. a=(param=="da")?item.a+val:item.a
  6742. ret.colors.push(new dxc.Color({
  6743. r: Math.min(255, Math.max(0, r)),
  6744. g: Math.min(255, Math.max(0, g)),
  6745. b: Math.min(255, Math.max(0, b)),
  6746. a: Math.min(1, Math.max(0, a))
  6747. }));
  6748. });
  6749. return ret;
  6750. }
  6751. function tCMY(p, param, val){
  6752. var ret = new dxc.Palette();
  6753. ret.colors = [];
  6754. arr.forEach(p.colors, function(item){
  6755. var o=item.toCmy(),
  6756. c=(param=="dc")?o.c+val:o.c,
  6757. m=(param=="dm")?o.m+val:o.m,
  6758. y=(param=="dy")?o.y+val:o.y;
  6759. ret.colors.push(dxc.fromCmy(
  6760. Math.min(100, Math.max(0, c)),
  6761. Math.min(100, Math.max(0, m)),
  6762. Math.min(100, Math.max(0, y))
  6763. ));
  6764. });
  6765. return ret;
  6766. }
  6767. function tCMYK(p, param, val){
  6768. var ret = new dxc.Palette();
  6769. ret.colors = [];
  6770. arr.forEach(p.colors, function(item){
  6771. var o=item.toCmyk(),
  6772. c=(param=="dc")?o.c+val:o.c,
  6773. m=(param=="dm")?o.m+val:o.m,
  6774. y=(param=="dy")?o.y+val:o.y,
  6775. k=(param=="dk")?o.b+val:o.b;
  6776. ret.colors.push(dxc.fromCmyk(
  6777. Math.min(100, Math.max(0, c)),
  6778. Math.min(100, Math.max(0, m)),
  6779. Math.min(100, Math.max(0, y)),
  6780. Math.min(100, Math.max(0, k))
  6781. ));
  6782. });
  6783. return ret;
  6784. }
  6785. function tHSL(p, param, val){
  6786. var ret = new dxc.Palette();
  6787. ret.colors = [];
  6788. arr.forEach(p.colors, function(item){
  6789. var o=item.toHsl(),
  6790. h=(param=="dh")?o.h+val:o.h,
  6791. s=(param=="ds")?o.s+val:o.s,
  6792. l=(param=="dl")?o.l+val:o.l;
  6793. ret.colors.push(dxc.fromHsl(h%360, Math.min(100, Math.max(0, s)), Math.min(100, Math.max(0, l))));
  6794. });
  6795. return ret;
  6796. }
  6797. function tHSV(p, param, val){
  6798. var ret = new dxc.Palette();
  6799. ret.colors = [];
  6800. arr.forEach(p.colors, function(item){
  6801. var o=item.toHsv(),
  6802. h=(param=="dh")?o.h+val:o.h,
  6803. s=(param=="ds")?o.s+val:o.s,
  6804. v=(param=="dv")?o.v+val:o.v;
  6805. ret.colors.push(dxc.fromHsv(h%360, Math.min(100, Math.max(0, s)), Math.min(100, Math.max(0, v))));
  6806. });
  6807. return ret;
  6808. }
  6809. // helper functions
  6810. function rangeDiff(val, low, high){
  6811. // given the value in a range from 0 to high, find the equiv
  6812. // using the range low to high.
  6813. return high-((high-val)*((high-low)/high));
  6814. }
  6815. // object methods ---------------------------------------------------------------
  6816. lang.extend(dxc.Palette, {
  6817. transform: function(/* dojox.color.Palette.__transformArgs */kwArgs){
  6818. // summary:
  6819. // Transform the palette using a specific transformation function
  6820. // and a set of transformation parameters.
  6821. // description:
  6822. // {palette}.transform is a simple way to uniformly transform
  6823. // all of the colors in a palette using any of 5 formulae:
  6824. // RGBA, HSL, HSV, CMYK or CMY.
  6825. //
  6826. // Once the forumula to be used is determined, you can pass any
  6827. // number of parameters based on the formula "d"[param]; for instance,
  6828. // { use: "rgba", dr: 20, dg: -50 } will take all of the colors in
  6829. // palette, add 20 to the R value and subtract 50 from the G value.
  6830. //
  6831. // Unlike other types of transformations, transform does *not* alter
  6832. // the original palette but will instead return a new one.
  6833. var fn=tRGBA; // the default transform function.
  6834. if(kwArgs.use){
  6835. // we are being specific about the algo we want to use.
  6836. var use=kwArgs.use.toLowerCase();
  6837. if(use.indexOf("hs")==0){
  6838. if(use.charAt(2)=="l"){ fn=tHSL; }
  6839. else { fn=tHSV; }
  6840. }
  6841. else if(use.indexOf("cmy")==0){
  6842. if(use.charAt(3)=="k"){ fn=tCMYK; }
  6843. else { fn=tCMY; }
  6844. }
  6845. }
  6846. // try to guess the best choice.
  6847. else if("dc" in kwArgs || "dm" in kwArgs || "dy" in kwArgs){
  6848. if("dk" in kwArgs){ fn = tCMYK; }
  6849. else { fn = tCMY; }
  6850. }
  6851. else if("dh" in kwArgs || "ds" in kwArgs){
  6852. if("dv" in kwArgs){ fn = tHSV; }
  6853. else { fn = tHSL; }
  6854. }
  6855. var palette = this;
  6856. for(var p in kwArgs){
  6857. // ignore use
  6858. if(p=="use"){ continue; }
  6859. palette = fn(palette, p, kwArgs[p]);
  6860. }
  6861. return palette; // dojox.color.Palette
  6862. },
  6863. clone: function(){
  6864. // summary:
  6865. // Clones the current palette.
  6866. return new dxc.Palette(this); // dojox.color.Palette
  6867. }
  6868. });
  6869. /*=====
  6870. dojox.color.Palette.__transformArgs = function(use, dr, dg, db, da, dc, dm, dy, dk, dh, ds, dv, dl){
  6871. // summary:
  6872. // The keywords argument to be passed to the dojox.color.Palette.transform function. Note that
  6873. // while all arguments are optional, *some* arguments must be passed. The basic concept is that
  6874. // you pass a delta value for a specific aspect of a color model (or multiple aspects of the same
  6875. // color model); for instance, if you wish to transform a palette based on the HSV color model,
  6876. // you would pass one of "dh", "ds", or "dv" as a value.
  6877. //
  6878. // use: String?
  6879. // Specify the color model to use for the transformation. Can be "rgb", "rgba", "hsv", "hsl", "cmy", "cmyk".
  6880. // dr: Number?
  6881. // The delta to be applied to the red aspect of the RGB/RGBA color model.
  6882. // dg: Number?
  6883. // The delta to be applied to the green aspect of the RGB/RGBA color model.
  6884. // db: Number?
  6885. // The delta to be applied to the blue aspect of the RGB/RGBA color model.
  6886. // da: Number?
  6887. // The delta to be applied to the alpha aspect of the RGBA color model.
  6888. // dc: Number?
  6889. // The delta to be applied to the cyan aspect of the CMY/CMYK color model.
  6890. // dm: Number?
  6891. // The delta to be applied to the magenta aspect of the CMY/CMYK color model.
  6892. // dy: Number?
  6893. // The delta to be applied to the yellow aspect of the CMY/CMYK color model.
  6894. // dk: Number?
  6895. // The delta to be applied to the black aspect of the CMYK color model.
  6896. // dh: Number?
  6897. // The delta to be applied to the hue aspect of the HSL/HSV color model.
  6898. // ds: Number?
  6899. // The delta to be applied to the saturation aspect of the HSL/HSV color model.
  6900. // dl: Number?
  6901. // The delta to be applied to the luminosity aspect of the HSL color model.
  6902. // dv: Number?
  6903. // The delta to be applied to the value aspect of the HSV color model.
  6904. this.use = use;
  6905. this.dr = dr;
  6906. this.dg = dg;
  6907. this.db = db;
  6908. this.da = da;
  6909. this.dc = dc;
  6910. this.dm = dm;
  6911. this.dy = dy;
  6912. this.dk = dk;
  6913. this.dh = dh;
  6914. this.ds = ds;
  6915. this.dl = dl;
  6916. this.dv = dv;
  6917. }
  6918. dojox.color.Palette.__generatorArgs = function(base){
  6919. // summary:
  6920. // The keyword arguments object used to create a palette based on a base color.
  6921. //
  6922. // base: dojo.Color
  6923. // The base color to be used to generate the palette.
  6924. this.base = base;
  6925. }
  6926. dojox.color.Palette.__analogousArgs = function(base, high, low){
  6927. // summary:
  6928. // The keyword arguments object that is used to create a 5 color palette based on the
  6929. // analogous rules as implemented at http://kuler.adobe.com, using the HSV color model.
  6930. //
  6931. // base: dojo.Color
  6932. // The base color to be used to generate the palette.
  6933. // high: Number?
  6934. // The difference between the hue of the base color and the highest hue. In degrees, default is 60.
  6935. // low: Number?
  6936. // The difference between the hue of the base color and the lowest hue. In degrees, default is 18.
  6937. this.base = base;
  6938. this.high = high;
  6939. this.low = low;
  6940. }
  6941. dojox.color.Palette.__splitComplementaryArgs = function(base, da){
  6942. // summary:
  6943. // The keyword arguments object used to create a palette based on the split complementary rules
  6944. // as implemented at http://kuler.adobe.com.
  6945. //
  6946. // base: dojo.Color
  6947. // The base color to be used to generate the palette.
  6948. // da: Number?
  6949. // The delta angle to be used to determine where the split for the complementary rules happen.
  6950. // In degrees, the default is 30.
  6951. this.base = base;
  6952. this.da = da;
  6953. }
  6954. =====*/
  6955. lang.mixin(dxc.Palette, {
  6956. generators: {
  6957. analogous:function(/* dojox.color.Palette.__analogousArgs */args){
  6958. // summary:
  6959. // Create a 5 color palette based on the analogous rules as implemented at
  6960. // http://kuler.adobe.com.
  6961. var high=args.high||60, // delta between base hue and highest hue (subtracted from base)
  6962. low=args.low||18, // delta between base hue and lowest hue (added to base)
  6963. base = lang.isString(args.base)?new dxc.Color(args.base):args.base,
  6964. hsv=base.toHsv();
  6965. // generate our hue angle differences
  6966. var h=[
  6967. (hsv.h+low+360)%360,
  6968. (hsv.h+Math.round(low/2)+360)%360,
  6969. hsv.h,
  6970. (hsv.h-Math.round(high/2)+360)%360,
  6971. (hsv.h-high+360)%360
  6972. ];
  6973. var s1=Math.max(10, (hsv.s<=95)?hsv.s+5:(100-(hsv.s-95))),
  6974. s2=(hsv.s>1)?hsv.s-1:21-hsv.s,
  6975. v1=(hsv.v>=92)?hsv.v-9:Math.max(hsv.v+9, 20),
  6976. v2=(hsv.v<=90)?Math.max(hsv.v+5, 20):(95+Math.ceil((hsv.v-90)/2)),
  6977. s=[ s1, s2, hsv.s, s1, s1 ],
  6978. v=[ v1, v2, hsv.v, v1, v2 ]
  6979. return new dxc.Palette(arr.map(h, function(hue, i){
  6980. return dxc.fromHsv(hue, s[i], v[i]);
  6981. })); // dojox.color.Palette
  6982. },
  6983. monochromatic: function(/* dojox.color.Palette.__generatorArgs */args){
  6984. // summary:
  6985. // Create a 5 color palette based on the monochromatic rules as implemented at
  6986. // http://kuler.adobe.com.
  6987. var base = lang.isString(args.base)?new dxc.Color(args.base):args.base,
  6988. hsv = base.toHsv();
  6989. // figure out the saturation and value
  6990. var s1 = (hsv.s-30>9)?hsv.s-30:hsv.s+30,
  6991. s2 = hsv.s,
  6992. v1 = rangeDiff(hsv.v, 20, 100),
  6993. v2 = (hsv.v-20>20)?hsv.v-20:hsv.v+60,
  6994. v3 = (hsv.v-50>20)?hsv.v-50:hsv.v+30;
  6995. return new dxc.Palette([
  6996. dxc.fromHsv(hsv.h, s1, v1),
  6997. dxc.fromHsv(hsv.h, s2, v3),
  6998. base,
  6999. dxc.fromHsv(hsv.h, s1, v3),
  7000. dxc.fromHsv(hsv.h, s2, v2)
  7001. ]); // dojox.color.Palette
  7002. },
  7003. triadic: function(/* dojox.color.Palette.__generatorArgs */args){
  7004. // summary:
  7005. // Create a 5 color palette based on the triadic rules as implemented at
  7006. // http://kuler.adobe.com.
  7007. var base = lang.isString(args.base)?new dxc.Color(args.base):args.base,
  7008. hsv = base.toHsv();
  7009. var h1 = (hsv.h+57+360)%360,
  7010. h2 = (hsv.h-157+360)%360,
  7011. s1 = (hsv.s>20)?hsv.s-10:hsv.s+10,
  7012. s2 = (hsv.s>90)?hsv.s-10:hsv.s+10,
  7013. s3 = (hsv.s>95)?hsv.s-5:hsv.s+5,
  7014. v1 = (hsv.v-20>20)?hsv.v-20:hsv.v+20,
  7015. v2 = (hsv.v-30>20)?hsv.v-30:hsv.v+30,
  7016. v3 = (hsv.v-30>70)?hsv.v-30:hsv.v+30;
  7017. return new dxc.Palette([
  7018. dxc.fromHsv(h1, s1, hsv.v),
  7019. dxc.fromHsv(hsv.h, s2, v2),
  7020. base,
  7021. dxc.fromHsv(h2, s2, v1),
  7022. dxc.fromHsv(h2, s3, v3)
  7023. ]); // dojox.color.Palette
  7024. },
  7025. complementary: function(/* dojox.color.Palette.__generatorArgs */args){
  7026. // summary:
  7027. // Create a 5 color palette based on the complementary rules as implemented at
  7028. // http://kuler.adobe.com.
  7029. var base = lang.isString(args.base)?new dxc.Color(args.base):args.base,
  7030. hsv = base.toHsv();
  7031. var h1 = ((hsv.h*2)+137<360)?(hsv.h*2)+137:Math.floor(hsv.h/2)-137,
  7032. s1 = Math.max(hsv.s-10, 0),
  7033. s2 = rangeDiff(hsv.s, 10, 100),
  7034. s3 = Math.min(100, hsv.s+20),
  7035. v1 = Math.min(100, hsv.v+30),
  7036. v2 = (hsv.v>20)?hsv.v-30:hsv.v+30;
  7037. return new dxc.Palette([
  7038. dxc.fromHsv(hsv.h, s1, v1),
  7039. dxc.fromHsv(hsv.h, s2, v2),
  7040. base,
  7041. dxc.fromHsv(h1, s3, v2),
  7042. dxc.fromHsv(h1, hsv.s, hsv.v)
  7043. ]); // dojox.color.Palette
  7044. },
  7045. splitComplementary: function(/* dojox.color.Palette.__splitComplementaryArgs */args){
  7046. // summary:
  7047. // Create a 5 color palette based on the split complementary rules as implemented at
  7048. // http://kuler.adobe.com.
  7049. var base = lang.isString(args.base)?new dxc.Color(args.base):args.base,
  7050. dangle = args.da || 30,
  7051. hsv = base.toHsv();
  7052. var baseh = ((hsv.h*2)+137<360)?(hsv.h*2)+137:Math.floor(hsv.h/2)-137,
  7053. h1 = (baseh-dangle+360)%360,
  7054. h2 = (baseh+dangle)%360,
  7055. s1 = Math.max(hsv.s-10, 0),
  7056. s2 = rangeDiff(hsv.s, 10, 100),
  7057. s3 = Math.min(100, hsv.s+20),
  7058. v1 = Math.min(100, hsv.v+30),
  7059. v2 = (hsv.v>20)?hsv.v-30:hsv.v+30;
  7060. return new dxc.Palette([
  7061. dxc.fromHsv(h1, s1, v1),
  7062. dxc.fromHsv(h1, s2, v2),
  7063. base,
  7064. dxc.fromHsv(h2, s3, v2),
  7065. dxc.fromHsv(h2, hsv.s, hsv.v)
  7066. ]); // dojox.color.Palette
  7067. },
  7068. compound: function(/* dojox.color.Palette.__generatorArgs */args){
  7069. // summary:
  7070. // Create a 5 color palette based on the compound rules as implemented at
  7071. // http://kuler.adobe.com.
  7072. var base = lang.isString(args.base)?new dxc.Color(args.base):args.base,
  7073. hsv = base.toHsv();
  7074. var h1 = ((hsv.h*2)+18<360)?(hsv.h*2)+18:Math.floor(hsv.h/2)-18,
  7075. h2 = ((hsv.h*2)+120<360)?(hsv.h*2)+120:Math.floor(hsv.h/2)-120,
  7076. h3 = ((hsv.h*2)+99<360)?(hsv.h*2)+99:Math.floor(hsv.h/2)-99,
  7077. s1 = (hsv.s-40>10)?hsv.s-40:hsv.s+40,
  7078. s2 = (hsv.s-10>80)?hsv.s-10:hsv.s+10,
  7079. s3 = (hsv.s-25>10)?hsv.s-25:hsv.s+25,
  7080. v1 = (hsv.v-40>10)?hsv.v-40:hsv.v+40,
  7081. v2 = (hsv.v-20>80)?hsv.v-20:hsv.v+20,
  7082. v3 = Math.max(hsv.v, 20);
  7083. return new dxc.Palette([
  7084. dxc.fromHsv(h1, s1, v1),
  7085. dxc.fromHsv(h1, s2, v2),
  7086. base,
  7087. dxc.fromHsv(h2, s3, v3),
  7088. dxc.fromHsv(h3, s2, v2)
  7089. ]); // dojox.color.Palette
  7090. },
  7091. shades: function(/* dojox.color.Palette.__generatorArgs */args){
  7092. // summary:
  7093. // Create a 5 color palette based on the shades rules as implemented at
  7094. // http://kuler.adobe.com.
  7095. var base = lang.isString(args.base)?new dxc.Color(args.base):args.base,
  7096. hsv = base.toHsv();
  7097. var s = (hsv.s==100 && hsv.v==0)?0:hsv.s,
  7098. v1 = (hsv.v-50>20)?hsv.v-50:hsv.v+30,
  7099. v2 = (hsv.v-25>=20)?hsv.v-25:hsv.v+55,
  7100. v3 = (hsv.v-75>=20)?hsv.v-75:hsv.v+5,
  7101. v4 = Math.max(hsv.v-10, 20);
  7102. return new dxc.Palette([
  7103. new dxc.fromHsv(hsv.h, s, v1),
  7104. new dxc.fromHsv(hsv.h, s, v2),
  7105. base,
  7106. new dxc.fromHsv(hsv.h, s, v3),
  7107. new dxc.fromHsv(hsv.h, s, v4)
  7108. ]); // dojox.color.Palette
  7109. }
  7110. },
  7111. generate: function(/* String|dojox.color.Color */base, /* Function|String */type){
  7112. // summary:
  7113. // Generate a new Palette using any of the named functions in
  7114. // dojox.color.Palette.generators or an optional function definition. Current
  7115. // generators include "analogous", "monochromatic", "triadic", "complementary",
  7116. // "splitComplementary", and "shades".
  7117. if(lang.isFunction(type)){
  7118. return type({ base: base }); // dojox.color.Palette
  7119. }
  7120. else if(dxc.Palette.generators[type]){
  7121. return dxc.Palette.generators[type]({ base: base }); // dojox.color.Palette
  7122. }
  7123. throw new Error("dojox.color.Palette.generate: the specified generator ('" + type + "') does not exist.");
  7124. }
  7125. });
  7126. return dxc.Palette;
  7127. });
  7128. },
  7129. 'dijit/a11y':function(){
  7130. define("dijit/a11y", [
  7131. "dojo/_base/array", // array.forEach array.map
  7132. "dojo/dom", // dom.byId
  7133. "dojo/dom-attr", // domAttr.attr domAttr.has
  7134. "dojo/dom-style", // domStyle.style
  7135. "dojo/_base/lang", // lang.mixin()
  7136. "dojo/_base/sniff", // has("ie") 1
  7137. "./main" // for exporting methods to dijit namespace
  7138. ], function(array, dom, domAttr, domStyle, lang, has, dijit){
  7139. // module:
  7140. // dijit/a11y
  7141. var undefined;
  7142. var a11y = {
  7143. // summary:
  7144. // Accessibility utility functions (keyboard, tab stops, etc.)
  7145. _isElementShown: function(/*Element*/ elem){
  7146. var s = domStyle.get(elem);
  7147. return (s.visibility != "hidden")
  7148. && (s.visibility != "collapsed")
  7149. && (s.display != "none")
  7150. && (domAttr.get(elem, "type") != "hidden");
  7151. },
  7152. hasDefaultTabStop: function(/*Element*/ elem){
  7153. // summary:
  7154. // Tests if element is tab-navigable even without an explicit tabIndex setting
  7155. // No explicit tabIndex setting, need to investigate node type
  7156. switch(elem.nodeName.toLowerCase()){
  7157. case "a":
  7158. // An <a> w/out a tabindex is only navigable if it has an href
  7159. return domAttr.has(elem, "href");
  7160. case "area":
  7161. case "button":
  7162. case "input":
  7163. case "object":
  7164. case "select":
  7165. case "textarea":
  7166. // These are navigable by default
  7167. return true;
  7168. case "iframe":
  7169. // If it's an editor <iframe> then it's tab navigable.
  7170. var body;
  7171. try{
  7172. // non-IE
  7173. var contentDocument = elem.contentDocument;
  7174. if("designMode" in contentDocument && contentDocument.designMode == "on"){
  7175. return true;
  7176. }
  7177. body = contentDocument.body;
  7178. }catch(e1){
  7179. // contentWindow.document isn't accessible within IE7/8
  7180. // if the iframe.src points to a foreign url and this
  7181. // page contains an element, that could get focus
  7182. try{
  7183. body = elem.contentWindow.document.body;
  7184. }catch(e2){
  7185. return false;
  7186. }
  7187. }
  7188. return body && (body.contentEditable == 'true' ||
  7189. (body.firstChild && body.firstChild.contentEditable == 'true'));
  7190. default:
  7191. return elem.contentEditable == 'true';
  7192. }
  7193. },
  7194. effectiveTabIndex: function(/*Element*/ elem){
  7195. // summary:
  7196. // Returns effective tabIndex of an element, either a number, or undefined if element isn't focusable.
  7197. if(domAttr.get(elem, "disabled")){
  7198. return undefined;
  7199. }else if(domAttr.has(elem, "tabIndex")){
  7200. // Explicit tab index setting
  7201. return +domAttr.get(elem, "tabIndex");// + to convert string --> number
  7202. }else{
  7203. // No explicit tabIndex setting, so depends on node type
  7204. return a11y.hasDefaultTabStop(elem) ? 0 : undefined;
  7205. }
  7206. },
  7207. isTabNavigable: function(/*Element*/ elem){
  7208. // summary:
  7209. // Tests if an element is tab-navigable
  7210. return a11y.effectiveTabIndex(elem) >= 0;
  7211. },
  7212. isFocusable: function(/*Element*/ elem){
  7213. // summary:
  7214. // Tests if an element is focusable by tabbing to it, or clicking it with the mouse.
  7215. return a11y.effectiveTabIndex(elem) >= -1;
  7216. },
  7217. _getTabNavigable: function(/*DOMNode*/ root){
  7218. // summary:
  7219. // Finds descendants of the specified root node.
  7220. // description:
  7221. // Finds the following descendants of the specified root node:
  7222. //
  7223. // - the first tab-navigable element in document order
  7224. // without a tabIndex or with tabIndex="0"
  7225. // - the last tab-navigable element in document order
  7226. // without a tabIndex or with tabIndex="0"
  7227. // - the first element in document order with the lowest
  7228. // positive tabIndex value
  7229. // - the last element in document order with the highest
  7230. // positive tabIndex value
  7231. var first, last, lowest, lowestTabindex, highest, highestTabindex, radioSelected = {};
  7232. function radioName(node){
  7233. // If this element is part of a radio button group, return the name for that group.
  7234. return node && node.tagName.toLowerCase() == "input" &&
  7235. node.type && node.type.toLowerCase() == "radio" &&
  7236. node.name && node.name.toLowerCase();
  7237. }
  7238. var shown = a11y._isElementShown, effectiveTabIndex = a11y.effectiveTabIndex;
  7239. var walkTree = function(/*DOMNode*/ parent){
  7240. for(var child = parent.firstChild; child; child = child.nextSibling){
  7241. // Skip text elements, hidden elements, and also non-HTML elements (those in custom namespaces) in IE,
  7242. // since show() invokes getAttribute("type"), which crash on VML nodes in IE.
  7243. if(child.nodeType != 1 || (has("ie") <= 9 && child.scopeName !== "HTML") || !shown(child)){
  7244. continue;
  7245. }
  7246. var tabindex = effectiveTabIndex(child);
  7247. if(tabindex >= 0){
  7248. if(tabindex == 0){
  7249. if(!first){
  7250. first = child;
  7251. }
  7252. last = child;
  7253. }else if(tabindex > 0){
  7254. if(!lowest || tabindex < lowestTabindex){
  7255. lowestTabindex = tabindex;
  7256. lowest = child;
  7257. }
  7258. if(!highest || tabindex >= highestTabindex){
  7259. highestTabindex = tabindex;
  7260. highest = child;
  7261. }
  7262. }
  7263. var rn = radioName(child);
  7264. if(domAttr.get(child, "checked") && rn){
  7265. radioSelected[rn] = child;
  7266. }
  7267. }
  7268. if(child.nodeName.toUpperCase() != 'SELECT'){
  7269. walkTree(child);
  7270. }
  7271. }
  7272. };
  7273. if(shown(root)){
  7274. walkTree(root);
  7275. }
  7276. function rs(node){
  7277. // substitute checked radio button for unchecked one, if there is a checked one with the same name.
  7278. return radioSelected[radioName(node)] || node;
  7279. }
  7280. return { first: rs(first), last: rs(last), lowest: rs(lowest), highest: rs(highest) };
  7281. },
  7282. getFirstInTabbingOrder: function(/*String|DOMNode*/ root, /*Document?*/ doc){
  7283. // summary:
  7284. // Finds the descendant of the specified root node
  7285. // that is first in the tabbing order
  7286. var elems = a11y._getTabNavigable(dom.byId(root, doc));
  7287. return elems.lowest ? elems.lowest : elems.first; // DomNode
  7288. },
  7289. getLastInTabbingOrder: function(/*String|DOMNode*/ root, /*Document?*/ doc){
  7290. // summary:
  7291. // Finds the descendant of the specified root node
  7292. // that is last in the tabbing order
  7293. var elems = a11y._getTabNavigable(dom.byId(root, doc));
  7294. return elems.last ? elems.last : elems.highest; // DomNode
  7295. }
  7296. };
  7297. 1 && lang.mixin(dijit, a11y);
  7298. return a11y;
  7299. });
  7300. },
  7301. 'dojox/charting/axis2d/Base':function(){
  7302. define("dojox/charting/axis2d/Base", ["dojo/_base/declare", "../Element"],
  7303. function(declare, Element){
  7304. /*=====
  7305. var Element = dojox.charting.Element;
  7306. =====*/
  7307. return declare("dojox.charting.axis2d.Base", Element, {
  7308. // summary:
  7309. // The base class for any axis. This is more of an interface/API
  7310. // definition than anything else; see dojox.charting.axis2d.Default
  7311. // for more details.
  7312. constructor: function(chart, kwArgs){
  7313. // summary:
  7314. // Return a new base axis.
  7315. // chart: dojox.charting.Chart
  7316. // The chart this axis belongs to.
  7317. // kwArgs: dojox.charting.axis2d.__AxisCtorArgs?
  7318. // An optional arguments object to define the axis parameters.
  7319. this.vertical = kwArgs && kwArgs.vertical;
  7320. },
  7321. clear: function(){
  7322. // summary:
  7323. // Stub function for clearing the axis.
  7324. // returns: dojox.charting.axis2d.Base
  7325. // A reference to the axis for functional chaining.
  7326. return this; // dojox.charting.axis2d.Base
  7327. },
  7328. initialized: function(){
  7329. // summary:
  7330. // Return a flag as to whether or not this axis has been initialized.
  7331. // returns: Boolean
  7332. // If the axis is initialized or not.
  7333. return false; // Boolean
  7334. },
  7335. calculate: function(min, max, span){
  7336. // summary:
  7337. // Stub function to run the calcuations needed for drawing this axis.
  7338. // returns: dojox.charting.axis2d.Base
  7339. // A reference to the axis for functional chaining.
  7340. return this; // dojox.charting.axis2d.Base
  7341. },
  7342. getScaler: function(){
  7343. // summary:
  7344. // A stub function to return the scaler object created during calculate.
  7345. // returns: Object
  7346. // The scaler object (see dojox.charting.scaler.linear for more information)
  7347. return null; // Object
  7348. },
  7349. getTicks: function(){
  7350. // summary:
  7351. // A stub function to return the object that helps define how ticks are rendered.
  7352. // returns: Object
  7353. // The ticks object.
  7354. return null; // Object
  7355. },
  7356. getOffsets: function(){
  7357. // summary:
  7358. // A stub function to return any offsets needed for axis and series rendering.
  7359. // returns: Object
  7360. // An object of the form { l, r, t, b }.
  7361. return {l: 0, r: 0, t: 0, b: 0}; // Object
  7362. },
  7363. render: function(dim, offsets){
  7364. // summary:
  7365. // Stub function to render this axis.
  7366. // returns: dojox.charting.axis2d.Base
  7367. // A reference to the axis for functional chaining.
  7368. this.dirty = false;
  7369. return this; // dojox.charting.axis2d.Base
  7370. }
  7371. });
  7372. });
  7373. },
  7374. 'dojox/charting/plot2d/Grid':function(){
  7375. define("dojox/charting/plot2d/Grid", ["dojo/_base/lang", "dojo/_base/declare", "dojo/_base/connect", "dojo/_base/array",
  7376. "../Element", "./common", "dojox/lang/utils", "dojox/gfx/fx"],
  7377. function(lang, declare, hub, arr, Element, dc, du, fx){
  7378. /*=====
  7379. dojo.declare("dojox.charting.plot2d.__GridCtorArgs", dojox.charting.plot2d.__DefaultCtorArgs, {
  7380. // summary:
  7381. // A special keyword arguments object that is specific to a grid "plot".
  7382. // hMajorLines: Boolean?
  7383. // Whether to show lines at the major ticks along the horizontal axis. Default is true.
  7384. hMajorLines: true,
  7385. // hMinorLines: Boolean?
  7386. // Whether to show lines at the minor ticks along the horizontal axis. Default is false.
  7387. hMinorLines: false,
  7388. // vMajorLines: Boolean?
  7389. // Whether to show lines at the major ticks along the vertical axis. Default is true.
  7390. vMajorLines: true,
  7391. // vMinorLines: Boolean?
  7392. // Whether to show lines at the major ticks along the vertical axis. Default is false.
  7393. vMinorLines: false,
  7394. // hStripes: String?
  7395. // Whether or not to show stripes (alternating fills) along the horizontal axis. Default is "none".
  7396. hStripes: "none",
  7397. // vStripes: String?
  7398. // Whether or not to show stripes (alternating fills) along the vertical axis. Default is "none".
  7399. vStripes: "none",
  7400. // enableCache: Boolean?
  7401. // Whether the grid lines are cached from one rendering to another. This improves the rendering performance of
  7402. // successive rendering but penalize the first rendering. Default false.
  7403. enableCache: false
  7404. });
  7405. var Element = dojox.charting.plot2d.Element;
  7406. =====*/
  7407. return declare("dojox.charting.plot2d.Grid", Element, {
  7408. // summary:
  7409. // A "faux" plot that can be placed behind other plots to represent
  7410. // a grid against which other plots can be easily measured.
  7411. defaultParams: {
  7412. hAxis: "x", // use a horizontal axis named "x"
  7413. vAxis: "y", // use a vertical axis named "y"
  7414. hMajorLines: true, // draw horizontal major lines
  7415. hMinorLines: false, // draw horizontal minor lines
  7416. vMajorLines: true, // draw vertical major lines
  7417. vMinorLines: false, // draw vertical minor lines
  7418. hStripes: "none", // TBD
  7419. vStripes: "none", // TBD
  7420. animate: null, // animate bars into place
  7421. enableCache: false
  7422. },
  7423. optionalParams: {}, // no optional parameters
  7424. constructor: function(chart, kwArgs){
  7425. // summary:
  7426. // Create the faux Grid plot.
  7427. // chart: dojox.charting.Chart
  7428. // The chart this plot belongs to.
  7429. // kwArgs: dojox.charting.plot2d.__GridCtorArgs?
  7430. // An optional keyword arguments object to help define the parameters of the underlying grid.
  7431. this.opt = lang.clone(this.defaultParams);
  7432. du.updateWithObject(this.opt, kwArgs);
  7433. this.hAxis = this.opt.hAxis;
  7434. this.vAxis = this.opt.vAxis;
  7435. this.dirty = true;
  7436. this.animate = this.opt.animate;
  7437. this.zoom = null,
  7438. this.zoomQueue = []; // zooming action task queue
  7439. this.lastWindow = {vscale: 1, hscale: 1, xoffset: 0, yoffset: 0};
  7440. if(this.opt.enableCache){
  7441. this._lineFreePool = [];
  7442. this._lineUsePool = [];
  7443. }
  7444. },
  7445. clear: function(){
  7446. // summary:
  7447. // Clear out any parameters set on this plot.
  7448. // returns: dojox.charting.plot2d.Grid
  7449. // The reference to this plot for functional chaining.
  7450. this._hAxis = null;
  7451. this._vAxis = null;
  7452. this.dirty = true;
  7453. return this; // dojox.charting.plot2d.Grid
  7454. },
  7455. setAxis: function(axis){
  7456. // summary:
  7457. // Set an axis for this plot.
  7458. // returns: dojox.charting.plot2d.Grid
  7459. // The reference to this plot for functional chaining.
  7460. if(axis){
  7461. this[axis.vertical ? "_vAxis" : "_hAxis"] = axis;
  7462. }
  7463. return this; // dojox.charting.plot2d.Grid
  7464. },
  7465. addSeries: function(run){
  7466. // summary:
  7467. // Ignored but included as a dummy method.
  7468. // returns: dojox.charting.plot2d.Grid
  7469. // The reference to this plot for functional chaining.
  7470. return this; // dojox.charting.plot2d.Grid
  7471. },
  7472. getSeriesStats: function(){
  7473. // summary:
  7474. // Returns default stats (irrelevant for this type of plot).
  7475. // returns: Object
  7476. // {hmin, hmax, vmin, vmax} min/max in both directions.
  7477. return lang.delegate(dc.defaultStats);
  7478. },
  7479. initializeScalers: function(){
  7480. // summary:
  7481. // Does nothing (irrelevant for this type of plot).
  7482. return this;
  7483. },
  7484. isDirty: function(){
  7485. // summary:
  7486. // Return whether or not this plot needs to be redrawn.
  7487. // returns: Boolean
  7488. // If this plot needs to be rendered, this will return true.
  7489. return this.dirty || this._hAxis && this._hAxis.dirty || this._vAxis && this._vAxis.dirty; // Boolean
  7490. },
  7491. performZoom: function(dim, offsets){
  7492. // summary:
  7493. // Create/alter any zooming windows on this plot.
  7494. // dim: Object
  7495. // An object of the form { width, height }.
  7496. // offsets: Object
  7497. // An object of the form { l, r, t, b }.
  7498. // returns: dojox.charting.plot2d.Grid
  7499. // A reference to this plot for functional chaining.
  7500. // get current zooming various
  7501. var vs = this._vAxis.scale || 1,
  7502. hs = this._hAxis.scale || 1,
  7503. vOffset = dim.height - offsets.b,
  7504. hBounds = this._hAxis.getScaler().bounds,
  7505. xOffset = (hBounds.from - hBounds.lower) * hBounds.scale,
  7506. vBounds = this._vAxis.getScaler().bounds,
  7507. yOffset = (vBounds.from - vBounds.lower) * vBounds.scale,
  7508. // get incremental zooming various
  7509. rVScale = vs / this.lastWindow.vscale,
  7510. rHScale = hs / this.lastWindow.hscale,
  7511. rXOffset = (this.lastWindow.xoffset - xOffset)/
  7512. ((this.lastWindow.hscale == 1)? hs : this.lastWindow.hscale),
  7513. rYOffset = (yOffset - this.lastWindow.yoffset)/
  7514. ((this.lastWindow.vscale == 1)? vs : this.lastWindow.vscale),
  7515. shape = this.group,
  7516. anim = fx.animateTransform(lang.delegate({
  7517. shape: shape,
  7518. duration: 1200,
  7519. transform:[
  7520. {name:"translate", start:[0, 0], end: [offsets.l * (1 - rHScale), vOffset * (1 - rVScale)]},
  7521. {name:"scale", start:[1, 1], end: [rHScale, rVScale]},
  7522. {name:"original"},
  7523. {name:"translate", start: [0, 0], end: [rXOffset, rYOffset]}
  7524. ]}, this.zoom));
  7525. lang.mixin(this.lastWindow, {vscale: vs, hscale: hs, xoffset: xOffset, yoffset: yOffset});
  7526. //add anim to zooming action queue,
  7527. //in order to avoid several zooming action happened at the same time
  7528. this.zoomQueue.push(anim);
  7529. //perform each anim one by one in zoomQueue
  7530. hub.connect(anim, "onEnd", this, function(){
  7531. this.zoom = null;
  7532. this.zoomQueue.shift();
  7533. if(this.zoomQueue.length > 0){
  7534. this.zoomQueue[0].play();
  7535. }
  7536. });
  7537. if(this.zoomQueue.length == 1){
  7538. this.zoomQueue[0].play();
  7539. }
  7540. return this; // dojox.charting.plot2d.Grid
  7541. },
  7542. getRequiredColors: function(){
  7543. // summary:
  7544. // Ignored but included as a dummy method.
  7545. // returns: Number
  7546. // Returns 0, since there are no series associated with this plot type.
  7547. return 0; // Number
  7548. },
  7549. cleanGroup: function(){
  7550. this.inherited(arguments);
  7551. if(this.opt.enableCache){
  7552. this._lineFreePool = this._lineFreePool.concat(this._lineUsePool);
  7553. this._lineUsePool = [];
  7554. }
  7555. },
  7556. createLine: function(creator, params){
  7557. var line;
  7558. if(this.opt.enableCache && this._lineFreePool.length > 0){
  7559. line = this._lineFreePool.pop();
  7560. line.setShape(params);
  7561. // was cleared, add it back
  7562. creator.add(line);
  7563. }else{
  7564. line = creator.createLine(params);
  7565. }
  7566. if(this.opt.enableCache){
  7567. this._lineUsePool.push(line);
  7568. }
  7569. return line;
  7570. },
  7571. render: function(dim, offsets){
  7572. // summary:
  7573. // Render the plot on the chart.
  7574. // dim: Object
  7575. // An object of the form { width, height }.
  7576. // offsets: Object
  7577. // An object of the form { l, r, t, b }.
  7578. // returns: dojox.charting.plot2d.Grid
  7579. // A reference to this plot for functional chaining.
  7580. if(this.zoom){
  7581. return this.performZoom(dim, offsets);
  7582. }
  7583. this.dirty = this.isDirty();
  7584. if(!this.dirty){ return this; }
  7585. this.cleanGroup();
  7586. var s = this.group, ta = this.chart.theme.axis;
  7587. // draw horizontal stripes and lines
  7588. try{
  7589. var vScaler = this._vAxis.getScaler(),
  7590. vt = vScaler.scaler.getTransformerFromModel(vScaler),
  7591. ticks = this._vAxis.getTicks();
  7592. if(ticks != null){
  7593. if(this.opt.hMinorLines){
  7594. arr.forEach(ticks.minor, function(tick){
  7595. var y = dim.height - offsets.b - vt(tick.value);
  7596. var hMinorLine = this.createLine(s, {
  7597. x1: offsets.l,
  7598. y1: y,
  7599. x2: dim.width - offsets.r,
  7600. y2: y
  7601. }).setStroke(ta.minorTick);
  7602. if(this.animate){
  7603. this._animateGrid(hMinorLine, "h", offsets.l, offsets.r + offsets.l - dim.width);
  7604. }
  7605. }, this);
  7606. }
  7607. if(this.opt.hMajorLines){
  7608. arr.forEach(ticks.major, function(tick){
  7609. var y = dim.height - offsets.b - vt(tick.value);
  7610. var hMajorLine = this.createLine(s, {
  7611. x1: offsets.l,
  7612. y1: y,
  7613. x2: dim.width - offsets.r,
  7614. y2: y
  7615. }).setStroke(ta.majorTick);
  7616. if(this.animate){
  7617. this._animateGrid(hMajorLine, "h", offsets.l, offsets.r + offsets.l - dim.width);
  7618. }
  7619. }, this);
  7620. }
  7621. }
  7622. }catch(e){
  7623. // squelch
  7624. }
  7625. // draw vertical stripes and lines
  7626. try{
  7627. var hScaler = this._hAxis.getScaler(),
  7628. ht = hScaler.scaler.getTransformerFromModel(hScaler),
  7629. ticks = this._hAxis.getTicks();
  7630. if(this != null){
  7631. if(ticks && this.opt.vMinorLines){
  7632. arr.forEach(ticks.minor, function(tick){
  7633. var x = offsets.l + ht(tick.value);
  7634. var vMinorLine = this.createLine(s, {
  7635. x1: x,
  7636. y1: offsets.t,
  7637. x2: x,
  7638. y2: dim.height - offsets.b
  7639. }).setStroke(ta.minorTick);
  7640. if(this.animate){
  7641. this._animateGrid(vMinorLine, "v", dim.height - offsets.b, dim.height - offsets.b - offsets.t);
  7642. }
  7643. }, this);
  7644. }
  7645. if(ticks && this.opt.vMajorLines){
  7646. arr.forEach(ticks.major, function(tick){
  7647. var x = offsets.l + ht(tick.value);
  7648. var vMajorLine = this.createLine(s, {
  7649. x1: x,
  7650. y1: offsets.t,
  7651. x2: x,
  7652. y2: dim.height - offsets.b
  7653. }).setStroke(ta.majorTick);
  7654. if(this.animate){
  7655. this._animateGrid(vMajorLine, "v", dim.height - offsets.b, dim.height - offsets.b - offsets.t);
  7656. }
  7657. }, this);
  7658. }
  7659. }
  7660. }catch(e){
  7661. // squelch
  7662. }
  7663. this.dirty = false;
  7664. return this; // dojox.charting.plot2d.Grid
  7665. },
  7666. _animateGrid: function(shape, type, offset, size){
  7667. var transStart = type == "h" ? [offset, 0] : [0, offset];
  7668. var scaleStart = type == "h" ? [1/size, 1] : [1, 1/size];
  7669. fx.animateTransform(lang.delegate({
  7670. shape: shape,
  7671. duration: 1200,
  7672. transform: [
  7673. {name: "translate", start: transStart, end: [0, 0]},
  7674. {name: "scale", start: scaleStart, end: [1, 1]},
  7675. {name: "original"}
  7676. ]
  7677. }, this.animate)).play();
  7678. }
  7679. });
  7680. });
  7681. },
  7682. 'dojox/gfx/utils':function(){
  7683. define("dojox/gfx/utils", ["dojo/_base/kernel","dojo/_base/lang","./_base", "dojo/_base/html","dojo/_base/array", "dojo/_base/window", "dojo/_base/json",
  7684. "dojo/_base/Deferred", "dojo/_base/sniff", "require","dojo/_base/config"],
  7685. function(kernel, lang, g, html, arr, win, jsonLib, Deferred, has, require, config){
  7686. var gu = g.utils = {};
  7687. /*===== g= dojox.gfx; gu = dojox.gfx.utils; =====*/
  7688. lang.mixin(gu, {
  7689. forEach: function(
  7690. /*dojox.gfx.Surface|dojox.gfx.Shape*/ object,
  7691. /*Function|String|Array*/ f, /*Object?*/ o
  7692. ){
  7693. // summary:
  7694. // Takes a shape or a surface and applies a function "f" to in the context of "o"
  7695. // (or global, if missing). If "shape" was a surface or a group, it applies the same
  7696. // function to all children recursively effectively visiting all shapes of the underlying scene graph.
  7697. // object : The gfx container to iterate.
  7698. // f : The function to apply.
  7699. // o : The scope.
  7700. o = o || win.global;
  7701. f.call(o, object);
  7702. if(object instanceof g.Surface || object instanceof g.Group){
  7703. arr.forEach(object.children, function(shape){
  7704. gu.forEach(shape, f, o);
  7705. });
  7706. }
  7707. },
  7708. serialize: function(
  7709. /* dojox.gfx.Surface|dojox.gfx.Shape */ object
  7710. ){
  7711. // summary:
  7712. // Takes a shape or a surface and returns a DOM object, which describes underlying shapes.
  7713. var t = {}, v, isSurface = object instanceof g.Surface;
  7714. if(isSurface || object instanceof g.Group){
  7715. t.children = arr.map(object.children, gu.serialize);
  7716. if(isSurface){
  7717. return t.children; // Array
  7718. }
  7719. }else{
  7720. t.shape = object.getShape();
  7721. }
  7722. if(object.getTransform){
  7723. v = object.getTransform();
  7724. if(v){ t.transform = v; }
  7725. }
  7726. if(object.getStroke){
  7727. v = object.getStroke();
  7728. if(v){ t.stroke = v; }
  7729. }
  7730. if(object.getFill){
  7731. v = object.getFill();
  7732. if(v){ t.fill = v; }
  7733. }
  7734. if(object.getFont){
  7735. v = object.getFont();
  7736. if(v){ t.font = v; }
  7737. }
  7738. return t; // Object
  7739. },
  7740. toJson: function(
  7741. /* dojox.gfx.Surface|dojox.gfx.Shape */ object,
  7742. /* Boolean? */ prettyPrint
  7743. ){
  7744. // summary:
  7745. // Works just like serialize() but returns a JSON string. If prettyPrint is true, the string is pretty-printed to make it more human-readable.
  7746. return jsonLib.toJson(gu.serialize(object), prettyPrint); // String
  7747. },
  7748. deserialize: function(
  7749. /* dojox.gfx.Surface|dojox.gfx.Shape */ parent,
  7750. /* dojox.gfx.Shape|Array */ object
  7751. ){
  7752. // summary:
  7753. // Takes a surface or a shape and populates it with an object produced by serialize().
  7754. if(object instanceof Array){
  7755. return arr.map(object, lang.hitch(null, gu.deserialize, parent)); // Array
  7756. }
  7757. var shape = ("shape" in object) ? parent.createShape(object.shape) : parent.createGroup();
  7758. if("transform" in object){
  7759. shape.setTransform(object.transform);
  7760. }
  7761. if("stroke" in object){
  7762. shape.setStroke(object.stroke);
  7763. }
  7764. if("fill" in object){
  7765. shape.setFill(object.fill);
  7766. }
  7767. if("font" in object){
  7768. shape.setFont(object.font);
  7769. }
  7770. if("children" in object){
  7771. arr.forEach(object.children, lang.hitch(null, gu.deserialize, shape));
  7772. }
  7773. return shape; // dojox.gfx.Shape
  7774. },
  7775. fromJson: function(
  7776. /* dojox.gfx.Surface|dojox.gfx.Shape */ parent,
  7777. /* String */ json){
  7778. // summary:
  7779. // Works just like deserialize() but takes a JSON representation of the object.
  7780. return gu.deserialize(parent, jsonLib.fromJson(json)); // Array || dojox.gfx.Shape
  7781. },
  7782. toSvg: function(/*GFX object*/surface){
  7783. // summary:
  7784. // Function to serialize a GFX surface to SVG text.
  7785. // description:
  7786. // Function to serialize a GFX surface to SVG text. The value of this output
  7787. // is that there are numerous serverside parser libraries that can render
  7788. // SVG into images in various formats. This provides a way that GFX objects
  7789. // can be captured in a known format and sent serverside for serialization
  7790. // into an image.
  7791. // surface:
  7792. // The GFX surface to serialize.
  7793. // returns:
  7794. // Deferred object that will be called when SVG serialization is complete.
  7795. //Since the init and even surface creation can be async, we need to
  7796. //return a deferred that will be called when content has serialized.
  7797. var deferred = new Deferred();
  7798. if(g.renderer === "svg"){
  7799. //If we're already in SVG mode, this is easy and quick.
  7800. try{
  7801. var svg = gu._cleanSvg(gu._innerXML(surface.rawNode));
  7802. deferred.callback(svg);
  7803. }catch(e){
  7804. deferred.errback(e);
  7805. }
  7806. }else{
  7807. //Okay, now we have to get creative with hidden iframes and the like to
  7808. //serialize SVG.
  7809. if (!gu._initSvgSerializerDeferred) {
  7810. gu._initSvgSerializer();
  7811. }
  7812. var jsonForm = gu.toJson(surface);
  7813. var serializer = function(){
  7814. try{
  7815. var sDim = surface.getDimensions();
  7816. var width = sDim.width;
  7817. var height = sDim.height;
  7818. //Create an attach point in the iframe for the contents.
  7819. var node = gu._gfxSvgProxy.document.createElement("div");
  7820. gu._gfxSvgProxy.document.body.appendChild(node);
  7821. //Set the node scaling.
  7822. win.withDoc(gu._gfxSvgProxy.document, function() {
  7823. html.style(node, "width", width);
  7824. html.style(node, "height", height);
  7825. }, this);
  7826. //Create temp surface to render object to and render.
  7827. var ts = gu._gfxSvgProxy[dojox._scopeName].gfx.createSurface(node, width, height);
  7828. //It's apparently possible that a suface creation is async, so we need to use
  7829. //the whenLoaded function. Probably not needed for SVG, but making it common
  7830. var draw = function(surface) {
  7831. try{
  7832. gu._gfxSvgProxy[dojox._scopeName].gfx.utils.fromJson(surface, jsonForm);
  7833. //Get contents and remove temp surface.
  7834. var svg = gu._cleanSvg(node.innerHTML);
  7835. surface.clear();
  7836. surface.destroy();
  7837. gu._gfxSvgProxy.document.body.removeChild(node);
  7838. deferred.callback(svg);
  7839. }catch(e){
  7840. deferred.errback(e);
  7841. }
  7842. };
  7843. ts.whenLoaded(null,draw);
  7844. }catch (ex) {
  7845. deferred.errback(ex);
  7846. }
  7847. };
  7848. //See if we can call it directly or pass it to the deferred to be
  7849. //called on initialization.
  7850. if(gu._initSvgSerializerDeferred.fired > 0){
  7851. serializer();
  7852. }else{
  7853. gu._initSvgSerializerDeferred.addCallback(serializer);
  7854. }
  7855. }
  7856. return deferred; //dojo.Deferred that will be called when serialization finishes.
  7857. },
  7858. //iFrame document used for handling SVG serialization.
  7859. _gfxSvgProxy: null,
  7860. //Serializer loaded.
  7861. _initSvgSerializerDeferred: null,
  7862. _svgSerializerInitialized: function() {
  7863. // summary:
  7864. // Internal function to call when the serializer init completed.
  7865. // tags:
  7866. // private
  7867. gu._initSvgSerializerDeferred.callback(true);
  7868. },
  7869. _initSvgSerializer: function(){
  7870. // summary:
  7871. // Internal function to initialize the hidden iframe where SVG rendering
  7872. // will occur.
  7873. // tags:
  7874. // private
  7875. if(!gu._initSvgSerializerDeferred){
  7876. gu._initSvgSerializerDeferred = new Deferred();
  7877. var f = win.doc.createElement("iframe");
  7878. html.style(f, {
  7879. display: "none",
  7880. position: "absolute",
  7881. width: "1em",
  7882. height: "1em",
  7883. top: "-10000px"
  7884. });
  7885. var intv;
  7886. if(has("ie")){
  7887. f.onreadystatechange = function(){
  7888. if(f.contentWindow.document.readyState == "complete"){
  7889. f.onreadystatechange = function() {};
  7890. intv = setInterval(function() {
  7891. if(f.contentWindow[kernel.scopeMap["dojo"][1]._scopeName] &&
  7892. f.contentWindow[kernel.scopeMap["dojox"][1]._scopeName].gfx &&
  7893. f.contentWindow[kernel.scopeMap["dojox"][1]._scopeName].gfx.utils){
  7894. clearInterval(intv);
  7895. f.contentWindow.parent[kernel.scopeMap["dojox"][1]._scopeName].gfx.utils._gfxSvgProxy = f.contentWindow;
  7896. f.contentWindow.parent[kernel.scopeMap["dojox"][1]._scopeName].gfx.utils._svgSerializerInitialized();
  7897. }
  7898. }, 50);
  7899. }
  7900. };
  7901. }else{
  7902. f.onload = function(){
  7903. f.onload = function() {};
  7904. intv = setInterval(function() {
  7905. if(f.contentWindow[kernel.scopeMap["dojo"][1]._scopeName] &&
  7906. f.contentWindow[kernel.scopeMap["dojox"][1]._scopeName].gfx &&
  7907. f.contentWindow[kernel.scopeMap["dojox"][1]._scopeName].gfx.utils){
  7908. clearInterval(intv);
  7909. f.contentWindow.parent[kernel.scopeMap["dojox"][1]._scopeName].gfx.utils._gfxSvgProxy = f.contentWindow;
  7910. f.contentWindow.parent[kernel.scopeMap["dojox"][1]._scopeName].gfx.utils._svgSerializerInitialized();
  7911. }
  7912. }, 50);
  7913. };
  7914. }
  7915. //We have to load the GFX SVG proxy frame. Default is to use the one packaged in dojox.
  7916. var uri = (config["dojoxGfxSvgProxyFrameUrl"]||require.toUrl("dojox/gfx/resources/gfxSvgProxyFrame.html"));
  7917. f.setAttribute("src", uri.toString());
  7918. win.body().appendChild(f);
  7919. }
  7920. },
  7921. _innerXML: function(/*Node*/node){
  7922. // summary:
  7923. // Implementation of MS's innerXML function, borrowed from dojox.xml.parser.
  7924. // node:
  7925. // The node from which to generate the XML text representation.
  7926. // tags:
  7927. // private
  7928. if(node.innerXML){
  7929. return node.innerXML; //String
  7930. }else if(node.xml){
  7931. return node.xml; //String
  7932. }else if(typeof XMLSerializer != "undefined"){
  7933. return (new XMLSerializer()).serializeToString(node); //String
  7934. }
  7935. return null;
  7936. },
  7937. _cleanSvg: function(svg) {
  7938. // summary:
  7939. // Internal function that cleans up artifacts in extracted SVG content.
  7940. // tags:
  7941. // private
  7942. if(svg){
  7943. //Make sure the namespace is set.
  7944. if(svg.indexOf("xmlns=\"http://www.w3.org/2000/svg\"") == -1){
  7945. svg = svg.substring(4, svg.length);
  7946. svg = "<svg xmlns=\"http://www.w3.org/2000/svg\"" + svg;
  7947. }
  7948. //Same for xmlns:xlink (missing in Chrome and Safari)
  7949. if(svg.indexOf("xmlns:xlink=\"http://www.w3.org/1999/xlink\"") == -1){
  7950. svg = svg.substring(4, svg.length);
  7951. svg = "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\"" + svg;
  7952. }
  7953. //and add namespace to href attribute if not done yet
  7954. //(FF 5+ adds xlink:href but not the xmlns def)
  7955. if(svg.indexOf("xlink:href") === -1){
  7956. svg = svg.replace(/href\s*=/g, "xlink:href=");
  7957. }
  7958. //Do some other cleanup, like stripping out the
  7959. //dojoGfx attributes and quoting ids.
  7960. svg = svg.replace(/\bdojoGfx\w*\s*=\s*(['"])\w*\1/g, "");
  7961. svg = svg.replace(/\b__gfxObject__\s*=\s*(['"])\w*\1/g, "");
  7962. svg = svg.replace(/[=]([^"']+?)(\s|>)/g,'="$1"$2');
  7963. // Undefined strokes (IE 8 seralization weirdness) should be removed to
  7964. // allow default. 'undefined' is not a valid value.
  7965. svg = svg.replace(/\bstroke-opacity\w*\s*=\s*(['"])undefined\1/g, "");
  7966. }
  7967. return svg; //Cleaned SVG text.
  7968. }
  7969. });
  7970. return gu;
  7971. });
  7972. },
  7973. 'dojox/lang/functional/fold':function(){
  7974. define(["dojo/_base/lang", "dojo/_base/array", "dojo/_base/window", "./lambda"],
  7975. function(lang, arr, win, df){
  7976. // This module adds high-level functions and related constructs:
  7977. // - "fold" family of functions
  7978. // Notes:
  7979. // - missing high-level functions are provided with the compatible API:
  7980. // foldl, foldl1, foldr, foldr1
  7981. // - missing JS standard functions are provided with the compatible API:
  7982. // reduce, reduceRight
  7983. // - the fold's counterpart: unfold
  7984. // Defined methods:
  7985. // - take any valid lambda argument as the functional argument
  7986. // - operate on dense arrays
  7987. // - take a string as the array argument
  7988. // - take an iterator objects as the array argument (only foldl, foldl1, and reduce)
  7989. var empty = {};
  7990. /*=====
  7991. var df = dojox.lang.functional;
  7992. =====*/
  7993. lang.mixin(df, {
  7994. // classic reduce-class functions
  7995. foldl: function(/*Array|String|Object*/ a, /*Function*/ f, /*Object*/ z, /*Object?*/ o){
  7996. // summary: repeatedly applies a binary function to an array from left
  7997. // to right using a seed value as a starting point; returns the final
  7998. // value.
  7999. if(typeof a == "string"){ a = a.split(""); }
  8000. o = o || win.global; f = df.lambda(f);
  8001. var i, n;
  8002. if(lang.isArray(a)){
  8003. // array
  8004. for(i = 0, n = a.length; i < n; z = f.call(o, z, a[i], i, a), ++i);
  8005. }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
  8006. // iterator
  8007. for(i = 0; a.hasNext(); z = f.call(o, z, a.next(), i++, a));
  8008. }else{
  8009. // object/dictionary
  8010. for(i in a){
  8011. if(!(i in empty)){
  8012. z = f.call(o, z, a[i], i, a);
  8013. }
  8014. }
  8015. }
  8016. return z; // Object
  8017. },
  8018. foldl1: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
  8019. // summary: repeatedly applies a binary function to an array from left
  8020. // to right; returns the final value.
  8021. if(typeof a == "string"){ a = a.split(""); }
  8022. o = o || win.global; f = df.lambda(f);
  8023. var z, i, n;
  8024. if(lang.isArray(a)){
  8025. // array
  8026. z = a[0];
  8027. for(i = 1, n = a.length; i < n; z = f.call(o, z, a[i], i, a), ++i);
  8028. }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
  8029. // iterator
  8030. if(a.hasNext()){
  8031. z = a.next();
  8032. for(i = 1; a.hasNext(); z = f.call(o, z, a.next(), i++, a));
  8033. }
  8034. }else{
  8035. // object/dictionary
  8036. var first = true;
  8037. for(i in a){
  8038. if(!(i in empty)){
  8039. if(first){
  8040. z = a[i];
  8041. first = false;
  8042. }else{
  8043. z = f.call(o, z, a[i], i, a);
  8044. }
  8045. }
  8046. }
  8047. }
  8048. return z; // Object
  8049. },
  8050. foldr: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){
  8051. // summary: repeatedly applies a binary function to an array from right
  8052. // to left using a seed value as a starting point; returns the final
  8053. // value.
  8054. if(typeof a == "string"){ a = a.split(""); }
  8055. o = o || win.global; f = df.lambda(f);
  8056. for(var i = a.length; i > 0; --i, z = f.call(o, z, a[i], i, a));
  8057. return z; // Object
  8058. },
  8059. foldr1: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
  8060. // summary: repeatedly applies a binary function to an array from right
  8061. // to left; returns the final value.
  8062. if(typeof a == "string"){ a = a.split(""); }
  8063. o = o || win.global; f = df.lambda(f);
  8064. var n = a.length, z = a[n - 1], i = n - 1;
  8065. for(; i > 0; --i, z = f.call(o, z, a[i], i, a));
  8066. return z; // Object
  8067. },
  8068. // JS 1.8 standard array functions, which can take a lambda as a parameter.
  8069. reduce: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ z){
  8070. // summary: apply a function simultaneously against two values of the array
  8071. // (from left-to-right) as to reduce it to a single value.
  8072. return arguments.length < 3 ? df.foldl1(a, f) : df.foldl(a, f, z); // Object
  8073. },
  8074. reduceRight: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ z){
  8075. // summary: apply a function simultaneously against two values of the array
  8076. // (from right-to-left) as to reduce it to a single value.
  8077. return arguments.length < 3 ? df.foldr1(a, f) : df.foldr(a, f, z); // Object
  8078. },
  8079. // the fold's counterpart: unfold
  8080. unfold: function(/*Function|String|Array*/ pr, /*Function|String|Array*/ f,
  8081. /*Function|String|Array*/ g, /*Object*/ z, /*Object?*/ o){
  8082. // summary: builds an array by unfolding a value
  8083. o = o || win.global; f = df.lambda(f); g = df.lambda(g); pr = df.lambda(pr);
  8084. var t = [];
  8085. for(; !pr.call(o, z); t.push(f.call(o, z)), z = g.call(o, z));
  8086. return t; // Array
  8087. }
  8088. });
  8089. });
  8090. },
  8091. 'url:dijit/templates/Tooltip.html':"<div class=\"dijitTooltip dijitTooltipLeft\" id=\"dojoTooltip\"\n\t><div class=\"dijitTooltipContainer dijitTooltipContents\" data-dojo-attach-point=\"containerNode\" role='alert'></div\n\t><div class=\"dijitTooltipConnector\" data-dojo-attach-point=\"connectorNode\"></div\n></div>\n",
  8092. 'dojox/charting/plot2d/Spider':function(){
  8093. define("dojox/charting/plot2d/Spider", ["dojo/_base/lang", "dojo/_base/declare", "dojo/_base/connect", "dojo/_base/html", "dojo/_base/array",
  8094. "dojo/dom-geometry", "dojo/_base/fx", "dojo/fx", "dojo/_base/sniff",
  8095. "../Element", "./_PlotEvents", "dojo/_base/Color", "dojox/color/_base", "./common", "../axis2d/common",
  8096. "../scaler/primitive", "dojox/gfx", "dojox/gfx/matrix", "dojox/gfx/fx", "dojox/lang/functional",
  8097. "dojox/lang/utils", "dojo/fx/easing"],
  8098. function(lang, declare, hub, html, arr, domGeom, baseFx, coreFx, has,
  8099. Element, PlotEvents, Color, dxcolor, dc, da, primitive,
  8100. g, m, gfxfx, df, du, easing){
  8101. /*=====
  8102. var Element = dojox.charting.Element;
  8103. var PlotEvents = dojox.charting.plot2d._PlotEvents;
  8104. =====*/
  8105. var FUDGE_FACTOR = 0.2; // use to overlap fans
  8106. var Spider = declare("dojox.charting.plot2d.Spider", [Element, PlotEvents], {
  8107. // summary:
  8108. // The plot that represents a typical Spider chart.
  8109. defaultParams: {
  8110. labels: true,
  8111. ticks: false,
  8112. fixed: true,
  8113. precision: 1,
  8114. labelOffset: -10,
  8115. labelStyle: "default", // default/rows/auto
  8116. htmlLabels: true, // use HTML to draw labels
  8117. startAngle: -90, // start angle for slices in degrees
  8118. divisions: 3, // radius tick count
  8119. axisColor: "", // spider axis color
  8120. axisWidth: 0, // spider axis stroke width
  8121. spiderColor: "", // spider web color
  8122. spiderWidth: 0, // spider web stroke width
  8123. seriesWidth: 0, // plot border with
  8124. seriesFillAlpha: 0.2, // plot fill alpha
  8125. spiderOrigin: 0.16,
  8126. markerSize: 3, // radius of plot vertex (px)
  8127. spiderType: "polygon", //"circle"
  8128. animationType: easing.backOut,
  8129. axisTickFont: "",
  8130. axisTickFontColor: "",
  8131. axisFont: "",
  8132. axisFontColor: ""
  8133. },
  8134. optionalParams: {
  8135. radius: 0,
  8136. font: "",
  8137. fontColor: ""
  8138. },
  8139. constructor: function(chart, kwArgs){
  8140. // summary:
  8141. // Create a Spider plot.
  8142. this.opt = lang.clone(this.defaultParams);
  8143. du.updateWithObject(this.opt, kwArgs);
  8144. du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
  8145. this.series = [];
  8146. this.dyn = [];
  8147. this.datas = {};
  8148. this.labelKey = [];
  8149. this.oldSeriePoints = {};
  8150. this.animations = {};
  8151. },
  8152. clear: function(){
  8153. // summary:
  8154. // Clear out all of the information tied to this plot.
  8155. // returns: dojox.charting.plot2d.Spider
  8156. // A reference to this plot for functional chaining.
  8157. this.dirty = true;
  8158. this.dyn = [];
  8159. this.series = [];
  8160. this.datas = {};
  8161. this.labelKey = [];
  8162. this.oldSeriePoints = {};
  8163. this.animations = {};
  8164. return this; // dojox.charting.plot2d.Spider
  8165. },
  8166. setAxis: function(axis){
  8167. // summary:
  8168. // Dummy method, since axes are irrelevant with a Spider chart.
  8169. // returns: dojox.charting.plot2d.Spider
  8170. // The reference to this plot for functional chaining.
  8171. return this; // dojox.charting.plot2d.Spider
  8172. },
  8173. addSeries: function(run){
  8174. // summary:
  8175. // Add a data series to this plot.
  8176. // run: dojox.charting.Series
  8177. // The series to be added.
  8178. // returns: dojox.charting.plot2d.Base
  8179. // A reference to this plot for functional chaining.
  8180. var matched = false;
  8181. this.series.push(run);
  8182. for(var key in run.data){
  8183. var val = run.data[key],
  8184. data = this.datas[key];
  8185. if(data){
  8186. data.vlist.push(val);
  8187. data.min = Math.min(data.min, val);
  8188. data.max = Math.max(data.max, val);
  8189. }else{
  8190. this.datas[key] = {min: val, max: val, vlist: [val]};
  8191. }
  8192. }
  8193. if (this.labelKey.length <= 0) {
  8194. for (var key in run.data) {
  8195. this.labelKey.push(key);
  8196. }
  8197. }
  8198. return this; // dojox.charting.plot2d.Base
  8199. },
  8200. getSeriesStats: function(){
  8201. // summary:
  8202. // Calculate the min/max on all attached series in both directions.
  8203. // returns: Object
  8204. // {hmin, hmax, vmin, vmax} min/max in both directions.
  8205. return dc.collectSimpleStats(this.series);
  8206. },
  8207. calculateAxes: function(dim){
  8208. // summary:
  8209. // Stub function for running the axis calculations (depricated).
  8210. // dim: Object
  8211. // An object of the form { width, height }
  8212. // returns: dojox.charting.plot2d.Base
  8213. // A reference to this plot for functional chaining.
  8214. this.initializeScalers(dim, this.getSeriesStats());
  8215. return this; // dojox.charting.plot2d.Base
  8216. },
  8217. getRequiredColors: function(){
  8218. // summary:
  8219. // Get how many data series we have, so we know how many colors to use.
  8220. // returns: Number
  8221. // The number of colors needed.
  8222. return this.series.length; // Number
  8223. },
  8224. initializeScalers: function(dim, stats){
  8225. // summary:
  8226. // Initializes scalers using attached axes.
  8227. // dim: Object:
  8228. // Size of a plot area in pixels as {width, height}.
  8229. // stats: Object:
  8230. // Min/max of data in both directions as {hmin, hmax, vmin, vmax}.
  8231. // returns: dojox.charting.plot2d.Base
  8232. // A reference to this plot for functional chaining.
  8233. if(this._hAxis){
  8234. if(!this._hAxis.initialized()){
  8235. this._hAxis.calculate(stats.hmin, stats.hmax, dim.width);
  8236. }
  8237. this._hScaler = this._hAxis.getScaler();
  8238. }else{
  8239. this._hScaler = primitive.buildScaler(stats.hmin, stats.hmax, dim.width);
  8240. }
  8241. if(this._vAxis){
  8242. if(!this._vAxis.initialized()){
  8243. this._vAxis.calculate(stats.vmin, stats.vmax, dim.height);
  8244. }
  8245. this._vScaler = this._vAxis.getScaler();
  8246. }else{
  8247. this._vScaler = primitive.buildScaler(stats.vmin, stats.vmax, dim.height);
  8248. }
  8249. return this; // dojox.charting.plot2d.Base
  8250. },
  8251. render: function(dim, offsets){
  8252. // summary:
  8253. // Render the plot on the chart.
  8254. // dim: Object
  8255. // An object of the form { width, height }.
  8256. // offsets: Object
  8257. // An object of the form { l, r, t, b }.
  8258. // returns: dojox.charting.plot2d.Spider
  8259. // A reference to this plot for functional chaining.
  8260. if(!this.dirty){ return this; }
  8261. this.dirty = false;
  8262. this.cleanGroup();
  8263. var s = this.group, t = this.chart.theme;
  8264. this.resetEvents();
  8265. if(!this.series || !this.series.length){
  8266. return this;
  8267. }
  8268. // calculate the geometry
  8269. var o = this.opt, ta = t.axis,
  8270. rx = (dim.width - offsets.l - offsets.r) / 2,
  8271. ry = (dim.height - offsets.t - offsets.b) / 2,
  8272. r = Math.min(rx, ry),
  8273. axisTickFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font) || "normal normal normal 7pt Tahoma",
  8274. axisFont = o.axisFont || (ta.tick && ta.tick.titleFont) || "normal normal normal 11pt Tahoma",
  8275. axisTickFontColor = o.axisTickFontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "silver",
  8276. axisFontColor = o.axisFontColor || (ta.tick && ta.tick.titleFontColor) || "black",
  8277. axisColor = o.axisColor || (ta.tick && ta.tick.axisColor) || "silver",
  8278. spiderColor = o.spiderColor || (ta.tick && ta.tick.spiderColor) || "silver",
  8279. axisWidth = o.axisWidth || (ta.stroke && ta.stroke.width) || 2,
  8280. spiderWidth = o.spiderWidth || (ta.stroke && ta.stroke.width) || 2,
  8281. seriesWidth = o.seriesWidth || (ta.stroke && ta.stroke.width) || 2,
  8282. asize = g.normalizedLength(g.splitFontString(axisFont).size),
  8283. startAngle = m._degToRad(o.startAngle),
  8284. start = startAngle, step, filteredRun, slices, labels, shift, labelR,
  8285. outerPoints, innerPoints, divisionPoints, divisionRadius, labelPoints,
  8286. ro = o.spiderOrigin, dv = o.divisions >= 3 ? o.divisions : 3, ms = o.markerSize,
  8287. spt = o.spiderType, at = o.animationType, lboffset = o.labelOffset < -10 ? o.labelOffset : -10,
  8288. axisExtra = 0.2;
  8289. if(o.labels){
  8290. labels = arr.map(this.series, function(s){
  8291. return s.name;
  8292. }, this);
  8293. shift = df.foldl1(df.map(labels, function(label, i){
  8294. var font = t.series.font;
  8295. return g._base._getTextBox(label, {
  8296. font: font
  8297. }).w;
  8298. }, this), "Math.max(a, b)") / 2;
  8299. r = Math.min(rx - 2 * shift, ry - asize) + lboffset;
  8300. labelR = r - lboffset;
  8301. }
  8302. if ("radius" in o) {
  8303. r = o.radius;
  8304. labelR = r - lboffset;
  8305. }
  8306. r /= (1+axisExtra);
  8307. var circle = {
  8308. cx: offsets.l + rx,
  8309. cy: offsets.t + ry,
  8310. r: r
  8311. };
  8312. for (var i = this.series.length - 1; i >= 0; i--) {
  8313. var serieEntry = this.series[i];
  8314. if (!this.dirty && !serieEntry.dirty) {
  8315. t.skip();
  8316. continue;
  8317. }
  8318. serieEntry.cleanGroup();
  8319. var run = serieEntry.data;
  8320. if (run !== null) {
  8321. var len = this._getObjectLength(run);
  8322. //construct connect points
  8323. if (!outerPoints || outerPoints.length <= 0) {
  8324. outerPoints = [], innerPoints = [], labelPoints = [];
  8325. this._buildPoints(outerPoints, len, circle, r, start, true);
  8326. this._buildPoints(innerPoints, len, circle, r*ro, start, true);
  8327. this._buildPoints(labelPoints, len, circle, labelR, start);
  8328. if(dv > 2){
  8329. divisionPoints = [], divisionRadius = [];
  8330. for (var j = 0; j < dv - 2; j++) {
  8331. divisionPoints[j] = [];
  8332. this._buildPoints(divisionPoints[j], len, circle, r*(ro + (1-ro)*(j+1)/(dv-1)), start, true);
  8333. divisionRadius[j] = r*(ro + (1-ro)*(j+1)/(dv-1));
  8334. }
  8335. }
  8336. }
  8337. }
  8338. }
  8339. //draw Spider
  8340. //axis
  8341. var axisGroup = s.createGroup(), axisStroke = {color: axisColor, width: axisWidth},
  8342. spiderStroke = {color: spiderColor, width: spiderWidth};
  8343. for (var j = outerPoints.length - 1; j >= 0; --j) {
  8344. var point = outerPoints[j],
  8345. st = {
  8346. x: point.x + (point.x - circle.cx) * axisExtra,
  8347. y: point.y + (point.y - circle.cy) * axisExtra
  8348. },
  8349. nd = {
  8350. x: point.x + (point.x - circle.cx) * axisExtra / 2,
  8351. y: point.y + (point.y - circle.cy) * axisExtra / 2
  8352. };
  8353. axisGroup.createLine({
  8354. x1: circle.cx,
  8355. y1: circle.cy,
  8356. x2: st.x,
  8357. y2: st.y
  8358. }).setStroke(axisStroke);
  8359. //arrow
  8360. this._drawArrow(axisGroup, st, nd, axisStroke);
  8361. }
  8362. // draw the label
  8363. var labelGroup = s.createGroup();
  8364. for (var j = labelPoints.length - 1; j >= 0; --j) {
  8365. var point = labelPoints[j],
  8366. fontWidth = g._base._getTextBox(this.labelKey[j], {font: axisFont}).w || 0,
  8367. render = this.opt.htmlLabels && g.renderer != "vml" ? "html" : "gfx",
  8368. elem = da.createText[render](this.chart, labelGroup, (!domGeom.isBodyLtr() && render == "html") ? (point.x + fontWidth - dim.width) : point.x, point.y,
  8369. "middle", this.labelKey[j], axisFont, axisFontColor);
  8370. if (this.opt.htmlLabels) {
  8371. this.htmlElements.push(elem);
  8372. }
  8373. }
  8374. //spider web: polygon or circle
  8375. var spiderGroup = s.createGroup();
  8376. if(spt == "polygon"){
  8377. spiderGroup.createPolyline(outerPoints).setStroke(spiderStroke);
  8378. spiderGroup.createPolyline(innerPoints).setStroke(spiderStroke);
  8379. if (divisionPoints.length > 0) {
  8380. for (var j = divisionPoints.length - 1; j >= 0; --j) {
  8381. spiderGroup.createPolyline(divisionPoints[j]).setStroke(spiderStroke);
  8382. }
  8383. }
  8384. }else{//circle
  8385. var ccount = this._getObjectLength(this.datas);
  8386. spiderGroup.createCircle({cx: circle.cx, cy: circle.cy, r: r}).setStroke(spiderStroke);
  8387. spiderGroup.createCircle({cx: circle.cx, cy: circle.cy, r: r*ro}).setStroke(spiderStroke);
  8388. if (divisionRadius.length > 0) {
  8389. for (var j = divisionRadius.length - 1; j >= 0; --j) {
  8390. spiderGroup.createCircle({cx: circle.cx, cy: circle.cy, r: divisionRadius[j]}).setStroke(spiderStroke);
  8391. }
  8392. }
  8393. }
  8394. //text
  8395. var textGroup = s.createGroup(), len = this._getObjectLength(this.datas), k = 0;
  8396. for(var key in this.datas){
  8397. var data = this.datas[key], min = data.min, max = data.max, distance = max - min,
  8398. end = start + 2 * Math.PI * k / len;
  8399. for (var i = 0; i < dv; i++) {
  8400. var text = min + distance*i/(dv-1), point = this._getCoordinate(circle, r*(ro + (1-ro)*i/(dv-1)), end);
  8401. text = this._getLabel(text);
  8402. var fontWidth = g._base._getTextBox(text, {font: axisTickFont}).w || 0,
  8403. render = this.opt.htmlLabels && g.renderer != "vml" ? "html" : "gfx";
  8404. if (this.opt.htmlLabels) {
  8405. this.htmlElements.push(da.createText[render]
  8406. (this.chart, textGroup, (!domGeom.isBodyLtr() && render == "html") ? (point.x + fontWidth - dim.width) : point.x, point.y,
  8407. "start", text, axisTickFont, axisTickFontColor));
  8408. }
  8409. }
  8410. k++;
  8411. }
  8412. //draw series (animation)
  8413. this.chart.seriesShapes = {};
  8414. var animationConnections = [];
  8415. for (var i = this.series.length - 1; i >= 0; i--) {
  8416. var serieEntry = this.series[i], run = serieEntry.data;
  8417. if (run !== null) {
  8418. //series polygon
  8419. var seriePoints = [], k = 0, tipData = [];
  8420. for(var key in run){
  8421. var data = this.datas[key], min = data.min, max = data.max, distance = max - min,
  8422. entry = run[key], end = start + 2 * Math.PI * k / len,
  8423. point = this._getCoordinate(circle, r*(ro + (1-ro)*(entry-min)/distance), end);
  8424. seriePoints.push(point);
  8425. tipData.push({sname: serieEntry.name, key: key, data: entry});
  8426. k++;
  8427. }
  8428. seriePoints[seriePoints.length] = seriePoints[0];
  8429. tipData[tipData.length] = tipData[0];
  8430. var polygonBoundRect = this._getBoundary(seriePoints),
  8431. theme = t.next("spider", [o, serieEntry]), ts = serieEntry.group,
  8432. f = g.normalizeColor(theme.series.fill), sk = {color: theme.series.fill, width: seriesWidth};
  8433. f.a = o.seriesFillAlpha;
  8434. serieEntry.dyn = {fill: f, stroke: sk};
  8435. var osps = this.oldSeriePoints[serieEntry.name];
  8436. var cs = this._createSeriesEntry(ts, (osps || innerPoints), seriePoints, f, sk, r, ro, ms, at);
  8437. this.chart.seriesShapes[serieEntry.name] = cs;
  8438. this.oldSeriePoints[serieEntry.name] = seriePoints;
  8439. var po = {
  8440. element: "spider_poly",
  8441. index: i,
  8442. id: "spider_poly_"+serieEntry.name,
  8443. run: serieEntry,
  8444. plot: this,
  8445. shape: cs.poly,
  8446. parent: ts,
  8447. brect: polygonBoundRect,
  8448. cx: circle.cx,
  8449. cy: circle.cy,
  8450. cr: r,
  8451. f: f,
  8452. s: s
  8453. };
  8454. this._connectEvents(po);
  8455. var so = {
  8456. element: "spider_plot",
  8457. index: i,
  8458. id: "spider_plot_"+serieEntry.name,
  8459. run: serieEntry,
  8460. plot: this,
  8461. shape: serieEntry.group
  8462. };
  8463. this._connectEvents(so);
  8464. arr.forEach(cs.circles, function(c, i){
  8465. var shape = c.getShape(),
  8466. co = {
  8467. element: "spider_circle",
  8468. index: i,
  8469. id: "spider_circle_"+serieEntry.name+i,
  8470. run: serieEntry,
  8471. plot: this,
  8472. shape: c,
  8473. parent: ts,
  8474. tdata: tipData[i],
  8475. cx: seriePoints[i].x,
  8476. cy: seriePoints[i].y,
  8477. f: f,
  8478. s: s
  8479. };
  8480. this._connectEvents(co);
  8481. }, this);
  8482. }
  8483. }
  8484. return this; // dojox.charting.plot2d.Spider
  8485. },
  8486. _createSeriesEntry: function(ts, osps, sps, f, sk, r, ro, ms, at){
  8487. //polygon
  8488. var spoly = ts.createPolyline(osps).setFill(f).setStroke(sk), scircle = [];
  8489. for (var j = 0; j < osps.length; j++) {
  8490. var point = osps[j], cr = ms;
  8491. var circle = ts.createCircle({cx: point.x, cy: point.y, r: cr}).setFill(f).setStroke(sk);
  8492. scircle.push(circle);
  8493. }
  8494. var anims = arr.map(sps, function(np, j){
  8495. // create animation
  8496. var sp = osps[j],
  8497. anim = new baseFx.Animation({
  8498. duration: 1000,
  8499. easing: at,
  8500. curve: [sp.y, np.y]
  8501. });
  8502. var spl = spoly, sc = scircle[j];
  8503. hub.connect(anim, "onAnimate", function(y){
  8504. //apply poly
  8505. var pshape = spl.getShape();
  8506. pshape.points[j].y = y;
  8507. spl.setShape(pshape);
  8508. //apply circle
  8509. var cshape = sc.getShape();
  8510. cshape.cy = y;
  8511. sc.setShape(cshape);
  8512. });
  8513. return anim;
  8514. });
  8515. var anims1 = arr.map(sps, function(np, j){
  8516. // create animation
  8517. var sp = osps[j],
  8518. anim = new baseFx.Animation({
  8519. duration: 1000,
  8520. easing: at,
  8521. curve: [sp.x, np.x]
  8522. });
  8523. var spl = spoly, sc = scircle[j];
  8524. hub.connect(anim, "onAnimate", function(x){
  8525. //apply poly
  8526. var pshape = spl.getShape();
  8527. pshape.points[j].x = x;
  8528. spl.setShape(pshape);
  8529. //apply circle
  8530. var cshape = sc.getShape();
  8531. cshape.cx = x;
  8532. sc.setShape(cshape);
  8533. });
  8534. return anim;
  8535. });
  8536. var masterAnimation = coreFx.combine(anims.concat(anims1)); //dojo.fx.chain(anims);
  8537. masterAnimation.play();
  8538. return {group :ts, poly: spoly, circles: scircle};
  8539. },
  8540. plotEvent: function(o){
  8541. // summary:
  8542. // Stub function for use by specific plots.
  8543. // o: Object
  8544. // An object intended to represent event parameters.
  8545. var runName = o.id ? o.id : "default", a;
  8546. if (runName in this.animations) {
  8547. a = this.animations[runName];
  8548. a.anim && a.anim.stop(true);
  8549. } else {
  8550. a = this.animations[runName] = {};
  8551. }
  8552. if(o.element == "spider_poly"){
  8553. if(!a.color){
  8554. var color = o.shape.getFill();
  8555. if(!color || !(color instanceof Color)){
  8556. return;
  8557. }
  8558. a.color = {
  8559. start: color,
  8560. end: transColor(color)
  8561. };
  8562. }
  8563. var start = a.color.start, end = a.color.end;
  8564. if(o.type == "onmouseout"){
  8565. // swap colors
  8566. var t = start; start = end; end = t;
  8567. }
  8568. a.anim = gfxfx.animateFill({
  8569. shape: o.shape,
  8570. duration: 800,
  8571. easing: easing.backOut,
  8572. color: {start: start, end: end}
  8573. });
  8574. a.anim.play();
  8575. }else if(o.element == "spider_circle"){
  8576. var init, scale, defaultScale = 1.5;
  8577. if(o.type == "onmouseover"){
  8578. init = m.identity;
  8579. scale = defaultScale;
  8580. //show tooltip
  8581. var aroundRect = {type: "rect"};
  8582. aroundRect.x = o.cx;
  8583. aroundRect.y = o.cy;
  8584. aroundRect.width = aroundRect.height = 1;
  8585. var lt = html.coords(this.chart.node, true);
  8586. aroundRect.x += lt.x;
  8587. aroundRect.y += lt.y;
  8588. aroundRect.x = Math.round(aroundRect.x);
  8589. aroundRect.y = Math.round(aroundRect.y);
  8590. aroundRect.width = aroundRect.w = Math.ceil(aroundRect.width);
  8591. aroundRect.height = aroundRect.h = Math.ceil(aroundRect.height);
  8592. this.aroundRect = aroundRect;
  8593. var position = ["after-centered", "before-centered"];
  8594. dc.doIfLoaded("dijit/Tooltip", dojo.hitch(this, function(Tooltip){
  8595. Tooltip.show(o.tdata.sname + "<br/>" + o.tdata.key + "<br/>" + o.tdata.data, this.aroundRect, position);
  8596. }));
  8597. }else{
  8598. init = m.scaleAt(defaultScale, o.cx, o.cy);
  8599. scale = 1/defaultScale;
  8600. dc.doIfLoaded("dijit/Tooltip", dojo.hitch(this, function(Tooltip){
  8601. this.aroundRect && Tooltip.hide(this.aroundRect);
  8602. }));
  8603. }
  8604. var cs = o.shape.getShape(),
  8605. init = m.scaleAt(defaultScale, cs.cx, cs.cy),
  8606. kwArgs = {
  8607. shape: o.shape,
  8608. duration: 200,
  8609. easing: easing.backOut,
  8610. transform: [
  8611. {name: "scaleAt", start: [1, cs.cx, cs.cy], end: [scale, cs.cx, cs.cy]},
  8612. init
  8613. ]
  8614. };
  8615. a.anim = gfxfx.animateTransform(kwArgs);
  8616. a.anim.play();
  8617. }else if(o.element == "spider_plot"){
  8618. //dojo gfx function "moveToFront" not work in IE
  8619. if (o.type == "onmouseover" && !has("ie")) {
  8620. o.shape.moveToFront();
  8621. }
  8622. }
  8623. },
  8624. _getBoundary: function(points){
  8625. var xmax = points[0].x,
  8626. xmin = points[0].x,
  8627. ymax = points[0].y,
  8628. ymin = points[0].y;
  8629. for(var i = 0; i < points.length; i++){
  8630. var point = points[i];
  8631. xmax = Math.max(point.x, xmax);
  8632. ymax = Math.max(point.y, ymax);
  8633. xmin = Math.min(point.x, xmin);
  8634. ymin = Math.min(point.y, ymin);
  8635. }
  8636. return {
  8637. x: xmin,
  8638. y: ymin,
  8639. width: xmax - xmin,
  8640. height: ymax - ymin
  8641. };
  8642. },
  8643. _drawArrow: function(s, start, end, stroke){
  8644. var len = Math.sqrt(Math.pow(end.x - start.x, 2) + Math.pow(end.y - start.y, 2)),
  8645. sin = (end.y - start.y)/len, cos = (end.x - start.x)/len,
  8646. point2 = {x: end.x + (len/3)*(-sin), y: end.y + (len/3)*cos},
  8647. point3 = {x: end.x + (len/3)*sin, y: end.y + (len/3)*(-cos)};
  8648. s.createPolyline([start, point2, point3]).setFill(stroke.color).setStroke(stroke);
  8649. },
  8650. _buildPoints: function(points, count, circle, radius, angle, recursive){
  8651. for (var i = 0; i < count; i++) {
  8652. var end = angle + 2 * Math.PI * i / count;
  8653. points.push(this._getCoordinate(circle, radius, end));
  8654. }
  8655. if(recursive){
  8656. points.push(this._getCoordinate(circle, radius, angle + 2 * Math.PI));
  8657. }
  8658. },
  8659. _getCoordinate: function(circle, radius, angle){
  8660. return {
  8661. x: circle.cx + radius * Math.cos(angle),
  8662. y: circle.cy + radius * Math.sin(angle)
  8663. }
  8664. },
  8665. _getObjectLength: function(obj){
  8666. var count = 0;
  8667. if(lang.isObject(obj)){
  8668. for(var key in obj){
  8669. count++;
  8670. }
  8671. }
  8672. return count;
  8673. },
  8674. // utilities
  8675. _getLabel: function(number){
  8676. return dc.getLabel(number, this.opt.fixed, this.opt.precision);
  8677. }
  8678. });
  8679. function transColor(color){
  8680. var a = new dxcolor.Color(color),
  8681. x = a.toHsl();
  8682. if(x.s == 0){
  8683. x.l = x.l < 50 ? 100 : 0;
  8684. }else{
  8685. x.s = 100;
  8686. if(x.l < 50){
  8687. x.l = 75;
  8688. }else if(x.l > 75){
  8689. x.l = 50;
  8690. }else{
  8691. x.l = x.l - 50 > 75 - x.l ?
  8692. 50 : 75;
  8693. }
  8694. }
  8695. var color = dxcolor.fromHsl(x);
  8696. color.a = 0.7;
  8697. return color;
  8698. }
  8699. return Spider; // dojox.plot2d.Spider
  8700. });
  8701. },
  8702. 'dojox/charting/plot2d/StackedBars':function(){
  8703. define(["dojo/_base/lang", "dojo/_base/array", "dojo/_base/declare", "./Bars", "./common",
  8704. "dojox/lang/functional", "dojox/lang/functional/reversed", "dojox/lang/functional/sequence"],
  8705. function(lang, arr, declare, Bars, dc, df, dfr, dfs){
  8706. var purgeGroup = dfr.lambda("item.purgeGroup()");
  8707. /*=====
  8708. var bars = dojox.charting.plot2d.Bars;
  8709. =====*/
  8710. return declare("dojox.charting.plot2d.StackedBars", Bars, {
  8711. // summary:
  8712. // The plot object representing a stacked bar chart (horizontal bars).
  8713. getSeriesStats: function(){
  8714. // summary:
  8715. // Calculate the min/max on all attached series in both directions.
  8716. // returns: Object
  8717. // {hmin, hmax, vmin, vmax} min/max in both directions.
  8718. var stats = dc.collectStackedStats(this.series), t;
  8719. this._maxRunLength = stats.hmax;
  8720. stats.hmin -= 0.5;
  8721. stats.hmax += 0.5;
  8722. t = stats.hmin, stats.hmin = stats.vmin, stats.vmin = t;
  8723. t = stats.hmax, stats.hmax = stats.vmax, stats.vmax = t;
  8724. return stats;
  8725. },
  8726. render: function(dim, offsets){
  8727. // summary:
  8728. // Run the calculations for any axes for this plot.
  8729. // dim: Object
  8730. // An object in the form of { width, height }
  8731. // offsets: Object
  8732. // An object of the form { l, r, t, b}.
  8733. // returns: dojox.charting.plot2d.StackedBars
  8734. // A reference to this plot for functional chaining.
  8735. if(this._maxRunLength <= 0){
  8736. return this;
  8737. }
  8738. // stack all values
  8739. var acc = df.repeat(this._maxRunLength, "-> 0", 0);
  8740. for(var i = 0; i < this.series.length; ++i){
  8741. var run = this.series[i];
  8742. for(var j = 0; j < run.data.length; ++j){
  8743. var value = run.data[j];
  8744. if(value !== null){
  8745. var v = typeof value == "number" ? value : value.y;
  8746. if(isNaN(v)){ v = 0; }
  8747. acc[j] += v;
  8748. }
  8749. }
  8750. }
  8751. // draw runs in backwards
  8752. if(this.zoom && !this.isDataDirty()){
  8753. return this.performZoom(dim, offsets);
  8754. }
  8755. this.resetEvents();
  8756. this.dirty = this.isDirty();
  8757. if(this.dirty){
  8758. arr.forEach(this.series, purgeGroup);
  8759. this._eventSeries = {};
  8760. this.cleanGroup();
  8761. var s = this.group;
  8762. df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
  8763. }
  8764. var t = this.chart.theme, f, gap, height,
  8765. ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
  8766. vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
  8767. events = this.events();
  8768. f = dc.calculateBarSize(this._vScaler.bounds.scale, this.opt);
  8769. gap = f.gap;
  8770. height = f.size;
  8771. for(var i = this.series.length - 1; i >= 0; --i){
  8772. var run = this.series[i];
  8773. if(!this.dirty && !run.dirty){
  8774. t.skip();
  8775. this._reconnectEvents(run.name);
  8776. continue;
  8777. }
  8778. run.cleanGroup();
  8779. var theme = t.next("bar", [this.opt, run]), s = run.group,
  8780. eventSeries = new Array(acc.length);
  8781. for(var j = 0; j < acc.length; ++j){
  8782. var value = run.data[j];
  8783. if(value !== null){
  8784. var v = acc[j],
  8785. width = ht(v),
  8786. finalTheme = typeof value != "number" ?
  8787. t.addMixin(theme, "bar", value, true) :
  8788. t.post(theme, "bar");
  8789. if(width >= 0 && height >= 1){
  8790. var rect = {
  8791. x: offsets.l,
  8792. y: dim.height - offsets.b - vt(j + 1.5) + gap,
  8793. width: width, height: height
  8794. };
  8795. var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
  8796. specialFill = this._shapeFill(specialFill, rect);
  8797. var shape = s.createRect(rect).setFill(specialFill).setStroke(finalTheme.series.stroke);
  8798. run.dyn.fill = shape.getFill();
  8799. run.dyn.stroke = shape.getStroke();
  8800. if(events){
  8801. var o = {
  8802. element: "bar",
  8803. index: j,
  8804. run: run,
  8805. shape: shape,
  8806. x: v,
  8807. y: j + 1.5
  8808. };
  8809. this._connectEvents(o);
  8810. eventSeries[j] = o;
  8811. }
  8812. if(this.animate){
  8813. this._animateBar(shape, offsets.l, -width);
  8814. }
  8815. }
  8816. }
  8817. }
  8818. this._eventSeries[run.name] = eventSeries;
  8819. run.dirty = false;
  8820. // update the accumulator
  8821. for(var j = 0; j < run.data.length; ++j){
  8822. var value = run.data[j];
  8823. if(value !== null){
  8824. var v = typeof value == "number" ? value : value.y;
  8825. if(isNaN(v)){ v = 0; }
  8826. acc[j] -= v;
  8827. }
  8828. }
  8829. }
  8830. this.dirty = false;
  8831. return this; // dojox.charting.plot2d.StackedBars
  8832. }
  8833. });
  8834. });
  8835. },
  8836. 'dojox/charting/themes/GreySkies':function(){
  8837. define("dojox/charting/themes/GreySkies", ["../Theme", "./common"], function(Theme, themes){
  8838. themes.GreySkies=new Theme(Theme._def);
  8839. return themes.GreySkies;
  8840. });
  8841. },
  8842. 'dojox/charting/plot2d/Columns':function(){
  8843. define(["dojo/_base/lang", "dojo/_base/array", "dojo/_base/declare", "./Base", "./common",
  8844. "dojox/lang/functional", "dojox/lang/functional/reversed", "dojox/lang/utils", "dojox/gfx/fx"],
  8845. function(lang, arr, declare, Base, dc, df, dfr, du, fx){
  8846. var purgeGroup = dfr.lambda("item.purgeGroup()");
  8847. /*=====
  8848. var Base = dojox.charting.plot2d.Base;
  8849. =====*/
  8850. return declare("dojox.charting.plot2d.Columns", Base, {
  8851. // summary:
  8852. // The plot object representing a column chart (vertical bars).
  8853. defaultParams: {
  8854. hAxis: "x", // use a horizontal axis named "x"
  8855. vAxis: "y", // use a vertical axis named "y"
  8856. gap: 0, // gap between columns in pixels
  8857. animate: null, // animate bars into place
  8858. enableCache: false
  8859. },
  8860. optionalParams: {
  8861. minBarSize: 1, // minimal column width in pixels
  8862. maxBarSize: 1, // maximal column width in pixels
  8863. // theme component
  8864. stroke: {},
  8865. outline: {},
  8866. shadow: {},
  8867. fill: {},
  8868. font: "",
  8869. fontColor: ""
  8870. },
  8871. constructor: function(chart, kwArgs){
  8872. // summary:
  8873. // The constructor for a columns chart.
  8874. // chart: dojox.charting.Chart
  8875. // The chart this plot belongs to.
  8876. // kwArgs: dojox.charting.plot2d.__BarCtorArgs?
  8877. // An optional keyword arguments object to help define the plot.
  8878. this.opt = lang.clone(this.defaultParams);
  8879. du.updateWithObject(this.opt, kwArgs);
  8880. du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
  8881. this.series = [];
  8882. this.hAxis = this.opt.hAxis;
  8883. this.vAxis = this.opt.vAxis;
  8884. this.animate = this.opt.animate;
  8885. },
  8886. getSeriesStats: function(){
  8887. // summary:
  8888. // Calculate the min/max on all attached series in both directions.
  8889. // returns: Object
  8890. // {hmin, hmax, vmin, vmax} min/max in both directions.
  8891. var stats = dc.collectSimpleStats(this.series);
  8892. stats.hmin -= 0.5;
  8893. stats.hmax += 0.5;
  8894. return stats;
  8895. },
  8896. createRect: function(run, creator, params){
  8897. var rect;
  8898. if(this.opt.enableCache && run._rectFreePool.length > 0){
  8899. rect = run._rectFreePool.pop();
  8900. rect.setShape(params);
  8901. // was cleared, add it back
  8902. creator.add(rect);
  8903. }else{
  8904. rect = creator.createRect(params);
  8905. }
  8906. if(this.opt.enableCache){
  8907. run._rectUsePool.push(rect);
  8908. }
  8909. return rect;
  8910. },
  8911. render: function(dim, offsets){
  8912. // summary:
  8913. // Run the calculations for any axes for this plot.
  8914. // dim: Object
  8915. // An object in the form of { width, height }
  8916. // offsets: Object
  8917. // An object of the form { l, r, t, b}.
  8918. // returns: dojox.charting.plot2d.Columns
  8919. // A reference to this plot for functional chaining.
  8920. if(this.zoom && !this.isDataDirty()){
  8921. return this.performZoom(dim, offsets);
  8922. }
  8923. var t = this.getSeriesStats();
  8924. this.resetEvents();
  8925. this.dirty = this.isDirty();
  8926. if(this.dirty){
  8927. arr.forEach(this.series, purgeGroup);
  8928. this._eventSeries = {};
  8929. this.cleanGroup();
  8930. var s = this.group;
  8931. df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
  8932. }
  8933. var t = this.chart.theme, f, gap, width,
  8934. ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
  8935. vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
  8936. baseline = Math.max(0, this._vScaler.bounds.lower),
  8937. baselineHeight = vt(baseline),
  8938. min = Math.max(0, Math.floor(this._hScaler.bounds.from - 1)), max = Math.ceil(this._hScaler.bounds.to),
  8939. events = this.events();
  8940. f = dc.calculateBarSize(this._hScaler.bounds.scale, this.opt);
  8941. gap = f.gap;
  8942. width = f.size;
  8943. for(var i = this.series.length - 1; i >= 0; --i){
  8944. var run = this.series[i];
  8945. if(!this.dirty && !run.dirty){
  8946. t.skip();
  8947. this._reconnectEvents(run.name);
  8948. continue;
  8949. }
  8950. run.cleanGroup();
  8951. if(this.opt.enableCache){
  8952. run._rectFreePool = (run._rectFreePool?run._rectFreePool:[]).concat(run._rectUsePool?run._rectUsePool:[]);
  8953. run._rectUsePool = [];
  8954. }
  8955. var theme = t.next("column", [this.opt, run]), s = run.group,
  8956. eventSeries = new Array(run.data.length);
  8957. var l = Math.min(run.data.length, max);
  8958. for(var j = min; j < l; ++j){
  8959. var value = run.data[j];
  8960. if(value !== null){
  8961. var v = typeof value == "number" ? value : value.y,
  8962. vv = vt(v),
  8963. height = vv - baselineHeight,
  8964. h = Math.abs(height),
  8965. finalTheme = typeof value != "number" ?
  8966. t.addMixin(theme, "column", value, true) :
  8967. t.post(theme, "column");
  8968. if(width >= 1 && h >= 0){
  8969. var rect = {
  8970. x: offsets.l + ht(j + 0.5) + gap,
  8971. y: dim.height - offsets.b - (v > baseline ? vv : baselineHeight),
  8972. width: width, height: h
  8973. };
  8974. var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
  8975. specialFill = this._shapeFill(specialFill, rect);
  8976. var shape = this.createRect(run, s, rect).setFill(specialFill).setStroke(finalTheme.series.stroke);
  8977. run.dyn.fill = shape.getFill();
  8978. run.dyn.stroke = shape.getStroke();
  8979. if(events){
  8980. var o = {
  8981. element: "column",
  8982. index: j,
  8983. run: run,
  8984. shape: shape,
  8985. x: j + 0.5,
  8986. y: v
  8987. };
  8988. this._connectEvents(o);
  8989. eventSeries[j] = o;
  8990. }
  8991. if(this.animate){
  8992. this._animateColumn(shape, dim.height - offsets.b - baselineHeight, h);
  8993. }
  8994. }
  8995. }
  8996. }
  8997. this._eventSeries[run.name] = eventSeries;
  8998. run.dirty = false;
  8999. }
  9000. this.dirty = false;
  9001. return this; // dojox.charting.plot2d.Columns
  9002. },
  9003. _animateColumn: function(shape, voffset, vsize){
  9004. fx.animateTransform(lang.delegate({
  9005. shape: shape,
  9006. duration: 1200,
  9007. transform: [
  9008. {name: "translate", start: [0, voffset - (voffset/vsize)], end: [0, 0]},
  9009. {name: "scale", start: [1, 1/vsize], end: [1, 1]},
  9010. {name: "original"}
  9011. ]
  9012. }, this.animate)).play();
  9013. }
  9014. });
  9015. });
  9016. },
  9017. 'dijit/place':function(){
  9018. define("dijit/place", [
  9019. "dojo/_base/array", // array.forEach array.map array.some
  9020. "dojo/dom-geometry", // domGeometry.position
  9021. "dojo/dom-style", // domStyle.getComputedStyle
  9022. "dojo/_base/kernel", // kernel.deprecated
  9023. "dojo/_base/window", // win.body
  9024. "./Viewport", // getEffectiveBox
  9025. "." // dijit (defining dijit.place to match API doc)
  9026. ], function(array, domGeometry, domStyle, kernel, win, Viewport, dijit){
  9027. // module:
  9028. // dijit/place
  9029. // summary:
  9030. // Code to place a popup relative to another node
  9031. function _place(/*DomNode*/ node, choices, layoutNode, aroundNodeCoords){
  9032. // summary:
  9033. // Given a list of spots to put node, put it at the first spot where it fits,
  9034. // of if it doesn't fit anywhere then the place with the least overflow
  9035. // choices: Array
  9036. // Array of elements like: {corner: 'TL', pos: {x: 10, y: 20} }
  9037. // Above example says to put the top-left corner of the node at (10,20)
  9038. // layoutNode: Function(node, aroundNodeCorner, nodeCorner, size)
  9039. // for things like tooltip, they are displayed differently (and have different dimensions)
  9040. // based on their orientation relative to the parent. This adjusts the popup based on orientation.
  9041. // It also passes in the available size for the popup, which is useful for tooltips to
  9042. // tell them that their width is limited to a certain amount. layoutNode() may return a value expressing
  9043. // how much the popup had to be modified to fit into the available space. This is used to determine
  9044. // what the best placement is.
  9045. // aroundNodeCoords: Object
  9046. // Size of aroundNode, ex: {w: 200, h: 50}
  9047. // get {x: 10, y: 10, w: 100, h:100} type obj representing position of
  9048. // viewport over document
  9049. var view = Viewport.getEffectiveBox(node.ownerDocument);
  9050. // This won't work if the node is inside a <div style="position: relative">,
  9051. // so reattach it to win.doc.body. (Otherwise, the positioning will be wrong
  9052. // and also it might get cutoff)
  9053. if(!node.parentNode || String(node.parentNode.tagName).toLowerCase() != "body"){
  9054. win.body().appendChild(node);
  9055. }
  9056. var best = null;
  9057. array.some(choices, function(choice){
  9058. var corner = choice.corner;
  9059. var pos = choice.pos;
  9060. var overflow = 0;
  9061. // calculate amount of space available given specified position of node
  9062. var spaceAvailable = {
  9063. w: {
  9064. 'L': view.l + view.w - pos.x,
  9065. 'R': pos.x - view.l,
  9066. 'M': view.w
  9067. }[corner.charAt(1)],
  9068. h: {
  9069. 'T': view.t + view.h - pos.y,
  9070. 'B': pos.y - view.t,
  9071. 'M': view.h
  9072. }[corner.charAt(0)]
  9073. };
  9074. // Clear left/right position settings set earlier so they don't interfere with calculations,
  9075. // specifically when layoutNode() (a.k.a. Tooltip.orient()) measures natural width of Tooltip
  9076. var s = node.style;
  9077. s.left = s.right = "auto";
  9078. // configure node to be displayed in given position relative to button
  9079. // (need to do this in order to get an accurate size for the node, because
  9080. // a tooltip's size changes based on position, due to triangle)
  9081. if(layoutNode){
  9082. var res = layoutNode(node, choice.aroundCorner, corner, spaceAvailable, aroundNodeCoords);
  9083. overflow = typeof res == "undefined" ? 0 : res;
  9084. }
  9085. // get node's size
  9086. var style = node.style;
  9087. var oldDisplay = style.display;
  9088. var oldVis = style.visibility;
  9089. if(style.display == "none"){
  9090. style.visibility = "hidden";
  9091. style.display = "";
  9092. }
  9093. var bb = domGeometry.position(node);
  9094. style.display = oldDisplay;
  9095. style.visibility = oldVis;
  9096. // coordinates and size of node with specified corner placed at pos,
  9097. // and clipped by viewport
  9098. var
  9099. startXpos = {
  9100. 'L': pos.x,
  9101. 'R': pos.x - bb.w,
  9102. 'M': Math.max(view.l, Math.min(view.l + view.w, pos.x + (bb.w >> 1)) - bb.w) // M orientation is more flexible
  9103. }[corner.charAt(1)],
  9104. startYpos = {
  9105. 'T': pos.y,
  9106. 'B': pos.y - bb.h,
  9107. 'M': Math.max(view.t, Math.min(view.t + view.h, pos.y + (bb.h >> 1)) - bb.h)
  9108. }[corner.charAt(0)],
  9109. startX = Math.max(view.l, startXpos),
  9110. startY = Math.max(view.t, startYpos),
  9111. endX = Math.min(view.l + view.w, startXpos + bb.w),
  9112. endY = Math.min(view.t + view.h, startYpos + bb.h),
  9113. width = endX - startX,
  9114. height = endY - startY;
  9115. overflow += (bb.w - width) + (bb.h - height);
  9116. if(best == null || overflow < best.overflow){
  9117. best = {
  9118. corner: corner,
  9119. aroundCorner: choice.aroundCorner,
  9120. x: startX,
  9121. y: startY,
  9122. w: width,
  9123. h: height,
  9124. overflow: overflow,
  9125. spaceAvailable: spaceAvailable
  9126. };
  9127. }
  9128. return !overflow;
  9129. });
  9130. // In case the best position is not the last one we checked, need to call
  9131. // layoutNode() again.
  9132. if(best.overflow && layoutNode){
  9133. layoutNode(node, best.aroundCorner, best.corner, best.spaceAvailable, aroundNodeCoords);
  9134. }
  9135. // And then position the node. Do this last, after the layoutNode() above
  9136. // has sized the node, due to browser quirks when the viewport is scrolled
  9137. // (specifically that a Tooltip will shrink to fit as though the window was
  9138. // scrolled to the left).
  9139. var s = node.style;
  9140. s.top = best.y + "px";
  9141. s.left = best.x + "px";
  9142. s.right = "auto"; // needed for FF or else tooltip goes to far left
  9143. return best;
  9144. }
  9145. /*=====
  9146. dijit.place.__Position = function(){
  9147. // x: Integer
  9148. // horizontal coordinate in pixels, relative to document body
  9149. // y: Integer
  9150. // vertical coordinate in pixels, relative to document body
  9151. this.x = x;
  9152. this.y = y;
  9153. };
  9154. =====*/
  9155. /*=====
  9156. dijit.place.__Rectangle = function(){
  9157. // x: Integer
  9158. // horizontal offset in pixels, relative to document body
  9159. // y: Integer
  9160. // vertical offset in pixels, relative to document body
  9161. // w: Integer
  9162. // width in pixels. Can also be specified as "width" for backwards-compatibility.
  9163. // h: Integer
  9164. // height in pixels. Can also be specified as "height" from backwards-compatibility.
  9165. this.x = x;
  9166. this.y = y;
  9167. this.w = w;
  9168. this.h = h;
  9169. };
  9170. =====*/
  9171. return (dijit.place = {
  9172. // summary:
  9173. // Code to place a DOMNode relative to another DOMNode.
  9174. // Load using require(["dijit/place"], function(place){ ... }).
  9175. at: function(node, pos, corners, padding){
  9176. // summary:
  9177. // Positions one of the node's corners at specified position
  9178. // such that node is fully visible in viewport.
  9179. // description:
  9180. // NOTE: node is assumed to be absolutely or relatively positioned.
  9181. // node: DOMNode
  9182. // The node to position
  9183. // pos: dijit.place.__Position
  9184. // Object like {x: 10, y: 20}
  9185. // corners: String[]
  9186. // Array of Strings representing order to try corners in, like ["TR", "BL"].
  9187. // Possible values are:
  9188. // * "BL" - bottom left
  9189. // * "BR" - bottom right
  9190. // * "TL" - top left
  9191. // * "TR" - top right
  9192. // padding: dijit.place.__Position?
  9193. // optional param to set padding, to put some buffer around the element you want to position.
  9194. // example:
  9195. // Try to place node's top right corner at (10,20).
  9196. // If that makes node go (partially) off screen, then try placing
  9197. // bottom left corner at (10,20).
  9198. // | place(node, {x: 10, y: 20}, ["TR", "BL"])
  9199. var choices = array.map(corners, function(corner){
  9200. var c = { corner: corner, pos: {x:pos.x,y:pos.y} };
  9201. if(padding){
  9202. c.pos.x += corner.charAt(1) == 'L' ? padding.x : -padding.x;
  9203. c.pos.y += corner.charAt(0) == 'T' ? padding.y : -padding.y;
  9204. }
  9205. return c;
  9206. });
  9207. return _place(node, choices);
  9208. },
  9209. around: function(
  9210. /*DomNode*/ node,
  9211. /*DomNode || dijit.place.__Rectangle*/ anchor,
  9212. /*String[]*/ positions,
  9213. /*Boolean*/ leftToRight,
  9214. /*Function?*/ layoutNode){
  9215. // summary:
  9216. // Position node adjacent or kitty-corner to anchor
  9217. // such that it's fully visible in viewport.
  9218. //
  9219. // description:
  9220. // Place node such that corner of node touches a corner of
  9221. // aroundNode, and that node is fully visible.
  9222. //
  9223. // anchor:
  9224. // Either a DOMNode or a __Rectangle (object with x, y, width, height).
  9225. //
  9226. // positions:
  9227. // Ordered list of positions to try matching up.
  9228. // * before: places drop down to the left of the anchor node/widget, or to the right in the case
  9229. // of RTL scripts like Hebrew and Arabic; aligns either the top of the drop down
  9230. // with the top of the anchor, or the bottom of the drop down with bottom of the anchor.
  9231. // * after: places drop down to the right of the anchor node/widget, or to the left in the case
  9232. // of RTL scripts like Hebrew and Arabic; aligns either the top of the drop down
  9233. // with the top of the anchor, or the bottom of the drop down with bottom of the anchor.
  9234. // * before-centered: centers drop down to the left of the anchor node/widget, or to the right
  9235. // in the case of RTL scripts like Hebrew and Arabic
  9236. // * after-centered: centers drop down to the right of the anchor node/widget, or to the left
  9237. // in the case of RTL scripts like Hebrew and Arabic
  9238. // * above-centered: drop down is centered above anchor node
  9239. // * above: drop down goes above anchor node, left sides aligned
  9240. // * above-alt: drop down goes above anchor node, right sides aligned
  9241. // * below-centered: drop down is centered above anchor node
  9242. // * below: drop down goes below anchor node
  9243. // * below-alt: drop down goes below anchor node, right sides aligned
  9244. //
  9245. // layoutNode: Function(node, aroundNodeCorner, nodeCorner)
  9246. // For things like tooltip, they are displayed differently (and have different dimensions)
  9247. // based on their orientation relative to the parent. This adjusts the popup based on orientation.
  9248. //
  9249. // leftToRight:
  9250. // True if widget is LTR, false if widget is RTL. Affects the behavior of "above" and "below"
  9251. // positions slightly.
  9252. //
  9253. // example:
  9254. // | placeAroundNode(node, aroundNode, {'BL':'TL', 'TR':'BR'});
  9255. // This will try to position node such that node's top-left corner is at the same position
  9256. // as the bottom left corner of the aroundNode (ie, put node below
  9257. // aroundNode, with left edges aligned). If that fails it will try to put
  9258. // the bottom-right corner of node where the top right corner of aroundNode is
  9259. // (ie, put node above aroundNode, with right edges aligned)
  9260. //
  9261. // if around is a DOMNode (or DOMNode id), convert to coordinates
  9262. var aroundNodePos = (typeof anchor == "string" || "offsetWidth" in anchor)
  9263. ? domGeometry.position(anchor, true)
  9264. : anchor;
  9265. // Compute position and size of visible part of anchor (it may be partially hidden by ancestor nodes w/scrollbars)
  9266. if(anchor.parentNode){
  9267. // ignore nodes between position:relative and position:absolute
  9268. var sawPosAbsolute = domStyle.getComputedStyle(anchor).position == "absolute";
  9269. var parent = anchor.parentNode;
  9270. while(parent && parent.nodeType == 1 && parent.nodeName != "BODY"){ //ignoring the body will help performance
  9271. var parentPos = domGeometry.position(parent, true),
  9272. pcs = domStyle.getComputedStyle(parent);
  9273. if(/relative|absolute/.test(pcs.position)){
  9274. sawPosAbsolute = false;
  9275. }
  9276. if(!sawPosAbsolute && /hidden|auto|scroll/.test(pcs.overflow)){
  9277. var bottomYCoord = Math.min(aroundNodePos.y + aroundNodePos.h, parentPos.y + parentPos.h);
  9278. var rightXCoord = Math.min(aroundNodePos.x + aroundNodePos.w, parentPos.x + parentPos.w);
  9279. aroundNodePos.x = Math.max(aroundNodePos.x, parentPos.x);
  9280. aroundNodePos.y = Math.max(aroundNodePos.y, parentPos.y);
  9281. aroundNodePos.h = bottomYCoord - aroundNodePos.y;
  9282. aroundNodePos.w = rightXCoord - aroundNodePos.x;
  9283. }
  9284. if(pcs.position == "absolute"){
  9285. sawPosAbsolute = true;
  9286. }
  9287. parent = parent.parentNode;
  9288. }
  9289. }
  9290. var x = aroundNodePos.x,
  9291. y = aroundNodePos.y,
  9292. width = "w" in aroundNodePos ? aroundNodePos.w : (aroundNodePos.w = aroundNodePos.width),
  9293. height = "h" in aroundNodePos ? aroundNodePos.h : (kernel.deprecated("place.around: dijit.place.__Rectangle: { x:"+x+", y:"+y+", height:"+aroundNodePos.height+", width:"+width+" } has been deprecated. Please use { x:"+x+", y:"+y+", h:"+aroundNodePos.height+", w:"+width+" }", "", "2.0"), aroundNodePos.h = aroundNodePos.height);
  9294. // Convert positions arguments into choices argument for _place()
  9295. var choices = [];
  9296. function push(aroundCorner, corner){
  9297. choices.push({
  9298. aroundCorner: aroundCorner,
  9299. corner: corner,
  9300. pos: {
  9301. x: {
  9302. 'L': x,
  9303. 'R': x + width,
  9304. 'M': x + (width >> 1)
  9305. }[aroundCorner.charAt(1)],
  9306. y: {
  9307. 'T': y,
  9308. 'B': y + height,
  9309. 'M': y + (height >> 1)
  9310. }[aroundCorner.charAt(0)]
  9311. }
  9312. })
  9313. }
  9314. array.forEach(positions, function(pos){
  9315. var ltr = leftToRight;
  9316. switch(pos){
  9317. case "above-centered":
  9318. push("TM", "BM");
  9319. break;
  9320. case "below-centered":
  9321. push("BM", "TM");
  9322. break;
  9323. case "after-centered":
  9324. ltr = !ltr;
  9325. // fall through
  9326. case "before-centered":
  9327. push(ltr ? "ML" : "MR", ltr ? "MR" : "ML");
  9328. break;
  9329. case "after":
  9330. ltr = !ltr;
  9331. // fall through
  9332. case "before":
  9333. push(ltr ? "TL" : "TR", ltr ? "TR" : "TL");
  9334. push(ltr ? "BL" : "BR", ltr ? "BR" : "BL");
  9335. break;
  9336. case "below-alt":
  9337. ltr = !ltr;
  9338. // fall through
  9339. case "below":
  9340. // first try to align left borders, next try to align right borders (or reverse for RTL mode)
  9341. push(ltr ? "BL" : "BR", ltr ? "TL" : "TR");
  9342. push(ltr ? "BR" : "BL", ltr ? "TR" : "TL");
  9343. break;
  9344. case "above-alt":
  9345. ltr = !ltr;
  9346. // fall through
  9347. case "above":
  9348. // first try to align left borders, next try to align right borders (or reverse for RTL mode)
  9349. push(ltr ? "TL" : "TR", ltr ? "BL" : "BR");
  9350. push(ltr ? "TR" : "TL", ltr ? "BR" : "BL");
  9351. break;
  9352. default:
  9353. // To assist dijit/_base/place, accept arguments of type {aroundCorner: "BL", corner: "TL"}.
  9354. // Not meant to be used directly.
  9355. push(pos.aroundCorner, pos.corner);
  9356. }
  9357. });
  9358. var position = _place(node, choices, layoutNode, {w: width, h: height});
  9359. position.aroundNodePos = aroundNodePos;
  9360. return position;
  9361. }
  9362. });
  9363. });
  9364. },
  9365. 'dojox/lang/functional/array':function(){
  9366. define("dojox/lang/functional/array", ["dojo/_base/kernel", "dojo/_base/lang", "dojo/_base/array", "dojo/_base/window", "./lambda"],
  9367. function(dojo, lang, arr, win, df){
  9368. // This module adds high-level functions and related constructs:
  9369. // - array-processing functions similar to standard JS functions
  9370. // Notes:
  9371. // - this module provides JS standard methods similar to high-level functions in dojo/_base/array.js:
  9372. // forEach, map, filter, every, some
  9373. // Defined methods:
  9374. // - take any valid lambda argument as the functional argument
  9375. // - operate on dense arrays
  9376. // - take a string as the array argument
  9377. // - take an iterator objects as the array argument
  9378. var empty = {};
  9379. /*=====
  9380. var df = dojox.lang.functional;
  9381. =====*/
  9382. lang.mixin(df, {
  9383. // JS 1.6 standard array functions, which can take a lambda as a parameter.
  9384. // Consider using dojo._base.array functions, if you don't need the lambda support.
  9385. filter: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
  9386. // summary: creates a new array with all elements that pass the test
  9387. // implemented by the provided function.
  9388. if(typeof a == "string"){ a = a.split(""); }
  9389. o = o || win.global; f = df.lambda(f);
  9390. var t = [], v, i, n;
  9391. if(lang.isArray(a)){
  9392. // array
  9393. for(i = 0, n = a.length; i < n; ++i){
  9394. v = a[i];
  9395. if(f.call(o, v, i, a)){ t.push(v); }
  9396. }
  9397. }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
  9398. // iterator
  9399. for(i = 0; a.hasNext();){
  9400. v = a.next();
  9401. if(f.call(o, v, i++, a)){ t.push(v); }
  9402. }
  9403. }else{
  9404. // object/dictionary
  9405. for(i in a){
  9406. if(!(i in empty)){
  9407. v = a[i];
  9408. if(f.call(o, v, i, a)){ t.push(v); }
  9409. }
  9410. }
  9411. }
  9412. return t; // Array
  9413. },
  9414. forEach: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
  9415. // summary: executes a provided function once per array element.
  9416. if(typeof a == "string"){ a = a.split(""); }
  9417. o = o || win.global; f = df.lambda(f);
  9418. var i, n;
  9419. if(lang.isArray(a)){
  9420. // array
  9421. for(i = 0, n = a.length; i < n; f.call(o, a[i], i, a), ++i);
  9422. }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
  9423. // iterator
  9424. for(i = 0; a.hasNext(); f.call(o, a.next(), i++, a));
  9425. }else{
  9426. // object/dictionary
  9427. for(i in a){
  9428. if(!(i in empty)){
  9429. f.call(o, a[i], i, a);
  9430. }
  9431. }
  9432. }
  9433. return o; // Object
  9434. },
  9435. map: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
  9436. // summary: creates a new array with the results of calling
  9437. // a provided function on every element in this array.
  9438. if(typeof a == "string"){ a = a.split(""); }
  9439. o = o || win.global; f = df.lambda(f);
  9440. var t, n, i;
  9441. if(lang.isArray(a)){
  9442. // array
  9443. t = new Array(n = a.length);
  9444. for(i = 0; i < n; t[i] = f.call(o, a[i], i, a), ++i);
  9445. }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
  9446. // iterator
  9447. t = [];
  9448. for(i = 0; a.hasNext(); t.push(f.call(o, a.next(), i++, a)));
  9449. }else{
  9450. // object/dictionary
  9451. t = [];
  9452. for(i in a){
  9453. if(!(i in empty)){
  9454. t.push(f.call(o, a[i], i, a));
  9455. }
  9456. }
  9457. }
  9458. return t; // Array
  9459. },
  9460. every: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
  9461. // summary: tests whether all elements in the array pass the test
  9462. // implemented by the provided function.
  9463. if(typeof a == "string"){ a = a.split(""); }
  9464. o = o || win.global; f = df.lambda(f);
  9465. var i, n;
  9466. if(lang.isArray(a)){
  9467. // array
  9468. for(i = 0, n = a.length; i < n; ++i){
  9469. if(!f.call(o, a[i], i, a)){
  9470. return false; // Boolean
  9471. }
  9472. }
  9473. }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
  9474. // iterator
  9475. for(i = 0; a.hasNext();){
  9476. if(!f.call(o, a.next(), i++, a)){
  9477. return false; // Boolean
  9478. }
  9479. }
  9480. }else{
  9481. // object/dictionary
  9482. for(i in a){
  9483. if(!(i in empty)){
  9484. if(!f.call(o, a[i], i, a)){
  9485. return false; // Boolean
  9486. }
  9487. }
  9488. }
  9489. }
  9490. return true; // Boolean
  9491. },
  9492. some: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){
  9493. // summary: tests whether some element in the array passes the test
  9494. // implemented by the provided function.
  9495. if(typeof a == "string"){ a = a.split(""); }
  9496. o = o || win.global; f = df.lambda(f);
  9497. var i, n;
  9498. if(lang.isArray(a)){
  9499. // array
  9500. for(i = 0, n = a.length; i < n; ++i){
  9501. if(f.call(o, a[i], i, a)){
  9502. return true; // Boolean
  9503. }
  9504. }
  9505. }else if(typeof a.hasNext == "function" && typeof a.next == "function"){
  9506. // iterator
  9507. for(i = 0; a.hasNext();){
  9508. if(f.call(o, a.next(), i++, a)){
  9509. return true; // Boolean
  9510. }
  9511. }
  9512. }else{
  9513. // object/dictionary
  9514. for(i in a){
  9515. if(!(i in empty)){
  9516. if(f.call(o, a[i], i, a)){
  9517. return true; // Boolean
  9518. }
  9519. }
  9520. }
  9521. }
  9522. return false; // Boolean
  9523. }
  9524. });
  9525. return df;
  9526. });
  9527. },
  9528. 'dojox/charting/Theme':function(){
  9529. define("dojox/charting/Theme", ["dojo/_base/lang", "dojo/_base/array","dojo/_base/declare","dojo/_base/Color",
  9530. "dojox/color/_base", "dojox/color/Palette", "dojox/lang/utils", "dojox/gfx/gradutils"],
  9531. function(lang, arr, declare, Color, colorX, Palette, dlu, dgg){
  9532. var Theme = declare("dojox.charting.Theme", null, {
  9533. // summary:
  9534. // A Theme is a pre-defined object, primarily JSON-based, that makes up the definitions to
  9535. // style a chart.
  9536. //
  9537. // description:
  9538. // While you can set up style definitions on a chart directly (usually through the various add methods
  9539. // on a dojox.charting.Chart object), a Theme simplifies this manual setup by allowing you to
  9540. // pre-define all of the various visual parameters of each element in a chart.
  9541. //
  9542. // Most of the properties of a Theme are straight-forward; if something is line-based (such as
  9543. // an axis or the ticks on an axis), they will be defined using basic stroke parameters. Likewise,
  9544. // if an element is primarily block-based (such as the background of a chart), it will be primarily
  9545. // fill-based.
  9546. //
  9547. // In addition (for convenience), a Theme definition does not have to contain the entire JSON-based
  9548. // structure. Each theme is built on top of a default theme (which serves as the basis for the theme
  9549. // "GreySkies"), and is mixed into the default theme object. This allows you to create a theme based,
  9550. // say, solely on colors for data series.
  9551. //
  9552. // Defining a new theme is relatively easy; see any of the themes in dojox.charting.themes for examples
  9553. // on how to define your own.
  9554. //
  9555. // When you set a theme on a chart, the theme itself is deep-cloned. This means that you cannot alter
  9556. // the theme itself after setting the theme value on a chart, and expect it to change your chart. If you
  9557. // are looking to make alterations to a theme for a chart, the suggestion would be to create your own
  9558. // theme, based on the one you want to use, that makes those alterations before it is applied to a chart.
  9559. //
  9560. // Finally, a Theme contains a number of functions to facilitate rendering operations on a chart--the main
  9561. // helper of which is the ~next~ method, in which a chart asks for the information for the next data series
  9562. // to be rendered.
  9563. //
  9564. // A note on colors:
  9565. // The Theme constructor was on the use of dojox.color.Palette (in general) for creating a visually distinct
  9566. // set of colors for usage in a chart. A palette is usually comprised of 5 different color definitions, and
  9567. // no more. If you have a need to render a chart with more than 5 data elements, you can simply "push"
  9568. // new color definitions into the theme's .color array. Make sure that you do that with the actual
  9569. // theme object from a Chart, and not in the theme itself (i.e. either do that before using .setTheme
  9570. // on a chart).
  9571. //
  9572. // example:
  9573. // The default theme (and structure) looks like so:
  9574. // | // all objects are structs used directly in dojox.gfx
  9575. // | chart:{
  9576. // | stroke: null,
  9577. // | fill: "white",
  9578. // | pageStyle: null // suggested page style as an object suitable for dojo.style()
  9579. // | },
  9580. // | plotarea:{
  9581. // | stroke: null,
  9582. // | fill: "white"
  9583. // | },
  9584. // | axis:{
  9585. // | stroke: { // the axis itself
  9586. // | color: "#333",
  9587. // | width: 1
  9588. // | },
  9589. // | tick: { // used as a foundation for all ticks
  9590. // | color: "#666",
  9591. // | position: "center",
  9592. // | font: "normal normal normal 7pt Tahoma", // labels on axis
  9593. // | fontColor: "#333" // color of labels
  9594. // | },
  9595. // | majorTick: { // major ticks on axis, and used for major gridlines
  9596. // | width: 1,
  9597. // | length: 6
  9598. // | },
  9599. // | minorTick: { // minor ticks on axis, and used for minor gridlines
  9600. // | width: 0.8,
  9601. // | length: 3
  9602. // | },
  9603. // | microTick: { // minor ticks on axis, and used for minor gridlines
  9604. // | width: 0.5,
  9605. // | length: 1
  9606. // | }
  9607. // | },
  9608. // | series: {
  9609. // | stroke: {width: 1.5, color: "#333"}, // line
  9610. // | outline: {width: 0.1, color: "#ccc"}, // outline
  9611. // | //shadow: {dx: 1, dy: 1, width: 2, color: [0, 0, 0, 0.3]},
  9612. // | shadow: null, // no shadow
  9613. // | fill: "#ccc", // fill, if appropriate
  9614. // | font: "normal normal normal 8pt Tahoma", // if there's a label
  9615. // | fontColor: "#000" // color of labels
  9616. // | labelWiring: {width: 1, color: "#ccc"}, // connect marker and target data item(slice, column, bar...)
  9617. // | },
  9618. // | marker: { // any markers on a series
  9619. // | symbol: "m-3,3 l3,-6 3,6 z", // symbol
  9620. // | stroke: {width: 1.5, color: "#333"}, // stroke
  9621. // | outline: {width: 0.1, color: "#ccc"}, // outline
  9622. // | shadow: null, // no shadow
  9623. // | fill: "#ccc", // fill if needed
  9624. // | font: "normal normal normal 8pt Tahoma", // label
  9625. // | fontColor: "#000"
  9626. // | },
  9627. // | indicator: {
  9628. // | lineStroke: {width: 1.5, color: "#333"}, // line
  9629. // | lineOutline: {width: 0.1, color: "#ccc"}, // line outline
  9630. // | lineShadow: null, // no line shadow
  9631. // | stroke: {width: 1.5, color: "#333"}, // label background stroke
  9632. // | outline: {width: 0.1, color: "#ccc"}, // label background outline
  9633. // | shadow: null, // no label background shadow
  9634. // | fill: "#ccc", // label background fill
  9635. // | radius: 3, // radius of the label background
  9636. // | font: "normal normal normal 10pt Tahoma", // label font
  9637. // | fontColor: "#000" // label color
  9638. // | markerFill: "#ccc", // marker fill
  9639. // | markerSymbol: "m-3,0 c0,-4 6,-4 6,0 m-6,0 c0,4 6,4 6,0", // marker symbol
  9640. // | markerStroke: {width: 1.5, color: "#333"}, // marker stroke
  9641. // | markerOutline: {width: 0.1, color: "#ccc"}, // marker outline
  9642. // | markerShadow: null, // no marker shadow
  9643. // | }
  9644. //
  9645. // example:
  9646. // Defining a new theme is pretty simple:
  9647. // | dojox.charting.themes.Grasslands = new dojox.charting.Theme({
  9648. // | colors: [ "#70803a", "#dde574", "#788062", "#b1cc5d", "#eff2c2" ]
  9649. // | });
  9650. // |
  9651. // | myChart.setTheme(dojox.charting.themes.Grasslands);
  9652. shapeSpaces: {shape: 1, shapeX: 1, shapeY: 1},
  9653. constructor: function(kwArgs){
  9654. // summary:
  9655. // Initialize a theme using the keyword arguments. Note that the arguments
  9656. // look like the example (above), and may include a few more parameters.
  9657. kwArgs = kwArgs || {};
  9658. // populate theme with defaults updating them if needed
  9659. var def = Theme.defaultTheme;
  9660. arr.forEach(["chart", "plotarea", "axis", "series", "marker", "indicator"], function(name){
  9661. this[name] = lang.delegate(def[name], kwArgs[name]);
  9662. }, this);
  9663. // personalize theme
  9664. if(kwArgs.seriesThemes && kwArgs.seriesThemes.length){
  9665. this.colors = null;
  9666. this.seriesThemes = kwArgs.seriesThemes.slice(0);
  9667. }else{
  9668. this.seriesThemes = null;
  9669. this.colors = (kwArgs.colors || Theme.defaultColors).slice(0);
  9670. }
  9671. this.markerThemes = null;
  9672. if(kwArgs.markerThemes && kwArgs.markerThemes.length){
  9673. this.markerThemes = kwArgs.markerThemes.slice(0);
  9674. }
  9675. this.markers = kwArgs.markers ? lang.clone(kwArgs.markers) : lang.delegate(Theme.defaultMarkers);
  9676. // set flags
  9677. this.noGradConv = kwArgs.noGradConv;
  9678. this.noRadialConv = kwArgs.noRadialConv;
  9679. if(kwArgs.reverseFills){
  9680. this.reverseFills();
  9681. }
  9682. // private housekeeping
  9683. this._current = 0;
  9684. this._buildMarkerArray();
  9685. },
  9686. clone: function(){
  9687. // summary:
  9688. // Clone the current theme.
  9689. // returns: dojox.charting.Theme
  9690. // The cloned theme; any alterations made will not affect the original.
  9691. var theme = new Theme({
  9692. // theme components
  9693. chart: this.chart,
  9694. plotarea: this.plotarea,
  9695. axis: this.axis,
  9696. series: this.series,
  9697. marker: this.marker,
  9698. // individual arrays
  9699. colors: this.colors,
  9700. markers: this.markers,
  9701. indicator: this.indicator,
  9702. seriesThemes: this.seriesThemes,
  9703. markerThemes: this.markerThemes,
  9704. // flags
  9705. noGradConv: this.noGradConv,
  9706. noRadialConv: this.noRadialConv
  9707. });
  9708. // copy custom methods
  9709. arr.forEach(
  9710. ["clone", "clear", "next", "skip", "addMixin", "post", "getTick"],
  9711. function(name){
  9712. if(this.hasOwnProperty(name)){
  9713. theme[name] = this[name];
  9714. }
  9715. },
  9716. this
  9717. );
  9718. return theme; // dojox.charting.Theme
  9719. },
  9720. clear: function(){
  9721. // summary:
  9722. // Clear and reset the internal pointer to start fresh.
  9723. this._current = 0;
  9724. },
  9725. next: function(elementType, mixin, doPost){
  9726. // summary:
  9727. // Get the next color or series theme.
  9728. // elementType: String?
  9729. // An optional element type (for use with series themes)
  9730. // mixin: Object?
  9731. // An optional object to mix into the theme.
  9732. // doPost: Boolean?
  9733. // A flag to post-process the results.
  9734. // returns: Object
  9735. // An object of the structure { series, marker, symbol }
  9736. var merge = dlu.merge, series, marker;
  9737. if(this.colors){
  9738. series = lang.delegate(this.series);
  9739. marker = lang.delegate(this.marker);
  9740. var color = new Color(this.colors[this._current % this.colors.length]), old;
  9741. // modify the stroke
  9742. if(series.stroke && series.stroke.color){
  9743. series.stroke = lang.delegate(series.stroke);
  9744. old = new Color(series.stroke.color);
  9745. series.stroke.color = new Color(color);
  9746. series.stroke.color.a = old.a;
  9747. }else{
  9748. series.stroke = {color: color};
  9749. }
  9750. if(marker.stroke && marker.stroke.color){
  9751. marker.stroke = lang.delegate(marker.stroke);
  9752. old = new Color(marker.stroke.color);
  9753. marker.stroke.color = new Color(color);
  9754. marker.stroke.color.a = old.a;
  9755. }else{
  9756. marker.stroke = {color: color};
  9757. }
  9758. // modify the fill
  9759. if(!series.fill || series.fill.type){
  9760. series.fill = color;
  9761. }else{
  9762. old = new Color(series.fill);
  9763. series.fill = new Color(color);
  9764. series.fill.a = old.a;
  9765. }
  9766. if(!marker.fill || marker.fill.type){
  9767. marker.fill = color;
  9768. }else{
  9769. old = new Color(marker.fill);
  9770. marker.fill = new Color(color);
  9771. marker.fill.a = old.a;
  9772. }
  9773. }else{
  9774. series = this.seriesThemes ?
  9775. merge(this.series, this.seriesThemes[this._current % this.seriesThemes.length]) :
  9776. this.series;
  9777. marker = this.markerThemes ?
  9778. merge(this.marker, this.markerThemes[this._current % this.markerThemes.length]) :
  9779. series;
  9780. }
  9781. var symbol = marker && marker.symbol || this._markers[this._current % this._markers.length];
  9782. var theme = {series: series, marker: marker, symbol: symbol};
  9783. // advance the counter
  9784. ++this._current;
  9785. if(mixin){
  9786. theme = this.addMixin(theme, elementType, mixin);
  9787. }
  9788. if(doPost){
  9789. theme = this.post(theme, elementType);
  9790. }
  9791. return theme; // Object
  9792. },
  9793. skip: function(){
  9794. // summary:
  9795. // Skip the next internal color.
  9796. ++this._current;
  9797. },
  9798. addMixin: function(theme, elementType, mixin, doPost){
  9799. // summary:
  9800. // Add a mixin object to the passed theme and process.
  9801. // theme: dojox.charting.Theme
  9802. // The theme to mixin to.
  9803. // elementType: String
  9804. // The type of element in question. Can be "line", "bar" or "circle"
  9805. // mixin: Object|Array
  9806. // The object or objects to mix into the theme.
  9807. // doPost: Boolean
  9808. // If true, run the new theme through the post-processor.
  9809. // returns: dojox.charting.Theme
  9810. // The new theme.
  9811. if(lang.isArray(mixin)){
  9812. arr.forEach(mixin, function(m){
  9813. theme = this.addMixin(theme, elementType, m);
  9814. }, this);
  9815. }else{
  9816. var t = {};
  9817. if("color" in mixin){
  9818. if(elementType == "line" || elementType == "area"){
  9819. lang.setObject("series.stroke.color", mixin.color, t);
  9820. lang.setObject("marker.stroke.color", mixin.color, t);
  9821. }else{
  9822. lang.setObject("series.fill", mixin.color, t);
  9823. }
  9824. }
  9825. arr.forEach(["stroke", "outline", "shadow", "fill", "font", "fontColor", "labelWiring"], function(name){
  9826. var markerName = "marker" + name.charAt(0).toUpperCase() + name.substr(1),
  9827. b = markerName in mixin;
  9828. if(name in mixin){
  9829. lang.setObject("series." + name, mixin[name], t);
  9830. if(!b){
  9831. lang.setObject("marker." + name, mixin[name], t);
  9832. }
  9833. }
  9834. if(b){
  9835. lang.setObject("marker." + name, mixin[markerName], t);
  9836. }
  9837. });
  9838. if("marker" in mixin){
  9839. t.symbol = mixin.marker;
  9840. }
  9841. theme = dlu.merge(theme, t);
  9842. }
  9843. if(doPost){
  9844. theme = this.post(theme, elementType);
  9845. }
  9846. return theme; // dojox.charting.Theme
  9847. },
  9848. post: function(theme, elementType){
  9849. // summary:
  9850. // Process any post-shape fills.
  9851. // theme: dojox.charting.Theme
  9852. // The theme to post process with.
  9853. // elementType: String
  9854. // The type of element being filled. Can be "bar" or "circle".
  9855. // returns: dojox.charting.Theme
  9856. // The post-processed theme.
  9857. var fill = theme.series.fill, t;
  9858. if(!this.noGradConv && this.shapeSpaces[fill.space] && fill.type == "linear"){
  9859. if(elementType == "bar"){
  9860. // transpose start and end points
  9861. t = {
  9862. x1: fill.y1,
  9863. y1: fill.x1,
  9864. x2: fill.y2,
  9865. y2: fill.x2
  9866. };
  9867. }else if(!this.noRadialConv && fill.space == "shape" && (elementType == "slice" || elementType == "circle")){
  9868. // switch to radial
  9869. t = {
  9870. type: "radial",
  9871. cx: 0,
  9872. cy: 0,
  9873. r: 100
  9874. };
  9875. }
  9876. if(t){
  9877. return dlu.merge(theme, {series: {fill: t}});
  9878. }
  9879. }
  9880. return theme; // dojox.charting.Theme
  9881. },
  9882. getTick: function(name, mixin){
  9883. // summary:
  9884. // Calculates and merges tick parameters.
  9885. // name: String
  9886. // Tick name, can be "major", "minor", or "micro".
  9887. // mixin: Object?
  9888. // Optional object to mix in to the tick.
  9889. var tick = this.axis.tick, tickName = name + "Tick",
  9890. merge = dlu.merge;
  9891. if(tick){
  9892. if(this.axis[tickName]){
  9893. tick = merge(tick, this.axis[tickName]);
  9894. }
  9895. }else{
  9896. tick = this.axis[tickName];
  9897. }
  9898. if(mixin){
  9899. if(tick){
  9900. if(mixin[tickName]){
  9901. tick = merge(tick, mixin[tickName]);
  9902. }
  9903. }else{
  9904. tick = mixin[tickName];
  9905. }
  9906. }
  9907. return tick; // Object
  9908. },
  9909. inspectObjects: function(f){
  9910. arr.forEach(["chart", "plotarea", "axis", "series", "marker", "indicator"], function(name){
  9911. f(this[name]);
  9912. }, this);
  9913. if(this.seriesThemes){
  9914. arr.forEach(this.seriesThemes, f);
  9915. }
  9916. if(this.markerThemes){
  9917. arr.forEach(this.markerThemes, f);
  9918. }
  9919. },
  9920. reverseFills: function(){
  9921. this.inspectObjects(function(o){
  9922. if(o && o.fill){
  9923. o.fill = dgg.reverse(o.fill);
  9924. }
  9925. });
  9926. },
  9927. addMarker:function(/*String*/ name, /*String*/ segment){
  9928. // summary:
  9929. // Add a custom marker to this theme.
  9930. // example:
  9931. // | myTheme.addMarker("Ellipse", foo);
  9932. this.markers[name] = segment;
  9933. this._buildMarkerArray();
  9934. },
  9935. setMarkers:function(/*Object*/ obj){
  9936. // summary:
  9937. // Set all the markers of this theme at once. obj should be a
  9938. // dictionary of keys and path segments.
  9939. //
  9940. // example:
  9941. // | myTheme.setMarkers({ "CIRCLE": foo });
  9942. this.markers = obj;
  9943. this._buildMarkerArray();
  9944. },
  9945. _buildMarkerArray: function(){
  9946. this._markers = [];
  9947. for(var p in this.markers){
  9948. this._markers.push(this.markers[p]);
  9949. }
  9950. }
  9951. });
  9952. /*=====
  9953. dojox.charting.Theme.__DefineColorArgs = function(num, colors, hue, saturation, low, high, base, generator){
  9954. // summary:
  9955. // The arguments object that can be passed to define colors for a theme.
  9956. // num: Number?
  9957. // The number of colors to generate. Defaults to 5.
  9958. // colors: String[]|dojo.Color[]?
  9959. // A pre-defined set of colors; this is passed through to the Theme directly.
  9960. // hue: Number?
  9961. // A hue to base the generated colors from (a number from 0 - 359).
  9962. // saturation: Number?
  9963. // If a hue is passed, this is used for the saturation value (0 - 100).
  9964. // low: Number?
  9965. // An optional value to determine the lowest value used to generate a color (HSV model)
  9966. // high: Number?
  9967. // An optional value to determine the highest value used to generate a color (HSV model)
  9968. // base: String|dojo.Color?
  9969. // A base color to use if we are defining colors using dojox.color.Palette
  9970. // generator: String?
  9971. // The generator function name from dojox.color.Palette.
  9972. this.num = num;
  9973. this.colors = colors;
  9974. this.hue = hue;
  9975. this.saturation = saturation;
  9976. this.low = low;
  9977. this.high = high;
  9978. this.base = base;
  9979. this.generator = generator;
  9980. }
  9981. =====*/
  9982. lang.mixin(Theme, {
  9983. defaultMarkers: {
  9984. CIRCLE: "m-3,0 c0,-4 6,-4 6,0 m-6,0 c0,4 6,4 6,0",
  9985. SQUARE: "m-3,-3 l0,6 6,0 0,-6 z",
  9986. DIAMOND: "m0,-3 l3,3 -3,3 -3,-3 z",
  9987. CROSS: "m0,-3 l0,6 m-3,-3 l6,0",
  9988. X: "m-3,-3 l6,6 m0,-6 l-6,6",
  9989. TRIANGLE: "m-3,3 l3,-6 3,6 z",
  9990. TRIANGLE_INVERTED: "m-3,-3 l3,6 3,-6 z"
  9991. },
  9992. defaultColors:[
  9993. // gray skies
  9994. "#54544c", "#858e94", "#6e767a", "#948585", "#474747"
  9995. ],
  9996. defaultTheme: {
  9997. // all objects are structs used directly in dojox.gfx
  9998. chart:{
  9999. stroke: null,
  10000. fill: "white",
  10001. pageStyle: null,
  10002. titleGap: 20,
  10003. titlePos: "top",
  10004. titleFont: "normal normal bold 14pt Tahoma", // labels on axis
  10005. titleFontColor: "#333"
  10006. },
  10007. plotarea:{
  10008. stroke: null,
  10009. fill: "white"
  10010. },
  10011. // TODO: label rotation on axis
  10012. axis:{
  10013. stroke: { // the axis itself
  10014. color: "#333",
  10015. width: 1
  10016. },
  10017. tick: { // used as a foundation for all ticks
  10018. color: "#666",
  10019. position: "center",
  10020. font: "normal normal normal 7pt Tahoma", // labels on axis
  10021. fontColor: "#333", // color of labels
  10022. titleGap: 15,
  10023. titleFont: "normal normal normal 11pt Tahoma", // labels on axis
  10024. titleFontColor: "#333", // color of labels
  10025. titleOrientation: "axis" // "axis": facing the axis, "away": facing away
  10026. },
  10027. majorTick: { // major ticks on axis, and used for major gridlines
  10028. width: 1,
  10029. length: 6
  10030. },
  10031. minorTick: { // minor ticks on axis, and used for minor gridlines
  10032. width: 0.8,
  10033. length: 3
  10034. },
  10035. microTick: { // minor ticks on axis, and used for minor gridlines
  10036. width: 0.5,
  10037. length: 1
  10038. }
  10039. },
  10040. series: {
  10041. // used as a "main" theme for series, sThemes augment it
  10042. stroke: {width: 1.5, color: "#333"}, // line
  10043. outline: {width: 0.1, color: "#ccc"}, // outline
  10044. //shadow: {dx: 1, dy: 1, width: 2, color: [0, 0, 0, 0.3]},
  10045. shadow: null, // no shadow
  10046. fill: "#ccc", // fill, if appropriate
  10047. font: "normal normal normal 8pt Tahoma", // if there's a label
  10048. fontColor: "#000", // color of labels
  10049. labelWiring: {width: 1, color: "#ccc"} // connect marker and target data item(slice, column, bar...)
  10050. },
  10051. marker: { // any markers on a series
  10052. stroke: {width: 1.5, color: "#333"}, // stroke
  10053. outline: {width: 0.1, color: "#ccc"}, // outline
  10054. //shadow: {dx: 1, dy: 1, width: 2, color: [0, 0, 0, 0.3]},
  10055. shadow: null, // no shadow
  10056. fill: "#ccc", // fill if needed
  10057. font: "normal normal normal 8pt Tahoma", // label
  10058. fontColor: "#000"
  10059. },
  10060. indicator: {
  10061. lineStroke: {width: 1.5, color: "#333"},
  10062. lineOutline: {width: 0.1, color: "#ccc"},
  10063. lineShadow: null,
  10064. stroke: {width: 1.5, color: "#333"},
  10065. outline: {width: 0.1, color: "#ccc"},
  10066. shadow: null,
  10067. fill : "#ccc",
  10068. radius: 3,
  10069. font: "normal normal normal 10pt Tahoma",
  10070. fontColor: "#000",
  10071. markerFill: "#ccc",
  10072. markerSymbol: "m-3,0 c0,-4 6,-4 6,0 m-6,0 c0,4 6,4 6,0",
  10073. markerStroke: {width: 1.5, color: "#333"},
  10074. markerOutline: {width: 0.1, color: "#ccc"},
  10075. markerShadow: null
  10076. }
  10077. },
  10078. defineColors: function(kwArgs){
  10079. // summary:
  10080. // Generate a set of colors for the theme based on keyword
  10081. // arguments.
  10082. // kwArgs: dojox.charting.Theme.__DefineColorArgs
  10083. // The arguments object used to define colors.
  10084. // returns: dojo.Color[]
  10085. // An array of colors for use in a theme.
  10086. //
  10087. // example:
  10088. // | var colors = dojox.charting.Theme.defineColors({
  10089. // | base: "#369",
  10090. // | generator: "compound"
  10091. // | });
  10092. //
  10093. // example:
  10094. // | var colors = dojox.charting.Theme.defineColors({
  10095. // | hue: 60,
  10096. // | saturation: 90,
  10097. // | low: 30,
  10098. // | high: 80
  10099. // | });
  10100. kwArgs = kwArgs || {};
  10101. var l, c = [], n = kwArgs.num || 5; // the number of colors to generate
  10102. if(kwArgs.colors){
  10103. // we have an array of colors predefined, so fix for the number of series.
  10104. l = kwArgs.colors.length;
  10105. for(var i = 0; i < n; i++){
  10106. c.push(kwArgs.colors[i % l]);
  10107. }
  10108. return c; // dojo.Color[]
  10109. }
  10110. if(kwArgs.hue){
  10111. // single hue, generate a set based on brightness
  10112. var s = kwArgs.saturation || 100, // saturation
  10113. st = kwArgs.low || 30,
  10114. end = kwArgs.high || 90;
  10115. // we'd like it to be a little on the darker side.
  10116. l = (end + st) / 2;
  10117. // alternately, use "shades"
  10118. return colorX.Palette.generate(
  10119. colorX.fromHsv(kwArgs.hue, s, l), "monochromatic"
  10120. ).colors;
  10121. }
  10122. if(kwArgs.generator){
  10123. // pass a base color and the name of a generator
  10124. return colorX.Palette.generate(kwArgs.base, kwArgs.generator).colors;
  10125. }
  10126. return c; // dojo.Color[]
  10127. },
  10128. generateGradient: function(fillPattern, colorFrom, colorTo){
  10129. var fill = lang.delegate(fillPattern);
  10130. fill.colors = [
  10131. {offset: 0, color: colorFrom},
  10132. {offset: 1, color: colorTo}
  10133. ];
  10134. return fill;
  10135. },
  10136. generateHslColor: function(color, luminance){
  10137. color = new Color(color);
  10138. var hsl = color.toHsl(),
  10139. result = colorX.fromHsl(hsl.h, hsl.s, luminance);
  10140. result.a = color.a; // add missing opacity
  10141. return result;
  10142. },
  10143. generateHslGradient: function(color, fillPattern, lumFrom, lumTo){
  10144. color = new Color(color);
  10145. var hsl = color.toHsl(),
  10146. colorFrom = colorX.fromHsl(hsl.h, hsl.s, lumFrom),
  10147. colorTo = colorX.fromHsl(hsl.h, hsl.s, lumTo);
  10148. colorFrom.a = colorTo.a = color.a; // add missing opacity
  10149. return Theme.generateGradient(fillPattern, colorFrom, colorTo); // Object
  10150. }
  10151. });
  10152. return Theme;
  10153. });
  10154. },
  10155. 'dojox/charting/themes/common':function(){
  10156. define(["dojo/_base/lang"], function(lang){
  10157. return lang.getObject("dojox.charting.themes", true);
  10158. });
  10159. },
  10160. 'dojox/charting/plot2d/common':function(){
  10161. define("dojox/charting/plot2d/common", ["dojo/_base/lang", "dojo/_base/array", "dojo/_base/Color",
  10162. "dojox/gfx", "dojox/lang/functional", "../scaler/common"],
  10163. function(lang, arr, Color, g, df, sc){
  10164. var common = lang.getObject("dojox.charting.plot2d.common", true);
  10165. return lang.mixin(common, {
  10166. doIfLoaded: sc.doIfLoaded,
  10167. makeStroke: function(stroke){
  10168. if(!stroke){ return stroke; }
  10169. if(typeof stroke == "string" || stroke instanceof Color){
  10170. stroke = {color: stroke};
  10171. }
  10172. return g.makeParameters(g.defaultStroke, stroke);
  10173. },
  10174. augmentColor: function(target, color){
  10175. var t = new Color(target),
  10176. c = new Color(color);
  10177. c.a = t.a;
  10178. return c;
  10179. },
  10180. augmentStroke: function(stroke, color){
  10181. var s = common.makeStroke(stroke);
  10182. if(s){
  10183. s.color = common.augmentColor(s.color, color);
  10184. }
  10185. return s;
  10186. },
  10187. augmentFill: function(fill, color){
  10188. var fc, c = new Color(color);
  10189. if(typeof fill == "string" || fill instanceof Color){
  10190. return common.augmentColor(fill, color);
  10191. }
  10192. return fill;
  10193. },
  10194. defaultStats: {
  10195. vmin: Number.POSITIVE_INFINITY, vmax: Number.NEGATIVE_INFINITY,
  10196. hmin: Number.POSITIVE_INFINITY, hmax: Number.NEGATIVE_INFINITY
  10197. },
  10198. collectSimpleStats: function(series){
  10199. var stats = lang.delegate(common.defaultStats);
  10200. for(var i = 0; i < series.length; ++i){
  10201. var run = series[i];
  10202. for(var j = 0; j < run.data.length; j++){
  10203. if(run.data[j] !== null){
  10204. if(typeof run.data[j] == "number"){
  10205. // 1D case
  10206. var old_vmin = stats.vmin, old_vmax = stats.vmax;
  10207. if(!("ymin" in run) || !("ymax" in run)){
  10208. arr.forEach(run.data, function(val, i){
  10209. if(val !== null){
  10210. var x = i + 1, y = val;
  10211. if(isNaN(y)){ y = 0; }
  10212. stats.hmin = Math.min(stats.hmin, x);
  10213. stats.hmax = Math.max(stats.hmax, x);
  10214. stats.vmin = Math.min(stats.vmin, y);
  10215. stats.vmax = Math.max(stats.vmax, y);
  10216. }
  10217. });
  10218. }
  10219. if("ymin" in run){ stats.vmin = Math.min(old_vmin, run.ymin); }
  10220. if("ymax" in run){ stats.vmax = Math.max(old_vmax, run.ymax); }
  10221. }else{
  10222. // 2D case
  10223. var old_hmin = stats.hmin, old_hmax = stats.hmax,
  10224. old_vmin = stats.vmin, old_vmax = stats.vmax;
  10225. if(!("xmin" in run) || !("xmax" in run) || !("ymin" in run) || !("ymax" in run)){
  10226. arr.forEach(run.data, function(val, i){
  10227. if(val !== null){
  10228. var x = "x" in val ? val.x : i + 1, y = val.y;
  10229. if(isNaN(x)){ x = 0; }
  10230. if(isNaN(y)){ y = 0; }
  10231. stats.hmin = Math.min(stats.hmin, x);
  10232. stats.hmax = Math.max(stats.hmax, x);
  10233. stats.vmin = Math.min(stats.vmin, y);
  10234. stats.vmax = Math.max(stats.vmax, y);
  10235. }
  10236. });
  10237. }
  10238. if("xmin" in run){ stats.hmin = Math.min(old_hmin, run.xmin); }
  10239. if("xmax" in run){ stats.hmax = Math.max(old_hmax, run.xmax); }
  10240. if("ymin" in run){ stats.vmin = Math.min(old_vmin, run.ymin); }
  10241. if("ymax" in run){ stats.vmax = Math.max(old_vmax, run.ymax); }
  10242. }
  10243. break;
  10244. }
  10245. }
  10246. }
  10247. return stats;
  10248. },
  10249. calculateBarSize: function(/* Number */ availableSize, /* Object */ opt, /* Number? */ clusterSize){
  10250. if(!clusterSize){
  10251. clusterSize = 1;
  10252. }
  10253. var gap = opt.gap, size = (availableSize - 2 * gap) / clusterSize;
  10254. if("minBarSize" in opt){
  10255. size = Math.max(size, opt.minBarSize);
  10256. }
  10257. if("maxBarSize" in opt){
  10258. size = Math.min(size, opt.maxBarSize);
  10259. }
  10260. size = Math.max(size, 1);
  10261. gap = (availableSize - size * clusterSize) / 2;
  10262. return {size: size, gap: gap}; // Object
  10263. },
  10264. collectStackedStats: function(series){
  10265. // collect statistics
  10266. var stats = lang.clone(common.defaultStats);
  10267. if(series.length){
  10268. // 1st pass: find the maximal length of runs
  10269. stats.hmin = Math.min(stats.hmin, 1);
  10270. stats.hmax = df.foldl(series, "seed, run -> Math.max(seed, run.data.length)", stats.hmax);
  10271. // 2nd pass: stack values
  10272. for(var i = 0; i < stats.hmax; ++i){
  10273. var v = series[0].data[i];
  10274. v = v && (typeof v == "number" ? v : v.y);
  10275. if(isNaN(v)){ v = 0; }
  10276. stats.vmin = Math.min(stats.vmin, v);
  10277. for(var j = 1; j < series.length; ++j){
  10278. var t = series[j].data[i];
  10279. t = t && (typeof t == "number" ? t : t.y);
  10280. if(isNaN(t)){ t = 0; }
  10281. v += t;
  10282. }
  10283. stats.vmax = Math.max(stats.vmax, v);
  10284. }
  10285. }
  10286. return stats;
  10287. },
  10288. curve: function(/* Number[] */a, /* Number|String */tension){
  10289. // FIX for #7235, submitted by Enzo Michelangeli.
  10290. // Emulates the smoothing algorithms used in a famous, unnamed spreadsheet
  10291. // program ;)
  10292. var array = a.slice(0);
  10293. if(tension == "x") {
  10294. array[array.length] = arr[0]; // add a last element equal to the first, closing the loop
  10295. }
  10296. var p=arr.map(array, function(item, i){
  10297. if(i==0){ return "M" + item.x + "," + item.y; }
  10298. if(!isNaN(tension)) { // use standard Dojo smoothing in tension is numeric
  10299. var dx=item.x-array[i-1].x, dy=array[i-1].y;
  10300. return "C"+(item.x-(tension-1)*(dx/tension))+","+dy+" "+(item.x-(dx/tension))+","+item.y+" "+item.x+","+item.y;
  10301. } else if(tension == "X" || tension == "x" || tension == "S") {
  10302. // use Excel "line smoothing" algorithm (http://xlrotor.com/resources/files.shtml)
  10303. var p0, p1 = array[i-1], p2 = array[i], p3;
  10304. var bz1x, bz1y, bz2x, bz2y;
  10305. var f = 1/6;
  10306. if(i==1) {
  10307. if(tension == "x") {
  10308. p0 = array[array.length-2];
  10309. } else { // "tension == X || tension == "S"
  10310. p0 = p1;
  10311. }
  10312. f = 1/3;
  10313. } else {
  10314. p0 = array[i-2];
  10315. }
  10316. if(i==(array.length-1)) {
  10317. if(tension == "x") {
  10318. p3 = array[1];
  10319. } else { // "tension == X || tension == "S"
  10320. p3 = p2;
  10321. }
  10322. f = 1/3;
  10323. } else {
  10324. p3 = array[i+1];
  10325. }
  10326. var p1p2 = Math.sqrt((p2.x-p1.x)*(p2.x-p1.x)+(p2.y-p1.y)*(p2.y-p1.y));
  10327. var p0p2 = Math.sqrt((p2.x-p0.x)*(p2.x-p0.x)+(p2.y-p0.y)*(p2.y-p0.y));
  10328. var p1p3 = Math.sqrt((p3.x-p1.x)*(p3.x-p1.x)+(p3.y-p1.y)*(p3.y-p1.y));
  10329. var p0p2f = p0p2 * f;
  10330. var p1p3f = p1p3 * f;
  10331. if(p0p2f > p1p2/2 && p1p3f > p1p2/2) {
  10332. p0p2f = p1p2/2;
  10333. p1p3f = p1p2/2;
  10334. } else if(p0p2f > p1p2/2) {
  10335. p0p2f = p1p2/2;
  10336. p1p3f = p1p2/2 * p1p3/p0p2;
  10337. } else if(p1p3f > p1p2/2) {
  10338. p1p3f = p1p2/2;
  10339. p0p2f = p1p2/2 * p0p2/p1p3;
  10340. }
  10341. if(tension == "S") {
  10342. if(p0 == p1) { p0p2f = 0; }
  10343. if(p2 == p3) { p1p3f = 0; }
  10344. }
  10345. bz1x = p1.x + p0p2f*(p2.x - p0.x)/p0p2;
  10346. bz1y = p1.y + p0p2f*(p2.y - p0.y)/p0p2;
  10347. bz2x = p2.x - p1p3f*(p3.x - p1.x)/p1p3;
  10348. bz2y = p2.y - p1p3f*(p3.y - p1.y)/p1p3;
  10349. }
  10350. return "C"+(bz1x+","+bz1y+" "+bz2x+","+bz2y+" "+p2.x+","+p2.y);
  10351. });
  10352. return p.join(" ");
  10353. },
  10354. getLabel: function(/*Number*/number, /*Boolean*/fixed, /*Number*/precision){
  10355. return sc.doIfLoaded("dojo/number", function(numberLib){
  10356. return (fixed ? numberLib.format(number, {places : precision}) :
  10357. numberLib.format(number)) || "";
  10358. }, function(){
  10359. return fixed ? number.toFixed(precision) : number.toString();
  10360. });
  10361. }
  10362. });
  10363. });
  10364. },
  10365. 'dijit/_Widget':function(){
  10366. define("dijit/_Widget", [
  10367. "dojo/aspect", // aspect.around
  10368. "dojo/_base/config", // config.isDebug
  10369. "dojo/_base/connect", // connect.connect
  10370. "dojo/_base/declare", // declare
  10371. "dojo/_base/kernel", // kernel.deprecated
  10372. "dojo/_base/lang", // lang.hitch
  10373. "dojo/query",
  10374. "dojo/ready",
  10375. "./registry", // registry.byNode
  10376. "./_WidgetBase",
  10377. "./_OnDijitClickMixin",
  10378. "./_FocusMixin",
  10379. "dojo/uacss", // browser sniffing (included for back-compat; subclasses may be using)
  10380. "./hccss" // high contrast mode sniffing (included to set CSS classes on <body>, module ret value unused)
  10381. ], function(aspect, config, connect, declare, kernel, lang, query, ready,
  10382. registry, _WidgetBase, _OnDijitClickMixin, _FocusMixin){
  10383. /*=====
  10384. var _WidgetBase = dijit._WidgetBase;
  10385. var _OnDijitClickMixin = dijit._OnDijitClickMixin;
  10386. var _FocusMixin = dijit._FocusMixin;
  10387. =====*/
  10388. // module:
  10389. // dijit/_Widget
  10390. // summary:
  10391. // Old base for widgets. New widgets should extend _WidgetBase instead
  10392. function connectToDomNode(){
  10393. // summary:
  10394. // If user connects to a widget method === this function, then they will
  10395. // instead actually be connecting the equivalent event on this.domNode
  10396. }
  10397. // Trap dojo.connect() calls to connectToDomNode methods, and redirect to _Widget.on()
  10398. function aroundAdvice(originalConnect){
  10399. return function(obj, event, scope, method){
  10400. if(obj && typeof event == "string" && obj[event] == connectToDomNode){
  10401. return obj.on(event.substring(2).toLowerCase(), lang.hitch(scope, method));
  10402. }
  10403. return originalConnect.apply(connect, arguments);
  10404. };
  10405. }
  10406. aspect.around(connect, "connect", aroundAdvice);
  10407. if(kernel.connect){
  10408. aspect.around(kernel, "connect", aroundAdvice);
  10409. }
  10410. var _Widget = declare("dijit._Widget", [_WidgetBase, _OnDijitClickMixin, _FocusMixin], {
  10411. // summary:
  10412. // Base class for all Dijit widgets.
  10413. //
  10414. // Extends _WidgetBase, adding support for:
  10415. // - declaratively/programatically specifying widget initialization parameters like
  10416. // onMouseMove="foo" that call foo when this.domNode gets a mousemove event
  10417. // - ondijitclick
  10418. // Support new data-dojo-attach-event="ondijitclick: ..." that is triggered by a mouse click or a SPACE/ENTER keypress
  10419. // - focus related functions
  10420. // In particular, the onFocus()/onBlur() callbacks. Driven internally by
  10421. // dijit/_base/focus.js.
  10422. // - deprecated methods
  10423. // - onShow(), onHide(), onClose()
  10424. //
  10425. // Also, by loading code in dijit/_base, turns on:
  10426. // - browser sniffing (putting browser id like .dj_ie on <html> node)
  10427. // - high contrast mode sniffing (add .dijit_a11y class to <body> if machine is in high contrast mode)
  10428. ////////////////// DEFERRED CONNECTS ///////////////////
  10429. onClick: connectToDomNode,
  10430. /*=====
  10431. onClick: function(event){
  10432. // summary:
  10433. // Connect to this function to receive notifications of mouse click events.
  10434. // event:
  10435. // mouse Event
  10436. // tags:
  10437. // callback
  10438. },
  10439. =====*/
  10440. onDblClick: connectToDomNode,
  10441. /*=====
  10442. onDblClick: function(event){
  10443. // summary:
  10444. // Connect to this function to receive notifications of mouse double click events.
  10445. // event:
  10446. // mouse Event
  10447. // tags:
  10448. // callback
  10449. },
  10450. =====*/
  10451. onKeyDown: connectToDomNode,
  10452. /*=====
  10453. onKeyDown: function(event){
  10454. // summary:
  10455. // Connect to this function to receive notifications of keys being pressed down.
  10456. // event:
  10457. // key Event
  10458. // tags:
  10459. // callback
  10460. },
  10461. =====*/
  10462. onKeyPress: connectToDomNode,
  10463. /*=====
  10464. onKeyPress: function(event){
  10465. // summary:
  10466. // Connect to this function to receive notifications of printable keys being typed.
  10467. // event:
  10468. // key Event
  10469. // tags:
  10470. // callback
  10471. },
  10472. =====*/
  10473. onKeyUp: connectToDomNode,
  10474. /*=====
  10475. onKeyUp: function(event){
  10476. // summary:
  10477. // Connect to this function to receive notifications of keys being released.
  10478. // event:
  10479. // key Event
  10480. // tags:
  10481. // callback
  10482. },
  10483. =====*/
  10484. onMouseDown: connectToDomNode,
  10485. /*=====
  10486. onMouseDown: function(event){
  10487. // summary:
  10488. // Connect to this function to receive notifications of when the mouse button is pressed down.
  10489. // event:
  10490. // mouse Event
  10491. // tags:
  10492. // callback
  10493. },
  10494. =====*/
  10495. onMouseMove: connectToDomNode,
  10496. /*=====
  10497. onMouseMove: function(event){
  10498. // summary:
  10499. // Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.
  10500. // event:
  10501. // mouse Event
  10502. // tags:
  10503. // callback
  10504. },
  10505. =====*/
  10506. onMouseOut: connectToDomNode,
  10507. /*=====
  10508. onMouseOut: function(event){
  10509. // summary:
  10510. // Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.
  10511. // event:
  10512. // mouse Event
  10513. // tags:
  10514. // callback
  10515. },
  10516. =====*/
  10517. onMouseOver: connectToDomNode,
  10518. /*=====
  10519. onMouseOver: function(event){
  10520. // summary:
  10521. // Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.
  10522. // event:
  10523. // mouse Event
  10524. // tags:
  10525. // callback
  10526. },
  10527. =====*/
  10528. onMouseLeave: connectToDomNode,
  10529. /*=====
  10530. onMouseLeave: function(event){
  10531. // summary:
  10532. // Connect to this function to receive notifications of when the mouse moves off of this widget.
  10533. // event:
  10534. // mouse Event
  10535. // tags:
  10536. // callback
  10537. },
  10538. =====*/
  10539. onMouseEnter: connectToDomNode,
  10540. /*=====
  10541. onMouseEnter: function(event){
  10542. // summary:
  10543. // Connect to this function to receive notifications of when the mouse moves onto this widget.
  10544. // event:
  10545. // mouse Event
  10546. // tags:
  10547. // callback
  10548. },
  10549. =====*/
  10550. onMouseUp: connectToDomNode,
  10551. /*=====
  10552. onMouseUp: function(event){
  10553. // summary:
  10554. // Connect to this function to receive notifications of when the mouse button is released.
  10555. // event:
  10556. // mouse Event
  10557. // tags:
  10558. // callback
  10559. },
  10560. =====*/
  10561. constructor: function(params){
  10562. // extract parameters like onMouseMove that should connect directly to this.domNode
  10563. this._toConnect = {};
  10564. for(var name in params){
  10565. if(this[name] === connectToDomNode){
  10566. this._toConnect[name.replace(/^on/, "").toLowerCase()] = params[name];
  10567. delete params[name];
  10568. }
  10569. }
  10570. },
  10571. postCreate: function(){
  10572. this.inherited(arguments);
  10573. // perform connection from this.domNode to user specified handlers (ex: onMouseMove)
  10574. for(var name in this._toConnect){
  10575. this.on(name, this._toConnect[name]);
  10576. }
  10577. delete this._toConnect;
  10578. },
  10579. on: function(/*String*/ type, /*Function*/ func){
  10580. if(this[this._onMap(type)] === connectToDomNode){
  10581. // Use connect.connect() rather than on() to get handling for "onmouseenter" on non-IE, etc.
  10582. // Also, need to specify context as "this" rather than the default context of the DOMNode
  10583. return connect.connect(this.domNode, type.toLowerCase(), this, func);
  10584. }
  10585. return this.inherited(arguments);
  10586. },
  10587. _setFocusedAttr: function(val){
  10588. // Remove this method in 2.0 (or sooner), just here to set _focused == focused, for back compat
  10589. // (but since it's a private variable we aren't required to keep supporting it).
  10590. this._focused = val;
  10591. this._set("focused", val);
  10592. },
  10593. ////////////////// DEPRECATED METHODS ///////////////////
  10594. setAttribute: function(/*String*/ attr, /*anything*/ value){
  10595. // summary:
  10596. // Deprecated. Use set() instead.
  10597. // tags:
  10598. // deprecated
  10599. kernel.deprecated(this.declaredClass+"::setAttribute(attr, value) is deprecated. Use set() instead.", "", "2.0");
  10600. this.set(attr, value);
  10601. },
  10602. attr: function(/*String|Object*/name, /*Object?*/value){
  10603. // summary:
  10604. // Set or get properties on a widget instance.
  10605. // name:
  10606. // The property to get or set. If an object is passed here and not
  10607. // a string, its keys are used as names of attributes to be set
  10608. // and the value of the object as values to set in the widget.
  10609. // value:
  10610. // Optional. If provided, attr() operates as a setter. If omitted,
  10611. // the current value of the named property is returned.
  10612. // description:
  10613. // This method is deprecated, use get() or set() directly.
  10614. // Print deprecation warning but only once per calling function
  10615. if(config.isDebug){
  10616. var alreadyCalledHash = arguments.callee._ach || (arguments.callee._ach = {}),
  10617. caller = (arguments.callee.caller || "unknown caller").toString();
  10618. if(!alreadyCalledHash[caller]){
  10619. kernel.deprecated(this.declaredClass + "::attr() is deprecated. Use get() or set() instead, called from " +
  10620. caller, "", "2.0");
  10621. alreadyCalledHash[caller] = true;
  10622. }
  10623. }
  10624. var args = arguments.length;
  10625. if(args >= 2 || typeof name === "object"){ // setter
  10626. return this.set.apply(this, arguments);
  10627. }else{ // getter
  10628. return this.get(name);
  10629. }
  10630. },
  10631. getDescendants: function(){
  10632. // summary:
  10633. // Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode.
  10634. // This method should generally be avoided as it returns widgets declared in templates, which are
  10635. // supposed to be internal/hidden, but it's left here for back-compat reasons.
  10636. kernel.deprecated(this.declaredClass+"::getDescendants() is deprecated. Use getChildren() instead.", "", "2.0");
  10637. return this.containerNode ? query('[widgetId]', this.containerNode).map(registry.byNode) : []; // dijit._Widget[]
  10638. },
  10639. ////////////////// MISCELLANEOUS METHODS ///////////////////
  10640. _onShow: function(){
  10641. // summary:
  10642. // Internal method called when this widget is made visible.
  10643. // See `onShow` for details.
  10644. this.onShow();
  10645. },
  10646. onShow: function(){
  10647. // summary:
  10648. // Called when this widget becomes the selected pane in a
  10649. // `dijit.layout.TabContainer`, `dijit.layout.StackContainer`,
  10650. // `dijit.layout.AccordionContainer`, etc.
  10651. //
  10652. // Also called to indicate display of a `dijit.Dialog`, `dijit.TooltipDialog`, or `dijit.TitlePane`.
  10653. // tags:
  10654. // callback
  10655. },
  10656. onHide: function(){
  10657. // summary:
  10658. // Called when another widget becomes the selected pane in a
  10659. // `dijit.layout.TabContainer`, `dijit.layout.StackContainer`,
  10660. // `dijit.layout.AccordionContainer`, etc.
  10661. //
  10662. // Also called to indicate hide of a `dijit.Dialog`, `dijit.TooltipDialog`, or `dijit.TitlePane`.
  10663. // tags:
  10664. // callback
  10665. },
  10666. onClose: function(){
  10667. // summary:
  10668. // Called when this widget is being displayed as a popup (ex: a Calendar popped
  10669. // up from a DateTextBox), and it is hidden.
  10670. // This is called from the dijit.popup code, and should not be called directly.
  10671. //
  10672. // Also used as a parameter for children of `dijit.layout.StackContainer` or subclasses.
  10673. // Callback if a user tries to close the child. Child will be closed if this function returns true.
  10674. // tags:
  10675. // extension
  10676. return true; // Boolean
  10677. }
  10678. });
  10679. // For back-compat, remove in 2.0.
  10680. if(!kernel.isAsync){
  10681. ready(0, function(){
  10682. var requires = ["dijit/_base"];
  10683. require(requires); // use indirection so modules not rolled into a build
  10684. });
  10685. }
  10686. return _Widget;
  10687. });
  10688. },
  10689. 'dijit/_FocusMixin':function(){
  10690. define("dijit/_FocusMixin", [
  10691. "./focus",
  10692. "./_WidgetBase",
  10693. "dojo/_base/declare", // declare
  10694. "dojo/_base/lang" // lang.extend
  10695. ], function(focus, _WidgetBase, declare, lang){
  10696. /*=====
  10697. var _WidgetBase = dijit._WidgetBase;
  10698. =====*/
  10699. // module:
  10700. // dijit/_FocusMixin
  10701. // summary:
  10702. // Mixin to widget to provide _onFocus() and _onBlur() methods that
  10703. // fire when a widget or it's descendants get/lose focus
  10704. // We don't know where _FocusMixin will occur in the inheritance chain, but we need the _onFocus()/_onBlur() below
  10705. // to be last in the inheritance chain, so mixin to _WidgetBase.
  10706. lang.extend(_WidgetBase, {
  10707. // focused: [readonly] Boolean
  10708. // This widget or a widget it contains has focus, or is "active" because
  10709. // it was recently clicked.
  10710. focused: false,
  10711. onFocus: function(){
  10712. // summary:
  10713. // Called when the widget becomes "active" because
  10714. // it or a widget inside of it either has focus, or has recently
  10715. // been clicked.
  10716. // tags:
  10717. // callback
  10718. },
  10719. onBlur: function(){
  10720. // summary:
  10721. // Called when the widget stops being "active" because
  10722. // focus moved to something outside of it, or the user
  10723. // clicked somewhere outside of it, or the widget was
  10724. // hidden.
  10725. // tags:
  10726. // callback
  10727. },
  10728. _onFocus: function(){
  10729. // summary:
  10730. // This is where widgets do processing for when they are active,
  10731. // such as changing CSS classes. See onFocus() for more details.
  10732. // tags:
  10733. // protected
  10734. this.onFocus();
  10735. },
  10736. _onBlur: function(){
  10737. // summary:
  10738. // This is where widgets do processing for when they stop being active,
  10739. // such as changing CSS classes. See onBlur() for more details.
  10740. // tags:
  10741. // protected
  10742. this.onBlur();
  10743. }
  10744. });
  10745. return declare("dijit._FocusMixin", null, {
  10746. // summary:
  10747. // Mixin to widget to provide _onFocus() and _onBlur() methods that
  10748. // fire when a widget or it's descendants get/lose focus
  10749. // flag that I want _onFocus()/_onBlur() notifications from focus manager
  10750. _focusManager: focus
  10751. });
  10752. });
  10753. },
  10754. 'dijit/_OnDijitClickMixin':function(){
  10755. define("dijit/_OnDijitClickMixin", [
  10756. "dojo/on",
  10757. "dojo/_base/array", // array.forEach
  10758. "dojo/keys", // keys.ENTER keys.SPACE
  10759. "dojo/_base/declare", // declare
  10760. "dojo/_base/sniff", // has("ie")
  10761. "dojo/_base/unload", // unload.addOnWindowUnload
  10762. "dojo/_base/window" // win.doc.addEventListener win.doc.attachEvent win.doc.detachEvent
  10763. ], function(on, array, keys, declare, has, unload, win){
  10764. // module:
  10765. // dijit/_OnDijitClickMixin
  10766. // summary:
  10767. // Mixin so you can pass "ondijitclick" to this.connect() method,
  10768. // as a way to handle clicks by mouse, or by keyboard (SPACE/ENTER key)
  10769. // Keep track of where the last keydown event was, to help avoid generating
  10770. // spurious ondijitclick events when:
  10771. // 1. focus is on a <button> or <a>
  10772. // 2. user presses then releases the ENTER key
  10773. // 3. onclick handler fires and shifts focus to another node, with an ondijitclick handler
  10774. // 4. onkeyup event fires, causing the ondijitclick handler to fire
  10775. var lastKeyDownNode = null;
  10776. if(has("ie") < 9){
  10777. (function(){
  10778. var keydownCallback = function(evt){
  10779. lastKeyDownNode = evt.srcElement;
  10780. };
  10781. win.doc.attachEvent('onkeydown', keydownCallback);
  10782. unload.addOnWindowUnload(function(){
  10783. win.doc.detachEvent('onkeydown', keydownCallback);
  10784. });
  10785. })();
  10786. }else{
  10787. win.doc.addEventListener('keydown', function(evt){
  10788. lastKeyDownNode = evt.target;
  10789. }, true);
  10790. }
  10791. // Custom a11yclick (a.k.a. ondijitclick) event
  10792. var a11yclick = function(node, listener){
  10793. if(/input|button/i.test(node.nodeName)){
  10794. // pass through, the browser already generates click event on SPACE/ENTER key
  10795. return on(node, "click", listener);
  10796. }else{
  10797. // Don't fire the click event unless both the keydown and keyup occur on this node.
  10798. // Avoids problems where focus shifted to this node or away from the node on keydown,
  10799. // either causing this node to process a stray keyup event, or causing another node
  10800. // to get a stray keyup event.
  10801. function clickKey(/*Event*/ e){
  10802. return (e.keyCode == keys.ENTER || e.keyCode == keys.SPACE) &&
  10803. !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey;
  10804. }
  10805. var handles = [
  10806. on(node, "keypress", function(e){
  10807. //console.log(this.id + ": onkeydown, e.target = ", e.target, ", lastKeyDownNode was ", lastKeyDownNode, ", equality is ", (e.target === lastKeyDownNode));
  10808. if(clickKey(e)){
  10809. // needed on IE for when focus changes between keydown and keyup - otherwise dropdown menus do not work
  10810. lastKeyDownNode = e.target;
  10811. // Prevent viewport scrolling on space key in IE<9.
  10812. // (Reproducible on test_Button.html on any of the first dijit.form.Button examples)
  10813. // Do this onkeypress rather than onkeydown because onkeydown.preventDefault() will
  10814. // suppress the onkeypress event, breaking _HasDropDown
  10815. e.preventDefault();
  10816. }
  10817. }),
  10818. on(node, "keyup", function(e){
  10819. //console.log(this.id + ": onkeyup, e.target = ", e.target, ", lastKeyDownNode was ", lastKeyDownNode, ", equality is ", (e.target === lastKeyDownNode));
  10820. if(clickKey(e) && e.target == lastKeyDownNode){ // === breaks greasemonkey
  10821. //need reset here or have problems in FF when focus returns to trigger element after closing popup/alert
  10822. lastKeyDownNode = null;
  10823. listener.call(this, e);
  10824. }
  10825. }),
  10826. on(node, "click", function(e){
  10827. // and connect for mouse clicks too (or touch-clicks on mobile)
  10828. listener.call(this, e);
  10829. })
  10830. ];
  10831. return {
  10832. remove: function(){
  10833. array.forEach(handles, function(h){ h.remove(); });
  10834. }
  10835. };
  10836. }
  10837. };
  10838. return declare("dijit._OnDijitClickMixin", null, {
  10839. connect: function(
  10840. /*Object|null*/ obj,
  10841. /*String|Function*/ event,
  10842. /*String|Function*/ method){
  10843. // summary:
  10844. // Connects specified obj/event to specified method of this object
  10845. // and registers for disconnect() on widget destroy.
  10846. // description:
  10847. // Provide widget-specific analog to connect.connect, except with the
  10848. // implicit use of this widget as the target object.
  10849. // This version of connect also provides a special "ondijitclick"
  10850. // event which triggers on a click or space or enter keyup.
  10851. // Events connected with `this.connect` are disconnected upon
  10852. // destruction.
  10853. // returns:
  10854. // A handle that can be passed to `disconnect` in order to disconnect before
  10855. // the widget is destroyed.
  10856. // example:
  10857. // | var btn = new dijit.form.Button();
  10858. // | // when foo.bar() is called, call the listener we're going to
  10859. // | // provide in the scope of btn
  10860. // | btn.connect(foo, "bar", function(){
  10861. // | console.debug(this.toString());
  10862. // | });
  10863. // tags:
  10864. // protected
  10865. return this.inherited(arguments, [obj, event == "ondijitclick" ? a11yclick : event, method]);
  10866. }
  10867. });
  10868. });
  10869. },
  10870. 'dojo/cache':function(){
  10871. define(["./_base/kernel", "./text"], function(dojo, text){
  10872. // module:
  10873. // dojo/cache
  10874. // summary:
  10875. // The module defines dojo.cache by loading dojo/text.
  10876. //dojo.cache is defined in dojo/text
  10877. return dojo.cache;
  10878. });
  10879. },
  10880. 'dojox/charting/plot2d/Bars':function(){
  10881. define("dojox/charting/plot2d/Bars", ["dojo/_base/kernel", "dojo/_base/lang", "dojo/_base/array", "dojo/_base/declare", "./Base", "./common",
  10882. "dojox/gfx/fx", "dojox/lang/utils", "dojox/lang/functional", "dojox/lang/functional/reversed"],
  10883. function(dojo, lang, arr, declare, Base, dc, fx, du, df, dfr){
  10884. /*=====
  10885. dojo.declare("dojox.charting.plot2d.__BarCtorArgs", dojox.charting.plot2d.__DefaultCtorArgs, {
  10886. // summary:
  10887. // Additional keyword arguments for bar charts.
  10888. // minBarSize: Number?
  10889. // The minimum size for a bar in pixels. Default is 1.
  10890. minBarSize: 1,
  10891. // maxBarSize: Number?
  10892. // The maximum size for a bar in pixels. Default is 1.
  10893. maxBarSize: 1,
  10894. // enableCache: Boolean?
  10895. // Whether the bars rect are cached from one rendering to another. This improves the rendering performance of
  10896. // successive rendering but penalize the first rendering. Default false.
  10897. enableCache: false
  10898. });
  10899. var Base = dojox.charting.plot2d.Base;
  10900. =====*/
  10901. var purgeGroup = dfr.lambda("item.purgeGroup()");
  10902. return declare("dojox.charting.plot2d.Bars", Base, {
  10903. // summary:
  10904. // The plot object representing a bar chart (horizontal bars).
  10905. defaultParams: {
  10906. hAxis: "x", // use a horizontal axis named "x"
  10907. vAxis: "y", // use a vertical axis named "y"
  10908. gap: 0, // gap between columns in pixels
  10909. animate: null, // animate bars into place
  10910. enableCache: false
  10911. },
  10912. optionalParams: {
  10913. minBarSize: 1, // minimal bar width in pixels
  10914. maxBarSize: 1, // maximal bar width in pixels
  10915. // theme component
  10916. stroke: {},
  10917. outline: {},
  10918. shadow: {},
  10919. fill: {},
  10920. font: "",
  10921. fontColor: ""
  10922. },
  10923. constructor: function(chart, kwArgs){
  10924. // summary:
  10925. // The constructor for a bar chart.
  10926. // chart: dojox.charting.Chart
  10927. // The chart this plot belongs to.
  10928. // kwArgs: dojox.charting.plot2d.__BarCtorArgs?
  10929. // An optional keyword arguments object to help define the plot.
  10930. this.opt = lang.clone(this.defaultParams);
  10931. du.updateWithObject(this.opt, kwArgs);
  10932. du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
  10933. this.series = [];
  10934. this.hAxis = this.opt.hAxis;
  10935. this.vAxis = this.opt.vAxis;
  10936. this.animate = this.opt.animate;
  10937. },
  10938. getSeriesStats: function(){
  10939. // summary:
  10940. // Calculate the min/max on all attached series in both directions.
  10941. // returns: Object
  10942. // {hmin, hmax, vmin, vmax} min/max in both directions.
  10943. var stats = dc.collectSimpleStats(this.series), t;
  10944. stats.hmin -= 0.5;
  10945. stats.hmax += 0.5;
  10946. t = stats.hmin, stats.hmin = stats.vmin, stats.vmin = t;
  10947. t = stats.hmax, stats.hmax = stats.vmax, stats.vmax = t;
  10948. return stats;
  10949. },
  10950. createRect: function(run, creator, params){
  10951. var rect;
  10952. if(this.opt.enableCache && run._rectFreePool.length > 0){
  10953. rect = run._rectFreePool.pop();
  10954. rect.setShape(params);
  10955. // was cleared, add it back
  10956. creator.add(rect);
  10957. }else{
  10958. rect = creator.createRect(params);
  10959. }
  10960. if(this.opt.enableCache){
  10961. run._rectUsePool.push(rect);
  10962. }
  10963. return rect;
  10964. },
  10965. render: function(dim, offsets){
  10966. // summary:
  10967. // Run the calculations for any axes for this plot.
  10968. // dim: Object
  10969. // An object in the form of { width, height }
  10970. // offsets: Object
  10971. // An object of the form { l, r, t, b}.
  10972. // returns: dojox.charting.plot2d.Bars
  10973. // A reference to this plot for functional chaining.
  10974. if(this.zoom && !this.isDataDirty()){
  10975. return this.performZoom(dim, offsets);
  10976. }
  10977. this.dirty = this.isDirty();
  10978. this.resetEvents();
  10979. if(this.dirty){
  10980. arr.forEach(this.series, purgeGroup);
  10981. this._eventSeries = {};
  10982. this.cleanGroup();
  10983. var s = this.group;
  10984. df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
  10985. }
  10986. var t = this.chart.theme, f, gap, height,
  10987. ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
  10988. vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
  10989. baseline = Math.max(0, this._hScaler.bounds.lower),
  10990. baselineWidth = ht(baseline),
  10991. events = this.events();
  10992. f = dc.calculateBarSize(this._vScaler.bounds.scale, this.opt);
  10993. gap = f.gap;
  10994. height = f.size;
  10995. for(var i = this.series.length - 1; i >= 0; --i){
  10996. var run = this.series[i];
  10997. if(!this.dirty && !run.dirty){
  10998. t.skip();
  10999. this._reconnectEvents(run.name);
  11000. continue;
  11001. }
  11002. run.cleanGroup();
  11003. if(this.opt.enableCache){
  11004. run._rectFreePool = (run._rectFreePool?run._rectFreePool:[]).concat(run._rectUsePool?run._rectUsePool:[]);
  11005. run._rectUsePool = [];
  11006. }
  11007. var theme = t.next("bar", [this.opt, run]), s = run.group,
  11008. eventSeries = new Array(run.data.length);
  11009. for(var j = 0; j < run.data.length; ++j){
  11010. var value = run.data[j];
  11011. if(value !== null){
  11012. var v = typeof value == "number" ? value : value.y,
  11013. hv = ht(v),
  11014. width = hv - baselineWidth,
  11015. w = Math.abs(width),
  11016. finalTheme = typeof value != "number" ?
  11017. t.addMixin(theme, "bar", value, true) :
  11018. t.post(theme, "bar");
  11019. if(w >= 0 && height >= 1){
  11020. var rect = {
  11021. x: offsets.l + (v < baseline ? hv : baselineWidth),
  11022. y: dim.height - offsets.b - vt(j + 1.5) + gap,
  11023. width: w, height: height
  11024. };
  11025. var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
  11026. specialFill = this._shapeFill(specialFill, rect);
  11027. var shape = this.createRect(run, s, rect).setFill(specialFill).setStroke(finalTheme.series.stroke);
  11028. run.dyn.fill = shape.getFill();
  11029. run.dyn.stroke = shape.getStroke();
  11030. if(events){
  11031. var o = {
  11032. element: "bar",
  11033. index: j,
  11034. run: run,
  11035. shape: shape,
  11036. x: v,
  11037. y: j + 1.5
  11038. };
  11039. this._connectEvents(o);
  11040. eventSeries[j] = o;
  11041. }
  11042. if(this.animate){
  11043. this._animateBar(shape, offsets.l + baselineWidth, -w);
  11044. }
  11045. }
  11046. }
  11047. }
  11048. this._eventSeries[run.name] = eventSeries;
  11049. run.dirty = false;
  11050. }
  11051. this.dirty = false;
  11052. return this; // dojox.charting.plot2d.Bars
  11053. },
  11054. _animateBar: function(shape, hoffset, hsize){
  11055. fx.animateTransform(lang.delegate({
  11056. shape: shape,
  11057. duration: 1200,
  11058. transform: [
  11059. {name: "translate", start: [hoffset - (hoffset/hsize), 0], end: [0, 0]},
  11060. {name: "scale", start: [1/hsize, 1], end: [1, 1]},
  11061. {name: "original"}
  11062. ]
  11063. }, this.animate)).play();
  11064. }
  11065. });
  11066. });
  11067. },
  11068. 'dojox/gfx/_base':function(){
  11069. define("dojox/gfx/_base", ["dojo/_base/lang", "dojo/_base/html", "dojo/_base/Color", "dojo/_base/sniff", "dojo/_base/window",
  11070. "dojo/_base/array","dojo/dom", "dojo/dom-construct","dojo/dom-geometry"],
  11071. function(lang, html, Color, has, win, arr, dom, domConstruct, domGeom){
  11072. // module:
  11073. // dojox/gfx
  11074. // summary:
  11075. // This module contains common core Graphics API used by different graphics renderers.
  11076. var g = lang.getObject("dojox.gfx", true),
  11077. b = g._base = {};
  11078. /*===== g = dojox.gfx; b = dojox.gfx._base; =====*/
  11079. // candidates for dojox.style (work on VML and SVG nodes)
  11080. g._hasClass = function(/*DomNode*/node, /*String*/classStr){
  11081. // summary:
  11082. // Returns whether or not the specified classes are a portion of the
  11083. // class list currently applied to the node.
  11084. // return (new RegExp('(^|\\s+)'+classStr+'(\\s+|$)')).test(node.className) // Boolean
  11085. var cls = node.getAttribute("className");
  11086. return cls && (" " + cls + " ").indexOf(" " + classStr + " ") >= 0; // Boolean
  11087. };
  11088. g._addClass = function(/*DomNode*/node, /*String*/classStr){
  11089. // summary:
  11090. // Adds the specified classes to the end of the class list on the
  11091. // passed node.
  11092. var cls = node.getAttribute("className") || "";
  11093. if(!cls || (" " + cls + " ").indexOf(" " + classStr + " ") < 0){
  11094. node.setAttribute("className", cls + (cls ? " " : "") + classStr);
  11095. }
  11096. };
  11097. g._removeClass = function(/*DomNode*/node, /*String*/classStr){
  11098. // summary: Removes classes from node.
  11099. var cls = node.getAttribute("className");
  11100. if(cls){
  11101. node.setAttribute(
  11102. "className",
  11103. cls.replace(new RegExp('(^|\\s+)' + classStr + '(\\s+|$)'), "$1$2")
  11104. );
  11105. }
  11106. };
  11107. // candidate for dojox.html.metrics (dynamic font resize handler is not implemented here)
  11108. // derived from Morris John's emResized measurer
  11109. b._getFontMeasurements = function(){
  11110. // summary:
  11111. // Returns an object that has pixel equivilents of standard font
  11112. // size values.
  11113. var heights = {
  11114. '1em': 0, '1ex': 0, '100%': 0, '12pt': 0, '16px': 0, 'xx-small': 0,
  11115. 'x-small': 0, 'small': 0, 'medium': 0, 'large': 0, 'x-large': 0,
  11116. 'xx-large': 0
  11117. };
  11118. var p;
  11119. if(has("ie")){
  11120. // we do a font-size fix if and only if one isn't applied already.
  11121. // NOTE: If someone set the fontSize on the HTML Element, this will kill it.
  11122. win.doc.documentElement.style.fontSize="100%";
  11123. }
  11124. // set up the measuring node.
  11125. var div = domConstruct.create("div", {style: {
  11126. position: "absolute",
  11127. left: "0",
  11128. top: "-100px",
  11129. width: "30px",
  11130. height: "1000em",
  11131. borderWidth: "0",
  11132. margin: "0",
  11133. padding: "0",
  11134. outline: "none",
  11135. lineHeight: "1",
  11136. overflow: "hidden"
  11137. }}, win.body());
  11138. // do the measurements.
  11139. for(p in heights){
  11140. div.style.fontSize = p;
  11141. heights[p] = Math.round(div.offsetHeight * 12/16) * 16/12 / 1000;
  11142. }
  11143. win.body().removeChild(div);
  11144. return heights; //object
  11145. };
  11146. var fontMeasurements = null;
  11147. b._getCachedFontMeasurements = function(recalculate){
  11148. if(recalculate || !fontMeasurements){
  11149. fontMeasurements = b._getFontMeasurements();
  11150. }
  11151. return fontMeasurements;
  11152. };
  11153. // candidate for dojox.html.metrics
  11154. var measuringNode = null, empty = {};
  11155. b._getTextBox = function( /*String*/ text,
  11156. /*Object*/ style,
  11157. /*String?*/ className){
  11158. var m, s, al = arguments.length;
  11159. var i;
  11160. if(!measuringNode){
  11161. measuringNode = domConstruct.create("div", {style: {
  11162. position: "absolute",
  11163. top: "-10000px",
  11164. left: "0"
  11165. }}, win.body());
  11166. }
  11167. m = measuringNode;
  11168. // reset styles
  11169. m.className = "";
  11170. s = m.style;
  11171. s.borderWidth = "0";
  11172. s.margin = "0";
  11173. s.padding = "0";
  11174. s.outline = "0";
  11175. // set new style
  11176. if(al > 1 && style){
  11177. for(i in style){
  11178. if(i in empty){ continue; }
  11179. s[i] = style[i];
  11180. }
  11181. }
  11182. // set classes
  11183. if(al > 2 && className){
  11184. m.className = className;
  11185. }
  11186. // take a measure
  11187. m.innerHTML = text;
  11188. if(m["getBoundingClientRect"]){
  11189. var bcr = m.getBoundingClientRect();
  11190. return {l: bcr.left, t: bcr.top, w: bcr.width || (bcr.right - bcr.left), h: bcr.height || (bcr.bottom - bcr.top)};
  11191. }else{
  11192. return domGeom.getMarginBox(m);
  11193. }
  11194. };
  11195. // candidate for dojo.dom
  11196. var uniqueId = 0;
  11197. b._getUniqueId = function(){
  11198. // summary: returns a unique string for use with any DOM element
  11199. var id;
  11200. do{
  11201. id = dojo._scopeName + "xUnique" + (++uniqueId);
  11202. }while(dom.byId(id));
  11203. return id;
  11204. };
  11205. lang.mixin(g, {
  11206. // summary:
  11207. // defines constants, prototypes, and utility functions for the core Graphics API
  11208. // default shapes, which are used to fill in missing parameters
  11209. defaultPath: {
  11210. // summary:
  11211. // Defines the default Path prototype object.
  11212. type: "path",
  11213. // type: String
  11214. // Specifies this object is a Path, default value 'path'.
  11215. path: ""
  11216. // path: String
  11217. // The path commands. See W32C SVG 1.0 specification.
  11218. // Defaults to empty string value.
  11219. },
  11220. defaultPolyline: {
  11221. // summary:
  11222. // Defines the default PolyLine prototype.
  11223. type: "polyline",
  11224. // type: String
  11225. // Specifies this object is a PolyLine, default value 'polyline'.
  11226. points: []
  11227. // points: Array
  11228. // An array of point objects [{x:0,y:0},...] defining the default polyline's line segments. Value is an empty array [].
  11229. },
  11230. defaultRect: {
  11231. // summary:
  11232. // Defines the default Rect prototype.
  11233. type: "rect",
  11234. // type: String
  11235. // Specifies this default object is a type of Rect. Value is 'rect'
  11236. x: 0,
  11237. // x: Number
  11238. // The X coordinate of the default rectangles position, value 0.
  11239. y: 0,
  11240. // y: Number
  11241. // The Y coordinate of the default rectangle's position, value 0.
  11242. width: 100,
  11243. // width: Number
  11244. // The width of the default rectangle, value 100.
  11245. height: 100,
  11246. // height: Number
  11247. // The height of the default rectangle, value 100.
  11248. r: 0
  11249. // r: Number
  11250. // The corner radius for the default rectangle, value 0.
  11251. },
  11252. defaultEllipse: {
  11253. // summary:
  11254. // Defines the default Ellipse prototype.
  11255. type: "ellipse",
  11256. // type: String
  11257. // Specifies that this object is a type of Ellipse, value is 'ellipse'
  11258. cx: 0,
  11259. // cx: Number
  11260. // The X coordinate of the center of the ellipse, default value 0.
  11261. cy: 0,
  11262. // cy: Number
  11263. // The Y coordinate of the center of the ellipse, default value 0.
  11264. rx: 200,
  11265. // rx: Number
  11266. // The radius of the ellipse in the X direction, default value 200.
  11267. ry: 100
  11268. // ry: Number
  11269. // The radius of the ellipse in the Y direction, default value 200.
  11270. },
  11271. defaultCircle: {
  11272. // summary:
  11273. // An object defining the default Circle prototype.
  11274. type: "circle",
  11275. // type: String
  11276. // Specifies this object is a circle, value 'circle'
  11277. cx: 0,
  11278. // cx: Number
  11279. // The X coordinate of the center of the circle, default value 0.
  11280. cy: 0,
  11281. // cy: Number
  11282. // The Y coordinate of the center of the circle, default value 0.
  11283. r: 100
  11284. // r: Number
  11285. // The radius, default value 100.
  11286. },
  11287. defaultLine: {
  11288. // summary:
  11289. // An pbject defining the default Line prototype.
  11290. type: "line",
  11291. // type: String
  11292. // Specifies this is a Line, value 'line'
  11293. x1: 0,
  11294. // x1: Number
  11295. // The X coordinate of the start of the line, default value 0.
  11296. y1: 0,
  11297. // y1: Number
  11298. // The Y coordinate of the start of the line, default value 0.
  11299. x2: 100,
  11300. // x2: Number
  11301. // The X coordinate of the end of the line, default value 100.
  11302. y2: 100
  11303. // y2: Number
  11304. // The Y coordinate of the end of the line, default value 100.
  11305. },
  11306. defaultImage: {
  11307. // summary:
  11308. // Defines the default Image prototype.
  11309. type: "image",
  11310. // type: String
  11311. // Specifies this object is an image, value 'image'.
  11312. x: 0,
  11313. // x: Number
  11314. // The X coordinate of the image's position, default value 0.
  11315. y: 0,
  11316. // y: Number
  11317. // The Y coordinate of the image's position, default value 0.
  11318. width: 0,
  11319. // width: Number
  11320. // The width of the image, default value 0.
  11321. height: 0,
  11322. // height:Number
  11323. // The height of the image, default value 0.
  11324. src: ""
  11325. // src: String
  11326. // The src url of the image, defaults to empty string.
  11327. },
  11328. defaultText: {
  11329. // summary:
  11330. // Defines the default Text prototype.
  11331. type: "text",
  11332. // type: String
  11333. // Specifies this is a Text shape, value 'text'.
  11334. x: 0,
  11335. // x: Number
  11336. // The X coordinate of the text position, default value 0.
  11337. y: 0,
  11338. // y: Number
  11339. // The Y coordinate of the text position, default value 0.
  11340. text: "",
  11341. // text: String
  11342. // The text to be displayed, default value empty string.
  11343. align: "start",
  11344. // align: String
  11345. // The horizontal text alignment, one of 'start', 'end', 'center'. Default value 'start'.
  11346. decoration: "none",
  11347. // decoration: String
  11348. // The text decoration , one of 'none', ... . Default value 'none'.
  11349. rotated: false,
  11350. // rotated: Boolean
  11351. // Whether the text is rotated, boolean default value false.
  11352. kerning: true
  11353. // kerning: Boolean
  11354. // Whether kerning is used on the text, boolean default value true.
  11355. },
  11356. defaultTextPath: {
  11357. // summary:
  11358. // Defines the default TextPath prototype.
  11359. type: "textpath",
  11360. // type: String
  11361. // Specifies this is a TextPath, value 'textpath'.
  11362. text: "",
  11363. // text: String
  11364. // The text to be displayed, default value empty string.
  11365. align: "start",
  11366. // align: String
  11367. // The horizontal text alignment, one of 'start', 'end', 'center'. Default value 'start'.
  11368. decoration: "none",
  11369. // decoration: String
  11370. // The text decoration , one of 'none', ... . Default value 'none'.
  11371. rotated: false,
  11372. // rotated: Boolean
  11373. // Whether the text is rotated, boolean default value false.
  11374. kerning: true
  11375. // kerning: Boolean
  11376. // Whether kerning is used on the text, boolean default value true.
  11377. },
  11378. // default stylistic attributes
  11379. defaultStroke: {
  11380. // summary:
  11381. // A stroke defines stylistic properties that are used when drawing a path.
  11382. // This object defines the default Stroke prototype.
  11383. type: "stroke",
  11384. // type: String
  11385. // Specifies this object is a type of Stroke, value 'stroke'.
  11386. color: "black",
  11387. // color: String
  11388. // The color of the stroke, default value 'black'.
  11389. style: "solid",
  11390. // style: String
  11391. // The style of the stroke, one of 'solid', ... . Default value 'solid'.
  11392. width: 1,
  11393. // width: Number
  11394. // The width of a stroke, default value 1.
  11395. cap: "butt",
  11396. // cap: String
  11397. // The endcap style of the path. One of 'butt', 'round', ... . Default value 'butt'.
  11398. join: 4
  11399. // join: Number
  11400. // The join style to use when combining path segments. Default value 4.
  11401. },
  11402. defaultLinearGradient: {
  11403. // summary:
  11404. // An object defining the default stylistic properties used for Linear Gradient fills.
  11405. // Linear gradients are drawn along a virtual line, which results in appearance of a rotated pattern in a given direction/orientation.
  11406. type: "linear",
  11407. // type: String
  11408. // Specifies this object is a Linear Gradient, value 'linear'
  11409. x1: 0,
  11410. // x1: Number
  11411. // The X coordinate of the start of the virtual line along which the gradient is drawn, default value 0.
  11412. y1: 0,
  11413. // y1: Number
  11414. // The Y coordinate of the start of the virtual line along which the gradient is drawn, default value 0.
  11415. x2: 100,
  11416. // x2: Number
  11417. // The X coordinate of the end of the virtual line along which the gradient is drawn, default value 100.
  11418. y2: 100,
  11419. // y2: Number
  11420. // The Y coordinate of the end of the virtual line along which the gradient is drawn, default value 100.
  11421. colors: [
  11422. { offset: 0, color: "black" }, { offset: 1, color: "white" }
  11423. ]
  11424. // colors: Array
  11425. // An array of colors at given offsets (from the start of the line). The start of the line is
  11426. // defined at offest 0 with the end of the line at offset 1.
  11427. // Default value, [{ offset: 0, color: 'black'},{offset: 1, color: 'white'}], is a gradient from black to white.
  11428. },
  11429. defaultRadialGradient: {
  11430. // summary:
  11431. // An object specifying the default properties for RadialGradients using in fills patterns.
  11432. type: "radial",
  11433. // type: String
  11434. // Specifies this is a RadialGradient, value 'radial'
  11435. cx: 0,
  11436. // cx: Number
  11437. // The X coordinate of the center of the radial gradient, default value 0.
  11438. cy: 0,
  11439. // cy: Number
  11440. // The Y coordinate of the center of the radial gradient, default value 0.
  11441. r: 100,
  11442. // r: Number
  11443. // The radius to the end of the radial gradient, default value 100.
  11444. colors: [
  11445. { offset: 0, color: "black" }, { offset: 1, color: "white" }
  11446. ]
  11447. // colors: Array
  11448. // An array of colors at given offsets (from the center of the radial gradient).
  11449. // The center is defined at offest 0 with the outer edge of the gradient at offset 1.
  11450. // Default value, [{ offset: 0, color: 'black'},{offset: 1, color: 'white'}], is a gradient from black to white.
  11451. },
  11452. defaultPattern: {
  11453. // summary:
  11454. // An object specifying the default properties for a Pattern using in fill operations.
  11455. type: "pattern",
  11456. // type: String
  11457. // Specifies this object is a Pattern, value 'pattern'.
  11458. x: 0,
  11459. // x: Number
  11460. // The X coordinate of the position of the pattern, default value is 0.
  11461. y: 0,
  11462. // y: Number
  11463. // The Y coordinate of the position of the pattern, default value is 0.
  11464. width: 0,
  11465. // width: Number
  11466. // The width of the pattern image, default value is 0.
  11467. height: 0,
  11468. // height: Number
  11469. // The height of the pattern image, default value is 0.
  11470. src: ""
  11471. // src: String
  11472. // A url specifing the image to use for the pattern.
  11473. },
  11474. defaultFont: {
  11475. // summary:
  11476. // An object specifying the default properties for a Font used in text operations.
  11477. type: "font",
  11478. // type: String
  11479. // Specifies this object is a Font, value 'font'.
  11480. style: "normal",
  11481. // style: String
  11482. // The font style, one of 'normal', 'bold', default value 'normal'.
  11483. variant: "normal",
  11484. // variant: String
  11485. // The font variant, one of 'normal', ... , default value 'normal'.
  11486. weight: "normal",
  11487. // weight: String
  11488. // The font weight, one of 'normal', ..., default value 'normal'.
  11489. size: "10pt",
  11490. // size: String
  11491. // The font size (including units), default value '10pt'.
  11492. family: "serif"
  11493. // family: String
  11494. // The font family, one of 'serif', 'sanserif', ..., default value 'serif'.
  11495. },
  11496. getDefault: (function(){
  11497. // summary:
  11498. // Returns a function used to access default memoized prototype objects (see them defined above).
  11499. var typeCtorCache = {};
  11500. // a memoized delegate()
  11501. return function(/*String*/ type){
  11502. var t = typeCtorCache[type];
  11503. if(t){
  11504. return new t();
  11505. }
  11506. t = typeCtorCache[type] = new Function();
  11507. t.prototype = g[ "default" + type ];
  11508. return new t();
  11509. }
  11510. })(),
  11511. normalizeColor: function(/*dojo.Color|Array|string|Object*/ color){
  11512. // summary:
  11513. // converts any legal color representation to normalized
  11514. // dojo.Color object
  11515. return (color instanceof Color) ? color : new Color(color); // dojo.Color
  11516. },
  11517. normalizeParameters: function(existed, update){
  11518. // summary:
  11519. // updates an existing object with properties from an 'update'
  11520. // object
  11521. // existed: Object
  11522. // the target object to be updated
  11523. // update: Object
  11524. // the 'update' object, whose properties will be used to update
  11525. // the existed object
  11526. var x;
  11527. if(update){
  11528. var empty = {};
  11529. for(x in existed){
  11530. if(x in update && !(x in empty)){
  11531. existed[x] = update[x];
  11532. }
  11533. }
  11534. }
  11535. return existed; // Object
  11536. },
  11537. makeParameters: function(defaults, update){
  11538. // summary:
  11539. // copies the original object, and all copied properties from the
  11540. // 'update' object
  11541. // defaults: Object
  11542. // the object to be cloned before updating
  11543. // update: Object
  11544. // the object, which properties are to be cloned during updating
  11545. var i = null;
  11546. if(!update){
  11547. // return dojo.clone(defaults);
  11548. return lang.delegate(defaults);
  11549. }
  11550. var result = {};
  11551. for(i in defaults){
  11552. if(!(i in result)){
  11553. result[i] = lang.clone((i in update) ? update[i] : defaults[i]);
  11554. }
  11555. }
  11556. return result; // Object
  11557. },
  11558. formatNumber: function(x, addSpace){
  11559. // summary: converts a number to a string using a fixed notation
  11560. // x: Number
  11561. // number to be converted
  11562. // addSpace: Boolean
  11563. // whether to add a space before a positive number
  11564. var val = x.toString();
  11565. if(val.indexOf("e") >= 0){
  11566. val = x.toFixed(4);
  11567. }else{
  11568. var point = val.indexOf(".");
  11569. if(point >= 0 && val.length - point > 5){
  11570. val = x.toFixed(4);
  11571. }
  11572. }
  11573. if(x < 0){
  11574. return val; // String
  11575. }
  11576. return addSpace ? " " + val : val; // String
  11577. },
  11578. // font operations
  11579. makeFontString: function(font){
  11580. // summary: converts a font object to a CSS font string
  11581. // font: Object: font object (see dojox.gfx.defaultFont)
  11582. return font.style + " " + font.variant + " " + font.weight + " " + font.size + " " + font.family; // Object
  11583. },
  11584. splitFontString: function(str){
  11585. // summary:
  11586. // converts a CSS font string to a font object
  11587. // description:
  11588. // Converts a CSS font string to a gfx font object. The CSS font
  11589. // string components should follow the W3C specified order
  11590. // (see http://www.w3.org/TR/CSS2/fonts.html#font-shorthand):
  11591. // style, variant, weight, size, optional line height (will be
  11592. // ignored), and family.
  11593. // str: String
  11594. // a CSS font string
  11595. var font = g.getDefault("Font");
  11596. var t = str.split(/\s+/);
  11597. do{
  11598. if(t.length < 5){ break; }
  11599. font.style = t[0];
  11600. font.variant = t[1];
  11601. font.weight = t[2];
  11602. var i = t[3].indexOf("/");
  11603. font.size = i < 0 ? t[3] : t[3].substring(0, i);
  11604. var j = 4;
  11605. if(i < 0){
  11606. if(t[4] == "/"){
  11607. j = 6;
  11608. }else if(t[4].charAt(0) == "/"){
  11609. j = 5;
  11610. }
  11611. }
  11612. if(j < t.length){
  11613. font.family = t.slice(j).join(" ");
  11614. }
  11615. }while(false);
  11616. return font; // Object
  11617. },
  11618. // length operations
  11619. cm_in_pt: 72 / 2.54,
  11620. // cm_in_pt: Number
  11621. // points per centimeter (constant)
  11622. mm_in_pt: 7.2 / 2.54,
  11623. // mm_in_pt: Number
  11624. // points per millimeter (constant)
  11625. px_in_pt: function(){
  11626. // summary: returns the current number of pixels per point.
  11627. return g._base._getCachedFontMeasurements()["12pt"] / 12; // Number
  11628. },
  11629. pt2px: function(len){
  11630. // summary: converts points to pixels
  11631. // len: Number
  11632. // a value in points
  11633. return len * g.px_in_pt(); // Number
  11634. },
  11635. px2pt: function(len){
  11636. // summary: converts pixels to points
  11637. // len: Number
  11638. // a value in pixels
  11639. return len / g.px_in_pt(); // Number
  11640. },
  11641. normalizedLength: function(len) {
  11642. // summary: converts any length value to pixels
  11643. // len: String
  11644. // a length, e.g., '12pc'
  11645. if(len.length === 0){ return 0; }
  11646. if(len.length > 2){
  11647. var px_in_pt = g.px_in_pt();
  11648. var val = parseFloat(len);
  11649. switch(len.slice(-2)){
  11650. case "px": return val;
  11651. case "pt": return val * px_in_pt;
  11652. case "in": return val * 72 * px_in_pt;
  11653. case "pc": return val * 12 * px_in_pt;
  11654. case "mm": return val * g.mm_in_pt * px_in_pt;
  11655. case "cm": return val * g.cm_in_pt * px_in_pt;
  11656. }
  11657. }
  11658. return parseFloat(len); // Number
  11659. },
  11660. pathVmlRegExp: /([A-Za-z]+)|(\d+(\.\d+)?)|(\.\d+)|(-\d+(\.\d+)?)|(-\.\d+)/g,
  11661. // pathVmlRegExp: RegExp
  11662. // a constant regular expression used to split a SVG/VML path into primitive components
  11663. pathSvgRegExp: /([A-Za-z])|(\d+(\.\d+)?)|(\.\d+)|(-\d+(\.\d+)?)|(-\.\d+)/g,
  11664. // pathVmlRegExp: RegExp
  11665. // a constant regular expression used to split a SVG/VML path into primitive components
  11666. equalSources: function(a /*Object*/, b /*Object*/){
  11667. // summary: compares event sources, returns true if they are equal
  11668. // a: first event source
  11669. // b: event source to compare against a
  11670. return a && b && a === b;
  11671. },
  11672. switchTo: function(renderer/*String|Object*/){
  11673. // summary: switch the graphics implementation to the specified renderer.
  11674. // renderer:
  11675. // Either the string name of a renderer (eg. 'canvas', 'svg, ...) or the renderer
  11676. // object to switch to.
  11677. var ns = typeof renderer == "string" ? g[renderer] : renderer;
  11678. if(ns){
  11679. arr.forEach(["Group", "Rect", "Ellipse", "Circle", "Line",
  11680. "Polyline", "Image", "Text", "Path", "TextPath",
  11681. "Surface", "createSurface", "fixTarget"], function(name){
  11682. g[name] = ns[name];
  11683. });
  11684. }
  11685. }
  11686. });
  11687. return g; // defaults object api
  11688. });
  11689. },
  11690. 'dijit/focus':function(){
  11691. define("dijit/focus", [
  11692. "dojo/aspect",
  11693. "dojo/_base/declare", // declare
  11694. "dojo/dom", // domAttr.get dom.isDescendant
  11695. "dojo/dom-attr", // domAttr.get dom.isDescendant
  11696. "dojo/dom-construct", // connect to domConstruct.empty, domConstruct.destroy
  11697. "dojo/Evented",
  11698. "dojo/_base/lang", // lang.hitch
  11699. "dojo/on",
  11700. "dojo/domReady",
  11701. "dojo/_base/sniff", // has("ie")
  11702. "dojo/Stateful",
  11703. "dojo/_base/window", // win.body
  11704. "dojo/window", // winUtils.get
  11705. "./a11y", // a11y.isTabNavigable
  11706. "./registry", // registry.byId
  11707. "./main" // to set dijit.focus
  11708. ], function(aspect, declare, dom, domAttr, domConstruct, Evented, lang, on, domReady, has, Stateful, win, winUtils,
  11709. a11y, registry, dijit){
  11710. // module:
  11711. // dijit/focus
  11712. var FocusManager = declare([Stateful, Evented], {
  11713. // summary:
  11714. // Tracks the currently focused node, and which widgets are currently "active".
  11715. // Access via require(["dijit/focus"], function(focus){ ... }).
  11716. //
  11717. // A widget is considered active if it or a descendant widget has focus,
  11718. // or if a non-focusable node of this widget or a descendant was recently clicked.
  11719. //
  11720. // Call focus.watch("curNode", callback) to track the current focused DOMNode,
  11721. // or focus.watch("activeStack", callback) to track the currently focused stack of widgets.
  11722. //
  11723. // Call focus.on("widget-blur", func) or focus.on("widget-focus", ...) to monitor when
  11724. // when widgets become active/inactive
  11725. //
  11726. // Finally, focus(node) will focus a node, suppressing errors if the node doesn't exist.
  11727. // curNode: DomNode
  11728. // Currently focused item on screen
  11729. curNode: null,
  11730. // activeStack: dijit/_WidgetBase[]
  11731. // List of currently active widgets (focused widget and it's ancestors)
  11732. activeStack: [],
  11733. constructor: function(){
  11734. // Don't leave curNode/prevNode pointing to bogus elements
  11735. var check = lang.hitch(this, function(node){
  11736. if(dom.isDescendant(this.curNode, node)){
  11737. this.set("curNode", null);
  11738. }
  11739. if(dom.isDescendant(this.prevNode, node)){
  11740. this.set("prevNode", null);
  11741. }
  11742. });
  11743. aspect.before(domConstruct, "empty", check);
  11744. aspect.before(domConstruct, "destroy", check);
  11745. },
  11746. registerIframe: function(/*DomNode*/ iframe){
  11747. // summary:
  11748. // Registers listeners on the specified iframe so that any click
  11749. // or focus event on that iframe (or anything in it) is reported
  11750. // as a focus/click event on the `<iframe>` itself.
  11751. // description:
  11752. // Currently only used by editor.
  11753. // returns:
  11754. // Handle with remove() method to deregister.
  11755. return this.registerWin(iframe.contentWindow, iframe);
  11756. },
  11757. registerWin: function(/*Window?*/targetWindow, /*DomNode?*/ effectiveNode){
  11758. // summary:
  11759. // Registers listeners on the specified window (either the main
  11760. // window or an iframe's window) to detect when the user has clicked somewhere
  11761. // or focused somewhere.
  11762. // description:
  11763. // Users should call registerIframe() instead of this method.
  11764. // targetWindow:
  11765. // If specified this is the window associated with the iframe,
  11766. // i.e. iframe.contentWindow.
  11767. // effectiveNode:
  11768. // If specified, report any focus events inside targetWindow as
  11769. // an event on effectiveNode, rather than on evt.target.
  11770. // returns:
  11771. // Handle with remove() method to deregister.
  11772. // TODO: make this function private in 2.0; Editor/users should call registerIframe(),
  11773. // Listen for blur and focus events on targetWindow's document.
  11774. var _this = this,
  11775. body = targetWindow.document && targetWindow.document.body;
  11776. if(body){
  11777. var mdh = on(body, 'mousedown', function(evt){
  11778. _this._justMouseDowned = true;
  11779. // Use a 13 ms timeout to work-around Chrome resolving too fast and focusout
  11780. // events not seeing that a mousedown just happened when a popup closes.
  11781. // See https://bugs.dojotoolkit.org/ticket/17668
  11782. setTimeout(function(){ _this._justMouseDowned = false; }, 13);
  11783. // workaround weird IE bug where the click is on an orphaned node
  11784. // (first time clicking a Select/DropDownButton inside a TooltipDialog).
  11785. // actually, strangely this is happening on latest chrome too.
  11786. if(evt && evt.target && evt.target.parentNode == null){
  11787. return;
  11788. }
  11789. _this._onTouchNode(effectiveNode || evt.target, "mouse");
  11790. });
  11791. var fih = on(body, 'focusin', function(evt){
  11792. // When you refocus the browser window, IE gives an event with an empty srcElement
  11793. if(!evt.target.tagName) { return; }
  11794. // IE reports that nodes like <body> have gotten focus, even though they have tabIndex=-1,
  11795. // ignore those events
  11796. var tag = evt.target.tagName.toLowerCase();
  11797. if(tag == "#document" || tag == "body"){ return; }
  11798. if(a11y.isTabNavigable(evt.target)){
  11799. // If condition doesn't seem quite right, but it is correctly preventing focus events for
  11800. // clicks on disabled buttons.
  11801. _this._onFocusNode(effectiveNode || evt.target);
  11802. }else{
  11803. // Previous code called _onTouchNode() for any activate event on a non-focusable node. Can
  11804. // probably just ignore such an event as it will be handled by onmousedown handler above, but
  11805. // leaving the code for now.
  11806. _this._onTouchNode(effectiveNode || evt.target);
  11807. }
  11808. });
  11809. var foh = on(body, 'focusout', function(evt){
  11810. _this._onBlurNode(effectiveNode || evt.target);
  11811. });
  11812. return {
  11813. remove: function(){
  11814. mdh.remove();
  11815. fih.remove();
  11816. foh.remove();
  11817. mdh = fih = foh = null;
  11818. body = null; // prevent memory leak (apparent circular reference via closure)
  11819. }
  11820. };
  11821. }
  11822. },
  11823. _onBlurNode: function(/*DomNode*/ node){
  11824. // summary:
  11825. // Called when focus leaves a node.
  11826. // Usually ignored, _unless_ it *isn't* followed by touching another node,
  11827. // which indicates that we tabbed off the last field on the page,
  11828. // in which case every widget is marked inactive
  11829. // If the blur event isn't followed by a focus event, it means the user clicked on something unfocusable,
  11830. // so clear focus.
  11831. if(this._clearFocusTimer){
  11832. clearTimeout(this._clearFocusTimer);
  11833. }
  11834. this._clearFocusTimer = setTimeout(lang.hitch(this, function(){
  11835. this.set("prevNode", this.curNode);
  11836. this.set("curNode", null);
  11837. }), 0);
  11838. if(this._justMouseDowned){
  11839. // the mouse down caused a new widget to be marked as active; this blur event
  11840. // is coming late, so ignore it.
  11841. return;
  11842. }
  11843. // If the blur event isn't followed by a focus or touch event then mark all widgets as inactive.
  11844. if(this._clearActiveWidgetsTimer){
  11845. clearTimeout(this._clearActiveWidgetsTimer);
  11846. }
  11847. this._clearActiveWidgetsTimer = setTimeout(lang.hitch(this, function(){
  11848. delete this._clearActiveWidgetsTimer;
  11849. this._setStack([]);
  11850. }), 100);
  11851. },
  11852. _onTouchNode: function(/*DomNode*/ node, /*String*/ by){
  11853. // summary:
  11854. // Callback when node is focused or mouse-downed
  11855. // node:
  11856. // The node that was touched.
  11857. // by:
  11858. // "mouse" if the focus/touch was caused by a mouse down event
  11859. // ignore the recent blurNode event
  11860. if(this._clearActiveWidgetsTimer){
  11861. clearTimeout(this._clearActiveWidgetsTimer);
  11862. delete this._clearActiveWidgetsTimer;
  11863. }
  11864. // compute stack of active widgets (ex: ComboButton --> Menu --> MenuItem)
  11865. var newStack=[];
  11866. try{
  11867. while(node){
  11868. var popupParent = domAttr.get(node, "dijitPopupParent");
  11869. if(popupParent){
  11870. node=registry.byId(popupParent).domNode;
  11871. }else if(node.tagName && node.tagName.toLowerCase() == "body"){
  11872. // is this the root of the document or just the root of an iframe?
  11873. if(node === win.body()){
  11874. // node is the root of the main document
  11875. break;
  11876. }
  11877. // otherwise, find the iframe this node refers to (can't access it via parentNode,
  11878. // need to do this trick instead). window.frameElement is supported in IE/FF/Webkit
  11879. node=winUtils.get(node.ownerDocument).frameElement;
  11880. }else{
  11881. // if this node is the root node of a widget, then add widget id to stack,
  11882. // except ignore clicks on disabled widgets (actually focusing a disabled widget still works,
  11883. // to support MenuItem)
  11884. var id = node.getAttribute && node.getAttribute("widgetId"),
  11885. widget = id && registry.byId(id);
  11886. if(widget && !(by == "mouse" && widget.get("disabled"))){
  11887. newStack.unshift(id);
  11888. }
  11889. node=node.parentNode;
  11890. }
  11891. }
  11892. }catch(e){ /* squelch */ }
  11893. this._setStack(newStack, by);
  11894. },
  11895. _onFocusNode: function(/*DomNode*/ node){
  11896. // summary:
  11897. // Callback when node is focused
  11898. if(!node){
  11899. return;
  11900. }
  11901. if(node.nodeType == 9){
  11902. // Ignore focus events on the document itself. This is here so that
  11903. // (for example) clicking the up/down arrows of a spinner
  11904. // (which don't get focus) won't cause that widget to blur. (FF issue)
  11905. return;
  11906. }
  11907. // There was probably a blur event right before this event, but since we have a new focus, don't
  11908. // do anything with the blur
  11909. if(this._clearFocusTimer){
  11910. clearTimeout(this._clearFocusTimer);
  11911. delete this._clearFocusTimer;
  11912. }
  11913. this._onTouchNode(node);
  11914. if(node == this.curNode){ return; }
  11915. this.set("prevNode", this.curNode);
  11916. this.set("curNode", node);
  11917. },
  11918. _setStack: function(/*String[]*/ newStack, /*String*/ by){
  11919. // summary:
  11920. // The stack of active widgets has changed. Send out appropriate events and records new stack.
  11921. // newStack:
  11922. // array of widget id's, starting from the top (outermost) widget
  11923. // by:
  11924. // "mouse" if the focus/touch was caused by a mouse down event
  11925. var oldStack = this.activeStack, lastOldIdx = oldStack.length - 1, lastNewIdx = newStack.length - 1;
  11926. if(newStack[lastNewIdx] == oldStack[lastOldIdx]){
  11927. // no changes, return now to avoid spurious notifications about changes to activeStack
  11928. return;
  11929. }
  11930. this.set("activeStack", newStack);
  11931. var widget, i;
  11932. // for all elements that have gone out of focus, set focused=false
  11933. for(i = lastOldIdx; i >= 0 && oldStack[i] != newStack[i]; i--){
  11934. widget = registry.byId(oldStack[i]);
  11935. if(widget){
  11936. widget._hasBeenBlurred = true; // TODO: used by form widgets, should be moved there
  11937. widget.set("focused", false);
  11938. if(widget._focusManager == this){
  11939. widget._onBlur(by);
  11940. }
  11941. this.emit("widget-blur", widget, by);
  11942. }
  11943. }
  11944. // for all element that have come into focus, set focused=true
  11945. for(i++; i <= lastNewIdx; i++){
  11946. widget = registry.byId(newStack[i]);
  11947. if(widget){
  11948. widget.set("focused", true);
  11949. if(widget._focusManager == this){
  11950. widget._onFocus(by);
  11951. }
  11952. this.emit("widget-focus", widget, by);
  11953. }
  11954. }
  11955. },
  11956. focus: function(node){
  11957. // summary:
  11958. // Focus the specified node, suppressing errors if they occur
  11959. if(node){
  11960. try{ node.focus(); }catch(e){/*quiet*/}
  11961. }
  11962. }
  11963. });
  11964. var singleton = new FocusManager();
  11965. // register top window and all the iframes it contains
  11966. domReady(function(){
  11967. var handle = singleton.registerWin(winUtils.get(document));
  11968. if(has("ie")){
  11969. on(window, "unload", function(){
  11970. if(handle){ // because this gets called twice when doh.robot is running
  11971. handle.remove();
  11972. handle = null;
  11973. }
  11974. });
  11975. }
  11976. });
  11977. // Setup dijit.focus as a pointer to the singleton but also (for backwards compatibility)
  11978. // as a function to set focus. Remove for 2.0.
  11979. dijit.focus = function(node){
  11980. singleton.focus(node); // indirection here allows dijit/_base/focus.js to override behavior
  11981. };
  11982. for(var attr in singleton){
  11983. if(!/^_/.test(attr)){
  11984. dijit.focus[attr] = typeof singleton[attr] == "function" ? lang.hitch(singleton, attr) : singleton[attr];
  11985. }
  11986. }
  11987. singleton.watch(function(attr, oldVal, newVal){
  11988. dijit.focus[attr] = newVal;
  11989. });
  11990. return singleton;
  11991. });
  11992. },
  11993. 'dojox/charting/widget/Legend':function(){
  11994. define("dojox/charting/widget/Legend", ["dojo/_base/lang", "dojo/_base/html", "dojo/_base/declare", "dijit/_Widget", "dojox/gfx","dojo/_base/array",
  11995. "dojox/lang/functional", "dojox/lang/functional/array", "dojox/lang/functional/fold",
  11996. "dojo/dom", "dojo/dom-construct", "dojo/dom-class","dijit/_base/manager"],
  11997. function(lang, html, declare, Widget, gfx, arrayUtil, df, dfa, dff,
  11998. dom, domFactory, domClass, widgetManager){
  11999. /*=====
  12000. var Widget = dijit._Widget;
  12001. =====*/
  12002. var REVERSED_SERIES = /\.(StackedColumns|StackedAreas|ClusteredBars)$/;
  12003. return declare("dojox.charting.widget.Legend", Widget, {
  12004. // summary: A legend for a chart. A legend contains summary labels for
  12005. // each series of data contained in the chart.
  12006. //
  12007. // Set the horizontal attribute to boolean false to layout legend labels vertically.
  12008. // Set the horizontal attribute to a number to layout legend labels in horizontal
  12009. // rows each containing that number of labels (except possibly the last row).
  12010. //
  12011. // (Line or Scatter charts (colored lines with shape symbols) )
  12012. // -o- Series1 -X- Series2 -v- Series3
  12013. //
  12014. // (Area/Bar/Pie charts (letters represent colors))
  12015. // [a] Series1 [b] Series2 [c] Series3
  12016. chartRef: "",
  12017. horizontal: true,
  12018. swatchSize: 18,
  12019. legendBody: null,
  12020. postCreate: function(){
  12021. if(!this.chart){
  12022. if(!this.chartRef){ return; }
  12023. this.chart = widgetManager.byId(this.chartRef);
  12024. if(!this.chart){
  12025. var node = dom.byId(this.chartRef);
  12026. if(node){
  12027. this.chart = widgetManager.byNode(node);
  12028. }else{
  12029. console.log("Could not find chart instance with id: " + this.chartRef);
  12030. return;
  12031. }
  12032. }
  12033. this.series = this.chart.chart.series;
  12034. }else{
  12035. this.series = this.chart.series;
  12036. }
  12037. this.refresh();
  12038. },
  12039. buildRendering: function(){
  12040. this.domNode = domFactory.create("table",
  12041. {role: "group", "aria-label": "chart legend", "class": "dojoxLegendNode"});
  12042. this.legendBody = domFactory.create("tbody", null, this.domNode);
  12043. this.inherited(arguments);
  12044. },
  12045. destroy: function(){
  12046. if(this._surfaces){
  12047. arrayUtil.forEach(this._surfaces, function(surface){
  12048. surface.destroy();
  12049. });
  12050. }
  12051. this.inherited(arguments);
  12052. },
  12053. refresh: function(){
  12054. // summary: regenerates the legend to reflect changes to the chart
  12055. // cleanup
  12056. if(this._surfaces){
  12057. arrayUtil.forEach(this._surfaces, function(surface){
  12058. surface.destroy();
  12059. });
  12060. }
  12061. this._surfaces = [];
  12062. while(this.legendBody.lastChild){
  12063. domFactory.destroy(this.legendBody.lastChild);
  12064. }
  12065. if(this.horizontal){
  12066. domClass.add(this.domNode, "dojoxLegendHorizontal");
  12067. // make a container <tr>
  12068. this._tr = domFactory.create("tr", null, this.legendBody);
  12069. this._inrow = 0;
  12070. }
  12071. var s = this.series;
  12072. if(s.length == 0){
  12073. return;
  12074. }
  12075. if(s[0].chart.stack[0].declaredClass == "dojox.charting.plot2d.Pie"){
  12076. var t = s[0].chart.stack[0];
  12077. if(typeof t.run.data[0] == "number"){
  12078. var filteredRun = df.map(t.run.data, "Math.max(x, 0)");
  12079. if(df.every(filteredRun, "<= 0")){
  12080. return;
  12081. }
  12082. var slices = df.map(filteredRun, "/this", df.foldl(filteredRun, "+", 0));
  12083. arrayUtil.forEach(slices, function(x, i){
  12084. this._addLabel(t.dyn[i], t._getLabel(x * 100) + "%");
  12085. }, this);
  12086. }else{
  12087. arrayUtil.forEach(t.run.data, function(x, i){
  12088. this._addLabel(t.dyn[i], x.legend || x.text || x.y);
  12089. }, this);
  12090. }
  12091. }else{
  12092. if(this._isReversal()){
  12093. s = s.slice(0).reverse();
  12094. }
  12095. arrayUtil.forEach(s, function(x){
  12096. this._addLabel(x.dyn, x.legend || x.name);
  12097. }, this);
  12098. }
  12099. },
  12100. _addLabel: function(dyn, label){
  12101. // create necessary elements
  12102. var wrapper = domFactory.create("td"),
  12103. icon = domFactory.create("div", null, wrapper),
  12104. text = domFactory.create("label", null, wrapper),
  12105. div = domFactory.create("div", {
  12106. style: {
  12107. "width": this.swatchSize + "px",
  12108. "height":this.swatchSize + "px",
  12109. "float": "left"
  12110. }
  12111. }, icon);
  12112. domClass.add(icon, "dojoxLegendIcon dijitInline");
  12113. domClass.add(text, "dojoxLegendText");
  12114. // create a skeleton
  12115. if(this._tr){
  12116. // horizontal
  12117. this._tr.appendChild(wrapper);
  12118. if(++this._inrow === this.horizontal){
  12119. // make a fresh container <tr>
  12120. this._tr = domFactory.create("tr", null, this.legendBody);
  12121. this._inrow = 0;
  12122. }
  12123. }else{
  12124. // vertical
  12125. var tr = domFactory.create("tr", null, this.legendBody);
  12126. tr.appendChild(wrapper);
  12127. }
  12128. // populate the skeleton
  12129. this._makeIcon(div, dyn);
  12130. text.innerHTML = String(label);
  12131. text.dir = this.getTextDir(label, text.dir);
  12132. },
  12133. _makeIcon: function(div, dyn){
  12134. var mb = { h: this.swatchSize, w: this.swatchSize };
  12135. var surface = gfx.createSurface(div, mb.w, mb.h);
  12136. this._surfaces.push(surface);
  12137. if(dyn.fill){
  12138. // regions
  12139. surface.createRect({x: 2, y: 2, width: mb.w - 4, height: mb.h - 4}).
  12140. setFill(dyn.fill).setStroke(dyn.stroke);
  12141. }else if(dyn.stroke || dyn.marker){
  12142. // draw line
  12143. var line = {x1: 0, y1: mb.h / 2, x2: mb.w, y2: mb.h / 2};
  12144. if(dyn.stroke){
  12145. surface.createLine(line).setStroke(dyn.stroke);
  12146. }
  12147. if(dyn.marker){
  12148. // draw marker on top
  12149. var c = {x: mb.w / 2, y: mb.h / 2};
  12150. if(dyn.stroke){
  12151. surface.createPath({path: "M" + c.x + " " + c.y + " " + dyn.marker}).
  12152. setFill(dyn.stroke.color).setStroke(dyn.stroke);
  12153. }else{
  12154. surface.createPath({path: "M" + c.x + " " + c.y + " " + dyn.marker}).
  12155. setFill(dyn.color).setStroke(dyn.color);
  12156. }
  12157. }
  12158. }else{
  12159. // nothing
  12160. surface.createRect({x: 2, y: 2, width: mb.w - 4, height: mb.h - 4}).
  12161. setStroke("black");
  12162. surface.createLine({x1: 2, y1: 2, x2: mb.w - 2, y2: mb.h - 2}).setStroke("black");
  12163. surface.createLine({x1: 2, y1: mb.h - 2, x2: mb.w - 2, y2: 2}).setStroke("black");
  12164. }
  12165. },
  12166. _isReversal: function(){
  12167. return (!this.horizontal) && arrayUtil.some(this.chart.stack, function(item){
  12168. return REVERSED_SERIES.test(item.declaredClass);
  12169. });
  12170. }
  12171. });
  12172. });
  12173. },
  12174. 'dojox/charting/plot2d/StackedLines':function(){
  12175. define("dojox/charting/plot2d/StackedLines", ["dojo/_base/declare", "./Stacked"], function(declare, Stacked){
  12176. /*=====
  12177. var Stacked = dojox.charting.plot2d.Stacked;
  12178. =====*/
  12179. return declare("dojox.charting.plot2d.StackedLines", Stacked, {
  12180. // summary:
  12181. // A convenience object to create a stacked line chart.
  12182. constructor: function(){
  12183. // summary:
  12184. // Force our Stacked base to be lines only.
  12185. this.opt.lines = true;
  12186. }
  12187. });
  12188. });
  12189. },
  12190. 'dojox/charting/plot2d/StackedColumns':function(){
  12191. define("dojox/charting/plot2d/StackedColumns", ["dojo/_base/lang", "dojo/_base/array", "dojo/_base/declare", "./Columns", "./common",
  12192. "dojox/lang/functional", "dojox/lang/functional/reversed", "dojox/lang/functional/sequence"],
  12193. function(lang, arr, declare, Columns, dc, df, dfr, dfs){
  12194. var purgeGroup = dfr.lambda("item.purgeGroup()");
  12195. /*=====
  12196. var Columns = dojox.charting.plot2d.Columns;
  12197. =====*/
  12198. return declare("dojox.charting.plot2d.StackedColumns", Columns, {
  12199. // summary:
  12200. // The plot object representing a stacked column chart (vertical bars).
  12201. getSeriesStats: function(){
  12202. // summary:
  12203. // Calculate the min/max on all attached series in both directions.
  12204. // returns: Object
  12205. // {hmin, hmax, vmin, vmax} min/max in both directions.
  12206. var stats = dc.collectStackedStats(this.series);
  12207. this._maxRunLength = stats.hmax;
  12208. stats.hmin -= 0.5;
  12209. stats.hmax += 0.5;
  12210. return stats;
  12211. },
  12212. render: function(dim, offsets){
  12213. // summary:
  12214. // Run the calculations for any axes for this plot.
  12215. // dim: Object
  12216. // An object in the form of { width, height }
  12217. // offsets: Object
  12218. // An object of the form { l, r, t, b}.
  12219. // returns: dojox.charting.plot2d.StackedColumns
  12220. // A reference to this plot for functional chaining.
  12221. if(this._maxRunLength <= 0){
  12222. return this;
  12223. }
  12224. // stack all values
  12225. var acc = df.repeat(this._maxRunLength, "-> 0", 0);
  12226. for(var i = 0; i < this.series.length; ++i){
  12227. var run = this.series[i];
  12228. for(var j = 0; j < run.data.length; ++j){
  12229. var value = run.data[j];
  12230. if(value !== null){
  12231. var v = typeof value == "number" ? value : value.y;
  12232. if(isNaN(v)){ v = 0; }
  12233. acc[j] += v;
  12234. }
  12235. }
  12236. }
  12237. // draw runs in backwards
  12238. if(this.zoom && !this.isDataDirty()){
  12239. return this.performZoom(dim, offsets);
  12240. }
  12241. this.resetEvents();
  12242. this.dirty = this.isDirty();
  12243. if(this.dirty){
  12244. arr.forEach(this.series, purgeGroup);
  12245. this._eventSeries = {};
  12246. this.cleanGroup();
  12247. var s = this.group;
  12248. df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
  12249. }
  12250. var t = this.chart.theme, f, gap, width,
  12251. ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
  12252. vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
  12253. events = this.events();
  12254. f = dc.calculateBarSize(this._hScaler.bounds.scale, this.opt);
  12255. gap = f.gap;
  12256. width = f.size;
  12257. for(var i = this.series.length - 1; i >= 0; --i){
  12258. var run = this.series[i];
  12259. if(!this.dirty && !run.dirty){
  12260. t.skip();
  12261. this._reconnectEvents(run.name);
  12262. continue;
  12263. }
  12264. run.cleanGroup();
  12265. var theme = t.next("column", [this.opt, run]), s = run.group,
  12266. eventSeries = new Array(acc.length);
  12267. for(var j = 0; j < acc.length; ++j){
  12268. var value = run.data[j];
  12269. if(value !== null){
  12270. var v = acc[j],
  12271. height = vt(v),
  12272. finalTheme = typeof value != "number" ?
  12273. t.addMixin(theme, "column", value, true) :
  12274. t.post(theme, "column");
  12275. if(width >= 1 && height >= 0){
  12276. var rect = {
  12277. x: offsets.l + ht(j + 0.5) + gap,
  12278. y: dim.height - offsets.b - vt(v),
  12279. width: width, height: height
  12280. };
  12281. var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
  12282. specialFill = this._shapeFill(specialFill, rect);
  12283. var shape = s.createRect(rect).setFill(specialFill).setStroke(finalTheme.series.stroke);
  12284. run.dyn.fill = shape.getFill();
  12285. run.dyn.stroke = shape.getStroke();
  12286. if(events){
  12287. var o = {
  12288. element: "column",
  12289. index: j,
  12290. run: run,
  12291. shape: shape,
  12292. x: j + 0.5,
  12293. y: v
  12294. };
  12295. this._connectEvents(o);
  12296. eventSeries[j] = o;
  12297. }
  12298. if(this.animate){
  12299. this._animateColumn(shape, dim.height - offsets.b, height);
  12300. }
  12301. }
  12302. }
  12303. }
  12304. this._eventSeries[run.name] = eventSeries;
  12305. run.dirty = false;
  12306. // update the accumulator
  12307. for(var j = 0; j < run.data.length; ++j){
  12308. var value = run.data[j];
  12309. if(value !== null){
  12310. var v = typeof value == "number" ? value : value.y;
  12311. if(isNaN(v)){ v = 0; }
  12312. acc[j] -= v;
  12313. }
  12314. }
  12315. }
  12316. this.dirty = false;
  12317. return this; // dojox.charting.plot2d.StackedColumns
  12318. }
  12319. });
  12320. });
  12321. },
  12322. 'dojox/charting/Series':function(){
  12323. define("dojox/charting/Series", ["dojo/_base/lang", "dojo/_base/declare", "./Element"],
  12324. function(lang, declare, Element){
  12325. /*=====
  12326. dojox.charting.__SeriesCtorArgs = function(plot){
  12327. // summary:
  12328. // An optional arguments object that can be used in the Series constructor.
  12329. // plot: String?
  12330. // The plot (by name) that this series belongs to.
  12331. this.plot = plot;
  12332. }
  12333. var Element = dojox.charting.Element;
  12334. =====*/
  12335. return declare("dojox.charting.Series", Element, {
  12336. // summary:
  12337. // An object representing a series of data for plotting on a chart.
  12338. constructor: function(chart, data, kwArgs){
  12339. // summary:
  12340. // Create a new data series object for use within charting.
  12341. // chart: dojox.charting.Chart
  12342. // The chart that this series belongs to.
  12343. // data: Array|Object:
  12344. // The array of data points (either numbers or objects) that
  12345. // represents the data to be drawn. Or it can be an object. In
  12346. // the latter case, it should have a property "data" (an array),
  12347. // destroy(), and setSeriesObject().
  12348. // kwArgs: dojox.charting.__SeriesCtorArgs?
  12349. // An optional keyword arguments object to set details for this series.
  12350. lang.mixin(this, kwArgs);
  12351. if(typeof this.plot != "string"){ this.plot = "default"; }
  12352. this.update(data);
  12353. },
  12354. clear: function(){
  12355. // summary:
  12356. // Clear the calculated additional parameters set on this series.
  12357. this.dyn = {};
  12358. },
  12359. update: function(data){
  12360. // summary:
  12361. // Set data and make this object dirty, so it can be redrawn.
  12362. // data: Array|Object:
  12363. // The array of data points (either numbers or objects) that
  12364. // represents the data to be drawn. Or it can be an object. In
  12365. // the latter case, it should have a property "data" (an array),
  12366. // destroy(), and setSeriesObject().
  12367. if(lang.isArray(data)){
  12368. this.data = data;
  12369. }else{
  12370. this.source = data;
  12371. this.data = this.source.data;
  12372. if(this.source.setSeriesObject){
  12373. this.source.setSeriesObject(this);
  12374. }
  12375. }
  12376. this.dirty = true;
  12377. this.clear();
  12378. }
  12379. });
  12380. });
  12381. },
  12382. 'dojox/charting/plot2d/Default':function(){
  12383. define("dojox/charting/plot2d/Default", ["dojo/_base/lang", "dojo/_base/declare", "dojo/_base/array",
  12384. "./Base", "./common", "dojox/lang/functional", "dojox/lang/functional/reversed", "dojox/lang/utils", "dojox/gfx/fx"],
  12385. function(lang, declare, arr, Base, dc, df, dfr, du, fx){
  12386. /*=====
  12387. dojo.declare("dojox.charting.plot2d.__DefaultCtorArgs", dojox.charting.plot2d.__PlotCtorArgs, {
  12388. // summary:
  12389. // The arguments used for any/most plots.
  12390. // hAxis: String?
  12391. // The horizontal axis name.
  12392. hAxis: "x",
  12393. // vAxis: String?
  12394. // The vertical axis name
  12395. vAxis: "y",
  12396. // lines: Boolean?
  12397. // Whether or not to draw lines on this plot. Defaults to true.
  12398. lines: true,
  12399. // areas: Boolean?
  12400. // Whether or not to draw areas on this plot. Defaults to false.
  12401. areas: false,
  12402. // markers: Boolean?
  12403. // Whether or not to draw markers at data points on this plot. Default is false.
  12404. markers: false,
  12405. // tension: Number|String?
  12406. // Whether or not to apply 'tensioning' to the lines on this chart.
  12407. // Options include a number, "X", "x", or "S"; if a number is used, the
  12408. // simpler bezier curve calculations are used to draw the lines. If X, x or S
  12409. // is used, the more accurate smoothing algorithm is used.
  12410. tension: "",
  12411. // animate: Boolean?
  12412. // Whether or not to animate the chart to place.
  12413. animate: false,
  12414. // stroke: dojox.gfx.Stroke?
  12415. // An optional stroke to use for any series on the plot.
  12416. stroke: {},
  12417. // outline: dojox.gfx.Stroke?
  12418. // An optional stroke used to outline any series on the plot.
  12419. outline: {},
  12420. // shadow: dojox.gfx.Stroke?
  12421. // An optional stroke to use to draw any shadows for a series on a plot.
  12422. shadow: {},
  12423. // fill: dojox.gfx.Fill?
  12424. // Any fill to be used for elements on the plot (such as areas).
  12425. fill: {},
  12426. // font: String?
  12427. // A font definition to be used for labels and other text-based elements on the plot.
  12428. font: "",
  12429. // fontColor: String|dojo.Color?
  12430. // The color to be used for any text-based elements on the plot.
  12431. fontColor: "",
  12432. // markerStroke: dojo.gfx.Stroke?
  12433. // An optional stroke to use for any markers on the plot.
  12434. markerStroke: {},
  12435. // markerOutline: dojo.gfx.Stroke?
  12436. // An optional outline to use for any markers on the plot.
  12437. markerOutline: {},
  12438. // markerShadow: dojo.gfx.Stroke?
  12439. // An optional shadow to use for any markers on the plot.
  12440. markerShadow: {},
  12441. // markerFill: dojo.gfx.Fill?
  12442. // An optional fill to use for any markers on the plot.
  12443. markerFill: {},
  12444. // markerFont: String?
  12445. // An optional font definition to use for any markers on the plot.
  12446. markerFont: "",
  12447. // markerFontColor: String|dojo.Color?
  12448. // An optional color to use for any marker text on the plot.
  12449. markerFontColor: "",
  12450. // enableCache: Boolean?
  12451. // Whether the markers are cached from one rendering to another. This improves the rendering performance of
  12452. // successive rendering but penalize the first rendering. Default false.
  12453. enableCache: false
  12454. });
  12455. var Base = dojox.charting.plot2d.Base;
  12456. =====*/
  12457. var purgeGroup = dfr.lambda("item.purgeGroup()");
  12458. var DEFAULT_ANIMATION_LENGTH = 1200; // in ms
  12459. return declare("dojox.charting.plot2d.Default", Base, {
  12460. defaultParams: {
  12461. hAxis: "x", // use a horizontal axis named "x"
  12462. vAxis: "y", // use a vertical axis named "y"
  12463. lines: true, // draw lines
  12464. areas: false, // draw areas
  12465. markers: false, // draw markers
  12466. tension: "", // draw curved lines (tension is "X", "x", or "S")
  12467. animate: false, // animate chart to place
  12468. enableCache: false
  12469. },
  12470. optionalParams: {
  12471. // theme component
  12472. stroke: {},
  12473. outline: {},
  12474. shadow: {},
  12475. fill: {},
  12476. font: "",
  12477. fontColor: "",
  12478. markerStroke: {},
  12479. markerOutline: {},
  12480. markerShadow: {},
  12481. markerFill: {},
  12482. markerFont: "",
  12483. markerFontColor: ""
  12484. },
  12485. constructor: function(chart, kwArgs){
  12486. // summary:
  12487. // Return a new plot.
  12488. // chart: dojox.charting.Chart
  12489. // The chart this plot belongs to.
  12490. // kwArgs: dojox.charting.plot2d.__DefaultCtorArgs?
  12491. // An optional arguments object to help define this plot.
  12492. this.opt = lang.clone(this.defaultParams);
  12493. du.updateWithObject(this.opt, kwArgs);
  12494. du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
  12495. this.series = [];
  12496. this.hAxis = this.opt.hAxis;
  12497. this.vAxis = this.opt.vAxis;
  12498. // animation properties
  12499. this.animate = this.opt.animate;
  12500. },
  12501. createPath: function(run, creator, params){
  12502. var path;
  12503. if(this.opt.enableCache && run._pathFreePool.length > 0){
  12504. path = run._pathFreePool.pop();
  12505. path.setShape(params);
  12506. // was cleared, add it back
  12507. creator.add(path);
  12508. }else{
  12509. path = creator.createPath(params);
  12510. }
  12511. if(this.opt.enableCache){
  12512. run._pathUsePool.push(path);
  12513. }
  12514. return path;
  12515. },
  12516. render: function(dim, offsets){
  12517. // summary:
  12518. // Render/draw everything on this plot.
  12519. // dim: Object
  12520. // An object of the form { width, height }
  12521. // offsets: Object
  12522. // An object of the form { l, r, t, b }
  12523. // returns: dojox.charting.plot2d.Default
  12524. // A reference to this plot for functional chaining.
  12525. // make sure all the series is not modified
  12526. if(this.zoom && !this.isDataDirty()){
  12527. return this.performZoom(dim, offsets);
  12528. }
  12529. this.resetEvents();
  12530. this.dirty = this.isDirty();
  12531. if(this.dirty){
  12532. arr.forEach(this.series, purgeGroup);
  12533. this._eventSeries = {};
  12534. this.cleanGroup();
  12535. this.group.setTransform(null);
  12536. var s = this.group;
  12537. df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
  12538. }
  12539. var t = this.chart.theme, stroke, outline, marker, events = this.events();
  12540. for(var i = this.series.length - 1; i >= 0; --i){
  12541. var run = this.series[i];
  12542. if(!this.dirty && !run.dirty){
  12543. t.skip();
  12544. this._reconnectEvents(run.name);
  12545. continue;
  12546. }
  12547. run.cleanGroup();
  12548. if(this.opt.enableCache){
  12549. run._pathFreePool = (run._pathFreePool?run._pathFreePool:[]).concat(run._pathUsePool?run._pathUsePool:[]);
  12550. run._pathUsePool = [];
  12551. }
  12552. if(!run.data.length){
  12553. run.dirty = false;
  12554. t.skip();
  12555. continue;
  12556. }
  12557. var theme = t.next(this.opt.areas ? "area" : "line", [this.opt, run], true),
  12558. s = run.group, rsegments = [], startindexes = [], rseg = null, lpoly,
  12559. ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
  12560. vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
  12561. eventSeries = this._eventSeries[run.name] = new Array(run.data.length);
  12562. // optim works only for index based case
  12563. var indexed = typeof run.data[0] == "number";
  12564. var min = indexed?Math.max(0, Math.floor(this._hScaler.bounds.from - 1)):0,
  12565. max = indexed?Math.min(run.data.length, Math.ceil(this._hScaler.bounds.to)):run.data.length;
  12566. // split the run data into dense segments (each containing no nulls)
  12567. for(var j = min; j < max; j++){
  12568. if(run.data[j] != null){
  12569. if(!rseg){
  12570. rseg = [];
  12571. startindexes.push(j);
  12572. rsegments.push(rseg);
  12573. }
  12574. rseg.push(run.data[j]);
  12575. }else{
  12576. rseg = null;
  12577. }
  12578. }
  12579. for(var seg = 0; seg < rsegments.length; seg++){
  12580. if(typeof rsegments[seg][0] == "number"){
  12581. lpoly = arr.map(rsegments[seg], function(v, i){
  12582. return {
  12583. x: ht(i + startindexes[seg] + 1) + offsets.l,
  12584. y: dim.height - offsets.b - vt(v)
  12585. };
  12586. }, this);
  12587. }else{
  12588. lpoly = arr.map(rsegments[seg], function(v, i){
  12589. return {
  12590. x: ht(v.x) + offsets.l,
  12591. y: dim.height - offsets.b - vt(v.y)
  12592. };
  12593. }, this);
  12594. }
  12595. var lpath = this.opt.tension ? dc.curve(lpoly, this.opt.tension) : "";
  12596. if(this.opt.areas && lpoly.length > 1){
  12597. var fill = theme.series.fill;
  12598. var apoly = lang.clone(lpoly);
  12599. if(this.opt.tension){
  12600. var apath = "L" + apoly[apoly.length-1].x + "," + (dim.height - offsets.b) +
  12601. " L" + apoly[0].x + "," + (dim.height - offsets.b) +
  12602. " L" + apoly[0].x + "," + apoly[0].y;
  12603. run.dyn.fill = s.createPath(lpath + " " + apath).setFill(fill).getFill();
  12604. } else {
  12605. apoly.push({x: lpoly[lpoly.length - 1].x, y: dim.height - offsets.b});
  12606. apoly.push({x: lpoly[0].x, y: dim.height - offsets.b});
  12607. apoly.push(lpoly[0]);
  12608. run.dyn.fill = s.createPolyline(apoly).setFill(fill).getFill();
  12609. }
  12610. }
  12611. if(this.opt.lines || this.opt.markers){
  12612. // need a stroke
  12613. stroke = theme.series.stroke;
  12614. if(theme.series.outline){
  12615. outline = run.dyn.outline = dc.makeStroke(theme.series.outline);
  12616. outline.width = 2 * outline.width + stroke.width;
  12617. }
  12618. }
  12619. if(this.opt.markers){
  12620. run.dyn.marker = theme.symbol;
  12621. }
  12622. var frontMarkers = null, outlineMarkers = null, shadowMarkers = null;
  12623. if(stroke && theme.series.shadow && lpoly.length > 1){
  12624. var shadow = theme.series.shadow,
  12625. spoly = arr.map(lpoly, function(c){
  12626. return {x: c.x + shadow.dx, y: c.y + shadow.dy};
  12627. });
  12628. if(this.opt.lines){
  12629. if(this.opt.tension){
  12630. run.dyn.shadow = s.createPath(dc.curve(spoly, this.opt.tension)).setStroke(shadow).getStroke();
  12631. } else {
  12632. run.dyn.shadow = s.createPolyline(spoly).setStroke(shadow).getStroke();
  12633. }
  12634. }
  12635. if(this.opt.markers && theme.marker.shadow){
  12636. shadow = theme.marker.shadow;
  12637. shadowMarkers = arr.map(spoly, function(c){
  12638. return this.createPath(run, s, "M" + c.x + " " + c.y + " " + theme.symbol).
  12639. setStroke(shadow).setFill(shadow.color);
  12640. }, this);
  12641. }
  12642. }
  12643. if(this.opt.lines && lpoly.length > 1){
  12644. if(outline){
  12645. if(this.opt.tension){
  12646. run.dyn.outline = s.createPath(lpath).setStroke(outline).getStroke();
  12647. } else {
  12648. run.dyn.outline = s.createPolyline(lpoly).setStroke(outline).getStroke();
  12649. }
  12650. }
  12651. if(this.opt.tension){
  12652. run.dyn.stroke = s.createPath(lpath).setStroke(stroke).getStroke();
  12653. } else {
  12654. run.dyn.stroke = s.createPolyline(lpoly).setStroke(stroke).getStroke();
  12655. }
  12656. }
  12657. if(this.opt.markers){
  12658. frontMarkers = new Array(lpoly.length);
  12659. outlineMarkers = new Array(lpoly.length);
  12660. outline = null;
  12661. if(theme.marker.outline){
  12662. outline = dc.makeStroke(theme.marker.outline);
  12663. outline.width = 2 * outline.width + (theme.marker.stroke ? theme.marker.stroke.width : 0);
  12664. }
  12665. arr.forEach(lpoly, function(c, i){
  12666. var path = "M" + c.x + " " + c.y + " " + theme.symbol;
  12667. if(outline){
  12668. outlineMarkers[i] = this.createPath(run, s, path).setStroke(outline);
  12669. }
  12670. frontMarkers[i] = this.createPath(run, s, path).setStroke(theme.marker.stroke).setFill(theme.marker.fill);
  12671. }, this);
  12672. run.dyn.markerFill = theme.marker.fill;
  12673. run.dyn.markerStroke = theme.marker.stroke;
  12674. if(events){
  12675. arr.forEach(frontMarkers, function(s, i){
  12676. var o = {
  12677. element: "marker",
  12678. index: i + startindexes[seg],
  12679. run: run,
  12680. shape: s,
  12681. outline: outlineMarkers[i] || null,
  12682. shadow: shadowMarkers && shadowMarkers[i] || null,
  12683. cx: lpoly[i].x,
  12684. cy: lpoly[i].y
  12685. };
  12686. if(typeof rsegments[seg][0] == "number"){
  12687. o.x = i + startindexes[seg] + 1;
  12688. o.y = rsegments[seg][i];
  12689. }else{
  12690. o.x = rsegments[seg][i].x;
  12691. o.y = rsegments[seg][i].y;
  12692. }
  12693. this._connectEvents(o);
  12694. eventSeries[i + startindexes[seg]] = o;
  12695. }, this);
  12696. }else{
  12697. delete this._eventSeries[run.name];
  12698. }
  12699. }
  12700. }
  12701. run.dirty = false;
  12702. }
  12703. if(this.animate){
  12704. // grow from the bottom
  12705. var plotGroup = this.group;
  12706. fx.animateTransform(lang.delegate({
  12707. shape: plotGroup,
  12708. duration: DEFAULT_ANIMATION_LENGTH,
  12709. transform:[
  12710. {name:"translate", start: [0, dim.height - offsets.b], end: [0, 0]},
  12711. {name:"scale", start: [1, 0], end:[1, 1]},
  12712. {name:"original"}
  12713. ]
  12714. }, this.animate)).play();
  12715. }
  12716. this.dirty = false;
  12717. return this; // dojox.charting.plot2d.Default
  12718. }
  12719. });
  12720. });
  12721. },
  12722. 'dijit/main':function(){
  12723. define("dijit/main", [
  12724. "dojo/_base/kernel"
  12725. ], function(dojo){
  12726. // module:
  12727. // dijit
  12728. // summary:
  12729. // The dijit package main module
  12730. return dojo.dijit;
  12731. });
  12732. },
  12733. 'dojox/charting/plot2d/Base':function(){
  12734. define("dojox/charting/plot2d/Base", ["dojo/_base/lang", "dojo/_base/declare", "dojo/_base/connect",
  12735. "../Element", "./_PlotEvents", "dojo/_base/array",
  12736. "../scaler/primitive", "./common", "dojox/gfx/fx"],
  12737. function(lang, declare, hub, Element, PlotEvents, arr, primitive, common, fx){
  12738. /*=====
  12739. var Element = dojox.charting.Element;
  12740. var PlotEvents = dojox.charting.plot2d._PlotEvents;
  12741. dojox.charting.plot2d.__PlotCtorArgs = function(){
  12742. // summary:
  12743. // The base keyword arguments object for plot constructors.
  12744. // Note that the parameters for this may change based on the
  12745. // specific plot type (see the corresponding plot type for
  12746. // details).
  12747. }
  12748. =====*/
  12749. return declare("dojox.charting.plot2d.Base", [Element, PlotEvents], {
  12750. constructor: function(chart, kwArgs){
  12751. // summary:
  12752. // Create a base plot for charting.
  12753. // chart: dojox.chart.Chart
  12754. // The chart this plot belongs to.
  12755. // kwArgs: dojox.charting.plot2d.__PlotCtorArgs?
  12756. // An optional arguments object to help define the plot.
  12757. this.zoom = null,
  12758. this.zoomQueue = []; // zooming action task queue
  12759. this.lastWindow = {vscale: 1, hscale: 1, xoffset: 0, yoffset: 0};
  12760. },
  12761. clear: function(){
  12762. // summary:
  12763. // Clear out all of the information tied to this plot.
  12764. // returns: dojox.charting.plot2d.Base
  12765. // A reference to this plot for functional chaining.
  12766. this.series = [];
  12767. this._hAxis = null;
  12768. this._vAxis = null;
  12769. this.dirty = true;
  12770. return this; // dojox.charting.plot2d.Base
  12771. },
  12772. setAxis: function(axis){
  12773. // summary:
  12774. // Set an axis for this plot.
  12775. // axis: dojox.charting.axis2d.Base
  12776. // The axis to set.
  12777. // returns: dojox.charting.plot2d.Base
  12778. // A reference to this plot for functional chaining.
  12779. if(axis){
  12780. this[axis.vertical ? "_vAxis" : "_hAxis"] = axis;
  12781. }
  12782. return this; // dojox.charting.plot2d.Base
  12783. },
  12784. toPage: function(coord){
  12785. // summary:
  12786. // Compute page coordinates from plot axis data coordinates.
  12787. // coord: Object?
  12788. // The coordinates in plot axis data coordinate space. For cartesian charts that is of the following form:
  12789. // `{ hAxisName: 50, vAxisName: 200 }`
  12790. // If not provided return the tranform method instead of the result of the transformation.
  12791. // returns: Object
  12792. // The resulting page pixel coordinates. That is of the following form:
  12793. // `{ x: 50, y: 200 }`
  12794. var ah = this._hAxis, av = this._vAxis,
  12795. sh = ah.getScaler(), sv = av.getScaler(),
  12796. th = sh.scaler.getTransformerFromModel(sh),
  12797. tv = sv.scaler.getTransformerFromModel(sv),
  12798. c = this.chart.getCoords(),
  12799. o = this.chart.offsets, dim = this.chart.dim;
  12800. var t = function(coord){
  12801. var r = {};
  12802. r.x = th(coord[ah.name]) + c.x + o.l;
  12803. r.y = c.y + dim.height - o.b - tv(coord[av.name]);
  12804. return r;
  12805. };
  12806. // if no coord return the function so that we can capture the current transforms
  12807. // and reuse them later on
  12808. return coord?t(coord):t;
  12809. },
  12810. toData: function(coord){
  12811. // summary:
  12812. // Compute plot axis data coordinates from page coordinates.
  12813. // coord: Object
  12814. // The pixel coordinate in page coordinate space. That is of the following form:
  12815. // `{ x: 50, y: 200 }`
  12816. // If not provided return the tranform method instead of the result of the transformation.
  12817. // returns: Object
  12818. // The resulting plot axis data coordinates. For cartesian charts that is of the following form:
  12819. // `{ hAxisName: 50, vAxisName: 200 }`
  12820. var ah = this._hAxis, av = this._vAxis,
  12821. sh = ah.getScaler(), sv = av.getScaler(),
  12822. th = sh.scaler.getTransformerFromPlot(sh),
  12823. tv = sv.scaler.getTransformerFromPlot(sv),
  12824. c = this.chart.getCoords(),
  12825. o = this.chart.offsets, dim = this.chart.dim;
  12826. var t = function(coord){
  12827. var r = {};
  12828. r[ah.name] = th(coord.x - c.x - o.l);
  12829. r[av.name] = tv(c.y + dim.height - coord.y - o.b);
  12830. return r;
  12831. };
  12832. // if no coord return the function so that we can capture the current transforms
  12833. // and reuse them later on
  12834. return coord?t(coord):t;
  12835. },
  12836. addSeries: function(run){
  12837. // summary:
  12838. // Add a data series to this plot.
  12839. // run: dojox.charting.Series
  12840. // The series to be added.
  12841. // returns: dojox.charting.plot2d.Base
  12842. // A reference to this plot for functional chaining.
  12843. this.series.push(run);
  12844. return this; // dojox.charting.plot2d.Base
  12845. },
  12846. getSeriesStats: function(){
  12847. // summary:
  12848. // Calculate the min/max on all attached series in both directions.
  12849. // returns: Object
  12850. // {hmin, hmax, vmin, vmax} min/max in both directions.
  12851. return common.collectSimpleStats(this.series);
  12852. },
  12853. calculateAxes: function(dim){
  12854. // summary:
  12855. // Stub function for running the axis calculations (depricated).
  12856. // dim: Object
  12857. // An object of the form { width, height }
  12858. // returns: dojox.charting.plot2d.Base
  12859. // A reference to this plot for functional chaining.
  12860. this.initializeScalers(dim, this.getSeriesStats());
  12861. return this; // dojox.charting.plot2d.Base
  12862. },
  12863. isDirty: function(){
  12864. // summary:
  12865. // Returns whether or not this plot needs to be rendered.
  12866. // returns: Boolean
  12867. // The state of the plot.
  12868. return this.dirty || this._hAxis && this._hAxis.dirty || this._vAxis && this._vAxis.dirty; // Boolean
  12869. },
  12870. isDataDirty: function(){
  12871. // summary:
  12872. // Returns whether or not any of this plot's data series need to be rendered.
  12873. // returns: Boolean
  12874. // Flag indicating if any of this plot's series are invalid and need rendering.
  12875. return arr.some(this.series, function(item){ return item.dirty; }); // Boolean
  12876. },
  12877. performZoom: function(dim, offsets){
  12878. // summary:
  12879. // Create/alter any zooming windows on this plot.
  12880. // dim: Object
  12881. // An object of the form { width, height }.
  12882. // offsets: Object
  12883. // An object of the form { l, r, t, b }.
  12884. // returns: dojox.charting.plot2d.Base
  12885. // A reference to this plot for functional chaining.
  12886. // get current zooming various
  12887. var vs = this._vAxis.scale || 1,
  12888. hs = this._hAxis.scale || 1,
  12889. vOffset = dim.height - offsets.b,
  12890. hBounds = this._hScaler.bounds,
  12891. xOffset = (hBounds.from - hBounds.lower) * hBounds.scale,
  12892. vBounds = this._vScaler.bounds,
  12893. yOffset = (vBounds.from - vBounds.lower) * vBounds.scale,
  12894. // get incremental zooming various
  12895. rVScale = vs / this.lastWindow.vscale,
  12896. rHScale = hs / this.lastWindow.hscale,
  12897. rXOffset = (this.lastWindow.xoffset - xOffset)/
  12898. ((this.lastWindow.hscale == 1)? hs : this.lastWindow.hscale),
  12899. rYOffset = (yOffset - this.lastWindow.yoffset)/
  12900. ((this.lastWindow.vscale == 1)? vs : this.lastWindow.vscale),
  12901. shape = this.group,
  12902. anim = fx.animateTransform(lang.delegate({
  12903. shape: shape,
  12904. duration: 1200,
  12905. transform:[
  12906. {name:"translate", start:[0, 0], end: [offsets.l * (1 - rHScale), vOffset * (1 - rVScale)]},
  12907. {name:"scale", start:[1, 1], end: [rHScale, rVScale]},
  12908. {name:"original"},
  12909. {name:"translate", start: [0, 0], end: [rXOffset, rYOffset]}
  12910. ]}, this.zoom));
  12911. lang.mixin(this.lastWindow, {vscale: vs, hscale: hs, xoffset: xOffset, yoffset: yOffset});
  12912. //add anim to zooming action queue,
  12913. //in order to avoid several zooming action happened at the same time
  12914. this.zoomQueue.push(anim);
  12915. //perform each anim one by one in zoomQueue
  12916. hub.connect(anim, "onEnd", this, function(){
  12917. this.zoom = null;
  12918. this.zoomQueue.shift();
  12919. if(this.zoomQueue.length > 0){
  12920. this.zoomQueue[0].play();
  12921. }
  12922. });
  12923. if(this.zoomQueue.length == 1){
  12924. this.zoomQueue[0].play();
  12925. }
  12926. return this; // dojox.charting.plot2d.Base
  12927. },
  12928. render: function(dim, offsets){
  12929. // summary:
  12930. // Render the plot on the chart.
  12931. // dim: Object
  12932. // An object of the form { width, height }.
  12933. // offsets: Object
  12934. // An object of the form { l, r, t, b }.
  12935. // returns: dojox.charting.plot2d.Base
  12936. // A reference to this plot for functional chaining.
  12937. return this; // dojox.charting.plot2d.Base
  12938. },
  12939. getRequiredColors: function(){
  12940. // summary:
  12941. // Get how many data series we have, so we know how many colors to use.
  12942. // returns: Number
  12943. // The number of colors needed.
  12944. return this.series.length; // Number
  12945. },
  12946. initializeScalers: function(dim, stats){
  12947. // summary:
  12948. // Initializes scalers using attached axes.
  12949. // dim: Object:
  12950. // Size of a plot area in pixels as {width, height}.
  12951. // stats: Object:
  12952. // Min/max of data in both directions as {hmin, hmax, vmin, vmax}.
  12953. // returns: dojox.charting.plot2d.Base
  12954. // A reference to this plot for functional chaining.
  12955. if(this._hAxis){
  12956. if(!this._hAxis.initialized()){
  12957. this._hAxis.calculate(stats.hmin, stats.hmax, dim.width);
  12958. }
  12959. this._hScaler = this._hAxis.getScaler();
  12960. }else{
  12961. this._hScaler = primitive.buildScaler(stats.hmin, stats.hmax, dim.width);
  12962. }
  12963. if(this._vAxis){
  12964. if(!this._vAxis.initialized()){
  12965. this._vAxis.calculate(stats.vmin, stats.vmax, dim.height);
  12966. }
  12967. this._vScaler = this._vAxis.getScaler();
  12968. }else{
  12969. this._vScaler = primitive.buildScaler(stats.vmin, stats.vmax, dim.height);
  12970. }
  12971. return this; // dojox.charting.plot2d.Base
  12972. }
  12973. });
  12974. });
  12975. },
  12976. 'dojox/charting/action2d/Tooltip':function(){
  12977. define("dojox/charting/action2d/Tooltip", ["dojo/_base/kernel", "dijit/Tooltip","dojo/_base/lang", "dojo/_base/html", "dojo/_base/declare", "./PlotAction",
  12978. "dojox/gfx/matrix", "dojox/lang/functional", "dojox/lang/functional/scan", "dojox/lang/functional/fold"],
  12979. function(dojo, Tooltip, lang, html, declare, PlotAction, m, df, dfs, dff){
  12980. /*=====
  12981. dojo.declare("dojox.charting.action2d.__TooltipCtorArgs", dojox.charting.action2d.__PlotActionCtorArgs, {
  12982. // summary:
  12983. // Additional arguments for tooltip actions.
  12984. // text: Function?
  12985. // The function that produces the text to be shown within a tooltip. By default this will be
  12986. // set by the plot in question, by returning the value of the element.
  12987. text: null
  12988. });
  12989. var PlotAction = dojox.charting.action2d.PlotAction;
  12990. =====*/
  12991. var DEFAULT_TEXT = function(o){
  12992. var t = o.run && o.run.data && o.run.data[o.index];
  12993. if(t && typeof t != "number" && (t.tooltip || t.text)){
  12994. return t.tooltip || t.text;
  12995. }
  12996. if(o.element == "candlestick"){
  12997. return '<table cellpadding="1" cellspacing="0" border="0" style="font-size:0.9em;">'
  12998. + '<tr><td>Open:</td><td align="right"><strong>' + o.data.open + '</strong></td></tr>'
  12999. + '<tr><td>High:</td><td align="right"><strong>' + o.data.high + '</strong></td></tr>'
  13000. + '<tr><td>Low:</td><td align="right"><strong>' + o.data.low + '</strong></td></tr>'
  13001. + '<tr><td>Close:</td><td align="right"><strong>' + o.data.close + '</strong></td></tr>'
  13002. + (o.data.mid !== undefined ? '<tr><td>Mid:</td><td align="right"><strong>' + o.data.mid + '</strong></td></tr>' : '')
  13003. + '</table>';
  13004. }
  13005. return o.element == "bar" ? o.x : o.y;
  13006. };
  13007. var pi4 = Math.PI / 4, pi2 = Math.PI / 2;
  13008. return declare("dojox.charting.action2d.Tooltip", PlotAction, {
  13009. // summary:
  13010. // Create an action on a plot where a tooltip is shown when hovering over an element.
  13011. // the data description block for the widget parser
  13012. defaultParams: {
  13013. text: DEFAULT_TEXT // the function to produce a tooltip from the object
  13014. },
  13015. optionalParams: {}, // no optional parameters
  13016. constructor: function(chart, plot, kwArgs){
  13017. // summary:
  13018. // Create the tooltip action and connect it to the plot.
  13019. // chart: dojox.charting.Chart
  13020. // The chart this action belongs to.
  13021. // plot: String?
  13022. // The plot this action is attached to. If not passed, "default" is assumed.
  13023. // kwArgs: dojox.charting.action2d.__TooltipCtorArgs?
  13024. // Optional keyword arguments object for setting parameters.
  13025. this.text = kwArgs && kwArgs.text ? kwArgs.text : DEFAULT_TEXT;
  13026. this.connect();
  13027. },
  13028. process: function(o){
  13029. // summary:
  13030. // Process the action on the given object.
  13031. // o: dojox.gfx.Shape
  13032. // The object on which to process the highlighting action.
  13033. if(o.type === "onplotreset" || o.type === "onmouseout"){
  13034. Tooltip.hide(this.aroundRect);
  13035. this.aroundRect = null;
  13036. if(o.type === "onplotreset"){
  13037. delete this.angles;
  13038. }
  13039. return;
  13040. }
  13041. if(!o.shape || o.type !== "onmouseover"){ return; }
  13042. // calculate relative coordinates and the position
  13043. var aroundRect = {type: "rect"}, position = ["after", "before"];
  13044. switch(o.element){
  13045. case "marker":
  13046. aroundRect.x = o.cx;
  13047. aroundRect.y = o.cy;
  13048. aroundRect.w = aroundRect.h = 1;
  13049. break;
  13050. case "circle":
  13051. aroundRect.x = o.cx - o.cr;
  13052. aroundRect.y = o.cy - o.cr;
  13053. aroundRect.w = aroundRect.h = 2 * o.cr;
  13054. break;
  13055. case "column":
  13056. position = ["above", "below"];
  13057. // intentional fall down
  13058. case "bar":
  13059. aroundRect = lang.clone(o.shape.getShape());
  13060. aroundRect.w = aroundRect.width;
  13061. aroundRect.h = aroundRect.height;
  13062. break;
  13063. case "candlestick":
  13064. aroundRect.x = o.x;
  13065. aroundRect.y = o.y;
  13066. aroundRect.w = o.width;
  13067. aroundRect.h = o.height;
  13068. break;
  13069. default:
  13070. //case "slice":
  13071. if(!this.angles){
  13072. // calculate the running total of slice angles
  13073. if(typeof o.run.data[0] == "number"){
  13074. this.angles = df.map(df.scanl(o.run.data, "+", 0),
  13075. "* 2 * Math.PI / this", df.foldl(o.run.data, "+", 0));
  13076. }else{
  13077. this.angles = df.map(df.scanl(o.run.data, "a + b.y", 0),
  13078. "* 2 * Math.PI / this", df.foldl(o.run.data, "a + b.y", 0));
  13079. }
  13080. }
  13081. var startAngle = m._degToRad(o.plot.opt.startAngle),
  13082. angle = (this.angles[o.index] + this.angles[o.index + 1]) / 2 + startAngle;
  13083. aroundRect.x = o.cx + o.cr * Math.cos(angle);
  13084. aroundRect.y = o.cy + o.cr * Math.sin(angle);
  13085. aroundRect.w = aroundRect.h = 1;
  13086. // calculate the position
  13087. if(angle < pi4){
  13088. // do nothing: the position is right
  13089. }else if(angle < pi2 + pi4){
  13090. position = ["below", "above"];
  13091. }else if(angle < Math.PI + pi4){
  13092. position = ["before", "after"];
  13093. }else if(angle < 2 * Math.PI - pi4){
  13094. position = ["above", "below"];
  13095. }
  13096. /*
  13097. else{
  13098. // do nothing: the position is right
  13099. }
  13100. */
  13101. break;
  13102. }
  13103. // adjust relative coordinates to absolute, and remove fractions
  13104. var lt = this.chart.getCoords();
  13105. aroundRect.x += lt.x;
  13106. aroundRect.y += lt.y;
  13107. aroundRect.x = Math.round(aroundRect.x);
  13108. aroundRect.y = Math.round(aroundRect.y);
  13109. aroundRect.w = Math.ceil(aroundRect.w);
  13110. aroundRect.h = Math.ceil(aroundRect.h);
  13111. this.aroundRect = aroundRect;
  13112. var tooltip = this.text(o);
  13113. if(this.chart.getTextDir){
  13114. var isChartDirectionRtl = (html.style(this.chart.node,"direction") == "rtl");
  13115. var isBaseTextDirRtl = (this.chart.getTextDir(tooltip) == "rtl");
  13116. }
  13117. if(tooltip){
  13118. if(isBaseTextDirRtl && !isChartDirectionRtl){
  13119. Tooltip.show("<span dir = 'rtl'>" + tooltip +"</span>", this.aroundRect, position);
  13120. }
  13121. else if(!isBaseTextDirRtl && isChartDirectionRtl){
  13122. Tooltip.show("<span dir = 'ltr'>" + tooltip +"</span>", this.aroundRect, position);
  13123. }else{
  13124. Tooltip.show(tooltip, this.aroundRect, position);
  13125. }
  13126. }
  13127. }
  13128. });
  13129. });
  13130. },
  13131. 'dojox/gfx':function(){
  13132. require({cache:{
  13133. 'dojox/gfx/_base':function(){
  13134. define(["dojo/_base/lang", "dojo/_base/html", "dojo/_base/Color", "dojo/_base/sniff", "dojo/_base/window",
  13135. "dojo/_base/array","dojo/dom", "dojo/dom-construct","dojo/dom-geometry"],
  13136. function(lang, html, Color, has, win, arr, dom, domConstruct, domGeom){
  13137. // module:
  13138. // dojox/gfx
  13139. // summary:
  13140. // This module contains common core Graphics API used by different graphics renderers.
  13141. var g = lang.getObject("dojox.gfx", true),
  13142. b = g._base = {};
  13143. /*===== g = dojox.gfx; b = dojox.gfx._base; =====*/
  13144. // candidates for dojox.style (work on VML and SVG nodes)
  13145. g._hasClass = function(/*DomNode*/node, /*String*/classStr){
  13146. // summary:
  13147. // Returns whether or not the specified classes are a portion of the
  13148. // class list currently applied to the node.
  13149. // return (new RegExp('(^|\\s+)'+classStr+'(\\s+|$)')).test(node.className) // Boolean
  13150. var cls = node.getAttribute("className");
  13151. return cls && (" " + cls + " ").indexOf(" " + classStr + " ") >= 0; // Boolean
  13152. };
  13153. g._addClass = function(/*DomNode*/node, /*String*/classStr){
  13154. // summary:
  13155. // Adds the specified classes to the end of the class list on the
  13156. // passed node.
  13157. var cls = node.getAttribute("className") || "";
  13158. if(!cls || (" " + cls + " ").indexOf(" " + classStr + " ") < 0){
  13159. node.setAttribute("className", cls + (cls ? " " : "") + classStr);
  13160. }
  13161. };
  13162. g._removeClass = function(/*DomNode*/node, /*String*/classStr){
  13163. // summary: Removes classes from node.
  13164. var cls = node.getAttribute("className");
  13165. if(cls){
  13166. node.setAttribute(
  13167. "className",
  13168. cls.replace(new RegExp('(^|\\s+)' + classStr + '(\\s+|$)'), "$1$2")
  13169. );
  13170. }
  13171. };
  13172. // candidate for dojox.html.metrics (dynamic font resize handler is not implemented here)
  13173. // derived from Morris John's emResized measurer
  13174. b._getFontMeasurements = function(){
  13175. // summary:
  13176. // Returns an object that has pixel equivilents of standard font
  13177. // size values.
  13178. var heights = {
  13179. '1em': 0, '1ex': 0, '100%': 0, '12pt': 0, '16px': 0, 'xx-small': 0,
  13180. 'x-small': 0, 'small': 0, 'medium': 0, 'large': 0, 'x-large': 0,
  13181. 'xx-large': 0
  13182. };
  13183. var p;
  13184. if(has("ie")){
  13185. // we do a font-size fix if and only if one isn't applied already.
  13186. // NOTE: If someone set the fontSize on the HTML Element, this will kill it.
  13187. win.doc.documentElement.style.fontSize="100%";
  13188. }
  13189. // set up the measuring node.
  13190. var div = domConstruct.create("div", {style: {
  13191. position: "absolute",
  13192. left: "0",
  13193. top: "-100px",
  13194. width: "30px",
  13195. height: "1000em",
  13196. borderWidth: "0",
  13197. margin: "0",
  13198. padding: "0",
  13199. outline: "none",
  13200. lineHeight: "1",
  13201. overflow: "hidden"
  13202. }}, win.body());
  13203. // do the measurements.
  13204. for(p in heights){
  13205. div.style.fontSize = p;
  13206. heights[p] = Math.round(div.offsetHeight * 12/16) * 16/12 / 1000;
  13207. }
  13208. win.body().removeChild(div);
  13209. return heights; //object
  13210. };
  13211. var fontMeasurements = null;
  13212. b._getCachedFontMeasurements = function(recalculate){
  13213. if(recalculate || !fontMeasurements){
  13214. fontMeasurements = b._getFontMeasurements();
  13215. }
  13216. return fontMeasurements;
  13217. };
  13218. // candidate for dojox.html.metrics
  13219. var measuringNode = null, empty = {};
  13220. b._getTextBox = function( /*String*/ text,
  13221. /*Object*/ style,
  13222. /*String?*/ className){
  13223. var m, s, al = arguments.length;
  13224. var i;
  13225. if(!measuringNode){
  13226. measuringNode = domConstruct.create("div", {style: {
  13227. position: "absolute",
  13228. top: "-10000px",
  13229. left: "0"
  13230. }}, win.body());
  13231. }
  13232. m = measuringNode;
  13233. // reset styles
  13234. m.className = "";
  13235. s = m.style;
  13236. s.borderWidth = "0";
  13237. s.margin = "0";
  13238. s.padding = "0";
  13239. s.outline = "0";
  13240. // set new style
  13241. if(al > 1 && style){
  13242. for(i in style){
  13243. if(i in empty){ continue; }
  13244. s[i] = style[i];
  13245. }
  13246. }
  13247. // set classes
  13248. if(al > 2 && className){
  13249. m.className = className;
  13250. }
  13251. // take a measure
  13252. m.innerHTML = text;
  13253. if(m["getBoundingClientRect"]){
  13254. var bcr = m.getBoundingClientRect();
  13255. return {l: bcr.left, t: bcr.top, w: bcr.width || (bcr.right - bcr.left), h: bcr.height || (bcr.bottom - bcr.top)};
  13256. }else{
  13257. return domGeom.getMarginBox(m);
  13258. }
  13259. };
  13260. // candidate for dojo.dom
  13261. var uniqueId = 0;
  13262. b._getUniqueId = function(){
  13263. // summary: returns a unique string for use with any DOM element
  13264. var id;
  13265. do{
  13266. id = dojo._scopeName + "xUnique" + (++uniqueId);
  13267. }while(dom.byId(id));
  13268. return id;
  13269. };
  13270. lang.mixin(g, {
  13271. // summary:
  13272. // defines constants, prototypes, and utility functions for the core Graphics API
  13273. // default shapes, which are used to fill in missing parameters
  13274. defaultPath: {
  13275. // summary:
  13276. // Defines the default Path prototype object.
  13277. type: "path",
  13278. // type: String
  13279. // Specifies this object is a Path, default value 'path'.
  13280. path: ""
  13281. // path: String
  13282. // The path commands. See W32C SVG 1.0 specification.
  13283. // Defaults to empty string value.
  13284. },
  13285. defaultPolyline: {
  13286. // summary:
  13287. // Defines the default PolyLine prototype.
  13288. type: "polyline",
  13289. // type: String
  13290. // Specifies this object is a PolyLine, default value 'polyline'.
  13291. points: []
  13292. // points: Array
  13293. // An array of point objects [{x:0,y:0},...] defining the default polyline's line segments. Value is an empty array [].
  13294. },
  13295. defaultRect: {
  13296. // summary:
  13297. // Defines the default Rect prototype.
  13298. type: "rect",
  13299. // type: String
  13300. // Specifies this default object is a type of Rect. Value is 'rect'
  13301. x: 0,
  13302. // x: Number
  13303. // The X coordinate of the default rectangles position, value 0.
  13304. y: 0,
  13305. // y: Number
  13306. // The Y coordinate of the default rectangle's position, value 0.
  13307. width: 100,
  13308. // width: Number
  13309. // The width of the default rectangle, value 100.
  13310. height: 100,
  13311. // height: Number
  13312. // The height of the default rectangle, value 100.
  13313. r: 0
  13314. // r: Number
  13315. // The corner radius for the default rectangle, value 0.
  13316. },
  13317. defaultEllipse: {
  13318. // summary:
  13319. // Defines the default Ellipse prototype.
  13320. type: "ellipse",
  13321. // type: String
  13322. // Specifies that this object is a type of Ellipse, value is 'ellipse'
  13323. cx: 0,
  13324. // cx: Number
  13325. // The X coordinate of the center of the ellipse, default value 0.
  13326. cy: 0,
  13327. // cy: Number
  13328. // The Y coordinate of the center of the ellipse, default value 0.
  13329. rx: 200,
  13330. // rx: Number
  13331. // The radius of the ellipse in the X direction, default value 200.
  13332. ry: 100
  13333. // ry: Number
  13334. // The radius of the ellipse in the Y direction, default value 200.
  13335. },
  13336. defaultCircle: {
  13337. // summary:
  13338. // An object defining the default Circle prototype.
  13339. type: "circle",
  13340. // type: String
  13341. // Specifies this object is a circle, value 'circle'
  13342. cx: 0,
  13343. // cx: Number
  13344. // The X coordinate of the center of the circle, default value 0.
  13345. cy: 0,
  13346. // cy: Number
  13347. // The Y coordinate of the center of the circle, default value 0.
  13348. r: 100
  13349. // r: Number
  13350. // The radius, default value 100.
  13351. },
  13352. defaultLine: {
  13353. // summary:
  13354. // An pbject defining the default Line prototype.
  13355. type: "line",
  13356. // type: String
  13357. // Specifies this is a Line, value 'line'
  13358. x1: 0,
  13359. // x1: Number
  13360. // The X coordinate of the start of the line, default value 0.
  13361. y1: 0,
  13362. // y1: Number
  13363. // The Y coordinate of the start of the line, default value 0.
  13364. x2: 100,
  13365. // x2: Number
  13366. // The X coordinate of the end of the line, default value 100.
  13367. y2: 100
  13368. // y2: Number
  13369. // The Y coordinate of the end of the line, default value 100.
  13370. },
  13371. defaultImage: {
  13372. // summary:
  13373. // Defines the default Image prototype.
  13374. type: "image",
  13375. // type: String
  13376. // Specifies this object is an image, value 'image'.
  13377. x: 0,
  13378. // x: Number
  13379. // The X coordinate of the image's position, default value 0.
  13380. y: 0,
  13381. // y: Number
  13382. // The Y coordinate of the image's position, default value 0.
  13383. width: 0,
  13384. // width: Number
  13385. // The width of the image, default value 0.
  13386. height: 0,
  13387. // height:Number
  13388. // The height of the image, default value 0.
  13389. src: ""
  13390. // src: String
  13391. // The src url of the image, defaults to empty string.
  13392. },
  13393. defaultText: {
  13394. // summary:
  13395. // Defines the default Text prototype.
  13396. type: "text",
  13397. // type: String
  13398. // Specifies this is a Text shape, value 'text'.
  13399. x: 0,
  13400. // x: Number
  13401. // The X coordinate of the text position, default value 0.
  13402. y: 0,
  13403. // y: Number
  13404. // The Y coordinate of the text position, default value 0.
  13405. text: "",
  13406. // text: String
  13407. // The text to be displayed, default value empty string.
  13408. align: "start",
  13409. // align: String
  13410. // The horizontal text alignment, one of 'start', 'end', 'center'. Default value 'start'.
  13411. decoration: "none",
  13412. // decoration: String
  13413. // The text decoration , one of 'none', ... . Default value 'none'.
  13414. rotated: false,
  13415. // rotated: Boolean
  13416. // Whether the text is rotated, boolean default value false.
  13417. kerning: true
  13418. // kerning: Boolean
  13419. // Whether kerning is used on the text, boolean default value true.
  13420. },
  13421. defaultTextPath: {
  13422. // summary:
  13423. // Defines the default TextPath prototype.
  13424. type: "textpath",
  13425. // type: String
  13426. // Specifies this is a TextPath, value 'textpath'.
  13427. text: "",
  13428. // text: String
  13429. // The text to be displayed, default value empty string.
  13430. align: "start",
  13431. // align: String
  13432. // The horizontal text alignment, one of 'start', 'end', 'center'. Default value 'start'.
  13433. decoration: "none",
  13434. // decoration: String
  13435. // The text decoration , one of 'none', ... . Default value 'none'.
  13436. rotated: false,
  13437. // rotated: Boolean
  13438. // Whether the text is rotated, boolean default value false.
  13439. kerning: true
  13440. // kerning: Boolean
  13441. // Whether kerning is used on the text, boolean default value true.
  13442. },
  13443. // default stylistic attributes
  13444. defaultStroke: {
  13445. // summary:
  13446. // A stroke defines stylistic properties that are used when drawing a path.
  13447. // This object defines the default Stroke prototype.
  13448. type: "stroke",
  13449. // type: String
  13450. // Specifies this object is a type of Stroke, value 'stroke'.
  13451. color: "black",
  13452. // color: String
  13453. // The color of the stroke, default value 'black'.
  13454. style: "solid",
  13455. // style: String
  13456. // The style of the stroke, one of 'solid', ... . Default value 'solid'.
  13457. width: 1,
  13458. // width: Number
  13459. // The width of a stroke, default value 1.
  13460. cap: "butt",
  13461. // cap: String
  13462. // The endcap style of the path. One of 'butt', 'round', ... . Default value 'butt'.
  13463. join: 4
  13464. // join: Number
  13465. // The join style to use when combining path segments. Default value 4.
  13466. },
  13467. defaultLinearGradient: {
  13468. // summary:
  13469. // An object defining the default stylistic properties used for Linear Gradient fills.
  13470. // Linear gradients are drawn along a virtual line, which results in appearance of a rotated pattern in a given direction/orientation.
  13471. type: "linear",
  13472. // type: String
  13473. // Specifies this object is a Linear Gradient, value 'linear'
  13474. x1: 0,
  13475. // x1: Number
  13476. // The X coordinate of the start of the virtual line along which the gradient is drawn, default value 0.
  13477. y1: 0,
  13478. // y1: Number
  13479. // The Y coordinate of the start of the virtual line along which the gradient is drawn, default value 0.
  13480. x2: 100,
  13481. // x2: Number
  13482. // The X coordinate of the end of the virtual line along which the gradient is drawn, default value 100.
  13483. y2: 100,
  13484. // y2: Number
  13485. // The Y coordinate of the end of the virtual line along which the gradient is drawn, default value 100.
  13486. colors: [
  13487. { offset: 0, color: "black" }, { offset: 1, color: "white" }
  13488. ]
  13489. // colors: Array
  13490. // An array of colors at given offsets (from the start of the line). The start of the line is
  13491. // defined at offest 0 with the end of the line at offset 1.
  13492. // Default value, [{ offset: 0, color: 'black'},{offset: 1, color: 'white'}], is a gradient from black to white.
  13493. },
  13494. defaultRadialGradient: {
  13495. // summary:
  13496. // An object specifying the default properties for RadialGradients using in fills patterns.
  13497. type: "radial",
  13498. // type: String
  13499. // Specifies this is a RadialGradient, value 'radial'
  13500. cx: 0,
  13501. // cx: Number
  13502. // The X coordinate of the center of the radial gradient, default value 0.
  13503. cy: 0,
  13504. // cy: Number
  13505. // The Y coordinate of the center of the radial gradient, default value 0.
  13506. r: 100,
  13507. // r: Number
  13508. // The radius to the end of the radial gradient, default value 100.
  13509. colors: [
  13510. { offset: 0, color: "black" }, { offset: 1, color: "white" }
  13511. ]
  13512. // colors: Array
  13513. // An array of colors at given offsets (from the center of the radial gradient).
  13514. // The center is defined at offest 0 with the outer edge of the gradient at offset 1.
  13515. // Default value, [{ offset: 0, color: 'black'},{offset: 1, color: 'white'}], is a gradient from black to white.
  13516. },
  13517. defaultPattern: {
  13518. // summary:
  13519. // An object specifying the default properties for a Pattern using in fill operations.
  13520. type: "pattern",
  13521. // type: String
  13522. // Specifies this object is a Pattern, value 'pattern'.
  13523. x: 0,
  13524. // x: Number
  13525. // The X coordinate of the position of the pattern, default value is 0.
  13526. y: 0,
  13527. // y: Number
  13528. // The Y coordinate of the position of the pattern, default value is 0.
  13529. width: 0,
  13530. // width: Number
  13531. // The width of the pattern image, default value is 0.
  13532. height: 0,
  13533. // height: Number
  13534. // The height of the pattern image, default value is 0.
  13535. src: ""
  13536. // src: String
  13537. // A url specifing the image to use for the pattern.
  13538. },
  13539. defaultFont: {
  13540. // summary:
  13541. // An object specifying the default properties for a Font used in text operations.
  13542. type: "font",
  13543. // type: String
  13544. // Specifies this object is a Font, value 'font'.
  13545. style: "normal",
  13546. // style: String
  13547. // The font style, one of 'normal', 'bold', default value 'normal'.
  13548. variant: "normal",
  13549. // variant: String
  13550. // The font variant, one of 'normal', ... , default value 'normal'.
  13551. weight: "normal",
  13552. // weight: String
  13553. // The font weight, one of 'normal', ..., default value 'normal'.
  13554. size: "10pt",
  13555. // size: String
  13556. // The font size (including units), default value '10pt'.
  13557. family: "serif"
  13558. // family: String
  13559. // The font family, one of 'serif', 'sanserif', ..., default value 'serif'.
  13560. },
  13561. getDefault: (function(){
  13562. // summary:
  13563. // Returns a function used to access default memoized prototype objects (see them defined above).
  13564. var typeCtorCache = {};
  13565. // a memoized delegate()
  13566. return function(/*String*/ type){
  13567. var t = typeCtorCache[type];
  13568. if(t){
  13569. return new t();
  13570. }
  13571. t = typeCtorCache[type] = new Function();
  13572. t.prototype = g[ "default" + type ];
  13573. return new t();
  13574. }
  13575. })(),
  13576. normalizeColor: function(/*dojo.Color|Array|string|Object*/ color){
  13577. // summary:
  13578. // converts any legal color representation to normalized
  13579. // dojo.Color object
  13580. return (color instanceof Color) ? color : new Color(color); // dojo.Color
  13581. },
  13582. normalizeParameters: function(existed, update){
  13583. // summary:
  13584. // updates an existing object with properties from an 'update'
  13585. // object
  13586. // existed: Object
  13587. // the target object to be updated
  13588. // update: Object
  13589. // the 'update' object, whose properties will be used to update
  13590. // the existed object
  13591. var x;
  13592. if(update){
  13593. var empty = {};
  13594. for(x in existed){
  13595. if(x in update && !(x in empty)){
  13596. existed[x] = update[x];
  13597. }
  13598. }
  13599. }
  13600. return existed; // Object
  13601. },
  13602. makeParameters: function(defaults, update){
  13603. // summary:
  13604. // copies the original object, and all copied properties from the
  13605. // 'update' object
  13606. // defaults: Object
  13607. // the object to be cloned before updating
  13608. // update: Object
  13609. // the object, which properties are to be cloned during updating
  13610. var i = null;
  13611. if(!update){
  13612. // return dojo.clone(defaults);
  13613. return lang.delegate(defaults);
  13614. }
  13615. var result = {};
  13616. for(i in defaults){
  13617. if(!(i in result)){
  13618. result[i] = lang.clone((i in update) ? update[i] : defaults[i]);
  13619. }
  13620. }
  13621. return result; // Object
  13622. },
  13623. formatNumber: function(x, addSpace){
  13624. // summary: converts a number to a string using a fixed notation
  13625. // x: Number
  13626. // number to be converted
  13627. // addSpace: Boolean
  13628. // whether to add a space before a positive number
  13629. var val = x.toString();
  13630. if(val.indexOf("e") >= 0){
  13631. val = x.toFixed(4);
  13632. }else{
  13633. var point = val.indexOf(".");
  13634. if(point >= 0 && val.length - point > 5){
  13635. val = x.toFixed(4);
  13636. }
  13637. }
  13638. if(x < 0){
  13639. return val; // String
  13640. }
  13641. return addSpace ? " " + val : val; // String
  13642. },
  13643. // font operations
  13644. makeFontString: function(font){
  13645. // summary: converts a font object to a CSS font string
  13646. // font: Object: font object (see dojox.gfx.defaultFont)
  13647. return font.style + " " + font.variant + " " + font.weight + " " + font.size + " " + font.family; // Object
  13648. },
  13649. splitFontString: function(str){
  13650. // summary:
  13651. // converts a CSS font string to a font object
  13652. // description:
  13653. // Converts a CSS font string to a gfx font object. The CSS font
  13654. // string components should follow the W3C specified order
  13655. // (see http://www.w3.org/TR/CSS2/fonts.html#font-shorthand):
  13656. // style, variant, weight, size, optional line height (will be
  13657. // ignored), and family.
  13658. // str: String
  13659. // a CSS font string
  13660. var font = g.getDefault("Font");
  13661. var t = str.split(/\s+/);
  13662. do{
  13663. if(t.length < 5){ break; }
  13664. font.style = t[0];
  13665. font.variant = t[1];
  13666. font.weight = t[2];
  13667. var i = t[3].indexOf("/");
  13668. font.size = i < 0 ? t[3] : t[3].substring(0, i);
  13669. var j = 4;
  13670. if(i < 0){
  13671. if(t[4] == "/"){
  13672. j = 6;
  13673. }else if(t[4].charAt(0) == "/"){
  13674. j = 5;
  13675. }
  13676. }
  13677. if(j < t.length){
  13678. font.family = t.slice(j).join(" ");
  13679. }
  13680. }while(false);
  13681. return font; // Object
  13682. },
  13683. // length operations
  13684. cm_in_pt: 72 / 2.54,
  13685. // cm_in_pt: Number
  13686. // points per centimeter (constant)
  13687. mm_in_pt: 7.2 / 2.54,
  13688. // mm_in_pt: Number
  13689. // points per millimeter (constant)
  13690. px_in_pt: function(){
  13691. // summary: returns the current number of pixels per point.
  13692. return g._base._getCachedFontMeasurements()["12pt"] / 12; // Number
  13693. },
  13694. pt2px: function(len){
  13695. // summary: converts points to pixels
  13696. // len: Number
  13697. // a value in points
  13698. return len * g.px_in_pt(); // Number
  13699. },
  13700. px2pt: function(len){
  13701. // summary: converts pixels to points
  13702. // len: Number
  13703. // a value in pixels
  13704. return len / g.px_in_pt(); // Number
  13705. },
  13706. normalizedLength: function(len) {
  13707. // summary: converts any length value to pixels
  13708. // len: String
  13709. // a length, e.g., '12pc'
  13710. if(len.length === 0){ return 0; }
  13711. if(len.length > 2){
  13712. var px_in_pt = g.px_in_pt();
  13713. var val = parseFloat(len);
  13714. switch(len.slice(-2)){
  13715. case "px": return val;
  13716. case "pt": return val * px_in_pt;
  13717. case "in": return val * 72 * px_in_pt;
  13718. case "pc": return val * 12 * px_in_pt;
  13719. case "mm": return val * g.mm_in_pt * px_in_pt;
  13720. case "cm": return val * g.cm_in_pt * px_in_pt;
  13721. }
  13722. }
  13723. return parseFloat(len); // Number
  13724. },
  13725. pathVmlRegExp: /([A-Za-z]+)|(\d+(\.\d+)?)|(\.\d+)|(-\d+(\.\d+)?)|(-\.\d+)/g,
  13726. // pathVmlRegExp: RegExp
  13727. // a constant regular expression used to split a SVG/VML path into primitive components
  13728. pathSvgRegExp: /([A-Za-z])|(\d+(\.\d+)?)|(\.\d+)|(-\d+(\.\d+)?)|(-\.\d+)/g,
  13729. // pathVmlRegExp: RegExp
  13730. // a constant regular expression used to split a SVG/VML path into primitive components
  13731. equalSources: function(a /*Object*/, b /*Object*/){
  13732. // summary: compares event sources, returns true if they are equal
  13733. // a: first event source
  13734. // b: event source to compare against a
  13735. return a && b && a === b;
  13736. },
  13737. switchTo: function(renderer/*String|Object*/){
  13738. // summary: switch the graphics implementation to the specified renderer.
  13739. // renderer:
  13740. // Either the string name of a renderer (eg. 'canvas', 'svg, ...) or the renderer
  13741. // object to switch to.
  13742. var ns = typeof renderer == "string" ? g[renderer] : renderer;
  13743. if(ns){
  13744. arr.forEach(["Group", "Rect", "Ellipse", "Circle", "Line",
  13745. "Polyline", "Image", "Text", "Path", "TextPath",
  13746. "Surface", "createSurface", "fixTarget"], function(name){
  13747. g[name] = ns[name];
  13748. });
  13749. }
  13750. }
  13751. });
  13752. return g; // defaults object api
  13753. });
  13754. },
  13755. 'dojox/gfx/renderer':function(){
  13756. define("dojox/gfx/renderer", ["./_base","dojo/_base/lang", "dojo/_base/sniff", "dojo/_base/window", "dojo/_base/config"],
  13757. function(g, lang, has, win, config){
  13758. //>> noBuildResolver
  13759. /*=====
  13760. dojox.gfx.renderer = {
  13761. // summary:
  13762. // This module is an AMD loader plugin that loads the appropriate graphics renderer
  13763. // implementation based on detected environment and current configuration settings.
  13764. };
  13765. =====*/
  13766. var currentRenderer = null;
  13767. has.add("vml", function(global, document, element){
  13768. element.innerHTML = "<v:shape adj=\"1\"/>";
  13769. var supported = ("adj" in element.firstChild);
  13770. element.innerHTML = "";
  13771. return supported;
  13772. });
  13773. return {
  13774. load: function(id, require, load){
  13775. if(currentRenderer && id != "force"){
  13776. load(currentRenderer);
  13777. return;
  13778. }
  13779. var renderer = config.forceGfxRenderer,
  13780. renderers = !renderer && (lang.isString(config.gfxRenderer) ?
  13781. config.gfxRenderer : "svg,vml,canvas,silverlight").split(","),
  13782. silverlightObject, silverlightFlag;
  13783. while(!renderer && renderers.length){
  13784. switch(renderers.shift()){
  13785. case "svg":
  13786. // the next test is from https://github.com/phiggins42/has.js
  13787. if("SVGAngle" in win.global){
  13788. renderer = "svg";
  13789. }
  13790. break;
  13791. case "vml":
  13792. if(has("vml")){
  13793. renderer = "vml";
  13794. }
  13795. break;
  13796. case "silverlight":
  13797. try{
  13798. if(has("ie")){
  13799. silverlightObject = new ActiveXObject("AgControl.AgControl");
  13800. if(silverlightObject && silverlightObject.IsVersionSupported("1.0")){
  13801. silverlightFlag = true;
  13802. }
  13803. }else{
  13804. if(navigator.plugins["Silverlight Plug-In"]){
  13805. silverlightFlag = true;
  13806. }
  13807. }
  13808. }catch(e){
  13809. silverlightFlag = false;
  13810. }finally{
  13811. silverlightObject = null;
  13812. }
  13813. if(silverlightFlag){
  13814. renderer = "silverlight";
  13815. }
  13816. break;
  13817. case "canvas":
  13818. if(win.global.CanvasRenderingContext2D){
  13819. renderer = "canvas";
  13820. }
  13821. break;
  13822. }
  13823. }
  13824. if (renderer === 'canvas' && config.canvasEvents !== false) {
  13825. renderer = "canvasWithEvents";
  13826. }
  13827. if(config.isDebug){
  13828. console.log("gfx renderer = " + renderer);
  13829. }
  13830. function loadRenderer(){
  13831. require(["dojox/gfx/" + renderer], function(module){
  13832. g.renderer = renderer;
  13833. // memorize the renderer module
  13834. currentRenderer = module;
  13835. // now load it
  13836. load(module);
  13837. });
  13838. }
  13839. if(renderer == "svg" && typeof window.svgweb != "undefined"){
  13840. window.svgweb.addOnLoad(loadRenderer);
  13841. }else{
  13842. loadRenderer();
  13843. }
  13844. }
  13845. };
  13846. });
  13847. }}});
  13848. define("dojox/gfx", ["dojo/_base/lang", "./gfx/_base", "./gfx/renderer!"],
  13849. function(lang, gfxBase, renderer){
  13850. // module:
  13851. // dojox/gfx
  13852. // summary:
  13853. // This the root of the Dojo Graphics package
  13854. gfxBase.switchTo(renderer);
  13855. return gfxBase;
  13856. });
  13857. },
  13858. 'dojox/gfx/shape':function(){
  13859. define("dojox/gfx/shape", ["./_base", "dojo/_base/lang", "dojo/_base/declare", "dojo/_base/window", "dojo/_base/sniff",
  13860. "dojo/_base/connect", "dojo/_base/array", "dojo/dom-construct", "dojo/_base/Color", "./matrix"],
  13861. function(g, lang, declare, win, has, events, arr, domConstruct, Color, matrixLib){
  13862. /*=====
  13863. dojox.gfx.shape = {
  13864. // summary:
  13865. // This module contains the core graphics Shape API.
  13866. // Different graphics renderer implementation modules (svg, canvas, vml, silverlight, etc.) extend this
  13867. // basic api to provide renderer-specific implementations for each shape.
  13868. };
  13869. =====*/
  13870. var shape = g.shape = {};
  13871. // a set of ids (keys=type)
  13872. var _ids = {};
  13873. // a simple set impl to map shape<->id
  13874. var registry = {};
  13875. var disposeCount = 0, fixIELeak = has("ie") < 9;
  13876. function repack(oldRegistry){
  13877. var newRegistry = {};
  13878. for(var key in oldRegistry){
  13879. if(oldRegistry.hasOwnProperty(key)){
  13880. newRegistry[key] = oldRegistry[key]
  13881. }
  13882. }
  13883. return newRegistry;
  13884. }
  13885. shape.register = function(/*dojox.gfx.shape.Shape*/shape){
  13886. // summary:
  13887. // Register the specified shape into the graphics registry.
  13888. // shape: dojox.gfx.shape.Shape
  13889. // The shape to register.
  13890. // returns:
  13891. // The unique id associated with this shape.
  13892. // the id pattern : type+number (ex: Rect0,Rect1,etc)
  13893. var t = shape.declaredClass.split('.').pop();
  13894. var i = t in _ids ? ++_ids[t] : ((_ids[t] = 0));
  13895. var uid = t+i;
  13896. registry[uid] = shape;
  13897. return uid;
  13898. };
  13899. shape.byId = function(/*String*/id){
  13900. // summary:
  13901. // Returns the shape that matches the specified id.
  13902. // id: String
  13903. // The unique identifier for this Shape.
  13904. return registry[id]; //dojox.gfx.shape.Shape
  13905. };
  13906. shape.dispose = function(/*dojox.gfx.shape.Shape*/shape){
  13907. // summary:
  13908. // Removes the specified shape from the registry.
  13909. // shape: dojox.gfx.shape.Shape
  13910. // The shape to unregister.
  13911. delete registry[shape.getUID()];
  13912. ++disposeCount;
  13913. if(fixIELeak && disposeCount>10000){
  13914. registry = repack(registry);
  13915. disposeCount = 0;
  13916. }
  13917. };
  13918. declare("dojox.gfx.shape.Shape", null, {
  13919. // summary: a Shape object, which knows how to apply
  13920. // graphical attributes and transformations
  13921. constructor: function(){
  13922. // rawNode: Node
  13923. // underlying graphics-renderer-specific implementation object (if applicable)
  13924. this.rawNode = null;
  13925. // shape: Object: an abstract shape object
  13926. // (see dojox.gfx.defaultPath,
  13927. // dojox.gfx.defaultPolyline,
  13928. // dojox.gfx.defaultRect,
  13929. // dojox.gfx.defaultEllipse,
  13930. // dojox.gfx.defaultCircle,
  13931. // dojox.gfx.defaultLine,
  13932. // or dojox.gfx.defaultImage)
  13933. this.shape = null;
  13934. // matrix: dojox.gfx.Matrix2D
  13935. // a transformation matrix
  13936. this.matrix = null;
  13937. // fillStyle: Object
  13938. // a fill object
  13939. // (see dojox.gfx.defaultLinearGradient,
  13940. // dojox.gfx.defaultRadialGradient,
  13941. // dojox.gfx.defaultPattern,
  13942. // or dojo.Color)
  13943. this.fillStyle = null;
  13944. // strokeStyle: Object
  13945. // a stroke object
  13946. // (see dojox.gfx.defaultStroke)
  13947. this.strokeStyle = null;
  13948. // bbox: dojox.gfx.Rectangle
  13949. // a bounding box of this shape
  13950. // (see dojox.gfx.defaultRect)
  13951. this.bbox = null;
  13952. // virtual group structure
  13953. // parent: Object
  13954. // a parent or null
  13955. // (see dojox.gfx.Surface,
  13956. // dojox.gfx.shape.VirtualGroup,
  13957. // or dojox.gfx.Group)
  13958. this.parent = null;
  13959. // parentMatrix: dojox.gfx.Matrix2D
  13960. // a transformation matrix inherited from the parent
  13961. this.parentMatrix = null;
  13962. var uid = shape.register(this);
  13963. this.getUID = function(){
  13964. return uid;
  13965. }
  13966. },
  13967. // trivial getters
  13968. getNode: function(){
  13969. // summary: Different graphics rendering subsystems implement shapes in different ways. This
  13970. // method provides access to the underlying graphics subsystem object. Clients calling this
  13971. // method and using the return value must be careful not to try sharing or using the underlying node
  13972. // in a general way across renderer implementation.
  13973. // Returns the underlying graphics Node, or null if no underlying graphics node is used by this shape.
  13974. return this.rawNode; // Node
  13975. },
  13976. getShape: function(){
  13977. // summary: returns the current Shape object or null
  13978. // (see dojox.gfx.defaultPath,
  13979. // dojox.gfx.defaultPolyline,
  13980. // dojox.gfx.defaultRect,
  13981. // dojox.gfx.defaultEllipse,
  13982. // dojox.gfx.defaultCircle,
  13983. // dojox.gfx.defaultLine,
  13984. // or dojox.gfx.defaultImage)
  13985. return this.shape; // Object
  13986. },
  13987. getTransform: function(){
  13988. // summary: Returns the current transformation matrix applied to this Shape or null
  13989. return this.matrix; // dojox.gfx.Matrix2D
  13990. },
  13991. getFill: function(){
  13992. // summary: Returns the current fill object or null
  13993. // (see dojox.gfx.defaultLinearGradient,
  13994. // dojox.gfx.defaultRadialGradient,
  13995. // dojox.gfx.defaultPattern,
  13996. // or dojo.Color)
  13997. return this.fillStyle; // Object
  13998. },
  13999. getStroke: function(){
  14000. // summary: Returns the current stroke object or null
  14001. // (see dojox.gfx.defaultStroke)
  14002. return this.strokeStyle; // Object
  14003. },
  14004. getParent: function(){
  14005. // summary: Returns the parent Shape, Group or VirtualGroup or null if this Shape is unparented.
  14006. // (see dojox.gfx.Surface,
  14007. // dojox.gfx.shape.VirtualGroup,
  14008. // or dojox.gfx.Group)
  14009. return this.parent; // Object
  14010. },
  14011. getBoundingBox: function(){
  14012. // summary: Returns the bounding box Rectanagle for this shape or null if a BoundingBox cannot be
  14013. // calculated for the shape on the current renderer or for shapes with no geometric area (points).
  14014. // A bounding box is a rectangular geometric region
  14015. // defining the X and Y extent of the shape.
  14016. // (see dojox.gfx.defaultRect)
  14017. return this.bbox; // dojox.gfx.Rectangle
  14018. },
  14019. getTransformedBoundingBox: function(){
  14020. // summary: returns an array of four points or null
  14021. // four points represent four corners of the untransformed bounding box
  14022. var b = this.getBoundingBox();
  14023. if(!b){
  14024. return null; // null
  14025. }
  14026. var m = this._getRealMatrix(),
  14027. gm = matrixLib;
  14028. return [ // Array
  14029. gm.multiplyPoint(m, b.x, b.y),
  14030. gm.multiplyPoint(m, b.x + b.width, b.y),
  14031. gm.multiplyPoint(m, b.x + b.width, b.y + b.height),
  14032. gm.multiplyPoint(m, b.x, b.y + b.height)
  14033. ];
  14034. },
  14035. getEventSource: function(){
  14036. // summary: returns a Node, which is used as
  14037. // a source of events for this shape
  14038. // COULD BE RE-IMPLEMENTED BY THE RENDERER!
  14039. return this.rawNode; // Node
  14040. },
  14041. // empty settings
  14042. setShape: function(shape){
  14043. // summary: sets a shape object
  14044. // (the default implementation simply ignores it)
  14045. // shape: Object
  14046. // a shape object
  14047. // (see dojox.gfx.defaultPath,
  14048. // dojox.gfx.defaultPolyline,
  14049. // dojox.gfx.defaultRect,
  14050. // dojox.gfx.defaultEllipse,
  14051. // dojox.gfx.defaultCircle,
  14052. // dojox.gfx.defaultLine,
  14053. // or dojox.gfx.defaultImage)
  14054. // COULD BE RE-IMPLEMENTED BY THE RENDERER!
  14055. this.shape = g.makeParameters(this.shape, shape);
  14056. this.bbox = null;
  14057. return this; // self
  14058. },
  14059. setFill: function(fill){
  14060. // summary: sets a fill object
  14061. // (the default implementation simply ignores it)
  14062. // fill: Object
  14063. // a fill object
  14064. // (see dojox.gfx.defaultLinearGradient,
  14065. // dojox.gfx.defaultRadialGradient,
  14066. // dojox.gfx.defaultPattern,
  14067. // or dojo.Color)
  14068. // COULD BE RE-IMPLEMENTED BY THE RENDERER!
  14069. if(!fill){
  14070. // don't fill
  14071. this.fillStyle = null;
  14072. return this; // self
  14073. }
  14074. var f = null;
  14075. if(typeof(fill) == "object" && "type" in fill){
  14076. // gradient or pattern
  14077. switch(fill.type){
  14078. case "linear":
  14079. f = g.makeParameters(g.defaultLinearGradient, fill);
  14080. break;
  14081. case "radial":
  14082. f = g.makeParameters(g.defaultRadialGradient, fill);
  14083. break;
  14084. case "pattern":
  14085. f = g.makeParameters(g.defaultPattern, fill);
  14086. break;
  14087. }
  14088. }else{
  14089. // color object
  14090. f = g.normalizeColor(fill);
  14091. }
  14092. this.fillStyle = f;
  14093. return this; // self
  14094. },
  14095. setStroke: function(stroke){
  14096. // summary: sets a stroke object
  14097. // (the default implementation simply ignores it)
  14098. // stroke: Object
  14099. // a stroke object
  14100. // (see dojox.gfx.defaultStroke)
  14101. // COULD BE RE-IMPLEMENTED BY THE RENDERER!
  14102. if(!stroke){
  14103. // don't stroke
  14104. this.strokeStyle = null;
  14105. return this; // self
  14106. }
  14107. // normalize the stroke
  14108. if(typeof stroke == "string" || lang.isArray(stroke) || stroke instanceof Color){
  14109. stroke = {color: stroke};
  14110. }
  14111. var s = this.strokeStyle = g.makeParameters(g.defaultStroke, stroke);
  14112. s.color = g.normalizeColor(s.color);
  14113. return this; // self
  14114. },
  14115. setTransform: function(matrix){
  14116. // summary: sets a transformation matrix
  14117. // matrix: dojox.gfx.Matrix2D
  14118. // a matrix or a matrix-like object
  14119. // (see an argument of dojox.gfx.Matrix2D
  14120. // constructor for a list of acceptable arguments)
  14121. // COULD BE RE-IMPLEMENTED BY THE RENDERER!
  14122. this.matrix = matrixLib.clone(matrix ? matrixLib.normalize(matrix) : matrixLib.identity);
  14123. return this._applyTransform(); // self
  14124. },
  14125. _applyTransform: function(){
  14126. // summary: physically sets a matrix
  14127. // COULD BE RE-IMPLEMENTED BY THE RENDERER!
  14128. return this; // self
  14129. },
  14130. // z-index
  14131. moveToFront: function(){
  14132. // summary: moves a shape to front of its parent's list of shapes
  14133. var p = this.getParent();
  14134. if(p){
  14135. p._moveChildToFront(this);
  14136. this._moveToFront(); // execute renderer-specific action
  14137. }
  14138. return this; // self
  14139. },
  14140. moveToBack: function(){
  14141. // summary: moves a shape to back of its parent's list of shapes
  14142. var p = this.getParent();
  14143. if(p){
  14144. p._moveChildToBack(this);
  14145. this._moveToBack(); // execute renderer-specific action
  14146. }
  14147. return this;
  14148. },
  14149. _moveToFront: function(){
  14150. // summary: renderer-specific hook, see dojox.gfx.shape.Shape.moveToFront()
  14151. // COULD BE RE-IMPLEMENTED BY THE RENDERER!
  14152. },
  14153. _moveToBack: function(){
  14154. // summary: renderer-specific hook, see dojox.gfx.shape.Shape.moveToFront()
  14155. // COULD BE RE-IMPLEMENTED BY THE RENDERER!
  14156. },
  14157. // apply left & right transformation
  14158. applyRightTransform: function(matrix){
  14159. // summary: multiplies the existing matrix with an argument on right side
  14160. // (this.matrix * matrix)
  14161. // matrix: dojox.gfx.Matrix2D
  14162. // a matrix or a matrix-like object
  14163. // (see an argument of dojox.gfx.Matrix2D
  14164. // constructor for a list of acceptable arguments)
  14165. return matrix ? this.setTransform([this.matrix, matrix]) : this; // self
  14166. },
  14167. applyLeftTransform: function(matrix){
  14168. // summary: multiplies the existing matrix with an argument on left side
  14169. // (matrix * this.matrix)
  14170. // matrix: dojox.gfx.Matrix2D
  14171. // a matrix or a matrix-like object
  14172. // (see an argument of dojox.gfx.Matrix2D
  14173. // constructor for a list of acceptable arguments)
  14174. return matrix ? this.setTransform([matrix, this.matrix]) : this; // self
  14175. },
  14176. applyTransform: function(matrix){
  14177. // summary: a shortcut for dojox.gfx.Shape.applyRightTransform
  14178. // matrix: dojox.gfx.Matrix2D
  14179. // a matrix or a matrix-like object
  14180. // (see an argument of dojox.gfx.Matrix2D
  14181. // constructor for a list of acceptable arguments)
  14182. return matrix ? this.setTransform([this.matrix, matrix]) : this; // self
  14183. },
  14184. // virtual group methods
  14185. removeShape: function(silently){
  14186. // summary: removes the shape from its parent's list of shapes
  14187. // silently: Boolean
  14188. // if true, do not redraw a picture yet
  14189. if(this.parent){
  14190. this.parent.remove(this, silently);
  14191. }
  14192. return this; // self
  14193. },
  14194. _setParent: function(parent, matrix){
  14195. // summary: sets a parent
  14196. // parent: Object
  14197. // a parent or null
  14198. // (see dojox.gfx.Surface,
  14199. // dojox.gfx.shape.VirtualGroup,
  14200. // or dojox.gfx.Group)
  14201. // matrix: dojox.gfx.Matrix2D
  14202. // a 2D matrix or a matrix-like object
  14203. this.parent = parent;
  14204. return this._updateParentMatrix(matrix); // self
  14205. },
  14206. _updateParentMatrix: function(matrix){
  14207. // summary: updates the parent matrix with new matrix
  14208. // matrix: dojox.gfx.Matrix2D
  14209. // a 2D matrix or a matrix-like object
  14210. this.parentMatrix = matrix ? matrixLib.clone(matrix) : null;
  14211. return this._applyTransform(); // self
  14212. },
  14213. _getRealMatrix: function(){
  14214. // summary: returns the cumulative ('real') transformation matrix
  14215. // by combining the shape's matrix with its parent's matrix
  14216. var m = this.matrix;
  14217. var p = this.parent;
  14218. while(p){
  14219. if(p.matrix){
  14220. m = matrixLib.multiply(p.matrix, m);
  14221. }
  14222. p = p.parent;
  14223. }
  14224. return m; // dojox.gfx.Matrix2D
  14225. }
  14226. });
  14227. shape._eventsProcessing = {
  14228. connect: function(name, object, method){
  14229. // summary: connects a handler to an event on this shape
  14230. // COULD BE RE-IMPLEMENTED BY THE RENDERER!
  14231. // redirect to fixCallback to normalize events and add the gfxTarget to the event. The latter
  14232. // is done by dojox.gfx.fixTarget which is defined by each renderer
  14233. return events.connect(this.getEventSource(), name, shape.fixCallback(this, g.fixTarget, object, method));
  14234. },
  14235. disconnect: function(token){
  14236. // summary: connects a handler by token from an event on this shape
  14237. // COULD BE RE-IMPLEMENTED BY THE RENDERER!
  14238. events.disconnect(token);
  14239. }
  14240. };
  14241. shape.fixCallback = function(gfxElement, fixFunction, scope, method){
  14242. // summary:
  14243. // Wraps the callback to allow for tests and event normalization
  14244. // before it gets invoked. This is where 'fixTarget' is invoked.
  14245. // gfxElement: Object
  14246. // The GFX object that triggers the action (ex.:
  14247. // dojox.gfx.Surface and dojox.gfx.Shape). A new event property
  14248. // 'gfxTarget' is added to the event to reference this object.
  14249. // for easy manipulation of GFX objects by the event handlers.
  14250. // fixFunction: Function
  14251. // The function that implements the logic to set the 'gfxTarget'
  14252. // property to the event. It should be 'dojox.gfx.fixTarget' for
  14253. // most of the cases
  14254. // scope: Object
  14255. // Optional. The scope to be used when invoking 'method'. If
  14256. // omitted, a global scope is used.
  14257. // method: Function|String
  14258. // The original callback to be invoked.
  14259. if(!method){
  14260. method = scope;
  14261. scope = null;
  14262. }
  14263. if(lang.isString(method)){
  14264. scope = scope || win.global;
  14265. if(!scope[method]){ throw(['dojox.gfx.shape.fixCallback: scope["', method, '"] is null (scope="', scope, '")'].join('')); }
  14266. return function(e){
  14267. return fixFunction(e,gfxElement) ? scope[method].apply(scope, arguments || []) : undefined; }; // Function
  14268. }
  14269. return !scope
  14270. ? function(e){
  14271. return fixFunction(e,gfxElement) ? method.apply(scope, arguments) : undefined; }
  14272. : function(e){
  14273. return fixFunction(e,gfxElement) ? method.apply(scope, arguments || []) : undefined; }; // Function
  14274. };
  14275. lang.extend(shape.Shape, shape._eventsProcessing);
  14276. shape.Container = {
  14277. // summary: a container of shapes, which can be used
  14278. // as a foundation for renderer-specific groups, or as a way
  14279. // to logically group shapes (e.g, to propagate matricies)
  14280. _init: function() {
  14281. // children: Array: a list of children
  14282. this.children = [];
  14283. },
  14284. // group management
  14285. openBatch: function() {
  14286. // summary: starts a new batch, subsequent new child shapes will be held in
  14287. // the batch instead of appending to the container directly
  14288. },
  14289. closeBatch: function() {
  14290. // summary: submits the current batch, append all pending child shapes to DOM
  14291. },
  14292. add: function(shape){
  14293. // summary: adds a shape to the list
  14294. // shape: dojox.gfx.Shape
  14295. // the shape to add to the list
  14296. var oldParent = shape.getParent();
  14297. if(oldParent){
  14298. oldParent.remove(shape, true);
  14299. }
  14300. this.children.push(shape);
  14301. return shape._setParent(this, this._getRealMatrix()); // self
  14302. },
  14303. remove: function(shape, silently){
  14304. // summary: removes a shape from the list
  14305. // shape: dojox.gfx.shape.Shape
  14306. // the shape to remove
  14307. // silently: Boolean
  14308. // if true, do not redraw a picture yet
  14309. for(var i = 0; i < this.children.length; ++i){
  14310. if(this.children[i] == shape){
  14311. if(silently){
  14312. // skip for now
  14313. }else{
  14314. shape.parent = null;
  14315. shape.parentMatrix = null;
  14316. }
  14317. this.children.splice(i, 1);
  14318. break;
  14319. }
  14320. }
  14321. return this; // self
  14322. },
  14323. clear: function(){
  14324. // summary: removes all shapes from a group/surface
  14325. var shape;
  14326. for(var i = 0; i < this.children.length;++i){
  14327. shape = this.children[i];
  14328. shape.parent = null;
  14329. shape.parentMatrix = null;
  14330. }
  14331. this.children = [];
  14332. return this; // self
  14333. },
  14334. // moving child nodes
  14335. _moveChildToFront: function(shape){
  14336. // summary: moves a shape to front of the list of shapes
  14337. // shape: dojox.gfx.shape.Shape
  14338. // one of the child shapes to move to the front
  14339. for(var i = 0; i < this.children.length; ++i){
  14340. if(this.children[i] == shape){
  14341. this.children.splice(i, 1);
  14342. this.children.push(shape);
  14343. break;
  14344. }
  14345. }
  14346. return this; // self
  14347. },
  14348. _moveChildToBack: function(shape){
  14349. // summary: moves a shape to back of the list of shapes
  14350. // shape: dojox.gfx.shape.Shape
  14351. // one of the child shapes to move to the front
  14352. for(var i = 0; i < this.children.length; ++i){
  14353. if(this.children[i] == shape){
  14354. this.children.splice(i, 1);
  14355. this.children.unshift(shape);
  14356. break;
  14357. }
  14358. }
  14359. return this; // self
  14360. }
  14361. };
  14362. declare("dojox.gfx.shape.Surface", null, {
  14363. // summary: a surface object to be used for drawings
  14364. constructor: function(){
  14365. // underlying node
  14366. this.rawNode = null;
  14367. // the parent node
  14368. this._parent = null;
  14369. // the list of DOM nodes to be deleted in the case of destruction
  14370. this._nodes = [];
  14371. // the list of events to be detached in the case of destruction
  14372. this._events = [];
  14373. },
  14374. destroy: function(){
  14375. // summary: destroy all relevant external resources and release all
  14376. // external references to make this object garbage-collectible
  14377. // dispose children from registry
  14378. var _dispose = function(s){
  14379. shape.dispose(s);
  14380. s.parent = null;
  14381. if(s.children && s.children.length){
  14382. arr.forEach(s.children, _dispose);
  14383. s.children = null;
  14384. }
  14385. };
  14386. arr.forEach(this.children, _dispose);
  14387. this.children = null;
  14388. // destroy dom construct
  14389. arr.forEach(this._nodes, domConstruct.destroy);
  14390. this._nodes = [];
  14391. arr.forEach(this._events, events.disconnect);
  14392. this._events = [];
  14393. this.rawNode = null; // recycle it in _nodes, if it needs to be recycled
  14394. if(has("ie")){
  14395. while(this._parent.lastChild){
  14396. domConstruct.destroy(this._parent.lastChild);
  14397. }
  14398. }else{
  14399. this._parent.innerHTML = "";
  14400. }
  14401. this._parent = null;
  14402. },
  14403. getEventSource: function(){
  14404. // summary: returns a node, which can be used to attach event listeners
  14405. return this.rawNode; // Node
  14406. },
  14407. _getRealMatrix: function(){
  14408. // summary: always returns the identity matrix
  14409. return null; // dojox.gfx.Matrix2D
  14410. },
  14411. isLoaded: true,
  14412. onLoad: function(/*dojox.gfx.Surface*/ surface){
  14413. // summary: local event, fired once when the surface is created
  14414. // asynchronously, used only when isLoaded is false, required
  14415. // only for Silverlight.
  14416. },
  14417. whenLoaded: function(/*Object|Null*/ context, /*Function|String*/ method){
  14418. var f = lang.hitch(context, method);
  14419. if(this.isLoaded){
  14420. f(this);
  14421. }else{
  14422. var h = events.connect(this, "onLoad", function(surface){
  14423. events.disconnect(h);
  14424. f(surface);
  14425. });
  14426. }
  14427. }
  14428. });
  14429. lang.extend(shape.Surface, shape._eventsProcessing);
  14430. declare("dojox.gfx.Point", null, {
  14431. // summary: a hypothetical 2D point to be used for drawings - {x, y}
  14432. // description: This object is defined for documentation purposes.
  14433. // You should use the naked object instead: {x: 1, y: 2}.
  14434. });
  14435. declare("dojox.gfx.Rectangle", null, {
  14436. // summary: a hypothetical rectangle - {x, y, width, height}
  14437. // description: This object is defined for documentation purposes.
  14438. // You should use the naked object instead: {x: 1, y: 2, width: 100, height: 200}.
  14439. });
  14440. declare("dojox.gfx.shape.Rect", shape.Shape, {
  14441. // summary: a generic rectangle
  14442. constructor: function(rawNode){
  14443. // rawNode: Node
  14444. // The underlying graphics system object (typically a DOM Node)
  14445. this.shape = g.getDefault("Rect");
  14446. this.rawNode = rawNode;
  14447. },
  14448. getBoundingBox: function(){
  14449. // summary: returns the bounding box (its shape in this case)
  14450. return this.shape; // dojox.gfx.Rectangle
  14451. }
  14452. });
  14453. declare("dojox.gfx.shape.Ellipse", shape.Shape, {
  14454. // summary: a generic ellipse
  14455. constructor: function(rawNode){
  14456. // rawNode: Node
  14457. // a DOM Node
  14458. this.shape = g.getDefault("Ellipse");
  14459. this.rawNode = rawNode;
  14460. },
  14461. getBoundingBox: function(){
  14462. // summary: returns the bounding box
  14463. if(!this.bbox){
  14464. var shape = this.shape;
  14465. this.bbox = {x: shape.cx - shape.rx, y: shape.cy - shape.ry,
  14466. width: 2 * shape.rx, height: 2 * shape.ry};
  14467. }
  14468. return this.bbox; // dojox.gfx.Rectangle
  14469. }
  14470. });
  14471. declare("dojox.gfx.shape.Circle", shape.Shape, {
  14472. // summary: a generic circle
  14473. // (this is a helper object, which is defined for convenience)
  14474. constructor: function(rawNode){
  14475. // rawNode: Node
  14476. // a DOM Node
  14477. this.shape = g.getDefault("Circle");
  14478. this.rawNode = rawNode;
  14479. },
  14480. getBoundingBox: function(){
  14481. // summary: returns the bounding box
  14482. if(!this.bbox){
  14483. var shape = this.shape;
  14484. this.bbox = {x: shape.cx - shape.r, y: shape.cy - shape.r,
  14485. width: 2 * shape.r, height: 2 * shape.r};
  14486. }
  14487. return this.bbox; // dojox.gfx.Rectangle
  14488. }
  14489. });
  14490. declare("dojox.gfx.shape.Line", shape.Shape, {
  14491. // summary: a generic line
  14492. // (this is a helper object, which is defined for convenience)
  14493. constructor: function(rawNode){
  14494. // rawNode: Node
  14495. // a DOM Node
  14496. this.shape = g.getDefault("Line");
  14497. this.rawNode = rawNode;
  14498. },
  14499. getBoundingBox: function(){
  14500. // summary: returns the bounding box
  14501. if(!this.bbox){
  14502. var shape = this.shape;
  14503. this.bbox = {
  14504. x: Math.min(shape.x1, shape.x2),
  14505. y: Math.min(shape.y1, shape.y2),
  14506. width: Math.abs(shape.x2 - shape.x1),
  14507. height: Math.abs(shape.y2 - shape.y1)
  14508. };
  14509. }
  14510. return this.bbox; // dojox.gfx.Rectangle
  14511. }
  14512. });
  14513. declare("dojox.gfx.shape.Polyline", shape.Shape, {
  14514. // summary: a generic polyline/polygon
  14515. // (this is a helper object, which is defined for convenience)
  14516. constructor: function(rawNode){
  14517. // rawNode: Node
  14518. // a DOM Node
  14519. this.shape = g.getDefault("Polyline");
  14520. this.rawNode = rawNode;
  14521. },
  14522. setShape: function(points, closed){
  14523. // summary: sets a polyline/polygon shape object
  14524. // points: Object
  14525. // a polyline/polygon shape object
  14526. // closed: Boolean
  14527. // close the polyline to make a polygon
  14528. if(points && points instanceof Array){
  14529. // points: Array: an array of points
  14530. this.inherited(arguments, [{points: points}]);
  14531. if(closed && this.shape.points.length){
  14532. this.shape.points.push(this.shape.points[0]);
  14533. }
  14534. }else{
  14535. this.inherited(arguments, [points]);
  14536. }
  14537. return this; // self
  14538. },
  14539. _normalizePoints: function(){
  14540. // summary: normalize points to array of {x:number, y:number}
  14541. var p = this.shape.points, l = p && p.length;
  14542. if(l && typeof p[0] == "number"){
  14543. var points = [];
  14544. for(var i = 0; i < l; i += 2){
  14545. points.push({x: p[i], y: p[i + 1]});
  14546. }
  14547. this.shape.points = points;
  14548. }
  14549. },
  14550. getBoundingBox: function(){
  14551. // summary: returns the bounding box
  14552. if(!this.bbox && this.shape.points.length){
  14553. var p = this.shape.points;
  14554. var l = p.length;
  14555. var t = p[0];
  14556. var bbox = {l: t.x, t: t.y, r: t.x, b: t.y};
  14557. for(var i = 1; i < l; ++i){
  14558. t = p[i];
  14559. if(bbox.l > t.x) bbox.l = t.x;
  14560. if(bbox.r < t.x) bbox.r = t.x;
  14561. if(bbox.t > t.y) bbox.t = t.y;
  14562. if(bbox.b < t.y) bbox.b = t.y;
  14563. }
  14564. this.bbox = {
  14565. x: bbox.l,
  14566. y: bbox.t,
  14567. width: bbox.r - bbox.l,
  14568. height: bbox.b - bbox.t
  14569. };
  14570. }
  14571. return this.bbox; // dojox.gfx.Rectangle
  14572. }
  14573. });
  14574. declare("dojox.gfx.shape.Image", shape.Shape, {
  14575. // summary: a generic image
  14576. // (this is a helper object, which is defined for convenience)
  14577. constructor: function(rawNode){
  14578. // rawNode: Node
  14579. // a DOM Node
  14580. this.shape = g.getDefault("Image");
  14581. this.rawNode = rawNode;
  14582. },
  14583. getBoundingBox: function(){
  14584. // summary: returns the bounding box (its shape in this case)
  14585. return this.shape; // dojox.gfx.Rectangle
  14586. },
  14587. setStroke: function(){
  14588. // summary: ignore setting a stroke style
  14589. return this; // self
  14590. },
  14591. setFill: function(){
  14592. // summary: ignore setting a fill style
  14593. return this; // self
  14594. }
  14595. });
  14596. declare("dojox.gfx.shape.Text", shape.Shape, {
  14597. // summary: a generic text
  14598. constructor: function(rawNode){
  14599. // rawNode: Node
  14600. // a DOM Node
  14601. this.fontStyle = null;
  14602. this.shape = g.getDefault("Text");
  14603. this.rawNode = rawNode;
  14604. },
  14605. getFont: function(){
  14606. // summary: returns the current font object or null
  14607. return this.fontStyle; // Object
  14608. },
  14609. setFont: function(newFont){
  14610. // summary: sets a font for text
  14611. // newFont: Object
  14612. // a font object (see dojox.gfx.defaultFont) or a font string
  14613. this.fontStyle = typeof newFont == "string" ? g.splitFontString(newFont) :
  14614. g.makeParameters(g.defaultFont, newFont);
  14615. this._setFont();
  14616. return this; // self
  14617. }
  14618. });
  14619. shape.Creator = {
  14620. // summary: shape creators
  14621. createShape: function(shape){
  14622. // summary: creates a shape object based on its type; it is meant to be used
  14623. // by group-like objects
  14624. // shape: Object
  14625. // a shape descriptor object
  14626. switch(shape.type){
  14627. case g.defaultPath.type: return this.createPath(shape);
  14628. case g.defaultRect.type: return this.createRect(shape);
  14629. case g.defaultCircle.type: return this.createCircle(shape);
  14630. case g.defaultEllipse.type: return this.createEllipse(shape);
  14631. case g.defaultLine.type: return this.createLine(shape);
  14632. case g.defaultPolyline.type: return this.createPolyline(shape);
  14633. case g.defaultImage.type: return this.createImage(shape);
  14634. case g.defaultText.type: return this.createText(shape);
  14635. case g.defaultTextPath.type: return this.createTextPath(shape);
  14636. }
  14637. return null;
  14638. },
  14639. createGroup: function(){
  14640. // summary: creates a group shape
  14641. return this.createObject(g.Group); // dojox.gfx.Group
  14642. },
  14643. createRect: function(rect){
  14644. // summary: creates a rectangle shape
  14645. // rect: Object
  14646. // a path object (see dojox.gfx.defaultRect)
  14647. return this.createObject(g.Rect, rect); // dojox.gfx.Rect
  14648. },
  14649. createEllipse: function(ellipse){
  14650. // summary: creates an ellipse shape
  14651. // ellipse: Object
  14652. // an ellipse object (see dojox.gfx.defaultEllipse)
  14653. return this.createObject(g.Ellipse, ellipse); // dojox.gfx.Ellipse
  14654. },
  14655. createCircle: function(circle){
  14656. // summary: creates a circle shape
  14657. // circle: Object
  14658. // a circle object (see dojox.gfx.defaultCircle)
  14659. return this.createObject(g.Circle, circle); // dojox.gfx.Circle
  14660. },
  14661. createLine: function(line){
  14662. // summary: creates a line shape
  14663. // line: Object
  14664. // a line object (see dojox.gfx.defaultLine)
  14665. return this.createObject(g.Line, line); // dojox.gfx.Line
  14666. },
  14667. createPolyline: function(points){
  14668. // summary: creates a polyline/polygon shape
  14669. // points: Object
  14670. // a points object (see dojox.gfx.defaultPolyline)
  14671. // or an Array of points
  14672. return this.createObject(g.Polyline, points); // dojox.gfx.Polyline
  14673. },
  14674. createImage: function(image){
  14675. // summary: creates a image shape
  14676. // image: Object
  14677. // an image object (see dojox.gfx.defaultImage)
  14678. return this.createObject(g.Image, image); // dojox.gfx.Image
  14679. },
  14680. createText: function(text){
  14681. // summary: creates a text shape
  14682. // text: Object
  14683. // a text object (see dojox.gfx.defaultText)
  14684. return this.createObject(g.Text, text); // dojox.gfx.Text
  14685. },
  14686. createPath: function(path){
  14687. // summary: creates a path shape
  14688. // path: Object
  14689. // a path object (see dojox.gfx.defaultPath)
  14690. return this.createObject(g.Path, path); // dojox.gfx.Path
  14691. },
  14692. createTextPath: function(text){
  14693. // summary: creates a text shape
  14694. // text: Object
  14695. // a textpath object (see dojox.gfx.defaultTextPath)
  14696. return this.createObject(g.TextPath, {}).setText(text); // dojox.gfx.TextPath
  14697. },
  14698. createObject: function(shapeType, rawShape){
  14699. // summary: creates an instance of the passed shapeType class
  14700. // SHOULD BE RE-IMPLEMENTED BY THE RENDERER!
  14701. // shapeType: Function
  14702. // a class constructor to create an instance of
  14703. // rawShape: Object
  14704. // properties to be passed in to the classes 'setShape' method
  14705. return null; // dojox.gfx.Shape
  14706. }
  14707. };
  14708. return shape;
  14709. });
  14710. },
  14711. 'dojox/charting/Chart2D':function(){
  14712. define("dojox/charting/Chart2D", ["dojo/_base/kernel", "dojox", "./Chart",
  14713. "./axis2d/Default", "./axis2d/Invisible", "./plot2d/Default", "./plot2d/Lines", "./plot2d/Areas",
  14714. "./plot2d/Markers", "./plot2d/MarkersOnly", "./plot2d/Scatter", "./plot2d/Stacked", "./plot2d/StackedLines",
  14715. "./plot2d/StackedAreas", "./plot2d/Columns", "./plot2d/StackedColumns", "./plot2d/ClusteredColumns",
  14716. "./plot2d/Bars", "./plot2d/StackedBars", "./plot2d/ClusteredBars", "./plot2d/Grid", "./plot2d/Pie",
  14717. "./plot2d/Bubble", "./plot2d/Candlesticks", "./plot2d/OHLC", "./plot2d/Spider"],
  14718. function(dojo, dojox, Chart){
  14719. dojo.deprecated("dojox.charting.Chart2D", "Use dojo.charting.Chart instead and require all other components explicitly", "2.0");
  14720. // module:
  14721. // dojox/charting/Chart2D
  14722. // summary:
  14723. // This is a compatibility module which loads all charting modules that used to be automatically
  14724. // loaded in versions prior to 1.6. It is highly recommended for performance reasons that
  14725. // this module no longer be referenced by applications. Instead, use dojox/charting/Chart.
  14726. return dojox.charting.Chart2D = Chart;
  14727. });
  14728. },
  14729. 'dojox/charting/scaler/linear':function(){
  14730. define(["dojo/_base/lang", "./common"],
  14731. function(lang, common){
  14732. var linear = lang.getObject("dojox.charting.scaler.linear", true);
  14733. var deltaLimit = 3, // pixels
  14734. findString = common.findString,
  14735. getLabel = common.getNumericLabel;
  14736. var calcTicks = function(min, max, kwArgs, majorTick, minorTick, microTick, span){
  14737. kwArgs = lang.delegate(kwArgs);
  14738. if(!majorTick){
  14739. if(kwArgs.fixUpper == "major"){ kwArgs.fixUpper = "minor"; }
  14740. if(kwArgs.fixLower == "major"){ kwArgs.fixLower = "minor"; }
  14741. }
  14742. if(!minorTick){
  14743. if(kwArgs.fixUpper == "minor"){ kwArgs.fixUpper = "micro"; }
  14744. if(kwArgs.fixLower == "minor"){ kwArgs.fixLower = "micro"; }
  14745. }
  14746. if(!microTick){
  14747. if(kwArgs.fixUpper == "micro"){ kwArgs.fixUpper = "none"; }
  14748. if(kwArgs.fixLower == "micro"){ kwArgs.fixLower = "none"; }
  14749. }
  14750. var lowerBound = findString(kwArgs.fixLower, ["major"]) ?
  14751. Math.floor(kwArgs.min / majorTick) * majorTick :
  14752. findString(kwArgs.fixLower, ["minor"]) ?
  14753. Math.floor(kwArgs.min / minorTick) * minorTick :
  14754. findString(kwArgs.fixLower, ["micro"]) ?
  14755. Math.floor(kwArgs.min / microTick) * microTick : kwArgs.min,
  14756. upperBound = findString(kwArgs.fixUpper, ["major"]) ?
  14757. Math.ceil(kwArgs.max / majorTick) * majorTick :
  14758. findString(kwArgs.fixUpper, ["minor"]) ?
  14759. Math.ceil(kwArgs.max / minorTick) * minorTick :
  14760. findString(kwArgs.fixUpper, ["micro"]) ?
  14761. Math.ceil(kwArgs.max / microTick) * microTick : kwArgs.max;
  14762. if(kwArgs.useMin){ min = lowerBound; }
  14763. if(kwArgs.useMax){ max = upperBound; }
  14764. var majorStart = (!majorTick || kwArgs.useMin && findString(kwArgs.fixLower, ["major"])) ?
  14765. min : Math.ceil(min / majorTick) * majorTick,
  14766. minorStart = (!minorTick || kwArgs.useMin && findString(kwArgs.fixLower, ["major", "minor"])) ?
  14767. min : Math.ceil(min / minorTick) * minorTick,
  14768. microStart = (! microTick || kwArgs.useMin && findString(kwArgs.fixLower, ["major", "minor", "micro"])) ?
  14769. min : Math.ceil(min / microTick) * microTick,
  14770. majorCount = !majorTick ? 0 : (kwArgs.useMax && findString(kwArgs.fixUpper, ["major"]) ?
  14771. Math.round((max - majorStart) / majorTick) :
  14772. Math.floor((max - majorStart) / majorTick)) + 1,
  14773. minorCount = !minorTick ? 0 : (kwArgs.useMax && findString(kwArgs.fixUpper, ["major", "minor"]) ?
  14774. Math.round((max - minorStart) / minorTick) :
  14775. Math.floor((max - minorStart) / minorTick)) + 1,
  14776. microCount = !microTick ? 0 : (kwArgs.useMax && findString(kwArgs.fixUpper, ["major", "minor", "micro"]) ?
  14777. Math.round((max - microStart) / microTick) :
  14778. Math.floor((max - microStart) / microTick)) + 1,
  14779. minorPerMajor = minorTick ? Math.round(majorTick / minorTick) : 0,
  14780. microPerMinor = microTick ? Math.round(minorTick / microTick) : 0,
  14781. majorPrecision = majorTick ? Math.floor(Math.log(majorTick) / Math.LN10) : 0,
  14782. minorPrecision = minorTick ? Math.floor(Math.log(minorTick) / Math.LN10) : 0,
  14783. scale = span / (max - min);
  14784. if(!isFinite(scale)){ scale = 1; }
  14785. return {
  14786. bounds: {
  14787. lower: lowerBound,
  14788. upper: upperBound,
  14789. from: min,
  14790. to: max,
  14791. scale: scale,
  14792. span: span
  14793. },
  14794. major: {
  14795. tick: majorTick,
  14796. start: majorStart,
  14797. count: majorCount,
  14798. prec: majorPrecision
  14799. },
  14800. minor: {
  14801. tick: minorTick,
  14802. start: minorStart,
  14803. count: minorCount,
  14804. prec: minorPrecision
  14805. },
  14806. micro: {
  14807. tick: microTick,
  14808. start: microStart,
  14809. count: microCount,
  14810. prec: 0
  14811. },
  14812. minorPerMajor: minorPerMajor,
  14813. microPerMinor: microPerMinor,
  14814. scaler: linear
  14815. };
  14816. };
  14817. return lang.mixin(linear, {
  14818. buildScaler: function(/*Number*/ min, /*Number*/ max, /*Number*/ span, /*Object*/ kwArgs){
  14819. var h = {fixUpper: "none", fixLower: "none", natural: false};
  14820. if(kwArgs){
  14821. if("fixUpper" in kwArgs){ h.fixUpper = String(kwArgs.fixUpper); }
  14822. if("fixLower" in kwArgs){ h.fixLower = String(kwArgs.fixLower); }
  14823. if("natural" in kwArgs){ h.natural = Boolean(kwArgs.natural); }
  14824. }
  14825. // update bounds
  14826. if("min" in kwArgs){ min = kwArgs.min; }
  14827. if("max" in kwArgs){ max = kwArgs.max; }
  14828. if(kwArgs.includeZero){
  14829. if(min > 0){ min = 0; }
  14830. if(max < 0){ max = 0; }
  14831. }
  14832. h.min = min;
  14833. h.useMin = true;
  14834. h.max = max;
  14835. h.useMax = true;
  14836. if("from" in kwArgs){
  14837. min = kwArgs.from;
  14838. h.useMin = false;
  14839. }
  14840. if("to" in kwArgs){
  14841. max = kwArgs.to;
  14842. h.useMax = false;
  14843. }
  14844. // check for erroneous condition
  14845. if(max <= min){
  14846. return calcTicks(min, max, h, 0, 0, 0, span); // Object
  14847. }
  14848. var mag = Math.floor(Math.log(max - min) / Math.LN10),
  14849. major = kwArgs && ("majorTickStep" in kwArgs) ? kwArgs.majorTickStep : Math.pow(10, mag),
  14850. minor = 0, micro = 0, ticks;
  14851. // calculate minor ticks
  14852. if(kwArgs && ("minorTickStep" in kwArgs)){
  14853. minor = kwArgs.minorTickStep;
  14854. }else{
  14855. do{
  14856. minor = major / 10;
  14857. if(!h.natural || minor > 0.9){
  14858. ticks = calcTicks(min, max, h, major, minor, 0, span);
  14859. if(ticks.bounds.scale * ticks.minor.tick > deltaLimit){ break; }
  14860. }
  14861. minor = major / 5;
  14862. if(!h.natural || minor > 0.9){
  14863. ticks = calcTicks(min, max, h, major, minor, 0, span);
  14864. if(ticks.bounds.scale * ticks.minor.tick > deltaLimit){ break; }
  14865. }
  14866. minor = major / 2;
  14867. if(!h.natural || minor > 0.9){
  14868. ticks = calcTicks(min, max, h, major, minor, 0, span);
  14869. if(ticks.bounds.scale * ticks.minor.tick > deltaLimit){ break; }
  14870. }
  14871. return calcTicks(min, max, h, major, 0, 0, span); // Object
  14872. }while(false);
  14873. }
  14874. // calculate micro ticks
  14875. if(kwArgs && ("microTickStep" in kwArgs)){
  14876. micro = kwArgs.microTickStep;
  14877. ticks = calcTicks(min, max, h, major, minor, micro, span);
  14878. }else{
  14879. do{
  14880. micro = minor / 10;
  14881. if(!h.natural || micro > 0.9){
  14882. ticks = calcTicks(min, max, h, major, minor, micro, span);
  14883. if(ticks.bounds.scale * ticks.micro.tick > deltaLimit){ break; }
  14884. }
  14885. micro = minor / 5;
  14886. if(!h.natural || micro > 0.9){
  14887. ticks = calcTicks(min, max, h, major, minor, micro, span);
  14888. if(ticks.bounds.scale * ticks.micro.tick > deltaLimit){ break; }
  14889. }
  14890. micro = minor / 2;
  14891. if(!h.natural || micro > 0.9){
  14892. ticks = calcTicks(min, max, h, major, minor, micro, span);
  14893. if(ticks.bounds.scale * ticks.micro.tick > deltaLimit){ break; }
  14894. }
  14895. micro = 0;
  14896. }while(false);
  14897. }
  14898. return micro ? ticks : calcTicks(min, max, h, major, minor, 0, span); // Object
  14899. },
  14900. buildTicks: function(/*Object*/ scaler, /*Object*/ kwArgs){
  14901. var step, next, tick,
  14902. nextMajor = scaler.major.start,
  14903. nextMinor = scaler.minor.start,
  14904. nextMicro = scaler.micro.start;
  14905. if(kwArgs.microTicks && scaler.micro.tick){
  14906. step = scaler.micro.tick, next = nextMicro;
  14907. }else if(kwArgs.minorTicks && scaler.minor.tick){
  14908. step = scaler.minor.tick, next = nextMinor;
  14909. }else if(scaler.major.tick){
  14910. step = scaler.major.tick, next = nextMajor;
  14911. }else{
  14912. // no ticks
  14913. return null;
  14914. }
  14915. // make sure that we have finite bounds
  14916. var revScale = 1 / scaler.bounds.scale;
  14917. if(scaler.bounds.to <= scaler.bounds.from || isNaN(revScale) || !isFinite(revScale) ||
  14918. step <= 0 || isNaN(step) || !isFinite(step)){
  14919. // no ticks
  14920. return null;
  14921. }
  14922. // loop over all ticks
  14923. var majorTicks = [], minorTicks = [], microTicks = [];
  14924. while(next <= scaler.bounds.to + revScale){
  14925. if(Math.abs(nextMajor - next) < step / 2){
  14926. // major tick
  14927. tick = {value: nextMajor};
  14928. if(kwArgs.majorLabels){
  14929. tick.label = getLabel(nextMajor, scaler.major.prec, kwArgs);
  14930. }
  14931. majorTicks.push(tick);
  14932. nextMajor += scaler.major.tick;
  14933. nextMinor += scaler.minor.tick;
  14934. nextMicro += scaler.micro.tick;
  14935. }else if(Math.abs(nextMinor - next) < step / 2){
  14936. // minor tick
  14937. if(kwArgs.minorTicks){
  14938. tick = {value: nextMinor};
  14939. if(kwArgs.minorLabels && (scaler.minMinorStep <= scaler.minor.tick * scaler.bounds.scale)){
  14940. tick.label = getLabel(nextMinor, scaler.minor.prec, kwArgs);
  14941. }
  14942. minorTicks.push(tick);
  14943. }
  14944. nextMinor += scaler.minor.tick;
  14945. nextMicro += scaler.micro.tick;
  14946. }else{
  14947. // micro tick
  14948. if(kwArgs.microTicks){
  14949. microTicks.push({value: nextMicro});
  14950. }
  14951. nextMicro += scaler.micro.tick;
  14952. }
  14953. next += step;
  14954. }
  14955. return {major: majorTicks, minor: minorTicks, micro: microTicks}; // Object
  14956. },
  14957. getTransformerFromModel: function(/*Object*/ scaler){
  14958. var offset = scaler.bounds.from, scale = scaler.bounds.scale;
  14959. return function(x){ return (x - offset) * scale; }; // Function
  14960. },
  14961. getTransformerFromPlot: function(/*Object*/ scaler){
  14962. var offset = scaler.bounds.from, scale = scaler.bounds.scale;
  14963. return function(x){ return x / scale + offset; }; // Function
  14964. }
  14965. });
  14966. });
  14967. },
  14968. 'dojox/gfx/renderer':function(){
  14969. define("dojox/gfx/renderer", ["./_base","dojo/_base/lang", "dojo/_base/sniff", "dojo/_base/window", "dojo/_base/config"],
  14970. function(g, lang, has, win, config){
  14971. //>> noBuildResolver
  14972. /*=====
  14973. dojox.gfx.renderer = {
  14974. // summary:
  14975. // This module is an AMD loader plugin that loads the appropriate graphics renderer
  14976. // implementation based on detected environment and current configuration settings.
  14977. };
  14978. =====*/
  14979. var currentRenderer = null;
  14980. has.add("vml", function(global, document, element){
  14981. element.innerHTML = "<v:shape adj=\"1\"/>";
  14982. var supported = ("adj" in element.firstChild);
  14983. element.innerHTML = "";
  14984. return supported;
  14985. });
  14986. return {
  14987. load: function(id, require, load){
  14988. if(currentRenderer && id != "force"){
  14989. load(currentRenderer);
  14990. return;
  14991. }
  14992. var renderer = config.forceGfxRenderer,
  14993. renderers = !renderer && (lang.isString(config.gfxRenderer) ?
  14994. config.gfxRenderer : "svg,vml,canvas,silverlight").split(","),
  14995. silverlightObject, silverlightFlag;
  14996. while(!renderer && renderers.length){
  14997. switch(renderers.shift()){
  14998. case "svg":
  14999. // the next test is from https://github.com/phiggins42/has.js
  15000. if("SVGAngle" in win.global){
  15001. renderer = "svg";
  15002. }
  15003. break;
  15004. case "vml":
  15005. if(has("vml")){
  15006. renderer = "vml";
  15007. }
  15008. break;
  15009. case "silverlight":
  15010. try{
  15011. if(has("ie")){
  15012. silverlightObject = new ActiveXObject("AgControl.AgControl");
  15013. if(silverlightObject && silverlightObject.IsVersionSupported("1.0")){
  15014. silverlightFlag = true;
  15015. }
  15016. }else{
  15017. if(navigator.plugins["Silverlight Plug-In"]){
  15018. silverlightFlag = true;
  15019. }
  15020. }
  15021. }catch(e){
  15022. silverlightFlag = false;
  15023. }finally{
  15024. silverlightObject = null;
  15025. }
  15026. if(silverlightFlag){
  15027. renderer = "silverlight";
  15028. }
  15029. break;
  15030. case "canvas":
  15031. if(win.global.CanvasRenderingContext2D){
  15032. renderer = "canvas";
  15033. }
  15034. break;
  15035. }
  15036. }
  15037. if (renderer === 'canvas' && config.canvasEvents !== false) {
  15038. renderer = "canvasWithEvents";
  15039. }
  15040. if(config.isDebug){
  15041. console.log("gfx renderer = " + renderer);
  15042. }
  15043. function loadRenderer(){
  15044. require(["dojox/gfx/" + renderer], function(module){
  15045. g.renderer = renderer;
  15046. // memorize the renderer module
  15047. currentRenderer = module;
  15048. // now load it
  15049. load(module);
  15050. });
  15051. }
  15052. if(renderer == "svg" && typeof window.svgweb != "undefined"){
  15053. window.svgweb.addOnLoad(loadRenderer);
  15054. }else{
  15055. loadRenderer();
  15056. }
  15057. }
  15058. };
  15059. });
  15060. },
  15061. 'dojox/charting/widget/Chart':function(){
  15062. define("dojox/charting/widget/Chart", ["dojo/_base/kernel", "dojo/_base/lang", "dojo/_base/array","dojo/_base/html","dojo/_base/declare", "dojo/query",
  15063. "dijit/_Widget", "../Chart", "dojox/lang/utils", "dojox/lang/functional","dojox/lang/functional/lambda",
  15064. "dijit/_base/manager"],
  15065. function(kernel, lang, arr, html, declare, query, Widget, Chart, du, df, dfl){
  15066. /*=====
  15067. var Widget = dijit._Widget;
  15068. =====*/
  15069. var collectParams, collectAxisParams, collectPlotParams,
  15070. collectActionParams, collectDataParams,
  15071. notNull = function(o){ return o; },
  15072. dc = lang.getObject("dojox.charting");
  15073. var ChartWidget = declare("dojox.charting.widget.Chart", Widget, {
  15074. // parameters for the markup
  15075. // theme for the chart
  15076. theme: null,
  15077. // margins for the chart: {l: 10, r: 10, t: 10, b: 10}
  15078. margins: null,
  15079. // chart area, define them as undefined to:
  15080. // allow the parser to take them into account
  15081. // but make sure they have no defined value to not override theme
  15082. stroke: undefined,
  15083. fill: undefined,
  15084. // methods
  15085. buildRendering: function(){
  15086. this.inherited(arguments);
  15087. n = this.domNode;
  15088. // collect chart parameters
  15089. var axes = query("> .axis", n).map(collectAxisParams).filter(notNull),
  15090. plots = query("> .plot", n).map(collectPlotParams).filter(notNull),
  15091. actions = query("> .action", n).map(collectActionParams).filter(notNull),
  15092. series = query("> .series", n).map(collectDataParams).filter(notNull);
  15093. // build the chart
  15094. n.innerHTML = "";
  15095. var c = this.chart = new Chart(n, {
  15096. margins: this.margins,
  15097. stroke: this.stroke,
  15098. fill: this.fill,
  15099. textDir: this.textDir
  15100. });
  15101. // add collected parameters
  15102. if(this.theme){
  15103. c.setTheme(this.theme);
  15104. }
  15105. axes.forEach(function(axis){
  15106. c.addAxis(axis.name, axis.kwArgs);
  15107. });
  15108. plots.forEach(function(plot){
  15109. c.addPlot(plot.name, plot.kwArgs);
  15110. });
  15111. this.actions = actions.map(function(action){
  15112. return new action.action(c, action.plot, action.kwArgs);
  15113. });
  15114. var render = df.foldl(series, function(render, series){
  15115. if(series.type == "data"){
  15116. c.addSeries(series.name, series.data, series.kwArgs);
  15117. render = true;
  15118. }else{
  15119. c.addSeries(series.name, [0], series.kwArgs);
  15120. var kw = {};
  15121. du.updateWithPattern(
  15122. kw,
  15123. series.kwArgs,
  15124. {
  15125. "query": "",
  15126. "queryOptions": null,
  15127. "start": 0,
  15128. "count": 1 //,
  15129. // "sort": []
  15130. },
  15131. true
  15132. );
  15133. if(series.kwArgs.sort){
  15134. // sort is a complex object type and doesn't survive coercian
  15135. kw.sort = lang.clone(series.kwArgs.sort);
  15136. }
  15137. lang.mixin(kw, {
  15138. onComplete: function(data){
  15139. var values;
  15140. if("valueFn" in series.kwArgs){
  15141. var fn = series.kwArgs.valueFn;
  15142. values = arr.map(data, function(x){
  15143. return fn(series.data.getValue(x, series.field, 0));
  15144. });
  15145. }else{
  15146. values = arr.map(data, function(x){
  15147. return series.data.getValue(x, series.field, 0);
  15148. });
  15149. }
  15150. c.addSeries(series.name, values, series.kwArgs).render();
  15151. }
  15152. });
  15153. series.data.fetch(kw);
  15154. }
  15155. return render;
  15156. }, false);
  15157. if(render){ c.render(); }
  15158. },
  15159. destroy: function(){
  15160. // summary: properly destroy the widget
  15161. this.chart.destroy();
  15162. this.inherited(arguments);
  15163. },
  15164. resize: function(box){
  15165. // summary:
  15166. // Resize the widget.
  15167. // description:
  15168. // Resize the domNode and the widget surface to the dimensions of a box of the following form:
  15169. // `{ l: 50, t: 200, w: 300: h: 150 }`
  15170. // If no box is provided, resize the surface to the marginBox of the domNode.
  15171. // box:
  15172. // If passed, denotes the new size of the widget.
  15173. this.chart.resize(box);
  15174. }
  15175. });
  15176. collectParams = function(node, type, kw){
  15177. var dp = eval("(" + type + ".prototype.defaultParams)");
  15178. var x, attr;
  15179. for(x in dp){
  15180. if(x in kw){ continue; }
  15181. attr = node.getAttribute(x);
  15182. kw[x] = du.coerceType(dp[x], attr == null || typeof attr == "undefined" ? dp[x] : attr);
  15183. }
  15184. var op = eval("(" + type + ".prototype.optionalParams)");
  15185. for(x in op){
  15186. if(x in kw){ continue; }
  15187. attr = node.getAttribute(x);
  15188. if(attr != null){
  15189. kw[x] = du.coerceType(op[x], attr);
  15190. }
  15191. }
  15192. };
  15193. collectAxisParams = function(node){
  15194. var name = node.getAttribute("name"), type = node.getAttribute("type");
  15195. if(!name){ return null; }
  15196. var o = {name: name, kwArgs: {}}, kw = o.kwArgs;
  15197. if(type){
  15198. if(dc.axis2d[type]){
  15199. type = dojo._scopeName + "x.charting.axis2d." + type;
  15200. }
  15201. var axis = eval("(" + type + ")");
  15202. if(axis){ kw.type = axis; }
  15203. }else{
  15204. type = dojo._scopeName + "x.charting.axis2d.Default";
  15205. }
  15206. collectParams(node, type, kw);
  15207. // compatibility conversions
  15208. if(kw.font || kw.fontColor){
  15209. if(!kw.tick){
  15210. kw.tick = {};
  15211. }
  15212. if(kw.font){
  15213. kw.tick.font = kw.font;
  15214. }
  15215. if(kw.fontColor){
  15216. kw.tick.fontColor = kw.fontColor;
  15217. }
  15218. }
  15219. return o;
  15220. };
  15221. collectPlotParams = function(node){
  15222. // var name = d.attr(node, "name"), type = d.attr(node, "type");
  15223. var name = node.getAttribute("name"), type = node.getAttribute("type");
  15224. if(!name){ return null; }
  15225. var o = {name: name, kwArgs: {}}, kw = o.kwArgs;
  15226. if(type){
  15227. if(dc.plot2d && dc.plot2d[type]){
  15228. type = dojo._scopeName + "x.charting.plot2d." + type;
  15229. }
  15230. var plot = eval("(" + type + ")");
  15231. if(plot){ kw.type = plot; }
  15232. }else{
  15233. type = dojo._scopeName + "x.charting.plot2d.Default";
  15234. }
  15235. collectParams(node, type, kw);
  15236. return o;
  15237. };
  15238. collectActionParams = function(node){
  15239. // var plot = d.attr(node, "plot"), type = d.attr(node, "type");
  15240. var plot = node.getAttribute("plot"), type = node.getAttribute("type");
  15241. if(!plot){ plot = "default"; }
  15242. var o = {plot: plot, kwArgs: {}}, kw = o.kwArgs;
  15243. if(type){
  15244. if(dc.action2d[type]){
  15245. type = dojo._scopeName + "x.charting.action2d." + type;
  15246. }
  15247. var action = eval("(" + type + ")");
  15248. if(!action){ return null; }
  15249. o.action = action;
  15250. }else{
  15251. return null;
  15252. }
  15253. collectParams(node, type, kw);
  15254. return o;
  15255. };
  15256. collectDataParams = function(node){
  15257. var ga = lang.partial(html.attr, node);
  15258. var name = ga("name");
  15259. if(!name){ return null; }
  15260. var o = { name: name, kwArgs: {} }, kw = o.kwArgs, t;
  15261. t = ga("plot");
  15262. if(t != null){ kw.plot = t; }
  15263. t = ga("marker");
  15264. if(t != null){ kw.marker = t; }
  15265. t = ga("stroke");
  15266. if(t != null){ kw.stroke = eval("(" + t + ")"); }
  15267. t = ga("outline");
  15268. if(t != null){ kw.outline = eval("(" + t + ")"); }
  15269. t = ga("shadow");
  15270. if(t != null){ kw.shadow = eval("(" + t + ")"); }
  15271. t = ga("fill");
  15272. if(t != null){ kw.fill = eval("(" + t + ")"); }
  15273. t = ga("font");
  15274. if(t != null){ kw.font = t; }
  15275. t = ga("fontColor");
  15276. if(t != null){ kw.fontColor = eval("(" + t + ")"); }
  15277. t = ga("legend");
  15278. if(t != null){ kw.legend = t; }
  15279. t = ga("data");
  15280. if(t != null){
  15281. o.type = "data";
  15282. o.data = t ? arr.map(String(t).split(','), Number) : [];
  15283. return o;
  15284. }
  15285. t = ga("array");
  15286. if(t != null){
  15287. o.type = "data";
  15288. o.data = eval("(" + t + ")");
  15289. return o;
  15290. }
  15291. t = ga("store");
  15292. if(t != null){
  15293. o.type = "store";
  15294. o.data = eval("(" + t + ")");
  15295. t = ga("field");
  15296. o.field = t != null ? t : "value";
  15297. t = ga("query");
  15298. if(!!t){ kw.query = t; }
  15299. t = ga("queryOptions");
  15300. if(!!t){ kw.queryOptions = eval("(" + t + ")"); }
  15301. t = ga("start");
  15302. if(!!t){ kw.start = Number(t); }
  15303. t = ga("count");
  15304. if(!!t){ kw.count = Number(t); }
  15305. t = ga("sort");
  15306. if(!!t){ kw.sort = eval("("+t+")"); }
  15307. t = ga("valueFn");
  15308. if(!!t){ kw.valueFn = dfl.lambda(t); }
  15309. return o;
  15310. }
  15311. return null;
  15312. };
  15313. return ChartWidget;
  15314. });
  15315. },
  15316. 'dojox/lang/functional':function(){
  15317. define("dojox/lang/functional", ["./functional/lambda", "./functional/array", "./functional/object"], function(df){
  15318. return df;
  15319. });
  15320. },
  15321. 'dojox/charting/scaler/common':function(){
  15322. define("dojox/charting/scaler/common", ["dojo/_base/lang"], function(lang){
  15323. var eq = function(/*Number*/ a, /*Number*/ b){
  15324. // summary: compare two FP numbers for equality
  15325. return Math.abs(a - b) <= 1e-6 * (Math.abs(a) + Math.abs(b)); // Boolean
  15326. };
  15327. var common = lang.getObject("dojox.charting.scaler.common", true);
  15328. var testedModules = {};
  15329. return lang.mixin(common, {
  15330. doIfLoaded: function(moduleName, ifloaded, ifnotloaded){
  15331. if(testedModules[moduleName] == undefined){
  15332. try{
  15333. testedModules[moduleName] = require(moduleName);
  15334. }catch(e){
  15335. testedModules[moduleName] = null;
  15336. }
  15337. }
  15338. if(testedModules[moduleName]){
  15339. return ifloaded(testedModules[moduleName]);
  15340. }else{
  15341. return ifnotloaded();
  15342. }
  15343. },
  15344. findString: function(/*String*/ val, /*Array*/ text){
  15345. val = val.toLowerCase();
  15346. for(var i = 0; i < text.length; ++i){
  15347. if(val == text[i]){ return true; }
  15348. }
  15349. return false;
  15350. },
  15351. getNumericLabel: function(/*Number*/ number, /*Number*/ precision, /*Object*/ kwArgs){
  15352. var def = "";
  15353. common.doIfLoaded("dojo/number", function(numberLib){
  15354. def = (kwArgs.fixed ? numberLib.format(number, {places : precision < 0 ? -precision : 0}) :
  15355. numberLib.format(number)) || "";
  15356. }, function(){
  15357. def = kwArgs.fixed ? number.toFixed(precision < 0 ? -precision : 0) : number.toString();
  15358. });
  15359. if(kwArgs.labelFunc){
  15360. var r = kwArgs.labelFunc(def, number, precision);
  15361. if(r){ return r; }
  15362. // else fall through to the regular labels search
  15363. }
  15364. if(kwArgs.labels){
  15365. // classic binary search
  15366. var l = kwArgs.labels, lo = 0, hi = l.length;
  15367. while(lo < hi){
  15368. var mid = Math.floor((lo + hi) / 2), val = l[mid].value;
  15369. if(val < number){
  15370. lo = mid + 1;
  15371. }else{
  15372. hi = mid;
  15373. }
  15374. }
  15375. // lets take into account FP errors
  15376. if(lo < l.length && eq(l[lo].value, number)){
  15377. return l[lo].text;
  15378. }
  15379. --lo;
  15380. if(lo >= 0 && lo < l.length && eq(l[lo].value, number)){
  15381. return l[lo].text;
  15382. }
  15383. lo += 2;
  15384. if(lo < l.length && eq(l[lo].value, number)){
  15385. return l[lo].text;
  15386. }
  15387. // otherwise we will produce a number
  15388. }
  15389. return def;
  15390. }
  15391. });
  15392. });
  15393. },
  15394. 'dojox/charting/axis2d/common':function(){
  15395. define("dojox/charting/axis2d/common", ["dojo/_base/lang", "dojo/_base/html", "dojo/_base/window", "dojo/dom-geometry", "dojox/gfx"],
  15396. function(lang, html, win, domGeom, g){
  15397. var common = lang.getObject("dojox.charting.axis2d.common", true);
  15398. var clearNode = function(s){
  15399. s.marginLeft = "0px";
  15400. s.marginTop = "0px";
  15401. s.marginRight = "0px";
  15402. s.marginBottom = "0px";
  15403. s.paddingLeft = "0px";
  15404. s.paddingTop = "0px";
  15405. s.paddingRight = "0px";
  15406. s.paddingBottom = "0px";
  15407. s.borderLeftWidth = "0px";
  15408. s.borderTopWidth = "0px";
  15409. s.borderRightWidth = "0px";
  15410. s.borderBottomWidth = "0px";
  15411. };
  15412. var getBoxWidth = function(n){
  15413. // marginBox is incredibly slow, so avoid it if we can
  15414. if(n["getBoundingClientRect"]){
  15415. var bcr = n.getBoundingClientRect();
  15416. return bcr.width || (bcr.right - bcr.left);
  15417. }else{
  15418. return domGeom.getMarginBox(n).w;
  15419. }
  15420. };
  15421. return lang.mixin(common, {
  15422. // summary:
  15423. // Common methods to be used by any axis. This is considered "static".
  15424. createText: {
  15425. gfx: function(chart, creator, x, y, align, text, font, fontColor){
  15426. // summary:
  15427. // Use dojox.gfx to create any text.
  15428. // chart: dojox.charting.Chart
  15429. // The chart to create the text into.
  15430. // creator: dojox.gfx.Surface
  15431. // The graphics surface to use for creating the text.
  15432. // x: Number
  15433. // Where to create the text along the x axis (CSS left).
  15434. // y: Number
  15435. // Where to create the text along the y axis (CSS top).
  15436. // align: String
  15437. // How to align the text. Can be "left", "right", "center".
  15438. // text: String
  15439. // The text to render.
  15440. // font: String
  15441. // The font definition, a la CSS "font".
  15442. // fontColor: String|dojo.Color
  15443. // The color of the resultant text.
  15444. // returns: dojox.gfx.Text
  15445. // The resultant GFX object.
  15446. return creator.createText({
  15447. x: x, y: y, text: text, align: align
  15448. }).setFont(font).setFill(fontColor); // dojox.gfx.Text
  15449. },
  15450. html: function(chart, creator, x, y, align, text, font, fontColor, labelWidth){
  15451. // summary:
  15452. // Use the HTML DOM to create any text.
  15453. // chart: dojox.charting.Chart
  15454. // The chart to create the text into.
  15455. // creator: dojox.gfx.Surface
  15456. // The graphics surface to use for creating the text.
  15457. // x: Number
  15458. // Where to create the text along the x axis (CSS left).
  15459. // y: Number
  15460. // Where to create the text along the y axis (CSS top).
  15461. // align: String
  15462. // How to align the text. Can be "left", "right", "center".
  15463. // text: String
  15464. // The text to render.
  15465. // font: String
  15466. // The font definition, a la CSS "font".
  15467. // fontColor: String|dojo.Color
  15468. // The color of the resultant text.
  15469. // labelWidth: Number?
  15470. // The maximum width of the resultant DOM node.
  15471. // returns: DOMNode
  15472. // The resultant DOMNode (a "div" element).
  15473. // setup the text node
  15474. var p = win.doc.createElement("div"), s = p.style, boxWidth;
  15475. // bidi support, if this function exists the module was loaded
  15476. if(chart.getTextDir){
  15477. p.dir = chart.getTextDir(text);
  15478. }
  15479. clearNode(s);
  15480. s.font = font;
  15481. p.innerHTML = String(text).replace(/\s/g, "&nbsp;");
  15482. s.color = fontColor;
  15483. // measure the size
  15484. s.position = "absolute";
  15485. s.left = "-10000px";
  15486. win.body().appendChild(p);
  15487. var size = g.normalizedLength(g.splitFontString(font).size);
  15488. // do we need to calculate the label width?
  15489. if(!labelWidth){
  15490. boxWidth = getBoxWidth(p);
  15491. }
  15492. // when the textDir is rtl, but the UI ltr needs
  15493. // to recalculate the starting point
  15494. if(p.dir == "rtl"){
  15495. x += labelWidth ? labelWidth : boxWidth;
  15496. }
  15497. // new settings for the text node
  15498. win.body().removeChild(p);
  15499. s.position = "relative";
  15500. if(labelWidth){
  15501. s.width = labelWidth + "px";
  15502. // s.border = "1px dotted grey";
  15503. switch(align){
  15504. case "middle":
  15505. s.textAlign = "center";
  15506. s.left = (x - labelWidth / 2) + "px";
  15507. break;
  15508. case "end":
  15509. s.textAlign = "right";
  15510. s.left = (x - labelWidth) + "px";
  15511. break;
  15512. default:
  15513. s.left = x + "px";
  15514. s.textAlign = "left";
  15515. break;
  15516. }
  15517. }else{
  15518. switch(align){
  15519. case "middle":
  15520. s.left = Math.floor(x - boxWidth / 2) + "px";
  15521. // s.left = Math.floor(x - p.offsetWidth / 2) + "px";
  15522. break;
  15523. case "end":
  15524. s.left = Math.floor(x - boxWidth) + "px";
  15525. // s.left = Math.floor(x - p.offsetWidth) + "px";
  15526. break;
  15527. //case "start":
  15528. default:
  15529. s.left = Math.floor(x) + "px";
  15530. break;
  15531. }
  15532. }
  15533. s.top = Math.floor(y - size) + "px";
  15534. s.whiteSpace = "nowrap"; // hack for WebKit
  15535. // setup the wrapper node
  15536. var wrap = win.doc.createElement("div"), w = wrap.style;
  15537. clearNode(w);
  15538. w.width = "0px";
  15539. w.height = "0px";
  15540. // insert nodes
  15541. wrap.appendChild(p)
  15542. chart.node.insertBefore(wrap, chart.node.firstChild);
  15543. return wrap; // DOMNode
  15544. }
  15545. }
  15546. });
  15547. });
  15548. },
  15549. 'dijit/_TemplatedMixin':function(){
  15550. define("dijit/_TemplatedMixin", [
  15551. "dojo/_base/lang", // lang.getObject
  15552. "dojo/touch",
  15553. "./_WidgetBase",
  15554. "dojo/string", // string.substitute string.trim
  15555. "dojo/cache", // dojo.cache
  15556. "dojo/_base/array", // array.forEach
  15557. "dojo/_base/declare", // declare
  15558. "dojo/dom-construct", // domConstruct.destroy, domConstruct.toDom
  15559. "dojo/_base/sniff", // has("ie")
  15560. "dojo/_base/unload", // unload.addOnWindowUnload
  15561. "dojo/_base/window" // win.doc
  15562. ], function(lang, touch, _WidgetBase, string, cache, array, declare, domConstruct, has, unload, win) {
  15563. /*=====
  15564. var _WidgetBase = dijit._WidgetBase;
  15565. =====*/
  15566. // module:
  15567. // dijit/_TemplatedMixin
  15568. // summary:
  15569. // Mixin for widgets that are instantiated from a template
  15570. var _TemplatedMixin = declare("dijit._TemplatedMixin", null, {
  15571. // summary:
  15572. // Mixin for widgets that are instantiated from a template
  15573. // templateString: [protected] String
  15574. // A string that represents the widget template.
  15575. // Use in conjunction with dojo.cache() to load from a file.
  15576. templateString: null,
  15577. // templatePath: [protected deprecated] String
  15578. // Path to template (HTML file) for this widget relative to dojo.baseUrl.
  15579. // Deprecated: use templateString with require([... "dojo/text!..."], ...) instead
  15580. templatePath: null,
  15581. // skipNodeCache: [protected] Boolean
  15582. // If using a cached widget template nodes poses issues for a
  15583. // particular widget class, it can set this property to ensure
  15584. // that its template is always re-built from a string
  15585. _skipNodeCache: false,
  15586. // _earlyTemplatedStartup: Boolean
  15587. // A fallback to preserve the 1.0 - 1.3 behavior of children in
  15588. // templates having their startup called before the parent widget
  15589. // fires postCreate. Defaults to 'false', causing child widgets to
  15590. // have their .startup() called immediately before a parent widget
  15591. // .startup(), but always after the parent .postCreate(). Set to
  15592. // 'true' to re-enable to previous, arguably broken, behavior.
  15593. _earlyTemplatedStartup: false,
  15594. /*=====
  15595. // _attachPoints: [private] String[]
  15596. // List of widget attribute names associated with data-dojo-attach-point=... in the
  15597. // template, ex: ["containerNode", "labelNode"]
  15598. _attachPoints: [],
  15599. =====*/
  15600. /*=====
  15601. // _attachEvents: [private] Handle[]
  15602. // List of connections associated with data-dojo-attach-event=... in the
  15603. // template
  15604. _attachEvents: [],
  15605. =====*/
  15606. constructor: function(){
  15607. this._attachPoints = [];
  15608. this._attachEvents = [];
  15609. },
  15610. _stringRepl: function(tmpl){
  15611. // summary:
  15612. // Does substitution of ${foo} type properties in template string
  15613. // tags:
  15614. // private
  15615. var className = this.declaredClass, _this = this;
  15616. // Cache contains a string because we need to do property replacement
  15617. // do the property replacement
  15618. return string.substitute(tmpl, this, function(value, key){
  15619. if(key.charAt(0) == '!'){ value = lang.getObject(key.substr(1), false, _this); }
  15620. if(typeof value == "undefined"){ throw new Error(className+" template:"+key); } // a debugging aide
  15621. if(value == null){ return ""; }
  15622. // Substitution keys beginning with ! will skip the transform step,
  15623. // in case a user wishes to insert unescaped markup, e.g. ${!foo}
  15624. return key.charAt(0) == "!" ? value :
  15625. // Safer substitution, see heading "Attribute values" in
  15626. // http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.3.2
  15627. value.toString().replace(/"/g,"&quot;"); //TODO: add &amp? use encodeXML method?
  15628. }, this);
  15629. },
  15630. buildRendering: function(){
  15631. // summary:
  15632. // Construct the UI for this widget from a template, setting this.domNode.
  15633. // tags:
  15634. // protected
  15635. if(!this.templateString){
  15636. this.templateString = cache(this.templatePath, {sanitize: true});
  15637. }
  15638. // Lookup cached version of template, and download to cache if it
  15639. // isn't there already. Returns either a DomNode or a string, depending on
  15640. // whether or not the template contains ${foo} replacement parameters.
  15641. var cached = _TemplatedMixin.getCachedTemplate(this.templateString, this._skipNodeCache);
  15642. var node;
  15643. if(lang.isString(cached)){
  15644. node = domConstruct.toDom(this._stringRepl(cached));
  15645. if(node.nodeType != 1){
  15646. // Flag common problems such as templates with multiple top level nodes (nodeType == 11)
  15647. throw new Error("Invalid template: " + cached);
  15648. }
  15649. }else{
  15650. // if it's a node, all we have to do is clone it
  15651. node = cached.cloneNode(true);
  15652. }
  15653. this.domNode = node;
  15654. // Call down to _Widget.buildRendering() to get base classes assigned
  15655. // TODO: change the baseClass assignment to _setBaseClassAttr
  15656. this.inherited(arguments);
  15657. // recurse through the node, looking for, and attaching to, our
  15658. // attachment points and events, which should be defined on the template node.
  15659. this._attachTemplateNodes(node, function(n,p){ return n.getAttribute(p); });
  15660. this._beforeFillContent(); // hook for _WidgetsInTemplateMixin
  15661. this._fillContent(this.srcNodeRef);
  15662. },
  15663. _beforeFillContent: function(){
  15664. },
  15665. _fillContent: function(/*DomNode*/ source){
  15666. // summary:
  15667. // Relocate source contents to templated container node.
  15668. // this.containerNode must be able to receive children, or exceptions will be thrown.
  15669. // tags:
  15670. // protected
  15671. var dest = this.containerNode;
  15672. if(source && dest){
  15673. while(source.hasChildNodes()){
  15674. dest.appendChild(source.firstChild);
  15675. }
  15676. }
  15677. },
  15678. _attachTemplateNodes: function(rootNode, getAttrFunc){
  15679. // summary:
  15680. // Iterate through the template and attach functions and nodes accordingly.
  15681. // Alternately, if rootNode is an array of widgets, then will process data-dojo-attach-point
  15682. // etc. for those widgets.
  15683. // description:
  15684. // Map widget properties and functions to the handlers specified in
  15685. // the dom node and it's descendants. This function iterates over all
  15686. // nodes and looks for these properties:
  15687. // * dojoAttachPoint/data-dojo-attach-point
  15688. // * dojoAttachEvent/data-dojo-attach-event
  15689. // rootNode: DomNode|Widget[]
  15690. // the node to search for properties. All children will be searched.
  15691. // getAttrFunc: Function
  15692. // a function which will be used to obtain property for a given
  15693. // DomNode/Widget
  15694. // tags:
  15695. // private
  15696. var nodes = lang.isArray(rootNode) ? rootNode : (rootNode.all || rootNode.getElementsByTagName("*"));
  15697. var x = lang.isArray(rootNode) ? 0 : -1;
  15698. for(; x<nodes.length; x++){
  15699. var baseNode = (x == -1) ? rootNode : nodes[x];
  15700. if(this.widgetsInTemplate && (getAttrFunc(baseNode, "dojoType") || getAttrFunc(baseNode, "data-dojo-type"))){
  15701. continue;
  15702. }
  15703. // Process data-dojo-attach-point
  15704. var attachPoint = getAttrFunc(baseNode, "dojoAttachPoint") || getAttrFunc(baseNode, "data-dojo-attach-point");
  15705. if(attachPoint){
  15706. var point, points = attachPoint.split(/\s*,\s*/);
  15707. while((point = points.shift())){
  15708. if(lang.isArray(this[point])){
  15709. this[point].push(baseNode);
  15710. }else{
  15711. this[point]=baseNode;
  15712. }
  15713. this._attachPoints.push(point);
  15714. }
  15715. }
  15716. // Process data-dojo-attach-event
  15717. var attachEvent = getAttrFunc(baseNode, "dojoAttachEvent") || getAttrFunc(baseNode, "data-dojo-attach-event");
  15718. if(attachEvent){
  15719. // NOTE: we want to support attributes that have the form
  15720. // "domEvent: nativeEvent; ..."
  15721. var event, events = attachEvent.split(/\s*,\s*/);
  15722. var trim = lang.trim;
  15723. while((event = events.shift())){
  15724. if(event){
  15725. var thisFunc = null;
  15726. if(event.indexOf(":") != -1){
  15727. // oh, if only JS had tuple assignment
  15728. var funcNameArr = event.split(":");
  15729. event = trim(funcNameArr[0]);
  15730. thisFunc = trim(funcNameArr[1]);
  15731. }else{
  15732. event = trim(event);
  15733. }
  15734. if(!thisFunc){
  15735. thisFunc = event;
  15736. }
  15737. // Map "press", "move" and "release" to keys.touch, keys.move, keys.release
  15738. this._attachEvents.push(this.connect(baseNode, touch[event] || event, thisFunc));
  15739. }
  15740. }
  15741. }
  15742. }
  15743. },
  15744. destroyRendering: function(){
  15745. // Delete all attach points to prevent IE6 memory leaks.
  15746. array.forEach(this._attachPoints, function(point){
  15747. delete this[point];
  15748. }, this);
  15749. this._attachPoints = [];
  15750. // And same for event handlers
  15751. array.forEach(this._attachEvents, this.disconnect, this);
  15752. this._attachEvents = [];
  15753. this.inherited(arguments);
  15754. }
  15755. });
  15756. // key is templateString; object is either string or DOM tree
  15757. _TemplatedMixin._templateCache = {};
  15758. _TemplatedMixin.getCachedTemplate = function(templateString, alwaysUseString){
  15759. // summary:
  15760. // Static method to get a template based on the templatePath or
  15761. // templateString key
  15762. // templateString: String
  15763. // The template
  15764. // alwaysUseString: Boolean
  15765. // Don't cache the DOM tree for this template, even if it doesn't have any variables
  15766. // returns: Mixed
  15767. // Either string (if there are ${} variables that need to be replaced) or just
  15768. // a DOM tree (if the node can be cloned directly)
  15769. // is it already cached?
  15770. var tmplts = _TemplatedMixin._templateCache;
  15771. var key = templateString;
  15772. var cached = tmplts[key];
  15773. if(cached){
  15774. try{
  15775. // if the cached value is an innerHTML string (no ownerDocument) or a DOM tree created within the current document, then use the current cached value
  15776. if(!cached.ownerDocument || cached.ownerDocument == win.doc){
  15777. // string or node of the same document
  15778. return cached;
  15779. }
  15780. }catch(e){ /* squelch */ } // IE can throw an exception if cached.ownerDocument was reloaded
  15781. domConstruct.destroy(cached);
  15782. }
  15783. templateString = string.trim(templateString);
  15784. if(alwaysUseString || templateString.match(/\$\{([^\}]+)\}/g)){
  15785. // there are variables in the template so all we can do is cache the string
  15786. return (tmplts[key] = templateString); //String
  15787. }else{
  15788. // there are no variables in the template so we can cache the DOM tree
  15789. var node = domConstruct.toDom(templateString);
  15790. if(node.nodeType != 1){
  15791. throw new Error("Invalid template: " + templateString);
  15792. }
  15793. return (tmplts[key] = node); //Node
  15794. }
  15795. };
  15796. if(has("ie")){
  15797. unload.addOnWindowUnload(function(){
  15798. var cache = _TemplatedMixin._templateCache;
  15799. for(var key in cache){
  15800. var value = cache[key];
  15801. if(typeof value == "object"){ // value is either a string or a DOM node template
  15802. domConstruct.destroy(value);
  15803. }
  15804. delete cache[key];
  15805. }
  15806. });
  15807. }
  15808. // These arguments can be specified for widgets which are used in templates.
  15809. // Since any widget can be specified as sub widgets in template, mix it
  15810. // into the base widget class. (This is a hack, but it's effective.)
  15811. lang.extend(_WidgetBase,{
  15812. dojoAttachEvent: "",
  15813. dojoAttachPoint: ""
  15814. });
  15815. return _TemplatedMixin;
  15816. });
  15817. },
  15818. 'dojox/lang/functional/object':function(){
  15819. define("dojox/lang/functional/object", ["dojo/_base/kernel", "dojo/_base/lang", "dojo/_base/window", "./lambda"], function(dojo, lang, win, df){
  15820. // This module adds high-level functions and related constructs:
  15821. // - object/dictionary helpers
  15822. // Defined methods:
  15823. // - take any valid lambda argument as the functional argument
  15824. // - skip all attributes that are present in the empty object
  15825. // (IE and/or 3rd-party libraries).
  15826. var empty = {};
  15827. /*=====
  15828. var df = dojox.lang.functional;
  15829. =====*/
  15830. lang.mixin(df, {
  15831. // object helpers
  15832. keys: function(/*Object*/ obj){
  15833. // summary: returns an array of all keys in the object
  15834. var t = [];
  15835. for(var i in obj){
  15836. if(!(i in empty)){
  15837. t.push(i);
  15838. }
  15839. }
  15840. return t; // Array
  15841. },
  15842. values: function(/*Object*/ obj){
  15843. // summary: returns an array of all values in the object
  15844. var t = [];
  15845. for(var i in obj){
  15846. if(!(i in empty)){
  15847. t.push(obj[i]);
  15848. }
  15849. }
  15850. return t; // Array
  15851. },
  15852. filterIn: function(/*Object*/ obj, /*Function|String|Array*/ f, /*Object?*/ o){
  15853. // summary: creates new object with all attributes that pass the test
  15854. // implemented by the provided function.
  15855. o = o || win.global; f = df.lambda(f);
  15856. var t = {}, v, i;
  15857. for(i in obj){
  15858. if(!(i in empty)){
  15859. v = obj[i];
  15860. if(f.call(o, v, i, obj)){ t[i] = v; }
  15861. }
  15862. }
  15863. return t; // Object
  15864. },
  15865. forIn: function(/*Object*/ obj, /*Function|String|Array*/ f, /*Object?*/ o){
  15866. // summary: iterates over all object attributes.
  15867. o = o || win.global; f = df.lambda(f);
  15868. for(var i in obj){
  15869. if(!(i in empty)){
  15870. f.call(o, obj[i], i, obj);
  15871. }
  15872. }
  15873. return o; // Object
  15874. },
  15875. mapIn: function(/*Object*/ obj, /*Function|String|Array*/ f, /*Object?*/ o){
  15876. // summary: creates new object with the results of calling
  15877. // a provided function on every attribute in this object.
  15878. o = o || win.global; f = df.lambda(f);
  15879. var t = {}, i;
  15880. for(i in obj){
  15881. if(!(i in empty)){
  15882. t[i] = f.call(o, obj[i], i, obj);
  15883. }
  15884. }
  15885. return t; // Object
  15886. }
  15887. });
  15888. return df;
  15889. });
  15890. },
  15891. 'dojo/window':function(){
  15892. define(["./_base/lang", "./_base/sniff", "./_base/window", "./dom", "./dom-geometry", "./dom-style", "./dom-construct"],
  15893. function(lang, has, baseWindow, dom, geom, style, domConstruct) {
  15894. // feature detection
  15895. /* not needed but included here for future reference
  15896. has.add("rtl-innerVerticalScrollBar-on-left", function(win, doc){
  15897. var body = baseWindow.body(doc),
  15898. scrollable = domConstruct.create('div', {
  15899. style: {overflow:'scroll', overflowX:'hidden', direction:'rtl', visibility:'hidden', position:'absolute', left:'0', width:'64px', height:'64px'}
  15900. }, body, "last"),
  15901. center = domConstruct.create('center', {
  15902. style: {overflow:'hidden', direction:'ltr'}
  15903. }, scrollable, "last"),
  15904. inner = domConstruct.create('div', {
  15905. style: {overflow:'visible', display:'inline' }
  15906. }, center, "last");
  15907. inner.innerHTML="&nbsp;";
  15908. var midPoint = Math.max(inner.offsetLeft, geom.position(inner).x);
  15909. var ret = midPoint >= 32;
  15910. center.removeChild(inner);
  15911. scrollable.removeChild(center);
  15912. body.removeChild(scrollable);
  15913. return ret;
  15914. });
  15915. */
  15916. has.add("rtl-adjust-position-for-verticalScrollBar", function(win, doc){
  15917. var body = baseWindow.body(doc),
  15918. scrollable = domConstruct.create('div', {
  15919. style: {overflow:'scroll', overflowX:'visible', direction:'rtl', visibility:'hidden', position:'absolute', left:'0', top:'0', width:'64px', height:'64px'}
  15920. }, body, "last"),
  15921. div = domConstruct.create('div', {
  15922. style: {overflow:'hidden', direction:'ltr'}
  15923. }, scrollable, "last"),
  15924. ret = geom.position(div).x != 0;
  15925. scrollable.removeChild(div);
  15926. body.removeChild(scrollable);
  15927. return ret;
  15928. });
  15929. has.add("position-fixed-support", function(win, doc){
  15930. // IE6, IE7+quirks, and some older mobile browsers don't support position:fixed
  15931. var body = baseWindow.body(doc),
  15932. outer = domConstruct.create('span', {
  15933. style: {visibility:'hidden', position:'fixed', left:'1px', top:'1px'}
  15934. }, body, "last"),
  15935. inner = domConstruct.create('span', {
  15936. style: {position:'fixed', left:'0', top:'0'}
  15937. }, outer, "last"),
  15938. ret = geom.position(inner).x != geom.position(outer).x;
  15939. outer.removeChild(inner);
  15940. body.removeChild(outer);
  15941. return ret;
  15942. });
  15943. // module:
  15944. // dojo/window
  15945. // summary:
  15946. // TODOC
  15947. var window = lang.getObject("dojo.window", true);
  15948. /*=====
  15949. dojo.window = {
  15950. // summary:
  15951. // TODO
  15952. };
  15953. window = dojo.window;
  15954. =====*/
  15955. window.getBox = function(){
  15956. // summary:
  15957. // Returns the dimensions and scroll position of the viewable area of a browser window
  15958. var
  15959. scrollRoot = (baseWindow.doc.compatMode == 'BackCompat') ? baseWindow.body() : baseWindow.doc.documentElement,
  15960. // get scroll position
  15961. scroll = geom.docScroll(), // scrollRoot.scrollTop/Left should work
  15962. w, h;
  15963. if(has("touch")){ // if(scrollbars not supported)
  15964. var uiWindow = baseWindow.doc.parentWindow || baseWindow.doc.defaultView; // use UI window, not dojo.global window. baseWindow.doc.parentWindow probably not needed since it's not defined for webkit
  15965. // on mobile, scrollRoot.clientHeight <= uiWindow.innerHeight <= scrollRoot.offsetHeight, return uiWindow.innerHeight
  15966. w = uiWindow.innerWidth || scrollRoot.clientWidth; // || scrollRoot.clientXXX probably never evaluated
  15967. h = uiWindow.innerHeight || scrollRoot.clientHeight;
  15968. }else{
  15969. // on desktops, scrollRoot.clientHeight <= scrollRoot.offsetHeight <= uiWindow.innerHeight, return scrollRoot.clientHeight
  15970. // uiWindow.innerWidth/Height includes the scrollbar and cannot be used
  15971. w = scrollRoot.clientWidth;
  15972. h = scrollRoot.clientHeight;
  15973. }
  15974. return {
  15975. l: scroll.x,
  15976. t: scroll.y,
  15977. w: w,
  15978. h: h
  15979. };
  15980. };
  15981. window.get = function(doc){
  15982. // summary:
  15983. // Get window object associated with document doc
  15984. // In some IE versions (at least 6.0), document.parentWindow does not return a
  15985. // reference to the real window object (maybe a copy), so we must fix it as well
  15986. // We use IE specific execScript to attach the real window reference to
  15987. // document._parentWindow for later use
  15988. if(has("ie") < 9 && window !== document.parentWindow){
  15989. /*
  15990. In IE 6, only the variable "window" can be used to connect events (others
  15991. may be only copies).
  15992. */
  15993. doc.parentWindow.execScript("document._parentWindow = window;", "Javascript");
  15994. //to prevent memory leak, unset it after use
  15995. //another possibility is to add an onUnload handler which seems overkill to me (liucougar)
  15996. var win = doc._parentWindow;
  15997. doc._parentWindow = null;
  15998. return win; // Window
  15999. }
  16000. return doc.parentWindow || doc.defaultView; // Window
  16001. };
  16002. window.scrollIntoView = function(/*DomNode*/ node, /*Object?*/ pos){
  16003. // summary:
  16004. // Scroll the passed node into view using minimal movement, if it is not already.
  16005. // Don't rely on node.scrollIntoView working just because the function is there since
  16006. // it forces the node to the page's bottom or top (and left or right in IE) without consideration for the minimal movement.
  16007. // WebKit's node.scrollIntoViewIfNeeded doesn't work either for inner scrollbars in right-to-left mode
  16008. // and when there's a fixed position scrollable element
  16009. try{ // catch unexpected/unrecreatable errors (#7808) since we can recover using a semi-acceptable native method
  16010. node = dom.byId(node);
  16011. var doc = node.ownerDocument || baseWindow.doc, // TODO: why baseWindow.doc? Isn't node.ownerDocument always defined?
  16012. body = baseWindow.body(doc),
  16013. html = doc.documentElement || body.parentNode,
  16014. isIE = has("ie"),
  16015. isWK = has("webkit");
  16016. // if an untested browser, then use the native method
  16017. if(node == body || node == html){ return; }
  16018. if(!(has("mozilla") || isIE || isWK || has("opera") || has("trident")) && ("scrollIntoView" in node)){
  16019. node.scrollIntoView(false); // short-circuit to native if possible
  16020. return;
  16021. }
  16022. var backCompat = doc.compatMode == 'BackCompat',
  16023. rootWidth = Math.min(body.clientWidth || html.clientWidth, html.clientWidth || body.clientWidth),
  16024. rootHeight = Math.min(body.clientHeight || html.clientHeight, html.clientHeight || body.clientHeight),
  16025. scrollRoot = (isWK || backCompat) ? body : html,
  16026. nodePos = pos || geom.position(node),
  16027. el = node.parentNode,
  16028. isFixed = function(el){
  16029. return (isIE <= 6 || (isIE == 7 && backCompat))
  16030. ? false
  16031. : (has("position-fixed-support") && (style.get(el, 'position').toLowerCase() == "fixed"));
  16032. },
  16033. self = this,
  16034. scrollElementBy = function(el, x, y){
  16035. if(el.tagName == "BODY" || el.tagName == "HTML"){
  16036. self.get(el.ownerDocument).scrollBy(x, y);
  16037. }else{
  16038. x && (el.scrollLeft += x);
  16039. y && (el.scrollTop += y);
  16040. }
  16041. };
  16042. if(isFixed(node)){ return; } // nothing to do
  16043. while(el){
  16044. if(el == body){ el = scrollRoot; }
  16045. var elPos = geom.position(el),
  16046. fixedPos = isFixed(el),
  16047. rtl = style.getComputedStyle(el).direction.toLowerCase() == "rtl";
  16048. if(el == scrollRoot){
  16049. elPos.w = rootWidth; elPos.h = rootHeight;
  16050. if(scrollRoot == html && (isIE || has("trident")) && rtl){ elPos.x += scrollRoot.offsetWidth-elPos.w; } // IE workaround where scrollbar causes negative x
  16051. if(elPos.x < 0 || !isIE || isIE >= 9 || has("trident")){ elPos.x = 0; } // older IE can have values > 0
  16052. if(elPos.y < 0 || !isIE || isIE >= 9 || has("trident")){ elPos.y = 0; }
  16053. }else{
  16054. var pb = geom.getPadBorderExtents(el);
  16055. elPos.w -= pb.w; elPos.h -= pb.h; elPos.x += pb.l; elPos.y += pb.t;
  16056. var clientSize = el.clientWidth,
  16057. scrollBarSize = elPos.w - clientSize;
  16058. if(clientSize > 0 && scrollBarSize > 0){
  16059. if(rtl && has("rtl-adjust-position-for-verticalScrollBar")){
  16060. elPos.x += scrollBarSize;
  16061. }
  16062. elPos.w = clientSize;
  16063. }
  16064. clientSize = el.clientHeight;
  16065. scrollBarSize = elPos.h - clientSize;
  16066. if(clientSize > 0 && scrollBarSize > 0){
  16067. elPos.h = clientSize;
  16068. }
  16069. }
  16070. if(fixedPos){ // bounded by viewport, not parents
  16071. if(elPos.y < 0){
  16072. elPos.h += elPos.y; elPos.y = 0;
  16073. }
  16074. if(elPos.x < 0){
  16075. elPos.w += elPos.x; elPos.x = 0;
  16076. }
  16077. if(elPos.y + elPos.h > rootHeight){
  16078. elPos.h = rootHeight - elPos.y;
  16079. }
  16080. if(elPos.x + elPos.w > rootWidth){
  16081. elPos.w = rootWidth - elPos.x;
  16082. }
  16083. }
  16084. // calculate overflow in all 4 directions
  16085. var l = nodePos.x - elPos.x, // beyond left: < 0
  16086. // t = nodePos.y - Math.max(elPos.y, 0), // beyond top: < 0
  16087. t = nodePos.y - elPos.y, // beyond top: < 0
  16088. r = l + nodePos.w - elPos.w, // beyond right: > 0
  16089. bot = t + nodePos.h - elPos.h; // beyond bottom: > 0
  16090. var s, old;
  16091. if(r * l > 0 && (!!el.scrollLeft || el == scrollRoot || el.scrollWidth > el.offsetHeight)){
  16092. s = Math[l < 0? "max" : "min"](l, r);
  16093. if(rtl && ((isIE == 8 && !backCompat) || isIE >= 9 || has("trident"))){ s = -s; }
  16094. old = el.scrollLeft;
  16095. scrollElementBy(el, s, 0);
  16096. s = el.scrollLeft - old;
  16097. nodePos.x -= s;
  16098. }
  16099. if(bot * t > 0 && (!!el.scrollTop || el == scrollRoot || el.scrollHeight > el.offsetHeight)){
  16100. s = Math.ceil(Math[t < 0? "max" : "min"](t, bot));
  16101. old = el.scrollTop;
  16102. scrollElementBy(el, 0, s);
  16103. s = el.scrollTop - old;
  16104. nodePos.y -= s;
  16105. }
  16106. el = (el != scrollRoot) && !fixedPos && el.parentNode;
  16107. }
  16108. }catch(error){
  16109. console.error('scrollIntoView: ' + error);
  16110. node.scrollIntoView(false);
  16111. }
  16112. };
  16113. return window;
  16114. });
  16115. },
  16116. 'dojox/charting/axis2d/Default':function(){
  16117. define("dojox/charting/axis2d/Default", ["dojo/_base/lang", "dojo/_base/array","dojo/_base/sniff", "dojo/_base/declare",
  16118. "dojo/_base/connect", "dojo/_base/html", "dojo/dom-geometry", "./Invisible",
  16119. "../scaler/common", "../scaler/linear", "./common", "dojox/gfx", "dojox/lang/utils"],
  16120. function(lang, arr, has, declare, connect, html, domGeom, Invisible, scommon,
  16121. lin, acommon, g, du){
  16122. /*=====
  16123. dojox.charting.axis2d.__AxisCtorArgs = function(
  16124. vertical, fixUpper, fixLower, natural, leftBottom,
  16125. includeZero, fixed, majorLabels, minorTicks, minorLabels, microTicks, htmlLabels,
  16126. min, max, from, to, majorTickStep, minorTickStep, microTickStep,
  16127. labels, labelFunc, maxLabelSize,
  16128. stroke, majorTick, minorTick, microTick, tick,
  16129. font, fontColor
  16130. ){
  16131. // summary:
  16132. // Optional arguments used in the definition of an axis.
  16133. //
  16134. // vertical: Boolean?
  16135. // A flag that says whether an axis is vertical (i.e. y axis) or horizontal. Default is false (horizontal).
  16136. // fixUpper: String?
  16137. // Align the greatest value on the axis with the specified tick level. Options are "major", "minor", "micro", or "none". Defaults to "none".
  16138. // fixLower: String?
  16139. // Align the smallest value on the axis with the specified tick level. Options are "major", "minor", "micro", or "none". Defaults to "none".
  16140. // natural: Boolean?
  16141. // Ensure tick marks are made on "natural" numbers. Defaults to false.
  16142. // leftBottom: Boolean?
  16143. // The position of a vertical axis; if true, will be placed against the left-bottom corner of the chart. Defaults to true.
  16144. // includeZero: Boolean?
  16145. // Include 0 on the axis rendering. Default is false.
  16146. // fixed: Boolean?
  16147. // Force all axis labels to be fixed numbers. Default is true.
  16148. // majorLabels: Boolean?
  16149. // Flag to draw all labels at major ticks. Default is true.
  16150. // minorTicks: Boolean?
  16151. // Flag to draw minor ticks on an axis. Default is true.
  16152. // minorLabels: Boolean?
  16153. // Flag to draw labels on minor ticks. Default is true.
  16154. // microTicks: Boolean?
  16155. // Flag to draw micro ticks on an axis. Default is false.
  16156. // htmlLabels: Boolean?
  16157. // Flag to use HTML (as opposed to the native vector graphics engine) to draw labels. Default is true.
  16158. // min: Number?
  16159. // The smallest value on an axis. Default is 0.
  16160. // max: Number?
  16161. // The largest value on an axis. Default is 1.
  16162. // from: Number?
  16163. // Force the chart to render data visible from this value. Default is 0.
  16164. // to: Number?
  16165. // Force the chart to render data visible to this value. Default is 1.
  16166. // majorTickStep: Number?
  16167. // The amount to skip before a major tick is drawn. Default is 4.
  16168. // minorTickStep: Number?
  16169. // The amount to skip before a minor tick is drawn. Default is 2.
  16170. // microTickStep: Number?
  16171. // The amount to skip before a micro tick is drawn. Default is 1.
  16172. // labels: Object[]?
  16173. // An array of labels for major ticks, with corresponding numeric values, ordered by value.
  16174. // labelFunc: Function?
  16175. // An optional function used to compute label values.
  16176. // maxLabelSize: Number?
  16177. // The maximum size, in pixels, for a label. To be used with the optional label function.
  16178. // stroke: dojox.gfx.Stroke?
  16179. // An optional stroke to be used for drawing an axis.
  16180. // majorTick: Object?
  16181. // An object containing a dojox.gfx.Stroke, and a length (number) for a major tick.
  16182. // minorTick: Object?
  16183. // An object containing a dojox.gfx.Stroke, and a length (number) for a minor tick.
  16184. // microTick: Object?
  16185. // An object containing a dojox.gfx.Stroke, and a length (number) for a micro tick.
  16186. // tick: Object?
  16187. // An object containing a dojox.gfx.Stroke, and a length (number) for a tick.
  16188. // font: String?
  16189. // An optional font definition (as used in the CSS font property) for labels.
  16190. // fontColor: String|dojo.Color?
  16191. // An optional color to be used in drawing labels.
  16192. // enableCache: Boolean?
  16193. // Whether the ticks and labels are cached from one rendering to another. This improves the rendering performance of
  16194. // successive rendering but penalize the first rendering. For labels it is only working with gfx labels
  16195. // not html ones. Default false.
  16196. this.vertical = vertical;
  16197. this.fixUpper = fixUpper;
  16198. this.fixLower = fixLower;
  16199. this.natural = natural;
  16200. this.leftBottom = leftBottom;
  16201. this.includeZero = includeZero;
  16202. this.fixed = fixed;
  16203. this.majorLabels = majorLabels;
  16204. this.minorTicks = minorTicks;
  16205. this.minorLabels = minorLabels;
  16206. this.microTicks = microTicks;
  16207. this.htmlLabels = htmlLabels;
  16208. this.min = min;
  16209. this.max = max;
  16210. this.from = from;
  16211. this.to = to;
  16212. this.majorTickStep = majorTickStep;
  16213. this.minorTickStep = minorTickStep;
  16214. this.microTickStep = microTickStep;
  16215. this.labels = labels;
  16216. this.labelFunc = labelFunc;
  16217. this.maxLabelSize = maxLabelSize;
  16218. this.stroke = stroke;
  16219. this.majorTick = majorTick;
  16220. this.minorTick = minorTick;
  16221. this.microTick = microTick;
  16222. this.tick = tick;
  16223. this.font = font;
  16224. this.fontColor = fontColor;
  16225. this.enableCache = enableCache;
  16226. }
  16227. var Invisible = dojox.charting.axis2d.Invisible
  16228. =====*/
  16229. var labelGap = 4, // in pixels
  16230. centerAnchorLimit = 45; // in degrees
  16231. return declare("dojox.charting.axis2d.Default", Invisible, {
  16232. // summary:
  16233. // The default axis object used in dojox.charting. See dojox.charting.Chart.addAxis for details.
  16234. //
  16235. // defaultParams: Object
  16236. // The default parameters used to define any axis.
  16237. // optionalParams: Object
  16238. // Any optional parameters needed to define an axis.
  16239. /*
  16240. // TODO: the documentation tools need these to be pre-defined in order to pick them up
  16241. // correctly, but the code here is partially predicated on whether or not the properties
  16242. // actually exist. For now, we will leave these undocumented but in the code for later. -- TRT
  16243. // opt: Object
  16244. // The actual options used to define this axis, created at initialization.
  16245. // scalar: Object
  16246. // The calculated helper object to tell charts how to draw an axis and any data.
  16247. // ticks: Object
  16248. // The calculated tick object that helps a chart draw the scaling on an axis.
  16249. // dirty: Boolean
  16250. // The state of the axis (whether it needs to be redrawn or not)
  16251. // scale: Number
  16252. // The current scale of the axis.
  16253. // offset: Number
  16254. // The current offset of the axis.
  16255. opt: null,
  16256. scalar: null,
  16257. ticks: null,
  16258. dirty: true,
  16259. scale: 1,
  16260. offset: 0,
  16261. */
  16262. defaultParams: {
  16263. vertical: false, // true for vertical axis
  16264. fixUpper: "none", // align the upper on ticks: "major", "minor", "micro", "none"
  16265. fixLower: "none", // align the lower on ticks: "major", "minor", "micro", "none"
  16266. natural: false, // all tick marks should be made on natural numbers
  16267. leftBottom: true, // position of the axis, used with "vertical"
  16268. includeZero: false, // 0 should be included
  16269. fixed: true, // all labels are fixed numbers
  16270. majorLabels: true, // draw major labels
  16271. minorTicks: true, // draw minor ticks
  16272. minorLabels: true, // draw minor labels
  16273. microTicks: false, // draw micro ticks
  16274. rotation: 0, // label rotation angle in degrees
  16275. htmlLabels: true, // use HTML to draw labels
  16276. enableCache: false // whether we cache or not
  16277. },
  16278. optionalParams: {
  16279. min: 0, // minimal value on this axis
  16280. max: 1, // maximal value on this axis
  16281. from: 0, // visible from this value
  16282. to: 1, // visible to this value
  16283. majorTickStep: 4, // major tick step
  16284. minorTickStep: 2, // minor tick step
  16285. microTickStep: 1, // micro tick step
  16286. labels: [], // array of labels for major ticks
  16287. // with corresponding numeric values
  16288. // ordered by values
  16289. labelFunc: null, // function to compute label values
  16290. maxLabelSize: 0, // size in px. For use with labelFunc
  16291. maxLabelCharCount: 0, // size in word count.
  16292. trailingSymbol: null,
  16293. // TODO: add support for minRange!
  16294. // minRange: 1, // smallest distance from min allowed on the axis
  16295. // theme components
  16296. stroke: {}, // stroke for an axis
  16297. majorTick: {}, // stroke + length for a tick
  16298. minorTick: {}, // stroke + length for a tick
  16299. microTick: {}, // stroke + length for a tick
  16300. tick: {}, // stroke + length for a tick
  16301. font: "", // font for labels
  16302. fontColor: "", // color for labels as a string
  16303. title: "", // axis title
  16304. titleGap: 0, // gap between axis title and axis label
  16305. titleFont: "", // axis title font
  16306. titleFontColor: "", // axis title font color
  16307. titleOrientation: "" // "axis" means the title facing the axis, "away" means facing away
  16308. },
  16309. constructor: function(chart, kwArgs){
  16310. // summary:
  16311. // The constructor for an axis.
  16312. // chart: dojox.charting.Chart
  16313. // The chart the axis belongs to.
  16314. // kwArgs: dojox.charting.axis2d.__AxisCtorArgs?
  16315. // Any optional keyword arguments to be used to define this axis.
  16316. this.opt = lang.clone(this.defaultParams);
  16317. du.updateWithObject(this.opt, kwArgs);
  16318. du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
  16319. if(this.opt.enableCache){
  16320. this._textFreePool = [];
  16321. this._lineFreePool = [];
  16322. this._textUsePool = [];
  16323. this._lineUsePool = [];
  16324. }
  16325. },
  16326. getOffsets: function(){
  16327. // summary:
  16328. // Get the physical offset values for this axis (used in drawing data series).
  16329. // returns: Object
  16330. // The calculated offsets in the form of { l, r, t, b } (left, right, top, bottom).
  16331. var s = this.scaler, offsets = { l: 0, r: 0, t: 0, b: 0 };
  16332. if(!s){
  16333. return offsets;
  16334. }
  16335. var o = this.opt, labelWidth = 0, a, b, c, d,
  16336. gl = scommon.getNumericLabel,
  16337. offset = 0, ma = s.major, mi = s.minor,
  16338. ta = this.chart.theme.axis,
  16339. // TODO: we use one font --- of major tick, we need to use major and minor fonts
  16340. taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font),
  16341. taTitleFont = o.titleFont || (ta.tick && ta.tick.titleFont),
  16342. taTitleGap = (o.titleGap==0) ? 0 : o.titleGap || (ta.tick && ta.tick.titleGap) || 15,
  16343. taMajorTick = this.chart.theme.getTick("major", o),
  16344. taMinorTick = this.chart.theme.getTick("minor", o),
  16345. size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,
  16346. tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0,
  16347. rotation = o.rotation % 360, leftBottom = o.leftBottom,
  16348. cosr = Math.abs(Math.cos(rotation * Math.PI / 180)),
  16349. sinr = Math.abs(Math.sin(rotation * Math.PI / 180));
  16350. this.trailingSymbol = (o.trailingSymbol === undefined || o.trailingSymbol === null) ? this.trailingSymbol : o.trailingSymbol;
  16351. if(rotation < 0){
  16352. rotation += 360;
  16353. }
  16354. if(size){
  16355. // we need width of all labels
  16356. if(this.labels){
  16357. labelWidth = this._groupLabelWidth(this.labels, taFont, o.maxLabelCharCount);
  16358. }else{
  16359. labelWidth = this._groupLabelWidth([
  16360. gl(ma.start, ma.prec, o),
  16361. gl(ma.start + ma.count * ma.tick, ma.prec, o),
  16362. gl(mi.start, mi.prec, o),
  16363. gl(mi.start + mi.count * mi.tick, mi.prec, o)
  16364. ], taFont, o.maxLabelCharCount);
  16365. }
  16366. labelWidth = o.maxLabelSize ? Math.min(o.maxLabelSize, labelWidth) : labelWidth;
  16367. if(this.vertical){
  16368. var side = leftBottom ? "l" : "r";
  16369. switch(rotation){
  16370. case 0:
  16371. case 180:
  16372. offsets[side] = labelWidth;
  16373. offsets.t = offsets.b = size / 2;
  16374. break;
  16375. case 90:
  16376. case 270:
  16377. offsets[side] = size;
  16378. offsets.t = offsets.b = labelWidth / 2;
  16379. break;
  16380. default:
  16381. if(rotation <= centerAnchorLimit || (180 < rotation && rotation <= (180 + centerAnchorLimit))){
  16382. offsets[side] = size * sinr / 2 + labelWidth * cosr;
  16383. offsets[leftBottom ? "t" : "b"] = size * cosr / 2 + labelWidth * sinr;
  16384. offsets[leftBottom ? "b" : "t"] = size * cosr / 2;
  16385. }else if(rotation > (360 - centerAnchorLimit) || (180 > rotation && rotation > (180 - centerAnchorLimit))){
  16386. offsets[side] = size * sinr / 2 + labelWidth * cosr;
  16387. offsets[leftBottom ? "b" : "t"] = size * cosr / 2 + labelWidth * sinr;
  16388. offsets[leftBottom ? "t" : "b"] = size * cosr / 2;
  16389. }else if(rotation < 90 || (180 < rotation && rotation < 270)){
  16390. offsets[side] = size * sinr + labelWidth * cosr;
  16391. offsets[leftBottom ? "t" : "b"] = size * cosr + labelWidth * sinr;
  16392. }else{
  16393. offsets[side] = size * sinr + labelWidth * cosr;
  16394. offsets[leftBottom ? "b" : "t"] = size * cosr + labelWidth * sinr;
  16395. }
  16396. break;
  16397. }
  16398. offsets[side] += labelGap + Math.max(taMajorTick.length, taMinorTick.length) + (o.title ? (tsize + taTitleGap) : 0);
  16399. }else{
  16400. var side = leftBottom ? "b" : "t";
  16401. switch(rotation){
  16402. case 0:
  16403. case 180:
  16404. offsets[side] = size;
  16405. offsets.l = offsets.r = labelWidth / 2;
  16406. break;
  16407. case 90:
  16408. case 270:
  16409. offsets[side] = labelWidth;
  16410. offsets.l = offsets.r = size / 2;
  16411. break;
  16412. default:
  16413. if((90 - centerAnchorLimit) <= rotation && rotation <= 90 || (270 - centerAnchorLimit) <= rotation && rotation <= 270){
  16414. offsets[side] = size * sinr / 2 + labelWidth * cosr;
  16415. offsets[leftBottom ? "r" : "l"] = size * cosr / 2 + labelWidth * sinr;
  16416. offsets[leftBottom ? "l" : "r"] = size * cosr / 2;
  16417. }else if(90 <= rotation && rotation <= (90 + centerAnchorLimit) || 270 <= rotation && rotation <= (270 + centerAnchorLimit)){
  16418. offsets[side] = size * sinr / 2 + labelWidth * cosr;
  16419. offsets[leftBottom ? "l" : "r"] = size * cosr / 2 + labelWidth * sinr;
  16420. offsets[leftBottom ? "r" : "l"] = size * cosr / 2;
  16421. }else if(rotation < centerAnchorLimit || (180 < rotation && rotation < (180 - centerAnchorLimit))){
  16422. offsets[side] = size * sinr + labelWidth * cosr;
  16423. offsets[leftBottom ? "r" : "l"] = size * cosr + labelWidth * sinr;
  16424. }else{
  16425. offsets[side] = size * sinr + labelWidth * cosr;
  16426. offsets[leftBottom ? "l" : "r"] = size * cosr + labelWidth * sinr;
  16427. }
  16428. break;
  16429. }
  16430. offsets[side] += labelGap + Math.max(taMajorTick.length, taMinorTick.length) + (o.title ? (tsize + taTitleGap) : 0);
  16431. }
  16432. }
  16433. if(labelWidth){
  16434. this._cachedLabelWidth = labelWidth;
  16435. }
  16436. return offsets; // Object
  16437. },
  16438. cleanGroup: function(creator){
  16439. if(this.opt.enableCache && this.group){
  16440. this._lineFreePool = this._lineFreePool.concat(this._lineUsePool);
  16441. this._lineUsePool = [];
  16442. this._textFreePool = this._textFreePool.concat(this._textUsePool);
  16443. this._textUsePool = [];
  16444. }
  16445. this.inherited(arguments);
  16446. },
  16447. createText: function(labelType, creator, x, y, align, textContent, font, fontColor, labelWidth){
  16448. if(!this.opt.enableCache || labelType=="html"){
  16449. return acommon.createText[labelType](
  16450. this.chart,
  16451. creator,
  16452. x,
  16453. y,
  16454. align,
  16455. textContent,
  16456. font,
  16457. fontColor,
  16458. labelWidth
  16459. );
  16460. }
  16461. var text;
  16462. if (this._textFreePool.length > 0){
  16463. text = this._textFreePool.pop();
  16464. text.setShape({x: x, y: y, text: textContent, align: align});
  16465. // For now all items share the same font, no need to re-set it
  16466. //.setFont(font).setFill(fontColor);
  16467. // was cleared, add it back
  16468. creator.add(text);
  16469. }else{
  16470. text = acommon.createText[labelType](
  16471. this.chart,
  16472. creator,
  16473. x,
  16474. y,
  16475. align,
  16476. textContent,
  16477. font,
  16478. fontColor,
  16479. labelWidth
  16480. ); }
  16481. this._textUsePool.push(text);
  16482. return text;
  16483. },
  16484. createLine: function(creator, params){
  16485. var line;
  16486. if(this.opt.enableCache && this._lineFreePool.length > 0){
  16487. line = this._lineFreePool.pop();
  16488. line.setShape(params);
  16489. // was cleared, add it back
  16490. creator.add(line);
  16491. }else{
  16492. line = creator.createLine(params);
  16493. }
  16494. if(this.opt.enableCache){
  16495. this._lineUsePool.push(line);
  16496. }
  16497. return line;
  16498. },
  16499. render: function(dim, offsets){
  16500. // summary:
  16501. // Render/draw the axis.
  16502. // dim: Object
  16503. // An object of the form { width, height}.
  16504. // offsets: Object
  16505. // An object of the form { l, r, t, b }.
  16506. // returns: dojox.charting.axis2d.Default
  16507. // The reference to the axis for functional chaining.
  16508. if(!this.dirty){
  16509. return this; // dojox.charting.axis2d.Default
  16510. }
  16511. // prepare variable
  16512. var o = this.opt, ta = this.chart.theme.axis, leftBottom = o.leftBottom, rotation = o.rotation % 360,
  16513. start, stop, titlePos, titleRotation=0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign,
  16514. // TODO: we use one font --- of major tick, we need to use major and minor fonts
  16515. taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font),
  16516. taTitleFont = o.titleFont || (ta.tick && ta.tick.titleFont),
  16517. // TODO: we use one font color --- we need to use different colors
  16518. taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black",
  16519. taTitleFontColor = o.titleFontColor || (ta.tick && ta.tick.titleFontColor) || "black",
  16520. taTitleGap = (o.titleGap==0) ? 0 : o.titleGap || (ta.tick && ta.tick.titleGap) || 15,
  16521. taTitleOrientation = o.titleOrientation || (ta.tick && ta.tick.titleOrientation) || "axis",
  16522. taMajorTick = this.chart.theme.getTick("major", o),
  16523. taMinorTick = this.chart.theme.getTick("minor", o),
  16524. taMicroTick = this.chart.theme.getTick("micro", o),
  16525. tickSize = Math.max(taMajorTick.length, taMinorTick.length, taMicroTick.length),
  16526. taStroke = "stroke" in o ? o.stroke : ta.stroke,
  16527. size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,
  16528. cosr = Math.abs(Math.cos(rotation * Math.PI / 180)),
  16529. sinr = Math.abs(Math.sin(rotation * Math.PI / 180)),
  16530. tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0;
  16531. if(rotation < 0){
  16532. rotation += 360;
  16533. }
  16534. if(this.vertical){
  16535. start = {y: dim.height - offsets.b};
  16536. stop = {y: offsets.t};
  16537. titlePos = {y: (dim.height - offsets.b + offsets.t)/2};
  16538. titleOffset = size * sinr + (this._cachedLabelWidth || 0) * cosr + labelGap + Math.max(taMajorTick.length, taMinorTick.length) + tsize + taTitleGap;
  16539. axisVector = {x: 0, y: -1};
  16540. labelOffset = {x: 0, y: 0};
  16541. tickVector = {x: 1, y: 0};
  16542. anchorOffset = {x: labelGap, y: 0};
  16543. switch(rotation){
  16544. case 0:
  16545. labelAlign = "end";
  16546. labelOffset.y = size * 0.4;
  16547. break;
  16548. case 90:
  16549. labelAlign = "middle";
  16550. labelOffset.x = -size;
  16551. break;
  16552. case 180:
  16553. labelAlign = "start";
  16554. labelOffset.y = -size * 0.4;
  16555. break;
  16556. case 270:
  16557. labelAlign = "middle";
  16558. break;
  16559. default:
  16560. if(rotation < centerAnchorLimit){
  16561. labelAlign = "end";
  16562. labelOffset.y = size * 0.4;
  16563. }else if(rotation < 90){
  16564. labelAlign = "end";
  16565. labelOffset.y = size * 0.4;
  16566. }else if(rotation < (180 - centerAnchorLimit)){
  16567. labelAlign = "start";
  16568. }else if(rotation < (180 + centerAnchorLimit)){
  16569. labelAlign = "start";
  16570. labelOffset.y = -size * 0.4;
  16571. }else if(rotation < 270){
  16572. labelAlign = "start";
  16573. labelOffset.x = leftBottom ? 0 : size * 0.4;
  16574. }else if(rotation < (360 - centerAnchorLimit)){
  16575. labelAlign = "end";
  16576. labelOffset.x = leftBottom ? 0 : size * 0.4;
  16577. }else{
  16578. labelAlign = "end";
  16579. labelOffset.y = size * 0.4;
  16580. }
  16581. }
  16582. if(leftBottom){
  16583. start.x = stop.x = offsets.l;
  16584. titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 90 : 270;
  16585. titlePos.x = offsets.l - titleOffset + (titleRotation == 270 ? tsize : 0);
  16586. tickVector.x = -1;
  16587. anchorOffset.x = -anchorOffset.x;
  16588. }else{
  16589. start.x = stop.x = dim.width - offsets.r;
  16590. titleRotation = (taTitleOrientation && taTitleOrientation == "axis") ? 90 : 270;
  16591. titlePos.x = dim.width - offsets.r + titleOffset - (titleRotation == 270 ? 0 : tsize);
  16592. switch(labelAlign){
  16593. case "start":
  16594. labelAlign = "end";
  16595. break;
  16596. case "end":
  16597. labelAlign = "start";
  16598. break;
  16599. case "middle":
  16600. labelOffset.x += size;
  16601. break;
  16602. }
  16603. }
  16604. }else{
  16605. start = {x: offsets.l};
  16606. stop = {x: dim.width - offsets.r};
  16607. titlePos = {x: (dim.width - offsets.r + offsets.l)/2};
  16608. titleOffset = size * cosr + (this._cachedLabelWidth || 0) * sinr + labelGap + Math.max(taMajorTick.length, taMinorTick.length) + tsize + taTitleGap;
  16609. axisVector = {x: 1, y: 0};
  16610. labelOffset = {x: 0, y: 0};
  16611. tickVector = {x: 0, y: 1};
  16612. anchorOffset = {x: 0, y: labelGap};
  16613. switch(rotation){
  16614. case 0:
  16615. labelAlign = "middle";
  16616. labelOffset.y = size;
  16617. break;
  16618. case 90:
  16619. labelAlign = "start";
  16620. labelOffset.x = -size * 0.4;
  16621. break;
  16622. case 180:
  16623. labelAlign = "middle";
  16624. break;
  16625. case 270:
  16626. labelAlign = "end";
  16627. labelOffset.x = size * 0.4;
  16628. break;
  16629. default:
  16630. if(rotation < (90 - centerAnchorLimit)){
  16631. labelAlign = "start";
  16632. labelOffset.y = leftBottom ? size : 0;
  16633. }else if(rotation < (90 + centerAnchorLimit)){
  16634. labelAlign = "start";
  16635. labelOffset.x = -size * 0.4;
  16636. }else if(rotation < 180){
  16637. labelAlign = "start";
  16638. labelOffset.y = leftBottom ? 0 : -size;
  16639. }else if(rotation < (270 - centerAnchorLimit)){
  16640. labelAlign = "end";
  16641. labelOffset.y = leftBottom ? 0 : -size;
  16642. }else if(rotation < (270 + centerAnchorLimit)){
  16643. labelAlign = "end";
  16644. labelOffset.y = leftBottom ? size * 0.4 : 0;
  16645. }else{
  16646. labelAlign = "end";
  16647. labelOffset.y = leftBottom ? size : 0;
  16648. }
  16649. }
  16650. if(leftBottom){
  16651. start.y = stop.y = dim.height - offsets.b;
  16652. titleRotation = (taTitleOrientation && taTitleOrientation == "axis") ? 180 : 0;
  16653. titlePos.y = dim.height - offsets.b + titleOffset - (titleRotation ? tsize : 0);
  16654. }else{
  16655. start.y = stop.y = offsets.t;
  16656. titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0;
  16657. titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize);
  16658. tickVector.y = -1;
  16659. anchorOffset.y = -anchorOffset.y;
  16660. switch(labelAlign){
  16661. case "start":
  16662. labelAlign = "end";
  16663. break;
  16664. case "end":
  16665. labelAlign = "start";
  16666. break;
  16667. case "middle":
  16668. labelOffset.y -= size;
  16669. break;
  16670. }
  16671. }
  16672. }
  16673. // render shapes
  16674. this.cleanGroup();
  16675. try{
  16676. var s = this.group,
  16677. c = this.scaler,
  16678. t = this.ticks,
  16679. canLabel,
  16680. f = lin.getTransformerFromModel(this.scaler),
  16681. // GFX Canvas now supports labels, so let's _not_ fallback to HTML anymore on canvas, just use
  16682. // HTML labels if explicitly asked + no rotation + no IE + no Opera
  16683. labelType = (!o.title || !titleRotation) && !rotation && this.opt.htmlLabels && !has("ie") && !has("opera") ? "html" : "gfx",
  16684. dx = tickVector.x * taMajorTick.length,
  16685. dy = tickVector.y * taMajorTick.length;
  16686. s.createLine({
  16687. x1: start.x,
  16688. y1: start.y,
  16689. x2: stop.x,
  16690. y2: stop.y
  16691. }).setStroke(taStroke);
  16692. //create axis title
  16693. if(o.title){
  16694. var axisTitle = acommon.createText[labelType](
  16695. this.chart,
  16696. s,
  16697. titlePos.x,
  16698. titlePos.y,
  16699. "middle",
  16700. o.title,
  16701. taTitleFont,
  16702. taTitleFontColor
  16703. );
  16704. if(labelType == "html"){
  16705. this.htmlElements.push(axisTitle);
  16706. }else{
  16707. //as soon as rotation is provided, labelType won't be "html"
  16708. //rotate gfx labels
  16709. axisTitle.setTransform(g.matrix.rotategAt(titleRotation, titlePos.x, titlePos.y));
  16710. }
  16711. }
  16712. // go out nicely instead of try/catch
  16713. if(t==null){
  16714. this.dirty = false;
  16715. return this;
  16716. }
  16717. arr.forEach(t.major, function(tick){
  16718. var offset = f(tick.value), elem,
  16719. x = start.x + axisVector.x * offset,
  16720. y = start.y + axisVector.y * offset;
  16721. this.createLine(s, {
  16722. x1: x, y1: y,
  16723. x2: x + dx,
  16724. y2: y + dy
  16725. }).setStroke(taMajorTick);
  16726. if(tick.label){
  16727. var label = o.maxLabelCharCount ? this.getTextWithLimitCharCount(tick.label, taFont, o.maxLabelCharCount) : {
  16728. text: tick.label,
  16729. truncated: false
  16730. };
  16731. label = o.maxLabelSize ? this.getTextWithLimitLength(label.text, taFont, o.maxLabelSize, label.truncated) : label;
  16732. elem = this.createText(labelType,
  16733. s,
  16734. x + dx + anchorOffset.x + (rotation ? 0 : labelOffset.x),
  16735. y + dy + anchorOffset.y + (rotation ? 0 : labelOffset.y),
  16736. labelAlign,
  16737. label.text,
  16738. taFont,
  16739. taFontColor
  16740. //this._cachedLabelWidth
  16741. );
  16742. // if bidi support was required, the textDir is "auto" and truncation
  16743. // took place, we need to update the dir of the element for cases as:
  16744. // Fool label: 111111W (W for bidi character)
  16745. // truncated label: 11...
  16746. // in this case for auto textDir the dir will be "ltr" which is wrong.
  16747. if(this.chart.truncateBidi && label.truncated){
  16748. this.chart.truncateBidi(elem, tick.label, labelType);
  16749. }
  16750. label.truncated && this.labelTooltip(elem, this.chart, tick.label, label.text, taFont, labelType);
  16751. if(labelType == "html"){
  16752. this.htmlElements.push(elem);
  16753. }else if(rotation){
  16754. elem.setTransform([
  16755. {dx: labelOffset.x, dy: labelOffset.y},
  16756. g.matrix.rotategAt(
  16757. rotation,
  16758. x + dx + anchorOffset.x,
  16759. y + dy + anchorOffset.y
  16760. )
  16761. ]);
  16762. }
  16763. }
  16764. }, this);
  16765. dx = tickVector.x * taMinorTick.length;
  16766. dy = tickVector.y * taMinorTick.length;
  16767. canLabel = c.minMinorStep <= c.minor.tick * c.bounds.scale;
  16768. arr.forEach(t.minor, function(tick){
  16769. var offset = f(tick.value), elem,
  16770. x = start.x + axisVector.x * offset,
  16771. y = start.y + axisVector.y * offset;
  16772. this.createLine(s, {
  16773. x1: x, y1: y,
  16774. x2: x + dx,
  16775. y2: y + dy
  16776. }).setStroke(taMinorTick);
  16777. if(canLabel && tick.label){
  16778. var label = o.maxLabelCharCount ? this.getTextWithLimitCharCount(tick.label, taFont, o.maxLabelCharCount) : {
  16779. text: tick.label,
  16780. truncated: false
  16781. };
  16782. label = o.maxLabelSize ? this.getTextWithLimitLength(label.text, taFont, o.maxLabelSize, label.truncated) : label;
  16783. elem = this.createText(labelType,
  16784. s,
  16785. x + dx + anchorOffset.x + (rotation ? 0 : labelOffset.x),
  16786. y + dy + anchorOffset.y + (rotation ? 0 : labelOffset.y),
  16787. labelAlign,
  16788. label.text,
  16789. taFont,
  16790. taFontColor
  16791. //this._cachedLabelWidth
  16792. );
  16793. // if bidi support was required, the textDir is "auto" and truncation
  16794. // took place, we need to update the dir of the element for cases as:
  16795. // Fool label: 111111W (W for bidi character)
  16796. // truncated label: 11...
  16797. // in this case for auto textDir the dir will be "ltr" which is wrong.
  16798. if(this.chart.getTextDir && label.truncated){
  16799. this.chart.truncateBidi(elem, tick.label, labelType);
  16800. }
  16801. label.truncated && this.labelTooltip(elem, this.chart, tick.label, label.text, taFont, labelType);
  16802. if(labelType == "html"){
  16803. this.htmlElements.push(elem);
  16804. }else if(rotation){
  16805. elem.setTransform([
  16806. {dx: labelOffset.x, dy: labelOffset.y},
  16807. g.matrix.rotategAt(
  16808. rotation,
  16809. x + dx + anchorOffset.x,
  16810. y + dy + anchorOffset.y
  16811. )
  16812. ]);
  16813. }
  16814. }
  16815. }, this);
  16816. dx = tickVector.x * taMicroTick.length;
  16817. dy = tickVector.y * taMicroTick.length;
  16818. arr.forEach(t.micro, function(tick){
  16819. var offset = f(tick.value), elem,
  16820. x = start.x + axisVector.x * offset,
  16821. y = start.y + axisVector.y * offset;
  16822. this.createLine(s, {
  16823. x1: x, y1: y,
  16824. x2: x + dx,
  16825. y2: y + dy
  16826. }).setStroke(taMicroTick);
  16827. }, this);
  16828. }catch(e){
  16829. // squelch
  16830. }
  16831. this.dirty = false;
  16832. return this; // dojox.charting.axis2d.Default
  16833. },
  16834. labelTooltip: function(elem, chart, label, truncatedLabel, font, elemType){
  16835. var modules = ["dijit/Tooltip"];
  16836. var aroundRect = {type: "rect"}, position = ["above", "below"],
  16837. fontWidth = g._base._getTextBox(truncatedLabel, {font: font}).w || 0,
  16838. fontHeight = font ? g.normalizedLength(g.splitFontString(font).size) : 0;
  16839. if(elemType == "html"){
  16840. lang.mixin(aroundRect, html.coords(elem.firstChild, true));
  16841. aroundRect.width = Math.ceil(fontWidth);
  16842. aroundRect.height = Math.ceil(fontHeight);
  16843. this._events.push({
  16844. shape: dojo,
  16845. handle: connect.connect(elem.firstChild, "onmouseover", this, function(e){
  16846. require(modules, function(Tooltip){
  16847. Tooltip.show(label, aroundRect, position);
  16848. });
  16849. })
  16850. });
  16851. this._events.push({
  16852. shape: dojo,
  16853. handle: connect.connect(elem.firstChild, "onmouseout", this, function(e){
  16854. require(modules, function(Tooltip){
  16855. Tooltip.hide(aroundRect);
  16856. });
  16857. })
  16858. });
  16859. }else{
  16860. var shp = elem.getShape(),
  16861. lt = html.coords(chart.node, true);
  16862. aroundRect = lang.mixin(aroundRect, {
  16863. x: shp.x - fontWidth / 2,
  16864. y: shp.y
  16865. });
  16866. aroundRect.x += lt.x;
  16867. aroundRect.y += lt.y;
  16868. aroundRect.x = Math.round(aroundRect.x);
  16869. aroundRect.y = Math.round(aroundRect.y);
  16870. aroundRect.width = Math.ceil(fontWidth);
  16871. aroundRect.height = Math.ceil(fontHeight);
  16872. this._events.push({
  16873. shape: elem,
  16874. handle: elem.connect("onmouseenter", this, function(e){
  16875. require(modules, function(Tooltip){
  16876. Tooltip.show(label, aroundRect, position);
  16877. });
  16878. })
  16879. });
  16880. this._events.push({
  16881. shape: elem,
  16882. handle: elem.connect("onmouseleave", this, function(e){
  16883. require(modules, function(Tooltip){
  16884. Tooltip.hide(aroundRect);
  16885. });
  16886. })
  16887. });
  16888. }
  16889. }
  16890. });
  16891. });
  16892. },
  16893. 'dojox/charting/plot2d/ClusteredBars':function(){
  16894. define("dojox/charting/plot2d/ClusteredBars", ["dojo/_base/lang", "dojo/_base/array", "dojo/_base/declare", "./Bars", "./common",
  16895. "dojox/lang/functional", "dojox/lang/functional/reversed", "dojox/lang/utils"],
  16896. function(lang, arr, declare, Bars, dc, df, dfr, du){
  16897. /*=====
  16898. var Bars = dojox.charting.plot2d.Bars;
  16899. =====*/
  16900. var purgeGroup = dfr.lambda("item.purgeGroup()");
  16901. return declare("dojox.charting.plot2d.ClusteredBars", Bars, {
  16902. // summary:
  16903. // A plot representing grouped or clustered bars (horizontal bars)
  16904. render: function(dim, offsets){
  16905. // summary:
  16906. // Run the calculations for any axes for this plot.
  16907. // dim: Object
  16908. // An object in the form of { width, height }
  16909. // offsets: Object
  16910. // An object of the form { l, r, t, b}.
  16911. // returns: dojox.charting.plot2d.ClusteredBars
  16912. // A reference to this plot for functional chaining.
  16913. if(this.zoom && !this.isDataDirty()){
  16914. return this.performZoom(dim, offsets);
  16915. }
  16916. this.resetEvents();
  16917. this.dirty = this.isDirty();
  16918. if(this.dirty){
  16919. arr.forEach(this.series, purgeGroup);
  16920. this._eventSeries = {};
  16921. this.cleanGroup();
  16922. var s = this.group;
  16923. df.forEachRev(this.series, function(item){ item.cleanGroup(s); });
  16924. }
  16925. var t = this.chart.theme, f, gap, height, thickness,
  16926. ht = this._hScaler.scaler.getTransformerFromModel(this._hScaler),
  16927. vt = this._vScaler.scaler.getTransformerFromModel(this._vScaler),
  16928. baseline = Math.max(0, this._hScaler.bounds.lower),
  16929. baselineWidth = ht(baseline),
  16930. events = this.events();
  16931. f = dc.calculateBarSize(this._vScaler.bounds.scale, this.opt, this.series.length);
  16932. gap = f.gap;
  16933. height = thickness = f.size;
  16934. for(var i = this.series.length - 1; i >= 0; --i){
  16935. var run = this.series[i], shift = thickness * (this.series.length - i - 1);
  16936. if(!this.dirty && !run.dirty){
  16937. t.skip();
  16938. this._reconnectEvents(run.name);
  16939. continue;
  16940. }
  16941. run.cleanGroup();
  16942. var theme = t.next("bar", [this.opt, run]), s = run.group,
  16943. eventSeries = new Array(run.data.length);
  16944. for(var j = 0; j < run.data.length; ++j){
  16945. var value = run.data[j];
  16946. if(value !== null){
  16947. var v = typeof value == "number" ? value : value.y,
  16948. hv = ht(v),
  16949. width = hv - baselineWidth,
  16950. w = Math.abs(width),
  16951. finalTheme = typeof value != "number" ?
  16952. t.addMixin(theme, "bar", value, true) :
  16953. t.post(theme, "bar");
  16954. if(w >= 0 && height >= 1){
  16955. var rect = {
  16956. x: offsets.l + (v < baseline ? hv : baselineWidth),
  16957. y: dim.height - offsets.b - vt(j + 1.5) + gap + shift,
  16958. width: w, height: height
  16959. };
  16960. var specialFill = this._plotFill(finalTheme.series.fill, dim, offsets);
  16961. specialFill = this._shapeFill(specialFill, rect);
  16962. var shape = s.createRect(rect).setFill(specialFill).setStroke(finalTheme.series.stroke);
  16963. run.dyn.fill = shape.getFill();
  16964. run.dyn.stroke = shape.getStroke();
  16965. if(events){
  16966. var o = {
  16967. element: "bar",
  16968. index: j,
  16969. run: run,
  16970. shape: shape,
  16971. x: v,
  16972. y: j + 1.5
  16973. };
  16974. this._connectEvents(o);
  16975. eventSeries[j] = o;
  16976. }
  16977. if(this.animate){
  16978. this._animateBar(shape, offsets.l + baselineWidth, -width);
  16979. }
  16980. }
  16981. }
  16982. }
  16983. this._eventSeries[run.name] = eventSeries;
  16984. run.dirty = false;
  16985. }
  16986. this.dirty = false;
  16987. return this; // dojox.charting.plot2d.ClusteredBars
  16988. }
  16989. });
  16990. });
  16991. },
  16992. 'dojox/charting/action2d/MoveSlice':function(){
  16993. define("dojox/charting/action2d/MoveSlice", ["dojo/_base/connect", "dojo/_base/declare", "./PlotAction", "dojo/fx/easing", "dojox/gfx/matrix",
  16994. "dojox/gfx/fx", "dojox/lang/functional", "dojox/lang/functional/scan", "dojox/lang/functional/fold"],
  16995. function(hub, declare, PlotAction, dfe, m, gf, df, dfs, dff){
  16996. /*=====
  16997. dojo.declare("dojox.charting.action2d.__MoveSliceCtorArgs", dojox.charting.action2d.__PlotActionCtorArgs, {
  16998. // summary:
  16999. // Additional arguments for highlighting actions.
  17000. // scale: Number?
  17001. // The amount to scale the pie slice. Default is 1.05.
  17002. scale: 1.05,
  17003. // shift: Number?
  17004. // The amount in pixels to shift the pie slice. Default is 7.
  17005. shift: 7
  17006. });
  17007. var PlotAction = dojox.charting.action2d.PlotAction;
  17008. =====*/
  17009. var DEFAULT_SCALE = 1.05,
  17010. DEFAULT_SHIFT = 7; // px
  17011. return declare("dojox.charting.action2d.MoveSlice", PlotAction, {
  17012. // summary:
  17013. // Create an action for a pie chart that moves and scales a pie slice.
  17014. // the data description block for the widget parser
  17015. defaultParams: {
  17016. duration: 400, // duration of the action in ms
  17017. easing: dfe.backOut, // easing for the action
  17018. scale: DEFAULT_SCALE, // scale of magnification
  17019. shift: DEFAULT_SHIFT // shift of the slice
  17020. },
  17021. optionalParams: {}, // no optional parameters
  17022. constructor: function(chart, plot, kwArgs){
  17023. // summary:
  17024. // Create the slice moving action and connect it to the plot.
  17025. // chart: dojox.charting.Chart
  17026. // The chart this action belongs to.
  17027. // plot: String?
  17028. // The plot this action is attached to. If not passed, "default" is assumed.
  17029. // kwArgs: dojox.charting.action2d.__MoveSliceCtorArgs?
  17030. // Optional keyword arguments object for setting parameters.
  17031. if(!kwArgs){ kwArgs = {}; }
  17032. this.scale = typeof kwArgs.scale == "number" ? kwArgs.scale : DEFAULT_SCALE;
  17033. this.shift = typeof kwArgs.shift == "number" ? kwArgs.shift : DEFAULT_SHIFT;
  17034. this.connect();
  17035. },
  17036. process: function(o){
  17037. // summary:
  17038. // Process the action on the given object.
  17039. // o: dojox.gfx.Shape
  17040. // The object on which to process the slice moving action.
  17041. if(!o.shape || o.element != "slice" || !(o.type in this.overOutEvents)){ return; }
  17042. if(!this.angles){
  17043. // calculate the running total of slice angles
  17044. var startAngle = m._degToRad(o.plot.opt.startAngle);
  17045. if(typeof o.run.data[0] == "number"){
  17046. this.angles = df.map(df.scanl(o.run.data, "+", startAngle),
  17047. "* 2 * Math.PI / this", df.foldl(o.run.data, "+", 0));
  17048. }else{
  17049. this.angles = df.map(df.scanl(o.run.data, "a + b.y", startAngle),
  17050. "* 2 * Math.PI / this", df.foldl(o.run.data, "a + b.y", 0));
  17051. }
  17052. }
  17053. var index = o.index, anim, startScale, endScale, startOffset, endOffset,
  17054. angle = (this.angles[index] + this.angles[index + 1]) / 2,
  17055. rotateTo0 = m.rotateAt(-angle, o.cx, o.cy),
  17056. rotateBack = m.rotateAt( angle, o.cx, o.cy);
  17057. anim = this.anim[index];
  17058. if(anim){
  17059. anim.action.stop(true);
  17060. }else{
  17061. this.anim[index] = anim = {};
  17062. }
  17063. if(o.type == "onmouseover"){
  17064. startOffset = 0;
  17065. endOffset = this.shift;
  17066. startScale = 1;
  17067. endScale = this.scale;
  17068. }else{
  17069. startOffset = this.shift;
  17070. endOffset = 0;
  17071. startScale = this.scale;
  17072. endScale = 1;
  17073. }
  17074. anim.action = gf.animateTransform({
  17075. shape: o.shape,
  17076. duration: this.duration,
  17077. easing: this.easing,
  17078. transform: [
  17079. rotateBack,
  17080. {name: "translate", start: [startOffset, 0], end: [endOffset, 0]},
  17081. {name: "scaleAt", start: [startScale, o.cx, o.cy], end: [endScale, o.cx, o.cy]},
  17082. rotateTo0
  17083. ]
  17084. });
  17085. if(o.type == "onmouseout"){
  17086. hub.connect(anim.action, "onEnd", this, function(){
  17087. delete this.anim[index];
  17088. });
  17089. }
  17090. anim.action.play();
  17091. },
  17092. reset: function(){
  17093. delete this.angles;
  17094. }
  17095. });
  17096. });
  17097. },
  17098. 'dojo/colors':function(){
  17099. define(["./_base/kernel", "./_base/lang", "./_base/Color", "./_base/array"], function(dojo, lang, Color, ArrayUtil) {
  17100. // module:
  17101. // dojo/colors
  17102. // summary:
  17103. // TODOC
  17104. var ColorExt = lang.getObject("dojo.colors", true);
  17105. //TODO: this module appears to break naming conventions
  17106. /*=====
  17107. lang.mixin(dojo, {
  17108. colors: {
  17109. // summary: Color utilities, extending Base dojo.Color
  17110. }
  17111. });
  17112. =====*/
  17113. // this is a standard conversion prescribed by the CSS3 Color Module
  17114. var hue2rgb = function(m1, m2, h){
  17115. if(h < 0){ ++h; }
  17116. if(h > 1){ --h; }
  17117. var h6 = 6 * h;
  17118. if(h6 < 1){ return m1 + (m2 - m1) * h6; }
  17119. if(2 * h < 1){ return m2; }
  17120. if(3 * h < 2){ return m1 + (m2 - m1) * (2 / 3 - h) * 6; }
  17121. return m1;
  17122. };
  17123. // Override base Color.fromRgb with the impl in this module
  17124. dojo.colorFromRgb = Color.fromRgb = function(/*String*/ color, /*dojo.Color?*/ obj){
  17125. // summary:
  17126. // get rgb(a) array from css-style color declarations
  17127. // description:
  17128. // this function can handle all 4 CSS3 Color Module formats: rgb,
  17129. // rgba, hsl, hsla, including rgb(a) with percentage values.
  17130. var m = color.toLowerCase().match(/^(rgba?|hsla?)\(([\s\.\-,%0-9]+)\)/);
  17131. if(m){
  17132. var c = m[2].split(/\s*,\s*/), l = c.length, t = m[1], a;
  17133. if((t == "rgb" && l == 3) || (t == "rgba" && l == 4)){
  17134. var r = c[0];
  17135. if(r.charAt(r.length - 1) == "%"){
  17136. // 3 rgb percentage values
  17137. a = ArrayUtil.map(c, function(x){
  17138. return parseFloat(x) * 2.56;
  17139. });
  17140. if(l == 4){ a[3] = c[3]; }
  17141. return Color.fromArray(a, obj); // dojo.Color
  17142. }
  17143. return Color.fromArray(c, obj); // dojo.Color
  17144. }
  17145. if((t == "hsl" && l == 3) || (t == "hsla" && l == 4)){
  17146. // normalize hsl values
  17147. var H = ((parseFloat(c[0]) % 360) + 360) % 360 / 360,
  17148. S = parseFloat(c[1]) / 100,
  17149. L = parseFloat(c[2]) / 100,
  17150. // calculate rgb according to the algorithm
  17151. // recommended by the CSS3 Color Module
  17152. m2 = L <= 0.5 ? L * (S + 1) : L + S - L * S,
  17153. m1 = 2 * L - m2;
  17154. a = [
  17155. hue2rgb(m1, m2, H + 1 / 3) * 256,
  17156. hue2rgb(m1, m2, H) * 256,
  17157. hue2rgb(m1, m2, H - 1 / 3) * 256,
  17158. 1
  17159. ];
  17160. if(l == 4){ a[3] = c[3]; }
  17161. return Color.fromArray(a, obj); // dojo.Color
  17162. }
  17163. }
  17164. return null; // dojo.Color
  17165. };
  17166. var confine = function(c, low, high){
  17167. // summary:
  17168. // sanitize a color component by making sure it is a number,
  17169. // and clamping it to valid values
  17170. c = Number(c);
  17171. return isNaN(c) ? high : c < low ? low : c > high ? high : c; // Number
  17172. };
  17173. Color.prototype.sanitize = function(){
  17174. // summary: makes sure that the object has correct attributes
  17175. var t = this;
  17176. t.r = Math.round(confine(t.r, 0, 255));
  17177. t.g = Math.round(confine(t.g, 0, 255));
  17178. t.b = Math.round(confine(t.b, 0, 255));
  17179. t.a = confine(t.a, 0, 1);
  17180. return this; // dojo.Color
  17181. };
  17182. ColorExt.makeGrey = Color.makeGrey = function(/*Number*/ g, /*Number?*/ a){
  17183. // summary: creates a greyscale color with an optional alpha
  17184. return Color.fromArray([g, g, g, a]); // dojo.Color
  17185. };
  17186. // mixin all CSS3 named colors not already in _base, along with SVG 1.0 variant spellings
  17187. lang.mixin(Color.named, {
  17188. "aliceblue": [240,248,255],
  17189. "antiquewhite": [250,235,215],
  17190. "aquamarine": [127,255,212],
  17191. "azure": [240,255,255],
  17192. "beige": [245,245,220],
  17193. "bisque": [255,228,196],
  17194. "blanchedalmond": [255,235,205],
  17195. "blueviolet": [138,43,226],
  17196. "brown": [165,42,42],
  17197. "burlywood": [222,184,135],
  17198. "cadetblue": [95,158,160],
  17199. "chartreuse": [127,255,0],
  17200. "chocolate": [210,105,30],
  17201. "coral": [255,127,80],
  17202. "cornflowerblue": [100,149,237],
  17203. "cornsilk": [255,248,220],
  17204. "crimson": [220,20,60],
  17205. "cyan": [0,255,255],
  17206. "darkblue": [0,0,139],
  17207. "darkcyan": [0,139,139],
  17208. "darkgoldenrod": [184,134,11],
  17209. "darkgray": [169,169,169],
  17210. "darkgreen": [0,100,0],
  17211. "darkgrey": [169,169,169],
  17212. "darkkhaki": [189,183,107],
  17213. "darkmagenta": [139,0,139],
  17214. "darkolivegreen": [85,107,47],
  17215. "darkorange": [255,140,0],
  17216. "darkorchid": [153,50,204],
  17217. "darkred": [139,0,0],
  17218. "darksalmon": [233,150,122],
  17219. "darkseagreen": [143,188,143],
  17220. "darkslateblue": [72,61,139],
  17221. "darkslategray": [47,79,79],
  17222. "darkslategrey": [47,79,79],
  17223. "darkturquoise": [0,206,209],
  17224. "darkviolet": [148,0,211],
  17225. "deeppink": [255,20,147],
  17226. "deepskyblue": [0,191,255],
  17227. "dimgray": [105,105,105],
  17228. "dimgrey": [105,105,105],
  17229. "dodgerblue": [30,144,255],
  17230. "firebrick": [178,34,34],
  17231. "floralwhite": [255,250,240],
  17232. "forestgreen": [34,139,34],
  17233. "gainsboro": [220,220,220],
  17234. "ghostwhite": [248,248,255],
  17235. "gold": [255,215,0],
  17236. "goldenrod": [218,165,32],
  17237. "greenyellow": [173,255,47],
  17238. "grey": [128,128,128],
  17239. "honeydew": [240,255,240],
  17240. "hotpink": [255,105,180],
  17241. "indianred": [205,92,92],
  17242. "indigo": [75,0,130],
  17243. "ivory": [255,255,240],
  17244. "khaki": [240,230,140],
  17245. "lavender": [230,230,250],
  17246. "lavenderblush": [255,240,245],
  17247. "lawngreen": [124,252,0],
  17248. "lemonchiffon": [255,250,205],
  17249. "lightblue": [173,216,230],
  17250. "lightcoral": [240,128,128],
  17251. "lightcyan": [224,255,255],
  17252. "lightgoldenrodyellow": [250,250,210],
  17253. "lightgray": [211,211,211],
  17254. "lightgreen": [144,238,144],
  17255. "lightgrey": [211,211,211],
  17256. "lightpink": [255,182,193],
  17257. "lightsalmon": [255,160,122],
  17258. "lightseagreen": [32,178,170],
  17259. "lightskyblue": [135,206,250],
  17260. "lightslategray": [119,136,153],
  17261. "lightslategrey": [119,136,153],
  17262. "lightsteelblue": [176,196,222],
  17263. "lightyellow": [255,255,224],
  17264. "limegreen": [50,205,50],
  17265. "linen": [250,240,230],
  17266. "magenta": [255,0,255],
  17267. "mediumaquamarine": [102,205,170],
  17268. "mediumblue": [0,0,205],
  17269. "mediumorchid": [186,85,211],
  17270. "mediumpurple": [147,112,219],
  17271. "mediumseagreen": [60,179,113],
  17272. "mediumslateblue": [123,104,238],
  17273. "mediumspringgreen": [0,250,154],
  17274. "mediumturquoise": [72,209,204],
  17275. "mediumvioletred": [199,21,133],
  17276. "midnightblue": [25,25,112],
  17277. "mintcream": [245,255,250],
  17278. "mistyrose": [255,228,225],
  17279. "moccasin": [255,228,181],
  17280. "navajowhite": [255,222,173],
  17281. "oldlace": [253,245,230],
  17282. "olivedrab": [107,142,35],
  17283. "orange": [255,165,0],
  17284. "orangered": [255,69,0],
  17285. "orchid": [218,112,214],
  17286. "palegoldenrod": [238,232,170],
  17287. "palegreen": [152,251,152],
  17288. "paleturquoise": [175,238,238],
  17289. "palevioletred": [219,112,147],
  17290. "papayawhip": [255,239,213],
  17291. "peachpuff": [255,218,185],
  17292. "peru": [205,133,63],
  17293. "pink": [255,192,203],
  17294. "plum": [221,160,221],
  17295. "powderblue": [176,224,230],
  17296. "rosybrown": [188,143,143],
  17297. "royalblue": [65,105,225],
  17298. "saddlebrown": [139,69,19],
  17299. "salmon": [250,128,114],
  17300. "sandybrown": [244,164,96],
  17301. "seagreen": [46,139,87],
  17302. "seashell": [255,245,238],
  17303. "sienna": [160,82,45],
  17304. "skyblue": [135,206,235],
  17305. "slateblue": [106,90,205],
  17306. "slategray": [112,128,144],
  17307. "slategrey": [112,128,144],
  17308. "snow": [255,250,250],
  17309. "springgreen": [0,255,127],
  17310. "steelblue": [70,130,180],
  17311. "tan": [210,180,140],
  17312. "thistle": [216,191,216],
  17313. "tomato": [255,99,71],
  17314. "turquoise": [64,224,208],
  17315. "violet": [238,130,238],
  17316. "wheat": [245,222,179],
  17317. "whitesmoke": [245,245,245],
  17318. "yellowgreen": [154,205,50]
  17319. });
  17320. return Color;
  17321. });
  17322. },
  17323. 'dijit/Tooltip':function(){
  17324. require({cache:{
  17325. 'url:dijit/templates/Tooltip.html':"<div class=\"dijitTooltip dijitTooltipLeft\" id=\"dojoTooltip\"\n\t><div class=\"dijitTooltipContainer dijitTooltipContents\" data-dojo-attach-point=\"containerNode\" role='alert'></div\n\t><div class=\"dijitTooltipConnector\" data-dojo-attach-point=\"connectorNode\"></div\n></div>\n"}});
  17326. define("dijit/Tooltip", [
  17327. "dojo/_base/array", // array.forEach array.indexOf array.map
  17328. "dojo/_base/declare", // declare
  17329. "dojo/_base/fx", // fx.fadeIn fx.fadeOut
  17330. "dojo/dom", // dom.byId
  17331. "dojo/dom-class", // domClass.add
  17332. "dojo/dom-geometry", // domGeometry.position
  17333. "dojo/dom-style", // domStyle.set, domStyle.get
  17334. "dojo/_base/lang", // lang.hitch lang.isArrayLike
  17335. "dojo/_base/sniff", // has("ie")
  17336. "dojo/_base/window", // win.body
  17337. "./_base/manager", // manager.defaultDuration
  17338. "./place",
  17339. "./_Widget",
  17340. "./_TemplatedMixin",
  17341. "./BackgroundIframe",
  17342. "dojo/text!./templates/Tooltip.html",
  17343. "." // sets dijit.showTooltip etc. for back-compat
  17344. ], function(array, declare, fx, dom, domClass, domGeometry, domStyle, lang, has, win,
  17345. manager, place, _Widget, _TemplatedMixin, BackgroundIframe, template, dijit){
  17346. /*=====
  17347. var _Widget = dijit._Widget;
  17348. var BackgroundIframe = dijit.BackgroundIframe;
  17349. var _TemplatedMixin = dijit._TemplatedMixin;
  17350. =====*/
  17351. // module:
  17352. // dijit/Tooltip
  17353. // summary:
  17354. // Defines dijit.Tooltip widget (to display a tooltip), showTooltip()/hideTooltip(), and _MasterTooltip
  17355. var MasterTooltip = declare("dijit._MasterTooltip", [_Widget, _TemplatedMixin], {
  17356. // summary:
  17357. // Internal widget that holds the actual tooltip markup,
  17358. // which occurs once per page.
  17359. // Called by Tooltip widgets which are just containers to hold
  17360. // the markup
  17361. // tags:
  17362. // protected
  17363. // duration: Integer
  17364. // Milliseconds to fade in/fade out
  17365. duration: manager.defaultDuration,
  17366. templateString: template,
  17367. postCreate: function(){
  17368. win.body().appendChild(this.domNode);
  17369. this.bgIframe = new BackgroundIframe(this.domNode);
  17370. // Setup fade-in and fade-out functions.
  17371. this.fadeIn = fx.fadeIn({ node: this.domNode, duration: this.duration, onEnd: lang.hitch(this, "_onShow") });
  17372. this.fadeOut = fx.fadeOut({ node: this.domNode, duration: this.duration, onEnd: lang.hitch(this, "_onHide") });
  17373. },
  17374. show: function(innerHTML, aroundNode, position, rtl, textDir){
  17375. // summary:
  17376. // Display tooltip w/specified contents to right of specified node
  17377. // (To left if there's no space on the right, or if rtl == true)
  17378. // innerHTML: String
  17379. // Contents of the tooltip
  17380. // aroundNode: DomNode || dijit.__Rectangle
  17381. // Specifies that tooltip should be next to this node / area
  17382. // position: String[]?
  17383. // List of positions to try to position tooltip (ex: ["right", "above"])
  17384. // rtl: Boolean?
  17385. // Corresponds to `WidgetBase.dir` attribute, where false means "ltr" and true
  17386. // means "rtl"; specifies GUI direction, not text direction.
  17387. // textDir: String?
  17388. // Corresponds to `WidgetBase.textdir` attribute; specifies direction of text.
  17389. if(this.aroundNode && this.aroundNode === aroundNode && this.containerNode.innerHTML == innerHTML){
  17390. return;
  17391. }
  17392. // reset width; it may have been set by orient() on a previous tooltip show()
  17393. this.domNode.width = "auto";
  17394. if(this.fadeOut.status() == "playing"){
  17395. // previous tooltip is being hidden; wait until the hide completes then show new one
  17396. this._onDeck=arguments;
  17397. return;
  17398. }
  17399. this.containerNode.innerHTML=innerHTML;
  17400. if(textDir){
  17401. this.set("textDir", textDir);
  17402. }
  17403. this.containerNode.align = rtl? "right" : "left"; //fix the text alignment
  17404. var pos = place.around(this.domNode, aroundNode,
  17405. position && position.length ? position : Tooltip.defaultPosition, !rtl, lang.hitch(this, "orient"));
  17406. // Position the tooltip connector for middle alignment.
  17407. // This could not have been done in orient() since the tooltip wasn't positioned at that time.
  17408. var aroundNodeCoords = pos.aroundNodePos;
  17409. if(pos.corner.charAt(0) == 'M' && pos.aroundCorner.charAt(0) == 'M'){
  17410. this.connectorNode.style.top = aroundNodeCoords.y + ((aroundNodeCoords.h - this.connectorNode.offsetHeight) >> 1) - pos.y + "px";
  17411. this.connectorNode.style.left = "";
  17412. }else if(pos.corner.charAt(1) == 'M' && pos.aroundCorner.charAt(1) == 'M'){
  17413. this.connectorNode.style.left = aroundNodeCoords.x + ((aroundNodeCoords.w - this.connectorNode.offsetWidth) >> 1) - pos.x + "px";
  17414. }
  17415. // show it
  17416. domStyle.set(this.domNode, "opacity", 0);
  17417. this.fadeIn.play();
  17418. this.isShowingNow = true;
  17419. this.aroundNode = aroundNode;
  17420. },
  17421. orient: function(/*DomNode*/ node, /*String*/ aroundCorner, /*String*/ tooltipCorner, /*Object*/ spaceAvailable, /*Object*/ aroundNodeCoords){
  17422. // summary:
  17423. // Private function to set CSS for tooltip node based on which position it's in.
  17424. // This is called by the dijit popup code. It will also reduce the tooltip's
  17425. // width to whatever width is available
  17426. // tags:
  17427. // protected
  17428. this.connectorNode.style.top = ""; //reset to default
  17429. // Adjust for space taking by tooltip connector.
  17430. // Take care not to modify the original spaceAvailable arg as that confuses the caller (dijit.place).
  17431. var heightAvailable = spaceAvailable.h,
  17432. widthAvailable = spaceAvailable.w;
  17433. if(aroundCorner.charAt(1) != tooltipCorner.charAt(1)){
  17434. // left/right tooltip
  17435. widthAvailable -= this.connectorNode.offsetWidth;
  17436. }else{
  17437. // above/below tooltip
  17438. heightAvailable -= this.connectorNode.offsetHeight;
  17439. }
  17440. node.className = "dijitTooltip " +
  17441. {
  17442. "MR-ML": "dijitTooltipRight",
  17443. "ML-MR": "dijitTooltipLeft",
  17444. "TM-BM": "dijitTooltipAbove",
  17445. "BM-TM": "dijitTooltipBelow",
  17446. "BL-TL": "dijitTooltipBelow dijitTooltipABLeft",
  17447. "TL-BL": "dijitTooltipAbove dijitTooltipABLeft",
  17448. "BR-TR": "dijitTooltipBelow dijitTooltipABRight",
  17449. "TR-BR": "dijitTooltipAbove dijitTooltipABRight",
  17450. "BR-BL": "dijitTooltipRight",
  17451. "BL-BR": "dijitTooltipLeft"
  17452. }[aroundCorner + "-" + tooltipCorner];
  17453. // reduce tooltip's width to the amount of width available, so that it doesn't overflow screen
  17454. this.domNode.style.width = "auto";
  17455. var size = domGeometry.getContentBox(this.domNode);
  17456. var width = Math.min((Math.max(widthAvailable,1)), size.w);
  17457. var widthWasReduced = width < size.w;
  17458. this.domNode.style.width = width+"px";
  17459. // Reposition the tooltip connector.
  17460. if(tooltipCorner.charAt(0) == 'B' && aroundCorner.charAt(0) == 'B'){
  17461. var bb = domGeometry.position(node);
  17462. var tooltipConnectorHeight = this.connectorNode.offsetHeight;
  17463. if(bb.h > heightAvailable){
  17464. // The tooltip starts at the top of the page and will extend past the aroundNode
  17465. var aroundNodePlacement = heightAvailable - ((aroundNodeCoords.h + tooltipConnectorHeight) >> 1);
  17466. this.connectorNode.style.top = aroundNodePlacement + "px";
  17467. this.connectorNode.style.bottom = "";
  17468. }else{
  17469. // Align center of connector with center of aroundNode, except don't let bottom
  17470. // of connector extend below bottom of tooltip content, or top of connector
  17471. // extend past top of tooltip content
  17472. this.connectorNode.style.bottom = Math.min(
  17473. Math.max(aroundNodeCoords.h/2 - tooltipConnectorHeight/2, 0),
  17474. bb.h - tooltipConnectorHeight) + "px";
  17475. this.connectorNode.style.top = "";
  17476. }
  17477. }else{
  17478. // reset the tooltip back to the defaults
  17479. this.connectorNode.style.top = "";
  17480. this.connectorNode.style.bottom = "";
  17481. }
  17482. return Math.max(0, size.w - widthAvailable);
  17483. },
  17484. _onShow: function(){
  17485. // summary:
  17486. // Called at end of fade-in operation
  17487. // tags:
  17488. // protected
  17489. if(has("ie")){
  17490. // the arrow won't show up on a node w/an opacity filter
  17491. this.domNode.style.filter="";
  17492. }
  17493. },
  17494. hide: function(aroundNode){
  17495. // summary:
  17496. // Hide the tooltip
  17497. if(this._onDeck && this._onDeck[1] == aroundNode){
  17498. // this hide request is for a show() that hasn't even started yet;
  17499. // just cancel the pending show()
  17500. this._onDeck=null;
  17501. }else if(this.aroundNode === aroundNode){
  17502. // this hide request is for the currently displayed tooltip
  17503. this.fadeIn.stop();
  17504. this.isShowingNow = false;
  17505. this.aroundNode = null;
  17506. this.fadeOut.play();
  17507. }else{
  17508. // just ignore the call, it's for a tooltip that has already been erased
  17509. }
  17510. },
  17511. _onHide: function(){
  17512. // summary:
  17513. // Called at end of fade-out operation
  17514. // tags:
  17515. // protected
  17516. this.domNode.style.cssText=""; // to position offscreen again
  17517. this.containerNode.innerHTML="";
  17518. if(this._onDeck){
  17519. // a show request has been queued up; do it now
  17520. this.show.apply(this, this._onDeck);
  17521. this._onDeck=null;
  17522. }
  17523. },
  17524. _setAutoTextDir: function(/*Object*/node){
  17525. // summary:
  17526. // Resolve "auto" text direction for children nodes
  17527. // tags:
  17528. // private
  17529. this.applyTextDir(node, has("ie") ? node.outerText : node.textContent);
  17530. array.forEach(node.children, function(child){this._setAutoTextDir(child); }, this);
  17531. },
  17532. _setTextDirAttr: function(/*String*/ textDir){
  17533. // summary:
  17534. // Setter for textDir.
  17535. // description:
  17536. // Users shouldn't call this function; they should be calling
  17537. // set('textDir', value)
  17538. // tags:
  17539. // private
  17540. this._set("textDir", textDir);
  17541. if (textDir == "auto"){
  17542. this._setAutoTextDir(this.containerNode);
  17543. }else{
  17544. this.containerNode.dir = this.textDir;
  17545. }
  17546. }
  17547. });
  17548. dijit.showTooltip = function(innerHTML, aroundNode, position, rtl, textDir){
  17549. // summary:
  17550. // Static method to display tooltip w/specified contents in specified position.
  17551. // See description of dijit.Tooltip.defaultPosition for details on position parameter.
  17552. // If position is not specified then dijit.Tooltip.defaultPosition is used.
  17553. // innerHTML: String
  17554. // Contents of the tooltip
  17555. // aroundNode: dijit.__Rectangle
  17556. // Specifies that tooltip should be next to this node / area
  17557. // position: String[]?
  17558. // List of positions to try to position tooltip (ex: ["right", "above"])
  17559. // rtl: Boolean?
  17560. // Corresponds to `WidgetBase.dir` attribute, where false means "ltr" and true
  17561. // means "rtl"; specifies GUI direction, not text direction.
  17562. // textDir: String?
  17563. // Corresponds to `WidgetBase.textdir` attribute; specifies direction of text.
  17564. // after/before don't work, but they used to, so for back-compat convert them to after-centered, before-centered
  17565. if(position){
  17566. position = array.map(position, function(val){
  17567. return {after: "after-centered", before: "before-centered"}[val] || val;
  17568. });
  17569. }
  17570. if(!Tooltip._masterTT){ dijit._masterTT = Tooltip._masterTT = new MasterTooltip(); }
  17571. return Tooltip._masterTT.show(innerHTML, aroundNode, position, rtl, textDir);
  17572. };
  17573. dijit.hideTooltip = function(aroundNode){
  17574. // summary:
  17575. // Static method to hide the tooltip displayed via showTooltip()
  17576. return Tooltip._masterTT && Tooltip._masterTT.hide(aroundNode);
  17577. };
  17578. var Tooltip = declare("dijit.Tooltip", _Widget, {
  17579. // summary:
  17580. // Pops up a tooltip (a help message) when you hover over a node.
  17581. // label: String
  17582. // Text to display in the tooltip.
  17583. // Specified as innerHTML when creating the widget from markup.
  17584. label: "",
  17585. // showDelay: Integer
  17586. // Number of milliseconds to wait after hovering over/focusing on the object, before
  17587. // the tooltip is displayed.
  17588. showDelay: 400,
  17589. // connectId: String|String[]
  17590. // Id of domNode(s) to attach the tooltip to.
  17591. // When user hovers over specified dom node, the tooltip will appear.
  17592. connectId: [],
  17593. // position: String[]
  17594. // See description of `dijit.Tooltip.defaultPosition` for details on position parameter.
  17595. position: [],
  17596. _setConnectIdAttr: function(/*String|String[]*/ newId){
  17597. // summary:
  17598. // Connect to specified node(s)
  17599. // Remove connections to old nodes (if there are any)
  17600. array.forEach(this._connections || [], function(nested){
  17601. array.forEach(nested, lang.hitch(this, "disconnect"));
  17602. }, this);
  17603. // Make array of id's to connect to, excluding entries for nodes that don't exist yet, see startup()
  17604. this._connectIds = array.filter(lang.isArrayLike(newId) ? newId : (newId ? [newId] : []),
  17605. function(id){ return dom.byId(id); });
  17606. // Make connections
  17607. this._connections = array.map(this._connectIds, function(id){
  17608. var node = dom.byId(id);
  17609. return [
  17610. this.connect(node, "onmouseenter", "_onHover"),
  17611. this.connect(node, "onmouseleave", "_onUnHover"),
  17612. this.connect(node, "onfocus", "_onHover"),
  17613. this.connect(node, "onblur", "_onUnHover")
  17614. ];
  17615. }, this);
  17616. this._set("connectId", newId);
  17617. },
  17618. addTarget: function(/*DOMNODE || String*/ node){
  17619. // summary:
  17620. // Attach tooltip to specified node if it's not already connected
  17621. // TODO: remove in 2.0 and just use set("connectId", ...) interface
  17622. var id = node.id || node;
  17623. if(array.indexOf(this._connectIds, id) == -1){
  17624. this.set("connectId", this._connectIds.concat(id));
  17625. }
  17626. },
  17627. removeTarget: function(/*DomNode || String*/ node){
  17628. // summary:
  17629. // Detach tooltip from specified node
  17630. // TODO: remove in 2.0 and just use set("connectId", ...) interface
  17631. var id = node.id || node, // map from DOMNode back to plain id string
  17632. idx = array.indexOf(this._connectIds, id);
  17633. if(idx >= 0){
  17634. // remove id (modifies original this._connectIds but that's OK in this case)
  17635. this._connectIds.splice(idx, 1);
  17636. this.set("connectId", this._connectIds);
  17637. }
  17638. },
  17639. buildRendering: function(){
  17640. this.inherited(arguments);
  17641. domClass.add(this.domNode,"dijitTooltipData");
  17642. },
  17643. startup: function(){
  17644. this.inherited(arguments);
  17645. // If this tooltip was created in a template, or for some other reason the specified connectId[s]
  17646. // didn't exist during the widget's initialization, then connect now.
  17647. var ids = this.connectId;
  17648. array.forEach(lang.isArrayLike(ids) ? ids : [ids], this.addTarget, this);
  17649. },
  17650. _onHover: function(/*Event*/ e){
  17651. // summary:
  17652. // Despite the name of this method, it actually handles both hover and focus
  17653. // events on the target node, setting a timer to show the tooltip.
  17654. // tags:
  17655. // private
  17656. if(!this._showTimer){
  17657. var target = e.target;
  17658. this._showTimer = setTimeout(lang.hitch(this, function(){this.open(target)}), this.showDelay);
  17659. }
  17660. },
  17661. _onUnHover: function(/*Event*/ /*===== e =====*/){
  17662. // summary:
  17663. // Despite the name of this method, it actually handles both mouseleave and blur
  17664. // events on the target node, hiding the tooltip.
  17665. // tags:
  17666. // private
  17667. // keep a tooltip open if the associated element still has focus (even though the
  17668. // mouse moved away)
  17669. if(this._focus){ return; }
  17670. if(this._showTimer){
  17671. clearTimeout(this._showTimer);
  17672. delete this._showTimer;
  17673. }
  17674. this.close();
  17675. },
  17676. open: function(/*DomNode*/ target){
  17677. // summary:
  17678. // Display the tooltip; usually not called directly.
  17679. // tags:
  17680. // private
  17681. if(this._showTimer){
  17682. clearTimeout(this._showTimer);
  17683. delete this._showTimer;
  17684. }
  17685. Tooltip.show(this.label || this.domNode.innerHTML, target, this.position, !this.isLeftToRight(), this.textDir);
  17686. this._connectNode = target;
  17687. this.onShow(target, this.position);
  17688. },
  17689. close: function(){
  17690. // summary:
  17691. // Hide the tooltip or cancel timer for show of tooltip
  17692. // tags:
  17693. // private
  17694. if(this._connectNode){
  17695. // if tooltip is currently shown
  17696. Tooltip.hide(this._connectNode);
  17697. delete this._connectNode;
  17698. this.onHide();
  17699. }
  17700. if(this._showTimer){
  17701. // if tooltip is scheduled to be shown (after a brief delay)
  17702. clearTimeout(this._showTimer);
  17703. delete this._showTimer;
  17704. }
  17705. },
  17706. onShow: function(/*===== target, position =====*/){
  17707. // summary:
  17708. // Called when the tooltip is shown
  17709. // tags:
  17710. // callback
  17711. },
  17712. onHide: function(){
  17713. // summary:
  17714. // Called when the tooltip is hidden
  17715. // tags:
  17716. // callback
  17717. },
  17718. uninitialize: function(){
  17719. this.close();
  17720. this.inherited(arguments);
  17721. }
  17722. });
  17723. Tooltip._MasterTooltip = MasterTooltip; // for monkey patching
  17724. Tooltip.show = dijit.showTooltip; // export function through module return value
  17725. Tooltip.hide = dijit.hideTooltip; // export function through module return value
  17726. // dijit.Tooltip.defaultPosition: String[]
  17727. // This variable controls the position of tooltips, if the position is not specified to
  17728. // the Tooltip widget or *TextBox widget itself. It's an array of strings with the values
  17729. // possible for `dijit/place::around()`. The recommended values are:
  17730. //
  17731. // * before-centered: centers tooltip to the left of the anchor node/widget, or to the right
  17732. // in the case of RTL scripts like Hebrew and Arabic
  17733. // * after-centered: centers tooltip to the right of the anchor node/widget, or to the left
  17734. // in the case of RTL scripts like Hebrew and Arabic
  17735. // * above-centered: tooltip is centered above anchor node
  17736. // * below-centered: tooltip is centered above anchor node
  17737. //
  17738. // The list is positions is tried, in order, until a position is found where the tooltip fits
  17739. // within the viewport.
  17740. //
  17741. // Be careful setting this parameter. A value of "above-centered" may work fine until the user scrolls
  17742. // the screen so that there's no room above the target node. Nodes with drop downs, like
  17743. // DropDownButton or FilteringSelect, are especially problematic, in that you need to be sure
  17744. // that the drop down and tooltip don't overlap, even when the viewport is scrolled so that there
  17745. // is only room below (or above) the target node, but not both.
  17746. Tooltip.defaultPosition = ["after-centered", "before-centered"];
  17747. return Tooltip;
  17748. });
  17749. },
  17750. 'dojox/charting/Element':function(){
  17751. define("dojox/charting/Element", ["dojo/_base/lang", "dojo/_base/array", "dojo/dom-construct", "dojo/_base/declare", "dojox/gfx", "dojox/gfx/utils", "dojox/gfx/shape"],
  17752. function(lang, arr, domConstruct, declare, gfx, utils, shape){
  17753. return declare("dojox.charting.Element", null, {
  17754. // summary:
  17755. // A base class that is used to build other elements of a chart, such as
  17756. // a series.
  17757. // chart: dojox.charting.Chart
  17758. // The parent chart for this element.
  17759. // group: dojox.gfx.Group
  17760. // The visual GFX group representing this element.
  17761. // htmlElement: Array
  17762. // Any DOMNodes used as a part of this element (such as HTML-based labels).
  17763. // dirty: Boolean
  17764. // A flag indicating whether or not this element needs to be rendered.
  17765. chart: null,
  17766. group: null,
  17767. htmlElements: null,
  17768. dirty: true,
  17769. constructor: function(chart){
  17770. // summary:
  17771. // Creates a new charting element.
  17772. // chart: dojox.charting.Chart
  17773. // The chart that this element belongs to.
  17774. this.chart = chart;
  17775. this.group = null;
  17776. this.htmlElements = [];
  17777. this.dirty = true;
  17778. this.trailingSymbol = "...";
  17779. this._events = [];
  17780. },
  17781. createGroup: function(creator){
  17782. // summary:
  17783. // Convenience function to create a new dojox.gfx.Group.
  17784. // creator: dojox.gfx.Surface?
  17785. // An optional surface in which to create this group.
  17786. // returns: dojox.charting.Element
  17787. // A reference to this object for functional chaining.
  17788. if(!creator){ creator = this.chart.surface; }
  17789. if(!this.group){
  17790. this.group = creator.createGroup();
  17791. }
  17792. return this; // dojox.charting.Element
  17793. },
  17794. purgeGroup: function(){
  17795. // summary:
  17796. // Clear any elements out of our group, and destroy the group.
  17797. // returns: dojox.charting.Element
  17798. // A reference to this object for functional chaining.
  17799. this.destroyHtmlElements();
  17800. if(this.group){
  17801. // since 1.7.x we need dispose shape otherwise there is a memoryleak
  17802. utils.forEach(this.group, function(child){
  17803. shape.dispose(child);
  17804. });
  17805. if(this.group.rawNode){
  17806. domConstruct.empty(this.group.rawNode);
  17807. }
  17808. this.group.clear();
  17809. this.group.removeShape();
  17810. shape.dispose(this.group);
  17811. this.group = null;
  17812. }
  17813. this.dirty = true;
  17814. if(this._events.length){
  17815. arr.forEach(this._events, function(item){
  17816. item.shape.disconnect(item.handle);
  17817. });
  17818. this._events = [];
  17819. }
  17820. return this; // dojox.charting.Element
  17821. },
  17822. cleanGroup: function(creator){
  17823. // summary:
  17824. // Clean any elements (HTML or GFX-based) out of our group, and create a new one.
  17825. // creator: dojox.gfx.Surface?
  17826. // An optional surface to work with.
  17827. // returns: dojox.charting.Element
  17828. // A reference to this object for functional chaining.
  17829. this.destroyHtmlElements();
  17830. if(!creator){ creator = this.chart.surface; }
  17831. if(this.group){
  17832. var bgnode;
  17833. utils.forEach(this.group, function(child){
  17834. shape.dispose(child);
  17835. });
  17836. if(this.group.rawNode){
  17837. bgnode = this.group.bgNode;
  17838. domConstruct.empty(this.group.rawNode);
  17839. }
  17840. this.group.clear();
  17841. if(bgnode){
  17842. this.group.rawNode.appendChild(bgnode);
  17843. }
  17844. }else{
  17845. this.group = creator.createGroup();
  17846. }
  17847. this.dirty = true;
  17848. return this; // dojox.charting.Element
  17849. },
  17850. destroyHtmlElements: function(){
  17851. // summary:
  17852. // Destroy any DOMNodes that may have been created as a part of this element.
  17853. if(this.htmlElements.length){
  17854. arr.forEach(this.htmlElements, domConstruct.destroy);
  17855. this.htmlElements = [];
  17856. }
  17857. },
  17858. destroy: function(){
  17859. // summary:
  17860. // API addition to conform to the rest of the Dojo Toolkit's standard.
  17861. this.purgeGroup();
  17862. },
  17863. //text utilities
  17864. getTextWidth: function(s, font){
  17865. return gfx._base._getTextBox(s, {font: font}).w || 0;
  17866. },
  17867. getTextWithLimitLength: function(s, font, limitWidth, truncated){
  17868. // summary:
  17869. // Get the truncated string based on the limited width in px(dichotomy algorithm)
  17870. // s: String?
  17871. // candidate text.
  17872. // font: String?
  17873. // text's font style.
  17874. // limitWidth: Number?
  17875. // text limited width in px.
  17876. // truncated: Boolean?
  17877. // whether the input text(s) has already been truncated.
  17878. // returns: Object
  17879. // {
  17880. // text: processed text, maybe truncated or not
  17881. // truncated: whether text has been truncated
  17882. // }
  17883. if (!s || s.length <= 0) {
  17884. return {
  17885. text: "",
  17886. truncated: truncated || false
  17887. };
  17888. }
  17889. if(!limitWidth || limitWidth <= 0){
  17890. return {
  17891. text: s,
  17892. truncated: truncated || false
  17893. };
  17894. }
  17895. var delta = 2,
  17896. //golden section for dichotomy algorithm
  17897. trucPercentage = 0.618,
  17898. minStr = s.substring(0,1) + this.trailingSymbol,
  17899. minWidth = this.getTextWidth(minStr, font);
  17900. if (limitWidth <= minWidth) {
  17901. return {
  17902. text: minStr,
  17903. truncated: true
  17904. };
  17905. }
  17906. var width = this.getTextWidth(s, font);
  17907. if(width <= limitWidth){
  17908. return {
  17909. text: s,
  17910. truncated: truncated || false
  17911. };
  17912. }else{
  17913. var begin = 0,
  17914. end = s.length;
  17915. while(begin < end){
  17916. if(end - begin <= delta ){
  17917. while (this.getTextWidth(s.substring(0, begin) + this.trailingSymbol, font) > limitWidth) {
  17918. begin -= 1;
  17919. }
  17920. return {
  17921. text: (s.substring(0,begin) + this.trailingSymbol),
  17922. truncated: true
  17923. };
  17924. }
  17925. var index = begin + Math.round((end - begin) * trucPercentage),
  17926. widthIntercepted = this.getTextWidth(s.substring(0, index), font);
  17927. if(widthIntercepted < limitWidth){
  17928. begin = index;
  17929. end = end;
  17930. }else{
  17931. begin = begin;
  17932. end = index;
  17933. }
  17934. }
  17935. }
  17936. },
  17937. getTextWithLimitCharCount: function(s, font, wcLimit, truncated){
  17938. // summary:
  17939. // Get the truncated string based on the limited character count(dichotomy algorithm)
  17940. // s: String?
  17941. // candidate text.
  17942. // font: String?
  17943. // text's font style.
  17944. // wcLimit: Number?
  17945. // text limited character count.
  17946. // truncated: Boolean?
  17947. // whether the input text(s) has already been truncated.
  17948. // returns: Object
  17949. // {
  17950. // text: processed text, maybe truncated or not
  17951. // truncated: whether text has been truncated
  17952. // }
  17953. if (!s || s.length <= 0) {
  17954. return {
  17955. text: "",
  17956. truncated: truncated || false
  17957. };
  17958. }
  17959. if(!wcLimit || wcLimit <= 0 || s.length <= wcLimit){
  17960. return {
  17961. text: s,
  17962. truncated: truncated || false
  17963. };
  17964. }
  17965. return {
  17966. text: s.substring(0, wcLimit) + this.trailingSymbol,
  17967. truncated: true
  17968. };
  17969. },
  17970. // fill utilities
  17971. _plotFill: function(fill, dim, offsets){
  17972. // process a plot-wide fill
  17973. if(!fill || !fill.type || !fill.space){
  17974. return fill;
  17975. }
  17976. var space = fill.space;
  17977. switch(fill.type){
  17978. case "linear":
  17979. if(space === "plot" || space === "shapeX" || space === "shapeY"){
  17980. // clone a fill so we can modify properly directly
  17981. fill = gfx.makeParameters(gfx.defaultLinearGradient, fill);
  17982. fill.space = space;
  17983. // process dimensions
  17984. if(space === "plot" || space === "shapeX"){
  17985. // process Y
  17986. var span = dim.height - offsets.t - offsets.b;
  17987. fill.y1 = offsets.t + span * fill.y1 / 100;
  17988. fill.y2 = offsets.t + span * fill.y2 / 100;
  17989. }
  17990. if(space === "plot" || space === "shapeY"){
  17991. // process X
  17992. var span = dim.width - offsets.l - offsets.r;
  17993. fill.x1 = offsets.l + span * fill.x1 / 100;
  17994. fill.x2 = offsets.l + span * fill.x2 / 100;
  17995. }
  17996. }
  17997. break;
  17998. case "radial":
  17999. if(space === "plot"){
  18000. // this one is used exclusively for scatter charts
  18001. // clone a fill so we can modify properly directly
  18002. fill = gfx.makeParameters(gfx.defaultRadialGradient, fill);
  18003. fill.space = space;
  18004. // process both dimensions
  18005. var spanX = dim.width - offsets.l - offsets.r,
  18006. spanY = dim.height - offsets.t - offsets.b;
  18007. fill.cx = offsets.l + spanX * fill.cx / 100;
  18008. fill.cy = offsets.t + spanY * fill.cy / 100;
  18009. fill.r = fill.r * Math.sqrt(spanX * spanX + spanY * spanY) / 200;
  18010. }
  18011. break;
  18012. case "pattern":
  18013. if(space === "plot" || space === "shapeX" || space === "shapeY"){
  18014. // clone a fill so we can modify properly directly
  18015. fill = gfx.makeParameters(gfx.defaultPattern, fill);
  18016. fill.space = space;
  18017. // process dimensions
  18018. if(space === "plot" || space === "shapeX"){
  18019. // process Y
  18020. var span = dim.height - offsets.t - offsets.b;
  18021. fill.y = offsets.t + span * fill.y / 100;
  18022. fill.height = span * fill.height / 100;
  18023. }
  18024. if(space === "plot" || space === "shapeY"){
  18025. // process X
  18026. var span = dim.width - offsets.l - offsets.r;
  18027. fill.x = offsets.l + span * fill.x / 100;
  18028. fill.width = span * fill.width / 100;
  18029. }
  18030. }
  18031. break;
  18032. }
  18033. return fill;
  18034. },
  18035. _shapeFill: function(fill, bbox){
  18036. // process shape-specific fill
  18037. if(!fill || !fill.space){
  18038. return fill;
  18039. }
  18040. var space = fill.space;
  18041. switch(fill.type){
  18042. case "linear":
  18043. if(space === "shape" || space === "shapeX" || space === "shapeY"){
  18044. // clone a fill so we can modify properly directly
  18045. fill = gfx.makeParameters(gfx.defaultLinearGradient, fill);
  18046. fill.space = space;
  18047. // process dimensions
  18048. if(space === "shape" || space === "shapeX"){
  18049. // process X
  18050. var span = bbox.width;
  18051. fill.x1 = bbox.x + span * fill.x1 / 100;
  18052. fill.x2 = bbox.x + span * fill.x2 / 100;
  18053. }
  18054. if(space === "shape" || space === "shapeY"){
  18055. // process Y
  18056. var span = bbox.height;
  18057. fill.y1 = bbox.y + span * fill.y1 / 100;
  18058. fill.y2 = bbox.y + span * fill.y2 / 100;
  18059. }
  18060. }
  18061. break;
  18062. case "radial":
  18063. if(space === "shape"){
  18064. // this one is used exclusively for bubble charts and pie charts
  18065. // clone a fill so we can modify properly directly
  18066. fill = gfx.makeParameters(gfx.defaultRadialGradient, fill);
  18067. fill.space = space;
  18068. // process both dimensions
  18069. fill.cx = bbox.x + bbox.width / 2;
  18070. fill.cy = bbox.y + bbox.height / 2;
  18071. fill.r = fill.r * bbox.width / 200;
  18072. }
  18073. break;
  18074. case "pattern":
  18075. if(space === "shape" || space === "shapeX" || space === "shapeY"){
  18076. // clone a fill so we can modify properly directly
  18077. fill = gfx.makeParameters(gfx.defaultPattern, fill);
  18078. fill.space = space;
  18079. // process dimensions
  18080. if(space === "shape" || space === "shapeX"){
  18081. // process X
  18082. var span = bbox.width;
  18083. fill.x = bbox.x + span * fill.x / 100;
  18084. fill.width = span * fill.width / 100;
  18085. }
  18086. if(space === "shape" || space === "shapeY"){
  18087. // process Y
  18088. var span = bbox.height;
  18089. fill.y = bbox.y + span * fill.y / 100;
  18090. fill.height = span * fill.height / 100;
  18091. }
  18092. }
  18093. break;
  18094. }
  18095. return fill;
  18096. },
  18097. _pseudoRadialFill: function(fill, center, radius, start, end){
  18098. // process pseudo-radial fills
  18099. if(!fill || fill.type !== "radial" || fill.space !== "shape"){
  18100. return fill;
  18101. }
  18102. // clone and normalize fill
  18103. var space = fill.space;
  18104. fill = gfx.makeParameters(gfx.defaultRadialGradient, fill);
  18105. fill.space = space;
  18106. if(arguments.length < 4){
  18107. // process both dimensions
  18108. fill.cx = center.x;
  18109. fill.cy = center.y;
  18110. fill.r = fill.r * radius / 100;
  18111. return fill;
  18112. }
  18113. // convert to a linear gradient
  18114. var angle = arguments.length < 5 ? start : (end + start) / 2;
  18115. return {
  18116. type: "linear",
  18117. x1: center.x,
  18118. y1: center.y,
  18119. x2: center.x + fill.r * radius * Math.cos(angle) / 100,
  18120. y2: center.y + fill.r * radius * Math.sin(angle) / 100,
  18121. colors: fill.colors
  18122. };
  18123. return fill;
  18124. }
  18125. });
  18126. });
  18127. },
  18128. 'dijit/_WidgetBase':function(){
  18129. define("dijit/_WidgetBase", [
  18130. "require", // require.toUrl
  18131. "dojo/_base/array", // array.forEach array.map
  18132. "dojo/aspect",
  18133. "dojo/_base/config", // config.blankGif
  18134. "dojo/_base/connect", // connect.connect
  18135. "dojo/_base/declare", // declare
  18136. "dojo/dom", // dom.byId
  18137. "dojo/dom-attr", // domAttr.set domAttr.remove
  18138. "dojo/dom-class", // domClass.add domClass.replace
  18139. "dojo/dom-construct", // domConstruct.create domConstruct.destroy domConstruct.place
  18140. "dojo/dom-geometry", // isBodyLtr
  18141. "dojo/dom-style", // domStyle.set, domStyle.get
  18142. "dojo/_base/kernel",
  18143. "dojo/_base/lang", // mixin(), isArray(), etc.
  18144. "dojo/on",
  18145. "dojo/ready",
  18146. "dojo/Stateful", // Stateful
  18147. "dojo/topic",
  18148. "dojo/_base/window", // win.doc.createTextNode
  18149. "./registry" // registry.getUniqueId(), registry.findWidgets()
  18150. ], function(require, array, aspect, config, connect, declare,
  18151. dom, domAttr, domClass, domConstruct, domGeometry, domStyle, kernel,
  18152. lang, on, ready, Stateful, topic, win, registry){
  18153. /*=====
  18154. var Stateful = dojo.Stateful;
  18155. =====*/
  18156. // module:
  18157. // dijit/_WidgetBase
  18158. // summary:
  18159. // Future base class for all Dijit widgets.
  18160. // For back-compat, remove in 2.0.
  18161. if(!kernel.isAsync){
  18162. ready(0, function(){
  18163. var requires = ["dijit/_base/manager"];
  18164. require(requires); // use indirection so modules not rolled into a build
  18165. });
  18166. }
  18167. // Nested hash listing attributes for each tag, all strings in lowercase.
  18168. // ex: {"div": {"style": true, "tabindex" true}, "form": { ...
  18169. var tagAttrs = {};
  18170. function getAttrs(obj){
  18171. var ret = {};
  18172. for(var attr in obj){
  18173. ret[attr.toLowerCase()] = true;
  18174. }
  18175. return ret;
  18176. }
  18177. function nonEmptyAttrToDom(attr){
  18178. // summary:
  18179. // Returns a setter function that copies the attribute to this.domNode,
  18180. // or removes the attribute from this.domNode, depending on whether the
  18181. // value is defined or not.
  18182. return function(val){
  18183. domAttr[val ? "set" : "remove"](this.domNode, attr, val);
  18184. this._set(attr, val);
  18185. };
  18186. }
  18187. function isEqual(a, b){
  18188. // summary:
  18189. // Function that determines whether two values are identical,
  18190. // taking into account that NaN is not normally equal to itself
  18191. // in JS.
  18192. return a === b || (/* a is NaN */ a !== a && /* b is NaN */ b !== b);
  18193. }
  18194. return declare("dijit._WidgetBase", Stateful, {
  18195. // summary:
  18196. // Future base class for all Dijit widgets.
  18197. // description:
  18198. // Future base class for all Dijit widgets.
  18199. // _Widget extends this class adding support for various features needed by desktop.
  18200. //
  18201. // Provides stubs for widget lifecycle methods for subclasses to extend, like postMixInProperties(), buildRendering(),
  18202. // postCreate(), startup(), and destroy(), and also public API methods like set(), get(), and watch().
  18203. //
  18204. // Widgets can provide custom setters/getters for widget attributes, which are called automatically by set(name, value).
  18205. // For an attribute XXX, define methods _setXXXAttr() and/or _getXXXAttr().
  18206. //
  18207. // _setXXXAttr can also be a string/hash/array mapping from a widget attribute XXX to the widget's DOMNodes:
  18208. //
  18209. // - DOM node attribute
  18210. // | _setFocusAttr: {node: "focusNode", type: "attribute"}
  18211. // | _setFocusAttr: "focusNode" (shorthand)
  18212. // | _setFocusAttr: "" (shorthand, maps to this.domNode)
  18213. // Maps this.focus to this.focusNode.focus, or (last example) this.domNode.focus
  18214. //
  18215. // - DOM node innerHTML
  18216. // | _setTitleAttr: { node: "titleNode", type: "innerHTML" }
  18217. // Maps this.title to this.titleNode.innerHTML
  18218. //
  18219. // - DOM node innerText
  18220. // | _setTitleAttr: { node: "titleNode", type: "innerText" }
  18221. // Maps this.title to this.titleNode.innerText
  18222. //
  18223. // - DOM node CSS class
  18224. // | _setMyClassAttr: { node: "domNode", type: "class" }
  18225. // Maps this.myClass to this.domNode.className
  18226. //
  18227. // If the value of _setXXXAttr is an array, then each element in the array matches one of the
  18228. // formats of the above list.
  18229. //
  18230. // If the custom setter is null, no action is performed other than saving the new value
  18231. // in the widget (in this).
  18232. //
  18233. // If no custom setter is defined for an attribute, then it will be copied
  18234. // to this.focusNode (if the widget defines a focusNode), or this.domNode otherwise.
  18235. // That's only done though for attributes that match DOMNode attributes (title,
  18236. // alt, aria-labelledby, etc.)
  18237. // id: [const] String
  18238. // A unique, opaque ID string that can be assigned by users or by the
  18239. // system. If the developer passes an ID which is known not to be
  18240. // unique, the specified ID is ignored and the system-generated ID is
  18241. // used instead.
  18242. id: "",
  18243. _setIdAttr: "domNode", // to copy to this.domNode even for auto-generated id's
  18244. // lang: [const] String
  18245. // Rarely used. Overrides the default Dojo locale used to render this widget,
  18246. // as defined by the [HTML LANG](http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang) attribute.
  18247. // Value must be among the list of locales specified during by the Dojo bootstrap,
  18248. // formatted according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt) (like en-us).
  18249. lang: "",
  18250. // set on domNode even when there's a focus node. but don't set lang="", since that's invalid.
  18251. _setLangAttr: nonEmptyAttrToDom("lang"),
  18252. // dir: [const] String
  18253. // Bi-directional support, as defined by the [HTML DIR](http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir)
  18254. // attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's
  18255. // default direction.
  18256. dir: "",
  18257. // set on domNode even when there's a focus node. but don't set dir="", since that's invalid.
  18258. _setDirAttr: nonEmptyAttrToDom("dir"), // to set on domNode even when there's a focus node
  18259. // textDir: String
  18260. // Bi-directional support, the main variable which is responsible for the direction of the text.
  18261. // The text direction can be different than the GUI direction by using this parameter in creation
  18262. // of a widget.
  18263. // Allowed values:
  18264. // 1. "ltr"
  18265. // 2. "rtl"
  18266. // 3. "auto" - contextual the direction of a text defined by first strong letter.
  18267. // By default is as the page direction.
  18268. textDir: "",
  18269. // class: String
  18270. // HTML class attribute
  18271. "class": "",
  18272. _setClassAttr: { node: "domNode", type: "class" },
  18273. // style: String||Object
  18274. // HTML style attributes as cssText string or name/value hash
  18275. style: "",
  18276. // title: String
  18277. // HTML title attribute.
  18278. //
  18279. // For form widgets this specifies a tooltip to display when hovering over
  18280. // the widget (just like the native HTML title attribute).
  18281. //
  18282. // For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer,
  18283. // etc., it's used to specify the tab label, accordion pane title, etc.
  18284. title: "",
  18285. // tooltip: String
  18286. // When this widget's title attribute is used to for a tab label, accordion pane title, etc.,
  18287. // this specifies the tooltip to appear when the mouse is hovered over that text.
  18288. tooltip: "",
  18289. // baseClass: [protected] String
  18290. // Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate
  18291. // widget state.
  18292. baseClass: "",
  18293. // srcNodeRef: [readonly] DomNode
  18294. // pointer to original DOM node
  18295. srcNodeRef: null,
  18296. // domNode: [readonly] DomNode
  18297. // This is our visible representation of the widget! Other DOM
  18298. // Nodes may by assigned to other properties, usually through the
  18299. // template system's data-dojo-attach-point syntax, but the domNode
  18300. // property is the canonical "top level" node in widget UI.
  18301. domNode: null,
  18302. // containerNode: [readonly] DomNode
  18303. // Designates where children of the source DOM node will be placed.
  18304. // "Children" in this case refers to both DOM nodes and widgets.
  18305. // For example, for myWidget:
  18306. //
  18307. // | <div data-dojo-type=myWidget>
  18308. // | <b> here's a plain DOM node
  18309. // | <span data-dojo-type=subWidget>and a widget</span>
  18310. // | <i> and another plain DOM node </i>
  18311. // | </div>
  18312. //
  18313. // containerNode would point to:
  18314. //
  18315. // | <b> here's a plain DOM node
  18316. // | <span data-dojo-type=subWidget>and a widget</span>
  18317. // | <i> and another plain DOM node </i>
  18318. //
  18319. // In templated widgets, "containerNode" is set via a
  18320. // data-dojo-attach-point assignment.
  18321. //
  18322. // containerNode must be defined for any widget that accepts innerHTML
  18323. // (like ContentPane or BorderContainer or even Button), and conversely
  18324. // is null for widgets that don't, like TextBox.
  18325. containerNode: null,
  18326. /*=====
  18327. // _started: Boolean
  18328. // startup() has completed.
  18329. _started: false,
  18330. =====*/
  18331. // attributeMap: [protected] Object
  18332. // Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute
  18333. // for each XXX attribute to be mapped to the DOM.
  18334. //
  18335. // attributeMap sets up a "binding" between attributes (aka properties)
  18336. // of the widget and the widget's DOM.
  18337. // Changes to widget attributes listed in attributeMap will be
  18338. // reflected into the DOM.
  18339. //
  18340. // For example, calling set('title', 'hello')
  18341. // on a TitlePane will automatically cause the TitlePane's DOM to update
  18342. // with the new title.
  18343. //
  18344. // attributeMap is a hash where the key is an attribute of the widget,
  18345. // and the value reflects a binding to a:
  18346. //
  18347. // - DOM node attribute
  18348. // | focus: {node: "focusNode", type: "attribute"}
  18349. // Maps this.focus to this.focusNode.focus
  18350. //
  18351. // - DOM node innerHTML
  18352. // | title: { node: "titleNode", type: "innerHTML" }
  18353. // Maps this.title to this.titleNode.innerHTML
  18354. //
  18355. // - DOM node innerText
  18356. // | title: { node: "titleNode", type: "innerText" }
  18357. // Maps this.title to this.titleNode.innerText
  18358. //
  18359. // - DOM node CSS class
  18360. // | myClass: { node: "domNode", type: "class" }
  18361. // Maps this.myClass to this.domNode.className
  18362. //
  18363. // If the value is an array, then each element in the array matches one of the
  18364. // formats of the above list.
  18365. //
  18366. // There are also some shorthands for backwards compatibility:
  18367. // - string --> { node: string, type: "attribute" }, for example:
  18368. // | "focusNode" ---> { node: "focusNode", type: "attribute" }
  18369. // - "" --> { node: "domNode", type: "attribute" }
  18370. attributeMap: {},
  18371. // _blankGif: [protected] String
  18372. // Path to a blank 1x1 image.
  18373. // Used by <img> nodes in templates that really get their image via CSS background-image.
  18374. _blankGif: config.blankGif || require.toUrl("dojo/resources/blank.gif"),
  18375. //////////// INITIALIZATION METHODS ///////////////////////////////////////
  18376. postscript: function(/*Object?*/params, /*DomNode|String*/srcNodeRef){
  18377. // summary:
  18378. // Kicks off widget instantiation. See create() for details.
  18379. // tags:
  18380. // private
  18381. this.create(params, srcNodeRef);
  18382. },
  18383. create: function(/*Object?*/params, /*DomNode|String?*/srcNodeRef){
  18384. // summary:
  18385. // Kick off the life-cycle of a widget
  18386. // params:
  18387. // Hash of initialization parameters for widget, including
  18388. // scalar values (like title, duration etc.) and functions,
  18389. // typically callbacks like onClick.
  18390. // srcNodeRef:
  18391. // If a srcNodeRef (DOM node) is specified:
  18392. // - use srcNodeRef.innerHTML as my contents
  18393. // - if this is a behavioral widget then apply behavior
  18394. // to that srcNodeRef
  18395. // - otherwise, replace srcNodeRef with my generated DOM
  18396. // tree
  18397. // description:
  18398. // Create calls a number of widget methods (postMixInProperties, buildRendering, postCreate,
  18399. // etc.), some of which of you'll want to override. See http://dojotoolkit.org/reference-guide/dijit/_WidgetBase.html
  18400. // for a discussion of the widget creation lifecycle.
  18401. //
  18402. // Of course, adventurous developers could override create entirely, but this should
  18403. // only be done as a last resort.
  18404. // tags:
  18405. // private
  18406. // store pointer to original DOM tree
  18407. this.srcNodeRef = dom.byId(srcNodeRef);
  18408. // For garbage collection. An array of listener handles returned by this.connect() / this.subscribe()
  18409. this._connects = [];
  18410. // For widgets internal to this widget, invisible to calling code
  18411. this._supportingWidgets = [];
  18412. // this is here for back-compat, remove in 2.0 (but check NodeList-instantiate.html test)
  18413. if(this.srcNodeRef && (typeof this.srcNodeRef.id == "string")){ this.id = this.srcNodeRef.id; }
  18414. // mix in our passed parameters
  18415. if(params){
  18416. this.params = params;
  18417. lang.mixin(this, params);
  18418. }
  18419. this.postMixInProperties();
  18420. // generate an id for the widget if one wasn't specified
  18421. // (be sure to do this before buildRendering() because that function might
  18422. // expect the id to be there.)
  18423. if(!this.id){
  18424. this.id = registry.getUniqueId(this.declaredClass.replace(/\./g,"_"));
  18425. }
  18426. registry.add(this);
  18427. this.buildRendering();
  18428. if(this.domNode){
  18429. // Copy attributes listed in attributeMap into the [newly created] DOM for the widget.
  18430. // Also calls custom setters for all attributes with custom setters.
  18431. this._applyAttributes();
  18432. // If srcNodeRef was specified, then swap out original srcNode for this widget's DOM tree.
  18433. // For 2.0, move this after postCreate(). postCreate() shouldn't depend on the
  18434. // widget being attached to the DOM since it isn't when a widget is created programmatically like
  18435. // new MyWidget({}). See #11635.
  18436. var source = this.srcNodeRef;
  18437. if(source && source.parentNode && this.domNode !== source){
  18438. source.parentNode.replaceChild(this.domNode, source);
  18439. }
  18440. }
  18441. if(this.domNode){
  18442. // Note: for 2.0 may want to rename widgetId to dojo._scopeName + "_widgetId",
  18443. // assuming that dojo._scopeName even exists in 2.0
  18444. this.domNode.setAttribute("widgetId", this.id);
  18445. }
  18446. this.postCreate();
  18447. // If srcNodeRef has been processed and removed from the DOM (e.g. TemplatedWidget) then delete it to allow GC.
  18448. if(this.srcNodeRef && !this.srcNodeRef.parentNode){
  18449. delete this.srcNodeRef;
  18450. }
  18451. this._created = true;
  18452. },
  18453. _applyAttributes: function(){
  18454. // summary:
  18455. // Step during widget creation to copy widget attributes to the
  18456. // DOM according to attributeMap and _setXXXAttr objects, and also to call
  18457. // custom _setXXXAttr() methods.
  18458. //
  18459. // Skips over blank/false attribute values, unless they were explicitly specified
  18460. // as parameters to the widget, since those are the default anyway,
  18461. // and setting tabIndex="" is different than not setting tabIndex at all.
  18462. //
  18463. // For backwards-compatibility reasons attributeMap overrides _setXXXAttr when
  18464. // _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.
  18465. // tags:
  18466. // private
  18467. // Get list of attributes where this.set(name, value) will do something beyond
  18468. // setting this[name] = value. Specifically, attributes that have:
  18469. // - associated _setXXXAttr() method/hash/string/array
  18470. // - entries in attributeMap.
  18471. var ctor = this.constructor,
  18472. list = ctor._setterAttrs;
  18473. if(!list){
  18474. list = (ctor._setterAttrs = []);
  18475. for(var attr in this.attributeMap){
  18476. list.push(attr);
  18477. }
  18478. var proto = ctor.prototype;
  18479. for(var fxName in proto){
  18480. if(fxName in this.attributeMap){ continue; }
  18481. var setterName = "_set" + fxName.replace(/^[a-z]|-[a-zA-Z]/g, function(c){ return c.charAt(c.length-1).toUpperCase(); }) + "Attr";
  18482. if(setterName in proto){
  18483. list.push(fxName);
  18484. }
  18485. }
  18486. }
  18487. // Call this.set() for each attribute that was either specified as parameter to constructor,
  18488. // or was found above and has a default non-null value. For correlated attributes like value and displayedValue, the one
  18489. // specified as a parameter should take precedence, so apply attributes in this.params last.
  18490. // Particularly important for new DateTextBox({displayedValue: ...}) since DateTextBox's default value is
  18491. // NaN and thus is not ignored like a default value of "".
  18492. array.forEach(list, function(attr){
  18493. if(this.params && attr in this.params){
  18494. // skip this one, do it below
  18495. }else if(this[attr]){
  18496. this.set(attr, this[attr]);
  18497. }
  18498. }, this);
  18499. for(var param in this.params){
  18500. this.set(param, this[param]);
  18501. }
  18502. },
  18503. postMixInProperties: function(){
  18504. // summary:
  18505. // Called after the parameters to the widget have been read-in,
  18506. // but before the widget template is instantiated. Especially
  18507. // useful to set properties that are referenced in the widget
  18508. // template.
  18509. // tags:
  18510. // protected
  18511. },
  18512. buildRendering: function(){
  18513. // summary:
  18514. // Construct the UI for this widget, setting this.domNode.
  18515. // Most widgets will mixin `dijit._TemplatedMixin`, which implements this method.
  18516. // tags:
  18517. // protected
  18518. if(!this.domNode){
  18519. // Create root node if it wasn't created by _Templated
  18520. this.domNode = this.srcNodeRef || domConstruct.create('div');
  18521. }
  18522. // baseClass is a single class name or occasionally a space-separated list of names.
  18523. // Add those classes to the DOMNode. If RTL mode then also add with Rtl suffix.
  18524. // TODO: make baseClass custom setter
  18525. if(this.baseClass){
  18526. var classes = this.baseClass.split(" ");
  18527. if(!this.isLeftToRight()){
  18528. classes = classes.concat( array.map(classes, function(name){ return name+"Rtl"; }));
  18529. }
  18530. domClass.add(this.domNode, classes);
  18531. }
  18532. },
  18533. postCreate: function(){
  18534. // summary:
  18535. // Processing after the DOM fragment is created
  18536. // description:
  18537. // Called after the DOM fragment has been created, but not necessarily
  18538. // added to the document. Do not include any operations which rely on
  18539. // node dimensions or placement.
  18540. // tags:
  18541. // protected
  18542. },
  18543. startup: function(){
  18544. // summary:
  18545. // Processing after the DOM fragment is added to the document
  18546. // description:
  18547. // Called after a widget and its children have been created and added to the page,
  18548. // and all related widgets have finished their create() cycle, up through postCreate().
  18549. // This is useful for composite widgets that need to control or layout sub-widgets.
  18550. // Many layout widgets can use this as a wiring phase.
  18551. if(this._started){ return; }
  18552. this._started = true;
  18553. array.forEach(this.getChildren(), function(obj){
  18554. if(!obj._started && !obj._destroyed && lang.isFunction(obj.startup)){
  18555. obj.startup();
  18556. obj._started = true;
  18557. }
  18558. });
  18559. },
  18560. //////////// DESTROY FUNCTIONS ////////////////////////////////
  18561. destroyRecursive: function(/*Boolean?*/ preserveDom){
  18562. // summary:
  18563. // Destroy this widget and its descendants
  18564. // description:
  18565. // This is the generic "destructor" function that all widget users
  18566. // should call to cleanly discard with a widget. Once a widget is
  18567. // destroyed, it is removed from the manager object.
  18568. // preserveDom:
  18569. // If true, this method will leave the original DOM structure
  18570. // alone of descendant Widgets. Note: This will NOT work with
  18571. // dijit._Templated widgets.
  18572. this._beingDestroyed = true;
  18573. this.destroyDescendants(preserveDom);
  18574. this.destroy(preserveDom);
  18575. },
  18576. destroy: function(/*Boolean*/ preserveDom){
  18577. // summary:
  18578. // Destroy this widget, but not its descendants.
  18579. // This method will, however, destroy internal widgets such as those used within a template.
  18580. // preserveDom: Boolean
  18581. // If true, this method will leave the original DOM structure alone.
  18582. // Note: This will not yet work with _Templated widgets
  18583. this._beingDestroyed = true;
  18584. this.uninitialize();
  18585. // remove this.connect() and this.subscribe() listeners
  18586. var c;
  18587. while((c = this._connects.pop())){
  18588. c.remove();
  18589. }
  18590. // destroy widgets created as part of template, etc.
  18591. var w;
  18592. while((w = this._supportingWidgets.pop())){
  18593. if(w.destroyRecursive){
  18594. w.destroyRecursive();
  18595. }else if(w.destroy){
  18596. w.destroy();
  18597. }
  18598. }
  18599. this.destroyRendering(preserveDom);
  18600. registry.remove(this.id);
  18601. this._destroyed = true;
  18602. },
  18603. destroyRendering: function(/*Boolean?*/ preserveDom){
  18604. // summary:
  18605. // Destroys the DOM nodes associated with this widget
  18606. // preserveDom:
  18607. // If true, this method will leave the original DOM structure alone
  18608. // during tear-down. Note: this will not work with _Templated
  18609. // widgets yet.
  18610. // tags:
  18611. // protected
  18612. if(this.bgIframe){
  18613. this.bgIframe.destroy(preserveDom);
  18614. delete this.bgIframe;
  18615. }
  18616. if(this.domNode){
  18617. if(preserveDom){
  18618. domAttr.remove(this.domNode, "widgetId");
  18619. }else{
  18620. domConstruct.destroy(this.domNode);
  18621. }
  18622. delete this.domNode;
  18623. }
  18624. if(this.srcNodeRef){
  18625. if(!preserveDom){
  18626. domConstruct.destroy(this.srcNodeRef);
  18627. }
  18628. delete this.srcNodeRef;
  18629. }
  18630. },
  18631. destroyDescendants: function(/*Boolean?*/ preserveDom){
  18632. // summary:
  18633. // Recursively destroy the children of this widget and their
  18634. // descendants.
  18635. // preserveDom:
  18636. // If true, the preserveDom attribute is passed to all descendant
  18637. // widget's .destroy() method. Not for use with _Templated
  18638. // widgets.
  18639. // get all direct descendants and destroy them recursively
  18640. array.forEach(this.getChildren(), function(widget){
  18641. if(widget.destroyRecursive){
  18642. widget.destroyRecursive(preserveDom);
  18643. }
  18644. });
  18645. },
  18646. uninitialize: function(){
  18647. // summary:
  18648. // Stub function. Override to implement custom widget tear-down
  18649. // behavior.
  18650. // tags:
  18651. // protected
  18652. return false;
  18653. },
  18654. ////////////////// GET/SET, CUSTOM SETTERS, ETC. ///////////////////
  18655. _setStyleAttr: function(/*String||Object*/ value){
  18656. // summary:
  18657. // Sets the style attribute of the widget according to value,
  18658. // which is either a hash like {height: "5px", width: "3px"}
  18659. // or a plain string
  18660. // description:
  18661. // Determines which node to set the style on based on style setting
  18662. // in attributeMap.
  18663. // tags:
  18664. // protected
  18665. var mapNode = this.domNode;
  18666. // Note: technically we should revert any style setting made in a previous call
  18667. // to his method, but that's difficult to keep track of.
  18668. if(lang.isObject(value)){
  18669. domStyle.set(mapNode, value);
  18670. }else{
  18671. if(mapNode.style.cssText){
  18672. mapNode.style.cssText += "; " + value;
  18673. }else{
  18674. mapNode.style.cssText = value;
  18675. }
  18676. }
  18677. this._set("style", value);
  18678. },
  18679. _attrToDom: function(/*String*/ attr, /*String*/ value, /*Object?*/ commands){
  18680. // summary:
  18681. // Reflect a widget attribute (title, tabIndex, duration etc.) to
  18682. // the widget DOM, as specified by commands parameter.
  18683. // If commands isn't specified then it's looked up from attributeMap.
  18684. // Note some attributes like "type"
  18685. // cannot be processed this way as they are not mutable.
  18686. //
  18687. // tags:
  18688. // private
  18689. commands = arguments.length >= 3 ? commands : this.attributeMap[attr];
  18690. array.forEach(lang.isArray(commands) ? commands : [commands], function(command){
  18691. // Get target node and what we are doing to that node
  18692. var mapNode = this[command.node || command || "domNode"]; // DOM node
  18693. var type = command.type || "attribute"; // class, innerHTML, innerText, or attribute
  18694. switch(type){
  18695. case "attribute":
  18696. if(lang.isFunction(value)){ // functions execute in the context of the widget
  18697. value = lang.hitch(this, value);
  18698. }
  18699. // Get the name of the DOM node attribute; usually it's the same
  18700. // as the name of the attribute in the widget (attr), but can be overridden.
  18701. // Also maps handler names to lowercase, like onSubmit --> onsubmit
  18702. var attrName = command.attribute ? command.attribute :
  18703. (/^on[A-Z][a-zA-Z]*$/.test(attr) ? attr.toLowerCase() : attr);
  18704. domAttr.set(mapNode, attrName, value);
  18705. break;
  18706. case "innerText":
  18707. mapNode.innerHTML = "";
  18708. mapNode.appendChild(win.doc.createTextNode(value));
  18709. break;
  18710. case "innerHTML":
  18711. mapNode.innerHTML = value;
  18712. break;
  18713. case "class":
  18714. domClass.replace(mapNode, value, this[attr]);
  18715. break;
  18716. }
  18717. }, this);
  18718. },
  18719. get: function(name){
  18720. // summary:
  18721. // Get a property from a widget.
  18722. // name:
  18723. // The property to get.
  18724. // description:
  18725. // Get a named property from a widget. The property may
  18726. // potentially be retrieved via a getter method. If no getter is defined, this
  18727. // just retrieves the object's property.
  18728. //
  18729. // For example, if the widget has properties `foo` and `bar`
  18730. // and a method named `_getFooAttr()`, calling:
  18731. // `myWidget.get("foo")` would be equivalent to calling
  18732. // `widget._getFooAttr()` and `myWidget.get("bar")`
  18733. // would be equivalent to the expression
  18734. // `widget.bar2`
  18735. var names = this._getAttrNames(name);
  18736. return this[names.g] ? this[names.g]() : this[name];
  18737. },
  18738. set: function(name, value){
  18739. // summary:
  18740. // Set a property on a widget
  18741. // name:
  18742. // The property to set.
  18743. // value:
  18744. // The value to set in the property.
  18745. // description:
  18746. // Sets named properties on a widget which may potentially be handled by a
  18747. // setter in the widget.
  18748. //
  18749. // For example, if the widget has properties `foo` and `bar`
  18750. // and a method named `_setFooAttr()`, calling
  18751. // `myWidget.set("foo", "Howdy!")` would be equivalent to calling
  18752. // `widget._setFooAttr("Howdy!")` and `myWidget.set("bar", 3)`
  18753. // would be equivalent to the statement `widget.bar = 3;`
  18754. //
  18755. // set() may also be called with a hash of name/value pairs, ex:
  18756. //
  18757. // | myWidget.set({
  18758. // | foo: "Howdy",
  18759. // | bar: 3
  18760. // | });
  18761. //
  18762. // This is equivalent to calling `set(foo, "Howdy")` and `set(bar, 3)`
  18763. if(typeof name === "object"){
  18764. for(var x in name){
  18765. this.set(x, name[x]);
  18766. }
  18767. return this;
  18768. }
  18769. var names = this._getAttrNames(name),
  18770. setter = this[names.s];
  18771. if(lang.isFunction(setter)){
  18772. // use the explicit setter
  18773. var result = setter.apply(this, Array.prototype.slice.call(arguments, 1));
  18774. }else{
  18775. // Mapping from widget attribute to DOMNode attribute/value/etc.
  18776. // Map according to:
  18777. // 1. attributeMap setting, if one exists (TODO: attributeMap deprecated, remove in 2.0)
  18778. // 2. _setFooAttr: {...} type attribute in the widget (if one exists)
  18779. // 3. apply to focusNode or domNode if standard attribute name, excluding funcs like onClick.
  18780. // Checks if an attribute is a "standard attribute" by whether the DOMNode JS object has a similar
  18781. // attribute name (ex: accept-charset attribute matches jsObject.acceptCharset).
  18782. // Note also that Tree.focusNode() is a function not a DOMNode, so test for that.
  18783. var defaultNode = this.focusNode && !lang.isFunction(this.focusNode) ? "focusNode" : "domNode",
  18784. tag = this[defaultNode].tagName,
  18785. attrsForTag = tagAttrs[tag] || (tagAttrs[tag] = getAttrs(this[defaultNode])),
  18786. map = name in this.attributeMap ? this.attributeMap[name] :
  18787. names.s in this ? this[names.s] :
  18788. ((names.l in attrsForTag && typeof value != "function") ||
  18789. /^aria-|^data-|^role$/.test(name)) ? defaultNode : null;
  18790. if(map != null){
  18791. this._attrToDom(name, value, map);
  18792. }
  18793. this._set(name, value);
  18794. }
  18795. return result || this;
  18796. },
  18797. _attrPairNames: {}, // shared between all widgets
  18798. _getAttrNames: function(name){
  18799. // summary:
  18800. // Helper function for get() and set().
  18801. // Caches attribute name values so we don't do the string ops every time.
  18802. // tags:
  18803. // private
  18804. var apn = this._attrPairNames;
  18805. if(apn[name]){ return apn[name]; }
  18806. var uc = name.replace(/^[a-z]|-[a-zA-Z]/g, function(c){ return c.charAt(c.length-1).toUpperCase(); });
  18807. return (apn[name] = {
  18808. n: name+"Node",
  18809. s: "_set"+uc+"Attr", // converts dashes to camel case, ex: accept-charset --> _setAcceptCharsetAttr
  18810. g: "_get"+uc+"Attr",
  18811. l: uc.toLowerCase() // lowercase name w/out dashes, ex: acceptcharset
  18812. });
  18813. },
  18814. _set: function(/*String*/ name, /*anything*/ value){
  18815. // summary:
  18816. // Helper function to set new value for specified attribute, and call handlers
  18817. // registered with watch() if the value has changed.
  18818. var oldValue = this[name];
  18819. this[name] = value;
  18820. if(this._watchCallbacks && this._created && !isEqual(value, oldValue)){
  18821. this._watchCallbacks(name, oldValue, value);
  18822. }
  18823. },
  18824. on: function(/*String*/ type, /*Function*/ func){
  18825. // summary:
  18826. // Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }).
  18827. // description:
  18828. // Call specified function when event `type` occurs, ex: `myWidget.on("click", function(){ ... })`.
  18829. // Note that the function is not run in any particular scope, so if (for example) you want it to run in the
  18830. // widget's scope you must do `myWidget.on("click", lang.hitch(myWidget, func))`.
  18831. return aspect.after(this, this._onMap(type), func, true);
  18832. },
  18833. _onMap: function(/*String*/ type){
  18834. // summary:
  18835. // Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove")
  18836. var ctor = this.constructor, map = ctor._onMap;
  18837. if(!map){
  18838. map = (ctor._onMap = {});
  18839. for(var attr in ctor.prototype){
  18840. if(/^on/.test(attr)){
  18841. map[attr.replace(/^on/, "").toLowerCase()] = attr;
  18842. }
  18843. }
  18844. }
  18845. return map[type.toLowerCase()]; // String
  18846. },
  18847. toString: function(){
  18848. // summary:
  18849. // Returns a string that represents the widget
  18850. // description:
  18851. // When a widget is cast to a string, this method will be used to generate the
  18852. // output. Currently, it does not implement any sort of reversible
  18853. // serialization.
  18854. return '[Widget ' + this.declaredClass + ', ' + (this.id || 'NO ID') + ']'; // String
  18855. },
  18856. getChildren: function(){
  18857. // summary:
  18858. // Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode.
  18859. // Does not return nested widgets, nor widgets that are part of this widget's template.
  18860. return this.containerNode ? registry.findWidgets(this.containerNode) : []; // dijit._Widget[]
  18861. },
  18862. getParent: function(){
  18863. // summary:
  18864. // Returns the parent widget of this widget
  18865. return registry.getEnclosingWidget(this.domNode.parentNode);
  18866. },
  18867. connect: function(
  18868. /*Object|null*/ obj,
  18869. /*String|Function*/ event,
  18870. /*String|Function*/ method){
  18871. // summary:
  18872. // Connects specified obj/event to specified method of this object
  18873. // and registers for disconnect() on widget destroy.
  18874. // description:
  18875. // Provide widget-specific analog to dojo.connect, except with the
  18876. // implicit use of this widget as the target object.
  18877. // Events connected with `this.connect` are disconnected upon
  18878. // destruction.
  18879. // returns:
  18880. // A handle that can be passed to `disconnect` in order to disconnect before
  18881. // the widget is destroyed.
  18882. // example:
  18883. // | var btn = new dijit.form.Button();
  18884. // | // when foo.bar() is called, call the listener we're going to
  18885. // | // provide in the scope of btn
  18886. // | btn.connect(foo, "bar", function(){
  18887. // | console.debug(this.toString());
  18888. // | });
  18889. // tags:
  18890. // protected
  18891. var handle = connect.connect(obj, event, this, method);
  18892. this._connects.push(handle);
  18893. return handle; // _Widget.Handle
  18894. },
  18895. disconnect: function(handle){
  18896. // summary:
  18897. // Disconnects handle created by `connect`.
  18898. // Also removes handle from this widget's list of connects.
  18899. // tags:
  18900. // protected
  18901. var i = array.indexOf(this._connects, handle);
  18902. if(i != -1){
  18903. handle.remove();
  18904. this._connects.splice(i, 1);
  18905. }
  18906. },
  18907. subscribe: function(t, method){
  18908. // summary:
  18909. // Subscribes to the specified topic and calls the specified method
  18910. // of this object and registers for unsubscribe() on widget destroy.
  18911. // description:
  18912. // Provide widget-specific analog to dojo.subscribe, except with the
  18913. // implicit use of this widget as the target object.
  18914. // t: String
  18915. // The topic
  18916. // method: Function
  18917. // The callback
  18918. // example:
  18919. // | var btn = new dijit.form.Button();
  18920. // | // when /my/topic is published, this button changes its label to
  18921. // | // be the parameter of the topic.
  18922. // | btn.subscribe("/my/topic", function(v){
  18923. // | this.set("label", v);
  18924. // | });
  18925. // tags:
  18926. // protected
  18927. var handle = topic.subscribe(t, lang.hitch(this, method));
  18928. this._connects.push(handle);
  18929. return handle; // _Widget.Handle
  18930. },
  18931. unsubscribe: function(/*Object*/ handle){
  18932. // summary:
  18933. // Unsubscribes handle created by this.subscribe.
  18934. // Also removes handle from this widget's list of subscriptions
  18935. // tags:
  18936. // protected
  18937. this.disconnect(handle);
  18938. },
  18939. isLeftToRight: function(){
  18940. // summary:
  18941. // Return this widget's explicit or implicit orientation (true for LTR, false for RTL)
  18942. // tags:
  18943. // protected
  18944. return this.dir ? (this.dir == "ltr") : domGeometry.isBodyLtr(); //Boolean
  18945. },
  18946. isFocusable: function(){
  18947. // summary:
  18948. // Return true if this widget can currently be focused
  18949. // and false if not
  18950. return this.focus && (domStyle.get(this.domNode, "display") != "none");
  18951. },
  18952. placeAt: function(/* String|DomNode|_Widget */reference, /* String?|Int? */position){
  18953. // summary:
  18954. // Place this widget's domNode reference somewhere in the DOM based
  18955. // on standard domConstruct.place conventions, or passing a Widget reference that
  18956. // contains and addChild member.
  18957. //
  18958. // description:
  18959. // A convenience function provided in all _Widgets, providing a simple
  18960. // shorthand mechanism to put an existing (or newly created) Widget
  18961. // somewhere in the dom, and allow chaining.
  18962. //
  18963. // reference:
  18964. // The String id of a domNode, a domNode reference, or a reference to a Widget possessing
  18965. // an addChild method.
  18966. //
  18967. // position:
  18968. // If passed a string or domNode reference, the position argument
  18969. // accepts a string just as domConstruct.place does, one of: "first", "last",
  18970. // "before", or "after".
  18971. //
  18972. // If passed a _Widget reference, and that widget reference has an ".addChild" method,
  18973. // it will be called passing this widget instance into that method, supplying the optional
  18974. // position index passed.
  18975. //
  18976. // returns:
  18977. // dijit._Widget
  18978. // Provides a useful return of the newly created dijit._Widget instance so you
  18979. // can "chain" this function by instantiating, placing, then saving the return value
  18980. // to a variable.
  18981. //
  18982. // example:
  18983. // | // create a Button with no srcNodeRef, and place it in the body:
  18984. // | var button = new dijit.form.Button({ label:"click" }).placeAt(win.body());
  18985. // | // now, 'button' is still the widget reference to the newly created button
  18986. // | button.on("click", function(e){ console.log('click'); }));
  18987. //
  18988. // example:
  18989. // | // create a button out of a node with id="src" and append it to id="wrapper":
  18990. // | var button = new dijit.form.Button({},"src").placeAt("wrapper");
  18991. //
  18992. // example:
  18993. // | // place a new button as the first element of some div
  18994. // | var button = new dijit.form.Button({ label:"click" }).placeAt("wrapper","first");
  18995. //
  18996. // example:
  18997. // | // create a contentpane and add it to a TabContainer
  18998. // | var tc = dijit.byId("myTabs");
  18999. // | new dijit.layout.ContentPane({ href:"foo.html", title:"Wow!" }).placeAt(tc)
  19000. if(reference.declaredClass && reference.addChild){
  19001. reference.addChild(this, position);
  19002. }else{
  19003. domConstruct.place(this.domNode, reference, position);
  19004. }
  19005. return this;
  19006. },
  19007. getTextDir: function(/*String*/ text,/*String*/ originalDir){
  19008. // summary:
  19009. // Return direction of the text.
  19010. // The function overridden in the _BidiSupport module,
  19011. // its main purpose is to calculate the direction of the
  19012. // text, if was defined by the programmer through textDir.
  19013. // tags:
  19014. // protected.
  19015. return originalDir;
  19016. },
  19017. applyTextDir: function(/*===== element, text =====*/){
  19018. // summary:
  19019. // The function overridden in the _BidiSupport module,
  19020. // originally used for setting element.dir according to this.textDir.
  19021. // In this case does nothing.
  19022. // element: DOMNode
  19023. // text: String
  19024. // tags:
  19025. // protected.
  19026. },
  19027. defer: function(fcn, delay){
  19028. // summary:
  19029. // Wrapper to setTimeout to avoid deferred functions executing
  19030. // after the originating widget has been destroyed.
  19031. // Returns an object handle with a remove method (that returns null) (replaces clearTimeout).
  19032. // fcn: function reference
  19033. // delay: Optional number (defaults to 0)
  19034. // tags:
  19035. // protected.
  19036. var timer = setTimeout(lang.hitch(this,
  19037. function(){
  19038. if(!timer){ return; }
  19039. timer = null;
  19040. if(!this._destroyed){
  19041. lang.hitch(this, fcn)();
  19042. }
  19043. }),
  19044. delay || 0
  19045. );
  19046. return {
  19047. remove: function(){
  19048. if(timer){
  19049. clearTimeout(timer);
  19050. timer = null;
  19051. }
  19052. return null; // so this works well: handle = handle.remove();
  19053. }
  19054. };
  19055. }
  19056. });
  19057. });
  19058. }}});
  19059. define("dojox/charting/widget/Chart2D", ["dojo/_base/kernel", "./Chart", "../Chart2D",
  19060. "../action2d/Highlight", "../action2d/Magnify",
  19061. "../action2d/MoveSlice", "../action2d/Shake", "../action2d/Tooltip"], function(dojo, Chart) {
  19062. dojo.deprecated("dojox.charting.widget.Chart2D", "Use dojo.charting.widget.Chart instead and require all other components explicitly", "2.0");
  19063. return dojox.charting.widget.Chart2D = Chart;
  19064. });