@@ -13,8 +13,16 @@ import { ScatterOptions } from './types';
13
13
*/
14
14
function geometry ( params : Params < ScatterOptions > ) : Params < ScatterOptions > {
15
15
const { chart, options } = params ;
16
- const { data, type, color, shape, size, pointStyle, colorField } = options ;
16
+ const { data, type, color, shape, size, pointStyle, shapeField , colorField, xField , yField , sizeField } = options ;
17
17
18
+ let { tooltip } = options ;
19
+
20
+ if ( tooltip && ! tooltip . fields ) {
21
+ tooltip = {
22
+ ...tooltip ,
23
+ fields : [ xField , yField , colorField , sizeField , shapeField ] ,
24
+ } ;
25
+ }
18
26
// 数据
19
27
chart . data ( data ) ;
20
28
@@ -29,6 +37,7 @@ function geometry(params: Params<ScatterOptions>): Params<ScatterOptions> {
29
37
size,
30
38
style : pointStyle ,
31
39
} ,
40
+ tooltip,
32
41
} ,
33
42
} )
34
43
) ;
@@ -216,13 +225,12 @@ function regressionLine(params: Params<ScatterOptions>): Params<ScatterOptions>
216
225
*/
217
226
export function tooltip ( params : Params < ScatterOptions > ) : Params < ScatterOptions > {
218
227
const { chart, options } = params ;
219
- const { tooltip, shapeField , colorField , xField , yField , sizeField } = options ;
228
+ const { tooltip } = options ;
220
229
221
230
if ( tooltip ) {
222
- chart . tooltip ( {
223
- fields : [ xField , yField , colorField , sizeField , shapeField ] ,
224
- ...tooltip ,
225
- } ) ;
231
+ chart . tooltip ( tooltip ) ;
232
+ } else if ( tooltip === false ) {
233
+ chart . tooltip ( false ) ;
226
234
}
227
235
228
236
return params ;
0 commit comments