Changeset 76 for trunk/src/bar.py

Show
Ignore:
Timestamp:
03/20/08 05:52:06 (4 years ago)
Author:
lgs
Message:

Make bar charts more robust by allowing datasets with just one point. Patch by jae_AT_zhar.net that fixes #9

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/bar.py

    r73 r76  
    3232        stores = self._getDatasetsValues() 
    3333        uniqx = uniqueIndices(stores) 
    34         xdelta = min([abs(uniqx[j] - uniqx[j-1]) for j in range(1, len(uniqx))]) 
    3534 
    3635        barWidth = 0 
     
    4342            self.barMargin = (1.0 - self.options.barWidthFillFraction) / 2 
    4443        else: 
     44            xdelta = min([abs(uniqx[j] - uniqx[j-1]) 
     45                          for j in range(1, len(uniqx))]) 
    4546            self.xscale = 1.0 / (self.xrange + 1) 
    4647            barWidth = xdelta * self.xscale * self.options.barWidthFillFraction