/+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-04-26 04:24:59 UTC
  • Revision ID: git-v1:98b3765e15c0a4863a4c214020790ce8f6e2b036
Added priority to shape markers

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)
29
 
    chart.add_data([0, 100, 100, 0, 0])
30
 
    chart.add_data([0, 0, 100, 100, 0])
 
30
    chart = XYLineChart(settings.width, settings.height,
 
31
                        x_range=(0, 100), y_range=(0, 100))
 
32
    chart.add_data([10, 90, 90, 10, 10])
 
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()