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 test_show_dots(): line = Line() line.add('_', [1, 2, 3]) q = line.render_pyquery() assert len(q(".dots")) == 3 line.show_dots = False q = line.render_pyquery() assert len(q(".dots")) == 0