Ejemplo n.º 1
0
 def draw(self, context, rect):
     context.set_source_rgb(0.5, 0.5, 1)
     drc = drawing_rectangle(lower_x_limit = -10,
                             upper_x_limit = 10,
                             lower_y_limit = -10,
                             upper_y_limit = 20)
     some_data = map(lambda a: (a, a ** 2 - 10), arange(-10, 10, 0.1))
     chart = data_chart(some_data, color = (0, 0, 1))
     draw_chart(context, rect, drc, chart)
Ejemplo n.º 2
0
 def draw(self, context, rect):
     context.set_source_rgb(0.1, 0.5, 0)
     drc = drawing_rectangle(lower_x_limit=-10,
                             upper_x_limit=10,
                             lower_y_limit=-1,
                             upper_y_limit=1)
     sin_data = map(lambda a: (a, sin(a)), arange(-10, 10, 0.1))
     mapsin = map_to_context_coordinates(drc, rect, sin_data)
     context.move_to(mapsin[0][0], mapsin[0][1])
     for dsin in mapsin[1:]:
         context.line_to(*dsin)
     context.stroke()
Ejemplo n.º 3
0
 def __init__(self, parent):
     self._parent = parent
     self.window = gtk.Dialog(title="График", buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CANCEL))
     if self._parent != None:
         self.window.set_transient_for(self._parent.window.builder.get_object("main_window"))
         self.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
     else:
         self.window.set_position(gtk.WIN_POS_CENTER)
     self.chart_area = cairo_canva()
     self.background = background_plotter()
     self.legend = legend_plotter()
     self.mesh = mesh_plotter()
     self.charts = charts_plotter()
     self.rectangle = drawing_rectangle()
     self.plotter = complex_plotter(self.rectangle, legend=self.legend, mesh=self.mesh, charts=self.charts)
     self.chart_area.add_drawer(self.background)
     self.chart_area.add_drawer(self.plotter)
     self.window.get_content_area().pack_start(self.chart_area, True, True)
     self.window.set_default_size(640, 480)