Graph x-axis date fix.

This commit is contained in:
softsimon
2020-05-10 17:44:19 +07:00
parent db64abec4e
commit 50f98807a3
3 changed files with 18 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ import { StateService } from 'src/app/services/state.service';
})
export class MempoolGraphComponent implements OnInit, OnChanges {
@Input() data;
@Input() dateSpan = '2h';
network = '';
mempoolVsizeFeesOptions: any;
@@ -26,7 +27,21 @@ export class MempoolGraphComponent implements OnInit, OnChanges {
ngOnInit(): void {
this.stateService.networkChanged$.subscribe((network) => this.network = network);
const labelInterpolationFnc = (value: any, index: any) => {
return index % 6 === 0 ? formatDate(value, 'HH:mm', this.locale) : null;
switch (this.dateSpan) {
case '2h':
case '24h':
value = formatDate(value, 'HH:mm', this.locale);
break;
case '1w':
value = formatDate(value, 'dd/MM HH:mm', this.locale);
break;
case '1m':
case '3m':
case '6m':
case '1y':
value = formatDate(value, 'dd/MM', this.locale);
}
return index % 6 === 0 ? value : null;
};
this.mempoolVsizeFeesOptions = {