Support negative graph values.

Currently graph Y-Axes were hardcoded to start at 0. Choose the Y-scale
automatically based on the graph data instead.
pull/263/head
Julius Volz 2013-05-21 16:54:33 +02:00
parent 053f4296d0
commit 8586c7520c
1 changed files with 6 additions and 5 deletions

View File

@ -74,7 +74,7 @@ Prometheus.Graph.prototype.initialize = function() {
self.stacked = self.queryForm.find("input[name=stacked]"); self.stacked = self.queryForm.find("input[name=stacked]");
self.insertMetric = self.queryForm.find("select[name=insert_metric]"); self.insertMetric = self.queryForm.find("select[name=insert_metric]");
self.refreshInterval = self.queryForm.find("select[name=refresh]"); self.refreshInterval = self.queryForm.find("select[name=refresh]");
self.consoleTab = graphWrapper.find(".console"); self.consoleTab = graphWrapper.find(".console");
self.graphTab = graphWrapper.find(".graph_container"); self.graphTab = graphWrapper.find(".graph_container");
self.tabs = graphWrapper.find(".tabs");; self.tabs = graphWrapper.find(".tabs");;
@ -403,7 +403,8 @@ Prometheus.Graph.prototype.showGraph = function() {
width: Math.max(self.graph.innerWidth(), 200), width: Math.max(self.graph.innerWidth(), 200),
renderer: (self.stacked.is(":checked") ? "stack" : "line"), renderer: (self.stacked.is(":checked") ? "stack" : "line"),
interpolation: "linear", interpolation: "linear",
series: self.data series: self.data,
min: "auto",
}); });
var xAxis = new Rickshaw.Graph.Axis.Time({ graph: self.rickshawGraph }); var xAxis = new Rickshaw.Graph.Axis.Time({ graph: self.rickshawGraph });
@ -543,8 +544,8 @@ function init() {
cache: false cache: false
}); });
$.ajax({ $.ajax({
url: "/static/js/graph_template.handlebar", url: "/static/js/graph_template.handlebar",
success: function(data) { success: function(data) {
graphTemplate = Handlebars.compile(data); graphTemplate = Handlebars.compile(data);
var options = parseGraphOptionsFromUrl(); var options = parseGraphOptionsFromUrl();
@ -555,7 +556,7 @@ function init() {
addGraph(options[i]); addGraph(options[i]);
} }
$("#add_graph").click(function() { addGraph({}); }); $("#add_graph").click(function() { addGraph({}); });
} }
}) })
} }
$(init); $(init);