Skip to content

Commit

Permalink
initial layout/goals for v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
justquick committed Jul 23, 2011
0 parents commit 693b5f4
Show file tree
Hide file tree
Showing 117 changed files with 5,552 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.svn
*.pyc
build/
dist/
.DS_Store
__pycache__
.tox
*.egg-info
9 changes: 9 additions & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Justin Quick <justquick@gmail.com>,
adunsmoor@gmail.com,
arthur.ledard@gmail.com,
BenBeecher@gmail.com,
markessien@gmail.com,
anedvedicky@gmail.com,
muanis@gmail.com,
mstamat@gmail.com,
javacasm@gmail.com
44 changes: 44 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
-- 1.0.0 --
Bug Fixes
Some backwards incompatable API and namespace changes including:
Module name moved from GChartWrapper to gchart
Charts are now found in gchart.charts
GChart class is renamed gchart.charts.BaseChart
Added microlevel version number for future bugfix only releases
Tox config to test Python versions 2.3-3.2
Sphinx Documentation
Nose Tests

-- 0.9 --
Switched to New BSD License


-- 0.8 --
Reverse functionality
>>> G = GChart.fromurl('http://chart.apis.google.com/chart?ch...')
<GChartWrapper.GChart instance at...>
Chaining fixes
Restuctured Axes functions
Centralized and added unittests
Enhanced unicode support
Demos pages w/ source code

-- 0.7 --
Full py3k compliance
Color name lookup from the css names: http://www.w3schools.com/css/css_colornames.asp
>>> G = Pie3D(range(1,5))
>>> G.color('green')
New charts Note,Text,Pin,Bubble
Updated Django templatetags to allow context inclusion and new charts
Added some more templating examples

-- 0.6 --
The wrapper now supports chaining
The old way:
>>> G = Pie3D(range(1,5))
>>> G.label('A','B','C','D')
>>> G.color('00dd00')
>>> print G
The new way with chaining
>>> print Pie3D(range(1,5)).label('A','B','C','D').color('00dd00')
New chart PieC for concentric pie charts
27 changes: 27 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright (c) 2009-2011, Justin Quick
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the authors nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
121 changes: 121 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
Google Chart Wrapper
======================


:Authors:
Justin Quick <justquick@gmail.com>,
adunsmoor@gmail.com,
arthur.ledard@gmail.com,
BenBeecher@gmail.com,
markessien@gmail.com,
anedvedicky@gmail.com,
muanis@gmail.com,
mstamat@gmail.com,
javacasm@gmail.com
:Version: 1.0

::

pip install google-chartwrapper==1.0.0
.. note:: For versions < 0.9, see `BaseChartWrapper @ Google Code <http://code.google.com/p/google-chartwrapper/>`_.

Second generation Python wrapper for the `Google Chart Image API <http://code.google.com/apis/chart/image/>`_.
Chart instances can render the URL of the actual Google chart and quickly insert into webpages on the fly or save images for later use.
Made for dynamic Python websites (Django, Zope, CGI, etc.) that need on the fly, dynamic chart image generation. Works for Python versions 2.3 to 3.2.

from gchart import Pie
Pie([5,10]).title('Hello Pie').color('red','lime').label('hello', 'world')

This generates a chart instance that can be rendered/saved in many ways. The most useful is display on a website

.. image:: http://chart.apis.google.com/chart?chco=ff0000,00ff00&chd=s:f9&chs=300x150&cht=p3&chl=hello|world&chtt=Hello%20Pie&.png

Requirements
--------------

- Python 2.3 to 3.2

Optional

- PIL (for PNG image manipulation)
- Nose and Tox (for testing)

Usage
--------

Construction
^^^^^^^^^^^^^^

The chart takes any iterable python data type (now including numpy arrays)
and does the encoding for you::
# Data sets
>>> dataset = (1, 2, 3)
# Also 2 dimensional
>>> dataset = [[3,4], [5,6], [7,8]]

Initialize the chart with a valid type (see API reference) and dataset::

# 3D Pie chart
>>> from gchart import BaseChart
>>> BaseChart('p3', dataset)
<BaseChart p3 (1, 2, 3)>
# Encoding (simple/text/extended)
>>> chart = BaseChart('p3', dataset, encoding='text')
# maxValue (for encoding values)
>>> chart = BaseChart('p3', dataset, maxValue=100)
# Size
>>> chart = BaseChart('p3', dataset, size=(300,150))
# OR directly pass in API parameters
>>> chart = BaseChart('p3', dataset, chtt='My Cool Chart', chl='A|B|C')


Rendering, Viewing and Saving
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The wrapper has many useful ways to take the URL of your chart and output it
into different formats like::

# URL of the actual Google chart
>>> chart.url
'http://chart.apis.google.com/chart?...'
# As an HTML <img> tag, keyword arguments will be added as tag attributes
>>> chart.img(height=500,id="chart")
'<img alt="" title="" src="http://chart.apis.google.com/chart?..." id="chart" height="500" >'
# Save chart to a file as PNG image, returns file name
>>> chart.save('my-cool-chart')
'my-cool-chart.png'
# Fetches the PngImageFile using the PIL module for image manipulation
>>> chart.image()
<PngImagePlugin.PngImageFile instance at 0xb795ee4c>
# Now that you have the image instance, the world is your oyster
# Try saving image as JPEG,GIF,etc.
>>> chart.image().save('my-cool-chart.jpg','JPEG')
# Show URL directly in your default web browser
>>> chart.show()
Examples
------------

See the `demo page <http://justquick.github.com/google-chartwrapper-demos/>`_ for tons of examples and source code


Testing
--------

Tests are located in ``gchart/tests.py`` and contributions are welcome.
To run the tests, simply execute ``nosetests`` in the source checkout.
If you have Tox installed and have the right Python environments setup,
you can test the module against them by running ``tox`` in the source checkout.


90 changes: 90 additions & 0 deletions doc_src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
DESTDIR = ..

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest

help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"

clean:
-rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DESTDIR)/docs
@echo
@echo "Build finished. The HTML pages are in $(DESTDIR)/docs."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."

json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/app.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/app.qhc"

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."

changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."

linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."

doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
Binary file added doc_src/_static/breadcrumb_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 693b5f4

Please sign in to comment.