code: def _scale_x_values_timestamps(self, values, max_width):
          '''Scale X values to new width based on timestamps'''
          first_timestamp = float(values[0][0])
          last_timestamp = float(values[-1][0])
          step_size = (last_timestamp - first_timestamp) / max_width
  
          values_by_column = [[] for i in range(max_width)]
          for timestamp, value in values:
              if value is None:
                  continue
              timestamp = float(timestamp)
              column = (timestamp - first_timestamp) // step_size
              column = int(min(column, max_width - 1))  # Don't go beyond the last column
              values_by_column[column].append(value)
  
          adjusted_values = [statistics.mean(values) if values else 0 for values in values_by_column]  # Average each column, 0 if no values
  
          return adjusted_valuef _scale_x_values_timestamps(self, values, max_width):
          '''Scale X values to new width based on timestamps'''
          first_timestamp = float(values[0][0])
          last_timestamp = float(values[-1][0])
          step_size = (last_timestamp - first_timestamp) / max_width
  
          values_by_column = [[] for i in range(max_width)]
          for timestamp, value in values:
              if value is None:
                  continue
              timestamp = float(timestamp)
              column = (timestamp - first_timestamp) // step_size
              column = int(min(column, max_width - 1))  # Don't go beyond the last column
              values_by_column[column].append(value)
  
          adjusted_values = [statistics.mean(values) if values else 0 for values in values_by_column]  # Average each column, 0 if no values
  
          return adjusted_values
docs: Scale X values to new width based on timestamps