(baseOptions, axis, data)
| 1 | const { checkIsPercent, formatNumber, getAxesWithFilter, processMultiQuotaData } = require('./utils') |
| 2 | |
| 3 | function 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) => { |
no test coverage detected