Admin/lib/scripts/churn_pie
author wenzelm
Sat, 05 Apr 2014 20:08:00 +0200
changeset 56427 5cbaf18d0dfb
parent 56417 04d0083cb9e5
child 64879 58525e7f721f
permissions -rwxr-xr-x
more standard hash-bang (python *is* canonical according to Admin/PLATFORMS);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
56427
5cbaf18d0dfb more standard hash-bang (python *is* canonical according to Admin/PLATFORMS);
wenzelm
parents: 56417
diff changeset
     1
#!/usr/bin/env python
56417
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
     2
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
     3
import re
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
     4
from pychart import theme, pie_plot, area, fill_style, arrow, legend
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
     5
import sys
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
     6
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
     7
re_entry = re.compile(R'^(.*\S+)\s+(\d+)\s*\**\s*$')
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
     8
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
     9
theme.get_options()
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
    10
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
    11
data = []
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
    12
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
    13
for line in sys.stdin.readlines():
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
    14
    match = re_entry.match(line)
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
    15
    data.append((match.group(1), int(match.group(2))))
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
    16
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
    17
plot = pie_plot.T(data = data, arc_offsets = [],
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
    18
  shadow = (2, -2, fill_style.gray50), label_offset = 10, arrow_style = arrow.a3)
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
    19
04d0083cb9e5 churning pie charts (with non-canonical 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 non-canonical prerequisites!)
haftmann
parents:
diff changeset
    21
ar.add_plot(plot)
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
    22
04d0083cb9e5 churning pie charts (with non-canonical prerequisites!)
haftmann
parents:
diff changeset
    23
ar.draw()