UNPKG

highcharts

Version:
14 lines 3.02 kB
/** * Highstock JS v13.0.1 (2026-08-17) * @module highcharts/modules/hollowcandlestick * @requires highcharts * @requires highcharts/modules/stock * * Hollow Candlestick series type for Highcharts Stock * * (c) 2010-2026 Highsoft AS * Author: Karol Kołodziej * * A commercial license may be required depending on use, * see www.highcharts.com/license */import*as t from"../highcharts.js";let e={};e.n=t=>{let i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},e.d=(t,i)=>{if(Array.isArray(i))for(var o=0;o<i.length;){var l=i[o++],s=i[o++];e.o(t,l)?0===s&&o++:0===s?Object.defineProperty(t,l,{enumerable:!0,value:i[o++]}):Object.defineProperty(t,l,{enumerable:!0,get:s})}else for(var l in i)e.o(i,l)&&!e.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:i[l]})},e.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let i=t.default;var o=e.n(i);let l=t.default.SeriesRegistry;var s=e.n(l);let{seriesTypes:{candlestick:r}}=s();class a 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 n=t.default.Axis;var h=e.n(n);let{seriesTypes:{candlestick:c}}=s();class p extends c{constructor(){super(...arguments),this.hollowCandlestickData=[]}getPriceMovement(){let t,e=this.allGroupedTable||this.dataTable,i=e.rowCount,o=this.hollowCandlestickData;o.length=0;for(let l=0;l<i;l++){let i=e.getRowObject(l,this.pointArrayMap);o.push(this.isBullish(i,l?t:i)),t=i}}getLineColor(t){return"up"===t?this.options.upColor||"var(--highcharts-positive-color)":this.options.color||"var(--highcharts-negative-color)"}getPointFill(t){return t.isBullish?"transparent":"up"===t.trendDirection?this.options.upColor||"var(--highcharts-positive-color)":this.options.color||"var(--highcharts-negative-color)"}init(){super.init.apply(this,arguments),this.hollowCandlestickData=[]}isBullish(t,e){return{isBullish:(t.open||0)<=(t.close||0),trendDirection:(t.close||0)<(e?.close||0)?"down":"up"}}pointAttribs(t,e){let i,o=super.pointAttribs.call(this,t,e),l=t?.index,s=this.hollowCandlestickData[l||0]||{};return o.fill=this.getPointFill(s)||o.fill,o.stroke=this.getLineColor(s.trendDirection)||o.stroke,e&&(o.fill=(i=this.options.states?.[e]||{}).color||o.fill,o.stroke=i.lineColor||o.stroke,o["stroke-width"]=i.lineWidth||o["stroke-width"]),o}}p.defaultOptions=(0,i.merge)(c.defaultOptions,{color:"var(--highcharts-negative-color)",dataGrouping:{groupAll:!0,groupPixelWidth:10},lineColor:"var(--highcharts-negative-color)",upColor:"var(--highcharts-positive-color)",upLineColor:"var(--highcharts-positive-color)"}),(0,i.addEvent)(p,"updatedData",function(){this.hollowCandlestickData.length&&(this.hollowCandlestickData.length=0)}),(0,i.addEvent)(h(),"postProcessData",function(){this.series.forEach(function(t){t.is("hollowcandlestick")&&t.getPriceMovement()})}),p.prototype.pointClass=a,s().registerSeriesType("hollowcandlestick",p);let d=o();export{d as default};