jondot / graphene

Graphene is a realtime dashboard & graphing toolkit based on D3 and Backbone.
http://jondot.github.com/graphene
2.87k stars 231 forks source link

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

Closed adamzap closed 11 years ago

adamzap commented 11 years ago

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.

jondot commented 11 years ago

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!

jondot commented 11 years ago

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

adamzap commented 11 years ago

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

jondot commented 11 years ago

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