MCPcopy Create free account
hub / github.com/dataease/SQLBot / getAxesWithFilter

Function getAxesWithFilter

g2-ssr/charts/utils.js:36–65  ·  view source on GitHub ↗
(axes)

Source from the content-addressed store, hash-verified

34}
35
36function getAxesWithFilter(axes) {
37 const groups = {
38 x: [],
39 y: [],
40 series: [],
41 multiQuota: [],
42 multiQuotaName: undefined,
43 }
44
45 // 分组
46 axes.forEach((axis) => {
47 if (axis.type === 'x') groups.x.push(axis)
48 else if (axis.type === 'y') groups.y.push(axis)
49 else if (axis.type === 'series') groups.series.push(axis)
50 else if (axis.type === 'other-info') groups.multiQuotaName = axis.value
51 })
52
53 // 应用过滤规则
54 if (groups.series.length > 0) {
55 groups.y = groups.y.slice(0, 1)
56 } else {
57 const multiQuotaY = groups.y.filter((item) => item['multi-quota'] === true)
58 groups.multiQuota = multiQuotaY.map((item) => item.value)
59 if (multiQuotaY.length > 0) {
60 groups.y = multiQuotaY
61 }
62 }
63
64 return groups
65}
66
67function processMultiQuotaData(
68 x,

Callers 4

getLineOptionsFunction · 0.70
getPieOptionsFunction · 0.70
getBarOptionsFunction · 0.70
getColumnOptionsFunction · 0.70

Calls 4

forEachMethod · 0.45
pushMethod · 0.45
filterMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected