Example #1
0
 def _add_plot_4(self):
     """ """
     try:
         app_tools.ToolManager().show_tool_by_name('Graph plotter') # Show tool if hidden.
         graphtool = app_tools.ToolManager().get_tool_by_name('Graph plotter')
         graphtool.clear_plot_data()
         # Filtered data should be used.
         self._main_activity.update_filter() # Must be done before create_filtered_dataset().
         analysisdata = self._analysisdata.create_filtered_dataset()
         if not analysisdata:
             return # Can't plot from empty dataset
         # Which parameter is selected?
         selectedparameter = str(self._parameter_list.currentText())
         # 
         plotdata = toolbox_utils.GraphPlotData(
                                 title = selectedparameter, 
                                 x_type = 'text',
                                 y_type = 'float',
                                 x_label = '',
                                 y_label = '')
         #
         self._add_plot_bbbbbbbbb(selectedparameter, analysisdata, plotdata)
         # Plot.
         graphtool.set_chart_selection(chart = 'Bar chart',
                                     combined = True, stacked = False, y_log_scale = False)
         graphtool.set_plot_data(plotdata)
         #
     except Exception as e:
         debug_info = self.__class__.__name__ + ', row  ' + str(sys._getframe().f_lineno)
         toolbox_utils.Logging().error('Exception: (' + debug_info + '): ' + str(e))
Example #2
0
 def __init__(self):
     """ """
     self._main_activity = None
     self._analysisdata = None
     super(AnalyseDatasetsTab6, self).__init__()
     #
     self._graph_plot_data = toolbox_utils.GraphPlotData()
     self._type_list_values = ["float", "integer", "text", "date", "datetime"]
    def _plot_graph(self):
        """ """
        try:
            # Show the Graph plotter tool if hidden.
            app_tools.ToolManager().show_tool_by_name('Graph plotter')
            graphtool = app_tools.ToolManager().get_tool_by_name(
                'Graph plotter')
            graphtool.clear_plot_data()
            # Filtered data should be used.
            self._main_activity.update_filter(
            )  # Must be done before create_filtered_dataset().
            analysisdata = self._analysisdata.create_filtered_dataset()
            if not analysisdata:
                return  # Can't create a report from an empty dataset.
            # Which parameter is selected?
            selectedparameter = str(self._parameter_list.currentText())
            # Split by.
            split_on_year = self._splitby_year_checkbox.isChecked()
            split_on_season = self._splitby_season_checkbox.isChecked()
            split_on_month = self._splitby_month_checkbox.isChecked()
            split_on_station = self._splitby_station_checkbox.isChecked()
            split_on_visit = self._splitby_visit_checkbox.isChecked()
            split_on_depth = self._splitby_depth_checkbox.isChecked()
            split_on_taxon = self._splitby_taxon_checkbox.isChecked()
            # Graph data.
            self._graph_plot_data = toolbox_utils.GraphPlotData(
                title=selectedparameter, y_type='float', y_label='')
            # Create subplots.
            self._extract_plot_values(analysisdata, selectedparameter,
                                      split_on_year, split_on_season,
                                      split_on_month, split_on_station,
                                      split_on_visit, split_on_depth,
                                      split_on_taxon)
            # View in the graph-plot tool.
            graphtool.set_chart_selection(chart='Boxplot chart',
                                          combined=True,
                                          stacked=False,
                                          y_log_scale=False)
            graphtool.set_plot_data(self._graph_plot_data)

        #
        except Exception as e:
            debug_info = self.__class__.__name__ + ', row  ' + str(
                sys._getframe().f_lineno)
            toolbox_utils.Logging().error('Exception: (' + debug_info + '): ' +
                                          str(e))