UNPKG

highcharts

Version:
14 lines 4.92 kB
!/** * Highstock JS v12.6.0 (2026-04-13) * @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 */function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(t._Highcharts,t._Highcharts.SeriesRegistry,t._Highcharts.Axis):"function"==typeof define&&define.amd?define("highcharts/modules/hollowcandlestick",["highcharts/highcharts"],function(t){return e(t,t.SeriesRegistry,t.Axis)}):"object"==typeof exports?exports["highcharts/modules/hollowcandlestick"]=e(t._Highcharts,t._Highcharts.SeriesRegistry,t._Highcharts.Axis):t.Highcharts=e(t.Highcharts,t.Highcharts.SeriesRegistry,t.Highcharts.Axis)}("u"<typeof window?this:window,(t,e,o)=>(()=>{"use strict";var r={512:t=>{t.exports=e},532:t=>{t.exports=o},944:e=>{e.exports=t}},i={};function s(t){var e=i[t];if(void 0!==e)return e.exports;var o=i[t]={exports:{}};return r[t](o,o.exports,s),o.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var o in e)s.o(e,o)&&!s.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n={};s.d(n,{default:()=>m});var l=s(944),a=s.n(l),c=s(512),h=s.n(c);let{seriesTypes:{candlestick:p}}=h();class u extends p.prototype.pointClass{getClassName(){let t=super.getClassName.apply(this),e=this.index,o=this.series.hollowCandlestickData[e];return o.isBullish||"up"!==o.trendDirection||(t+="-bearish-up"),t}}var f=s(532),d=s.n(f);let{doc:y,win:g}=a();function b(t,e,o,r={}){let i="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(i,"hcEvents")||(i.hcEvents={});let s=i.hcEvents;a().Point&&t instanceof a().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let n=t.addEventListener;n&&n.call(t,e,o,!!a().supportsPassiveEvents&&{passive:void 0===r.passive?-1!==e.indexOf("touch"):r.passive,capture:!1}),s[e]||(s[e]=[]);let l={fn:o,order:"number"==typeof r.order?r.order:1/0};return s[e].push(l),s[e].sort((t,e)=>t.order-e.order),function(){!function(t,e,o){function r(e,o){let r=t.removeEventListener;r&&r.call(t,e,o,!1)}function i(o){let i,s;t.nodeName&&(e?(i={})[e]=!0:i=o,k(i,function(t,e){if(o[e])for(s=o[e].length;s--;)r(e,o[e][s].fn)}))}let s="function"==typeof t&&t.prototype||t;if(Object.hasOwnProperty.call(s,"hcEvents")){let t=s.hcEvents;if(e){let s=t[e]||[];o?(t[e]=s.filter(function(t){return o!==t.fn}),r(e,o)):(i(t),t[e]=[])}else i(t),delete s.hcEvents}}(t,e,o)}}function v(t){return w(t)&&"number"==typeof t.nodeType}function w(t,e){let o;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(o=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==o)}function k(t,e,o){for(let r in t)Object.hasOwnProperty.call(t,r)&&e.call(o||t[r],t[r],r,t)}Array.prototype.find;let{seriesTypes:{candlestick:x}}=h();class C extends x{constructor(){super(...arguments),this.hollowCandlestickData=[]}getPriceMovement(){let t,e=this.allGroupedTable||this.dataTable,o=e.rowCount,r=this.hollowCandlestickData;r.length=0;for(let i=0;i<o;i++){let o=e.getRow(i,this.pointArrayMap);r.push(this.isBullish(o,i?t:o)),t=o}}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 o,r=super.pointAttribs.call(this,t,e),i=t.index,s=this.hollowCandlestickData[i];return r.fill=this.getPointFill(s)||r.fill,r.stroke=this.getLineColor(s.trendDirection)||r.stroke,e&&(r.fill=(o=this.options.states[e]).color||r.fill,r.stroke=o.lineColor||r.stroke,r["stroke-width"]=o.lineWidth||r["stroke-width"]),r}}C.defaultOptions=function(t,...e){let o,r=[t,...e],i={},s=function(t,e){return"object"!=typeof t&&(t={}),k(e,function(o,r){if("__proto__"!==r&&"constructor"!==r){let i;!w(o,!0)||(i=o?.constructor,w(o,!0)&&!v(o)&&i?.name&&"Object"!==i.name)||v(o)?t[r]=e[r]:t[r]=s(t[r]||{},o)}}),t};!0===t&&(i=r[1],r=Array.prototype.slice.call(r,2));let n=r.length;for(o=0;o<n;o++)i=s(i,r[o]);return i}(x.defaultOptions,{color:"#f21313",dataGrouping:{groupAll:!0,groupPixelWidth:10},lineColor:"#f21313",upColor:"#06b535",upLineColor:"#06b535"}),b(C,"updatedData",function(){this.hollowCandlestickData.length&&(this.hollowCandlestickData.length=0)}),b(d(),"postProcessData",function(){this.series.forEach(function(t){t.is("hollowcandlestick")&&t.getPriceMovement()})}),C.prototype.pointClass=u,h().registerSeriesType("hollowcandlestick",C);let m=a();return n.default})());