Archive for the ‘pygooglechart’ Category

Python Google Chart 0.2.1 released

I just released pygooglechart 0.2.1. It has several bug fixes and minor additions, but the major change is that it now supports QR codes. You can quite easily create a QR code with pygooglechart as you can see below.

from pygooglechart import QRChart

# Create a 125x125 QR code chart
chart = QRChart(125, 125)

# Add the text
chart.add_data('Hello, World!')

# "Level H" error correction with a 0 pixel margin
chart.set_ec('H', 0)

# Download
chart.download('qr-hello.png')

This will download a png from the URL:

http://chart.apis.google.com/chart?cht=qr&chs=125×125&chl=Hello%2C%20World%21&chld=H|0

The image downloaded looks like this:

QR codes are new to me. I’ve only seen a QR code on a bus stop advertisement once in Sydney but I’m sure more will pop up.

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • description
  • Reddit
  • StumbleUpon

Python Google Chart 0.2.0

I released pygooglechart 0.2.0 this afternoon after several months of patches coming in to add features and fix bugs. The main addition to pygooglechart is automatic data scaling, which is turned on by default. You can also specify the scale range manually:

chart = SimpleLineChart(width, height, x_range=(0, 100), y_range=(0, 100))

Other features are the new API chart types and options. There are 3 new chart types: Map, Google-o-Meter and Radar. Here is an example of using the Map chart type:

import pygooglechart as gc

chart = gc.MapChart(440, 220)
chart.set_colours(('AAAAAA', '30A030', 'A0C030'))
chart.set_codes(['AU', 'US', 'CA', 'BR', 'NZ'])
chart.add_data([1, 0.5, 0.7, 0.3, 0.1])
chart.download('map.png')

Produces the URL:
http://chart.apis.google.com/chart?cht=t&chs=440×220&chd=s:9frSG&chco=AAAAAA,30A030,A0C030&chtm=world&chld=AUUSCABRNZ

And the image:

The Google-o-meter has a funny name. Here is an example of its usage:

import pygooglechart as gc

chart = gc.GoogleOMeterChart(440, 220, y_range=(0, 10))
chart.set_pie_labels(['Awesome'])
chart.add_data([8])
chart.download('gom.png')

It produces this URL:
http://chart.apis.google.com/chart?cht=gom&chs=440×220&chd=s:x&chl=Awesome

And the image:

Well, have fun. Please write a ticket for any bugs, patches or feature requests you have.

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • description
  • Reddit
  • StumbleUpon

Release Update

Just a quick update. I have recently made some Python releases.

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • description
  • Reddit
  • StumbleUpon