forked from github/dataease
fix(图表): 指标字段作为表格维度不显示提示信息
This commit is contained in:
parent
05720206cc
commit
ec82a90cbe
@ -77,7 +77,7 @@ export class TableInfo extends S2ChartView<TableSheet> {
|
|||||||
if (value === null || value === undefined) {
|
if (value === null || value === undefined) {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
if (f.groupType === 'd' || !isNumber(value)) {
|
if (![2, 3].includes(f.deType) || !isNumber(value)) {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
let formatCfg = f.formatterCfg
|
let formatCfg = f.formatterCfg
|
||||||
|
@ -68,9 +68,13 @@ export class TableNormal extends S2ChartView<TableSheet> {
|
|||||||
})
|
})
|
||||||
fields.splice(drillFieldIndex, 0, ...curDrillField)
|
fields.splice(drillFieldIndex, 0, ...curDrillField)
|
||||||
}
|
}
|
||||||
|
const axisMap = [...chart.xAxis, ...chart.yAxis].reduce((pre, cur) => {
|
||||||
|
pre[cur.dataeaseName] = cur
|
||||||
|
return pre
|
||||||
|
}, {})
|
||||||
// add drill list
|
// add drill list
|
||||||
fields.forEach(ele => {
|
fields.forEach(ele => {
|
||||||
const f = getCurrentField(chart.yAxis, ele)
|
const f = axisMap[ele.dataeaseName]
|
||||||
columns.push(ele.dataeaseName)
|
columns.push(ele.dataeaseName)
|
||||||
meta.push({
|
meta.push({
|
||||||
field: ele.dataeaseName,
|
field: ele.dataeaseName,
|
||||||
@ -82,7 +86,7 @@ export class TableNormal extends S2ChartView<TableSheet> {
|
|||||||
if (value === null || value === undefined) {
|
if (value === null || value === undefined) {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
if (f.groupType === 'd' || !isNumber(value)) {
|
if (![2, 3].includes(f.deType) || !isNumber(value)) {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
let formatCfg = f.formatterCfg
|
let formatCfg = f.formatterCfg
|
||||||
|
@ -4,7 +4,7 @@ import { hexColorToRGBA, parseJson } from '../../../util'
|
|||||||
import { S2ChartView, S2DrawOptions } from '../../types/impl/s2'
|
import { S2ChartView, S2DrawOptions } from '../../types/impl/s2'
|
||||||
import { TABLE_EDITOR_PROPERTY_INNER } from './common'
|
import { TABLE_EDITOR_PROPERTY_INNER } from './common'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { maxBy, merge, minBy } from 'lodash-es'
|
import { isNumber, maxBy, merge, minBy } from 'lodash-es'
|
||||||
import { copyContent } from '../../common/common_table'
|
import { copyContent } from '../../common/common_table'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
@ -83,7 +83,11 @@ export class TablePivot extends S2ChartView<PivotSheet> {
|
|||||||
const columns = []
|
const columns = []
|
||||||
const meta = []
|
const meta = []
|
||||||
|
|
||||||
const valueFieldMap: Record<string, Axis> = chart.yAxis.reduce((p, n) => {
|
const valueFieldMap: Record<string, Axis> = [
|
||||||
|
...chart.xAxis,
|
||||||
|
...chart.xAxisExt,
|
||||||
|
...chart.yAxis
|
||||||
|
].reduce((p, n) => {
|
||||||
p[n.dataeaseName] = n
|
p[n.dataeaseName] = n
|
||||||
return p
|
return p
|
||||||
}, {})
|
}, {})
|
||||||
@ -100,6 +104,9 @@ export class TablePivot extends S2ChartView<PivotSheet> {
|
|||||||
if (value === null || value === undefined) {
|
if (value === null || value === undefined) {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
if (![2, 3].includes(f.deType) || !isNumber(value)) {
|
||||||
|
return value
|
||||||
|
}
|
||||||
if (f.formatterCfg) {
|
if (f.formatterCfg) {
|
||||||
return valueFormatter(value, f.formatterCfg)
|
return valueFormatter(value, f.formatterCfg)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user