Merge pull request #10766 from dataease/pr@dev-v2@fix_quota_field_dim_tooltip

fix(图表): 指标字段作为表格维度不显示提示信息
This commit is contained in:
wisonic-s 2024-07-03 16:11:09 +08:00 committed by GitHub
commit d1f1e7763b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 5 deletions

View File

@ -77,7 +77,7 @@ export class TableInfo extends S2ChartView<TableSheet> {
if (value === null || value === undefined) {
return value
}
if (f.groupType === 'd' || !isNumber(value)) {
if (![2, 3].includes(f.deType) || !isNumber(value)) {
return value
}
let formatCfg = f.formatterCfg

View File

@ -68,9 +68,13 @@ export class TableNormal extends S2ChartView<TableSheet> {
})
fields.splice(drillFieldIndex, 0, ...curDrillField)
}
const axisMap = [...chart.xAxis, ...chart.yAxis].reduce((pre, cur) => {
pre[cur.dataeaseName] = cur
return pre
}, {})
// add drill list
fields.forEach(ele => {
const f = getCurrentField(chart.yAxis, ele)
const f = axisMap[ele.dataeaseName]
columns.push(ele.dataeaseName)
meta.push({
field: ele.dataeaseName,
@ -82,7 +86,7 @@ export class TableNormal extends S2ChartView<TableSheet> {
if (value === null || value === undefined) {
return value
}
if (f.groupType === 'd' || !isNumber(value)) {
if (![2, 3].includes(f.deType) || !isNumber(value)) {
return value
}
let formatCfg = f.formatterCfg

View File

@ -4,7 +4,7 @@ import { hexColorToRGBA, parseJson } from '../../../util'
import { S2ChartView, S2DrawOptions } from '../../types/impl/s2'
import { TABLE_EDITOR_PROPERTY_INNER } from './common'
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'
const { t } = useI18n()
@ -83,7 +83,11 @@ export class TablePivot extends S2ChartView<PivotSheet> {
const columns = []
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
return p
}, {})
@ -100,6 +104,9 @@ export class TablePivot extends S2ChartView<PivotSheet> {
if (value === null || value === undefined) {
return value
}
if (![2, 3].includes(f.deType) || !isNumber(value)) {
return value
}
if (f.formatterCfg) {
return valueFormatter(value, f.formatterCfg)
} else {