diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index 728f7469d4..98cf7ed868 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -449,7 +449,8 @@ export const DEFAULT_FUNCTION_CFG = { export const DEFAULT_THRESHOLD = { gaugeThreshold: '', labelThreshold: [], - tableThreshold: [] + tableThreshold: [], + textLabelThreshold: [] } export const DEFAULT_SCROLL = { open: false, diff --git a/frontend/src/views/chart/components/dragItem/utils.js b/frontend/src/views/chart/components/dragItem/utils.js index 2fb419f6f8..f7395b33fa 100644 --- a/frontend/src/views/chart/components/dragItem/utils.js +++ b/frontend/src/views/chart/components/dragItem/utils.js @@ -69,3 +69,15 @@ export function getOriginFieldName(dimensionList, quotaList, field) { } return originName } + +export function resetValueFormatter(item) { + if (item) { + item.formatterCfg = { + type: 'auto', // auto,value,percent + unit: 1, // 换算单位 + suffix: '', // 单位后缀 + decimalCount: 2, // 小数位数 + thousandSeparator: true// 千分符 + } + } +} diff --git a/frontend/src/views/chart/components/normal/LabelNormalText.vue b/frontend/src/views/chart/components/normal/LabelNormalText.vue index 1e133d08d0..eb9a6967b4 100644 --- a/frontend/src/views/chart/components/normal/LabelNormalText.vue +++ b/frontend/src/views/chart/components/normal/LabelNormalText.vue @@ -184,7 +184,7 @@ export default { this.$nextTick(function() { if (that.$refs.tableContainer) { const currentHeight = that.$refs.tableContainer.offsetHeight - const contentHeight = currentHeight - that.$refs.title.offsetHeight - 16 + const contentHeight = currentHeight - that.$refs.title.offsetHeight - 8 that.height = contentHeight + 'px' that.content_class.height = that.height } @@ -195,7 +195,8 @@ export default { const customAttr = JSON.parse(this.chart.customAttr) if (customAttr.color) { this.label_class.color = customAttr.color.dimensionColor - this.label_content_class.color = customAttr.color.quotaColor + // color threshold + this.colorThreshold(customAttr.color.quotaColor) } if (customAttr.size) { this.dimensionShow = customAttr.size.dimensionShow @@ -303,6 +304,57 @@ export default { }, initRemark() { this.remarkCfg = getRemark(this.chart) + }, + colorThreshold(valueColor) { + if (this.chart.senior) { + const senior = JSON.parse(this.chart.senior) + if (senior.threshold && senior.threshold.textLabelThreshold && senior.threshold.textLabelThreshold.length > 0) { + const value = this.chart.data.series[0].data[0] + for (let i = 0; i < senior.threshold.textLabelThreshold.length; i++) { + let flag = false + const t = senior.threshold.textLabelThreshold[i] + const tv = t.value + if (t.term === 'eq') { + if (value === tv) { + this.label_content_class.color = t.color + flag = true + } + } else if (t.term === 'not_eq') { + if (value !== tv) { + this.label_content_class.color = t.color + flag = true + } + } else if (t.term === 'like') { + if (value.includes(tv)) { + this.label_content_class.color = t.color + flag = true + } + } else if (t.term === 'not like') { + if (!value.includes(tv)) { + this.label_content_class.color = t.color + flag = true + } + } else if (t.term === 'null') { + if (value === null || value === undefined || value === '') { + this.label_content_class.color = t.color + flag = true + } + } else if (t.term === 'not_null') { + if (value !== null && value !== undefined && value !== '') { + this.label_content_class.color = t.color + flag = true + } + } + if (flag) { + break + } else if (i === senior.threshold.textLabelThreshold.length - 1) { + this.label_content_class.color = valueColor + } + } + } else { + this.label_content_class.color = valueColor + } + } } } } diff --git a/frontend/src/views/chart/components/senior/Threshold.vue b/frontend/src/views/chart/components/senior/Threshold.vue index a9f7b7958b..3d7e0a5bf3 100644 --- a/frontend/src/views/chart/components/senior/Threshold.vue +++ b/frontend/src/views/chart/components/senior/Threshold.vue @@ -41,6 +41,64 @@ + + + + + + + + {{ $t('chart.filter_eq') }} + {{ $t('chart.filter_not_eq') }} + {{ $t('chart.filter_like') }} + {{ $t('chart.filter_not_like') }} + {{ $t('chart.filter_null') }} + {{ $t('chart.filter_not_null') }} + + + {{ item.value }} +   + + + + + + + + + @@ -236,6 +294,37 @@ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + + + + diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 46db1c4479..8e65f66030 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -998,7 +998,7 @@ >
@@ -1037,7 +1037,7 @@ {{ $t('chart.analyse_cfg') }}