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')) {
|
} else if (equalsAny(chart.type, 'bar-group', 'line')) {
|
||||||
// 拿到data中的category,并去重,然后构建seriesColor
|
// 拿到data中的category,并去重,然后构建seriesColor
|
||||||
const data = chart.data.data
|
if (chart.data) {
|
||||||
const s = []
|
const data = chart.data.data
|
||||||
data.forEach((cur) => {
|
const s = []
|
||||||
if (s.indexOf(cur.category) < 0) {
|
data.forEach((cur) => {
|
||||||
s.push(cur.category)
|
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
|
|
||||||
})
|
})
|
||||||
|
for (let i = 0; i < s.length; i++) {
|
||||||
|
seriesColors.push({
|
||||||
|
name: s[i],
|
||||||
|
color: colors[i % colors.length],
|
||||||
|
isCustom: false
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (chart.data) {
|
if (chart.data) {
|
||||||
|
@ -243,7 +243,7 @@ export default {
|
|||||||
fieldOptions() {
|
fieldOptions() {
|
||||||
const xaxis = this.view.xaxis
|
const xaxis = this.view.xaxis
|
||||||
const yaxis = this.view.yaxis
|
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 xIds = xaxis ? xaxis.map(item => item.id) : []
|
||||||
const yIds = yaxis ? yaxis.map(item => item.id) : []
|
const yIds = yaxis ? yaxis.map(item => item.id) : []
|
||||||
const disableIds = [...xIds, ...yIds, ...locationIds]
|
const disableIds = [...xIds, ...yIds, ...locationIds]
|
||||||
|
Loading…
Reference in New Issue
Block a user