[develop | DONE | CHANGED] indicator form: show datatitles only if legend is enabled in chart

This commit is contained in:
argirok 2024-06-19 11:20:58 +03:00
parent 51787e582a
commit deaa358cea
2 changed files with 10 additions and 3 deletions

View File

@ -565,9 +565,11 @@
<div *ngIf="getParameter(i, 'yAxisTitle')" input class="uk-width-1-3@s" <div *ngIf="getParameter(i, 'yAxisTitle')" input class="uk-width-1-3@s"
[formInput]="getParameter(i, 'yAxisTitle').get('value')" [formInput]="getParameter(i, 'yAxisTitle').get('value')"
placeholder="Y-Axis Title"></div> placeholder="Y-Axis Title"></div>
<ng-container *ngIf="isLegendEnabled(indicator, i)">
<div *ngFor="let dataTitle of dataTitles(i); let j=index" input class="uk-width-1-3@s" <div *ngFor="let dataTitle of dataTitles(i); let j=index" input class="uk-width-1-3@s"
[formInput]="getParameter(i, dataTitle).get('value')" [formInput]="getParameter(i, dataTitle).get('value')"
[placeholder]="'Data Title ' + (j + 1)"></div> [placeholder]="'Data Title ' + (j + 1)"></div>
</ng-container>
<div *ngIf="getParameter(i, 'start_year')" input class="uk-width-1-3@s" <div *ngIf="getParameter(i, 'start_year')" input class="uk-width-1-3@s"
[formInput]="getParameter(i, 'start_year').get('value')" [formInput]="getParameter(i, 'start_year').get('value')"
placeholder="Year (From)"></div> placeholder="Year (From)"></div>

View File

@ -1547,4 +1547,9 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple
get isEditable(): boolean { get isEditable(): boolean {
return this.stakeholder.copy || this.stakeholder.defaultId == null || this.stakeholder.defaultId == '-1'; return this.stakeholder.copy || this.stakeholder.defaultId == null || this.stakeholder.defaultId == '-1';
} }
isLegendEnabled(indicator, i){
let chartObject = JSON.parse(indicator.indicatorPaths[i].chartObject, indicator.indicatorPaths[i].chartObject)
return !chartObject || !chartObject.chartDescription.legend || chartObject.chartDescription.legend.enabled
}
} }