Fix cumprofit chart showing error

This commit is contained in:
Matthias 2023-07-23 07:28:14 +02:00
parent 12d0169992
commit 7a6a31c493

View File

@ -125,7 +125,7 @@ const cumulativeData = computed<CumProfitChartData[]>(() => {
return valueArray; return valueArray;
}); });
function updateChart(initial = false) { function generateChart(initial = false) {
const chartOptionsLoc: EChartsOption = { const chartOptionsLoc: EChartsOption = {
dataset: { dataset: {
dimensions: ['date', 'profit', 'currentProfit'], dimensions: ['date', 'profit', 'currentProfit'],
@ -171,7 +171,6 @@ function updateChart(initial = false) {
}, },
], ],
}; };
// TODO: maybe have profit lines per bot? // TODO: maybe have profit lines per bot?
// this.botList.forEach((botId: string) => { // this.botList.forEach((botId: string) => {
// console.log('bot', botId); // console.log('bot', botId);
@ -188,6 +187,10 @@ function updateChart(initial = false) {
// // symbol: 'none', // // symbol: 'none',
// }); // });
// }); // });
return chartOptionsLoc;
}
function updateChart(initial = false) {
const chartOptionsLoc = generateChart(initial);
chart.value?.setOption(chartOptionsLoc, { chart.value?.setOption(chartOptionsLoc, {
replaceMerge: ['series', 'dataset'], replaceMerge: ['series', 'dataset'],
noMerge: !initial, 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 }); chart.value?.setOption(chartOptionsLoc, { noMerge: true });
updateChart(true); updateChart(true);
} }