Commit cf175acaa4173e33dc2a939f197ce722c68ddb35

Authored by Igor Kulikov
1 parent a1225636

Propagate UI changes.

... ... @@ -91,22 +91,9 @@ export class LegendConfigPanelComponent extends PageComponent implements OnInit
91 91 }
92 92 this.legendConfigForm.patchValue(
93 93 {
94   - position,
95   - showMin: false,
96   - showMax: false,
97   - showAvg: false,
98   - showTotal: false
  94 + position
99 95 }, {emitEvent: false}
100 96 );
101   - this.legendConfigForm.get('showMin').disable({emitEvent: false});
102   - this.legendConfigForm.get('showMax').disable({emitEvent: false});
103   - this.legendConfigForm.get('showAvg').disable({emitEvent: false});
104   - this.legendConfigForm.get('showTotal').disable({emitEvent: false});
105   - } else {
106   - this.legendConfigForm.get('showMin').enable({emitEvent: false});
107   - this.legendConfigForm.get('showMax').enable({emitEvent: false});
108   - this.legendConfigForm.get('showAvg').enable({emitEvent: false});
109   - this.legendConfigForm.get('showTotal').enable({emitEvent: false});
110 97 }
111 98 }
112 99
... ...
... ... @@ -15,7 +15,8 @@
15 15 limitations under the License.
16 16
17 17 -->
18   -<table class="tb-legend">
  18 +<table class="tb-legend" [ngClass]="isRowDirection ? 'tb-legend-row' : 'tb-legend-column'"
  19 + [ngStyle]="{ marginRight: isRowDirection && !displayHeader ? 'auto' : '20px' }">
