highcharts
Version:
JavaScript charting framework
14 lines • 4.2 kB
JavaScript
/**
* 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
*/import*as t from"../highcharts.js";var e={};e.n=t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},e.d=(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},e.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let o=t.default;var r=e.n(o);let i=t.default.SeriesRegistry;var l=e.n(i);let{seriesTypes:{candlestick:n}}=l();class s extends n.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}}let a=t.default.Axis;var c=e.n(a);let{doc:p,win:u}=r();function h(t,e,o,i={}){let l="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(l,"hcEvents")||(l.hcEvents={});let n=l.hcEvents;r().Point&&t instanceof r().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let s=t.addEventListener;s&&s.call(t,e,o,!!r().supportsPassiveEvents&&{passive:void 0===i.passive?-1!==e.indexOf("touch"):i.passive,capture:!1}),n[e]||(n[e]=[]);let a={fn:o,order:"number"==typeof i.order?i.order:1/0};return n[e].push(a),n[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,l;t.nodeName&&(e?(i={})[e]=!0:i=o,y(i,function(t,e){if(o[e])for(l=o[e].length;l--;)r(e,o[e][l].fn)}))}let l="function"==typeof t&&t.prototype||t;if(Object.hasOwnProperty.call(l,"hcEvents")){let t=l.hcEvents;if(e){let l=t[e]||[];o?(t[e]=l.filter(function(t){return o!==t.fn}),r(e,o)):(i(t),t[e]=[])}else i(t),delete l.hcEvents}}(t,e,o)}}function f(t){return d(t)&&"number"==typeof t.nodeType}function d(t,e){let o;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(o=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==o)}function y(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:b}}=l();class v extends b{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,l=this.hollowCandlestickData[i];return r.fill=this.getPointFill(l)||r.fill,r.stroke=this.getLineColor(l.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}}v.defaultOptions=function(t,...e){let o,r=[t,...e],i={},l=function(t,e){return"object"!=typeof t&&(t={}),y(e,function(o,r){if("__proto__"!==r&&"constructor"!==r){let i;!d(o,!0)||(i=o?.constructor,d(o,!0)&&!f(o)&&i?.name&&"Object"!==i.name)||f(o)?t[r]=e[r]:t[r]=l(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=l(i,r[o]);return i}(b.defaultOptions,{color:"#f21313",dataGrouping:{groupAll:!0,groupPixelWidth:10},lineColor:"#f21313",upColor:"#06b535",upLineColor:"#06b535"}),h(v,"updatedData",function(){this.hollowCandlestickData.length&&(this.hollowCandlestickData.length=0)}),h(c(),"postProcessData",function(){this.series.forEach(function(t){t.is("hollowcandlestick")&&t.getPriceMovement()})}),v.prototype.pointClass=s,l().registerSeriesType("hollowcandlestick",v);let g=r();export{g as default};