feat: support multiple metrics in line, column, and bar charts

This commit is contained in:
ulleo
2026-01-20 17:07:11 +08:00
committed by ulleo
parent 1ed92d73a8
commit da807a503b
6 changed files with 86 additions and 26 deletions
@@ -3,6 +3,7 @@ export interface ChartAxis {
value: string
type?: 'x' | 'y' | 'series' | 'other-info'
'multi-quota'?: boolean
hidden?: boolean
}
export interface ChartData {
@@ -49,7 +49,12 @@ const axis = computed(() => {
_list.push({ name: column.name, value: column.value, type: 'series' })
})
if (params.multiQuotaName) {
_list.push({ name: params.multiQuotaName, value: params.multiQuotaName, type: 'other-info' })
_list.push({
name: params.multiQuotaName,
value: params.multiQuotaName,
type: 'other-info',
hidden: true,
})
}
return _list
})
@@ -7,7 +7,7 @@ import {
type S2DataConfig,
type S2MountContainer,
} from '@antv/s2'
import { debounce } from 'lodash-es'
import { debounce, filter } from 'lodash-es'
import { i18n } from '@/i18n'
const { t } = i18n.global
@@ -43,7 +43,10 @@ export class Table extends BaseChart {
}
init(axis: Array<ChartAxis>, data: Array<ChartData>) {
super.init(axis, data)
super.init(
filter(axis, (a) => !a.hidden), //隐藏多指标的other-info列
data
)
const s2DataConfig: S2DataConfig = {
fields: {