def updateChartDataset(self, drawLabels=True): dataset = XYSeriesCollection() #self._calculateConfArea() #dataset.addSeries(self.confArea) dataset.addSeries(self.markers) plot = self.chart.getPlot() rangeAxis = plot.getRangeAxis() domainAxis = plot.getDomainAxis() rangeAxis.setRange(self.minY, self.maxY) #change domainAxis.setRange(self.minX, self.maxX) #plot.setBackgroundPaint(Color.lightGray); #plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); #plot.setDomainGridlinePaint(Color.white); #plot.setRangeGridlinePaint(Color.white); markerRenderer = XYLineAndShapeRenderer(False, True) #print self.markerColor markerRenderer.setSeriesPaint(0, self.markerColor) markerRenderer.setSeriesShape(0, Ellipse2D.Double(-3, -3, 6, 6)) #markerRenderer.setToolTipGenerator(FDistToolTipGenerator(self.pointNames)) plot.setRenderer(0, markerRenderer) plot.setDataset(0, dataset) dataset = XYSeriesCollection() if self.drawCI: dataset = YIntervalSeriesCollection() CIRenderer = DeviationRenderer(True, False) # CIRenderer.setOutline(True) # CIRenderer.setRoundXCoordinates(True) dataset.addSeries(self.bottom) dataset.addSeries(self.top) dataset.addSeries(self.limit) CIRenderer.setSeriesFillPaint(0, self.balColor) CIRenderer.setSeriesFillPaint(1, self.neuColor) CIRenderer.setSeriesFillPaint(2, self.posColor) CIRenderer.setSeriesPaint(0, self.balColor) CIRenderer.setSeriesPaint(1, self.neuColor) CIRenderer.setSeriesPaint(2, self.posColor) plot.setDataset(1, dataset) plot.setRenderer(1, CIRenderer) plot.setDataset(1, dataset) if drawLabels: self.drawLabels()
def ellipse(surface, color, rect, width=0): """ Draw ellipse shape, and returns bounding Rect. Argument include surface to draw, color, and rect. Optional width argument of outline, which defaults to 0 for filled shape. """ if not hasattr(rect, 'width'): rect = Rect(rect) g = surface.createGraphics() if hasattr(color, 'a'): g.setColor(color) else: g.setColor(Color(color)) g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON) ellipse = Ellipse2D.Double(rect.x, rect.y, rect.width, rect.height) if width: g.draw(ellipse) else: g.fill(ellipse) g.dispose() if not _return_rect: return None return surface.get_rect().clip(rect)
def circle(self, radius, x, y): """Draws a circle.""" return self.appendShape( Ellipse2D.Double(x - radius, y - radius, 2 * radius, 2 * radius))
def ellipse(self, rx, ry, x, y): """Draws an ellipse.""" return self.appendShape( Ellipse2D.Double(x - rx, y - ry, rx * 2, ry * 2))