UNPKG

highcharts

Version:
14 lines 4.08 kB
!/** * Highstock JS v12.6.0 (2026-04-13) * @module highcharts/modules/renko * @requires highcharts * @requires highcharts/modules/stock * * Renko series type for Highcharts Stock * * (c) 2010-2026 Highsoft AS * Author: Paweł Lysy * * 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.Series.types.column):"function"==typeof define&&define.amd?define("highcharts/modules/renko",["highcharts/highcharts"],function(t){return e(t,t.SeriesRegistry,t.Series,["types"],["column"])}):"object"==typeof exports?exports["highcharts/modules/renko"]=e(t._Highcharts,t._Highcharts.SeriesRegistry,t._Highcharts.Series.types.column):t.Highcharts=e(t.Highcharts,t.Highcharts.SeriesRegistry,t.Highcharts.Series.types.column)}("u"<typeof window?this:window,(t,e,o)=>(()=>{"use strict";var r={448:t=>{t.exports=o},512:t=>{t.exports=e},944:e=>{e.exports=t}},s={};function n(t){var e=s[t];if(void 0!==e)return e.exports;var o=s[t]={exports:{}};return r[t](o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var i={};n.d(i,{default:()=>x});var a=n(944),l=n.n(a),p=n(512),c=n.n(p);let{column:{prototype:{pointClass:h}}}=c().seriesTypes;var u=n(448),f=n.n(u);let{doc:d,win:y}=l();function g(t){return m(t)&&"number"==typeof t.nodeType}function m(t,e){let o;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(o=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==o)}Array.prototype.find;class b extends f(){constructor(){super(...arguments),this.hasDerivedData=!0,this.allowDG=!1}init(){super.init.apply(this,arguments),this.renkoData=[]}setData(t,e,o){this.renkoData=[],super.setData(t,e,o,!1)}getXExtremes(t){return this.processData(),{min:(t=this.getColumn("x",!0))[0],max:t[t.length-1]}}getProcessedData(){var t;let e=this.dataTable.getModified(),o=[],r=[],s=[],n=this.getColumn("x",!0),i=this.getColumn("y",!0);if(!this.renkoData||this.renkoData.length>0)return{modified:e,closestPointRange:1,cropped:!1,cropStart:0};let a=this.options.boxSize,l="number"==typeof a&&!isNaN(a)&&a<1/0&&a>-1/0?a:(t=i[0],/%$/.test(a)?t*parseFloat(a)/100+0:parseFloat(a)),p=[],c=n.length,h=0,u=i[0];for(let t=1;t<c;t++){let e=i[t]-i[t-1];if(e>l){2===h&&(u+=l);for(let o=0;o<e/l;o++)p.push({x:n[t]+o,low:u,y:u+l,color:this.options.color,upTrend:!0}),u+=l;h=1}else if(Math.abs(e)>l){1===h&&(u-=l);for(let o=0;o<Math.abs(e)/l;o++)p.push({x:n[t]+o,low:u-l,y:u,color:this.options.downColor,upTrend:!1}),u-=l;h=2}}for(let t of(this.renkoData=p,p))o.push(t.x),r.push(t.y),s.push(t.low);return this.processedData=p,e.setColumn("x",o),e.setColumn("y",r),e.setColumn("low",s),{modified:e,cropped:!1,cropStart:0,closestPointRange:1}}}b.defaultOptions=function(t,...e){let o,r=[t,...e],s={},n=function(t,e){return"object"!=typeof t&&(t={}),function(t,e,o){for(let o in t)Object.hasOwnProperty.call(t,o)&&e.call((0,t[o]),t[o],o,t)}(e,function(o,r){if("__proto__"!==r&&"constructor"!==r){let s;!m(o,!0)||(s=o?.constructor,m(o,!0)&&!g(o)&&s?.name&&"Object"!==s.name)||g(o)?t[r]=e[r]:t[r]=n(t[r]||{},o)}}),t};!0===t&&(s=r[1],r=Array.prototype.slice.call(r,2));let i=r.length;for(o=0;o<i;o++)s=n(s,r[o]);return s}(f().defaultOptions,{boxSize:4,groupPadding:0,pointPadding:0,downColor:"#ff0000",navigatorOptions:{type:"renko"},fillColor:"transparent",borderWidth:2,lineWidth:0,stickyTracking:!0,borderRadius:{where:"all"},tooltip:{pointFormat:'<span style="color:{point.color}">●</span> {series.name}: <b>{point.low:.2f} - {point.y:.2f}</b><br/>'}}),function(t,e){let o;for(o in t||(t={}),e)t[o]=e[o]}(b.prototype,{pointClass:class extends h{getClassName(){return super.getClassName.call(this)+(this.upTrend?" highcharts-point-up":" highcharts-point-down")}}}),c().registerSeriesType("renko",b);let x=l();return i.default})());