def graph(): _charts = [ pygal.Line(), pygal.Bar(), pygal.Histogram(), pygal.XY(), pygal.Pie(), pygal.Radar(), pygal.Box(), pygal.Dot(), pygal.Funnel(), pygal.SolidGauge(), pygal.Gauge(), pygal.Pyramid(), pygal.Treemap() ] charts = [] for chart in _charts: chart.title = '% Change Coolness of programming languages over time.' chart.x_labels = ['2011', '2012', '2013', '2014', '2015', '2016'] chart.add('Python', [15, 31, 89, 200, 356, 900]) chart.add('Java', [15, 45, 76, 80, 91, 95]) chart.add('C++', [5, 51, 54, 102, 150, 201]) chart.add('All others combined!', [5, 15, 21, 55, 92, 105]) charts.append(chart.render_data_uri()) return render_template('part2/graph.html', charts=charts, root_path=root_path)
# -*- coding: utf-8 -*- import pygal funnel_chart = pygal.Funnel(x_label_rotation=40) funnel_chart.title = 'Amount of thrust used in a space shuttle at takeoff (in lbs)' funnel_chart.x_labels = ['Pre-takeoff', '5 min', ' 10 min', '15 min', '20 min'] funnel_chart.add('Main Engine', [7000000, 6115200, 5009600, 4347400, 2341211]) funnel_chart.add('Engine #1', [1285000, 1072000, 89000, 51600, 12960]) funnel_chart.add('Engine #3 & #4 (mid-size)', [99000, 61600, 21960, 17856, 11235]) funnel_chart.render_to_file('funnel_chart.svg')
import pygal import lxml funnel_chart = pygal.Funnel() funnel_chart.title = 'V8 benchmark results' funnel_chart.x_labels = [ 'Richards', 'DeltaBlue', 'Crypto', 'RayTrace', 'EarleyBoyer', 'RegExp', 'Splay', 'NavierStokes' ] funnel_chart.add('Opera', [3472, 2933, 4203, 5229, 5810, 1828, 9013, 4669]) funnel_chart.add('Firefox', [7473, 8099, 11700, 2651, 6361, 1044, 3797, 9450]) funnel_chart.add('Chrome', [6395, 8212, 7520, 7218, 12464, 1660, 2123, 8607]) funnel_chart.render_to_file('new_try.svg')
def __init__(self, **kwargs): self.chart = pygal.Funnel(**kwargs) self.chart.title = 'Recruitment Funnel'