mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Graph: fixed PNG rendering of panels with legend table to the right, #2185
This commit is contained in:
parent
cfeba99776
commit
26e5d7a3de
@ -28,6 +28,9 @@
|
|||||||
- Search HTTP API response has changed (simplified), tags list moved to seperate HTTP resource URI
|
- Search HTTP API response has changed (simplified), tags list moved to seperate HTTP resource URI
|
||||||
- Datasource HTTP api breaking change, ADD datasource is now POST /api/datasources/, update is now PUT /api/datasources/:id
|
- Datasource HTTP api breaking change, ADD datasource is now POST /api/datasources/, update is now PUT /api/datasources/:id
|
||||||
|
|
||||||
|
**Fixes**
|
||||||
|
- [Issue #2185](https://github.com/grafana/grafana/issues/2185). Graph: fixed PNG rendering of panels with legend table to the right
|
||||||
|
|
||||||
# 2.0.3 (unreleased - 2.0.x branch)
|
# 2.0.3 (unreleased - 2.0.x branch)
|
||||||
|
|
||||||
**Fixes**
|
**Fixes**
|
||||||
|
@ -54,7 +54,7 @@ func RenderToPng(params *RenderOpts) (string, error) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-time.After(10 * time.Second):
|
case <-time.After(15 * time.Second):
|
||||||
if err := cmd.Process.Kill(); err != nil {
|
if err := cmd.Process.Kill(); err != nil {
|
||||||
log.Error(4, "failed to kill: %v", err)
|
log.Error(4, "failed to kill: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ function (angular, $, config) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.broadcastRefresh = function() {
|
$scope.broadcastRefresh = function() {
|
||||||
|
$rootScope.performance.panelsRendered = 0;
|
||||||
$rootScope.$broadcast('refresh');
|
$rootScope.$broadcast('refresh');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -164,6 +164,7 @@ function (angular, _) {
|
|||||||
|
|
||||||
_.each(selected, function(option, index) {
|
_.each(selected, function(option, index) {
|
||||||
var copy = self.getPanelClone(panel, row, index);
|
var copy = self.getPanelClone(panel, row, index);
|
||||||
|
copy.span = 12 / selected.length;
|
||||||
copy.scopedVars = copy.scopedVars || {};
|
copy.scopedVars = copy.scopedVars || {};
|
||||||
copy.scopedVars[variable.name] = option;
|
copy.scopedVars[variable.name] = option;
|
||||||
});
|
});
|
||||||
|
@ -86,6 +86,10 @@ function (angular, _, config) {
|
|||||||
return datasourceSrv.get($scope.panel.datasource);
|
return datasourceSrv.get($scope.panel.datasource);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.panelRenderingComplete = function() {
|
||||||
|
$rootScope.performance.panelsRendered++;
|
||||||
|
};
|
||||||
|
|
||||||
$scope.get_data = function() {
|
$scope.get_data = function() {
|
||||||
if ($scope.otherPanelInFullscreenMode()) { return; }
|
if ($scope.otherPanelInFullscreenMode()) { return; }
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ function (angular, app, _, config, PanelMeta) {
|
|||||||
|
|
||||||
return backendSrv.search(params).then(function(result) {
|
return backendSrv.search(params).then(function(result) {
|
||||||
$scope.dashList = result;
|
$scope.dashList = result;
|
||||||
|
$scope.panelRenderingComplete();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -247,22 +247,26 @@ function (angular, $, kbn, moment, _, GraphTooltip) {
|
|||||||
|
|
||||||
sortedSeries = _.sortBy(data, function(series) { return series.zindex; });
|
sortedSeries = _.sortBy(data, function(series) { return series.zindex; });
|
||||||
|
|
||||||
function callPlot() {
|
function callPlot(incrementRenderCounter) {
|
||||||
try {
|
try {
|
||||||
$.plot(elem, sortedSeries, options);
|
$.plot(elem, sortedSeries, options);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('flotcharts error', e);
|
console.log('flotcharts error', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (incrementRenderCounter) {
|
||||||
|
scope.panelRenderingComplete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldDelayDraw(panel)) {
|
if (shouldDelayDraw(panel)) {
|
||||||
// temp fix for legends on the side, need to render twice to get dimensions right
|
// temp fix for legends on the side, need to render twice to get dimensions right
|
||||||
callPlot();
|
callPlot(false);
|
||||||
setTimeout(callPlot, 50);
|
setTimeout(function() { callPlot(true); }, 50);
|
||||||
legendSideLastValue = panel.legend.rightSide;
|
legendSideLastValue = panel.legend.rightSide;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
callPlot();
|
callPlot(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ function (angular, app, _, $) {
|
|||||||
|
|
||||||
scope.$on('render', function() {
|
scope.$on('render', function() {
|
||||||
render();
|
render();
|
||||||
|
scope.panelRenderingComplete();
|
||||||
});
|
});
|
||||||
|
|
||||||
function setElementHeight() {
|
function setElementHeight() {
|
||||||
|
@ -61,6 +61,7 @@ function (angular, app, _, require, PanelMeta) {
|
|||||||
else if ($scope.panel.mode === 'text') {
|
else if ($scope.panel.mode === 'text') {
|
||||||
$scope.renderText($scope.panel.content);
|
$scope.renderText($scope.panel.content);
|
||||||
}
|
}
|
||||||
|
$scope.panelRenderingComplete();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.renderText = function(content) {
|
$scope.renderText = function(content) {
|
||||||
|
@ -36,6 +36,7 @@ define([
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
scope.panelRenderingComplete = sinon.spy();
|
||||||
scope.appEvent = sinon.spy();
|
scope.appEvent = sinon.spy();
|
||||||
scope.onAppEvent = sinon.spy();
|
scope.onAppEvent = sinon.spy();
|
||||||
scope.hiddenSeries = {};
|
scope.hiddenSeries = {};
|
||||||
|
6
vendor/phantomjs/render.js
vendored
6
vendor/phantomjs/render.js
vendored
@ -34,10 +34,12 @@ page.open(params.url, function (status) {
|
|||||||
|
|
||||||
function checkIsReady() {
|
function checkIsReady() {
|
||||||
var canvas = page.evaluate(function() {
|
var canvas = page.evaluate(function() {
|
||||||
return $('canvas').length > 0;
|
var body = angular.element(document.body); // 1
|
||||||
|
var rootScope = body.scope().$root;
|
||||||
|
return rootScope.performance.panelsRendered > 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (canvas || tries === 100) {
|
if (canvas || tries === 1000) {
|
||||||
page.render(params.png);
|
page.render(params.png);
|
||||||
phantom.exit();
|
phantom.exit();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user