Beispiel #1
0
    def _Flag_Palestine(self):
        s = _size
        g = Group()
        box = Rect(0,
                   s / 3.0,
                   s * 2,
                   s / 3.0,
                   fillColor=colors.mintcream,
                   strokeColor=None,
                   strokeWidth=0)
        g.add(box)

        greenbox = Rect(0,
                        0,
                        width=s * 2,
                        height=s / 3.0,
                        fillColor=colors.limegreen,
                        strokeColor=None,
                        strokeWidth=0)
        g.add(greenbox)

        blackbox = Rect(0,
                        2 * s / 3.0,
                        width=s * 2,
                        height=s / 3.0,
                        fillColor=colors.black,
                        strokeColor=None,
                        strokeWidth=0)
        g.add(blackbox)

        redwedge = Polygon(points=[0, 0, 2 * s / 3.0, (s / 2.0), 0, s],
                           fillColor=colors.red,
                           strokeColor=None,
                           strokeWidth=0)
        g.add(redwedge)
        return g
Beispiel #2
0
    def addShape(self, parent, node, shape, **kwargs):

        self.applyStyleToShape(shape, node, **kwargs)

        transform = node.get('transform')
        if transform:
            # transform can only be applied to a group
            if isinstance(node, Group):
                group = node
            else:
                group = Group()

            for op in parseTransform.iterparse(transform):
                self.applyTransformOnGroup(group, op)

            if not isinstance(node, Group):
                group.add(shape)

            parent.add(group)

        else:
            parent.add(shape)

        return shape
Beispiel #3
0
    def _Flag_Switzerland(self):
        s = _size
        g = Group()
        self._width = s

        g.add(
            Rect(0,
                 0,
                 s,
                 s,
                 fillColor=colors.red,
                 strokeColor=colors.black,
                 strokeWidth=0))
        g.add(
            Line((s / 2.0), (s / 5.5), (s / 2), (s - (s / 5.5)),
                 fillColor=colors.mintcream,
                 strokeColor=colors.mintcream,
                 strokeWidth=(s / 5.0)))
        g.add(
            Line((s / 5.5), (s / 2.0), (s - (s / 5.5)), (s / 2.0),
                 fillColor=colors.mintcream,
                 strokeColor=colors.mintcream,
                 strokeWidth=s / 5.0))
        return g
Beispiel #4
0
    def renderUse(self, node, group=None, clipping=None):
        if group is None:
            group = Group()

        item = self.xlink_href_target(node, group=group)
        if item is None:
            return
        elif item is DELAYED:
            return group

        if clipping:
            group.add(clipping)
        if len(node.getchildren()) == 0:
            # Append a copy of the referenced node as the <use> child (if not already done)
            node.append(copy.deepcopy(item))
        self.renderNode(node.getchildren()[-1], parent=group)
        getAttr = node.getAttribute
        transform = getAttr("transform")
        x, y = map(getAttr, ("x", "y"))
        if x or y:
            transform += " translate(%s, %s)" % (x or '0', y or '0')
        if transform:
            self.shape_converter.applyTransformOnGroup(transform, group)
        return group
def sample1():
    "Make up something from the individual Sectors"

    d = Drawing(400, 400)
    g = Group()

    s1 = Wedge(centerx=200, centery=200, radius=150, startangledegrees=0, endangledegrees=120, radius1=100)
    s1.fillColor=colors.red
    s1.strokeColor=None
    d.add(s1)
    s2 = Wedge(centerx=200, centery=200, radius=150, startangledegrees=120, endangledegrees=240, radius1=100)
    s2.fillColor=colors.green
    s2.strokeColor=None
    d.add(s2)
    s3 = Wedge(centerx=200, centery=200, radius=150, startangledegrees=240, endangledegrees=260, radius1=100)
    s3.fillColor=colors.blue
    s3.strokeColor=None
    d.add(s3)
    s4 = Wedge(centerx=200, centery=200, radius=150, startangledegrees=260, endangledegrees=360, radius1=100)
    s4.fillColor=colors.gray
    s4.strokeColor=None
    d.add(s4)

    return d
