highcharts
Version:
JavaScript charting framework
14 lines • 2.85 kB
JavaScript
/**
* Highstock JS v13.0.1 (2026-08-17)
* @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
*/import*as e from"../highcharts.js";let t={};t.n=e=>{let o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},t.d=(e,o)=>{if(Array.isArray(o))for(var r=0;r<o.length;){var s=o[r++],a=o[r++];t.o(e,s)?0===a&&r++:0===a?Object.defineProperty(e,s,{enumerable:!0,value:o[r++]}):Object.defineProperty(e,s,{enumerable:!0,get:a})}else for(var s in o)t.o(o,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:o[s]})},t.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let o=e.default;var r=t.n(o);let s=e.default.SeriesRegistry;var a=t.n(s);let{column:{prototype:{pointClass:n}}}=a().seriesTypes,l=e.default.Series.types.column;var i=t.n(l);class p extends i(){constructor(){super(...arguments),this.hasDerivedData=!0,this.allowDG=!1}init(){super.init.apply(this,arguments),this.renkoData=[]}setData(e,t,o){this.renkoData=[],super.setData(e,t,o,!1)}getXExtremes(e){return this.processData(),{min:(e=this.getColumn("x",!0))[0],max:e[e.length-1]}}getProcessedData(){let e=this.dataTable.getModified(),t=[],r=[],s=[],a=[],n=[],l=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 p=this.options.boxSize,h=(0,o.isNumber)(p)?p:(0,o.relativeLength)(p,i[0]),u=[],d=l.length,c=0,f=i[0];for(let e=1;e<d;e++){let t=i[e]-i[e-1];if(t>h){2===c&&(f+=h);for(let o=0;o<t/h;o++)u.push({x:l[e]+o,low:f,y:f+h,color:this.options.color,upTrend:!0}),f+=h;c=1}else if(Math.abs(t)>h){1===c&&(f-=h);for(let o=0;o<Math.abs(t)/h;o++)u.push({x:l[e]+o,low:f-h,y:f,color:this.options.downColor,upTrend:!1}),f-=h;c=2}}for(let e of(this.renkoData=u,u))t.push(e.x),r.push(e.y),s.push(e.low),a.push(e.color),n.push(e.upTrend);return this.hasProcessedDataTable=!0,e.setColumn("x",t),e.setColumn("y",r),e.setColumn("low",s),e.setColumn("color",a),e.setColumn("upTrend",n),{modified:e,cropped:!1,cropStart:0,closestPointRange:1}}}p.defaultOptions=(0,o.merge)(i().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/>'}}),(0,o.extend)(p.prototype,{pointClass:class extends n{getClassName(){return super.getClassName.call(this)+(this.upTrend?" highcharts-point-up":" highcharts-point-down")}}}),a().registerSeriesType("renko",p);let h=r();export{h as default};