From c240d6bc165610413cc2429b4b78677266945591 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 6 May 2023 17:48:11 +0200 Subject: [PATCH] Avoid random colors on every click --- src/components/charts/PlotConfigurator.vue | 12 ++++++++++-- src/components/charts/PlotIndicatorSelect.vue | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/charts/PlotConfigurator.vue b/src/components/charts/PlotConfigurator.vue index 2b2f3e34..fa5ec73d 100644 --- a/src/components/charts/PlotConfigurator.vue +++ b/src/components/charts/PlotConfigurator.vue @@ -51,7 +51,10 @@ size="sm" class="ms-1 col" :disabled="addNewIndicator" - @click="addNewIndicator = !addNewIndicator" + @click=" + addNewIndicator = !addNewIndicator; + selIndicatorName = ''; + " > Add new indicator @@ -158,6 +161,7 @@ import { deepClone } from '@/shared/deepClone'; import { useBotStore } from '@/stores/ftbotwrapper'; import { usePlotConfigStore } from '@/stores/plotConfig'; import { computed, onMounted, onUnmounted, ref, watch } from 'vue'; +import randomColor from '@/shared/randomColor'; defineProps({ columns: { required: true, type: Array as () => string[] }, @@ -322,7 +326,11 @@ function addNewIndicatorSelected(indicator?: string) { addNewIndicator.value = false; if (indicator) { - addIndicator({ [indicator]: {} }); + addIndicator({ + [indicator]: { + color: randomColor(), + }, + }); selIndicatorName.value = indicator; } } diff --git a/src/components/charts/PlotIndicatorSelect.vue b/src/components/charts/PlotIndicatorSelect.vue index f9668258..008024ca 100644 --- a/src/components/charts/PlotIndicatorSelect.vue +++ b/src/components/charts/PlotIndicatorSelect.vue @@ -13,7 +13,7 @@