def __init__(self, dg_option=None, ostream=None, data=None):
<EOL>self.dg_option = dg_option<EOL>if self.dg_option == None:<EOL><INDENT>self.dg_option = DOption()<EOL><DEDENT>self.ostream = ostream<EOL>if self.ostream == None:<EOL><INDENT>try:<EOL><INDENT>self.ostream = sys.stdout.buffer<EOL><DEDENT>except AttributeError:<EOL><INDENT>self.ostream = sys.stdout<EOL><DEDENT><DEDENT>if self.dg_option.mode == '<STR_LIT:h>':<EOL><INDENT>self.dg = HorizontalBarGraph(self.dg_option.size,<EOL>self.dg_option)<EOL><DEDENT>elif self.dg_option.mode == '<STR_LIT:v>':<EOL><INDENT>self.dg = VerticalBarGraph(self.dg_option.size,<EOL>self.dg_option)<EOL><DEDENT>else:<EOL><INDENT>self.dg = AxisGraph(self.dg_option.size,<EOL>self.dg_option)<EOL><DEDENT>self.dg.update(data[<NUM_LIT:0>], data[<NUM_LIT:1>])<EOL>
Handle some of the setup functions for the graph in the
        diagram package. Specifically hide all of the requirements that
        are computed in run() inside diagram.py.