Add inverted chart feature.

This commit is contained in:
Miguel Medeiros
2021-09-26 11:41:55 -03:00
parent 7ab1ce8fc4
commit 5ce7b55441
3 changed files with 40 additions and 28 deletions

View File

@@ -36,6 +36,7 @@
<input ngbButton type="radio" [value]="'1y'" [routerLink]="['/graphs' | relativeUrl]" fragment="1y"> 1Y
</label>
</div>
<button (click)="invertGraph()" class="btn btn-primary btn-sm ml-2 d-none d-md-inline"><fa-icon [icon]="['fas', 'exchange-alt']" [rotate]="90" [fixedWidth]="true" i18n-title="statistics.component-invert.title" title="Invert"></fa-icon></button>
</form>
</div>
<div class="card-body">

View File

@@ -31,6 +31,7 @@ export class StatisticsComponent implements OnInit {
radioGroupForm: FormGroup;
graphWindowPreference: String;
inverted: boolean;
constructor(
@Inject(LOCALE_ID) private locale: string,
@@ -44,6 +45,7 @@ export class StatisticsComponent implements OnInit {
) { }
ngOnInit() {
this.inverted = this.storageService.getValue('inverted-graph') === 'true';
this.seoService.setTitle($localize`:@@5d4f792f048fcaa6df5948575d7cb325c9393383:Graphs`);
this.stateService.networkChanged$.subscribe((network) => this.network = network);
this.graphWindowPreference = this.storageService.getValue('graphWindowPreference') ? this.storageService.getValue('graphWindowPreference').trim() : '2h';
@@ -124,4 +126,9 @@ export class StatisticsComponent implements OnInit {
saveGraphPreference() {
this.storageService.setValue('graphWindowPreference', this.radioGroupForm.controls.dateSpan.value);
}
invertGraph() {
this.storageService.setValue('inverted-graph', !this.inverted);
document.location.reload();
}
}