From 88d4b5cf976bff564e5ec1f7b7a11aff91ac6655 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 28 May 2023 15:51:13 +0200 Subject: [PATCH] Show tooltip for current_profit --- src/components/charts/CumProfitChart.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/charts/CumProfitChart.vue b/src/components/charts/CumProfitChart.vue index d2464380..8bb4f9e5 100644 --- a/src/components/charts/CumProfitChart.vue +++ b/src/components/charts/CumProfitChart.vue @@ -128,9 +128,7 @@ function updateChart(initial = false) { name: 'currentProfit', animation: initial, - tooltip: { - show: false, - }, + lineStyle: { color: openProfit.value > 0 ? 'green' : 'red', type: 'dotted', @@ -193,9 +191,14 @@ function initializeChart() { show: props.showTitle, }, backgroundColor: 'rgba(0, 0, 0, 0)', - tooltip: { trigger: 'axis', + formatter: (params) => { + const profit = params[0].data.profit; + const currentProfit = params[0].data['currentProfit']; + const profitText = currentProfit ? `Current Profit: ${currentProfit}` : `Profit: ${profit}`; + return profitText; + }, axisPointer: { type: 'line', label: {