highcharts
Version:
JavaScript charting framework
15 lines • 6.45 kB
JavaScript
/**
* Highstock JS v13.0.1 (2026-08-17)
* @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";let e={};e.n=t=>{let s=t&&t.__esModule?()=>t.default:()=>t;return e.d(s,{a:s}),s},e.d=(t,s)=>{if(Array.isArray(s))for(var r=0;r<s.length;){var o=s[r++],i=s[r++];e.o(t,o)?0===i&&r++:0===i?Object.defineProperty(t,o,{enumerable:!0,value:s[r++]}):Object.defineProperty(t,o,{enumerable:!0,get:i})}else for(var o in s)e.o(s,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:s[o]})},e.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let s=t.default;var r,o=e.n(s);let{setLength:i,splice:n}={convertToNumber:function(t,e){switch(typeof t){case"boolean":return+!!t;case"number":return isNaN(t)&&!e?null:t;default:return isNaN(t=parseFloat(`${t??""}`))&&!e?null:t}},setLength:function(t,e,s){return Array.isArray(t)?(t.length=e,t):t[s?"subarray":"slice"](0,e)},splice:function(t,e,s,r,o=[]){if(Array.isArray(t))return Array.isArray(o)||(o=Array.from(o)),{removed:t.splice(e,s,...o),array:t};let i=Object.getPrototypeOf(t).constructor,n=t[r?"subarray":"slice"](e,e+s),a=new i(t.length-s+o.length);return a.set(t.subarray(0,e),0),a.set(o,e),a.set(t.subarray(e+s),e+o.length),{removed:n,array:a}}},a=class{constructor(t={}){this.isDataTable=!0,this.autoId=!t.id,this.columns={},this.id=t.id||(0,s.uniqueKey)(),this.rowCount=0,this.versionTag=(0,s.uniqueKey)();let e=0;(0,s.objectEach)(t.columns||{},(t,s)=>{this.columns[s]=t.slice(),e=Math.max(e,t.length)}),this.applyRowCount(e)}applyRowCount(t){this.rowCount=t,(0,s.objectEach)(this.columns,(e,s)=>{e.length!==t&&(this.columns[s]=i(e,t))})}deleteRows(t,e=1){if(e>0&&t<this.rowCount){let r=0;(0,s.objectEach)(this.columns,(s,o)=>{this.columns[o]=n(s,t,e).array,r=s.length}),this.rowCount=r}(0,s.fireEvent)(this,"afterDeleteRows",{rowIndex:t,rowCount:e}),this.versionTag=(0,s.uniqueKey)()}getColumn(t,e){return this.columns[t]}getColumns(t,e){return(t||Object.keys(this.columns)).reduce((t,e)=>(t[e]=this.columns[e],t),{})}getRowObject(t,e){let s={},r=this.columns;for(let o of(e??(e=Object.keys(this.columns)),e))s[o]=r[o]?.[t];return s}setColumn(t,e=[],s=0,r){this.setColumns({[t]:e},s,r)}setColumns(t,e,r){let o=this.rowCount;(0,s.objectEach)(t,(t,e)=>{this.columns[e]=t.slice(),o=t.length}),this.applyRowCount(o),r?.silent||((0,s.fireEvent)(this,"afterSetColumns"),this.versionTag=(0,s.uniqueKey)())}setRow(t,e=this.rowCount,r,o){var i;let{columns:a}=this,l=r?this.rowCount+1:e+1,h=Object.keys(t);if(o?.addColumns!==!1)for(let t=0,e=h.length;t<e;t++)a[i=h[t]]||(a[i]=Array(this.rowCount));(0,s.objectEach)(a,(s,o)=>{s&&(r?s=n(s,e,0,!0,[t[o]]).array:s[e]=o in t?t[o]:s[e],a[o]=s)}),this.applyRowCount(Math.max(l,this.rowCount)),o?.silent||((0,s.fireEvent)(this,"afterSetRows",{rowIndex:e}),this.versionTag=(0,s.uniqueKey)())}getModified(){return this.modified||this}},l=t.default.SeriesRegistry;var h=e.n(l);let{seriesTypes:{scatter:{prototype:{pointClass:u}}}}=h(),p=class extends u{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")}},{composed:c}=o();function d(t,e,s,r){return[["M",t,e],["L",t+s,e+r],["M",t+s,e],["L",t,e+r],["Z"]]}(r||(r={})).compose=function(t){(0,s.pushUnique)(c,"Series.CrossSymbol")&&(t.prototype.symbols.cross=d)};let m=r,{composed:y}=o(),{scatter:f,column:{prototype:g}}=h().seriesTypes;class b extends f{constructor(){super(...arguments),this.allowDG=!1}static compose(t){(0,s.pushUnique)(y,"pointandfigure")&&m.compose(t)}init(){super.init.apply(this,arguments),this.pnfDataGroups=[]}getProcessedData(){let t;if(!this.pnfDataGroups)return{modified:this.dataTable.getModified(),cropped:!1,cropStart:0,closestPointRange:1};let e=this.options,r=this.getColumn("x",!0),o=this.getColumn("y",!0),i=e.boxSize,n=(0,s.isNumber)(i)?i:(0,s.relativeLength)(i,o[0]),l=this.pnfDataGroups,h=n*e.reversalAmount,u=this.dataTable.getModified(),p=u===this.dataTable?u:new a;function c(t,e,s){let r=l[l.length-1],o=e?1:-1,i=Math.floor(o*(t-s)/n);for(let t=1;t<=i;t++){let e=s+n*t*o;r.y.push(e)}}if(this.calculatedBoxSize=n,this.isDirtyData||0===l.length){this.pnfDataGroups.length=0;for(let e=0;e<o.length;e++){let s=r[e],i=o[e],a=o[0];if(i-a>=n){t=!0,l.push({x:s,y:[i],upTrend:t});break}if(a-i>=n){t=!1,l.push({x:s,y:[i],upTrend:t});break}}o.forEach((e,s)=>{let o,i=r[s],a=(o=l[l.length-1].y)[o.length-1];t&&(e-a>=n&&c(e,t,a),a-e>=h&&(t=!1,l.push({x:i,y:[],upTrend:t}),c(e,t,a))),!t&&(a-e>=n&&c(e,t,a),e-a>=h&&(t=!0,l.push({x:i,y:[],upTrend:t}),c(e,t,a)))})}let d=[],m=[],y=[],f=[];return l.forEach(t=>{let e=t.x,s=t.upTrend;t.y.forEach(t=>{m.push(e),y.push(t),f.push(s),d.push({x:e,y:t,upTrend:s})})}),p.setColumn("x",m),p.setColumn("y",y),p.setColumn("upTrend",f),this.pnfDataGroups=l,this.hasProcessedDataTable=!0,{modified:p,cropped:!1,cropStart:0,closestPointRange:1}}markerAttribs(t){let e=this.options,s={},r=t.pos();return s.width=this.markerWidth,s.height=this.markerHeight,r&&s.width&&s.height&&(s.x=r[0]-Math.round(s.width)/2,s.y=r[1]-Math.round(s.height)/2),e.crisp&&s.x&&(s.x=Math.floor(s.x)),s}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()}}b.defaultOptions=(0,s.merge)(f.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"}),(0,s.extend)(b.prototype,{takeOrdinalPosition:!0,pnfDataGroups:[],getColumnMetrics:g.getColumnMetrics,pointClass:p,sorted:!0}),h().registerSeriesType("pointandfigure",b);let C=o();b.compose(C.Renderer);let w=o();export{w as default};