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

Function getColumnOptions

g2-ssr/charts/column.js:3–139  ·  view source on GitHub ↗
(baseOptions, axis, data)

Source from the content-addressed store, hash-verified

1const { checkIsPercent, formatNumber, getAxesWithFilter, processMultiQuotaData } = require('./utils')
2
3function getColumnOptions(baseOptions, axis, data) {
4
5 const axes = getAxesWithFilter(axis)
6
7 if (axes.x.length === 0 || axes?.y?.length === 0) {
8 return
9 }
10
11 let config = {
12 data: data,
13 y: axes.y,
14 series: axes.series,
15 }
16 if (axes.multiQuota.length > 0) {
17 config = processMultiQuotaData(
18 axes.x,
19 config.y,
20 axes.multiQuota,
21 axes.multiQuotaName,
22 config.data,
23 )
24 }
25
26 const x = axes.x
27 const y = config.y
28 const series = config.series
29
30 const _data = checkIsPercent(y, config.data)
31
32 const options = {
33 ...baseOptions,
34 type: 'interval',
35 data: _data.data,
36 encode: {
37 x: x[0].value,
38 y: y[0].value,
39 color: series.length > 0 ? series[0].value : undefined,
40 },
41 style: {
42 radiusTopLeft: (d) => {
43 if (d[y[0].value] && d[y[0].value] > 0) {
44 return 4
45 }
46 return 0
47 },
48 radiusTopRight: (d) => {
49 if (d[y[0].value] && d[y[0].value] > 0) {
50 return 4
51 }
52 return 0
53 },
54 radiusBottomLeft: (d) => {
55 if (d[y[0].value] && d[y[0].value] < 0) {
56 return 4
57 }
58 return 0
59 },
60 radiusBottomRight: (d) => {

Callers 1

getOptionsFunction · 0.85

Calls 4

getAxesWithFilterFunction · 0.70
processMultiQuotaDataFunction · 0.70
checkIsPercentFunction · 0.70
formatNumberFunction · 0.70

Tested by

no test coverage detected