/+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: 2008-04-26 04:02:25 UTC
  • Revision ID: git-v1:d8ec581c0346dccc323f2fff088fc3e3d346a0c1
Added Google-o-meter chart

Show diffs side-by-side

added added

removed removed

Lines of Context:
546
546
            data = self.data
547
547
        return repr(data_class(data))
548
548
 
 
549
    def annotated_data(self):
 
550
        for dataset in self.data:
 
551
            yield ('x', dataset)
 
552
 
549
553
    # Axis Labels
550
554
    # -------------------------------------------------------------------------
551
555
 
728
732
    def type_to_url(self):
729
733
        return 'cht=bhs'
730
734
 
731
 
    def annotated_data(self):
732
 
        for dataset in self.data:
733
 
            yield ('x', dataset)
734
735
 
735
736
class StackedVerticalBarChart(BarChart):
736
737
 
786
787
    def type_to_url(self):
787
788
        return 'cht=bhg'
788
789
 
789
 
    def annotated_data(self):
790
 
        for dataset in self.data:
791
 
            yield ('x', dataset)
792
 
 
793
790
 
794
791
class GroupedVerticalBarChart(GroupedBarChart):
795
792
 
851
848
    def type_to_url(self):
852
849
        return 'cht=r'
853
850
 
854
 
    def annotated_data(self):
855
 
        for dataset in self.data:
856
 
            yield ('x', dataset)
857
 
 
858
851
class SplineRadarChart(RadarChart):
859
852
 
860
853
    def type_to_url(self):
881
874
            url_bits.append('chld=%s' % ''.join(self.codes))
882
875
        return url_bits
883
876
 
884
 
    def annotated_data(self):
885
 
        for dataset in self.data:
886
 
            yield ('x', dataset)
 
877
 
 
878
class GoogleOMeterChart(PieChart):
 
879
    """Inheriting from PieChart because of similar labeling"""
 
880
 
 
881
    def type_to_url(self):
 
882
        return 'cht=gom'
 
883
 
887
884
 
888
885
def test():
889
886
    chart = PieChart2D(320, 200)
892
889
    chart = GroupedVerticalBarChart(320, 200)
893
890
    chart = SplineRadarChart(500, 500)
894
891
    chart = MapChart(440, 220)
 
892
    chart = GoogleOMeterChart(440, 220, x_range=(0, 100))
895
893
    sine_data = [math.sin(float(a) / math.pi) * 100 for a in xrange(100)]
896
894
    random_data = [random.random() * 100 for a in xrange(100)]
897
895
    random_data2 = [random.random() * 50 for a in xrange(100)]
916
914
#    chart.set_axis_positions(axis_bottom_index, [1, 25, 95])
917
915
#    chart.set_axis_style(axis_bottom_index, '003050', 15)
918
916
 
919
 
#    chart.set_pie_labels(('apples', 'oranges', 'bananas'))
 
917
    chart.set_pie_labels(('apples', 'oranges', 'bananas'))
920
918
 
921
919
#    chart.set_grid(10, 10)
922
920
#    for a in xrange(0, 100, 10):
927
925
 
928
926
#    chart.add_fill_simple('303030A0')
929
927
 
930
 
    chart.set_codes(['AU', 'AT', 'US'])
931
 
    chart.add_data([1,2,3])
932
 
    chart.set_colours(('EEEEEE', '000000', '00FF00'))
 
928
#    chart.set_codes(['AU', 'AT', 'US'])
 
929
#    chart.add_data([1,2,3])
 
930
#    chart.set_colours(('EEEEEE', '000000', '00FF00'))
 
931
 
 
932
    chart.add_data([50,75])
 
933
    chart.set_pie_labels(('apples', 'oranges'))
 
934
 
933
935
    url = chart.get_url()
934
936
    print url
935
937