Package GChartWrapper :: Module GChart'
[hide private]
[frames] | no frames]

Module GChart'

source code

GChartWrapper - Google Chart API Wrapper

The wrapper can render the URL of the Google chart based on your parameters. With the chart you can render an HTML img tag to insert into webpages on the fly, show it directly in a webbrowser, or save the chart PNG to disk. New versions can generate PIL PngImage instances.

Example

>>> G = GChart('lc',['simpleisbetterthancomplexcomplexisbetterthancomplicated'])
>>> G.title('The Zen of Python','00cc00',36)
>>> G.color('00cc00')
>>> str(G)
'http://chart.apis.google.com/chart?
    chd=e:simpleisbetterthancomplexcomplexisbetterthancomplicated
    &chs=300x150
    &cht=lc
    &chtt=The+Zen+of+Python'    
>>> G.image() # PIL instance
<PngImagePlugin.PngImageFile instance at ...>
>>> 1#G.show() # Webbrowser open
True
>>> G.save('tmp.png') # Save to disk
'tmp.png'

See tests.py for unit test and other examples

Classes [hide private]
Axes
Axes attribute dictionary storage
Bubble
GChart
Main chart class
HorizontalBarGroup
HorizontalBarStack
Line
LineXY
Map
Meter
Note
Pie
Pie3D
PieC
Pin
QRCode
Radar
RadarSpline
Scatter
Sparkline
Text
Venn
VerticalBarGroup
VerticalBarStack
_AbstractGChart
Functions [hide private]
 
color_args(args, *indexes)
Color a list of arguments on particular indexes
source code
 
lookup_color(color)
Returns the hex color for any valid css color name
source code
Variables [hide private]
  APIPARAMS = ('chxtc', 'chxt', 'chxp', 'chxs', 'chxr', 'chco', ...
  APIURL = 'http://chart.apis.google.com/chart?'
  BUBBLE_LICONS = ('beer', 'bike', 'car', 'house', 'petrol', 'sk...
  BUBBLE_SICONS = ('WC', 'WCfemale', 'WCmale', 'accomm', 'airpor...
  BUBBLE_TYPES = ('icon_text_small', 'icon_text_big', 'icon_text...
  COLOR_MAP = {'aliceblue': 'F0F8FF', 'antiquewhite': 'FAEBD7', ...
  GEO = ('africa', 'asia', 'europe', 'middle_east', 'south_ameri...
  IMGATTRS = ('title', 'alt', 'align', 'border', 'height', 'widt...
  LEGEND_POSITIONS = ('b', 't', 'r', 'l', 'bv', 'tv')
  MARKERS = 'acdostvVhxrRbBDF'
  NOTE_IMAGES = ('arrow_d', 'balloon', 'pinned_c', 'sticky_y', '...
  NOTE_TYPES = ('note_title', 'note', 'weather')
  NOTE_WEATHERS = ('clear-night-moon', 'cloudy-heavy', 'cloudy-s...
  PIN_ICONS = ('home', 'home', 'WC', 'WCfemale', 'WCmale', 'acco...
  PIN_SHAPES = ('pin', 'star', 'sleft', 'sright')
  PIN_TYPES = ('pin_letter', 'pin_icon', 'xpin_letter', 'xpin_ic...
  PY_VER = '2.x'
  TTAGSATTRS = ('label', 'title', 'color', 'line', 'grid', 'bar'...
  TYPES = ('bvs', 'p3', 'qr', 'lc', 'p', 'bhg', 'pc', 's', 'r', ...
Function Details [hide private]

color_args(args, *indexes)

source code 

Color a list of arguments on particular indexes

>>> c = color_args([None,'blue'], 1)
>>> c.next()
None
>>> c.next()
'0000FF'

lookup_color(color)

source code 

Returns the hex color for any valid css color name

>>> lookup_color('aliceblue')
'F0F8FF'

Variables Details [hide private]

APIPARAMS

Value:
('chxtc',
 'chxt',
 'chxp',
 'chxs',
 'chxr',
 'chco',
 'chtm',
 'chld',
...

BUBBLE_LICONS

Value:
('beer', 'bike', 'car', 'house', 'petrol', 'ski', 'snack')

BUBBLE_SICONS

Value:
('WC',
 'WCfemale',
 'WCmale',
 'accomm',
 'airport',
 'baby',
 'bar',
 'bicycle',
...

BUBBLE_TYPES

Value:
('icon_text_small', 'icon_text_big', 'icon_texts_big', 'texts_big')

COLOR_MAP

Value:
{'aliceblue': 'F0F8FF',
 'antiquewhite': 'FAEBD7',
 'aqua': '00FFFF',
 'aquamarine': '7FFFD4',
 'azure': 'F0FFFF',
 'beige': 'F5F5DC',
 'bisque': 'FFE4C4',
 'black': '000000',
...

GEO

Value:
('africa',
 'asia',
 'europe',
 'middle_east',
 'south_america',
 'usa',
 'world')

IMGATTRS

Value:
('title',
 'alt',
 'align',
 'border',
 'height',
 'width',
 'ismap',
 'longdesc',
...

NOTE_IMAGES

Value:
('arrow_d', 'balloon', 'pinned_c', 'sticky_y', 'taped_y', 'thought')

NOTE_WEATHERS

Value:
('clear-night-moon',
 'cloudy-heavy',
 'cloudy-sunny',
 'cloudy',
 'rain',
 'rainy-sunny',
 'snow',
 'snowflake',
...

PIN_ICONS

Value:
('home',
 'home',
 'WC',
 'WCfemale',
 'WCmale',
 'accomm',
 'airport',
 'baby',
...

PIN_TYPES

Value:
('pin_letter', 'pin_icon', 'xpin_letter', 'xpin_icon', 'spin')

TTAGSATTRS

Value:
('label',
 'title',
 'color',
 'line',
 'grid',
 'bar',
 'marker',
 'fill',
...

TYPES

Value:
('bvs',
 'p3',
 'qr',
 'lc',
 'p',
 'bhg',
 'pc',
 's',
...