def _AnomalySegmentSeries(change_points):
  """Makes a list of data series for showing segments next to anomalies.

  Args:
    change_points: A list of find_change_points.ChangePoint objects.

  Returns:
    A list of data series (lists of pairs) to be graphed by Flot.
  """
  # We make a separate series for each anomaly, since segments may overlap.
  anomaly_series_list = []

  for change_point in change_points:
    anomaly_series = []

    # In a Flot data series, null is treated as a special value which
    # indicates a discontinuity. We want to end each segment with null
    # so that they show up as separate segments on the graph.
    anomaly_series.append([change_point.window_start, None])

    for x in range(change_point.window_start + 1, change_point.x_value):
      anomaly_series.append([x, change_point.median_before])
    anomaly_series.append([change_point.x_value, None])

    for x in range(change_point.x_value + 1, change_point.window_end + 1):
      anomaly_series.append([x, change_point.median_after])
    anomaly_series.append([change_point.window_end, None])
    anomaly_series_list.append(anomaly_series)

  return anomaly_series_list