8
ROOT = os.path.dirname(os.path.abspath(__file__))
9
sys.path.insert(0, os.path.join(ROOT, '..'))
11
from pygooglechart import SimpleLineChart
12
from pygooglechart import Axis
18
"""Cat proximity graph from http://xkcd.com/231/"""
19
chart = SimpleLineChart(int(settings.width * 1.5), settings.height)
20
chart.set_legend(['INTELLIGENCE', 'INSANITY OF STATEMENTS'])
23
data_index = chart.add_data([100. / y for y in xrange(1, 15)])
25
# insanity of statements
26
chart.add_data([100. - 100 / y for y in xrange(1, 15)])
29
chart.set_colours(['208020', '202080'])
31
# "Near" and "Far" labels, they are placed automatically at either ends.
32
near_far_axis_index = chart.set_axis_labels(Axis.BOTTOM, ['FAR', 'NEAR'])
34
# "Human Proximity to cat" label. Aligned to the center.
35
index = chart.set_axis_labels(Axis.BOTTOM, ['HUMAN PROXIMITY TO CAT'])
36
chart.set_axis_style(index, '202020', font_size=10, alignment=0)
37
chart.set_axis_positions(index, [50])
40
chart.download('label-cat-proximity.png')
43
chart = SimpleLineChart(settings.width, settings.height)
46
for axis_type in (Axis.LEFT, Axis.RIGHT, Axis.BOTTOM):
47
index = chart.set_axis_range(axis_type, 0, random.random() * 100)
48
chart.set_axis_style(index, colour=helper.random_colour(), \
49
font_size=random.random() * 10 + 5)
51
chart.add_data(helper.random_data())
52
chart.download('label-many.png')
58
if __name__ == '__main__':