def draw(self, loc, min, max, qmin = None, qmax = None): x = loc[0] y = loc[1] min = (min - y) *1 + y max = (max - y) *1+ y canvas.line(self.line_style, x, min, x, max)
def draw(self, x, y): self.predraw_check() # move to the bottom-left corner x = x - self.size / 2.0 y = y - self.size / 2.0 canvas.line(self.line_style, x, y, x + self.size, y + self.size) canvas.line(self.line_style, x + self.size, y, x, y + self.size)
def draw (self, x, y): self.predraw_check() # move to the bottom-left corner x = x - self.size/2.0 y = y - self.size/2.0 canvas.line(self.line_style, x, y, x+self.size, y+self.size) canvas.line(self.line_style, x+self.size, y, x, y+self.size)
def draw(self, loc, min, max, qmin=None, qmax=None): x = loc[0] y = loc[1] min = (min - y) * 1 + y max = (max - y) * 1 + y canvas.line(self.line_style, x, min, x, max)
def draw(self, x, y): self.predraw_check() # move to the bottom-left corner canvas.line(self.line_style, x - self.size / 1.4, y, x + self.size / 1.4, y) canvas.line(self.line_style, x, y - self.size / 1.4, x, y + self.size / 1.4)
def draw(self, loc, min, max, qmin=None, qmax=None): x = loc[0] y = min canvas.line(self.line_style, x - self.tic_len / 2.0, y, x + self.tic_len / 2.0, y) y = max canvas.line(self.line_style, x - self.tic_len / 2.0, y, x + self.tic_len / 2.0, y)
def __draw_x_grid_and_axis(self): if self.x_grid_style: for i in self.x_tic_points(self.x_grid_interval): x = self.x_pos(i) if x > self.loc[0]: canvas.line(self.x_grid_style, x, self.loc[1], x, self.loc[1]+self.size[1]) if self.x_axis: self.x_axis.draw(self)
def draw(self, x1, y1, x2, y2): interval = self.line_interval cury = y1 while cury < y2: canvas.line(self.line_style, x1, cury, x2, cury) cury = cury + interval curx = x1 while curx < x2: canvas.line(self.line_style, curx, y1, curx, y2) curx = curx + interval
def __draw_y_grid_and_axis(self): if self.y_grid_style: for i in self.y_tic_points(self.y_grid_interval): y = self.y_pos(i) if y > self.loc[1]: canvas.line(self.y_grid_style, self.loc[0], y, self.loc[0]+self.size[0], y) if self.y_axis: self.y_axis.draw(self)
def draw(self, x1, y1, x2, y2): interval = nscale(self.line_interval) cury = y1 j = 0 while cury < y2: curx = x1 if j % 2 == 1: curx = curx + interval / 2.0 while curx < x2: canvas.line(self.line_style, curx, cury, curx + interval / 2.0, cury) curx = curx + interval * 1.5 j = j + 1 cury = cury + interval
def draw(self, x1, y1, x2, y2): line_width = self.line_style.width interval = self.line_interval * 1.414 x1 = x1 - line_width y1 = y1 - line_width x2 = x2 + line_width y2 = y2 + line_width height = y2 - y1 width = x2 - x2 len = max(height, width) curx = x1 - len while curx < x2: canvas.line(self.line_style, curx, y1, curx+len, y1+len) curx = curx + interval
def draw(self, x1, y1, x2, y2): line_width = self.line_style.width interval = self.line_interval * 1.414 x1 = x1 - line_width y1 = y1 - line_width x2 = x2 + line_width y2 = y2 + line_width height = y2 - y1 width = x2 - x2 len = max(height, width) curx = x1 - len while curx < x2: canvas.line(self.line_style, curx, y1, curx + len, y1 + len) curx = curx + interval
def draw(self, x, y): self.predraw_check() # move to the bottom-left corner midx = x midy = y d_len = self.size / 2.0 r_len = self.size * 1.414 / 2.0 canvas.line(self.line_style, x - d_len, y - d_len, x + d_len, y + d_len) canvas.line(self.line_style, x + d_len, y - d_len, x - d_len, y + d_len) canvas.line(self.line_style, midx, y - r_len, midx, y + r_len) canvas.line(self.line_style, x - r_len, midy, x + r_len, midy)
def draw (self, x, y): self.predraw_check() # move to the bottom-left corner midx = x midy = y d_len = self.size / 2.0 r_len = self.size * 1.414 / 2.0 canvas.line(self.line_style, x-d_len, y-d_len, x+d_len, y+d_len) canvas.line(self.line_style, x+d_len, y-d_len, x-d_len, y+d_len) canvas.line(self.line_style, midx, y-r_len, midx, y+r_len) canvas.line(self.line_style, x-r_len, midy, x+r_len, midy)
def draw(self, ar, x_tick, x_label, y): """Draw a legend entry. X_TICK and X_LABEL are the X location \ (in points) of where the sample and label are drawn.""" nr_lines = len(string.split(self.label, "\n")) text_height = font.text_height(self.label)[0] line_height = text_height / float(nr_lines) y_center = y + text_height - line_height/1.5 if self.fill_style != None: canvas.rectangle(self.line_style, self.fill_style, x_tick, y_center - self.rect_size/2.0, x_tick + self.rect_size, y_center + self.rect_size/2.0) elif self.line_style != None: canvas.line(self.line_style, x_tick, y_center, x_tick + self.line_len, y_center) if self.tick_mark != None: self.tick_mark.draw(x_tick + self.line_len/2.0, y_center) elif self.tick_mark != None: self.tick_mark.draw(x_tick, y_center) canvas.show(x_label, y, self.label)
def draw(self, ar, x_tick, x_label, y): """Draw a legend entry. X_TICK and X_LABEL are the X location \ (in points) of where the sample and label are drawn.""" nr_lines = len(string.split(self.label, "\n")) text_height = font.text_height(self.label)[0] line_height = text_height / float(nr_lines) y_center = y + text_height - line_height / 1.5 if self.fill_style != None: canvas.rectangle(self.line_style, self.fill_style, x_tick, y_center - self.rect_size / 2.0, x_tick + self.rect_size, y_center + self.rect_size / 2.0) elif self.line_style != None: canvas.line(self.line_style, x_tick, y_center, x_tick + self.line_len, y_center) if self.tick_mark != None: self.tick_mark.draw(x_tick + self.line_len / 2.0, y_center) elif self.tick_mark != None: self.tick_mark.draw(x_tick, y_center) canvas.show(x_label, y, self.label)
def draw(self, loc, min, max, qmin = None, qmax = None): vline_style = self.vline_style if not vline_style: vline_style = self.hline_style x = loc[0] y1 = min canvas.line(self.hline_style, x-self.tic_len/2.0, y1, x+self.tic_len/2.0, y1) y2 = max canvas.line(self.hline_style, x-self.tic_len/2.0, y2, x+self.tic_len/2.0, y2) canvas.line(vline_style, x, y1, x, y2)
def draw(self, loc, min, max, qmin, qmax): x = loc[0] style = self.line_style y1 = min canvas.line(style, x-self.tic_len/2.0, y1, x+self.tic_len/2.0, y1) y2 = max canvas.line(style, x-self.tic_len/2.0, y2, x+self.tic_len/2.0, y2) canvas.line(style, x, y1, x, y2) canvas.rectangle(style, self.fill_style, x-self.box_width/2.0, qmin, x+self.box_width/2.0, qmax)
def draw(self, loc, min, max, qmin=None, qmax=None): vline_style = self.vline_style if not vline_style: vline_style = self.hline_style x = loc[0] y1 = min canvas.line(self.hline_style, x - self.tic_len / 2.0, y1, x + self.tic_len / 2.0, y1) y2 = max canvas.line(self.hline_style, x - self.tic_len / 2.0, y2, x + self.tic_len / 2.0, y2) canvas.line(vline_style, x, y1, x, y2)
def draw(self, loc, min, max, qmin, qmax): x = loc[0] style = self.line_style y1 = min canvas.line(style, x - self.tic_len / 2.0, y1, x + self.tic_len / 2.0, y1) y2 = max canvas.line(style, x - self.tic_len / 2.0, y2, x + self.tic_len / 2.0, y2) canvas.line(style, x, y1, x, y2) canvas.rectangle(style, self.fill_style, x - self.box_width / 2.0, qmin, x + self.box_width / 2.0, qmax)
def draw(self, ar): self.type_check() self.tic_interval = self.tic_interval or ar.y_grid_interval x_base = ar.loc[0] + self.offset canvas.line(self.line_style, x_base, ar.loc[1], x_base, ar.loc[1] + ar.size[1]) xmin = x_base + ar.size[0] # somebigvalue tic_dic = {} for i in ar.y_tic_points(self.tic_interval): y_tic = ar.y_pos(i) tic_dic[i] = 1 canvas.line(self.line_style, x_base, y_tic, x_base - self.tic_len, y_tic) tic_label = pychart_util.apply_format(self.format, (i, ), 0) x = x_base - self.tic_len + self.tic_label_offset[0] if self.tic_len > 0: tic_label = "/hR" + tic_label tic_height, base_height = font.text_height(tic_label) canvas.show(x, y_tic - tic_height / 2.0 + self.tic_label_offset[1], tic_label) xmin = min(xmin, x - font.text_width(tic_label)) if self.minor_tic_interval: for i in ar.y_tic_points(self.minor_tic_interval): if tic_dic.has_key(i): # a major tic was drawn already. pass else: y_tic = ar.y_pos(i) canvas.line(self.line_style, x_base, y_tic, x_base - self.minor_tic_len, y_tic) if self.label != None: xlabel = xmin - theme.default_font_size / 2.0 ylabel = ar.loc[1] + ar.size[1] / 2 if self.label_offset[0] != None: xlabel = xlabel + self.label_offset[0] if self.label_offset[1] != None: ylabel = ylabel + self.label_offset[1] canvas.show(xlabel, ylabel, "/a90/hC" + self.label)
def draw(self, ar): self.type_check() self.tic_interval = self.tic_interval or ar.y_grid_interval x_base = ar.loc[0] + self.offset canvas.line(self.line_style, x_base, ar.loc[1], x_base, ar.loc[1]+ar.size[1]) xmin = x_base + ar.size[0] # somebigvalue tic_dic = {} for i in ar.y_tic_points(self.tic_interval): y_tic = ar.y_pos(i) tic_dic[i] = 1 canvas.line(self.line_style, x_base, y_tic, x_base - self.tic_len, y_tic) tic_label = pychart_util.apply_format(self.format, (i,), 0) x = x_base - self.tic_len + self.tic_label_offset[0] if self.tic_len > 0: tic_label = "/hR" + tic_label tic_height, base_height = font.text_height(tic_label) canvas.show(x, y_tic - tic_height/2.0 + self.tic_label_offset[1], tic_label) xmin = min(xmin, x - font.text_width(tic_label)) if self.minor_tic_interval: for i in ar.y_tic_points(self.minor_tic_interval): if tic_dic.has_key(i): # a major tic was drawn already. pass else: y_tic = ar.y_pos(i) canvas.line(self.line_style, x_base, y_tic, x_base - self.minor_tic_len, y_tic) if self.label != None: xlabel = xmin - theme.default_font_size/2.0 ylabel = ar.loc[1] + ar.size[1] / 2 if self.label_offset[0] != None: xlabel = xlabel + self.label_offset[0] if self.label_offset[1] != None: ylabel = ylabel + self.label_offset[1] canvas.show(xlabel, ylabel, "/a90/hC" + self.label)
def draw (self, x, y): self.predraw_check() # move to the bottom-left corner canvas.line(self.line_style, x-self.size/1.4, y, x+self.size/1.4, y) canvas.line(self.line_style, x, y-self.size/1.4, x, y+self.size/1.4)
def draw(self, ar): self.type_check() self.tic_interval = self.tic_interval or ar.x_grid_interval y_base = ar.loc[1] + self.offset canvas.line(self.line_style, ar.loc[0], y_base, ar.loc[0] + ar.size[0], y_base) tic_dic = {} max_tic_height = 0 for i in ar.x_tic_points(self.tic_interval): tic_dic[i] = 1 ticx = ar.x_pos(i) str = "/hC" + pychart_util.apply_format(self.format, (i, ), 0) (total_height, base_height) = font.text_height(str) max_tic_height = max(max_tic_height, total_height) canvas.line(self.line_style, ticx, y_base, ticx, y_base - self.tic_len) canvas.show( ticx + self.tic_label_offset[0], y_base - self.tic_len - base_height + self.tic_label_offset[1], str) if self.minor_tic_interval: for i in ar.x_tic_points(self.minor_tic_interval): if tic_dic.has_key(i): # a major tic was drawn already. pass else: ticx = ar.x_pos(i) canvas.line(self.line_style, ticx, y_base, ticx, y_base - self.minor_tic_len) if self.label != None: str = "/hC/vM" + self.label (label_height, base_height) = font.text_height(str) xlabel = ar.loc[0] + ar.size[0] / 2.0 ylabel = y_base - self.tic_len - max_tic_height - 10 if self.label_offset[0] != None: xlabel = xlabel + self.label_offset[0] if self.label_offset[1] != None: ylabel = ylabel + self.label_offset[1] canvas.show(xlabel, ylabel, str) tic_dic = {} max_tic_height = 0 for i in ar.x_tic_points(self.tic_interval): tic_dic[i] = 1 ticx = ar.x_pos(i) str = "/hC" + pychart_util.apply_format(self.format, (i, ), 0) (total_height, base_height) = font.text_height(str) max_tic_height = max(max_tic_height, total_height) canvas.line(self.line_style, ticx, y_base, ticx, y_base - self.tic_len) canvas.show( ticx + self.tic_label_offset[0], y_base - self.tic_len - base_height + self.tic_label_offset[1], str) if self.minor_tic_interval: for i in ar.x_tic_points(self.minor_tic_interval): if tic_dic.has_key(i): # a major tic was drawn already. pass else: ticx = ar.x_pos(i) canvas.line(self.line_style, ticx, y_base, ticx, y_base - self.minor_tic_len) if self.label != None: str = "/hC/vM" + self.label (label_height, base_height) = font.text_height(str) if self.label_offset[0] != None: xlabel = ar.loc[0] + self.label_offset[0] else: xlabel = ar.loc[0] + ar.size[0] / 2.0 if self.label_offset[1] != None: ylabel = y_base + self.label_offset[1] else: ylabel = y_base - self.tic_len - max_tic_height - 10 canvas.show(xlabel, ylabel, str)
def draw(self, ar): self.type_check() self.tic_interval = self.tic_interval or ar.x_grid_interval y_base = ar.loc[1] + self.offset canvas.line(self.line_style, ar.loc[0], y_base, ar.loc[0]+ ar.size[0], y_base) tic_dic = {} max_tic_height = 0 for i in ar.x_tic_points(self.tic_interval): tic_dic[i] = 1 ticx = ar.x_pos(i) str = "/hC" + pychart_util.apply_format(self.format, (i, ), 0) (total_height, base_height) = font.text_height(str) max_tic_height = max(max_tic_height, total_height) canvas.line(self.line_style, ticx, y_base, ticx, y_base-self.tic_len) canvas.show(ticx+self.tic_label_offset[0], y_base-self.tic_len-base_height+self.tic_label_offset[1], str) if self.minor_tic_interval: for i in ar.x_tic_points(self.minor_tic_interval): if tic_dic.has_key(i): # a major tic was drawn already. pass else: ticx = ar.x_pos(i) canvas.line(self.line_style, ticx, y_base, ticx, y_base-self.minor_tic_len) if self.label != None: str = "/hC/vM" + self.label (label_height, base_height) = font.text_height(str) xlabel = ar.loc[0] + ar.size[0]/2.0 ylabel = y_base - self.tic_len - max_tic_height - 10 if self.label_offset[0] != None: xlabel = xlabel + self.label_offset[0] if self.label_offset[1] != None: ylabel = ylabel + self.label_offset[1] canvas.show(xlabel, ylabel, str) tic_dic = {} max_tic_height = 0 for i in ar.x_tic_points(self.tic_interval): tic_dic[i] = 1 ticx = ar.x_pos(i) str = "/hC" + pychart_util.apply_format(self.format, (i,), 0) (total_height, base_height) = font.text_height(str) max_tic_height = max(max_tic_height, total_height) canvas.line(self.line_style, ticx, y_base, ticx, y_base-self.tic_len) canvas.show(ticx+self.tic_label_offset[0], y_base-self.tic_len-base_height+self.tic_label_offset[1], str) if self.minor_tic_interval: for i in ar.x_tic_points(self.minor_tic_interval): if tic_dic.has_key(i): # a major tic was drawn already. pass else: ticx = ar.x_pos(i) canvas.line(self.line_style, ticx, y_base, ticx, y_base-self.minor_tic_len) if self.label != None: str = "/hC/vM" + self.label (label_height, base_height) = font.text_height(str) if self.label_offset[0] != None: xlabel = ar.loc[0] + self.label_offset[0] else: xlabel = ar.loc[0] + ar.size[0]/2.0 if self.label_offset[1] != None: ylabel = y_base + self.label_offset[1] else: ylabel = y_base - self.tic_len - max_tic_height - 10 canvas.show(xlabel, ylabel, str)
def draw(self, loc, min, max, qmin = None, qmax = None): x = loc[0] y = min canvas.line(self.line_style, x-self.tic_len/2.0, y, x+self.tic_len/2.0, y) y = max canvas.line(self.line_style, x-self.tic_len/2.0, y, x+self.tic_len/2.0, y)
def draw(self, loc, min, max, qmin, qmax): x = loc[0] canvas.line(self.line_style, x, min, x, qmin) canvas.line(self.line_style, x, qmax, x, max)