UNPKG

realchart

Version:

Wooritech charting library

8 lines (6 loc) 5.98 kB
/** * RealChart Vector v1.4.12 * Copyright (C) 2023-2026 WooriTech Inc. * All Rights Reserved. */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("realchart")):"function"==typeof define&&define.amd?define(["exports","realchart"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RealChartVector={},t.RealChart)}(this,(function(t,e){"use strict";function n(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var o,r=n(e),i=(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),s=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return i(n,t),n.prototype._assignTo=function(n){return e.assignObj(t.prototype._assignTo.call(this,n),{length:this.length,angle:this.angle,lengthValue:this.lengthValue,angleValue:this.angleValue})},n.prototype._valuesChangd=function(e){return this.length!==e.length||this.angle!==e.angle||t.prototype._valuesChangd.call(this,e)},n.prototype._readArray=function(t,n){if(n.length<=2)this.isNull=!0;else{var o=n.length>3?1:0;o>0&&(this.x=n[e.pickNum(t.options.xField,0)]),this.y=n[e.pickNum(t.options.yField,0+o)],this.length=n[e.pickNum(t.options.lengthField,1+o)],this.angle=n[e.pickNum(t.options.angleField,2+o)]}},n.prototype._readObject=function(n,o){t.prototype._readObject.call(this,n,o),this.length=e.pickProp(o[n.options.lengthField],o.length),this.angle=e.pickProp(o[n.options.angleField],o.angle),this.y=e.pickProp3(n._yFielder(o),o.y,o.value)},n.prototype._readSingle=function(e){t.prototype._readSingle.call(this,e),this.length=this.angle=this.y},n.prototype.parse=function(e){t.prototype.parse.call(this,e),this.isNull||(this.isNull=isNaN(this.lengthValue)||isNaN(this.angleValue))},n.prototype.initValues=function(){this.lengthValue=parseFloat(this.length),this.angleValue=parseFloat(this.angle)},n.prototype.initPrev=function(t,e){e.yValue=this.yValue,e.lengthValue=.001},n.prototype.applyValueRate=function(t,n){this.lengthValue=e.incv(t.lengthValue,this.lengthValue,n)},n}(e.DataPoint),a=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return i(n,t),n.prototype._createPoint=function(t){return new s(t)},n.prototype._doPrepareRender=function(){t.prototype._doPrepareRender.call(this);var n=this._runPoints;if(n.length>0){var o=this._op.maxLength,r=this._op.origin,i=n.map((function(t){return t.length})).reduce((function(t,n){return e.maxv(t,n)}));n.forEach((function(t){var e=t.length/i;switch(t._len=e*o,r){case"start":t._off=-t._len/2;break;case"end":t._off=t._len/2;break;default:t._off=0}}))}},n.prototype._createLegendMarker=function(t,n){for(var o=.3,r=.7*n,i=[0,-o*n,-.2*n,-o*n,0,-.6*n,.2*n,-o*n,0,-o*n,0,.6*n],s=["M",i[0],i[1]+r],a=2;a<i.length;a+=2)s.push("L",i[a],i[a+1]+r);var l=new e.PathElement(t,e.Series.LEGEND_MARKER).setPath(s);return l.setStyle("strokeWidth","2px"),l.rotation=30,l},n.type=e.VectorSeriesType,n.defaults=e.extend(e.Series.defaults,{origin:"center",maxLength:20,startAngle:0,arrowHead:"close"}),n}(e.ConnectableSeries),l=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),p=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),e.prototype.layout=function(t,e,n){var o,r=this.point._len,i=r*n,s=.5,a=(r-i)/2;switch(t){case"none":o=[0,a-s*i,0,a+s*i];break;case"open":o=[0,a-.45*i,0-.15*i,a-.2*i,0,a-s*i,0+.15*i,a-.2*i,0,a-.45*i,0,a+s*i];break;default:var l=.3;o=[0,a-l*i,0-.1*i,a-l*i,0,a-s*i,0+.1*i,a-l*i,0,a-l*i,0,a+s*i]}for(var p=this.point._off*n,u=["M",o[0],o[1]+p],c=2;c<o.length;c+=2)u.push("L",o[c],o[c+1]+p);this.rotation=e,this.setPath(u)},e}(e.PointElement),u=function(t){function n(n){var o=t.call(this,n,"rct-vector-series")||this;return o._arrows=new e.ElementPool(o._pointContainer,p),o}return l(n,t),n.prototype._getPointPool=function(){return this._arrows},n.prototype._prepareSeries=function(t,e){this.$_prepareArrows(e,this._visPoints)},n.prototype._renderSeries=function(t,e){var n=this.model,o=n.options.startAngle,r=n.options.arrowHead,i=n._xAxisObj,s=n._yAxisObj,a=this._inverted,l=a?t:e,p=a?e:t,u=this._getGrowRate(),c=a?0:e,h=i.options.reversed?-1:1,f=s.options.reversed;this._pointContainer.invert(a,e),this._arrows.forEach((function(t){var e=t.point;if(t.setVis(!e.isNull)){var n=i.getPos(p,e.xValue),g=c-s.getPos(l,e.yValue),y=o+e.angleValue*h;f&&(y=180-y),e.xPos=a?c+s.getPos(l,e.yValue):n,e.yPos=a?p-i.getPos(p,e.xValue):g,t.trans(n,g),t.layout(r,y,u)}}))},n.prototype._runShowEffect=function(t){t&&e.SeriesAnimation.grow(this)},n.prototype._doViewRateChanged=function(t){this._renderSeries(this.width,this.height)},n.prototype.getPointsAt=function(t,e){return[]},n.prototype.$_prepareArrows=function(t,e){var n=this;this._arrows.prepare(e.length,(function(o,r){var i=o.point=e[r];n._setPointStyle(o,t,i)}))},n}(e.SeriesView);function c(t){(function(t){return t.Series&&t.SeriesView})(t)&&(t.Series.register(a),t.SeriesView.register([a,u]))}c(r),t.VectorSeries=a,t.default=c,Object.defineProperty(t,"__esModule",{value:!0})}));