(self)
| 108 | self.remove_child(poly.textYVal) |
| 109 | |
| 110 | def render(self): |
| 111 | self.set_viewbox(-self.plot_inner_border, -self.plot_inner_border, self.width + self.plot_inner_border * 2, |
| 112 | self.height + self.plot_inner_border * 2) |
| 113 | if len(self.polyList) < 1: |
| 114 | return |
| 115 | minX = min(self.polyList[0].plotData.coordsX) |
| 116 | maxX = max(self.polyList[0].plotData.coordsX) |
| 117 | minY = min(self.polyList[0].plotData.coordsY) |
| 118 | maxY = max(self.polyList[0].plotData.coordsY) |
| 119 | |
| 120 | for poly in self.polyList: |
| 121 | minX = min(minX, min(poly.plotData.coordsX)) |
| 122 | maxX = max(maxX, max(poly.plotData.coordsX)) |
| 123 | minY = min(minY, min(poly.plotData.coordsY)) |
| 124 | maxY = max(maxY, max(poly.plotData.coordsY)) |
| 125 | self.textYMin.set_text("min:%s" % minY) |
| 126 | self.textYMax.set_text("max:%s" % maxY) |
| 127 | |
| 128 | i = 1 |
| 129 | for poly in self.polyList: |
| 130 | scaledTranslatedYpos = (-poly.plotData.coordsY[-1] + maxY + (self.height-(maxY-minY))/2.0) |
| 131 | |
| 132 | textXpos = self.height / (len(self.polyList) + 1) * i |
| 133 | |
| 134 | poly.textXMin.set_text(str(min(poly.plotData.coordsX))) |
| 135 | poly.textXMin.set_fill(poly.attributes['stroke']) |
| 136 | |
| 137 | poly.textXMin.set_position(-textXpos, (min(poly.plotData.coordsX) - minX) ) |
| 138 | poly.textXMin.attributes['transform'] = "rotate(%s)" % (-90) |
| 139 | poly.textXMax.set_text(str(max(poly.plotData.coordsX))) |
| 140 | poly.textXMax.set_fill(poly.attributes['stroke']) |
| 141 | poly.textXMax.set_position(-textXpos, (max(poly.plotData.coordsX) - minX) ) |
| 142 | |
| 143 | poly.textXMax.attributes['transform'] = "rotate(%s)" % (-90) |
| 144 | poly.textYVal.set_text(str(poly.plotData.coordsY[-1])) |
| 145 | poly.textYVal.set_fill(poly.attributes['stroke']) |
| 146 | poly.textYVal.set_position(0, scaledTranslatedYpos) |
| 147 | |
| 148 | poly.lineYValIndicator.set_stroke(1, poly.attributes['stroke']) |
| 149 | poly.lineXMinIndicator.set_stroke(1, poly.attributes['stroke']) |
| 150 | poly.lineXMaxIndicator.set_stroke(1, poly.attributes['stroke']) |
| 151 | poly.lineYValIndicator.set_coords(0, scaledTranslatedYpos, self.width, scaledTranslatedYpos) |
| 152 | poly.lineXMinIndicator.set_coords((min(poly.plotData.coordsX) - minX), 0, |
| 153 | (min(poly.plotData.coordsX) - minX), self.height) |
| 154 | poly.lineXMaxIndicator.set_coords((max(poly.plotData.coordsX) - minX), 0, |
| 155 | (max(poly.plotData.coordsX) - minX), self.height) |
| 156 | poly.attributes['transform'] = ('translate(%s,%s)' % (-minX, maxY + (self.height-(maxY-minY))/2.0) + |
| 157 | ' scale(%s,%s)' % ((1.0), -(1.0))) |
| 158 | i = i + 1 |
| 159 | |
| 160 | |
| 161 | class MyApp(App): |
no test coverage detected