def _GetPlotData(chart_series, anomaly_points, anomaly_segments):
  """Returns data to embed on the front-end for the chart.

  Args:
    chart_series: A series, i.e. a list of (index, value) pairs.
    anomaly_points: A series which contains the list of points where the
        anomalies were detected.
    anomaly_segments: A list of series, each of which represents one segment,
        which is a horizontal line across a range of values used in finding
        an anomaly.

  Returns:
    A list of data series, in the format accepted by Flot, which can be
    serialized as JSON and embedded on the page.
  """
  data = [
      {
          'data': chart_series,
          'color': '#666',
          'lines': {'show': True},
          'points': {'show': False},
      },
      {
          'data': anomaly_points,
          'color': '#f90',
          'lines': {'show': False},
          'points': {'show': True, 'radius': 4}
      },
  ]
  for series in anomaly_segments:
    data.append({
        'data': series,
        'color': '#f90',
        'lines': {'show': True},
        'points': {'show': False},
    })
  return data