(self, size, bardata)
return widths
Return a list of bar widths, one for each bar in data.

        If self.bar_width is None this implementation will stretch
        the bars across the available space specified by maxcol.
Return a list of bar widths, one for each bar in data.
Return a list of bar widths one for each bar in data .
def calculate_bar_widths(self, size, bardata):
        """
        Return a list of bar widths, one for each bar in data.

        If self.bar_width is None this implementation will stretch
        the bars across the available space specified by maxcol.
        """
        (maxcol, _) = size

        if self.bar_width is not None:
            return [self.bar_width] * min(
                len(bardata), int(maxcol / self.bar_width))

        if len(bardata) >= maxcol:
            return [1] * maxcol

        widths = []
        grow = maxcol
        remain = len(bardata)
        for _ in bardata:
            w = int(float(grow) / remain + 0.5)
            widths.append(w)
            grow -= w
            remain -= 1
        return widths
def calculate_bar_widths ( self , size , bardata ) : ( maxcol , _ ) = size if self . bar_width is not None : return [ self . bar_width ] * min ( len ( bardata ) , int ( maxcol / self . bar_width ) ) if len ( bardata ) >= maxcol : return [ 1 ] * maxcol widths = [ ] grow = maxcol remain = len ( bardata ) for _ in bardata : w = int ( float ( grow ) / remain + 0.5 ) widths . append ( w ) grow -= w remain -= 1 return widths