Example #1
0
    def _add_line_plots(self, plot):
        """Adds curve line plots to the ChacoPlot"""

        line_plots = []
        for plot_config in self.line_plot_configs:
            line_plot = ChacoPlot(self._plot_data)

            # Customize text
            line_plot.trait_set(title=plot_config.title,
                                padding=75,
                                line_width=1)
            line_plot.x_axis.title = plot_config.x_label
            line_plot.y_axis.title = plot_config.y_label

            # Add pan and zoom tools
            line_plot.tools.append(PanTool(line_plot))
            line_plot.overlays.append(ZoomTool(line_plot))

            for name, kwargs in plot_config.line_config.items():
                line = line_plot.plot((f"x_line_{name}", f"y_line_{name}"),
                                      type="line",
                                      **kwargs)[0]
                self._sub_axes[f'{name}_line_plot'] = line

            line_plots.append(line_plot)

        container = GridPlotContainer(*line_plots,
                                      shape=self._grid_shape,
                                      spacing=(0, 0),
                                      valign='top',
                                      bgcolor="none")
        self._component = HPlotContainer(plot, container, bgcolor="none")
        self._line_plots = line_plots