def _line_for_patches(self, data, chart, renderer, series_name):
<EOL>xvals = deepcopy(renderer.data_source.data['<STR_LIT>'][<NUM_LIT:0>])<EOL>yvals = deepcopy(renderer.data_source.data['<STR_LIT>'][<NUM_LIT:0>])<EOL>line_color = renderer.glyph.fill_color<EOL>orig_xvals = [x for x in xvals]<EOL>orig_yvals = [y for y in yvals]<EOL>new_xvals = [x for x in xvals]<EOL>new_yvals = [y for y in yvals]<EOL>xvals = new_xvals[<NUM_LIT:1>:]<EOL>yvals = new_yvals[<NUM_LIT:1>:]<EOL>last_idx = None<EOL>for idx, val in enumerate(xvals):<EOL><INDENT>if yvals[idx+<NUM_LIT:1>] == <NUM_LIT:0> and xvals[idx+<NUM_LIT:1>] == xvals[idx]:<EOL><INDENT>last_idx = idx<EOL>break<EOL><DEDENT><DEDENT>if last_idx is None:<EOL><INDENT>logger.error('<STR_LIT>'<EOL>'<STR_LIT>', orig_xvals, orig_yvals)<EOL>return None<EOL><DEDENT>xvals = xvals[:last_idx+<NUM_LIT:1>]<EOL>yvals = yvals[:last_idx+<NUM_LIT:1>]<EOL>lastx = xvals[-<NUM_LIT:1>]<EOL>xvals[-<NUM_LIT:1>] = lastx - <NUM_LIT:1000>  <EOL>xvals.append(lastx)<EOL>yvals.append(yvals[-<NUM_LIT:1>])<EOL>download_counts = [<EOL>data[series_name][y] for y in range(<NUM_LIT:0>, len(yvals) - <NUM_LIT:1>)<EOL>]<EOL>download_counts.append(download_counts[-<NUM_LIT:1>])<EOL>data2 = {<EOL>'<STR_LIT:x>': xvals,  <EOL>'<STR_LIT:y>': yvals,<EOL>'<STR_LIT>': [series_name for _ in yvals],<EOL>'<STR_LIT>': [self.datetime64_to_formatted_date(x) for x in xvals],<EOL>'<STR_LIT>': download_counts<EOL>}<EOL>data2['<STR_LIT>'][-<NUM_LIT:2>] = data2['<STR_LIT>'][-<NUM_LIT:1>]<EOL>line_ds = ColumnDataSource(data2)<EOL>line = Line(x='<STR_LIT:x>', y='<STR_LIT:y>', line_color=line_color)<EOL>lineglyph = chart.add_glyph(line_ds, line)<EOL>return lineglyph<EOL>
Add a line along the top edge of a Patch in a stacked Area Chart; return
the new Glyph for addition to HoverTool.

:param data: original data for the graph
:type data: dict
:param chart: Chart to add the line to
:type chart: bokeh.charts.Chart
:param renderer: GlyphRenderer containing one Patches glyph, to draw
  the line for
:type renderer: bokeh.models.renderers.GlyphRenderer
:param series_name: the data series name this Patches represents
:type series_name: str
:return: GlyphRenderer for a Line at the top edge of this Patch
:rtype: bokeh.models.renderers.GlyphRenderer