diff --git a/frontend/src/app/lightning/node-fee-chart/node-fee-chart.component.ts b/frontend/src/app/lightning/node-fee-chart/node-fee-chart.component.ts index 242ecc6ed..97268226d 100644 --- a/frontend/src/app/lightning/node-fee-chart/node-fee-chart.component.ts +++ b/frontend/src/app/lightning/node-fee-chart/node-fee-chart.component.ts @@ -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`,