Graph x-axis date fix.
This commit is contained in:
		
							parent
							
								
									db64abec4e
								
							
						
					
					
						commit
						50f98807a3
					
				@ -12,6 +12,7 @@ import { StateService } from 'src/app/services/state.service';
 | 
				
			|||||||
})
 | 
					})
 | 
				
			||||||
export class MempoolGraphComponent implements OnInit, OnChanges {
 | 
					export class MempoolGraphComponent implements OnInit, OnChanges {
 | 
				
			||||||
  @Input() data;
 | 
					  @Input() data;
 | 
				
			||||||
 | 
					  @Input() dateSpan = '2h';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  network = '';
 | 
					  network = '';
 | 
				
			||||||
  mempoolVsizeFeesOptions: any;
 | 
					  mempoolVsizeFeesOptions: any;
 | 
				
			||||||
@ -26,7 +27,21 @@ export class MempoolGraphComponent implements OnInit, OnChanges {
 | 
				
			|||||||
  ngOnInit(): void {
 | 
					  ngOnInit(): void {
 | 
				
			||||||
    this.stateService.networkChanged$.subscribe((network) => this.network = network);
 | 
					    this.stateService.networkChanged$.subscribe((network) => this.network = network);
 | 
				
			||||||
    const labelInterpolationFnc = (value: any, index: any) => {
 | 
					    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 = {
 | 
					    this.mempoolVsizeFeesOptions = {
 | 
				
			||||||
 | 
				
			|||||||
@ -44,7 +44,7 @@
 | 
				
			|||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <div class="card-body">
 | 
					        <div class="card-body">
 | 
				
			||||||
          <div style="height: 600px;">
 | 
					          <div style="height: 600px;">
 | 
				
			||||||
            <app-mempool-graph [data]="mempoolStats"></app-mempool-graph>
 | 
					            <app-mempool-graph [data]="mempoolStats" [dateSpan]="radioGroupForm.controls.dateSpan.value"></app-mempool-graph>
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
 | 
				
			|||||||
@ -55,7 +55,7 @@
 | 
				
			|||||||
            </tr>
 | 
					            </tr>
 | 
				
			||||||
            <tr *ngIf="tx.vin.length > tx['@vinLength']">
 | 
					            <tr *ngIf="tx.vin.length > tx['@vinLength']">
 | 
				
			||||||
              <td colspan="3" class="text-center">
 | 
					              <td colspan="3" class="text-center">
 | 
				
			||||||
                <button class="btn btn-sm btn-primary mt-2" (click)="loadMoreVin(tx)">Load more</button>
 | 
					                <button class="btn btn-sm btn-primary mt-2" (click)="loadMoreVin(tx)">Load more ({{ tx.vin.length - tx['@vinLength'] }})</button>
 | 
				
			||||||
              </td>
 | 
					              </td>
 | 
				
			||||||
            </tr>
 | 
					            </tr>
 | 
				
			||||||
          </tbody>
 | 
					          </tbody>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user