1# Copyright(c) 2007-2010 by Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
2#
3# This file is part of PyCha.
4#
5# PyCha is free software: you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# PyCha is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU Lesser General Public License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public License
16# along with PyCha.  If not, see <http://www.gnu.org/licenses/>.
17
18import cairo
19
20import pycha.bar
21
22def testBar():
23    surface = cairo.SVGSurface("testsvg.svg", 500, 300)
24
25    options = {
26        'legend': {
27            'position': {
28                'left': 330
29                }
30            },
31        }
32
33    chart = pycha.bar.VerticalBarChart(surface, options)
34
35    dataSet = (
36        ('myFirstDataset', [[0, 1], [1, 1], [2, 1.414], [3, 1.73]]),
37        ('mySecondDataset', [[0, 0.3], [1, 2.67], [2, 1.34], [3, 1.73]]),
38        ('myThirdDataset', [[0, 0.46], [1, 1.45], [2, 2.5], [3, 1.2]]),
39        ('myFourthDataset', [[0, 0.86], [1, 0.83], [2, 3], [3, 1.73]]),
40    )
41
42    chart.addDataset(dataSet)
43    chart.render()
44
45    surface.flush()
46
47if __name__ == '__main__':
48    testBar()
49