The following script, which started out life as the roundup-reminder script, will generate a pie chart summary of the statuses in your tracker. The original used the "PyChart library": http://home.gna.org/pychart/ to do the actual charting. PyChart is python 2 only and is unmaintained. I have left the PyChart code commented out in the script below.
This version uses pygal: https://www.pygal.org/en/stable/index.html. The script is:
import sys import pygal #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 = [] for sid in db.status.list(): count = len(db.issue.find(status=sid)) if count: data.append((db.status.get(sid, 'name'), count)) config = pygal.Config() # Customize CSS # Almost all font-* here needs to be !important. Base styles include # the #custom-chart-anchor which gives the base setting higher # specificy/priority. # Make plot title larger and wrap lines on embedded newline config.css.append('''inline: g.titles text.plot_title { font-size: 20px !important; white-space: pre-line; }''') # reduce size of legend text config.css.append('''inline: g.legend text { font-size: 10px !important; }''') chart = pygal.Pie(config, width=400, height=400, print_value=True, # by default values are shown when hovering over a slice ) for d in data: chart.add(d[0], d[1]) chart.title = "Created by Users \n(%s)"%tracker chart.render_to_file('out.svg', pretty_print=True) # now call PyChart for the chart generation #theme.output_file = 'out.png' #theme.reinitialize() #ar = area.T(size=(150,150), legend=legend.T(), # x_grid_style=None, y_grid_style=None) #plot = pie_plot.T(data=data, arc_offsets=[0,10,0,10], # shadow=(2, -2, fill_style.gray50), label_offset=25, arrow_style=arrow.a3) #ar.add_plot(plot) #ar.draw()
The output file out.svg is attached. Because it is shown as an image in mediawiki, there is no interactivity. If you download the svg and open it in the browser, it has interactive capability:
- show/hide a plot by clicking on the colored checkbox in the legend
- hovering over the slice shows details about the slice including value
this is provided using a javascript library loaded from: