From 7a6a31c493b3e183484aa61a5d34e96c24e77cda Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 23 Jul 2023 07:28:14 +0200 Subject: [PATCH] Fix cumprofit chart showing error --- src/components/charts/CumProfitChart.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/charts/CumProfitChart.vue b/src/components/charts/CumProfitChart.vue index b150763d..ae1cf16b 100644 --- a/src/components/charts/CumProfitChart.vue +++ b/src/components/charts/CumProfitChart.vue @@ -125,7 +125,7 @@ const cumulativeData = computed(() => { return valueArray; }); -function updateChart(initial = false) { +function generateChart(initial = false) { const chartOptionsLoc: EChartsOption = { dataset: { dimensions: ['date', 'profit', 'currentProfit'], @@ -171,7 +171,6 @@ function updateChart(initial = false) { }, ], }; - // TODO: maybe have profit lines per bot? // this.botList.forEach((botId: string) => { // console.log('bot', botId); @@ -188,6 +187,10 @@ function updateChart(initial = false) { // // symbol: 'none', // }); // }); + return chartOptionsLoc; +} +function updateChart(initial = false) { + const chartOptionsLoc = generateChart(initial); chart.value?.setOption(chartOptionsLoc, { replaceMerge: ['series', 'dataset'], noMerge: !initial, @@ -260,6 +263,11 @@ function initializeChart() { }, ], }; + const chartOptionsLoc1 = generateChart(true); + // Merge the series and dataset, but not the rest + chartOptionsLoc.series = chartOptionsLoc1.series; + chartOptionsLoc.dataset = chartOptionsLoc1.dataset; + chart.value?.setOption(chartOptionsLoc, { noMerge: true }); updateChart(true); }