UNPKG

highcharts

Version:
15 lines 4.73 kB
/** * Highstock JS v12.6.0 (2026-04-13) * @module highcharts/modules/pointandfigure * @requires highcharts * @requires highcharts/modules/stock * * Point and figure series type for Highcharts Stock * * (c) 2010-2026 Highsoft AS * * Author: Kamil Musiałowski * * A commercial license may be required depending on use. * See www.highcharts.com/license */import*as t from"../highcharts.js";var e,r={};r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let o=t.default;var s=r.n(o);let i=t.default.SeriesRegistry;var n=r.n(i);let{seriesTypes:{scatter:{prototype:{pointClass:a}}}}=n(),l=class extends a{resolveMarker(){let t=this.series.options;this.marker=this.options.marker=this.upTrend?t.markerUp:t.marker,this.color=this.options.marker.lineColor}resolveColor(){super.resolveColor(),this.resolveMarker()}getClassName(){return super.getClassName.call(this)+(this.upTrend?" highcharts-point-up":" highcharts-point-down")}},{doc:p,win:h}=s();function u(t){return c(t)&&"number"==typeof t.nodeType}function c(t,e){let r;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(r=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==r)}function d(t,e){return 0>t.indexOf(e)&&!!t.push(e)}Array.prototype.find;let{composed:f}=s();function m(t,e,r,o){return[["M",t,e],["L",t+r,e+o],["M",t+r,e],["L",t,e+o],["Z"]]}(e||(e={})).compose=function(t){d(f,"Series.CrossSymbol")&&(t.prototype.symbols.cross=m)};let y=e,{composed:g}=s(),{scatter:b,column:{prototype:x}}=n().seriesTypes;class C extends b{constructor(){super(...arguments),this.allowDG=!1}static compose(t){d(g,"pointandfigure")&&y.compose(t)}init(){super.init.apply(this,arguments),this.pnfDataGroups=[]}getProcessedData(){var t;let e;if(!this.pnfDataGroups)return{modified:this.dataTable.getModified(),cropped:!1,cropStart:0,closestPointRange:1};let r=this.dataTable.getModified(),o=this.options,s=this.getColumn("x",!0),i=this.getColumn("y",!0),n=o.boxSize,a="number"==typeof n&&!isNaN(n)&&n<1/0&&n>-1/0?n:(t=i[0],/%$/.test(n)?t*parseFloat(n)/100+0:parseFloat(n)),l=this.pnfDataGroups,p=a*o.reversalAmount;function h(t,e,r){let o=l[l.length-1],s=e?1:-1,i=Math.floor(s*(t-r)/a);for(let t=1;t<=i;t++){let e=r+a*t*s;o.y.push(e)}}if(this.calculatedBoxSize=a,this.isDirtyData||0===l.length){this.pnfDataGroups.length=0;for(let t=0;t<i.length;t++){let r=s[t],o=i[t],n=i[0];if(o-n>=a){e=!0,l.push({x:r,y:[o],upTrend:e});break}if(n-o>=a){e=!1,l.push({x:r,y:[o],upTrend:e});break}}i.forEach((t,r)=>{let o,i=s[r],n=(o=l[l.length-1].y)[o.length-1];e&&(t-n>=a&&h(t,e,n),n-t>=p&&(e=!1,l.push({x:i,y:[],upTrend:e}),h(t,e,n))),!e&&(n-t>=a&&h(t,e,n),t-n>=p&&(e=!0,l.push({x:i,y:[],upTrend:e}),h(t,e,n)))})}let u=[],c=[],d=[];return l.forEach(t=>{let e=t.x,r=t.upTrend;t.y.forEach(t=>{c.push(e),d.push(t),u.push({x:e,y:t,upTrend:r})})}),r.setColumn("x",c),r.setColumn("y",d),this.pnfDataGroups=l,this.processedData=u,{modified:r,cropped:!1,cropStart:0,closestPointRange:1}}markerAttribs(t){let e=this.options,r={},o=t.pos();return r.width=this.markerWidth,r.height=this.markerHeight,o&&r.width&&r.height&&(r.x=o[0]-Math.round(r.width)/2,r.y=o[1]-Math.round(r.height)/2),e.crisp&&r.x&&(r.x=Math.floor(r.x)),r}translate(){let t=this.getColumnMetrics(),e=this.calculatedBoxSize;this.markerWidth=t.width+t.paddedWidth+t.offset,this.markerHeight=this.yAxis.toPixels(0)-this.yAxis.toPixels(e),super.translate()}}C.defaultOptions=function(t,...e){let r,o=[t,...e],s={},i=function(t,e){return"object"!=typeof t&&(t={}),function(t,e,r){for(let r in t)Object.hasOwnProperty.call(t,r)&&e.call((0,t[r]),t[r],r,t)}(e,function(r,o){if("__proto__"!==o&&"constructor"!==o){let s;!c(r,!0)||(s=r?.constructor,c(r,!0)&&!u(r)&&s?.name&&"Object"!==s.name)||u(r)?t[o]=e[o]:t[o]=i(t[o]||{},r)}}),t};!0===t&&(s=o[1],o=Array.prototype.slice.call(o,2));let n=o.length;for(r=0;r<n;r++)s=i(s,o[r]);return s}(b.defaultOptions,{boxSize:"1%",reversalAmount:3,tooltip:{pointFormat:'<span style="color:{point.color}">●</span> <b> {series.name}</b><br/>Close: {point.y:.2f}<br/>',headerFormat:""},turboThreshold:0,groupPadding:.2,pointPadding:.1,pointRange:null,dataGrouping:{enabled:!1},markerUp:{symbol:"cross",lineColor:"#00FF00",lineWidth:2},marker:{symbol:"circle",fillColor:"transparent",lineColor:"#FF0000",lineWidth:2},legendSymbol:"lineMarker"}),function(t,e){let r;for(r in t||(t={}),e)t[r]=e[r]}(C.prototype,{takeOrdinalPosition:!0,pnfDataGroups:[],getColumnMetrics:x.getColumnMetrics,pointClass:l,sorted:!0}),n().registerSeriesType("pointandfigure",C);let k=s();C.compose(k.Renderer);let M=s();export{M as default};