diff --git a/public/app/plugins/panel/graph/graph.js b/public/app/plugins/panel/graph/graph.js index 3a42df657a5..b24f6cedb1e 100755 --- a/public/app/plugins/panel/graph/graph.js +++ b/public/app/plugins/panel/graph/graph.js @@ -19,7 +19,6 @@ function (angular, $, moment, _, kbn, GraphTooltip) { var module = angular.module('grafana.directives'); var labelWidthCache = {}; - var panelWidthCache = {}; module.directive('grafanaGraph', function($rootScope, timeSrv) { return { @@ -102,11 +101,6 @@ function (angular, $, moment, _, kbn, GraphTooltip) { if (!setElementHeight()) { return true; } - if(_.isString(data)) { - render_panel_as_graphite_png(data); - return true; - } - if (panelWidth === 0) { return true; } @@ -172,10 +166,7 @@ function (angular, $, moment, _, kbn, GraphTooltip) { // Function for rendering panel function render_panel() { - panelWidth = panelWidthCache[panel.span]; - if (!panelWidth) { - panelWidth = panelWidthCache[panel.span] = elem.width(); - } + panelWidth = elem.width(); if (shouldAbortRender()) { return; @@ -461,80 +452,6 @@ function (angular, $, moment, _, kbn, GraphTooltip) { return "%H:%M"; } - function render_panel_as_graphite_png(url) { - url += '&width=' + panelWidth; - url += '&height=' + elem.css('height').replace('px', ''); - url += '&bgcolor=1f1f1f'; // @grayDarker & @grafanaPanelBackground - url += '&fgcolor=BBBFC2'; // @textColor & @grayLighter - url += panel.stack ? '&areaMode=stacked' : ''; - url += panel.fill !== 0 ? ('&areaAlpha=' + (panel.fill/10).toFixed(1)) : ''; - url += panel.linewidth !== 0 ? '&lineWidth=' + panel.linewidth : ''; - url += panel.legend.show ? '&hideLegend=false' : '&hideLegend=true'; - - if (panel.yaxes && panel.yaxes.length > 0) { - var showYaxis = false; - for(var i = 0; panel.yaxes.length > i; i++) { - if (panel.yaxes[i].show) { - url += (panel.yaxes[i].min !== null && panel.yaxes[i].min !== undefined) ? '&yMin=' + panel.yaxes[i].min : ''; - url += (panel.yaxes[i].max !== null && panel.yaxes[i].max !== undefined) ? '&yMax=' + panel.yaxes[i].max : ''; - showYaxis = true; - break; - } - } - url += showYaxis ? '' : '&hideYAxis=true'; - } - - url += panel.xaxis.show ? '' : '&hideAxes=true'; - - switch(panel.yaxes[0].format) { - case 'bytes': - url += '&yUnitSystem=binary'; - break; - case 'bits': - url += '&yUnitSystem=binary'; - break; - case 'bps': - url += '&yUnitSystem=si'; - break; - case 'pps': - url += '&yUnitSystem=si'; - break; - case 'Bps': - url += '&yUnitSystem=si'; - break; - case 'short': - url += '&yUnitSystem=si'; - break; - case 'joule': - url += '&yUnitSystem=si'; - break; - case 'watt': - url += '&yUnitSystem=si'; - break; - case 'ev': - url += '&yUnitSystem=si'; - break; - case 'none': - url += '&yUnitSystem=none'; - break; - } - - switch(panel.nullPointMode) { - case 'connected': - url += '&lineMode=connected'; - break; - case 'null': - break; // graphite default lineMode - case 'null as zero': - url += "&drawNullAsZero=true"; - break; - } - - url += panel.steppedLine ? '&lineMode=staircase' : ''; - - elem.html(''); - } - new GraphTooltip(elem, dashboard, scope, function() { return sortedSeries; }); @@ -550,5 +467,4 @@ function (angular, $, moment, _, kbn, GraphTooltip) { } }; }); - });