예제 #1
0
    def _updateChart(self):
        """Evaluates measures for vertical bars"""
        super(StackedVerticalBarChart, self)._updateChart()

        accumulated_heights = {}
        for i, (name, store) in enumerate(self.datasets):
            for item in store:
                xval, yval = item
                x = ((xval - self.minxval) * self.xscale) + self.barMargin
                w = self.barWidth
                h = abs(yval) * self.yscale
                if yval > 0:
                    y = (1.0 - h) - self.origin
                else:
                    y = 1 - self.origin

                accumulated_height = accumulated_heights.setdefault(xval, 0)
                y -= accumulated_height
                accumulated_heights[xval] += h

                rect = Rect(x, y, w, h, xval, yval, name)

                if (0.0 <= rect.x <= 1.0) and (0.0 <= rect.y <= 1.0):
                    self.bars.append(rect)
예제 #2
0
    def _updateChart(self):
        """Evaluates measures for horizontal bars"""
        super(StackedHorizontalBarChart, self)._updateChart()

        accumulated_widths = {}
        for i, (name, store) in enumerate(self.datasets):
            for item in store:
                xval, yval = item
                y = ((xval - self.minxval) * self.xscale) + self.barMargin
                h = self.barWidth
                w = abs(yval) * self.yscale
                if yval > 0:
                    x = self.origin
                else:
                    x = self.origin - w

                accumulated_width = accumulated_widths.setdefault(xval, 0)
                x += accumulated_width
                accumulated_widths[xval] += w

                rect = Rect(x, y, w, h, xval, yval, name)

                if (0.0 <= rect.x <= 1.0) and (0.0 <= rect.y <= 1.0):
                    self.bars.append(rect)