19 20 <thead>
20 21 <tr class="tb-legend-header" *ngIf="!isRowDirection">
21 22 <th colspan="2"></th>
... ... @@ -26,17 +27,54 @@
26 27 </tr>
27 28 </thead>
28 29 <tbody>
29   - <tr class="tb-legend-keys" *ngFor="let legendKey of legendKeys()" [ngClass]="{ 'tb-row-direction': isRowDirection }">
30   - <td><span class="tb-legend-line" [ngStyle]="{backgroundColor: legendKey.dataKey.color}"></span></td>
31   - <td class="tb-legend-label"
32   - (click)="toggleHideData(legendKey.dataIndex)"
33   - [ngClass]="{ 'tb-hidden-label': legendData.keys[legendKey.dataIndex].dataKey.hidden, 'tb-horizontal': isHorizontal }">
34   - {{ legendKey.dataKey.label }}
35   - </td>
36   - <td class="tb-legend-value" *ngIf="legendConfig.showMin === true">{{ legendData.data[legendKey.dataIndex].min }}</td>
37   - <td class="tb-legend-value" *ngIf="legendConfig.showMax === true">{{ legendData.data[legendKey.dataIndex].max }}</td>
38   - <td class="tb-legend-value" *ngIf="legendConfig.showAvg === true">{{ legendData.data[legendKey.dataIndex].avg }}</td>
39   - <td class="tb-legend-value" *ngIf="legendConfig.showTotal === true">{{ legendData.data[legendKey.dataIndex].total }}</td>
40   - </tr>
  30 + <ng-container *ngIf="!isRowDirection">
  31 + <tr class="tb-legend-keys" *ngFor="let legendKey of legendKeys()">
  32 + <td><span class="tb-legend-line" [ngStyle]="{backgroundColor: legendKey.dataKey.color}"></span></td>
  33 + <td class="tb-legend-label"
  34 + (click)="toggleHideData(legendKey.dataIndex)"
  35 + [ngClass]="{ 'tb-hidden-label': legendData.keys[legendKey.dataIndex].dataKey.hidden, 'tb-horizontal': isHorizontal }">
  36 + {{ legendKey.dataKey.label }}
  37 + </td>
  38 + <td class="tb-legend-value" *ngIf="legendConfig.showMin === true">{{ legendData.data[legendKey.dataIndex].min }}</td>
  39 + <td class="tb-legend-value" *ngIf="legendConfig.showMax === true">{{ legendData.data[legendKey.dataIndex].max }}</td>
  40 + <td class="tb-legend-value" *ngIf="legendConfig.showAvg === true">{{ legendData.data[legendKey.dataIndex].avg }}</td>
  41 + <td class="tb-legend-value" *ngIf="legendConfig.showTotal === true">{{ legendData.data[legendKey.dataIndex].total }}</td>
  42 + </tr>
  43 + </ng-container>
  44 + <tr *ngIf="isRowDirection" class="tb-legend-keys" [ngClass]="{ 'tb-row-direction': !displayHeader }">
  45 + <td></td>
  46 + <td *ngFor="let legendKey of legendKeys()">
  47 + <span class="tb-legend-line" [ngStyle]="{backgroundColor: legendKey.dataKey.color}"></span>
  48 + <span class="tb-legend-label"
  49 + (click)="toggleHideData(legendKey.dataIndex)"
  50 + [ngClass]="{ 'tb-hidden-label': legendData.keys[legendKey.dataIndex].dataKey.hidden}">
  51 + {{ legendKey.dataKey.label }}
  52 + </span>
  53 + </td>
  54 + </tr>
  55 + <tr class="tb-legend-keys" *ngIf="isRowDirection && legendConfig.showMin === true">
  56 + <td class="tb-legend-type">{{ 'legend.min' | translate }}</td>
  57 + <td class="tb-legend-value" *ngFor="let legendKey of legendKeys()">
  58 + {{ legendData.data[legendKey.dataIndex].min }}
  59 + </td>
  60 + </tr>
  61 + <tr class="tb-legend-keys" *ngIf="isRowDirection && legendConfig.showMax === true">
  62 + <td class="tb-legend-type">{{ 'legend.max' | translate }}</td>
  63 + <td class="tb-legend-value" *ngFor="let legendKey of legendKeys()">
  64 + {{ legendData.data[legendKey.dataIndex].max }}
  65 + </td>
  66 + </tr>
  67 + <tr class="tb-legend-keys" *ngIf="isRowDirection && legendConfig.showAvg === true">
  68 + <td class="tb-legend-type">{{ 'legend.avg' | translate }}</td>
  69 + <td class="tb-legend-value" *ngFor="let legendKey of legendKeys()">
  70 + {{ legendData.data[legendKey.dataIndex].avg }}
  71 + </td>
  72 + </tr>
  73 + <tr class="tb-legend-keys" *ngIf="isRowDirection && legendConfig.showTotal === true">
  74 + <td class="tb-legend-type">{{ 'legend.total' | translate }}</td>
  75 + <td class="tb-legend-value" *ngFor="let legendKey of legendKeys()">
  76 + {{ legendData.data[legendKey.dataIndex].total }}
  77 + </td>
  78 + </tr>
41 79 </tbody>
42 80 </table>
... ...
... ... @@ -15,9 +15,17 @@
15 15 */
16 16 :host {
17 17 table.tb-legend {
18   - width: 100%;
19 18 font-size: 12px;
20 19
  20 + &.tb-legend-column {
  21 + width: 100%;
  22 + }
  23 +
  24 + &.tb-legend-row {
  25 + width: auto;
  26 + margin-left: auto;
  27 + }
  28 +
21 29 .tb-legend-header,
22 30 .tb-legend-value {
23 31 text-align: right;
... ... @@ -42,6 +50,15 @@
42 50 white-space: nowrap;
43 51 }
44 52
  53 + .tb-legend-type {
  54 + min-width: 50px;
  55 + padding: 0 10px 1px 0;
  56 + font-weight: 700;
  57 + color: rgb(255, 110, 64);
  58 + text-align: right;
  59 + white-space: nowrap;
  60 + }
  61 +
45 62 .tb-legend-line {
46 63 display: inline-block;
47 64 width: 15px;
... ... @@ -50,7 +67,9 @@
50 67 }
51 68
52 69 .tb-legend-label {
  70 + padding: 2px 10px;
53 71 text-align: left;
  72 + white-space: nowrap;
54 73 outline: none;
55 74
56 75 &.tb-horizontal {
... ...
... ... @@ -46,5 +46,6 @@
46 46
47 47 #widget-container {
48 48 min-height: 0;
  49 + min-width: 0;
49 50 }
50 51 }
... ...