- Timestamp:
- 03/20/08 05:52:06 (4 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
src/bar.py (modified) (2 diffs)
-
tests/bar.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bar.py
r73 r76 32 32 stores = self._getDatasetsValues() 33 33 uniqx = uniqueIndices(stores) 34 xdelta = min([abs(uniqx[j] - uniqx[j-1]) for j in range(1, len(uniqx))])35 34 36 35 barWidth = 0 … … 43 42 self.barMargin = (1.0 - self.options.barWidthFillFraction) / 2 44 43 else: 44 xdelta = min([abs(uniqx[j] - uniqx[j-1]) 45 for j in range(1, len(uniqx))]) 45 46 self.xscale = 1.0 / (self.xrange + 1) 46 47 barWidth = xdelta * self.xscale * self.options.barWidthFillFraction -
trunk/tests/bar.py
r73 r76 40 40 self.assertEqual(ch.bars, []) 41 41 self.assertEqual(ch.minxdelta, 0) 42 43 def test_updateChart(self): 44 surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 500, 500) 45 # An evil dataset with just one point. See bug #9 46 dataset = ( 47 ('dataset1', ([0, 0],)), 48 ) 49 ch = pycha.bar.BarChart(surface) 50 ch.addDataset(dataset) 51 ch._updateXY() 52 ch._updateChart() 53 54 self.assertEqual(ch.xscale, 1.0) 55 self.assertEqual(ch.minxval, 0) 56 self.assertAlmostEqual(ch.barWidthForSet, 0.75, 4) 57 self.assertAlmostEqual(ch.barMargin, 0.125, 4) 42 58 43 59 class VerticalBarTests(unittest.TestCase):
