1
1
import { Geometry , Chart } from '@antv/g2' ;
2
2
import { deepMix , isFunction } from '@antv/util' ;
3
3
import { Params } from '../../core/adaptor' ;
4
+ import { findGeometry } from '../../common/helper' ;
4
5
import { flow , pick } from '../../utils' ;
5
6
import { ColumnOptions } from './types' ;
6
7
import { AXIS_META_CONFIG_KEYS } from '../../constant' ;
7
8
8
- function findGeometry ( chart : Chart ) : Geometry | undefined {
9
- return chart . geometries . find ( ( g : Geometry ) => g . type === 'interval' ) ;
10
- }
11
-
12
9
/**
13
10
* 字段
14
11
* @param params
@@ -61,7 +58,7 @@ function axis(params: Params<ColumnOptions>): Params<ColumnOptions> {
61
58
}
62
59
63
60
if ( yAxis === false ) {
64
- chart . axis ( xField , false ) ;
61
+ chart . axis ( yField , false ) ;
65
62
} else {
66
63
chart . axis ( yField , yAxis ) ;
67
64
}
@@ -92,7 +89,7 @@ function style(params: Params<ColumnOptions>): Params<ColumnOptions> {
92
89
const { chart, options } = params ;
93
90
const { xField, yField, colorField, columnStyle } = options ;
94
91
95
- const geometry = findGeometry ( chart ) ;
92
+ const geometry = findGeometry ( chart , 'interval' ) ;
96
93
if ( columnStyle && geometry ) {
97
94
if ( isFunction ( columnStyle ) ) {
98
95
geometry . style ( colorField ? `${ xField } *${ yField } *${ colorField } ` : `${ xField } *${ yField } ` , columnStyle ) ;
@@ -111,7 +108,7 @@ function label(params: Params<ColumnOptions>): Params<ColumnOptions> {
111
108
const { chart, options } = params ;
112
109
const { label, yField } = options ;
113
110
114
- const geometry = findGeometry ( chart ) ;
111
+ const geometry = findGeometry ( chart , 'interval' ) ;
115
112
116
113
if ( ! label ) {
117
114
geometry . label ( false ) ;
0 commit comments