Giter Site home page Giter Site logo

pygooglechart's Introduction

No Maintenance Intended

Project Abandoned

Many apologies. I've stopped maintaining this project due to personal time constraints.

I'm happy to forward users to any new forks, or to discuss PyPI ownership.

Python Google Chart

pygooglechart is a complete Python wrapper for the Google Chart API.

pygooglechart works with Linux, Windows and Mac OS X.

Example

from pygooglechart import PieChart3D

# Create a chart object of 250x100 pixels
chart = PieChart3D(250, 100)

# Add some data
chart.add_data([20, 10])

# Assign the labels to the pie data
chart.set_pie_labels(['Hello', 'World'])

# Print the chart URL
print chart.get_url()

# Download the chart
chart.download('pie-hello-world.png')

There are more examples in the examples directory.

Installation

There are a few ways of installing it from source:

If you have setuptools installed, simply run the following:

easy_install pygooglechart

Or get the sources and run:

python setup.py install

pygooglechart's People

Contributors

chrismgray avatar ddoskind avatar ecarreras avatar gak avatar grahamu avatar hacst avatar wolph avatar yakky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pygooglechart's Issues

QR code creation fails when using / characters (as in a URL)

I wrote an incredibly simple program to input text and URLs from a file, parsed by the program, passed to pygooglechart, and then downloaded.

upon encountering a text file with a 'forward slash', the program crashes, apparently recognizing the text as a unix file path.

My program code:

!/usr/bin/python

import os
import math
import sys
from pygooglechart import QRChart
ROOT = os.path.dirname(os.path.abspath(file))
sys.path.insert(0, os.path.join(ROOT, '..'))
text_file = open("urls.txt", "r")
lines = text_file.readlines()
print lines
print len(lines)
for line in lines:
print line
# Chart size
chart = QRChart(400,400)
# Chart text
chart.add_data(line)
# Set level of error correction, and 0 pixel margin
chart.set_ec('H',0)
# Download final image
chart.download(line +".png")
text_file.close()

Incorrect argument in raise

By Daniel Romaniuk on https://groups.google.com/d/topic/pygooglechart/SHVd8jKkSUI/discussion

I noticed what appear to be two small errors in the script. In the
following two functions:

def set_axis_positions(self, axis_index, positions):
..................
raise InvalidParametersException('Axis index %i has not
been '
'created' % axis)

def set_axis_style(self, axis_index, colour, font_size=None,
alignment=None):
...................
raise InvalidParametersException('Axis index %i has not
been '
'created' % axis)

I think you mean
% axis_index)
instead of
% axis)
as axis is not defined at that point in the program.

Can't install pygooglechart via pip

$ pip install pygooglechart
Downloading/unpacking pygooglechart
HTTP error 403 while getting http://pygooglechart.slowchop.com/files/download/pygooglechart-0.3.0.tar.gz (from https://pypi.python.org/simple/pygooglechart/)
Could not install requirement pygooglechart because of HTTP error HTTP Error 403: Forbidden for URL http://pygooglechart.slowchop.com/files/download/pygooglechart-0.3.0.tar.gz (from https://pypi.python.org/simple/pygooglechart/)

It is really strange that I can not install pygooglechart via pip (pypi)

I've tried to open the link directly in browser
http://pygooglechart.slowchop.com/files/download/pygooglechart-0.3.0.tar.gz

it can be opened very well. Is there anything wrong with your server setup? cause pip is trying to fetch the package through your server but gets an 403 error.

Pie chart labels not appearing

When creating a pie chart and using the url to display the image on a site, the chart labels do not appear in the image.

400 Bad Request in 0.4.0

I am getting 400 errors on charts generated through 0.4.0 which were not there under 0.3.0.

It looks to be related to the subdomain change from chart.apis.google.com to www.google.com. I can resolve by switching the BASE URL back to chart.apis...

Not really sure why this is a problem though?

Thanks

Adding missing value (__)

It looks that it is not possible now - mix '_' or '__' as a symbol of missing value with integers in .add_data.

Fails to install on Python 3

On Mac OS X 10.8, when attempting to install via pip for Python 3:

  $ /Library/Frameworks/Python.framework/Versions/3.2/bin/pip-3.2 install pygooglechart

I get the following error:

Downloading/unpacking pygooglechart
  Real name of requirement pygooglechart is pygooglechart
  Downloading pygooglechart-0.3.0.tar.gz
  Running setup.py egg_info for package pygooglechart
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/Users/oubiwann/lab/game/coin-toss/build/pygooglechart/setup.py", line 3, in <module>
        from pygooglechart import __version__
      File "pygooglechart.py", line 26, in <module>
        import urllib2
    ImportError: No module named urllib2
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/Users/oubiwann/lab/game/coin-toss/build/pygooglechart/setup.py", line 3, in <module>

    from pygooglechart import __version__

  File "pygooglechart.py", line 26, in <module>

    import urllib2

ImportError: No module named urllib2

POST requests

Stefan Hacker has created a patch to allow the POST method:

def download(self, file_name, use_post = False):

I default disabled it to make sure this does not break anything for existing software (Afaik there's no downside to always using POST when compared to GET and there shouldn't be any regressions but who knows. I didn't do to much testing).

Here is a bit of sample code demonstrating the new capability:

from pygooglechart import SimpleLineChart
from random import randrange
c = SimpleLineChart(1000,300, y_range=(0,100))
c.add_data([randrange(100) for i in range(100)])
c.download('test100get.png') # Works
c.download('test100post.png', use_post = True) # Identical to line above

c = SimpleLineChart(1000,300, y_range=(0,100))
c.add_data([randrange(100) for i in range(2000)])
c.download('test2000get.png') # Fails
c.download('test2000post.png', use_post = True) # Works as intended

Setting slice text on pie charts

Setting the slice text on pie charts (supported in the Google API via the pieSliceText option) doesn't appear to be supported. Any plans to do so?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.