Commit 2945655d6e1460ed4c5dee9e8ef654760d2d2465
Merge branch 'mircopz-feature/add-values-in-legend-row-direction'
Showing
6 changed files
with
61 additions
and
24 deletions
... | ... | @@ -28,20 +28,6 @@ export default function LegendConfigPanelController(mdPanelRef, $scope, types, l |
28 | 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 | 31 | $scope.$watch('vm.legendConfig', function () { |
46 | 32 | if (onLegendConfigUpdate) { |
47 | 33 | onLegendConfigUpdate(vm.legendConfig); | ... | ... |
... | ... | @@ -22,8 +22,7 @@ |
22 | 22 | <md-content class="md-padding" layout="column"> |
23 | 23 | <md-input-container> |
24 | 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 | 26 | <md-option ng-repeat="direction in vm.directions" ng-value="direction.value"> |
28 | 27 | {{direction.name | translate}} |
29 | 28 | </md-option> |
... | ... | @@ -38,16 +37,16 @@ |
38 | 37 | </md-option> |
39 | 38 | </md-select> |
40 | 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 | 41 | ng-model="vm.legendConfig.showMin">{{ 'legend.show-min' | translate }} |
43 | 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 | 44 | ng-model="vm.legendConfig.showMax">{{ 'legend.show-max' | translate }} |
46 | 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 | 47 | ng-model="vm.legendConfig.showAvg">{{ 'legend.show-avg' | translate }} |
49 | 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 | 50 | ng-model="vm.legendConfig.showTotal">{{ 'legend.show-total' | translate }} |
52 | 51 | </md-checkbox> |
53 | 52 | </md-content> | ... | ... |
... | ... | @@ -14,7 +14,6 @@ |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | table.tb-legend { |
17 | - width: 100%; | |
18 | 17 | font-size: 12px; |
19 | 18 | |
20 | 19 | .tb-legend-header, |
... | ... | @@ -37,6 +36,15 @@ table.tb-legend { |
37 | 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 | 48 | .tb-legend-line { |
41 | 49 | display: inline-block; |
42 | 50 | width: 15px; |
... | ... | @@ -45,7 +53,9 @@ table.tb-legend { |
45 | 53 | } |
46 | 54 | |
47 | 55 | .tb-legend-label { |
56 | + padding: 2px 10px; | |
48 | 57 | text-align: left; |
58 | + white-space: nowrap; | |
49 | 59 | outline: none; |
50 | 60 | |
51 | 61 | &.tb-horizontal { |
... | ... | @@ -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 | 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 | 20 | <thead> |
20 | 21 | <tr class="tb-legend-header" ng-if="!isRowDirection"> |
21 | 22 | <th colspan="2"></th> |
... | ... | @@ -26,7 +27,7 @@ |
26 | 27 | </tr> |
27 | 28 | </thead> |
28 | 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 | 31 | <td><span class="tb-legend-line" ng-style="{backgroundColor: legendKey.dataKey.color}"></span></td> |
31 | 32 | <td class="tb-legend-label" |
32 | 33 | ng-click="toggleHideData(legendKey.dataIndex)" |
... | ... | @@ -38,5 +39,32 @@ |
38 | 39 | <td class="tb-legend-value" ng-if="legendConfig.showAvg === true">{{ legendData.data[legendKey.dataIndex].avg }}</td> |
39 | 40 | <td class="tb-legend-value" ng-if="legendConfig.showTotal === true">{{ legendData.data[legendKey.dataIndex].total }}</td> |
40 | 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 | 69 | </tbody> |
42 | 70 | </table> | ... | ... |
... | ... | @@ -1176,7 +1176,7 @@ |
1176 | 1176 | "select": "Seleccionar diseño objetivo" |
1177 | 1177 | }, |
1178 | 1178 | "legend": { |
1179 | - "direction": "", | |
1179 | + "direction": "Dirección de la leyenda", | |
1180 | 1180 | "position": "Posición de la leyenda", |
1181 | 1181 | "show-max": "Mostrar valor máximo", |
1182 | 1182 | "show-min": "Mostrar valor mínimo", | ... | ... |
... | ... | @@ -670,6 +670,10 @@ |
670 | 670 | "dialog": { |
671 | 671 | "close": "Close dialog" |
672 | 672 | }, |
673 | + "direction": { | |
674 | + "column": "Colonna", | |
675 | + "row": "Riga" | |
676 | + }, | |
673 | 677 | "error": { |
674 | 678 | "unable-to-connect": "Impossibile connettersi al server! Controlla la connessione ad Internet.", |
675 | 679 | "unhandled-error-code": "Codice errore non gestito: {{errorCode}}", |
... | ... | @@ -1116,6 +1120,7 @@ |
1116 | 1120 | "select": "Select target layout" |
1117 | 1121 | }, |
1118 | 1122 | "legend": { |
1123 | + "direction": "Direzione", | |
1119 | 1124 | "position": "Posizione Legenda", |
1120 | 1125 | "show-max": "Mostra valore max", |
1121 | 1126 | "show-min": "Mostra valore min", | ... | ... |