Exemplo n.º 1
0
 def createXAxis(self):
     ax = Group()
     x = self.canvas.x - self.canvas.height
     y = self.canvas.y + self.canvas.height
     ax.appendTransform(Rotate(-90, self.canvas.x, y))
     if self.settings.horizontal:
         UnifiedGraph.createXAxis(self)
     else:
         textProperties = {
             'textHeight': self.settings.xAxisTextHeight,
             'verticalAnchor': 'middle',
             'horizontalAnchor': 'right',
         }
         xaxis = YAxis(id='x-axis',
                       inf=self.canvas.y + self.canvas.height,
                       sup=self.canvas.y + self.canvas.height -
                       self.canvas.width,
                       x=self.canvas.x - self.canvas.height -
                       self.settings.xAxisSpace,
                       lower=self.xbounds[0],
                       upper=self.xbounds[1],
                       textProperties=textProperties)
         ticks = []
         labels = []
         for child in self.canvas.data:
             if child.xml.has_key('name'):
                 ticks.append(child.x + child.width / 2.0)
                 labels.append(child.xml['data'])
         xaxis.createTicks(ticks)
         xaxis.setText(map(str, labels))
         xaxis.drawTicks()
         ax.draw(xaxis)
         self.dataGroup.drawAt(ax, 0)
Exemplo n.º 2
0
 def createY2Axis(self):
     ybounds = self.setY2Bounds()
     textProperties = {
         'textHeight': 8,
         'horizontalAnchor': 'left',
         'verticalAnchor': 'middle',
     }
     yaxis = YAxis(inf=self.canvas.y,
                   sup=self.canvas.y + self.canvas.height,
                   x=0,
                   lower=ybounds[0],
                   upper=ybounds[1],
                   textProperties=textProperties)
     yaxis.createTicks()
     yaxis.drawTicks()
     self.canvas.changeSize(-yaxis.width - 5, 0)
     yaxis.move(self.canvas.x + self.canvas.width + 1, 0)
     self.dataGroup.drawAt(yaxis, 0)
Exemplo n.º 3
0
 def createYAxis (self):
     textProperties = {'textHeight': self.settings.yAxisTextHeight,
                       'horizontalAnchor': 'right',
                       'verticalAnchor': 'middle',
                       }
     yaxis = YAxis (inf = self.canvas.y,
                    sup = self.canvas.y + self.canvas.height,
                    x = 0,
                    lower = self.ybounds[0],
                    upper = self.ybounds[1],
                    textProperties = textProperties)
     yaxis.createTicks (self.ypositions)
     yaxis.setText (self.ylabels)
     yaxis.drawTicks ()
     yaxis.move (self.canvas.x + yaxis.width, 0)
     self.canvas.changeSize (-yaxis.width - self.settings.yAxisSpace, 0)
     self.canvas.move (yaxis.width + self.settings.yAxisSpace, 0)
     self.dataGroup.drawAt (yaxis, 0)