/+junk/pygooglechart-py3k

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/pygooglechart-py3k

« back to all changes in this revision

Viewing changes to pygooglechart.py

  • Committer: gak
  • Date: 2007-12-09 07:18:39 UTC
  • Revision ID: git-v1:3303a4ec6195ace1a8fa77910dffcc147585a972
small changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""
 
2
PyGoogleChart - A Python wrapper for the Google Chart API
 
3
 
 
4
http://pygooglechart.slowchop.com/
 
5
 
 
6
Copyright 2007 Gerald Kaszuba
 
7
 
 
8
This program is free software: you can redistribute it and/or modify
 
9
it under the terms of the GNU General Public License as published by
 
10
the Free Software Foundation, either version 3 of the License, or
 
11
(at your option) any later version.
 
12
 
 
13
This program is distributed in the hope that it will be useful,
 
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
GNU General Public License for more details.
 
17
 
 
18
You should have received a copy of the GNU General Public License
 
19
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
20
 
 
21
"""
 
22
 
1
23
import os
2
24
import urllib
3
25
import math
226
248
            url_bits.append(self.markers_to_url())
227
249
        return url_bits
228
250
 
 
251
    # Downloading
 
252
    # -------------------------------------------------------------------------
 
253
    def download_graph(self, file_name):
 
254
        open(file_name, 'wb').write(urllib.urlopen(self.get_url()).read())
 
255
 
229
256
    # Simple settings
230
257
    # -------------------------------------------------------------------------
231
258
 
391
418
    # -------------------------------------------------------------------------
392
419
 
393
420
    def markers_to_url(self):
394
 
        print 'chm=%s' % '|'.join([ ','.join(a) for a in self.markers ])
395
421
        return 'chm=%s' % '|'.join([ ','.join(a) for a in self.markers ])
396
422
 
397
423
    def add_marker(self, index, point, marker_type, colour, size):
573
599
 
574
600
    chart.add_fill_simple('303030A0')
575
601
 
 
602
    chart.download_graph('test.png')
 
603
 
576
604
    url = chart.get_url()
577
605
    print url
578
606
    if 0: