diff --git a/dist/circliful.js b/dist/circliful.js index 96ff9a7..51ce370 100644 --- a/dist/circliful.js +++ b/dist/circliful.js @@ -1 +1 @@ -var circliful=function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=1)}([function(t,e,i){},function(t,e,i){"use strict";i.r(e),i.d(e,"newCircle",(function(){return w})),i.d(e,"newCircleWithDataSet",(function(){return x}));i(0);var n,r=function(){function t(){}return t.extractPropertyFromObject=function(t,e){var i;return t.hasOwnProperty(e)&&t[e]&&(i=t[e]),i},t}(),o=function(){function t(t){this.options=t}return t.prototype.update=function(t){var e=this,i=document.getElementById("svg-"+this.options.id);Array.isArray(t)?t.forEach((function(t){return e.updateType(t.type,t.value)})):this.updateType(t.type,t.value),i.innerHTML="",b.initializeCircleType(this.options)},t.prototype.updateType=function(t,e){switch(t){case"percent":this.options.percent=Number(e);break;case"point":this.options.point=Boolean(e);break;case"animation":this.options.animation=Boolean(e);break;case"pointSize":this.options.pointSize=Number(e);break;case"animationStep":this.options.animationStep=Number(e);break;case"strokeGradient":this.options.strokeGradient=e;break;case"icon":this.options.icon=String(e);break;case"text":this.options.text=String(e);break;case"textReplacesPercentage":this.options.textReplacesPercentage=Boolean(e);break;case"foregroundCircleWidth":this.options.foregroundCircleWidth=Number(e);break;case"backgroundCircleWidth":this.options.backgroundCircleWidth=Number(e);break;case"additionalCssClasses":this.options.additionalCssClasses=e;break;case"progressColors":this.options.progressColors=e}},t.prototype.get=function(t){return r.extractPropertyFromObject(this.options,t)},t}(),s=function(){function t(){}return t.setAttributes=function(t,e){for(var i=0,n=Object.entries(e);i0,h=1,l=setInterval((function(e,n,a){var d=p/100*h;s.setAttributes(e,{d:s.describeArc(r.x,r.y,r.radius,c,d)}),u&&t.updateCircleColor(h,e,a),(h+=o)>n&&(clearInterval(l),"function"==typeof i&&i())}),d,n,r.percent,a)},t.updateCircleColor=function(t,e,i){var n=i.find((function(e){return e.percent===t}));n&&s.setAttributes(e,{style:"stroke: "+n.color})},t.getMilliseconds=function(t,e){var i=t||50;return e<=180&&(i/=3),i},t}(),p=function(){return(p=Object.assign||function(t){for(var e,i=1,n=arguments.length;ie},t.prototype.drawContainer=function(t){var e=this.getViewBoxParams(),i=e.minX,n=e.minY,r=e.width,o=e.height,s=a.addSvg(p({width:"100%",height:"100%",viewBox:i+" "+n+" "+r+" "+o,id:"svg-"+this.options.id,preserveAspectRatio:"xMinYMin meet"},t));this.tags.push({element:s,parentId:this.options.id})},t.prototype.getViewBoxParams=function(){var t=this.options,e=t.foregroundCircleWidth,i=t.backgroundCircleWidth,n=i;e>i&&(n=e);var r=this.size.width,o=this.size.height;return(e>5||i>5)&&(r=this.size.width+1.5*n,o=this.size.height+1.5*n),{minX:0,minY:0,width:r,height:o}},t.prototype.append=function(){this.tags.forEach((function(t){document.getElementById(t.parentId).appendChild(t.element)}))},t.prototype.initialize=function(t,e){this.options=t,this.size=e},t}(),u=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),h=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.coordinates={x:0,y:0},e.additionalCssClasses={},e}return u(e,t),e.prototype.initialize=function(e,i){t.prototype.initialize.call(this,e,i);var n=this.size.maxSize;this.coordinates={x:n/2,y:n/2},this.radius=n/2.2,this.options.additionalCssClasses&&(this.additionalCssClasses=this.options.additionalCssClasses),this.animateInView()},e.prototype.drawCircle=function(){var t={class:r.extractPropertyFromObject(this.additionalCssClasses,"svgContainer")};this.drawContainer(t),this.options.strokeGradient&&this.drawLinearGradient(),this.drawBackgroundCircle(),this.drawForegroundCircle(),this.options.point&&this.drawPoint(),this.options.icon&&this.drawIcon(),this.drawText(),!this.options.textReplacesPercentage&&this.options.text&&this.drawInfoText(),this.append()},e.prototype.drawBackgroundCircle=function(){var t=r.extractPropertyFromObject(this.additionalCssClasses,"backgroundCircle"),e=a.addCircle({id:"circle-"+this.options.id,class:"background-circle "+t,cx:String(this.coordinates.x),cy:String(this.coordinates.y),r:String(this.radius),"stroke-width":this.options.backgroundCircleWidth});this.tags.push({element:e,parentId:"svg-"+this.options.id})},e.prototype.drawPoint=function(){var t=this.radius/100*this.options.pointSize,e=r.extractPropertyFromObject(this.additionalCssClasses,"point"),i=a.addCircle({id:"point-"+this.options.id,class:"point-circle "+e,cx:String(this.coordinates.x),cy:String(this.coordinates.y),r:String(t)});this.tags.push({element:i,parentId:"svg-"+this.options.id})},e.prototype.drawForegroundCircle=function(){var t=3.6*this.options.percent,e=r.extractPropertyFromObject(this.additionalCssClasses,"foregroundCircle"),i={id:"arc-"+this.options.id,class:"foreground-circle "+e,d:s.describeArc(this.coordinates.x,this.coordinates.y,this.radius,0,t),"stroke-width":this.options.foregroundCircleWidth,"stroke-linecap":this.options.strokeLinecap};this.options.strokeGradient&&(i.stroke="url(#linearGradient)",i.class="foreground-circle-without-stroke-color "+e);var n=a.addArc(i);this.options.animation&&this.animate(n),this.tags.push({element:n,parentId:"svg-"+this.options.id})},e.prototype.animate=function(t,e){c.animateArc({arc:t,arcParams:{percent:e||this.options.percent,x:this.coordinates.x,y:this.coordinates.y,radius:this.radius},animationStep:this.options.animationStep,progressColors:this.options.progressColors},this.options.onAnimationEnd)},e.prototype.drawIcon=function(){var t=this.options.icon,e=r.extractPropertyFromObject(this.additionalCssClasses,"icon"),i=a.addText({id:"text-"+this.options.id,x:String(this.coordinates.x),y:String(this.coordinates.y-25),class:"circle-icon fa "+e});i.innerHTML="&#x"+t+";",this.tags.push({element:i,parentId:"svg-"+this.options.id})},e.prototype.drawText=function(){var t=r.extractPropertyFromObject(this.additionalCssClasses,"text"),e=a.addText({id:"text-"+this.options.id,x:String(this.coordinates.x),y:String(this.coordinates.y),class:"circle-text "+t}),i=this.options.noPercentageSign?"":"%",n=""+this.options.percent+i;this.options.textReplacesPercentage&&this.options.text&&(n=this.options.text),e.textContent=n,this.tags.push({element:e,parentId:"svg-"+this.options.id})},e.prototype.drawInfoText=function(){var t=r.extractPropertyFromObject(this.additionalCssClasses,"infoText"),e=a.addText({id:"text-"+this.options.id,x:String(this.coordinates.x),y:String(this.coordinates.y+20),class:"circle-info-text "+t});e.textContent=this.options.text,this.tags.push({element:e,parentId:"svg-"+this.options.id})},e.prototype.drawLinearGradient=function(){var t={};t.gradientStart=this.options.strokeGradient[0],t.gradientEnd=this.options.strokeGradient[1];var e=a.addDefs(t);this.tags.push({element:e,parentId:"svg-"+this.options.id})},e}(d),l=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),e.prototype.drawCircle=function(){var t={class:r.extractPropertyFromObject(this.additionalCssClasses,"svgContainer")};this.drawContainer(t),this.drawBackgroundCircle(),this.drawForegroundCircle(),this.drawText(),this.append()},e.prototype.drawBackgroundCircle=function(){var t=r.extractPropertyFromObject(this.additionalCssClasses,"backgroundCircle"),e=a.addArc({id:"bg-arc-"+this.options.id,d:s.describeArc(this.coordinates.x,this.coordinates.y,this.radius,270,90),class:"background-circle "+t,"stroke-width":this.options.backgroundCircleWidth});this.tags.push({element:e,parentId:"svg-"+this.options.id})},e.prototype.drawForegroundCircle=function(){var t=1.8*this.options.percent,e=r.extractPropertyFromObject(this.additionalCssClasses,"foregroundCircle"),i=a.addArc({id:"arc-"+this.options.id,class:"foreground-circle "+e,d:s.describeArc(this.coordinates.x,this.coordinates.y,this.radius,0,t),transform:"rotate(-90, "+this.coordinates.x+", "+this.coordinates.y+")","stroke-width":this.options.foregroundCircleWidth,"stroke-linecap":this.options.strokeLinecap});this.options.animation&&this.animate(i),this.tags.push({element:i,parentId:"svg-"+this.options.id})},e.prototype.animate=function(t){c.animateArc({arc:t,arcParams:{percent:this.options.percent,x:this.coordinates.x,y:this.coordinates.y,radius:this.radius,endAngleGrade:180},animationStep:this.options.animationStep,progressColors:this.options.progressColors},this.options.onAnimationEnd)},e}(h),g=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),m=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.coordinates={x:0,y:0},e.additionalCssClasses={},e}return g(e,t),e.prototype.initialize=function(e,i){t.prototype.initialize.call(this,e,i);var n=this.size.maxSize;this.coordinates={x:n/2,y:n/2},this.radius=n/2.2,this.options.additionalCssClasses&&(this.additionalCssClasses=this.options.additionalCssClasses),this.animateInView()},e.prototype.drawCircle=function(){this.drawContainer(),this.drawPlainCircle(),this.append()},e.prototype.drawPlainCircle=function(){var t=3.6*this.options.percent,e=r.extractPropertyFromObject(this.additionalCssClasses,"foregroundCircle"),i=a.addArc({id:"arc-"+this.options.id,class:"foreground-circle "+e,d:s.describeArc(this.coordinates.x,this.coordinates.y,this.radius,0,t),"stroke-width":this.options.foregroundCircleWidth,"stroke-linecap":this.options.strokeLinecap});this.options.animation&&this.animate(i),this.tags.push({element:i,parentId:"svg-"+this.options.id})},e.prototype.animate=function(t){c.animateArc({arc:t,arcParams:{percent:this.options.percent,x:this.coordinates.x,y:this.coordinates.y,radius:this.radius},animationStep:this.options.animationStep,progressColors:this.options.progressColors},this.options.onAnimationEnd)},e}(d),y=function(){function t(){}return t.create=function(t){var e;switch(t.toLowerCase()){case"half":e=new f;break;case"plain":e=new m;break;case"simple":e=new h;break;default:e=new h}return e},t}(),C=function(){return(C=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0?e.clientWidth:200,n=e.clientHeight>0?e.clientHeight:200;return{maxSize:i>n?n:i,height:n,width:i}},t.initializeCircleType=function(e,i){void 0===i&&(i=!1);var n=t.getParentSize(e.id),r=y.create(e.type),o=(new v).mergeOptions(e,i);return r.initialize(o,n),r.drawCircle(),r},t.prototype.newCircle=function(e){return t.initializeCircleType(e),new o(e)},t.prototype.newCircleWithDataSet=function(e,i){var n={id:e,type:i,percent:1};return t.initializeCircleType(n,!0),new o(n)},t}();function w(t){return(new b).newCircle(t)}function x(t,e){return(new b).newCircleWithDataSet(t,e)}}]); \ No newline at end of file +var circliful=function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=1)}([function(t,e,i){},function(t,e,i){"use strict";i.r(e),i.d(e,"newCircle",(function(){return w})),i.d(e,"newCircleWithDataSet",(function(){return x}));i(0);var n,r=function(){function t(){}return t.extractPropertyFromObject=function(t,e){var i;return t.hasOwnProperty(e)&&t[e]&&(i=t[e]),i},t}(),o=function(){function t(t){this.options=t}return t.prototype.update=function(t){var e=this,i=document.getElementById("svg-"+this.options.id);Array.isArray(t)?t.forEach((function(t){return e.updateType(t.type,t.value)})):this.updateType(t.type,t.value),i.innerHTML="",b.initializeCircleType(this.options)},t.prototype.updateType=function(t,e){switch(t){case"percent":this.options.percent=Number(e);break;case"point":this.options.point=Boolean(e);break;case"animation":this.options.animation=Boolean(e);break;case"pointSize":this.options.pointSize=Number(e);break;case"animationStep":this.options.animationStep=Number(e);break;case"strokeGradient":this.options.strokeGradient=e;break;case"icon":this.options.icon=String(e);break;case"text":this.options.text=String(e);break;case"textReplacesPercentage":this.options.textReplacesPercentage=Boolean(e);break;case"foregroundCircleWidth":this.options.foregroundCircleWidth=Number(e);break;case"backgroundCircleWidth":this.options.backgroundCircleWidth=Number(e);break;case"additionalCssClasses":this.options.additionalCssClasses=e;break;case"progressColors":this.options.progressColors=e}},t.prototype.get=function(t){return r.extractPropertyFromObject(this.options,t)},t}(),s=function(){function t(){}return t.setAttributes=function(t,e){for(var i=0,n=Object.entries(e);i0,h=1,l=setInterval((function(e,n,a){var d=p/100*h;s.setAttributes(e,{d:s.describeArc(r.x,r.y,r.radius,c,d)}),u&&t.updateCircleColor(h,e,a),(h+=o)>n&&(clearInterval(l),"function"==typeof i&&i())}),d,n,r.percent,a)},t.updateCircleColor=function(t,e,i){var n=i.find((function(e){return e.percent===t}));n&&s.setAttributes(e,{style:"stroke: "+n.color})},t.getMilliseconds=function(t,e){var i=t||50;return e<=180&&(i/=3),i},t}(),p=function(){return(p=Object.assign||function(t){for(var e,i=1,n=arguments.length;ie},t.prototype.drawContainer=function(t){var e=this.getViewBoxParams(),i=e.minX,n=e.minY,r=e.width,o=e.height,s=a.addSvg(p({width:"100%",height:"100%",viewBox:i+" "+n+" "+r+" "+o,id:"svg-"+this.options.id,preserveAspectRatio:"xMinYMin meet"},t));this.tags.push({element:s,parentId:this.options.id})},t.prototype.getViewBoxParams=function(){var t=this.options,e=t.foregroundCircleWidth,i=t.backgroundCircleWidth,n=i;e>i&&(n=e);var r=this.size.width,o=this.size.height;return(e>5||i>5)&&(r=this.size.width+1.5*n,o=this.size.height+1.5*n),{minX:0,minY:0,width:r,height:o}},t.prototype.append=function(){this.tags.forEach((function(t){document.getElementById(t.parentId).appendChild(t.element)}))},t.prototype.initialize=function(t,e){this.options=t,this.size=e},t}(),u=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),h=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.coordinates={x:0,y:0},e.additionalCssClasses={},e}return u(e,t),e.prototype.initialize=function(e,i){t.prototype.initialize.call(this,e,i);var n=this.size.maxSize;this.coordinates={x:n/2,y:n/2},this.radius=n/2.2,this.options.additionalCssClasses&&(this.additionalCssClasses=this.options.additionalCssClasses),this.animateInView()},e.prototype.drawCircle=function(){var t={class:r.extractPropertyFromObject(this.additionalCssClasses,"svgContainer")};this.drawContainer(t),this.options.strokeGradient&&this.drawLinearGradient(),this.drawBackgroundCircle(),this.drawForegroundCircle(),this.options.point&&this.drawPoint(),this.options.icon&&this.drawIcon(),this.drawText(),!this.options.textReplacesPercentage&&this.options.text&&this.drawInfoText(),this.append()},e.prototype.drawBackgroundCircle=function(){var t=r.extractPropertyFromObject(this.additionalCssClasses,"backgroundCircle"),e=a.addCircle({id:"circle-"+this.options.id,class:"background-circle "+t,cx:String(this.coordinates.x),cy:String(this.coordinates.y),r:String(this.radius),"stroke-width":this.options.backgroundCircleWidth});this.tags.push({element:e,parentId:"svg-"+this.options.id})},e.prototype.drawPoint=function(){var t=this.radius/100*this.options.pointSize,e=r.extractPropertyFromObject(this.additionalCssClasses,"point"),i=a.addCircle({id:"point-"+this.options.id,class:"point-circle "+e,cx:String(this.coordinates.x),cy:String(this.coordinates.y),r:String(t)});this.tags.push({element:i,parentId:"svg-"+this.options.id})},e.prototype.drawForegroundCircle=function(){var t=3.6*this.options.percent,e=r.extractPropertyFromObject(this.additionalCssClasses,"foregroundCircle"),i={id:"arc-"+this.options.id,class:"foreground-circle "+e,d:s.describeArc(this.coordinates.x,this.coordinates.y,this.radius,0,t),"stroke-width":this.options.foregroundCircleWidth,"stroke-linecap":this.options.strokeLinecap};this.options.strokeGradient&&(i.stroke="url(#linearGradient)",i.class="foreground-circle-without-stroke-color "+e);var n=a.addArc(i);this.options.animation&&this.animate(n),this.tags.push({element:n,parentId:"svg-"+this.options.id})},e.prototype.animate=function(t,e){c.animateArc({arc:t,arcParams:{percent:e||this.options.percent,x:this.coordinates.x,y:this.coordinates.y,radius:this.radius},animationStep:this.options.animationStep,progressColors:this.options.progressColors},this.options.onAnimationEnd)},e.prototype.drawIcon=function(){var t=this.options.icon,e=r.extractPropertyFromObject(this.additionalCssClasses,"icon"),i=a.addText({id:"text-"+this.options.id,x:String(this.coordinates.x),y:String(this.coordinates.y-25),class:"circle-icon fa "+e});i.innerHTML="&#x"+t+";",this.tags.push({element:i,parentId:"svg-"+this.options.id})},e.prototype.drawText=function(){var t=r.extractPropertyFromObject(this.additionalCssClasses,"text"),e=a.addText({id:"text-"+this.options.id,x:String(this.coordinates.x),y:String(this.coordinates.y),class:"circle-text "+t}),i=this.options.noPercentageSign?"":"%",n=""+this.options.percent+i;this.options.textReplacesPercentage&&this.options.text&&(n=this.options.text),e.textContent=n,this.tags.push({element:e,parentId:"svg-"+this.options.id})},e.prototype.drawInfoText=function(){var t=r.extractPropertyFromObject(this.additionalCssClasses,"infoText"),e=a.addText({id:"text-"+this.options.id,x:String(this.coordinates.x),y:String(this.coordinates.y+20),class:"circle-info-text "+t});e.textContent=this.options.text,this.tags.push({element:e,parentId:"svg-"+this.options.id})},e.prototype.drawLinearGradient=function(){var t={};t.gradientStart=this.options.strokeGradient[0],t.gradientEnd=this.options.strokeGradient[1];var e=a.addDefs(t);this.tags.push({element:e,parentId:"svg-"+this.options.id})},e}(d),l=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return l(e,t),e.prototype.drawCircle=function(){var t={class:r.extractPropertyFromObject(this.additionalCssClasses,"svgContainer")};this.drawContainer(t),this.drawBackgroundCircle(),this.drawForegroundCircle(),this.drawText(),this.append()},e.prototype.drawBackgroundCircle=function(){var t=r.extractPropertyFromObject(this.additionalCssClasses,"backgroundCircle"),e=a.addArc({id:"bg-arc-"+this.options.id,d:s.describeArc(this.coordinates.x,this.coordinates.y,this.radius,270,90),class:"background-circle "+t,"stroke-width":this.options.backgroundCircleWidth});this.tags.push({element:e,parentId:"svg-"+this.options.id})},e.prototype.drawForegroundCircle=function(){var t=1.8*this.options.percent,e=r.extractPropertyFromObject(this.additionalCssClasses,"foregroundCircle"),i=a.addArc({id:"arc-"+this.options.id,class:"foreground-circle "+e,d:s.describeArc(this.coordinates.x,this.coordinates.y,this.radius,0,t),transform:"rotate(-90, "+this.coordinates.x+", "+this.coordinates.y+")","stroke-width":this.options.foregroundCircleWidth,"stroke-linecap":this.options.strokeLinecap});this.options.animation&&this.animate(i),this.tags.push({element:i,parentId:"svg-"+this.options.id})},e.prototype.animate=function(t){c.animateArc({arc:t,arcParams:{percent:this.options.percent,x:this.coordinates.x,y:this.coordinates.y,radius:this.radius,endAngleGrade:180},animationStep:this.options.animationStep,progressColors:this.options.progressColors},this.options.onAnimationEnd)},e}(h),g=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),y=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.coordinates={x:0,y:0},e.additionalCssClasses={},e}return g(e,t),e.prototype.initialize=function(e,i){t.prototype.initialize.call(this,e,i);var n=this.size.maxSize;this.coordinates={x:n/2,y:n/2},this.radius=n/2.2,this.options.additionalCssClasses&&(this.additionalCssClasses=this.options.additionalCssClasses),this.animateInView()},e.prototype.drawCircle=function(){this.drawContainer(),this.drawPlainCircle(),this.append()},e.prototype.drawPlainCircle=function(){var t=3.6*this.options.percent,e=r.extractPropertyFromObject(this.additionalCssClasses,"foregroundCircle"),i=a.addArc({id:"arc-"+this.options.id,class:"foreground-circle "+e,d:s.describeArc(this.coordinates.x,this.coordinates.y,this.radius,0,t),"stroke-width":this.options.foregroundCircleWidth,"stroke-linecap":this.options.strokeLinecap});this.options.animation&&this.animate(i),this.tags.push({element:i,parentId:"svg-"+this.options.id})},e.prototype.animate=function(t){c.animateArc({arc:t,arcParams:{percent:this.options.percent,x:this.coordinates.x,y:this.coordinates.y,radius:this.radius},animationStep:this.options.animationStep,progressColors:this.options.progressColors},this.options.onAnimationEnd)},e}(d),m=function(){function t(){}return t.create=function(t){var e;switch(t.toLowerCase()){case"half":e=new f;break;case"plain":e=new y;break;case"simple":e=new h;break;default:e=new h}return e},t}(),C=function(){return(C=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0?e.clientWidth:200,n=e.clientHeight>0?e.clientHeight:200;return{maxSize:i>n?n:i,height:n,width:i}},t.initializeCircleType=function(e,i){void 0===i&&(i=!1);var n=t.getParentSize(e.id),r=m.create(e.type),o=(new v).mergeOptions(e,i);return r.initialize(o,n),r.drawCircle(),r},t.prototype.newCircle=function(e){return t.initializeCircleType(e),new o(e)},t.prototype.newCircleWithDataSet=function(e,i){var n={id:e,type:i,percent:1};return t.initializeCircleType(n,!0),new o(n)},t}();function w(t){return(new b).newCircle(t)}function x(t,e){return(new b).newCircleWithDataSet(t,e)}}]); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7a73a05..cc55557 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3683,91 +3683,6 @@ } } }, - "compression-webpack-plugin": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/compression-webpack-plugin/-/compression-webpack-plugin-3.1.0.tgz", - "integrity": "sha512-iqTHj3rADN4yHwXMBrQa/xrncex/uEQy8QHlaTKxGchT/hC0SdlJlmL/5eRqffmWq2ep0/Romw6Ld39JjTR/ug==", - "dev": true, - "requires": { - "cacache": "^13.0.1", - "find-cache-dir": "^3.0.0", - "neo-async": "^2.5.0", - "schema-utils": "^2.6.1", - "serialize-javascript": "^2.1.2", - "webpack-sources": "^1.0.1" - }, - "dependencies": { - "find-cache-dir": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", - "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - } - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", diff --git a/src/helper/svg-tags-helper.ts b/src/helper/svg-tags-helper.ts index 91edb3c..a516518 100644 --- a/src/helper/svg-tags-helper.ts +++ b/src/helper/svg-tags-helper.ts @@ -43,8 +43,8 @@ class SvgTagsHelper { const angleInRadians = (angleInDegrees - 90) * Math.PI / 180.0; return { - x: centerX + Math.round(radius * Math.cos(angleInRadians) + Number.EPSILON), - y: centerY + Math.round(radius * Math.sin(angleInRadians) + Number.EPSILON), + x: centerX + radius * Math.cos(angleInRadians), + y: centerY + radius * Math.sin(angleInRadians), }; }