author  haftmann 
Sat, 05 Apr 2014 10:03:04 +0200  
changeset 56417  04d0083cb9e5 
child 56427  5cbaf18d0dfb 
permissions  rwxrxrx 
56417
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

1 
#!/usr/bin/python 
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

2 

04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

3 
import re 
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

4 
from pychart import theme, pie_plot, area, fill_style, arrow, legend 
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

5 
import sys 
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

6 

04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

7 
re_entry = re.compile(R'^(.*\S+)\s+(\d+)\s*\**\s*$') 
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

8 

04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

9 
theme.get_options() 
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

10 

04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

11 
data = [] 
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

12 

04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

13 
for line in sys.stdin.readlines(): 
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

14 
match = re_entry.match(line) 
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

15 
data.append((match.group(1), int(match.group(2)))) 
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

16 

04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

17 
plot = pie_plot.T(data = data, arc_offsets = [], 
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

18 
shadow = (2, 2, fill_style.gray50), label_offset = 10, arrow_style = arrow.a3) 
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

19 

04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

20 
ar = area.T(size = (500, 500), legend = legend.T(), x_grid_style = None, y_grid_style = None) 
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

21 
ar.add_plot(plot) 
04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

22 

04d0083cb9e5
churning pie charts (with noncanonical prerequisites!)
haftmann
parents:
diff
changeset

23 
ar.draw() 