Exemplo n.º 1
0
    def refresh(self, from_date=None):
        (total, low, normal, high) = self.get_data(from_date=from_date)

        self.ax.clear()
        self.ax.pie([low, high, normal],
                    labels=[format_as_percent(low, total, 'Lows {}',
                                              low),
                            format_as_percent(high, total, 'Highs {}',
                                              high),
                            format_as_percent(normal,
                                              total, 'Normal {}',
                                              normal)],

                    colors=['orange', 'red', 'green'], shadow=True,
                    explode=(0, 0, 0.2))

        self.ax.set_title(self.title)
        self.figure.canvas.draw_idle()
Exemplo n.º 2
0
    def __init__(self, from_date=None):
        Plot.__init__(self)

        (total, low, normal, high) = self.get_data(from_date=from_date)

        ax = self.figure.add_subplot(111, aspect='equal', axisbg="white")
        ax.set_axis_bgcolor('red')

        ax.pie([low, high, normal],
               labels=[format_as_percent(low, total, 'Lows {}',
                                         low),
                       format_as_percent(high, total, 'Highs {}',
                                         high),
                       format_as_percent(normal,
                                         total, 'Normal {}',
                                         normal)],

               colors=['orange', 'red', 'green'], shadow=True,
               explode=(0, 0, 0.2))

        ax.set_title(self.title)
        ax.plot()

        self.ax = ax