pygal

RSS Feed

Pygal 1.4

Pygal 1.4.1 has been released with a lot of new features and bug fixes.

Changelog

box_plot = pygal.Box()
box_plot.title = 'V8 benchmark results'
box_plot.add('Chrome', [6395, 8212, 7520, 7218, 12464, 1660, 2123, 8607])
box_plot.add('Firefox', [7473, 8099, 11700, 2651, 6361, 1044, 3797, 9450])
box_plot.add('Opera', [3472, 2933, 4203, 5229, 5810, 1828, 9013, 4669])
box_plot.add('IE', [43, 41, 59, 79, 144, 136, 34, 102])
box_plot.render()
  • Quick css fix can now be inserted inline whithin the css chart option:
config = pygal.Config()
config.css.append('inline: path { stroke-dasharray: 15, 5, 10, 5; } .guide { stroke: none !important }')
chart = pygal.Radar(config)
chart.x_labels = 'one', 'two', 'three', 'four', 'five'
chart.add('red', [1, 2, 3, 1, 2])
chart.add('green', [4, 3, 2, 1, 2])
chart.render()
  • Parametric styles using color manipulation (Lighten, Darken, Saturate, Desaturate, Rotate) (see: Parametric styles):
bar = pygal.Bar(style=pygal.style.RotateStyle('#ff5995'))
for i in range(1, 15):
    bar.add('Serie %d' % i, i ** (1 / i))
bar.render()
stack = pygal.StackedLine(style=pygal.style.LightenStyle('#ff5995'), fill=True)
for i in range(1, 10):
    stack.add('Serie %d' % i, [i ** (1 / j) for j in range(1, 5)])
stack.render()
  • More customizations of the major axes concept, see major axes and a rewrite of the automatic major axes detection by liZe
  • Two french maps are now available:
fr_chart = pygal.FrenchMap_Departments(human_readable=True)
fr_chart.title = 'Population by department'
fr_chart.add('In 2011', {'01': 603827, '02': 541302, '03': 342729, '04': 160959, '05': 138605, '06': 1081244, '07': 317277, '08': 283110, '09': 152286, '10': 303997, '11': 359967, '12': 275813, '13': 1975896, '14': 685262, '15': 147577, '16': 352705, '17': 625682, '18': 311694, '19': 242454, '2A': 145846, '2B': 168640, '21': 525931, '22': 594375, '23': 122560, '24': 415168, '25': 529103, '26': 487993, '27': 588111, '28': 430416, '29': 899870, '30': 718357, '31': 1260226, '32': 188893, '33': 1463662, '34': 1062036, '35': 996439, '36': 230175, '37': 593683, '38': 1215212, '39': 261294, '40': 387929, '41': 331280, '42': 749053, '43': 224907, '44': 1296364, '45': 659587, '46': 174754, '47': 330866, '48': 77156, '49': 790343, '50': 499531, '51': 566571, '52': 182375, '53': 307031, '54': 733124, '55': 193557, '56': 727083, '57': 1045146, '58': 218341, '59': 2579208, '60': 805642, '61': 290891, '62': 1462807, '63': 635469, '64': 656608, '65': 229228, '66': 452530, '67': 1099269, '68': 753056, '69': 1744236, '70': 239695, '71': 555999, '72': 565718, '73': 418949, '74': 746994, '75': 2249975, '76': 1251282, '77': 1338427, '78': 1413635, '79': 370939, '80': 571211, '81': 377675, '82': 244545, '83': 1012735, '84': 546630, '85': 641657, '86': 428447, '87': 376058, '88': 378830, '89': 342463, '90': 143348, '91': 1225191, '92': 1581628, '93': 1529928, '94': 1333702, '95': 1180365, '971': 404635, '972': 392291, '973': 237549, '974': 828581, '976': 212645})
fr_chart.render()
from pygal.graph.frenchmap import aggregate_regions
fr_chart = pygal.FrenchMap_Regions(human_readable=True)
fr_chart.title = 'Population by region'
fr_chart.add('In 2011', aggregate_regions({'01': 603827, '02': 541302, '03': 342729, '04': 160959, '05': 138605, '06': 1081244, '07': 317277, '08': 283110, '09': 152286, '10': 303997, '11': 359967, '12': 275813, '13': 1975896, '14': 685262, '15': 147577, '16': 352705, '17': 625682, '18': 311694, '19': 242454, '2A': 145846, '2B': 168640, '21': 525931, '22': 594375, '23': 122560, '24': 415168, '25': 529103, '26': 487993, '27': 588111, '28': 430416, '29': 899870, '30': 718357, '31': 1260226, '32': 188893, '33': 1463662, '34': 1062036, '35': 996439, '36': 230175, '37': 593683, '38': 1215212, '39': 261294, '40': 387929, '41': 331280, '42': 749053, '43': 224907, '44': 1296364, '45': 659587, '46': 174754, '47': 330866, '48': 77156, '49': 790343, '50': 499531, '51': 566571, '52': 182375, '53': 307031, '54': 733124, '55': 193557, '56': 727083, '57': 1045146, '58': 218341, '59': 2579208, '60': 805642, '61': 290891, '62': 1462807, '63': 635469, '64': 656608, '65': 229228, '66': 452530, '67': 1099269, '68': 753056, '69': 1744236, '70': 239695, '71': 555999, '72': 565718, '73': 418949, '74': 746994, '75': 2249975, '76': 1251282, '77': 1338427, '78': 1413635, '79': 370939, '80': 571211, '81': 377675, '82': 244545, '83': 1012735, '84': 546630, '85': 641657, '86': 428447, '87': 376058, '88': 378830, '89': 342463, '90': 143348, '91': 1225191, '92': 1581628, '93': 1529928, '94': 1333702, '95': 1180365, '971': 404635, '972': 392291, '973': 237549, '974': 828581, '976': 212645}))
fr_chart.render()

