Show "No data to display yet" in "Fee distribution" chart on node page when there are no channels yet
This commit is contained in:
		
							parent
							
								
									f1f6c48128
								
							
						
					
					
						commit
						ed69591bcf
					
				| @ -101,8 +101,15 @@ export class NodeFeeChartComponent implements OnInit { | ||||
|   } | ||||
| 
 | ||||
|   prepareChartOptions(outgoingData, incomingData): void { | ||||
|     let sum = outgoingData.reduce((accumulator, object) => { | ||||
|       return accumulator + object.count; | ||||
|     }, 0); | ||||
|     sum += incomingData.reduce((accumulator, object) => { | ||||
|       return accumulator + object.count; | ||||
|     }, 0); | ||||
| 
 | ||||
|     let title: object; | ||||
|     if (outgoingData.length === 0) { | ||||
|     if (sum === 0) { | ||||
|       title = { | ||||
|         textStyle: { | ||||
|           color: 'grey', | ||||
| @ -115,7 +122,7 @@ export class NodeFeeChartComponent implements OnInit { | ||||
|     } | ||||
| 
 | ||||
|     this.chartOptions = { | ||||
|       title: outgoingData.length === 0 ? title : undefined, | ||||
|       title: sum === 0 ? title : undefined, | ||||
|       animation: false, | ||||
|       grid: { | ||||
|         top: 30, | ||||
| @ -151,7 +158,7 @@ export class NodeFeeChartComponent implements OnInit { | ||||
|           `;
 | ||||
|         } | ||||
|       }, | ||||
|       xAxis: outgoingData.length === 0 ? undefined : { | ||||
|       xAxis: sum === 0 ? undefined : { | ||||
|         type: 'category', | ||||
|         axisLine: { onZero: true }, | ||||
|         axisLabel: { | ||||
| @ -163,7 +170,7 @@ export class NodeFeeChartComponent implements OnInit { | ||||
|         }, | ||||
|         data: outgoingData.map(bucket => bucket.label) | ||||
|       }, | ||||
|       legend: outgoingData.length === 0 ? undefined : { | ||||
|       legend: sum === 0 ? undefined : { | ||||
|         padding: 10, | ||||
|         data: [ | ||||
|           { | ||||
| @ -184,7 +191,7 @@ export class NodeFeeChartComponent implements OnInit { | ||||
|           }, | ||||
|         ], | ||||
|       }, | ||||
|       yAxis: outgoingData.length === 0 ? undefined : [ | ||||
|       yAxis: sum === 0 ? undefined : [ | ||||
|         { | ||||
|           type: 'value', | ||||
|           axisLabel: { | ||||
| @ -202,7 +209,7 @@ export class NodeFeeChartComponent implements OnInit { | ||||
|           }, | ||||
|         }, | ||||
|       ], | ||||
|       series: outgoingData.length === 0 ? undefined : [ | ||||
|       series: sum === 0 ? undefined : [ | ||||
|         { | ||||
|           zlevel: 0, | ||||
|           name: $localize`Outgoing Fees`, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user