UNPKG

highcharts

Version:
12 lines 5.08 kB
/** * Highcharts JS v12.3.0 (2025-06-21) * @module highcharts/modules/series-on-point * @requires highcharts * * Series on point module * * (c) 2010-2025 Highsoft AS * Author: Rafal Sebestjanski and Piotr Madej * * License: www.highcharts.com/license */import*as t from"../highcharts.js";var e,s,o,i={};i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let r=t.default;var n=i.n(r);(e=s||(s={})).setLength=function(t,e,s){return Array.isArray(t)?(t.length=e,t):t[s?"subarray":"slice"](0,e)},e.splice=function(t,e,s,o,i=[]){if(Array.isArray(t))return Array.isArray(i)||(i=Array.from(i)),{removed:t.splice(e,s,...i),array:t};let r=Object.getPrototypeOf(t).constructor,n=t[o?"subarray":"slice"](e,e+s),a=new r(t.length-s+i.length);return a.set(t.subarray(0,e),0),a.set(i,e),a.set(t.subarray(e+s),e+i.length),{removed:n,array:a}};let{setLength:a,splice:h}=s,{fireEvent:l,objectEach:u,uniqueKey:c}=n(),p=class{constructor(t={}){this.autoId=!t.id,this.columns={},this.id=t.id||c(),this.modified=this,this.rowCount=0,this.versionTag=c();let e=0;u(t.columns||{},(t,s)=>{this.columns[s]=t.slice(),e=Math.max(e,t.length)}),this.applyRowCount(e)}applyRowCount(t){this.rowCount=t,u(this.columns,(e,s)=>{e.length!==t&&(this.columns[s]=a(e,t))})}deleteRows(t,e=1){if(e>0&&t<this.rowCount){let s=0;u(this.columns,(o,i)=>{this.columns[i]=h(o,t,e).array,s=o.length}),this.rowCount=s}l(this,"afterDeleteRows",{rowIndex:t,rowCount:e}),this.versionTag=c()}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),{})}getRow(t,e){return(e||Object.keys(this.columns)).map(e=>this.columns[e]?.[t])}setColumn(t,e=[],s=0,o){this.setColumns({[t]:e},s,o)}setColumns(t,e,s){let o=this.rowCount;u(t,(t,e)=>{this.columns[e]=t.slice(),o=t.length}),this.applyRowCount(o),s?.silent||(l(this,"afterSetColumns"),this.versionTag=c())}setRow(t,e=this.rowCount,s,o){let{columns:i}=this,r=s?this.rowCount+1:e+1;u(t,(t,n)=>{let a=i[n]||o?.addColumns!==!1&&Array(r);a&&(s?a=h(a,e,0,!0,[t]).array:a[e]=t,i[n]=a)}),r>this.rowCount&&this.applyRowCount(r),o?.silent||(l(this,"afterSetRows"),this.versionTag=c())}},d=t.default.Point;var f=i.n(d);i.d({},{});let y=t.default.SeriesRegistry;var m=i.n(y);let g=t.default.SVGRenderer;var C=i.n(g);let{composed:w}=n(),{bubble:b}=m().seriesTypes,{addEvent:P,defined:R,find:v,isNumber:x,pushUnique:A}=n();var O=o||(o={});O.compose=function(t,e){if(A(w,"SeriesOnPoint")){let{chartGetZData:s,seriesAfterInit:o,seriesAfterRender:i,seriesGetCenter:r,seriesShowOrHide:n,seriesTranslate:a}=S.prototype;t.types.pie.prototype.onPointSupported=!0,P(t,"afterInit",o),P(t,"afterRender",i),P(t,"afterGetCenter",r),P(t,"hide",n),P(t,"show",n),P(t,"translate",a),P(e,"beforeRender",s),P(e,"beforeRedraw",s)}return t};class S{constructor(t){this.getColumn=b.prototype.getColumn,this.getRadii=b.prototype.getRadii,this.getRadius=b.prototype.getRadius,this.getPxExtremes=b.prototype.getPxExtremes,this.getZExtremes=b.prototype.getZExtremes,this.chart=t.chart,this.series=t,this.options=t.options.onPoint}drawConnector(){this.connector||(this.connector=this.series.chart.renderer.path().addClass("highcharts-connector-seriesonpoint").attr({zIndex:-1}).add(this.series.markerGroup));let t=this.getConnectorAttributes();t&&this.connector.animate(t)}getConnectorAttributes(){let t=this.series.chart,e=this.options;if(!e)return;let s=e.connectorOptions||{},o=e.position,i=t.get(e.id);if(!(i instanceof f())||!o||!R(i.plotX)||!R(i.plotY))return;let r=R(o.x)?o.x:i.plotX,n=R(o.y)?o.y:i.plotY,a=r+(o.offsetX||0),h=n+(o.offsetY||0),l=s.width||1,u=s.stroke||this.series.color,c=s.dashstyle,p={d:C().prototype.crispLine([["M",r,n],["L",a,h]],l),"stroke-width":l};return t.styledMode||(p.stroke=u,p.dashstyle=c),p}seriesAfterInit(){this.onPointSupported&&this.options.onPoint&&(this.bubblePadding=!0,this.useMapGeometry=!0,this.onPoint=new S(this))}seriesAfterRender(){delete this.chart.bubbleZExtremes,this.onPoint&&this.onPoint.drawConnector()}seriesGetCenter(t){let e=this.options.onPoint,s=t.positions;if(e){let t=this.chart.get(e.id);t instanceof f()&&R(t.plotX)&&R(t.plotY)&&(s[0]=t.plotX,s[1]=t.plotY);let o=e.position;o&&(R(o.x)&&(s[0]=o.x),R(o.y)&&(s[1]=o.y),o.offsetX&&(s[0]+=o.offsetX),o.offsetY&&(s[1]+=o.offsetY))}let o=this.radii&&this.radii[this.index];x(o)&&(s[2]=2*o),t.positions=s}seriesShowOrHide(){let t=this.chart.series;this.points?.forEach(e=>{let s=v(t,t=>{let s=((t.onPoint||{}).options||{}).id;return!!s&&s===e.id});s&&s.setVisible(!s.visible,!1)})}seriesTranslate(){this.onPoint&&(this.onPoint.getRadii(),this.radii=this.onPoint.radii)}chartGetZData(){let t=[];this.series.forEach(e=>{let s=e.options.onPoint;t.push(s?.z??null)});let e=new p({columns:{z:t}});this.series.forEach(t=>{t.onPoint&&(t.onPoint.dataTable=t.dataTable=e)})}}O.Additions=S;let E=o,T=n();E.compose(T.Series,T.Chart);let X=n();export{X as default};