def draw_multi_price_line(name, dict_data): line = Line() line.disable_xml_declaration = True line.js = [] line.x_label_rotation = 45 line.y_labels_major_every = 3 #line.show_legend = False line.legend_at_bottom = True line.print_values = False line.width = 1280 line.height = 720 line.value_formatter = lambda x:str(int(x)) #line.major_label_font_size = 20 #line.print_zeroes = True #line.show_minor_x_labels = True #line.show_minor_y_labels = True line.title = name min_y = None max_y = None for name in dict_data: #print(name) list_x, list_y = dict_data[name] line.add(name, list_y) min_list_y = min(list_y) max_list_y = max(list_y) if min_y == None or min_list_y < min_y : min_y = min_list_y if max_y == None or max_list_y > max_y : max_y = max_list_y if min_y == None : min_y = 0 if max_y == None : max_y = 0 line.range = (min_y-100, max_y+300) line.x_labels = map(str, list_x) line.y_labels = map(lambda x:x*100, range(int((min_y/100)-1), int((max_y/100+4)))) return line.render()
def draw_number_line(name, list_x, list_y, max_y = 0): line = Line() line.disable_xml_declaration = True line.js = [] line.x_label_rotation = 45 line.x_labels_major_count = 31 #line.y_labels_major_every = 3 line.show_legend = False line.print_values = False line.print_zeroes = False line.width = 1280 line.height = 720 line.value_formatter = lambda x:str(int(x)) #line.major_label_font_size = 20 #line.print_zeroes = True line.show_minor_x_labels = False #line.show_minor_y_labels = True line.show_dots = False #line.interpolate = 'hermite' line.title = name list_int_y = [0] for y in list_y: if y != None: list_int_y.append(y) line.range = (0, max(int(max(list_int_y)*1.1), max_y)) line.x_labels = list_x #line.y_labels = map(lambda x:x*100, range(int((min(list_y)/100)-1), int((max(list_y)/100+4)))) line.add(name, list_y) return line.render()
def draw_price_line(name, list_x, list_y): line = Line() line.disable_xml_declaration = True line.js = [] line.x_label_rotation = 45 line.y_labels_major_every = 3 line.show_legend = False line.print_values = False line.width = 1280 line.height = 720 line.value_formatter = lambda x:str(int(x)) #line.major_label_font_size = 20 #line.print_zeroes = True #line.show_minor_x_labels = True #line.show_minor_y_labels = True line.title = name digital_y = list(filter(lambda x:x != None, list_y)) if digital_y == [] : digital_y = [0] line.range = (min(digital_y)-100, max(digital_y)+300) line.x_labels = list_x line.y_labels = map(lambda x:x*100, range(int((min(digital_y)/100)-1), int((max(digital_y)/100+4)))) line.add(name, list_y) return line.render()