mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 19:42:56 +08:00
fix(图表): 修复柱条图条件样式,两个相同的字段,并不是最后的字段配置生效的问题
This commit is contained in:
parent
7f8866aac8
commit
9b39250dca
@ -1646,11 +1646,15 @@ export const addConditionsStyleColorToData = (chart: Chart, options) => {
|
|||||||
*/
|
*/
|
||||||
const getColorByConditions = (quotaList: [], values: number | number[], chart) => {
|
const getColorByConditions = (quotaList: [], values: number | number[], chart) => {
|
||||||
const { threshold } = parseJson(chart.senior)
|
const { threshold } = parseJson(chart.senior)
|
||||||
const conditions = threshold.lineThreshold ?? []
|
|
||||||
const { basicStyle } = parseJson(chart.customAttr)
|
const { basicStyle } = parseJson(chart.customAttr)
|
||||||
const currentValue = Array.isArray(values) ? values[1] - values[0] : values
|
const currentValue = Array.isArray(values) ? values[1] - values[0] : values
|
||||||
if (!currentValue) return undefined
|
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 (chart.type === 'progress-bar' && chart.yAxisExt?.[0]?.id !== quotaList[0]) continue
|
||||||
if (!quotaList.includes(condition.fieldId) && chart.type !== 'waterfall') continue
|
if (!quotaList.includes(condition.fieldId) && chart.type !== 'waterfall') continue
|
||||||
for (const tc of condition.conditions) {
|
for (const tc of condition.conditions) {
|
||||||
|
Loading…
Reference in New Issue
Block a user