Commit fd94019c by Torkel Ödegaard

changed second-y axis setting, now on per alias leven instead of graphite target expression level

parent fc2718e7
...@@ -230,16 +230,6 @@ function (angular, _, config, graphiteFuncs, Parser) { ...@@ -230,16 +230,6 @@ function (angular, _, config, graphiteFuncs, Parser) {
$scope.targetChanged(); $scope.targetChanged();
}; };
$scope.setYAxis = function() {
if ($scope.target.yaxis) {
delete $scope.target.yaxis;
} else {
$scope.target.yaxis = 2;
}
$scope.get_data();
};
$scope.duplicate = function() { $scope.duplicate = function() {
var clone = angular.copy($scope.target); var clone = angular.copy($scope.target);
$scope.panel.targets.push(clone); $scope.panel.targets.push(clone);
......
...@@ -32,12 +32,6 @@ ...@@ -32,12 +32,6 @@
Duplicate Duplicate
</a> </a>
</li> </li>
<li role="menuitem">
<a tabindex="1"
ng-click="setYAxis()">
Right Y-axis
</a>
</li>
</ul> </ul>
</li> </li>
<li> <li>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
ng-style="{color: series.color}" ng-style="{color: series.color}"
bs-popover="'colorPopup.html'" bs-popover="'colorPopup.html'"
data-unique="1" data-unique="1"
data-placement="bottomLeft"> data-placement="{{series.yaxis === 2 ? 'bottomRight' : 'bottomLeft'}}">
</i> </i>
<span class='small histogram-legend-item'> <span class='small histogram-legend-item'>
<a ng-click="toggleSeries(series)"> <a ng-click="toggleSeries(series)">
...@@ -16,17 +16,22 @@ ...@@ -16,17 +16,22 @@
</span> </span>
<script type="text/ng-template" id="colorPopup.html"> <script type="text/ng-template" id="colorPopup.html">
<div style="width: 150px;"> <div class="histogram-legend-popover">
<div> <div class="histogram-legend-popover-header">
<a class="close pull-right" ng-click="dismiss();" href="">×</a> <a class="small" ng-click="toggleYAxis(series)">
<div class="clearfix"></div> Toggle Y-axis (y&sup2;)
</a>
<a class="close" ng-click="dismiss();" href="">×</a>
</div> </div>
<div class="editor-row">
<i ng-repeat="color in colors" <i ng-repeat="color in colors"
class="pointer" class="pointer"
ng-class="{'icon-circle-blank': color === series.color,'icon-circle': color !== series.color}" ng-class="{'icon-circle-blank': color === series.color,'icon-circle': color !== series.color}"
ng-style="{color:color}" ng-style="{color:color}"
ng-click="changeSeriesColor(series, color);dismiss();"> ng-click="changeSeriesColor(series, color);dismiss();">
</i> </i>
</div> </div>
</div>
</script> </script>
...@@ -202,7 +202,8 @@ function (angular, app, $, _, kbn, moment, timeSeries) { ...@@ -202,7 +202,8 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
targets: [], targets: [],
aliasColors: {} aliasColors: {},
aliasYAxis: {}
}; };
_.defaults($scope.panel,_d); _.defaults($scope.panel,_d);
...@@ -352,14 +353,15 @@ function (angular, app, $, _, kbn, moment, timeSeries) { ...@@ -352,14 +353,15 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
} }
}); });
var target = graphiteSrv.match($scope.panel.targets, targetData.target);
var alias = targetData.target; var alias = targetData.target;
var color = $scope.panel.aliasColors[alias] || $scope.colors[data.length]; var color = $scope.panel.aliasColors[alias] || $scope.colors[data.length];
var yaxis = $scope.panel.aliasYAxis[alias] || 1;
var seriesInfo = { var seriesInfo = {
alias: alias, alias: alias,
color: color, color: color,
enable: true, enable: true,
yaxis: target.yaxis || 1 yaxis: yaxis
}; };
$scope.legend.push(seriesInfo); $scope.legend.push(seriesInfo);
...@@ -367,7 +369,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) { ...@@ -367,7 +369,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
data.push({ data.push({
info: seriesInfo, info: seriesInfo,
time_series: time_series, time_series: time_series,
yaxis: target.yaxis || 1
}); });
}); });
...@@ -470,6 +471,12 @@ function (angular, app, $, _, kbn, moment, timeSeries) { ...@@ -470,6 +471,12 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
$scope.$emit('toggleLegend', info.alias); $scope.$emit('toggleLegend', info.alias);
}; };
$scope.toggleYAxis = function(info) {
info.yaxis = info.yaxis === 2 ? 1 : 2;
$scope.panel.aliasYAxis[info.alias] = info.yaxis;
$scope.$emit('render');
};
}); });
module.directive('histogramChart', function(filterSrv, $rootScope) { module.directive('histogramChart', function(filterSrv, $rootScope) {
...@@ -639,12 +646,10 @@ function (angular, app, $, _, kbn, moment, timeSeries) { ...@@ -639,12 +646,10 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
var _d = data[i].time_series.getFlotPairs(required_times); var _d = data[i].time_series.getFlotPairs(required_times);
data[i].yaxis = data[i].info.yaxis;
data[i].data = _d; data[i].data = _d;
}
var hasSecondY = _.findWhere(data, { yaxis: 2});
if (hasSecondY) { if (options.yaxes.length === 1 && data[i].yaxis === 2) {
options.yaxes.push({ options.yaxes.push({
position: 'right', position: 'right',
show: scope.panel['y-axis'], show: scope.panel['y-axis'],
...@@ -652,6 +657,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) { ...@@ -652,6 +657,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
max: scope.panel.percentage && scope.panel.stack ? 100 : scope.panel.grid.max max: scope.panel.percentage && scope.panel.stack ? 100 : scope.panel.grid.max
}); });
} }
}
plot = $.plot(elem, data, options); plot = $.plot(elem, data, options);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -146,6 +146,25 @@ ...@@ -146,6 +146,25 @@
text-align: left; text-align: left;
} }
.grafana-legend-container .popover-content {
padding: 0;
}
.histogram-legend-popover {
width: 150px;
.histogram-legend-popover-header {
background: #41474c;
text-align: center;
border-bottom: 1px solid #353a3e;
padding: 3px 5px;
white-space: nowrap;
}
.editor-row {
padding: 5px;
}
}
.panel-full-edit-tabs { .panel-full-edit-tabs {
margin-top: 10px; margin-top: 10px;
min-height: 250px; min-height: 250px;
......
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