mirror of
https://github.com/dataease/dataease.git
synced 2026-05-15 05:22:13 +08:00
fix(图表): fix(图表): 修复堆叠柱条图自定义图例顺序和自定义排序效果冲突 #17649
This commit is contained in:
@@ -976,10 +976,21 @@ export function setUpStackSeriesColor(
|
||||
return
|
||||
}
|
||||
seriesSet.add(d.category)
|
||||
})
|
||||
const cats = [...seriesSet]
|
||||
const stackAxis = extStack[0]
|
||||
if (stackAxis.sort === 'custom_sort' && stackAxis.customSort?.length) {
|
||||
cats.sort((a, b) => {
|
||||
const aIndex = stackAxis.customSort.indexOf(a)
|
||||
const bIndex = stackAxis.customSort.indexOf(b)
|
||||
return aIndex - bIndex
|
||||
})
|
||||
}
|
||||
cats.forEach((c, i) => {
|
||||
result.push({
|
||||
id: d.category,
|
||||
name: d.category,
|
||||
color: colors[(seriesSet.size - 1) % colors.length]
|
||||
id: c,
|
||||
name: c,
|
||||
color: colors[i % colors.length]
|
||||
})
|
||||
})
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user