def render( self, svg, paint ): g = group.Group() utils.copy_object ( paint, g ) width = self.xAxis.length + self.xAxis.bias height = self.yAxis.length + self.yAxis.bias if self.xGrid and self.xAxis.tick_positions != None: for pos in self.xAxis.tick_positions: h = Line () h.x1 = pos h.y1 = 0 h.x2 = pos h.y2 = height g.append( h ) if self.yGrid and self.yAxis.tick_positions != None: for pos in self.yAxis.tick_positions: v = Line () v.x1 = 0 v.y1 = pos v.x2 = width v.y2 = pos g.append( v ) svg.append( g )
def __init__(self, viewport, gw, gh, paint): Object.__init__(self, viewport) utils.copy_object(paint, self) # draw num_lines = int(viewport.w / gw) - 1 x = viewport.x + gw for l in range(0, num_lines): v = line.Line() v.x1 = x v.y1 = viewport.y v.x2 = x v.y2 = v.y1 + viewport.h x += gw self.append(v) num_lines = int(viewport.h / gh) - 1 y = viewport.y + gh for l in range(0, num_lines): h = line.Line() h.x1 = viewport.x h.y1 = y h.x2 = h.x1 + viewport.w h.y2 = y y += gh self.append(h)
def render( self, svg ): bar_group = group.Group() if self.shadow and self.length > 0: shadow_paint = Paint() shadow_paint.fill = "#BBB" shadow_paint.fill_opacity = 0.6 shadow = rect.Rect() shadow.x = self.x shadow.y = self.y - 3 shadow.width = self.length + 3 shadow.height = self.width utils.copy_object( shadow_paint, shadow ) bar_group.append( shadow ) r = rect.Rect() r.x = self.x r.y = self.y r.width = self.length r.height = self.width utils.copy_object( self.paint, r ) bar_group.append( r ) svg.append( bar_group )
def __init__ (self, viewport, gw, gh, paint ): Object.__init__(self, viewport) utils.copy_object ( paint, self ) # draw num_lines = int (viewport.w / gw) - 1 x = viewport.x + gw for l in range ( 0, num_lines ): v = line.Line () v.x1 = x v.y1 = viewport.y v.x2 = x v.y2 = v.y1 + viewport.h x += gw self.append (v) num_lines = int ( viewport.h / gh) - 1 y = viewport.y + gh for l in range (0, num_lines ): h = line.Line () h.x1 = viewport.x h.y1 = y h.x2 = h.x1 + viewport.w h.y2 = y y += gh self.append (h)
def __init__(self, data, paint): group.Group.__init__(self) p = path.Path() utils.copy_object(paint, self) p.fill = "none" p.moveto(data) self.append(p)
def __init__(self, data, paint ): group.Group.__init__(self) p = path.Path () utils.copy_object ( paint, self ) p.fill ="none" p.moveto ( data ) self.append ( p )
def render( self, svg ): plot_line = group.Group() if self.shadow and self.paint.stroke_width != None: shadow_paint = Paint() shadow_paint.stroke_width = self.paint.stroke_width * 2 shadow_paint.stroke = SHADOW_COLOR p = path.Path () utils.copy_object ( shadow_paint, p ) p.moveto ( [ (c[0],c[1]-(shadow_paint.stroke_width-1)) for c in self.coords ] ) plot_line.append( p ) if self.paint.fill != None and self.paint.fill.upper != "NONE": paint = Paint( fill = self.paint.fill ) p = path.Path () p.moveto ( self.coords ) p.vertical( 0 ) p.horizontal( 0 ) p.close() utils.copy_object( paint, p ) plot_line.append( p ) paint = Paint() utils.copy_object( self.paint, paint ) paint.fill = "None" p = path.Path() if self.startMarker != None: p.marker_start = self.startMarker.getURI() if self.midMarker != None: p.marker_mid = self.midMarker.getURI() if self.endMarker != None: p.marker_end = self.endMarker.getURI() p.moveto( self.coords ) utils.copy_object( paint, p ) plot_line.append( p ) svg.append( plot_line ) plot_points = group.Group() utils.copy_object ( paint, plot_points ) plot_points.fill = plot_points.stroke
def render( self, svg, paint ): g = group.Group() utils.copy_object( paint, g ) if self.axe: l = Line() l.x1 = 0 l.y1 = 0 if self.orientation == Axis.Orientation.HORIZONTAL: l.x2 = self.length + self.bias l.y2 = 0 else: l.x2 = 0 l.y2 = self.length + self.bias utils.copy_object( paint, l ) g.append( l ) if self.tick_positions != None: if self.orientation == Axis.Orientation.HORIZONTAL: for t in self.tick_positions: tick = Line() tick.x1 = t tick.y1 = TICK_START tick.x2 = t tick.y2 = TICK_LENGTH g.append( tick ) else: for t in self.tick_positions: tick = Line() tick.x1 = TICK_START tick.y1 = t tick.x2 = TICK_LENGTH tick.y2 = t g.append( tick ) if self.labels != None: self.labels.render( g ) svg.append( g )
def __init__(self, origin, length, tickInterval, paint): group.Group.__init__(self) utils.copy_object(paint, self) self.tickInterval = tickInterval self.line = line.Line() self.line.x1 = 0 self.line.y1 = 0 self.line.x2 = length self.line.y2 = 0 self.length = length self.translate(origin[0], origin[1]) self.line.fill = "none" self.append(self.line) ticks = Ticks(length, tickInterval) self.append(ticks)
def __init__ ( self, origin, length, tickInterval, paint ): group.Group.__init__(self) utils.copy_object ( paint, self ) self.tickInterval = tickInterval self.line = line.Line() self.line.x1 = 0 self.line.y1 = 0 self.line.x2 = length self.line.y2 = 0 self.length = length self.translate( origin[0], origin[1] ) self.line.fill ="none" self.append ( self.line ) ticks = Ticks ( length, tickInterval ) self.append ( ticks )