-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGen_Line.py
More file actions
19 lines (19 loc) · 796 Bytes
/
Gen_Line.py
File metadata and controls
19 lines (19 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""BTS line graph."""
import pygal
import csv
from pygal.style import DarkStyle
def bar_graph():
"""Return bar graph as svg file."""
year = input()
with open(year+'.txt') as bts:
for data in csv.reader(bts):
lst = data[0].split()
chart = pygal.Line(fill=True, interpolate='cubic', style=DarkStyle)
chart.title = lst[0] + ' ' + year
chart.x_labels = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',\
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
chart.add(lst[0], [int(lst[1]), int(lst[2]), int(lst[3]),
int(lst[4]), int(lst[5]), int(lst[6]), int(lst[7]), int(lst[8]),\
int(lst[9]), int(lst[10]), int(lst[11]), int(lst[12])])
chart.render_to_file(lst[0]+year+".svg")
bar_graph()