'Returns the JSON for the plot with non-data elements stripped.
:param (bool) flatten: {\'a\': {\'b\': \'\'}} --> {\'a.b\': \'\'}
:returns: (dict|list) Depending on (flat|unflat)'

def get_data(self, flatten=False):

    if flatten:
        data = [v.get_data(flatten=flatten) for v in self]
        d = {}
        taken_names = []
        for (i, trace) in enumerate(data):
            trace_name = trace.pop('name', 'trace_{0}'.format(i))
            if (trace_name in taken_names):
                j = 1
                new_trace_name = '{0}_{1}'.format(trace_name, j)
                while (new_trace_name in taken_names):
                    new_trace_name = '{0}_{1}'.format(trace_name, j)
                    j += 1
                trace_name = new_trace_name
            taken_names.append(trace_name)
            for (k, v) in trace.items():
                key = '{0}.{1}'.format(trace_name, k)
                d[key] = v
        return d
    else:
        return super(Data, self).get_data(flatten=flatten)
