@@ -8,54 +8,54 @@ export function stackX(stackOptions = {}, options = {}) {
8
8
if ( arguments . length === 1 ) [ stackOptions , options ] = mergeOptions ( stackOptions ) ;
9
9
const { y1, y = y1 , x, ...rest } = options ; // note: consumes x!
10
10
const [ transform , Y , x1 , x2 ] = stack ( y , x , "y" , "x" , stackOptions , rest ) ;
11
- return { ...transform , y1, y : Y , x1, x2, x : mid ( x1 , x2 ) } ;
11
+ return { ...transform , y1, y : Y , x1, x2, x : mid ( x1 , x2 ) , tooltipAxis : "y" } ;
12
12
}
13
13
14
14
export function stackX1 ( stackOptions = { } , options = { } ) {
15
15
if ( arguments . length === 1 ) [ stackOptions , options ] = mergeOptions ( stackOptions ) ;
16
16
const { y1, y = y1 , x} = options ;
17
17
const [ transform , Y , X ] = stack ( y , x , "y" , "x" , stackOptions , options ) ;
18
- return { ...transform , y1, y : Y , x : X } ;
18
+ return { ...transform , y1, y : Y , x : X , tooltipAxis : "y" } ;
19
19
}
20
20
21
21
export function stackX2 ( stackOptions = { } , options = { } ) {
22
22
if ( arguments . length === 1 ) [ stackOptions , options ] = mergeOptions ( stackOptions ) ;
23
23
const { y1, y = y1 , x} = options ;
24
24
const [ transform , Y , , X ] = stack ( y , x , "y" , "x" , stackOptions , options ) ;
25
- return { ...transform , y1, y : Y , x : X } ;
25
+ return { ...transform , y1, y : Y , x : X , tooltipAxis : "y" } ;
26
26
}
27
27
28
28
export function stackY ( stackOptions = { } , options = { } ) {
29
29
if ( arguments . length === 1 ) [ stackOptions , options ] = mergeOptions ( stackOptions ) ;
30
30
const { x1, x = x1 , y, ...rest } = options ; // note: consumes y!
31
31
const [ transform , X , y1 , y2 ] = stack ( x , y , "x" , "y" , stackOptions , rest ) ;
32
- return { ...transform , x1, x : X , y1, y2, y : mid ( y1 , y2 ) } ;
32
+ return { ...transform , x1, x : X , y1, y2, y : mid ( y1 , y2 ) , tooltipAxis : "x" } ;
33
33
}
34
34
35
35
export function stackY1 ( stackOptions = { } , options = { } ) {
36
36
if ( arguments . length === 1 ) [ stackOptions , options ] = mergeOptions ( stackOptions ) ;
37
37
const { x1, x = x1 , y} = options ;
38
38
const [ transform , X , Y ] = stack ( x , y , "x" , "y" , stackOptions , options ) ;
39
- return { ...transform , x1, x : X , y : Y } ;
39
+ return { ...transform , x1, x : X , y : Y , tooltipAxis : "x" } ;
40
40
}
41
41
42
42
export function stackY2 ( stackOptions = { } , options = { } ) {
43
43
if ( arguments . length === 1 ) [ stackOptions , options ] = mergeOptions ( stackOptions ) ;
44
44
const { x1, x = x1 , y} = options ;
45
45
const [ transform , X , , Y ] = stack ( x , y , "x" , "y" , stackOptions , options ) ;
46
- return { ...transform , x1, x : X , y : Y } ;
46
+ return { ...transform , x1, x : X , y : Y , tooltipAxis : "x" } ;
47
47
}
48
48
49
49
export function maybeStackX ( { x, x1, x2, ...options } = { } ) {
50
50
if ( x1 === undefined && x2 === undefined ) return stackX ( { x, ...options } ) ;
51
51
[ x1 , x2 ] = maybeZero ( x , x1 , x2 ) ;
52
- return { ...options , x1, x2} ;
52
+ return { ...options , x1, x2, tooltipAxis : "x" } ;
53
53
}
54
54
55
55
export function maybeStackY ( { y, y1, y2, ...options } = { } ) {
56
56
if ( y1 === undefined && y2 === undefined ) return stackY ( { y, ...options } ) ;
57
57
[ y1 , y2 ] = maybeZero ( y , y1 , y2 ) ;
58
- return { ...options , y1, y2} ;
58
+ return { ...options , y1, y2, tooltipAxis : "y" } ;
59
59
}
60
60
61
61
// The reverse option is ambiguous: it is both a stack option and a basic
0 commit comments