Add support for zooming in address balance graph
This commit is contained in:
		
							parent
							
								
									7bef8653b1
								
							
						
					
					
						commit
						2b44055fc7
					
				| @ -2,7 +2,7 @@ | |||||||
| 
 | 
 | ||||||
| <div [class.full-container]="!widget"> | <div [class.full-container]="!widget"> | ||||||
|   <ng-container *ngIf="!error"> |   <ng-container *ngIf="!error"> | ||||||
|     <div [class]="!widget ? 'chart' : 'chart-widget'" *browserOnly [style]="{ height: widget ? ((height + 20) + 'px') : null}" echarts [initOpts]="chartInitOptions" [options]="chartOptions" |     <div [class]="!widget ? 'chart' : 'chart-widget'" *browserOnly [style]="{ height: widget ? ((height + 20) + 'px') : null, paddingBottom: !widget && !allowZoom ? '10px' : null}" echarts [initOpts]="chartInitOptions" [options]="chartOptions" | ||||||
|       (chartInit)="onChartInit($event)"> |       (chartInit)="onChartInit($event)"> | ||||||
|     </div> |     </div> | ||||||
|     <div class="text-center loadingGraphs" *ngIf="isLoading"> |     <div class="text-center loadingGraphs" *ngIf="isLoading"> | ||||||
|  | |||||||
| @ -46,7 +46,6 @@ | |||||||
|   display: flex; |   display: flex; | ||||||
|   flex: 1; |   flex: 1; | ||||||
|   width: 100%; |   width: 100%; | ||||||
|   padding-bottom: 10px; |  | ||||||
|   padding-right: 10px; |   padding-right: 10px; | ||||||
| } | } | ||||||
| .chart-widget { | .chart-widget { | ||||||
|  | |||||||
| @ -50,6 +50,7 @@ export class AddressGraphComponent implements OnChanges, OnDestroy { | |||||||
|   hoverData: any[] = []; |   hoverData: any[] = []; | ||||||
|   showFiat = false; |   showFiat = false; | ||||||
|   conversions: any; |   conversions: any; | ||||||
|  |   allowZoom: boolean = false; | ||||||
| 
 | 
 | ||||||
|   subscription: Subscription; |   subscription: Subscription; | ||||||
|   redraw$: BehaviorSubject<boolean> = new BehaviorSubject(false); |   redraw$: BehaviorSubject<boolean> = new BehaviorSubject(false); | ||||||
| @ -100,6 +101,7 @@ export class AddressGraphComponent implements OnChanges, OnDestroy { | |||||||
|         if (addressSummary) { |         if (addressSummary) { | ||||||
|           this.error = null; |           this.error = null; | ||||||
|           this.conversions = conversions; |           this.conversions = conversions; | ||||||
|  |           this.allowZoom = addressSummary.length > 100 && !this.widget; | ||||||
|           this.prepareChartOptions(addressSummary); |           this.prepareChartOptions(addressSummary); | ||||||
|         } |         } | ||||||
|         this.isLoading = false; |         this.isLoading = false; | ||||||
| @ -169,7 +171,7 @@ export class AddressGraphComponent implements OnChanges, OnDestroy { | |||||||
|       animation: false, |       animation: false, | ||||||
|       grid: { |       grid: { | ||||||
|         top: 20, |         top: 20, | ||||||
|         bottom: 20, |         bottom: this.allowZoom ? 65 : 20, | ||||||
|         right: this.right, |         right: this.right, | ||||||
|         left: this.left, |         left: this.left, | ||||||
|       }, |       }, | ||||||
| @ -337,6 +339,28 @@ export class AddressGraphComponent implements OnChanges, OnDestroy { | |||||||
|           step: 'end' |           step: 'end' | ||||||
|         } |         } | ||||||
|       ], |       ], | ||||||
|  |       dataZoom: this.allowZoom ? [{ | ||||||
|  |         type: 'inside', | ||||||
|  |         realtime: true, | ||||||
|  |         zoomLock: true, | ||||||
|  |         maxSpan: 100, | ||||||
|  |         minSpan: 5, | ||||||
|  |         moveOnMouseMove: false, | ||||||
|  |       }, { | ||||||
|  |         showDetail: false, | ||||||
|  |         show: true, | ||||||
|  |         type: 'slider', | ||||||
|  |         brushSelect: false, | ||||||
|  |         realtime: true, | ||||||
|  |         left: this.left, | ||||||
|  |         right: this.right, | ||||||
|  |         selectedDataBackground: { | ||||||
|  |           lineStyle: { | ||||||
|  |             color: '#fff', | ||||||
|  |             opacity: 0.45, | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  |       }] : undefined | ||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user