56
57
chart.add_data(helper.random_data())
57
58
chart.download('line-sparkline.png')
62
# Set the vertical range to 0 to 50
64
chart = SimpleLineChart(200, 125, y_range=[0, max_y])
66
# First value is the highest Y value. Two of them are needed to be
68
chart.add_data([max_y] * 2)
71
chart.add_data([28, 30, 31, 33, 35, 36, 42, 48, 43, 37, 32, 24, 28])
72
chart.add_data([16, 18, 18, 21, 23, 23, 29, 36, 31, 25, 20, 12, 17])
73
chart.add_data([7, 9, 9, 12, 14, 14, 20, 27, 21, 15, 10, 3, 7])
75
# Last value is the lowest in the Y axis.
76
chart.add_data([0] * 2)
79
chart.set_colours(['000000'] * 5)
82
# from the top to the first real data
83
chart.add_fill_range('76A4FB', 0, 1)
85
# Between the 3 data values
86
chart.add_fill_range('224499', 1, 2)
87
chart.add_fill_range('FF0000', 2, 3)
89
# from the last real data to the
90
chart.add_fill_range('80C65A', 3, 4)
93
chart.set_axis_labels(Axis.LEFT, ['', max_y / 2, max_y])
94
chart.set_axis_labels(Axis.BOTTOM, ['Sep', 'Oct', 'Nov', 'Dec'])
96
chart.download('line-fill.png')
66
106
if __name__ == '__main__':