/+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 examples/line.py

  • Committer: gak
  • Date: 2008-05-03 07:30:58 UTC
  • Revision ID: git-v1:9342edb8666dde7e843e3eb438f1f6a717aa32fc
- Really added initial unit tests
- Converted setup.py to unix file format
- warnings made when data is being clipped and when data scaling is incorrect
- max_value is now a variable
- pie and google-o-meter chart data is now on the x-axis
- More grammar work

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 
10
10
from pygooglechart import SimpleLineChart
11
11
from pygooglechart import XYLineChart
 
12
from pygooglechart import SparkLineChart
12
13
 
13
14
import settings
14
15
import helper
15
16
 
16
17
def simple_random():
17
 
    chart = SimpleLineChart(settings.width, settings.height)
 
18
    chart = SimpleLineChart(settings.width, settings.height, y_range=(0, 100))
18
19
    chart.add_data(helper.random_data())
19
20
    chart.download('line-simple-random.png')
20
21
 
21
22
def xy_random():
22
 
    chart = XYLineChart(settings.width, settings.height)
 
23
    chart = XYLineChart(settings.width, settings.height,
 
24
                        x_range=(0, 100), y_range=(0, 100))
23
25
    chart.add_data(helper.random_data())
24
26
    chart.add_data(helper.random_data())
25
27
    chart.download('line-xy-random.png')
26
28
 
27
29
def xy_rect():
28
 
    chart = XYLineChart(settings.width, settings.height)
 
30
    chart = XYLineChart(settings.width, settings.height,
 
31
                        x_range=(0, 100), y_range=(0, 100))
29
32
    chart.add_data([10, 90, 90, 10, 10])
30
33
    chart.add_data([10, 10, 90, 90, 10])
31
34
    chart.download('line-xy-rect.png')
32
35
 
33
36
def xy_circle():
34
 
    chart = XYLineChart(settings.width, settings.height)
 
37
    chart = XYLineChart(settings.width, settings.height,
 
38
                        x_range=(0, 100), y_range=(0, 100))
35
39
    steps = 40
36
40
    xradius = 25
37
41
    yradius = 45
47
51
    chart.add_data(ylist)
48
52
    chart.download('line-xy-circle.png')
49
53
 
 
54
def sparklines():
 
55
    chart = SparkLineChart(settings.width, settings.height)
 
56
    chart.add_data(helper.random_data())
 
57
    chart.download('line-sparkline.png')
 
58
 
50
59
def main():
51
60
    simple_random()
52
61
    xy_random()
53
62
    xy_rect()
54
63
    xy_circle()
 
64
    sparklines()
55
65
 
56
66
if __name__ == '__main__':
57
67
    main()