UNPKG

highcharts

Version:
14 lines 4.51 kB
!/** * Highstock JS v12.6.0 (2026-04-13) * @module highcharts/modules/heikinashi * @requires highcharts * @requires highcharts/modules/stock * * HeikinAshi 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):"function"==typeof define&&define.amd?define("highcharts/modules/heikinashi",["highcharts/highcharts"],function(t){return e(t,t.SeriesRegistry)}):"object"==typeof exports?exports["highcharts/modules/heikinashi"]=e(t._Highcharts,t._Highcharts.SeriesRegistry):t.Highcharts=e(t.Highcharts,t.Highcharts.SeriesRegistry)}("u"<typeof window?this:window,(t,e)=>(()=>{"use strict";var i={512:t=>{t.exports=e},944:e=>{e.exports=t}},r={};function s(t){var e=r[t];if(void 0!==e)return e.exports;var o=r[t]={exports:{}};return i[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 i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var o={};s.d(o,{default:()=>P});var n=s(944),a=s.n(n),h=s(512),c=s.n(h);let{candlestick:{prototype:{pointClass:l}},hlc:{prototype:{pointClass:p}}}=c().seriesTypes,{doc:u,win:f}=a();function d(t,e,i,r={}){let s="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(s,"hcEvents")||(s.hcEvents={});let o=s.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,i,!!a().supportsPassiveEvents&&{passive:void 0===r.passive?-1!==e.indexOf("touch"):r.passive,capture:!1}),o[e]||(o[e]=[]);let h={fn:i,order:"number"==typeof r.order?r.order:1/0};return o[e].push(h),o[e].sort((t,e)=>t.order-e.order),function(){!function(t,e,i){function r(e,i){let r=t.removeEventListener;r&&r.call(t,e,i,!1)}function s(i){let s,o;t.nodeName&&(e?(s={})[e]=!0:s=i,v(s,function(t,e){if(i[e])for(o=i[e].length;o--;)r(e,i[e][o].fn)}))}let o="function"==typeof t&&t.prototype||t;if(Object.hasOwnProperty.call(o,"hcEvents")){let t=o.hcEvents;if(e){let o=t[e]||[];i?(t[e]=o.filter(function(t){return i!==t.fn}),r(e,i)):(s(t),t[e]=[])}else s(t),delete o.hcEvents}}(t,e,i)}}function y(t){return g(t)&&"number"==typeof t.nodeType}function g(t,e){let i;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(i=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==i)}function v(t,e,i){for(let r in t)Object.hasOwnProperty.call(t,r)&&e.call(i||t[r],t[r],r,t)}Array.prototype.find;let{composed:k}=a(),{candlestick:m}=c().seriesTypes;function b(){this.series.forEach(t=>{t.is("heikinashi")&&(t.heikinashiData.length=0,t.getHeikinashiData())})}function x(){let t=this.points,e=this.heikinashiData,i=this.cropStart||0;for(let r=0;r<t.length;r++){let s=t[r],o=e[r+i];s.open=o[0],s.high=o[1],s.low=o[2],s.close=o[3]}}function D(){this.heikinashiData.length&&(this.heikinashiData.length=0)}class O extends m{constructor(){super(...arguments),this.heikinashiData=[]}static compose(t,e){var i;m.compose(t),i="HeikinAshi",0>k.indexOf(i)&&k.push(i)&&(d(e,"postProcessData",b),d(O,"afterTranslate",x),d(O,"updatedData",D))}getHeikinashiData(){let t=this.allGroupedTable||this.dataTable,e=t.rowCount,i=this.heikinashiData;if(!i.length&&e){this.modifyFirstPointValue(t.getRow(0,this.pointArrayMap));for(let r=1;r<e;r++)this.modifyDataPoint(t.getRow(r,this.pointArrayMap),i[r-1])}this.heikinashiData=i}init(){super.init.apply(this,arguments),this.heikinashiData=[]}modifyFirstPointValue(t){let e=(t[0]+t[1]+t[2]+t[3])/4,i=(t[0]+t[3])/2;this.heikinashiData.push([e,t[1],t[2],i])}modifyDataPoint(t,e){let i=(e[0]+e[3])/2,r=(t[0]+t[1]+t[2]+t[3])/4,s=Math.max(t[1],r,i),o=Math.min(t[2],r,i);this.heikinashiData.push([i,s,o,r])}}O.defaultOptions=function(t,...e){let i,r=[t,...e],s={},o=function(t,e){return"object"!=typeof t&&(t={}),v(e,function(i,r){if("__proto__"!==r&&"constructor"!==r){let s;!g(i,!0)||(s=i?.constructor,g(i,!0)&&!y(i)&&s?.name&&"Object"!==s.name)||y(i)?t[r]=e[r]:t[r]=o(t[r]||{},i)}}),t};!0===t&&(s=r[1],r=Array.prototype.slice.call(r,2));let n=r.length;for(i=0;i<n;i++)s=o(s,r[i]);return s}(m.defaultOptions,{dataGrouping:{groupAll:!0}}),O.prototype.pointClass=class extends l{},c().registerSeriesType("heikinashi",O);let j=a();O.compose(j.Series,j.Axis);let P=a();return o.default})());