def DrawGuides(vf_time):
  """Draws guides showing the currently displayed interval at scale on
  the right side of the screen. Also draw a line backwards from the
  current time to the corresponding time on the right side interval.
  """
  pos = vf_time.GetPos()
  cur_time = vf_time.GetTime()
  interval = vf_time.GetInterval()
  interval_size = interval[1] - interval[0]
  max_interval = vf_time.GetMaxInterval()
  max_interval_size = max_interval[1] - max_interval[0]

  def _DrawGuideLine(timestamp, fmt, transparency=0.0):
    """Draws a guide line from current interval at 'timestamp' to the max
    interval.
    """
    left_ratio = float(timestamp - interval[0]) / interval_size
    left_y = int(iphone_dims[1] * (1.0 - left_ratio))
    right_ratio = float(timestamp - max_interval[0]) / (max_interval[1] - max_interval[0])
    right_y = int(iphone_dims[1] * (1.0 - right_ratio))
    line = [(pos[0], left_y), (iphone_dims[0], right_y)]
    DrawLine(line, line_color, 0.0)
    DrawLabel(datetime.fromtimestamp(timestamp).strftime(fmt),
              iphone_dims[0], right_y, text_color, font, 0.0)

  def _DrawHorizontalGuideLine(timestamp, fmt, transparency=0.0):
    """Draws a guide line from current interval at 'timestamp' to the max
    interval.
    """
    left_ratio = float(timestamp - interval[0]) / interval_size
    left_y = int(iphone_dims[1] * (1.0 - left_ratio))
    right_ratio = float(timestamp - max_interval[0]) / (max_interval[1] - max_interval[0])
    right_y = int(iphone_dims[1] * (1.0 - right_ratio))
    line = [(iphone_dims[0] - 60, right_y), (iphone_dims[0], right_y)]
    DrawLine(line, line_color, 0.0)
    DrawLabel(datetime.fromtimestamp(timestamp).strftime(fmt),
              iphone_dims[0]-60, right_y, text_color, font, 0.0)

  # Draw interval guide lines.
  [_DrawHorizontalGuideLine(x, '%b %d, %Y') for x in interval]
  _DrawHorizontalGuideLine(cur_time, '%b %d, %Y')

  interval = max_interval
  interval_size = max_interval[1] - max_interval[0]
  def _DrawIntervalTick(timestamp, fmt, transparency=0.0):
    """Draws a guide label with specified 'timestamp' and 'fmt'."""
    label = datetime.fromtimestamp(timestamp).strftime(fmt)
    ratio = float(timestamp - interval[0]) / interval_size
    x = iphone_dims[0]#max(min_tick_x_offset, pos[0])
    y = int(iphone_dims[1] * (1.0 - ratio))
    DrawLabel(label, x, y, text_color, font, transparency)

  # Draw ticks for days, months, & years.
  start = datetime.fromtimestamp(interval[0])
  end = datetime.fromtimestamp(interval[1])

  fade_interval = [60, 4]
  if interval_size < DAY * fade_interval[0]:
    transparency = max(0.0, (float(interval_size - DAY * fade_interval[1]) / DAY) / (fade_interval[0] - fade_interval[1]))
    cur = start.replace(hour=0, minute=0, second=0, microsecond=0)
    while cur < end:
      _DrawIntervalTick(time.mktime(cur.timetuple()), '%b %d, %Y', transparency)
      cur = cur + timedelta(days=1)

  fade_interval = [36, 12]
  if interval_size < MONTH * fade_interval[0]:
    transparency = max(0.0, (float(interval_size - MONTH * fade_interval[1]) / MONTH) / (fade_interval[0] - fade_interval[1]))
    cur = start.replace(day=1, hour=0, minute=0, second=0, microsecond=0)
    while cur < end:
      _DrawIntervalTick(time.mktime(cur.timetuple()), '%b %Y', transparency)
      cur = GetNextMonth(cur)

  # Draw years if there are possibly more than two displayed.
  if interval_size >= MONTH * 12:
    cur = start.replace(month=1, day=1, hour=0, minute=0, second=0, microsecond=0)
    while cur < end:
      _DrawIntervalTick(time.mktime(cur.timetuple()), '%Y')
      cur = cur.replace(year=cur.year + 1, month=1, day=1, hour=0, minute=0, second=0, microsecond=0)

  #DrawLabel(datetime.fromtimestamp(cur_time).strftime('%b %d, %Y'),
  #          pos[0], pos[1], cur_time_color, font, 0.0)
  # Draw max interval labels.
  #DrawLabel(datetime.fromtimestamp(max_interval[1]).strftime('%b %d, %Y'),
  #          iphone_dims[0], 0, text_color, font, 0.0)
  #DrawLabel(datetime.fromtimestamp(max_interval[0]).strftime('%b %d, %Y'),
  #          iphone_dims[0], iphone_dims[1], text_color, font, 0.0)
dataset/ETHPy150Open viewfinderco/viewfinder/clients/experimental/viewfinder.py/DrawGuides/original