forked from github/dataease
fix(视图): 修复部分视图初始化报错
This commit is contained in:
parent
442a956b7f
commit
55bc0b10e1
@ -3367,19 +3367,21 @@ export function getColors(chart, colors, reset) {
|
||||
}
|
||||
} else if (equalsAny(chart.type, 'bar-group', 'line')) {
|
||||
// 拿到data中的category,并去重,然后构建seriesColor
|
||||
const data = chart.data.data
|
||||
const s = []
|
||||
data.forEach((cur) => {
|
||||
if (s.indexOf(cur.category) < 0) {
|
||||
s.push(cur.category)
|
||||
}
|
||||
})
|
||||
for (let i = 0; i < s.length; i++) {
|
||||
seriesColors.push({
|
||||
name: s[i],
|
||||
color: colors[i % colors.length],
|
||||
isCustom: false
|
||||
if (chart.data) {
|
||||
const data = chart.data.data
|
||||
const s = []
|
||||
data.forEach((cur) => {
|
||||
if (s.indexOf(cur.category) < 0) {
|
||||
s.push(cur.category)
|
||||
}
|
||||
})
|
||||
for (let i = 0; i < s.length; i++) {
|
||||
seriesColors.push({
|
||||
name: s[i],
|
||||
color: colors[i % colors.length],
|
||||
isCustom: false
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (chart.data) {
|
||||
|
@ -243,7 +243,7 @@ export default {
|
||||
fieldOptions() {
|
||||
const xaxis = this.view.xaxis
|
||||
const yaxis = this.view.yaxis
|
||||
const locationIds = this.view.viewFields.filter(item => item.busiType === 'locationXaxis' || item.busiType === 'locationYaxis').map(item => item.id)
|
||||
const locationIds = this.view.viewFields ? this.view.viewFields.filter(item => item.busiType === 'locationXaxis' || item.busiType === 'locationYaxis').map(item => item.id) : []
|
||||
const xIds = xaxis ? xaxis.map(item => item.id) : []
|
||||
const yIds = yaxis ? yaxis.map(item => item.id) : []
|
||||
const disableIds = [...xIds, ...yIds, ...locationIds]
|
||||
|
Loading…
Reference in New Issue
Block a user