Beispiel #6
0
    def draw(self, dx=5, dy=300, auto_width=500, auto_height=500):
        """
        绘图操作
        :param dx: 图片绘图位置
        :param dy:  图片绘图位置
        :param auto_width: 自适应图片宽度(调节字体)
        :param auto_height: 自适应图片高度(调节字体)
        :return:
        """

        def reverse_dict(data: dict):
            out = {}
            for k, v in data.items():
                out[str(v)] = str(k)

            return out

        font = TTFont(self.fontName)
        img_dict = font['cmap'].tables[2].ttFont.tables['cmap'].tables[1].cmap
        img_dict = reverse_dict(img_dict)
        gs = font.getGlyphSet()
        glyphNames = font.getGlyphNames()
        for i in glyphNames:
            name = self.key(img_dict.get(i))
            if name == None:
                continue
            g = gs[i]
            pen = ReportLabPen(gs, Path(fillColor=colors.black, strokeWidth=10))
            g.draw(pen)
            w, h = g.width, g.width
            g = Group(pen.path)
            g.translate(dx, dy)
            d = Drawing(w + auto_width, h + auto_height)
            d.add(g)
            imageFile = self.imagePath + "/" + str(name) + "." + self.fmt
            renderPM.drawToFile(d, imageFile, self.fmt)
	def __init__(self,width=400,height=200,*args,**kw):
		Drawing.__init__(self,width,height,*args,**kw)
		self.transform = (1,0,0,1,0,0)
		self.add(Rect(50,50,300,125,rx=0,ry=0,fillColor=None,fillOpacity=None,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=0,strokeDashArray=None,strokeOpacity=None))
		self.add(Rect(75,50,100,27.08333,rx=0,ry=0,fillColor=Color(1,0,0,1),fillOpacity=None,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=0,strokeDashArray=None,strokeOpacity=None))
		self.add(Rect(225,50,100,41.66667,rx=0,ry=0,fillColor=Color(1,0,0,1),fillOpacity=None,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=0,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(50,49,350,49,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=0,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(50,49,50,44,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(200,49,200,44,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(350,49,350,44,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		v0=self._nn(Group())
		v0.transform = (.866025,.5,-0.5,.866025,133,47)
		v0.add(String(-20,-10,'Ying',textAnchor='start',fontName='Times-Roman',fontSize=10,fillColor=Color(0,0,0,1)))
		v0=self._nn(Group())
		v0.transform = (.866025,.5,-0.5,.866025,283,47)
		v0.add(String(-21.66,-10,'Yang',textAnchor='start',fontName='Times-Roman',fontSize=10,fillColor=Color(0,0,0,1)))
		self.add(Line(50,50,50,175,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=0,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(50,50,45,50,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(50,81.25,45,81.25,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(50,112.5,45,112.5,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(50,143.75,45,143.75,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(50,175,45,175,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,45,50)
		v0.add(String(-5,-4,'0',textAnchor='start',fontName='Times-Roman',fontSize=10,fillColor=Color(0,0,0,1)))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,45,81.25)
		v0.add(String(-10,-4,'15',textAnchor='start',fontName='Times-Roman',fontSize=10,fillColor=Color(0,0,0,1)))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,45,112.5)
		v0.add(String(-10,-4,'30',textAnchor='start',fontName='Times-Roman',fontSize=10,fillColor=Color(0,0,0,1)))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,45,143.75)
		v0.add(String(-10,-4,'45',textAnchor='start',fontName='Times-Roman',fontSize=10,fillColor=Color(0,0,0,1)))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,45,175)
		v0.add(String(-10,-4,'60',textAnchor='start',fontName='Times-Roman',fontSize=10,fillColor=Color(0,0,0,1)))
	def __init__(self,width=400,height=200,*args,**kw):
		Drawing.__init__(self,width,height,*args,**kw)
		self.transform = (1,0,0,1,0,0)
		self.add(Rect(50,50,300,125,rx=0,ry=0,fillColor=None,fillOpacity=None,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=0,strokeDashArray=None,strokeOpacity=None))
		self.add(Rect(92.85714,60.41667,55.71429,41.66667,rx=0,ry=0,fillColor=Color(1,0,0,1),fillOpacity=None,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=0,strokeDashArray=None,strokeOpacity=None))
		self.add(Rect(92.85714,122.9167,85.71429,41.66667,rx=0,ry=0,fillColor=Color(1,0,0,1),fillOpacity=None,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=0,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(49,50,49,175,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=0,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(49,50,44,50,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(49,112.5,44,112.5,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(49,175,44,175,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,44,81.25)
		v0.add(String(-20,-4,'Ying',textAnchor='start',fontName='Times-Roman',fontSize=10,fillColor=Color(0,0,0,1)))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,44,143.75)
		v0.add(String(-21.66,-4,'Yang',textAnchor='start',fontName='Times-Roman',fontSize=10,fillColor=Color(0,0,0,1)))
		self.add(Line(50,50,350,50,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=0,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(92.85714,50,92.85714,45,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(157.1429,50,157.1429,45,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(221.4286,50,221.4286,45,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(285.7143,50,285.7143,45,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		self.add(Line(350,50,350,45,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=10,strokeDashArray=None,strokeOpacity=None))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,92.85714,45)
		v0.add(String(-2.5,-10,'0',textAnchor='start',fontName='Times-Roman',fontSize=10,fillColor=Color(0,0,0,1)))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,157.1429,45)
		v0.add(String(-5,-10,'15',textAnchor='start',fontName='Times-Roman',fontSize=10,fillColor=Color(0,0,0,1)))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,221.4286,45)
		v0.add(String(-5,-10,'30',textAnchor='start',fontName='Times-Roman',fontSize=10,fillColor=Color(0,0,0,1)))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,285.7143,45)
		v0.add(String(-5,-10,'45',textAnchor='start',fontName='Times-Roman',fontSize=10,fillColor=Color(0,0,0,1)))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,350,45)
		v0.add(String(-5,-10,'60',textAnchor='start',fontName='Times-Roman',fontSize=10,fillColor=Color(0,0,0,1)))
Beispiel #9
0
	def __init__(self,width=400,height=200,*args,**kw):
		Drawing.__init__(self,width,height,*args,**kw)
		self.transform = (1,0,0,1,0,0)
		self.add(Rect(0,0,100,20,rx=0,ry=0,fillColor=Color(1,1,0,1),fillOpacity=None,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=0,strokeDashArray=None,strokeOpacity=None))
		self.add(String(5,5,'Text in the box',textAnchor='start',fontName='Times-Roman',fontSize=12,fillColor=Color(0,0,0,1)))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,25,25)
		v0.add(Rect(0,0,100,20,rx=0,ry=0,fillColor=Color(1,1,0,1),fillOpacity=None,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=0,strokeDashArray=None,strokeOpacity=None))
		v0.add(String(5,5,'Text in the box',textAnchor='start',fontName='Times-Roman',fontSize=12,fillColor=Color(0,0,0,1)))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,25,25)
		v1=v0._nn(Group())
		v1.transform = (1,0,0,1,25,25)
		v1.add(Rect(0,0,100,20,rx=0,ry=0,fillColor=Color(1,1,0,1),fillOpacity=None,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=0,strokeDashArray=None,strokeOpacity=None))
		v1.add(String(5,5,'Text in the box',textAnchor='start',fontName='Times-Roman',fontSize=12,fillColor=Color(0,0,0,1)))
		v0=self._nn(Group())
		v0.transform = (1,0,0,1,25,25)
		v1=v0._nn(Group())
		v1.transform = (1,0,0,1,25,25)
		v2=v1._nn(Group())
		v2.transform = (1,0,0,1,25,25)
		v2.add(Rect(0,0,100,20,rx=0,ry=0,fillColor=Color(1,1,0,1),fillOpacity=None,strokeColor=Color(0,0,0,1),strokeWidth=1,strokeLineCap=0,strokeLineJoin=0,strokeMiterLimit=0,strokeDashArray=None,strokeOpacity=None))
		v2.add(String(5,5,'Text in the box',textAnchor='start',fontName='Times-Roman',fontSize=12,fillColor=Color(0,0,0,1)))
Beispiel #10
0
 def draw(self):
     G = self.makeBackground()
     w = self.makeWedges()
     if G: return Group(G,w)
     return w
Beispiel #11
0
    def draw(self):
        slices = self.slices
        _3d_angle = self.angle_3d
        _3dva = self._3dva = _360(_3d_angle+90)
        a0 = _2rad(_3dva)
        self._xdepth_3d = cos(a0)*self.depth_3d
        self._ydepth_3d = sin(a0)*self.depth_3d
        self._cx = self.x+self.width/2.0
        self._cy = self.y+(self.height - self._ydepth_3d)/2.0
        radiusx = radiusy = self._cx-self.x
        if self.xradius: radiusx = self.xradius
        if self.yradius: radiusy = self.yradius
        self._radiusx = radiusx
        self._radiusy = radiusy = (1.0 - self.perspective/100.0)*radiusy
        data = self.normalizeData()
        sum = self._sum

        CX = self.CX
        CY = self.CY
        OX = self.OX
        OY = self.OY
        rad_dist = self.rad_dist
        _fillSide = self._fillSide
        self._seriesCount = n = len(data)
        _sl3d = self._sl3d = []
        g = Group()
        last = _360(self.startAngle)
        a0 = self.direction=='clockwise' and -1 or 1
        for v in data:
            v *= a0
            angle1, angle0 = last, v+last
            last = angle0
            if a0>0: angle0, angle1 = angle1, angle0
            _sl3d.append(_SL3D(angle0,angle1))

        labels = _fixLabels(self.labels,n)
        a0 = _3d_angle
        a1 = _3d_angle+180
        T = []
        S = []
        L = []

        class WedgeLabel3d(WedgeLabel):
            _ydepth_3d = self._ydepth_3d
            def _checkDXY(self,ba):
                if ba[0]=='n':
                    if not hasattr(self,'_ody'):
                        self._ody = self.dy
                        self.dy = -self._ody + self._ydepth_3d
    
        checkLabelOverlap = self.checkLabelOverlap

        for i in xrange(n):
            style = slices[i]
            if not style.visible: continue
            sl = _sl3d[i]
            lo = angle0 = sl.lo
            hi = angle1 = sl.hi
            if abs(hi-lo)<=1e-7: continue
            fillColor = _getShaded(style.fillColor,style.fillColorShaded,style.shading)
            strokeColor = _getShaded(style.strokeColor,style.strokeColorShaded,style.shading) or fillColor
            strokeWidth = style.strokeWidth
            cx0 = CX(i,0)
            cy0 = CY(i,0)
            cx1 = CX(i,1)
            cy1 = CY(i,1)
            #background shaded pie bottom
            g.add(Wedge(cx1,cy1,radiusx, lo, hi,yradius=radiusy,
                            strokeColor=strokeColor,strokeWidth=strokeWidth,fillColor=fillColor,
                            strokeLineJoin=1))
            #connect to top
            if lo < a0 < hi: angle0 = a0
            if lo < a1 < hi: angle1 = a1
            if 1:
                p = ArcPath(strokeColor=strokeColor, fillColor=fillColor,strokeWidth=strokeWidth,strokeLineJoin=1)
                p.addArc(cx1,cy1,radiusx,angle0,angle1,yradius=radiusy,moveTo=1)
                p.lineTo(OX(i,angle1,0),OY(i,angle1,0))
                p.addArc(cx0,cy0,radiusx,angle0,angle1,yradius=radiusy,reverse=1)
                p.closePath()
                if angle0<=_3dva and angle1>=_3dva:
                    rd = 0
                else:
                    rd = min(rad_dist(angle0),rad_dist(angle1))
                S.append((rd,p))
            _fillSide(S,i,lo,strokeColor,strokeWidth,fillColor)
            _fillSide(S,i,hi,strokeColor,strokeWidth,fillColor)

            #bright shaded top
            fillColor = style.fillColor
            strokeColor = style.strokeColor or fillColor
            T.append(Wedge(cx0,cy0,radiusx,lo,hi,yradius=radiusy,
                            strokeColor=strokeColor,strokeWidth=strokeWidth,fillColor=fillColor,strokeLineJoin=1))

            text = labels[i]
            if style.label_visible and text:
                rat = style.labelRadius
                self._radiusx *= rat
                self._radiusy *= rat
                mid = sl.mid
                labelX = OX(i,mid,0)
                labelY = OY(i,mid,0)
                _addWedgeLabel(self,text,L.append,mid,labelX,labelY,style,labelClass=WedgeLabel3d)
                if checkLabelOverlap:
                    l = L[-1]
                    l._origdata = { 'x': labelX, 'y':labelY, 'angle': mid,
                                    'rx': self._radiusx, 'ry':self._radiusy, 'cx':CX(i,0), 'cy':CY(i,0),
                                    'bounds': l.getBounds(),
                                    }
                self._radiusx = radiusx
                self._radiusy = radiusy

        S.sort(lambda a,b: -cmp(a[0],b[0]))
        if checkLabelOverlap and L:
            fixLabelOverlaps(L)
        map(g.add,map(lambda x:x[1],S)+T+L)
        return g
Beispiel #12
0
 def __init__(self, width=400, height=200, *args, **kw):
     Drawing.__init__(self, width, height, *args, **kw)
     self.transform = (1, 0, 0, 1, 0, 0)
     self.add(
         Line(50,
              100,
              350,
              100,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(50,
              100,
              50,
              95,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(143.75,
              100,
              143.75,
              95,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(237.5,
              100,
              237.5,
              95,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(331.25,
              100,
              331.25,
              95,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 50, 95)
     v0.add(
         String(-5,
                -10,
                '10',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 143.75, 95)
     v0.add(
         String(-5,
                -10,
                '20',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 237.5, 95)
     v0.add(
         String(-5,
                -10,
                '30',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 331.25, 95)
     v0.add(
         String(-5,
                -10,
                '40',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     self.add(
         Line(50,
              50,
              50,
              175,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(50,
              50,
              45,
              50,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(50,
              89.0625,
              45,
              89.0625,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(50,
              128.125,
              45,
              128.125,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(50,
              167.1875,
              45,
              167.1875,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 45, 50)
     v0.add(
         String(-10,
                -4,
                '10',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 45, 89.0625)
     v0.add(
         String(-10,
                -4,
                '20',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 45, 128.125)
     v0.add(
         String(-10,
                -4,
                '30',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 45, 167.1875)
     v0.add(
         String(-10,
                -4,
                '40',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
Beispiel #13
0
 def draw(self):
     g = Group()
     g.add(self.makeSectors())
     return g
 def __init__(self, width=400, height=200, *args, **kw):
     Drawing.__init__(self, width, height, *args, **kw)
     self.transform = (1, 0, 0, 1, 0, 0)
     self.add(
         Line(40,
              30,
              220,
              30,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(74.54545,
              30,
              74.54545,
              25,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(110.9091,
              30,
              110.9091,
              25,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(147.2727,
              30,
              147.2727,
              25,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(183.6364,
              30,
              183.6364,
              25,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(220,
              30,
              220,
              25,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 74.54545, 25)
     v0.add(
         String(-7.5,
                -10,
                '200',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 110.9091, 25)
     v0.add(
         String(-7.5,
                -10,
                '400',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 147.2727, 25)
     v0.add(
         String(-7.5,
                -10,
                '600',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 183.6364, 25)
     v0.add(
         String(-7.5,
                -10,
                '800',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 220, 25)
     v0.add(
         String(-10,
                -10,
                '1000',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     self.add(
         Line(40,
              30,
              40,
              115,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(40,
              34.59459,
              35,
              34.59459,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(40,
              57.56757,
              35,
              57.56757,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(40,
              80.54054,
              35,
              80.54054,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(40,
              103.5135,
              35,
              103.5135,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 35, 34.59459)
     v0.add(
         String(-25.08,
                -4,
                '1e+02',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 35, 57.56757)
     v0.add(
         String(-25.08,
                -4,
                '1e+04',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 35, 80.54054)
     v0.add(
         String(-25.08,
                -4,
                '1e+06',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 35, 103.5135)
     v0.add(
         String(-25.08,
                -4,
                '1e+08',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     self.add(
         PolyLine(points=[
             40, 34.59459, 41.81818, 41.51015, 43.63636, 45.55549, 45.45455,
             48.4257, 47.27273, 50.65201, 49.09091, 52.47104, 50.90909,
             54.00901, 52.72727, 55.34126, 54.54545, 56.51638, 56.36364,
             57.56757, 58.18182, 58.51848, 60, 59.3866, 61.81818, 60.18519,
             63.63636, 60.92456, 65.45455, 61.61291, 67.27273, 62.25681,
             69.09091, 62.86166, 70.90909, 63.43194, 72.72727, 63.97137,
             74.54545, 64.48312, 76.36364, 64.9699, 78.18182, 65.43403, 80,
             65.87753, 81.81818, 66.30215, 83.63636, 66.70943, 85.45455,
             67.10074, 87.27273, 67.47728, 89.09091, 67.84012, 90.90909,
             68.19022, 92.72727, 68.52846, 94.54545, 68.85561, 96.36364,
             69.17236, 98.18182, 69.47937, 100, 69.77722, 101.8182,
             70.06643, 103.6364, 70.34749, 105.4545, 70.62085, 107.2727,
             70.88692, 109.0909, 71.14608, 110.9091, 71.39868, 112.7273,
             71.64503, 114.5455, 71.88546, 116.3636, 72.12022, 118.1818,
             72.34959, 120, 72.5738, 121.8182, 72.79309, 123.6364, 73.00765,
             125.4545, 73.2177, 127.2727, 73.42342, 129.0909, 73.62499,
             130.9091, 73.82256, 132.7273, 74.01629, 134.5455, 74.20634,
             136.3636, 74.39283, 138.1818, 74.5759, 140, 74.75567, 141.8182,
             74.93226, 143.6364, 75.10578, 145.4545, 75.27633, 147.2727,
             75.44402, 149.0909, 75.60893, 150.9091, 75.77116, 152.7273,
             75.9308, 154.5455, 76.08792, 156.3636, 76.2426, 158.1818,
             76.39493, 160, 76.54496, 161.8182, 76.69277, 163.6364,
             76.83843, 165.4545, 76.98198, 167.2727, 77.1235, 169.0909,
             77.26304, 170.9091, 77.40066, 172.7273, 77.5364, 174.5455,
             77.67033, 176.3636, 77.80247, 178.1818, 77.9329, 180, 78.06163,
             181.8182, 78.18873, 183.6364, 78.31423, 185.4545, 78.43817,
             187.2727, 78.56059, 189.0909, 78.68152, 190.9091, 78.80101,
             192.7273, 78.91908, 194.5455, 79.03578, 196.3636, 79.15112,
             198.1818, 79.26514, 200, 79.37788, 201.8182, 79.48935,
             203.6364, 79.5996, 205.4545, 79.70864, 207.2727, 79.8165,
             209.0909, 79.92321, 210.9091, 80.02879, 212.7273, 80.13326,
             214.5455, 80.23665, 216.3636, 80.33898, 218.1818, 80.44027,
             220, 80.54054
         ],
                  strokeColor=Color(1, 0, 0, 1),
                  strokeWidth=.2,
                  strokeLineCap=0,
                  strokeLineJoin=1,
                  strokeMiterLimit=0,
                  strokeDashArray=None,
                  strokeOpacity=None))
     self.add(
         PolyLine(points=[
             40, 46.08108, 41.81818, 56.45441, 43.63636, 62.52242, 45.45455,
             66.82774, 47.27273, 70.16721, 49.09091, 72.89575, 50.90909,
             75.2027, 52.72727, 77.20107, 54.54545, 78.96376, 56.36364,
             80.54054, 58.18182, 81.96691, 60, 83.26908, 61.81818, 84.46697,
             63.63636, 85.57603, 65.45455, 86.60855, 67.27273, 87.5744,
             69.09091, 88.48169, 70.90909, 89.33709, 72.72727, 90.14624,
             74.54545, 90.91387, 76.36364, 91.64404, 78.18182, 92.34024, 80,
             93.00549, 81.81818, 93.64241, 83.63636, 94.25334, 85.45455,
             94.8403, 87.27273, 95.4051, 89.09091, 95.94936, 90.90909,
             96.47453, 92.72727, 96.98188, 94.54545, 97.4726, 96.36364,
             97.94774, 98.18182, 98.40825, 100, 98.85502, 101.8182,
             99.28883, 103.6364, 99.71042, 105.4545, 100.1205, 107.2727,
             100.5196, 109.0909, 100.9083, 110.9091, 101.2872, 112.7273,
             101.6567, 114.5455, 102.0174, 116.3636, 102.3695, 118.1818,
             102.7136, 120, 103.0499, 121.8182, 103.3788, 123.6364,
             103.7007, 125.4545, 104.0157, 127.2727, 104.3243, 129.0909,
             104.6267, 130.9091, 104.923, 132.7273, 105.2136, 134.5455,
             105.4987, 136.3636, 105.7784, 138.1818, 106.053, 140, 106.3227,
             141.8182, 106.5876, 143.6364, 106.8479, 145.4545, 107.1037,
             147.2727, 107.3552, 149.0909, 107.6026, 150.9091, 107.8459,
             152.7273, 108.0854, 154.5455, 108.3211, 156.3636, 108.5531,
             158.1818, 108.7816, 160, 109.0066, 161.8182, 109.2283,
             163.6364, 109.4468, 165.4545, 109.6622, 167.2727, 109.8744,
             169.0909, 110.0838, 170.9091, 110.2902, 172.7273, 110.4938,
             174.5455, 110.6947, 176.3636, 110.8929, 178.1818, 111.0885,
             180, 111.2816, 181.8182, 111.4723, 183.6364, 111.6605,
             185.4545, 111.8464, 187.2727, 112.0301, 189.0909, 112.2115,
             190.9091, 112.3907, 192.7273, 112.5678, 194.5455, 112.7429,
             196.3636, 112.9159, 198.1818, 113.0869, 200, 113.256, 201.8182,
             113.4232, 203.6364, 113.5886, 205.4545, 113.7521, 207.2727,
             113.9139, 209.0909, 114.074, 210.9091, 114.2324, 212.7273,
             114.3891, 214.5455, 114.5442, 216.3636, 114.6977, 218.1818,
             114.8496, 220, 115
         ],
                  strokeColor=Color(0, 0, 1, 1),
                  strokeWidth=.2,
                  strokeLineCap=0,
                  strokeLineJoin=1,
                  strokeMiterLimit=0,
                  strokeDashArray=None,
                  strokeOpacity=None))
     self.add(
         PolyLine(points=[
             40, 30, 41.81818, 35.53244, 43.63636, 38.76871, 45.45455,
             41.06489, 47.27273, 42.84594, 49.09091, 44.30116, 50.90909,
             45.53153, 52.72727, 46.59733, 54.54545, 47.53743, 56.36364,
             48.37838, 58.18182, 49.13911, 60, 49.8336, 61.81818, 50.47247,
             63.63636, 51.06397, 65.45455, 51.61465, 67.27273, 52.12977,
             69.09091, 52.61366, 70.90909, 53.06987, 72.72727, 53.50142,
             74.54545, 53.91082, 76.36364, 54.30025, 78.18182, 54.67155, 80,
             55.02635, 81.81818, 55.36604, 83.63636, 55.69187, 85.45455,
             56.00492, 87.27273, 56.30614, 89.09091, 56.59642, 90.90909,
             56.8765, 92.72727, 57.14709, 94.54545, 57.40881, 96.36364,
             57.66222, 98.18182, 57.90782, 100, 58.1461, 101.8182, 58.37747,
             103.6364, 58.60232, 105.4545, 58.821, 107.2727, 59.03386,
             109.0909, 59.24119, 110.9091, 59.44326, 112.7273, 59.64035,
             114.5455, 59.83269, 116.3636, 60.0205, 118.1818, 60.204, 120,
             60.38337, 121.8182, 60.55879, 123.6364, 60.73045, 125.4545,
             60.89849, 127.2727, 61.06306, 129.0909, 61.22431, 130.9091,
             61.38237, 132.7273, 61.53736, 134.5455, 61.68939, 136.3636,
             61.83859, 138.1818, 61.98504, 140, 62.12886, 141.8182,
             62.27013, 143.6364, 62.40895, 145.4545, 62.54539, 147.2727,
             62.67954, 149.0909, 62.81147, 150.9091, 62.94125, 152.7273,
             63.06896, 154.5455, 63.19466, 156.3636, 63.31841, 158.1818,
             63.44027, 160, 63.56029, 161.8182, 63.67854, 163.6364,
             63.79506, 165.4545, 63.90991, 167.2727, 64.02313, 169.0909,
             64.13476, 170.9091, 64.24485, 172.7273, 64.35345, 174.5455,
             64.46059, 176.3636, 64.5663, 178.1818, 64.67064, 180, 64.77363,
             181.8182, 64.87531, 183.6364, 64.97571, 185.4545, 65.07486,
             187.2727, 65.1728, 189.0909, 65.26954, 190.9091, 65.36513,
             192.7273, 65.45959, 194.5455, 65.55294, 196.3636, 65.64522,
             198.1818, 65.73644, 200, 65.82663, 201.8182, 65.91581,
             203.6364, 66.004, 205.4545, 66.09124, 207.2727, 66.17752,
             209.0909, 66.26289, 210.9091, 66.34735, 212.7273, 66.43093,
             214.5455, 66.51364, 216.3636, 66.59551, 218.1818, 66.67654,
             220, 66.75676
         ],
                  strokeColor=Color(0, .501961, 0, 1),
                  strokeWidth=.2,
                  strokeLineCap=0,
                  strokeLineJoin=1,
                  strokeMiterLimit=0,
                  strokeDashArray=None,
                  strokeOpacity=None))
Beispiel #15
0
    def makeLines(self):
        g = Group()

        labelFmt = self.lineLabelFormat
        P = list(range(len(self._positions)))
        if self.reversePlotOrder: P.reverse()
        inFill = self.inFill
        if inFill:
            inFillY = self.categoryAxis._y
            inFillX0 = self.valueAxis._x
            inFillX1 = inFillX0 + self.categoryAxis._length
            inFillG = getattr(self,'_inFillG',g)
        yzero = self._yzero

        # Iterate over data rows.
        for rowNo in P:
            row = self._positions[rowNo]
            styleCount = len(self.lines)
            styleIdx = rowNo % styleCount
            rowStyle = self.lines[styleIdx]
            rowColor = rowStyle.strokeColor
            dash = getattr(rowStyle, 'strokeDashArray', None)
            lineStyle = getattr(rowStyle,'lineStyle',None)

            if hasattr(rowStyle, 'strokeWidth'):
                strokeWidth = rowStyle.strokeWidth
            elif hasattr(self.lines, 'strokeWidth'):
                strokeWidth = self.lines.strokeWidth
            else:
                strokeWidth = None

            # Iterate over data columns.
            if lineStyle=='bar':
                barWidth = getattr(rowStyle,'barWidth',Percentage(50))
                fillColor = getattr(rowStyle,'fillColor',rowColor)
                if isinstance(barWidth,Percentage):
                    hbw = self._hngs*barWidth*0.01
                else:
                    hbw = barWidth*0.5
                for colNo in range(len(row)):
                    x,y = row[colNo]
                    g.add(Rect(x-hbw,min(y,yzero),2*hbw,abs(y-yzero),strokeWidth=strokeWidth,strokeColor=rowColor,fillColor=fillColor))
            elif self.joinedLines or lineStyle=='joinedLine':
                points = []
                for colNo in range(len(row)):
                    points += row[colNo]
                if inFill:
                    points = points + [inFillX1,inFillY,inFillX0,inFillY]
                    inFillG.add(Polygon(points,fillColor=rowColor,strokeColor=rowColor,strokeWidth=0.1))
                else:
                    line = PolyLine(points,strokeColor=rowColor,strokeLineCap=0,strokeLineJoin=1)
                    if strokeWidth:
                        line.strokeWidth = strokeWidth
                    if dash:
                        line.strokeDashArray = dash
                    g.add(line)

            if hasattr(rowStyle, 'symbol'):
                uSymbol = rowStyle.symbol
            elif hasattr(self.lines, 'symbol'):
                uSymbol = self.lines.symbol
            else:
                uSymbol = None

            if uSymbol:
                for colNo in range(len(row)):
                    x1, y1 = row[colNo]
                    symbol = uSymbol2Symbol(uSymbol,x1,y1,rowStyle.strokeColor)
                    if symbol: g.add(symbol)

            # Draw item labels.
            for colNo in range(len(row)):
                x1, y1 = row[colNo]
                self.drawLabel(g, rowNo, colNo, x1, y1)

        return g
Beispiel #16
0
    def draw(self):
        colorNamePairs = self.colorNamePairs
        autoCP = isAuto(colorNamePairs)
        if autoCP:
            chart = getattr(colorNamePairs, 'chart',
                            getattr(colorNamePairs, 'obj', None))
            swatchMarker = None
            autoCP = Auto(obj=chart)
            n = chart._seriesCount
            chartTexts = self._getTexts(colorNamePairs)
        else:
            swatchMarker = getattr(self, 'swatchMarker', None)
            if isAuto(swatchMarker):
                chart = getattr(swatchMarker, 'chart',
                                getattr(swatchMarker, 'obj', None))
                swatchMarker = Auto(obj=chart)
            n = len(colorNamePairs)
        dx = self.dx
        dy = self.dy
        alignment = self.alignment
        columnMaximum = self.columnMaximum
        deltax = self.deltax
        deltay = self.deltay
        dxTextSpace = self.dxTextSpace
        fontName = self.fontName
        fontSize = self.fontSize
        fillColor = self.fillColor
        strokeWidth = self.strokeWidth
        strokeColor = self.strokeColor
        subCols = self.subCols
        leading = fontSize * 1.2
        yGap = self.yGap
        if not deltay:
            deltay = max(dy, leading) + self.autoYPadding
        ba = self.boxAnchor
        maxWidth = self._calculateMaxBoundaries(colorNamePairs)
        nCols = int((n + columnMaximum - 1) / (columnMaximum * 1.0))
        xW = dx + dxTextSpace + self.autoXPadding
        variColumn = self.variColumn
        if variColumn:
            width = reduce(operator.add, [m[-1]
                                          for m in maxWidth], 0) + xW * nCols
        else:
            deltax = max(maxWidth[-1] + xW, deltax)
            width = maxWidth[-1] + nCols * deltax
            maxWidth = nCols * [maxWidth]

        thisx = self.x
        thisy = self.y - self.dy
        if ba not in ('ne', 'n', 'nw', 'autoy'):
            height = self._calcHeight()
            if ba in ('e', 'c', 'w'):
                thisy += height / 2.
            else:
                thisy += height
        if ba not in ('nw', 'w', 'sw', 'autox'):
            if ba in ('n', 'c', 's'):
                thisx -= width / 2
            else:
                thisx -= width
        upperlefty = thisy

        g = Group()

        ascent = getFont(fontName).face.ascent / 1000.
        if ascent == 0: ascent = 0.718  # default (from helvetica)
        ascent *= fontSize  # normalize

        lim = columnMaximum - 1
        callout = getattr(self, 'callout', None)
        scallout = getattr(self, 'swatchCallout', None)
        dividerLines = self.dividerLines
        if dividerLines:
            dividerWidth = self.dividerWidth
            dividerColor = self.dividerColor
            dividerDashArray = self.dividerDashArray
            dividerOffsX = self.dividerOffsX
            dividerOffsY = self.dividerOffsY

        for i in xrange(n):
            if autoCP:
                col = autoCP
                col.index = i
                name = chartTexts[i]
            else:
                col, name = colorNamePairs[i]
                if isAuto(swatchMarker):
                    col = swatchMarker
                    col.index = i
                if isAuto(name):
                    name = getattr(swatchMarker, 'chart',
                                   getattr(swatchMarker, 'obj',
                                           None)).getSeriesName(
                                               i, 'series %d' % i)
            T = _getLines(name)
            S = []
            aS = S.append
            j = int(i / (columnMaximum * 1.0))
            jOffs = maxWidth[j]

            # thisy+dy/2 = y+leading/2
            y = y0 = thisy + (dy - ascent) * 0.5

            if callout: callout(self, g, thisx, y, (col, name))
            if alignment == "left":
                x = thisx
                xn = thisx + jOffs[-1] + dxTextSpace
            elif alignment == "right":
                x = thisx + dx + dxTextSpace
                xn = thisx
            else:
                raise ValueError, "bad alignment"
            if not isSeqType(name):
                T = [T]
            yd = y
            for k, lines in enumerate(T):
                y = y0
                kk = k * 2
                x1 = x + jOffs[kk]
                x2 = x + jOffs[kk + 1]
                sc = subCols[k, i]
                anchor = sc.align
                fN = getattr(sc, 'fontName', fontName)
                fS = getattr(sc, 'fontSize', fontSize)
                fC = getattr(sc, 'fillColor', fillColor)
                fL = getattr(sc, 'leading', 1.2 * fontSize)
                if fN == fontName:
                    fA = (ascent * fS) / fontSize
                else:
                    fA = getFont(fontName).face.ascent / 1000.
                    if fA == 0: fA = 0.718
                    fA *= fS
                if anchor == 'left':
                    anchor = 'start'
                    xoffs = x1
                elif anchor == 'right':
                    anchor = 'end'
                    xoffs = x2
                elif anchor == 'numeric':
                    xoffs = x2
                else:
                    anchor = 'middle'
                    xoffs = 0.5 * (x1 + x2)
                for t in lines:
                    aS(
                        String(xoffs,
                               y,
                               t,
                               fontName=fN,
                               fontSize=fS,
                               fillColor=fC,
                               textAnchor=anchor))
                    y -= fL
                yd = min(yd, y)
                y += fL
                for iy, a in ((y - max(fL - fA, 0), 'underlines'),
                              (y + fA, 'overlines')):
                    il = getattr(sc, a, None)
                    if il:
                        if not isinstance(il, (tuple, list)): il = (il, )
                        for l in il:
                            l = copy.copy(l)
                            l.y1 += iy
                            l.y2 += iy
                            l.x1 += x1
                            l.x2 += x2
                            aS(l)
            x = xn
            y = yd
            leadingMove = 2 * y0 - y - thisy

            if dividerLines:
                xd = thisx + dx + dxTextSpace + jOffs[-1] + dividerOffsX[1]
                yd = thisy + dy * 0.5 + dividerOffsY
                if ((dividerLines & 1) and i % columnMaximum) or (
                    (dividerLines & 2) and not i % columnMaximum):
                    g.add(
                        Line(thisx + dividerOffsX[0],
                             yd,
                             xd,
                             yd,
                             strokeColor=dividerColor,
                             strokeWidth=dividerWidth,
                             strokeDashArray=dividerDashArray))

                if (dividerLines & 4) and (i % columnMaximum == lim
                                           or i == (n - 1)):
                    yd -= max(deltay, leadingMove) + yGap
                    g.add(
                        Line(thisx + dividerOffsX[0],
                             yd,
                             xd,
                             yd,
                             strokeColor=dividerColor,
                             strokeWidth=dividerWidth,
                             strokeDashArray=dividerDashArray))

            # Make a 'normal' color swatch...
            if isAuto(col):
                chart = getattr(col, 'chart', getattr(col, 'obj', None))
                c = chart.makeSwatchSample(getattr(col, 'index', i), x, thisy,
                                           dx, dy)
            elif isinstance(col, colors.Color):
                if isSymbol(swatchMarker):
                    c = uSymbol2Symbol(swatchMarker, x + dx / 2.,
                                       thisy + dy / 2., col)
                else:
                    c = self._defaultSwatch(x,
                                            thisy,
                                            dx,
                                            dy,
                                            fillColor=col,
                                            strokeWidth=strokeWidth,
                                            strokeColor=strokeColor)
            elif col is not None:
                try:
                    c = copy.deepcopy(col)
                    c.x = x
                    c.y = thisy
                    c.width = dx
                    c.height = dy
                except:
                    c = None
            else:
                c = None

            if c:
                g.add(c)
                if scallout: scallout(self, g, thisx, y0, i, (col, name), c)

            for s in S:
                g.add(s)
            if self.colEndCallout and (i % columnMaximum == lim
                                       or i == (n - 1)):
                if alignment == "left":
                    xt = thisx
                else:
                    xt = thisx + dx + dxTextSpace
                yd = thisy + dy * 0.5 + dividerOffsY - (
                    max(deltay, leadingMove) + yGap)
                self.colEndCallout(self, g, thisx, xt, yd, jOffs[-1],
                                   jOffs[-1] + dx + dxTextSpace)

            if i % columnMaximum == lim:
                if variColumn:
                    thisx += jOffs[-1] + xW
                else:
                    thisx = thisx + deltax
                thisy = upperlefty
            else:
                thisy = thisy - max(deltay, leadingMove) - yGap

        return g
    def makeSectors(self):
        # normalize slice data
        data = self.data
        multi = isListOfListOfNoneOrNumber(data)
        if multi:
            #it's a nested list, more than one sequence
            normData = []
            n = []
            for l in data:
                t = self.normalizeData(l)
                normData.append(t)
                n.append(len(t))
            self._seriesCount = max(n)
        else:
            normData = self.normalizeData(data)
            n = len(normData)
            self._seriesCount = n

        #labels
        checkLabelOverlap = self.checkLabelOverlap
        L = []
        L_add = L.append

        labels = self.labels
        if labels is None:
            labels = []
            if not multi:
                labels = [''] * n
            else:
                for m in n:
                    labels = list(labels) + [''] * m
        else:
            #there's no point in raising errors for less than enough labels if
            #we silently create all for the extreme case of no labels.
            if not multi:
                i = n - len(labels)
                if i > 0:
                    labels = list(labels) + [''] * i
            else:
                tlab = 0
                for m in n:
                    tlab += m
                i = tlab - len(labels)
                if i > 0:
                    labels = list(labels) + [''] * i
        self.labels = labels

        xradius = self.width / 2.0
        yradius = self.height / 2.0
        centerx = self.x + xradius
        centery = self.y + yradius

        if self.direction == "anticlockwise":
            whichWay = 1
        else:
            whichWay = -1

        g = Group()

        startAngle = self.startAngle  #% 360
        styleCount = len(self.slices)
        irf = self.innerRadiusFraction

        if multi:
            #multi-series doughnut
            ndata = len(data)
            if irf is None:
                yir = (yradius / 2.5) / ndata
                xir = (xradius / 2.5) / ndata
            else:
                yir = yradius * irf
                xir = xradius * irf
            ydr = (yradius - yir) / ndata
            xdr = (xradius - xir) / ndata
            for sn, series in enumerate(normData):
                for i, angle in enumerate(series):
                    endAngle = (startAngle + (angle * whichWay))  #% 360
                    aa = abs(startAngle - endAngle)
                    if aa < 1e-5:
                        startAngle = endAngle
                        continue
                    if startAngle < endAngle:
                        a1 = startAngle
                        a2 = endAngle
                    else:
                        a1 = endAngle
                        a2 = startAngle
                    startAngle = endAngle

                    #if we didn't use %stylecount here we'd end up with the later sectors
                    #all having the default style
                    sectorStyle = self.slices[sn, i % styleCount]

                    # is it a popout?
                    cx, cy = centerx, centery
                    if sectorStyle.popout != 0:
                        # pop out the sector
                        averageAngle = (a1 + a2) / 2.0
                        aveAngleRadians = averageAngle * pi / 180.0
                        popdistance = sectorStyle.popout
                        cx = centerx + popdistance * cos(aveAngleRadians)
                        cy = centery + popdistance * sin(aveAngleRadians)

                    yr1 = yir + sn * ydr
                    yr = yr1 + ydr
                    xr1 = xir + sn * xdr
                    xr = xr1 + xdr
                    if len(series) > 1:
                        theSector = Wedge(cx,
                                          cy,
                                          xr,
                                          a1,
                                          a2,
                                          yradius=yr,
                                          radius1=xr1,
                                          yradius1=yr1)
                    else:
                        theSector = Wedge(cx,
                                          cy,
                                          xr,
                                          a1,
                                          a2,
                                          yradius=yr,
                                          radius1=xr1,
                                          yradius1=yr1,
                                          annular=True)

                    theSector.fillColor = sectorStyle.fillColor
                    theSector.strokeColor = sectorStyle.strokeColor
                    theSector.strokeWidth = sectorStyle.strokeWidth
                    theSector.strokeDashArray = sectorStyle.strokeDashArray

                    shader = sectorStyle.shadingKind
                    if shader:
                        nshades = aa / float(sectorStyle.shadingAngle)
                        if nshades > 1:
                            shader = colors.Whiter if shader == 'lighten' else colors.Blacker
                            nshades = 1 + int(nshades)
                            shadingAmount = 1 - sectorStyle.shadingAmount
                            if sectorStyle.shadingDirection == 'normal':
                                dsh = (1 - shadingAmount) / float(nshades - 1)
                                shf1 = shadingAmount
                            else:
                                dsh = (shadingAmount - 1) / float(nshades - 1)
                                shf1 = 1
                            shda = (a2 - a1) / float(nshades)
                            shsc = sectorStyle.fillColor
                            theSector.fillColor = None
                            for ish in range(nshades):
                                sha1 = a1 + ish * shda
                                sha2 = a1 + (ish + 1) * shda
                                shc = shader(shsc, shf1 + dsh * ish)
                                if len(series) > 1:
                                    shSector = Wedge(cx,
                                                     cy,
                                                     xr,
                                                     sha1,
                                                     sha2,
                                                     yradius=yr,
                                                     radius1=xr1,
                                                     yradius1=yr1)
                                else:
                                    shSector = Wedge(cx,
                                                     cy,
                                                     xr,
                                                     sha1,
                                                     sha2,
                                                     yradius=yr,
                                                     radius1=xr1,
                                                     yradius1=yr1,
                                                     annular=True)
                                shSector.fillColor = shc
                                shSector.strokeColor = None
                                shSector.strokeWidth = 0
                                g.add(shSector)

                    g.add(theSector)

                    if sn == 0 and sectorStyle.visible and sectorStyle.label_visible:
                        text = self.getSeriesName(i, '')
                        if text:
                            averageAngle = (a1 + a2) / 2.0
                            aveAngleRadians = averageAngle * pi / 180.0
                            labelRadius = sectorStyle.labelRadius
                            rx = xradius * labelRadius
                            ry = yradius * labelRadius
                            labelX = centerx + (0.5 * self.width *
                                                cos(aveAngleRadians) *
                                                labelRadius)
                            labelY = centery + (0.5 * self.height *
                                                sin(aveAngleRadians) *
                                                labelRadius)
                            l = _addWedgeLabel(self, text, averageAngle,
                                               labelX, labelY, sectorStyle)
                            if checkLabelOverlap:
                                l._origdata = {
                                    'x': labelX,
                                    'y': labelY,
                                    'angle': averageAngle,
                                    'rx': rx,
                                    'ry': ry,
                                    'cx': cx,
                                    'cy': cy,
                                    'bounds': l.getBounds(),
                                }
                            L_add(l)

        else:
            #single series doughnut
            if irf is None:
                yir = yradius / 2.5
                xir = xradius / 2.5
            else:
                yir = yradius * irf
                xir = xradius * irf
            for i, angle in enumerate(normData):
                endAngle = (startAngle + (angle * whichWay))  #% 360
                aa = abs(startAngle - endAngle)
                if aa < 1e-5:
                    startAngle = endAngle
                    continue
                if startAngle < endAngle:
                    a1 = startAngle
                    a2 = endAngle
                else:
                    a1 = endAngle
                    a2 = startAngle
                startAngle = endAngle

                #if we didn't use %stylecount here we'd end up with the later sectors
                #all having the default style
                sectorStyle = self.slices[i % styleCount]

                # is it a popout?
                cx, cy = centerx, centery
                if sectorStyle.popout != 0:
                    # pop out the sector
                    averageAngle = (a1 + a2) / 2.0
                    aveAngleRadians = averageAngle * pi / 180.0
                    popdistance = sectorStyle.popout
                    cx = centerx + popdistance * cos(aveAngleRadians)
                    cy = centery + popdistance * sin(aveAngleRadians)

                if n > 1:
                    theSector = Wedge(cx,
                                      cy,
                                      xradius,
                                      a1,
                                      a2,
                                      yradius=yradius,
                                      radius1=xir,
                                      yradius1=yir)
                elif n == 1:
                    theSector = Wedge(cx,
                                      cy,
                                      xradius,
                                      a1,
                                      a2,
                                      yradius=yradius,
                                      radius1=xir,
                                      yradius1=yir,
                                      annular=True)

                theSector.fillColor = sectorStyle.fillColor
                theSector.strokeColor = sectorStyle.strokeColor
                theSector.strokeWidth = sectorStyle.strokeWidth
                theSector.strokeDashArray = sectorStyle.strokeDashArray

                shader = sectorStyle.shadingKind
                if shader:
                    nshades = aa / float(sectorStyle.shadingAngle)
                    if nshades > 1:
                        shader = colors.Whiter if shader == 'lighten' else colors.Blacker
                        nshades = 1 + int(nshades)
                        shadingAmount = 1 - sectorStyle.shadingAmount
                        if sectorStyle.shadingDirection == 'normal':
                            dsh = (1 - shadingAmount) / float(nshades - 1)
                            shf1 = shadingAmount
                        else:
                            dsh = (shadingAmount - 1) / float(nshades - 1)
                            shf1 = 1
                        shda = (a2 - a1) / float(nshades)
                        shsc = sectorStyle.fillColor
                        theSector.fillColor = None
                        for ish in range(nshades):
                            sha1 = a1 + ish * shda
                            sha2 = a1 + (ish + 1) * shda
                            shc = shader(shsc, shf1 + dsh * ish)
                            if n > 1:
                                shSector = Wedge(cx,
                                                 cy,
                                                 xradius,
                                                 sha1,
                                                 sha2,
                                                 yradius=yradius,
                                                 radius1=xir,
                                                 yradius1=yir)
                            elif n == 1:
                                shSector = Wedge(cx,
                                                 cy,
                                                 xradius,
                                                 sha1,
                                                 sha2,
                                                 yradius=yradius,
                                                 radius1=xir,
                                                 yradius1=yir,
                                                 annular=True)
                            shSector.fillColor = shc
                            shSector.strokeColor = None
                            shSector.strokeWidth = 0
                            g.add(shSector)

                g.add(theSector)

                # now draw a label
                if labels[
                        i] and sectorStyle.visible and sectorStyle.label_visible:
                    averageAngle = (a1 + a2) / 2.0
                    aveAngleRadians = averageAngle * pi / 180.0
                    labelRadius = sectorStyle.labelRadius
                    labelX = centerx + (0.5 * self.width *
                                        cos(aveAngleRadians) * labelRadius)
                    labelY = centery + (0.5 * self.height *
                                        sin(aveAngleRadians) * labelRadius)
                    rx = xradius * labelRadius
                    ry = yradius * labelRadius
                    l = _addWedgeLabel(self, labels[i], averageAngle, labelX,
                                       labelY, sectorStyle)
                    if checkLabelOverlap:
                        l._origdata = {
                            'x': labelX,
                            'y': labelY,
                            'angle': averageAngle,
                            'rx': rx,
                            'ry': ry,
                            'cx': cx,
                            'cy': cy,
                            'bounds': l.getBounds(),
                        }
                    L_add(l)

        if checkLabelOverlap and L:
            fixLabelOverlaps(L)

        for l in L:
            g.add(l)

        return g
Beispiel #18
0
 def __init__(self, width=400, height=200, *args, **kw):
     Drawing.__init__(self, width, height, *args, **kw)
     self.transform = (1, 0, 0, 1, 0, 0)
     self.add(
         Wedge(200,
               100,
               50,
               -147.8571,
               -135,
               yradius=50,
               annular=False,
               fillColor=Color(.27451, .509804, .705882, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -160.7143,
               -147.8571,
               yradius=50,
               annular=False,
               fillColor=Color(.847059, .74902, .847059, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -173.5714,
               -160.7143,
               yradius=50,
               annular=False,
               fillColor=Color(.392157, .584314, .929412, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -186.4286,
               -173.5714,
               yradius=50,
               annular=False,
               fillColor=Color(.690196, .768627, .870588, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -199.2857,
               -186.4286,
               yradius=50,
               annular=False,
               fillColor=Color(.498039, 1, .831373, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -212.1429,
               -199.2857,
               yradius=50,
               annular=False,
               fillColor=Color(.372549, .619608, .627451, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -225,
               -212.1429,
               yradius=50,
               annular=False,
               fillColor=Color(1, 1, 0, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -237.8571,
               -225,
               yradius=50,
               annular=False,
               fillColor=Color(.27451, .509804, .705882, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -250.7143,
               -237.8571,
               yradius=50,
               annular=False,
               fillColor=Color(.847059, .74902, .847059, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -263.5714,
               -250.7143,
               yradius=50,
               annular=False,
               fillColor=Color(.392157, .584314, .929412, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -276.4286,
               -263.5714,
               yradius=50,
               annular=False,
               fillColor=Color(.690196, .768627, .870588, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -289.2857,
               -276.4286,
               yradius=50,
               annular=False,
               fillColor=Color(.498039, 1, .831373, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -302.1429,
               -289.2857,
               yradius=50,
               annular=False,
               fillColor=Color(.372549, .619608, .627451, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -315,
               -302.1429,
               yradius=50,
               annular=False,
               fillColor=Color(1, 1, 0, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -327.8571,
               -315,
               yradius=50,
               annular=False,
               fillColor=Color(.27451, .509804, .705882, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -340.7143,
               -327.8571,
               yradius=50,
               annular=False,
               fillColor=Color(.847059, .74902, .847059, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -353.5714,
               -340.7143,
               yradius=50,
               annular=False,
               fillColor=Color(.392157, .584314, .929412, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -366.4286,
               -353.5714,
               yradius=50,
               annular=False,
               fillColor=Color(.690196, .768627, .870588, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -379.2857,
               -366.4286,
               yradius=50,
               annular=False,
               fillColor=Color(.498039, 1, .831373, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -392.1429,
               -379.2857,
               yradius=50,
               annular=False,
               fillColor=Color(.372549, .619608, .627451, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -405,
               -392.1429,
               yradius=50,
               annular=False,
               fillColor=Color(1, 1, 0, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -417.8571,
               -405,
               yradius=50,
               annular=False,
               fillColor=Color(.27451, .509804, .705882, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -430.7143,
               -417.8571,
               yradius=50,
               annular=False,
               fillColor=Color(.847059, .74902, .847059, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -443.5714,
               -430.7143,
               yradius=50,
               annular=False,
               fillColor=Color(.392157, .584314, .929412, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -456.4286,
               -443.5714,
               yradius=50,
               annular=False,
               fillColor=Color(.690196, .768627, .870588, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -469.2857,
               -456.4286,
               yradius=50,
               annular=False,
               fillColor=Color(.498039, 1, .831373, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -482.1429,
               -469.2857,
               yradius=50,
               annular=False,
               fillColor=Color(.372549, .619608, .627451, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Wedge(200,
               100,
               50,
               -495,
               -482.1429,
               yradius=50,
               annular=False,
               fillColor=Color(1, 1, 0, 1),
               fillOpacity=None,
               strokeColor=Color(0, 0, 0, 1),
               strokeWidth=1,
               strokeLineCap=0,
               strokeLineJoin=1,
               strokeMiterLimit=0,
               strokeDashArray=None,
               strokeOpacity=None))
     self.add(
         Line(160.9084,
              68.82551,
              150.4542,
              65.59061,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(150.4542,
              65.59061,
              140,
              65.59061,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(154.9516,
              78.30581,
              147.4758,
              76.96698,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(147.4758,
              76.96698,
              140,
              76.96698,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(151.2536,
              88.87395,
              145.6268,
              89.64874,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(145.6268,
              89.64874,
              140,
              89.64874,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(150,
              100,
              145,
              103,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(145,
              103,
              140,
              103,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(151.2536,
              111.126,
              145.6268,
              116.3513,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(145.6268,
              116.3513,
              140,
              116.3513,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(154.9516,
              121.6942,
              147.4758,
              129.033,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(147.4758,
              129.033,
              140,
              129.033,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(160.9084,
              131.1745,
              150.4542,
              140.4094,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(150.4542,
              140.4094,
              140,
              140.4094,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(168.8255,
              139.0916,
              154.4128,
              149.9099,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(154.4128,
              149.9099,
              140,
              149.9099,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(178.3058,
              145.0484,
              159.1529,
              181.0581,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(159.1529,
              181.0581,
              140,
              181.0581,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(188.874,
              148.7464,
              164.437,
              173.4957,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(164.437,
              173.4957,
              140,
              173.4957,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(200,
              150,
              170,
              163,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(170,
              163,
              140,
              163,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(211.126,
              148.7464,
              235.563,
              167.4957,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(235.563,
              167.4957,
              260,
              167.4957,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(221.6942,
              145.0484,
              240.8471,
              157.0581,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(240.8471,
              157.0581,
              260,
              157.0581,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(231.1745,
              139.0916,
              245.5872,
              149.9099,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(245.5872,
              149.9099,
              260,
              149.9099,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(239.0916,
              131.1745,
              249.5458,
              140.4094,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(249.5458,
              140.4094,
              260,
              140.4094,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(245.0484,
              121.6942,
              252.5242,
              129.033,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(252.5242,
              129.033,
              260,
              129.033,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(248.7464,
              111.126,
              254.3732,
              116.3513,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(254.3732,
              116.3513,
              260,
              116.3513,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(250,
              100,
              255,
              103,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(255,
              103,
              260,
              103,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(248.7464,
              88.87395,
              254.3732,
              89.64874,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(254.3732,
              89.64874,
              260,
              89.64874,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(245.0484,
              78.30581,
              252.5242,
              76.96698,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(252.5242,
              76.96698,
              260,
              76.96698,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(239.0916,
              68.82551,
              249.5458,
              65.59061,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(249.5458,
              65.59061,
              260,
              65.59061,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(231.1745,
              60.90843,
              245.5872,
              56.09011,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(245.5872,
              56.09011,
              260,
              56.09011,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(221.6942,
              54.95156,
              240.8471,
              24.94187,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(240.8471,
              24.94187,
              260,
              24.94187,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(211.126,
              51.2536,
              235.563,
              32.50433,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(235.563,
              32.50433,
              260,
              32.50433,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(200,
              50,
              230,
              43,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(230,
              43,
              260,
              43,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(188.874,
              51.2536,
              164.437,
              38.50433,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(164.437,
              38.50433,
              140,
              38.50433,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(178.3058,
              54.95156,
              159.1529,
              48.94187,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(159.1529,
              48.94187,
              140,
              48.94187,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(168.8255,
              60.90843,
              154.4128,
              56.09011,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(154.4128,
              56.09011,
              140,
              56.09011,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=.5,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 140, 66.59061)
     v0.add(
         String(-38.88,
                -4,
                'example1',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 140, 77.96698)
     v0.add(
         String(-38.88,
                -4,
                'example2',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 140, 90.64874)
     v0.add(
         String(-38.88,
                -4,
                'example3',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 140, 104)
     v0.add(
         String(-38.88,
                -4,
                'example4',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 140, 117.3513)
     v0.add(
         String(-38.88,
                -4,
                'example5',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 140, 130.033)
     v0.add(
         String(-38.88,
                -4,
                'example6',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 140, 141.4094)
     v0.add(
         String(-38.88,
                -4,
                'example7',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 140, 150.9099)
     v0.add(
         String(-38.88,
                -4,
                'example8',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 140, 182.0581)
     v0.add(
         String(-38.88,
                -4,
                'example9',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 140, 174.4957)
     v0.add(
         String(-43.88,
                -4,
                'example10',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 140, 164)
     v0.add(
         String(-43.88,
                -4,
                'example11',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 168.4957)
     v0.add(
         String(0,
                -4,
                'example12',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 158.0581)
     v0.add(
         String(0,
                -4,
                'example13',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 150.9099)
     v0.add(
         String(0,
                -4,
                'example14',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 141.4094)
     v0.add(
         String(0,
                -4,
                'example15',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 130.033)
     v0.add(
         String(0,
                -4,
                'example16',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 117.3513)
     v0.add(
         String(0,
                -4,
                'example17',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 104)
     v0.add(
         String(0,
                -4,
                'example18',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 90.64874)
     v0.add(
         String(0,
                -4,
                'example19',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 77.96698)
     v0.add(
         String(0,
                -4,
                'example20',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 66.59061)
     v0.add(
         String(0,
                -4,
                'example21',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 57.09011)
     v0.add(
         String(0,
                -4,
                'example22',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 25.94187)
     v0.add(
         String(0,
                -4,
                'example23',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 33.50433)
     v0.add(
         String(0,
                -4,
                'example24',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 44)
     v0.add(
         String(0,
                -4,
                'example25',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 140, 39.50433)
     v0.add(
         String(-43.88,
                -4,
                'example26',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 140, 49.94187)
     v0.add(
         String(-43.88,
                -4,
                'example27',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 140, 57.09011)
     v0.add(
         String(-43.88,
                -4,
                'example28',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
Beispiel #19
0
    def makeLines(self):
        labelFmt = self.lineLabelFormat
        P = list(range(len(self._positions)))
        if self.reversePlotOrder: P.reverse()
        inFill = self.inFill
        assert not inFill, "inFill not supported for 3d yet"
        #if inFill:
            #inFillY = self.categoryAxis._y
            #inFillX0 = self.valueAxis._x
            #inFillX1 = inFillX0 + self.categoryAxis._length
            #inFillG = getattr(self,'_inFillG',g)
        zDepth = self.zDepth
        _zadjust = self._zadjust
        theta_x = self.theta_x
        theta_y = self.theta_y
        F = _FakeGroup()
        from reportlab.graphics.charts.utils3d import _make_3d_line_info
        tileWidth = getattr(self,'_3d_tilewidth',None)
        if not tileWidth and self.categoryAxis.style!='parallel_3d': tileWidth = 1

        # Iterate over data rows.
        for rowNo in P:
            row = self._positions[rowNo]
            n = len(row)
            styleCount = len(self.lines)
            styleIdx = rowNo % styleCount
            rowStyle = self.lines[styleIdx]
            rowColor = rowStyle.strokeColor
            dash = getattr(rowStyle, 'strokeDashArray', None)
            z0 = self._calc_z0(rowNo)
            z1 = z0 + zDepth

            if hasattr(self.lines[styleIdx], 'strokeWidth'):
                strokeWidth = self.lines[styleIdx].strokeWidth
            elif hasattr(self.lines, 'strokeWidth'):
                strokeWidth = self.lines.strokeWidth
            else:
                strokeWidth = None

            # Iterate over data columns.
            if self.joinedLines:
                if n:
                    x0, y0 = row[0]
                    for colNo in range(1,n):
                        x1, y1 = row[colNo]
                        _make_3d_line_info( F, x0, x1, y0, y1, z0, z1,
                                theta_x, theta_y,
                                rowColor, fillColorShaded=None, tileWidth=tileWidth,
                                strokeColor=None, strokeWidth=None, strokeDashArray=None,
                                shading=0.1)
                        x0, y0 = x1, y1

            if hasattr(self.lines[styleIdx], 'symbol'):
                uSymbol = self.lines[styleIdx].symbol
            elif hasattr(self.lines, 'symbol'):
                uSymbol = self.lines.symbol
            else:
                uSymbol = None

            if uSymbol:
                for colNo in range(n):
                    x1, y1 = row[colNo]
                    x1, y1 = _zadjust(x1,y1,z0)
                    symbol = uSymbol2Symbol(uSymbol,x1,y1,rowColor)
                    if symbol: F.add((2,z0,z0,x1,y1,symbol))

            # Draw item labels.
            for colNo in range(n):
                x1, y1 = row[colNo]
                x1, y1 = _zadjust(x1,y1,z0)
                L = self._innerDrawLabel(rowNo, colNo, x1, y1)
                if L: F.add((2,z0,z0,x1,y1,L))

        F.sort()
        g = Group()
        for v in F.value(): g.add(v[-1])
        return g
Beispiel #20
0
    def convertPath(self, node):
        d = node.getAttribute('d')
        if not d:
            return None
        normPath = normalise_svg_path(d)
        path = Path()
        points = path.points
        # Track subpaths needing to be closed later
        unclosed_subpath_pointers = []
        subpath_start = []
        lastop = ''

        for i in range(0, len(normPath), 2):
            op, nums = normPath[i:i+2]

            if op in ('m', 'M') and i > 0 and path.operators[-1] != _CLOSEPATH:
                unclosed_subpath_pointers.append(len(path.operators))

            # moveto absolute
            if op == 'M':
                path.moveTo(*nums)
                subpath_start = points[-2:]
            # lineto absolute
            elif op == 'L':
                path.lineTo(*nums)

            # moveto relative
            elif op == 'm':
                if len(points) >= 2:
                    if lastop in ('Z', 'z'):
                        starting_point = subpath_start
                    else:
                        starting_point = points[-2:]
                    xn, yn = starting_point[0] + nums[0], starting_point[1] + nums[1]
                    path.moveTo(xn, yn)
                else:
                    path.moveTo(*nums)
                subpath_start = points[-2:]
            # lineto relative
            elif op == 'l':
                xn, yn = points[-2] + nums[0], points[-1] + nums[1]
                path.lineTo(xn, yn)

            # horizontal/vertical line absolute
            elif op == 'H':
                path.lineTo(nums[0], points[-1])
            elif op == 'V':
                path.lineTo(points[-2], nums[0])

            # horizontal/vertical line relative
            elif op == 'h':
                path.lineTo(points[-2] + nums[0], points[-1])
            elif op == 'v':
                path.lineTo(points[-2], points[-1] + nums[0])

            # cubic bezier, absolute
            elif op == 'C':
                path.curveTo(*nums)
            elif op == 'S':
                x2, y2, xn, yn = nums
                if len(points) < 4 or lastop not in {'c', 'C', 's', 'S'}:
                    xp, yp, x0, y0 = points[-2:] * 2
                else:
                    xp, yp, x0, y0 = points[-4:]
                xi, yi = x0 + (x0 - xp), y0 + (y0 - yp)
                path.curveTo(xi, yi, x2, y2, xn, yn)

            # cubic bezier, relative
            elif op == 'c':
                xp, yp = points[-2:]
                x1, y1, x2, y2, xn, yn = nums
                path.curveTo(xp + x1, yp + y1, xp + x2, yp + y2, xp + xn, yp + yn)
            elif op == 's':
                x2, y2, xn, yn = nums
                if len(points) < 4 or lastop not in {'c', 'C', 's', 'S'}:
                    xp, yp, x0, y0 = points[-2:] * 2
                else:
                    xp, yp, x0, y0 = points[-4:]
                xi, yi = x0 + (x0 - xp), y0 + (y0 - yp)
                path.curveTo(xi, yi, x0 + x2, y0 + y2, x0 + xn, y0 + yn)

            # quadratic bezier, absolute
            elif op == 'Q':
                x0, y0 = points[-2:]
                x1, y1, xn, yn = nums
                (x0, y0), (x1, y1), (x2, y2), (xn, yn) = \
                    convert_quadratic_to_cubic_path((x0, y0), (x1, y1), (xn, yn))
                path.curveTo(x1, y1, x2, y2, xn, yn)
            elif op == 'T':
                if len(points) < 4:
                    xp, yp, x0, y0 = points[-2:] * 2
                else:
                    xp, yp, x0, y0 = points[-4:]
                xi, yi = x0 + (x0 - xp), y0 + (y0 - yp)
                xn, yn = nums
                (x0, y0), (x1, y1), (x2, y2), (xn, yn) = \
                    convert_quadratic_to_cubic_path((x0, y0), (xi, yi), (xn, yn))
                path.curveTo(x1, y1, x2, y2, xn, yn)

            # quadratic bezier, relative
            elif op == 'q':
                x0, y0 = points[-2:]
                x1, y1, xn, yn = nums
                x1, y1, xn, yn = x0 + x1, y0 + y1, x0 + xn, y0 + yn
                (x0, y0), (x1, y1), (x2, y2), (xn, yn) = \
                    convert_quadratic_to_cubic_path((x0, y0), (x1, y1), (xn, yn))
                path.curveTo(x1, y1, x2, y2, xn, yn)
            elif op == 't':
                if len(points) < 4:
                    xp, yp, x0, y0 = points[-2:] * 2
                else:
                    xp, yp, x0, y0 = points[-4:]
                x0, y0 = points[-2:]
                xn, yn = nums
                xn, yn = x0 + xn, y0 + yn
                xi, yi = x0 + (x0 - xp), y0 + (y0 - yp)
                (x0, y0), (x1, y1), (x2, y2), (xn, yn) = \
                    convert_quadratic_to_cubic_path((x0, y0), (xi, yi), (xn, yn))
                path.curveTo(x1, y1, x2, y2, xn, yn)

            # elliptical arc
            elif op in ('A', 'a'):
                rx, ry, phi, fA, fS, x2, y2 = nums
                x1, y1 = points[-2:]
                if op == 'a':
                    x2 += x1
                    y2 += y1
                if abs(rx) <= 1e-10 or abs(ry) <= 1e-10:
                    path.lineTo(x2, y2)
                else:
                    bp = bezier_arc_from_end_points(x1, y1, rx, ry, phi, fA, fS, x2, y2)
                    for _, _, x1, y1, x2, y2, xn, yn in bp:
                        path.curveTo(x1, y1, x2, y2, xn, yn)

            # close path
            elif op in ('Z', 'z'):
                path.closePath()

            else:
                logger.debug("Suspicious path operator: %s" % op)
            lastop = op

        gr = Group()
        self.applyStyleOnShape(path, node)

        if path.operators[-1] != _CLOSEPATH:
            unclosed_subpath_pointers.append(len(path.operators))

        if unclosed_subpath_pointers and path.fillColor is not None:
            # ReportLab doesn't fill unclosed paths, so we are creating a copy
            # of the path with all subpaths closed, but without stroke.
            # https://bitbucket.org/rptlab/reportlab/issues/99/
            closed_path = NoStrokePath(copy_from=path)
            for pointer in reversed(unclosed_subpath_pointers):
                closed_path.operators.insert(pointer, _CLOSEPATH)
            gr.add(closed_path)
            path.fillColor = None

        gr.add(path)
        return gr
Beispiel #21
0
    def makeSectors(self):
        # normalize slice data
        if type(self.data) in (ListType, TupleType) and type(
                self.data[0]) in (ListType, TupleType):
            #it's a nested list, more than one sequence
            normData = []
            n = []
            for l in self.data:
                t = self.normalizeData(l)
                normData.append(t)
                n.append(len(t))
            self._seriesCount = max(n)
        else:
            normData = self.normalizeData(self.data)
            n = len(normData)
            self._seriesCount = n

        #labels
        checkLabelOverlap = self.checkLabelOverlap
        L = []
        L_add = L.append

        if self.labels is None:
            labels = []
            if type(n) not in (ListType, TupleType):
                labels = [''] * n
            else:
                for m in n:
                    labels = list(labels) + [''] * m
        else:
            labels = self.labels
            #there's no point in raising errors for less than enough labels if
            #we silently create all for the extreme case of no labels.
            if type(n) not in (ListType, TupleType):
                i = n - len(labels)
                if i > 0:
                    labels = list(labels) + [''] * i
            else:
                tlab = 0
                for m in n:
                    tlab += m
                i = tlab - len(labels)
                if i > 0:
                    labels = list(labels) + [''] * i

        xradius = self.width / 2.0
        yradius = self.height / 2.0
        centerx = self.x + xradius
        centery = self.y + yradius

        if self.direction == "anticlockwise":
            whichWay = 1
        else:
            whichWay = -1

        g = Group()

        startAngle = self.startAngle  #% 360
        styleCount = len(self.slices)
        if type(self.data[0]) in (ListType, TupleType):
            #multi-series doughnut
            iradius = (self.height / 5.0) / len(self.data)
            for sn, series in enumerate(normData):
                for i, angle in enumerate(series):
                    endAngle = (startAngle + (angle * whichWay))  #% 360
                    if abs(startAngle - endAngle) < 1e-5:
                        startAngle = endAngle
                        continue
                    if startAngle < endAngle:
                        a1 = startAngle
                        a2 = endAngle
                    else:
                        a1 = endAngle
                        a2 = startAngle
                    startAngle = endAngle

                    #if we didn't use %stylecount here we'd end up with the later sectors
                    #all having the default style
                    sectorStyle = self.slices[i % styleCount]

                    # is it a popout?
                    cx, cy = centerx, centery
                    if sectorStyle.popout != 0:
                        # pop out the sector
                        averageAngle = (a1 + a2) / 2.0
                        aveAngleRadians = averageAngle * pi / 180.0
                        popdistance = sectorStyle.popout
                        cx = centerx + popdistance * cos(aveAngleRadians)
                        cy = centery + popdistance * sin(aveAngleRadians)

                    if type(n) in (ListType, TupleType):
                        theSector = Wedge(
                            cx,
                            cy,
                            xradius + (sn * iradius) - iradius,
                            a1,
                            a2,
                            yradius=yradius + (sn * iradius) - iradius,
                            radius1=yradius + (sn * iradius) - (2 * iradius))
                    else:
                        theSector = Wedge(cx,
                                          cy,
                                          xradius,
                                          a1,
                                          a2,
                                          yradius=yradius,
                                          radius1=iradius)

                    theSector.fillColor = sectorStyle.fillColor
                    theSector.strokeColor = sectorStyle.strokeColor
                    theSector.strokeWidth = sectorStyle.strokeWidth
                    theSector.strokeDashArray = sectorStyle.strokeDashArray

                    g.add(theSector)

                    if sn == 0:
                        text = self.getSeriesName(i, '')
                        if text:
                            averageAngle = (a1 + a2) / 2.0
                            aveAngleRadians = averageAngle * pi / 180.0
                            labelRadius = sectorStyle.labelRadius
                            rx = xradius * labelRadius
                            ry = yradius * labelRadius
                            labelX = centerx + (0.5 * self.width *
                                                cos(aveAngleRadians) *
                                                labelRadius)
                            labelY = centery + (0.5 * self.height *
                                                sin(aveAngleRadians) *
                                                labelRadius)
                            l = _addWedgeLabel(self, text, averageAngle,
                                               labelX, labelY, sectorStyle)
                            if checkLabelOverlap:
                                l._origdata = {
                                    'x': labelX,
                                    'y': labelY,
                                    'angle': averageAngle,
                                    'rx': rx,
                                    'ry': ry,
                                    'cx': cx,
                                    'cy': cy,
                                    'bounds': l.getBounds(),
                                }
                            L_add(l)

        else:
            #single series doughnut
            iradius = self.height / 5.0
            for i, angle in enumerate(normData):
                endAngle = (startAngle + (angle * whichWay))  #% 360
                if abs(startAngle - endAngle) < 1e-5:
                    startAngle = endAngle
                    continue
                if startAngle < endAngle:
                    a1 = startAngle
                    a2 = endAngle
                else:
                    a1 = endAngle
                    a2 = startAngle
                startAngle = endAngle

                #if we didn't use %stylecount here we'd end up with the later sectors
                #all having the default style
                sectorStyle = self.slices[i % styleCount]

                # is it a popout?
                cx, cy = centerx, centery
                if sectorStyle.popout != 0:
                    # pop out the sector
                    averageAngle = (a1 + a2) / 2.0
                    aveAngleRadians = averageAngle * pi / 180.0
                    popdistance = sectorStyle.popout
                    cx = centerx + popdistance * cos(aveAngleRadians)
                    cy = centery + popdistance * sin(aveAngleRadians)

                if n > 1:
                    theSector = Wedge(cx,
                                      cy,
                                      xradius,
                                      a1,
                                      a2,
                                      yradius=yradius,
                                      radius1=iradius)
                elif n == 1:
                    theSector = Wedge(cx,
                                      cy,
                                      xradius,
                                      a1,
                                      a2,
                                      yradius=yradius,
                                      iradius=iradius)

                theSector.fillColor = sectorStyle.fillColor
                theSector.strokeColor = sectorStyle.strokeColor
                theSector.strokeWidth = sectorStyle.strokeWidth
                theSector.strokeDashArray = sectorStyle.strokeDashArray

                g.add(theSector)

                # now draw a label
                if labels[i] != "":
                    averageAngle = (a1 + a2) / 2.0
                    aveAngleRadians = averageAngle * pi / 180.0
                    labelRadius = sectorStyle.labelRadius
                    labelX = centerx + (0.5 * self.width *
                                        cos(aveAngleRadians) * labelRadius)
                    labelY = centery + (0.5 * self.height *
                                        sin(aveAngleRadians) * labelRadius)
                    rx = xradius * labelRadius
                    ry = yradius * labelRadius
                    l = _addWedgeLabel(self, labels[i], averageAngle, labelX,
                                       labelY, sectorStyle)
                    if checkLabelOverlap:
                        l._origdata = {
                            'x': labelX,
                            'y': labelY,
                            'angle': averageAngle,
                            'rx': rx,
                            'ry': ry,
                            'cx': cx,
                            'cy': cy,
                            'bounds': l.getBounds(),
                        }
                    L_add(l)

        if checkLabelOverlap and L:
            fixLabelOverlaps(L)

        for l in L:
            g.add(l)

        return g
Beispiel #22
0
 def __init__(self, width=400, height=200, *args, **kw):
     Drawing.__init__(self, width, height, *args, **kw)
     self.transform = (1, 0, 0, 1, 0, 0)
     self.add(
         Rect(50,
              50,
              300,
              125,
              rx=0,
              ry=0,
              fillColor=None,
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(50,
              50,
              350,
              50,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(110,
              50,
              110,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(170,
              50,
              170,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(200,
              50,
              200,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(230,
              50,
              230,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(290,
              50,
              290,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(350,
              50,
              350,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 110, 45)
     v0.add(
         String(-6.25,
                -10,
                '1.0',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 170, 45)
     v0.add(
         String(-6.25,
                -10,
                '2.0',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 200, 45)
     v0.add(
         String(-6.25,
                -10,
                '2.5',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 230, 45)
     v0.add(
         String(-6.25,
                -10,
                '3.0',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 290, 45)
     v0.add(
         String(-6.25,
                -10,
                '4.0',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 350, 45)
     v0.add(
         String(-6.25,
                -10,
                '5.0',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     self.add(
         Line(50,
              50,
              50,
              175,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(50,
              67.85714,
              45,
              67.85714,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(50,
              85.71429,
              45,
              85.71429,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(50,
              103.5714,
              45,
              103.5714,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(50,
              139.2857,
              45,
              139.2857,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(50,
              157.1429,
              45,
              157.1429,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 45, 67.85714)
     v0.add(
         String(-5,
                -4,
                '1',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 45, 85.71429)
     v0.add(
         String(-5,
                -4,
                '2',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 45, 103.5714)
     v0.add(
         String(-5,
                -4,
                '3',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 45, 139.2857)
     v0.add(
         String(-5,
                -4,
                '5',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 45, 157.1429)
     v0.add(
         String(-5,
                -4,
                '6',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     self.add(
         PolyLine(points=[
             110, 67.85714, 170, 85.71429, 200, 67.85714, 230, 103.5714,
             290, 139.2857
         ],
                  strokeColor=Color(1, 0, 0, 1),
                  strokeWidth=1,
                  strokeLineCap=0,
                  strokeLineJoin=1,
                  strokeMiterLimit=0,
                  strokeDashArray=None,
                  strokeOpacity=None))
     self.add(
         PolyLine(points=[
             110, 85.71429, 170, 103.5714, 200, 85.71429, 260, 139.2857,
             290, 157.1429
         ],
                  strokeColor=Color(0, 0, 1, 1),
                  strokeWidth=1,
                  strokeLineCap=0,
                  strokeLineJoin=1,
                  strokeMiterLimit=0,
                  strokeDashArray=None,
                  strokeOpacity=None))
     self.add(
         Circle(110,
                67.85714,
                2.5,
                fillColor=Color(1, 0, 0, 1),
                fillOpacity=None,
                strokeColor=Color(0, 0, 0, 1),
                strokeWidth=.1,
                strokeLineCap=0,
                strokeLineJoin=0,
                strokeMiterLimit=0,
                strokeDashArray=None,
                strokeOpacity=None))
     self.add(
         Circle(170,
                85.71429,
                2.5,
                fillColor=Color(1, 0, 0, 1),
                fillOpacity=None,
                strokeColor=Color(0, 0, 0, 1),
                strokeWidth=.1,
                strokeLineCap=0,
                strokeLineJoin=0,
                strokeMiterLimit=0,
                strokeDashArray=None,
                strokeOpacity=None))
     self.add(
         Circle(200,
                67.85714,
                2.5,
                fillColor=Color(1, 0, 0, 1),
                fillOpacity=None,
                strokeColor=Color(0, 0, 0, 1),
                strokeWidth=.1,
                strokeLineCap=0,
                strokeLineJoin=0,
                strokeMiterLimit=0,
                strokeDashArray=None,
                strokeOpacity=None))
     self.add(
         Circle(230,
                103.5714,
                2.5,
                fillColor=Color(1, 0, 0, 1),
                fillOpacity=None,
                strokeColor=Color(0, 0, 0, 1),
                strokeWidth=.1,
                strokeLineCap=0,
                strokeLineJoin=0,
                strokeMiterLimit=0,
                strokeDashArray=None,
                strokeOpacity=None))
     self.add(
         Circle(290,
                139.2857,
                2.5,
                fillColor=Color(1, 0, 0, 1),
                fillOpacity=None,
                strokeColor=Color(0, 0, 0, 1),
                strokeWidth=.1,
                strokeLineCap=0,
                strokeLineJoin=0,
                strokeMiterLimit=0,
                strokeDashArray=None,
                strokeOpacity=None))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 110, 77.85714)
     v0.add(
         String(-3.75,
                -4,
                ' 1',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 170, 95.71429)
     v0.add(
         String(-3.75,
                -4,
                ' 2',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 200, 77.85714)
     v0.add(
         String(-3.75,
                -4,
                ' 1',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 230, 113.5714)
     v0.add(
         String(-3.75,
                -4,
                ' 3',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 290, 149.2857)
     v0.add(
         String(-3.75,
                -4,
                ' 5',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     self.add(
         Circle(110,
                85.71429,
                2.5,
                fillColor=Color(0, 0, 1, 1),
                fillOpacity=None,
                strokeColor=Color(0, 0, 0, 1),
                strokeWidth=.1,
                strokeLineCap=0,
                strokeLineJoin=0,
                strokeMiterLimit=0,
                strokeDashArray=None,
                strokeOpacity=None))
     self.add(
         Circle(170,
                103.5714,
                2.5,
                fillColor=Color(0, 0, 1, 1),
                fillOpacity=None,
                strokeColor=Color(0, 0, 0, 1),
                strokeWidth=.1,
                strokeLineCap=0,
                strokeLineJoin=0,
                strokeMiterLimit=0,
                strokeDashArray=None,
                strokeOpacity=None))
     self.add(
         Circle(200,
                85.71429,
                2.5,
                fillColor=Color(0, 0, 1, 1),
                fillOpacity=None,
                strokeColor=Color(0, 0, 0, 1),
                strokeWidth=.1,
                strokeLineCap=0,
                strokeLineJoin=0,
                strokeMiterLimit=0,
                strokeDashArray=None,
                strokeOpacity=None))
     self.add(
         Circle(260,
                139.2857,
                2.5,
                fillColor=Color(0, 0, 1, 1),
                fillOpacity=None,
                strokeColor=Color(0, 0, 0, 1),
                strokeWidth=.1,
                strokeLineCap=0,
                strokeLineJoin=0,
                strokeMiterLimit=0,
                strokeDashArray=None,
                strokeOpacity=None))
     self.add(
         Circle(290,
                157.1429,
                2.5,
                fillColor=Color(0, 0, 1, 1),
                fillOpacity=None,
                strokeColor=Color(0, 0, 0, 1),
                strokeWidth=.1,
                strokeLineCap=0,
                strokeLineJoin=0,
                strokeMiterLimit=0,
                strokeDashArray=None,
                strokeOpacity=None))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 110, 95.71429)
     v0.add(
         String(-3.75,
                -4,
                ' 2',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 170, 113.5714)
     v0.add(
         String(-3.75,
                -4,
                ' 3',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 200, 95.71429)
     v0.add(
         String(-3.75,
                -4,
                ' 2',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 260, 149.2857)
     v0.add(
         String(-3.75,
                -4,
                ' 5',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 290, 167.1429)
     v0.add(
         String(-3.75,
                -4,
                ' 6',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
Beispiel #23
0
    def draw(self):
        g = Group()
        gAdd = g.add
        barWidth = self.barWidth
        width = self.width
        barHeight = self.barHeight
        x = self.x
        y = self.y
        gAdd(
            Rect(x,
                 y,
                 width,
                 barHeight,
                 fillColor=None,
                 strokeColor=None,
                 strokeWidth=0))
        s = self.value + self._checkdigit(self.value)
        self._lquiet = lquiet = self._calc_quiet(self.lquiet)
        rquiet = self._calc_quiet(self.rquiet)
        b = [lquiet * '0', self._tail]  #the signal string
        a = b.append
        self._encode_left(s, a)
        a(self._sep)

        z = ord('0')
        _right = self._right
        for c in s[self._start_right:]:
            a(_right[ord(c) - z])
        a(self._tail)
        a(rquiet * '0')

        fontSize = self.fontSize
        barFillColor = self.barFillColor
        barStrokeWidth = self.barStrokeWidth
        barStrokeColor = self.barStrokeColor

        fth = fontSize * 1.2
        b = ''.join(b)

        lrect = None
        for i, c in enumerate(b):
            if c == "1":
                dh = self._short_bar(i) and fth or 0
                yh = y + dh
                if lrect and lrect.y == yh:
                    lrect.width += barWidth
                else:
                    lrect = Rect(x,
                                 yh,
                                 barWidth,
                                 barHeight - dh,
                                 fillColor=barFillColor,
                                 strokeWidth=barStrokeWidth,
                                 strokeColor=barStrokeColor)
                    gAdd(lrect)
            else:
                lrect = None
            x += barWidth

        if self.humanReadable: self._add_human_readable(s, gAdd)
        return g
Beispiel #24
0
 def __init__(self, width=400, height=200, *args, **kw):
     Drawing.__init__(self, width, height, *args, **kw)
     self.transform = (1, 0, 0, 1, 0, 0)
     self.add(
         Rect(230,
              54,
              24,
              8,
              rx=0,
              ry=0,
              fillColor=Color(1, 0, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(230,
              78,
              -57,
              8,
              rx=0,
              ry=0,
              fillColor=Color(1, 0, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(230,
              102,
              20,
              8,
              rx=0,
              ry=0,
              fillColor=Color(1, 0, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(230,
              126,
              50,
              8,
              rx=0,
              ry=0,
              fillColor=Color(1, 0, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(230,
              150,
              92,
              8,
              rx=0,
              ry=0,
              fillColor=Color(1, 0, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(230,
              62,
              6,
              8,
              rx=0,
              ry=0,
              fillColor=Color(0, .501961, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(230,
              86,
              -49,
              8,
              rx=0,
              ry=0,
              fillColor=Color(0, .501961, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(230,
              110,
              -30,
              8,
              rx=0,
              ry=0,
              fillColor=Color(0, .501961, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(230,
              134,
              40,
              8,
              rx=0,
              ry=0,
              fillColor=Color(0, .501961, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(230,
              158,
              68,
              8,
              rx=0,
              ry=0,
              fillColor=Color(0, .501961, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(79,
              50,
              79,
              170,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(79,
              50,
              74,
              50,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(79,
              74,
              74,
              74,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(79,
              98,
              74,
              98,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(79,
              122,
              74,
              122,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(79,
              146,
              74,
              146,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(79,
              170,
              74,
              170,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, -71, 62)
     v0.add(
         String(-30.688,
                -3.2,
                'Q3 2000',
                textAnchor='start',
                fontName='Helvetica',
                fontSize=8,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, -71, 86)
     v0.add(
         String(-44.912,
                -3.2,
                'Year to Date',
                textAnchor='start',
                fontName='Helvetica',
                fontSize=8,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, -71, 110)
     v0.add(
         String(-37.352,
                -3.2,
                '12 months',
                textAnchor='start',
                fontName='Helvetica',
                fontSize=8,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, -71, 134)
     v0.add(
         String(-39.576,
                1.6,
                'Annualised',
                textAnchor='start',
                fontName='Helvetica',
                fontSize=8,
                fillColor=Color(0, 0, 0, 1)))
     v0.add(
         String(-39.576,
                -8,
                '3 years',
                textAnchor='start',
                fontName='Helvetica',
                fontSize=8,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, -71, 158)
     v0.add(
         String(-53.368,
                -3.2,
                'Since 07.10.99',
                textAnchor='start',
                fontName='Helvetica',
                fontSize=8,
                fillColor=Color(0, 0, 0, 1)))
     self.add(
         Line(80,
              50,
              380,
              50,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(80,
              50,
              80,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(130,
              50,
              130,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(180,
              50,
              180,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(230,
              50,
              230,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(280,
              50,
              280,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(330,
              50,
              330,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(380,
              50,
              380,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 80, 45)
     v0.add(
         String(0,
                -8,
                '-15',
                textAnchor='middle',
                fontName='Helvetica',
                fontSize=8,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 130, 45)
     v0.add(
         String(0,
                -8,
                '-10',
                textAnchor='middle',
                fontName='Helvetica',
                fontSize=8,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 180, 45)
     v0.add(
         String(0,
                -8,
                '-5',
                textAnchor='middle',
                fontName='Helvetica',
                fontSize=8,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 230, 45)
     v0.add(
         String(0,
                -8,
                '0',
                textAnchor='middle',
                fontName='Helvetica',
                fontSize=8,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 280, 45)
     v0.add(
         String(0,
                -8,
                '5',
                textAnchor='middle',
                fontName='Helvetica',
                fontSize=8,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 330, 45)
     v0.add(
         String(0,
                -8,
                '10',
                textAnchor='middle',
                fontName='Helvetica',
                fontSize=8,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 380, 45)
     v0.add(
         String(0,
                -8,
                '15',
                textAnchor='middle',
                fontName='Helvetica',
                fontSize=8,
                fillColor=Color(0, 0, 0, 1)))
 def __init__(self, width=400, height=200, *args, **kw):
     Drawing.__init__(self, width, height, *args, **kw)
     self.transform = (1, 0, 0, 1, 0, 0)
     self.add(
         Rect(50,
              50,
              300,
              125,
              rx=0,
              ry=0,
              fillColor=None,
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(50,
              52.97619,
              50,
              11.90476,
              rx=0,
              ry=0,
              fillColor=Color(1, 0, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(50,
              115.4762,
              300,
              11.90476,
              rx=0,
              ry=0,
              fillColor=Color(1, 0, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(50,
              67.85714,
              100,
              11.90476,
              rx=0,
              ry=0,
              fillColor=Color(0, .501961, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(50,
              130.3571,
              250,
              11.90476,
              rx=0,
              ry=0,
              fillColor=Color(0, .501961, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(50,
              82.7381,
              150,
              11.90476,
              rx=0,
              ry=0,
              fillColor=Color(0, 0, 1, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(50,
              145.2381,
              200,
              11.90476,
              rx=0,
              ry=0,
              fillColor=Color(0, 0, 1, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(50,
              97.61905,
              200,
              11.90476,
              rx=0,
              ry=0,
              fillColor=Color(1, 0, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Rect(50,
              160.119,
              150,
              11.90476,
              rx=0,
              ry=0,
              fillColor=Color(1, 0, 0, 1),
              fillOpacity=None,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(49,
              50,
              49,
              175,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(49,
              50,
              44,
              50,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(49,
              112.5,
              44,
              112.5,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(49,
              175,
              44,
              175,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 44, 81.25)
     v0.add(
         String(-20,
                -4,
                'Ying',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 44, 143.75)
     v0.add(
         String(-21.66,
                -4,
                'Yang',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     self.add(
         Line(50,
              50,
              350,
              50,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=0,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(50,
              50,
              50,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(125,
              50,
              125,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(200,
              50,
              200,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(275,
              50,
              275,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     self.add(
         Line(350,
              50,
              350,
              45,
              strokeColor=Color(0, 0, 0, 1),
              strokeWidth=1,
              strokeLineCap=0,
              strokeLineJoin=0,
              strokeMiterLimit=10,
              strokeDashArray=None,
              strokeOpacity=None))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 50, 45)
     v0.add(
         String(-2.5,
                -10,
                '0',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 125, 45)
     v0.add(
         String(-5,
                -10,
                '15',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 200, 45)
     v0.add(
         String(-5,
                -10,
                '30',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 275, 45)
     v0.add(
         String(-5,
                -10,
                '45',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 350, 45)
     v0.add(
         String(-5,
                -10,
                '60',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
 def __init__(self, width=400, height=200, *args, **kw):
     Drawing.__init__(self, width, height, *args, **kw)
     self.transform = (1, 0, 0, 1, 0, 0)
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 50, 45)
     v0.add(
         String(-5,
                -10,
                '10',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 143.75, 45)
     v0.add(
         String(-5,
                -10,
                '20',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 237.5, 45)
     v0.add(
         String(-5,
                -10,
                '30',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 331.25, 45)
     v0.add(
         String(-5,
                -10,
                '40',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 45, 50)
     v0.add(
         String(-10,
                -4,
                '10',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 45, 89.0625)
     v0.add(
         String(-10,
                -4,
                '20',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 45, 128.125)
     v0.add(
         String(-10,
                -4,
                '30',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
     v0 = self._nn(Group())
     v0.transform = (1, 0, 0, 1, 45, 167.1875)
     v0.add(
         String(-10,
                -4,
                '40',
                textAnchor='start',
                fontName='Times-Roman',
                fontSize=10,
                fillColor=Color(0, 0, 0, 1)))
Beispiel #27
0
    def makeWedges(self):
        angles = self.makeAngles()
        n = len(angles)
        labels = _fixLabels(self.labels,n)

        self._seriesCount = n
        styleCount = len(self.slices)

        plMode = self.pointerLabelMode
        if plMode:
            checkLabelOverlap = False
            PL=self.makePointerLabels(angles,plMode)
            xradius = PL.xradius
            yradius = PL.yradius
            centerx = PL.centerx
            centery = PL.centery
            PL_data = PL.data
            gSN = lambda i: ''
        else:
            xradius = self.width*0.5
            yradius = self.height*0.5
            centerx = self.x + xradius
            centery = self.y + yradius
            if self.xradius: xradius = self.xradius
            if self.yradius: yradius = self.yradius
            if self.sameRadii: xradius=yradius=min(xradius,yradius)
            checkLabelOverlap = self.checkLabelOverlap
            gSN = lambda i: self.getSeriesName(i,'')

        g = Group()
        g_add = g.add
        if checkLabelOverlap:
            L = []
            L_add = L.append
        else:
            L_add = g_add

        for i,(a1,a2) in angles:
            if a2 is None: continue
            #if we didn't use %stylecount here we'd end up with the later wedges
            #all having the default style
            wedgeStyle = self.slices[i%styleCount]
            if not wedgeStyle.visible: continue

            # is it a popout?
            cx, cy = centerx, centery
            text = gSN(i)
            popout = wedgeStyle.popout
            if text or popout:
                averageAngle = (a1+a2)/2.0
                aveAngleRadians = averageAngle/_180_pi
                cosAA = cos(aveAngleRadians)
                sinAA = sin(aveAngleRadians)
                if popout:
                    # pop out the wedge
                    cx = centerx + popout*cosAA
                    cy = centery + popout*sinAA

            if n > 1:
                theWedge = Wedge(cx, cy, xradius, a1, a2, yradius=yradius)
            elif n==1:
                theWedge = Ellipse(cx, cy, xradius, yradius)

            theWedge.fillColor = wedgeStyle.fillColor
            theWedge.strokeColor = wedgeStyle.strokeColor
            theWedge.strokeWidth = wedgeStyle.strokeWidth
            theWedge.strokeDashArray = wedgeStyle.strokeDashArray

            g_add(theWedge)
            if wedgeStyle.label_visible:
                if text:
                    labelRadius = wedgeStyle.labelRadius
                    rx = xradius*labelRadius
                    ry = yradius*labelRadius
                    labelX = cx + rx*cosAA
                    labelY = cy + ry*sinAA
                    _addWedgeLabel(self,text,L_add,averageAngle,labelX,labelY,wedgeStyle)
                    if checkLabelOverlap:
                        l = L[-1]
                        l._origdata = { 'x': labelX, 'y':labelY, 'angle': averageAngle,
                                        'rx': rx, 'ry':ry, 'cx':cx, 'cy':cy,
                                        'bounds': l.getBounds(),
                                        }
                elif plMode and PL_data:
                    l = PL_data[i]
                    if l:
                        data = l._origdata
                        sinM = data['smid']
                        cosM = data['cmid']
                        lX = cx + xradius*cosM
                        lY = cy + yradius*sinM
                        lpel = wedgeStyle.label_pointer_elbowLength
                        lXi = lX + lpel*cosM
                        lYi = lY + lpel*sinM
                        L_add(PolyLine((lX,lY,lXi,lYi,l.x,l.y),
                                strokeWidth=wedgeStyle.label_pointer_strokeWidth,
                                strokeColor=wedgeStyle.label_pointer_strokeColor))
                        L_add(l)

        if checkLabelOverlap and L:
            fixLabelOverlaps(L)
            map(g_add,L)

        return g
Beispiel #28
0
 def makeBackground(self):
     if self.background is not None:
         BG = self.background
         if isinstance(BG, Group):
             g = BG
             for bg in g.contents:
                 bg.x = self.x
                 bg.y = self.y
                 bg.width = self.width
                 bg.height = self.height
         else:
             g = Group()
             if type(BG) not in (type(()), type([])): BG = (BG, )
             for bg in BG:
                 bg.x = self.x
                 bg.y = self.y
                 bg.width = self.width
                 bg.height = self.height
                 g.add(bg)
         return g
     else:
         strokeColor, strokeWidth, fillColor = self.strokeColor, self.strokeWidth, self.fillColor
         if (strokeWidth and strokeColor) or fillColor:
             g = Group()
             _3d_dy = getattr(self, '_3d_dy', None)
             x = self.x
             y = self.y
             h = self.height
             w = self.width
             if _3d_dy is not None:
                 _3d_dx = self._3d_dx
                 if fillColor and not strokeColor:
                     from reportlab.lib.colors import Blacker
                     c = Blacker(fillColor, getattr(self, '_3d_blacken',
                                                    0.7))
                 else:
                     c = strokeColor
                 if not strokeWidth: strokeWidth = 0.5
                 if fillColor or strokeColor or c:
                     bg = Polygon([
                         x, y, x, y + h, x + _3d_dx, y + h + _3d_dy,
                         x + w + _3d_dx, y + h + _3d_dy, x + w + _3d_dx,
                         y + _3d_dy, x + w, y
                     ],
                                  strokeColor=strokeColor or c or grey,
                                  strokeWidth=strokeWidth,
                                  fillColor=fillColor)
                     g.add(bg)
                     g.add(
                         Line(x,
                              y,
                              x + _3d_dx,
                              y + _3d_dy,
                              strokeWidth=0.5,
                              strokeColor=c))
                     g.add(
                         Line(x + _3d_dx,
                              y + _3d_dy,
                              x + _3d_dx,
                              y + h + _3d_dy,
                              strokeWidth=0.5,
                              strokeColor=c))
                     fc = Blacker(c, getattr(self, '_3d_blacken', 0.8))
                     g.add(
                         Polygon([
                             x, y, x + _3d_dx, y + _3d_dy, x + w + _3d_dx,
                             y + _3d_dy, x + w, y
                         ],
                                 strokeColor=strokeColor or c or grey,
                                 strokeWidth=strokeWidth,
                                 fillColor=fc))
                     bg = Line(x + _3d_dx,
                               y + _3d_dy,
                               x + w + _3d_dx,
                               y + _3d_dy,
                               strokeWidth=0.5,
                               strokeColor=c)
                 else:
                     bg = None
             else:
                 bg = Rect(x,
                           y,
                           w,
                           h,
                           strokeColor=strokeColor,
                           strokeWidth=strokeWidth,
                           fillColor=fillColor)
             if bg: g.add(bg)
             return g
         else:
             return None
Beispiel #29
0
    from reportlab.lib import colors

    path = sys.argv[1]
    glyphName = sys.argv[2]
    if (len(sys.argv) > 3):
        imageFile = sys.argv[3]
    else:
        imageFile = "%s.png" % glyphName

    font = TTFont(
        path
    )  # it would work just as well with fontemon_blender_addon.fontTools.t1Lib.T1Font
    gs = font.getGlyphSet()
    pen = ReportLabPen(gs, Path(fillColor=colors.red, strokeWidth=5))
    g = gs[glyphName]
    g.draw(pen)

    w, h = g.width, 1000
    from reportlab.graphics import renderPM
    from reportlab.graphics.shapes import Group, Drawing, scale

    # Everything is wrapped in a group to allow transformations.
    g = Group(pen.path)
    g.translate(0, 200)
    g.scale(0.3, 0.3)

    d = Drawing(w, h)
    d.add(g)

    renderPM.drawToFile(d, imageFile, fmt="PNG")
Beispiel #30
0
    def draw(self):
        fillColor = self.fillColor
        strokeColor = self.strokeColor

        g = Group()
        g.add(
            Rect(x=0,
                 y=0,
                 fillColor=self.fillColor,
                 strokeColor=self.fillColor,
                 width=self.borderWidth,
                 height=self.height))
        g.add(
            Rect(x=0,
                 y=self.height - self.borderWidth,
                 fillColor=self.fillColor,
                 strokeColor=self.fillColor,
                 width=self.width,
                 height=self.borderWidth))

        g2 = Group()
        rl = RL_CorpLogo()
        rl.height = 1.25 * cm
        rl.width = 1.9 * cm
        rl.draw()
        g2.add(rl)
        g.add(g2)
        g2.shift(x=(self.width - (rl.width + (self.width / 42))),
                 y=(self.height - (rl.height + (self.height / 42))))

        g.add(
            String(x=self.borderWidth / 5.0,
                   y=((self.height - (rl.height + (self.height / 42))) +
                      ((38 / 90.5) * rl.height)),
                   fontSize=6,
                   fillColor=self.altStrokeColor,
                   fontName="Helvetica-BoldOblique",
                   textAnchor='start',
                   text=self._strapline))

        leftText = ["Tel:", "Mobile:", "Fax:", "Email:", "Web:"]
        leftDetails = [
            self.telephone, self.mobile, self.fax, self.email, self.web
        ]
        leftText.reverse()
        leftDetails.reverse()
        for f in range(len(leftText), 0, -1):
            g.add(
                String(x=self.borderWidth + (self.borderWidth / 5.0),
                       y=(self.borderWidth / 5.0) + ((f - 1) * (5 * 1.2)),
                       fontSize=5,
                       fillColor=self.strokeColor,
                       fontName="Helvetica",
                       textAnchor='start',
                       text=leftText[f - 1]))
            g.add(
                String(x=self.borderWidth + (self.borderWidth / 5.0) +
                       self.borderWidth,
                       y=(self.borderWidth / 5.0) + ((f - 1) * (5 * 1.2)),
                       fontSize=5,
                       fillColor=self.strokeColor,
                       fontName="Helvetica",
                       textAnchor='start',
                       text=leftDetails[f - 1]))

        ty = (self.height - self.borderWidth - (self.borderWidth / 5.0) + 2)
        #       g.add(Line(self.borderWidth, ty, self.borderWidth+(self.borderWidth/5.0), ty))
        #       g.add(Line(self.borderWidth+(self.borderWidth/5.0), ty, self.borderWidth+(self.borderWidth/5.0),
        #                         ty+(self.borderWidth/5.0)))
        #       g.add(Line(self.borderWidth, ty-10,
        #                         self.borderWidth+(self.borderWidth/5.0), ty-10))

        rightText = self.rh_blurb_top
        for f in range(1, (len(rightText) + 1)):
            g.add(
                String(x=self.width - (self.borderWidth / 5.0),
                       y=ty - ((f) * (5 * 1.2)),
                       fontSize=5,
                       fillColor=self.strokeColor,
                       fontName="Helvetica",
                       textAnchor='end',
                       text=rightText[f - 1]))

        g.add(
            String(x=self.borderWidth + (self.borderWidth / 5.0),
                   y=ty - 10,
                   fontSize=10,
                   fillColor=self.strokeColor,
                   fontName="Helvetica",
                   textAnchor='start',
                   text=self.name))

        ty1 = ty - 10 * 1.2

        g.add(
            String(x=self.borderWidth + (self.borderWidth / 5.0),
                   y=ty1 - 8,
                   fontSize=8,
                   fillColor=self.strokeColor,
                   fontName="Helvetica",
                   textAnchor='start',
                   text=self.position))
        if self.border:
            g.add(
                Rect(x=0,
                     y=0,
                     fillColor=None,
                     strokeColor=black,
                     width=self.width,
                     height=self.height))
        g.shift(self.x, self.y)
        return g