Further improvement to size ratio

This commit is contained in:
Colin McLeod
2015-07-26 22:38:01 -07:00
parent 164e9f5c8a
commit ab18228131
8 changed files with 45 additions and 21 deletions

View File

@@ -1,8 +1,4 @@
<<<<<<< HEAD
angular.module('app').directive('powerBands', ['$window', '$translate', '$rootScope', function($window, $translate, $rootScope) {
=======
angular.module('app').directive('powerBands', ['$window', '$rootScope', function($window, $rootScope) {
>>>>>>> Another improvement to font-size adjustments
return {
restrict: 'A',
scope: {
@@ -44,6 +40,7 @@ angular.module('app').directive('powerBands', ['$window', '$rootScope', function
// Create Y Axis SVG Elements
vis.append('g').attr('class', 'watt axis');
vis.append('g').attr('class', 'pct axis');
var retLbl = vis.append('text').attr('x', -35).attr('y', 16).attr('class', 'primary upp');
var depLbl = vis.append('text').attr('x', -35).attr('y', barHeight + 18).attr('class', 'primary upp');
var retVal = vis.append('text').attr('y', 16);
@@ -81,7 +78,7 @@ angular.module('app').directive('powerBands', ['$window', '$rootScope', function
}
function render() {
var size = $rootScope.sizeRatio;
var size = $rootScope.sizeRatio,
mTop = Math.round(25 * size),
mRight = Math.round(130 * size),
mBottom = Math.round(25 * size),
@@ -110,7 +107,6 @@ angular.module('app').directive('powerBands', ['$window', '$rootScope', function
vis.selectAll('.watt.axis').call(wattAxis);
vis.selectAll('.pct.axis').attr('transform', 'translate(0,' + innerHeight + ')').call(pctAxis);
<<<<<<< HEAD
for (var b = 0, l = bands.length; b < l; b++) {
if (bands[b].retSelected) {
retractedSum += bands[b].retracted + bands[b].retOnly;
@@ -173,16 +169,16 @@ angular.module('app').directive('powerBands', ['$window', '$rootScope', function
}
function updateLabel(lbl, width, y, selected, sum, available) {
function updateLabel(lbl, width, y, selected, sum, avail) {
lbl
.attr('x', width + 5 )
.attr('y', y)
.attr('class', getClass(selected, sum, available))
.text(wattFmt(Math.max(0, sum)) + ' (' + pctFmt(Math.max(0, sum / available)) + ')');
.attr('class', getClass(selected, sum, avail))
.text(wattFmt(Math.max(0, sum)) + ' (' + pctFmt(Math.max(0, sum / avail)) + ')');
}
function getClass(selected, sum, available) {
return selected ? 'secondary' : (sum > available) ? 'warning' : 'primary';
function getClass(selected, sum, avail) {
return selected ? 'secondary' : (sum > avail) ? 'warning' : 'primary';
}
function bandText(val, index) {