diff --git a/core/core-frontend/src/custom-component/indicator/DeIndicator.vue b/core/core-frontend/src/custom-component/indicator/DeIndicator.vue
index 4242a34d4b..5b37c41ced 100644
--- a/core/core-frontend/src/custom-component/indicator/DeIndicator.vue
+++ b/core/core-frontend/src/custom-component/indicator/DeIndicator.vue
@@ -12,6 +12,7 @@ import {
DEFAULT_INDICATOR_STYLE
} from '@/views/chart/components/editor/util/chart'
import { valueFormatter } from '@/views/chart/components/js/formatter'
+import { hexColorToRGBA } from '@/views/chart/components/js/util'
const props = defineProps({
view: {
@@ -222,15 +223,21 @@ const renderChart = async view => {
if (!view) {
return
}
+
+ const TEMP_DEFAULT_CHART = cloneDeep(BASE_VIEW_CONFIG)
+ delete TEMP_DEFAULT_CHART.customAttr.basicStyle.alpha
+
const chart = deepCopy({
- ...defaultsDeep(view, cloneDeep(BASE_VIEW_CONFIG)),
+ ...defaultsDeep(view, TEMP_DEFAULT_CHART),
data: chartData.value
})
+
recursionTransObj(customAttrTrans, chart.customAttr, scale.value, terminal.value)
recursionTransObj(customStyleTrans, chart.customStyle, scale.value, terminal.value)
if (chart.customAttr) {
const customAttr = chart.customAttr
+
if (customAttr.indicator) {
switch (customAttr.indicator.hPosition) {
case 'left':
@@ -254,6 +261,15 @@ const renderChart = async view => {
}
indicatorColor.value = customAttr.indicator.color
+ let suffixColor = customAttr.indicator.suffixColor
+
+ if (customAttr.basicStyle && customAttr.basicStyle.alpha !== undefined) {
+ indicatorColor.value = hexColorToRGBA(
+ customAttr.basicStyle.colors[0],
+ customAttr.basicStyle.alpha
+ )
+ suffixColor = hexColorToRGBA(customAttr.basicStyle.colors[1], customAttr.basicStyle.alpha)
+ }
indicatorClass.value = {
color: thresholdColor.value,
@@ -270,7 +286,7 @@ const renderChart = async view => {
}
indicatorSuffixClass.value = {
- color: customAttr.indicator.suffixColor,
+ color: suffixColor,
'font-size': customAttr.indicator.suffixFontSize + 'px',
'font-family': defaultTo(
CHART_CONT_FAMILY_MAP[customAttr.indicator.suffixFontFamily],
@@ -287,9 +303,15 @@ const renderChart = async view => {
suffixContent.value = defaultTo(customAttr.indicator.suffix, '')
}
if (customAttr.indicatorName && customAttr.indicatorName.show) {
+ let nameColor = customAttr.indicatorName.color
+
+ if (customAttr.basicStyle && customAttr.basicStyle.alpha !== undefined) {
+ nameColor = hexColorToRGBA(customAttr.basicStyle.colors[2], customAttr.basicStyle.alpha)
+ }
+
indicatorNameShow.value = true
indicatorNameClass.value = {
- color: customAttr.indicatorName.color,
+ color: nameColor,
'font-size': customAttr.indicatorName.fontSize + 'px',
'font-family': defaultTo(
CHART_CONT_FAMILY_MAP[customAttr.indicatorName.fontFamily],
diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue
index 54707fee91..956efabf42 100644
--- a/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue
+++ b/core/core-frontend/src/views/chart/components/editor/editor-style/ChartStyle.vue
@@ -1,6 +1,6 @@
@@ -125,6 +148,7 @@ watch(
:predefine="predefineColors"
@change="changeTitleStyle('color')"
is-custom
+ show-alpha
/>
diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/IndicatorValueSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/IndicatorValueSelector.vue
index 6cd2ffc63e..9f2e6cea22 100644
--- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/IndicatorValueSelector.vue
+++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/IndicatorValueSelector.vue
@@ -5,13 +5,15 @@ import {
COLOR_PANEL,
CHART_FONT_FAMILY,
CHART_FONT_LETTER_SPACE,
- DEFAULT_INDICATOR_STYLE
+ DEFAULT_INDICATOR_STYLE,
+ DEFAULT_BASIC_STYLE
} from '@/views/chart/components/editor/util/chart'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { storeToRefs } from 'pinia'
import { cloneDeep, defaultsDeep } from 'lodash-es'
import { ElButton, ElIcon, ElInput } from 'element-plus-secondary'
import Icon from '@/components/icon-custom/src/Icon.vue'
+import { hexColorToRGBA } from '@/views/chart/components/js/util'
const dvMainStore = dvMainStoreWithOut()
const { batchOptStatus } = storeToRefs(dvMainStore)
@@ -31,7 +33,7 @@ const props = defineProps({
}
})
-const emit = defineEmits(['onIndicatorChange'])
+const emit = defineEmits(['onIndicatorChange', 'onBasicStyleChange'])
const toolTip = computed(() => {
return props.themes === 'dark' ? 'ndark' : 'dark'
})
@@ -40,7 +42,8 @@ const fontFamily = CHART_FONT_FAMILY
const fontLetterSpace = CHART_FONT_LETTER_SPACE
const state = reactive({
- indicatorValueForm: JSON.parse(JSON.stringify(DEFAULT_INDICATOR_STYLE))
+ indicatorValueForm: JSON.parse(JSON.stringify(DEFAULT_INDICATOR_STYLE)),
+ basicStyleForm: {} as ChartBasicStyle
})
const { chart } = toRefs(props)
@@ -61,11 +64,27 @@ const changeTitleStyle = prop => {
}
const init = () => {
+ const TEMP_DEFAULT_BASIC_STYLE = cloneDeep(DEFAULT_BASIC_STYLE)
+ delete TEMP_DEFAULT_BASIC_STYLE.alpha
+
+ state.basicStyleForm = defaultsDeep(
+ cloneDeep(props.chart?.customAttr?.basicStyle),
+ cloneDeep(TEMP_DEFAULT_BASIC_STYLE)
+ )
+
const customText = defaultsDeep(
cloneDeep(props.chart?.customAttr?.indicator),
cloneDeep(DEFAULT_INDICATOR_STYLE)
)
+ if (state.basicStyleForm.alpha !== undefined) {
+ const color = hexColorToRGBA(state.basicStyleForm.colors[0], state.basicStyleForm.alpha)
+ const suffixColor = hexColorToRGBA(state.basicStyleForm.colors[1], state.basicStyleForm.alpha)
+
+ customText.color = color
+ customText.suffixColor = suffixColor
+ }
+
state.indicatorValueForm = cloneDeep(customText)
//第一次颜色可能赋值失败,单独赋值一次
@@ -86,6 +105,12 @@ watch(
},
{ deep: true }
)
+
+function getFormData() {
+ return state.indicatorValueForm
+}
+
+defineExpose({ getFormData })
@@ -125,6 +150,7 @@ watch(
class="color-picker-style"
:predefine="predefineColors"
@change="changeTitleStyle('color')"
+ show-alpha
is-custom
/>
@@ -410,6 +436,7 @@ watch(
:predefine="predefineColors"
@change="changeTitleStyle('suffixColor')"
is-custom
+ show-alpha
/>
diff --git a/core/core-frontend/src/views/chart/components/editor/index.vue b/core/core-frontend/src/views/chart/components/editor/index.vue
index 77b3e2ecd2..dbda67309d 100644
--- a/core/core-frontend/src/views/chart/components/editor/index.vue
+++ b/core/core-frontend/src/views/chart/components/editor/index.vue
@@ -691,13 +691,25 @@ const onLabelChange = val => {
renderChart(view.value)
}
-const onIndicatorChange = val => {
- view.value.customAttr.indicator = val
+const onIndicatorChange = (val, prop) => {
+ if (prop === 'color' || prop === 'suffixColor') {
+ view.value.customAttr.basicStyle.alpha = undefined
+ if (val.indicatorName !== undefined) {
+ view.value.customAttr.indicatorName = val.indicatorName
+ }
+ }
+ view.value.customAttr.indicator = val.indicatorValue
renderChart(view.value)
}
-const onIndicatorNameChange = val => {
- view.value.customAttr.indicatorName = val
+const onIndicatorNameChange = (val, prop) => {
+ if (prop === 'color') {
+ view.value.customAttr.basicStyle.alpha = undefined
+ if (val.indicatorValue !== undefined) {
+ view.value.customAttr.indicator = val.indicatorValue
+ }
+ }
+ view.value.customAttr.indicatorName = val.indicatorName
renderChart(view.value)
}
diff --git a/core/core-frontend/src/views/chart/components/editor/util/chart.ts b/core/core-frontend/src/views/chart/components/editor/util/chart.ts
index d3d71ecb7a..590bab5478 100644
--- a/core/core-frontend/src/views/chart/components/editor/util/chart.ts
+++ b/core/core-frontend/src/views/chart/components/editor/util/chart.ts
@@ -354,7 +354,7 @@ export const DEFAULT_TITLE_STYLE: ChartTextStyle = {
export const DEFAULT_INDICATOR_STYLE: ChartIndicatorStyle = {
show: true,
fontSize: '20',
- color: '#5470C6',
+ color: '#5470C6ff',
hPosition: 'center',
vPosition: 'center',
isItalic: false,
@@ -366,7 +366,7 @@ export const DEFAULT_INDICATOR_STYLE: ChartIndicatorStyle = {
suffixEnable: true,
suffix: '',
suffixFontSize: '14',
- suffixColor: '#5470C6',
+ suffixColor: '#5470C6ff',
suffixIsItalic: false,
suffixIsBolder: true,
suffixFontFamily: 'Microsoft YaHei',
@@ -376,7 +376,7 @@ export const DEFAULT_INDICATOR_STYLE: ChartIndicatorStyle = {
export const DEFAULT_INDICATOR_NAME_STYLE: ChartIndicatorNameStyle = {
show: true,
fontSize: '18',
- color: '#ffffff',
+ color: '#ffffffff',
isItalic: false,
isBolder: true,
fontFamily: 'Microsoft YaHei',