'Returns a formatted string showing graph_obj constructors.
:param (int) level: The number of indentations to start with.
:param (int) indent: The indentation amount.
:param (str) eol: The end of line character(s).
:param (bool) pretty: Curtail long list output with a \'..\' ?
:param (int) max_chars: The max characters per line.
Example:
print(obj.to_string())'

def to_string(self, level=0, indent=4, eol='\n', pretty=True, max_chars=80):

    if (not len(self)):
        return '{name}()'.format(name=self._get_class_name())
    string = '{name}('.format(name=self._get_class_name())
    if (self._name in graph_reference.TRACE_NAMES):
        keys = [key for key in self.keys() if (key != 'type')]
    else:
        keys = self.keys()
    keys = sorted(keys, key=graph_objs_tools.sort_keys)
    num_keys = len(keys)
    for (index, key) in enumerate(keys, 1):
        string += '{eol}{indent}{key}='.format(eol=eol, indent=(('    ' * indent) * (level + 1)), key=key)
        if isinstance(self[key], PlotlyBase):
            string += self[key].to_string(level=(level + 1), indent=indent, eol=eol, pretty=pretty, max_chars=max_chars)
        elif pretty:
            max_len = (((max_chars - (indent * (level + 1))) - len((key + '='))) - len(eol))
            if (index < num_keys):
                max_len -= len(',')
            if isinstance(self[key], list):
                s = '[]'
                for (iii, entry) in enumerate(self[key], 1):
                    if (iii < len(self[key])):
                        s_sub = graph_objs_tools.curtail_val_repr(entry, max_chars=(max_len - len(s)), add_delim=True)
                    else:
                        s_sub = graph_objs_tools.curtail_val_repr(entry, max_chars=(max_len - len(s)), add_delim=False)
                    s = ((s[:(-1)] + s_sub) + s[(-1)])
                    if (len(s) == max_len):
                        break
                string += s
            else:
                string += graph_objs_tools.curtail_val_repr(self[key], max_len)
        else:
            string += repr(self[key])
        if (index < num_keys):
            string += ','
    string += '{eol}{indent})'.format(eol=eol, indent=(('    ' * indent) * level))
    return string
