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 { |   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; |     let title: object; | ||||||
|     if (outgoingData.length === 0) { |     if (sum === 0) { | ||||||
|       title = { |       title = { | ||||||
|         textStyle: { |         textStyle: { | ||||||
|           color: 'grey', |           color: 'grey', | ||||||
| @ -115,7 +122,7 @@ export class NodeFeeChartComponent implements OnInit { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     this.chartOptions = { |     this.chartOptions = { | ||||||
|       title: outgoingData.length === 0 ? title : undefined, |       title: sum === 0 ? title : undefined, | ||||||
|       animation: false, |       animation: false, | ||||||
|       grid: { |       grid: { | ||||||
|         top: 30, |         top: 30, | ||||||
| @ -151,7 +158,7 @@ export class NodeFeeChartComponent implements OnInit { | |||||||
|           `;
 |           `;
 | ||||||
|         } |         } | ||||||
|       }, |       }, | ||||||
|       xAxis: outgoingData.length === 0 ? undefined : { |       xAxis: sum === 0 ? undefined : { | ||||||
|         type: 'category', |         type: 'category', | ||||||
|         axisLine: { onZero: true }, |         axisLine: { onZero: true }, | ||||||
|         axisLabel: { |         axisLabel: { | ||||||
| @ -163,7 +170,7 @@ export class NodeFeeChartComponent implements OnInit { | |||||||
|         }, |         }, | ||||||
|         data: outgoingData.map(bucket => bucket.label) |         data: outgoingData.map(bucket => bucket.label) | ||||||
|       }, |       }, | ||||||
|       legend: outgoingData.length === 0 ? undefined : { |       legend: sum === 0 ? undefined : { | ||||||
|         padding: 10, |         padding: 10, | ||||||
|         data: [ |         data: [ | ||||||
|           { |           { | ||||||
| @ -184,7 +191,7 @@ export class NodeFeeChartComponent implements OnInit { | |||||||
|           }, |           }, | ||||||
|         ], |         ], | ||||||
|       }, |       }, | ||||||
|       yAxis: outgoingData.length === 0 ? undefined : [ |       yAxis: sum === 0 ? undefined : [ | ||||||
|         { |         { | ||||||
|           type: 'value', |           type: 'value', | ||||||
|           axisLabel: { |           axisLabel: { | ||||||
| @ -202,7 +209,7 @@ export class NodeFeeChartComponent implements OnInit { | |||||||
|           }, |           }, | ||||||
|         }, |         }, | ||||||
|       ], |       ], | ||||||
|       series: outgoingData.length === 0 ? undefined : [ |       series: sum === 0 ? undefined : [ | ||||||
|         { |         { | ||||||
|           zlevel: 0, |           zlevel: 0, | ||||||
|           name: $localize`Outgoing Fees`, |           name: $localize`Outgoing Fees`, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user