klinecharts.min.js 206 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871
  1. /**
  2. * @license
  3. * KLineChart v7.5.0
  4. * Copyright (c) 2019 lihu.
  5. * Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
  6. */
  7. ! function(t, e) {
  8. "object" == typeof exports && "undefined" != typeof module ? e(exports) : "function" == typeof define && define
  9. .amd ? define(["exports"], e) : e((t = "undefined" != typeof globalThis ? globalThis : t || self)
  10. .klinecharts = {})
  11. }(this, (function(t) {
  12. "use strict";
  13. var e = {
  14. name: "BBI",
  15. series: "price",
  16. precision: 2,
  17. calcParams: [3, 6, 12, 24],
  18. shouldCheckParamCount: !0,
  19. shouldOhlc: !0,
  20. plots: [{
  21. key: "bbi",
  22. title: "BBI: ",
  23. type: "line"
  24. }],
  25. calcTechnicalIndicator: function(t, e) {
  26. var i = Math.max.apply(null, e),
  27. a = [],
  28. n = [];
  29. return t.map((function(r, o) {
  30. var s = {},
  31. c = r.close;
  32. if (e.forEach((function(e, i) {
  33. a[i] = (a[i] || 0) + c, e - 1 > o || (n[i] = a[i] / e, a[
  34. i] -= t[o - (e - 1)].close)
  35. })), o >= i - 1) {
  36. var h = 0;
  37. n.forEach((function(t) {
  38. h += t
  39. })), s.bbi = h / 4
  40. }
  41. return s
  42. }))
  43. }
  44. },
  45. i = {
  46. name: "DMA",
  47. calcParams: [10, 50, 10],
  48. plots: [{
  49. key: "dma",
  50. title: "DMA: ",
  51. type: "line"
  52. }, {
  53. key: "ama",
  54. title: "AMA: ",
  55. type: "line"
  56. }],
  57. calcTechnicalIndicator: function(t, e) {
  58. var i = Math.max(e[0], e[1]),
  59. a = 0,
  60. n = 0,
  61. r = 0,
  62. o = [];
  63. return t.forEach((function(s, c) {
  64. var h, l, u = {},
  65. d = s.close;
  66. if (a += d, n += d, e[0] - 1 > c || (h = a / e[0], a -= t[c - (e[0] - 1)]
  67. .close), e[1] - 1 > c || (l = n / e[1], n -= t[c - (e[1] - 1)]
  68. .close), c >= i - 1) {
  69. var _ = h - l;
  70. u.dma = _, r += _, i + e[2] - 2 > c || (u.ama = r / e[2], r -= o[c - (e[
  71. 2] - 1)].dma)
  72. }
  73. o.push(u)
  74. })), o
  75. }
  76. },
  77. a = {
  78. name: "DMI",
  79. calcParams: [14, 6],
  80. plots: [{
  81. key: "pdi",
  82. title: "PDI: ",
  83. type: "line"
  84. }, {
  85. key: "mdi",
  86. title: "MDI: ",
  87. type: "line"
  88. }, {
  89. key: "adx",
  90. title: "ADX: ",
  91. type: "line"
  92. }, {
  93. key: "adxr",
  94. title: "ADXR: ",
  95. type: "line"
  96. }],
  97. calcTechnicalIndicator: function(t, e) {
  98. var i = 0,
  99. a = 0,
  100. n = 0,
  101. r = 0,
  102. o = 0,
  103. s = 0,
  104. c = 0,
  105. h = 0,
  106. l = [];
  107. return t.forEach((function(u, d) {
  108. var _ = {},
  109. v = t[d - 1] || u,
  110. f = v.close,
  111. p = u.high,
  112. y = u.low,
  113. m = p - y,
  114. x = Math.abs(p - f),
  115. g = Math.abs(f - y),
  116. k = p - v.high,
  117. D = v.low - y,
  118. w = Math.max(Math.max(m, x), g),
  119. b = k > 0 && k > D ? k : 0,
  120. M = D > 0 && D > k ? D : 0;
  121. if (i += w, a += b, n += M, d >= e[0] - 1) {
  122. d > e[0] - 1 ? (r = r - r / e[0] + w, o = o - o / e[0] + b, s = s - s /
  123. e[0] + M) : (r = i, o = a, s = n);
  124. var P = 0,
  125. E = 0;
  126. 0 !== r && (P = 100 * o / r, E = 100 * s / r), _.pdi = P, _.mdi = E;
  127. var C = 0;
  128. E + P !== 0 && (C = Math.abs(E - P) / (E + P) * 100), c += C, 2 * e[0] -
  129. 2 > d || (_.adx = h = d > 2 * e[0] - 2 ? (h * (e[0] - 1) + C) / e[
  130. 0] : c / e[0], 2 * e[0] + e[1] - 3 > d || (_.adxr = (l[d - (e[
  131. 1] - 1)].adx + h) / 2))
  132. }
  133. l.push(_)
  134. })), l
  135. }
  136. },
  137. n = {
  138. name: "MACD",
  139. calcParams: [12, 26, 9],
  140. baseValue: 0,
  141. plots: [{
  142. key: "dif",
  143. title: "DIF: ",
  144. type: "line"
  145. }, {
  146. key: "dea",
  147. title: "DEA: ",
  148. type: "line"
  149. }, {
  150. key: "macd",
  151. title: "MACD: ",
  152. type: "bar",
  153. color: function(t, e) {
  154. var i = (t.currentData.technicalIndicatorData || {}).macd;
  155. return i > 0 ? e.bar.upColor : 0 > i ? e.bar.downColor : e.bar.noChangeColor
  156. },
  157. isStroke: function(t) {
  158. return (t.currentData.technicalIndicatorData || {}).macd > (t.preData
  159. .technicalIndicatorData || {}).macd
  160. }
  161. }],
  162. calcTechnicalIndicator: function(t, e) {
  163. var i, a, n = 0,
  164. r = 0,
  165. o = 0,
  166. s = 0,
  167. c = Math.max(e[0], e[1]);
  168. return t.map((function(t, h) {
  169. var l = {},
  170. u = t.close;
  171. return n += u, e[0] - 1 > h || (i = h > e[0] - 1 ? (2 * u + (e[0] - 1) *
  172. i) / (e[0] + 1) : n / e[0]), e[1] - 1 > h || (a = h > e[1] - 1 ? (
  173. 2 * u + (e[1] - 1) * a) / (e[1] + 1) : n / e[1]), c - 1 > h || (l
  174. .dif = r = i - a, o += r, c + e[2] - 2 > h || (l.macd = 2 * (r - (
  175. s = h > c + e[2] - 2 ? (2 * r + s * (e[2] - 1)) / (e[
  176. 2] + 1) : o / e[2])), l.dea = s)), l
  177. }))
  178. }
  179. },
  180. r = {
  181. name: "CR",
  182. calcParams: [26, 10, 20, 40, 60],
  183. plots: [{
  184. key: "cr",
  185. title: "CR: ",
  186. type: "line"
  187. }, {
  188. key: "ma1",
  189. title: "MA1: ",
  190. type: "line"
  191. }, {
  192. key: "ma2",
  193. title: "MA2: ",
  194. type: "line"
  195. }, {
  196. key: "ma3",
  197. title: "MA3: ",
  198. type: "line"
  199. }, {
  200. key: "ma4",
  201. title: "MA4: ",
  202. type: "line"
  203. }],
  204. calcTechnicalIndicator: function(t, e) {
  205. var i = Math.ceil(e[1] / 2.5 + 1),
  206. a = Math.ceil(e[2] / 2.5 + 1),
  207. n = Math.ceil(e[3] / 2.5 + 1),
  208. r = Math.ceil(e[4] / 2.5 + 1),
  209. o = 0,
  210. s = [],
  211. c = 0,
  212. h = [],
  213. l = 0,
  214. u = [],
  215. d = 0,
  216. _ = [],
  217. v = [];
  218. return t.forEach((function(f, p) {
  219. var y = {},
  220. m = t[p - 1] || f,
  221. x = (m.high + m.close + m.low + m.open) / 4,
  222. g = Math.max(0, f.high - x),
  223. k = Math.max(0, x - f.low);
  224. e[0] - 1 > p || (y.cr = 0 !== k ? g / k * 100 : 0, o += y.cr, c += y.cr,
  225. l += y.cr, d += y.cr, e[0] + e[1] - 2 > p || (s.push(o / e[1]), e[
  226. 0] + e[1] + i - 3 > p || (y.ma1 = s[s.length - 1 - i]), o -= v[
  227. p - (e[1] - 1)].cr), e[0] + e[2] - 2 > p || (h.push(c / e[
  228. 2]), e[0] + e[2] + a - 3 > p || (y.ma2 = h[h.length - 1 -
  229. a]), c -= v[p - (e[2] - 1)].cr), e[0] + e[3] - 2 > p || (u.push(
  230. l / e[3]), e[0] + e[3] + n - 3 > p || (y.ma3 = u[u.length -
  231. 1 - n]), l -= v[p - (e[3] - 1)].cr), e[0] + e[4] - 2 > p || (_
  232. .push(d / e[4]), e[0] + e[4] + r - 3 > p || (y.ma4 = _[_
  233. .length - 1 - r]), d -= v[p - (e[4] - 1)].cr)), v.push(y)
  234. })), v
  235. }
  236. },
  237. o = {
  238. name: "AO",
  239. calcParams: [5, 34],
  240. shouldCheckParamCount: !0,
  241. plots: [{
  242. key: "ao",
  243. title: "AO: ",
  244. type: "bar",
  245. color: function(t, e) {
  246. return (t.currentData.technicalIndicatorData || {}).ao > (t.preData
  247. .technicalIndicatorData || {}).ao ? e.bar.upColor : e.bar.downColor
  248. },
  249. isStroke: function(t) {
  250. return (t.currentData.technicalIndicatorData || {}).ao > (t.preData
  251. .technicalIndicatorData || {}).ao
  252. }
  253. }],
  254. baseValue: 0,
  255. calcTechnicalIndicator: function(t, e) {
  256. var i = Math.max(e[0], e[1]),
  257. a = 0,
  258. n = 0,
  259. r = 0,
  260. o = 0;
  261. return t.map((function(s, c) {
  262. var h = {},
  263. l = (s.low + s.high) / 2;
  264. if (a += l, n += l, c >= e[0] - 1) {
  265. r = a / e[0];
  266. var u = t[c - (e[0] - 1)];
  267. a -= (u.low + u.high) / 2
  268. }
  269. if (c >= e[1] - 1) {
  270. o = n / e[1];
  271. var d = t[c - (e[1] - 1)];
  272. n -= (d.low + d.high) / 2
  273. }
  274. return i - 1 > c || (h.ao = r - o), h
  275. }))
  276. }
  277. },
  278. s = {
  279. name: "CCI",
  280. calcParams: [20],
  281. plots: [{
  282. key: "cci",
  283. title: "CCI: ",
  284. type: "line"
  285. }],
  286. calcTechnicalIndicator: function(t, e) {
  287. var i = e[0] - 1,
  288. a = 0,
  289. n = [];
  290. return t.map((function(r, o) {
  291. var s = {},
  292. c = (r.high + r.low + r.close) / 3;
  293. if (a += c, n.push(c), o >= i) {
  294. var h = a / e[0],
  295. l = n.slice(o - i, o + 1),
  296. u = 0;
  297. l.forEach((function(t) {
  298. u += Math.abs(t - h)
  299. }));
  300. var d = u / e[0];
  301. s.cci = 0 !== d ? (c - h) / d / .015 : 0, a -= (t[o - i].high + t[o - i]
  302. .low + t[o - i].close) / 3
  303. }
  304. return s
  305. }))
  306. }
  307. },
  308. c = {
  309. name: "RSI",
  310. calcParams: [6, 12, 24],
  311. shouldCheckParamCount: !1,
  312. plots: [{
  313. key: "rsi1",
  314. title: "RSI1: ",
  315. type: "line"
  316. }, {
  317. key: "rsi2",
  318. title: "RSI2: ",
  319. type: "line"
  320. }, {
  321. key: "rsi3",
  322. title: "RSI3: ",
  323. type: "line"
  324. }],
  325. regeneratePlots: function(t) {
  326. return t.map((function(t, e) {
  327. var i = e + 1;
  328. return {
  329. key: "rsi".concat(i),
  330. title: "RSI".concat(i, ": "),
  331. type: "line"
  332. }
  333. }))
  334. },
  335. calcTechnicalIndicator: function(t, e, i) {
  336. var a = [],
  337. n = [];
  338. return t.map((function(r, o) {
  339. var s = {},
  340. c = r.close - (t[o - 1] || r).close;
  341. return e.forEach((function(e, r) {
  342. if (c > 0 ? a[r] = (a[r] || 0) + c : n[r] = (n[r] || 0) +
  343. Math.abs(c), o >= e - 1) {
  344. s[i[r].key] = 0 !== n[r] ? 100 - 100 / (1 + a[r] / n[
  345. r]) : 0;
  346. var h = t[o - (e - 1)],
  347. l = h.close - (t[o - e] || h).close;
  348. l > 0 ? a[r] -= l : n[r] -= Math.abs(l)
  349. }
  350. })), s
  351. }))
  352. }
  353. };
  354. function h() {
  355. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [],
  356. e = Number.MIN_SAFE_INTEGER,
  357. i = Number.MAX_SAFE_INTEGER;
  358. return t.forEach((function(t) {
  359. e = Math.max(t.high, e), i = Math.min(t.low, i)
  360. })), {
  361. hn: e,
  362. ln: i
  363. }
  364. }
  365. var l = {
  366. name: "KDJ",
  367. calcParams: [9, 3, 3],
  368. plots: [{
  369. key: "k",
  370. title: "K: ",
  371. type: "line"
  372. }, {
  373. key: "d",
  374. title: "D: ",
  375. type: "line"
  376. }, {
  377. key: "j",
  378. title: "J: ",
  379. type: "line"
  380. }],
  381. calcTechnicalIndicator: function(t, e) {
  382. var i = [];
  383. return t.forEach((function(a, n) {
  384. var r = {},
  385. o = a.close;
  386. if (n >= e[0] - 1) {
  387. var s = h(t.slice(n - (e[0] - 1), n + 1)),
  388. c = s.ln,
  389. l = s.hn - c;
  390. r.k = ((e[1] - 1) * (i[n - 1].k || 50) + (o - c) / (0 === l ? 1 : l) *
  391. 100) / e[1], r.d = ((e[2] - 1) * (i[n - 1].d || 50) + r.k) / e[
  392. 2], r.j = 3 * r.k - 2 * r.d
  393. }
  394. i.push(r)
  395. })), i
  396. }
  397. },
  398. u = {
  399. name: "WR",
  400. calcParams: [6, 10, 14],
  401. shouldCheckParamCount: !1,
  402. plots: [{
  403. key: "wr1",
  404. title: "WR1: ",
  405. type: "line"
  406. }, {
  407. key: "wr2",
  408. title: "WR2: ",
  409. type: "line"
  410. }, {
  411. key: "wr3",
  412. title: "WR3: ",
  413. type: "line"
  414. }],
  415. regeneratePlots: function(t) {
  416. return t.map((function(t, e) {
  417. return {
  418. key: "wr".concat(e + 1),
  419. title: "WR".concat(e + 1, ": "),
  420. type: "line"
  421. }
  422. }))
  423. },
  424. calcTechnicalIndicator: function(t, e, i) {
  425. return t.map((function(a, n) {
  426. var r = {},
  427. o = a.close;
  428. return e.forEach((function(e, a) {
  429. var s = e - 1;
  430. if (n >= s) {
  431. var c = h(t.slice(n - s, n + 1)),
  432. l = c.hn,
  433. u = l - c.ln;
  434. r[i[a].key] = 0 === u ? 0 : (o - l) / u * 100
  435. }
  436. })), r
  437. }))
  438. }
  439. };
  440. var d = {
  441. name: "BOLL",
  442. series: "price",
  443. calcParams: [20, 2],
  444. calcParamsAllowDecimal: {
  445. 1: !0
  446. },
  447. precision: 2,
  448. shouldOhlc: !0,
  449. plots: [{
  450. key: "up",
  451. title: "UP: ",
  452. type: "line"
  453. }, {
  454. key: "mid",
  455. title: "MID: ",
  456. type: "line"
  457. }, {
  458. key: "dn",
  459. title: "DN: ",
  460. type: "line"
  461. }],
  462. calcTechnicalIndicator: function(t, e) {
  463. var i = e[0] - 1,
  464. a = 0;
  465. return t.map((function(n, r) {
  466. var o = {};
  467. if (a += n.close, r >= i) {
  468. o.mid = a / e[0];
  469. var s = function(t, e) {
  470. var i = t.length,
  471. a = 0;
  472. t.forEach((function(t) {
  473. var i = t.close - e;
  474. a += i * i
  475. }));
  476. var n = a > 0,
  477. r = Math.sqrt((a = Math.abs(a)) / i);
  478. return n ? r : -1 * r
  479. }(t.slice(r - i, r + 1), o.mid);
  480. o.up = o.mid + e[1] * s, o.dn = o.mid - e[1] * s, a -= t[r - i].close
  481. }
  482. return o
  483. }))
  484. }
  485. },
  486. _ = {
  487. name: "SAR",
  488. series: "price",
  489. calcParams: [2, 2, 20],
  490. precision: 2,
  491. shouldOhlc: !0,
  492. plots: [{
  493. key: "sar",
  494. title: "SAR: ",
  495. type: "circle",
  496. color: function(t, e) {
  497. var i = t.currentData,
  498. a = i.kLineData || {};
  499. return (a.high + a.low) / 2 > (i.technicalIndicatorData || {}).sar ? e.circle
  500. .upColor : e.circle.downColor
  501. }
  502. }],
  503. calcTechnicalIndicator: function(t, e) {
  504. var i = e[0] / 100,
  505. a = e[1] / 100,
  506. n = e[2] / 100,
  507. r = i,
  508. o = -100,
  509. s = !1,
  510. c = 0;
  511. return t.map((function(e, h) {
  512. var l = c,
  513. u = e.high,
  514. d = e.low;
  515. if (s) {
  516. (-100 === o || u > o) && (o = u, r = Math.min(r + a, n)), c = l + r * (
  517. o - l);
  518. var _ = Math.min(t[Math.max(1, h) - 1].low, d);
  519. c > e.low ? (c = o, r = i, o = -100, s = !s) : c > _ && (c = _)
  520. } else {
  521. (-100 === o || o > d) && (o = d, r = Math.min(r + a, n)), c = l + r * (
  522. o - l);
  523. var v = Math.max(t[Math.max(1, h) - 1].high, u);
  524. e.high > c ? (c = o, r = 0, o = -100, s = !s) : v > c && (c = v)
  525. }
  526. return {
  527. sar: c
  528. }
  529. }))
  530. }
  531. },
  532. v = {
  533. technicalIndicatorExtensions: {},
  534. graphicMarkExtensions: {},
  535. addTechnicalIndicator: function(t) {
  536. var e = this;
  537. t && [].concat(t).forEach((function(t) {
  538. t.name && (e.technicalIndicatorExtensions[t.name] = t)
  539. }))
  540. },
  541. addGraphicMark: function(t) {
  542. var e = this;
  543. t && [].concat(t).forEach((function(t) {
  544. t.name && (e.graphicMarkExtensions[t.name] = t)
  545. }))
  546. }
  547. };
  548. function f(t, e) {
  549. var i = Object.keys(t);
  550. if (Object.getOwnPropertySymbols) {
  551. var a = Object.getOwnPropertySymbols(t);
  552. e && (a = a.filter((function(e) {
  553. return Object.getOwnPropertyDescriptor(t, e).enumerable
  554. }))), i.push.apply(i, a)
  555. }
  556. return i
  557. }
  558. function p(t) {
  559. for (var e = 1; arguments.length > e; e++) {
  560. var i = null != arguments[e] ? arguments[e] : {};
  561. e % 2 ? f(Object(i), !0).forEach((function(e) {
  562. k(t, e, i[e])
  563. })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object
  564. .getOwnPropertyDescriptors(i)) : f(Object(i)).forEach((function(e) {
  565. Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(i, e))
  566. }))
  567. }
  568. return t
  569. }
  570. function y(t) {
  571. return (y = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
  572. return typeof t
  573. } : function(t) {
  574. return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol
  575. .prototype ? "symbol" : typeof t
  576. })(t)
  577. }
  578. function m(t, e) {
  579. if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
  580. }
  581. function x(t, e) {
  582. for (var i = 0; e.length > i; i++) {
  583. var a = e[i];
  584. a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object
  585. .defineProperty(t, a.key, a)
  586. }
  587. }
  588. function g(t, e, i) {
  589. return e && x(t.prototype, e), i && x(t, i), t
  590. }
  591. function k(t, e, i) {
  592. return e in t ? Object.defineProperty(t, e, {
  593. value: i,
  594. enumerable: !0,
  595. configurable: !0,
  596. writable: !0
  597. }) : t[e] = i, t
  598. }
  599. function D(t, e) {
  600. if ("function" != typeof e && null !== e) throw new TypeError(
  601. "Super expression must either be null or a function");
  602. t.prototype = Object.create(e && e.prototype, {
  603. constructor: {
  604. value: t,
  605. writable: !0,
  606. configurable: !0
  607. }
  608. }), e && b(t, e)
  609. }
  610. function w(t) {
  611. return (w = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) {
  612. return t.__proto__ || Object.getPrototypeOf(t)
  613. })(t)
  614. }
  615. function b(t, e) {
  616. return (b = Object.setPrototypeOf || function(t, e) {
  617. return t.__proto__ = e, t
  618. })(t, e)
  619. }
  620. function M(t, e) {
  621. return !e || "object" != typeof e && "function" != typeof e ? function(t) {
  622. if (void 0 === t) throw new ReferenceError(
  623. "this hasn't been initialised - super() hasn't been called");
  624. return t
  625. }(t) : e
  626. }
  627. function P(t) {
  628. var e = function() {
  629. if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
  630. if (Reflect.construct.sham) return !1;
  631. if ("function" == typeof Proxy) return !0;
  632. try {
  633. return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}))), !0
  634. } catch (t) {
  635. return !1
  636. }
  637. }();
  638. return function() {
  639. var i, a = w(t);
  640. if (e) {
  641. var n = w(this).constructor;
  642. i = Reflect.construct(a, arguments, n)
  643. } else i = a.apply(this, arguments);
  644. return M(this, i)
  645. }
  646. }
  647. function E(t, e, i) {
  648. return (E = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function(t, e, i) {
  649. var a = function(t, e) {
  650. for (; !Object.prototype.hasOwnProperty.call(t, e) && null !== (t = w(t)););
  651. return t
  652. }(t, e);
  653. if (a) {
  654. var n = Object.getOwnPropertyDescriptor(a, e);
  655. return n.get ? n.get.call(i) : n.value
  656. }
  657. })(t, e, i || t)
  658. }
  659. function C(t, e) {
  660. (null == e || e > t.length) && (e = t.length);
  661. for (var i = 0, a = Array(e); e > i; i++) a[i] = t[i];
  662. return a
  663. }
  664. function A(t, e) {
  665. var i = "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
  666. if (!i) {
  667. if (Array.isArray(t) || (i = function(t, e) {
  668. if (t) {
  669. if ("string" == typeof t) return C(t, e);
  670. var i = Object.prototype.toString.call(t).slice(8, -1);
  671. return "Object" === i && t.constructor && (i = t.constructor.name), "Map" === i ||
  672. "Set" === i ? Array.from(t) : "Arguments" === i ||
  673. /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? C(t, e) : void 0
  674. }
  675. }(t)) || e && t && "number" == typeof t.length) {
  676. i && (t = i);
  677. var a = 0,
  678. n = function() {};
  679. return {
  680. s: n,
  681. n: function() {
  682. return t.length > a ? {
  683. done: !1,
  684. value: t[a++]
  685. } : {
  686. done: !0
  687. }
  688. },
  689. e: function(t) {
  690. throw t
  691. },
  692. f: n
  693. }
  694. }
  695. throw new TypeError(
  696. "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
  697. )
  698. }
  699. var r, o = !0,
  700. s = !1;
  701. return {
  702. s: function() {
  703. i = i.call(t)
  704. },
  705. n: function() {
  706. var t = i.next();
  707. return o = t.done, t
  708. },
  709. e: function(t) {
  710. s = !0, r = t
  711. },
  712. f: function() {
  713. try {
  714. o || null == i.return || i.return()
  715. } finally {
  716. if (s) throw r
  717. }
  718. }
  719. }
  720. }
  721. function T(t, e) {
  722. if (O(t) && O(e))
  723. for (var i in e)
  724. if (i in t) {
  725. var a = t[i],
  726. n = e[i];
  727. O(n) && O(a) && !I(n) && !I(a) ? T(a, n) : F(e[i]) && (t[i] = e[i])
  728. }
  729. }
  730. function S(t) {
  731. if (!O(t)) return t;
  732. var e;
  733. for (var i in e = I(t) ? [] : {}, t)
  734. if (t.hasOwnProperty(i)) {
  735. var a = t[i];
  736. e[i] = O(a) ? S(a) : a
  737. } return e
  738. }
  739. function I(t) {
  740. return "[object Array]" === Object.prototype.toString.call(t)
  741. }
  742. function L(t) {
  743. return "function" == typeof t
  744. }
  745. function O(t) {
  746. return !!t && "object" === y(t)
  747. }
  748. function R(t) {
  749. return "number" == typeof t && !isNaN(t)
  750. }
  751. function F(t) {
  752. return null != t
  753. }
  754. function z(t) {
  755. return "boolean" == typeof t
  756. }
  757. function B(t) {
  758. return "string" == typeof t
  759. }
  760. function V(t) {
  761. return t && t instanceof HTMLElement && t.appendChild && "function" == typeof t.appendChild
  762. }
  763. var H = "dash",
  764. Y = "left",
  765. W = "right",
  766. G = "normal",
  767. N = "percentage",
  768. X = "log",
  769. j = "candle_solid",
  770. Z = "candle_stroke",
  771. U = "candle_up_stroke",
  772. K = "candle_down_stroke",
  773. q = "ohlc",
  774. $ = "area",
  775. J = "always",
  776. Q = "follow_cross",
  777. tt = "rect",
  778. et = "standard",
  779. it = "circle",
  780. at = "rect",
  781. nt = "triangle",
  782. rt = "diamond",
  783. ot = "custom",
  784. st = "point",
  785. ct = "top",
  786. ht = "bottom",
  787. lt = {
  788. grid: {
  789. show: !0,
  790. horizontal: {
  791. show: !0,
  792. size: 1,
  793. color: "#EDEDED",
  794. style: H,
  795. dashValue: [2, 2]
  796. },
  797. vertical: {
  798. show: !0,
  799. size: 1,
  800. color: "#EDEDED",
  801. style: H,
  802. dashValue: [2, 2]
  803. }
  804. },
  805. candle: {
  806. margin: {
  807. top: .2,
  808. bottom: .1
  809. },
  810. type: j,
  811. bar: {
  812. // upColor: "#26A69A",
  813. // downColor: "#EF5350",
  814. upColor: "#0ECB81",
  815. downColor: "#F5465C",
  816. // noChangeColor: "#999999"
  817. noChangeColor: "#0ECB81"
  818. },
  819. area: {
  820. lineSize: 2,
  821. lineColor: "#2196F3",
  822. value: "close",
  823. fillColor: [{
  824. offset: 0,
  825. color: "rgba(33, 150, 243, 0.01)"
  826. }, {
  827. offset: 1,
  828. color: "rgba(33, 150, 243, 0.2)"
  829. }]
  830. },
  831. priceMark: {
  832. show: !0,
  833. high: {
  834. show: !0,
  835. color: "#76808F",
  836. textMargin: 5,
  837. textSize: 10,
  838. textFamily: "Helvetica Neue",
  839. textWeight: "normal"
  840. },
  841. low: {
  842. show: !0,
  843. color: "#76808F",
  844. textMargin: 5,
  845. textSize: 10,
  846. textFamily: "Helvetica Neue",
  847. textWeight: "normal"
  848. },
  849. last: {
  850. show: !0,
  851. upColor: "#0ECB81",
  852. downColor: "#F5465C",
  853. // noChangeColor: "#999999"
  854. noChangeColor: "#0ECB81",
  855. line: {
  856. show: !0,
  857. style: H,
  858. dashValue: [4, 4],
  859. size: 1
  860. },
  861. text: {
  862. show: !0,
  863. size: 12,
  864. paddingLeft: 2,
  865. paddingTop: 2,
  866. paddingRight: 2,
  867. paddingBottom: 2,
  868. color: "#FFFFFF",
  869. family: "Helvetica Neue",
  870. weight: "normal",
  871. borderRadius: 2
  872. }
  873. }
  874. },
  875. tooltip: {
  876. showRule: J,
  877. showType: et,
  878. // labels: ["时间: ", "开: ", "收: ", "高: ", "低: ", "成交量: "],
  879. labels: window.labels,
  880. values: null,
  881. defaultValue: "n/a",
  882. rect: {
  883. paddingLeft: 0,
  884. paddingRight: 0,
  885. paddingTop: 0,
  886. paddingBottom: 6,
  887. offsetLeft: 8,
  888. offsetTop: 8,
  889. offsetRight: 8,
  890. borderRadius: 4,
  891. borderSize: 1,
  892. borderColor: "#F2F3F5",
  893. fillColor: "#FEFEFE"
  894. },
  895. text: {
  896. size: 12,
  897. family: "Helvetica Neue",
  898. weight: "normal",
  899. color: "#76808F",
  900. marginLeft: 4,
  901. marginTop: 6,
  902. marginRight: 4,
  903. marginBottom: 0
  904. }
  905. }
  906. },
  907. technicalIndicator: {
  908. margin: {
  909. top: .2,
  910. bottom: .1
  911. },
  912. bar: {
  913. // upColor: "rgba(38, 166, 154, .65)",
  914. // downColor: "rgba(239, 83, 80, .65)",
  915. // noChangeColor: "#888888"
  916. upColor: "#0ECB81",
  917. downColor: "#F5465C",
  918. noChangeColor: "#0ECB81"
  919. },
  920. line: {
  921. size: 1,
  922. colors: ["#FF9600", "#9D65C9", "#2196F3", "#E11D74", "#01C5C4"]
  923. },
  924. circle: {
  925. upColor: "rgba(38, 166, 154, .65)",
  926. downColor: "rgba(239, 83, 80, .65)",
  927. noChangeColor: "#888888"
  928. },
  929. lastValueMark: {
  930. show: !1,
  931. text: {
  932. show: !1,
  933. color: "#FFFFFF",
  934. size: 12,
  935. family: "Helvetica Neue",
  936. weight: "normal",
  937. paddingLeft: 3,
  938. paddingTop: 2,
  939. paddingRight: 3,
  940. paddingBottom: 2,
  941. borderRadius: 2
  942. }
  943. },
  944. tooltip: {
  945. showRule: J,
  946. showType: et,
  947. showName: !0,
  948. showParams: !0,
  949. defaultValue: "n/a",
  950. text: {
  951. size: 12,
  952. family: "Helvetica Neue",
  953. weight: "normal",
  954. color: "#76808F",
  955. marginTop: 6,
  956. marginRight: 8,
  957. marginBottom: 0,
  958. marginLeft: 8
  959. }
  960. }
  961. },
  962. xAxis: {
  963. show: !0,
  964. height: null,
  965. axisLine: {
  966. show: !0,
  967. color: "#DDDDDD",
  968. size: 1
  969. },
  970. tickText: {
  971. show: !0,
  972. color: "#76808F",
  973. size: 12,
  974. family: "Helvetica Neue",
  975. weight: "normal",
  976. paddingTop: 3,
  977. paddingBottom: 6
  978. },
  979. tickLine: {
  980. show: !0,
  981. size: 1,
  982. length: 3,
  983. color: "#DDDDDD"
  984. }
  985. },
  986. yAxis: {
  987. show: !0,
  988. width: null,
  989. type: G,
  990. position: W,
  991. inside: !1,
  992. axisLine: {
  993. show: !0,
  994. color: "#DDDDDD",
  995. size: 1
  996. },
  997. tickText: {
  998. show: !0,
  999. color: "#76808F",
  1000. size: 12,
  1001. family: "Helvetica Neue",
  1002. weight: "normal",
  1003. paddingLeft: 3,
  1004. paddingRight: 6
  1005. },
  1006. tickLine: {
  1007. show: !0,
  1008. size: 1,
  1009. length: 3,
  1010. color: "#DDDDDD"
  1011. }
  1012. },
  1013. separator: {
  1014. size: 1,
  1015. color: "#DDDDDD",
  1016. fill: !0,
  1017. activeBackgroundColor: "rgba(33, 150, 243, 0.08)"
  1018. },
  1019. crosshair: {
  1020. show: !0,
  1021. horizontal: {
  1022. show: !0,
  1023. line: {
  1024. show: !0,
  1025. style: H,
  1026. dashValue: [4, 2],
  1027. size: 1,
  1028. color: "#76808F"
  1029. },
  1030. text: {
  1031. show: !0,
  1032. color: "#FFFFFF",
  1033. size: 12,
  1034. family: "Helvetica Neue",
  1035. weight: "normal",
  1036. paddingLeft: 2,
  1037. paddingRight: 2,
  1038. paddingTop: 2,
  1039. paddingBottom: 2,
  1040. borderSize: 1,
  1041. borderColor: "#686D76",
  1042. borderRadius: 2,
  1043. backgroundColor: "#686D76"
  1044. }
  1045. },
  1046. vertical: {
  1047. show: !0,
  1048. line: {
  1049. show: !0,
  1050. style: H,
  1051. dashValue: [4, 2],
  1052. size: 1,
  1053. color: "#76808F"
  1054. },
  1055. text: {
  1056. show: !0,
  1057. color: "#FFFFFF",
  1058. size: 12,
  1059. family: "Helvetica Neue",
  1060. weight: "normal",
  1061. paddingLeft: 2,
  1062. paddingRight: 2,
  1063. paddingTop: 2,
  1064. paddingBottom: 2,
  1065. borderSize: 1,
  1066. borderRadius: 2,
  1067. borderColor: "#686D76",
  1068. backgroundColor: "#686D76"
  1069. }
  1070. }
  1071. },
  1072. graphicMark: {
  1073. point: {
  1074. backgroundColor: "#2196F3",
  1075. borderColor: "rgba(33, 150, 243, 0.35)",
  1076. borderSize: 1,
  1077. radius: 5,
  1078. activeBackgroundColor: "#2196F3",
  1079. activeBorderColor: "rgba(33, 150, 243, 0.35)",
  1080. activeBorderSize: 3,
  1081. activeRadius: 5
  1082. },
  1083. line: {
  1084. color: "#2196F3",
  1085. size: 1,
  1086. dashValue: [2, 2]
  1087. },
  1088. polygon: {
  1089. stroke: {
  1090. size: 1,
  1091. color: "#2196F3"
  1092. },
  1093. fill: {
  1094. color: "rgba(33, 150, 243, 0.1)"
  1095. }
  1096. },
  1097. arc: {
  1098. stroke: {
  1099. size: 1,
  1100. color: "#2196F3"
  1101. },
  1102. fill: {
  1103. color: "rgba(33, 150, 243, 0.1)"
  1104. }
  1105. },
  1106. text: {
  1107. color: "#2196F3",
  1108. size: 12,
  1109. family: "Helvetica Neue",
  1110. weight: "normal",
  1111. marginLeft: 2,
  1112. marginRight: 2,
  1113. marginTop: 2,
  1114. marginBottom: 6
  1115. }
  1116. },
  1117. annotation: {
  1118. symbol: {
  1119. type: rt,
  1120. position: ct,
  1121. size: 8,
  1122. color: "#2196F3",
  1123. activeSize: 10,
  1124. activeColor: "#FF9600",
  1125. offset: [0, 20]
  1126. }
  1127. },
  1128. tag: {
  1129. position: st,
  1130. offset: 0,
  1131. line: {
  1132. show: !0,
  1133. style: H,
  1134. dashValue: [4, 2],
  1135. size: 1,
  1136. color: "#2196F3"
  1137. },
  1138. text: {
  1139. color: "#FFFFFF",
  1140. backgroundColor: "#2196F3",
  1141. size: 12,
  1142. family: "Helvetica Neue",
  1143. weight: "normal",
  1144. paddingLeft: 2,
  1145. paddingRight: 2,
  1146. paddingTop: 2,
  1147. paddingBottom: 2,
  1148. borderRadius: 2
  1149. },
  1150. mark: {
  1151. color: "#FFFFFF",
  1152. backgroundColor: "#2196F3",
  1153. size: 12,
  1154. family: "Helvetica Neue",
  1155. weight: "normal",
  1156. paddingLeft: 2,
  1157. paddingRight: 2,
  1158. paddingTop: 2,
  1159. paddingBottom: 2,
  1160. borderRadius: 2
  1161. }
  1162. }
  1163. };
  1164. function ut(t, e) {
  1165. var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "--";
  1166. if (O(t)) {
  1167. var a = t[e];
  1168. if (F(a)) return a
  1169. }
  1170. return i
  1171. }
  1172. function dt(t, e) {
  1173. var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "MM-DD hh:mm";
  1174. if (R(e)) {
  1175. var a = t.format(new Date(e)),
  1176. n = a.split(", "),
  1177. r = n[0].split("/"),
  1178. o = {
  1179. YYYY: r[2],
  1180. MM: r[0],
  1181. DD: r[1],
  1182. "hh:mm": "24" === n[1].match(/^[\d]{2}/)[0] ? n[1].replace(/^[\d]{2}/, "00") : n[1]
  1183. };
  1184. return i.replace(/YYYY|MM|DD|(hh:mm)/g, (function(t) {
  1185. return o[t]
  1186. }))
  1187. }
  1188. return "--"
  1189. }
  1190. function _t(t) {
  1191. var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2,
  1192. i = +t;
  1193. return (i || 0 === i) && R(i) ? i.toFixed(e) : "".concat(i)
  1194. }
  1195. function vt(t) {
  1196. return R(+t) ? t > 1e9 ? "".concat(+(t / 1e9).toFixed(3), "B") : t > 1e6 ? "".concat(+(t / 1e6).toFixed(
  1197. 3), "M") : t > 1e3 ? "".concat(+(t / 1e3).toFixed(3), "K") : t : "--"
  1198. }
  1199. function ft(t, e) {
  1200. return null == e && (e = 10), +(t = (+t).toFixed(e = Math.min(Math.max(0, e), 20)))
  1201. }
  1202. function pt(t) {
  1203. return Math.log(t) / Math.log(10)
  1204. }
  1205. function yt(t) {
  1206. return Math.pow(10, t)
  1207. }
  1208. var mt = "price",
  1209. xt = "volume",
  1210. gt = "line",
  1211. kt = "bar",
  1212. Dt = "circle",
  1213. wt = function() {
  1214. function t(e) {
  1215. var i = e.name,
  1216. a = e.series,
  1217. n = e.calcParams,
  1218. r = e.plots,
  1219. o = e.precision,
  1220. s = e.calcParamsAllowDecimal,
  1221. c = e.shouldCheckParamCount,
  1222. h = e.shouldOhlc,
  1223. l = e.shouldFormatBigNumber,
  1224. u = e.baseValue,
  1225. d = e.minValue,
  1226. _ = e.maxValue,
  1227. v = e.styles;
  1228. m(this, t), this.name = i || "", this.series = a || "normal", this.precision = R(o) && o >= 0 ?
  1229. o : 4, this.calcParams = I(n) ? n : [], this.plots = I(r) ? r : [], this
  1230. .calcParamsAllowDecimal = O(s) ? s : {}, this.shouldCheckParamCount = !z(c) || c, this
  1231. .shouldOhlc = h, this.shouldFormatBigNumber = l, this.baseValue = R(u) ? u : null, this
  1232. .minValue = d, this.maxValue = _, this.styles = v
  1233. }
  1234. return g(t, [{
  1235. key: "setPrecision",
  1236. value: function(t) {
  1237. return !(!R(t) || 0 > t) && (this.precision = parseInt(t, 10), !0)
  1238. }
  1239. }, {
  1240. key: "setCalcParamsAllowDecimal",
  1241. value: function(t) {
  1242. O(t) && (this.calcParamsAllowDecimal = t)
  1243. }
  1244. }, {
  1245. key: "setCalcParams",
  1246. value: function(t) {
  1247. if (!I(t)) return !1;
  1248. if (this.shouldCheckParamCount && t.length !== this.calcParams.length)
  1249. return !1;
  1250. for (var e = 0; t.length > e; e++) {
  1251. var i = t[e];
  1252. if (!R(i) || 0 >= i || !this.calcParamsAllowDecimal[e] && parseInt(i,
  1253. 10) !== i) return !1
  1254. }
  1255. this.calcParams = S(t);
  1256. var a = this.regeneratePlots(t);
  1257. return a && I(a) && (this.plots = a), !0
  1258. }
  1259. }, {
  1260. key: "setStyles",
  1261. value: function(t, e) {
  1262. return !!O(t) && (this.styles || (this.styles = {
  1263. bar: S(e.bar),
  1264. line: S(e.line),
  1265. circle: S(e.circle)
  1266. }), T(this.styles, t), !0)
  1267. }
  1268. }, {
  1269. key: "calcTechnicalIndicator",
  1270. value: function(t, e) {}
  1271. }, {
  1272. key: "regeneratePlots",
  1273. value: function(t) {}
  1274. }]), t
  1275. }();
  1276. function bt(t) {
  1277. var e = t.name,
  1278. i = t.series,
  1279. a = t.calcParams,
  1280. n = t.plots,
  1281. r = t.precision,
  1282. o = t.calcParamsAllowDecimal,
  1283. s = t.shouldCheckParamCount,
  1284. c = t.shouldOhlc,
  1285. h = t.shouldFormatBigNumber,
  1286. l = t.baseValue,
  1287. u = t.minValue,
  1288. d = t.maxValue,
  1289. _ = t.styles,
  1290. v = t.calcTechnicalIndicator,
  1291. f = t.regeneratePlots,
  1292. p = t.render;
  1293. if (!e || !L(v)) return null;
  1294. var y = function(t) {
  1295. D(f, t);
  1296. var v = P(f);
  1297. function f() {
  1298. return m(this, f), v.call(this, {
  1299. name: e,
  1300. series: i,
  1301. calcParams: a,
  1302. plots: n,
  1303. precision: r,
  1304. calcParamsAllowDecimal: o,
  1305. shouldCheckParamCount: s,
  1306. shouldOhlc: c,
  1307. shouldFormatBigNumber: h,
  1308. baseValue: l,
  1309. minValue: u,
  1310. maxValue: d,
  1311. styles: _
  1312. })
  1313. }
  1314. return f
  1315. }(wt);
  1316. return y.prototype.calcTechnicalIndicator = v, f && L(f) && (y.prototype.regeneratePlots = f), p && L(
  1317. p) && (y.prototype.render = p), new y
  1318. }
  1319. function Mt(t) {
  1320. return {
  1321. name: t.name,
  1322. series: t.series,
  1323. calcParams: t.calcParams,
  1324. calcParamsAllowDecimal: t.calcParamsAllowDecimal,
  1325. shouldCheckParamCount: t.shouldCheckParamCount,
  1326. shouldOhlc: t.shouldOhlc,
  1327. shouldFormatBigNumber: t.shouldFormatBigNumber,
  1328. precision: t.precision,
  1329. styles: t.styles,
  1330. result: t.result || []
  1331. }
  1332. }
  1333. function Pt() {
  1334. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
  1335. e = arguments.length > 1 ? arguments[1] : void 0,
  1336. i = e.calcParams,
  1337. a = e.plots,
  1338. n = e.precision,
  1339. r = e.shouldFormatBigNumber,
  1340. o = [],
  1341. s = "",
  1342. c = "";
  1343. return a.length > 0 && (s = e.name), i.length > 0 && (c = "(".concat(i.join(","), ")")), a.forEach((
  1344. function(e) {
  1345. var i = {};
  1346. if (F(e.title)) {
  1347. var a = t[e.key];
  1348. F(a) && (a = _t(a, n), r && (a = vt(a))), i.title = e.title, i.value = a
  1349. }
  1350. o.push(i)
  1351. })), {
  1352. values: o,
  1353. name: s,
  1354. calcParamText: c
  1355. }
  1356. }
  1357. var Et = function() {
  1358. function t(e) {
  1359. var i = e.id,
  1360. a = e.chartData,
  1361. n = e.xAxis,
  1362. r = e.yAxis;
  1363. m(this, t), this._id = i, this._chartData = a, this._xAxis = n, this._yAxis = r, this._styles =
  1364. null
  1365. }
  1366. return g(t, [{
  1367. key: "draw",
  1368. value: function(t) {}
  1369. }, {
  1370. key: "setStyles",
  1371. value: function(t, e) {
  1372. return !!O(t) && (this._styles || (this._styles = S(e)), T(this._styles, t),
  1373. !0)
  1374. }
  1375. }, {
  1376. key: "id",
  1377. value: function() {
  1378. return this._id
  1379. }
  1380. }, {
  1381. key: "styles",
  1382. value: function() {
  1383. return this._styles
  1384. }
  1385. }, {
  1386. key: "checkMousePointOnGraphic",
  1387. value: function(t) {}
  1388. }, {
  1389. key: "onClick",
  1390. value: function(t) {}
  1391. }, {
  1392. key: "onRightClick",
  1393. value: function(t) {}
  1394. }, {
  1395. key: "onMouseEnter",
  1396. value: function(t) {}
  1397. }, {
  1398. key: "onMouseLeave",
  1399. value: function(t) {}
  1400. }]), t
  1401. }();
  1402. function Ct(t, e, i, a) {
  1403. t.fillStyle = e, t.beginPath(), t.arc(i.x, i.y, a, 0, 2 * Math.PI), t.closePath(), t.fill()
  1404. }
  1405. function At(t, e, i) {
  1406. var a = Math.abs(e.x - t.x),
  1407. n = Math.abs(e.y - t.y),
  1408. r = Math.abs(i.x - t.x);
  1409. return Math.abs(a * Math.abs(i.y - t.y) - r * n) / 2
  1410. }
  1411. function Tt(t, e) {
  1412. var i = t.x - e.x;
  1413. if (0 !== i) {
  1414. var a = (t.y - e.y) / i;
  1415. return {
  1416. k: a,
  1417. b: t.y - a * t.x
  1418. }
  1419. }
  1420. }
  1421. function St(t, e, i) {
  1422. return It(Tt(t, e), i)
  1423. }
  1424. function It(t, e) {
  1425. return t ? e.x * t.k + t.b : e.y
  1426. }
  1427. function Lt(t, e, i) {
  1428. if (!i || !t || !e) return !1;
  1429. if (t.x === e.x) return 2 > Math.abs(i.x - t.x);
  1430. var a = Tt(t, e),
  1431. n = It(a, i),
  1432. r = Math.abs(n - i.y);
  1433. return 4 > r * r / (a.k * a.k + 1)
  1434. }
  1435. function Ot(t, e, i) {
  1436. return !!Lt(t, e, i) && (t.x === e.x ? e.y > t.y ? 2 > t.y - i.y : 2 > i.y - t.y : e.x > t.x ? 2 > t.x -
  1437. i.x : 2 > i.x - t.x)
  1438. }
  1439. function Rt(t, e, i) {
  1440. return !!Lt(t, e, i) && (t.x === e.x ? 4 > Math.abs(t.y - i.y) + Math.abs(e.y - i.y) - Math.abs(t.y - e
  1441. .y) : 4 > Math.abs(t.x - i.x) + Math.abs(e.x - i.x) - Math.abs(t.x - e.x))
  1442. }
  1443. function Ft(t, e, i) {
  1444. if (!i) return !1;
  1445. var a = i.x - t.x,
  1446. n = i.y - t.y;
  1447. return !(a * a + n * n > e * e)
  1448. }
  1449. function zt(t, e) {
  1450. var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
  1451. a = [];
  1452. if (t.length > 1)
  1453. if (t[0].x === t[1].x) {
  1454. var n = 0,
  1455. r = e.y;
  1456. if (a.push([{
  1457. x: t[0].x,
  1458. y: n
  1459. }, {
  1460. x: t[0].x,
  1461. y: r
  1462. }]), t.length > 2) {
  1463. a.push([{
  1464. x: t[2].x,
  1465. y: n
  1466. }, {
  1467. x: t[2].x,
  1468. y: r
  1469. }]);
  1470. for (var o = t[0].x - t[2].x, s = 0; i > s; s++) {
  1471. var c = o * (s + 1);
  1472. a.push([{
  1473. x: t[0].x + c,
  1474. y: n
  1475. }, {
  1476. x: t[0].x + c,
  1477. y: r
  1478. }])
  1479. }
  1480. }
  1481. } else {
  1482. var h = 0,
  1483. l = e.x,
  1484. u = Tt(t[0], t[1]),
  1485. d = u.k,
  1486. _ = u.b;
  1487. if (a.push([{
  1488. x: h,
  1489. y: h * d + _
  1490. }, {
  1491. x: l,
  1492. y: l * d + _
  1493. }]), t.length > 2) {
  1494. var v = t[2].y - d * t[2].x;
  1495. a.push([{
  1496. x: h,
  1497. y: h * d + v
  1498. }, {
  1499. x: l,
  1500. y: l * d + v
  1501. }]);
  1502. for (var f = _ - v, p = 0; i > p; p++) {
  1503. var y = _ + f * (p + 1);
  1504. a.push([{
  1505. x: h,
  1506. y: h * d + y
  1507. }, {
  1508. x: l,
  1509. y: l * d + y
  1510. }])
  1511. }
  1512. }
  1513. } return a
  1514. }
  1515. function Bt(t, e, i, a) {
  1516. t.beginPath();
  1517. var n = t.lineWidth % 2 ? .5 : 0;
  1518. t.moveTo(i, e + n), t.lineTo(a, e + n), t.stroke(), t.closePath()
  1519. }
  1520. function Vt(t, e, i, a) {
  1521. t.beginPath();
  1522. var n = t.lineWidth % 2 ? .5 : 0;
  1523. t.moveTo(e + n, i), t.lineTo(e + n, a), t.stroke(), t.closePath()
  1524. }
  1525. function Ht(t, e) {
  1526. t.save(), t.lineWidth % 2 && t.translate(.5, .5), e(), t.restore()
  1527. }
  1528. var Yt = "other",
  1529. Wt = "point",
  1530. Gt = "none",
  1531. Nt = "line",
  1532. Xt = "text",
  1533. jt = "continuous_line",
  1534. Zt = "polygon",
  1535. Ut = "arc",
  1536. Kt = "stroke",
  1537. qt = "fill",
  1538. $t = "dash",
  1539. Jt = 0,
  1540. Qt = 1,
  1541. te = 2;
  1542. var ee = function(t) {
  1543. D(i, t);
  1544. var e = P(i);
  1545. function i(t) {
  1546. var a, n = t.id,
  1547. r = t.name,
  1548. o = t.totalStep,
  1549. s = t.chartData,
  1550. c = t.xAxis,
  1551. h = t.yAxis,
  1552. l = t.points,
  1553. u = t.styles,
  1554. d = t.lock;
  1555. return m(this, i), (a = e.call(this, {
  1556. id: n,
  1557. chartData: s,
  1558. xAxis: c,
  1559. yAxis: h
  1560. }))._name = r, a._totalStep = o, a._lock = d, a._drawStep = 1, a._points = [], a.setPoints(
  1561. l), a.setStyles(u, s.styleOptions().graphicMark), a
  1562. }
  1563. return g(i, [{
  1564. key: "setPoints",
  1565. value: function(t) {
  1566. if (I(t) && t.length > 0) {
  1567. var e;
  1568. this._totalStep - 1 > t.length ? (this._drawStep = t.length + 1, this
  1569. ._points = S(t), e = t.length) : (this._drawStep = -1, this
  1570. ._points = t.slice(0, this._totalStep - 1), e = this
  1571. ._totalStep - 1);
  1572. for (var i = 0; e > i; i++) this.performMouseMoveForDrawing(i + 2, this
  1573. .points, this._points[i], this._xAxis, this._yAxis); - 1 === this
  1574. ._drawStep && this.performMousePressedMove(this._points, this
  1575. ._points.length - 1, this._points[this._points.length - 1], this
  1576. ._xAxis, this._yAxis)
  1577. }
  1578. }
  1579. }, {
  1580. key: "_timestampOrDataIndexToPointX",
  1581. value: function(t) {
  1582. var e = t.timestamp,
  1583. i = t.dataIndex;
  1584. return this._xAxis.convertToPixel(e ? this._chartData.timestampToDataIndex(
  1585. e) : i)
  1586. }
  1587. }, {
  1588. key: "_drawLines",
  1589. value: function(t, e, i, a) {
  1590. t.save(), t.strokeStyle = a.line.color, t.lineWidth = a.line.size, i ===
  1591. $t && t.setLineDash(a.line.dashValue), e.forEach((function(e) {
  1592. var i, a;
  1593. if (e.length > 1) switch ((i = e[0]).x === (a = e[1]).x ?
  1594. te : i.y === a.y ? Qt : Jt) {
  1595. case Jt:
  1596. Ht(t, (function() {
  1597. t.beginPath(), t.moveTo(e[0].x,
  1598. e[0].y), t.lineTo(e[1]
  1599. .x, e[1].y), t.stroke(),
  1600. t.closePath()
  1601. }));
  1602. break;
  1603. case Qt:
  1604. Bt(t, e[0].y, e[0].x, e[1].x);
  1605. break;
  1606. case te:
  1607. Vt(t, e[0].x, e[0].y, e[1].y)
  1608. }
  1609. })), t.restore()
  1610. }
  1611. }, {
  1612. key: "_drawContinuousLines",
  1613. value: function(t, e, i, a) {
  1614. t.save(), t.strokeStyle = a.line.color, t.lineWidth = a.line.size, i ===
  1615. $t && t.setLineDash(a.line.dashValue), e.forEach((function(e) {
  1616. e.length > 0 && Ht(t, (function() {
  1617. t.beginPath(), t.moveTo(e[0].x, e[0].y);
  1618. for (var i = 1; e.length > i; i++) t.lineTo(
  1619. e[i].x, e[i].y);
  1620. t.stroke(), t.closePath()
  1621. }))
  1622. })), t.restore()
  1623. }
  1624. }, {
  1625. key: "_drawPolygons",
  1626. value: function(t, e, i, a) {
  1627. var n;
  1628. t.save(), i === qt ? (t.fillStyle = a.polygon.fill.color, n = t.fill) : (t
  1629. .lineWidth = a.polygon.stroke.size, t.strokeStyle = a.polygon.stroke
  1630. .color, n = t.stroke), e.forEach((function(e) {
  1631. e.length > 0 && Ht(t, (function() {
  1632. t.beginPath(), t.moveTo(e[0].x, e[0].y);
  1633. for (var i = 1; e.length > i; i++) t.lineTo(
  1634. e[i].x, e[i].y);
  1635. t.closePath(), n.call(t)
  1636. }))
  1637. })), t.restore()
  1638. }
  1639. }, {
  1640. key: "_drawArcs",
  1641. value: function(t, e, i, a) {
  1642. t.save(), i === qt ? t.fillStyle = a.arc.fill.color : (t.lineWidth = a.arc
  1643. .stroke.size, t.strokeStyle = a.arc.stroke.color), e.forEach((
  1644. function(e) {
  1645. var a = e.x,
  1646. n = e.y,
  1647. r = e.radius,
  1648. o = e.startAngle,
  1649. s = e.endAngle;
  1650. t.beginPath(), t.arc(a, n, r, o, s), i === qt ? (t
  1651. .closePath(), t.fill()) : (t.stroke(), t
  1652. .closePath())
  1653. })), t.restore()
  1654. }
  1655. }, {
  1656. key: "_drawText",
  1657. value: function(t, e, i, a) {
  1658. var n;
  1659. t.save(), i === Kt ? (t.strokeStyle = a.text.color, n = t.strokeText) : (t
  1660. .fillStyle = a.text.color, n = t.fillText), t.font = "".concat(a
  1661. .text.weight, " ").concat(a.text.size, "px ").concat(a.text.family),
  1662. e.forEach((function(e) {
  1663. n.call(t, e.text, e.x + a.text.marginLeft, e.y - a.text
  1664. .marginBottom)
  1665. })), t.restore()
  1666. }
  1667. }, {
  1668. key: "draw",
  1669. value: function(t) {
  1670. var e = this,
  1671. i = this._points.map((function(t) {
  1672. var i = t.price;
  1673. return {
  1674. x: e._timestampOrDataIndexToPointX({
  1675. timestamp: t.timestamp,
  1676. dataIndex: t.dataIndex
  1677. }),
  1678. y: e._yAxis.convertToPixel(i)
  1679. }
  1680. })),
  1681. a = this._styles || this._chartData.styleOptions().graphicMark;
  1682. if (1 !== this._drawStep && i.length > 0) {
  1683. var n = {
  1684. width: this._xAxis.width(),
  1685. height: this._yAxis.height()
  1686. },
  1687. r = {
  1688. price: this._chartData.pricePrecision(),
  1689. volume: this._chartData.volumePrecision()
  1690. },
  1691. o = this.createGraphicDataSource(this._drawStep, this._points, i, n,
  1692. r, this._xAxis, this._yAxis) || [];
  1693. o.forEach((function(i) {
  1694. var n = i.type,
  1695. r = i.isDraw,
  1696. o = i.style,
  1697. s = i.dataSource,
  1698. c = void 0 === s ? [] : s;
  1699. if (!F(r) || r) switch (n) {
  1700. case Nt:
  1701. e._drawLines(t, c, o, a);
  1702. break;
  1703. case jt:
  1704. e._drawContinuousLines(t, c, o, a);
  1705. break;
  1706. case Zt:
  1707. e._drawPolygons(t, c, o, a);
  1708. break;
  1709. case Ut:
  1710. e._drawArcs(t, c, o, a);
  1711. break;
  1712. case Xt:
  1713. e._drawText(t, c, o, a)
  1714. }
  1715. })), this.drawExtend && (t.save(), this.drawExtend(t, o, a, n, r,
  1716. this._xAxis, this._yAxis), t.restore())
  1717. }
  1718. var s = this._chartData.graphicMarkMouseOperate();
  1719. (s.hover.id === this._id && s.hover.element !== Gt || s.click.id === this
  1720. ._id && s.click.element !== Gt) && i.forEach((function(i, n) {
  1721. var r = i.x,
  1722. o = i.y,
  1723. c = a.point.radius,
  1724. h = a.point.backgroundColor,
  1725. l = a.point.borderColor,
  1726. u = a.point.borderSize;
  1727. s.hover.id === e._id && s.hover.element === Wt && n === s
  1728. .hover.elementIndex && (c = a.point.activeRadius, h = a
  1729. .point.activeBackgroundColor, l = a.point
  1730. .activeBorderColor, u = a.point.activeBorderSize),
  1731. Ct(t, l, {
  1732. x: r,
  1733. y: o
  1734. }, c + u), Ct(t, h, {
  1735. x: r,
  1736. y: o
  1737. }, c)
  1738. }))
  1739. }
  1740. }, {
  1741. key: "setLock",
  1742. value: function(t) {
  1743. this._lock = t
  1744. }
  1745. }, {
  1746. key: "name",
  1747. value: function() {
  1748. return this._name
  1749. }
  1750. }, {
  1751. key: "lock",
  1752. value: function() {
  1753. return this._lock
  1754. }
  1755. }, {
  1756. key: "totalStep",
  1757. value: function() {
  1758. return this._totalStep
  1759. }
  1760. }, {
  1761. key: "points",
  1762. value: function() {
  1763. return this._points
  1764. }
  1765. }, {
  1766. key: "isDrawing",
  1767. value: function() {
  1768. return -1 !== this._drawStep
  1769. }
  1770. }, {
  1771. key: "checkMousePointOnGraphic",
  1772. value: function(t) {
  1773. for (var e = this._styles || this._chartData.styleOptions().graphicMark,
  1774. i = [], a = 0; this._points.length > a; a++) {
  1775. var n = this._points[a],
  1776. r = n.price,
  1777. o = {
  1778. x: this._timestampOrDataIndexToPointX({
  1779. timestamp: n.timestamp,
  1780. dataIndex: n.dataIndex
  1781. }),
  1782. y: this._yAxis.convertToPixel(r)
  1783. };
  1784. if (i.push(o), Ft(o, e.point.radius, t)) return {
  1785. id: this._id,
  1786. element: Wt,
  1787. elementIndex: a,
  1788. instance: this
  1789. }
  1790. }
  1791. var s, c = A(this.createGraphicDataSource(this._drawStep, this._points, i, {
  1792. width: this._xAxis.width(),
  1793. height: this._yAxis.height()
  1794. }, {
  1795. price: this._chartData.pricePrecision(),
  1796. volume: this._chartData.volumePrecision()
  1797. }, this._xAxis, this._yAxis) || []);
  1798. try {
  1799. for (c.s(); !(s = c.n()).done;) {
  1800. var h = s.value,
  1801. l = h.key,
  1802. u = h.type,
  1803. d = h.dataSource,
  1804. _ = void 0 === d ? [] : d;
  1805. if (h.isCheck)
  1806. for (var v = 0; _.length > v; v++) {
  1807. if (this.checkMousePointOn(l, u, _[v], t)) return {
  1808. id: this._id,
  1809. element: Yt,
  1810. elementIndex: v,
  1811. instance: this
  1812. }
  1813. }
  1814. }
  1815. } catch (t) {
  1816. c.e(t)
  1817. } finally {
  1818. c.f()
  1819. }
  1820. }
  1821. }, {
  1822. key: "mouseMoveForDrawing",
  1823. value: function(t) {
  1824. var e = this._xAxis.convertFromPixel(t.x),
  1825. i = this._chartData.dataIndexToTimestamp(e),
  1826. a = this._yAxis.convertFromPixel(t.y);
  1827. this._points[this._drawStep - 1] = {
  1828. timestamp: i,
  1829. price: a,
  1830. dataIndex: e
  1831. }, this.performMouseMoveForDrawing(this._drawStep, this._points, {
  1832. timestamp: i,
  1833. price: a,
  1834. dataIndex: e
  1835. }, this._xAxis, this._yAxis), this.onDrawing({
  1836. id: this._id,
  1837. step: this._drawStep,
  1838. points: this._points
  1839. })
  1840. }
  1841. }, {
  1842. key: "mouseLeftButtonDownForDrawing",
  1843. value: function() {
  1844. this._drawStep === this._totalStep - 1 ? (this._drawStep = -1, this
  1845. .onDrawEnd({
  1846. id: this._id,
  1847. points: this._points
  1848. })) : this._drawStep++
  1849. }
  1850. }, {
  1851. key: "mousePressedMove",
  1852. value: function(t, e) {
  1853. var i = this._chartData.graphicMarkMouseOperate(),
  1854. a = i.click.elementIndex;
  1855. if (!this._lock && i.click.id === this._id && i.click.element === Wt && -
  1856. 1 !== a) {
  1857. var n = this._xAxis.convertFromPixel(t.x),
  1858. r = this._chartData.dataIndexToTimestamp(n),
  1859. o = this._yAxis.convertFromPixel(t.y);
  1860. this._points[a].timestamp = r, this._points[a].dataIndex = n, this
  1861. ._points[a].price = o, this.performMousePressedMove(this._points,
  1862. a, {
  1863. dataIndex: n,
  1864. timestamp: r,
  1865. price: o
  1866. }, this._xAxis, this._yAxis), this.onPressedMove({
  1867. id: i.click.id,
  1868. points: this._points,
  1869. event: e
  1870. })
  1871. }
  1872. }
  1873. }, {
  1874. key: "onDrawStart",
  1875. value: function(t) {}
  1876. }, {
  1877. key: "onDrawing",
  1878. value: function(t) {}
  1879. }, {
  1880. key: "onDrawEnd",
  1881. value: function(t) {}
  1882. }, {
  1883. key: "onPressedMove",
  1884. value: function(t) {}
  1885. }, {
  1886. key: "onRemove",
  1887. value: function(t) {}
  1888. }, {
  1889. key: "checkMousePointOn",
  1890. value: function(t, e, i, a) {}
  1891. }, {
  1892. key: "createGraphicDataSource",
  1893. value: function(t, e, i, a, n, r, o) {}
  1894. }, {
  1895. key: "performMouseMoveForDrawing",
  1896. value: function(t, e, i, a, n) {}
  1897. }, {
  1898. key: "performMousePressedMove",
  1899. value: function(t, e, i, a, n) {}
  1900. }]), i
  1901. }(Et),
  1902. ie = function() {
  1903. function t() {
  1904. m(this, t), this._observers = []
  1905. }
  1906. return g(t, [{
  1907. key: "subscribe",
  1908. value: function(t) {
  1909. 0 > this._observers.indexOf(t) && this._observers.push(t)
  1910. }
  1911. }, {
  1912. key: "unsubscribe",
  1913. value: function(t) {
  1914. var e = this._observers.indexOf(t);
  1915. e > -1 ? this._observers.splice(e, 1) : this._observers = []
  1916. }
  1917. }, {
  1918. key: "execute",
  1919. value: function(t) {
  1920. this._observers.forEach((function(e) {
  1921. e(t)
  1922. }))
  1923. }
  1924. }, {
  1925. key: "hasObservers",
  1926. value: function() {
  1927. return this._observers.length > 0
  1928. }
  1929. }]), t
  1930. }();
  1931. function ae(t) {
  1932. var e = t.name,
  1933. i = t.totalStep,
  1934. a = t.checkMousePointOn,
  1935. n = t.createGraphicDataSource,
  1936. r = t.performMousePressedMove,
  1937. o = t.performMouseMoveForDrawing,
  1938. s = t.drawExtend;
  1939. if (!(e && R(i) && L(a) && L(n))) return null;
  1940. var c = function(t) {
  1941. D(n, t);
  1942. var a = P(n);
  1943. function n(t) {
  1944. var r = t.id,
  1945. o = t.chartData,
  1946. s = t.xAxis,
  1947. c = t.yAxis,
  1948. h = t.points,
  1949. l = t.styles,
  1950. u = t.lock;
  1951. return m(this, n), a.call(this, {
  1952. id: r,
  1953. name: e,
  1954. totalStep: i,
  1955. chartData: o,
  1956. xAxis: s,
  1957. yAxis: c,
  1958. points: h,
  1959. styles: l,
  1960. lock: u
  1961. })
  1962. }
  1963. return n
  1964. }(ee);
  1965. return c.prototype.checkMousePointOn = a, c.prototype.createGraphicDataSource = n, L(r) && (c.prototype
  1966. .performMousePressedMove = r), L(o) && (c.prototype.performMouseMoveForDrawing = o), L(s) && (c
  1967. .prototype.drawExtend = s), c
  1968. }
  1969. function ne(t) {
  1970. return {
  1971. name: t.name(),
  1972. id: t.id(),
  1973. totalStep: t.totalStep(),
  1974. lock: t.lock(),
  1975. points: t.tpPoints(),
  1976. styles: t.styles()
  1977. }
  1978. }
  1979. var re = "technical_indicator_pane_",
  1980. oe = "graphic_mark_",
  1981. se = "candle_pane",
  1982. ce = 1,
  1983. he = 2,
  1984. le = 3,
  1985. ue = {
  1986. DRAW_CANDLE: "drawCandle",
  1987. DRAW_TECHNICAL_INDICATOR: "drawTechnicalIndicator",
  1988. ZOOM: "zoom",
  1989. SCROLL: "scroll",
  1990. CROSSHAIR: "crosshair",
  1991. PANE_DRAG: "pane_drag"
  1992. },
  1993. de = function() {
  1994. function t(e, i) {
  1995. m(this, t), this._handler = i, this._styleOptions = S(lt), T(this._styleOptions, e), this
  1996. ._technicalIndicatorMapping = function() {
  1997. var t = {},
  1998. e = v.technicalIndicatorExtensions;
  1999. for (var i in e) {
  2000. var a = bt(e[i]);
  2001. a && (t[i] = a)
  2002. }
  2003. return t
  2004. }(), this._zoomEnabled = !0, this._scrollEnabled = !0, this._pricePrecision = 2, this
  2005. ._volumePrecision = 0, this._dateTimeFormat = new Intl.DateTimeFormat("en", {
  2006. hour12: !1,
  2007. year: "numeric",
  2008. month: "2-digit",
  2009. day: "2-digit",
  2010. hour: "2-digit",
  2011. minute: "2-digit"
  2012. }), this._dataList = [], this._visibleDataList = [], this._loading = !0, this
  2013. ._loadMoreCallback = null, this._more = !0, this._totalDataSpace = 0, this._dataSpace = 6,
  2014. this._barSpace = this._calcBarSpace(), this._offsetRightSpace = 50, this
  2015. ._offsetRightBarCount = this._offsetRightSpace / this._dataSpace, this
  2016. ._leftMinVisibleBarCount = 2, this._rightMinVisibleBarCount = 2, this._from = 0, this._to =
  2017. 0, this._crosshair = {}, this._preOffsetRightBarCount = 0, this._dragGraphicMarkFlag = !1,
  2018. this._graphicMarkMapping = function() {
  2019. var t = {},
  2020. e = v.graphicMarkExtensions;
  2021. for (var i in e) {
  2022. var a = ae(e[i]);
  2023. a && (t[i] = a)
  2024. }
  2025. return t
  2026. }(), this._graphicMarkMouseOperate = {
  2027. click: {
  2028. id: "",
  2029. element: Gt,
  2030. elementIndex: -1
  2031. },
  2032. hover: {
  2033. id: "",
  2034. element: Gt,
  2035. elementIndex: -1
  2036. }
  2037. }, this._graphicMarks = [], this._annotations = new Map, this._visibleAnnotations = [], this
  2038. ._annotationMouseOperate = {
  2039. id: ""
  2040. }, this._tags = new Map, this._dragPaneFlag = !1, this._actionDelegate = new Map
  2041. }
  2042. return g(t, [{
  2043. key: "_calcBarSpace",
  2044. value: function() {
  2045. return Math.max(1, Math.min(Math.floor(.8 * this._dataSpace), Math.floor(
  2046. this._dataSpace) - 1))
  2047. }
  2048. }, {
  2049. key: "_adjustVisibleDataList",
  2050. value: function() {
  2051. var t = this._dataList.length;
  2052. this._visibleDataList = [], this._visibleAnnotations = [];
  2053. for (var e = this._from; this._to > e; e++) {
  2054. var i = this._dataList[e],
  2055. a = this._totalDataSpace - (t + this._offsetRightBarCount - e -
  2056. .5) * this._dataSpace;
  2057. this._visibleDataList.push({
  2058. index: e,
  2059. x: a,
  2060. data: i
  2061. });
  2062. var n = this._annotations.get(i.timestamp) || [];
  2063. if (n.length > 0) {
  2064. var r, o = A(n);
  2065. try {
  2066. for (o.s(); !(r = o.n()).done;) {
  2067. var s = r.value;
  2068. s.createSymbolCoordinate(a), this._visibleAnnotations.push(
  2069. s)
  2070. }
  2071. } catch (t) {
  2072. o.e(t)
  2073. } finally {
  2074. o.f()
  2075. }
  2076. }
  2077. }
  2078. }
  2079. }, {
  2080. key: "_adjustFromTo",
  2081. value: function() {
  2082. var t = this._dataList.length,
  2083. e = this._totalDataSpace / this._dataSpace,
  2084. i = e - Math.min(this._leftMinVisibleBarCount, t);
  2085. this._offsetRightBarCount > i && (this._offsetRightBarCount = i);
  2086. var a = -t + Math.min(this._rightMinVisibleBarCount, t);
  2087. a > this._offsetRightBarCount && (this._offsetRightBarCount = a), this._to =
  2088. Math.round(this._offsetRightBarCount + t + .5), this._from = Math.round(
  2089. this._to - e) - 1, this._to > t && (this._to = t), 0 > this._from &&
  2090. (this._from = 0), this._adjustVisibleDataList(), 0 === this._from &&
  2091. this._more && !this._loading && this._loadMoreCallback && L(this
  2092. ._loadMoreCallback) && (this._loading = !0, this._loadMoreCallback(
  2093. ut(this._dataList[0], "timestamp")))
  2094. }
  2095. }, {
  2096. key: "styleOptions",
  2097. value: function() {
  2098. return this._styleOptions
  2099. }
  2100. }, {
  2101. key: "applyStyleOptions",
  2102. value: function(t) {
  2103. T(this._styleOptions, t)
  2104. }
  2105. }, {
  2106. key: "getTechnicalIndicatorInfo",
  2107. value: function(t) {
  2108. if (!F(t)) {
  2109. var e = {};
  2110. for (var i in this._technicalIndicatorMapping) {
  2111. e[i] = Mt(this._technicalIndicatorMapping[i])
  2112. }
  2113. return e
  2114. }
  2115. var a = this.getTechnicalIndicatorInstance(t);
  2116. return a ? Mt(a) : {}
  2117. }
  2118. }, {
  2119. key: "getTechnicalIndicatorInstance",
  2120. value: function(t) {
  2121. return this._technicalIndicatorMapping[t]
  2122. }
  2123. }, {
  2124. key: "pricePrecision",
  2125. value: function() {
  2126. return this._pricePrecision
  2127. }
  2128. }, {
  2129. key: "volumePrecision",
  2130. value: function() {
  2131. return this._volumePrecision
  2132. }
  2133. }, {
  2134. key: "dateTimeFormat",
  2135. value: function() {
  2136. return this._dateTimeFormat
  2137. }
  2138. }, {
  2139. key: "setTimezone",
  2140. value: function(t) {
  2141. var e;
  2142. try {
  2143. e = new Intl.DateTimeFormat("en", {
  2144. hour12: !1,
  2145. timeZone: t,
  2146. year: "numeric",
  2147. month: "2-digit",
  2148. day: "2-digit",
  2149. hour: "2-digit",
  2150. minute: "2-digit"
  2151. })
  2152. } catch (t) {}
  2153. e && (this._dateTimeFormat = e)
  2154. }
  2155. }, {
  2156. key: "timezone",
  2157. value: function() {
  2158. return this._dateTimeFormat.resolvedOptions().timeZone
  2159. }
  2160. }, {
  2161. key: "setPriceVolumePrecision",
  2162. value: function(t, e) {
  2163. for (var i in this._pricePrecision = t, this._volumePrecision = e, this
  2164. ._technicalIndicatorMapping) {
  2165. switch (this._technicalIndicatorMapping[i].series) {
  2166. case mt:
  2167. this._technicalIndicatorMapping[i].setPrecision(t);
  2168. break;
  2169. case xt:
  2170. this._technicalIndicatorMapping[i].setPrecision(e)
  2171. }
  2172. }
  2173. }
  2174. }, {
  2175. key: "dataList",
  2176. value: function() {
  2177. return this._dataList
  2178. }
  2179. }, {
  2180. key: "visibleDataList",
  2181. value: function() {
  2182. return this._visibleDataList
  2183. }
  2184. }, {
  2185. key: "clearDataList",
  2186. value: function() {
  2187. this._more = !0, this._loading = !0, this._dataList = [], this
  2188. ._visibleDataList = [], this._from = 0, this._to = 0
  2189. }
  2190. }, {
  2191. key: "addData",
  2192. value: function(t, e, i) {
  2193. if (O(t)) {
  2194. if (I(t)) {
  2195. this._loading = !1, this._more = !z(i) || i;
  2196. var a = 0 === this._dataList.length;
  2197. this._dataList = t.concat(this._dataList), a && this
  2198. .setOffsetRightSpace(this._offsetRightSpace), this
  2199. ._adjustFromTo()
  2200. } else {
  2201. this._dataList.length > e ? (this._dataList[e] = t, this
  2202. ._adjustVisibleDataList()) : (this._dataList.push(t), 0 >
  2203. this._offsetRightBarCount && (this._offsetRightBarCount -=
  2204. 1), this._adjustFromTo())
  2205. }
  2206. this.setCrosshair(this._crosshair, !0)
  2207. }
  2208. }
  2209. }, {
  2210. key: "dataSpace",
  2211. value: function() {
  2212. return this._dataSpace
  2213. }
  2214. }, {
  2215. key: "barSpace",
  2216. value: function() {
  2217. return this._barSpace
  2218. }
  2219. }, {
  2220. key: "setDataSpace",
  2221. value: function(t, e) {
  2222. 1 > t || t > 50 || this._dataSpace === t || (this._dataSpace = t, this
  2223. ._barSpace = this._calcBarSpace(), e && e(), this._adjustFromTo(),
  2224. this.setCrosshair(this._crosshair, !0), this.invalidate())
  2225. }
  2226. }, {
  2227. key: "setTotalDataSpace",
  2228. value: function(t) {
  2229. this._totalDataSpace !== t && (this._totalDataSpace = t, this
  2230. ._adjustFromTo(), this.setCrosshair(this._crosshair, !0))
  2231. }
  2232. }, {
  2233. key: "setOffsetRightSpace",
  2234. value: function(t, e) {
  2235. this._offsetRightSpace = t, this._offsetRightBarCount = t / this._dataSpace,
  2236. e && (this._adjustFromTo(), this.setCrosshair(this._crosshair, !0), this
  2237. .invalidate())
  2238. }
  2239. }, {
  2240. key: "offsetRightSpace",
  2241. value: function() {
  2242. return this._offsetRightSpace
  2243. }
  2244. }, {
  2245. key: "offsetRightBarCount",
  2246. value: function() {
  2247. return this._offsetRightBarCount
  2248. }
  2249. }, {
  2250. key: "setLeftMinVisibleBarCount",
  2251. value: function(t) {
  2252. this._leftMinVisibleBarCount = t
  2253. }
  2254. }, {
  2255. key: "setRightMinVisibleBarCount",
  2256. value: function(t) {
  2257. this._rightMinVisibleBarCount = t
  2258. }
  2259. }, {
  2260. key: "from",
  2261. value: function() {
  2262. return this._from
  2263. }
  2264. }, {
  2265. key: "to",
  2266. value: function() {
  2267. return this._to
  2268. }
  2269. }, {
  2270. key: "crosshair",
  2271. value: function() {
  2272. return this._crosshair
  2273. }
  2274. }, {
  2275. key: "setCrosshair",
  2276. value: function(t, e) {
  2277. var i, a, n = t || {};
  2278. a = F(n.x) ? 0 > (i = this.coordinateToDataIndex(n.x)) ? 0 : i > this
  2279. ._dataList.length - 1 ? this._dataList.length - 1 : i : i = this
  2280. ._dataList.length - 1;
  2281. var r = this._dataList[a],
  2282. o = this.dataIndexToCoordinate(i),
  2283. s = this._crosshair.x,
  2284. c = this._crosshair.y,
  2285. h = this._crosshair.paneId;
  2286. this._crosshair = p(p({}, n), {}, {
  2287. realX: o,
  2288. kLineData: r,
  2289. realDataIndex: i,
  2290. dataIndex: a
  2291. }), n.paneId && r && this._handler.crosshair({
  2292. realDataIndex: i,
  2293. dataIndex: a,
  2294. kLineData: r,
  2295. x: n.x,
  2296. y: n.y
  2297. }), s === n.x && c === n.y && h === n.paneId || e || this.invalidate(ce)
  2298. }
  2299. }, {
  2300. key: "startScroll",
  2301. value: function() {
  2302. this._preOffsetRightBarCount = this._offsetRightBarCount
  2303. }
  2304. }, {
  2305. key: "scroll",
  2306. value: function(t, e) {
  2307. if (this._scrollEnabled) {
  2308. var i = t / this._dataSpace;
  2309. this.actionExecute(ue.SCROLL, {
  2310. barCount: i,
  2311. distance: t
  2312. }), this._offsetRightBarCount = this._preOffsetRightBarCount - i,
  2313. this._adjustFromTo(), this.setCrosshair(e || this._crosshair, !0),
  2314. this.invalidate()
  2315. }
  2316. }
  2317. }, {
  2318. key: "coordinateToFloatIndex",
  2319. value: function(t) {
  2320. return Math.round(1e6 * (this._dataList.length + this._offsetRightBarCount -
  2321. (this._totalDataSpace - t) / this._dataSpace)) / 1e6
  2322. }
  2323. }, {
  2324. key: "dataIndexToTimestamp",
  2325. value: function(t) {
  2326. var e = this._dataList[t];
  2327. if (e) return e.timestamp
  2328. }
  2329. }, {
  2330. key: "timestampToDataIndex",
  2331. value: function(t) {
  2332. return 0 === this._dataList.length ? 0 : function(t, e, i) {
  2333. var a = 0,
  2334. n = 0;
  2335. for (n = t.length - 1; a !== n;) {
  2336. var r = Math.floor((n + a) / 2),
  2337. o = n - a,
  2338. s = t[r][e];
  2339. if (i === t[a][e]) return a;
  2340. if (i === t[n][e]) return n;
  2341. if (i === s) return r;
  2342. if (i > s ? a = r : n = r, 2 >= o) break
  2343. }
  2344. return a
  2345. }(this._dataList, "timestamp", t)
  2346. }
  2347. }, {
  2348. key: "dataIndexToCoordinate",
  2349. value: function(t) {
  2350. return this._totalDataSpace - (this._dataList.length + this
  2351. ._offsetRightBarCount - t - .5) * this._dataSpace
  2352. }
  2353. }, {
  2354. key: "coordinateToDataIndex",
  2355. value: function(t) {
  2356. return Math.ceil(this.coordinateToFloatIndex(t)) - 1
  2357. }
  2358. }, {
  2359. key: "zoom",
  2360. value: function(t, e) {
  2361. var i = this;
  2362. if (this._zoomEnabled) {
  2363. e && F(e.x) || (e = {
  2364. x: F(this._crosshair.x) ? this._crosshair.x : this
  2365. ._totalDataSpace / 2
  2366. }), this.actionExecute(ue.ZOOM, {
  2367. point: e,
  2368. scale: t
  2369. });
  2370. var a = this.coordinateToFloatIndex(e.x);
  2371. this.setDataSpace(this._dataSpace + t * (this._dataSpace / 10), (
  2372. function() {
  2373. i._offsetRightBarCount += a - i.coordinateToFloatIndex(e
  2374. .x)
  2375. }))
  2376. }
  2377. }
  2378. }, {
  2379. key: "invalidate",
  2380. value: function(t) {
  2381. this._handler.invalidate(t)
  2382. }
  2383. }, {
  2384. key: "setZoomEnabled",
  2385. value: function(t) {
  2386. this._zoomEnabled = t
  2387. }
  2388. }, {
  2389. key: "zoomEnabled",
  2390. value: function() {
  2391. return this._zoomEnabled
  2392. }
  2393. }, {
  2394. key: "setScrollEnabled",
  2395. value: function(t) {
  2396. this._scrollEnabled = t
  2397. }
  2398. }, {
  2399. key: "scrollEnabled",
  2400. value: function() {
  2401. return this._scrollEnabled
  2402. }
  2403. }, {
  2404. key: "setLoadMoreCallback",
  2405. value: function(t) {
  2406. this._loadMoreCallback = t
  2407. }
  2408. }, {
  2409. key: "addGraphicMarkInstance",
  2410. value: function(t) {
  2411. if (this._graphicMarks.find((function(e) {
  2412. return e.id() === t.id()
  2413. }))) return !1;
  2414. var e = this._graphicMarks[this._graphicMarks.length - 1];
  2415. return e && e.isDrawing() ? this._graphicMarks[this._graphicMarks.length -
  2416. 1] = t : this._graphicMarks.push(t), this.invalidate(ce), !0
  2417. }
  2418. }, {
  2419. key: "addCustomGraphicMark",
  2420. value: function(t) {
  2421. var e = this;
  2422. t.forEach((function(t) {
  2423. var i = ae(t);
  2424. i && (e._graphicMarkMapping[t.name] = i)
  2425. }))
  2426. }
  2427. }, {
  2428. key: "setGraphicMarkOptions",
  2429. value: function(t) {
  2430. var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
  2431. i = e.styles,
  2432. a = e.lock,
  2433. n = this._graphicMarks.find((function(e) {
  2434. return e.id() === t
  2435. }));
  2436. n && (n.setLock(a), n.setStyles(i, this._styleOptions.graphicMark) && this
  2437. .invalidate(ce))
  2438. }
  2439. }, {
  2440. key: "getGraphicMark",
  2441. value: function(t) {
  2442. if (!t) return this._graphicMarks.map((function(t) {
  2443. return ne(t)
  2444. }));
  2445. var e = this._graphicMarks.find((function(e) {
  2446. return e.id() === t
  2447. }));
  2448. return e ? ne(e) : null
  2449. }
  2450. }, {
  2451. key: "removeGraphicMarkInstance",
  2452. value: function(t) {
  2453. var e = this._graphicMarks;
  2454. if (F(t)) {
  2455. var i = e.findIndex((function(e) {
  2456. return e.id() === t
  2457. }));
  2458. i > -1 && (e[i].onRemove({
  2459. id: e[i].id()
  2460. }), e.splice(i, 1), this.invalidate(ce))
  2461. } else e.length > 0 && (e.forEach((function(t) {
  2462. t.onRemove({
  2463. id: t.id()
  2464. })
  2465. })), this._graphicMarks = [], this.invalidate(ce))
  2466. }
  2467. }, {
  2468. key: "dragGraphicMarkFlag",
  2469. value: function() {
  2470. return this._dragGraphicMarkFlag
  2471. }
  2472. }, {
  2473. key: "setDragGraphicMarkFlag",
  2474. value: function(t) {
  2475. this._dragGraphicMarkFlag = t
  2476. }
  2477. }, {
  2478. key: "graphicMarkMouseOperate",
  2479. value: function() {
  2480. return this._graphicMarkMouseOperate
  2481. }
  2482. }, {
  2483. key: "dragPaneFlag",
  2484. value: function() {
  2485. return this._dragPaneFlag
  2486. }
  2487. }, {
  2488. key: "setDragPaneFlag",
  2489. value: function(t) {
  2490. this._dragPaneFlag = t
  2491. }
  2492. }, {
  2493. key: "graphicMarkMapping",
  2494. value: function() {
  2495. return this._graphicMarkMapping
  2496. }
  2497. }, {
  2498. key: "graphicMarks",
  2499. value: function() {
  2500. return this._graphicMarks
  2501. }
  2502. }, {
  2503. key: "visibleAnnotations",
  2504. value: function() {
  2505. return this._visibleAnnotations
  2506. }
  2507. }, {
  2508. key: "annotationMouseOperate",
  2509. value: function() {
  2510. return this._annotationMouseOperate
  2511. }
  2512. }, {
  2513. key: "addAnnotations",
  2514. value: function(t) {
  2515. var e = this;
  2516. t.forEach((function(t) {
  2517. e._annotations.has(t.id()) ? e._annotations.get(t.id())
  2518. .push(t) : e._annotations.set(t.id(), [t])
  2519. })), this._adjustVisibleDataList(), this.invalidate(ce)
  2520. }
  2521. }, {
  2522. key: "removeAnnotation",
  2523. value: function(t) {
  2524. var e = this,
  2525. i = !1;
  2526. F(t) ? ([].concat(t).forEach((function(t) {
  2527. var a = t.timestamp;
  2528. e._annotations.has(a) && (i = !0, e._annotations.delete(
  2529. a))
  2530. })), i && this._adjustVisibleDataList()) : (i = !0, this._annotations
  2531. .clear(), this._visibleAnnotations = []), i && this.invalidate(ce)
  2532. }
  2533. }, {
  2534. key: "tags",
  2535. value: function() {
  2536. return this._tags
  2537. }
  2538. }, {
  2539. key: "getTag",
  2540. value: function(t) {
  2541. return this._tags.get(t)
  2542. }
  2543. }, {
  2544. key: "addTags",
  2545. value: function(t) {
  2546. var e = this;
  2547. t.forEach((function(t) {
  2548. e._tags.set(t.id(), t)
  2549. })), this.invalidate(ce)
  2550. }
  2551. }, {
  2552. key: "removeTag",
  2553. value: function(t) {
  2554. var e = this,
  2555. i = !1;
  2556. F(t) ? [].concat(t).forEach((function(t) {
  2557. e._tags.has(t) && (i = !0, e._tags.delete(t))
  2558. })) : (i = !0, this._tags.clear());
  2559. i && this.invalidate(ce)
  2560. }
  2561. }, {
  2562. key: "setOverlayMouseOperate",
  2563. value: function(t, e) {
  2564. var i = this._graphicMarkMouseOperate,
  2565. a = i.hover,
  2566. n = i.click,
  2567. r = this._annotationMouseOperate.id,
  2568. o = this._graphicMarks[this._graphicMarks.length - 1],
  2569. s = !1;
  2570. !t.hover || a.id === t.hover.id && a.element === t.hover.element && a
  2571. .elementIndex === t.hover.elementIndex || (this._graphicMarkMouseOperate
  2572. .hover = p({}, t.hover), s = !0), !t.click || n.id === t.click.id &&
  2573. n.element === t.click.element && n.elementIndex === t.click
  2574. .elementIndex || (this._graphicMarkMouseOperate.click = p({}, t.click),
  2575. s = !0), e && r !== e.id && (this._annotationMouseOperate = p({},
  2576. e), s = !0), (s || o && o.isDrawing()) && this.invalidate(ce)
  2577. }
  2578. }, {
  2579. key: "addCustomTechnicalIndicator",
  2580. value: function(t) {
  2581. var e = this;
  2582. t.forEach((function(t) {
  2583. var i = bt(t || {});
  2584. i && (e._technicalIndicatorMapping[i.name] = i)
  2585. }))
  2586. }
  2587. }, {
  2588. key: "actionExecute",
  2589. value: function(t, e, i, a) {
  2590. this.hasAction(t) && (i && i(), this._actionDelegate.get(t).execute(e), a &&
  2591. a())
  2592. }
  2593. }, {
  2594. key: "hasAction",
  2595. value: function(t) {
  2596. return this._actionDelegate.has(t) && this._actionDelegate.get(t)
  2597. .hasObservers()
  2598. }
  2599. }, {
  2600. key: "subscribeAction",
  2601. value: function(t, e) {
  2602. return Object.values(ue).indexOf(t) >= 0 && (this._actionDelegate.has(t) ||
  2603. this._actionDelegate.set(t, new ie), this._actionDelegate.get(t)
  2604. .subscribe(e), !0)
  2605. }
  2606. }, {
  2607. key: "unsubscribeAction",
  2608. value: function(t, e) {
  2609. if (0 > Object.values(ue).indexOf(t)) return !1;
  2610. if (this._actionDelegate.has(t)) {
  2611. var i = this._actionDelegate.get(t);
  2612. return i.unsubscribe(e), i.hasObservers() || this._actionDelegate
  2613. .delete(t), !0
  2614. }
  2615. return !1
  2616. }
  2617. }]), t
  2618. }();
  2619. function _e(t) {
  2620. return t.ownerDocument && t.ownerDocument.defaultView && t.ownerDocument.defaultView.devicePixelRatio ||
  2621. 2
  2622. }
  2623. function ve(t, e) {
  2624. return Math.round(t.measureText(e).width)
  2625. }
  2626. function fe() {
  2627. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 12,
  2628. e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "normal",
  2629. i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "Helvetica Neue";
  2630. return "".concat(e, " ").concat(t, "px ").concat(i)
  2631. }
  2632. var pe = function() {
  2633. function t(e) {
  2634. m(this, t), this._height = -1, this._container = e.container, this._chartData = e.chartData,
  2635. this._initBefore(e), this._initElement(), this._mainWidget = this._createMainWidget(this
  2636. ._element, e), this._yAxisWidget = this._createYAxisWidget(this._element, e)
  2637. }
  2638. return g(t, [{
  2639. key: "_initBefore",
  2640. value: function(t) {}
  2641. }, {
  2642. key: "_initElement",
  2643. value: function() {
  2644. this._element = document.createElement("div"), this._element.style.margin =
  2645. "0", this._element.style.padding = "0", this._element.style.position =
  2646. "relative", this._element.style.overflow = "hidden", this._element.style
  2647. .width = "100%";
  2648. var t = this._container.lastChild;
  2649. t ? this._container.insertBefore(this._element, t) : this._container
  2650. .appendChild(this._element)
  2651. }
  2652. }, {
  2653. key: "_createMainWidget",
  2654. value: function(t, e) {}
  2655. }, {
  2656. key: "_createYAxisWidget",
  2657. value: function(t, e) {}
  2658. }, {
  2659. key: "width",
  2660. value: function() {
  2661. return this._element.offsetWidth
  2662. }
  2663. }, {
  2664. key: "setWidth",
  2665. value: function(t, e) {
  2666. this._mainWidget.setWidth(t), this._yAxisWidget && this._yAxisWidget
  2667. .setWidth(e)
  2668. }
  2669. }, {
  2670. key: "height",
  2671. value: function() {
  2672. return this._height
  2673. }
  2674. }, {
  2675. key: "setHeight",
  2676. value: function(t) {
  2677. this._height = t, this._mainWidget.setHeight(t), this._yAxisWidget && this
  2678. ._yAxisWidget.setHeight(t)
  2679. }
  2680. }, {
  2681. key: "setOffsetLeft",
  2682. value: function(t, e) {
  2683. this._mainWidget.setOffsetLeft(t), this._yAxisWidget && this._yAxisWidget
  2684. .setOffsetLeft(e)
  2685. }
  2686. }, {
  2687. key: "layout",
  2688. value: function() {
  2689. this._element.offsetHeight !== this._height && (this._element.style.height =
  2690. "".concat(this._height, "px")), this._mainWidget.layout(), this
  2691. ._yAxisWidget && this._yAxisWidget.layout()
  2692. }
  2693. }, {
  2694. key: "invalidate",
  2695. value: function(t) {
  2696. this._yAxisWidget && this._yAxisWidget.invalidate(t), this._mainWidget
  2697. .invalidate(t)
  2698. }
  2699. }, {
  2700. key: "getImage",
  2701. value: function(t) {
  2702. var e = document.createElement("canvas"),
  2703. i = e.getContext("2d"),
  2704. a = _e(e),
  2705. n = this._element.offsetWidth,
  2706. r = this._element.offsetHeight;
  2707. e.style.width = "".concat(n, "px"), e.style.height = "".concat(r, "px"), e
  2708. .width = n * a, e.height = r * a, i.scale(a, a);
  2709. var o = this._mainWidget.getElement(),
  2710. s = o.offsetWidth,
  2711. c = o.offsetHeight,
  2712. h = parseInt(o.style.left, 10);
  2713. if (i.drawImage(this._mainWidget.getImage(t), h, 0, s, c), this
  2714. ._yAxisWidget) {
  2715. var l = this._yAxisWidget.getElement(),
  2716. u = l.offsetWidth,
  2717. d = l.offsetHeight,
  2718. _ = parseInt(l.style.left, 10);
  2719. i.drawImage(this._yAxisWidget.getImage(t), _, 0, u, d)
  2720. }
  2721. return e
  2722. }
  2723. }, {
  2724. key: "destroy",
  2725. value: function() {
  2726. this._container.removeChild(this._element)
  2727. }
  2728. }]), t
  2729. }(),
  2730. ye = function() {
  2731. function t(e) {
  2732. m(this, t), this._width = 0, this._height = 0, this._initElement(e.container), this._mainView =
  2733. this._createMainView(this._element, e), this._overlayView = this._createOverlayView(this
  2734. ._element, e)
  2735. }
  2736. return g(t, [{
  2737. key: "_initElement",
  2738. value: function(t) {
  2739. this._element = document.createElement("div"), this._element.style.top =
  2740. "0", this._element.style.margin = "0", this._element.style.padding =
  2741. "0", this._element.style.position = "absolute", this._element.style
  2742. .overflow = "hidden", t.appendChild(this._element)
  2743. }
  2744. }, {
  2745. key: "_createMainView",
  2746. value: function(t, e) {}
  2747. }, {
  2748. key: "_createOverlayView",
  2749. value: function(t, e) {}
  2750. }, {
  2751. key: "getElement",
  2752. value: function() {
  2753. return this._element
  2754. }
  2755. }, {
  2756. key: "setWidth",
  2757. value: function(t) {
  2758. this._width = t, this._mainView.setWidth(t), this._overlayView.setWidth(t)
  2759. }
  2760. }, {
  2761. key: "setHeight",
  2762. value: function(t) {
  2763. this._height = t, this._mainView.setHeight(t), this._overlayView.setHeight(
  2764. t)
  2765. }
  2766. }, {
  2767. key: "setOffsetLeft",
  2768. value: function(t) {
  2769. this._element.style.left = "".concat(t, "px")
  2770. }
  2771. }, {
  2772. key: "layout",
  2773. value: function() {
  2774. this._element.offsetWidth !== this._width && (this._element.style.width = ""
  2775. .concat(this._width, "px")), this._element.offsetHeight !== this
  2776. ._height && (this._element.style.height = "".concat(this._height,
  2777. "px")), this._mainView.layout(), this._overlayView.layout()
  2778. }
  2779. }, {
  2780. key: "invalidate",
  2781. value: function(t) {
  2782. switch (t) {
  2783. case ce:
  2784. this._overlayView.flush();
  2785. break;
  2786. case he:
  2787. case le:
  2788. this._mainView.flush(), this._overlayView.flush()
  2789. }
  2790. }
  2791. }, {
  2792. key: "getImage",
  2793. value: function(t) {
  2794. var e = document.createElement("canvas"),
  2795. i = e.getContext("2d"),
  2796. a = _e(e);
  2797. return e.style.width = "".concat(this._width, "px"), e.style.height = ""
  2798. .concat(this._height, "px"), e.width = this._width * a, e.height = this
  2799. ._height * a, i.scale(a, a), i.drawImage(this._mainView.getImage(), 0,
  2800. 0, this._width, this._height), t && this._overlayView && i
  2801. .drawImage(this._overlayView.getImage(), 0, 0, this._width, this
  2802. ._height), e
  2803. }
  2804. }]), t
  2805. }();
  2806. function me(t) {
  2807. return window.requestAnimationFrame ? window.requestAnimationFrame(t) : window.setTimeout(t, 20)
  2808. }
  2809. var xe = function() {
  2810. function t(e, i) {
  2811. m(this, t), this._chartData = i, this._initCanvas(e)
  2812. }
  2813. return g(t, [{
  2814. key: "_initCanvas",
  2815. value: function(t) {
  2816. this._canvas = document.createElement("canvas"), this._canvas.style
  2817. .position = "absolute", this._canvas.style.top = "0", this._canvas.style
  2818. .left = "0", this._canvas.style.zIndex = "2", this._ctx = this._canvas
  2819. .getContext("2d"), t.appendChild(this._canvas)
  2820. }
  2821. }, {
  2822. key: "_redraw",
  2823. value: function(t) {
  2824. this._ctx.clearRect(0, 0, this._canvas.offsetWidth, this._canvas
  2825. .offsetHeight), t && t(), this._draw()
  2826. }
  2827. }, {
  2828. key: "_draw",
  2829. value: function() {}
  2830. }, {
  2831. key: "setWidth",
  2832. value: function(t) {
  2833. this._width = t
  2834. }
  2835. }, {
  2836. key: "setHeight",
  2837. value: function(t) {
  2838. this._height = t
  2839. }
  2840. }, {
  2841. key: "layout",
  2842. value: function() {
  2843. var t = this;
  2844. this._height !== this._canvas.offsetHeight || this._width !== this._canvas
  2845. .offsetWidth ? this._redraw((function() {
  2846. var e = _e(t._canvas);
  2847. t._canvas.style.width = "".concat(t._width, "px"), t._canvas
  2848. .style.height = "".concat(t._height, "px"), t._canvas
  2849. .width = Math.floor(t._width * e), t._canvas.height =
  2850. Math.floor(t._height * e), t._ctx.scale(e, e)
  2851. })) : this.flush()
  2852. }
  2853. }, {
  2854. key: "flush",
  2855. value: function() {
  2856. var t, e = this;
  2857. this.requestAnimationId && (t = this.requestAnimationId, window
  2858. .cancelAnimationFrame || clearTimeout(t), window
  2859. .cancelAnimationFrame(t), this.requestAnimationId = null), this
  2860. .requestAnimationId = me((function() {
  2861. e._redraw()
  2862. }))
  2863. }
  2864. }, {
  2865. key: "getImage",
  2866. value: function() {
  2867. return this._canvas
  2868. }
  2869. }]), t
  2870. }(),
  2871. ge = function(t) {
  2872. D(i, t);
  2873. var e = P(i);
  2874. function i(t, a, n, r, o) {
  2875. var s;
  2876. return m(this, i), (s = e.call(this, t, a))._xAxis = n, s._yAxis = r, s
  2877. ._additionalDataProvider = o, s
  2878. }
  2879. return g(i, [{
  2880. key: "_draw",
  2881. value: function() {
  2882. this._drawGrid(), this._drawTechnicalIndicators()
  2883. }
  2884. }, {
  2885. key: "_drawGrid",
  2886. value: function() {
  2887. var t = this,
  2888. e = this._chartData.styleOptions().grid;
  2889. if (e.show) {
  2890. var i = e.horizontal;
  2891. this._ctx.save(), i.show && (this._ctx.strokeStyle = i.color, this._ctx
  2892. .lineWidth = i.size, this._ctx.setLineDash(i.style === H ? i
  2893. .dashValue : []), this._yAxis.ticks().forEach((function(e) {
  2894. Bt(t._ctx, e.y, 0, t._width)
  2895. })));
  2896. var a = e.vertical;
  2897. a.show && (this._ctx.strokeStyle = a.color, this._ctx.lineWidth = a
  2898. .size, this._ctx.setLineDash(a.style === H ? a.dashValue : []),
  2899. this._xAxis.ticks().forEach((function(e) {
  2900. Vt(t._ctx, e.x, 0, t._height)
  2901. }))), this._ctx.restore()
  2902. }
  2903. }
  2904. }, {
  2905. key: "_drawTechnicalIndicators",
  2906. value: function() {
  2907. var t = this,
  2908. e = this._chartData.styleOptions().technicalIndicator;
  2909. this._additionalDataProvider.technicalIndicators().forEach((function(i) {
  2910. var a = i.plots,
  2911. n = [],
  2912. r = t._chartData.dataList(),
  2913. o = i.result,
  2914. s = i.styles || e;
  2915. i.render && (t._ctx.save(), i.render(t._ctx, {
  2916. from: t._chartData.from(),
  2917. to: t._chartData.to(),
  2918. kLineDataList: t._chartData.dataList(),
  2919. technicalIndicatorDataList: o
  2920. }, {
  2921. width: t._width,
  2922. height: t._height,
  2923. dataSpace: t._chartData.dataSpace(),
  2924. barSpace: t._chartData.barSpace()
  2925. }, s, {
  2926. convertFromPixel: t._xAxis.convertFromPixel
  2927. .bind(t._xAxis),
  2928. convertToPixel: t._xAxis.convertToPixel
  2929. .bind(t._xAxis)
  2930. }, {
  2931. convertFromPixel: t._yAxis.convertFromPixel
  2932. .bind(t._yAxis),
  2933. convertToPixel: t._yAxis.convertToPixel
  2934. .bind(t._yAxis)
  2935. }, t._yAxis.isCandleYAxis()), t._ctx.restore());
  2936. var c = i.baseValue;
  2937. F(c) || (c = t._yAxis.min());
  2938. var h = t._yAxis.convertToPixel(c),
  2939. l = t._yAxis.isCandleYAxis();
  2940. t._ctx.lineWidth = 1, t._drawGraphics((function(e, c, u, d,
  2941. _) {
  2942. var v = o[c] || {},
  2943. f = 0;
  2944. i.shouldOhlc && !l && t._drawCandleBar(e, d,
  2945. _, c, u, s.bar, q);
  2946. var y = {};
  2947. a.forEach((function(a) {
  2948. var m = v[a.key],
  2949. x = t._yAxis
  2950. .convertToPixel(m);
  2951. switch (y[a.key] = x, a
  2952. .type) {
  2953. case Dt:
  2954. if (F(m)) {
  2955. var g = {
  2956. preData: {
  2957. kLineData: r[
  2958. c -
  2959. 1
  2960. ],
  2961. technicalIndicatorData: o[
  2962. c -
  2963. 1
  2964. ]
  2965. },
  2966. currentData: {
  2967. kLineData: u,
  2968. technicalIndicatorData: v
  2969. },
  2970. nextData: {
  2971. kLineData: r[
  2972. c +
  2973. 1
  2974. ],
  2975. technicalIndicatorData: o[
  2976. c +
  2977. 1
  2978. ]
  2979. }
  2980. },
  2981. k = {
  2982. x: e,
  2983. y: x,
  2984. radius: d,
  2985. color: a
  2986. .color &&
  2987. a
  2988. .color(
  2989. g,
  2990. s
  2991. ) ||
  2992. s
  2993. .circle
  2994. .noChangeColor,
  2995. isStroke:
  2996. !a
  2997. .isStroke ||
  2998. a
  2999. .isStroke(
  3000. g
  3001. )
  3002. };
  3003. t._drawCircle(k)
  3004. }
  3005. break;
  3006. case kt:
  3007. if (F(m)) {
  3008. var D = {
  3009. preData: {
  3010. kLineData: r[
  3011. c -
  3012. 1
  3013. ],
  3014. technicalIndicatorData: o[
  3015. c -
  3016. 1
  3017. ]
  3018. },
  3019. currentData: {
  3020. kLineData: u,
  3021. technicalIndicatorData: v
  3022. },
  3023. nextData: {
  3024. kLineData: r[
  3025. c +
  3026. 1
  3027. ],
  3028. technicalIndicatorData: o[
  3029. c +
  3030. 1
  3031. ]
  3032. }
  3033. },
  3034. w = Math
  3035. .abs(h - x),
  3036. b = {
  3037. x: e -
  3038. d,
  3039. width: 2 *
  3040. d,
  3041. height: Math
  3042. .max(
  3043. 1,
  3044. w
  3045. )
  3046. };
  3047. b.y = x > h ?
  3048. h : 1 > w ?
  3049. h - 1 : x, b
  3050. .color = a
  3051. .color && a
  3052. .color(D,
  3053. s) || s.bar
  3054. .noChangeColor,
  3055. b
  3056. .isStroke = !
  3057. !a
  3058. .isStroke &&
  3059. a.isStroke(
  3060. D), t
  3061. ._drawBar(b)
  3062. }
  3063. break;
  3064. case gt:
  3065. var M = null;
  3066. F(m) && (M = {
  3067. x: e,
  3068. y: x
  3069. }), n[f] ? n[f]
  3070. .push(M) : n[
  3071. f] = [M], f++
  3072. }
  3073. t._drawActionExecute(ue
  3074. .DRAW_TECHNICAL_INDICATOR, {
  3075. ctx: t._ctx,
  3076. kLineData: u,
  3077. dataIndex: c,
  3078. technicalIndicatorData: v,
  3079. technicalIndicatorName: i
  3080. .name,
  3081. coordinate: p({
  3082. x: e
  3083. }, y),
  3084. viewport: {
  3085. width: t
  3086. ._width,
  3087. height: t
  3088. ._height
  3089. },
  3090. barSpace: _,
  3091. halfBarSpace: d,
  3092. isCandle: l
  3093. })
  3094. }))
  3095. }), (function() {
  3096. t._drawLines(n, s)
  3097. }))
  3098. }))
  3099. }
  3100. }, {
  3101. key: "_drawGraphics",
  3102. value: function(t, e) {
  3103. var i = this._chartData.visibleDataList(),
  3104. a = this._chartData.barSpace(),
  3105. n = a / 2;
  3106. i.forEach((function(e, i) {
  3107. t(e.x, e.index, e.data, n, a, i)
  3108. })), e && e()
  3109. }
  3110. }, {
  3111. key: "_drawLines",
  3112. value: function(t, e) {
  3113. var i = this,
  3114. a = e.line.colors || [],
  3115. n = a.length;
  3116. this._ctx.lineWidth = e.line.size, Ht(this._ctx, (function() {
  3117. t.forEach((function(t, e) {
  3118. i._ctx.strokeStyle = a[e % n], i._ctx
  3119. .beginPath();
  3120. var r = !0;
  3121. t.forEach((function(t) {
  3122. F(t) && (r ? (i._ctx.moveTo(
  3123. t.x, t.y),
  3124. r = !1) : i._ctx
  3125. .lineTo(t.x, t.y))
  3126. })), i._ctx.stroke(), i._ctx.closePath()
  3127. }))
  3128. }))
  3129. }
  3130. }, {
  3131. key: "_drawBar",
  3132. value: function(t) {
  3133. t.isStroke ? (this._ctx.strokeStyle = t.color, this._ctx.strokeRect(t.x +
  3134. .5, t.y, t.width - 1, t.height)) : (this._ctx.fillStyle = t.color,
  3135. this._ctx.fillRect(t.x, t.y, t.width, t.height))
  3136. }
  3137. }, {
  3138. key: "_drawCircle",
  3139. value: function(t) {
  3140. this._ctx.strokeStyle = t.color, this._ctx.fillStyle = t.color, this._ctx
  3141. .beginPath(), this._ctx.arc(t.x, t.y, t.radius, 2 * Math.PI, 0, !0), t
  3142. .isStroke ? this._ctx.stroke() : this._ctx.fill(), this._ctx.closePath()
  3143. }
  3144. }, {
  3145. key: "_drawCandleBar",
  3146. value: function(t, e, i, a, n, r, o) {
  3147. var s = n.open,
  3148. c = n.close,
  3149. h = n.high,
  3150. l = n.low;
  3151. c > s ? (this._ctx.strokeStyle = r.upColor, this._ctx.fillStyle = r
  3152. .upColor) : s > c ? (this._ctx.strokeStyle = r.downColor, this._ctx
  3153. .fillStyle = r.downColor) : (this._ctx.strokeStyle = r
  3154. .noChangeColor, this._ctx.fillStyle = r.noChangeColor);
  3155. var u = this._yAxis.convertToPixel(s),
  3156. d = this._yAxis.convertToPixel(c),
  3157. _ = this._yAxis.convertToPixel(h),
  3158. v = this._yAxis.convertToPixel(l),
  3159. f = Math.min(u, d),
  3160. p = Math.max(u, d);
  3161. this._ctx.fillRect(t - .5, _, 1, f - _), this._ctx.fillRect(t - .5, p, 1,
  3162. v - p);
  3163. var y = Math.max(1, p - f);
  3164. switch (o) {
  3165. case j:
  3166. this._ctx.fillRect(t - e, f, i, y);
  3167. break;
  3168. case Z:
  3169. this._ctx.strokeRect(t - e + .5, f, i - 1, y);
  3170. break;
  3171. case U:
  3172. c > s ? this._ctx.strokeRect(t - e + .5, f, i - 1, y) : this._ctx
  3173. .fillRect(t - e, f, i, y);
  3174. break;
  3175. case K:
  3176. c > s ? this._ctx.fillRect(t - e, f, i, y) : this._ctx.strokeRect(
  3177. t - e + .5, f, i - 1, y);
  3178. break;
  3179. default:
  3180. this._ctx.fillRect(t - .5, _, 1, v - _), this._ctx.fillRect(t - e,
  3181. u - .5, e, 1), this._ctx.fillRect(t, d - .5, e, 1)
  3182. }
  3183. this._drawActionExecute(ue.DRAW_CANDLE, {
  3184. ctx: this._ctx,
  3185. dataIndex: a,
  3186. kLineData: n,
  3187. coordinate: {
  3188. x: t,
  3189. open: u,
  3190. close: d,
  3191. high: _,
  3192. low: v
  3193. },
  3194. viewport: {
  3195. width: this._width,
  3196. height: this._height
  3197. },
  3198. barSpace: i,
  3199. halfBarSpace: e,
  3200. isCandle: this._yAxis.isCandleYAxis()
  3201. })
  3202. }
  3203. }, {
  3204. key: "_drawActionExecute",
  3205. value: function(t, e) {
  3206. var i = this;
  3207. this._chartData.actionExecute(t, e, (function() {
  3208. i._ctx.save()
  3209. }), (function() {
  3210. i._ctx.restore()
  3211. }))
  3212. }
  3213. }]), i
  3214. }(xe);
  3215. function ke(t, e, i, a, n) {
  3216. t.fillStyle = e, t.fillText(n, i, a)
  3217. }
  3218. var De = function(t) {
  3219. D(i, t);
  3220. var e = P(i);
  3221. function i(t, a, n, r, o) {
  3222. var s;
  3223. return m(this, i), (s = e.call(this, t, a))._xAxis = n, s._yAxis = r, s
  3224. ._additionalDataProvider = o, s
  3225. }
  3226. return g(i, [{
  3227. key: "_draw",
  3228. value: function() {
  3229. this._drawCover();
  3230. var t = this._chartData.crosshair();
  3231. if (t.kLineData) {
  3232. var e = this._additionalDataProvider.technicalIndicators(),
  3233. i = this._chartData.styleOptions().crosshair;
  3234. t.paneId === this._additionalDataProvider.id() && this
  3235. ._drawCrosshairLine(i, "horizontal", t.y, 0, this._width, Bt), t
  3236. .paneId && this._drawCrosshairLine(i, "vertical", t.realX, 0, this
  3237. ._height, Vt), this._drawTooltip(t, e)
  3238. }
  3239. }
  3240. }, {
  3241. key: "_drawCover",
  3242. value: function() {}
  3243. }, {
  3244. key: "_drawTooltip",
  3245. value: function(t, e) {
  3246. var i = this._chartData.styleOptions().technicalIndicator;
  3247. this._drawBatchTechnicalIndicatorToolTip(t, e, i, 0, this
  3248. ._shouldDrawTooltip(t, i.tooltip))
  3249. }
  3250. }, {
  3251. key: "_drawCrosshairLine",
  3252. value: function(t, e, i, a, n, r) {
  3253. var o = t[e],
  3254. s = o.line;
  3255. t.show && o.show && s.show && (this._ctx.save(), this._ctx.lineWidth = s
  3256. .size, this._ctx.strokeStyle = s.color, s.style === H && this._ctx
  3257. .setLineDash(s.dashValue), r(this._ctx, i, a, n), this._ctx
  3258. .restore())
  3259. }
  3260. }, {
  3261. key: "_drawBatchTechnicalIndicatorToolTip",
  3262. value: function(t, e, i) {
  3263. var a = this,
  3264. n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0,
  3265. r = arguments.length > 4 ? arguments[4] : void 0;
  3266. if (r) {
  3267. var o = i.tooltip,
  3268. s = n;
  3269. e.forEach((function(e) {
  3270. a._drawTechnicalIndicatorTooltip(t, e, i, s), s += o
  3271. .text.marginTop + o.text.size + o.text.marginBottom
  3272. }))
  3273. }
  3274. }
  3275. }, {
  3276. key: "_drawTechnicalIndicatorTooltip",
  3277. value: function(t, e, i) {
  3278. var a = this,
  3279. n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0,
  3280. r = i.tooltip,
  3281. o = e.styles || i,
  3282. s = e.result,
  3283. c = s[t.dataIndex],
  3284. h = Pt(c, e),
  3285. l = o.line.colors,
  3286. u = this._chartData.dataList(),
  3287. d = {
  3288. preData: {
  3289. kLineData: u[t.dataIndex - 1],
  3290. technicalIndicatorData: s[t.dataIndex - 1]
  3291. },
  3292. currentData: {
  3293. kLineData: u[t.dataIndex],
  3294. technicalIndicatorData: c
  3295. },
  3296. nextData: {
  3297. kLineData: u[t.dataIndex + 1],
  3298. technicalIndicatorData: s[t.dataIndex + 1]
  3299. }
  3300. },
  3301. _ = e.plots,
  3302. v = r.text,
  3303. f = h.values,
  3304. p = v.marginLeft,
  3305. y = v.marginRight,
  3306. m = 0,
  3307. x = v.marginTop + n,
  3308. g = v.size,
  3309. k = v.color,
  3310. D = l.length;
  3311. if (this._ctx.textBaseline = "top", this._ctx.font = fe(g, v.weight, v
  3312. .family), r.showName) {
  3313. var w = h.name,
  3314. b = ve(this._ctx, w);
  3315. ke(this._ctx, k, m += p, x, w), m += b, r.showParams || (m += y)
  3316. }
  3317. if (r.showParams) {
  3318. var M = h.calcParamText,
  3319. P = ve(this._ctx, M);
  3320. r.showName || (m += p), ke(this._ctx, k, m, x, M), m += P + y
  3321. }
  3322. var E, C = 0;
  3323. _.forEach((function(t, e) {
  3324. switch (t.type) {
  3325. case Dt:
  3326. E = t.color && t.color(d, o) || o.circle
  3327. .noChangeColor;
  3328. break;
  3329. case kt:
  3330. E = t.color && t.color(d, o) || o.bar.noChangeColor;
  3331. break;
  3332. case gt:
  3333. E = l[C % D] || k, C++
  3334. }
  3335. var i = f[e].title;
  3336. if (F(i)) {
  3337. m += p;
  3338. var n = "".concat(i).concat(f[e].value || r
  3339. .defaultValue),
  3340. s = ve(a._ctx, n);
  3341. ke(a._ctx, E, m, x, n), m += s + y
  3342. }
  3343. }))
  3344. }
  3345. }, {
  3346. key: "_shouldDrawTooltip",
  3347. value: function(t, e) {
  3348. var i = e.showRule;
  3349. return i === J || i === Q && !!t.paneId
  3350. }
  3351. }]), i
  3352. }(xe),
  3353. we = function(t) {
  3354. D(i, t);
  3355. var e = P(i);
  3356. function i() {
  3357. return m(this, i), e.apply(this, arguments)
  3358. }
  3359. return g(i, [{
  3360. key: "_createMainView",
  3361. value: function(t, e) {
  3362. return new ge(t, e.chartData, e.xAxis, e.yAxis, e.additionalDataProvider)
  3363. }
  3364. }, {
  3365. key: "_createOverlayView",
  3366. value: function(t, e) {
  3367. return new De(t, e.chartData, e.xAxis, e.yAxis, e.additionalDataProvider)
  3368. }
  3369. }]), i
  3370. }(ye);
  3371. function be(t, e, i, a, n, r, o, s, c) {
  3372. Pe(t, e, n, r, o, s, c), Me(t, i, a, n, r, o, s, c)
  3373. }
  3374. function Me(t, e, i, a, n, r, o, s) {
  3375. t.lineWidth = i, t.strokeStyle = e, Ee(t, a, n, r, o, s), t.stroke()
  3376. }
  3377. function Pe(t, e, i, a, n, r, o) {
  3378. t.fillStyle = e, Ee(t, i, a, n, r, o), t.fill()
  3379. }
  3380. function Ee(t, e, i, a, n, r) {
  3381. t.beginPath(), t.moveTo(e + r, i), t.arcTo(e + a, i, e + a, i + n, r), t.arcTo(e + a, i + n, e, i + n,
  3382. r), t.arcTo(e, i + n, e, i, r), t.arcTo(e, i, e + a, i, r), t.closePath()
  3383. }
  3384. var Ce = function(t) {
  3385. D(i, t);
  3386. var e = P(i);
  3387. function i(t, a, n, r) {
  3388. var o;
  3389. return m(this, i), (o = e.call(this, t, a))._yAxis = n, o._additionalDataProvider = r, o
  3390. }
  3391. return g(i, [{
  3392. key: "_draw",
  3393. value: function() {
  3394. var t = this._chartData.styleOptions().yAxis;
  3395. t.show && (this._drawAxisLine(t), this._drawTickLines(t), this
  3396. ._drawTickLabels(t), this._drawTechnicalIndicatorLastValue(t), this
  3397. ._drawLastPriceLabel(t))
  3398. }
  3399. }, {
  3400. key: "_drawAxisLine",
  3401. value: function(t) {
  3402. var e, i = t.axisLine;
  3403. i.show && (this._ctx.strokeStyle = i.color, this._ctx.lineWidth = i.size,
  3404. e = this._yAxis.isFromYAxisZero() ? 0 : this._width - 1, Vt(this
  3405. ._ctx, e, 0, this._height))
  3406. }
  3407. }, {
  3408. key: "_drawTickLines",
  3409. value: function(t) {
  3410. var e = this,
  3411. i = t.tickLine;
  3412. if (i.show) {
  3413. this._ctx.lineWidth = i.size, this._ctx.strokeStyle = i.color;
  3414. var a, n, r = i.length;
  3415. this._yAxis.isFromYAxisZero() ? (a = 0, t.axisLine.show && (a += t
  3416. .axisLine.size), n = a + r) : (a = this._width, t.axisLine
  3417. .show && (a -= t.axisLine.size), n = a - r), this._yAxis.ticks()
  3418. .forEach((function(t) {
  3419. Bt(e._ctx, t.y, a, n)
  3420. }))
  3421. }
  3422. }
  3423. }, {
  3424. key: "_drawTickLabels",
  3425. value: function(t) {
  3426. var e = this,
  3427. i = t.tickText;
  3428. if (i.show) {
  3429. var a, n = t.tickLine,
  3430. r = n.show,
  3431. o = n.length;
  3432. this._yAxis.isFromYAxisZero() ? (a = i.paddingLeft, t.axisLine.show && (
  3433. a += t.axisLine.size), r && (a += o), this._ctx.textAlign =
  3434. "left") : (a = this._width - i.paddingRight, t.axisLine.show &&
  3435. (a -= t.axisLine.size), r && (a -= o), this._ctx.textAlign =
  3436. "right"), this._ctx.textBaseline = "middle", this._ctx.font =
  3437. fe(i.size, i.weight, i.family), this._ctx.fillStyle = i.color, this
  3438. ._yAxis.ticks().forEach((function(t) {
  3439. e._ctx.fillText(t.v, a, t.y)
  3440. })), this._ctx.textAlign = "left"
  3441. }
  3442. }
  3443. }, {
  3444. key: "_drawTechnicalIndicatorLastValue",
  3445. value: function(t) {
  3446. var e = this,
  3447. i = this._chartData.styleOptions().technicalIndicator,
  3448. a = i.lastValueMark,
  3449. n = this._additionalDataProvider.technicalIndicators();
  3450. if (a.show && a.text.show) {
  3451. var r = this._chartData.dataList();
  3452. n.forEach((function(n) {
  3453. var o = n.result || [],
  3454. s = o.length,
  3455. c = o[s - 1] || {},
  3456. h = {
  3457. preData: {
  3458. kLineData: r[s - 2],
  3459. technicalIndicatorData: o[s - 2]
  3460. },
  3461. currentData: {
  3462. kLineData: r[s - 1],
  3463. technicalIndicatorData: c
  3464. },
  3465. nextData: {
  3466. kLineData: null,
  3467. technicalIndicatorData: null
  3468. }
  3469. },
  3470. l = n.precision,
  3471. u = n.styles || i,
  3472. d = u.line.colors || [],
  3473. _ = d.length,
  3474. v = 0;
  3475. n.plots.forEach((function(i) {
  3476. var r, o = c[i.key];
  3477. switch (i.type) {
  3478. case Dt:
  3479. r = i.color && i.color(h, u) ||
  3480. u.circle.noChangeColor;
  3481. break;
  3482. case kt:
  3483. r = i.color && i.color(h, u) ||
  3484. u.bar.noChangeColor;
  3485. break;
  3486. case gt:
  3487. r = d[v % _], v++
  3488. }
  3489. F(o) && e._drawMarkLabel(t, o, l, n
  3490. .shouldFormatBigNumber, p(p({},
  3491. a.text), {}, {
  3492. backgroundColor: r
  3493. }))
  3494. }))
  3495. }))
  3496. }
  3497. }
  3498. }, {
  3499. key: "_drawLastPriceLabel",
  3500. value: function(t) {
  3501. if (this._yAxis.isCandleYAxis()) {
  3502. var e = this._chartData.styleOptions().candle.priceMark,
  3503. i = e.last;
  3504. if (e.show && i.show && i.text.show) {
  3505. var a = this._chartData.dataList(),
  3506. n = a[a.length - 1];
  3507. if (n) {
  3508. var r, o = n.close,
  3509. s = n.open;
  3510. r = o > s ? i.upColor : s > o ? i.downColor : i.noChangeColor,
  3511. this._drawMarkLabel(t, o, this._chartData.pricePrecision(),
  3512. !1, p(p({}, i.text), {}, {
  3513. backgroundColor: r
  3514. }))
  3515. }
  3516. }
  3517. }
  3518. }
  3519. }, {
  3520. key: "_drawMarkLabel",
  3521. value: function(t, e, i, a, n) {
  3522. var r, o = n.size,
  3523. s = n.weight,
  3524. c = n.family,
  3525. h = n.color,
  3526. l = n.backgroundColor,
  3527. u = n.borderRadius,
  3528. d = n.paddingLeft,
  3529. _ = n.paddingTop,
  3530. v = n.paddingRight,
  3531. f = n.paddingBottom,
  3532. p = this._yAxis.convertToNicePixel(e);
  3533. if (this._yAxis.yAxisType() === N) {
  3534. var y = ((this._chartData.visibleDataList()[0] || {}).data || {}).close;
  3535. r = "".concat(((e - y) / y * 100).toFixed(2), "%")
  3536. } else r = _t(e, i), a && (r = vt(r));
  3537. this._ctx.font = fe(o, s, c);
  3538. var m, x = ve(this._ctx, r) + d + v,
  3539. g = _ + o + f;
  3540. m = this._yAxis.isFromYAxisZero() ? 0 : this._width - x, Pe(this._ctx, l, m,
  3541. p - _ - o / 2, x, g, u), this._ctx.textBaseline = "middle", ke(this
  3542. ._ctx, h, m + d, p, r)
  3543. }
  3544. }]), i
  3545. }(xe),
  3546. Ae = function(t) {
  3547. D(i, t);
  3548. var e = P(i);
  3549. function i(t, a, n, r) {
  3550. var o;
  3551. return m(this, i), (o = e.call(this, t, a))._yAxis = n, o._additionalDataProvider = r, o
  3552. }
  3553. return g(i, [{
  3554. key: "_draw",
  3555. value: function() {
  3556. var t = this;
  3557. (this._ctx.textBaseline = "middle", this._yAxis.isCandleYAxis()) && this
  3558. ._chartData.tags().forEach((function(e) {
  3559. e.drawText(t._ctx)
  3560. }));
  3561. this._drawCrossHairLabel()
  3562. }
  3563. }, {
  3564. key: "_drawCrossHairLabel",
  3565. value: function() {
  3566. var t = this._chartData.crosshair();
  3567. if (t.paneId === this._additionalDataProvider.id() && 0 !== this._chartData
  3568. .dataList().length) {
  3569. var e = this._chartData.styleOptions().crosshair,
  3570. i = e.horizontal,
  3571. a = i.text;
  3572. if (e.show && i.show && a.show) {
  3573. var n, r = this._yAxis.convertFromPixel(t.y);
  3574. if (this._yAxis.yAxisType() === N) {
  3575. var o = (this._chartData.visibleDataList()[0] || {}).data || {};
  3576. n = "".concat(((r - o.close) / o.close * 100).toFixed(2), "%")
  3577. } else {
  3578. var s = this._additionalDataProvider.technicalIndicators(),
  3579. c = 0,
  3580. h = !1;
  3581. this._yAxis.isCandleYAxis() ? c = this._chartData
  3582. .pricePrecision() : s.forEach((function(t) {
  3583. c = Math.max(t.precision, c), h || (h = t
  3584. .shouldFormatBigNumber)
  3585. })), n = _t(r, c), h && (n = vt(n))
  3586. }
  3587. var l = a.size;
  3588. this._ctx.font = fe(l, a.weight, a.family);
  3589. var u, d = ve(this._ctx, n),
  3590. _ = a.paddingLeft,
  3591. v = a.paddingTop,
  3592. f = a.borderSize,
  3593. p = d + 2 * f + _ + a.paddingRight,
  3594. y = l + 2 * f + v + a.paddingBottom;
  3595. u = this._yAxis.isFromYAxisZero() ? 0 : this._width - p, be(this
  3596. ._ctx, a.backgroundColor, a.borderColor, f, u, t.y - f - v -
  3597. l / 2, p, y, a.borderRadius), ke(this._ctx, a.color, u + f +
  3598. _, t.y, n)
  3599. }
  3600. }
  3601. }
  3602. }]), i
  3603. }(xe),
  3604. Te = function(t) {
  3605. D(i, t);
  3606. var e = P(i);
  3607. function i() {
  3608. return m(this, i), e.apply(this, arguments)
  3609. }
  3610. return g(i, [{
  3611. key: "_createMainView",
  3612. value: function(t, e) {
  3613. return new Ce(t, e.chartData, e.yAxis, e.additionalDataProvider)
  3614. }
  3615. }, {
  3616. key: "_createOverlayView",
  3617. value: function(t, e) {
  3618. return new Ae(t, e.chartData, e.yAxis, e.additionalDataProvider)
  3619. }
  3620. }]), i
  3621. }(ye),
  3622. Se = function() {
  3623. function t(e) {
  3624. m(this, t), this._chartData = e, this._width = 0, this._height = 0, this._cacheMinValue = 0,
  3625. this._cacheMaxValue = 0, this._minValue = 0, this._maxValue = 0, this._range = 0, this
  3626. ._ticks = [], this._initMeasureCanvas()
  3627. }
  3628. return g(t, [{
  3629. key: "_initMeasureCanvas",
  3630. value: function() {
  3631. var t = document.createElement("canvas"),
  3632. e = _e(t);
  3633. this._measureCtx = t.getContext("2d"), this._measureCtx.scale(e, e)
  3634. }
  3635. }, {
  3636. key: "min",
  3637. value: function() {
  3638. return this._minValue
  3639. }
  3640. }, {
  3641. key: "max",
  3642. value: function() {
  3643. return this._maxValue
  3644. }
  3645. }, {
  3646. key: "width",
  3647. value: function() {
  3648. return this._width
  3649. }
  3650. }, {
  3651. key: "height",
  3652. value: function() {
  3653. return this._height
  3654. }
  3655. }, {
  3656. key: "setWidth",
  3657. value: function(t) {
  3658. this._width = t
  3659. }
  3660. }, {
  3661. key: "setHeight",
  3662. value: function(t) {
  3663. this._height = t
  3664. }
  3665. }, {
  3666. key: "ticks",
  3667. value: function() {
  3668. return this._ticks
  3669. }
  3670. }, {
  3671. key: "computeAxis",
  3672. value: function(t) {
  3673. var e = this._optimalMinMax(this._computeMinMax());
  3674. return this._minValue = e.min, this._maxValue = e.max, this._range = e
  3675. .range, !(this._cacheMinValue === e.min && this._cacheMaxValue === e
  3676. .max && !t) && (this._cacheMinValue = e.min, this._cacheMaxValue = e
  3677. .max, this._ticks = this._optimalTicks(this._computeTicks()), !0)
  3678. }
  3679. }, {
  3680. key: "_computeMinMax",
  3681. value: function() {}
  3682. }, {
  3683. key: "_optimalMinMax",
  3684. value: function(t) {}
  3685. }, {
  3686. key: "_computeTicks",
  3687. value: function() {
  3688. var t = [];
  3689. if (this._range >= 0) {
  3690. var e = this._computeInterval(this._range),
  3691. i = e.interval,
  3692. a = e.precision,
  3693. n = ft(Math.ceil(this._minValue / i) * i, a),
  3694. r = ft(Math.floor(this._maxValue / i) * i, a),
  3695. o = 0,
  3696. s = n;
  3697. if (0 !== i)
  3698. for (; r >= s;) t[o] = {
  3699. v: s.toFixed(a)
  3700. }, ++o, s += i
  3701. }
  3702. return t
  3703. }
  3704. }, {
  3705. key: "_optimalTicks",
  3706. value: function(t) {}
  3707. }, {
  3708. key: "_computeInterval",
  3709. value: function(t) {
  3710. var e, i, a, n, r = (i = Math.floor(pt(e = t / 8)), a = yt(i), e = (1.5 > (
  3711. n = e / a) ? 1 : 2.5 > n ? 2 : 3.5 > n ? 3 : 4.5 > n ? 4 :
  3712. 5.5 > n ? 5 : 6.5 > n ? 6 : 8) * a, -20 > i ? e : +e.toFixed(0 >
  3713. i ? -i : 0));
  3714. return {
  3715. interval: r,
  3716. precision: function(t) {
  3717. var e = "" + t,
  3718. i = e.indexOf("e");
  3719. if (i > 0) {
  3720. var a = +e.slice(i + 1);
  3721. return 0 > a ? -a : 0
  3722. }
  3723. var n = e.indexOf(".");
  3724. return 0 > n ? 0 : e.length - 1 - n
  3725. }(r)
  3726. }
  3727. }
  3728. }]), t
  3729. }(),
  3730. Ie = function(t) {
  3731. D(i, t);
  3732. var e = P(i);
  3733. function i(t, a, n) {
  3734. var r;
  3735. return m(this, i), (r = e.call(this, t))._realRange = 0, r._isCandleYAxis = a, r
  3736. ._additionalDataProvider = n, r
  3737. }
  3738. return g(i, [{
  3739. key: "_computeMinMax",
  3740. value: function() {
  3741. var t = this,
  3742. e = [Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER],
  3743. i = [],
  3744. a = !1,
  3745. n = Number.MAX_SAFE_INTEGER,
  3746. r = Number.MIN_SAFE_INTEGER,
  3747. o = Number.MAX_SAFE_INTEGER;
  3748. this._additionalDataProvider.technicalIndicators().forEach((function(t) {
  3749. a || (a = t.shouldOhlc), o = Math.min(o, t.precision), R(t
  3750. .minValue) && (n = Math.min(n, t.minValue)), R(t
  3751. .maxValue) && (r = Math.max(r, t.maxValue)), i
  3752. .push({
  3753. plots: t.plots,
  3754. result: t.result
  3755. })
  3756. }));
  3757. var s = 4;
  3758. if (this._isCandleYAxis) {
  3759. var c = this._chartData.pricePrecision();
  3760. s = o !== Number.MAX_SAFE_INTEGER ? Math.min(o, c) : c
  3761. } else o !== Number.MAX_SAFE_INTEGER && (s = o);
  3762. var h = this._chartData.visibleDataList(),
  3763. l = this._chartData.styleOptions().candle,
  3764. u = l.type === $,
  3765. d = l.area.value,
  3766. _ = this._isCandleYAxis && !u || !this._isCandleYAxis && a;
  3767. return h.forEach((function(a) {
  3768. var n = a.index,
  3769. r = a.data;
  3770. _ && (e[0] = Math.min(e[0], r.low), e[1] = Math.max(e[1], r
  3771. .high)), t._isCandleYAxis && u && (e[0] = Math.min(
  3772. e[0], r[d]), e[1] = Math.max(e[1], r[d])), i
  3773. .forEach((function(t) {
  3774. var i = t.result[n] || {};
  3775. t.plots.forEach((function(t) {
  3776. var a = i[t.key];
  3777. F(a) && (e[0] = Math.min(e[
  3778. 0], a), e[1] =
  3779. Math.max(e[1], a))
  3780. }))
  3781. }))
  3782. })), e[0] !== Number.MAX_SAFE_INTEGER && e[1] !== Number
  3783. .MIN_SAFE_INTEGER ? (e[0] = Math.min(n, e[0]), e[1] = Math.max(r, e[
  3784. 1])) : (e[0] = 0, e[1] = 10), {
  3785. min: e[0],
  3786. max: e[1],
  3787. precision: s,
  3788. specifyMin: n,
  3789. specifyMax: r
  3790. }
  3791. }
  3792. }, {
  3793. key: "_optimalMinMax",
  3794. value: function(t) {
  3795. var e, i, a, n, r = t.precision,
  3796. o = t.specifyMin,
  3797. s = t.specifyMax,
  3798. c = t.min,
  3799. h = t.max,
  3800. l = this.yAxisType();
  3801. switch (l) {
  3802. case N:
  3803. var u = (this._chartData.visibleDataList()[0] || {}).data || {};
  3804. R(u.close) && (c = (c - u.close) / u.close * 100, h = (h - u
  3805. .close) / u.close * 100), e = .01;
  3806. break;
  3807. case X:
  3808. c = pt(c), h = pt(h), e = .05 * yt(-r);
  3809. break;
  3810. default:
  3811. e = yt(-r)
  3812. }
  3813. if (c === h || e > Math.abs(c - h)) {
  3814. var d = o === c,
  3815. _ = s === h;
  3816. c = d ? c : _ ? c - 8 * e : c - 4 * e, h = _ ? h : d ? h + 8 * e : h +
  3817. 4 * e
  3818. }
  3819. a = (i = this._isCandleYAxis ? this._chartData.styleOptions().candle
  3820. .margin : this._chartData.styleOptions().technicalIndicator.margin)
  3821. .top > 1 ? i.top / this._height : R(i.top) ? i.top : .2, n = i.bottom >
  3822. 1 ? i.bottom / this._height : R(i.bottom) ? i.bottom : .1;
  3823. var v = Math.abs(h - c);
  3824. return v = Math.abs((h += v * a) - (c -= v * n)), this._realRange = l ===
  3825. X ? Math.abs(yt(h) - yt(c)) : v, {
  3826. min: c,
  3827. max: h,
  3828. range: v
  3829. }
  3830. }
  3831. }, {
  3832. key: "_optimalTicks",
  3833. value: function(t) {
  3834. var e = this,
  3835. i = [],
  3836. a = this.yAxisType(),
  3837. n = this._additionalDataProvider.technicalIndicators(),
  3838. r = 0,
  3839. o = !1;
  3840. this._isCandleYAxis ? r = this._chartData.pricePrecision() : n.forEach((
  3841. function(t) {
  3842. r = Math.max(r, t.precision), o || (o = t
  3843. .shouldFormatBigNumber)
  3844. }));
  3845. var s, c, h = this._chartData.styleOptions().xAxis.tickText.size;
  3846. return a === X && (s = this._computeInterval(this._realRange)), t.forEach((
  3847. function(t) {
  3848. var n, l = t.v,
  3849. u = e._innerConvertToPixel(+l);
  3850. switch (a) {
  3851. case N:
  3852. n = "".concat(_t(l, 2), "%");
  3853. break;
  3854. case X:
  3855. n = ft(yt(l), s.precision), u = e
  3856. ._innerConvertToPixel(pt(n)), n = _t(n, r);
  3857. break;
  3858. default:
  3859. n = _t(l, r), o && (n = vt(n))
  3860. }
  3861. u > h && e._height - h > u && (c && c - u > 2 * h || !c) &&
  3862. (i.push({
  3863. v: n,
  3864. y: u
  3865. }), c = u)
  3866. })), i
  3867. }
  3868. }, {
  3869. key: "_innerConvertToPixel",
  3870. value: function(t) {
  3871. return Math.round((1 - (t - this._minValue) / this._range) * this._height)
  3872. }
  3873. }, {
  3874. key: "isCandleYAxis",
  3875. value: function() {
  3876. return this._isCandleYAxis
  3877. }
  3878. }, {
  3879. key: "yAxisType",
  3880. value: function() {
  3881. return this._isCandleYAxis ? this._chartData.styleOptions().yAxis.type : G
  3882. }
  3883. }, {
  3884. key: "isFromYAxisZero",
  3885. value: function() {
  3886. var t = this._chartData.styleOptions().yAxis;
  3887. return t.position === Y && t.inside || t.position === W && !t.inside
  3888. }
  3889. }, {
  3890. key: "getSelfWidth",
  3891. value: function() {
  3892. var t = this,
  3893. e = this._chartData.styleOptions(),
  3894. i = e.yAxis,
  3895. a = i.width;
  3896. if (R(a)) return a;
  3897. var n = 0;
  3898. if (i.show && (i.axisLine.show && (n += i.axisLine.size), i.tickLine.show &&
  3899. (n += i.tickLine.length), i.tickText.show)) {
  3900. var r = 0;
  3901. this._measureCtx.font = fe(i.tickText.size, i.tickText.weight, i
  3902. .tickText.family), this._ticks.forEach((function(e) {
  3903. r = Math.max(r, ve(t._measureCtx, e.v))
  3904. })), n += i.tickText.paddingLeft + i.tickText.paddingRight + r
  3905. }
  3906. var o = e.crosshair,
  3907. s = 0;
  3908. if (o.show && o.horizontal.show && o.horizontal.text.show) {
  3909. var c = this._additionalDataProvider.technicalIndicators(),
  3910. h = 0,
  3911. l = !1;
  3912. c.forEach((function(t) {
  3913. h = Math.max(t.precision, h), l || (l = t
  3914. .shouldFormatBigNumber)
  3915. })), this._measureCtx.font = fe(o.horizontal.text.size, o.horizontal
  3916. .text.weight, o.horizontal.text.family);
  3917. var u = 2;
  3918. if (this.yAxisType() !== N)
  3919. if (this._isCandleYAxis) {
  3920. var d = this._chartData.pricePrecision(),
  3921. _ = e.technicalIndicator.lastValueMark;
  3922. u = _.show && _.text.show ? Math.max(h, d) : d
  3923. } else u = h;
  3924. var v = _t(this._maxValue, u);
  3925. l && (v = vt(v)), s += o.horizontal.text.paddingLeft + o.horizontal.text
  3926. .paddingRight + 2 * o.horizontal.text.borderSize + ve(this
  3927. ._measureCtx, v)
  3928. }
  3929. return Math.max(n, s)
  3930. }
  3931. }, {
  3932. key: "convertFromPixel",
  3933. value: function(t) {
  3934. var e = (1 - t / this._height) * this._range + this._minValue;
  3935. switch (this.yAxisType()) {
  3936. case N:
  3937. var i = (this._chartData.visibleDataList()[0] || {}).data || {};
  3938. if (R(i.close)) return i.close * e / 100 + i.close;
  3939. break;
  3940. case X:
  3941. return yt(e);
  3942. default:
  3943. return e
  3944. }
  3945. }
  3946. }, {
  3947. key: "convertToPixel",
  3948. value: function(t) {
  3949. var e;
  3950. switch (this.yAxisType()) {
  3951. case N:
  3952. var i = (this._chartData.visibleDataList()[0] || {}).data || {};
  3953. R(i.close) && (e = (t - i.close) / i.close * 100);
  3954. break;
  3955. case X:
  3956. e = pt(t);
  3957. break;
  3958. default:
  3959. e = t
  3960. }
  3961. return this._innerConvertToPixel(e)
  3962. }
  3963. }, {
  3964. key: "convertToNicePixel",
  3965. value: function(t) {
  3966. var e = this.convertToPixel(t);
  3967. return Math.round(Math.max(.05 * this._height, Math.min(e, .98 * this
  3968. ._height)))
  3969. }
  3970. }]), i
  3971. }(Se),
  3972. Le = function(t) {
  3973. D(i, t);
  3974. var e = P(i);
  3975. function i(t) {
  3976. var a;
  3977. return m(this, i), (a = e.call(this, t))._techs = new Map, "height" in t && a.setHeight(t
  3978. .height), a.setTechnicalIndicator(a._chartData.getTechnicalIndicatorInstance(t.name)), a
  3979. }
  3980. return g(i, [{
  3981. key: "_initBefore",
  3982. value: function(t) {
  3983. this._id = t.id, this._yAxis = this._createYAxis(t)
  3984. }
  3985. }, {
  3986. key: "_createYAxis",
  3987. value: function(t) {
  3988. return new Ie(t.chartData, !1, {
  3989. technicalIndicators: this.technicalIndicators.bind(this)
  3990. })
  3991. }
  3992. }, {
  3993. key: "_createMainWidget",
  3994. value: function(t, e) {
  3995. return new we({
  3996. container: t,
  3997. chartData: e.chartData,
  3998. xAxis: e.xAxis,
  3999. yAxis: this._yAxis,
  4000. additionalDataProvider: {
  4001. technicalIndicators: this.technicalIndicators.bind(this),
  4002. id: this.id.bind(this)
  4003. }
  4004. })
  4005. }
  4006. }, {
  4007. key: "_createYAxisWidget",
  4008. value: function(t, e) {
  4009. return new Te({
  4010. container: t,
  4011. chartData: e.chartData,
  4012. yAxis: this._yAxis,
  4013. additionalDataProvider: {
  4014. technicalIndicators: this.technicalIndicators.bind(this),
  4015. id: this.id.bind(this)
  4016. }
  4017. })
  4018. }
  4019. }, {
  4020. key: "setHeight",
  4021. value: function(t) {
  4022. E(w(i.prototype), "setHeight", this).call(this, t), this._yAxis.setHeight(t)
  4023. }
  4024. }, {
  4025. key: "setWidth",
  4026. value: function(t, e) {
  4027. E(w(i.prototype), "setWidth", this).call(this, t, e), this._yAxis.setWidth(
  4028. e)
  4029. }
  4030. }, {
  4031. key: "id",
  4032. value: function() {
  4033. return this._id
  4034. }
  4035. }, {
  4036. key: "yAxis",
  4037. value: function() {
  4038. return this._yAxis
  4039. }
  4040. }, {
  4041. key: "technicalIndicators",
  4042. value: function() {
  4043. return this._techs
  4044. }
  4045. }, {
  4046. key: "isEmptyTechnicalIndicator",
  4047. value: function() {
  4048. return 0 === this._techs.size
  4049. }
  4050. }, {
  4051. key: "removeTechnicalIndicator",
  4052. value: function(t) {
  4053. return t ? !!this._techs.has(t) && (this._techs.delete(t), !0) : (this
  4054. ._techs.clear(), !0)
  4055. }
  4056. }, {
  4057. key: "setTechnicalIndicator",
  4058. value: function(t, e) {
  4059. if (t) {
  4060. if (this._techs.has(t.name)) return !1;
  4061. var i = Object.create(t);
  4062. return e ? this._techs.set(i.name, i) : this._techs = new Map([
  4063. [i.name, i]
  4064. ]), this.calcTechnicalIndicator(i), !0
  4065. }
  4066. return !1
  4067. }
  4068. }, {
  4069. key: "calcTechnicalIndicator",
  4070. value: function(t) {
  4071. t.result = t.calcTechnicalIndicator(this._chartData.dataList(), t
  4072. .calcParams, t.plots) || []
  4073. }
  4074. }, {
  4075. key: "calcAllTechnicalIndicator",
  4076. value: function() {
  4077. var t = this;
  4078. return this._techs.forEach((function(e) {
  4079. t.calcTechnicalIndicator(e)
  4080. })), this._yAxis.computeAxis()
  4081. }
  4082. }]), i
  4083. }(pe),
  4084. Oe = function(t) {
  4085. D(i, t);
  4086. var e = P(i);
  4087. function i() {
  4088. return m(this, i), e.apply(this, arguments)
  4089. }
  4090. return g(i, [{
  4091. key: "_draw",
  4092. value: function() {
  4093. this._drawGrid();
  4094. var t = this._chartData.styleOptions().candle;
  4095. t.type === $ ? this._drawArea(t) : (this._drawCandle(t), this
  4096. ._drawLowHighPrice(t.priceMark, "high", "high", Number
  4097. .MIN_SAFE_INTEGER, [-2, -5], (function(t, e) {
  4098. if (t > e) return t
  4099. })), this._drawLowHighPrice(t.priceMark, "low", "low", Number
  4100. .MAX_SAFE_INTEGER, [2, 5], (function(t, e) {
  4101. if (e > t) return t
  4102. }))), this._drawTechnicalIndicators(), this._drawLastPriceLine(t
  4103. .priceMark)
  4104. }
  4105. }, {
  4106. key: "_drawArea",
  4107. value: function(t) {
  4108. var e = this,
  4109. i = [],
  4110. a = [],
  4111. n = Number.MAX_SAFE_INTEGER,
  4112. r = t.area;
  4113. this._drawGraphics((function(t, o, s, c, h, l) {
  4114. var u = s[r.value];
  4115. if (R(u)) {
  4116. var d = e._yAxis.convertToPixel(u);
  4117. if (0 === l) {
  4118. var _ = t - c;
  4119. a.push({
  4120. x: _,
  4121. y: e._height
  4122. }), a.push({
  4123. x: _,
  4124. y: d
  4125. }), i.push({
  4126. x: _,
  4127. y: d
  4128. })
  4129. }
  4130. i.push({
  4131. x: t,
  4132. y: d
  4133. }), a.push({
  4134. x: t,
  4135. y: d
  4136. }), n = Math.min(n, d)
  4137. }
  4138. }), (function() {
  4139. var t = a.length;
  4140. if (t > 0) {
  4141. var o = a[t - 1],
  4142. s = e._chartData.barSpace() / 2,
  4143. c = o.x + s;
  4144. i.push({
  4145. x: c,
  4146. y: o.y
  4147. }), a.push({
  4148. x: c,
  4149. y: o.y
  4150. }), a.push({
  4151. x: c,
  4152. y: e._height
  4153. })
  4154. }
  4155. if (i.length > 0 && (e._ctx.lineWidth = r.lineSize, e._ctx
  4156. .strokeStyle = r.lineColor, Ht(e._ctx, (function() {
  4157. e._ctx.beginPath(), e._ctx.moveTo(i[0]
  4158. .x, i[0].y);
  4159. for (var t = 1; i.length > t; t++) e
  4160. ._ctx.lineTo(i[t].x, i[t].y);
  4161. e._ctx.stroke(), e._ctx.closePath()
  4162. }))), a.length > 0) {
  4163. var h = r.fillColor;
  4164. if (I(h)) {
  4165. var l = e._ctx.createLinearGradient(0, e._height, 0,
  4166. n);
  4167. try {
  4168. h.forEach((function(t) {
  4169. l.addColorStop(t.offset, t
  4170. .color)
  4171. }))
  4172. } catch (t) {}
  4173. e._ctx.fillStyle = l
  4174. } else e._ctx.fillStyle = h;
  4175. e._ctx.beginPath(), e._ctx.moveTo(a[0].x, a[0].y);
  4176. for (var u = 1; a.length > u; u++) e._ctx.lineTo(a[u].x,
  4177. a[u].y);
  4178. e._ctx.closePath(), e._ctx.fill()
  4179. }
  4180. }))
  4181. }
  4182. }, {
  4183. key: "_drawCandle",
  4184. value: function(t) {
  4185. var e = this;
  4186. this._drawGraphics((function(i, a, n, r, o) {
  4187. e._drawCandleBar(i, r, o, a, n, t.bar, t.type)
  4188. }))
  4189. }
  4190. }, {
  4191. key: "_drawLowHighPrice",
  4192. value: function(t, e, i, a, n, r) {
  4193. var o = this,
  4194. s = t[e];
  4195. if (t.show && s.show) {
  4196. var c = this._chartData.visibleDataList(),
  4197. h = a,
  4198. l = -1;
  4199. c.forEach((function(t) {
  4200. var e = t.index,
  4201. n = r(ut(t.data, i, a), h);
  4202. n && (h = n, l = e)
  4203. }));
  4204. var u = this._chartData.pricePrecision(),
  4205. d = this._yAxis.convertToPixel(h),
  4206. _ = this._xAxis.convertToPixel(l),
  4207. v = d + n[0];
  4208. this._ctx.textAlign = "left", this._ctx.lineWidth = 1, this._ctx
  4209. .strokeStyle = s.color, this._ctx.fillStyle = s.color, Ht(this._ctx,
  4210. (function() {
  4211. o._ctx.beginPath(), o._ctx.moveTo(_ - 2, v + n[0]), o
  4212. ._ctx.lineTo(_, v), o._ctx.lineTo(_ + 2, v + n[0]),
  4213. o._ctx.stroke(), o._ctx.closePath()
  4214. }));
  4215. var f = v + n[1];
  4216. Ht(this._ctx, (function() {
  4217. o._ctx.beginPath(), o._ctx.moveTo(_, v), o._ctx.lineTo(
  4218. _, f), o._ctx.lineTo(_ + 5, f), o._ctx.stroke(),
  4219. o._ctx.closePath()
  4220. })), this._ctx.font = fe(s.textSize, s.textWeight, s.textFamily);
  4221. var p = _t(h, u);
  4222. this._ctx.textBaseline = "middle", this._ctx.fillText(p, _ + 5 + s
  4223. .textMargin, f)
  4224. }
  4225. }
  4226. }, {
  4227. key: "_drawLastPriceLine",
  4228. value: function(t) {
  4229. var e = t.last;
  4230. if (t.show && e.show && e.line.show) {
  4231. var i = this._chartData.dataList(),
  4232. a = i[i.length - 1];
  4233. if (a) {
  4234. var n, r = a.close,
  4235. o = a.open,
  4236. s = this._yAxis.convertToNicePixel(r);
  4237. n = r > o ? e.upColor : o > r ? e.downColor : e.noChangeColor, this
  4238. ._ctx.save(), this._ctx.strokeStyle = n, this._ctx.lineWidth = e
  4239. .line.size, e.line.style === H && this._ctx.setLineDash(e.line
  4240. .dashValue), Bt(this._ctx, s, 0, this._width), this._ctx
  4241. .restore()
  4242. }
  4243. }
  4244. }
  4245. }]), i
  4246. }(ge),
  4247. Re = function(t) {
  4248. D(i, t);
  4249. var e = P(i);
  4250. function i() {
  4251. return m(this, i), e.apply(this, arguments)
  4252. }
  4253. return g(i, [{
  4254. key: "_drawCover",
  4255. value: function() {
  4256. var t = this;
  4257. this._ctx.textBaseline = "alphabetic", this._chartData.tags().forEach((
  4258. function(e) {
  4259. e.drawMarkLine(t._ctx)
  4260. })), this._chartData.graphicMarks().forEach((function(e) {
  4261. e.draw(t._ctx)
  4262. })), this._chartData.visibleAnnotations().forEach((function(e) {
  4263. e.draw(t._ctx)
  4264. }))
  4265. }
  4266. }, {
  4267. key: "_drawTooltip",
  4268. value: function(t, e) {
  4269. var i = this._chartData.styleOptions(),
  4270. a = i.candle,
  4271. n = a.tooltip,
  4272. r = i.technicalIndicator,
  4273. o = r.tooltip,
  4274. s = this._shouldDrawTooltip(t, n),
  4275. c = this._shouldDrawTooltip(t, o);
  4276. n.showType === tt && o.showType === tt ? this._drawCandleTooltipWithRect(t,
  4277. e, a, s, r, c) : n.showType === et ? (this
  4278. ._drawCandleTooltipWithStandard(t.kLineData, a, s), o.showType ===
  4279. et ? this._drawBatchTechnicalIndicatorToolTip(t, e, r, s ? n.text
  4280. .size + n.text.marginTop : 0, c) : this
  4281. ._drawCandleTooltipWithRect(t, e, a, !1, r, c)) : (this
  4282. ._drawCandleTooltipWithRect(t, e, a, s, r, !1), this
  4283. ._drawBatchTechnicalIndicatorToolTip(t, e, r, 0, c))
  4284. }
  4285. }, {
  4286. key: "_drawCandleTooltipWithStandard",
  4287. value: function(t, e, i) {
  4288. var a = this;
  4289. if (i) {
  4290. var n = this._getCandleTooltipData(t, e),
  4291. r = e.tooltip,
  4292. o = r.text.marginLeft,
  4293. s = r.text.marginRight,
  4294. c = r.text.size,
  4295. h = r.text.color,
  4296. l = r.labels;
  4297. this._ctx.textBaseline = "top", this._ctx.font = fe(c, r.text.weight, r
  4298. .text.family);
  4299. var u = o,
  4300. d = r.text.marginTop;
  4301. l.forEach((function(t, e) {
  4302. var i = ve(a._ctx, t);
  4303. ke(a._ctx, h, u, d, t), u += i;
  4304. var c, l, _ = n[e] || r.defaultValue;
  4305. O(_) ? (c = _.value || r.defaultValue, l = _.color ||
  4306. h) : (l = h, c = _);
  4307. var v = ve(a._ctx, c);
  4308. ke(a._ctx, l, u, d, c), u += v + o + s
  4309. }))
  4310. }
  4311. }
  4312. }, {
  4313. key: "_drawCandleTooltipWithRect",
  4314. value: function(t, e, i, a, n, r) {
  4315. var o = this;
  4316. if (a || r) {
  4317. var s = i.tooltip,
  4318. c = s.labels,
  4319. h = this._getCandleTooltipData(t.kLineData, i),
  4320. l = s.text.marginLeft,
  4321. u = s.text.marginRight,
  4322. d = s.text.marginTop,
  4323. _ = s.text.marginBottom,
  4324. v = s.text.size,
  4325. f = s.text.color,
  4326. p = s.rect,
  4327. y = p.borderSize,
  4328. m = p.paddingLeft,
  4329. x = p.paddingRight,
  4330. g = p.paddingTop,
  4331. k = p.paddingBottom,
  4332. D = p.offsetLeft,
  4333. w = p.offsetRight,
  4334. b = 0,
  4335. M = 0,
  4336. P = 0;
  4337. this._ctx.save(), this._ctx.textBaseline = "top", a && (this._ctx.font =
  4338. fe(v, s.text.weight, s.text.family), c.forEach((function(t, e) {
  4339. var i, a = h[e];
  4340. i = O(a) ? a.value || s.defaultValue : a;
  4341. var n = "".concat(t).concat(i),
  4342. r = ve(o._ctx, n) + l + u;
  4343. b = Math.max(b, r)
  4344. })), P += (_ + d + v) * c.length);
  4345. var E = n.tooltip,
  4346. C = E.text.marginLeft,
  4347. A = E.text.marginRight,
  4348. T = E.text.marginTop,
  4349. S = E.text.marginBottom,
  4350. I = E.text.size,
  4351. L = [],
  4352. R = this._chartData.dataList();
  4353. if (e.forEach((function(e) {
  4354. var i = e.result;
  4355. L.push({
  4356. name: e.name,
  4357. tooltipData: Pt(i[t.dataIndex], e),
  4358. cbData: {
  4359. preData: {
  4360. kLineData: R[t.dataIndex - 1],
  4361. technicalIndicatorData: i[t
  4362. .dataIndex - 1]
  4363. },
  4364. currentData: {
  4365. kLineData: R[t.dataIndex],
  4366. technicalIndicatorData: i[t
  4367. .dataIndex]
  4368. },
  4369. nextData: {
  4370. kLineData: R[t.dataIndex + 1],
  4371. technicalIndicatorData: i[t
  4372. .dataIndex + 1]
  4373. }
  4374. }
  4375. })
  4376. })), r && (this._ctx.font = fe(I, E.text.weight, E.text.family), L
  4377. .forEach((function(t) {
  4378. t.tooltipData.values.forEach((function(t) {
  4379. var e = t.title,
  4380. i = t.value;
  4381. if (F(e)) {
  4382. var a = i || E.defaultValue,
  4383. n = "".concat(e).concat(a),
  4384. r = ve(o._ctx, n) + C + A;
  4385. b = Math.max(b, r), P += T + S +
  4386. I
  4387. }
  4388. }))
  4389. }))), 0 !== (M += b) && 0 !== P) {
  4390. var z;
  4391. M += 2 * y + m + x;
  4392. var B = p.offsetTop,
  4393. V = p.borderRadius;
  4394. Pe(this._ctx, p.fillColor, z = this._width / 2 > t.realX ? this
  4395. ._width - w - M : D, B, M, P += 2 * y + g + k, V), Me(this
  4396. ._ctx, p.borderColor, y, z, B, M, P, V);
  4397. var H = z + y + m + l,
  4398. Y = B + y + g;
  4399. if (a && (this._ctx.font = fe(v, s.text.weight, s.text.family), c
  4400. .forEach((function(t, e) {
  4401. Y += d, o._ctx.textAlign = "left", ke(o._ctx, f,
  4402. H, Y, t);
  4403. var i, a, n = h[e];
  4404. O(n) ? (a = n.color || f, i = n.value || s
  4405. .defaultValue) : (a = f, i = n || s
  4406. .defaultValue), o._ctx.textAlign =
  4407. "right", ke(o._ctx, a, z + M - y - u - x, Y,
  4408. i), Y += v + _
  4409. }))), r) {
  4410. var W = this._chartData.styleOptions().technicalIndicator,
  4411. G = z + y + m + C;
  4412. this._ctx.font = fe(I, E.text.weight, E.text.family), L.forEach(
  4413. (function(t) {
  4414. var i, a = t.tooltipData,
  4415. n = t.cbData,
  4416. r = e.get(t.name),
  4417. s = r.styles || W,
  4418. c = s.line.colors,
  4419. h = c.length,
  4420. l = 0;
  4421. r.plots.forEach((function(t, e) {
  4422. switch (t.type) {
  4423. case Dt:
  4424. i = t.color && t.color(
  4425. n, s) || s
  4426. .circle
  4427. .noChangeColor;
  4428. break;
  4429. case kt:
  4430. i = t.color && t.color(
  4431. n, s) || s.bar
  4432. .noChangeColor;
  4433. break;
  4434. case gt:
  4435. i = c[l % h] || s.text
  4436. .color, l++
  4437. }
  4438. var r = a.values[e];
  4439. F(r.title) && (Y += T, o._ctx
  4440. .textAlign = "left", o
  4441. ._ctx.fillStyle = i, o
  4442. ._ctx.fillText(""
  4443. .concat(r.title), G,
  4444. Y), o._ctx
  4445. .textAlign = "right", o
  4446. ._ctx.fillText(r
  4447. .value || E
  4448. .defaultValue, z +
  4449. M - y - A - x, Y),
  4450. Y += I + S)
  4451. }))
  4452. }))
  4453. }
  4454. this._ctx.restore()
  4455. }
  4456. }
  4457. }
  4458. }, {
  4459. key: "_getCandleTooltipData",
  4460. value: function(t, e) {
  4461. var i = this,
  4462. a = e.tooltip.values,
  4463. n = [];
  4464. if (a) L(a) ? n = a(t, e) || [] : I(a) && (n = a);
  4465. else {
  4466. var r = this._chartData.pricePrecision(),
  4467. o = this._chartData.volumePrecision();
  4468. (n = [ut(t, "timestamp"), ut(t, "open"), ut(t, "close"), ut(t, "high"),
  4469. ut(t, "low"), ut(t, "volume")
  4470. ]).forEach((function(t, e) {
  4471. switch (e) {
  4472. case 0:
  4473. n[e] = dt(i._chartData.dateTimeFormat(), t,
  4474. "YYYY-MM-DD hh:mm");
  4475. break;
  4476. case n.length - 1:
  4477. n[e] = vt(_t(t, o));
  4478. break;
  4479. default:
  4480. n[e] = _t(t, r)
  4481. }
  4482. }))
  4483. }
  4484. return n
  4485. }
  4486. }]), i
  4487. }(De),
  4488. Fe = function(t) {
  4489. D(i, t);
  4490. var e = P(i);
  4491. function i() {
  4492. return m(this, i), e.apply(this, arguments)
  4493. }
  4494. return g(i, [{
  4495. key: "_createMainView",
  4496. value: function(t, e) {
  4497. return new Oe(t, e.chartData, e.xAxis, e.yAxis, e.additionalDataProvider)
  4498. }
  4499. }, {
  4500. key: "_createOverlayView",
  4501. value: function(t, e) {
  4502. return new Re(t, e.chartData, e.xAxis, e.yAxis, e.additionalDataProvider)
  4503. }
  4504. }]), i
  4505. }(we),
  4506. ze = function(t) {
  4507. D(i, t);
  4508. var e = P(i);
  4509. function i() {
  4510. return m(this, i), e.apply(this, arguments)
  4511. }
  4512. return g(i, [{
  4513. key: "_createYAxis",
  4514. value: function(t) {
  4515. return new Ie(t.chartData, !0, {
  4516. technicalIndicators: this.technicalIndicators.bind(this)
  4517. })
  4518. }
  4519. }, {
  4520. key: "_createMainWidget",
  4521. value: function(t, e) {
  4522. return new Fe({
  4523. container: t,
  4524. chartData: e.chartData,
  4525. xAxis: e.xAxis,
  4526. yAxis: this._yAxis,
  4527. additionalDataProvider: {
  4528. technicalIndicators: this.technicalIndicators.bind(this),
  4529. id: this.id.bind(this)
  4530. }
  4531. })
  4532. }
  4533. }]), i
  4534. }(Le),
  4535. Be = function(t) {
  4536. D(i, t);
  4537. var e = P(i);
  4538. function i(t, a, n) {
  4539. var r;
  4540. return m(this, i), (r = e.call(this, t, a))._xAxis = n, r
  4541. }
  4542. return g(i, [{
  4543. key: "_draw",
  4544. value: function() {
  4545. var t = this._chartData.styleOptions().xAxis;
  4546. t.show && (this._drawAxisLine(t), this._drawTickLines(t), this
  4547. ._drawTickLabels(t))
  4548. }
  4549. }, {
  4550. key: "_drawAxisLine",
  4551. value: function(t) {
  4552. var e = t.axisLine;
  4553. e.show && (this._ctx.strokeStyle = e.color, this._ctx.lineWidth = e.size,
  4554. Bt(this._ctx, 0, 0, this._width))
  4555. }
  4556. }, {
  4557. key: "_drawTickLines",
  4558. value: function(t) {
  4559. var e = this,
  4560. i = t.tickLine;
  4561. if (i.show) {
  4562. this._ctx.lineWidth = i.size, this._ctx.strokeStyle = i.color;
  4563. var a = t.axisLine.show ? t.axisLine.size : 0,
  4564. n = a + i.length;
  4565. this._xAxis.ticks().forEach((function(t) {
  4566. Vt(e._ctx, t.x, a, n)
  4567. }))
  4568. }
  4569. }
  4570. }, {
  4571. key: "_drawTickLabels",
  4572. value: function(t) {
  4573. var e = t.tickText;
  4574. if (e.show) {
  4575. var i = t.tickLine;
  4576. this._ctx.textBaseline = "top", this._ctx.font = fe(e.size, e.weight, e
  4577. .family), this._ctx.textAlign = "center", this._ctx.fillStyle =
  4578. e.color;
  4579. var a = e.paddingTop;
  4580. t.axisLine.show && (a += t.axisLine.size), i.show && (a += i.length);
  4581. for (var n = this._xAxis.ticks(), r = n.length, o = 0; r > o; o++) this
  4582. ._ctx.fillText(n[o].v, n[o].x, a)
  4583. }
  4584. }
  4585. }]), i
  4586. }(xe),
  4587. Ve = function(t) {
  4588. D(i, t);
  4589. var e = P(i);
  4590. function i(t, a, n) {
  4591. var r;
  4592. return m(this, i), (r = e.call(this, t, a))._xAxis = n, r
  4593. }
  4594. return g(i, [{
  4595. key: "_draw",
  4596. value: function() {
  4597. this._drawCrosshairLabel()
  4598. }
  4599. }, {
  4600. key: "_drawCrosshairLabel",
  4601. value: function() {
  4602. var t = this._chartData.crosshair();
  4603. if (t.paneId) {
  4604. var e = this._chartData.styleOptions().crosshair,
  4605. i = e.vertical,
  4606. a = i.text;
  4607. if (e.show && i.show && a.show && t.dataIndex === t.realDataIndex) {
  4608. var n = t.realX,
  4609. r = t.kLineData.timestamp,
  4610. o = dt(this._chartData.dateTimeFormat(), r, "YYYY-MM-DD hh:mm"),
  4611. s = a.size;
  4612. this._ctx.font = fe(s, a.weight, a.family);
  4613. var c = ve(this._ctx, o),
  4614. h = n - c / 2,
  4615. l = a.paddingLeft,
  4616. u = a.paddingRight,
  4617. d = a.paddingTop,
  4618. _ = a.borderSize;
  4619. l + _ > h ? h = l + _ : h > this._width - c - _ - u && (h = this
  4620. ._width - c - _ - u), be(this._ctx, a.backgroundColor, a
  4621. .borderColor, _, h - _ - l, 0, c + 2 * _ + u + l, s + 2 *
  4622. _ + d + a.paddingBottom, a.borderRadius), this._ctx
  4623. .textBaseline = "top", ke(this._ctx, a.color, h, _ + d, o)
  4624. }
  4625. }
  4626. }
  4627. }]), i
  4628. }(xe),
  4629. He = function(t) {
  4630. D(i, t);
  4631. var e = P(i);
  4632. function i() {
  4633. return m(this, i), e.apply(this, arguments)
  4634. }
  4635. return g(i, [{
  4636. key: "_createMainView",
  4637. value: function(t, e) {
  4638. return new Be(t, e.chartData, e.xAxis)
  4639. }
  4640. }, {
  4641. key: "_createOverlayView",
  4642. value: function(t, e) {
  4643. return new Ve(t, e.chartData, e.xAxis)
  4644. }
  4645. }]), i
  4646. }(ye),
  4647. Ye = function(t) {
  4648. D(i, t);
  4649. var e = P(i);
  4650. function i() {
  4651. return m(this, i), e.apply(this, arguments)
  4652. }
  4653. return g(i, [{
  4654. key: "_computeMinMax",
  4655. value: function() {
  4656. return {
  4657. min: this._chartData.from(),
  4658. max: this._chartData.to() - 1
  4659. }
  4660. }
  4661. }, {
  4662. key: "_optimalMinMax",
  4663. value: function(t) {
  4664. var e = t.min,
  4665. i = t.max;
  4666. return {
  4667. min: e,
  4668. max: i,
  4669. range: i - e + 1
  4670. }
  4671. }
  4672. }, {
  4673. key: "_optimalTicks",
  4674. value: function(t) {
  4675. var e = [],
  4676. i = t.length,
  4677. a = this._chartData.dataList();
  4678. if (i > 0) {
  4679. var n = this._chartData.dateTimeFormat(),
  4680. r = this._chartData.styleOptions().xAxis.tickText;
  4681. this._measureCtx.font = fe(r.size, r.weight, r.family);
  4682. var o = ve(this._measureCtx, "00-00 00:00"),
  4683. s = this.convertToPixel(parseInt(t[0].v, 10)),
  4684. c = 1;
  4685. if (i > 1) {
  4686. var h = this.convertToPixel(parseInt(t[1].v, 10)),
  4687. l = Math.abs(h - s);
  4688. o > l && (c = Math.ceil(o / l))
  4689. }
  4690. for (var u = 0; i > u; u += c) {
  4691. var d = parseInt(t[u].v, 10),
  4692. _ = a[d].timestamp,
  4693. v = dt(n, _, "hh:mm");
  4694. if (0 !== u) v = this._optimalTickLabel(n, _, a[parseInt(t[u - c].v,
  4695. 10)].timestamp) || v;
  4696. var f = this.convertToPixel(d);
  4697. e.push({
  4698. v: v,
  4699. x: f,
  4700. oV: _
  4701. })
  4702. }
  4703. if (1 === e.length) e[0].v = dt(n, e[0].oV, "YYYY-MM-DD hh:mm");
  4704. else {
  4705. var p = e[0].oV,
  4706. y = e[1].oV;
  4707. if (e[2]) {
  4708. var m = e[2].v;
  4709. /^[0-9]{2}-[0-9]{2}$/.test(m) ? e[0].v = dt(n, p, "MM-DD") :
  4710. /^[0-9]{4}-[0-9]{2}$/.test(m) ? e[0].v = dt(n, p,
  4711. "YYYY-MM") : /^[0-9]{4}$/.test(m) && (e[0].v = dt(n, p,
  4712. "YYYY"))
  4713. } else e[0].v = this._optimalTickLabel(n, p, y) || e[0].v
  4714. }
  4715. }
  4716. return e
  4717. }
  4718. }, {
  4719. key: "_optimalTickLabel",
  4720. value: function(t, e, i) {
  4721. var a = dt(t, e, "YYYY"),
  4722. n = dt(t, e, "YYYY-MM"),
  4723. r = dt(t, e, "MM-DD");
  4724. return a !== dt(t, i, "YYYY") ? a : n !== dt(t, i, "YYYY-MM") ? n : r !==
  4725. dt(t, i, "MM-DD") ? r : null
  4726. }
  4727. }, {
  4728. key: "getSelfHeight",
  4729. value: function() {
  4730. var t = this._chartData.styleOptions(),
  4731. e = t.xAxis,
  4732. i = e.height;
  4733. if (R(i)) return i;
  4734. var a = t.crosshair,
  4735. n = 0;
  4736. e.show && (e.axisLine.show && (n += e.axisLine.size), e.tickLine.show && (
  4737. n += e.tickLine.length), e.tickText.show && (n += e.tickText
  4738. .paddingTop + e.tickText.paddingBottom + e.tickText.size));
  4739. var r = 0;
  4740. return a.show && a.vertical.show && a.vertical.text.show && (r += a.vertical
  4741. .text.paddingTop + a.vertical.text.paddingBottom + 2 * a.vertical
  4742. .text.borderSize + a.vertical.text.size), Math.max(n, r)
  4743. }
  4744. }, {
  4745. key: "convertFromPixel",
  4746. value: function(t) {
  4747. return this._chartData.coordinateToDataIndex(t)
  4748. }
  4749. }, {
  4750. key: "convertToPixel",
  4751. value: function(t) {
  4752. return this._chartData.dataIndexToCoordinate(t)
  4753. }
  4754. }]), i
  4755. }(Se),
  4756. We = function(t) {
  4757. D(i, t);
  4758. var e = P(i);
  4759. function i() {
  4760. return m(this, i), e.apply(this, arguments)
  4761. }
  4762. return g(i, [{
  4763. key: "_initBefore",
  4764. value: function() {
  4765. this._xAxis = new Ye(this._chartData)
  4766. }
  4767. }, {
  4768. key: "_createMainWidget",
  4769. value: function(t, e) {
  4770. return new He({
  4771. container: t,
  4772. chartData: e.chartData,
  4773. xAxis: this._xAxis
  4774. })
  4775. }
  4776. }, {
  4777. key: "xAxis",
  4778. value: function() {
  4779. return this._xAxis
  4780. }
  4781. }, {
  4782. key: "setWidth",
  4783. value: function(t, e) {
  4784. E(w(i.prototype), "setWidth", this).call(this, t, e), this._xAxis.setWidth(
  4785. t)
  4786. }
  4787. }, {
  4788. key: "setHeight",
  4789. value: function(t) {
  4790. E(w(i.prototype), "setHeight", this).call(this, t), this._xAxis.setHeight(t)
  4791. }
  4792. }]), i
  4793. }(pe),
  4794. Ge = 0,
  4795. Ne = 2;
  4796. function Xe(t) {
  4797. return t.getBoundingClientRect() || {
  4798. left: 0,
  4799. top: 0
  4800. }
  4801. }
  4802. function je(t) {
  4803. return !!t.touches
  4804. }
  4805. function Ze(t) {
  4806. t.cancelable && t.preventDefault()
  4807. }
  4808. var Ue = !!navigator.maxTouchPoints || !!navigator.msMaxTouchPoints || "ontouchstart" in window || !!(window
  4809. .DocumentTouch && document instanceof window.DocumentTouch),
  4810. Ke = "onorientationchange" in window && Ue;
  4811. function qe(t, e) {
  4812. var i = t.clientX - e.clientX,
  4813. a = t.clientY - e.clientY;
  4814. return Math.sqrt(i * i + a * a)
  4815. }
  4816. var $e = "mouse",
  4817. Je = "touch",
  4818. Qe = function() {
  4819. function t(e, i, a) {
  4820. m(this, t), this._target = e, this._handler = i, this._options = a, this._clickCount = 0, this
  4821. ._clickTimeoutId = null, this._longTapTimeoutId = null, this._longTapActive = !1, this
  4822. ._mouseMoveStartPosition = null, this._moveExceededManhattanDistance = !1, this
  4823. ._cancelClick = !1, this._unsubscribeOutsideEvents = null, this._unsubscribeMousemove =
  4824. null, this._unsubscribeRoot = null, this._startPinchMiddlePoint = null, this
  4825. ._startPinchDistance = 0, this._pinchPrevented = !1, this._preventDragProcess = !1, this
  4826. ._mousePressed = !1, this._init()
  4827. }
  4828. return g(t, [{
  4829. key: "destroy",
  4830. value: function() {
  4831. null !== this._unsubscribeOutsideEvents && (this
  4832. ._unsubscribeOutsideEvents(), this._unsubscribeOutsideEvents = null),
  4833. null !== this._unsubscribeMousemove && (this._unsubscribeMousemove(),
  4834. this._unsubscribeMousemove = null), null !== this
  4835. ._unsubscribeRoot && (this._unsubscribeRoot(), this._unsubscribeRoot =
  4836. null), this._clearLongTapTimeout(), this._resetClickTimeout()
  4837. }
  4838. }, {
  4839. key: "_mouseEnterHandler",
  4840. value: function(t) {
  4841. var e = this;
  4842. this._unsubscribeMousemove && this._unsubscribeMousemove();
  4843. var i = this._mouseMoveHandler.bind(this),
  4844. a = this._mouseWheelHandler.bind(this);
  4845. this._unsubscribeMousemove = function() {
  4846. e._target.removeEventListener("mousemove", i), e._target
  4847. .removeEventListener("wheel", a)
  4848. }, this._target.addEventListener("mousemove", i), this._target
  4849. .addEventListener("wheel", a, {
  4850. passive: !1
  4851. }), je(t) && this._mouseMoveHandler(t);
  4852. var n = this._makeCompatEvent(t);
  4853. this._processEvent(n, this._handler.mouseEnterEvent)
  4854. }
  4855. }, {
  4856. key: "_resetClickTimeout",
  4857. value: function() {
  4858. null !== this._clickTimeoutId && clearTimeout(this._clickTimeoutId), this
  4859. ._clickCount = 0, this._clickTimeoutId = null
  4860. }
  4861. }, {
  4862. key: "_mouseMoveHandler",
  4863. value: function(t) {
  4864. if (!this._mousePressed || je(t)) {
  4865. var e = this._makeCompatEvent(t);
  4866. this._processEvent(e, this._handler.mouseMoveEvent)
  4867. }
  4868. }
  4869. }, {
  4870. key: "_mouseWheelHandler",
  4871. value: function(t) {
  4872. var e = this._makeCompatEvent(t);
  4873. t.localX = e.localX, t.localY = e.localY, this._processEvent(t, this
  4874. ._handler.mouseWheelEvent)
  4875. }
  4876. }, {
  4877. key: "_mouseMoveWithDownHandler",
  4878. value: function(t) {
  4879. if ((!("button" in t) || t.button === Ge) && null === this
  4880. ._startPinchMiddlePoint) {
  4881. var e = je(t);
  4882. if (!this._preventDragProcess || !e) {
  4883. this._pinchPrevented = !0;
  4884. var i = this._makeCompatEvent(t),
  4885. a = this._mouseMoveStartPosition,
  4886. n = Math.abs(a.x - i.pageX),
  4887. r = Math.abs(a.y - i.pageY),
  4888. o = n + r > 5;
  4889. if (o || !e) {
  4890. if (o && !this._moveExceededManhattanDistance && e) {
  4891. var s = .5 * n;
  4892. r >= s && !this._options.treatVertTouchDragAsPageScroll ||
  4893. s > r && !this._options
  4894. .treatHorzTouchDragAsPageScroll || (this
  4895. ._preventDragProcess = !0)
  4896. }
  4897. o && (this._moveExceededManhattanDistance = !0, this
  4898. ._cancelClick = !0, e && this._clearLongTapTimeout()),
  4899. this._preventDragProcess || (this._processEvent(i, this
  4900. ._handler.pressedMouseMoveEvent), e && Ze(t))
  4901. }
  4902. }
  4903. }
  4904. }
  4905. }, {
  4906. key: "_mouseUpHandler",
  4907. value: function(t) {
  4908. if (!("button" in t) || t.button === Ge) {
  4909. var e = this._makeCompatEvent(t);
  4910. this._clearLongTapTimeout(), this._mouseMoveStartPosition = null, this
  4911. ._mousePressed = !1, this._unsubscribeRoot && (this
  4912. ._unsubscribeRoot(), this._unsubscribeRoot = null), je(t) &&
  4913. this._mouseLeaveHandler(t), this._processEvent(e, this._handler
  4914. .mouseUpEvent), ++this._clickCount, this._clickTimeoutId && this
  4915. ._clickCount > 1 ? (this._processEvent(e, this._handler
  4916. .mouseDoubleClickEvent), this._resetClickTimeout()) : this
  4917. ._cancelClick || this._processEvent(e, this._handler
  4918. .mouseClickEvent), je(t) && (Ze(t), this._mouseLeaveHandler(t),
  4919. 0 === t.touches.length && (this._longTapActive = !1))
  4920. }
  4921. }
  4922. }, {
  4923. key: "_clearLongTapTimeout",
  4924. value: function() {
  4925. null !== this._longTapTimeoutId && (clearTimeout(this._longTapTimeoutId),
  4926. this._longTapTimeoutId = null)
  4927. }
  4928. }, {
  4929. key: "_mouseDownHandler",
  4930. value: function(t) {
  4931. if (!("button" in t) || t.button === Ge || t.button === Ne) {
  4932. var e = this._makeCompatEvent(t);
  4933. if ("button" in t && t.button === Ne) this._processEvent(e, this
  4934. ._handler.mouseRightDownEvent);
  4935. else {
  4936. this._cancelClick = !1, this._moveExceededManhattanDistance = !1,
  4937. this._preventDragProcess = !1, je(t) && this._mouseEnterHandler(
  4938. t), this._mouseMoveStartPosition = {
  4939. x: e.pageX,
  4940. y: e.pageY
  4941. }, this._unsubscribeRoot && (this._unsubscribeRoot(), this
  4942. ._unsubscribeRoot = null);
  4943. var i = this._mouseMoveWithDownHandler.bind(this),
  4944. a = this._mouseUpHandler.bind(this),
  4945. n = this._target.ownerDocument.documentElement;
  4946. this._unsubscribeRoot = function() {
  4947. n.removeEventListener("touchmove", i), n
  4948. .removeEventListener("touchend", a), n
  4949. .removeEventListener("mousemove", i), n
  4950. .removeEventListener("mouseup", a)
  4951. }, n.addEventListener("touchmove", i, {
  4952. passive: !1
  4953. }), n.addEventListener("touchend", a, {
  4954. passive: !1
  4955. }), this._clearLongTapTimeout(), je(t) && 1 === t.touches
  4956. .length ? this._longTapTimeoutId = setTimeout(this
  4957. ._longTapHandler.bind(this, t), 600) : (n.addEventListener(
  4958. "mousemove", i), n.addEventListener("mouseup", a)), this
  4959. ._mousePressed = !0, this._processEvent(e, this._handler
  4960. .mouseDownEvent), this._clickTimeoutId || (this
  4961. ._clickCount = 0, this._clickTimeoutId = setTimeout(this
  4962. ._resetClickTimeout.bind(this), 500))
  4963. }
  4964. }
  4965. }
  4966. }, {
  4967. key: "_init",
  4968. value: function() {
  4969. var t = this;
  4970. this._target.addEventListener("mouseenter", this._mouseEnterHandler.bind(
  4971. this)), this._target.addEventListener("touchcancel", this
  4972. ._clearLongTapTimeout.bind(this));
  4973. var e = this._target.ownerDocument,
  4974. i = function(e) {
  4975. t._handler.mouseDownOutsideEvent && (e.target && t._target.contains(
  4976. e.target) || t._handler.mouseDownOutsideEvent())
  4977. };
  4978. this._unsubscribeOutsideEvents = function() {
  4979. e.removeEventListener("mousedown", i), e.removeEventListener(
  4980. "touchstart", i)
  4981. }, e.addEventListener("mousedown", i), e.addEventListener("touchstart",
  4982. i, {
  4983. passive: !0
  4984. }), this._target.addEventListener("mouseleave", this
  4985. ._mouseLeaveHandler.bind(this)), this._target.addEventListener(
  4986. "touchstart", this._mouseDownHandler.bind(this), {
  4987. passive: !0
  4988. }), Ke || this._target.addEventListener("mousedown", this
  4989. ._mouseDownHandler.bind(this)), this._initPinch(), this._target
  4990. .addEventListener("touchmove", (function() {}), {
  4991. passive: !1
  4992. })
  4993. }
  4994. }, {
  4995. key: "_initPinch",
  4996. value: function() {
  4997. var t = this;
  4998. void 0 === this._handler.pinchStartEvent && void 0 === this._handler
  4999. .pinchEvent && void 0 === this._handler.pinchEndEvent || (this._target
  5000. .addEventListener("touchstart", (function(e) {
  5001. return t._checkPinchState(e.touches)
  5002. }), {
  5003. passive: !0
  5004. }), this._target.addEventListener("touchmove", (function(e) {
  5005. if (2 === e.touches.length && null !== t
  5006. ._startPinchMiddlePoint && void 0 !== t._handler
  5007. .pinchEvent) {
  5008. var i = qe(e.touches[0], e.touches[1]);
  5009. t._handler.pinchEvent(t._startPinchMiddlePoint, i /
  5010. t._startPinchDistance), Ze(e)
  5011. }
  5012. }), {
  5013. passive: !1
  5014. }), this._target.addEventListener("touchend", (function(e) {
  5015. t._checkPinchState(e.touches)
  5016. })))
  5017. }
  5018. }, {
  5019. key: "_checkPinchState",
  5020. value: function(t) {
  5021. 1 === t.length && (this._pinchPrevented = !1), 2 !== t.length || this
  5022. ._pinchPrevented || this._longTapActive ? this._stopPinch() : this
  5023. ._startPinch(t)
  5024. }
  5025. }, {
  5026. key: "_startPinch",
  5027. value: function(t) {
  5028. var e = Xe(this._target);
  5029. this._startPinchMiddlePoint = {
  5030. x: (t[0].clientX - e.left + (t[1].clientX - e.left)) / 2,
  5031. y: (t[0].clientY - e.top + (t[1].clientY - e.top)) / 2
  5032. }, this._startPinchDistance = qe(t[0], t[1]), void 0 !== this._handler
  5033. .pinchStartEvent && this._handler.pinchStartEvent(), this
  5034. ._clearLongTapTimeout()
  5035. }
  5036. }, {
  5037. key: "_stopPinch",
  5038. value: function() {
  5039. null !== this._startPinchMiddlePoint && (this._startPinchMiddlePoint = null,
  5040. void 0 !== this._handler.pinchEndEvent && this._handler
  5041. .pinchEndEvent())
  5042. }
  5043. }, {
  5044. key: "_mouseLeaveHandler",
  5045. value: function(t) {
  5046. this._unsubscribeMousemove && this._unsubscribeMousemove();
  5047. var e = this._makeCompatEvent(t);
  5048. this._processEvent(e, this._handler.mouseLeaveEvent)
  5049. }
  5050. }, {
  5051. key: "_longTapHandler",
  5052. value: function(t) {
  5053. var e = this._makeCompatEvent(t);
  5054. this._processEvent(e, this._handler.longTapEvent), this._cancelClick = !0,
  5055. this._longTapActive = !0
  5056. }
  5057. }, {
  5058. key: "_processEvent",
  5059. value: function(t, e) {
  5060. e && e.call(this._handler, t)
  5061. }
  5062. }, {
  5063. key: "_makeCompatEvent",
  5064. value: function(t) {
  5065. var e;
  5066. e = "touches" in t && t.touches.length ? t.touches[0] : "changedTouches" in
  5067. t && t.changedTouches.length ? t.changedTouches[0] : t;
  5068. var i = Xe(this._target);
  5069. return {
  5070. clientX: e.clientX,
  5071. clientY: e.clientY,
  5072. pageX: e.pageX,
  5073. pageY: e.pageY,
  5074. screenX: e.screenX,
  5075. screenY: e.screenY,
  5076. localX: e.clientX - i.left,
  5077. localY: e.clientY - i.top,
  5078. ctrlKey: t.ctrlKey,
  5079. altKey: t.altKey,
  5080. shiftKey: t.shiftKey,
  5081. metaKey: t.metaKey,
  5082. type: t.type.startsWith("mouse") ? $e : Je,
  5083. target: e.target,
  5084. view: t.view
  5085. }
  5086. }
  5087. }]), t
  5088. }(),
  5089. ti = function() {
  5090. function t(e, i, a, n, r, o) {
  5091. m(this, t), this._chartData = i, this._topPaneId = a, this._bottomPaneId = n, this
  5092. ._dragEnabled = r, this._width = 0, this._offsetLeft = 0, this._dragEventHandler = o, this
  5093. ._dragFlag = !1, this._initElement(e), this._initEvent(r)
  5094. }
  5095. return g(t, [{
  5096. key: "_initElement",
  5097. value: function(t) {
  5098. this._container = t, this._wrapper = this._createElement(), this._wrapper
  5099. .style.position = "relative", this._element = this._createElement(),
  5100. this._element.style.width = "100%", this._element.style.position =
  5101. "absolute", this._element.style.zIndex = "20", this._element.style.top =
  5102. "-3px", this._element.style.height = "7px", this._wrapper.appendChild(
  5103. this._element);
  5104. var e = t.lastChild;
  5105. e ? t.insertBefore(this._wrapper, e) : t.appendChild(this._wrapper)
  5106. }
  5107. }, {
  5108. key: "_initEvent",
  5109. value: function(t) {
  5110. t && (this._element.style.cursor = "ns-resize", this._dragEvent = new Qe(
  5111. this._element, {
  5112. mouseDownEvent: this._mouseDownEvent.bind(this),
  5113. mouseUpEvent: this._mouseUpEvent.bind(this),
  5114. pressedMouseMoveEvent: this._pressedMouseMoveEvent.bind(
  5115. this),
  5116. mouseEnterEvent: this._mouseEnterEvent.bind(this),
  5117. mouseLeaveEvent: this._mouseLeaveEvent.bind(this)
  5118. }, {
  5119. treatVertTouchDragAsPageScroll: !1,
  5120. treatHorzTouchDragAsPageScroll: !0
  5121. }))
  5122. }
  5123. }, {
  5124. key: "_createElement",
  5125. value: function() {
  5126. var t = document.createElement("div");
  5127. return t.style.margin = "0", t.style.padding = "0", t
  5128. }
  5129. }, {
  5130. key: "_mouseDownEvent",
  5131. value: function(t) {
  5132. this._dragFlag = !0, this._startY = t.pageY, this._dragEventHandler
  5133. .startDrag(this._topPaneId, this._bottomPaneId)
  5134. }
  5135. }, {
  5136. key: "_mouseUpEvent",
  5137. value: function() {
  5138. this._dragFlag = !1, this._chartData.setDragPaneFlag(!1)
  5139. }
  5140. }, {
  5141. key: "_pressedMouseMoveEvent",
  5142. value: function(t) {
  5143. this._dragEventHandler.drag(t.pageY - this._startY, this._topPaneId, this
  5144. ._bottomPaneId), this._chartData.setDragPaneFlag(!0), this
  5145. ._chartData.setCrosshair()
  5146. }
  5147. }, {
  5148. key: "_mouseEnterEvent",
  5149. value: function() {
  5150. var t = this._chartData.styleOptions().separator;
  5151. this._element.style.background = t.activeBackgroundColor, this._chartData
  5152. .setDragPaneFlag(!0), this._chartData.setCrosshair()
  5153. }
  5154. }, {
  5155. key: "_mouseLeaveEvent",
  5156. value: function() {
  5157. this._dragFlag || (this._element.style.background = null, this._chartData
  5158. .setDragPaneFlag(!1))
  5159. }
  5160. }, {
  5161. key: "height",
  5162. value: function() {
  5163. return this._wrapper.offsetHeight
  5164. }
  5165. }, {
  5166. key: "setSize",
  5167. value: function(t, e) {
  5168. this._offsetLeft = t, this._width = e, this.invalidate()
  5169. }
  5170. }, {
  5171. key: "setDragEnabled",
  5172. value: function(t) {
  5173. t !== this._dragEnabled && (this._dragEnabled = t, t ? !this._dragEvent &&
  5174. this._initEvent(t) : (this._element.style.cursor = "default", this
  5175. ._dragEvent && this._dragEvent.destroy(), this._dragEvent = null
  5176. ))
  5177. }
  5178. }, {
  5179. key: "topPaneId",
  5180. value: function() {
  5181. return this._topPaneId
  5182. }
  5183. }, {
  5184. key: "bottomPaneId",
  5185. value: function() {
  5186. return this._bottomPaneId
  5187. }
  5188. }, {
  5189. key: "updatePaneId",
  5190. value: function(t, e) {
  5191. F(t) && (this._topPaneId = t), F(e) && (this._bottomPaneId = e)
  5192. }
  5193. }, {
  5194. key: "invalidate",
  5195. value: function() {
  5196. var t = this._chartData.styleOptions().separator;
  5197. this._element.style.top = "".concat(-Math.floor((7 - t.size) / 2), "px"),
  5198. this._wrapper.style.backgroundColor = t.color, this._wrapper.style
  5199. .height = "".concat(t.size, "px"), this._wrapper.style.marginLeft = ""
  5200. .concat(t.fill ? 0 : this._offsetLeft, "px"), this._wrapper.style
  5201. .width = t.fill ? "100%" : "".concat(this._width, "px")
  5202. }
  5203. }, {
  5204. key: "getImage",
  5205. value: function() {
  5206. var t = this._chartData.styleOptions().separator,
  5207. e = document.createElement("canvas"),
  5208. i = e.getContext("2d"),
  5209. a = _e(e),
  5210. n = this._wrapper.offsetWidth,
  5211. r = t.size;
  5212. return e.style.width = "".concat(n, "px"), e.style.height = "".concat(r,
  5213. "px"), e.width = n * a, e.height = r * a, i.scale(a, a), i
  5214. .fillStyle = t.color, i.fillRect(this._offsetLeft, 0, n, r), e
  5215. }
  5216. }, {
  5217. key: "destroy",
  5218. value: function() {
  5219. this._dragEvent && this._dragEvent.destroy(), this._container.removeChild(
  5220. this._wrapper)
  5221. }
  5222. }]), t
  5223. }();
  5224. function ei(t) {
  5225. return t.type === Je
  5226. }
  5227. function ii(t) {
  5228. return t.type === $e
  5229. }
  5230. var ai = function() {
  5231. function t(e) {
  5232. m(this, t), this._chartData = e, this._chartContentSize = {}, this._paneContentSize = {}
  5233. }
  5234. return g(t, [{
  5235. key: "_checkEventPointX",
  5236. value: function(t) {
  5237. return t > 0 && this._chartContentSize.contentRight - this._chartContentSize
  5238. .contentLeft > t
  5239. }
  5240. }, {
  5241. key: "setChartContentSize",
  5242. value: function(t) {
  5243. this._chartContentSize = t
  5244. }
  5245. }, {
  5246. key: "setPaneContentSize",
  5247. value: function(t) {
  5248. this._paneContentSize = t
  5249. }
  5250. }]), t
  5251. }(),
  5252. ni = function(t) {
  5253. D(i, t);
  5254. var e = P(i);
  5255. function i(t) {
  5256. var a;
  5257. return m(this, i), (a = e.call(this, t))._startScrollPoint = {}, a._touchPoint = null, a
  5258. ._touchCancelCrossHair = !1, a._touchZoomed = !1, a._pinchScale = 1, a
  5259. }
  5260. return g(i, [{
  5261. key: "pinchStartEvent",
  5262. value: function() {
  5263. this._pinchScale = 1, this._touchZoomed = !0
  5264. }
  5265. }, {
  5266. key: "pinchEvent",
  5267. value: function(t, e) {
  5268. var i = 5 * (e - this._pinchScale);
  5269. this._pinchScale = e, this._chartData.zoom(i, t)
  5270. }
  5271. }, {
  5272. key: "mouseLeaveEvent",
  5273. value: function(t) {
  5274. ii(t) && this._chartData.setCrosshair()
  5275. }
  5276. }, {
  5277. key: "mouseMoveEvent",
  5278. value: function(t) {
  5279. var e = this;
  5280. ii(t) && this._performCross(t, !1, (function(i) {
  5281. e._chartData.setCrosshair({
  5282. x: t.localX,
  5283. y: i.y,
  5284. paneId: i.paneId
  5285. })
  5286. }), (function() {
  5287. e._chartData.setCrosshair()
  5288. }))
  5289. }
  5290. }, {
  5291. key: "mouseWheelEvent",
  5292. value: function(t) {
  5293. if (this._checkEventPointX(t.localX))
  5294. if (Math.abs(t.deltaX) > Math.abs(t.deltaY)) {
  5295. if (t.cancelable && t.preventDefault(), 0 === Math.abs(t.deltaX))
  5296. return;
  5297. this._chartData.startScroll(), this._chartData.scroll(-t.deltaX)
  5298. } else {
  5299. var e = -t.deltaY / 100;
  5300. if (0 === e) return;
  5301. switch (t.cancelable && t.preventDefault(), t.deltaMode) {
  5302. case t.DOM_DELTA_PAGE:
  5303. e *= 120;
  5304. break;
  5305. case t.DOM_DELTA_LINE:
  5306. e *= 32
  5307. }
  5308. if (0 !== e) {
  5309. var i = Math.sign(e) * Math.min(1, Math.abs(e));
  5310. this._chartData.zoom(i, {
  5311. x: t.localX,
  5312. y: t.localY
  5313. })
  5314. }
  5315. }
  5316. }
  5317. }, {
  5318. key: "mouseClickEvent",
  5319. value: function(t) {
  5320. var e = this;
  5321. this._performCross(t, !0, (function(i) {
  5322. e._touchPoint || e._touchCancelCrossHair || e
  5323. ._touchZoomed || (e._touchPoint = {
  5324. x: t.localX,
  5325. y: t.localY
  5326. }, e._chartData.setCrosshair({
  5327. x: t.localX,
  5328. y: i.y,
  5329. paneId: i.paneId
  5330. }))
  5331. }))
  5332. }
  5333. }, {
  5334. key: "mouseDownEvent",
  5335. value: function(t) {
  5336. var e = this;
  5337. this._startScrollPoint = {
  5338. x: t.localX,
  5339. y: t.localY
  5340. }, this._chartData.startScroll(), this._performCross(t, !0, (function(
  5341. i) {
  5342. if (e._touchZoomed = !1, e._touchPoint) {
  5343. var a = t.localX - e._touchPoint.x,
  5344. n = t.localY - e._touchPoint.y;
  5345. 10 > Math.sqrt(a * a + n * n) ? (e._touchPoint = {
  5346. x: t.localX,
  5347. y: t.localY
  5348. }, e._chartData.setCrosshair({
  5349. x: t.localX,
  5350. y: i.y,
  5351. paneId: i.paneId
  5352. })) : (e._touchCancelCrossHair = !0, e._touchPoint =
  5353. null, e._chartData.setCrosshair())
  5354. } else e._touchCancelCrossHair = !1
  5355. }))
  5356. }
  5357. }, {
  5358. key: "pressedMouseMoveEvent",
  5359. value: function(t) {
  5360. var e = this;
  5361. this._performCross(t, !1, (function(i) {
  5362. var a = {
  5363. x: t.localX,
  5364. y: i.y,
  5365. paneId: i.paneId
  5366. };
  5367. if (ei(t)) {
  5368. if (e._touchPoint) return e._touchPoint = {
  5369. x: t.localX,
  5370. y: t.localY
  5371. }, void e._chartData.setCrosshair(a);
  5372. a = null
  5373. }
  5374. e._chartData.scroll(t.localX - e._startScrollPoint.x, a)
  5375. }))
  5376. }
  5377. }, {
  5378. key: "longTapEvent",
  5379. value: function(t) {
  5380. var e = this;
  5381. this._performCross(t, !0, (function(i) {
  5382. e._touchPoint = {
  5383. x: t.localX,
  5384. y: t.localY
  5385. }, e._chartData.setCrosshair({
  5386. x: t.localX,
  5387. y: i.y,
  5388. paneId: i.paneId
  5389. })
  5390. }))
  5391. }
  5392. }, {
  5393. key: "_performCross",
  5394. value: function(t, e, i, a) {
  5395. if (!e || ei(t))
  5396. if (this._checkEventPointX(t.localX)) {
  5397. var n = !1;
  5398. for (var r in this._paneContentSize) {
  5399. var o = this._paneContentSize[r];
  5400. if (t.localY > o.contentTop && o.contentBottom > t.localY) {
  5401. n = !0, i && i({
  5402. paneId: r,
  5403. y: t.localY - o.contentTop
  5404. });
  5405. break
  5406. }
  5407. }!n && a && a()
  5408. } else a && a()
  5409. }
  5410. }]), i
  5411. }(ai),
  5412. ri = function(t) {
  5413. D(i, t);
  5414. var e = P(i);
  5415. function i(t) {
  5416. var a;
  5417. return m(this, i), (a = e.call(this, t))._pressedGraphicMark = null, a
  5418. }
  5419. return g(i, [{
  5420. key: "_performOverlayMouseHover",
  5421. value: function(t, e, i, a) {
  5422. var n, r, o = A(t);
  5423. try {
  5424. for (o.s(); !(r = o.n()).done;) {
  5425. if (n = r.value.checkMousePointOnGraphic(i)) break
  5426. }
  5427. } catch (t) {
  5428. o.e(t)
  5429. } finally {
  5430. o.f()
  5431. }
  5432. return n && e.id === n.id || (e.id && e.instance && ii(a) && e.instance
  5433. .onMouseLeave({
  5434. id: e.id,
  5435. points: e.instance.points(),
  5436. event: a
  5437. }), n && n.id !== e.id && n.instance && ii(a) && n.instance
  5438. .onMouseEnter({
  5439. id: n.id,
  5440. points: n.instance.points(),
  5441. event: a
  5442. })), n
  5443. }
  5444. }, {
  5445. key: "mouseUpEvent",
  5446. value: function(t) {
  5447. this._pressedGraphicMark && (this._pressedGraphicMark = null, this
  5448. ._chartData.setDragGraphicMarkFlag(!1))
  5449. }
  5450. }, {
  5451. key: "mouseMoveEvent",
  5452. value: function(t) {
  5453. if (this._checkEventPointX(t.localX) && this._checkEventPointY(t.localY) &&
  5454. !this._waitingForMouseMoveAnimationFrame) {
  5455. this._waitingForMouseMoveAnimationFrame = !0;
  5456. var e, i, a, n = {
  5457. x: t.localX,
  5458. y: t.localY
  5459. },
  5460. r = this._chartData.graphicMarks(),
  5461. o = this._chartData.visibleAnnotations(),
  5462. s = r[r.length - 1],
  5463. c = this._chartData.graphicMarkMouseOperate().hover,
  5464. h = this._chartData.annotationMouseOperate();
  5465. s && s.isDrawing() ? (s.mouseMoveForDrawing(n), e = s
  5466. .checkMousePointOnGraphic(n), i = {
  5467. id: "",
  5468. element: Gt,
  5469. elementIndex: -1
  5470. }) : (e = this._performOverlayMouseHover(r, c, n, t), a = this
  5471. ._performOverlayMouseHover(o, h, n, t)), this._chartData
  5472. .setOverlayMouseOperate({
  5473. hover: e || {
  5474. id: "",
  5475. element: Gt,
  5476. elementIndex: -1
  5477. },
  5478. click: i
  5479. }, a || {
  5480. id: ""
  5481. }), this._waitingForMouseMoveAnimationFrame = !1
  5482. }
  5483. }
  5484. }, {
  5485. key: "mouseDownEvent",
  5486. value: function(t) {
  5487. if (this._checkEventPointX(t.localX) && this._checkEventPointY(t.localY)) {
  5488. var e, i = {
  5489. x: t.localX,
  5490. y: t.localY
  5491. },
  5492. a = this._chartData.graphicMarks(),
  5493. n = a[a.length - 1],
  5494. r = {
  5495. id: "",
  5496. element: Gt,
  5497. elementIndex: -1
  5498. };
  5499. if (n && n.isDrawing()) n.mouseLeftButtonDownForDrawing(i), e = n
  5500. .checkMousePointOnGraphic(i);
  5501. else {
  5502. var o, s = A(a);
  5503. try {
  5504. for (s.s(); !(o = s.n()).done;) {
  5505. var c = o.value;
  5506. if (e = c.checkMousePointOnGraphic(i)) {
  5507. e.element === Wt && (this._pressedGraphicMark = c, this
  5508. ._chartData.setDragGraphicMarkFlag(!0), r =
  5509. p({}, e)), c.onClick({
  5510. id: e.id,
  5511. points: c.points(),
  5512. event: t
  5513. });
  5514. break
  5515. }
  5516. }
  5517. } catch (t) {
  5518. s.e(t)
  5519. } finally {
  5520. s.f()
  5521. }
  5522. var h, l = A(this._chartData.visibleAnnotations());
  5523. try {
  5524. for (l.s(); !(h = l.n()).done;) {
  5525. var u = h.value,
  5526. d = u.checkMousePointOnGraphic(i);
  5527. if (d) {
  5528. u.onClick({
  5529. id: d.id,
  5530. points: u.points(),
  5531. event: t
  5532. });
  5533. break
  5534. }
  5535. }
  5536. } catch (t) {
  5537. l.e(t)
  5538. } finally {
  5539. l.f()
  5540. }
  5541. }
  5542. this._chartData.setOverlayMouseOperate({
  5543. hover: r,
  5544. click: e || {
  5545. id: "",
  5546. element: Gt,
  5547. elementIndex: -1
  5548. }
  5549. })
  5550. }
  5551. }
  5552. }, {
  5553. key: "mouseRightDownEvent",
  5554. value: function(t) {
  5555. var e = this._chartData.graphicMarks().find((function(e) {
  5556. return e.checkMousePointOnGraphic({
  5557. x: t.localX,
  5558. y: t.localY
  5559. })
  5560. }));
  5561. e && !e.onRightClick({
  5562. id: e.id(),
  5563. points: e.points(),
  5564. event: t
  5565. }) && this._chartData.removeGraphicMarkInstance(e.id());
  5566. var i = this._chartData.visibleAnnotations().find((function(e) {
  5567. return e.checkMousePointOnGraphic({
  5568. x: t.localX,
  5569. y: t.localY
  5570. })
  5571. }));
  5572. i && i.onRightClick({
  5573. id: i.id(),
  5574. points: i.points(),
  5575. event: t
  5576. })
  5577. }
  5578. }, {
  5579. key: "pressedMouseMoveEvent",
  5580. value: function(t) {
  5581. var e = this._chartData.graphicMarks(),
  5582. i = e[e.length - 1];
  5583. i && i.isDrawing() || !this._pressedGraphicMark || (this._pressedGraphicMark
  5584. .mousePressedMove({
  5585. x: t.localX,
  5586. y: t.localY
  5587. }, t), this._chartData.invalidate(ce))
  5588. }
  5589. }, {
  5590. key: "_checkEventPointY",
  5591. value: function(t) {
  5592. var e = this._paneContentSize.candle_pane;
  5593. return t > e.contentTop && e.contentBottom > t
  5594. }
  5595. }]), i
  5596. }(ai),
  5597. oi = "Equal",
  5598. si = "Minus",
  5599. ci = "ArrowLeft",
  5600. hi = "ArrowRight",
  5601. li = function(t) {
  5602. D(i, t);
  5603. var e = P(i);
  5604. function i() {
  5605. return m(this, i), e.apply(this, arguments)
  5606. }
  5607. return g(i, [{
  5608. key: "keyBoardDownEvent",
  5609. value: function(t) {
  5610. if (t.shiftKey) switch (t.code) {
  5611. case oi:
  5612. this._chartData.zoom(.5);
  5613. break;
  5614. case si:
  5615. this._chartData.zoom(-.5);
  5616. break;
  5617. case ci:
  5618. this._chartData.startScroll(), this._chartData.scroll(-3 * this
  5619. ._chartData.dataSpace());
  5620. break;
  5621. case hi:
  5622. this._chartData.startScroll(), this._chartData.scroll(3 * this
  5623. ._chartData.dataSpace())
  5624. }
  5625. }
  5626. }]), i
  5627. }(ai),
  5628. ui = function() {
  5629. function t(e, i) {
  5630. m(this, t), this._target = e, this._chartData = i, this._chartContentSize = {}, this._event =
  5631. new Qe(this._target, {
  5632. pinchStartEvent: this._pinchStartEvent.bind(this),
  5633. pinchEvent: this._pinchEvent.bind(this),
  5634. mouseUpEvent: this._mouseUpEvent.bind(this),
  5635. mouseClickEvent: this._mouseClickEvent.bind(this),
  5636. mouseDownEvent: this._mouseDownEvent.bind(this),
  5637. mouseRightDownEvent: this._mouseRightDownEvent.bind(this),
  5638. mouseLeaveEvent: this._mouseLeaveEvent.bind(this),
  5639. mouseMoveEvent: this._mouseMoveEvent.bind(this),
  5640. mouseWheelEvent: this._mouseWheelEvent.bind(this),
  5641. pressedMouseMoveEvent: this._pressedMouseMoveEvent.bind(this),
  5642. longTapEvent: this._longTapEvent.bind(this)
  5643. }, {
  5644. treatVertTouchDragAsPageScroll: !1,
  5645. treatHorzTouchDragAsPageScroll: !1
  5646. }), this._boundKeyBoardDownEvent = this._keyBoardDownEvent.bind(this), this._target
  5647. .addEventListener("keydown", this._boundKeyBoardDownEvent), this._boundContextMenuEvent =
  5648. function(t) {
  5649. t.preventDefault()
  5650. }, this._target.addEventListener("contextmenu", this._boundContextMenuEvent, !1), this
  5651. ._zoomScrollEventHandler = new ni(i), this._overlayEventHandler = new ri(i), this
  5652. ._keyBoardEventHandler = new li(i)
  5653. }
  5654. return g(t, [{
  5655. key: "_keyBoardDownEvent",
  5656. value: function(t) {
  5657. this._keyBoardEventHandler.keyBoardDownEvent(t)
  5658. }
  5659. }, {
  5660. key: "_pinchStartEvent",
  5661. value: function() {
  5662. this._zoomScrollEventHandler.pinchStartEvent()
  5663. }
  5664. }, {
  5665. key: "_pinchEvent",
  5666. value: function(t, e) {
  5667. this._zoomScrollEventHandler.pinchEvent(t, e)
  5668. }
  5669. }, {
  5670. key: "_mouseUpEvent",
  5671. value: function(t) {
  5672. this._target.style.cursor = "crosshair", this
  5673. ._shouldPerformOverlayEvent() && (t.localX -= this._chartContentSize
  5674. .contentLeft, this._overlayEventHandler.mouseUpEvent(t))
  5675. }
  5676. }, {
  5677. key: "_mouseLeaveEvent",
  5678. value: function(t) {
  5679. this._checkZoomScroll() && (t.localX -= this._chartContentSize.contentLeft,
  5680. this._zoomScrollEventHandler.mouseLeaveEvent(t))
  5681. }
  5682. }, {
  5683. key: "_mouseMoveEvent",
  5684. value: function(t) {
  5685. t.localX -= this._chartContentSize.contentLeft, this
  5686. ._shouldPerformOverlayEvent() && this._overlayEventHandler
  5687. .mouseMoveEvent(t), this._checkZoomScroll() && this
  5688. ._zoomScrollEventHandler.mouseMoveEvent(t)
  5689. }
  5690. }, {
  5691. key: "_mouseWheelEvent",
  5692. value: function(t) {
  5693. this._checkZoomScroll() && this._zoomScrollEventHandler.mouseWheelEvent(t)
  5694. }
  5695. }, {
  5696. key: "_mouseClickEvent",
  5697. value: function(t) {
  5698. this._checkZoomScroll() && (t.localX -= this._chartContentSize.contentLeft,
  5699. this._zoomScrollEventHandler.mouseClickEvent(t))
  5700. }
  5701. }, {
  5702. key: "_mouseDownEvent",
  5703. value: function(t) {
  5704. this._target.style.cursor = "pointer", t.localX -= this._chartContentSize
  5705. .contentLeft, this._shouldPerformOverlayEvent() && this
  5706. ._overlayEventHandler.mouseDownEvent(t), this._checkZoomScroll() && this
  5707. ._zoomScrollEventHandler.mouseDownEvent(t)
  5708. }
  5709. }, {
  5710. key: "_mouseRightDownEvent",
  5711. value: function(t) {
  5712. this._shouldPerformOverlayEvent() && (t.localX -= this._chartContentSize
  5713. .contentLeft, this._overlayEventHandler.mouseRightDownEvent(t))
  5714. }
  5715. }, {
  5716. key: "_pressedMouseMoveEvent",
  5717. value: function(t) {
  5718. t.localX -= this._chartContentSize.contentLeft, this._chartData
  5719. .dragGraphicMarkFlag() && (this._overlayEventHandler
  5720. .pressedMouseMoveEvent(t), this._chartData.crosshair().paneId &&
  5721. this._chartData.setCrosshair()), this._checkZoomScroll() && this
  5722. ._zoomScrollEventHandler.pressedMouseMoveEvent(t)
  5723. }
  5724. }, {
  5725. key: "_longTapEvent",
  5726. value: function(t) {
  5727. this._checkZoomScroll() && (t.localX -= this._chartContentSize.contentLeft,
  5728. this._zoomScrollEventHandler.longTapEvent(t))
  5729. }
  5730. }, {
  5731. key: "_checkZoomScroll",
  5732. value: function() {
  5733. var t = this._chartData.graphicMarks(),
  5734. e = t.length;
  5735. return !(this._chartData.dragPaneFlag() || this._chartData
  5736. .dragGraphicMarkFlag() || 0 !== e && t[e - 1].isDrawing())
  5737. }
  5738. }, {
  5739. key: "_shouldPerformOverlayEvent",
  5740. value: function() {
  5741. return this._chartData.graphicMarks().length > 0 || this._chartData
  5742. .visibleAnnotations().length > 0
  5743. }
  5744. }, {
  5745. key: "setChartContentSize",
  5746. value: function(t) {
  5747. this._chartContentSize = t, this._zoomScrollEventHandler
  5748. .setChartContentSize(t), this._overlayEventHandler.setChartContentSize(
  5749. t)
  5750. }
  5751. }, {
  5752. key: "setPaneContentSize",
  5753. value: function(t) {
  5754. this._zoomScrollEventHandler.setPaneContentSize(t), this
  5755. ._overlayEventHandler.setPaneContentSize(t)
  5756. }
  5757. }, {
  5758. key: "destroy",
  5759. value: function() {
  5760. this._event.destroy(), this._target.removeEventListener("keydown", this
  5761. ._boundKeyBoardDownEvent), this._target.removeEventListener(
  5762. "contextmenu", this._boundContextMenuEvent)
  5763. }
  5764. }]), t
  5765. }();
  5766. function di(t) {
  5767. var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 20,
  5768. i = 0;
  5769. return function() {
  5770. var a = Date.now(),
  5771. n = this,
  5772. r = arguments;
  5773. a - i > e && (t.apply(n, r), i = a)
  5774. }
  5775. }
  5776. var _i = function(t) {
  5777. D(i, t);
  5778. var e = P(i);
  5779. function i(t) {
  5780. var a, n = t.id,
  5781. r = t.point,
  5782. o = t.chartData,
  5783. s = t.xAxis,
  5784. c = t.yAxis,
  5785. h = t.styles;
  5786. return m(this, i), (a = e.call(this, {
  5787. id: n,
  5788. chartData: o,
  5789. xAxis: s,
  5790. yAxis: c
  5791. }))._point = r, a._symbolCoordinate = {}, a.setStyles(h, o.styleOptions().annotation), a
  5792. }
  5793. return g(i, [{
  5794. key: "_drawSymbol",
  5795. value: function(t, e, i) {
  5796. var a = this._chartData.barSpace(),
  5797. n = i.symbol,
  5798. r = n.size,
  5799. o = n.activeSize,
  5800. s = e ? R(o) ? o : a : R(r) ? r : a,
  5801. c = e ? n.activeColor : n.color;
  5802. switch (n.type) {
  5803. case it:
  5804. Ct(t, c, this._symbolCoordinate, s / 2);
  5805. break;
  5806. case at:
  5807. ! function(t, e, i, a, n, r) {
  5808. t.fillStyle = e, t.fillRect(i, a, n, r)
  5809. }(t, c, this._symbolCoordinate.x - s / 2, this._symbolCoordinate.y -
  5810. s / 2, s, s);
  5811. break;
  5812. case rt:
  5813. ! function(t, e, i, a, n) {
  5814. t.fillStyle = e, t.beginPath(), t.moveTo(i.x - a / 2, i.y), t
  5815. .lineTo(i.x, i.y - n / 2), t.lineTo(i.x + a / 2, i.y), t
  5816. .lineTo(i.x, i.y + n / 2), t.closePath(), t.fill()
  5817. }(t, c, this._symbolCoordinate, s, s);
  5818. break;
  5819. case nt:
  5820. ! function(t, e, i, a, n) {
  5821. t.fillStyle = e, t.beginPath(), t.moveTo(i.x - a / 2, i.y + n /
  5822. 2), t.lineTo(i.x, i.y - n / 2), t.lineTo(i.x + a / 2, i
  5823. .y + n / 2), t.closePath(), t.fill()
  5824. }(t, c, this._symbolCoordinate, s, s);
  5825. break;
  5826. case ot:
  5827. this.drawCustomSymbol({
  5828. ctx: t,
  5829. point: this._point,
  5830. coordinate: this._symbolCoordinate,
  5831. viewport: {
  5832. width: this._xAxis.width(),
  5833. height: this._yAxis.height(),
  5834. barSpace: a
  5835. },
  5836. styles: n,
  5837. isActive: e
  5838. })
  5839. }
  5840. }
  5841. }, {
  5842. key: "draw",
  5843. value: function(t) {
  5844. var e = this._styles || this._chartData.styleOptions().annotation,
  5845. i = e.symbol,
  5846. a = i.offset || [],
  5847. n = 0;
  5848. switch (i.position) {
  5849. case st:
  5850. n = this._yAxis.convertToPixel(this._point.price);
  5851. break;
  5852. case ct:
  5853. n = 0;
  5854. break;
  5855. case ht:
  5856. n = this._yAxis.height()
  5857. }
  5858. this._symbolCoordinate.y = n + (a[1] || 0);
  5859. var r = this._id === this._chartData.annotationMouseOperate().id;
  5860. this._drawSymbol(t, r, e), this.drawExtend && (t.save(), this.drawExtend({
  5861. ctx: t,
  5862. point: this._point,
  5863. coordinate: this._symbolCoordinate,
  5864. viewport: {
  5865. width: this._xAxis.width(),
  5866. height: this._yAxis.height()
  5867. },
  5868. styles: e,
  5869. isActive: r
  5870. }), t.restore())
  5871. }
  5872. }, {
  5873. key: "checkMousePointOnGraphic",
  5874. value: function(t) {
  5875. var e, i, a, n, r = this._chartData.barSpace(),
  5876. o = (this._styles || this._chartData.styleOptions().annotation).symbol,
  5877. s = R(o.size) ? o.size : r;
  5878. switch (o.type) {
  5879. case it:
  5880. e = Ft(this._symbolCoordinate, s / 2, t);
  5881. break;
  5882. case at:
  5883. a = {
  5884. x: this._symbolCoordinate.x + s / 2,
  5885. y: this._symbolCoordinate.y + s / 2
  5886. }, e = !((i = {
  5887. x: this._symbolCoordinate.x - s / 2,
  5888. y: this._symbolCoordinate.y - s / 2
  5889. }).x > (n = t).x || n.x > a.x || i.y > n.y || n.y > a.y);
  5890. break;
  5891. case rt:
  5892. e = function(t, e, i, a) {
  5893. return e * i / 2 + 2 > Math.abs(t.x - a.x) * i + Math.abs(t
  5894. .y - a.y) * e
  5895. }(this._symbolCoordinate, s, s, t);
  5896. break;
  5897. case nt:
  5898. e = function(t, e) {
  5899. var i = At(t[0], t[1], t[2]),
  5900. a = At(t[0], t[1], e) + At(t[0], t[2], e) + At(t[1], t[
  5901. 2], e);
  5902. return 2 > Math.abs(i - a)
  5903. }([{
  5904. x: this._symbolCoordinate.x - s / 2,
  5905. y: this._symbolCoordinate.y + s / 2
  5906. }, {
  5907. x: this._symbolCoordinate.x,
  5908. y: this._symbolCoordinate.y - s / 2
  5909. }, {
  5910. x: this._symbolCoordinate.x + s / 2,
  5911. y: this._symbolCoordinate.y + s / 2
  5912. }], t);
  5913. break;
  5914. case ot:
  5915. e = this.checkPointInCustomSymbol({
  5916. mouseCoordinate: t,
  5917. coordinate: this._symbolCoordinate,
  5918. size: s
  5919. })
  5920. }
  5921. if (e) return {
  5922. id: this._id,
  5923. instance: this
  5924. }
  5925. }
  5926. }, {
  5927. key: "createSymbolCoordinate",
  5928. value: function(t) {
  5929. var e = this._styles || this._chartData.styleOptions().annotation;
  5930. this._symbolCoordinate = {
  5931. x: t + ((e.symbol.offset || [])[0] || 0)
  5932. }
  5933. }
  5934. }, {
  5935. key: "points",
  5936. value: function() {
  5937. return this._point
  5938. }
  5939. }, {
  5940. key: "checkPointInCustomSymbol",
  5941. value: function(t) {}
  5942. }, {
  5943. key: "drawCustomSymbol",
  5944. value: function(t) {}
  5945. }]), i
  5946. }(Et),
  5947. vi = function(t) {
  5948. D(i, t);
  5949. var e = P(i);
  5950. function i(t) {
  5951. var a, n = t.id,
  5952. r = t.point,
  5953. o = t.text,
  5954. s = t.mark,
  5955. c = t.chartData,
  5956. h = t.xAxis,
  5957. l = t.yAxis,
  5958. u = t.styles;
  5959. return m(this, i), (a = e.call(this, {
  5960. id: n,
  5961. chartData: c,
  5962. xAxis: h,
  5963. yAxis: l
  5964. }))._point = r || {}, a._text = o, a._mark = s, a.setStyles(u, c.styleOptions().tag), a
  5965. }
  5966. return g(i, [{
  5967. key: "update",
  5968. value: function(t) {
  5969. var e = t.point,
  5970. i = t.text,
  5971. a = t.mark,
  5972. n = t.styles,
  5973. r = !1;
  5974. return O(e) && (this._point = e, r = !0), F(i) && (this._text = i, r = !0),
  5975. F(a) && (this._mark = a, r = !0), this.setStyles(n, this._chartData
  5976. .styleOptions().tag) && (r = !0), r
  5977. }
  5978. }, {
  5979. key: "drawMarkLine",
  5980. value: function(t) {
  5981. var e = this._chartData.styleOptions(),
  5982. i = e.yAxis,
  5983. a = this._styles || e.tag,
  5984. n = this._getY(a);
  5985. t.save(), this._drawLine(t, n, a.line), this._drawMark(t, n, a, i), t
  5986. .restore()
  5987. }
  5988. }, {
  5989. key: "drawText",
  5990. value: function(t) {
  5991. if (F(this._text)) {
  5992. var e = this._chartData.styleOptions(),
  5993. i = this._styles || e.tag,
  5994. a = i.text;
  5995. t.font = fe(a.size, a.weight, a.family);
  5996. var n, r = this._getTextRectWidth(t, a),
  5997. o = a.paddingTop + a.paddingBottom + a.size;
  5998. n = this._yAxis.isFromYAxisZero() ? 0 : this._yAxis.width() - r;
  5999. var s = this._getY(i);
  6000. Pe(t, a.backgroundColor, n, s - o / 2, r, o, a.borderRadius), ke(t, a
  6001. .color, n + a.paddingLeft, s, this._text)
  6002. }
  6003. }
  6004. }, {
  6005. key: "_drawLine",
  6006. value: function(t, e, i) {
  6007. i.show && (t.strokeStyle = i.color, t.lineWidth = i.size, i.style === H && t
  6008. .setLineDash(i.dashValue), Bt(t, e, 0, this._xAxis.width()))
  6009. }
  6010. }, {
  6011. key: "_drawMark",
  6012. value: function(t, e, i, a) {
  6013. if (F(this._mark)) {
  6014. var n = i.mark;
  6015. t.font = fe(n.size, n.weight, n.family);
  6016. var r, o = n.paddingLeft + n.paddingRight + ve(t, this._mark),
  6017. s = n.paddingTop + n.paddingBottom + n.size;
  6018. if (a.inside) {
  6019. var c = 0;
  6020. F(this._text) && (c = this._getTextRectWidth(t, i.text)), r = a
  6021. .position === Y ? c : this._xAxis.width() - c - o
  6022. } else r = a.position === Y ? 0 : this._xAxis.width() - o;
  6023. Pe(t, n.backgroundColor, r, e - s / 2, o, s, n.borderRadius), t
  6024. .textBaseline = "middle", t.font = fe(n.size, n.weight, n.family),
  6025. ke(t, n.color, r + n.paddingLeft, e, this._mark)
  6026. }
  6027. }
  6028. }, {
  6029. key: "_getY",
  6030. value: function(t) {
  6031. var e = t.offset;
  6032. switch (t.position) {
  6033. case ct:
  6034. return e;
  6035. case ht:
  6036. return this._yAxis.height() + e;
  6037. default:
  6038. return this._yAxis.convertToNicePixel(this._point.price) + e
  6039. }
  6040. }
  6041. }, {
  6042. key: "_getTextRectWidth",
  6043. value: function(t, e) {
  6044. return t.font = fe(e.size, e.weight, e.family), e.paddingLeft + e
  6045. .paddingRight + ve(t, this._text)
  6046. }
  6047. }]), i
  6048. }(Et),
  6049. fi = function() {
  6050. function t(e, i) {
  6051. m(this, t), this._initChartContainer(e), this._graphicMarkBaseId = 0, this._paneBaseId = 0, this
  6052. ._separatorDragStartTopPaneHeight = 0, this._separatorDragStartBottomPaneHeight = 0, this
  6053. ._chartData = new de(i, {
  6054. invalidate: this._invalidatePane.bind(this),
  6055. crosshair: this._crosshairObserver.bind(this)
  6056. }), this._xAxisPane = new We({
  6057. container: this._chartContainer,
  6058. chartData: this._chartData
  6059. }), this._panes = new Map([
  6060. [se, new ze({
  6061. container: this._chartContainer,
  6062. chartData: this._chartData,
  6063. xAxis: this._xAxisPane.xAxis(),
  6064. id: se
  6065. })]
  6066. ]), this._separators = new Map, this._chartWidth = {}, this._chartHeight = {}, this
  6067. ._chartEvent = new ui(this._chartContainer, this._chartData), this.adjustPaneViewport(!0, !
  6068. 0, !0)
  6069. }
  6070. return g(t, [{
  6071. key: "_initChartContainer",
  6072. value: function(t) {
  6073. this._container = t, this._chartContainer = document.createElement("div"),
  6074. this._chartContainer.style.userSelect = "none", this._chartContainer
  6075. .style.webkitUserSelect = "none", this._chartContainer.style
  6076. .msUserSelect = "none", this._chartContainer.style.MozUserSelect =
  6077. "none", this._chartContainer.style.webkitTapHighlightColor =
  6078. "transparent", this._chartContainer.style.position = "relative", this
  6079. ._chartContainer.style.outline = "none", this._chartContainer.style
  6080. .borderStyle = "none", this._chartContainer.style.width = "100%", this
  6081. ._chartContainer.style.cursor = "crosshair", this._chartContainer
  6082. .tabIndex = 1, t.appendChild(this._chartContainer)
  6083. }
  6084. }, {
  6085. key: "_crosshairObserver",
  6086. value: function(t) {
  6087. var e = t.dataIndex,
  6088. i = t.kLineData,
  6089. a = t.x,
  6090. n = t.y;
  6091. if (this.chartData().hasAction(ue.CROSSHAIR)) {
  6092. var r = {};
  6093. this._panes.forEach((function(t, i) {
  6094. var a = {};
  6095. t.technicalIndicators().forEach((function(t) {
  6096. a[t.name] = t.result[e]
  6097. })), r[i] = a
  6098. })), this._chartData.actionExecute(ue.CROSSHAIR, {
  6099. coordinate: {
  6100. x: a,
  6101. y: n
  6102. },
  6103. dataIndex: e,
  6104. kLineData: i,
  6105. technicalIndicatorData: r
  6106. })
  6107. }
  6108. }
  6109. }, {
  6110. key: "_separatorStartDrag",
  6111. value: function(t, e) {
  6112. this._separatorDragStartTopPaneHeight = this._panes.get(t).height(), this
  6113. ._separatorDragStartBottomPaneHeight = this._panes.get(e).height()
  6114. }
  6115. }, {
  6116. key: "_separatorDrag",
  6117. value: function(t, e, i) {
  6118. var a = this._separatorDragStartTopPaneHeight + t,
  6119. n = this._separatorDragStartBottomPaneHeight - t;
  6120. a > this._separatorDragStartTopPaneHeight + this
  6121. ._separatorDragStartBottomPaneHeight && (a = this
  6122. ._separatorDragStartTopPaneHeight + this
  6123. ._separatorDragStartBottomPaneHeight, n = 0), 0 > a && (a = 0, n =
  6124. this._separatorDragStartTopPaneHeight + this
  6125. ._separatorDragStartBottomPaneHeight), this._panes.get(e).setHeight(
  6126. a), this._panes.get(i).setHeight(n), this._chartData.actionExecute(
  6127. ue.PANE_DRAG, {
  6128. topPaneId: e,
  6129. bottomPaneId: i,
  6130. topPaneHeight: a,
  6131. bottomPaneHeight: n
  6132. }), this.adjustPaneViewport(!0, !0, !0, !0, !0)
  6133. }
  6134. }, {
  6135. key: "_invalidatePane",
  6136. value: function() {
  6137. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : le;
  6138. if (t === ce) this._xAxisPane.invalidate(t), this._panes.forEach((function(
  6139. e) {
  6140. e.invalidate(t)
  6141. }));
  6142. else {
  6143. var e = !1;
  6144. this._panes.forEach((function(t) {
  6145. var i = t.yAxis().computeAxis();
  6146. i && (e = i)
  6147. })), this.adjustPaneViewport(!1, e, !0)
  6148. }
  6149. }
  6150. }, {
  6151. key: "_calcAllPaneTechnicalIndicator",
  6152. value: function() {
  6153. var t = this,
  6154. e = [];
  6155. this._panes.forEach((function(t) {
  6156. e.push(Promise.resolve(t.calcAllTechnicalIndicator()))
  6157. })), Promise.all(e).then((function(e) {
  6158. var i = e.indexOf(!0) > -1;
  6159. t.adjustPaneViewport(!1, i, !0)
  6160. }))
  6161. }
  6162. }, {
  6163. key: "_measurePaneHeight",
  6164. value: function() {
  6165. var t = this,
  6166. e = this._chartData.styleOptions(),
  6167. i = this._container.offsetHeight,
  6168. a = e.separator.size,
  6169. n = a * this._separators.size,
  6170. r = this._xAxisPane.xAxis().getSelfHeight(),
  6171. o = i - r - n,
  6172. s = 0;
  6173. this._panes.forEach((function(t) {
  6174. if (t.id() !== se) {
  6175. var e = t.height();
  6176. s + e > o ? (t.setHeight(o - s), s = o) : s += e
  6177. }
  6178. }));
  6179. var c = o - s,
  6180. h = {};
  6181. h.candle_pane = {
  6182. contentTop: 0,
  6183. contentBottom: c
  6184. };
  6185. var l = c,
  6186. u = c;
  6187. this._panes.get(se).setHeight(c), this._chartHeight.candle_pane = c, this
  6188. ._panes.forEach((function(e) {
  6189. if (e.id() !== se) {
  6190. var i = e.height();
  6191. u += i + a, h[e.id()] = {
  6192. contentTop: l,
  6193. contentBottom: u
  6194. }, t._chartHeight[e.id()] = i, l = u
  6195. }
  6196. })), this._xAxisPane.setHeight(r), this._chartHeight.xAxis = r, this
  6197. ._chartHeight.total = i, this._chartEvent.setPaneContentSize(h)
  6198. }
  6199. }, {
  6200. key: "_measurePaneWidth",
  6201. value: function() {
  6202. var t, e, i, a = this,
  6203. n = this._chartData.styleOptions().yAxis,
  6204. r = n.position === Y,
  6205. o = this._container.offsetWidth,
  6206. s = Number.MIN_SAFE_INTEGER;
  6207. !n.inside ? (this._panes.forEach((function(t) {
  6208. s = Math.max(s, t.yAxis().getSelfWidth())
  6209. })), t = o - s, r ? (e = 0, i = s) : (i = 0, e = o - s)) : (t = o, s =
  6210. o, e = 0, i = 0), this._chartData.setTotalDataSpace(t), this._panes
  6211. .forEach((function(n, r) {
  6212. n.setWidth(t, s), n.setOffsetLeft(i, e);
  6213. var o = a._separators.get(r);
  6214. o && o.setSize(i, t)
  6215. })), this._chartWidth = {
  6216. content: t,
  6217. yAxis: s,
  6218. total: o
  6219. }, this._xAxisPane.setWidth(t, s), this._xAxisPane.setOffsetLeft(i, e),
  6220. this._chartEvent.setChartContentSize({
  6221. contentLeft: i,
  6222. contentRight: i + t
  6223. })
  6224. }
  6225. }, {
  6226. key: "adjustPaneViewport",
  6227. value: function(t, e, i, a, n) {
  6228. t && this._measurePaneHeight();
  6229. var r = !1;
  6230. a && this._panes.forEach((function(t) {
  6231. var e = t.yAxis().computeAxis(n);
  6232. r || (r = e)
  6233. })), (!a && e || a && r) && this._measurePaneWidth(), i && (this
  6234. ._xAxisPane.xAxis().computeAxis(!0), this._xAxisPane.layout(), this
  6235. ._panes.forEach((function(t) {
  6236. t.layout()
  6237. })))
  6238. }
  6239. }, {
  6240. key: "chartData",
  6241. value: function() {
  6242. return this._chartData
  6243. }
  6244. }, {
  6245. key: "overrideTechnicalIndicator",
  6246. value: function(t, e) {
  6247. var i = this,
  6248. a = e.name,
  6249. n = e.calcParams,
  6250. r = e.precision,
  6251. o = e.styles;
  6252. t.setCalcParamsAllowDecimal(e.calcParamsAllowDecimal);
  6253. var s = t.setCalcParams(n),
  6254. c = t.setPrecision(r),
  6255. h = this._chartData.styleOptions().technicalIndicator,
  6256. l = t.setStyles(o, h);
  6257. if (s || c || l) {
  6258. var u = !1,
  6259. d = [];
  6260. this._panes.forEach((function(t) {
  6261. var e = t.technicalIndicators();
  6262. if (e.has(a)) {
  6263. u = !0;
  6264. var i = e.get(a);
  6265. s && d.push(Promise.resolve(t
  6266. .calcTechnicalIndicator(i)))
  6267. }
  6268. })), u && Promise.all(d).then((function(t) {
  6269. i.adjustPaneViewport(!1, !0, !0, !0)
  6270. }))
  6271. }
  6272. }
  6273. }, {
  6274. key: "_applyDataList",
  6275. value: function(t, e, i) {
  6276. I(t) && (L(i) && i(), this._chartData.addData(t, 0, e), this
  6277. ._calcAllPaneTechnicalIndicator())
  6278. }
  6279. }, {
  6280. key: "applyNewData",
  6281. value: function(t, e) {
  6282. var i = this;
  6283. this._applyDataList(t, e, (function() {
  6284. i._chartData.clearDataList()
  6285. }))
  6286. }
  6287. }, {
  6288. key: "applyMoreData",
  6289. value: function(t, e) {
  6290. this._applyDataList(t, e)
  6291. }
  6292. }, {
  6293. key: "updateData",
  6294. value: function(t) {
  6295. var e = this._chartData.dataList(),
  6296. i = e.length,
  6297. a = ut(t, "timestamp", 0),
  6298. n = ut(e[i - 1], "timestamp", 0);
  6299. if (a >= n) {
  6300. var r = i;
  6301. a === n && (r = i - 1), this._chartData.addData(t, r), this
  6302. ._calcAllPaneTechnicalIndicator()
  6303. }
  6304. }
  6305. }, {
  6306. key: "removeTechnicalIndicator",
  6307. value: function(t, e) {
  6308. var i = this;
  6309. if (this._panes.has(t))
  6310. if (t === se) this._panes.get(se).removeTechnicalIndicator(e) && this
  6311. .adjustPaneViewport(!1, !0, !0, !0);
  6312. else {
  6313. var a = this._panes.get(t),
  6314. n = a.removeTechnicalIndicator(e);
  6315. if (a.isEmptyTechnicalIndicator()) {
  6316. a.destroy();
  6317. var r = this._separators.get(t).topPaneId();
  6318. this._separators.get(t).destroy(), this._panes.delete(t), this
  6319. ._separators.delete(t), this._separators.forEach((function(
  6320. t) {
  6321. var e = t.topPaneId();
  6322. i._separators.has(e) || t.updatePaneId(r)
  6323. })), this.adjustPaneViewport(!0, !0, !0, !0, !0)
  6324. } else n && this.adjustPaneViewport(!1, !0, !0, !0)
  6325. }
  6326. }
  6327. }, {
  6328. key: "createTechnicalIndicator",
  6329. value: function(t, e) {
  6330. var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
  6331. if (this._panes.has(i.id)) return this.setPaneOptions(i, this._panes.get(i
  6332. .id).setTechnicalIndicator(t, e)), i.id;
  6333. var a = i.id || "".concat(re).concat(++this._paneBaseId),
  6334. n = !z(i.dragEnabled) || i.dragEnabled;
  6335. return this._separators.set(a, new ti(this._chartContainer, this._chartData,
  6336. Array.from(this._panes.keys()).pop(), a, n, {
  6337. startDrag: this._separatorStartDrag.bind(this),
  6338. drag: di(this._separatorDrag.bind(this), 50)
  6339. })), this._panes.set(a, new Le({
  6340. container: this._chartContainer,
  6341. chartData: this._chartData,
  6342. xAxis: this._xAxisPane.xAxis(),
  6343. name: t.name,
  6344. id: a,
  6345. height: i.height || 100
  6346. })), this.adjustPaneViewport(!0, !0, !0, !0, !0), a
  6347. }
  6348. }, {
  6349. key: "getPaneTechnicalIndicator",
  6350. value: function(t) {
  6351. var e = function(t) {
  6352. var e = {};
  6353. return t.technicalIndicators().forEach((function(t) {
  6354. e[t.name] = Mt(t)
  6355. })), e
  6356. };
  6357. if (!F(t)) {
  6358. var i = {};
  6359. return this._panes.forEach((function(t) {
  6360. i[t.id()] = e(t)
  6361. })), i
  6362. }
  6363. return this._panes.has(t) ? e(this._panes.get(t)) : {}
  6364. }
  6365. }, {
  6366. key: "createGraphicMark",
  6367. value: function(t) {
  6368. var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
  6369. i = e.id,
  6370. a = e.points,
  6371. n = e.styles,
  6372. r = e.lock,
  6373. o = e.onDrawStart,
  6374. s = e.onDrawing,
  6375. c = e.onDrawEnd,
  6376. h = e.onClick,
  6377. l = e.onRightClick,
  6378. u = e.onPressedMove,
  6379. d = e.onMouseEnter,
  6380. _ = e.onMouseLeave,
  6381. v = e.onRemove,
  6382. f = i || "".concat(oe).concat(++this._graphicMarkBaseId),
  6383. p = new t({
  6384. id: f,
  6385. chartData: this._chartData,
  6386. xAxis: this._xAxisPane.xAxis(),
  6387. yAxis: this._panes.get(se).yAxis(),
  6388. points: a,
  6389. styles: n,
  6390. lock: r
  6391. });
  6392. if (L(o) && (p.onDrawStart = o, p.onDrawStart({
  6393. id: f
  6394. })), L(s) && (p.onDrawing = s), L(c) && (p.onDrawEnd = c), L(h) && (p
  6395. .onClick = h), L(l) && (p.onRightClick = l), L(u) && (p
  6396. .onPressedMove = u), L(d) && (p.onMouseEnter = d), L(_) && (p
  6397. .onMouseLeave = _), L(v) && (p.onRemove = v), this._chartData
  6398. .addGraphicMarkInstance(p)) return f
  6399. }
  6400. }, {
  6401. key: "createAnnotation",
  6402. value: function(t) {
  6403. var e = this,
  6404. i = [];
  6405. t.forEach((function(t) {
  6406. var a = t.point,
  6407. n = t.styles,
  6408. r = t.checkPointInCustomSymbol,
  6409. o = t.drawCustomSymbol,
  6410. s = t.drawExtend,
  6411. c = t.onClick,
  6412. h = t.onRightClick,
  6413. l = t.onMouseEnter,
  6414. u = t.onMouseLeave;
  6415. if (a && a.timestamp) {
  6416. var d = new _i({
  6417. id: a.timestamp,
  6418. chartData: e._chartData,
  6419. point: a,
  6420. xAxis: e._xAxisPane.xAxis(),
  6421. yAxis: e._panes.get(se).yAxis(),
  6422. styles: n
  6423. });
  6424. L(s) && (d.drawExtend = s), L(r) && (d
  6425. .checkPointInCustomSymbol = r), L(o) && (d
  6426. .drawCustomSymbol = o), L(c) && (d.onClick = c),
  6427. L(h) && (d.onRightClick = h), L(l) && (d
  6428. .onMouseEnter = l), L(u) && (d.onMouseLeave =
  6429. u), i.push(d)
  6430. }
  6431. })), i.length > 0 && this._chartData.addAnnotations(i)
  6432. }
  6433. }, {
  6434. key: "createTag",
  6435. value: function(t) {
  6436. var e = this,
  6437. i = [],
  6438. a = !1,
  6439. n = !1;
  6440. t.forEach((function(t) {
  6441. var r = t.id,
  6442. o = t.point,
  6443. s = t.text,
  6444. c = t.mark,
  6445. h = t.styles;
  6446. if (F(r)) {
  6447. var l = e._chartData.getTag(r);
  6448. if (l) {
  6449. var u = l.update({
  6450. point: o,
  6451. text: s,
  6452. mark: c,
  6453. styles: h
  6454. });
  6455. a || (a = u)
  6456. } else n = !0, i.push(new vi({
  6457. id: r,
  6458. point: o,
  6459. text: s,
  6460. mark: c,
  6461. styles: h,
  6462. chartData: e._chartData,
  6463. xAxis: e._xAxisPane.xAxis(),
  6464. yAxis: e._panes.get(se).yAxis()
  6465. }))
  6466. }
  6467. })), n ? this._chartData.addTags(i) : a && this._invalidatePane(ce)
  6468. }
  6469. }, {
  6470. key: "setPaneOptions",
  6471. value: function(t, e) {
  6472. var i = e,
  6473. a = !1;
  6474. if (t.id !== se) {
  6475. var n = this._panes.get(t.id);
  6476. n && (R(t.height) && t.height > 0 && n.height() !== t.height && (i = !0,
  6477. n.setHeight(t.height), a = !0), z(t.dragEnabled) && this
  6478. ._separators.get(t.id).setDragEnabled(t.dragEnabled))
  6479. }
  6480. i && this.adjustPaneViewport(a, !0, !0, !0)
  6481. }
  6482. }, {
  6483. key: "setTimezone",
  6484. value: function(t) {
  6485. this._chartData.setTimezone(t), this._xAxisPane.xAxis().computeAxis(!0),
  6486. this._xAxisPane.invalidate(le)
  6487. }
  6488. }, {
  6489. key: "convertToPixel",
  6490. value: function(t, e) {
  6491. var i, a = this,
  6492. n = e.paneId,
  6493. r = void 0 === n ? se : n,
  6494. o = e.dataIndexXAxis,
  6495. s = e.absoluteYAxis,
  6496. c = [].concat(t),
  6497. h = [],
  6498. l = this._chartData.styleOptions().separator.size,
  6499. u = 0,
  6500. d = A(this._panes.values());
  6501. try {
  6502. var _ = function() {
  6503. var t = i.value;
  6504. if (t.id() === r) return h = c.map((function(e) {
  6505. var i = e.xAxisValue,
  6506. n = e.yAxisValue,
  6507. r = {};
  6508. if (F(i)) {
  6509. var c = o ? i : a._chartData
  6510. .timestampToDataIndex(i);
  6511. r.x = a._xAxisPane.xAxis()
  6512. .convertToPixel(c)
  6513. }
  6514. if (F(n)) {
  6515. var h = t.yAxis().convertToPixel(n);
  6516. r.y = s ? u + h : h
  6517. }
  6518. return r
  6519. })), "break";
  6520. u += t.height() + l
  6521. };
  6522. for (d.s(); !(i = d.n()).done;) {
  6523. if ("break" === _()) break
  6524. }
  6525. } catch (t) {
  6526. d.e(t)
  6527. } finally {
  6528. d.f()
  6529. }
  6530. return I(t) ? h : h[0] || {}
  6531. }
  6532. }, {
  6533. key: "convertFromPixel",
  6534. value: function(t, e) {
  6535. var i, a = this,
  6536. n = e.paneId,
  6537. r = void 0 === n ? se : n,
  6538. o = e.dataIndexXAxis,
  6539. s = e.absoluteYAxis,
  6540. c = [].concat(t),
  6541. h = [],
  6542. l = this._chartData.styleOptions().separator.size,
  6543. u = 0,
  6544. d = A(this._panes.values());
  6545. try {
  6546. var _ = function() {
  6547. var t = i.value;
  6548. if (t.id() === r) return h = c.map((function(e) {
  6549. var i = e.x,
  6550. n = e.y,
  6551. r = {};
  6552. if (F(i)) {
  6553. var c = a._xAxisPane.xAxis()
  6554. .convertFromPixel(i);
  6555. r.xAxisValue = o ? c : a._chartData
  6556. .dataIndexToTimestamp(c)
  6557. }
  6558. if (F(n)) {
  6559. var h = s ? n - u : n;
  6560. r.yAxisValue = t.yAxis()
  6561. .convertFromPixel(h)
  6562. }
  6563. return r
  6564. })), "break";
  6565. u += t.height() + l
  6566. };
  6567. for (d.s(); !(i = d.n()).done;) {
  6568. if ("break" === _()) break
  6569. }
  6570. } catch (t) {
  6571. d.e(t)
  6572. } finally {
  6573. d.f()
  6574. }
  6575. return I(t) ? h : h[0] || {}
  6576. }
  6577. }, {
  6578. key: "chartWidth",
  6579. value: function() {
  6580. return this._chartWidth
  6581. }
  6582. }, {
  6583. key: "chartHeight",
  6584. value: function() {
  6585. return this._chartHeight
  6586. }
  6587. }, {
  6588. key: "getConvertPictureUrl",
  6589. value: function(t, e, i) {
  6590. var a = this,
  6591. n = document.createElement("canvas"),
  6592. r = n.getContext("2d"),
  6593. o = _e(n),
  6594. s = this._chartContainer.offsetWidth,
  6595. c = this._chartContainer.offsetHeight;
  6596. n.style.width = "".concat(s, "px"), n.style.height = "".concat(c, "px"), n
  6597. .width = s * o, n.height = c * o, r.scale(o, o), r.fillStyle = i, r
  6598. .fillRect(0, 0, s, c);
  6599. var h = 0;
  6600. return this._panes.forEach((function(e, i) {
  6601. if (i !== se) {
  6602. var n = a._separators.get(i);
  6603. r.drawImage(n.getImage(), 0, h, s, n.height()), h += n
  6604. .height()
  6605. }
  6606. r.drawImage(e.getImage(t), 0, h, s, e.height()), h += e
  6607. .height()
  6608. })), r.drawImage(this._xAxisPane.getImage(t), 0, h, s, this._xAxisPane
  6609. .height()), n.toDataURL("image/".concat(e))
  6610. }
  6611. }, {
  6612. key: "destroy",
  6613. value: function() {
  6614. this._panes.forEach((function(t) {
  6615. t.destroy()
  6616. })), this._separators.forEach((function(t) {
  6617. t.destroy()
  6618. })), this._panes.clear(), this._separators.clear(), this._xAxisPane
  6619. .destroy(), this._container.removeChild(this._chartContainer), this
  6620. ._chartEvent.destroy()
  6621. }
  6622. }]), t
  6623. }(),
  6624. pi = function() {
  6625. function t(e, i) {
  6626. m(this, t), this._chartPane = new fi(e, i)
  6627. }
  6628. return g(t, [{
  6629. key: "getWidth",
  6630. value: function() {
  6631. return this._chartPane.chartWidth()
  6632. }
  6633. }, {
  6634. key: "getHeight",
  6635. value: function() {
  6636. return this._chartPane.chartHeight()
  6637. }
  6638. }, {
  6639. key: "setStyleOptions",
  6640. value: function(t) {
  6641. O(t) && (this._chartPane.chartData().applyStyleOptions(t), this._chartPane
  6642. .adjustPaneViewport(!0, !0, !0, !0, !0))
  6643. }
  6644. }, {
  6645. key: "getStyleOptions",
  6646. value: function() {
  6647. return S(this._chartPane.chartData().styleOptions())
  6648. }
  6649. }, {
  6650. key: "overrideTechnicalIndicator",
  6651. value: function(t) {
  6652. if (O(t)) {
  6653. var e = this._chartPane.chartData().getTechnicalIndicatorInstance(t
  6654. .name);
  6655. e && this._chartPane.overrideTechnicalIndicator(e, t)
  6656. }
  6657. }
  6658. }, {
  6659. key: "getTechnicalIndicatorByName",
  6660. value: function(t) {
  6661. return this._chartPane.chartData().getTechnicalIndicatorInfo(t)
  6662. }
  6663. }, {
  6664. key: "getTechnicalIndicatorByPaneId",
  6665. value: function(t) {
  6666. return this._chartPane.getPaneTechnicalIndicator(t)
  6667. }
  6668. }, {
  6669. key: "setPriceVolumePrecision",
  6670. value: function(t, e) {
  6671. R(t) && t >= 0 && R(e) && e >= 0 && this._chartPane.chartData()
  6672. .setPriceVolumePrecision(t, e)
  6673. }
  6674. }, {
  6675. key: "setTimezone",
  6676. value: function(t) {
  6677. this._chartPane.setTimezone(t)
  6678. }
  6679. }, {
  6680. key: "getTimezone",
  6681. value: function() {
  6682. return this._chartPane.chartData().timezone()
  6683. }
  6684. }, {
  6685. key: "resize",
  6686. value: function() {
  6687. this._chartPane.adjustPaneViewport(!0, !0, !0, !0, !0)
  6688. }
  6689. }, {
  6690. key: "setOffsetRightSpace",
  6691. value: function(t) {
  6692. R(t) && this._chartPane.chartData().setOffsetRightSpace(t, !0)
  6693. }
  6694. }, {
  6695. key: "setLeftMinVisibleBarCount",
  6696. value: function(t) {
  6697. R(t) && t > 0 && this._chartPane.chartData().setLeftMinVisibleBarCount(Math
  6698. .ceil(t))
  6699. }
  6700. }, {
  6701. key: "setRightMinVisibleBarCount",
  6702. value: function(t) {
  6703. R(t) && t > 0 && this._chartPane.chartData().setRightMinVisibleBarCount(Math
  6704. .ceil(t))
  6705. }
  6706. }, {
  6707. key: "setDataSpace",
  6708. value: function(t) {
  6709. R(t) && this._chartPane.chartData().setDataSpace(t)
  6710. }
  6711. }, {
  6712. key: "clearData",
  6713. value: function() {
  6714. this._chartPane.chartData().clearDataList()
  6715. }
  6716. }, {
  6717. key: "getDataList",
  6718. value: function() {
  6719. return this._chartPane.chartData().dataList()
  6720. }
  6721. }, {
  6722. key: "applyNewData",
  6723. value: function(t, e) {
  6724. I(t) && this._chartPane.applyNewData(t, e)
  6725. }
  6726. }, {
  6727. key: "applyMoreData",
  6728. value: function(t, e) {
  6729. I(t) && this._chartPane.applyMoreData(t, e)
  6730. }
  6731. }, {
  6732. key: "updateData",
  6733. value: function(t) {
  6734. O(t) && !I(t) && this._chartPane.updateData(t)
  6735. }
  6736. }, {
  6737. key: "loadMore",
  6738. value: function(t) {
  6739. L(t) && this._chartPane.chartData().setLoadMoreCallback(t)
  6740. }
  6741. }, {
  6742. key: "createTechnicalIndicator",
  6743. value: function(t, e, i) {
  6744. var a = this._chartPane.chartData().getTechnicalIndicatorInstance(t);
  6745. return a ? this._chartPane.createTechnicalIndicator(a, e, i) : null
  6746. }
  6747. }, {
  6748. key: "addCustomTechnicalIndicator",
  6749. value: function(t) {
  6750. if (O(t)) {
  6751. var e = [].concat(t);
  6752. this._chartPane.chartData().addCustomTechnicalIndicator(e)
  6753. }
  6754. }
  6755. }, {
  6756. key: "removeTechnicalIndicator",
  6757. value: function(t, e) {
  6758. this._chartPane.removeTechnicalIndicator(t, e)
  6759. }
  6760. }, {
  6761. key: "createGraphicMark",
  6762. value: function(t, e) {
  6763. var i = this._chartPane.chartData().graphicMarkMapping()[t];
  6764. return i ? this._chartPane.createGraphicMark(i, e) : null
  6765. }
  6766. }, {
  6767. key: "getGraphicMark",
  6768. value: function(t) {
  6769. return this._chartPane.chartData().getGraphicMark(t)
  6770. }
  6771. }, {
  6772. key: "setGraphicMarkOptions",
  6773. value: function(t, e) {
  6774. this._chartPane.chartData().setGraphicMarkOptions(t, e)
  6775. }
  6776. }, {
  6777. key: "addCustomGraphicMark",
  6778. value: function(t) {
  6779. if (O(t)) {
  6780. var e = [].concat(t);
  6781. this._chartPane.chartData().addCustomGraphicMark(e)
  6782. }
  6783. }
  6784. }, {
  6785. key: "removeGraphicMark",
  6786. value: function(t) {
  6787. this._chartPane.chartData().removeGraphicMarkInstance(t)
  6788. }
  6789. }, {
  6790. key: "createAnnotation",
  6791. value: function(t) {
  6792. if (O(t)) {
  6793. var e = [].concat(t);
  6794. this._chartPane.createAnnotation(e)
  6795. }
  6796. }
  6797. }, {
  6798. key: "removeAnnotation",
  6799. value: function(t) {
  6800. this._chartPane.chartData().removeAnnotation(t)
  6801. }
  6802. }, {
  6803. key: "createTag",
  6804. value: function(t) {
  6805. if (O(t)) {
  6806. var e = [].concat(t);
  6807. this._chartPane.createTag(e)
  6808. }
  6809. }
  6810. }, {
  6811. key: "removeTag",
  6812. value: function(t) {
  6813. this._chartPane.chartData().removeTag(t)
  6814. }
  6815. }, {
  6816. key: "setPaneOptions",
  6817. value: function() {
  6818. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  6819. this._chartPane.setPaneOptions(t, !1)
  6820. }
  6821. }, {
  6822. key: "setZoomEnabled",
  6823. value: function(t) {
  6824. this._chartPane.chartData().setZoomEnabled(t)
  6825. }
  6826. }, {
  6827. key: "isZoomEnabled",
  6828. value: function() {
  6829. return this._chartPane.chartData().zoomEnabled()
  6830. }
  6831. }, {
  6832. key: "setScrollEnabled",
  6833. value: function(t) {
  6834. this._chartPane.chartData().setScrollEnabled(t)
  6835. }
  6836. }, {
  6837. key: "isScrollEnabled",
  6838. value: function() {
  6839. return this._chartPane.chartData().scrollEnabled()
  6840. }
  6841. }, {
  6842. key: "scrollByDistance",
  6843. value: function(t, e) {
  6844. var i = this;
  6845. if (R(t))
  6846. if (R(e) && e > 0) {
  6847. this._chartPane.chartData().startScroll();
  6848. var a = (new Date).getTime();
  6849. ! function n() {
  6850. var r = ((new Date).getTime() - a) / e,
  6851. o = r >= 1,
  6852. s = o ? t : t * r;
  6853. i._chartPane.chartData().scroll(s), o || me(n)
  6854. }()
  6855. } else this._chartPane.chartData().startScroll(), this._chartPane
  6856. .chartData().scroll(t)
  6857. }
  6858. }, {
  6859. key: "scrollToRealTime",
  6860. value: function(t) {
  6861. var e = (this._chartPane.chartData().offsetRightBarCount() - this._chartPane
  6862. .chartData().offsetRightSpace() / this._chartPane.chartData()
  6863. .dataSpace()) * this._chartPane.chartData().dataSpace();
  6864. this.scrollByDistance(e, t)
  6865. }
  6866. }, {
  6867. key: "scrollToPosition",
  6868. value: function(t, e) {
  6869. if (R(t)) {
  6870. var i = (this._chartPane.chartData().dataList().length - 1 - t) * this
  6871. ._chartPane.chartData().dataSpace();
  6872. this.scrollByDistance(i, e)
  6873. }
  6874. }
  6875. }, {
  6876. key: "zoomAtCoordinate",
  6877. value: function(t, e, i) {
  6878. var a = this;
  6879. if (R(t))
  6880. if (R(i) && i > 0) {
  6881. var n = this._chartPane.chartData().dataSpace(),
  6882. r = n * t - n,
  6883. o = (new Date).getTime();
  6884. ! function t() {
  6885. var s = ((new Date).getTime() - o) / i,
  6886. c = s >= 1,
  6887. h = c ? r : r * s;
  6888. a._chartPane.chartData().zoom(h / n, e), c || me(t)
  6889. }()
  6890. } else this._chartPane.chartData().zoom(t, e)
  6891. }
  6892. }, {
  6893. key: "zoomAtPosition",
  6894. value: function(t, e, i) {
  6895. if (R(t) && R(e)) {
  6896. var a = this._chartPane.chartData().dataIndexToCoordinate(e);
  6897. this.zoomAtCoordinate(t, {
  6898. x: a
  6899. }, i)
  6900. }
  6901. }
  6902. }, {
  6903. key: "convertToPixel",
  6904. value: function(t, e) {
  6905. return this._chartPane.convertToPixel(t, e)
  6906. }
  6907. }, {
  6908. key: "convertFromPixel",
  6909. value: function(t, e) {
  6910. return this._chartPane.convertFromPixel(t, e)
  6911. }
  6912. }, {
  6913. key: "subscribeAction",
  6914. value: function(t, e) {
  6915. this._chartPane.chartData().subscribeAction(t, e)
  6916. }
  6917. }, {
  6918. key: "unsubscribeAction",
  6919. value: function(t, e) {
  6920. this._chartPane.chartData().unsubscribeAction(t, e)
  6921. }
  6922. }, {
  6923. key: "getConvertPictureUrl",
  6924. value: function(t, e) {
  6925. var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] :
  6926. "jpeg",
  6927. a = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] :
  6928. "#FFFFFF";
  6929. if ("png" === i || "jpeg" === i || "bmp" === i) return this._chartPane
  6930. .getConvertPictureUrl(t, i, a)
  6931. }
  6932. }, {
  6933. key: "destroy",
  6934. value: function() {
  6935. this._chartPane.destroy()
  6936. }
  6937. }]), t
  6938. }(),
  6939. yi = {},
  6940. mi = 1,
  6941. xi = "k_line_chart_";
  6942. v.addTechnicalIndicator([{
  6943. name: "AVP",
  6944. series: "price",
  6945. precision: 2,
  6946. plots: [{
  6947. key: "avp",
  6948. title: "AVP: ",
  6949. type: "line"
  6950. }],
  6951. calcTechnicalIndicator: function(t) {
  6952. var e = 0,
  6953. i = 0;
  6954. return t.map((function(t) {
  6955. var a = {};
  6956. return e += t.turnover || 0, 0 !== (i += t.volume || 0) && (a.avp =
  6957. e / i), a
  6958. }))
  6959. }
  6960. }, e, i, a, {
  6961. name: "EMV",
  6962. calcParams: [14, 9],
  6963. plots: [{
  6964. key: "emv",
  6965. title: "EMV: ",
  6966. type: "line"
  6967. }, {
  6968. key: "maEmv",
  6969. title: "MAEMV: ",
  6970. type: "line"
  6971. }],
  6972. calcTechnicalIndicator: function(t, e) {
  6973. var i = 0,
  6974. a = 0,
  6975. n = [],
  6976. r = [];
  6977. return t.forEach((function(o, s) {
  6978. var c = {},
  6979. h = t[s - 1] || o,
  6980. l = o.high,
  6981. u = o.low,
  6982. d = o.turnover || 0,
  6983. _ = 0;
  6984. 0 !== d && (_ = ((l + u) / 2 - (h.high + h.low) / 2) * (l - u) / d),
  6985. n.push(_), i += _, e[0] - 1 > s || (c.emv = i, i -= n[s - (e[
  6986. 0] - 1)], a += c.emv, e[0] + e[1] - 2 > s || (c.maEmv =
  6987. a / e[1], a -= r[s - (e[1] - 1)].emv)), r.push(c)
  6988. })), r
  6989. }
  6990. }, {
  6991. name: "EMA",
  6992. series: "price",
  6993. calcParams: [6, 12, 20],
  6994. precision: 2,
  6995. shouldCheckParamCount: !1,
  6996. shouldOhlc: !0,
  6997. plots: [{
  6998. key: "ema6",
  6999. title: "EMA6: ",
  7000. type: "line"
  7001. }, {
  7002. key: "ema12",
  7003. title: "EMA12: ",
  7004. type: "line"
  7005. }, {
  7006. key: "ema20",
  7007. title: "EMA20: ",
  7008. type: "line"
  7009. }],
  7010. regeneratePlots: function(t) {
  7011. return t.map((function(t) {
  7012. return {
  7013. key: "ema".concat(t),
  7014. title: "EMA".concat(t, ": "),
  7015. type: "line"
  7016. }
  7017. }))
  7018. },
  7019. calcTechnicalIndicator: function(t, e, i) {
  7020. var a = 0,
  7021. n = [];
  7022. return t.map((function(t, r) {
  7023. var o = {},
  7024. s = t.close;
  7025. return a += s, e.forEach((function(t, e) {
  7026. t - 1 > r || (n[e] = r > t - 1 ? (2 * s + (t - 1) *
  7027. n[e]) / (t + 1) : a / t, o[i[e].key] =
  7028. n[e])
  7029. })), o
  7030. }))
  7031. }
  7032. }, {
  7033. name: "MA",
  7034. series: "price",
  7035. calcParams: [5, 10, 30, 60],
  7036. precision: 2,
  7037. shouldCheckParamCount: !1,
  7038. shouldOhlc: !0,
  7039. plots: window.plots,
  7040. regeneratePlots: function(t) {
  7041. return t.map((function(t) {
  7042. return {
  7043. key: "ma".concat(t),
  7044. title: "MA".concat(t, ": "),
  7045. type: "line"
  7046. }
  7047. }))
  7048. },
  7049. calcTechnicalIndicator: function(t, e, i) {
  7050. var a = [];
  7051. return t.map((function(n, r) {
  7052. var o = {},
  7053. s = n.close;
  7054. return e.forEach((function(e, n) {
  7055. a[n] = (a[n] || 0) + s, e - 1 > r || (o[i[n].key] =
  7056. a[n] / e, a[n] -= t[r - (e - 1)].close)
  7057. })), o
  7058. }))
  7059. }
  7060. }, n, {
  7061. name: "SMA",
  7062. calcParams: [12, 2],
  7063. series: "price",
  7064. precision: 2,
  7065. plots: [{
  7066. key: "sma",
  7067. title: "SMA: ",
  7068. type: "line"
  7069. }],
  7070. shouldCheckParamCount: !0,
  7071. shouldOhlc: !0,
  7072. calcTechnicalIndicator: function(t, e) {
  7073. var i = 0,
  7074. a = 0;
  7075. return t.map((function(t, n) {
  7076. var r = {},
  7077. o = t.close;
  7078. return i += o, e[0] - 1 > n || (r.sma = a = n > e[0] - 1 ? (o * e[
  7079. 1] + a * (e[0] - e[1] + 1)) / (e[0] + 1) : i / e[0]), r
  7080. }))
  7081. }
  7082. }, {
  7083. name: "TRIX",
  7084. calcParams: [12, 9],
  7085. plots: [{
  7086. key: "trix",
  7087. title: "TRIX: ",
  7088. type: "line"
  7089. }, {
  7090. key: "maTrix",
  7091. title: "MATRIX: ",
  7092. type: "line"
  7093. }],
  7094. calcTechnicalIndicator: function(t, e) {
  7095. var i, a, n, r = 0,
  7096. o = 0,
  7097. s = 0,
  7098. c = 0,
  7099. h = [];
  7100. return t.forEach((function(t, l) {
  7101. var u = {},
  7102. d = t.close;
  7103. if (r += d, l >= e[0] - 1 && (o += i = l > e[0] - 1 ? (2 * d + (e[
  7104. 0] - 1) * i) / (e[0] + 1) : r / e[0], l >= 2 * e[0] -
  7105. 2 && (s += a = l > 2 * e[0] - 2 ? (2 * i + (e[0] - 1) * a) /
  7106. (e[0] + 1) : o / e[0], l >= 3 * e[0] - 3))) {
  7107. var _, v = 0;
  7108. l > 3 * e[0] - 3 ? v = ((_ = (2 * a + (e[0] - 1) * n) / (e[0] +
  7109. 1)) - n) / n * 100 : _ = s / e[0], n = _, u.trix = v,
  7110. c += v, 3 * e[0] + e[1] - 4 > l || (u.maTrix = c / e[1],
  7111. c -= h[l - (e[1] - 1)].trix)
  7112. }
  7113. h.push(u)
  7114. })), h
  7115. }
  7116. }, {
  7117. name: "BRAR",
  7118. calcParams: [26],
  7119. plots: [{
  7120. key: "br",
  7121. title: "BR: ",
  7122. type: "line"
  7123. }, {
  7124. key: "ar",
  7125. title: "AR: ",
  7126. type: "line"
  7127. }],
  7128. calcTechnicalIndicator: function(t, e) {
  7129. var i = 0,
  7130. a = 0,
  7131. n = 0,
  7132. r = 0;
  7133. return t.map((function(o, s) {
  7134. var c = {},
  7135. h = o.high,
  7136. l = o.low,
  7137. u = o.open,
  7138. d = (t[s - 1] || o).close;
  7139. if (n += h - u, r += u - l, i += h - d, a += d - l, s >= e[0] - 1) {
  7140. c.ar = 0 !== r ? n / r * 100 : 0, c.br = 0 !== a ? i / a * 100 :
  7141. 0;
  7142. var _ = t[s - (e[0] - 1)],
  7143. v = _.high,
  7144. f = _.low,
  7145. p = _.open,
  7146. y = (t[s - e[0]] || t[s - (e[0] - 1)]).close;
  7147. i -= v - y, a -= y - f, n -= v - p, r -= p - f
  7148. }
  7149. return c
  7150. }))
  7151. }
  7152. }, r, {
  7153. name: "MTM",
  7154. calcParams: [12, 6],
  7155. plots: [{
  7156. key: "mtm",
  7157. title: "MTM: ",
  7158. type: "line"
  7159. }, {
  7160. key: "maMtm",
  7161. title: "MAMTM: ",
  7162. type: "line"
  7163. }],
  7164. calcTechnicalIndicator: function(t, e) {
  7165. var i = 0,
  7166. a = [];
  7167. return t.forEach((function(n, r) {
  7168. var o = {};
  7169. r < e[0] || (o.mtm = n.close - t[r - e[0]].close, i += o.mtm, e[0] +
  7170. e[1] - 1 > r || (o.maMtm = i / e[1], i -= a[r - (e[1] - 1)]
  7171. .mtm));
  7172. a.push(o)
  7173. })), a
  7174. }
  7175. }, {
  7176. name: "PSY",
  7177. calcParams: [12, 6],
  7178. plots: [{
  7179. key: "psy",
  7180. title: "PSY: ",
  7181. type: "line"
  7182. }, {
  7183. key: "maPsy",
  7184. title: "MAPSY: ",
  7185. type: "line"
  7186. }],
  7187. calcTechnicalIndicator: function(t, e) {
  7188. var i = 0,
  7189. a = 0,
  7190. n = [],
  7191. r = [];
  7192. return t.forEach((function(o, s) {
  7193. var c = {},
  7194. h = o.close - (t[s - 1] || o).close > 0 ? 1 : 0;
  7195. n.push(h), i += h, e[0] - 1 > s || (c.psy = i / e[0] * 100, a += c
  7196. .psy, e[0] + e[1] - 2 > s || (c.maPsy = a / e[1], a -= r[s -
  7197. (e[1] - 1)].psy), i -= n[s - (e[0] - 1)]), r.push(c)
  7198. })), r
  7199. }
  7200. }, {
  7201. name: "ROC",
  7202. calcParams: [12, 6],
  7203. shouldCheckParamCount: !0,
  7204. plots: [{
  7205. key: "roc",
  7206. title: "ROC: ",
  7207. type: "line"
  7208. }, {
  7209. key: "maRoc",
  7210. title: "MAROC: ",
  7211. type: "line"
  7212. }],
  7213. calcTechnicalIndicator: function(t, e) {
  7214. var i = [],
  7215. a = 0;
  7216. return t.forEach((function(n, r) {
  7217. var o = {};
  7218. if (r >= e[0] - 1) {
  7219. var s = (t[r - e[0]] || t[r - (e[0] - 1)]).close;
  7220. o.roc = 0 !== s ? (n.close - s) / s * 100 : 0, a += o.roc, e[
  7221. 0] - 1 + e[1] - 1 > r || (o.maRoc = a / e[1], a -= i[r - (e[
  7222. 1] - 1)].roc)
  7223. }
  7224. i.push(o)
  7225. })), i
  7226. }
  7227. }, {
  7228. name: "VR",
  7229. calcParams: [26, 6],
  7230. plots: [{
  7231. key: "vr",
  7232. title: "VR: ",
  7233. type: "line"
  7234. }, {
  7235. key: "maVr",
  7236. title: "MAVR: ",
  7237. type: "line"
  7238. }],
  7239. calcTechnicalIndicator: function(t, e) {
  7240. var i = 0,
  7241. a = 0,
  7242. n = 0,
  7243. r = 0,
  7244. o = [];
  7245. return t.forEach((function(s, c) {
  7246. var h = {},
  7247. l = s.close,
  7248. u = (t[c - 1] || s).close,
  7249. d = s.volume;
  7250. if (l > u ? i += d : u > l ? a += d : n += d, c >= e[0] - 1) {
  7251. var _ = n / 2;
  7252. h.vr = a + _ === 0 ? 0 : (i + _) / (a + _) * 100, r += h.vr, e[
  7253. 0] + e[1] - 2 > c || (h.maVr = r / e[1], r -= o[c - (e[
  7254. 1] - 1)].vr);
  7255. var v = t[c - (e[0] - 1)],
  7256. f = t[c - e[0]] || v,
  7257. p = v.close,
  7258. y = v.volume;
  7259. p > f.close ? i -= y : f.close > p ? a -= y : n -= y
  7260. }
  7261. o.push(h)
  7262. })), o
  7263. }
  7264. }, o, {
  7265. name: "BIAS",
  7266. calcParams: [6, 12, 24],
  7267. shouldCheckParamCount: !1,
  7268. plots: [{
  7269. key: "bias6",
  7270. title: "BIAS6: ",
  7271. type: "line"
  7272. }, {
  7273. key: "bias12",
  7274. title: "BIAS12: ",
  7275. type: "line"
  7276. }, {
  7277. key: "bias24",
  7278. title: "BIAS24: ",
  7279. type: "line"
  7280. }],
  7281. regeneratePlots: function(t) {
  7282. return t.map((function(t) {
  7283. return {
  7284. key: "bias".concat(t),
  7285. title: "BIAS".concat(t, ": "),
  7286. type: "line"
  7287. }
  7288. }))
  7289. },
  7290. calcTechnicalIndicator: function(t, e, i) {
  7291. var a = [];
  7292. return t.map((function(n, r) {
  7293. var o = {},
  7294. s = n.close;
  7295. return e.forEach((function(n, c) {
  7296. if (a[c] = (a[c] || 0) + s, r >= n - 1) {
  7297. var h = a[c] / e[c];
  7298. o[i[c].key] = (s - h) / h * 100, a[c] -= t[r - (
  7299. n - 1)].close
  7300. }
  7301. })), o
  7302. }))
  7303. }
  7304. }, s, c, l, u, d, _, {
  7305. name: "OBV",
  7306. calcParams: [30],
  7307. plots: [{
  7308. key: "obv",
  7309. title: "OBV: ",
  7310. type: "line"
  7311. }, {
  7312. key: "maObv",
  7313. title: "MAOBV: ",
  7314. type: "line"
  7315. }],
  7316. calcTechnicalIndicator: function(t, e) {
  7317. var i = 0,
  7318. a = 0,
  7319. n = [];
  7320. return t.forEach((function(r, o) {
  7321. var s = t[o - 1] || r;
  7322. s.close > r.close ? a -= r.volume : r.close > s.close && (a += r
  7323. .volume);
  7324. var c = {
  7325. obv: a
  7326. };
  7327. i += a, e[0] - 1 > o || (c.maObv = i / e[0], i -= n[o - (e[0] - 1)]
  7328. .obv), n.push(c)
  7329. })), n
  7330. }
  7331. }, {
  7332. name: "PVT",
  7333. plots: [{
  7334. key: "pvt",
  7335. title: "PVT: ",
  7336. type: "line"
  7337. }],
  7338. calcTechnicalIndicator: function(t) {
  7339. var e = 0;
  7340. return t.map((function(i, a) {
  7341. var n = {},
  7342. r = (t[a - 1] || i).close,
  7343. o = 0;
  7344. return 0 !== r && (o = (i.close - r) / r * i.volume), n.pvt = e +=
  7345. o, n
  7346. }))
  7347. }
  7348. }, {
  7349. name: "VOL",
  7350. series: "volume",
  7351. calcParams: [5, 10, 20],
  7352. shouldCheckParamCount: !1,
  7353. shouldFormatBigNumber: !0,
  7354. precision: 0,
  7355. baseValue: 0,
  7356. minValue: 0,
  7357. plots: [{
  7358. key: "ma5",
  7359. title: "MA5: ",
  7360. type: "line"
  7361. }, {
  7362. key: "ma10",
  7363. title: "MA10: ",
  7364. type: "line"
  7365. }, {
  7366. key: "ma20",
  7367. title: window.title,
  7368. type: "line"
  7369. }, {
  7370. key: "volume",
  7371. title: window.title1,
  7372. type: "bar",
  7373. color: function(t, e) {
  7374. var i = t.currentData.kLineData || {};
  7375. return i.close > i.open ? e.bar.upColor : i.open > i.close ? e.bar
  7376. .downColor : e.bar.noChangeColor
  7377. }
  7378. }],
  7379. regeneratePlots: function(t) {
  7380. var e = t.map((function(t) {
  7381. return {
  7382. key: "ma".concat(t),
  7383. title: "MA".concat(t, ": "),
  7384. type: "line"
  7385. }
  7386. }));
  7387. return e.push({
  7388. key: "volume",
  7389. title: "VOLUME: ",
  7390. type: "bar",
  7391. color: function(t, e) {
  7392. var i = t.currentData.kLineData || {};
  7393. return i.close > i.open ? e.bar.upColor : i.open > i.close ? e
  7394. .bar.downColor : e.bar.noChangeColor
  7395. }
  7396. }), e
  7397. },
  7398. calcTechnicalIndicator: function(t, e, i) {
  7399. var a = [];
  7400. return t.map((function(n, r) {
  7401. var o = n.volume || 0,
  7402. s = {
  7403. volume: o
  7404. };
  7405. return e.forEach((function(e, n) {
  7406. a[n] = (a[n] || 0) + o, e - 1 > r || (s[i[n].key] =
  7407. a[n] / e, a[n] -= t[r - (e - 1)].volume)
  7408. })), s
  7409. }))
  7410. }
  7411. }]), v.addGraphicMark([{
  7412. name: "horizontalRayLine",
  7413. totalStep: 3,
  7414. checkMousePointOn: function(t, e, i, a) {
  7415. return Ot(i[0], i[1], a)
  7416. },
  7417. createGraphicDataSource: function(t, e, i, a) {
  7418. var n = {
  7419. x: 0,
  7420. y: i[0].y
  7421. };
  7422. return i[1] && i[1].x > i[0].x && (n.x = a.width), [{
  7423. type: "line",
  7424. isDraw: !0,
  7425. isCheck: !0,
  7426. dataSource: [
  7427. [i[0], n]
  7428. ]
  7429. }]
  7430. },
  7431. performMousePressedMove: function(t, e, i) {
  7432. var a = i.price;
  7433. t[0].price = a, t[1].price = a
  7434. },
  7435. performMouseMoveForDrawing: function(t, e, i) {
  7436. 2 === t && (e[0].price = i.price)
  7437. }
  7438. }, {
  7439. name: "horizontalSegment",
  7440. totalStep: 3,
  7441. checkMousePointOn: function(t, e, i, a) {
  7442. return Rt(i[0], i[1], a)
  7443. },
  7444. createGraphicDataSource: function(t, e, i) {
  7445. var a = [];
  7446. return 2 === i.length && (a = [i]), [{
  7447. type: "line",
  7448. isDraw: !0,
  7449. isCheck: !0,
  7450. dataSource: a
  7451. }]
  7452. },
  7453. performMousePressedMove: function(t, e, i) {
  7454. var a = i.price;
  7455. t[0].price = a, t[1].price = a
  7456. },
  7457. performMouseMoveForDrawing: function(t, e, i) {
  7458. 2 === t && (e[0].price = i.price)
  7459. }
  7460. }, {
  7461. name: "horizontalStraightLine",
  7462. totalStep: 2,
  7463. checkMousePointOn: function(t, e, i, a) {
  7464. return Lt(i[0], i[1], a)
  7465. },
  7466. createGraphicDataSource: function(t, e, i, a) {
  7467. return [{
  7468. type: "line",
  7469. isDraw: !0,
  7470. isCheck: !0,
  7471. dataSource: [
  7472. [{
  7473. x: 0,
  7474. y: i[0].y
  7475. }, {
  7476. x: a.width,
  7477. y: i[0].y
  7478. }]
  7479. ]
  7480. }]
  7481. }
  7482. }, {
  7483. name: "verticalRayLine",
  7484. totalStep: 3,
  7485. checkMousePointOn: function(t, e, i, a) {
  7486. return Ot(i[0], i[1], a)
  7487. },
  7488. createGraphicDataSource: function(t, e, i, a) {
  7489. var n = {
  7490. x: i[0].x,
  7491. y: 0
  7492. };
  7493. return i[1] && i[1].y > i[0].y && (n.y = a.height), [{
  7494. type: "line",
  7495. isDraw: !0,
  7496. isCheck: !0,
  7497. dataSource: [
  7498. [i[0], n]
  7499. ]
  7500. }]
  7501. },
  7502. performMousePressedMove: function(t, e, i) {
  7503. var a = i.dataIndex,
  7504. n = i.timestamp;
  7505. t[0].timestamp = n, t[0].dataIndex = a, t[1].timestamp = n, t[1].dataIndex = a
  7506. },
  7507. performMouseMoveForDrawing: function(t, e, i) {
  7508. var a = i.dataIndex;
  7509. 2 === t && (e[0].timestamp = i.timestamp, e[0].dataIndex = a)
  7510. }
  7511. }, {
  7512. name: "verticalSegment",
  7513. totalStep: 3,
  7514. checkMousePointOn: function(t, e, i, a) {
  7515. return Rt(i[0], i[1], a)
  7516. },
  7517. createGraphicDataSource: function(t, e, i) {
  7518. var a = [];
  7519. return 2 === i.length && (a = [i]), [{
  7520. type: "line",
  7521. isDraw: !0,
  7522. isCheck: !0,
  7523. dataSource: a
  7524. }]
  7525. },
  7526. performMousePressedMove: function(t, e, i) {
  7527. var a = i.dataIndex,
  7528. n = i.timestamp;
  7529. t[0].timestamp = n, t[0].dataIndex = a, t[1].timestamp = n, t[1].dataIndex = a
  7530. },
  7531. performMouseMoveForDrawing: function(t, e, i) {
  7532. var a = i.dataIndex;
  7533. 2 === t && (e[0].timestamp = i.timestamp, e[0].dataIndex = a)
  7534. }
  7535. }, {
  7536. name: "verticalStraightLine",
  7537. totalStep: 2,
  7538. checkMousePointOn: function(t, e, i, a) {
  7539. return Lt(i[0], i[1], a)
  7540. },
  7541. createGraphicDataSource: function(t, e, i, a) {
  7542. return [{
  7543. type: "line",
  7544. isDraw: !0,
  7545. isCheck: !0,
  7546. dataSource: [
  7547. [{
  7548. x: i[0].x,
  7549. y: 0
  7550. }, {
  7551. x: i[0].x,
  7552. y: a.height
  7553. }]
  7554. ]
  7555. }]
  7556. }
  7557. }, {
  7558. name: "rayLine",
  7559. totalStep: 3,
  7560. checkMousePointOn: function(t, e, i, a) {
  7561. return Ot(i[0], i[1], a)
  7562. },
  7563. createGraphicDataSource: function(t, e, i, a) {
  7564. return [{
  7565. type: "line",
  7566. isDraw: !0,
  7567. isCheck: !0,
  7568. dataSource: [(n = i[0], r = i[1], o = {
  7569. x: a.width,
  7570. y: a.height
  7571. }, n && r ? [n, n.x === r.x && n.y !== r.y ? r.y > n.y ? {
  7572. x: n.x,
  7573. y: o.y
  7574. } : {
  7575. x: n.x,
  7576. y: 0
  7577. } : n.x > r.x ? {
  7578. x: 0,
  7579. y: St(n, r, {
  7580. x: 0,
  7581. y: n.y
  7582. })
  7583. } : {
  7584. x: o.x,
  7585. y: St(n, r, {
  7586. x: o.x,
  7587. y: n.y
  7588. })
  7589. }] : [])]
  7590. }];
  7591. var n, r, o
  7592. }
  7593. }, {
  7594. name: "segment",
  7595. totalStep: 3,
  7596. checkMousePointOn: function(t, e, i, a) {
  7597. return Rt(i[0], i[1], a)
  7598. },
  7599. createGraphicDataSource: function(t, e, i) {
  7600. var a = [];
  7601. return 2 === i.length && (a = [i]), [{
  7602. type: "line",
  7603. isDraw: !0,
  7604. isCheck: !0,
  7605. dataSource: a
  7606. }]
  7607. }
  7608. }, {
  7609. name: "straightLine",
  7610. totalStep: 3,
  7611. checkMousePointOn: function(t, e, i, a) {
  7612. return Lt(i[0], i[1], a)
  7613. },
  7614. createGraphicDataSource: function(t, e, i, a) {
  7615. return 2 > i.length || i[0].x === i[1].x ? [{
  7616. type: "line",
  7617. isDraw: !0,
  7618. isCheck: !0,
  7619. dataSource: [
  7620. [{
  7621. x: i[0].x,
  7622. y: 0
  7623. }, {
  7624. x: i[0].x,
  7625. y: a.height
  7626. }]
  7627. ]
  7628. }] : [{
  7629. type: "line",
  7630. isDraw: !0,
  7631. isCheck: !0,
  7632. dataSource: [
  7633. [{
  7634. x: 0,
  7635. y: St(i[0], i[1], {
  7636. x: 0,
  7637. y: i[0].y
  7638. })
  7639. }, {
  7640. x: a.width,
  7641. y: St(i[0], i[1], {
  7642. x: a.width,
  7643. y: i[0].y
  7644. })
  7645. }]
  7646. ]
  7647. }]
  7648. }
  7649. }, {
  7650. name: "parallelStraightLine",
  7651. totalStep: 4,
  7652. checkMousePointOn: function(t, e, i, a) {
  7653. return Lt(i[0], i[1], a)
  7654. },
  7655. createGraphicDataSource: function(t, e, i, a) {
  7656. return [{
  7657. type: "line",
  7658. isDraw: !0,
  7659. isCheck: !0,
  7660. dataSource: zt(i, {
  7661. x: a.width,
  7662. y: a.height
  7663. })
  7664. }]
  7665. }
  7666. }, {
  7667. name: "priceChannelLine",
  7668. totalStep: 4,
  7669. checkMousePointOn: function(t, e, i, a) {
  7670. return Lt(i[0], i[1], a)
  7671. },
  7672. createGraphicDataSource: function(t, e, i, a) {
  7673. return [{
  7674. type: "line",
  7675. isDraw: !0,
  7676. isCheck: !0,
  7677. dataSource: zt(i, {
  7678. x: a.width,
  7679. y: a.height
  7680. }, 1)
  7681. }]
  7682. }
  7683. }, {
  7684. name: "priceLine",
  7685. totalStep: 2,
  7686. checkMousePointOn: function(t, e, i, a) {
  7687. return Ot(i[0], i[1], a)
  7688. },
  7689. createGraphicDataSource: function(t, e, i, a, n, r, o) {
  7690. return [{
  7691. type: "line",
  7692. isDraw: !0,
  7693. isCheck: !0,
  7694. dataSource: [
  7695. [i[0], {
  7696. x: a.width,
  7697. y: i[0].y
  7698. }]
  7699. ]
  7700. }, {
  7701. type: "text",
  7702. isDraw: !0,
  7703. isCheck: !1,
  7704. dataSource: [{
  7705. x: i[0].x,
  7706. y: i[0].y,
  7707. text: o.convertFromPixel(i[0].y).toFixed(n.price)
  7708. }]
  7709. }]
  7710. }
  7711. }, {
  7712. name: "fibonacciLine",
  7713. totalStep: 3,
  7714. checkMousePointOn: function(t, e, i, a) {
  7715. return Lt(i[0], i[1], a)
  7716. },
  7717. createGraphicDataSource: function(t, e, i, a, n) {
  7718. if (i.length > 0) {
  7719. var r = [],
  7720. o = [],
  7721. s = a.width;
  7722. if (i.length > 1) {
  7723. var c = i[0].y - i[1].y,
  7724. h = e[0].price - e[1].price;
  7725. [1, .786, .618, .5, .382, .236, 0].forEach((function(t) {
  7726. var a = i[1].y + c * t,
  7727. l = (e[1].price + h * t).toFixed(n.price);
  7728. r.push([{
  7729. x: 0,
  7730. y: a
  7731. }, {
  7732. x: s,
  7733. y: a
  7734. }]), o.push({
  7735. x: 0,
  7736. y: a,
  7737. text: "".concat(l, " (").concat((100 * t)
  7738. .toFixed(1), "%)")
  7739. })
  7740. }))
  7741. }
  7742. return [{
  7743. type: "line",
  7744. isDraw: !0,
  7745. isCheck: !0,
  7746. dataSource: r
  7747. }, {
  7748. type: "text",
  7749. isDraw: !0,
  7750. isCheck: !1,
  7751. dataSource: o
  7752. }]
  7753. }
  7754. return []
  7755. }
  7756. }]), t.dispose = function(t) {
  7757. if (t) {
  7758. var e;
  7759. if (B(t)) {
  7760. var i = document.getElementById(t);
  7761. e = i && i.chartId
  7762. } else V(t) ? e = t.chartId : t instanceof pi && (e = t.id);
  7763. e && (yi[e].destroy(), delete yi[e])
  7764. }
  7765. }, t.extension = v, t.init = function(t) {
  7766. var e, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
  7767. if (!t) return null;
  7768. if (!V(e = B(t) ? document.getElementById(t) : t)) return null;
  7769. var a = yi[e.chartId || ""];
  7770. if (a) return a;
  7771. var n = "".concat(xi).concat(mi++);
  7772. return (a = new pi(e, i)).id = n, e.chartId = n, yi[n] = a, a
  7773. }, t.version = function() {
  7774. return "7.5.0"
  7775. }, Object.defineProperty(t, "__esModule", {
  7776. value: !0
  7777. })
  7778. }));