Ticket #9: bar-1-item.diff

File bar-1-item.diff, 0.9 kB (added by jae@…, 4 years ago)

patch for bar.py - fix for 1 item bar chart

  • bar.py

     
    3131        """Evaluates measures for vertical bars""" 
    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 
    3736        if len(uniqx) == 1: 
     
    4241            self.barWidthForSet = barWidth / len(stores) 
    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 
    4748            self.barWidthForSet = barWidth / len(stores)