Commit e2d7ead8 by Torkel Ödegaard

Merge branch 'master' of github.com:torkelo/grafana

parents 36f56f36 5961d54a
......@@ -132,35 +132,13 @@ function (angular, $, kbn, moment, _) {
}
};
if (panel.grid.threshold1) {
var limit1 = panel.grid.thresholdLine ? panel.grid.threshold1 : (panel.grid.threshold2 || null);
options.grid.markings = [];
options.grid.markings.push({
yaxis: { from: panel.grid.threshold1, to: limit1 },
color: panel.grid.threshold1Color
});
if (panel.grid.threshold2) {
var limit2;
if (panel.grid.thresholdLine) {
limit2 = panel.grid.threshold2;
} else {
limit2 = panel.grid.threshold1 > panel.grid.threshold2 ? -Infinity : +Infinity;
}
options.grid.markings.push({
yaxis: { from: panel.grid.threshold2, to: limit2 },
color: panel.grid.threshold2Color
});
}
}
addAnnotations(options);
for (var i = 0; i < data.length; i++) {
var _d = data[i].getFlotPairs(panel.nullPointMode);
var _d = data[i].getFlotPairs(panel.nullPointMode, panel.y_formats);
data[i].data = _d;
}
addGridThresholds(options, panel);
addAnnotations(options);
configureAxisOptions(data, options);
plot = $.plot(elem, data, options);
......@@ -210,6 +188,30 @@ function (angular, $, kbn, moment, _) {
elem.html('<img src="' + url + '"></img>');
}
function addGridThresholds(options, panel) {
if (panel.grid.threshold1) {
var limit1 = panel.grid.thresholdLine ? panel.grid.threshold1 : (panel.grid.threshold2 || null);
options.grid.markings = [];
options.grid.markings.push({
yaxis: { from: panel.grid.threshold1, to: limit1 },
color: panel.grid.threshold1Color
});
if (panel.grid.threshold2) {
var limit2;
if (panel.grid.thresholdLine) {
limit2 = panel.grid.threshold2;
} else {
limit2 = panel.grid.threshold1 > panel.grid.threshold2 ? -Infinity : +Infinity;
}
options.grid.markings.push({
yaxis: { from: panel.grid.threshold2, to: limit2 },
color: panel.grid.threshold2Color
});
}
}
}
function addAnnotations(options) {
if(!data.annotations || data.annotations.length === 0) {
return;
......
......@@ -156,7 +156,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
/** @scratch /panels/histogram/3
* stack:: Stack multiple series
*/
stack : true,
stack : false,
/** @scratch /panels/histogram/3
* legend:: Display the legond
*/
......
define([
'underscore'
'underscore',
'kbn'
],
function (_) {
function (_, kbn) {
'use strict';
var ts = {};
......@@ -12,7 +13,7 @@ function (_) {
this.label = opts.info.alias;
};
ts.ZeroFilled.prototype.getFlotPairs = function (fillStyle) {
ts.ZeroFilled.prototype.getFlotPairs = function (fillStyle, yFormats) {
var result = [];
this.color = this.info.color;
......@@ -50,13 +51,39 @@ function (_) {
}, this);
if (result.length) {
this.info.avg = (this.info.total / result.length).toFixed(2);
this.info.avg = (this.info.total / result.length);
this.info.current = result[result.length-1][1];
var formater = getFormater(yFormats[this.yaxis - 1]);
this.info.avg = formater(this.info.avg);
this.info.current = formater(this.info.current);
this.info.min = formater(this.info.min);
this.info.max = formater(this.info.max);
this.info.total = formater(this.info.total);
}
return result;
};
function getFormater(yformat) {
switch(yformat) {
case 'bytes':
return kbn.byteFormat;
case 'short':
return kbn.shortFormat;
case 'ms':
return kbn.msFormat;
default:
return function(val) {
if (val % 1 === 0) {
return val;
}
else {
return val.toFixed(2);
}
};
}
}
return ts;
});
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -173,7 +173,7 @@
}
.close {
margin-right: 5px;
color: white;
color: @linkColor;
opacity: 0.7;
text-shadow: none;
}
......@@ -310,7 +310,7 @@
input[type=text].grafana-target-text-input {
padding: 5px 7px;
border: 1px solid #050505;
border: 1px solid @grafanaTargetSegmentBorder;
margin: 0px;
background: transparent;
width: 80%;
......@@ -341,9 +341,9 @@ input[type=text].func-param {
.grafana-func-editor {
min-width: 140px;
.grafana-func-editor-header {
background: #41474c;
background: @grafanaTargetFuncHightlight;
text-align: center;
border-bottom: 1px solid #353a3e;
border-bottom: 1px solid @grafanaTargetFuncBackground;
padding: 3px 5px;
white-space: nowrap;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment