def InlineLegend(chart):
  """Provide a legend for line charts by attaching labels to the right
  end of each line.  Supresses the regular legend.
  """
  show = False
  labels = []
  label_positions = []
  for series in chart.data:
    if series.label is None:
      labels.append('')
    else:
      labels.append(series.label)
      show = True
    label_positions.append(series.data[-1])

  if show:
    chart.right.min = chart.left.min
    chart.right.max = chart.left.max
    chart.right.labels = labels
    chart.right.label_positions = label_positions
    chart._show_legend = False  # Supress the regular legend.
Provide a legend for line charts by attaching labels to the right
  end of each line.  Supresses the regular legend.
  
mapreduce/lib/graphy/formatters.py