Commit acf6ee7613f2931ede24a1c4c20fa05b9fddef68
1 parent
763ec4b9
Add values even when legend direction is set to 'Row'
Showing
6 changed files
with
65 additions
and
23 deletions
@@ -28,20 +28,6 @@ export default function LegendConfigPanelController(mdPanelRef, $scope, types, l | @@ -28,20 +28,6 @@ export default function LegendConfigPanelController(mdPanelRef, $scope, types, l | ||
28 | $scope.theForm.$setPristine(); | 28 | $scope.theForm.$setPristine(); |
29 | }; | 29 | }; |
30 | 30 | ||
31 | - vm.onChangeDirection = function() { | ||
32 | - if (vm.legendConfig.direction === types.direction.row.value) { | ||
33 | - vm.isRowDirection = true; | ||
34 | - vm.legendConfig.position = types.position.bottom.value; | ||
35 | - vm.legendConfig.showMin = false; | ||
36 | - vm.legendConfig.showMax = false; | ||
37 | - vm.legendConfig.showAvg = false; | ||
38 | - vm.legendConfig.showTotal = false; | ||
39 | - } | ||
40 | - else { | ||
41 | - vm.isRowDirection = false; | ||
42 | - } | ||
43 | - }; | ||
44 | - | ||
45 | $scope.$watch('vm.legendConfig', function () { | 31 | $scope.$watch('vm.legendConfig', function () { |
46 | if (onLegendConfigUpdate) { | 32 | if (onLegendConfigUpdate) { |
47 | onLegendConfigUpdate(vm.legendConfig); | 33 | onLegendConfigUpdate(vm.legendConfig); |
@@ -22,8 +22,7 @@ | @@ -22,8 +22,7 @@ | ||
22 | <md-content class="md-padding" layout="column"> | 22 | <md-content class="md-padding" layout="column"> |
23 | <md-input-container> | 23 | <md-input-container> |
24 | <label translate>legend.direction</label> | 24 | <label translate>legend.direction</label> |
25 | - <md-select ng-model="vm.legendConfig.direction" style="min-width: 150px;" | ||
26 | - ng-change="vm.onChangeDirection()"> | 25 | + <md-select ng-model="vm.legendConfig.direction" style="min-width: 150px;"> |
27 | <md-option ng-repeat="direction in vm.directions" ng-value="direction.value"> | 26 | <md-option ng-repeat="direction in vm.directions" ng-value="direction.value"> |
28 | {{direction.name | translate}} | 27 | {{direction.name | translate}} |
29 | </md-option> | 28 | </md-option> |
@@ -38,16 +37,16 @@ | @@ -38,16 +37,16 @@ | ||
38 | </md-option> | 37 | </md-option> |
39 | </md-select> | 38 | </md-select> |
40 | </md-input-container> | 39 | </md-input-container> |
41 | - <md-checkbox flex aria-label="{{ 'legend.show-min' | translate }}" ng-disabled="vm.isRowDirection" | 40 | + <md-checkbox flex aria-label="{{ 'legend.show-min' | translate }}"" |
42 | ng-model="vm.legendConfig.showMin">{{ 'legend.show-min' | translate }} | 41 | ng-model="vm.legendConfig.showMin">{{ 'legend.show-min' | translate }} |
43 | </md-checkbox> | 42 | </md-checkbox> |
44 | - <md-checkbox flex aria-label="{{ 'legend.show-max' | translate }}" ng-disabled="vm.isRowDirection" | 43 | + <md-checkbox flex aria-label="{{ 'legend.show-max' | translate }}"" |
45 | ng-model="vm.legendConfig.showMax">{{ 'legend.show-max' | translate }} | 44 | ng-model="vm.legendConfig.showMax">{{ 'legend.show-max' | translate }} |
46 | </md-checkbox> | 45 | </md-checkbox> |
47 | - <md-checkbox flex aria-label="{{ 'legend.show-avg' | translate }}" ng-disabled="vm.isRowDirection" | 46 | + <md-checkbox flex aria-label="{{ 'legend.show-avg' | translate }}"" |
48 | ng-model="vm.legendConfig.showAvg">{{ 'legend.show-avg' | translate }} | 47 | ng-model="vm.legendConfig.showAvg">{{ 'legend.show-avg' | translate }} |
49 | </md-checkbox> | 48 | </md-checkbox> |
50 | - <md-checkbox flex aria-label="{{ 'legend.show-total' | translate }}" ng-disabled="vm.isRowDirection" | 49 | + <md-checkbox flex aria-label="{{ 'legend.show-total' | translate }}"" |
51 | ng-model="vm.legendConfig.showTotal">{{ 'legend.show-total' | translate }} | 50 | ng-model="vm.legendConfig.showTotal">{{ 'legend.show-total' | translate }} |
52 | </md-checkbox> | 51 | </md-checkbox> |
53 | </md-content> | 52 | </md-content> |
@@ -14,7 +14,6 @@ | @@ -14,7 +14,6 @@ | ||
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | table.tb-legend { | 16 | table.tb-legend { |
17 | - width: 100%; | ||
18 | font-size: 12px; | 17 | font-size: 12px; |
19 | 18 | ||
20 | .tb-legend-header, | 19 | .tb-legend-header, |
@@ -37,6 +36,15 @@ table.tb-legend { | @@ -37,6 +36,15 @@ table.tb-legend { | ||
37 | white-space: nowrap; | 36 | white-space: nowrap; |
38 | } | 37 | } |
39 | 38 | ||
39 | + .tb-legend-type { | ||
40 | + min-width: 50px; | ||
41 | + padding: 0 10px 1px 0; | ||
42 | + font-weight: 700; | ||
43 | + color: rgb(255, 110, 64); | ||
44 | + text-align: right; | ||
45 | + white-space: nowrap; | ||
46 | + } | ||
47 | + | ||
40 | .tb-legend-line { | 48 | .tb-legend-line { |
41 | display: inline-block; | 49 | display: inline-block; |
42 | width: 15px; | 50 | width: 15px; |
@@ -45,7 +53,9 @@ table.tb-legend { | @@ -45,7 +53,9 @@ table.tb-legend { | ||
45 | } | 53 | } |
46 | 54 | ||
47 | .tb-legend-label { | 55 | .tb-legend-label { |
56 | + padding: 2px 10px; | ||
48 | text-align: left; | 57 | text-align: left; |
58 | + white-space: nowrap; | ||
49 | outline: none; | 59 | outline: none; |
50 | 60 | ||
51 | &.tb-horizontal { | 61 | &.tb-horizontal { |
@@ -63,3 +73,12 @@ table.tb-legend { | @@ -63,3 +73,12 @@ table.tb-legend { | ||
63 | } | 73 | } |
64 | } | 74 | } |
65 | } | 75 | } |
76 | + | ||
77 | +table.tb-legend-column { | ||
78 | + width: 100%; | ||
79 | +} | ||
80 | + | ||
81 | +table.tb-legend-row { | ||
82 | + width: auto; | ||
83 | + margin-left: auto; | ||
84 | +} |
@@ -15,7 +15,8 @@ | @@ -15,7 +15,8 @@ | ||
15 | limitations under the License. | 15 | limitations under the License. |
16 | 16 | ||
17 | --> | 17 | --> |
18 | -<table class="tb-legend"> | 18 | +<table class="tb-legend" ng-class="isRowDirection ? 'tb-legend-row' : 'tb-legend-column'" |
19 | + ng-style="{ 'marginRight': isRowDirection && !displayHeader() ? 'auto' : '20px' }"> | ||
19 | <thead> | 20 | <thead> |
20 | <tr class="tb-legend-header" ng-if="!isRowDirection"> | 21 | <tr class="tb-legend-header" ng-if="!isRowDirection"> |
21 | <th colspan="2"></th> | 22 | <th colspan="2"></th> |
@@ -26,7 +27,7 @@ | @@ -26,7 +27,7 @@ | ||
26 | </tr> | 27 | </tr> |
27 | </thead> | 28 | </thead> |
28 | <tbody> | 29 | <tbody> |
29 | - <tr class="tb-legend-keys" ng-repeat="legendKey in legendData.keys" ng-class="{ 'tb-row-direction': isRowDirection }"> | 30 | + <tr class="tb-legend-keys" ng-repeat="legendKey in legendData.keys" ng-if="!isRowDirection"> |
30 | <td><span class="tb-legend-line" ng-style="{backgroundColor: legendKey.dataKey.color}"></span></td> | 31 | <td><span class="tb-legend-line" ng-style="{backgroundColor: legendKey.dataKey.color}"></span></td> |
31 | <td class="tb-legend-label" | 32 | <td class="tb-legend-label" |
32 | ng-click="toggleHideData(legendKey.dataIndex)" | 33 | ng-click="toggleHideData(legendKey.dataIndex)" |
@@ -38,5 +39,32 @@ | @@ -38,5 +39,32 @@ | ||
38 | <td class="tb-legend-value" ng-if="legendConfig.showAvg === true">{{ legendData.data[legendKey.dataIndex].avg }}</td> | 39 | <td class="tb-legend-value" ng-if="legendConfig.showAvg === true">{{ legendData.data[legendKey.dataIndex].avg }}</td> |
39 | <td class="tb-legend-value" ng-if="legendConfig.showTotal === true">{{ legendData.data[legendKey.dataIndex].total }}</td> | 40 | <td class="tb-legend-value" ng-if="legendConfig.showTotal === true">{{ legendData.data[legendKey.dataIndex].total }}</td> |
40 | </tr> | 41 | </tr> |
42 | + <tr class="tb-legend-keys" ng-class="{ 'tb-row-direction': !displayHeader() }" ng-if="isRowDirection"> | ||
43 | + <td></td> | ||
44 | + <td ng-repeat="legendKey in legendData.keys"> | ||
45 | + <span class="tb-legend-line" ng-style="{backgroundColor: legendKey.dataKey.color}"></span> | ||
46 | + <span class="tb-legend-label" | ||
47 | + ng-click="toggleHideData(legendKey.dataIndex)" | ||
48 | + ng-class="{ 'tb-hidden-label': legendData.keys[legendKey.dataIndex].dataKey.hidden}"> | ||
49 | + {{ legendKey.dataKey.label }} | ||
50 | + </span> | ||
51 | + </td> | ||
52 | + </tr> | ||
53 | + <tr class="tb-legend-keys" ng-if="isRowDirection && legendConfig.showMin === true"> | ||
54 | + <td class="tb-legend-type">{{ 'legend.min' | translate }}</td> | ||
55 | + <td class="tb-legend-value" ng-repeat="legendKey in legendData.keys">{{ legendData.data[legendKey.dataIndex].min }}</td> | ||
56 | + </tr> | ||
57 | + <tr class="tb-legend-keys" ng-if="isRowDirection && legendConfig.showMax === true"> | ||
58 | + <td class="tb-legend-type">{{ 'legend.max' | translate }}</td> | ||
59 | + <td class="tb-legend-value" ng-repeat="legendKey in legendData.keys">{{ legendData.data[legendKey.dataIndex].max }}</td> | ||
60 | + </tr> | ||
61 | + <tr class="tb-legend-keys" ng-if="isRowDirection && legendConfig.showAvg === true"> | ||
62 | + <td class="tb-legend-type">{{ 'legend.avg' | translate }}</td> | ||
63 | + <td class="tb-legend-value" ng-repeat="legendKey in legendData.keys">{{ legendData.data[legendKey.dataIndex].avg }}</td> | ||
64 | + </tr> | ||
65 | + <tr class="tb-legend-keys" ng-if="isRowDirection && legendConfig.showTotal === true"> | ||
66 | + <td class="tb-legend-type">{{ 'legend.total' | translate }}</td> | ||
67 | + <td class="tb-legend-value" ng-repeat="legendKey in legendData.keys">{{ legendData.data[legendKey.dataIndex].total }}</td> | ||
68 | + </tr> | ||
41 | </tbody> | 69 | </tbody> |
42 | </table> | 70 | </table> |
@@ -670,6 +670,10 @@ | @@ -670,6 +670,10 @@ | ||
670 | "dialog": { | 670 | "dialog": { |
671 | "close": "Cerrar diálogo" | 671 | "close": "Cerrar diálogo" |
672 | }, | 672 | }, |
673 | + "direction": { | ||
674 | + "column": "Columna", | ||
675 | + "row": "Fila" | ||
676 | + }, | ||
673 | "error": { | 677 | "error": { |
674 | "unable-to-connect": "¡No se puede conectar al servidor! Por favor, revise su conexión a Internet.", | 678 | "unable-to-connect": "¡No se puede conectar al servidor! Por favor, revise su conexión a Internet.", |
675 | "unhandled-error-code": "Código de error no controlado: {{errorCode}}", | 679 | "unhandled-error-code": "Código de error no controlado: {{errorCode}}", |
@@ -1111,6 +1115,7 @@ | @@ -1111,6 +1115,7 @@ | ||
1111 | "select": "Seleccionar diseño objetivo" | 1115 | "select": "Seleccionar diseño objetivo" |
1112 | }, | 1116 | }, |
1113 | "legend": { | 1117 | "legend": { |
1118 | + "direction": "Dirección de la leyenda", | ||
1114 | "position": "Posición de la leyenda", | 1119 | "position": "Posición de la leyenda", |
1115 | "show-max": "Mostrar valor máximo", | 1120 | "show-max": "Mostrar valor máximo", |
1116 | "show-min": "Mostrar valor mínimo", | 1121 | "show-min": "Mostrar valor mínimo", |
@@ -670,6 +670,10 @@ | @@ -670,6 +670,10 @@ | ||
670 | "dialog": { | 670 | "dialog": { |
671 | "close": "Close dialog" | 671 | "close": "Close dialog" |
672 | }, | 672 | }, |
673 | + "direction": { | ||
674 | + "column": "Colonna", | ||
675 | + "row": "Riga" | ||
676 | + }, | ||
673 | "error": { | 677 | "error": { |
674 | "unable-to-connect": "Impossibile connettersi al server! Controlla la connessione ad Internet.", | 678 | "unable-to-connect": "Impossibile connettersi al server! Controlla la connessione ad Internet.", |
675 | "unhandled-error-code": "Codice errore non gestito: {{errorCode}}", | 679 | "unhandled-error-code": "Codice errore non gestito: {{errorCode}}", |
@@ -1116,6 +1120,7 @@ | @@ -1116,6 +1120,7 @@ | ||
1116 | "select": "Select target layout" | 1120 | "select": "Select target layout" |
1117 | }, | 1121 | }, |
1118 | "legend": { | 1122 | "legend": { |
1123 | + "direction": "Direzione", | ||
1119 | "position": "Posizione Legenda", | 1124 | "position": "Posizione Legenda", |
1120 | "show-max": "Mostra valore max", | 1125 | "show-max": "Mostra valore max", |
1121 | "show-min": "Mostra valore min", | 1126 | "show-min": "Mostra valore min", |