UNPKG

highcharts

Version:
13 lines 3.27 kB
/** * Highcharts JS v12.6.0 (2026-04-13) * @module highcharts/modules/vector * @requires highcharts * * Vector plot series module * * (c) 2010-2026 Highsoft AS * Author: Torstein Hønsi * * A commercial license may be required depending on use. * See www.highcharts.com/license */import*as t from"../highcharts.js";var 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,r)=>Object.prototype.hasOwnProperty.call(t,r);let e=t.default;var o=r.n(e);let i=t.default.SeriesRegistry;var n=r.n(i);let{doc:a,win:s}=o();function l(t){return c(t)&&"number"==typeof t.nodeType}function c(t,r){let e;return!!t&&"object"==typeof t&&(!r||"[object Array]"!==(e=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==e)}Array.prototype.find;let{animObject:p}=o(),{series:h,seriesTypes:{scatter:d}}=n();class u extends d{animate(t){t?this.markerGroup.attr({opacity:.01}):this.markerGroup.animate({opacity:1},p(this.options.animation))}arrow(t){let r=t.length/this.lengthMax*this.options.vectorLength/20,e={start:10*r,center:0,end:-10*r}[this.options.rotationOrigin]||0;return[["M",0,7*r+e],["L",-1.5*r,7*r+e],["L",0,10*r+e],["L",1.5*r,7*r+e],["L",0,7*r+e],["L",0,-10*r+e]]}drawPoints(){let t=this.chart;for(let r of this.points){let e=r.plotX,o=r.plotY;!1===this.options.clip||t.isInsidePlot(e,o,{inverted:t.inverted})?(r.graphic||(r.graphic=this.chart.renderer.path().add(this.markerGroup).addClass("highcharts-point highcharts-color-"+function(){let t=arguments,r=t.length;for(let e=0;e<r;e++){let r=t[e];if(null!=r)return r}}(r.colorIndex,r.series.colorIndex))),r.graphic.attr({d:this.arrow(r),translateX:e,translateY:o,rotation:r.direction}),this.chart.styledMode||r.graphic.attr(this.pointAttribs(r))):r.graphic&&(r.graphic=r.graphic.destroy())}}pointAttribs(t,r){let e=this.options,o=t?.color||this.color,i=this.options.lineWidth;return r&&(o=e.states[r].color||o,i=(e.states[r].lineWidth||i)+(e.states[r].lineWidthPlus||0)),{stroke:o,"stroke-width":i}}translate(){h.prototype.translate.call(this),this.lengthMax=function(t){let r=t.length,e=t[0];for(;r--;)t[r]>e&&(e=t[r]);return e}(this.getColumn("length"))}}u.defaultOptions=function(t,...r){let e,o=[t,...r],i={},n=function(t,r){return"object"!=typeof t&&(t={}),function(t,r,e){for(let e in t)Object.hasOwnProperty.call(t,e)&&r.call((0,t[e]),t[e],e,t)}(r,function(e,o){if("__proto__"!==o&&"constructor"!==o){let i;!c(e,!0)||(i=e?.constructor,c(e,!0)&&!l(e)&&i?.name&&"Object"!==i.name)||l(e)?t[o]=r[o]:t[o]=n(t[o]||{},e)}}),t};!0===t&&(i=o[1],o=Array.prototype.slice.call(o,2));let a=o.length;for(e=0;e<a;e++)i=n(i,o[e]);return i}(d.defaultOptions,{lineWidth:2,marker:void 0,rotationOrigin:"center",states:{hover:{lineWidthPlus:1}},tooltip:{pointFormat:"<b>[{point.x}, {point.y}]</b><br/>Length: <b>{point.length}</b><br/>Direction: <b>{point.direction}\xb0</b><br/>"},vectorLength:20}),function(t,r){let e;for(e in t||(t={}),r)t[e]=r[e]}(u.prototype,{drawGraph:o().noop,getSymbol:o().noop,markerAttribs:o().noop,parallelArrays:["x","y","length","direction"],pointArrayMap:["y","length","direction"]}),n().registerSeriesType("vector",u);let f=o();export{f as default};