UNPKG

quoslibero

Version:

FusionCharts JavaScript charting framework

1 lines 1.16 kB
import AnnotationShape from'./annotation-shape';import{pluckNumber,clampNumber}from'../../../../fc-core/src/lib';const DEFAULT_POLYGON_SIDES=5,DEFAULT_ANGLE_START=0;class PolygonAnnotation extends AnnotationShape{getName(){return'polygon'}configureAttributes(a={}){super.configureAttributes(a);let b=this,c=b.rawConfig;b.config.sides=pluckNumber(clampNumber(c.sides,3),DEFAULT_POLYGON_SIDES),b.config.startAngle=pluckNumber(parseFloat(c.startAngle),DEFAULT_ANGLE_START),b.config.xRadius=pluckNumber(parseFloat(c.radius),0),b.config.elementType='polypath'}updateAttr(){let a,b=this,c=b.config,d=c.calculatedAttrs;a=[c.sides,pluckNumber(d.x,b.getScaledVal(c.x,!0)),pluckNumber(d.y,b.getScaledVal(c.y,!1)),b.getScaledVal(c.xRadius),c.startAngle,0],b._setConfig('attr',{polypath:a})}_getAnnotationAttrs(){let a=this,b=a.config,c=a._getConfig('attr')||{},d=b.sides,e=b.x,f=b.y,g=b.color,h=b.startAngle,i=b.borderColor,j=b.borderThickness,k=b.dashArrayStr,l=b.xRadius;return c.fill=g,c.stroke=i,c['stroke-width']=j,c['stroke-dasharray']=k,c.polypath=c.polypath||[d,a.getScaledVal(e,!0),a.getScaledVal(f,!1),a.getScaledVal(l),h,0],c}}export default PolygonAnnotation;