def people_roles_piechart(parser, token): width, height, args = _extract_chart_params(token) colors = dict(arg.split(':') for arg in args) items = Profile.objects.filter(role__in=colors.keys()).values('role').annotate(num=Count('id')) for item in items: item['name'] = name = item.pop('role') item['color'] = colors[name] return ChartNode(items, width, height, 'bhs')
def people_roles_piechart(parser, token): width, height, args = _extract_chart_params(token) colors = dict(arg.split(':') for arg in args) items = Profile.objects.filter( role__in=colors.keys()).values('role').annotate(num=Count('id')) for item in items: item['name'] = name = item.pop('role') item['color'] = colors[name] return ChartNode(items, width, height, 'bhs')
def project_official_piechart(parser, token): width, height, args = _extract_chart_params(token) args = [arg.split(':') for arg in args] items = Project.objects.values('official').annotate(num=Count('id')) for item in items: if item.pop('official'): item['name'] = args[0][0] item['color'] = args[0][1] else: item['name'] = args[1][0] item['color'] = args[1][1] return ChartNode(items, width, height, chart_type='bhs')