Pygal 1.0.0

Time to become 1.0 !

Get it via PyPi.

Changelog

  • pygal is now python 2.6, 2.7, 3.2, 3.3 fully compatible without the use of 2to3.
  • pygal-js is now served from kozea.github.com/pygal.js to avoid mime type problems. (Remember to mirror these files on your server to speed up graph generation by setting the js config)
  • Secondary axes
chart = pygal.Line(title=u'Some different points')
chart.add('line', [.0002, .0005, .00035])
chart.add('other line', [1000, 2000, 7000], secondary=True)
chart.render()
  • New graph types:
    • DateY for date indexed XY charts
    • Worldmap for a beautifull worldmap
worldmap_chart = pygal.Worldmap()
worldmap_chart.title = 'Minimum deaths by capital punishement (source: Amnesty International)'
worldmap_chart.add('In 2012', {
  'af': 14,
  'bd': 1,
  'by': 3,
  'cn': 1000,
  'gm': 9,
  'in': 1,
  'ir': 314,
  'iq': 129,
  'jp': 7,
  'kp': 6,
  'pk': 1,
  'ps': 6,
  'sa': 79,
  'so': 6,
  'sd': 5,
  'tw': 6,
  'ae': 1,
  'us': 43,
  'ye': 28
})
worldmap_chart.render()

Pygal 0.13.0

Pygal 0.13.0 is out!

Get it via PyPi.

Changelog

  • Multiline titles
  • No data is now written like a normal chart (with title, legend, labels if any, ...)
  • Rewrite of bar drawing
  • Logarithmic scale is now supported in various charts (stackedbars, radar, ...)
  • New font size option for No data text
  • Minor style tweaks
  • Minor bug fixes

Pygal 0.12.1

Pygal 0.12.1 is out!

Get it via PyPi.

Changelog

  • Core rewrite of the instanciation mechanism. Now it works with ghost objects holding configuration and values. Those phantoms instanciate the real objects only when the render function is called. It simplifies a lot of code.
  • Support of label indexed values, ie:
chart = pygal.Bar()
chart.add('A', {'red': 10, 'green': 12, 'blue': 14})
chart.add('B', {'green': 11, 'red': 7})
chart.add('C', {'blue': 2, 'red': 13})
chart.x_labels = ('red', 'green', 'blue')
chart.render()
  • New config self description for cabaret
  • Minor fixes