Ejemplo n.º 1
0
    def _show_plot(self, data):
        cd = dict(padding=5, stack_order="top_to_bottom")
        csnames = self.column_names
        xmin = np.Inf
        xmax = -np.Inf

        if self.as_series:
            g = RegressionGraph(container_dict=cd)
            p = g.new_plot(padding=[50, 5, 5, 50], xtitle="")
            p.value_range.tight_bounds = False
            p.value_range.margin = 0.1
        else:
            g = StackedRegressionGraph(container_dict=cd)

        regressable = False
        #        metadata = None
        for i, csi in enumerate(self.data_selectors):
            if not self.as_series:
                p = g.new_plot(padding=[50, 5, 5, 50])
                p.value_range.tight_bounds = False
                p.value_range.margin = 0.1
                plotid = i
            else:
                plotid = 0

            try:
                x = data[csnames.index(csi.index)]
                y = data[csnames.index(csi.value)]
                xmin = min(xmin, min(x))
                xmax = max(xmax, max(x))
                fit = csi.fit if csi.fit != NULL_STR else None
                g.new_series(x, y, fit=fit, filter_outliers=csi.use_filter, type=csi.plot_type, plotid=plotid)

                g.set_x_title(csi.index, plotid=plotid)
                g.set_y_title(csi.value, plotid=plotid)
                if fit:
                    regressable = True

            except IndexError:
                pass

        g.set_x_limits(xmin, xmax, pad="0.1")

        self._graph_count += 1
        if regressable:
            gg = StatsGraph(graph=g)
            gii = gg
        else:
            gii = g

        g._update_graph()

        def show(gi):
            gi.window_title = "{} Graph {}".format(self.short_name, self._graph_count)
            gi.window_x = self._graph_count * 20 + 400
            gi.window_y = self._graph_count * 20 + 20
            gi.edit_traits()

        show(gii)
Ejemplo n.º 2
0
    def _show_plot(self, data):
        cd = dict(padding=5, stack_order='top_to_bottom')
        csnames = self.column_names
        xmin = np.Inf
        xmax = -np.Inf

        if self.as_series:
            g = RegressionGraph(container_dict=cd)
            p = g.new_plot(padding=[50, 5, 5, 50],
                           xtitle=''
            )
            p.value_range.tight_bounds = False
            p.value_range.margin = 0.1
        else:
            g = StackedRegressionGraph(container_dict=cd)

        regressable = False
        #        metadata = None
        for i, csi in enumerate(self.data_selectors):
            if not self.as_series:
                p = g.new_plot(padding=[50, 5, 5, 50])
                p.value_range.tight_bounds = False
                p.value_range.margin = 0.1
                plotid = i
            else:
                plotid = 0

            try:
                x = data[csnames.index(csi.index)]
                y = data[csnames.index(csi.value)]
                xmin = min(xmin, min(x))
                xmax = max(xmax, max(x))
                fit = csi.fit if csi.fit != NULL_STR else None
                g.new_series(x, y, fit=fit,
                             filter_outliers=csi.use_filter,
                             type=csi.plot_type,
                             plotid=plotid)

                g.set_x_title(csi.index, plotid=plotid)
                g.set_y_title(csi.value, plotid=plotid)
                if fit:
                    regressable = True

            except IndexError:
                pass

        g.set_x_limits(xmin, xmax, pad='0.1')

        self._graph_count += 1
        if regressable:
            gg = StatsGraph(graph=g)
            gii = gg
        else:
            gii = g

        g._update_graph()

        def show(gi):
            gi.window_title = '{} Graph {}'.format(self.short_name, self._graph_count)
            gi.window_x = self._graph_count * 20 + 400
            gi.window_y = self._graph_count * 20 + 20
            gi.edit_traits()

        show(gii)