Sort Pens on Time Series Chart Help

First off post code, not pictures of code, with sensitive parts redacted as necessary:

Moving onto the ordering problem, you are iterating through the response from browseTags, so you are likely at the mercy of whatever order that function returns the tags in.

If you just want alphabetical ordering you can make use of operator.itemgetter to sort the resulting list before returning it. Something along the lines of

data = sorted(data, key=operator.itemgetter('alias'))

right before assigning the data to self.custom.data should work.

If you want specific ordering you'll probably have to do something like use a separate list that has the tag names in the preferred order, that you can then compare against and move items in the data variable to match positions/order.