fix(图表): 修复柱条图条件样式,两个相同的字段,并不是最后的字段配置生效的问题

This commit is contained in:
jianneng-fit2cloud 2024-12-31 18:00:31 +08:00 committed by xuwei-fit2cloud
parent 7f8866aac8
commit 9b39250dca

View File

@ -1646,11 +1646,15 @@ export const addConditionsStyleColorToData = (chart: Chart, options) => {
*/
const getColorByConditions = (quotaList: [], values: number | number[], chart) => {
const { threshold } = parseJson(chart.senior)
const conditions = threshold.lineThreshold ?? []
const { basicStyle } = parseJson(chart.customAttr)
const currentValue = Array.isArray(values) ? values[1] - values[0] : values
if (!currentValue) return undefined
for (const condition of conditions) {
// 同样的指标只取最后一个
const conditionMap = new Map()
for (const condition of threshold.lineThreshold ?? []) {
conditionMap.set(condition.fieldId, condition)
}
for (const condition of conditionMap.values()) {
if (chart.type === 'progress-bar' && chart.yAxisExt?.[0]?.id !== quotaList[0]) continue
if (!quotaList.includes(condition.fieldId) && chart.type !== 'waterfall') continue
for (const tc of condition.conditions) {