jondot/graphene

Sorting TimeSeries data by ymax causes random metric order if ymax is not supplied

Closed this issue · 4 comments

We don't supply a ymax value for our graphs, so we were getting random ordering of TimeSeries metrics. By this I mean the order in which the metrics were graphed was different each page refresh along with the colors, etc.

To fix this, I removed the following line from graphene.coffee:

data = _.sortBy(data, (d)-> order*d.ymax)

(https://github.com/jondot/graphene/blob/84b55772/app/js/graphene.coffee#L405)

I didn't offer this change as a pull request because some people probably use ymax, but I wonder if this sorting behavior should be condition based on an option on the graph description.

Yup, this is due to a feature where either the graph with max or min value of all graphs should have its label on top. Thus a single TimeSeries element can give you a view of the graphs and a "feel" of which of the graphs is most influential in a single glance.
When data changes, and min/max recomputed, ordering also changes which causes a feel of randomness if one is not aware that this is the logic.

I agree with you, and now I believe this feature should be opt-in.
I'm planning to make a series of new features this week, and will bake this one in as well.

Thanks!

Hi @adamzap hopefully this fixes it. Thanks for a great feedback which made a simple and fast fix possible :)

Thanks for working on a fix. I will integrate it on Monday and let you know.

Hey Adam, I'm closing this one, feel free to reopen if still having issues 👍