mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-11 02:36:54 +08:00
feat: support multiple metrics in line, column, and bar charts
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user