|
@@ -34,7 +34,6 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) {
|
|
|
var data;
|
|
var data;
|
|
|
var plot;
|
|
var plot;
|
|
|
var sortedSeries;
|
|
var sortedSeries;
|
|
|
- var legendSideLastValue = null;
|
|
|
|
|
var rootScope = scope.$root;
|
|
var rootScope = scope.$root;
|
|
|
var panelWidth = 0;
|
|
var panelWidth = 0;
|
|
|
var eventManager = new EventManager(ctrl);
|
|
var eventManager = new EventManager(ctrl);
|
|
@@ -95,25 +94,14 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) {
|
|
|
}, scope);
|
|
}, scope);
|
|
|
|
|
|
|
|
function getLegendHeight(panelHeight) {
|
|
function getLegendHeight(panelHeight) {
|
|
|
- const LEGEND_TABLE_LINE_HEIGHT = 21;
|
|
|
|
|
const LEGEND_PADDING = 23;
|
|
const LEGEND_PADDING = 23;
|
|
|
|
|
|
|
|
if (!panel.legend.show || panel.legend.rightSide) {
|
|
if (!panel.legend.show || panel.legend.rightSide) {
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- let legendSeries = _.filter(data, function(series) {
|
|
|
|
|
- return series.hideFromLegend(panel.legend) === false;
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- if (panel.legend.alignAsTable) {
|
|
|
|
|
- let total = LEGEND_PADDING + (LEGEND_TABLE_LINE_HEIGHT * legendSeries.length);
|
|
|
|
|
- return Math.min(total, Math.floor(panelHeight/2));
|
|
|
|
|
- } else {
|
|
|
|
|
- let legendHeight = getLegendContainerHeight();
|
|
|
|
|
- let total = LEGEND_PADDING + (legendHeight);
|
|
|
|
|
- return Math.min(total, Math.floor(panelHeight/2));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ let legendHeight = getLegendContainerHeight() + LEGEND_PADDING;
|
|
|
|
|
+ return Math.min(legendHeight, Math.floor(panelHeight/2));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function getLegendContainerHeight() {
|
|
function getLegendContainerHeight() {
|
|
@@ -254,15 +242,7 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) {
|
|
|
eventManager.addFlotEvents(annotations, options);
|
|
eventManager.addFlotEvents(annotations, options);
|
|
|
|
|
|
|
|
sortedSeries = sortSeries(data, panel);
|
|
sortedSeries = sortSeries(data, panel);
|
|
|
-
|
|
|
|
|
- if (shouldDelayDraw(panel)) {
|
|
|
|
|
- // temp fix for legends on the side, need to render twice to get dimensions right
|
|
|
|
|
- callPlot(options, false);
|
|
|
|
|
- setTimeout(function() { callPlot(options, true); }, 50);
|
|
|
|
|
- legendSideLastValue = panel.legend.rightSide;
|
|
|
|
|
- } else {
|
|
|
|
|
- callPlot(options, true);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ callPlot(options, true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function buildFlotPairs(data) {
|
|
function buildFlotPairs(data) {
|
|
@@ -446,16 +426,6 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function shouldDelayDraw(panel) {
|
|
|
|
|
- if (panel.legend.rightSide) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- if (legendSideLastValue !== null && panel.legend.rightSide !== legendSideLastValue) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
function addTimeAxis(options) {
|
|
function addTimeAxis(options) {
|
|
|
var ticks = panelWidth / 100;
|
|
var ticks = panelWidth / 100;
|
|
|
var min = _.isUndefined(ctrl.range.from) ? null : ctrl.range.from.valueOf();
|
|
var min = _.isUndefined(ctrl.range.from) ? null : ctrl.range.from.valueOf();
|