From 946fd1471d394c4f212ad03981cd681e2df0cf43 Mon Sep 17 00:00:00 2001 From: bptrgx <47859535+bptrgx@users.noreply.github.com> Date: Fri, 7 Jul 2023 20:55:05 +0200 Subject: [PATCH] Fix https://github.com/ghostfolio/ghostfolio/pull/2123#pullrequestreview-1519260989 : prevent from creating empty datasets --- libs/ui/src/lib/line-chart/line-chart.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/ui/src/lib/line-chart/line-chart.component.ts b/libs/ui/src/lib/line-chart/line-chart.component.ts index a402f3b39..44902f2cb 100644 --- a/libs/ui/src/lib/line-chart/line-chart.component.ts +++ b/libs/ui/src/lib/line-chart/line-chart.component.ts @@ -168,7 +168,10 @@ export class LineChartComponent implements AfterViewInit, OnChanges, OnDestroy { this.historicalDataItems?.forEach((historicalDataItem, index) => { data.datasets[0].data.push(this.benchmarkDataItems?.[index]?.value); - if (this.benchmarkDataItems?.[index]?.value === null) { + if ( + this.benchmarkDataItems?.[index]?.value === null && + data.datasets[0].data.some((value) => value !== null) + ) { data.datasets.unshift({ borderColor: `rgb(${secondaryColorRgb.r}, ${secondaryColorRgb.g}, ${secondaryColorRgb.b})`, borderWidth: 1,