How to reverse legend labels in Flot stacked bar chart?

flot, javascript, legend, reverse

Solution

Use `sorted: "reverse"`, as described in the Customizing the Legend section of the documentation. Note that this requires Flot 0.8, which is still technically a dev version, though it's due to replace 0.7 as the stable release in the next week or two.

Problem

Basically it is all in the title. I pass a `json` object to my template. This is how it's build using python: ``` series = [] tab = [] for i,l in reversed(list(enumerate(ts_g))): try: z = l[0].split(";") start_z = ts_g[0][0].split(';')[0] tmp_d = { 'data': [ [float(start_z), float(z[1])], ], 'label': str(s.description), 'color':str(s.color) } series.append(tmp_d) tab.append([z[0],z[1],s.description]) except Exception: raise Exception("couldn't get data from vsoil data field\n") return series, tab.reverse() ``` All values are negatives so I want the legend to be displayed in reverse. How can I do this?

Original source