UNPKG

quoslibero

Version:

FusionCharts JavaScript charting framework

1 lines 1.29 kB
import{pluckNumber}from'../../../../fc-core/src/lib';import AnnotationShape from'./annotation-shape';const DEFAULT_RADIUS=0;class RectAnnotation extends AnnotationShape{getName(){return'rect'}configureAttributes(a={}){super.configureAttributes(a);let b=this,c=b.rawConfig;b.config.xRadius=pluckNumber(parseFloat(c.radius),DEFAULT_RADIUS),b.config.elementType='rect'}updateAttr(){var a=Math.abs;let b,c,d,e,f=this,g=this.config,h=g.calculatedAttrs;b=pluckNumber(h.x,f.getScaledVal(g.x,!0)),c=pluckNumber(h.y,f.getScaledVal(g.y,!1)),d=pluckNumber(h.toX,f.getScaledVal(g.tox,!0)),e=pluckNumber(h.toY,f.getScaledVal(g.toy,!1)),0<=e&&0<=c&&e<c&&([c,e]=[e,c]),0<=d&&0<=b&&d<b&&([b,d]=[d,b]),f._setConfig('attr',{x:b,y:c,width:a(d-b),height:a(e-c)})}_getAnnotationAttrs(){var a=Math.abs;let b=this,c=b.config,d=b._getConfig('attr')||{},e=b.getScaledVal(c.x),f=b.getScaledVal(c.y),g=c.xRadius,h=b.getScaledVal(c.tox),i=b.getScaledVal(c.toy),j=c.borderColor,k=c.borderThickness,l=c.dashArrayStr,m=c.color;return d.x='undefined'==typeof d.x?e:d.x,d.y='undefined'==typeof d.y?f:d.y,d.width='undefined'==typeof d.width?a(h-e):d.width,d.height='undefined'==typeof d.height?a(i-f):d.height,d.r=b.getScaledVal(g),d.fill=m,d.stroke=j,d['stroke-width']=k,d['stroke-dasharray']=l,d}}export default RectAnnotation;