- Timestamp:
- 10/28/08 16:28:25 (4 years ago)
- Location:
- trunk
- Files:
-
- 8 modified
-
examples/scatterchart.py (modified) (1 diff)
-
setup.py (modified) (1 diff)
-
src/bar.py (modified) (1 diff)
-
tests/bar.py (modified) (2 diffs)
-
tests/chart.py (modified) (10 diffs)
-
tests/color.py (modified) (3 diffs)
-
tests/line.py (modified) (1 diff)
-
tests/pie.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/scatterchart.py
r85 r112 28 28 surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 400, 200) 29 29 30 30 31 31 dataSet = ( 32 32 ('points', [(i, random.random() * 100.0) for i in range(100)]), -
trunk/setup.py
r91 r112 35 35 license="LGPL 3", 36 36 keywords="chart cairo", 37 packages=['pycha' ],38 package_dir={'pycha': 'src' },37 packages=['pycha', 'chavier'], 38 package_dir={'pycha': 'src', 'chavier': 'chavier'}, 39 39 url='http://www.lorenzogil.com/projects/pycha/', 40 40 # if would be nice if pycairo would have an egg (sigh) -
trunk/src/bar.py
r109 r112 87 87 cx.set_source_rgb(*self.options.colorScheme[bar.name]) 88 88 cx.fill_preserve() 89 89 90 90 if not self.options.stroke.hide: 91 91 cx.set_source_rgb(*hex2rgb(self.options.stroke.color)) -
trunk/tests/bar.py
r109 r112 170 170 self.assertAlmostEqual(ch.yticks[i][0], yticks[i][0], 4) 171 171 self.assertAlmostEqual(ch.yticks[i][1], yticks[i][1], 4) 172 172 173 173 def test_udpateTicksWithNegatives(self): 174 174 surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 500, 500) … … 244 244 ('dataset1', ([0, -3], [1, -1], [2, 3], [3, 5])), 245 245 ) 246 246 247 247 ch = pycha.bar.HorizontalBarChart(surface) 248 248 ch.addDataset(dataset) -
trunk/tests/chart.py
r109 r112 23 23 24 24 class FunctionsTests(unittest.TestCase): 25 25 26 26 def test_uniqueIndices(self): 27 27 arr = (range(10), range(5), range(20), range(30)) … … 38 38 39 39 class AreaTests(unittest.TestCase): 40 40 41 41 def test_area(self): 42 42 area = pycha.chart.Area(10, 20, 100, 300) … … 50 50 51 51 class OptionTests(unittest.TestCase): 52 52 53 53 def test_options(self): 54 54 opt = pycha.chart.Option(a=1, b=2, c=3) … … 70 70 # new attributes not present in original option are not merged 71 71 self.assertRaises(AttributeError, getattr, opt.c, 'f') 72 72 73 73 opt.merge(pycha.chart.Option(a=10, b=20)) 74 74 self.assertEqual(opt.a, 10) … … 76 76 77 77 class ChartTests(unittest.TestCase): 78 78 79 79 def test_init(self): 80 80 ch = pycha.chart.Chart(None) … … 93 93 self.assertEqual(ch.yticks, []) 94 94 self.assertEqual(ch.options, pycha.chart.DEFAULT_OPTIONS) 95 95 96 96 def test_datasets(self): 97 97 ch = pycha.chart.Chart(None) … … 104 104 self.assertEqual(ch._getDatasetsValues(), 105 105 [d1[1], d2[1], d3[1]]) 106 106 107 107 def test_options(self): 108 108 ch = pycha.chart.Chart(None) … … 144 144 ch = pycha.chart.Chart(None, {'colorScheme': (0.0, 0.0, 0.0)}) 145 145 self.assertRaises(TypeError, ch._setColorscheme) 146 146 147 147 def test_updateXY(self): 148 148 surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 500, 500) … … 166 166 self.assertEqual(ch.yrange, 4) 167 167 self.assertEqual(ch.yscale, 1/4.0) 168 169 168 # TODO: test with different options (axis.range, ...) 170 169 … … 207 206 self.assertAlmostEqual(ch.yticks[1][0], 2/3.0, 4) 208 207 self.assertAlmostEqual(ch.yticks[2][0], 1/3.0, 4) 209 208 210 209 def test_abstractChart(self): 211 210 ch = pycha.chart.Chart(None) -
trunk/tests/color.py
r85 r112 87 87 def test_autoLighting(self): 88 88 """This test ensures that the colors don't get to white too fast. 89 89 90 90 See bug #8. 91 91 """ … … 95 95 color = '#ff0000' 96 96 scheme = pycha.color.generateColorscheme(color, keys) 97 97 98 98 # ensure that the last color is not completely white 99 99 color = scheme[n-1] … … 101 101 self.assertNotAlmostEqual(color[1], 1.0, 4) 102 102 self.assertNotAlmostEqual(color[2], 1.0, 4) 103 103 104 104 def test_suite(): 105 105 return unittest.TestSuite(( -
trunk/tests/line.py
r109 r112 23 23 24 24 class PointTests(unittest.TestCase): 25 25 26 26 def test_point(self): 27 27 point = pycha.line.Point(2, 3, 1.0, 2.0, "test") -
trunk/tests/pie.py
r110 r112 123 123 ('dataset2', 'dataset2 (20.0%)'), 124 124 ('dataset3', 'dataset3 (70.0%)')]) 125 126 125 127 126
