Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added min/max to graph to accomodate for constant time series #2612

Merged
merged 2 commits into from Apr 12, 2017
Merged

Added min/max to graph to accomodate for constant time series #2612

merged 2 commits into from Apr 12, 2017

Conversation

conr
Copy link
Contributor

@conr conr commented Apr 12, 2017

Fixes #1909 #1214

Essentially find the smallest and largest data point for any of the given time series and set the min/max of the graph to by ±10% of these values in order to make constant time series more visible.

Constant Graph Before:
screen shot 2017-04-12 at 11 44 47 3

Constant Graph After:
screen shot 2017-04-12 at 11 44 18 3

@@ -556,6 +556,30 @@ Prometheus.Graph.prototype.updateGraph = function() {
min: "auto",
});

// Find and set graph's max/min
var min = Math.min();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Infinity/-Infinity would be clearer here

if (min == 0) {
self.rickshawGraph.min = -1;
} else {
self.rickshawGraph.min = min - (0.1*(min));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if min is negative?

What you want is 0.1 * (max - min)

@brian-brazil brian-brazil merged commit ee62807 into prometheus:master Apr 12, 2017
@brian-brazil
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants