highcharts
Version:
JavaScript charting framework
1 lines • 2.23 kB
JavaScript
import*as t from"../highcharts.js";import"./stock.js";var e={};e.n=t=>{var i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},e.d=(t,i)=>{for(var s in i)e.o(i,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:i[s]})},e.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let i=t.default;var s=e.n(i);e.d({},{});let l=t.default.SeriesRegistry;var o=e.n(l);let{seriesTypes:{candlestick:r}}=o();class n extends r.prototype.pointClass{getClassName(){let t=super.getClassName.apply(this),e=this.index,i=this.series.hollowCandlestickData[e];return i.isBullish||"up"!==i.trendDirection||(t+="-bearish-up"),t}}let a=t.default.Axis;var h=e.n(a);let{seriesTypes:{candlestick:p}}=o(),{addEvent:c,merge:u}=s();class d extends p{constructor(){super(...arguments),this.hollowCandlestickData=[]}getPriceMovement(){let t,e=this.allGroupedTable||this.dataTable,i=e.rowCount,s=this.hollowCandlestickData;s.length=0;for(let l=0;l<i;l++){let i=e.getRow(l,this.pointArrayMap);s.push(this.isBullish(i,l?t:i)),t=i}}getLineColor(t){return"up"===t?this.options.upColor||"#06b535":this.options.color||"#f21313"}getPointFill(t){return t.isBullish?"transparent":"up"===t.trendDirection?this.options.upColor||"#06b535":this.options.color||"#f21313"}init(){super.init.apply(this,arguments),this.hollowCandlestickData=[]}isBullish(t,e){return{isBullish:(t[0]||0)<=(t[3]||0),trendDirection:(t[3]||0)<(e?.[3]||0)?"down":"up"}}pointAttribs(t,e){let i,s=super.pointAttribs.call(this,t,e),l=t.index,o=this.hollowCandlestickData[l];return s.fill=this.getPointFill(o)||s.fill,s.stroke=this.getLineColor(o.trendDirection)||s.stroke,e&&(s.fill=(i=this.options.states[e]).color||s.fill,s.stroke=i.lineColor||s.stroke,s["stroke-width"]=i.lineWidth||s["stroke-width"]),s}}d.defaultOptions=u(p.defaultOptions,{color:"#f21313",dataGrouping:{groupAll:!0,groupPixelWidth:10},lineColor:"#f21313",upColor:"#06b535",upLineColor:"#06b535"}),c(d,"updatedData",function(){this.hollowCandlestickData.length&&(this.hollowCandlestickData.length=0)}),c(h(),"postProcessData",function(){this.series.forEach(function(t){t.is("hollowcandlestick")&&t.getPriceMovement()})}),d.prototype.pointClass=n,o().registerSeriesType("hollowcandlestick",d);let f=s();export{f as default};