Show "No data to display yet" until we have at least two points for node stats charts

This commit is contained in:
nymkappa 2023-03-22 13:45:27 +09:00
parent 77835bcb9d
commit f1f6c48128
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04

View File

@ -75,7 +75,7 @@ export class NodeStatisticsChartComponent implements OnInit {
prepareChartOptions(data) { prepareChartOptions(data) {
let title: object; let title: object;
if (data.channels.length === 0) { if (data.channels.length < 2) {
title = { title = {
textStyle: { textStyle: {
color: 'grey', color: 'grey',
@ -135,14 +135,14 @@ export class NodeStatisticsChartComponent implements OnInit {
return tooltip; return tooltip;
} }
}, },
xAxis: data.channels.length === 0 ? undefined : { xAxis: data.channels.length < 2 ? undefined : {
type: 'time', type: 'time',
splitNumber: this.isMobile() ? 5 : 10, splitNumber: this.isMobile() ? 5 : 10,
axisLabel: { axisLabel: {
hideOverlap: true, hideOverlap: true,
} }
}, },
legend: data.channels.length === 0 ? undefined : { legend: data.channels.length < 2 ? undefined : {
padding: 10, padding: 10,
data: [ data: [
{ {
@ -167,7 +167,7 @@ export class NodeStatisticsChartComponent implements OnInit {
'Capacity': true, 'Capacity': true,
} }
}, },
yAxis: data.channels.length === 0 ? undefined : [ yAxis: data.channels.length < 2 ? undefined : [
{ {
type: 'value', type: 'value',
axisLabel: { axisLabel: {
@ -198,7 +198,7 @@ export class NodeStatisticsChartComponent implements OnInit {
} }
} }
], ],
series: data.channels.length === 0 ? [] : [ series: data.channels.length < 2 ? [] : [
{ {
zlevel: 1, zlevel: 1,
name: $localize`:@@807cf11e6ac1cde912496f764c176bdfdd6b7e19:Channels`, name: $localize`:@@807cf11e6ac1cde912496f764c176bdfdd6b7e19:Channels`,