def generate_graph(self):
logger.debug('<STR_LIT>', self._graph_id)<EOL>tools = [<EOL>PanTool(),<EOL>BoxZoomTool(),<EOL>WheelZoomTool(),<EOL>SaveTool(),<EOL>ResetTool(),<EOL>ResizeTool()<EOL>]<EOL>try:<EOL><INDENT>g = Area(<EOL>self._data, x='<STR_LIT>', y=self._y_series_names,<EOL>title=self._title, stack=True, xlabel='<STR_LIT>',<EOL>ylabel='<STR_LIT>', tools=tools,<EOL>plot_height=<NUM_LIT>, plot_width=<NUM_LIT>,<EOL>toolbar_location='<STR_LIT>', legend=False<EOL>)<EOL><DEDENT>except Exception as ex:<EOL><INDENT>logger.error("<STR_LIT>", self._graph_id)<EOL>logger.error("<STR_LIT>", self._data)<EOL>logger.error("<STR_LIT>", self._y_series_names)<EOL>raise ex<EOL><DEDENT>lines = []<EOL>legend_parts = []<EOL>for renderer in g.select(GlyphRenderer):<EOL><INDENT>if not isinstance(renderer.glyph, Patches):<EOL><INDENT>continue<EOL><DEDENT>series_name = renderer.data_source.data['<STR_LIT>'][<NUM_LIT:0>]<EOL>logger.debug('<STR_LIT>', renderer,<EOL>series_name)<EOL>line = self._line_for_patches(self._data, g, renderer, series_name)<EOL>if line is not None:<EOL><INDENT>lines.append(line)<EOL>legend_parts.append((series_name, [line]))<EOL><DEDENT><DEDENT>g.add_tools(<EOL>HoverTool(<EOL>tooltips=[<EOL>(self._y_name, '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>],<EOL>renderers=lines,<EOL>line_policy='<STR_LIT>'<EOL>)<EOL>)<EOL>legend = Legend(legends=legend_parts, location=(<NUM_LIT:0>, <NUM_LIT:0>))<EOL>g.add_layout(legend, '<STR_LIT:right>')<EOL>return components(g)<EOL>
Generate the graph; return a 2-tuple of strings, script to place in the
head of the HTML document and div content for the graph itself.

:return: 2-tuple (script, div)
:rtype: tuple