panel(graph): stacking can now handle null values, #6287
This commit is contained in:
@@ -183,6 +183,22 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMinTimeStepOfSeries(data) {
|
||||||
|
var min = 100000000000;
|
||||||
|
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
if (!data[i].stats.timeStep) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data[i].stats.timeStep < min) {
|
||||||
|
min = data[i].stats.timeStep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
|
||||||
// Function for rendering panel
|
// Function for rendering panel
|
||||||
function render_panel() {
|
function render_panel() {
|
||||||
panelWidth = elem.width();
|
panelWidth = elem.width();
|
||||||
@@ -279,14 +295,8 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
var width;
|
if (panel.bars) {
|
||||||
for (let i = 0; i < data.length; i++) {
|
options.series.bars.barWidth = getMinTimeStepOfSeries(data) / 1.5;
|
||||||
if (data[i].stats.timeStep && (width == null || (data[i].stats.timeStep / 1.5) < width)) {
|
|
||||||
width = data[i].stats.timeStep / 1.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (width) {
|
|
||||||
options.series.bars.barWidth = width;
|
|
||||||
}
|
}
|
||||||
addTimeAxis(options);
|
addTimeAxis(options);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user