[graph] don't change yaxis scale if no outliers - save state in localstorage

This commit is contained in:
nymkappa 2023-11-15 18:46:33 +09:00
parent 2d30c0b588
commit dc26c6f105
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04
3 changed files with 12 additions and 2 deletions

View File

@ -255,7 +255,15 @@ export class IncomingTransactionsGraphComponent implements OnInit, OnChanges, On
}
],
yAxis: {
max: this.outlierCappingEnabled ? Math.round(this.medianVbytesPerSecond * OUTLIERS_MEDIAN_MULTIPLIER) : undefined,
max: (value) => {
if (!this.outlierCappingEnabled) {
return undefined;
}
if (value.max < this.medianVbytesPerSecond * OUTLIERS_MEDIAN_MULTIPLIER) {
return undefined;
}
return Math.round(this.medianVbytesPerSecond * OUTLIERS_MEDIAN_MULTIPLIER);
},
type: 'value',
axisLabel: {
fontSize: 11,

View File

@ -117,7 +117,7 @@
</button>
</div>
<div class="form-check">
<input style="margin-top: 9px" class="form-check-input" type="checkbox" value="" id="hide-outliers" (change)="onOutlierToggleChange($event)">
<input style="margin-top: 9px" class="form-check-input" type="checkbox" [checked]="outlierCappingEnabled" id="hide-outliers" (change)="onOutlierToggleChange($event)">
<label class="form-check-label" for="hide-outliers">
<small i18n="statistics.cap-outliers">Cap outliers</small>
</label>

View File

@ -67,6 +67,7 @@ export class StatisticsComponent implements OnInit {
this.seoService.setDescription($localize`:@@meta.description.bitcoin.graphs.mempool:See mempool size (in MvB) and transactions per second (in vB/s) visualized over time.`);
this.stateService.networkChanged$.subscribe((network) => this.network = network);
this.graphWindowPreference = this.storageService.getValue('graphWindowPreference') ? this.storageService.getValue('graphWindowPreference').trim() : '2h';
this.outlierCappingEnabled = this.storageService.getValue('cap-outliers') === 'true';
this.radioGroupForm = this.formBuilder.group({
dateSpan: this.graphWindowPreference
@ -212,6 +213,7 @@ export class StatisticsComponent implements OnInit {
onOutlierToggleChange(e): void {
this.outlierCappingEnabled = e.target.checked;
this.storageService.setValue('cap-outliers', e.target.checked);
}
onSaveChart(name) {