highcharts
Version:
JavaScript charting framework
14 lines • 3.59 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
*/function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(e._Highcharts,e._Highcharts.SeriesRegistry,e._Highcharts.Series.types.column):"function"==typeof define&&define.amd?define("highcharts/modules/renko",["highcharts/highcharts"],function(e){return t(e,e.SeriesRegistry,e.Series,["types"],["column"])}):"object"==typeof exports?exports["highcharts/modules/renko"]=t(e._Highcharts,e._Highcharts.SeriesRegistry,e._Highcharts.Series.types.column):e.Highcharts=t(e.Highcharts,e.Highcharts.SeriesRegistry,e.Highcharts.Series.types.column)}("u"<typeof window?this:window,(e,t,r)=>(()=>{"use strict";var o={448(e){e.exports=r},512(e){e.exports=t},944(t){t.exports=e}};let s={};function i(e){let t=s[e];if(void 0!==t)return t.exports;let r=s[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.n=e=>{let t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var o=t[r++],s=t[r++];i.o(e,o)?0===s&&r++:0===s?Object.defineProperty(e,o,{enumerable:!0,value:t[r++]}):Object.defineProperty(e,o,{enumerable:!0,get:s})}else for(var o in t)i.o(t,o)&&!i.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let n={};i.d(n,{default:()=>f});var a=i(944),l=i.n(a),p=i(512),h=i.n(p);let{column:{prototype:{pointClass:u}}}=h().seriesTypes;var c=i(448),d=i.n(c);class g extends d(){constructor(){super(...arguments),this.hasDerivedData=!0,this.allowDG=!1}init(){super.init.apply(this,arguments),this.renkoData=[]}setData(e,t,r){this.renkoData=[],super.setData(e,t,r,!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=[],o=[],s=[],i=[],n=this.getColumn("x",!0),l=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,a.isNumber)(p)?p:(0,a.relativeLength)(p,l[0]),u=[],c=n.length,d=0,g=l[0];for(let e=1;e<c;e++){let t=l[e]-l[e-1];if(t>h){2===d&&(g+=h);for(let r=0;r<t/h;r++)u.push({x:n[e]+r,low:g,y:g+h,color:this.options.color,upTrend:!0}),g+=h;d=1}else if(Math.abs(t)>h){1===d&&(g-=h);for(let r=0;r<Math.abs(t)/h;r++)u.push({x:n[e]+r,low:g-h,y:g,color:this.options.downColor,upTrend:!1}),g-=h;d=2}}for(let e of(this.renkoData=u,u))t.push(e.x),r.push(e.y),o.push(e.low),s.push(e.color),i.push(e.upTrend);return this.hasProcessedDataTable=!0,e.setColumn("x",t),e.setColumn("y",r),e.setColumn("low",o),e.setColumn("color",s),e.setColumn("upTrend",i),{modified:e,cropped:!1,cropStart:0,closestPointRange:1}}}g.defaultOptions=(0,a.merge)(d().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,a.extend)(g.prototype,{pointClass:class extends u{getClassName(){return super.getClassName.call(this)+(this.upTrend?" highcharts-point-up":" highcharts-point-down")}}}),h().registerSeriesType("renko",g);let f=l();return n.default})());