Beispiel #1
0
 def plot_timeseries(self, graphing_library='matplotlib'):
     if graphing_library != 'matplotlib':
         return Metric.graph(self, graphing_library)
     else:
         logger.info(
             'Using graphing_library {lib} for metric {name}'.format(
                 lib=graphing_library, name=self.label))
         plot_data = {}
         # plot time series data for submetrics
         for out_csv in sorted(self.csv_files, reverse=True):
             csv_filename = os.path.basename(out_csv)
             # The last element is .csv, don't need that in the name of the chart
             column = csv_filename.split('.')[-2]
             transaction_name = ' '.join(csv_filename.split('.')[1:-2])
             plot = PD(input_csv=out_csv,
                       csv_column=1,
                       series_name=transaction_name,
                       y_label=self.sub_metric_description[column] + ' (' +
                       self.sub_metric_units[column] + ')',
                       precision=None,
                       graph_height=500,
                       graph_width=1200,
                       graph_type='line')
             if transaction_name in plot_data:
                 plot_data[transaction_name].append(plot)
             else:
                 plot_data[transaction_name] = [plot]
         for transaction in plot_data:
             graphed, div_file = Metric.graphing_modules[
                 graphing_library].graph_data(
                     plot_data[transaction], self.resource_directory,
                     self.resource_path, self.label + '.' + transaction)
             if graphed:
                 self.plot_files.append(div_file)
         return True
Beispiel #2
0
 def plot_timeseries(self, graphing_library='matplotlib'):
   if graphing_library != 'matplotlib':
    return Metric.graph(self, graphing_library)
   else:
     logger.info('Using graphing_library {lib} for metric {name}'.format(lib=graphing_library, name=self.label))
     plot_data = {}
     # plot time series data for submetrics
     for out_csv in sorted(self.csv_files, reverse=True):
       csv_filename = os.path.basename(out_csv)
       # The last element is .csv, don't need that in the name of the chart
       column = csv_filename.split('.')[-2]
       transaction_name = ' '.join(csv_filename.split('.')[1:-2])
       plot = PD(input_csv=out_csv, csv_column=1, series_name=transaction_name, y_label=self.sub_metric_description[column] + ' (' + self.sub_metric_units[column] + ')', precision=None, graph_height=500, graph_width=1200, graph_type='line')
       if transaction_name in plot_data:
         plot_data[transaction_name].append(plot)
       else:
         plot_data[transaction_name] = [plot]
     for transaction in plot_data:
       graphed, div_file = Metric.graphing_modules[graphing_library].graph_data(plot_data[transaction], self.resource_directory, self.resource_path, self.label + '.' + transaction )
       if graphed:
         self.plot_files.append(div_file)
     return True