(axis: Array<ChartAxis>, data: Array<ChartData>)
| 14 | } |
| 15 | |
| 16 | init(axis: Array<ChartAxis>, data: Array<ChartData>) { |
| 17 | super.init(axis, data) |
| 18 | |
| 19 | const axes = getAxesWithFilter(this.axis) |
| 20 | |
| 21 | if (axes.x.length == 0 || axes.y.length == 0) { |
| 22 | console.debug({ instance: this }) |
| 23 | return |
| 24 | } |
| 25 | |
| 26 | let config = { |
| 27 | data: data, |
| 28 | y: axes.y, |
| 29 | series: axes.series, |
| 30 | } |
| 31 | if (axes.multiQuota.length > 0) { |
| 32 | config = processMultiQuotaData( |
| 33 | axes.x, |
| 34 | config.y, |
| 35 | axes.multiQuota, |
| 36 | axes.multiQuotaName, |
| 37 | config.data |
| 38 | ) |
| 39 | } |
| 40 | |
| 41 | const x = axes.x |
| 42 | const y = config.y |
| 43 | const series = config.series |
| 44 | |
| 45 | const _data = checkIsPercent(y, config.data) |
| 46 | |
| 47 | console.debug({ 'render-info': { x: x, y: y, series: series, data: _data }, instance: this }) |
| 48 | |
| 49 | const options: G2Spec = { |
| 50 | ...this.chart.options(), |
| 51 | type: 'interval', |
| 52 | data: _data.data, |
| 53 | coordinate: { transform: [{ type: 'transpose' }] }, |
| 54 | encode: { |
| 55 | x: x[0].value, |
| 56 | y: y[0].value, |
| 57 | color: series.length > 0 ? series[0].value : undefined, |
| 58 | }, |
| 59 | style: { |
| 60 | radiusTopLeft: (d: ChartData) => { |
| 61 | if (d[y[0].value] && d[y[0].value] > 0) { |
| 62 | return 4 |
| 63 | } |
| 64 | return 0 |
| 65 | }, |
| 66 | radiusTopRight: (d: ChartData) => { |
| 67 | if (d[y[0].value] && d[y[0].value] > 0) { |
| 68 | return 4 |
| 69 | } |
| 70 | return 0 |
| 71 | }, |
| 72 | radiusBottomLeft: (d: ChartData) => { |
| 73 | if (d[y[0].value] && d[y[0].value] < 0) { |
nothing calls this directly
no test coverage detected