2 lines
3.4 KiB
JavaScript
2 lines
3.4 KiB
JavaScript
"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[7607],{67079:(e,i,t)=>{t.r(i),t.d(i,{LineToolDisjointChannel:()=>a});var s=t(85842),n=t(7321),r=t(82014),p=t(33993),o=t(93445),l=t(22384),h=t(89659);class a extends r.LineDataSource{constructor(e,i,s,n){super(e,i??a.createProperties(e.backgroundTheme().spawnOwnership()),s,n),this.version=1,this._hasEditableCoordinates=new h.WatchedValue(!1),this._priceAxisViews.push(this.createPriceAxisView(3)),Promise.all([t.e(8263),t.e(144),t.e(4073),t.e(1912),t.e(1495)]).then(t.bind(t,46774)).then((e=>{this._setPaneViews([new e.DisjointChannelPaneView(this,this._model)])}))}pointsCount(){return 3}name(){return"Disjoint Channel"}snapTo45DegreesAvailable(){return!0}addPoint(e,i,t){return this._snapTo45DegreesApplicable(i)&&2===this.points().length&&this.snapPoint45Degree(e,this.points()[this.points().length-2]),super.addPoint(e)}setLastPoint(e,i){return this._snapTo45DegreesApplicable(i)&&2===this.points().length&&this.snapPoint45Degree(e,this.points()[this.points().length-2]),super.setLastPoint(e)}setPoint(e,i,t,s){const n=.5*(this._points[1].price+this._points[2].price);if(this._snapTo45DegreesApplicable(t)&&1===e){const e=0;this.snapPoint45Degree(i,this.points()[e])}if(e<3&&super.setPoint(e,i),0!==e&&2!==e){if(1===e){const e=this._points[1].price-n;this._points[2].price=this._points[1].price-2*e}else if(3===e){const e=i.price-this._points[2].price;this._points[0].price=this._points[1].price-e,this._points[0].index=i.index,this._points[0].interval=this._model.mainSeries().interval()}this._normalizePoints()}}getPoint(e){if(e<3)return super.getPoint(e);const i=this._points[0].price-this._points[2].price;return{index:this._points[0].index,price:this._points[1].price-i}}canHasAlert(){return!0}template(){const e=super.template();return e.labelText=this.properties().childs().labelText.value(),e}priceAxisPoints(){return this._axisPoints()}static createProperties(e,i){const t=new o.DefaultProperty({defaultName:"linetooldisjointangle",state:i,theme:e});return this._configureProperties(t),t}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().labelText.setValue(e.labelText??"")}_getAlertPlots(){const e=this._points[0],i=this._points[1],t=[];e.index<=i.index?(t.push(e),t.push(i)):(t.push(i),t.push(e));const s=this._points[2];s.time=i.time,s.index=i.index;const r={price:s.price+(i.price-e.price),time:e.time,index:e.index},p=[];let o,l,h,a;s.index<=r.index?(p.push(s),p.push(r)):(p.push(r),p.push(s)),t[0].price>p[0].price?(o=t,l=p):p[0].price>t[0].price||p[1].price>t[1].price?(o=p,l=t):(o=t,l=p);const c=this.properties().childs().extendLeft.value(),d=this.properties().childs().extendRight.value();return e.index<=i.index?(h=c,a=d):(h=d,a=c),[this._linePointsToAlertPlot(o,"Upper",h,a),this._linePointsToAlertPlot(l,"Lower",h,a)].filter(n.notNull)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([t.e(1982),t.e(7686),t.e(2428),t.e(3920),t.e(9328)]).then(t.bind(t,90210))).GeneralTrendFiguresDefinitionsViewModel}
|
|
static _configureProperties(e){super._configureProperties(e),e.hasChild("labelText")||e.addChild("labelText",new l.Property("")),e.addExcludedKey("labelText",1),e.addChild("textsColors",new p.LineToolColorsProperty([(0,s.ensureDefined)(e.child("labelTextColor"))]))}_axisPoints(){const e=this.points();return e.length>2&&e.push({index:e[0].index,price:e[1].price-e[0].price+e[2].price,time:e[0].time}),e}}}}]); |