Skip to content

Instantly share code, notes, and snippets.

@theraphim
Created October 29, 2015 17:40
Show Gist options
  • Save theraphim/4389f62a4776a7562892 to your computer and use it in GitHub Desktop.
Save theraphim/4389f62a4776a7562892 to your computer and use it in GitHub Desktop.
#! /usr/bin/env python
import sys
from pychart import *
from roundup import instance
# open the instance
if len(sys.argv) < 2:
print 'You need to specify an instance home dir'
instance_home = sys.argv[1]
instance = instance.open(instance_home)
db = instance.open('admin')
# analyse the tracker for the status summary
data = []
fs = []
dm = { 'in-progress' : fill_style.red,
'testing': fill_style.blue,
'chatting': fill_style.green,
'deferred': fill_style.yellow,
'unread' : fill_style.darkorchid,
'need-eg': fill_style.darkseagreen,
}
for sid in db.status.list():
if db.status.get(sid, 'name') != 'resolved':
count = len(db.issue.find(status=sid))
if count:
try:
fs.append(dm[db.status.get(sid, 'name')])
except:
fs.append(fill_style.green)
data.append((db.status.get(sid, 'name'), count))
# now call PyChart for the chart generation
theme.output_file = sys.argv[2]
theme.use_color = True
theme.default_font_size = 16
theme.reinitialize()
ar = area.T(size=(400,400), legend=legend.T(),
x_grid_style=None, y_grid_style=None)
plot = pie_plot.T(data=data, arc_offsets=[0,10,0,10], fill_styles = fs,
shadow=(2, -2, fill_style.gray50), label_offset=25, arrow_style=arrow.a3)
ar.add_plot(plot)
ar.draw()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment