Files
ai/charting_library/bundles/line-tool-volume-profile.d050b545467d2b512927.js

3 lines
8.2 KiB
JavaScript

"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[59],{96685:(e,t,i)=>{i.r(t),i.d(t,{LineToolFixedRangeVolumeProfile:()=>p});var s=i(85842),o=i(55458),r=i(6620),n=i(20737),l=i(93445),a=i(7321),c=i(34969),d=i(49399),h=i(63271);const u=(0,s.ensureDefined)(h.lineToolsStudyIds.LineToolFixedRangeVolumeProfile);class p extends o.LineToolVbPFixed{constructor(e,t,i,s,o){super(e,t,i||(0,d.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:u}),s,o)}calcIsActualSymbol(){n.StudyLineDataSource.prototype.calcIsActualSymbol.apply(this)}boundToSymbol(){return!0}isSynchronizable(){return this.priceScale()===this._model.mainSeries().priceScale()}static studyId(){return u}static createProperties(e,t){const i=r.StudyMetaInfo.getStudyPropertyRootNameById(u),o=(0,s.ensureNotNull)((0,d.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:u})),n=(0,l.createDefaultsState)(!0,i,[],(0,d.studyMetaInfoRepository)().studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(o,o,(0,a.merge)((0,a.clone)(n),t??{}),(0,d.studyMetaInfoRepository)().studyVersioning(),e)}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s,o){const r=(0,c.prepareStudyPropertiesForLoadChart)(e,t,i,s,void 0,o);return this._configureProperties(r),r}}},55458:(e,t,i)=>{i.r(t),i.d(t,{LineToolVbPFixed:()=>v});const s=function(e){return null===e};var o=i(85842),r=i(6620),n=i(20737),l=i(95359),a=i(24561),c=i(33578),d=i(9840),h=i(7321),u=i(93445),p=i(34969),y=i(77753),g=i(49399),m=i(63271);const _=(0,o.ensureDefined)(m.lineToolsStudyIds.LineToolVbPFixed);function S(e,t,i,s){return t.styles&&(f(t.styles.developingPoc),f(t.styles.developingVAHigh),f(t.styles.developingVALow)),t}function f(e){void 0!==e&&void 0!==e.visible&&(e.display=e.visible?4294967295:0,delete e.visible)}function P(e){return!!e.childs().inputs.childs().extendToRight?.value()}class v extends n.StudyLineDataSource{constructor(e,t,i,s,o){super(e,i||(0,g.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:_}),"vbpfixed_",t??v.createProperties(e.backgroundTheme().spawnOwnership()),s,o),this._onVisibleBarsStrictRangeChanged=()=>{if(P(this.properties()))return;const e=this._getPointsetPoints();!this._isDataSourceStarted()&&null!==e&&this._isInVisibleTimeRange(e)&&this._onStudyInputsMayChange()},this._createPaneViews().then((e=>{this._setPaneViews(e),e.forEach((e=>e.update((0,d.sourceChangeEvent)({sourceId:this.id(),clearData:!0}))))})),this.clearData(),this._model.timeScale().visibleBarsStrictRangeChanged().subscribe(this,this._onVisibleBarsStrictRangeChanged)}destroy(){this._model.timeScale().visibleBarsStrictRangeChanged().unsubscribe(this,this._onVisibleBarsStrictRangeChanged),super.destroy()}pointsCount(){return 2}boundToSymbol(){return!1}offset(e){return 0}getMinFirstBarIndexForPlot(){return-1/0}calcIsActualSymbol(){this._isActualSymbol=!0,this._isActualCurrency=!0,this._isActualUnit=!0,this._isActualMetric=!0,this.calcIsActualInterval()}cloneable(){return!1}isSynchronizable(){return!1}hasHighlightedPlots(){return!1}isPlotVisibleAt(e,t){
const i=this.properties().childs().styles.childs()[e].childs();return(0,c.isPlotVisible)(i.display.value(),t)}preferredZOrder(){return 0}static createProperties(e,t){const i=r.StudyMetaInfo.getStudyPropertyRootNameById(_),s=(0,o.ensureNotNull)((0,g.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:_})),n=(0,u.createDefaultsState)(!0,i,[],(0,g.studyMetaInfoRepository)().studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(s,s,(0,h.merge)((0,h.clone)(n),t??{}),(0,g.studyMetaInfoRepository)().studyVersioning(),e)}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s,o){const r=(0,p.prepareStudyPropertiesForLoadChart)(e,t,i,s,S,o);return this._configureProperties(r),r}static studyId(){return _}_studyInputs(e){if((0,o.assert)(2===e.length,"all the line tool points should be defined"),!this._isDataSourceStarted()&&!P(this.properties())&&!this._isInVisibleTimeRange(e))return null;const t=[...e].sort(((e,t)=>e.index-t.index)).map((e=>this._getPointTime(e,!1)));if(t.some(s))return null;const[i,r]=t,n=this.properties().childs(),l=this._model.mainSeries().bars().lastIndex(),[a,c]=e,d=Math.max(a.index,c.index);return{...n.inputs.state(),first_bar_time:1e3*i,last_bar_time:1e3*r,subscribeRealtime:l===d,mapRightBoundaryToBarStartTime:!!this._needExtendToBarsEnding()||void 0}}_isReady(){return!(0,l.isStudyGraphicsEmpty)(this.graphics())}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2817),i.e(7686),i.e(2428),i.e(2827),i.e(8381)]).then(i.bind(i,54011))).StudyLineDataSourceDefinitionsViewModel}_onDataUpdated(){this._updateAnchors(),this.updateAllViews((0,d.sourceChangeEvent)(this.id())),this._model.updateSource(this)}_updateAnchors(){const e=this._calculateAnchors();if(!e)return;const[{price:t},{price:i}]=e;this._timePoint.length&&(this._timePoint[0].price=t,this._timePoint[1].price=i),this._points.length&&(this._points[0].price=t,this._points[1].price=i)}_calculateAnchors(){let e=null,t=null,i=null,o=null;if(this.graphics().hhists().forEach((s=>{s.forEach((s=>{const{priceLow:r,priceHigh:n,firstBarTime:l,lastBarTime:a}=s;(null===e||r<e)&&(e=r),(null===t||n>t)&&(t=n),null!==l&&(null===i||l<i)&&(i=l),(null===o||a>o)&&(o=a)}))})),!(s(e)||s(t)||s(o)||s(i)))return[{price:t,index:i},{price:e,index:o}]}_updateAnchorsPrice(){const e=this._calculateAnchors();if(!e)return;const[{price:t},{price:i}]=e;this._timePoint.length&&(this._timePoint[0].price=t,this._timePoint[1].price=i),this._points.length&&(this._points[0].price=t,this._points[1].price=i)}async _createPaneViews(){const e=this._metaInfo,t=e.graphics,s=[],o=this._needExtendToBarsEnding();if(t.hhists){const{HHistPaneView:e}=await i.e(1668).then(i.bind(i,61352)),t=this.properties().childs().graphics.childs().polygons?.childs();s.push(new e(this,this._model,void 0,t?.histBoxBg,o,(()=>this._getLeftIndex())))}if(t.horizlines){const{HorizLinePaneView:e}=await i.e(1668).then(i.bind(i,32599));s.push(new e(this,this._model,void 0,o,(()=>this._getLeftIndex())))}
return e.plots.length>0&&s.push(this._createStudyPlotPaneView(e.plots[0].id,o)),e.plots.length>1&&s.push(this._createStudyPlotPaneView(e.plots[1].id,o)),e.plots.length>2&&s.push(this._createStudyPlotPaneView(e.plots[2].id,o)),s}_createStudyPlotPaneView(e,t){return new a.StudyPlotPaneView(this,this._model.mainSeries(),this._model,e,t)}_needExtendToBarsEnding(){return void 0!==this.metaInfo().defaults.inputs?.mapRightBoundaryToBarStartTime}static _configureProperties(e){super._configureProperties(e),e.setThemedColors((0,y.volumeProfileThemedColors)(e.childs().graphics.childs().polygons?.hasChild("histBoxBg")))}_getLeftIndex(){const e=this._getPointsetPoints();if(null===e)return null;const[t,i]=e;return t.index<i.index?t.index:i.index}_isInVisibleTimeRange(e){const t=this._model.timeScale().visibleBarsStrictRange();if(!t)return!1;if(e.some((e=>t.contains(e.index))))return!0;const[i,s]=e.sort(((e,t)=>e.index-t.index));return i.index<=t.firstBar()&&s.index>=t.lastBar()}}},77753:(e,t,i)=>{i.d(t,{volumeProfileThemedColors:()=>p});var s=i(86684);const{colorColdGray200:o,colorColdGray900:r,colorBerryPink400Alpha50:n,colorBerryPink400Alpha75:l,colorSkyBlue400Alpha50:a,colorSkyBlue400Alpha5:c,colorSkyBlue400Alpha75:d,colorSkyBlue500:h}=s.colors,u={val:[r,o],poc:[r,o],vah:[r,o],developingPoc:[r,o],developingVA:[h,h],valuesColor:[r,o],volumeColorUp:[a,a],volumeColorDown:[n,n],valueAreaColorUp:[d,d],valueAreaColorDown:[l,l],histogramBoxColor:[c,c]};function p(e){const t="graphics.horizlines",i="graphics.hhists",s=[{path:`${t}.pocLines.color`,colors:u.poc},{path:`${t}.vahLines.color`,colors:u.vah},{path:`${t}.valLines.color`,colors:u.val},{path:`${i}.histBars2.colors.0`,colors:u.volumeColorUp},{path:`${i}.histBars2.colors.1`,colors:u.volumeColorDown},{path:`${i}.histBars2.valuesColor`,colors:u.valuesColor},{path:`${i}.histBarsVA.colors.0`,colors:u.valueAreaColorUp},{path:`${i}.histBarsVA.colors.1`,colors:u.valueAreaColorDown},{path:`${i}.histBarsVA.valuesColor`,colors:u.valuesColor},{path:"styles.developingPoc.color",colors:u.developingPoc},{path:"styles.developingVAHigh.color",colors:u.developingVA},{path:"styles.developingVALow.color",colors:u.developingVA}];return e&&s.push({path:"graphics.polygons.histBoxBg.color",colors:u.histogramBoxColor}),s}}}]);